Skip to content

Commit 96ab31d

Browse files
authored
Update LuaApi.cpp - Add maps.isPlantInBox
1 parent 174aa2e commit 96ab31d

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

library/LuaApi.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2531,6 +2531,20 @@ static int maps_getPlantAtTile(lua_State *L)
25312531
return 1;
25322532
}
25332533

2534+
static int maps_isPlantInBox(lua_State *state)
2535+
{
2536+
auto plant = Lua::CheckDFObject<df::plant>(state, 1);
2537+
int x1 = luaL_checkint(state, 2);
2538+
int y1 = luaL_checkint(state, 3);
2539+
int z1 = luaL_checkint(state, 4);
2540+
int x2 = luaL_checkint(state, 5);
2541+
int y2 = luaL_checkint(state, 6);
2542+
int z2 = luaL_checkint(state, 7);
2543+
2544+
lua_pushboolean(state, Maps::isPlantInBox(plant, x1, y1, z1, x2, y2, z2));
2545+
return 1;
2546+
}
2547+
25342548
static int maps_getBiomeType(lua_State *L)
25352549
{
25362550
auto pos = CheckCoordXY(L, 1, true);
@@ -2596,6 +2610,7 @@ static const luaL_Reg dfhack_maps_funcs[] = {
25962610
{ "getRegionBiome", maps_getRegionBiome },
25972611
{ "getTileBiomeRgn", maps_getTileBiomeRgn },
25982612
{ "getPlantAtTile", maps_getPlantAtTile },
2613+
{ "isPlantInBox", maps_isPlantInBox },
25992614
{ "getBiomeType", maps_getBiomeType },
26002615
{ "isTileAquifer", maps_isTileAquifer },
26012616
{ "isTileHeavyAquifer", maps_isTileHeavyAquifer },

0 commit comments

Comments
 (0)