@ -3267,8 +3267,8 @@ Implements a trivial single-inheritance class system.
1. An empty instance table is created, and its metatable set.
1. An empty instance table is created, and its metatable set.
2. The ``preinit`` methods are called via ``invoke_before`` (see below)
2. The ``preinit`` methods are called via ``invoke_before`` (see below)
with the table used as argument to the class. These methods are intended
with the table used as the argument to the class. These methods are
for validating and tweaking that argument table.
intended for validating and tweaking that argument table.
3. Declared ATTRS are initialized from the argument table or their default values.
3. Declared ATTRS are initialized from the argument table or their default values.
4. The ``init`` methods are called via ``invoke_after`` with the argument table.
4. The ``init`` methods are called via ``invoke_after`` with the argument table.
This is the main constructor method.
This is the main constructor method.
@ -3339,7 +3339,7 @@ A module for reading custom tokens added to the raws by mods.
Where ``typeInstance`` is a unit, entity, item, job, projectile, building, plant, or interaction
Where ``typeInstance`` is a unit, entity, item, job, projectile, building, plant, or interaction
instance. Gets ``typeDefinition`` and then returns the same as ``getToken(typeDefinition, token)``.
instance. Gets ``typeDefinition`` and then returns the same as ``getToken(typeDefinition, token)``.
For units, it gets the token from the race or caste instead if appplicable. For plants growth items,
For units, it gets the token from the race or caste instead if applicable. For plants growth items,
it gets the token from the plant or plant growth instead if applicable. For plants it does the same
it gets the token from the plant or plant growth instead if applicable. For plants it does the same
but with growth number -1.
but with growth number -1.
@ -3661,7 +3661,7 @@ It also always has the following fields:
These fields are computed by the layout process:
These fields are computed by the layout process:
:frame_parent_rect:The ViewRect represeting the client area of the parent view.
:frame_parent_rect:The ViewRect representing the client area of the parent view.
:frame_rect:The ``mkdims`` rect of the outer frame in parent-local coordinates.
:frame_rect:The ``mkdims`` rect of the outer frame in parent-local coordinates.
:frame_body:The ViewRect representing the body part of the View's own frame.
:frame_body:The ViewRect representing the body part of the View's own frame.
@ -3897,13 +3897,13 @@ Base of all the widgets. Inherits from View and has the following attributes:
:r:gap between the right edges of the frame and the parent.
:r:gap between the right edges of the frame and the parent.
:b:gap between the bottom edges of the frame and the parent.
:b:gap between the bottom edges of the frame and the parent.
:w:maximum width of the frame.
:w:maximum width of the frame.
:h:maximum heigth of the frame.
:h:maximum height of the frame.
:xalign:X alignment of the frame.
:xalign:X alignment of the frame.
:yalign:Y alignment of the frame.
:yalign:Y alignment of the frame.
First the ``l,t,r,b`` fields restrict the available area for
First the ``l,t,r,b`` fields restrict the available area for
placing the frame. If ``w`` and ``h`` are not specified or
placing the frame. If ``w`` and ``h`` are not specified or
larger then the computed area, it becomes the frame. Otherwise
larger than the computed area, it becomes the frame. Otherwise
the smaller frame is placed within the are based on the
the smaller frame is placed within the are based on the
``xalign/yalign`` fields. If the align hints are omitted, they
``xalign/yalign`` fields. If the align hints are omitted, they
are assumed to be 0, 1, or 0.5 based on which of the ``l/r/t/b``
are assumed to be 0, 1, or 0.5 based on which of the ``l/r/t/b``
@ -4437,7 +4437,7 @@ Functions
..note:: this is the only mandatory field.
..note:: this is the only mandatory field.
:fix_impassible:
:fix_impassible:
if true make impassible tiles impassible to liquids too
if true make impassable tiles impassable to liquids too
:consume:
:consume:
how much machine power is needed to work.
how much machine power is needed to work.
Disables reactions if not supplied enough and ``needs_power==1``
Disables reactions if not supplied enough and ``needs_power==1``
@ -4461,7 +4461,7 @@ Functions
:canBeRoomSubset:
:canBeRoomSubset:
a flag if this building can be counted in room. 1 means it can, 0 means it can't and -1 default building behaviour
a flag if this building can be counted in room. 1 means it can, 0 means it can't and -1 default building behaviour
:auto_gears:
:auto_gears:
a flag that automatically fills up gears and animate. It looks over building definition for gear icons and maps them.
a flag that automatically fills up gears and animations. It looks over the building definition for gear icons and maps them.
Animate table also might contain:
Animate table also might contain:
@ -4472,7 +4472,7 @@ Functions
``getPower(building)`` returns two number - produced and consumed power if building can be modified and returns nothing otherwise
``getPower(building)`` returns two number - produced and consumed power if building can be modified and returns nothing otherwise
``setPower(building,produced,consumed)`` sets current productiona and consumption for a building.
``setPower(building,produced,consumed)`` sets current power production and consumption for a building.
Examples
Examples
--------
--------
@ -4506,7 +4506,7 @@ Native functions provided by the `buildingplan` plugin:
* ``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 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.
* ``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 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 doCycle()`` runs a check for whether buildings 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.
* ``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.
@ -4796,7 +4796,7 @@ These events are straight from EventManager module. Each of them first needs to
4. ``onJobCompleted(job)``
4. ``onJobCompleted(job)``
Gets called when job is finished. The job that is passed to this function is a copy. Requires a frequency of 0 in order to distinguish between workshop jobs that were cancelled by the user and workshop jobs that completed successfully.
Gets called when job is finished. The job that is passed to this function is a copy. Requires a frequency of 0 in order to distinguish between workshop jobs that were canceled by the user and workshop jobs that completed successfully.
5. ``onUnitDeath(unit_id)``
5. ``onUnitDeath(unit_id)``
@ -4855,7 +4855,7 @@ Functions
5. ``registerSidebar(shop_name,callback)``
5. ``registerSidebar(shop_name,callback)``
Enable callback when sidebar for ``shop_name`` is drawn. Usefull for custom workshop views e.g. using gui.dwarfmode lib. Also accepts a ``class`` instead of function
Enable callback when sidebar for ``shop_name`` is drawn. Useful for custom workshop views e.g. using gui.dwarfmode lib. Also accepts a ``class`` instead of function
as callback. Best used with ``gui.dwarfmode`` class ``WorkshopOverlay``.
as callback. Best used with ``gui.dwarfmode`` class ``WorkshopOverlay``.
Examples
Examples
@ -4898,7 +4898,7 @@ luasocket
=========
=========
A way to access csocket from lua. The usage is made similar to luasocket in vanilla lua distributions. Currently
A way to access csocket from lua. The usage is made similar to luasocket in vanilla lua distributions. Currently
only subset of functions exist and only tcp mode is implemented.
only a subset of the functions exist and only tcp mode is implemented.
..contents::
..contents::
:local:
:local:
@ -4977,7 +4977,7 @@ Functions
- ``render_map_rect(x,y,z,w,h)``
- ``render_map_rect(x,y,z,w,h)``
returns a table with w*h*4 entries of rendered tiles. The format is same as ``df.global.gps.screen`` (tile,foreground,bright,background).
returns a table with w*h*4 entries of rendered tiles. The format is the same as ``df.global.gps.screen`` (tile,foreground,bright,background).
.._pathable-api:
.._pathable-api:
@ -5094,7 +5094,7 @@ Scripts
:local:
:local:
Any files with the ``.lua`` extension placed into the :file:`hack/scripts` folder
Any files with the ``.lua`` extension placed into the :file:`hack/scripts` folder
are automatically made avaiable as DFHack commands. The command corresponding to
are automatically made available as DFHack commands. The command corresponding to
a script is simply the script's filename, relative to the scripts folder, with
a script is simply the script's filename, relative to the scripts folder, with