Sfoglia il codice sorgente

Unified interface for object template.

DjWarmonger 10 anni fa
parent
commit
f894abe494

+ 10 - 3
config/objects/moddables.json

@@ -150,13 +150,20 @@
 			"black" :  { "index" : 7 }
 		}
 	},
+	//Seer Hut object is set off bottom-right corner, need to fix that
 	"seerHut" : {
 		"index" :83,
 		"handler": "seerHut",
+		"base" : {
+			"base" : {
+				"visitableFrom" : [ "---", "+++", "+++" ],
+				"mask" : [ "VVV", "VAV" ]
+			}
+		},
 		"types" : {
-			"0" :  { "index" : 0 },
-			"1" :  { "index" : 1 },
-			"2" :    { "index" : 2 }
+			"0" :	{ "index" : 0 },
+			"1" :	{ "index" : 1 },
+			"2" :	{ "index" : 2 }
 		}
 	},
 

+ 1 - 1
lib/mapObjects/ObjectTemplate.cpp

@@ -329,7 +329,7 @@ int3 ObjectTemplate::getBlockMapOffset() const
 		for(int h = 0; h < getHeight(); ++h)
 		{
 			if (isBlockedAt(w, h))
-				return int3(-w, -h, 0);
+				return int3(w, h, 0);
 		}
 	}
 	return int3(-1,-1,-1);

+ 1 - 1
lib/rmg/CRmgTemplateZone.cpp

@@ -1447,7 +1447,7 @@ void CRmgTemplateZone::createObstacles(CMapGenerator* gen)
 	auto tryToPlaceObstacleHere = [this, gen, &possibleObstacles](int3& tile, int index)-> bool
 	{
 		auto temp = *RandomGeneratorUtil::nextItem(possibleObstacles[index].second, gen->rand);
-		int3 obstaclePos = tile - temp.getBlockMapOffset();
+		int3 obstaclePos = tile + temp.getBlockMapOffset();
 		if (canObstacleBePlacedHere(gen, temp, obstaclePos)) //can be placed here
 		{
 			auto obj = VLC->objtypeh->getHandlerFor(temp.id, temp.subid)->create(temp);