From 144e0b4dcb91bdb0d6787c4b9c5aad0eaf9b8856 Mon Sep 17 00:00:00 2001 From: expwnent Date: Wed, 2 Jan 2013 11:26:30 -0500 Subject: [PATCH] Digging Invaders: merged eventManager and recent. --- CMakeLists.txt | 13 +- Lua API.html | 81 +- Lua API.rst | 87 +- NEWS | 37 +- Readme.html | 961 +++++++++++------ Readme.rst | 414 +++++++- dfhack.init-example | 57 +- images/assign-rack.png | Bin 0 -> 3892 bytes images/automaterial-mat.png | Bin 0 -> 5187 bytes images/automaterial-pos.png | Bin 0 -> 3007 bytes images/guide-path.png | Bin 0 -> 4871 bytes images/liquids.png | Bin 0 -> 3676 bytes images/manipulator.png | Bin 0 -> 7724 bytes images/manipulator2.png | Bin 0 -> 7558 bytes images/mechanisms.png | Bin 0 -> 3741 bytes images/power-meter.png | Bin 0 -> 4435 bytes images/rename-bld.png | Bin 0 -> 6667 bytes images/rename-prof.png | Bin 0 -> 6190 bytes images/room-list.png | Bin 0 -> 4839 bytes images/search-stockpile.png | Bin 0 -> 5971 bytes images/search.png | Bin 0 -> 4509 bytes images/siege-engine.png | Bin 0 -> 4023 bytes images/tweak-mil-color.png | Bin 0 -> 6967 bytes images/tweak-plate.png | Bin 0 -> 3365 bytes images/workflow-new1.png | Bin 0 -> 6775 bytes images/workflow-new2.png | Bin 0 -> 7793 bytes images/workflow-status.png | Bin 0 -> 5118 bytes images/workflow.png | Bin 0 -> 5779 bytes images/workshop-job-item.png | Bin 0 -> 4806 bytes images/workshop-job-material.png | Bin 0 -> 5553 bytes images/workshop-job.png | Bin 0 -> 6461 bytes library/CMakeLists.txt | 44 +- library/Core.cpp | 57 +- library/Hooks-windows.cpp | 66 +- library/LuaApi.cpp | 22 + library/LuaTools.cpp | 12 + library/MacPool.mm | 14 +- library/Process-darwin.cpp | 96 +- library/Process-linux.cpp | 36 +- library/Process-windows.cpp | 78 +- library/Types.cpp | 18 + library/VersionInfoFactory.cpp | 4 +- library/include/Console.h | 14 +- library/include/DFHack.h | 1 - library/include/DataDefs.h | 2 +- library/include/LuaTools.h | 15 + library/include/MemAccess.h | 25 +- library/include/ModuleFactory.h | 1 - library/include/TileTypes.h | 8 +- library/include/Types.h | 26 + library/include/VersionInfo.h | 2 +- library/include/modules/Buildings.h | 3 + library/include/modules/Graphic.h | 90 +- library/include/modules/Gui.h | 5 + library/include/modules/Job.h | 5 + library/include/modules/MapCache.h | 16 +- library/include/modules/Maps.h | 1 - library/include/modules/Materials.h | 8 +- library/include/modules/Screen.h | 132 +++ library/include/modules/Units.h | 5 + library/include/modules/Vegetation.h | 70 -- library/include/modules/World.h | 49 + library/lua/binpatch.lua | 121 +++ library/lua/dfhack.lua | 43 +- library/lua/gui.lua | 20 +- library/lua/gui/dialogs.lua | 22 +- library/lua/gui/materials.lua | 22 +- library/lua/gui/widgets.lua | 119 ++- library/lua/memscan.lua | 22 +- library/modules/Buildings.cpp | 16 +- library/modules/Graphic.cpp | 74 +- library/modules/Items.cpp | 48 +- library/modules/Job.cpp | 35 +- library/modules/Maps.cpp | 21 +- library/modules/Materials.cpp | 6 +- library/modules/Screen.cpp | 74 +- library/modules/Translation.cpp | 15 + library/modules/Units.cpp | 61 +- library/modules/Vegetation.cpp | 85 -- library/modules/World.cpp | 6 +- library/xml | 2 +- patches/v0.34.11 SDL/armorstand-capacity.dif | 142 +++ patches/v0.34.11 SDL/custom-reagent-size.dif | 91 ++ patches/v0.34.11 SDL/deconstruct-heapfall.dif | 61 ++ patches/v0.34.11 SDL/deconstruct-teleport.dif | 104 ++ .../v0.34.11 SDL/hospital-overstocking.dif | 62 ++ patches/v0.34.11 SDL/training-ammo.dif | 83 ++ patches/v0.34.11 SDL/weaponrack-unassign.dif | 61 ++ .../v0.34.11 linux/armorstand-capacity.dif | 147 +++ .../v0.34.11 linux/custom-reagent-size.dif | 40 + .../v0.34.11 linux/deconstruct-heapfall.dif | 83 ++ .../v0.34.11 linux/deconstruct-teleport.dif | 139 +++ .../v0.34.11 linux/hospital-overstocking.dif | 60 ++ patches/v0.34.11 linux/training-ammo.dif | 85 ++ .../v0.34.11 linux/weaponrack-unassign.dif | 45 + plugins/CMakeLists.txt | 2 + plugins/Dfusion/CMakeLists.txt | 5 +- plugins/Dfusion/dfusion.cpp | 227 +--- plugins/Dfusion/include/OutFile.h | 2 +- plugins/Dfusion/include/functioncall.h | 26 - plugins/Dfusion/include/lua_FunctionCall.h | 14 - plugins/Dfusion/include/lua_Misc.h | 1 - plugins/Dfusion/include/lua_Offsets.h | 13 - plugins/Dfusion/include/lua_VersionInfo.h | 12 - plugins/Dfusion/luafiles/adv_tools/init.lua | 133 --- plugins/Dfusion/luafiles/adv_tools/plugin.lua | 3 - plugins/Dfusion/luafiles/buildingpatterns.lua | 24 - plugins/Dfusion/luafiles/common.lua | 548 ---------- plugins/Dfusion/luafiles/editor.lua | 150 --- plugins/Dfusion/luafiles/embark/a.out | 0 plugins/Dfusion/luafiles/embark/build.bat | 1 - plugins/Dfusion/luafiles/embark/init.lua | 83 -- plugins/Dfusion/luafiles/embark/plugin.lua | 5 - plugins/Dfusion/luafiles/embark/races.txt | 9 - .../Dfusion/luafiles/friendship/friendship.o | Bin 722 -> 0 bytes plugins/Dfusion/luafiles/friendship/init.lua | 45 - .../Dfusion/luafiles/friendship/install.lua | 35 - plugins/Dfusion/luafiles/friendship/patch.lua | 57 - .../Dfusion/luafiles/friendship/plugin.lua | 18 - plugins/Dfusion/luafiles/friendship/races.txt | 8 - .../luafiles/friendship_civ/compile.bat | 1 - .../luafiles/friendship_civ/friendship_c.asm | 41 - .../luafiles/friendship_civ/friendship_c.o | Bin 462 -> 0 bytes .../Dfusion/luafiles/friendship_civ/init.lua | 89 -- .../luafiles/friendship_civ/plugin.lua | 57 - plugins/Dfusion/luafiles/init.lua | 97 -- plugins/Dfusion/luafiles/itempatterns.lua | 62 -- plugins/Dfusion/luafiles/items/plugin.lua | 212 ---- plugins/Dfusion/luafiles/migrants/compile.bat | 1 - plugins/Dfusion/luafiles/migrants/init.lua | 62 -- .../Dfusion/luafiles/migrants/migrants.asm | 20 - plugins/Dfusion/luafiles/migrants/migrants.o | Bin 336 -> 0 bytes plugins/Dfusion/luafiles/migrants/plugin.lua | 5 - plugins/Dfusion/luafiles/migrants/races.txt | 29 - plugins/Dfusion/luafiles/offsets/plugin.lua | 2 - plugins/Dfusion/luafiles/offsets_misc.lua | 48 - plugins/Dfusion/luafiles/patterns.lua | 248 ----- .../luafiles/patterns/supplementary.xml | 7 - .../luafiles/patterns/xml_angavrilov.lua | 55 - plugins/Dfusion/luafiles/patterns2.lua | 29 - .../Dfusion/luafiles/simple_embark/plugin.lua | 15 - plugins/Dfusion/luafiles/tools/init.lua | 497 --------- plugins/Dfusion/luafiles/tools/plugin.lua | 8 - plugins/Dfusion/luafiles/triggers/compile.bat | 1 - .../Dfusion/luafiles/triggers/functions.lua | 20 - .../luafiles/triggers/functions_menu.lua | 12 - plugins/Dfusion/luafiles/triggers/plugin.lua | 107 -- .../Dfusion/luafiles/triggers/triggers.asm | 68 -- plugins/Dfusion/luafiles/triggers/triggers.o | Bin 720 -> 0 bytes .../luafiles/triggers/universalfunc.asm | 14 - plugins/Dfusion/luafiles/utils.lua | 1 - plugins/Dfusion/luafiles/xml_struct.lua | 151 --- plugins/Dfusion/luafiles/xml_types.lua | 734 ------------- .../Dfusion/luafiles/xml_types_windows.lua | 159 --- plugins/Dfusion/src/OutFile.cpp | 18 +- plugins/Dfusion/src/functioncall.cpp | 121 --- plugins/Dfusion/src/lua_FunctionCall.cpp | 39 - plugins/Dfusion/src/lua_Misc.cpp | 99 +- plugins/Dfusion/src/lua_Offsets.cpp | 190 ---- plugins/Dfusion/src/lua_VersionInfo.cpp | 115 -- plugins/advtools.cpp | 8 +- plugins/autodump.cpp | 8 +- plugins/autolabor.cpp | 12 +- plugins/automaterial.cpp | 378 +++++++ plugins/cleaners.cpp | 1 + plugins/cleanowned.cpp | 2 +- plugins/devel/memview.cpp | 242 +++-- plugins/devel/nestboxes.cpp | 74 +- plugins/devel/rprobe.cpp | 24 +- plugins/devel/stockcheck.cpp | 366 +++---- plugins/devel/stripcaged.cpp | 68 +- plugins/devel/tiles.cpp | 1 - plugins/dfstream.cpp | 2 +- plugins/diggingInvaders/diggingInvaders.cpp | 14 +- plugins/filltraffic.cpp | 2 +- plugins/fix-armory.cpp | 38 +- plugins/forceequip.cpp | 682 ++++++------ plugins/getplants.cpp | 2 +- plugins/liquids.cpp | 1 - plugins/lua/dfusion.lua | 240 +++++ plugins/lua/dfusion/adv_tools.lua | 116 ++ plugins/lua/dfusion/embark.lua | 124 +++ .../luafiles/embark => lua/dfusion}/embark.o | Bin 348 -> 369 bytes plugins/lua/dfusion/friendship.lua | 112 ++ plugins/lua/dfusion/friendship.o | Bin 0 -> 854 bytes .../dfusion/srcs}/compile.bat | 0 .../embark => lua/dfusion/srcs}/embark.asm | 6 +- .../dfusion/srcs}/friendship.asm | 10 +- plugins/lua/dfusion/tools.lua | 243 +++++ plugins/lua/reactionhooks.lua | 13 + plugins/lua/workflow.lua | 41 +- plugins/manipulator.cpp | 78 +- plugins/mapexport/mapexport.cpp | 1 + plugins/plants.cpp | 12 +- plugins/prospector.cpp | 1 + plugins/reactionhooks.cpp | 322 ++++++ plugins/ruby/README | 5 +- plugins/ruby/building.rb | 4 +- plugins/ruby/codegen.pl | 18 +- plugins/ruby/item.rb | 2 +- plugins/ruby/map.rb | 62 +- plugins/ruby/ruby-autogen-defs.rb | 71 +- plugins/ruby/ruby.cpp | 110 +- plugins/ruby/ruby.rb | 67 +- plugins/ruby/unit.rb | 210 +++- plugins/search.cpp | 133 ++- plugins/showmood.cpp | 4 +- plugins/steam-engine.cpp | 16 +- plugins/tiletypes.cpp | 1 - plugins/tweak.cpp | 289 ++++- plugins/workflow.cpp | 301 +++++- plugins/zone.cpp | 202 ++-- scripts/autofarm.rb | 165 +++ scripts/autounsuspend.rb | 58 + scripts/binpatch.lua | 44 + scripts/create-items.rb | 161 +++ scripts/deathcause.rb | 45 +- scripts/devel/inspect-screen.lua | 103 ++ scripts/dfusion.lua | 14 + scripts/embark.lua | 53 + scripts/fix/loyaltycascade.rb | 6 +- scripts/fix/stable-temp.lua | 10 +- scripts/growcrops.rb | 4 +- scripts/gui/assign-rack.lua | 26 +- scripts/gui/companion-order.lua | 470 +++++++++ scripts/gui/gm-editor.lua | 245 +++++ scripts/gui/workflow.lua | 998 +++++++++++++++--- scripts/lever.rb | 120 +++ scripts/lua.lua | 46 + scripts/magmasource.rb | 2 +- scripts/region-pops.lua | 34 + scripts/slayrace.rb | 46 +- scripts/soundsense-season.lua | 26 + scripts/stripcaged.rb | 204 ++++ scripts/superdwarf.rb | 2 +- scripts/unsuspend.rb | 17 + 236 files changed, 10121 insertions(+), 6962 deletions(-) create mode 100644 images/assign-rack.png create mode 100644 images/automaterial-mat.png create mode 100644 images/automaterial-pos.png create mode 100644 images/guide-path.png create mode 100644 images/liquids.png create mode 100644 images/manipulator.png create mode 100644 images/manipulator2.png create mode 100644 images/mechanisms.png create mode 100644 images/power-meter.png create mode 100644 images/rename-bld.png create mode 100644 images/rename-prof.png create mode 100644 images/room-list.png create mode 100644 images/search-stockpile.png create mode 100644 images/search.png create mode 100644 images/siege-engine.png create mode 100644 images/tweak-mil-color.png create mode 100644 images/tweak-plate.png create mode 100644 images/workflow-new1.png create mode 100644 images/workflow-new2.png create mode 100644 images/workflow-status.png create mode 100644 images/workflow.png create mode 100644 images/workshop-job-item.png create mode 100644 images/workshop-job-material.png create mode 100644 images/workshop-job.png delete mode 100644 library/include/modules/Vegetation.h create mode 100644 library/lua/binpatch.lua delete mode 100644 library/modules/Vegetation.cpp create mode 100644 patches/v0.34.11 SDL/armorstand-capacity.dif create mode 100644 patches/v0.34.11 SDL/custom-reagent-size.dif create mode 100644 patches/v0.34.11 SDL/deconstruct-heapfall.dif create mode 100644 patches/v0.34.11 SDL/deconstruct-teleport.dif create mode 100644 patches/v0.34.11 SDL/hospital-overstocking.dif create mode 100644 patches/v0.34.11 SDL/training-ammo.dif create mode 100644 patches/v0.34.11 SDL/weaponrack-unassign.dif create mode 100644 patches/v0.34.11 linux/armorstand-capacity.dif create mode 100644 patches/v0.34.11 linux/custom-reagent-size.dif create mode 100644 patches/v0.34.11 linux/deconstruct-heapfall.dif create mode 100644 patches/v0.34.11 linux/deconstruct-teleport.dif create mode 100644 patches/v0.34.11 linux/hospital-overstocking.dif create mode 100644 patches/v0.34.11 linux/training-ammo.dif create mode 100644 patches/v0.34.11 linux/weaponrack-unassign.dif delete mode 100644 plugins/Dfusion/include/functioncall.h delete mode 100644 plugins/Dfusion/include/lua_FunctionCall.h delete mode 100644 plugins/Dfusion/include/lua_Offsets.h delete mode 100644 plugins/Dfusion/include/lua_VersionInfo.h delete mode 100644 plugins/Dfusion/luafiles/adv_tools/init.lua delete mode 100644 plugins/Dfusion/luafiles/adv_tools/plugin.lua delete mode 100644 plugins/Dfusion/luafiles/buildingpatterns.lua delete mode 100644 plugins/Dfusion/luafiles/common.lua delete mode 100644 plugins/Dfusion/luafiles/editor.lua delete mode 100644 plugins/Dfusion/luafiles/embark/a.out delete mode 100644 plugins/Dfusion/luafiles/embark/build.bat delete mode 100644 plugins/Dfusion/luafiles/embark/init.lua delete mode 100644 plugins/Dfusion/luafiles/embark/plugin.lua delete mode 100644 plugins/Dfusion/luafiles/embark/races.txt delete mode 100644 plugins/Dfusion/luafiles/friendship/friendship.o delete mode 100644 plugins/Dfusion/luafiles/friendship/init.lua delete mode 100644 plugins/Dfusion/luafiles/friendship/install.lua delete mode 100644 plugins/Dfusion/luafiles/friendship/patch.lua delete mode 100644 plugins/Dfusion/luafiles/friendship/plugin.lua delete mode 100644 plugins/Dfusion/luafiles/friendship/races.txt delete mode 100644 plugins/Dfusion/luafiles/friendship_civ/compile.bat delete mode 100644 plugins/Dfusion/luafiles/friendship_civ/friendship_c.asm delete mode 100644 plugins/Dfusion/luafiles/friendship_civ/friendship_c.o delete mode 100644 plugins/Dfusion/luafiles/friendship_civ/init.lua delete mode 100644 plugins/Dfusion/luafiles/friendship_civ/plugin.lua delete mode 100644 plugins/Dfusion/luafiles/init.lua delete mode 100644 plugins/Dfusion/luafiles/itempatterns.lua delete mode 100644 plugins/Dfusion/luafiles/items/plugin.lua delete mode 100644 plugins/Dfusion/luafiles/migrants/compile.bat delete mode 100644 plugins/Dfusion/luafiles/migrants/init.lua delete mode 100644 plugins/Dfusion/luafiles/migrants/migrants.asm delete mode 100644 plugins/Dfusion/luafiles/migrants/migrants.o delete mode 100644 plugins/Dfusion/luafiles/migrants/plugin.lua delete mode 100644 plugins/Dfusion/luafiles/migrants/races.txt delete mode 100644 plugins/Dfusion/luafiles/offsets/plugin.lua delete mode 100644 plugins/Dfusion/luafiles/offsets_misc.lua delete mode 100644 plugins/Dfusion/luafiles/patterns.lua delete mode 100644 plugins/Dfusion/luafiles/patterns/supplementary.xml delete mode 100644 plugins/Dfusion/luafiles/patterns/xml_angavrilov.lua delete mode 100644 plugins/Dfusion/luafiles/patterns2.lua delete mode 100644 plugins/Dfusion/luafiles/simple_embark/plugin.lua delete mode 100644 plugins/Dfusion/luafiles/tools/init.lua delete mode 100644 plugins/Dfusion/luafiles/tools/plugin.lua delete mode 100644 plugins/Dfusion/luafiles/triggers/compile.bat delete mode 100644 plugins/Dfusion/luafiles/triggers/functions.lua delete mode 100644 plugins/Dfusion/luafiles/triggers/functions_menu.lua delete mode 100644 plugins/Dfusion/luafiles/triggers/plugin.lua delete mode 100644 plugins/Dfusion/luafiles/triggers/triggers.asm delete mode 100644 plugins/Dfusion/luafiles/triggers/triggers.o delete mode 100644 plugins/Dfusion/luafiles/triggers/universalfunc.asm delete mode 100644 plugins/Dfusion/luafiles/utils.lua delete mode 100644 plugins/Dfusion/luafiles/xml_struct.lua delete mode 100644 plugins/Dfusion/luafiles/xml_types.lua delete mode 100644 plugins/Dfusion/luafiles/xml_types_windows.lua delete mode 100644 plugins/Dfusion/src/functioncall.cpp delete mode 100644 plugins/Dfusion/src/lua_FunctionCall.cpp delete mode 100644 plugins/Dfusion/src/lua_Offsets.cpp delete mode 100644 plugins/Dfusion/src/lua_VersionInfo.cpp create mode 100644 plugins/automaterial.cpp create mode 100644 plugins/lua/dfusion.lua create mode 100644 plugins/lua/dfusion/adv_tools.lua create mode 100644 plugins/lua/dfusion/embark.lua rename plugins/{Dfusion/luafiles/embark => lua/dfusion}/embark.o (55%) create mode 100644 plugins/lua/dfusion/friendship.lua create mode 100644 plugins/lua/dfusion/friendship.o rename plugins/{Dfusion/luafiles/friendship => lua/dfusion/srcs}/compile.bat (100%) rename plugins/{Dfusion/luafiles/embark => lua/dfusion/srcs}/embark.asm (61%) rename plugins/{Dfusion/luafiles/friendship => lua/dfusion/srcs}/friendship.asm (83%) create mode 100644 plugins/lua/dfusion/tools.lua create mode 100644 plugins/lua/reactionhooks.lua create mode 100644 plugins/reactionhooks.cpp create mode 100644 scripts/autofarm.rb create mode 100644 scripts/autounsuspend.rb create mode 100644 scripts/binpatch.lua create mode 100644 scripts/create-items.rb create mode 100644 scripts/devel/inspect-screen.lua create mode 100644 scripts/dfusion.lua create mode 100644 scripts/embark.lua create mode 100644 scripts/gui/companion-order.lua create mode 100644 scripts/gui/gm-editor.lua create mode 100644 scripts/lever.rb create mode 100644 scripts/lua.lua create mode 100644 scripts/soundsense-season.lua create mode 100644 scripts/stripcaged.rb create mode 100644 scripts/unsuspend.rb 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 {
  • sort
  • -
  • Scripts
  • +
  • Scripts +
  • 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.

  • @@ -1109,6 +1115,12 @@ above operations accordingly. If enabled, pauses and zooms to position.

  • 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.

  • @@ -1147,6 +1159,12 @@ the flags in the job item.

  • 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.

  • @@ -1209,6 +1227,9 @@ is true, subtracts the rust penalty.

  • 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.

  • @@ -1403,6 +1424,12 @@ burrows, or the presence of invaders.

    Buildings module

    @@ -2893,6 +2947,8 @@ supports:

    edit_pen:If specified, used instead of cursor_pen for the edit field. +edit_below:If true, the edit field is placed below the list instead of above. + not_found_label:  Specifies the text of the label shown when no items match the filter. @@ -3014,6 +3070,25 @@ The name argument should be the name stem, as

    Note that this function lets errors propagate to the caller.

    +
    +

    Save init script

    +

    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.

    +
    diff --git a/Lua API.rst b/Lua API.rst index d06e3d2e6..0ec464f76 100644 --- a/Lua API.rst +++ b/Lua API.rst @@ -741,6 +741,10 @@ can be omitted. 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. @@ -833,6 +837,14 @@ Job module 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. @@ -879,6 +891,14 @@ Units module 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*. @@ -954,6 +974,10 @@ Units module 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. @@ -1198,6 +1222,14 @@ Burrows module Buildings module ---------------- +* ``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. @@ -1582,7 +1614,10 @@ Supported callbacks and fields are: Maps to an integer in range 0-255. Duplicates a separate "STRING_A???" code for convenience. ``_MOUSE_L, _MOUSE_R`` - If the left or right mouse button is pressed. + If the left or right mouse button is being pressed. + + ``_MOUSE_L_DOWN, _MOUSE_R_DOWN`` + 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. @@ -1618,10 +1653,20 @@ and are only documented here for completeness: 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. @@ -2672,6 +2717,16 @@ containing newlines, or a table with the following possible fields: 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 @@ -2737,8 +2792,12 @@ It has the following attributes: :inactive_pen: If specified, used for the cursor when the widget is not active. :icon_pen: Default pen for icons. :on_select: Selection change callback; called as ``on_select(index,choice)``. + This is also called with *nil* arguments if ``setChoices`` is called + with an empty list. :on_submit: Enter key callback; if specified, the list reacts to the key and calls it as ``on_submit(index,choice)``. +:on_submit2: Shift-Enter key callback; if specified, the list reacts to the key + and calls it as ``on_submit2(index,choice)``. :row_height: Height of every row in text lines. :icon_width: If not *nil*, the specified number of character columns are reserved to the left of the list item for the icons. @@ -2788,6 +2847,10 @@ The list supports the following methods: 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. + FilteredList class ------------------ @@ -2798,6 +2861,7 @@ In addition to passing through all attributes supported by List, it supports: :edit_pen: If specified, used instead of ``cursor_pen`` for the edit field. +:edit_below: If true, the edit field is placed below the list instead of above. :not_found_label: Specifies the text of the label shown when no items match the filter. The list choices may include the following attributes: @@ -2933,3 +2997,24 @@ from other scripts) in any context, via the same function the core uses: The ``name`` argument should be the name stem, as would be used on the command line. Note that this function lets errors propagate to the caller. + +Save init script +================ + +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``. diff --git a/NEWS b/NEWS index f2237cab9..ed6290261 100644 --- a/NEWS +++ b/NEWS @@ -10,24 +10,55 @@ DFHack future - fastdwarf: new mode using debug flags, and some internal consistency fixes. - added a small stand-alone utility for applying and removing binary patches. - removebadthoughts: add --dry-run option + - superdwarf: work in adventure mode too + - tweak stable-cursor: carries cursor location from/to Build menu. + - deathcause: allow selection from the unitlist screen + - slayrace: allow targetting undeads + New tweaks: + - tweak military-training: speed up melee squad training up to 10x (normally 3-5x). New scripts: + - binpatch: the same as the stand-alone binpatch.exe, but works at runtime. - region-pops: displays animal populations of the region and allows tweaking them. + - lua: lua interpreter front-end converted to a script from a native command. + - dfusion: misc scripts with a text based menu. + - embark: lets you embark anywhere. + - lever: list and pull fort levers from the dfhack console. + - stripcaged: mark items inside cages for dumping, eg caged goblin weapons. + - soundsense-season: writes the correct season to gamelog.txt on world load. + - create-items: spawn items New GUI scripts: - gui/guide-path: displays the cached path for minecart Guide orders. - gui/workshop-job: displays inputs of a workshop job and allows tweaking them. - - gui/workflow: a front-end for the workflow plugin. + - gui/workflow: a front-end for the workflow plugin (part inspired by falconne). - gui/assign-rack: works together with a binary patch to fix weapon racks. + - gui/gm-editor: an universal editor for lots of dfhack things. + - gui/companion-order: a adventure mode command interface for your companions. + New binary patches (for use with binpatch): + - armorstand-capacity: doubles the capacity of armor stands. + - custom-reagent-size: lets custom reactions use small amounts of inputs. + - deconstruct-heapfall: stops some items still falling on head when deconstructing. + - deconstruct-teleport: stops items from 16x16 block teleporting when deconstructing. + - hospital-overstocking: stops hospital overstocking with supplies. + - training-ammo: lets dwarves with quiver full of combat-only ammo train. + - weaponrack-unassign: fixes bug that negates work done by gui/assign-rack. Workflow plugin: - properly considers minecarts assigned to routes busy. - code for deducing job outputs rewritten in lua for flexibility. - logic fix: collecting webs produces silk, and ungathered webs are not thread. + - items assigned to squads are considered busy, even if not in inventory. + - shearing and milking jobs are supported, but only with generic MILK or YARN outputs. + - workflow announces when the stock level gets very low once a season. New Fix Armory plugin: Together with a couple of binary patches and the gui/assign-rack script, this plugin makes weapon racks, armor stands, chests and cabinets in properly designated barracks be used again for storage of squad equipment. New Search plugin by falconne: - Adds an incremental search function to the Stocks, Trading and Unit List screens. - + Adds an incremental search function to the Stocks, Trading, Stockpile and Unit List screens. + New AutoMaterial plugin by falconne: + Makes building constructions (walls, floors, fortifications, etc) a little bit easier by + saving you from having to trawl through long lists of materials each time you place one. + Dfusion plugin: + Reworked to make use of lua modules, now all the scripts can be used from other scripts. DFHack v0.34.11-r2 diff --git a/Readme.html b/Readme.html index cd073459c..54deb013f 100644 --- a/Readme.html +++ b/Readme.html @@ -337,197 +337,210 @@ access DF memory and allow for easier development of new tools.

  • Introduction
  • Getting DFHack
  • Compatibility
  • -
  • Installation/Removal
  • -
  • Using DFHack