Skip to content

Commit b27a61a

Browse files
committed
docs: change wording on many thingies
1 parent 5360b98 commit b27a61a

File tree

1 file changed

+29
-24
lines changed

1 file changed

+29
-24
lines changed

docs/dev/Lua API.rst

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6522,7 +6522,9 @@ building-hacks
65226522

65236523
This plugin extends DF workshops to support custom powered buildings.
65246524

6525-
.. note:: when using numeric ids for workshops be aware that those id can change between worlds
6525+
.. note::
6526+
When using numeric ids for workshops be aware that those id can change between worlds,
6527+
depending on what other custom types exist in the raws for that world.
65266528

65276529
.. contents::
65286530
:local:
@@ -6532,41 +6534,42 @@ Functions
65326534

65336535
* ``setOwnableBuilding(workshop_type)``
65346536

6535-
Set workshop to be included in zones (such as bedroom or inn).
6537+
Set workshop to be included in zones (such as a bedroom or tavern).
65366538

6537-
:workshop_type: custom workshop string id e.g. ``SOAPMAKER`` or numeric id
6539+
:workshop_type: custom workshop string id, e.g. ``SOAPMAKER`` or numeric id
65386540

65396541
* ``fixImpassible(workshop_type)``
65406542

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

6543-
:workshop_type: custom workshop string id e.g. ``SOAPMAKER`` or numeric id
6545+
:workshop_type: custom workshop string id, e.g. ``SOAPMAKER`` or numeric id
65446546

65456547
* ``setMachineInfo(workshop_type, needs_power, power_consumed, power_produced, connection_points)``
65466548

65476549
Setup and enable machine-like functionality for the workshop. All workshops of this type will have
6548-
this as default power consumption/production. Note: due to implementation limitations
6549-
workshop only connects to other machines if the other machine is build later than this one.
6550+
this as their default power consumption/production. Note: due to implementation limitations,
6551+
workshops only connect to other machines if the other machines are planned after than this one.
65506552

65516553
:workshop_type: custom workshop string id e.g. ``SOAPMAKER`` or numeric id
6552-
:needs_power: only function if it has sufficient power
6553-
:power_consumed: building consumes this amount of power
6554-
:power_produced: output this amount of power
6554+
:needs_power: true if the workshop should only be usable if it has sufficient power
6555+
:power_consumed: buildings of this type consume this amount of power by default
6556+
:power_produced: buildings of this type output this amount of power by default
65556557
:connection_points: a table of ``{x=?,y=?}`` zero-based coordinates that can connect to other machines
65566558

65576559
* ``setMachineInfoAuto(workshop_type, needs_power, power_consumed, power_produced, [gear_tiles])``
65586560

6559-
Same as ``setMachineInfo`` but fills out the ``connection_points`` table from raws placing connection
6560-
points on tiles which have the gear tile. ``gear_tiles`` is an optional array of two tiles that are
6561-
counted as gears in the workshop ascii tile raws. The default gear tiles are ``42`` and ``15``.
6561+
Same as ``setMachineInfo`` but fills out the ``connection_points`` table based on the
6562+
building definition in the raws. It places connection points on tiles which have the gear
6563+
tile. ``gear_tiles`` is an optional array of two tiles that are counted as gears in the
6564+
workshop ascii tile raws. The default gear tiles are ``42`` and ``15``.
65626565

65636566
* ``setAnimationInfo(workshop_type, frames, frame_skip)``
65646567

65656568
Animate workshop by replacing displayed tiles (or graphical tiles). There are two ways this works:
65666569
if ``frame_skip>=0`` then it shows each frame for ``frame_skip`` of frames or if ``frame_skip<0``
6567-
Frames are synchronized to the machine this building is connected to.
6570+
Frames are synchronized with the machines this building is connected to.
65686571

6569-
:workshop_type: custom workshop string id e.g. ``SOAPMAKER`` or numeric id
6572+
:workshop_type: custom workshop string id, e.g. ``SOAPMAKER`` or numeric id
65706573
:frames: table of frames. Each frame is sparse flat table with ids from ``0`` to ``31*31-1``.
65716574
Each frame tile is table of integers from 4 to 8 members long. Tile members are as
65726575
follow: ``tile``, ``foreground color``, ``background color``, ``bright``,
@@ -6577,38 +6580,40 @@ Functions
65776580
:frame_skip: How many ticks to display one frame. If set to negative number (or skipped) frames
65786581
are synchronized with machine animation.
65796582

6580-
* ``setAnimationInfoAuto(workshop_type, make_graphics_too, [frame_length], [gear_tiles])``
6583+
* ``setAnimationInfoAuto(workshop_type, make_graphics_too[, frame_length][, gear_tiles])``
65816584

65826585
Animate workshop as with function above but generate frames automatically. This works by finding
65836586
tiles which have gears and animating them with alternating gear tiles.
65846587

6585-
:workshop_type: custom workshop string id e.g. ``SOAPMAKER`` or numeric id
6588+
:workshop_type: custom workshop string id, e.g. ``SOAPMAKER`` or numeric id
65866589
:make_graphics_too: replace same tiles in graphics mode with tiles from vanilla df mechanism
65876590
:frame_length: How many ticks to display one frame. If set to negative number (or skipped) frames
65886591
are synchronized with machine animation.
65896592
:gear_tiles: Optional array of 2 or 4 indexes. First two define ascii tiles and next two graphics tiles.
65906593
This overrides default gear tiles.
65916594

6592-
* ``setOnUpdate(workshop_type,interval,callback)``
6595+
* ``setOnUpdate(workshop_type, interval, callback)``
65936596

6594-
Setup callback to be called every ``interval`` of ticks for each building of this type. Note: low interval
6595-
numbers and/or many workshops that use this might reduce DF performance.
6597+
Register callback to be called every ``interval`` ticks for each building of this
6598+
type. This can be very expensive if the interval is low and/or there are many
6599+
workshops of this type. Keep these callbacks light!
65966600

6597-
:workshop_type: custom workshop string id e.g. ``SOAPMAKER`` or numeric id
6601+
:workshop_type: custom workshop string id, e.g. ``SOAPMAKER`` or numeric id
65986602
:interval: how many ticks to skip between event triggers
65996603
:callback: function to call. Function signature is ``func(workshop)`` where ``workshop`` is of type
66006604
``df.building_workshopst``
66016605

66026606
* ``getPower(building)``
66036607

6604-
Returns two number - produced and consumed power if building can be modified and returns nothing otherwise.
6608+
If this building is of a type registered with building-hacks, returns values for
6609+
consumed and produced power. Otherwise, returns ``nil``.
66056610

66066611
:building: specific workshop that produces or consumes power
66076612

66086613
* ``setPower(building, power_consumed, power_produced)``
66096614

6610-
Sets current power production and consumption for a specific workshop building. Can be used to make buildings that
6611-
dynamically change power consumption and production.
6615+
Dynamically sets current power production and consumption for a specific workshop
6616+
(which must be of a type registered with building-hacks).
66126617

66136618
:building: specific workshop that produces or consumes power
66146619
:power_consumed: set building to consume this amount of power
@@ -6621,7 +6626,7 @@ Events
66216626
This module exports two events. However only one is documented here and is intended to be used directly. To use
66226627
``onUpdateAction`` instead call ``setOnUpdate`` function.
66236628

6624-
* ``onSetTriggerState(workshop,state)``
6629+
* ``onSetTriggerState(workshop, state)``
66256630

66266631
Notify when building is triggered from linked lever or trap.
66276632

0 commit comments

Comments
 (0)