From 598354d9d4d2271e606f57f720f911f6cfac43cc Mon Sep 17 00:00:00 2001 From: 20k Date: Sat, 21 Jan 2023 20:31:39 +0000 Subject: [PATCH 1/6] getbiometype naming, docs --- docs/dev/Lua API.rst | 6 +++++- library/LuaApi.cpp | 8 ++++++++ library/include/modules/Maps.h | 4 ++-- library/modules/Maps.cpp | 6 +++--- plugins/autofarm.cpp | 2 +- plugins/embark-assistant/survey.cpp | 2 +- 6 files changed, 20 insertions(+), 8 deletions(-) diff --git a/docs/dev/Lua API.rst b/docs/dev/Lua API.rst index ebd82ce19..8b2d8b513 100644 --- a/docs/dev/Lua API.rst +++ b/docs/dev/Lua API.rst @@ -1779,6 +1779,10 @@ Maps module Returns the biome info struct for the given global map region. + ``dfhack.maps.getBiomeType(region_coord2d)`` or ``getBiomeType(x,y)`` + + Returns the biome_type for the given global map region. + * ``dfhack.maps.enableBlockUpdates(block[,flow,temperature])`` Enables updates for liquid flow or temperature, unless already active. @@ -1798,7 +1802,7 @@ Maps module * ``dfhack.maps.getTileBiomeRgn(coords)``, or ``getTileBiomeRgn(x,y,z)`` - Returns *x, y* for use with ``getRegionBiome``. + Returns *x, y* for use with ``getRegionBiome`` and ``getBiomeType``. * ``dfhack.maps.getPlantAtTile(pos)``, or ``getPlantAtTile(x,y,z)`` diff --git a/library/LuaApi.cpp b/library/LuaApi.cpp index 84612f790..ceb79556f 100644 --- a/library/LuaApi.cpp +++ b/library/LuaApi.cpp @@ -2131,6 +2131,13 @@ static int maps_getPlantAtTile(lua_State *L) return 1; } +static int maps_getBiomeType(lua_State *L) +{ + auto pos = CheckCoordXY(L, 1, true); + lua_pushinteger(L, Maps::getBiomeType(pos.x, pos.y)); + return 1; +} + static const luaL_Reg dfhack_maps_funcs[] = { { "isValidTilePos", maps_isValidTilePos }, { "isTileVisible", maps_isTileVisible }, @@ -2141,6 +2148,7 @@ static const luaL_Reg dfhack_maps_funcs[] = { { "getRegionBiome", maps_getRegionBiome }, { "getTileBiomeRgn", maps_getTileBiomeRgn }, { "getPlantAtTile", maps_getPlantAtTile }, + { "getBiomeType", maps_getBiomeType }, { NULL, NULL } }; diff --git a/library/include/modules/Maps.h b/library/include/modules/Maps.h index 225efae17..e468dcf9c 100644 --- a/library/include/modules/Maps.h +++ b/library/include/modules/Maps.h @@ -349,8 +349,8 @@ extern DFHACK_EXPORT df::plant *getPlantAtTile(int32_t x, int32_t y, int32_t z); inline df::plant *getPlantAtTile(df::coord pos) { return getPlantAtTile(pos.x, pos.y, pos.z); } -DFHACK_EXPORT df::enums::biome_type::biome_type GetBiomeType(int world_coord_x, int world_coord_y); -DFHACK_EXPORT df::enums::biome_type::biome_type GetBiomeTypeWithRef(int world_coord_x, int world_coord_y, int world_ref_y_coord); +DFHACK_EXPORT df::enums::biome_type::biome_type getBiomeType(int world_coord_x, int world_coord_y); +DFHACK_EXPORT df::enums::biome_type::biome_type getBiomeTypeWithRef(int world_coord_x, int world_coord_y, int world_ref_y_coord); } diff --git a/library/modules/Maps.cpp b/library/modules/Maps.cpp index e046faa0e..ddcd6078f 100644 --- a/library/modules/Maps.cpp +++ b/library/modules/Maps.cpp @@ -987,7 +987,7 @@ Return the biome type, given a position coordinate expressed in world_tiles The world ref coordinates are used for tropicality determination and may refer to a tile neighboring the "official" one. *****************************************************************************/ -df::enums::biome_type::biome_type Maps::GetBiomeTypeWithRef(int world_coord_x, +df::enums::biome_type::biome_type Maps::getBiomeTypeWithRef(int world_coord_x, int world_coord_y, int world_ref_coord_y ) @@ -1186,7 +1186,7 @@ df::enums::biome_type::biome_type Maps::GetBiomeTypeWithRef(int world_coord_x, Module main function. Return the biome type, given a position coordinate expressed in world_tiles *****************************************************************************/ -df::enums::biome_type::biome_type Maps::GetBiomeType(int world_coord_x, int world_coord_y) +df::enums::biome_type::biome_type Maps::getBiomeType(int world_coord_x, int world_coord_y) { - return Maps::GetBiomeTypeWithRef(world_coord_x, world_coord_y, world_coord_y); + return Maps::getBiomeTypeWithRef(world_coord_x, world_coord_y, world_coord_y); } diff --git a/plugins/autofarm.cpp b/plugins/autofarm.cpp index 566c49355..44253b2f9 100644 --- a/plugins/autofarm.cpp +++ b/plugins/autofarm.cpp @@ -315,7 +315,7 @@ public: biome = biome_type::SUBTERRANEAN_WATER; else { df::coord2d region(Maps::getTileBiomeRgn(df::coord(bb->centerx, bb->centery, bb->z))); - biome = Maps::GetBiomeType(region.x, region.y); + biome = Maps::getBiomeType(region.x, region.y); } farms[biome].push_back(farm); } diff --git a/plugins/embark-assistant/survey.cpp b/plugins/embark-assistant/survey.cpp index 80bf58fbd..9655fa886 100644 --- a/plugins/embark-assistant/survey.cpp +++ b/plugins/embark-assistant/survey.cpp @@ -790,7 +790,7 @@ void embark_assist::survey::high_level_world_survey(embark_assist::defs::geo_dat offset_count++; results.biome_index[l] = world_data->region_map[adjusted.x][adjusted.y].region_id; - results.biome[l] = DFHack::Maps::GetBiomeTypeWithRef(adjusted.x, adjusted.y, k); + results.biome[l] = DFHack::Maps::getBiomeTypeWithRef(adjusted.x, adjusted.y, k); temperature = world_data->region_map[adjusted.x][adjusted.y].temperature; negative = temperature < 0; From aa4cc8ff4153d20ca33a991428d266d6b496b8f7 Mon Sep 17 00:00:00 2001 From: Janeene Beeforth Date: Sun, 22 Jan 2023 16:42:19 +1100 Subject: [PATCH 2/6] Update orders related to bags for v50.x Bags now have their own item type, they're no longer mixed in with boxes --- data/orders/basic.json | 38 ++++++++++++++++---------------------- data/orders/furnace.json | 5 ++--- 2 files changed, 18 insertions(+), 25 deletions(-) diff --git a/data/orders/basic.json b/data/orders/basic.json index b3fae8dcd..1ab67c743 100644 --- a/data/orders/basic.json +++ b/data/orders/basic.json @@ -256,10 +256,9 @@ "condition" : "AtLeast", "flags" : [ - "empty", - "bag" + "empty" ], - "item_type" : "BOX", + "item_type" : "BAG", "value" : 5 } ], @@ -310,10 +309,9 @@ "condition" : "AtLeast", "flags" : [ - "empty", - "bag" + "empty" ], - "item_type" : "BOX", + "item_type" : "BAG", "value" : 5 } ], @@ -844,14 +842,13 @@ "condition" : "AtMost", "flags" : [ - "empty", - "sewn_imageless" + "empty" ], - "item_type" : "BOX", + "item_type" : "BAG", "value" : 30 } ], - "job" : "ConstructChest", + "job" : "ConstructBag", "material_category" : [ "leather" @@ -880,14 +877,13 @@ "condition" : "AtMost", "flags" : [ - "empty", - "sewn_imageless" + "empty" ], - "item_type" : "BOX", + "item_type" : "BAG", "value" : 30 } ], - "job" : "ConstructChest", + "job" : "ConstructBag", "material_category" : [ "silk" @@ -916,14 +912,13 @@ "condition" : "AtMost", "flags" : [ - "empty", - "sewn_imageless" + "empty" ], - "item_type" : "BOX", + "item_type" : "BAG", "value" : 30 } ], - "job" : "ConstructChest", + "job" : "ConstructBag", "material_category" : [ "cloth" @@ -952,14 +947,13 @@ "condition" : "AtMost", "flags" : [ - "empty", - "sewn_imageless" + "empty" ], - "item_type" : "BOX", + "item_type" : "BAG", "value" : 30 } ], - "job" : "ConstructChest", + "job" : "ConstructBag", "material_category" : [ "yarn" diff --git a/data/orders/furnace.json b/data/orders/furnace.json index 54d7d758e..62e389ded 100644 --- a/data/orders/furnace.json +++ b/data/orders/furnace.json @@ -152,10 +152,9 @@ "condition" : "AtLeast", "flags" : [ - "empty", - "bag" + "empty" ], - "item_type" : "BOX", + "item_type" : "BAG", "value" : 10 }, { From 3f9f4fe2439843c584b2979e76f942cc5eb37ef8 Mon Sep 17 00:00:00 2001 From: Janeene Beeforth Date: Sun, 22 Jan 2023 17:02:56 +1100 Subject: [PATCH 3/6] Attempt to fix lye order limits --- data/orders/basic.json | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/data/orders/basic.json b/data/orders/basic.json index 1ab67c743..badcbf85f 100644 --- a/data/orders/basic.json +++ b/data/orders/basic.json @@ -1131,8 +1131,11 @@ }, { "condition" : "AtMost", - "item_type" : "LIQUID_MISC", - "material" : "LYE", + "contains" : + [ + "lye" + ], + "reaction_id" : "MAKE_SOAP_FROM_TALLOW", "value" : 5 } ], @@ -1160,8 +1163,11 @@ }, { "condition" : "AtLeast", - "item_type" : "LIQUID_MISC", - "material" : "LYE", + "contains" : + [ + "lye" + ], + "reaction_id" : "MAKE_SOAP_FROM_TALLOW", "value" : 3 }, { @@ -1194,8 +1200,11 @@ }, { "condition" : "AtLeast", - "item_type" : "LIQUID_MISC", - "material" : "LYE", + "contains" : + [ + "lye" + ], + "reaction_id" : "MAKE_SOAP_FROM_OIL", "value" : 3 }, { From 11befd9726f986bad258c1a75461b9ea153c24fb Mon Sep 17 00:00:00 2001 From: DFHack-Urist via GitHub Actions <63161697+DFHack-Urist@users.noreply.github.com> Date: Sun, 22 Jan 2023 07:13:34 +0000 Subject: [PATCH 4/6] Auto-update submodules scripts: master --- scripts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts b/scripts index 4e97b8095..9666cb8eb 160000 --- a/scripts +++ b/scripts @@ -1 +1 @@ -Subproject commit 4e97b809511660f7b5fc98e82f7d1cfff49395ee +Subproject commit 9666cb8ebcc51f8e4bb2fb99116636793a7e4270 From bb5a3ac8e937a243a8b9e0b9807d191a24c54a77 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Sun, 22 Jan 2023 00:06:03 -0800 Subject: [PATCH 5/6] fix library order for minecarts --- data/orders/basic.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/data/orders/basic.json b/data/orders/basic.json index badcbf85f..16b05e0ba 100644 --- a/data/orders/basic.json +++ b/data/orders/basic.json @@ -723,6 +723,10 @@ }, { "condition" : "AtMost", + "flags" : + [ + "empty" + ], "item_subtype" : "ITEM_TOOL_MINECART", "item_type" : "TOOL", "value" : 2 From 76822ac7b783f0e4be0fb60b3fe29d404d6472ea Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Sun, 22 Jan 2023 00:59:27 -0800 Subject: [PATCH 6/6] remove orphan fortplan.lua file --- plugins/lua/fortplan.lua | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 plugins/lua/fortplan.lua diff --git a/plugins/lua/fortplan.lua b/plugins/lua/fortplan.lua deleted file mode 100644 index 71e69c69d..000000000 --- a/plugins/lua/fortplan.lua +++ /dev/null @@ -1,13 +0,0 @@ -local _ENV = mkmodule('plugins.fortplan') - -require('dfhack.buildings') - -function construct_building_from_params(building_type, x, y, z) - local pos = xyz2pos(x, y, z) - local bld, err = - dfhack.buildings.constructBuilding{type=building_type, pos=pos} - if err then error(err) end - return bld -end - -return _ENV