diff --git a/docs/Lua API.rst b/docs/Lua API.rst index 75196e7b9..5cfd8cf09 100644 --- a/docs/Lua API.rst +++ b/docs/Lua API.rst @@ -1912,7 +1912,8 @@ Constructions module * ``dfhack.constructions.insert(construction)`` - Properly inserts the given construction into the game. + Properly inserts the given construction into the game. Returns false and fails to + insert if there was already a construction at the position. Kitchen module -------------- diff --git a/library/LuaApi.cpp b/library/LuaApi.cpp index 463cf3fcc..4a97a0502 100644 --- a/library/LuaApi.cpp +++ b/library/LuaApi.cpp @@ -2264,6 +2264,7 @@ static const luaL_Reg dfhack_buildings_funcs[] = { static const LuaWrapper::FunctionReg dfhack_constructions_module[] = { WRAPM(Constructions, designateNew), + WRAPM(Constructions, insert), { NULL, NULL } }; @@ -2286,7 +2287,6 @@ static int constructions_findAtTile(lua_State *L) static const luaL_Reg dfhack_constructions_funcs[] = { { "designateRemove", constructions_designateRemove }, { "findAtTile", constructions_findAtTile }, - WRAPM(Constructions, insert), { NULL, NULL } }; diff --git a/library/include/modules/Constructions.h b/library/include/modules/Constructions.h index c7a1c048b..b152381c4 100644 --- a/library/include/modules/Constructions.h +++ b/library/include/modules/Constructions.h @@ -45,6 +45,8 @@ namespace Constructions DFHACK_EXPORT df::construction * findAtTile(df::coord pos); +DFHACK_EXPORT bool insert(df::construction * constr); + DFHACK_EXPORT bool designateNew(df::coord pos, df::construction_type type, df::item_type item = df::item_type::NONE, int mat_index = -1);