diff --git a/CMakeLists.txt b/CMakeLists.txt index 41c38bd44..50d50d18d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,7 +121,7 @@ ADD_DEFINITIONS(-DPROTOBUF_USE_DLLS) ADD_DEFINITIONS(-DLUA_BUILD_AS_DLL) if(APPLE) - add_definitions(-D_DARWIN) + add_definitions(-D_DARWIN) elseif(UNIX) add_definitions(-D_LINUX) elseif(WIN32) @@ -172,6 +172,7 @@ IF(BUILD_LIBRARY) add_subdirectory (library) ## install the default documentation files install(FILES LICENSE "Lua API.html" Readme.html Compile.html Contributors.html DESTINATION ${DFHACK_USERDOC_DESTINATION}) + install(DIRECTORY images DESTINATION ${DFHACK_USERDOC_DESTINATION}) endif() #build the plugins @@ -181,11 +182,11 @@ endif() # Packaging with CPack! IF(UNIX) - if(APPLE) - SET(CPACK_GENERATOR "ZIP") - else() - SET(CPACK_GENERATOR "TGZ") - endif() + if(APPLE) + SET(CPACK_GENERATOR "ZIP") + else() + SET(CPACK_GENERATOR "TGZ") + endif() ELSEIF(WIN32) SET(CPACK_GENERATOR "ZIP") ENDIF() diff --git a/Lua API.html b/Lua API.html index 226afa98a..e5318165d 100644 --- a/Lua API.html +++ b/Lua API.html @@ -404,7 +404,10 @@ ul.auto-toc {
The current version of DFHack has extensive support for @@ -1034,6 +1037,9 @@ can be omitted.
dfhack.getHackPath()
Returns the dfhack directory path, i.e. ".../df/hack/".
dfhack.getSavePath()
+Returns the path to the current save directory, or nil if no save loaded.
+dfhack.getTickCount()
Returns the tick count in ms, exactly as DF ui uses.
dfhack.job.printItemDetails(jobitem,idx)
Prints info about the job item.
dfhack.job.getGeneralRef(job, type)
+Searches for a general_ref with the given type.
+dfhack.job.getSpecificRef(job, type)
+Searches for a specific_ref with the given type.
+dfhack.job.getHolder(job)
Returns the building holding the job.
dfhack.units.getPosition(unit)
Returns true x,y,z of the unit, or nil if invalid; may be not equal to unit.pos if caged.
dfhack.units.getGeneralRef(unit, type)
+Searches for a general_ref with the given type.
+dfhack.units.getSpecificRef(unit, type)
+Searches for a specific_ref with the given type.
+dfhack.units.getContainer(unit)
Returns the container (cage) item or nil.
dfhack.units.getEffectiveSkill(unit, skill)
Computes the effective rating for the given skill, taking into account exhaustion, pain etc.
dfhack.units.getExperience(unit, skill[, total])
+Returns the experience value for the given skill. If total is true, adds experience implied by the current rating.
+dfhack.units.computeMovementSpeed(unit)
Computes number of frames * 100 it takes the unit to move in its current state of mind and body.
dfhack.buildings.getGeneralRef(building, type)
+Searches for a general_ref with the given type.
+dfhack.buildings.getSpecificRef(building, type)
+Searches for a specific_ref with the given type.
+dfhack.buildings.setOwner(item,unit)
Replaces the owner of the building. If unit is nil, removes ownership. Returns false in case of error.
@@ -1728,7 +1755,10 @@ options; if multiple interpretations exist, the table will contain multiple keysMaps to an integer in range 0-255. Duplicates a separate "STRING_A???" code for convenience.
If the left or right mouse button is pressed.
+If the left or right mouse button is being pressed.
+If the left or right mouse button was just pressed.
If this method is omitted, the screen is dismissed on receival of the LEAVESCREEN key.
@@ -1763,9 +1793,17 @@ global environment, persistent between calls to the script.dfhack.internal.getVTable(name)
Returns the pre-extracted vtable address name, or nil.
dfhack.internal.getImageBase()
+Returns the mmap base of the executable.
+dfhack.internal.getRebaseDelta()
Returns the ASLR rebase offset of the DF executable.
dfhack.internal.adjustOffset(offset[,to_file])
+Returns the re-aligned offset, or nil if invalid. +If to_file is true, the offset is adjusted from memory to file. +This function returns the original value everywhere except windows.
+dfhack.internal.getMemRanges()
Returns a sequence of tables describing virtual memory ranges of the process.
token.tile = pen
Specifies a pen to paint as one tile before the main part of the token.
token.width = ...
+If specified either as a value or a callback, the text field is padded +or truncated to the specified number.
+token.pad_char = '?'
+If specified together with width, the padding area is filled with +this character instead of just being skipped over.
+token.key = '...'
Specifies the keycode associated with the token. The string description of the key binding is added to the text content of the token.
@@ -2819,11 +2865,16 @@ this may be extended with mouse click support.list:submit()
Call the on_submit callback, as if the Enter key was handled.
list:submit2()
+Call the on_submit2 callback, as if the Shift-Enter key was handled.
+Note that this function lets errors propagate to the caller.
+If a save directory contains a file called raw/init.lua, it is +automatically loaded and executed every time the save is loaded. It +can also define the following functions to be called by dfhack:
+function onStateChange(op) ... end
+Automatically called from the regular onStateChange event as long +as the save is still loaded. This avoids the need to install a hook +into the global dfhack.onStateChange table, with associated +cleanup concerns.
+function onUnload() ... end
+Called when the save containing the script is unloaded. This function +should clean up any global hooks installed by the script.
+Within the init script, the path to the save directory is available as SAVE_PATH.
+