summaryrefslogtreecommitdiffstats
path: root/src/Generating/PrefabPiecePool.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2016-11-21 17:12:01 +0100
committerMattes D <github@xoft.cz>2016-11-24 15:51:53 +0100
commit6b70574da96208a9bf855d0db983d27972ad9281 (patch)
treeab87c4a6c9f58fdfe2495c4fef939f4940df7d96 /src/Generating/PrefabPiecePool.cpp
parentMerge pull request #3442 from Seadragon91/luacheck_config (diff)
downloadcuberite-6b70574da96208a9bf855d0db983d27972ad9281.tar
cuberite-6b70574da96208a9bf855d0db983d27972ad9281.tar.gz
cuberite-6b70574da96208a9bf855d0db983d27972ad9281.tar.bz2
cuberite-6b70574da96208a9bf855d0db983d27972ad9281.tar.lz
cuberite-6b70574da96208a9bf855d0db983d27972ad9281.tar.xz
cuberite-6b70574da96208a9bf855d0db983d27972ad9281.tar.zst
cuberite-6b70574da96208a9bf855d0db983d27972ad9281.zip
Diffstat (limited to '')
-rw-r--r--src/Generating/PrefabPiecePool.cpp54
1 files changed, 44 insertions, 10 deletions
diff --git a/src/Generating/PrefabPiecePool.cpp b/src/Generating/PrefabPiecePool.cpp
index 417f8ce7e..d6c2c8819 100644
--- a/src/Generating/PrefabPiecePool.cpp
+++ b/src/Generating/PrefabPiecePool.cpp
@@ -526,16 +526,15 @@ bool cPrefabPiecePool::ReadPieceMetadataCubesetVer1(
}
// Get the values:
- int AddWeightIfSame = 0, DefaultWeight = 100, MoveToGround = 0, ShouldExpandFloor = 0;
+ int AddWeightIfSame = 0, DefaultWeight = 100, MoveToGround = 0;
AString DepthWeight, MergeStrategy, VerticalLimit, VerticalStrategy;
- a_LuaState.GetNamedValue("AddWeightIfSame", AddWeightIfSame);
- a_LuaState.GetNamedValue("DefaultWeight", DefaultWeight);
- a_LuaState.GetNamedValue("DepthWeight", DepthWeight);
- a_LuaState.GetNamedValue("MergeStrategy", MergeStrategy);
- a_LuaState.GetNamedValue("MoveToGround", MoveToGround);
- a_LuaState.GetNamedValue("ShouldExpandFloor", ShouldExpandFloor);
- a_LuaState.GetNamedValue("VerticalLimit", VerticalLimit);
- a_LuaState.GetNamedValue("VerticalStrategy", VerticalStrategy);
+ a_LuaState.GetNamedValue("AddWeightIfSame", AddWeightIfSame);
+ a_LuaState.GetNamedValue("DefaultWeight", DefaultWeight);
+ a_LuaState.GetNamedValue("DepthWeight", DepthWeight);
+ a_LuaState.GetNamedValue("MergeStrategy", MergeStrategy);
+ a_LuaState.GetNamedValue("MoveToGround", MoveToGround);
+ a_LuaState.GetNamedValue("VerticalLimit", VerticalLimit);
+ a_LuaState.GetNamedValue("VerticalStrategy", VerticalStrategy);
// Apply the values:
a_Prefab->SetAddWeightIfSame(AddWeightIfSame);
@@ -555,7 +554,42 @@ bool cPrefabPiecePool::ReadPieceMetadataCubesetVer1(
a_Prefab->SetMergeStrategy(strategy->second);
}
a_Prefab->SetMoveToGround(MoveToGround != 0);
- a_Prefab->SetExtendFloor(ShouldExpandFloor != 0);
+
+ AString ExpandFloorStrategyStr;
+ if (!a_LuaState.GetNamedValue("ExpandFloorStrategy", ExpandFloorStrategyStr))
+ {
+ // Check the older variant for ExpandFloorStrategy, ShouldExpandFloor:
+ int ShouldExpandFloor;
+ if (a_LuaState.GetNamedValue("ShouldExpandFloor", ShouldExpandFloor))
+ {
+ LOG("Piece \"%s\" in file \"%s\" is using the old \"ShouldExpandFloor\" attribute. Use the new \"ExpandFloorStrategy\" attribute instead for more options.",
+ a_PieceName.c_str(), a_FileName.c_str()
+ );
+ a_Prefab->SetExtendFloorStrategy((ShouldExpandFloor != 0) ? cPrefab::efsRepeatBottomTillNonAir : cPrefab::efsNone);
+ }
+ }
+ else
+ {
+ auto lcExpandFloorStrategyStr = StrToLower(ExpandFloorStrategyStr);
+ if (lcExpandFloorStrategyStr == "repeatbottomtillnonair")
+ {
+ a_Prefab->SetExtendFloorStrategy(cPrefab::efsRepeatBottomTillNonAir);
+ }
+ else if (lcExpandFloorStrategyStr == "repeatbottomtillsolid")
+ {
+ a_Prefab->SetExtendFloorStrategy(cPrefab::efsRepeatBottomTillSolid);
+ }
+ else
+ {
+ if (lcExpandFloorStrategyStr != "none")
+ {
+ LOGWARNING("Piece \"%s\" in file \"%s\" is using an unknown \"ExpandFloorStrategy\" attribute value: \"%s\"",
+ a_PieceName.c_str(), a_FileName.c_str(), ExpandFloorStrategyStr.c_str()
+ );
+ }
+ a_Prefab->SetExtendFloorStrategy(cPrefab::efsNone);
+ }
+ }
if (!VerticalLimit.empty())
{
if (!a_Prefab->SetVerticalLimitFromString(VerticalLimit, a_LogWarnings))