diff --git a/docs/Lua API.rst b/docs/Lua API.rst index 633ae2278..31e48015a 100644 --- a/docs/Lua API.rst +++ b/docs/Lua API.rst @@ -3616,8 +3616,9 @@ buildingplan Native functions: -* ``bool isPlannableBuilding(df::building_type type)`` returns whether the building type is handled by buildingplan -* ``void addPlannedBuilding(df::building *bld)`` suspends the building jobs and adds the building to the monitor list +* ``bool isEnabled()`` returns whether the plugin is enabled. +* ``bool isPlannableBuilding(df::building_type type)`` returns whether the building type is handled by buildingplan. +* ``void addPlannedBuilding(df::building *bld)`` suspends the building jobs and adds the building to the monitor list. * ``void doCycle()`` runs a check for whether buildlings in the monitor list can be assigned items and unsuspended. This method runs automatically twice a game day, so you only need to call it directly if you want buildingplan to do a check right now. burrows diff --git a/plugins/buildingplan.cpp b/plugins/buildingplan.cpp index c42aeac53..4b91d0f84 100644 --- a/plugins/buildingplan.cpp +++ b/plugins/buildingplan.cpp @@ -418,6 +418,10 @@ DFhackCExport command_result plugin_onstatechange(color_ostream &out, state_chan // Lua API section +static bool isEnabled() { + return is_enabled; +} + static bool isPlannableBuilding(df::building_type type) { return planner.isPlanableBuilding(type); } @@ -431,6 +435,7 @@ static void doCycle() { } DFHACK_PLUGIN_LUA_FUNCTIONS { + DFHACK_LUA_FUNCTION(isEnabled), DFHACK_LUA_FUNCTION(isPlannableBuilding), DFHACK_LUA_FUNCTION(addPlannedBuilding), DFHACK_LUA_FUNCTION(doCycle), diff --git a/plugins/lua/buildingplan.lua b/plugins/lua/buildingplan.lua index 071c07395..6bf60f4b8 100644 --- a/plugins/lua/buildingplan.lua +++ b/plugins/lua/buildingplan.lua @@ -4,6 +4,7 @@ local _ENV = mkmodule('plugins.buildingplan') Native functions: + * bool isEnabled() * bool isPlannableBuilding(df::building_type type) * void addPlannedBuilding(df::building *bld) * void doCycle()