Skip to content

Commit d47f5e6

Browse files
committed
remove boolean arg from fixImpassible and setOwnableBuilding and doc improvements
1 parent 89f57ed commit d47f5e6

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

docs/dev/Lua API.rst

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6071,29 +6071,30 @@ building-hacks
60716071

60726072
This plugin extends DF workshops to support custom powered buildings.
60736073

6074+
.. note:: when using numeric ids for workshops be aware that those id can change between worlds
6075+
60746076
.. contents::
60756077
:local:
60766078

60776079
Functions
60786080
---------
60796081

6080-
* ``setOwnableBuilding(workshop_type, enable)``
6082+
* ``setOwnableBuilding(workshop_type)``
60816083

60826084
Set workshop to be included in zones (such as bedroom or inn).
60836085

60846086
:workshop_type: custom workshop string id e.g. ``SOAPMAKER`` or numeric id
6085-
:enable: boolean value to enable or disable this functionality
60866087

6087-
* ``fixImpassible(workshop_type, enable)``
6088+
* ``fixImpassible(workshop_type)``
60886089

60896090
Set workshop non walkable tiles to also block liquids (i.e. water and magma).
60906091

60916092
:workshop_type: custom workshop string id e.g. ``SOAPMAKER`` or numeric id
6092-
:enable: boolean value to enable or disable this functionality
60936093

60946094
* ``setMachineInfo(workshop_type, needs_power, power_consumed, power_produced, connection_points)``
60956095

6096-
Setup and enable machine-like functionality for the workshop. Note: due to implementation limitations
6096+
Setup and enable machine-like functionality for the workshop. All workshops of this type will have
6097+
this as default power consumption/production. Note: due to implementation limitations
60976098
workshop only connects to other machines if the other machine is build later than this one.
60986099

60996100
:workshop_type: custom workshop string id e.g. ``SOAPMAKER`` or numeric id
@@ -6140,17 +6141,18 @@ Functions
61406141

61416142
:name: custom workshop string id e.g. ``SOAPMAKER``
61426143
:interval: how many ticks to skip between event triggers
6143-
:callback: function to call
6144+
:callback: function to call. Function signature is ``func(workshop)`` where ``workshop`` is of type
6145+
``df.building_workshopst``
61446146

61456147
* ``getPower(building)``
61466148

61476149
Returns two number - produced and consumed power if building can be modified and returns nothing otherwise.
61486150

61496151
:building: specific workshop that produces or consumes power
61506152

6151-
* ``setPower(building,power_consumed, power_produced)``
6153+
* ``setPower(building, power_consumed, power_produced)``
61526154

6153-
Sets current power production and consumption for a building. Can be used to make buildings that
6155+
Sets current power production and consumption for a specific workshop building. Can be used to make buildings that
61546156
dynamically change power consumption and production.
61556157

61566158
:building: specific workshop that produces or consumes power

plugins/building-hacks.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -461,14 +461,13 @@ static void loadFrames(lua_State* L,workshop_hack_data& def,int stack_pos)
461461
return ;
462462
}
463463

464-
//fixImpassible(workshop_type,bool) - changes how impassible tiles work with liquids. False - default behaviour. True - blocks liquids.
464+
//fixImpassible(workshop_type) - changes how impassible tiles work with liquids.
465465
static int fixImpassible(lua_State* L)
466466
{
467467
int workshop_type = get_workshop_type(L, 1);
468-
bool impassible_setting = lua_toboolean(L, 2);
469468

470469
auto& def = hacked_workshops[workshop_type];
471-
def.impassible_fix = impassible_setting;
470+
def.impassible_fix = true;
472471

473472
enable_hooks(true);
474473

@@ -541,14 +540,13 @@ static int setAnimationInfo(lua_State* L)
541540

542541
return 0;
543542
}
544-
//setOwnableBuilding(workshop_type,bool is_ownable)
543+
//setOwnableBuilding(workshop_type)
545544
static int setOwnableBuilding(lua_State* L)
546545
{
547546
int workshop_type = get_workshop_type(L, 1);
548-
bool room_subset = lua_toboolean(L, 2);
549547

550548
auto& def = hacked_workshops[workshop_type];
551-
def.room_subset = room_subset;
549+
def.room_subset = true;
552550

553551
enable_hooks(true);
554552

0 commit comments

Comments
 (0)