@ -344,17 +344,18 @@ ul.auto-toc {
< li > < a class = "reference internal" href = "#maps-module" id = "id18" > Maps module< / a > < / li >
< li > < a class = "reference internal" href = "#burrows-module" id = "id19" > Burrows module< / a > < / li >
< li > < a class = "reference internal" href = "#buildings-module" id = "id20" > Buildings module< / a > < / li >
< li > < a class = "reference internal" href = "#constructions-module" id = "id21" > Constructions module< / a > < / li >
< / ul >
< / li >
< li > < a class = "reference internal" href = "#core-interpreter-context" id = "id2 1 "> Core interpreter context< / a > < ul >
< li > < a class = "reference internal" href = "#event-type" id = "id2 2 "> Event type< / a > < / li >
< li > < a class = "reference internal" href = "#core-interpreter-context" id = "id2 2 "> Core interpreter context< / a > < ul >
< li > < a class = "reference internal" href = "#event-type" id = "id2 3 "> Event type< / a > < / li >
< / ul >
< / li >
< / ul >
< / li >
< li > < a class = "reference internal" href = "#plugins" id = "id2 3 "> Plugins< / a > < ul >
< li > < a class = "reference internal" href = "#burrows" id = "id2 4 "> burrows< / a > < / li >
< li > < a class = "reference internal" href = "#sort" id = "id2 5 "> sort< / a > < / li >
< li > < a class = "reference internal" href = "#plugins" id = "id2 4 "> Plugins< / a > < ul >
< li > < a class = "reference internal" href = "#burrows" id = "id2 5 "> burrows< / a > < / li >
< li > < a class = "reference internal" href = "#sort" id = "id2 6 "> sort< / a > < / li >
< / ul >
< / li >
< / ul >
@ -1068,6 +1069,10 @@ burrows, or the presence of invaders.</p>
< li > < p class = "first" > < tt class = "docutils literal" > dfhack.buildings.getSize(building)< / tt > < / p >
< p > Returns < em > width, height, centerx, centery< / em > .< / p >
< / li >
< li > < p class = "first" > < tt class = "docutils literal" > dfhack.buildings.findAtTile(pos)< / tt > < / p >
< p > Scans the buildings for the one located at the given tile.
Does not work on civzones. Warning: linear scan.< / p >
< / li >
< li > < p class = "first" > < tt class = "docutils literal" > dfhack.buildings.getCorrectSize(width, height, type, subtype, custom, direction)< / tt > < / p >
< p > Computes correct dimensions for the specified building type and orientation,
using width and height for flexible dimensions.
@ -1118,9 +1123,20 @@ from the size of the building.</p>
< p > More high-level functions are implemented in lua and can be loaded by
< tt class = "docutils literal" > < span class = "pre" > require('dfhack.buildings')< / span > < / tt > . See < tt class = "docutils literal" > hack/lua/dfhack/buildings.lua< / tt > .< / p >
< / div >
< div class = "section" id = "constructions-module" >
< h3 > < a class = "toc-backref" href = "#id21" > Constructions module< / a > < / h3 >
< ul >
< li > < p class = "first" > < tt class = "docutils literal" > dfhack.constructions.designateNew(pos,type,item_type,mat_index)< / tt > < / p >
< p > Designates a new construction at given position. If there already is
a planned but not completed construction there, changes its type.
Returns < em > true< / em > or < em > false< / em > if obstructed.
Note that designated constructions are technically buildings.< / p >
< / li >
< / ul >
< / div >
< / div >
< div class = "section" id = "core-interpreter-context" >
< h2 > < a class = "toc-backref" href = "#id21" > Core interpreter context< / a > < / h2 >
< h2 > < a class = "toc-backref" href = "#id2 2 "> Core interpreter context< / a > < / h2 >
< p > While plugins can create any number of interpreter instances,
there is one special context managed by dfhack core. It is the
only context that can receive events from DF and plugins.< / p >
@ -1134,7 +1150,7 @@ only context that can receive events from DF and plugins.</p>
< / li >
< / ul >
< div class = "section" id = "event-type" >
< h3 > < a class = "toc-backref" href = "#id2 2 "> Event type< / a > < / h3 >
< h3 > < a class = "toc-backref" href = "#id2 3 "> Event type< / a > < / h3 >
< p > An event is just a lua table with a predefined metatable that
contains a __call metamethod. When it is invoked, it loops
through the table with next and calls all contained values.
@ -1160,14 +1176,14 @@ order using <tt class="docutils literal">dfhack.safecall</tt>.</p>
< / div >
< / div >
< div class = "section" id = "plugins" >
< h1 > < a class = "toc-backref" href = "#id2 3 "> Plugins< / a > < / h1 >
< h1 > < a class = "toc-backref" href = "#id2 4 "> Plugins< / a > < / h1 >
< p > DFHack plugins may export native functions and events
to lua contexts. They are automatically imported by
< tt class = "docutils literal" > < span class = "pre" > mkmodule('plugins.< name> ')< / span > < / tt > ; this means that a lua
module file is still necessary for < tt class = "docutils literal" > require< / tt > to read.< / p >
< p > The following plugins have lua support.< / p >
< div class = "section" id = "burrows" >
< h2 > < a class = "toc-backref" href = "#id2 4 "> burrows< / a > < / h2 >
< h2 > < a class = "toc-backref" href = "#id2 5 "> burrows< / a > < / h2 >
< p > Implements extended burrow manipulations.< / p >
< p > Events:< / p >
< ul >
@ -1205,7 +1221,7 @@ set is the same as used by the command line.</p>
< p > The lua module file also re-exports functions from < tt class = "docutils literal" > dfhack.burrows< / tt > .< / p >
< / div >
< div class = "section" id = "sort" >
< h2 > < a class = "toc-backref" href = "#id2 5 "> sort< / a > < / h2 >
< h2 > < a class = "toc-backref" href = "#id2 6 "> sort< / a > < / h2 >
< p > Does not export any native functions as of now. Instead, it
calls lua code to perform the actual ordering of list items.< / p >
< / div >