浏览代码

Unified interface for object template.

DjWarmonger 10 年之前
父节点
当前提交
f894abe494
共有 3 个文件被更改,包括 12 次插入5 次删除
  1. 10 3
      config/objects/moddables.json
  2. 1 1
      lib/mapObjects/ObjectTemplate.cpp
  3. 1 1
      lib/rmg/CRmgTemplateZone.cpp

+ 10 - 3
config/objects/moddables.json

@@ -150,13 +150,20 @@
 			"black" :  { "index" : 7 }
 			"black" :  { "index" : 7 }
 		}
 		}
 	},
 	},
+	//Seer Hut object is set off bottom-right corner, need to fix that
 	"seerHut" : {
 	"seerHut" : {
 		"index" :83,
 		"index" :83,
 		"handler": "seerHut",
 		"handler": "seerHut",
+		"base" : {
+			"base" : {
+				"visitableFrom" : [ "---", "+++", "+++" ],
+				"mask" : [ "VVV", "VAV" ]
+			}
+		},
 		"types" : {
 		"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)
 		for(int h = 0; h < getHeight(); ++h)
 		{
 		{
 			if (isBlockedAt(w, h))
 			if (isBlockedAt(w, h))
-				return int3(-w, -h, 0);
+				return int3(w, h, 0);
 		}
 		}
 	}
 	}
 	return int3(-1,-1,-1);
 	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 tryToPlaceObstacleHere = [this, gen, &possibleObstacles](int3& tile, int index)-> bool
 	{
 	{
 		auto temp = *RandomGeneratorUtil::nextItem(possibleObstacles[index].second, gen->rand);
 		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
 		if (canObstacleBePlacedHere(gen, temp, obstaclePos)) //can be placed here
 		{
 		{
 			auto obj = VLC->objtypeh->getHandlerFor(temp.id, temp.subid)->create(temp);
 			auto obj = VLC->objtypeh->getHandlerFor(temp.id, temp.subid)->create(temp);