Merge remote-tracking branch 'myk002/myk_isplannedbuilding' into develop

develop
lethosor 2020-11-13 14:09:36 -05:00
commit 2e4f23d49f
No known key found for this signature in database
GPG Key ID: 76A269552F4F58C1
3 changed files with 7 additions and 0 deletions

@ -3797,6 +3797,7 @@ Native functions provided by the `buildingplan` plugin:
* ``bool isPlannableBuilding(df::building_type type, int16_t subtype, int32_t custom)`` returns whether the building type is handled by buildingplan.
* ``bool isPlanModeEnabled(df::building_type type, int16_t subtype, int32_t custom)`` returns whether the buildingplan UI is enabled for the specified building type.
* ``bool isPlannedBuilding(df::building *bld)`` returns whether the given building is managed 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.
* ``void scheduleCycle()`` schedules a cycle to be run during the next non-paused game frame. Can be called multiple times while the game is paused and only one cycle will be scheduled.

@ -1024,6 +1024,10 @@ static bool isPlannableBuilding(df::building_type type,
toBuildingTypeKey(type, subtype, custom));
}
static bool isPlannedBuilding(df::building *bld) {
return !!planner.getPlannedBuilding(bld);
}
static void addPlannedBuilding(df::building *bld) {
planner.addPlannedBuilding(bld);
}
@ -1049,6 +1053,7 @@ static void setSetting(std::string name, bool value) {
DFHACK_PLUGIN_LUA_FUNCTIONS {
DFHACK_LUA_FUNCTION(isPlanModeEnabled),
DFHACK_LUA_FUNCTION(isPlannableBuilding),
DFHACK_LUA_FUNCTION(isPlannedBuilding),
DFHACK_LUA_FUNCTION(addPlannedBuilding),
DFHACK_LUA_FUNCTION(doCycle),
DFHACK_LUA_FUNCTION(scheduleCycle),

@ -7,6 +7,7 @@ local _ENV = mkmodule('plugins.buildingplan')
* void setSetting(string name, boolean value)
* bool isPlanModeEnabled(df::building_type type, int16_t subtype, int32_t custom)
* bool isPlannableBuilding(df::building_type type, int16_t subtype, int32_t custom)
* bool isPlannedBuilding(df::building *bld)
* void addPlannedBuilding(df::building *bld)
* void doCycle()
* void scheduleCycle()