Merge branch 'develop' of https://github.com/DFHack/dfhack into develop

develop
Japa 2015-11-08 13:54:14 +05:30
commit 79e1c4982e
201 changed files with 5097 additions and 3981 deletions

2
.gitignore vendored

@ -21,7 +21,7 @@ buntu
build/VC2010 build/VC2010
# Sphinx generated documentation # Sphinx generated documentation
docs/_*/ docs/_*
docs/html/ docs/html/
#except for the real one #except for the real one

@ -18,7 +18,7 @@ script:
- python travis/lint.py - python travis/lint.py
- python travis/script-in-readme.py - python travis/script-in-readme.py
- python travis/script-syntax.py --ext=lua --cmd="luac5.2 -p" - python travis/script-syntax.py --ext=lua --cmd="luac5.2 -p"
- python travis/script-syntax.py --ext=rb --cmd="ruby -c" - python travis/script-syntax.py --ext=rb --cmd="ruby -c" --path scripts/
- mkdir build-travis - mkdir build-travis
- cd build-travis - cd build-travis
- cmake .. && make -j3 - cmake .. && make -j3

@ -93,7 +93,7 @@ endif()
# set up versioning. # set up versioning.
set(DF_VERSION "0.40.24") set(DF_VERSION "0.40.24")
SET(DFHACK_RELEASE "r3") SET(DFHACK_RELEASE "r4")
set(DFHACK_VERSION "${DF_VERSION}-${DFHACK_RELEASE}") set(DFHACK_VERSION "${DF_VERSION}-${DFHACK_RELEASE}")
@ -184,10 +184,7 @@ endif()
# build the lib itself # build the lib itself
IF(BUILD_LIBRARY) IF(BUILD_LIBRARY)
add_subdirectory (library) add_subdirectory (library)
## install the default documentation files install(FILES LICENSE.rst NEWS.rst DESTINATION ${DFHACK_USERDOC_DESTINATION})
#install(FILES LICENSE NEWS "Lua API.html" Readme.html Compile.html Contributors.html DESTINATION ${DFHACK_USERDOC_DESTINATION})
install(FILES LICENSE NEWS DESTINATION ${DFHACK_USERDOC_DESTINATION})
#install(DIRECTORY docs/images DESTINATION ${DFHACK_USERDOC_DESTINATION})
endif() endif()
install(DIRECTORY dfhack-config/ DESTINATION dfhack-config/default) install(DIRECTORY dfhack-config/ DESTINATION dfhack-config/default)
@ -204,43 +201,34 @@ if (BUILD_DOCS)
if (NOT SPHINX_FOUND) if (NOT SPHINX_FOUND)
message(SEND_ERROR "Sphinx not found but BUILD_DOCS enabled") message(SEND_ERROR "Sphinx not found but BUILD_DOCS enabled")
endif() endif()
set(SPHINX_THEME "alabaster")
set(SPHINX_THEME_DIR)
set(SPHINX_BINARY_BUILD_DIR "${CMAKE_CURRENT_SOURCE_DIR}/docs/_build")
set(SPHINX_CACHE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/docs/_build/_doctrees")
set(SPHINX_HTML_DIR "${CMAKE_CURRENT_SOURCE_DIR}/docs/html/")
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/docs/conf.py.in"
"${SPHINX_BINARY_BUILD_DIR}/conf.py"
@ONLY)
file(GLOB SPHINX_DEPS file(GLOB SPHINX_DEPS
"${CMAKE_CURRENT_SOURCE_DIR}/docs/*.rst" "${CMAKE_CURRENT_SOURCE_DIR}/docs/*.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/docs/images/*.png" "${CMAKE_CURRENT_SOURCE_DIR}/docs/images/*.png"
"${CMAKE_CURRENT_SOURCE_DIR}/docs/conf.py.in" "${CMAKE_CURRENT_SOURCE_DIR}/docs/styles/*"
"${CMAKE_CURRENT_SOURCE_DIR}/conf.py"
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/about.txt"
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/*/about.txt"
)
file(GLOB_RECURSE SPHINX_SCRIPT_DEPS
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/*.lua" "${CMAKE_CURRENT_SOURCE_DIR}/scripts/*.lua"
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/*/*.lua" "${CMAKE_CURRENT_SOURCE_DIR}/scripts/*.rb"
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/*/*/*.lua" )
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/*/*/*/*.lua" set(SPHINX_DEPS ${SPHINX_DEPS} ${SPHINX_SCRIPT_DEPS}
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/*/*/*/*/*.lua" "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/*/*/*/*/*/*.lua" "${CMAKE_CURRENT_SOURCE_DIR}/NEWS.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/*/*/*/*/*/*/*.lua" "${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt"
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/*/*/*/*/*/*/*/*.lua"
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/*/*/*/*/*/*/*/*/*.lua"
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/*/*/*/*/*/*/*/*/*/*.lua"
) )
set(SPHINX_DEPS ${SPHINX_DEPS} LICENSE NEWS README.rst)
set(SPHINX_OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/docs/html/.buildinfo") set(SPHINX_OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/docs/html/.buildinfo")
set_source_files_properties(${SPHINX_OUTPUT} PROPERTIES GENERATED TRUE) set_source_files_properties(${SPHINX_OUTPUT} PROPERTIES GENERATED TRUE)
add_custom_command(OUTPUT ${SPHINX_OUTPUT} add_custom_command(OUTPUT ${SPHINX_OUTPUT}
COMMAND ${SPHINX_EXECUTABLE} COMMAND ${SPHINX_EXECUTABLE}
-a -E -q -b html -a -E -q -b html
-c "${SPHINX_BINARY_BUILD_DIR}"
-d "${SPHINX_CACHE_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}"
"${SPHINX_HTML_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/docs/html"
-w "${CMAKE_CURRENT_SOURCE_DIR}/docs/_sphinx-warnings.txt"
-j 2
DEPENDS ${SPHINX_DEPS} DEPENDS ${SPHINX_DEPS}
COMMENT "Building HTML documentation with Sphinx" COMMENT "Building HTML documentation with Sphinx"
) )
@ -253,16 +241,18 @@ if (BUILD_DOCS)
add_custom_command(TARGET dfhack_docs POST_BUILD add_custom_command(TARGET dfhack_docs POST_BUILD
COMMAND ${CMAKE_COMMAND} -E touch ${SPHINX_OUTPUT}) COMMAND ${CMAKE_COMMAND} -E touch ${SPHINX_OUTPUT})
install(DIRECTORY ${dfhack_SOURCE_DIR}/docs/html install(DIRECTORY ${dfhack_SOURCE_DIR}/docs/html/
DESTINATION ${DFHACK_USERDOC_DESTINATION} DESTINATION ${DFHACK_USERDOC_DESTINATION}/docs
#FILES_MATCHING PATTERN "*.lua"
# PATTERN "*.rb"
# PATTERN "3rdparty" EXCLUDE
) )
install(FILES "README.html" DESTINATION "${DFHACK_DATA_DESTINATION}")
endif() endif()
# Packaging with CPack! # Packaging with CPack!
SET(DFHACK_PACKAGE_SUFFIX "")
IF(UNIX) IF(UNIX)
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
string(STRIP ${GCC_VERSION} GCC_VERSION)
SET(DFHACK_PACKAGE_SUFFIX "-gcc-${GCC_VERSION}")
if(APPLE) if(APPLE)
SET(CPACK_GENERATOR "ZIP;TBZ2") SET(CPACK_GENERATOR "ZIP;TBZ2")
else() else()
@ -277,7 +267,7 @@ IF(APPLE)
ELSE() ELSE()
set(DFHACK_PACKAGE_PLATFORM_NAME ${CMAKE_SYSTEM_NAME}) set(DFHACK_PACKAGE_PLATFORM_NAME ${CMAKE_SYSTEM_NAME})
ENDIF() ENDIF()
set(CPACK_PACKAGE_FILE_NAME "dfhack-${DFHACK_VERSION}-${DFHACK_PACKAGE_PLATFORM_NAME}") set(CPACK_PACKAGE_FILE_NAME "dfhack-${DFHACK_VERSION}-${DFHACK_PACKAGE_PLATFORM_NAME}${DFHACK_PACKAGE_SUFFIX}")
INCLUDE(CPack) INCLUDE(CPack)
#INCLUDE(FindSphinx.cmake) #INCLUDE(FindSphinx.cmake)

@ -1,359 +0,0 @@
License of DFHack
=================
https://github.com/peterix/dfhack
Copyright (c) 2009-2012 Petr Mrázek (peterix@gmail.com)
::
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any
damages arising from the use of this software.
Permission is granted to anyone to use this software for any
purpose, including commercial applications, and to alter it and
redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation
would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
clsocket license
================
::
Copyright (c) 2007-2009 CarrierLabs, LLC. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
4. The name "CarrierLabs" must not be used to
endorse or promote products derived from this software without
prior written permission. For written permission, please contact
mark@carrierlabs.com.
THIS SOFTWARE IS PROVIDED BY MARK CARRIER ``AS IS'' AND ANY
EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MARK CARRIER OR
ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
Lua license
===========
Lua is licensed under the terms of the MIT license reproduced below.
This means that Lua is free software and can be used for both academic
and commercial purposes at absolutely no cost.
For details and rationale, see http://www.lua.org/license.html .
::
Copyright (C) 1994-2008 Lua.org, PUC-Rio.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Protobuf license
================
::
Copyright 2008, Google Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Code generated by the Protocol Buffer compiler is owned by the owner
of the input file used when generating it. This code is not
standalone and requires a support library to be linked with it. This
support library is itself covered by the above license.
License of tinyxml (XML reader library)
=======================================
http://www.sourceforge.net/projects/tinyxml
Original code, 2.0 and earlier, copyright 2000-2006 Lee Thomason (http://www.grinninglizard.com)
::
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any
damages arising from the use of this software.
Permission is granted to anyone to use this software for any
purpose, including commercial applications, and to alter it and
redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation
would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
tinythread license
==================
::
Copyright (c) 2010 Marcus Geelnard
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
zlib license
============
::
Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
dirent.h - dirent API for Microsoft Visual Studio
=================================================
::
Copyright (C) 2006 Toni Ronkko
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL TONI RONKKO BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
linenoise.c
===========
Parts of dfhack are based on linenoise: a line editing library against the
idea that a line editing lib needs to be 20,000 lines of C code.
You can find the latest source code at http://github.com/antirez/linenoise
::
Copyright (c) 2010, Salvatore Sanfilippo <antirez at gmail dot com>
Copyright (c) 2010, Pieter Noordhuis <pcnoordhuis at gmail dot com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
UTF-8 Decoder
=============
See http://bjoern.hoehrmann.de/utf-8/decoder/dfa/ for details.
::
Copyright (c) 2008-2010 Bjoern Hoehrmann <bjoern@hoehrmann.de>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
luafilesystem
=============
Parts of dfhack are based on luafilesystem:
::
Copyright (c) 2003-2014 Kepler Project.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use, copy,
modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
jsoncpp
========
::
Copyright (c) 2007-2010 Baptiste Lepilleur
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use, copy,
modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
JSON.lua
========
Copyright 2010-2014 Jeffrey Friedl, http://regex.info/blog/
Latest version: http://regex.info/blog/lua/json
This code is released under a Creative Commons CC-BY "Attribution" License:
http://creativecommons.org/licenses/by/3.0/deed.en_US

@ -0,0 +1,145 @@
.. _license:
########
Licenses
########
DFHack is distributed under the Zlib license, with some MIT-
and BSD-licensed components. These licenses protect your right
to use DFhack for any purpose, distribute copies, and so on.
The core, plugins, scripts, and other DFHack code all use the
ZLib license unless noted otherwise. By contributing to DFHack,
authors release the contributed work under this license.
DFHack also draws on several external packages.
Their licenses are summarised here and reproduced below.
=============== ============= =================================================
Component License Copyright
=============== ============= =================================================
DFHack_ Zlib \(c\) 2009-2012, Petr Mrázek
clsocket_ BSD 3-clause \(c\) 2007-2009, CarrierLabs, LLC.
dirent_ MIT \(c\) 2006, Toni Ronkko
JSON.lua_ CC-BY-SA_ \(c\) 2010-2014, Jeffrey Friedl
jsoncpp_ MIT \(c\) 2007-2010, Baptiste Lepilleur
linenoise_ BSD 2-clause \(c\) 2010, Salvatore Sanfilippo & Pieter Noordhuis
lua_ MIT \(c\) 1994-2008, Lua.org, PUC-Rio.
luafilesystem_ MIT \(c\) 2003-2014, Kepler Project
protobuf_ BSD 3-clause \(c\) 2008, Google Inc.
tinythread_ Zlib \(c\) 2010, Marcus Geelnard
tinyxml_ Zlib \(c\) 2000-2006, Lee Thomason
UTF-8-decoder_ MIT \(c\) 2008-2010, Bjoern Hoehrmann
=============== ============= =================================================
.. _DFHack: https://github.com/DFHack/dfhack
.. _clsocket: https://github.com/DFHack/clsocket
.. _dirent: https://github.com/tronkko/dirent
.. _JSON.lua: http://regex.info/blog/lua/json
.. _jsoncpp: https://github.com/open-source-parsers/jsoncpp
.. _linenoise: http://github.com/antirez/linenoise
.. _lua: http://www.lua.org
.. _luafilesystem: https://github.com/keplerproject/luafilesystem
.. _protobuf: https://github.com/google/protobuf
.. _tinythread: http://tinythreadpp.bitsnbites.eu/
.. _tinyxml: http://www.sourceforge.net/projects/tinyxml
.. _UTF-8-decoder: http://bjoern.hoehrmann.de/utf-8/decoder/dfa
.. _CC-BY-SA: http://creativecommons.org/licenses/by/3.0/deed.en_US
Zlib License
============
See https://en.wikipedia.org/wiki/Zlib_License
::
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any
damages arising from the use of this software.
Permission is granted to anyone to use this software for any
purpose, including commercial applications, and to alter it and
redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product
documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
MIT License
===========
See https://en.wikipedia.org/wiki/MIT_License
::
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
BSD Licenses
============
See https://en.wikipedia.org/wiki/BSD_licenses
::
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
``linenoise`` adds no further clauses.
``protobuf`` adds the following clause::
3. Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
``clsocket`` adds the following clauses::
3. The name of the author may not be used to endorse or promote
products derived from this software without specific prior
written permission.
4. The name "CarrierLabs" must not be used to endorse or promote
products derived from this software without prior written
permission. For written permission, please contact
mark@carrierlabs.com

863
NEWS

@ -1,863 +0,0 @@
.. comment
This is the changelog file for DFHack. If you add or change anything, note
it here under the heading "DFHack Future", in the appropriate section.
Items within each section are listed in alphabetical order to minimise merge
conflicts. Try to match the style and level of detail of the other entries.
DFHack Future
=============
::
Internals
A method for caching screen output is now available to Lua (and C++)
Developer plugins can be ignored on startup by setting the DFHACK_NO_DEV_PLUGINS environment variable
The console on Linux and OS X now recognizes keyboard input between prompts
JSON libraries available (C++ and Lua)
More DFHack build information used in plugin version checks and available to plugins and lua scripts
Fixed a rare overflow issue that could cause crashes on Linux and OS X
Stopped DF window from receiving input when unfocused on OS X
Fixed issues with keybindings involving Ctrl-A and Ctrl-Z, as well as Alt-E/U/N on OS X
Multiple contexts can now be specified when adding keybindings
Keybindings can now use F10-F12 and 0-9
Plugin system is no longer restricted to plugins that exist on startup
dfhack.init file locations significantly generalized
Lua
Scripts can be enabled with the built-in enable/disable commands
A new function, reqscript(), is available as a safer alternative to script_environment()
Lua viewscreens can choose not to intercept the OPTIONS keybinding
New internal commands
kill-lua: Interrupt running Lua scripts
type: Show where a command is implemented
New plugins
confirm: Adds confirmation dialogs for several potentially dangerous actions
fix-unit-occupancy: Fixes issues with unit occupancy, such as faulty "unit blocking tile" messages (bug 3499)
title-version (formerly vshook): Display DFHack version on title screen
New scripts
burial: sets all unowned coffins to allow burial ("-pets" to allow pets too)
fix-ster: changes fertility/sterility of animals or dwarves
view-item-info: adds information and customisable descriptions to item viewscreens
warn-starving: check for starving, thirsty, or very drowsy units and pause with warning if any are found
modtools/create-unit: create new units from nothing
modtools/equip-item: a script to equip items on units
points: set number of points available at embark screen
Vjek's script collection:
- armoks-blessing: Adjust all attributes, personality, age and skills of all dwarves in play
- brainwash: brainwash a dwarf (modifying their personality)
- elevate-mental: elevate all the mental attributes of a unit
- elevate-physical: elevate all the physical attributes of a unit
- make-legendary: modify skill(s) of a single unit
- pref-adjust: Adjust all preferences of all dwarves in play
- rejuvenate: make any "old" dwarf 20 years old
New tweaks
embark-profile-name: Allows the use of lowercase letters when saving embark profiles
kitchen-keys: Fixes DF kitchen meal keybindings
kitchen-prefs-color: Changes color of enabled items to green in kitchen preferences
kitchen-prefs-empty: Fixes a layout issue with empty kitchen tabs
Fixes
Plugins with vmethod hooks can now be reloaded on OS X
Lua's os.system() now works on OS X
Fixed default arguments in Lua gametype detection functions
Circular lua dependencies (reqscript/script_environment) fixed
Prevented crash in Items::createItem()
buildingplan: Now supports hatch covers
gui/create-item:
- fixed assigning quality to items
- made "esc" work properly
gui/gm-editor handles lua tables properly
help: now recognizes built-in commands, like "help"
manipulator: fixed crash when selecting custom professions when none are found
remotefortressreader: fixed crash when attempting to send map info when no map was loaded
search:
- fixed crash in unit list after cancelling a job
- fixed crash when disabling stockpile category after searching in a subcategory
stockpiles: now checks/sanitizes filenames when saving
stocks: fixed a crash when right-clicking
steam-engine:
- fixed a crash on arena load
- number keys (e.g. 2/8) take priority over cursor keys when applicable
tweak fps-min fixed
tweak farm-plot-select: Stopped controls from appearing when plots weren't fully built
workflow: Fixed some issues with stuck jobs
- Note: Existing stuck jobs must be cancelled and re-added
zone: Fixed a crash when using "zone set" (and a few other potential crashes)
Misc Improvements
DFHack documentation:
- massively reorganised, into files of more readable size
- added many missing entries
- indexes, internal links, offline search all documents
- includes documentation of linked projects (df-structures, 3rdparty scripts)
- better HTML generation with Sphinx
autolabor:
- Stopped modification of labors that shouldn't be modified for brokers/diplomats
- Prioritize skilled dwarves more efficiently
- Prevent dwarves from running away with tools from previous jobs
dwarfmonitor:
- widgets' positions, formats, etc. are now customizable (see Readme)
- weather display now separated from the date display
- New mouse cursor widget
dfstatus: Can enable/disable individual categories and customize metal bar list
full-heal: "-r" option removes corpses
gui/gm-editor
- Pointers can now be displaced
- Added some useful aliases: "item" for the selected item, "screen" for the current screen, etc.
- Now avoids errors with unrecognized types
gui/hack-wish: renamed to gui/create-item
"keybinding list" accepts a context
lever:
- Lists lever names
- "lever pull" can be used to pull the currently-selected lever
memview: Fixed display issue
modtools/create-item: arguments are named more clearly, and you can specify the creator to be
the unit with id df.global.unit_next_id-1 (useful in conjunction with modtools/create-unit)
nyan: Can now be stopped with dfhack-run
plug:
- lists all plugins
- shows state and number of commands in plugins
prospect: works from within command-prompt
quicksave: Restricted to fortress mode
remotefortressreader: Exposes more information
search:
- Supports noble suggestion screen (e.g. suggesting a baron)
- Supports fortress mode loo[k] menu
- Recognizes ? and ; keys
stocks: can now match beginning and end of item names
teleport: Fixed cursor recognition
tweak:
- debug output now logged to stderr.log instead of console - makes DFHack start faster
- farm-plot-select: Fixed issues with selecting undiscovered crops
workflow: Improved handling of plant reactions
Removed
embark-tools nano: 1x1 embarks are now possible in vanilla 0.40.24
DFHack 0.40.24-r3
=================
::
Internals
Ruby library now included on OS X - ruby scripts should work on OS X 10.10
libstdc++ should work with older versions of OS X
Added support for onLoadMap/onUnloadMap.init scripts
game type detection functions are now available in the World module
The DFHACK_LOG_MEM_RANGES environment variable can be used to log information to stderr.log on OS X
Fixed adventure mode menu names
Fixed command usage information for some commands
Lua
Lua scripts will only be reloaded if necessary
Added a df2console() wrapper, useful for printing DF (CP437-encoded) text to the console in a portable way
Added a strerror() wrapper
New internal commands
hide/show: hide and show the console on Windows
sc-script: Allows additional scripts to be run when certain events occur (similar to onLoad*.init scripts)
New plugins
autohauler: A hauling-only version of autolabor
New scripts
modtools/reaction-product-trigger: triggers callbacks when products are produced (contrast with when reactions complete)
New tweaks
fps-min: Fixes the in-game minimum FPS setting
shift-8-scroll: Gives Shift+8 (or *) priority when scrolling menus, instead of scrolling the map
tradereq-pet-gender: Displays pet genders on the trade request screen
New features
autolabor: A negative pool size can be specified to use the most unskilled dwarves
catsplosion: Works on any specified races
exportlegends: Now exports more information
Fixes
Fixed game type detection in:
3dveins
createitem
reveal
seedwatch
Made PRELOAD_LIB more extensible on Linux
add-spatter, eventful: Fixed crash on world load
building-hacks: made buildings produce/consume correct amount of power
Gave add-thought a proper subthought arg.
fix-armory compiles and is available again (albeit with issues)
gui/gm-editor: Added search option (accessible with "s")
hack-wish: Made items stack properly.
modtools/skill-change: made level granularity work properly.
show-unit-syndromes should work
stockflow: Fixed error message in Arena mode
stockflow: No longer checks the DF version
stockflow: Fixed ballistic arrow head orders
stockflow: Now convinces the bookkeeper to update records more often
zone: Stopped crash when scrolling cage owner list
Misc Improvements
building-hacks: Added a way to allow building to work even if it consumes more power
than is available. Added setPower/getPower functions.
catsplosion: Can now trigger pregnancies in (most) other creatures
exportlegends: 'info' and 'all' exports legends_plus xml with more data for legends utilities
manipulator:
Added ability to edit nicknames/profession names
Added "Job" as a View Type, in addition to "Profession" and "Squad"
Custom profession templates, with masking
remotefortressreader: Exposes more information
DFHack 0.40.24-r2
=================
::
Internals
Lua scripts can set environment variables of each other with dfhack.run_script_with_env.
Lua scripts can now call each others internal nonlocal functions with dfhack.script_environment(scriptName).functionName(arg1,arg2).
eventful Lua reactions no longer require LUA_HOOK as a prefix: you can register a
callback for the completion of any reaction with a name
Filesystem module now provides file access/modification times and can list directories (normally and recursively)
Units Module: New functions:
isWar
isHunter
isAvailableForAdoption
isOwnCiv
isOwnRace
getRaceName
getRaceNamePlural
getRaceBabyName
getRaceChildName
isBaby
isChild
isAdult
isEggLayer
isGrazer
isMilkable
isTrainableWar
isTrainableHunting
isTamable
isMale
isFemale
isMerchant
isForest
isMarkedForSlaughter
Buildings Module: New Functions:
isActivityZone
isPenPasture
isPitPond
isActive
findPenPitAt
Fixes
dfhack.run_script should correctly find save-specific scripts now.
Updated add-thought to properly affect stress.
hfs-pit should work now
Autobutcher takes gelding into account
init.lua existence checks should be more reliable (notably when using non-English locales)
Misc Improvements
Multiline commands are now possible inside dfhack.init scripts. See dfhack.init-example for example usage.
DFHack 0.40.24-r1
=================
::
Internals
CMake shouldn't cache DFHACK_RELEASE anymore. People may need to manually update/delete
their CMake cache files to get rid of it.
DFHack 0.40.24-r0
=================
::
Internals
EventManager: fixed crash error with EQUIPMENT_CHANGE event.
key modifier state exposed to Lua
Fixes
dfhack script can now be run from other directories on OSX
New Plugins
blueprint: export part of your fortress to quickfort .csv files
New Scripts
hotkey-notes: print key, name, and jump position of hotkeys
Removed
embark.lua
needs_porting/*
Misc Improvements
added support for searching more lists
DFHack 0.40.23-r1
=================
::
Internals
plugins will not be loaded if globals they specify as required are not located (should prevent some crashes)
Fixes
Fixed numerous (mostly Lua-related) crashes on OS X by including a more up-to-date libstdc++
Alt should no longer get stuck on Windows (and perhaps other platforms as well)
advfort works again
autobutcher takes sexualities into account
devel/export-dt-ini: Updated for 0.40.20+
digfort: now checks file type and existence
exportlegends: Fixed map export
full-heal: Fixed a problem with selecting units in the GUI
gui/hack-wish: Fixed restrictive material filters
mousequery: Changed box-select key to Alt+M
plugins/dwarfmonitor: correct date display (month index, separator)
scripts/putontable: added to the readme
siren should work again
stderr.log: removed excessive debug output on OS X
trackstop: No longer prevents cancelling the removal of a track stop or roller.
Fixed a display issue with PRINT_MODE:TEXT
Fixed a symbol error (MapExtras::BiomeInfo::MAX_LAYERS) when compiling DFHack in Debug mode
New Plugins
fortplan: designate construction of (limited) buildings from .csv file, quickfort-style
New Scripts
gui/stockpiles: an in-game interface for saving and loading stockpile
settings files.
position: Reports the current date, time, month, and season, plus
some location info. Port/update of position.py
hfs-pit: Digs a hole to hell under the cursor. Replaces needs_porting/hellhole.cpp
Removed
embark.lua: Obsolete, use `embark-tools`
New tweaks:
eggs-fertile: Displays an egg fertility indicator on nestboxes
max-wheelbarrow: Allows assigning more than 3 wheelbarrows to a stockpile
Misc Improvements
embark-tools: Added basic mouse support on the local map
Made some adventure mode keybindings in dfhack.init-example only work in adventure mode
Added a default keybinding for "gui/companion-order"
further work on needs_porting
DFHack 0.40.19-r1
=================
::
Fixes:
typo fix in modtools/reaction-trigger
modtools/item-trigger should now work with item types
New plugins:
savestock and loadstock: two commands for saving and loading
stockpile settings to a file. They can be used to migrate stockpile
settings between worlds and saves.
New scripts:
remove-stress [all]: set selected or all units unit to -1,000,000 stress
this script replaces removebadthoughts.rb
Misc improvements:
cmd-prompt can now access selected items, units, and buildings
autolabor plugin: add an optional talent pool parameter
DFHack 0.40.16-r1
=================
::
Internals:
EventManager should handle INTERACTION triggers a little better. It still can get confused
about who did what but only rarely.
EventManager should no longer trigger REPORT events for old reports after loading a save.
lua/persist-table.lua: a convenient way of using persistent tables of arbitrary structure and dimension in Lua
Fixes:
mousequery: Disabled when linking levers
stocks: Melting should work now
scripts/full-heal: Updated with proper argument handling.
scripts/modtools/reaction-trigger-transition.lua
should produce the correct syntax now
scripts/superdwarf.rb should work better now
scripts/forum-dwarves.lua
update for new df-structures changes
New scripts:
scripts/
adaptation.rb
view or set the cavern adaptation level of your citizens
add-thought.lua
allows the user to add thoughts to creatures.
gaydar.lua
detect the sexual orientation of units on the map
markdown.lua
Save a copy of a text screen in markdown (for reddit among others).
devel/
all-bob.lua: renames everyone Bob to help test interaction-trigger
Misc improvements:
autodump:
Can now mark a stockpile for auto-dumping (similar to
automelt and autotrade)
buildingplan:
Can now auto-allocate rooms to dwarves with specific positions
(e.g. expedition leader, mayor)
dwarfmonitor
Now displays a weather indicator and date
lua/syndrome-util.lua
now you can remove syndromes by SYN_CLASS
scripts/modtools/add-syndrome.lua
now you can remove syndromes by SYN_CLASS
No longer writes empty .history files
DFHack 0.40.15-r1
=================
::
Fixes:
- mousequery: Fixed behavior when selecting a tile on the lowest z-level
Internals:
- EventManager: deals with frame_counter getting reset properly now.
- modtools/item-trigger: fixed equip/unequip bug and corrected minor documentation error
- teleport: Updated with proper argument handling and proper unit-at-destination handling.
- autotrade: Removed the newly obsolete "Mark all" functionality.
- search: Adapts to the new trade screen column width
- tweak fast-trade: Switching the fast-trade keybinding to Shift-Up/Shift-Down, due to Select All conflict
DFHack 0.40.14-r1
=================
::
Internals:
- The DFHack console can now be disabled by setting the DFHACK_DISABLE_CONSOLE
environment variable: "DFHACK_DISABLE_CONSOLE=1 ./dfhack"
Fixes:
- Stopped duplicate load/unload events when unloading a world
- Stopped "-e" from being echoed when DFHack quits on Linux
- automelt now uses a faster method to locate items
- autotrade: "Mark all" no longer double-marks bin contents
- drainaquifer.rb: replaced with a faster less buggy drain-aquifer.lua
- embark-tools no longer conflicts with keys on the notes screen
- fastdwarf: Fixed problems with combat/attacks
- forum-dwarves should work now
- manipulator now uses a stable sort, allowing sorting by multiple categories
- rendermax updated to work with 0.40
New plugins:
- trackstop: Shows track stop friction and dump direction in its 'q' menu
New tweaks:
- farm-plot-select: Adds "Select all" and "Deselect all" options to farm plot menus
- import-priority-category: Allows changing the priority of all goods in a
category when discussing an import agreement with the liaison
- manager-quantity: Removes the limit of 30 jobs per manager order
- civ-view-agreement: Fixes overlapping text on the "view agreement" screen
- nestbox-color: Fixes the color of built nestboxes
Misc Improvements:
- exportlegends.lua can now handle site maps
DFHack 0.40.13-r1
=================
::
Internals:
- unified spatter structs
- added ruby df.print_color(color, string) method for dfhack console
Fixes:
- no more -e after terminating
- fixed superdwarf
DFHack 0.40.12-r1
=================
::
Fixes:
- possible crash fixed for hack-wish
- updated search to not conflict with BUILDJOB_SUSPEND
- workflow: job_material_category -> dfhack_material_category
New plugins:
- hotkeys (by Falconne): Shows ingame viewscreen with all dfhack keybindings active in current mode.
- automelt: allows marking stockpiles for automelt
(i.e. any items placed in stocpile will be designated for melting)
Misc Improvements:
- now you can use @ to print things in interactive Lua with subtley different semantics
- optimizations for stockpiles for autotrade and stockflow
- updated exportlegends.lua to work with new maps, dfhack 40.11 r1+
Internals:
- support for global onLoadWorld.init and onUnloadWorld.init files,
called when loading and unloading a world
- Close file after loading a binary patch.
DFHack 0.40.11-r1
=================
::
Internals:
- Plugins on OS X now use ".plug.dylib" as an extension instead of ".plug.so"
Fixes:
- 3dveins should no longer hang/crash on specific maps
- Fixed some autotrade and search layout issues
- Updated deathcause
- hack-wish should work now
- reveal no longer allocates data for nonexistent map blocks
- Various documentation fixes and updates
DFHack v0.40.10-r1
==================
A few bugfixes.
DFHack v0.40.08-r2
==================
::
Internals:
supported per save script folders
Items module: added createItem function
Sorted CMakeList for plugins and plugins/devel
diggingInvaders no longer builds if plugin building is disabled
EventManager:
EQUIPMENT_CHANGE now triggers for new units
new events:
ON_REPORT
UNIT_ATTACK
UNLOAD
INTERACTION
New scripts:
lua/
repeat-util.lua
makes it easier to make things repeat indefinitely
syndrome-util.lua
makes it easier to deal with unit syndromes
scripts/
forum-dwarves.lua
helps copy df viewscreens to a file
full-heal.lua
fully heal a unit
remove-wear.lua
removes wear from all items in the fort
repeat.lua
repeatedly calls a script or a plugin
ShowUnitSyndromes.rb
shows syndromes affecting units and other relevant info
teleport.lua
teleports units
scripts/devel/
print-args.lua
scripts/fix/
blood-del.lua
makes it so civs don't bring barrels full of blood ichor or goo
feeding-timers.lua
reset the feeding timers of all units
scripts/gui/
hack-wish.lua
creates items out of any material
unit-info-viewer.lua
displays information about units
scripts/modtools/
add-syndrome.lua
add a syndrome to a unit or remove one
anonymous-script.lua
execute an lua script defined by a string. For example,
'scripts/modtools/anonymous-script "print(args[2] .. args[1])" one two'
will print 'twoone'. Useful for the *-trigger scripts.
force.lua
forces events: caravan, migrants, diplomat, megabeast, curiousbeast,
mischievousbeast, flier, siege, nightcreature
item-trigger.lua
triggers commands based on equipping, unequipping, and wounding units with items
interaction-trigger.lua
triggers commands when interactions happen
invader-item-destroyer.lua
destroys invaders' items when they die
moddable-gods.lua
standardized version of Putnam's moddable gods script
outside-only.lua
register buildings as outside only or inside only
replaces outsideOnly plugin
projectile-trigger.lua
standardized version of projectileExpansion
reaction-trigger.lua
trigger commands when custom reactions complete
replaces autoSyndrome
reaction-trigger-transition.lua
a tool for converting mods from autoSyndrome to reaction-trigger
random-trigger.lua
triggers random scripts that you register
skill-change.lua
for incrementing and setting skills
spawn-flow.lua
creates flows, like mist or dragonfire
syndrome-trigger.lua
trigger commands when syndromes happen
transform-unit.lua
shapeshifts a unit, possibly permanently
Misc improvements:
new function in utils.lua for standardized argument processing
Removed
digmat.rb: digFlood does the same functionality with less FPS impact
scripts/invasionNow: scripts/modtools/force.lua does it better
autoSyndrome replaced with scripts/modtools/reaction-trigger.lua
syndromeTrigger replaced with scripts/modtools/syndrome-trigger.lua
devel/printArgs plugin converted to scripts/devel/print-args.lua
DFHack v0.40.08-r1
==================
Was a mistake. Don't use it.
DFHack v0.34.11-r5
==================
::
Internals:
- support for calling a lua function via a protobuf request (demonstrated by dfhack-run --lua).
- support for basic filesystem operations (e.g. chdir, mkdir, rmdir, stat) in C++ and Lua
- Lua API for listing files in directory. Needed for mod-manager.
- Lua API for creating unit combat reports and writing to gamelog.
- Lua API for running arbitrary DFHack commands
- support for multiple raw/init.d/*.lua init scripts in one save.
- eventful now has a more friendly way of making custom sidebars
- on Linux and OSX the console now supports moving the cursor back and forward by a whole word.
New scripts:
- gui/mod-manager: allows installing/uninstalling mods into df from df/mods directory.
- gui/clone-uniform: duplicates the currently selected uniform in the military screen.
- fix/build-location: partial work-around for bug 5991 (trying to build wall while standing on it)
- undump-buildings: removes dump designation from materials used in buildings.
- exportlegends: exports data from legends mode, allowing a set-and-forget export of large worlds.
- log-region: each time a fort is loaded identifying information will be written to the gamelog.
- dfstatus: show an overview of critical stock quantities, including food, drinks, wood, and bars.
New commands:
- 'plant create' - spawn a new shrub under the cursor
- command-prompt: a dfhack command prompt in df.
New tweaks:
- craft-age-wear: make crafted items wear out with time like in old versions (bug 6003)
- adamantine-cloth-wear: stop adamantine clothing from wearing out (bug 6481)
- confirm-embark: adds a prompt before embarking (on the "prepare carefully" screen)
New plugins:
- rendermax: replace the renderer with something else. Most interesting is "rendermax light"- a lighting engine for df.
- automelt: allows marking stockpiles for automelt (i.e. any items placed in stocpile will be designated for melting)
- embark-tools: implementations of Embark Anywhere, Nano Embark, and a few other embark-related utilities
- building-hacks: Allows to add custom functionality and/or animations to buildings.
- petcapRemover: triggers pregnancies in creatures so that you can effectively raise the default
pet population cap from the default 50
Misc improvements:
- plant: move the 'grow', 'extirpate' and 'immolate' commands as 'plant' subcommands
- digfort: improved csv parsing, add start() comment handling
- exterminate: allow specifying a caste (exterminate gob:male)
- createitem: in adventure mode it now defaults to the controlled unit as maker.
- autotrade: adds "(Un)mark All" options to both panes of trade screen.
- mousequery: several usability improvements.
- mousequery: show live overlay (in menu area) of what's on the tile under the mouse cursor.
- search: workshop profile search added.
- dwarfmonitor: add screen to summarise preferences of fortress dwarfs.
- getplants: add autochop function to automate woodcutting.
- stocks: added more filtering and display options.
Siege engine plugin:
- engine quality and distance to target now affect accuracy
- firing the siege engine at a target produces a combat report
- improved movement speed computation for meandering units
- operators in Prepare To Fire mode are released from duty once
hungry/thirsty if there is a free replacement
DFHack v0.34.11-r4
==================
::
New commands:
- diggingInvaders - allows invaders to dig and/or deconstruct walls and buildings in order to get at your dwarves.
- digFlood - automatically dig out specified veins as they are revealed
- enable, disable - Built-in commands that can be used to enable/disable many plugins.
- restrictice - Restrict traffic on squares above visible ice.
- restrictliquid - Restrict traffic on every visible square with liquid.
- treefarm - automatically chop trees and dig obsidian
New scripts:
- autobutcher: A GUI front-end for the autobutcher plugin.
- invasionNow: trigger an invasion, or many
- locate_ore: scan the map for unmined ore veins
- masspit: designate caged creatures in a zone for pitting
- multicmd: run a sequence of dfhack commands, separated by ';'
- startdwarf: change the number of dwarves for a new embark
- digmat: dig veins/layers tile by tile, as discovered
Misc improvements:
- autoSyndrome:
disable by default
reorganized special tags
minimized error spam
reset policies: if the target already has an instance of the syndrome you can skip,
add another instance, reset the timer, or add the full duration to the time remaining
- core: fix SC_WORLD_(UN)LOADED event for arena mode
- exterminate: renamed from slayrace, add help message, add butcher mode
- fastdwarf: fixed bug involving fastdwarf and teledwarf being on at the same time
- magmasource: rename to 'source', allow water/magma sources/drains
- ruby: add df.dfhack_run "somecommand"
- syndromeTrigger: replaces and extends trueTransformation. Can trigger things when syndromes are added for any reason.
- tiletypes: support changing tile material to arbitrary stone.
- workNow: can optionally look for jobs when jobs are completed
New tweaks:
- hive-crash: Prevent crash if bees die in a hive with ungathered products (bug 6368).
New plugins:
- 3dveins: Reshapes all veins on the map in a way that flows between Z levels. May be unstable. Backup before using.
- autotrade: Automatically send items in marked stockpiles to trade depot, when trading is possible.
- buildingplan: Place furniture before it's built
- dwarfmonitor: Records dwarf activity to measure fort efficiency
- mousequery: Look and poke at the map elements with the mouse.
- outsideOnly: make raw-specified buildings impossible to build inside
- resume: A plugin to help display and resume suspended constructions conveniently
- stocks: An improved stocks display screen.
Internals:
- Core: there is now a per-save dfhack.init file for when the save is loaded, and another for when it is unloaded
- EventManager: fixed job completion detection, fixed removal of TICK events, added EQUIPMENT_CHANGE event
- Lua API for a better random number generator and perlin noise functions.
- Once: easy way to make sure something happens once per run of DF, such as an error message
DFHack v0.34.11-r3
==================
::
Internals:
- support for displaying active keybindings properly.
- support for reusable widgets in lua screen library.
- Maps::canStepBetween: returns whether you can walk between two tiles in one step.
- EventManager: monitors various in game events centrally so that individual plugins
don't have to monitor the same things redundantly.
- Now works with OSX 10.6.8
Notable bugfixes:
- autobutcher can be re-enabled again after being stopped.
- stopped Dwarf Manipulator from unmasking vampires.
- Stonesense is now fixed on OSX
Misc improvements:
- 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
- fix/cloth-stockpile: fixes bug 5739; needs to be run after savegame load every time.
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 (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.
- gui/advfort: a way to do jobs with your adventurer (e.g. build fort).
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, 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.
New Eventful plugin:
A collection of lua events, that will allow new ways to interact with df world.
Auto syndrome plugin:
A way of automatically applying boiling rock syndromes and calling dfhack commands controlled by raws.
Infinite sky plugin:
Create new z-levels automatically or on request.
True transformation plugin:
A better way of doing permanent transformations that allows later transformations.
Work now plugin:
Makes the game assign jobs every time you pause.
DFHack v0.34.11-r2
==================
::
Internals:
- full support for Mac OS X.
- a plugin that adds scripting in ruby.
- support for interposing virtual methods in DF from C++ plugins.
- support for creating new interface screens from C++ and lua.
- added various other API functions.
Notable bugfixes:
- better terminal reset after exit on linux.
- seedwatch now works on reclaim.
- the sort plugin won't crash on cages anymore.
Misc improvements:
- autodump: can move items to any walkable tile, not just floors.
- stripcaged: by default keep armor, new dumparmor option.
- zone: allow non-domesticated birds in nestboxes.
- workflow: quality range in constraints.
- cleanplants: new command to remove rain water from plants.
- liquids: can paint permaflow, i.e. what makes rivers power water wheels.
- prospect: pre-embark prospector accounts for caves & magma sea in its estimate.
- rename: supports renaming stockpiles, workshops, traps, siege engines.
- fastdwarf: now has an additional option to make dwarves teleport to their destination.
New commands:
- misery: multiplies every negative thought gained (2x by default).
- digtype: designates every tile of the same type of vein on the map for 'digging' (any dig designation).
New tweaks:
- tweak stable-cursor: keeps exact cursor position between d/k/t/q/v etc menus.
- tweak patrol-duty: makes Train orders reduce patrol timer, like the binary patch does.
- tweak readable-build-plate: fix unreadable truncation in unit pressure plate build ui.
- tweak stable-temp: fixes bug 6012; may improve FPS by 50-100% on a slow item-heavy fort.
- tweak fast-heat: speeds up item heating & cooling, thus making stable-temp act faster.
- tweak fix-dimensions: fixes subtracting small amounts from stacked liquids etc.
- tweak advmode-contained: fixes UI bug in custom reactions with container inputs in advmode.
- tweak fast-trade: Shift-Enter for selecting items quckly in Trade and Move to Depot screens.
- tweak military-stable-assign: Stop rightmost list of military->Positions from jumping to top.
- tweak military-color-assigned: In same list, color already assigned units in brown & green.
New scripts:
- fixnaked: removes thoughts about nakedness.
- setfps: set FPS cap at runtime, in case you want slow motion or speed-up.
- siren: wakes up units, stops breaks and parties - but causes bad thoughts.
- fix/population-cap: run after every migrant wave to prevent exceeding the cap.
- fix/stable-temp: counts items with temperature updates; does instant one-shot stable-temp.
- fix/loyaltycascade: fix units allegiance, eg after ordering a dwarf merchant kill.
- deathcause: shows the circumstances of death for a given body.
- digfort: designate areas to dig from a csv file.
- drainaquifer: remove aquifers from the map.
- growcrops: cheat to make farm crops instantly grow.
- magmasource: continuously spawn magma from any map tile.
- removebadthoughts: delete all negative thoughts from your dwarves.
- slayrace: instakill all units of a given race, optionally with magma.
- superdwarf: per-creature fastdwarf.
New GUI scripts:
- gui/mechanisms: browse mechanism links of the current building.
- gui/room-list: browse other rooms owned by the unit when assigning one.
- gui/liquids: a GUI front-end for the liquids plugin.
- gui/rename: renaming stockpiles, workshops and units via an in-game dialog.
- gui/power-meter: front-end for the Power Meter plugin.
- gui/siege-engine: front-end for the Siege Engine plugin.
- gui/choose-weapons: auto-choose matching weapons in the military equip screen.
Autolabor plugin:
- can set nonidle hauler percentage.
- broker excluded from all labors when needed at depot.
- likewise, anybody with a scheduled diplomat meeting.
New Dwarf Manipulator plugin:
Open the unit list, and press 'l' to access a Dwarf Therapist like UI in the game.
New Steam Engine plugin:
Dwarven Water Reactors don't make any sense whatsoever and cause lag, so this may be
a replacement for those concerned by it. The plugin detects if a workshop with a
certain name is in the raws used by the current world, and provides the necessary
behavior. See hack/raw/*_steam_engine.txt for the necessary raw definitions.
Note: Stuff like animal treadmills might be more period, but absolutely can't be
done with tools dfhack has access to.
New Power Meter plugin:
When activated, implements a pressure plate modification that detects power in gear
boxes built on the four adjacent N/S/W/E tiles. The gui/power-meter script implements
the necessary build configuration UI.
New Siege Engine plugin:
When enabled and configured via gui/siege-engine, allows aiming siege engines
at a designated rectangular area with 360 degree fire range and across Z levels;
this works by rewriting the projectile trajectory immediately after it appears.
Also supports loading catapults with non-boulder projectiles, taking from a stockpile,
and restricting operator skill range like with ordinary workshops.
Disclaimer: not in any way to undermine the future siege update from Toady, but
the aiming logic of existing engines hasn't been updated since 2D, and is almost
useless above ground :(. Again, things like making siegers bring their own engines
is totally out of the scope of dfhack and can only be done by Toady.
New Add Spatter plugin:
Detects reactions with certain names in the raws, and changes them from adding
improvements to adding item contaminants. This allows directly covering items
with poisons. The added spatters are immune both to water and 'clean items'.
Intended to give some use to all those giant cave spider poison barrels brought
by the caravans.

@ -0,0 +1,969 @@
.. comment
This is the changelog file for DFHack. If you add or change anything, note
it here under the heading "DFHack Future", in the appropriate section.
Items within each section are listed in alphabetical order to minimise merge
conflicts. Try to match the style and level of detail of the other entries.
Sections for each release are added as required, and consist solely of the
following in order as subheadings::
Internals
Lua
New [Internal Commands | Plugins | Scripts | Tweaks]
Fixes
Misc Improvements
Removed
When referring to a script, plugin, or command, use backticks (```) to
create a link to the relevant documentation - and check that the docs are
still up to date!
When adding a new release, change "DFHack future" to the appropriate title
before releasing, and then add a new "DFHack future" section after releasing.
#########
Changelog
#########
.. contents::
:depth: 2
DFHack 0.40.24-r4
=================
Internals
---------
- A method for caching screen output is now available to Lua (and C++)
- Developer plugins can be ignored on startup by setting the ``DFHACK_NO_DEV_PLUGINS`` environment variable
- The console on Linux and OS X now recognizes keyboard input between prompts
- JSON libraries available (C++ and Lua)
- More DFHack build information used in plugin version checks and available to plugins and lua scripts
- Fixed a rare overflow issue that could cause crashes on Linux and OS X
- Stopped DF window from receiving input when unfocused on OS X
- Fixed issues with keybindings involving Ctrl-A and Ctrl-Z, as well as Alt-E/U/N on OS X
- Multiple contexts can now be specified when adding keybindings
- Keybindings can now use F10-F12 and 0-9
- Plugin system is no longer restricted to plugins that exist on startup
- :file:`dfhack.init` file locations significantly generalized
Lua
---
- Scripts can be enabled with the built-in enable/disable commands
- A new function, ``reqscript()``, is available as a safer alternative to ``script_environment()``
- Lua viewscreens can choose not to intercept the OPTIONS keybinding
New internal commands
---------------------
- kill-lua: Interrupt running Lua scripts
- type: Show where a command is implemented
New plugins
-----------
- `confirm`: Adds confirmation dialogs for several potentially dangerous actions
- `fix-unit-occupancy`: Fixes issues with unit occupancy, such as faulty "unit blocking tile" messages (:bug:`3499`)
- title-version (formerly vshook): Display DFHack version on title screen
New scripts
-----------
- `armoks-blessing`: Adjust all attributes, personality, age and skills of all dwarves in play
- `brainwash`: brainwash a dwarf (modifying their personality)
- `burial`: sets all unowned coffins to allow burial ("-pets" to allow pets too)
- `deteriorateclothes`: make worn clothes on the ground wear far faster to boost FPS
- `deterioratecorpses`: make body parts wear away far faster to boost FPS
- `deterioratefood`: make food vanish after a few months if not used
- `elevate-mental`: elevate all the mental attributes of a unit
- `elevate-physical`: elevate all the physical attributes of a unit
- `emigration`: stressed dwarves may leave your fortress if they see a chance
- `fix-ster`: changes fertility/sterility of animals or dwarves
- `gui/family-affairs`: investigate and alter romantic relationships
- `make-legendary`: modify skill(s) of a single unit
- `modtools/create-unit`: create new units from nothing
- `modtools/equip-item`: a script to equip items on units
- `points`: set number of points available at embark screen
- `pref-adjust`: Adjust all preferences of all dwarves in play
- `rejuvenate`: make any "old" dwarf 20 years old
- `starvingdead`: make undead weaken after one month on the map, and crumble after six
- `view-item-info`: adds information and customisable descriptions to item viewscreens
- `warn-starving`: check for starving, thirsty, or very drowsy units and pause with warning if any are found
New tweaks
----------
- embark-profile-name: Allows the use of lowercase letters when saving embark profiles
- kitchen-keys: Fixes DF kitchen meal keybindings
- kitchen-prefs-color: Changes color of enabled items to green in kitchen preferences
- kitchen-prefs-empty: Fixes a layout issue with empty kitchen tabs
Fixes
-----
- Plugins with vmethod hooks can now be reloaded on OS X
- Lua's ``os.system()`` now works on OS X
- Fixed default arguments in Lua gametype detection functions
- Circular lua dependencies (reqscript/script_environment) fixed
- Prevented crash in ``Items::createItem()``
- `buildingplan`: Now supports hatch covers
- `gui/create-item`: fixed assigning quality to items, made :kbd:`Esc` work properly
- `gui/gm-editor`: handles lua tables properly
- help: now recognizes built-in commands, like "help"
- `manipulator`: fixed crash when selecting custom professions when none are found
- `remotefortressreader`: fixed crash when attempting to send map info when no map was loaded
- `search-plugin`: fixed crash in unit list after cancelling a job; fixed crash when disabling stockpile category after searching in a subcategory
- `stockpiles`: now checks/sanitizes filenames when saving
- `stocks`: fixed a crash when right-clicking
- `steam-engine`: fixed a crash on arena load; number keys (e.g. 2/8) take priority over cursor keys when applicable
- tweak fps-min fixed
- tweak farm-plot-select: Stopped controls from appearing when plots weren't fully built
- `workflow`: Fixed some issues with stuck jobs. Existing stuck jobs must be cancelled and re-added
- `zone`: Fixed a crash when using ``zone set`` (and a few other potential crashes)
Misc Improvements
-----------------
- DFHack documentation:
- massively reorganised, into files of more readable size
- added many missing entries
- indexes, internal links, offline search all documents
- includes documentation of linked projects (df-structures, third-party scripts)
- better HTML generation with Sphinx
- documentation for scripts now located in source files
- `autolabor`:
- Stopped modification of labors that shouldn't be modified for brokers/diplomats
- Prioritize skilled dwarves more efficiently
- Prevent dwarves from running away with tools from previous jobs
- `automaterial`: Fixed several issues with constructions being allowed/disallowed incorrectly when using box-select
- `dwarfmonitor`:
- widgets' positions, formats, etc. are now customizable (see Readme)
- weather display now separated from the date display
- New mouse cursor widget
- `gui/dfstatus`: Can enable/disable individual categories and customize metal bar list
- `full-heal`: ``-r`` option removes corpses
- `gui/gm-editor`
- Pointers can now be displaced
- Added some useful aliases: "item" for the selected item, "screen" for the current screen, etc.
- Now avoids errors with unrecognized types
- `gui/hack-wish`: renamed to `gui/create-item`
- "keybinding list" accepts a context
- `lever`:
- Lists lever names
- "lever pull" can be used to pull the currently-selected lever
- memview: Fixed display issue
- `modtools/create-item`: arguments are named more clearly, and you can specify the creator to be the unit with id ``df.global.unit_next_id-1`` (useful in conjunction with `modtools/create-unit`)
- nyan: Can now be stopped with dfhack-run
- plug: lists all plugins; shows state and number of commands in plugins
- `prospect`: works from within command-prompt
- `quicksave`: Restricted to fortress mode
- `remotefortressreader`: Exposes more information
- `search-plugin`:
- Supports noble suggestion screen (e.g. suggesting a baron)
- Supports fortress mode loo[k] menu
- Recognizes ? and ; keys
- `stocks`: can now match beginning and end of item names
- `teleport`: Fixed cursor recognition
- `tidlers`, `twaterlvl`: now implemented by scripts instead of a plugin
- `tweak`:
- debug output now logged to stderr.log instead of console - makes DFHack start faster
- farm-plot-select: Fixed issues with selecting undiscovered crops
- `workflow`: Improved handling of plant reactions
Removed
-------
- `embark-tools` nano: 1x1 embarks are now possible in vanilla 0.40.24
DFHack 0.40.24-r3
=================
Internals
---------
- Ruby library now included on OS X - Ruby scripts should work on OS X 10.10
- libstdc++ should work with older versions of OS X
- Added support for ``onLoadMap.init``/``onUnloadMap.init`` scripts
- game type detection functions are now available in the World module
- The ``DFHACK_LOG_MEM_RANGES`` environment variable can be used to log information to ``stderr.log`` on OS X
- Fixed adventure mode menu names
- Fixed command usage information for some commands
Lua
---
- Lua scripts will only be reloaded if necessary
- Added a ``df2console()`` wrapper, useful for printing DF (CP437-encoded) text to the console in a portable way
- Added a ``strerror()`` wrapper
New Internal Commands
---------------------
- `hide`, `show`: hide and show the console on Windows
- `sc-script`: Allows additional scripts to be run when certain events occur (similar to onLoad*.init scripts)
New Plugins
-----------
- `autohauler`: A hauling-only version of autolabor
New Scripts
-----------
- `modtools/reaction-product-trigger`: triggers callbacks when products are produced (contrast with when reactions complete)
New Tweaks
----------
- `fps-min <tweak>`: Fixes the in-game minimum FPS setting
- `shift-8-scroll <tweak>`: Gives Shift+8 (or ``*``) priority when scrolling menus, instead of scrolling the map
- `tradereq-pet-gender <tweak>`: Displays pet genders on the trade request screen
Fixes
-----
- Fixed game type detection in `3dveins`, `gui/create-item`, `reveal`, `seedwatch`
- PRELOAD_LIB: More extensible on Linux
- `add-spatter`, `eventful`: Fixed crash on world load
- `add-thought`: Now has a proper subthought arg.
- `building-hacks`: Made buildings produce/consume correct amount of power
- `fix-armory`: compiles and is available again (albeit with issues)
- `gui/gm-editor`: Added search option (accessible with "s")
- `hack-wish <gui/create-item>`: Made items stack properly.
- `modtools/skill-change`: Made level granularity work properly.
- `show-unit-syndromes`: should work
- `stockflow`:
- Fixed error message in Arena mode
- no longer checks the DF version
- fixed ballistic arrow head orders
- convinces the bookkeeper to update records more often'
- `zone`: Stopped crash when scrolling cage owner list
Misc Improvements
-----------------
- `autolabor`: A negative pool size can be specified to use the most unskilled dwarves
- `building-hacks`:
- Added a way to allow building to work even if it consumes more power than is available.
- Added setPower/getPower functions.
- `catsplosion`: Can now trigger pregnancies in (most) other creatures
- `exportlegends`: ``info`` and ``all`` options export ``legends_plus.xml`` with more data for legends utilities
- `manipulator`:
- Added ability to edit nicknames/profession names
- added "Job" as a View Type, in addition to "Profession" and "Squad"
- added custom profession templates with masking
- `remotefortressreader`: Exposes more information
DFHack 0.40.24-r2
=================
Internals
---------
- Lua scripts can set environment variables of each other with dfhack.run_script_with_env.
- Lua scripts can now call each others internal nonlocal functions with dfhack.script_environment(scriptName).functionName(arg1,arg2).
- `eventful`: Lua reactions no longer require LUA_HOOK as a prefix; you can register a callback for the completion of any reaction with a name
- Filesystem module now provides file access/modification times and can list directories (normally and recursively)
- Units Module: New functions::
isWar
isHunter
isAvailableForAdoption
isOwnCiv
isOwnRace
getRaceName
getRaceNamePlural
getRaceBabyName
getRaceChildName
isBaby
isChild
isAdult
isEggLayer
isGrazer
isMilkable
isTrainableWar
isTrainableHunting
isTamable
isMale
isFemale
isMerchant
isForest
isMarkedForSlaughter
- Buildings Module: New Functions::
isActivityZone
isPenPasture
isPitPond
isActive
findPenPitAt
Fixes
-----
- ``dfhack.run_script`` should correctly find save-specific scripts now.
- `add-thought`: updated to properly affect stress.
- `hfs-pit`: should work now
- `autobutcher`: takes gelding into account
- init.lua existence checks should be more reliable (notably when using non-English locales)
Misc Improvements
-----------------
Multiline commands are now possible inside dfhack.init scripts. See :file:`dfhack.init-example` for example usage.
DFHack 0.40.24-r1
=================
Internals
---------
CMake shouldn't cache DFHACK_RELEASE anymore. People may need to manually update/delete their CMake cache files to get rid of it.
DFHack 0.40.24-r0
=================
Internals
---------
- `EventManager`: fixed crash error with EQUIPMENT_CHANGE event.
- key modifier state exposed to Lua (ie :kbd:`Ctrl`, :kbd:`Alt`, :kbd:`Shift`)
Fixes
-----
``dfhack.sh`` can now be run from other directories on OS X
New Plugins
-----------
- `blueprint`: export part of your fortress to quickfort .csv files
New Scripts
-----------
- `hotkey-notes`: print key, name, and jump position of hotkeys
Removed
-------
- embark.lua
- needs_porting/*
Misc Improvements
-----------------
Added support for searching more lists
DFHack 0.40.23-r1
=================
Internals
- plugins will not be loaded if globals they specify as required are not located (should prevent some crashes)
Fixes
-----
- Fixed numerous (mostly Lua-related) crashes on OS X by including a more up-to-date libstdc++
- :kbd:`Alt` should no longer get stuck on Windows (and perhaps other platforms as well)
- `gui/advfort` works again
- `autobutcher`: takes sexualities into account
- devel/export-dt-ini: Updated for 0.40.20+
- `digfort`: now checks file type and existence
- `exportlegends`: Fixed map export
- `full-heal`: Fixed a problem with selecting units in the GUI
- `gui/hack-wish`: Fixed restrictive material filters
- `mousequery`: Changed box-select key to Alt+M
- `dwarfmonitor`: correct date display (month index, separator)
- `putontable`: added to the readme
- `siren` should work again
- stderr.log: removed excessive debug output on OS X
- `trackstop`: No longer prevents cancelling the removal of a track stop or roller.
- Fixed a display issue with ``PRINT_MODE:TEXT``
- Fixed a symbol error (MapExtras::BiomeInfo::MAX_LAYERS) when compiling DFHack in Debug mode
New Plugins
-----------
- `fortplan`: designate construction of (limited) buildings from .csv file, quickfort-style
New Scripts
-----------
- `gui/stockpiles`: an in-game interface for saving and loading stockpile settings files.
- `position`: Reports the current date, time, month, and season, plus some location info. Port/update of position.py
- `hfs-pit`: Digs a hole to hell under the cursor. Replaces needs_porting/hellhole.cpp
Removed
-------
- embark.lua: Obsolete, use `embark-tools`
New tweaks
----------
- `eggs-fertile <tweak>`: Displays an egg fertility indicator on nestboxes
- `max-wheelbarrow <tweak>`: Allows assigning more than 3 wheelbarrows to a stockpile
Misc Improvements
-----------------
- `embark-tools`: Added basic mouse support on the local map
- Made some adventure mode keybindings in :file:`dfhack.init-example` only work in adventure mode
- `gui/companion-order`: added a default keybinding
- further work on needs_porting
DFHack 0.40.19-r1
=================
Fixes
-----
- `modtools/reaction-trigger`: fixed typo
- `modtools/item-trigger`: should now work with item types
New plugins
-----------
- `savestock, loadstock <stocksettings>`: save and load stockpile settings across worlds and saves
New scripts
-----------
- `remove-stress`: set selected or all units unit to -1,000,000 stress (this script replaces removebadthoughts)
Misc improvements
-----------------
- `command-prompt`: can now access selected items, units, and buildings
- `autolabor`: add an optional talent pool parameter
DFHack 0.40.16-r1
=================
Internals
---------
- `EventManager` should handle INTERACTION triggers a little better. It still can get confused about who did what but only rarely.
- `EventManager` should no longer trigger REPORT events for old reports after loading a save.
- lua/persist-table: a convenient way of using persistent tables of arbitrary structure and dimension in Lua
Fixes
-----
- `mousequery`: Disabled when linking levers
- `stocks`: Melting should work now
- `full-heal`: Updated with proper argument handling
- `modtools/reaction-trigger-transition`: should produce the correct syntax now
- `superdwarf`: should work better now
- `forum-dwarves`: update for new df-structures changes
New Scripts
-----------
- `adaptation`: view or set the cavern adaptation level of your citizens
- `add-thought`: allows the user to add thoughts to creatures.
- `gaydar`: detect the sexual orientation of units on the map
- `markdown`: Save a copy of a text screen in markdown (for reddit among others).
- devel/all-bob: renames everyone Bob to help test interaction-trigger
Misc Improvements
-----------------
- `autodump`: Can now mark a stockpile for auto-dumping (similar to automelt and autotrade)
- `buildingplan`: Can now auto-allocate rooms to dwarves with specific positions (e.g. expedition leader, mayor)
- `dwarfmonitor`: now displays a weather indicator and date
- lua/syndrome-util, `modtools/add-syndrome`: now you can remove syndromes by SYN_CLASS
- No longer write empty :file:`.history` files
DFHack 0.40.15-r1
=================
Fixes
-----
- mousequery: Fixed behavior when selecting a tile on the lowest z-level
Misc Improvements
-----------------
- `EventManager`: deals with frame_counter getting reset properly now.
- `modtools/item-trigger`: fixed equip/unequip bug and corrected minor documentation error
- `teleport`: Updated with proper argument handling and proper unit-at-destination handling.
- `autotrade`: Removed the newly obsolete :guilabel:`Mark all` functionality.
- `search-plugin`: Adapts to the new trade screen column width
- `tweak fast-trade <tweak>`: Switching the fast-trade keybinding to Shift-Up/Shift-Down, due to Select All conflict
DFHack 0.40.14-r1
=================
Internals
---------
- The DFHack console can now be disabled by setting the DFHACK_DISABLE_CONSOLE environment variable: ``DFHACK_DISABLE_CONSOLE=1 ./dfhack``
Fixes
-----
- Stopped duplicate load/unload events when unloading a world
- Stopped ``-e`` from being echoed when DFHack quits on Linux
- `automelt`: now uses a faster method to locate items
- `autotrade`: "Mark all" no longer double-marks bin contents
- `drain-aquifer`: new script replaces the buggy plugin
- `embark-tools`: no longer conflicts with keys on the notes screen
- `fastdwarf`: Fixed problems with combat/attacks
- `forum-dwarves`: should work now
- `manipulator`: now uses a stable sort, allowing sorting by multiple categories
- `rendermax`: updated to work with 0.40
New Plugins
-----------
- `trackstop`: Shows track stop friction and dump direction in its :kbd:`q` menu
New Tweaks
----------
- farm-plot-select: Adds "Select all" and "Deselect all" options to farm plot menus
- import-priority-category: Allows changing the priority of all goods in a category when discussing an import agreement with the liaison
- manager-quantity: Removes the limit of 30 jobs per manager order
- civ-view-agreement: Fixes overlapping text on the "view agreement" screen
- nestbox-color: Fixes the color of built nestboxes
Misc Improvements
-----------------
- `exportlegends`: can now handle site maps
DFHack 0.40.13-r1
=================
Internals
---------
- unified spatter structs
- added ruby df.print_color(color, string) method for dfhack console
Fixes
-----
- no more ``-e`` after terminating
- fixed `superdwarf`
DFHack 0.40.12-r1
=================
Internals
---------
- support for global :file:`onLoadWorld.init` and :file:`onUnloadWorld.init` files, called when loading and unloading a world
- Close file after loading a binary patch.
New Plugins
-----------
- `hotkeys`: Shows ingame viewscreen with all dfhack keybindings active in current mode.
- `automelt`: allows marking stockpiles so any items placed in them will be designated for melting
Fixes
-----
- possible crash fixed for `gui/hack-wish`
- `search-plugin`: updated to not conflict with BUILDJOB_SUSPEND
- `workflow`: job_material_category -> dfhack_material_category
Misc Improvements
-----------------
- now you can use ``@`` to print things in interactive Lua with subtley different semantics
- optimizations for stockpiles for `autotrade` and `stockflow`
- updated `exportlegends` to work with new maps, dfhack 40.11 r1+
DFHack 0.40.11-r1
=================
Internals
- Plugins on OS X now use ``.plug.dylib` as an extension instead of ``.plug.so``
Fixes
-----
- `3dveins`: should no longer hang/crash on specific maps
- `autotrade`, `search-plugin`: fixed some layout issues
- `deathcause`: updated
- `gui/hack-wish`: should work now
- `reveal`: no longer allocates data for nonexistent map blocks
- Various documentation fixes and updates
DFHack v0.40.10-r1
==================
A few bugfixes.
DFHack v0.40.08-r2
==================
Internals
---------
- supported per save script folders
- Items module: added createItem function
- Sorted CMakeList for plugins and plugins/devel
- diggingInvaders no longer builds if plugin building is disabled
- `EventManager`: EQUIPMENT_CHANGE now triggers for new units. New events::
ON_REPORT
UNIT_ATTACK
UNLOAD
INTERACTION
New Scripts
-----------
- lua/repeat-util: makes it easier to make things repeat indefinitely
- lua/syndrome-util: makes it easier to deal with unit syndromes
- forum-dwarves: helps copy df viewscreens to a file
- full-heal: fully heal a unit
- remove-wear: removes wear from all items in the fort
- repeat: repeatedly calls a script or a plugin
- ShowUnitSyndromes: shows syndromes affecting units and other relevant info
- teleport: teleports units
- devel/print-args
- fix/blood-del: makes it so civs don't bring barrels full of blood ichor or goo
- fix/feeding-timers: reset the feeding timers of all units
- gui/hack-wish: creates items out of any material
- gui/unit-info-viewer: displays information about units
- modtools/add-syndrome: add a syndrome to a unit or remove one
- modtools/anonymous-script: execute an lua script defined by a string. Useful for the ``*-trigger`` scripts.
- modtools/force: forces events: caravan, migrants, diplomat, megabeast, curiousbeast, mischievousbeast, flier, siege, nightcreature
- modtools/item-trigger: triggers commands based on equipping, unequipping, and wounding units with items
- modtools/interaction-trigger: triggers commands when interactions happen
- modtools/invader-item-destroyer: destroys invaders' items when they die
- modtools/moddable-gods: standardized version of Putnam's moddable gods script
- modtools/projectile-trigger: standardized version of projectileExpansion
- modtools/reaction-trigger: trigger commands when custom reactions complete; replaces autoSyndrome
- modtools/reaction-trigger-transition: a tool for converting mods from autoSyndrome to reaction-trigger
- modtools/random-trigger: triggers random scripts that you register
- modtools/skill-change: for incrementing and setting skills
- modtools/spawn-flow: creates flows, like mist or dragonfire
- modtools/syndrome-trigger: trigger commands when syndromes happen
- modtools/transform-unit: shapeshifts a unit, possibly permanently
Misc improvements
-----------------
- new function in utils.lua for standardized argument processing
Removed
-------
- digmat.rb: digFlood does the same functionality with less FPS impact
- scripts/invasionNow: scripts/modtools/force.lua does it better
- autoSyndrome replaced with scripts/modtools/reaction-trigger.lua
- syndromeTrigger replaced with scripts/modtools/syndrome-trigger.lua
- devel/printArgs plugin converted to scripts/devel/print-args.lua
- outsideOnly plugin replaced by modtools/outside-only
DFHack v0.40.08-r1
==================
Was a mistake. Don't use it.
DFHack v0.34.11-r5
==================
Internals
---------
- support for calling a lua function via a protobuf request (demonstrated by dfhack-run --lua).
- support for basic filesystem operations (e.g. chdir, mkdir, rmdir, stat) in C++ and Lua
- Lua API for listing files in directory. Needed for mod-manager.
- Lua API for creating unit combat reports and writing to gamelog.
- Lua API for running arbitrary DFHack commands
- support for multiple ``raw/init.d/*.lua`` init scripts in one save.
- eventful now has a more friendly way of making custom sidebars
- on Linux and OS X the console now supports moving the cursor back and forward by a whole word.
New scripts
-----------
- gui/mod-manager: allows installing/uninstalling mods into df from df/mods directory.
- gui/clone-uniform: duplicates the currently selected uniform in the military screen.
- fix/build-location: partial work-around for bug 5991 (trying to build wall while standing on it)
- undump-buildings: removes dump designation from materials used in buildings.
- exportlegends: exports data from legends mode, allowing a set-and-forget export of large worlds.
- log-region: each time a fort is loaded identifying information will be written to the gamelog.
- dfstatus: show an overview of critical stock quantities, including food, drinks, wood, and bars.
- command-prompt: a dfhack command prompt in df.
New plugins
-----------
- rendermax: replace the renderer with something else, eg ``rendermax light``- a lighting engine
- automelt: allows marking stockpiles for automelt (i.e. any items placed in stocpile will be designated for melting)
- embark-tools: implementations of Embark Anywhere, Nano Embark, and a few other embark-related utilities
- building-hacks: Allows to add custom functionality and/or animations to buildings.
- petcapRemover: triggers pregnancies in creatures so that you can effectively raise the default pet population cap
- 'plant create': spawn a new shrub under the cursor
New tweaks
----------
- craft-age-wear: make crafted items wear out with time like in old versions (bug 6003)
- adamantine-cloth-wear: stop adamantine clothing from wearing out (bug 6481)
- confirm-embark: adds a prompt before embarking (on the "prepare carefully" screen)
Misc improvements
-----------------
- plant: move the 'grow', 'extirpate' and 'immolate' commands as 'plant' subcommands
- digfort: improved csv parsing, add start() comment handling
- exterminate: allow specifying a caste (exterminate gob:male)
- createitem: in adventure mode it now defaults to the controlled unit as maker.
- autotrade: adds "(Un)mark All" options to both panes of trade screen.
- mousequery: several usability improvements.
- mousequery: show live overlay (in menu area) of what's on the tile under the mouse cursor.
- search: workshop profile search added.
- dwarfmonitor: add screen to summarise preferences of fortress dwarfs.
- getplants: add autochop function to automate woodcutting.
- stocks: added more filtering and display options.
- Siege engine plugin:
- engine quality and distance to target now affect accuracy
- firing the siege engine at a target produces a combat report
- improved movement speed computation for meandering units
- operators in Prepare To Fire mode are released from duty once hungry/thirsty if there is a free replacement
DFHack v0.34.11-r4
==================
New commands
------------
- diggingInvaders - allows invaders to dig and/or deconstruct walls and buildings in order to get at your dwarves.
- digFlood - automatically dig out specified veins as they are revealed
- enable, disable - Built-in commands that can be used to enable/disable many plugins.
- restrictice - Restrict traffic on squares above visible ice.
- restrictliquid - Restrict traffic on every visible square with liquid.
- treefarm - automatically chop trees and dig obsidian
New Scripts
-----------
- autobutcher: A GUI front-end for the autobutcher plugin.
- invasionNow: trigger an invasion, or many
- locate_ore: scan the map for unmined ore veins
- masspit: designate caged creatures in a zone for pitting
- multicmd: run a sequence of dfhack commands, separated by ';'
- startdwarf: change the number of dwarves for a new embark
- digmat: dig veins/layers tile by tile, as discovered
Misc improvements
-----------------
- autoSyndrome:
- disable by default
- reorganized special tags
- minimized error spam
- reset policies: if the target already has an instance of the syndrome you can skip,
add another instance, reset the timer, or add the full duration to the time remaining
- core: fix SC_WORLD_(UN)LOADED event for arena mode
- exterminate: renamed from slayrace, add help message, add butcher mode
- fastdwarf: fixed bug involving fastdwarf and teledwarf being on at the same time
- magmasource: rename to ``source``, allow water/magma sources/drains
- ruby: add df.dfhack_run "somecommand"
- syndromeTrigger: replaces and extends trueTransformation. Can trigger things when syndromes are added for any reason.
- tiletypes: support changing tile material to arbitrary stone.
- workNow: can optionally look for jobs when jobs are completed
New tweaks
----------
- hive-crash: Prevent crash if bees die in a hive with ungathered products (bug 6368).
New plugins
-----------
- 3dveins: Reshapes all veins on the map in a way that flows between Z levels. May be unstable. Backup before using.
- autotrade: Automatically send items in marked stockpiles to trade depot, when trading is possible.
- buildingplan: Place furniture before it's built
- dwarfmonitor: Records dwarf activity to measure fort efficiency
- mousequery: Look and poke at the map elements with the mouse.
- outsideOnly: make raw-specified buildings impossible to build inside
- resume: A plugin to help display and resume suspended constructions conveniently
- stocks: An improved stocks display screen.
Internals
---------
- Core: there is now a per-save dfhack.init file for when the save is loaded, and another for when it is unloaded
- EventManager: fixed job completion detection, fixed removal of TICK events, added EQUIPMENT_CHANGE event
- Lua API for a better random number generator and perlin noise functions.
- Once: easy way to make sure something happens once per run of DF, such as an error message
DFHack v0.34.11-r3
==================
Internals
---------
- support for displaying active keybindings properly.
- support for reusable widgets in lua screen library.
- Maps::canStepBetween: returns whether you can walk between two tiles in one step.
- EventManager: monitors various in game events centrally so that individual plugins
don't have to monitor the same things redundantly.
- Now works with OS X 10.6.8
Notable bugfixes
----------------
- autobutcher can be re-enabled again after being stopped.
- stopped Dwarf Manipulator from unmasking vampires.
- Stonesense is now fixed on OS X
Misc improvements
-----------------
- 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
- 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.
- Auto syndrome plugin: A way of automatically applying boiling rock syndromes and calling dfhack commands controlled by raws.
- Infinite sky plugin: Create new z-levels automatically or on request.
- True transformation plugin: A better way of doing permanent transformations that allows later transformations.
- Work now plugin: Makes the game assign jobs every time you pause.
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
- fix/cloth-stockpile: fixes bug 5739; needs to be run after savegame load every time.
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 (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.
- gui/advfort: a way to do jobs with your adventurer (e.g. build fort).
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.
New Plugins
-----------
- fix-armory: 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.
- search: Adds an incremental search function to the Stocks, Trading, Stockpile and Unit List screens.
- automaterial: 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: Reworked to make use of lua modules, now all the scripts can be used from other scripts.
- Eventful: A collection of lua events, that will allow new ways to interact with df world.
DFHack v0.34.11-r2
==================
Internals
---------
- full support for Mac OS X.
- a plugin that adds scripting in ruby.
- support for interposing virtual methods in DF from C++ plugins.
- support for creating new interface screens from C++ and lua.
- added various other API functions.
Notable bugfixes
----------------
- better terminal reset after exit on linux.
- seedwatch now works on reclaim.
- the sort plugin won't crash on cages anymore.
Misc improvements
-----------------
- autodump: can move items to any walkable tile, not just floors.
- stripcaged: by default keep armor, new dumparmor option.
- zone: allow non-domesticated birds in nestboxes.
- workflow: quality range in constraints.
- cleanplants: new command to remove rain water from plants.
- liquids: can paint permaflow, i.e. what makes rivers power water wheels.
- prospect: pre-embark prospector accounts for caves & magma sea in its estimate.
- rename: supports renaming stockpiles, workshops, traps, siege engines.
- fastdwarf: now has an additional option to make dwarves teleport to their destination.
- Autolabor plugin:
- can set nonidle hauler percentage.
- broker excluded from all labors when needed at depot.
- likewise, anybody with a scheduled diplomat meeting.
New commands
------------
- misery: multiplies every negative thought gained (2x by default).
- digtype: designates every tile of the same type of vein on the map for 'digging' (any dig designation).
New tweaks
----------
- tweak stable-cursor: keeps exact cursor position between d/k/t/q/v etc menus.
- tweak patrol-duty: makes Train orders reduce patrol timer, like the binary patch does.
- tweak readable-build-plate: fix unreadable truncation in unit pressure plate build ui.
- tweak stable-temp: fixes bug 6012; may improve FPS by 50-100% on a slow item-heavy fort.
- tweak fast-heat: speeds up item heating & cooling, thus making stable-temp act faster.
- tweak fix-dimensions: fixes subtracting small amounts from stacked liquids etc.
- tweak advmode-contained: fixes UI bug in custom reactions with container inputs in advmode.
- tweak fast-trade: Shift-Enter for selecting items quckly in Trade and Move to Depot screens.
- tweak military-stable-assign: Stop rightmost list of military->Positions from jumping to top.
- tweak military-color-assigned: In same list, color already assigned units in brown & green.
New scripts
-----------
- fixnaked: removes thoughts about nakedness.
- setfps: set FPS cap at runtime, in case you want slow motion or speed-up.
- siren: wakes up units, stops breaks and parties - but causes bad thoughts.
- fix/population-cap: run after every migrant wave to prevent exceeding the cap.
- fix/stable-temp: counts items with temperature updates; does instant one-shot stable-temp.
- fix/loyaltycascade: fix units allegiance, eg after ordering a dwarf merchant kill.
- deathcause: shows the circumstances of death for a given body.
- digfort: designate areas to dig from a csv file.
- drainaquifer: remove aquifers from the map.
- growcrops: cheat to make farm crops instantly grow.
- magmasource: continuously spawn magma from any map tile.
- removebadthoughts: delete all negative thoughts from your dwarves.
- slayrace: instakill all units of a given race, optionally with magma.
- superdwarf: per-creature fastdwarf.
- gui/mechanisms: browse mechanism links of the current building.
- gui/room-list: browse other rooms owned by the unit when assigning one.
- gui/liquids: a GUI front-end for the liquids plugin.
- gui/rename: renaming stockpiles, workshops and units via an in-game dialog.
- gui/power-meter: front-end for the Power Meter plugin.
- gui/siege-engine: front-end for the Siege Engine plugin.
- gui/choose-weapons: auto-choose matching weapons in the military equip screen.
New Plugins
-----------
- Dwarf Manipulator: Open the unit list, and press 'l' to access a Dwarf Therapist like UI in the game.
- Steam Engine:
Dwarven Water Reactors don't make any sense whatsoever and cause lag, so this may be
a replacement for those concerned by it. The plugin detects if a workshop with a
certain name is in the raws used by the current world, and provides the necessary
behavior. See ``hack/raw/*_steam_engine.txt`` for the necessary raw definitions.
Note: Stuff like animal treadmills might be more period, but absolutely can't be
done with tools dfhack has access to.
- Power Meter:
When activated, implements a pressure plate modification that detects power in gear
boxes built on the four adjacent N/S/W/E tiles. The gui/power-meter script implements
the necessary build configuration UI.
- Siege Engine:
When enabled and configured via gui/siege-engine, allows aiming siege engines
at a designated rectangular area with 360 degree fire range and across Z levels;
this works by rewriting the projectile trajectory immediately after it appears.
Also supports loading catapults with non-boulder projectiles, taking from a stockpile,
and restricting operator skill range like with ordinary workshops.
Disclaimer: not in any way to undermine the future siege update from Toady, but
the aiming logic of existing engines hasn't been updated since 2D, and is almost
useless above ground :(. Again, things like making siegers bring their own engines
is totally out of the scope of dfhack and can only be done by Toady.
- Add Spatter:
Detects reactions with certain names in the raws, and changes them from adding
improvements to adding item contaminants. This allows directly covering items
with poisons. The added spatters are immune both to water and 'clean items'.
Intended to give some use to all those giant cave spider poison barrels brought
by the caravans.

@ -4,13 +4,13 @@
<html lang="en-US"> <html lang="en-US">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta http-equiv="refresh" content="0;url=./docs/html/README.html"> <meta http-equiv="refresh" content="0;url=./docs/html/index.html">
<script type="text/javascript"> <script type="text/javascript">
window.location.href = "./docs/html/README.html" window.location.href = "./docs/html/index.html"
</script> </script>
<title>Page Redirection</title> <title>Page Redirection</title>
</head> </head>
<body> <body>
If you are not redirected automatically, follow the <a href='./docs/html/README.html'>link to the documentation.</a> Follow this <a href='./docs/html/index.html'>link to the documentation.</a>
</body> </body>
</html> </html>

@ -0,0 +1,24 @@
#DFHack Readme
[![Build Status](https://travis-ci.org/DFHack/dfhack.svg?branch=develop)]
(https://travis-ci.org/DFHack/dfhack)
[![Documentation Status](https://readthedocs.org/projects/dfhack/badge)]
(https://dfhack.readthedocs.org)
[![License](https://img.shields.io/badge/license-ZLib-blue.svg)]
(https://en.wikipedia.org/wiki/Zlib_License)
[![Github Issues](http://githubbadges.herokuapp.com/DFHack/dfhack/issues)]
(https://github.com/DFHack/dfhack/issues)
[![Open Pulls](http://githubbadges.herokuapp.com/DFHack/dfhack/pulls)]
(https://github.com/DFHack/dfhack/pulls)
DFHack is a Dwarf Fortress memory access library, distributed with scripts
and plugins implementing a wide variety of useful functions and tools.
The full documentation [is available online here](https://dfhack.readthedocs.org),
from the README.html page in the DFHack distribution, or as raw text in the `./docs` folder.
If you're an end-user, modder, or interested in contributing to DFHack -
go read those docs.
If that's unclear or you need more help, try [the Bay12 forums thread]
(http://www.bay12forums.com/smf/index.php?topic=139553) or the #dfhack IRC
channel on freenode.

@ -1,8 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
# DFHack documentation build configuration file, created by # DFHack documentation build configuration file
# sphinx-quickstart on Tue Sep 22 17:34:54 2015.
# #
# This file is execfile()d with the current directory set to its # This file is execfile()d with the current directory set to its
# containing dir. # containing dir.
@ -14,68 +13,115 @@
# serve to show the default. # serve to show the default.
import fnmatch import fnmatch
import io from io import open
import os import os
import shlex import shlex
import sys import sys
from os import listdir
from os.path import isfile, join, isdir # -- Autodoc for DFhack scripts -------------------------------------------
#import sys
def doc_dir(dirname, files):
currentDir = '@CMAKE_CURRENT_SOURCE_DIR@' """Yield (command, includepath) for each script in the directory."""
sdir = os.path.relpath(dirname, '.').replace('\\', '/').replace('../', '')
def makeIncludeAll(directory, extension): for f in files:
outputFile = join(directory,'include-all.rst') if f[-3:] not in ('lua', '.rb'):
#print(outputFile) continue
files = [ f for f in listdir(directory) if isfile(join(directory,f)) and f.endswith(extension) ] with open(os.path.join(dirname, f), 'r', encoding='utf8') as fstream:
files.sort() text = [l.rstrip() for l in fstream.readlines() if l.strip()]
out = open(outputFile, 'w') command = None
for f in files: for line in text:
#TODO: check if the file contains the BEGIN_DOCS string if command and line == len(line) * '=':
#print(join(directory,f)) yield command, sdir + '/' + f
fstream = io.open(join(directory,f), 'r', encoding='utf8') break
data = fstream.read().replace('\n','') command = line
fstream.close()
if 'BEGIN_DOCS' in data:
out.write('.. include:: ' + join(directory,f) + '\n :start-after: BEGIN_DOCS\n :end-before: END_DOCS\n\n') def document_scripts():
out.close() """Autodoc for files with the magic script documentation marker strings.
def makeAllIncludeAll(directory, extension): Creates a file for eack kind of script (base/devel/fix/gui/modtools)
for root, subdirs, files in os.walk(directory): with all the ".. include::" directives to pull out docs between the
if isdir(root): magic strings.
makeIncludeAll(root, extension) """
# First, we collect the commands and paths to include in our docs
makeAllIncludeAll(currentDir + '/scripts', '.lua') scripts = []
for root, _, files in os.walk('scripts'):
# If extensions (or modules to document with autodoc) are in another directory, scripts.extend(doc_dir(root, files))
# add these directories to sys.path here. If the directory is relative to the # Next we split by type and create include directives sorted by command
# documentation root, use os.path.abspath to make it absolute, like shown here. kinds = {'base': [], 'devel': [], 'fix': [], 'gui': [], 'modtools': []}
#sys.path.insert(0, os.path.abspath('.')) for s in scripts:
k_fname = s[0].split('/', 1)
if len(k_fname) == 1:
kinds['base'].append(s)
else:
kinds.get(k_fname[0], []).append(s)
template = ('.. _{}:\n\n'
'.. include:: /{}\n'
' :start-after: =begin\n'
' :end-before: =end\n')
for key, value in kinds.items():
kinds[key] = [template.format(x[0], x[1])
for x in sorted(value, key=lambda x: x[0])]
# Finally, we write our _auto/* files for each kind of script
if not os.path.isdir('docs/_auto'):
os.mkdir('docs/_auto')
head = {
'base': 'Basic Scripts',
'devel': 'Development Scripts',
'fix': 'Bugfixing Scripts',
'gui': 'GUI Scripts',
'modtools': 'Scripts for Modders'}
for k in head:
title = ('.. _{k}:\n\n{l}\n{t}\n{l}\n\n'
'.. include:: /scripts/{a}about.txt\n\n'
'.. contents::\n\n').format(
k=k, t=head[k], l=len(head[k])*'#', a=('' if k=='base' else k+'/'))
mode = 'w' if sys.version_info.major > 2 else 'wb'
with open('docs/_auto/{}.rst'.format(k), mode) as outfile:
outfile.write(title)
outfile.write('\n\n'.join(kinds[k]))
# Actually call the docs generator
document_scripts()
# -- General configuration ------------------------------------------------ # -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here. # If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0' needs_sphinx = '1.3'
# Add any Sphinx extension module names here, as strings. They can be # Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones. # ones.
extensions = [] extensions = ['sphinx.ext.extlinks']
# This config value must be a dictionary of external sites, mapping unique
# short alias names to a base URL and a prefix.
# See http://sphinx-doc.org/ext/extlinks.html
extlinks = {
'wiki': ('http://dwarffortresswiki.org/%s', ''),
'forums': ('http://www.bay12forums.com/smf/index.php?topic=%s',
'Bay12 forums thread '),
'dffd': ('http://dffd.bay12games.com/file.php?id=%s', 'DFFD file '),
'bug': ('http://www.bay12games.com/dwarves/mantisbt/view.php?id=%s',
'Bug '),
'issue': ('https://github.com/DFHack/dfhack/issues/%s', 'Issue '),
}
# Add any paths that contain templates here, relative to this directory. # Add any paths that contain templates here, relative to this directory.
templates_path = [] templates_path = []
# The suffix(es) of source filenames. # The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string: # You can specify multiple suffix as a list of string:
# source_suffix = ['.rst', '.md'] source_suffix = ['.rst']
source_suffix = '.rst'
# The encoding of source files. # The encoding of source files.
#source_encoding = 'utf-8-sig' #source_encoding = 'utf-8-sig'
# The master toctree document. # The master toctree document.
master_doc = 'README' master_doc = 'index'
# General information about the project. # General information about the project.
project = 'DFHack' project = 'DFHack'
@ -86,25 +132,26 @@ author = 'The DFHack Team'
# |version| and |release|, also used in various other places throughout the # |version| and |release|, also used in various other places throughout the
# built documents. # built documents.
#def get_version(): def get_version():
# """Return the DFHack version string, from CMakeLists.txt""" """Return the DFHack version string, from CMakeLists.txt"""
# version, release = '', '' version = release = ''
# with open('CMakeLists.txt') as f: try:
# for s in f.readlines(): with open('CMakeLists.txt') as f:
# if fnmatch.fnmatch(s.upper(), 'SET(DF_VERSION "?.??.??")\n'): for s in f.readlines():
# version = s.upper().replace('SET(DF_VERSION "', '') if fnmatch.fnmatch(s.upper(), 'SET(DF_VERSION "?.??.??")\n'):
# elif fnmatch.fnmatch(s.upper(), 'SET(DFHACK_RELEASE "r*")\n'): version = s.upper().replace('SET(DF_VERSION "', '')
# release = s.upper().replace('SET(DFHACK_RELEASE "', '').lower() elif fnmatch.fnmatch(s.upper(), 'SET(DFHACK_RELEASE "r*")\n'):
# return (version + '-' + release).replace('")\n', '') release = s.upper().replace('SET(DFHACK_RELEASE "', '').lower()
return (version + '-' + release).replace('")\n', '')
except IOError:
return 'unknown'
# The short X.Y version. # The short X.Y version.
version = '@DFHACK_VERSION@'
# The full version, including alpha/beta/rc tags. # The full version, including alpha/beta/rc tags.
release = '@DFHACK_VERSION@' version = release = get_version()
# The language for content autogenerated by Sphinx. Refer to documentation # The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages. # for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs. # This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases. # Usually you set "language" from the command line for these cases.
language = None language = None
@ -117,32 +164,21 @@ language = None
# List of patterns, relative to source directory, that match files and # List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files. # directories to ignore when looking for source files.
exclude_patterns = ['docs/_build/*', 'depends/*'] exclude_patterns = [
'README.md',
'docs/html*',
'depends/*',
'scripts/3rdparty/*',
'build*',
]
# The reST default role (used for this markup: `text`) to use for all # The reST default role (used for this markup: `text`) to use for all
# documents. # documents.
default_role = 'any' default_role = 'ref'
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# The name of the Pygments (syntax highlighting) style to use. # The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx' pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# If true, keep warnings as "system message" paragraphs in the built documents.
#keep_warnings = False
# If true, `todo` and `todoList` produce output, else they produce nothing. # If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False todo_include_todos = False
@ -151,12 +187,19 @@ todo_include_todos = False
# The theme to use for HTML and HTML Help pages. See the documentation for # The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes. # a list of builtin themes.
html_theme = '@SPHINX_THEME@' html_theme = 'alabaster'
html_style = 'dfhack.css'
# Theme options are theme-specific and customize the look and feel of a theme # Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the # further. For a list of options available for each theme, see the
# documentation. # documentation.
#html_theme_options = {} html_theme_options = {
#'logo': 'logo.png',
'github_user': 'DFHack',
'github_repo': 'dfhack',
'github_button': False,
'travis_button': False,
}
# Add any paths that contain custom themes here, relative to this directory. # Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = [] #html_theme_path = []
@ -166,7 +209,7 @@ html_theme = '@SPHINX_THEME@'
#html_title = None #html_title = None
# A shorter title for the navigation bar. Default is the same as html_title. # A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None html_short_title = 'DFHack Docs'
# The name of an image file (relative to this directory) to place at the top # The name of an image file (relative to this directory) to place at the top
# of the sidebar. # of the sidebar.
@ -175,12 +218,12 @@ html_theme = '@SPHINX_THEME@'
# The name of an image file (within the static path) to use as favicon of the # The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large. # pixels large.
html_favicon = 'dfhack-icon.ico' html_favicon = 'docs/styles/dfhack-icon.ico'
# Add any paths that contain custom static files (such as style sheets) here, # Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files, # relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css". # so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['../images'] html_static_path = ['docs/styles']
# Add any extra paths that contain custom files (such as robots.txt or # Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied # .htaccess) here, relative to this directory. These files are copied
@ -189,24 +232,31 @@ html_static_path = ['../images']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format. # using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y' html_last_updated_fmt = '%Y-%m-%d'
# If true, SmartyPants will be used to convert quotes and dashes to # If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities. # typographically correct entities.
#html_use_smartypants = True #html_use_smartypants = True
# Custom sidebar templates, maps document names to template names. # Custom sidebar templates, maps document names to template names.
#html_sidebars = {} html_sidebars = {
'**': [
'about.html',
'relations.html',
'searchbox.html',
'localtoc.html',
]
}
# Additional templates that should be rendered to pages, maps page names to # Additional templates that should be rendered to pages, maps page names to
# template names. # template names.
#html_additional_pages = {} #html_additional_pages = {}
# If false, no module index is generated. # If false, no module index is generated.
#html_domain_indices = True html_domain_indices = False
# If false, no index is generated. # If false, no index is generated.
#html_use_index = True html_use_index = False
# If true, the index is split into individual pages for each letter. # If true, the index is split into individual pages for each letter.
#html_split_index = False #html_split_index = False
@ -225,23 +275,6 @@ html_static_path = ['../images']
# base URL from which the finished HTML is served. # base URL from which the finished HTML is served.
#html_use_opensearch = '' #html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None
# Language to be used for generating the HTML full-text search index.
# Sphinx supports the following languages:
# 'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja'
# 'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr'
#html_search_language = 'en'
# A dictionary with options for the search language support, empty by default.
# Now only 'ja' uses this config value
#html_search_options = {'type': 'default'}
# The name of a javascript file (relative to the configuration directory) that
# implements a search results scorer. If empty, the default will be used.
#html_search_scorer = 'scorer.js'
# Output file base name for HTML help builder. # Output file base name for HTML help builder.
htmlhelp_basename = 'DFHackdoc' htmlhelp_basename = 'DFHackdoc'

@ -202,6 +202,7 @@ LIST(APPEND LIBPROTOBUF_FULL_SRCS ${LIBPROTOBUF_LITE_SRCS})
IF(CMAKE_COMPILER_IS_GNUCC) IF(CMAKE_COMPILER_IS_GNUCC)
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -Wno-sign-compare") SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -Wno-sign-compare")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-result")
ENDIF() ENDIF()
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})

@ -21,15 +21,18 @@ Caldfir caldfir
Chris Dombroski cdombroski Chris Dombroski cdombroski
Clayton Hughes Clayton Hughes
David Corbett dscorbett David Corbett dscorbett
Deon
DoctorVanGogh DoctorVanGogh DoctorVanGogh DoctorVanGogh
Donald Ruegsegger hashaash Donald Ruegsegger hashaash
doomchild doomchild doomchild doomchild
enjia2000
Eric Wald eswald Eric Wald eswald
Erik Youngren Artanis Erik Youngren Artanis
Espen Wiborg Espen Wiborg
expwnent expwnent expwnent expwnent
Feng Feng
Harlan Playford playfordh Harlan Playford playfordh
IndigoFenix
James Logsdon jlogsdon James Logsdon jlogsdon
Japa JapaMala Japa JapaMala
Jared Adams Jared Adams
@ -40,11 +43,14 @@ Jonas Ask
kane-t kane-t kane-t kane-t
Kelly Martin ab9rf Kelly Martin ab9rf
Kris Parker kaypy Kris Parker kaypy
Kurik Amudnil
Lethosor lethosor Lethosor lethosor
Mason11987 Mason11987 Mason11987 Mason11987
Matthew Cline Matthew Cline
Max maxthyme Max^TM Max maxthyme Max^TM
melkor217 melkor217 melkor217 melkor217
Meneth32
Meph
Michon van Dooren MaienM Michon van Dooren MaienM
miffedmap miffedmap miffedmap miffedmap
Mike Stewart thewonderidiot Mike Stewart thewonderidiot
@ -53,6 +59,7 @@ MithrilTuxedo MithrilTuxedo
mizipzor mizipzor mizipzor mizipzor
Neil Little nmlittle Neil Little nmlittle
Nick Rart nickrart comestible Nick Rart nickrart comestible
Omniclasm
PeridexisErrant PeridexisErrant PeridexisErrant PeridexisErrant
Petr Mrázek peterix Petr Mrázek peterix
potato potato
@ -64,6 +71,7 @@ rampaging-poet
Raoul van Putten Raoul van Putten
Raoul XQ raoulxq Raoul XQ raoulxq
reverb reverb
Raidau Raidau
Rinin Rinin Rinin Rinin
Robert Heinrich rh73 Robert Heinrich rh73
rofl0r rofl0r rofl0r rofl0r
@ -78,6 +86,7 @@ scamtank scamtank
Seth Woodworth sethwoodworth Seth Woodworth sethwoodworth
simon simon
Simon Jackson sizeak Simon Jackson sizeak
Tacomagic
Tim Walberg twalberg Tim Walberg twalberg
Timothy Collett danaris Timothy Collett danaris
Tom Prince Tom Prince

@ -7,7 +7,7 @@ Patching the DF binary
Writing scripts and plugins for DFHack is not the only way to modify Dwarf Writing scripts and plugins for DFHack is not the only way to modify Dwarf
Fortress. Before DFHack, it was common for tools to manually patch the Fortress. Before DFHack, it was common for tools to manually patch the
binary to change behaviour, and DFHack still contains tools to do this via binary to change behaviour, and DFHack still contains tools to do this via
the `scripts/binpatch` command. the `binpatch` command.
.. warning:: .. warning::
@ -32,8 +32,7 @@ decent skill in `memory research <contributing-memory-research>`.
* See `this commit <https://github.com/DFHack/dfhack/commit/8a9e3d1a728>`_, * See `this commit <https://github.com/DFHack/dfhack/commit/8a9e3d1a728>`_,
when the 0.34.11 patches were discarded, for example patches. when the 0.34.11 patches were discarded, for example patches.
* `Issue #546 <https://github.com/DFHack/dfhack/issues/546>`_ is about the * :issue:`546` is about the future of the binpatches, and may be useful reading.
future of the binpatches, and may be useful reading.
If you want to write a patch, the armory patches discussed here and documented If you want to write a patch, the armory patches discussed here and documented
below would probably be the best place to start. below would probably be the best place to start.
@ -45,7 +44,7 @@ There are two methods to apply a patch.
Patching at runtime Patching at runtime
------------------- -------------------
The `scripts/binpatch` script checks, applies or removes binary patches The `binpatch` script checks, applies or removes binary patches
directly in memory at runtime:: directly in memory at runtime::
binpatch [check|apply|remove] <patchname> binpatch [check|apply|remove] <patchname>
@ -56,7 +55,7 @@ the version appropriate for the currently loaded executable.
This is the preferred method; it's easier to debug, does not cause persistent This is the preferred method; it's easier to debug, does not cause persistent
problems, and leaves file checksums alone. As with many other commands, users problems, and leaves file checksums alone. As with many other commands, users
can simply add it to ``dfhack.init`` to reapply the patch every time DF is run. can simply add it to `dfhack.init` to reapply the patch every time DF is run.
Patching on disk Patching on disk
@ -107,7 +106,7 @@ armor stands, and in containers.
.. note:: .. note::
In order to actually be used, weapon racks have to be patched and In order to actually be used, weapon racks have to be patched and
manually assigned to a squad. See `scripts/gui/assign-rack`. manually assigned to a squad. See `gui/assign-rack`.
Note that the buildings in the armory are used as follows: Note that the buildings in the armory are used as follows:
@ -152,8 +151,8 @@ these rules is intended by Toady; the rest are invented by this plugin.
gui/assign-rack gui/assign-rack
--------------- ---------------
Bind to a key (the example config uses P), and activate when viewing a weapon Bind to a key (the example config uses :kbd:`P`), and activate when viewing a weapon
rack in the ``q`` mode. rack in the :kbd:`q` mode.
.. image:: images/assign-rack.png .. image:: images/assign-rack.png
@ -166,12 +165,10 @@ work again. The existing issues are:
* Even if assigned by the script, **the game will unassign the racks again * Even if assigned by the script, **the game will unassign the racks again
without a binary patch**. This patch is called ``weaponrack-unassign``, without a binary patch**. This patch is called ``weaponrack-unassign``,
and has not been updated since 0.34.11. See `the bug report`_ for more info. and has not been updated since 0.34.11. See :bug:`1445` for more info.
.. _`the bug report`: http://www.bay12games.com/dwarves/mantisbt/view.php?id=1445
* Haulers still take equipment stored in the armory away to the stockpiles, * Haulers still take equipment stored in the armory away to the stockpiles,
unless `plugins/fix-armory` is used. unless `fix-armory` is used.
The script interface simply lets you designate one of the squads that The script interface simply lets you designate one of the squads that
are assigned to the barracks/armory containing the selected stand as are assigned to the barracks/armory containing the selected stand as

@ -1,7 +0,0 @@
#########
Changelog
#########
.. contents::
.. include:: ../NEWS

@ -2,28 +2,20 @@
Compiling DFHack Compiling DFHack
################ ################
.. important:: You don't need to compile DFHack unless you're developing plugins or working on the core.
You don't need to compile DFHack unless you're developing plugins or working on the core.
For users, modders, and authors of scripts it's better to download the latest release instead. For users, modders, and authors of scripts it's better to download
and `install the latest release instead <installing>`.
.. contents:: .. contents::
:depth: 2 :depth: 2
===================
How to get the code How to get the code
=================== ===================
DFHack doesn't have any kind of system of code snapshots in place, so you will have to DFHack doesn't have any kind of system of code snapshots in place, so you will have to
get code from the github repository using git. get code from the github repository using git. How to get git is described under
The code resides at https://github.com/DFHack/dfhack the instructions for each platform.
On Linux and OS X, having a ``git`` package installed is the minimal requirement (see below for OS X instructions),
but some sort of git gui or git integration for your favorite text editor/IDE will certainly help.
On Windows, you will need some sort of Windows port of git, or a GUI. Some examples:
* http://msysgit.github.io - this is a command line version of git for windows.
Most tutorials on git usage will apply.
* http://code.google.com/p/tortoisegit - this puts a pretty, graphical face on top of msysgit
To get the code:: To get the code::
@ -33,22 +25,14 @@ To get the code::
If your version of git does not support the ``--recursive`` flag, you will need to omit it and run If your version of git does not support the ``--recursive`` flag, you will need to omit it and run
``git submodule update --init`` after entering the dfhack directory. ``git submodule update --init`` after entering the dfhack directory.
If you just want to compile DFHack or work on it by contributing patches, it's quite If you want to get involved with the development, create an account on
enough to clone from the read-only address instead::
git clone --recursive git://github.com/DFHack/dfhack.git
cd dfhack
If you want to get really involved with the development, create an account on
Github, make a clone there and then use that as your remote repository instead. Github, make a clone there and then use that as your remote repository instead.
Detailed instructions are beyond the scope of this document. If you need help, We'd love that; join us on IRC (#dfhack channel on freenode) if you need help.
join us on IRC (#dfhack channel on freenode).
===========
Build types Build types
=========== ===========
``cmake`` allows you to pick a build type by changing this ``cmake`` allows you to pick a build type by changing the ``CMAKE_BUILD_TYPE`` variable::
variable: ``CMAKE_BUILD_TYPE`` ::
cmake .. -DCMAKE_BUILD_TYPE:string=BUILD_TYPE cmake .. -DCMAKE_BUILD_TYPE:string=BUILD_TYPE
@ -58,34 +42,42 @@ Without specifying a build type or 'None', cmake uses the
Valid and useful build types include 'Release', 'Debug' and Valid and useful build types include 'Release', 'Debug' and
'RelWithDebInfo'. 'Debug' is not available on Windows. 'RelWithDebInfo'. 'Debug' is not available on Windows.
=====
Linux Linux
===== =====
On Linux, DFHack acts as a library that shadows parts of the SDL API using LD_PRELOAD. On Linux, DFHack acts as a library that shadows parts of the SDL API using LD_PRELOAD.
Dependencies Dependencies
============ ------------
DFHack is meant to be installed into an existing DF folder, so get one ready. DFHack is meant to be installed into an existing DF folder, so get one ready.
For building, you need a 32-bit version of GCC. For example, to build DFHack on We assume that any Linux platform will have ``git`` available.
a 64-bit distribution like Arch, you'll need the multilib development tools and libraries.
Alternatively, you might be able to use ``lxc`` to To build DFHack you need a 32-bit version of GCC. GCC 4.5 is easiest to work
`create a virtual 32-bit environment <http://www.bay12forums.com/smf/index.php?topic=139553.msg5435310#msg5435310>`_. with due to avoiding libstdc++ issues (see below), but any later 4.x version
should work as well. GCC 5.x may work but is discouraged for releases because it
won't work on systems without GCC 5.x installed. On 64-bit distributions, you'll
need the multilib development tools and libraries (``gcc-multilib`` or
``gcc-4.x-multilib`` on Debian). Alternatively, you might be able to use ``lxc``
to
:forums:`create a virtual 32-bit environment <139553.msg5435310#msg5435310>`.
Before you can build anything, you'll also need ``cmake``. It is advisable to also get Before you can build anything, you'll also need ``cmake``. It is advisable to also get
``ccmake`` on distributions that split the cmake package into multiple parts. ``ccmake`` on distributions that split the cmake package into multiple parts.
You also need perl and the XML::LibXML and XML::LibXSLT perl packages (for the code generation parts). You also need perl and the XML::LibXML and XML::LibXSLT perl packages (for the code generation parts).
You should be able to find them in your distro repositories (on Arch linux You should be able to find them in your distro repositories.
``perl-xml-libxml`` and ``perl-xml-libxslt``) or through ``cpan``.
* On Arch linux, ``perl-xml-libxml`` and ``perl-xml-libxslt`` (or through ``cpan``)
* On 64-bit Ubuntu, ``apt-get install zlib1g-dev:i386 libxml-libxml-perl libxml-libxslt-perl``.
* On 32-bit Ubuntu, ``apt-get install zlib1g-dev libxml-libxml-perl libxml-libxslt-perl``.
* Debian-derived distros should have similar requirements.
To build Stonesense, you'll also need OpenGL headers. To build Stonesense, you'll also need OpenGL headers.
Some additional dependencies for other distros are listed on the
`wiki <https://github.com/DFHack/dfhack/wiki/Linux-dependencies>`_.
Build Build
===== -----
Building is fairly straightforward. Enter the ``build`` folder (or create an Building is fairly straightforward. Enter the ``build`` folder (or create an
empty folder in the DFHack directory to use instead) and start the build like this:: empty folder in the DFHack directory to use instead) and start the build like this::
@ -103,15 +95,13 @@ Alternatively, you can use ccmake instead of cmake::
make install make install
This will show a curses-based interface that lets you set all of the This will show a curses-based interface that lets you set all of the
extra options. extra options. You can also use a cmake-friendly IDE like KDevelop 4
or the cmake-gui program.
You can also use a cmake-friendly IDE like KDevelop 4 or the cmake-gui
program.
Fixing the libstdc++ version bug Incompatible libstdc++
================================ ~~~~~~~~~~~~~~~~~~~~~~
When compiling dfhack yourself, it builds against your system libstdc++.
When compiling dfhack yourself, it builds against your system libc.
When Dwarf Fortress runs, it uses a libstdc++ shipped with the binary, which When Dwarf Fortress runs, it uses a libstdc++ shipped with the binary, which
comes from GCC 4.5 and is incompatible with code compiled with newer GCC versions. comes from GCC 4.5 and is incompatible with code compiled with newer GCC versions.
This manifests itself with the error message:: This manifests itself with the error message::
@ -119,74 +109,80 @@ This manifests itself with the error message::
./libs/Dwarf_Fortress: /pathToDF/libs/libstdc++.so.6: version ./libs/Dwarf_Fortress: /pathToDF/libs/libstdc++.so.6: version
`GLIBCXX_3.4.15' not found (required by ./hack/libdfhack.so) `GLIBCXX_3.4.15' not found (required by ./hack/libdfhack.so)
To fix this, simply remove the libstdc++ shipped with DF, it will fall back To fix this, you can compile with GCC 4.5 or remove the libstdc++ shipped with
to your system lib and everything will work fine:: DF, which causes DF to use your system libstdc++ instead::
cd /path/to/DF/ cd /path/to/DF/
rm libs/libstdc++.so.6 rm libs/libstdc++.so.6
Alternatively, this issue can be avoided by compiling DFHack with GCC 4.5. Note that distributing binaries compiled with newer GCC versions requires end-
users to delete libstdc++ themselves and have a libstdc++ on their system from
the same GCC version or newer. For this reason, distributing anything compiled
with GCC versions newer than 4.8 is discouraged.
========
Mac OS X Mac OS X
======== ========
DFHack functions similarly on OS X and Linux, and the majority of the DFHack functions similarly on OS X and Linux, and the majority of the
information above regarding the build process (cmake and make) applies here information above regarding the build process (cmake and make) applies here
as well. as well.
* If you are building on 10.6, please read the subsection below titled "Snow Leopard Changes" FIRST. If you have issues building on OS X 10.10 (Yosemite) or above, try definining the
* If you are building on 10.10+, read the "Yosemite Changes" subsection before building. following environment variable::
1. Download and unpack a copy of the latest DF export MACOSX_DEPLOYMENT_TARGET=10.9
2. Install Xcode from Mac App Store
3. Open Xcode, go to Preferences > Downloads, and install the Command Line Tools.
4. Install dependencies
Option 1: Using Homebrew: #. Download and unpack a copy of the latest DF
#. Install Xcode from Mac App Store
#. Open Xcode, go to Preferences > Downloads, and install the Command Line Tools.
#. Install dependencies
* `Install Homebrew <http://brew.sh/>`_ and run: Using `Homebrew <http://brew.sh/>`_::
* ``brew tap homebrew/versions``
* ``brew install git``
* ``brew install cmake``
* ``brew install gcc45``
Option 2: Using MacPorts: brew tap homebrew/versions
brew install git
brew install cmake
brew install gcc45
* `Install MacPorts <http://www.macports.org/>`_ Using `MacPorts <https://www.macports.org>`_::
* Run ``sudo port install gcc45 +universal cmake +universal git-core +universal``
This will take some time—maybe hours, depending on your machine.
At some point during this process, it may ask you to install a Java environment; let it do so. sudo port install gcc45 +universal cmake +universal git-core +universal
5. Install perl dependencies Macports will take some time - maybe hours. At some point it may ask
you to install a Java environment; let it do so.
#. Install perl dependencies
1. ``sudo cpan`` 1. ``sudo cpan``
If this is the first time you've run cpan, you will need to go through the setup If this is the first time you've run cpan, you will need to go through the setup
process. Just stick with the defaults for everything and you'll be fine. process. Just stick with the defaults for everything and you'll be fine.
If you are running OS X 10.6 (Snow Leopard) or earlier, good luck!
You'll need to open a separate Terminal window and run::
sudo ln -s /usr/include/libxml2/libxml /usr/include/libxml
2. ``install XML::LibXML`` 2. ``install XML::LibXML``
3. ``install XML::LibXSLT`` 3. ``install XML::LibXSLT``
6. Get the dfhack source:: #. Get the dfhack source::
git clone --recursive https://github.com/DFHack/dfhack.git git clone --recursive https://github.com/DFHack/dfhack.git
cd dfhack cd dfhack
7. Set environment variables: #. Set environment variables:
Homebrew (if installed elsewhere, replace /usr/local with ``$(brew --prefix)``):: Homebrew (if installed elsewhere, replace /usr/local with ``$(brew --prefix)``)::
export CC=/usr/local/bin/gcc-4.5 export CC=/usr/local/bin/gcc-4.5
export CXX=/usr/local/bin/g++-4.5 export CXX=/usr/local/bin/g++-4.5
Macports:: Macports::
export CC=/opt/local/bin/gcc-mp-4.5 export CC=/opt/local/bin/gcc-mp-4.5
export CXX=/opt/local/bin/g++-mp-4.5 export CXX=/opt/local/bin/g++-mp-4.5
8. Build dfhack:: #. Build dfhack::
mkdir build-osx mkdir build-osx
cd build-osx cd build-osx
@ -195,70 +191,58 @@ as well.
make install make install
Snow Leopard Changes
====================
1. Add a step 6.2a (before Install XML::LibXSLT)::
In a separate Terminal window or tab, run:
``sudo ln -s /usr/include/libxml2/libxml /usr/include/libxml``
2. Add a step 7a (before building)::
In <dfhack directory>/library/LuaTypes.cpp, change line 467 to
``int len = strlen((char*)ptr);``
Yosemite Changes
================
If you have issues building on OS X Yosemite (or above), try definining the
following environment variable::
export MACOSX_DEPLOYMENT_TARGET=10.9
=======
Windows Windows
======= =======
On Windows, DFHack replaces the SDL library distributed with DF. On Windows, DFHack replaces the SDL library distributed with DF.
Dependencies Dependencies
============ ------------
First, you need ``cmake``. Get the win32 installer version from the official You will need some sort of Windows port of git, or a GUI. Some examples:
site: http://www.cmake.org/cmake/resources/software.html
* `Git for Windows <https://git-for-windows.github.io>`_ (command-line and GUI)
* `tortoisegit <https://tortoisegit.org>`_ (GUI and File Explorer integration)
You need ``cmake``. Get the win32 installer version from
`the official site <http://www.cmake.org/cmake/resources/software.html>`_.
It has the usual installer wizard. Make sure you let it add its binary folder It has the usual installer wizard. Make sure you let it add its binary folder
to your binary search PATH so the tool can be later run from anywhere. to your binary search PATH so the tool can be later run from anywhere.
You'll need a copy of Microsoft Visual C++ 2010. The Express version is sufficient. You'll need a copy of Microsoft Visual C++ 2010. The Express version is sufficient.
Grab it from Microsoft's site. Grab it from `Microsoft's site <http://download.microsoft.com/download/1/E/5/1E5F1C0A-0D5B-426A-A603-1798B951DDAE/VS2010Express1.iso>`_.
You'll also need the Visual Studio 2010 SP1 update. You'll also need the Visual Studio 2010 SP1 update.
For the code generation parts, you'll need perl with XML::LibXML and XML::LibXSLT. For the code generation parts, you'll need perl with XML::LibXML and XML::LibXSLT.
`Strawberry Perl <http://strawberryperl.com>`_ works nicely for this. `Strawberry Perl <http://strawberryperl.com>`_ works nicely for this and includes
all of the required packages.
If you already have a different version of perl (for example the one from cygwin), If you already have a different version of perl (for example the one from cygwin),
you can run into some trouble. Either remove the other perl install from PATH, or you can run into some trouble. Either remove the other perl install from PATH, or
install libxml and libxslt for it instead. Strawberry perl works though and has install libxml and libxslt for it instead.
all the required packages.
Build Build
===== -----
There are several different batch files in the ``build`` folder along with a script that's used for picking the DF path. There are several different batch files in the ``build`` folder along
with a script that's used for picking the DF path.
First, run set_df_path.vbs and point the dialog that pops up at your DF folder that you want to use for development. First, run ``set_df_path.vbs`` and point the dialog that pops up at your
DF folder that you want to use for development.
Next, run one of the scripts with ``generate`` prefix. These create the MSVC solution file(s): Next, run one of the scripts with ``generate`` prefix. These create the MSVC solution file(s):
* ``all`` will create a solution with everything enabled (and the kitchen sink). * ``all`` will create a solution with everything enabled (and the kitchen sink).
* ``gui`` will pop up the cmake gui and let you pick and choose what to build. This is probably what you want most of the time. Set the options you are interested in, then hit configure, then generate. More options can appear after the configure step. * ``gui`` will pop up the cmake gui and let you pick and choose what to build.
* ``minimal`` will create a minimal solution with just the bare necessities - the main library and standard plugins. This is probably what you want most of the time. Set the options you are interested
in, then hit configure, then generate. More options can appear after the configure step.
* ``minimal`` will create a minimal solution with just the bare necessities -
the main library and standard plugins.
Then you can either open the solution with MSVC or use one of the msbuild scripts: Then you can either open the solution with MSVC or use one of the msbuild scripts:
* Scripts with ``build`` prefix will only build. * Scripts with ``build`` prefix will only build DFHack.
* Scripts with ``install`` prefix will build DFHack and install it to the previously selected DF path. * Scripts with ``install`` prefix will build DFHack and install it to the previously selected DF path.
* Scripts with ``package`` prefix will build and create a .zip package of DFHack. * Scripts with ``package`` prefix will build and create a .zip package of DFHack.
When you open the solution in MSVC, make sure you never use the Debug builds. Those aren't When you open the solution in MSVC, make sure you never use the Debug builds. Those aren't
binary-compatible with DF. If you try to use a debug build with DF, you'll only get crashes. binary-compatible with DF. If you try to use a debug build with DF, you'll only get crashes.
So pick either Release or RelWithDebInfo build and build the INSTALL target. For this reason the Windows "debug" scripts actually do RelWithDebInfo builds,
so pick either Release or RelWithDebInfo build and build the INSTALL target.
The ``debug`` scripts actually do RelWithDebInfo builds.

@ -11,7 +11,6 @@ Several things should be kept in mind when contributing code to DFHack.
Code Format Code Format
----------- -----------
* Four space indents for C++. Never use tabs for indentation in any language. * Four space indents for C++. Never use tabs for indentation in any language.
* LF (Unix style) line terminators * LF (Unix style) line terminators
* Avoid trailing whitespace * Avoid trailing whitespace
@ -25,14 +24,18 @@ Code Format
How to get new code into DFHack How to get new code into DFHack
------------------------------- -------------------------------
* Submit pull requests to the ``develop`` branch, not the ``master`` branch.
* Submit pull requests to the ``develop`` branch, not the master branch. The master branch always points at the most recent release. (The ``master`` branch always points at the most recent release)
* Use new branches for each feature/fix so that your changes can be merged independently (i.e. not the master or develop branch of your fork). * Use a new branch for each feature or bugfix so that your changes can be merged independently
(i.e. not the master or develop branch of your fork).
* If possible, compile on multiple platforms when changing anything that compiles * If possible, compile on multiple platforms when changing anything that compiles
* Update ``NEWS`` and ``docs/Authors.rst`` when applicable * It must pass CI - run ``python travis/all.py`` to check this.
* Update ``NEWS.rst`` and ``docs/Authors.rst`` when applicable.
* Create a GitHub pull request once finished * Create a GitHub pull request once finished
* Work done against GitHub issues tagged "bug" get priority * Submit ideas and bug reports as :issue:`issues on GitHub <>`.
* Submit ideas and bug reports as issues on GitHub. Posts in the forum thread can easily get missed or forgotten. Posts in the forum thread can easily get missed or forgotten.
* Work on :issue:`reported problems <?q=is:open+-label:idea>`
will take priority over ideas or suggestions.
.. _contributing-memory-research: .. _contributing-memory-research:
@ -62,7 +65,8 @@ All the plugins can be found in the 'plugins' folder. There's no in-depth docume
on how to write one yet, but it should be easy enough to copy one and just follow the pattern. on how to write one yet, but it should be easy enough to copy one and just follow the pattern.
``plugins/skeleton/skeleton.cpp`` is provided for this purpose. ``plugins/skeleton/skeleton.cpp`` is provided for this purpose.
Other than through plugins, it is possible to use DFHack via remote access interface, or by writing Lua scripts. Other than through plugins, it is possible to use DFHack via remote access interface,
or by writing scripts in Lua or Ruby. There are plenty of examples in the scripts folder.
The most important parts of DFHack are the Core, Console, Modules and Plugins. The most important parts of DFHack are the Core, Console, Modules and Plugins.
@ -83,7 +87,7 @@ documentation is built with Sphinx, which runs automatically at compile time.
DFHack consists of variously licensed code, but invariably weak copyleft. DFHack consists of variously licensed code, but invariably weak copyleft.
The main license is zlib/libpng, some bits are MIT licensed, and some are The main license is zlib/libpng, some bits are MIT licensed, and some are
BSD licensed. See the ``LICENSE`` document for more information. BSD licensed. See the `license` for more information.
Feel free to add your own extensions and plugins. Contributing back to Feel free to add your own extensions and plugins. Contributing back to
the DFHack repository is welcome and the right thing to do :) the DFHack repository is welcome and the right thing to do :)
@ -118,14 +122,39 @@ comprehensive interface for visualisers such as Armok Vision.
Documentation Standards Documentation Standards
======================= =======================
DFHack documentation is built with Sphinx, and configured automatically
through CMake. If you want to build the docs *only*, use this command::
sphinx-build . docs/html
Whether you're adding new code or just fixing old documentation (and there's plenty), Whether you're adding new code or just fixing old documentation (and there's plenty),
there are a few important standards for completeness and consistent style. Treat there are a few important standards for completeness and consistent style. Treat
this section as a guide rather than iron law, match the surrounding text, and you'll this section as a guide rather than iron law, match the surrounding text, and you'll
be fine. be fine.
Every script, plugin, or command should be documented. This is an active project, Everything should be documented! For plugins, it's a work in progress - use
and the best place to put this documentation might change. For now, it's usually ``docs/Plugins.rst`` for now. Core functions and general explanations should
either ``docs/Scripts.rst`` or ``docs/Plugins.rst``. go in the documents for that component; if it's not clear add a new section
as some may be missing.
Scripts can use a custom autodoc function, based on the Sphinx ``include``
directive and Ruby docstring conventions - any lines between ``=begin`` and
``=end`` are copied into the appropriate scripts documentation page.
They **must** have a heading which exactly matches the command, underlined
with ``=====`` to the same length. For example, a lua file would have::
--[[=begin
add-thought
===========
Adds a thought or emotion to the selected unit. Can be used by other scripts,
or the gui invoked by running ``add-thought gui`` with a unit selected.
=end]]
Ruby scripts use the same syntax, but obviously omit the leading ``--[[`` and
trailing ``]]`` which denote a multiline comment in lua.
``=begin`` and ``=end`` are native syntax (and matched in lua for convenience).
Where the heading for a section is also the name of a command, the spelling Where the heading for a section is also the name of a command, the spelling
and case should exactly match the command to enter in the DFHack command line. and case should exactly match the command to enter in the DFHack command line.
@ -136,13 +165,13 @@ Sphinx (our documentation system) will make sure paragraphs flow.
If there aren't many options or examples to show, they can go in a paragraph of If there aren't many options or examples to show, they can go in a paragraph of
text. Use double-backticks to put commands in monospaced font, like this:: text. Use double-backticks to put commands in monospaced font, like this::
You can use ``cleanall scattered x`` to dump tattered or abandoned items. You can use ``cleanowned scattered x`` to dump tattered or abandoned items.
If the command takes more than three arguments, format the list as a table If the command takes more than three arguments, format the list as a table
called Options. The table *only* lists arguments, not full commands. called Usage. The table *only* lists arguments, not full commands.
Input values are specified in angle brackets. Example:: Input values are specified in angle brackets. Example::
Options: Usage:
:arg1: A simple argument. :arg1: A simple argument.
:arg2 <input>: Does something based on the input value. :arg2 <input>: Does something based on the input value.
@ -158,17 +187,19 @@ describe the effect::
If it would be helpful to mention another DFHack command, don't just type the If it would be helpful to mention another DFHack command, don't just type the
name - add a hyperlink! Specify the link target in backticks, and it will be name - add a hyperlink! Specify the link target in backticks, and it will be
replaced with the corresponding title and linked: eg ```plugins/autolabor``` replaced with the corresponding title and linked: eg ```autolabor```
=> `plugins/autolabor`. Link targets should be the path to the file => `autolabor`. Link targets should be equivalent to the command
described (without file extension), and placed above the heading of that described (without file extension), and placed above the heading of that
section like this:: section like this::
.. _plugins/autolabor: .. _autolabor:
autolabor autolabor
========= =========
Add link targets if you need them, but otherwise plain headings are preferred. Add link targets if you need them, but otherwise plain headings are preferred.
Scripts using the in-source docs option, which should be all of them, have
link targets created automatically.
Other ways to help Other ways to help
================== ==================

@ -1,216 +1,106 @@
.. _dfhack-core:
########### ###########
DFHack Core DFHack Core
########### ###########
.. contents:: DFHack commands can be implemented in three ways, all of which
are used in the same way:
==============
Getting DFHack
==============
The project is currently hosted at http://www.github.com/
Recent releases are available in source and binary formats `on the releases
page`_, while the binaries for releases 0.40.15-r1 to 0.34.11-r4 are on DFFD_.
Even older versions are available here_.
.. _`on the releases page`: http://github.com/DFHack/dfhack/releases
.. _DFFD: http://dffd.bay12games.com/search.php?string=DFHack&id=15
.. _here: http://dethware.org/dfhack/download
All new releases are announced in `the bay12 forums thread`_, which is also a
good place for discussion and questions.
.. _`the Bay12 DFHack thread`:
.. _`the bay12 forums thread`: http://www.bay12forums.com/smf/index.php?topic=139553
If this sounds too complicated, you might prefer to `get a Starter Pack`_. :builtin: commands are implemented by the core of DFHack. They manage
These are packages for new players or those who don't want to set up everything other DFhack tools, interpret commands, and control basic
themselves, and are available - with DFHack configured - for all OSes. aspects of DF (force pause or quit).
.. _`get a Starter Pack`: http://dwarffortresswiki.org/index.php/Utility:Lazy_Newb_Pack :plugins: are stored in ``hack/plugins/`` and must be compiled with the
same version of DFHack. They are less flexible than scripts,
but used for complex or ongoing tasks becasue they run faster.
Compatibility :scripts: are Ruby or Lua scripts stored in ``hack/scripts/``.
============= Because they don't need to be compiled, scripts are
DFHack is available for Windows (XP or later), Linux (any modern distribution), more flexible about versions, and easier to distribute.
or OS X (10.6.8 to 10.9). Most third-party DFHack addons are scripts.
Most releases only support the version of DF mentioned in their title - for
example, DFHack 0.40.24-r2 only supports DF 0.40.24 - but some releases
support earlier DF versions as well. Wherever possible, use the latest version
built for the target version of DF.
On Windows, DFHack is compatible with the SDL version of DF, but not the legacy version. .. contents::
It is also possible to use the Windows DFHack with Wine under Linux and OS X.
Installation/Removal
====================
Installing DFhack involves copying files into your DF folder.
Copy the files from a release archive so that:
* On Windows, ``SDL.dll`` is replaced
* On Linux or OSX, the ``dfhack`` script is placed in the same folder as the ``df`` script
Uninstalling is basically the same, in reverse:
* On Windows, first delete ``SDL.dll`` and rename ``SDLreal.dll`` to ``SDL.dll``,
then remove the other DFHack files
* On Linux, remove the DFHack files.
The stonesense plugin might require some additional libraries on Linux.
If any of the plugins or dfhack itself refuses to load, check the ``stderr.log``
file created in your DF folder.
Built-in Commands
=================
The following commands are provided by the 'core' components
of DFhack, rather than plugins or scripts.
===============
Getting started
===============
If DFHack is installed correctly, it will automatically pop up a console
window once DF is started as usual on windows. Linux and Mac OS X require
running the dfhack script from the terminal, and will use that terminal for
the console.
**NOTE**: The ``dfhack-run`` executable is there for calling DFHack commands in .. _cls:
an already running DF+DFHack instance from external OS scripts and programs,
and is *not* the way how you use DFHack normally.
DFHack has a lot of features, which can be accessed by typing commands in the cls
console, or by mapping them to keyboard shortcuts. Most of the newer and more ---
user-friendly tools are designed to be at least partially used via the latter Clear the terminal. Does not delete command history.
way.
In order to set keybindings, you have to create a text configuration file
called ``dfhack.init``; the installation comes with an example version called
``dfhack.init-example``, which is fully functional, covers all of the recent
features and can be simply renamed to ``dfhack.init``. You are encouraged to look
through it to learn which features it makes available under which key combinations.
Using DFHack .. _die:
============
DFHack basically extends what DF can do with something similar to the drop-down
console found in Quake engine games. On Windows, this is a separate command line
window. On Linux, the terminal used to launch the dfhack script is taken over
(so, make sure you start from a terminal). Basic interaction with dfhack
involves entering commands into the console. For some basic instructions,
use the ``help`` command. To list all possible commands, use the ``ls`` command.
Many commands have their own help or detailed description. You can use
``command help`` or ``command ?`` to show that.
The command line has some nice line editing capabilities, including history die
that's preserved between different runs of DF (use up/down keys to go through ---
the history). Instantly kills DF without saving.
The second way to interact with DFHack is to bind the available commands
to in-game hotkeys. The old way to do this is via the hotkey/zoom menu (normally
opened with the ``h`` key). Binding the commands is done by assigning a command as
a hotkey name (with ``n``).
A new and more flexible way is the keybinding command in the dfhack console.
However, bindings created this way are not automatically remembered between runs
of the game, so it becomes necessary to use the dfhack.init file to ensure that
they are re-created every time it is loaded.
Interactive commands like `plugins/liquids` cannot be used as hotkeys.
Many commands come from plugins, which are stored in ``hack/plugins/`` .. _disable:
and must be compiled with the same version of DFHack. Others come
from scripts, which are stored in ``hack/scripts``. Scripts are much
more flexible about versions, and easier to distribute - so most third-party
DFHack addons are scripts.
Something doesn't work, help!
=============================
First, don't panic :)
Second, dfhack keeps a few log files in DF's folder (``stderr.log`` and
``stdout.log``). Looking at these might help you solve the problem.
If it doesn't, you can ask for help in the forum thread or on IRC.
If you found a bug, you can report it in `the Bay12 DFHack thread`_,
`the issues tracker on github <https://github.com/DFHack/dfhack/issues>`_,
or visit `the #dfhack IRC channel on freenode
<https://webchat.freenode.net/?channels=dfhack>`_.
=============
Core Commands
=============
DFHack command syntax consists of a command name, followed by arguments separated
by whitespace. To include whitespace in an argument, quote it in double quotes.
To include a double quote character, use ``\"`` inside double quotes.
If the first non-whitespace character of a line is ``#``, the line is treated
as a comment, i.e. a silent no-op command.
When reading commands from dfhack.init or with the ``script`` command, if the final
character on a line is a backslash then the next uncommented line is considered a
continuation of that line, with the backslash deleted. Commented lines are skipped,
so it is possible to comment out parts of a command with the ``#`` character.
If the first non-whitespace character is ``:``, the command is parsed in a special .. _enable:
alternative mode: first, non-whitespace characters immediately following the ``:``
are used as the command name; the remaining part of the line, starting with the first
non-whitespace character *after* the command name, is used verbatim as the first argument.
The following two command lines are exactly equivalent::
:foo a b "c d" e f enable
foo "a b \"c d\" e f" ------
Many plugins can be in a distinct enabled or disabled state. Some of
them activate and deactivate automatically depending on the contents
of the world raws. Others store their state in world data. However a
number of them have to be enabled globally, and the init file is the
right place to do it.
This is intended for commands like ``rb_eval`` that evaluate script language statements. Most such plugins or scripts support the built-in ``enable`` and ``disable``
commands. Calling them at any time without arguments prints a list
of enabled and disabled plugins, and shows whether that can be changed
through the same commands.
Almost all the commands support using the ``help <command-name>`` built-in command To enable or disable plugins that support this, use their names as
to retrieve further help without having to look at this document. Alternatively, arguments for the command::
some accept a ``help`` or ``?`` as an option on their command line.
.. note:: enable manipulator search
Some tools work by displaying dialogs or overlays in the game window.
In order to avoid confusion, these tools display the word "DFHack" while active. If they .. _fpause:
merely add keybinding hints to existing screens, they use red instead of green for the key.
fpause
------
Forces DF to pause. This is useful when your FPS drops below 1 and you lose
control of the game.
Init files
==========
DFHack allows users to automatically run commonly-used DFHack commands when DF is first
loaded, when a game is loaded, and when a game is unloaded.
Init scripts function the same way they would if the user manually typed in their contents, .. _help:
but are much more convenient. If your DF folder contains at least one file with a name
following the format ``dfhack*.init`` where ``*`` is a placeholder for any string (including
the empty string), then all such files are executed in alphabetical order as init scripts when
DF is first loaded.
If your DF folder does not contain any such files, then DFHack will execute ``dfhack.init-example`` help
as an example of useful commands to be run automatically. If you want DFHack to do nothing on ----
its own, then create an empty ``dfhack.init`` file in the main DF directory, or delete ``dfhack.init-example``. Most commands support using the ``help <command>`` built-in command
to retrieve further help without having to look at this document.
``? <cmd>`` and ``man <cmd>`` are aliases.
The file ``dfhack.init-example`` is included as an example for users to follow if they need DFHack Some commands (including many scripts) instead take ``help`` or ``?``
command executed automatically. We recommend modifying or deleting ``dfhack.init-example`` as as an option on their command line - ie ``<cmd> help``.
its settings will not be optimal for all players.
In order to facilitate savegave portability, mod merging, and general organization of init files,
DFHack supports multiple init files both in the main DF directory and save-specific init files in
the save folders.
DFHack looks for init files in three places. .. _hide:
It will look for them in the main DF directory, and in ``data/save/_____/raw`` and hide
``data/save/_____/raw/objects`` where ``_____`` is the name of the current savegame. ----
Hides the DFHack terminal window. Only available on Windows.
When a game is loaded, DFHack looks for files of the form ``onLoad*.init``, where
``*`` can be any string, including the empty string.
When a game is unloaded, DFHack looks for files of the form ``onUnload*.init``. Again, .. _keybinding:
these files may be in any of the above three places. All matching init files will be
executed in alphebetical order.
Setting keybindings keybinding
=================== ----------
To set keybindings, use the built-in ``keybinding`` command. Like any other To set keybindings, use the built-in ``keybinding`` command. Like any other
command it can be used at any time from the console, but it is most useful command it can be used at any time from the console, but bindings are not
in the DFHack init file. remembered between runs of the game unless re-created in `dfhack.init`.
Currently, any combinations of Ctrl/Alt/Shift with A-Z, 0-9, or F1-F12 are supported. Currently, any combinations of Ctrl/Alt/Shift with A-Z, 0-9, or F1-F12 are supported.
@ -239,68 +129,233 @@ as a hotkey are always considered applicable.
The ``context`` part in the key specifier above can be used to explicitly restrict The ``context`` part in the key specifier above can be used to explicitly restrict
the UI state where the binding would be applicable. If called without parameters, the UI state where the binding would be applicable. If called without parameters,
the ``keybinding`` command among other things prints the current context string. the ``keybinding`` command among other things prints the current context string.
Only bindings with a ``context`` tag that either matches the current context fully, Only bindings with a ``context`` tag that either matches the current context fully,
or is a prefix ending at a ``/`` boundary would be considered for execution, i.e. or is a prefix ending at a ``/`` boundary would be considered for execution, i.e.
for context ``foo/bar/baz``, possible matches are any of ``@foo/bar/baz``, ``@foo/bar``, when in context ``foo/bar/baz``, keybindings restricted to any of ``@foo/bar/baz``,
``@foo`` or none. Multiple contexts can be specified by separating them with a ``@foo/bar``, ``@foo`` or none will be active.
pipe (``|``) - for example, ``@foo|bar|baz/foo``.
Hotkeys Multiple contexts can be specified by separating them with a
======= pipe (``|``) - for example, ``@foo|bar|baz/foo`` would match
Opens an in-game screen showing DFHack keybindings that are active in the current context. anything under ``@foo``, ``@bar``, or ``@baz/foo``.
.. image:: images/hotkeys.png Interactive commands like `liquids` cannot be used as hotkeys.
Type ``hotkeys`` into the DFHack console to open the screen, or bind the command to a
globally active hotkey. The default keybinding is ``Ctrl-F1``.
In-game Console .. _kill-lua:
===============
The ``command-prompt`` plugin adds an in-game DFHack terminal, where you
can enter other commands. It's default keybinding is Ctrl-Shift-P.
Enabling plugins kill-lua
================ --------
Many plugins can be in a distinct enabled or disabled state. Some of Stops any currently-running Lua scripts. By default, scripts can
them activate and deactivate automatically depending on the contents only be interrupted every 256 instructions. Use ``kill-lua force``
of the world raws. Others store their state in world data. However a to interrupt the next instruction.
number of them have to be enabled globally, and the init file is the
right place to do it.
Most such plugins or scripts support the built-in ``enable`` and ``disable``
commands. Calling them at any time without arguments prints a list
of enabled and disabled plugins, and shows whether that can be changed
through the same commands.
To enable or disable plugins that support this, use their names as .. _load:
arguments for the command:: .. _unload:
.. _reload:
enable manipulator search load
----
``load``, ``unload``, and ``reload`` control whether a plugin is loaded
into memory - note that plugins are loaded but disabled unless you do
something. Usage::
load|unload|reload PLUGIN|(-a|--all)
Game progress Allows dealing with plugins individually by name, or all at once.
=============
.. _ls:
ls
--
``ls`` does not list files like the Unix command, but rather
available commands - first built in commands, then plugins,
and scripts at the end. Usage:
:ls -a: Also list scripts in subdirectories of ``hack/scripts/``,
which are generally not intended for direct use.
:ls <plugin>: List subcommands for the given plugin.
die
---
Instantly kills DF without saving.
quicksave .. _plug:
plug
----
Lists available plugins, including their state and detailed description.
``plug``
Lists available plugins (*not* commands implemented by plugins)
``plug [PLUGIN] [PLUGIN] ...``
List state and detailed description of the given plugins,
including commands implemented by the plugin.
.. _sc-script:
sc-script
--------- ---------
Save immediately, without exiting. Only available in fortress mode. Allows additional scripts to be run when certain events occur
(similar to onLoad*.init scripts)
forcepause
----------
Forces DF to pause. This is useful when your FPS drops below 1 and you lose
control of the game. Activate with ``forcepause 1``; deactivate with ``forcepause 0``.
hide / show .. _script:
-----------
Hides or shows the DFHack terminal window, respectively. To use ``show``, use script
the in-game console (default keybinding ``Ctrl-Shift-P``). Only available on Windows. ------
Reads a text file, and runs each line as a DFHack command
as if it had been typed in by the user - treating the
input like `an init file <init-files>`.
Some other tools, such as `autobutcher` and `workflow`, export
their settings as the commands to create them - which are later
loaded with ``script``
.. _show:
show
----
Shows the terminal window after it has been `hidden <hide>`.
Only available on Windows. You'll need to use it from a
`keybinding` set beforehand, or the in-game `command-prompt`.
.. _type:
type
----
``type command`` shows where ``command`` is implemented.
Other Commands
--------------
The following commands are *not* built-in, but offer similarly useful functions.
* `command-prompt`
* `hotkeys`
* `lua`
* `multicmd`
* `nopause`
* `quicksave`
* `rb`
* `repeat`
.. _init-files:
Init Files
==========
DFHack allows users to automatically run commonly-used DFHack commands
when DF is first loaded, when a game is loaded, and when a game is unloaded.
Init scripts function the same way they would if the user manually typed
in their contents, but are much more convenient. In order to facilitate
savegave portability, mod merging, and general organization of init files,
DFHack supports multiple init files both in the main DF directory and
save-specific init files in the save folders.
DFHack looks for init files in three places each time they could be run:
#. The main DF directory
#. :file:`data/save/{world}/raw`, where ``world`` is the current save, and
#. :file:`data/save/{world}/raw/objects`
When reading commands from dfhack.init or with the `script` command, if the final
character on a line is a backslash then the next uncommented line is considered a
continuation of that line, with the backslash deleted. Commented lines are skipped,
so it is possible to comment out parts of a command with the ``#`` character.
.. _dfhack.init:
dfhack*.init
------------
If your DF folder contains at least one file named ``dfhack*.init``
(where ``*`` is a placeholder for any string), then all such files
are executed in alphabetical order when DF is first started.
DFHack is distributed with :download:`/dfhack.init-example` as an example
with an up-to-date collection of basic commands; mostly setting standard
keybindings and `enabling <enable>` plugins. You are encouraged to look
through this file to learn which features it makes available under which
key combinations. You may also customise it and rename it to ``dfhack.init``.
If your DF folder does not contain any ``dfhack*.init`` files, the example
will be run as a fallback.
These files are best used for keybindings and enabling persistent plugins
which do not require a world to be loaded.
.. _onLoad.init:
onLoad*.init
------------
When a world is loaded, DFHack looks for files of the form ``onLoad*.init``,
where ``*`` can be any string, including the empty string.
All matching init files will be executed in alphebetical order.
A world being loaded can mean a fortress, an adventurer, or legends mode.
These files are best used for non-persistent commands, such as setting
a `fix <fix>` script to run on `repeat`.
.. _onUnload.init:
onUnload*.init
--------------
When a world is unloaded, DFHack looks for files of the form ``onUnload*.init``.
Again, these files may be in any of the above three places.
All matching init files will be executed in alphebetical order.
Modders often use such scripts to disable tools which should not affect
an unmodded save.
Other init files
----------------
* ``onMapLoad*.init`` and ``onMapUnload*.init`` are run when a map,
distinct from a world, is loaded. This is good for map-affecting
commands (eg `clean`), or avoiding issues in Legends mode.
* Any lua script named ``raw/init.d/*.lua``, in the save or main DF
directory, will be run when any world or that save is loaded.
Miscellaneous Notes
===================
This section is for odd but important notes that don't fit anywhere else.
* The ``dfhack-run`` executable is there for calling DFHack commands in
an already running DF+DFHack instance from external OS scripts and programs,
and is *not* the way how you use DFHack normally.
* If a DF :kbd:`H` hotkey is named with a DFHack command, pressing
the corresponding :kbd:`Fx` button will run that command, instead of
zooming to the set location.
* The command line has some nice line editing capabilities, including history
that's preserved between different runs of DF (use up/down keys to go through
the history).
* The binaries for 0.40.15-r1 to 0.34.11-r4 are on DFFD_.
Older versions are available here_.
.. _DFFD: http://dffd.bay12games.com/search.php?string=DFHack&id=15&limit=1000
.. _here: http://dethware.org/dfhack/download
* To include whitespace in the argument/s to some command, quote it in
double quotes. To include a double quote character, use ``\"``.
* If the first non-whitespace character is ``:``, the command is parsed in
an alternative mode which is very useful for the `lua` and `rb` commands.
The following two command lines are exactly equivalent::
:foo a b "c d" e f
foo "a b \"c d\" e f"
nopause * non-whitespace characters following the ``:`` are the command name
------- * the remaining part of the line is used verbatim as the first argument
Disables pausing (both manual and automatic) with the exception of pause forced
by 'reveal hell'. This is nice for digging under rivers.

@ -0,0 +1,107 @@
.. _introduction:
#########################
Introduction and Overview
#########################
DFHack is a Dwarf Fortress memory access library, distributed with
a wide variety of useful scripts and plugins.
The project is currently hosted at https://www.github.com/DFHack/dfhack,
and can be downloaded from `the releases page
<http://github.com/DFHack/dfhack/releases>`_.
All new releases are announced in :forums:`the bay12 forums thread <139553>`,
which is also a good place for discussion and questions.
For users, it provides a significant suite of bugfixes and interface
enhancements by default, and more can be enabled. There are also many tools
(such as `workflow` or `autodump`) which can make life easier.
You can even add third-party scripts and plugins to do almost anything!
For modders, DFHack makes many things possible. Custom reactions, new
interactions, magic creature abilities, and more can be set through `modtools`
and custom raws. Non-standard DFHack scripts and inits can be stored in the
raw directory, making raws or saves fully self-contained for distribution -
or for coexistence in a single DF install, even with incompatible components.
For developers, DFHack unites the various ways tools access DF memory and
allows easier development of new tools. As an open-source project under
`various copyleft licences <license>`, contributions are welcome.
.. contents::
.. _installing:
Installing DFHack
=================
DFHack is available for the SDL version of Dwarf Frtress on Windows,
any modern Linux distribution, and OS X (10.6.8 to 10.9).
It is possible to use Windows DF+DFHack under Wine on Linux or OS X.
Most releases only support the version of DF mentioned in their title - for
example, DFHack 0.40.24-r2 only supports DF 0.40.24 - but some releases
support earlier DF versions as well. Wherever possible, use the latest version
of DFHack built for the target version of DF.
Installing DFhack involves copying files from a release archive
into your DF folder, so that:
* On Windows, ``SDL.dll`` is replaced
* On Linux or OSX, the ``dfhack`` script is placed in the same folder as the ``df`` script
Uninstalling is basically the same, in reverse:
* On Windows, replace ``SDL.dll`` with ``SDLreal.dll``, then remove the DFHack files.
* On Linux or OSX, remove the DFHack files.
New players may wish to :wiki:`get a pack <Utility:Lazy_Newb_Pack>`
with DFHack preinstalled.
Getting started
===============
DFHack basically extends DF with something similar to the
console found in many PC games.
If DFHack is installed correctly, it will automatically pop up a console
window once DF is started as usual on Windows. Linux and Mac OS X require
running the dfhack script from the terminal, and will use that terminal for
the console.
* Basic interaction with dfhack involves entering commands into the console.
To learn what commands are available, you can keep reading this documentation
or skip ahead and use the `ls` and `help` commands.
* Another way to interact with DFHack is to set in-game `keybindings <keybinding>`
for certain commands. Many of the newer and user-friendly tools are designed
to be used this way.
* Commands can also run at startup via `init files <init-files>`,
on in batches at other times with the `script` command.
* Finally, some commands are persistent once enabled, and will sit in the
background managing or changing some aspect of the game if you `enable` them.
.. _troubleshooting:
Troubleshooting
===============
Don't panic! Even if you need this section, it'll be OK :)
If something goes wrong, check the log files in DF's folder
(``stderr.log`` and ``stdout.log``). Looking at these might help you -
or someone else - solve the problem. Take screenshots of any weird
error messages, and take notes on what you did to cause them.
If the search function in this documentation isn't enough and
:wiki:`the DF Wiki <>` hasn't helped, try asking in:
- the `#dfhack IRC channel on freenode <https://webchat.freenode.net/?channels=dfhack>`_
- the :forums:`Bay12 DFHack thread <139553>`
- the `/r/dwarffortress <https://dwarffortress.reddit.com>`_ questions thread
- the thread for the mod or Starter Pack you're using (if any)

@ -1,11 +0,0 @@
.. _license:
########
Licenses
########
DFHack is distributed under a range of permissive and weakly copyleft licenses.
The core uses the ZLib license; the others are described below.
.. include:: ../LICENSE

@ -3264,6 +3264,8 @@ sort
Does not export any native functions as of now. Instead, it Does not export any native functions as of now. Instead, it
calls lua code to perform the actual ordering of list items. calls lua code to perform the actual ordering of list items.
.. _eventful:
Eventful Eventful
======== ========
@ -3306,6 +3308,8 @@ List of events
Is called after calling (or not) native fillSidebarMenu(). Useful for job button Is called after calling (or not) native fillSidebarMenu(). Useful for job button
tweaking (e.g. adding custom reactions) tweaking (e.g. adding custom reactions)
.. _EventManager:
Events from EventManager Events from EventManager
------------------------ ------------------------
These events are straight from EventManager module. Each of them first needs to be enabled. See functions for more info. If you register a listener before the game is loaded, be aware that no events will be triggered immediately after loading, so you might need to add another event listener for when the game first loads in some cases. These events are straight from EventManager module. Each of them first needs to be enabled. See functions for more info. If you register a listener before the game is loaded, be aware that no events will be triggered immediately after loading, so you might need to add another event listener for when the game first loads in some cases.
@ -3420,6 +3424,8 @@ Integrated tannery::
b=require "plugins.eventful" b=require "plugins.eventful"
b.addReactionToShop("TAN_A_HIDE","LEATHERWORKS") b.addReactionToShop("TAN_A_HIDE","LEATHERWORKS")
.. _building-hacks:
Building-hacks Building-hacks
============== ==============

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

@ -0,0 +1,40 @@
/* make sure to sync this with the base theme's css filename */
@import url("alabaster.css");
.kbd {
/* Keybinding CSS from the DF wiki; applies to :kbd:`` directives.
* Use this directive for all keypresses, to make them look like keys.
*/
border: 1px solid #aaa;
border-radius: 0.2em;
-webkit-border-radius: 0.2em;
-moz-border-radius: 0.2em;
-o-border-radius: 0.2em; -ms-border-radius: 0.2em;
-moz-box-shadow: 0.1em 0.2em 0.2em #ddd;
-webkit-box-shadow: 0.1em 0.2em 0.2em #ddd;
box-shadow: 0.1em 0.2em 0.2em #ddd;
background-color: #f9f9f9;
background-image: -moz-linear-gradient(top, #eee, #f9f9f9, #eee);
background-image: -o-linear-gradient(top, #eee, #f9f9f9, #eee);
background-image: -webkit-linear-gradient(top, #eee, #f9f9f9, #eee);
background-image: linear-gradient(to bottom, #eee, #f9f9f9, #eee);
padding: 0.1em 0.3em;
font-family: sans-serif;
font-size: 0.8em;
}
@font-face {
font-family: cp437;
src: url("cp437.ttf");
}
.guilabel {
/* In-game text CSS from the DF wiki; applies to :guilabel:`` directives.
* Use this for any text from an in-game announcement or menu.
*/
color: #CBC7C0;
font-family: cp437, 'fixedsys', monospace;
background: #000000;
font-size: 0.95em;
padding: 0.05em 0.4em;
}

@ -1,18 +1,26 @@
##################################
Welcome to DFHack's documentation! Welcome to DFHack's documentation!
================================== ##################################
Introduction Introduction
============ ============
DFHack is a Dwarf Fortress memory access library, distributed with scripts DFHack is a Dwarf Fortress memory access library, distributed with
and plugins implementing a wide variety of useful functions and tools. a wide variety of useful scripts and plugins.
The project is currently hosted at https://www.github.com/DFHack/dfhack,
and can be downloaded from `the releases page
<http://github.com/DFHack/dfhack/releases>`_.
All new releases are announced in :forums:`the bay12 forums thread <139553>`,
which is also a good place for discussion and questions.
For users, it provides a significant suite of bugfixes and interface For users, it provides a significant suite of bugfixes and interface
enhancements by default, and more can be enabled. There are also many tools enhancements by default, and more can be enabled. There are also many tools
(such as `plugins/workflow` or `plugins/autodump`) which can make life easier. (such as `workflow` or `autodump`) which can make life easier.
You can even add third-party scripts and plugins to do almost anything! You can even add third-party scripts and plugins to do almost anything!
For modders, DFHack makes many things possible. Custom reactions, new For modders, DFHack makes many things possible. Custom reactions, new
interactions, magic creature abilities, and more can be set through `scripts <scripts/modtools>` interactions, magic creature abilities, and more can be set through `modtools`
and custom raws. Non-standard DFHack scripts and inits can be stored in the and custom raws. Non-standard DFHack scripts and inits can be stored in the
raw directory, making raws or saves fully self-contained for distribution - raw directory, making raws or saves fully self-contained for distribution -
or for coexistence in a single DF install, even with incompatible components. or for coexistence in a single DF install, even with incompatible components.
@ -22,38 +30,36 @@ allows easier development of new tools. As an open-source project under
`various copyleft licences <license>`, contributions are welcome. `various copyleft licences <license>`, contributions are welcome.
Documentation User Manual
============= ===========
DFHack documentation is generated by Sphinx. Check out the table of contents
below, or the sources in the `docs folder`_!
.. _`docs folder`: ./docs
User Manual:
.. toctree:: .. toctree::
:maxdepth: 2 :maxdepth: 2
docs/Core /docs/Introduction
docs/Plugins /docs/Core
docs/Scripts /docs/Plugins
/docs/Scripts
Other Contents: Other Contents
==============
.. toctree:: .. toctree::
:maxdepth: 1 :maxdepth: 1
docs/Authors /docs/Authors
docs/Licenses /LICENSE
docs/Changelog /NEWS
For Developers: For Developers
==============
.. toctree:: .. toctree::
:maxdepth: 1 :maxdepth: 1
docs/Contributing /docs/Contributing
docs/Compile /docs/Compile
docs/Lua API /docs/Lua API
library/xml/SYNTAX /library/xml/SYNTAX
docs/Binpatches /library/xml/how-to-update
/docs/Binpatches

@ -553,7 +553,6 @@ string getBuiltinCommand(std::string cmd)
cmd == "enable" || cmd == "enable" ||
cmd == "disable" || cmd == "disable" ||
cmd == "plug" || cmd == "plug" ||
cmd == "type" ||
cmd == "keybinding" || cmd == "keybinding" ||
cmd == "fpause" || cmd == "fpause" ||
cmd == "cls" || cmd == "cls" ||

@ -114,7 +114,8 @@ static int (*_SDL_Init)(uint32_t flags) = 0;
DFhackCExport int SDL_Init(uint32_t flags) DFhackCExport int SDL_Init(uint32_t flags)
{ {
// reroute stderr // reroute stderr
freopen("stderr.log", "w", stderr); if (!freopen("stderr.log", "w", stderr))
fprintf(stderr, "dfhack: failed to reroute stderr\n");
// we don't reroute stdout until we figure out if this should be done at all // we don't reroute stdout until we figure out if this should be done at all
// See: Console-linux.cpp // See: Console-linux.cpp

@ -1310,6 +1310,18 @@ static int wtype_ipairs(lua_State *state)
return 3; return 3;
} }
static int wtype_next_item(lua_State *state)
{
int first = lua_tointeger(state, lua_upvalueindex(1)),
last = lua_tointeger(state, lua_upvalueindex(2)),
cur = luaL_checkint(state, lua_gettop(state) > 1 ? 2 : 1); // 'self' optional
if (cur < last)
lua_pushinteger(state, cur + 1);
else
lua_pushinteger(state, first);
return 1;
}
static void RenderTypeChildren(lua_State *state, const std::vector<compound_identity*> &children); static void RenderTypeChildren(lua_State *state, const std::vector<compound_identity*> &children);
void LuaWrapper::AssociateId(lua_State *state, int table, int val, const char *name) void LuaWrapper::AssociateId(lua_State *state, int table, int val, const char *name)
@ -1347,6 +1359,11 @@ static void FillEnumKeys(lua_State *state, int ix_meta, int ftable, enum_identit
lua_pushcclosure(state, wtype_ipairs, 3); lua_pushcclosure(state, wtype_ipairs, 3);
lua_setfield(state, ix_meta, "__ipairs"); lua_setfield(state, ix_meta, "__ipairs");
lua_pushinteger(state, eid->getFirstItem());
lua_pushinteger(state, eid->getLastItem());
lua_pushcclosure(state, wtype_next_item, 2);
lua_setfield(state, ftable, "next_item");
lua_pushinteger(state, eid->getFirstItem()); lua_pushinteger(state, eid->getFirstItem());
lua_setfield(state, ftable, "_first_item"); lua_setfield(state, ftable, "_first_item");

@ -59,6 +59,7 @@ DFHACK_EXPORT bool isValid();
DFHACK_EXPORT uint32_t getCount(); DFHACK_EXPORT uint32_t getCount();
DFHACK_EXPORT bool copyConstruction (const int32_t index, t_construction &out); DFHACK_EXPORT bool copyConstruction (const int32_t index, t_construction &out);
DFHACK_EXPORT df::construction * getConstruction (const int32_t index); DFHACK_EXPORT df::construction * getConstruction (const int32_t index);
DFHACK_EXPORT df::construction * findAtTile(df::coord pos);
DFHACK_EXPORT bool designateNew(df::coord pos, df::construction_type type, DFHACK_EXPORT bool designateNew(df::coord pos, df::construction_type type,
df::item_type item = df::item_type::NONE, int mat_index = -1); df::item_type item = df::item_type::NONE, int mat_index = -1);

@ -68,6 +68,15 @@ df::construction * Constructions::getConstruction(const int32_t index)
return world->constructions[index]; return world->constructions[index];
} }
df::construction * Constructions::findAtTile(df::coord pos)
{
for (auto it = world->constructions.begin(); it != world->constructions.end(); ++it) {
if ((*it)->pos == pos)
return *it;
}
return NULL;
}
bool Constructions::copyConstruction(const int32_t index, t_construction &out) bool Constructions::copyConstruction(const int32_t index, t_construction &out)
{ {
if (uint32_t(index) >= getCount()) if (uint32_t(index) >= getCount())

@ -1 +1 @@
Subproject commit dc76bf4247b78cf2525bf60a62553dadd42ca696 Subproject commit 378a580f7e333607a64a301d598e3885954a5d9d

@ -133,7 +133,6 @@ if (BUILD_SUPPORTED)
DFHACK_PLUGIN(getplants getplants.cpp) DFHACK_PLUGIN(getplants getplants.cpp)
DFHACK_PLUGIN(hotkeys hotkeys.cpp) DFHACK_PLUGIN(hotkeys hotkeys.cpp)
DFHACK_PLUGIN(infiniteSky infiniteSky.cpp) DFHACK_PLUGIN(infiniteSky infiniteSky.cpp)
DFHACK_PLUGIN(initflags initflags.cpp)
DFHACK_PLUGIN(isoworldremote isoworldremote.cpp PROTOBUFS isoworldremote) DFHACK_PLUGIN(isoworldremote isoworldremote.cpp PROTOBUFS isoworldremote)
DFHACK_PLUGIN(jobutils jobutils.cpp) DFHACK_PLUGIN(jobutils jobutils.cpp)
DFHACK_PLUGIN(lair lair.cpp) DFHACK_PLUGIN(lair lair.cpp)

@ -41,6 +41,17 @@ using df::nemesis_record;
using df::historical_figure; using df::historical_figure;
using namespace DFHack::Translation; using namespace DFHack::Translation;
/*
advtools
========
A package of different adventure mode tools. Usage:
:list-equipped [all]: List armor and weapons equipped by your companions.
If all is specified, also lists non-metal clothing.
:metal-detector [all-types] [non-trader]:
Reveal metal armor and weapons in shops. The options
disable the checks on item type and being in shop.
*/
DFHACK_PLUGIN("advtools"); DFHACK_PLUGIN("advtools");
REQUIRE_GLOBAL(world); REQUIRE_GLOBAL(world);

@ -32,6 +32,7 @@
#include "modules/Constructions.h" #include "modules/Constructions.h"
#include "modules/Buildings.h" #include "modules/Buildings.h"
#include "modules/Maps.h" #include "modules/Maps.h"
#include "modules/MapCache.h"
#include "TileTypes.h" #include "TileTypes.h"
#include "df/job_item.h" #include "df/job_item.h"
@ -455,24 +456,14 @@ static bool is_valid_building_site(building_site &site, bool orthogonal_check, b
} }
else else
{ {
if (shape_basic != tiletype_shape_basic::Floor) if (shape != tiletype_shape::STAIR_DOWN && shape_basic != tiletype_shape_basic::Floor)
return false; return false;
if (material == tiletype_material::CONSTRUCTION) // Can build on top of a wall, but not on other construction
auto construction = Constructions::findAtTile(site.pos);
if (construction)
{ {
// Can build on top of a wall, but not on a constructed floor if (construction->flags.bits.top_of_wall==0)
df::coord pos_below = site.pos;
pos_below.z--;
if (!Maps::isValidTilePos(pos_below))
return false;
auto ttype = Maps::getTileType(pos_below);
if (!ttype)
return false;
auto shape = tileShape(*ttype);
auto shapeBasic = tileShapeBasic(shape);
if (tileShapeBasic(shape) != tiletype_shape_basic::Wall)
return false; return false;
} }
@ -1129,7 +1120,7 @@ struct jobutils_hook : public df::viewscreen_dwarfmodest
{ {
++y; ++y;
OutputString(COLOR_BROWN, x, y, "Construction:", true, left_margin); OutputString(COLOR_BROWN, x, y, "Construction:", true, left_margin);
OutputString(COLOR_WHITE, x, y, int_to_string(valid_building_sites.size() + 1) + " tiles to fill", true, left_margin); OutputString(COLOR_WHITE, x, y, int_to_string(valid_building_sites.size()) + " tiles to fill", true, left_margin);
} }
} }
} }

@ -60,7 +60,7 @@ public:
{ {
show_fps=gps->display_frames; show_fps=gps->display_frames;
gps->display_frames=0; gps->display_frames=0;
cursor_pos = 0; cursor_pos = entry.size();
frame = 0; frame = 0;
history_idx = command_history.size(); history_idx = command_history.size();
if (history_idx > 0) if (history_idx > 0)

@ -20,6 +20,11 @@ using namespace std;
#include <df/unit_soul.h> #include <df/unit_soul.h>
#include <df/unit_labor.h> #include <df/unit_labor.h>
#include <df/unit_skill.h> #include <df/unit_skill.h>
/*
dwarfexport
===========
Export dwarves to RuneSmith-compatible XML; also unused by modern tools.
*/
using namespace DFHack; using namespace DFHack;
using df::global::ui; using df::global::ui;

@ -8,6 +8,7 @@
#include "VTableInterpose.h" #include "VTableInterpose.h"
#include "df/building.h" #include "df/building.h"
#include "df/building_furnacest.h"
#include "df/building_workshopst.h" #include "df/building_workshopst.h"
#include "df/construction.h" #include "df/construction.h"
#include "df/item.h" #include "df/item.h"
@ -91,8 +92,8 @@ static bool is_lua_hook(const std::string &name)
/* /*
* Hooks * Hooks
*/ */
static void handle_fillsidebar(color_ostream &out,df::building_workshopst*,bool *call_native){}; static void handle_fillsidebar(color_ostream &out,df::building_actual*,bool *call_native){};
static void handle_postfillsidebar(color_ostream &out,df::building_workshopst*){}; static void handle_postfillsidebar(color_ostream &out,df::building_actual*){};
static void handle_reaction_done(color_ostream &out,df::reaction*, df::reaction_product_itemst*, df::unit *unit, std::vector<df::item*> *in_items,std::vector<df::reaction_reagent*> *in_reag static void handle_reaction_done(color_ostream &out,df::reaction*, df::reaction_product_itemst*, df::unit *unit, std::vector<df::item*> *in_items,std::vector<df::reaction_reagent*> *in_reag
, std::vector<df::item*> *out_items,bool *call_native){}; , std::vector<df::item*> *out_items,bool *call_native){};
@ -102,8 +103,8 @@ static void handle_projitem_cm(color_ostream &out,df::proj_itemst*){};
static void handle_projunit_ci(color_ostream &out,df::proj_unitst*,bool){}; static void handle_projunit_ci(color_ostream &out,df::proj_unitst*,bool){};
static void handle_projunit_cm(color_ostream &out,df::proj_unitst*){}; static void handle_projunit_cm(color_ostream &out,df::proj_unitst*){};
DEFINE_LUA_EVENT_2(onWorkshopFillSidebarMenu, handle_fillsidebar, df::building_workshopst*,bool* ); DEFINE_LUA_EVENT_2(onWorkshopFillSidebarMenu, handle_fillsidebar, df::building_actual*,bool* );
DEFINE_LUA_EVENT_1(postWorkshopFillSidebarMenu, handle_postfillsidebar, df::building_workshopst*); DEFINE_LUA_EVENT_1(postWorkshopFillSidebarMenu, handle_postfillsidebar, df::building_actual*);
DEFINE_LUA_EVENT_7(onReactionComplete, handle_reaction_done,df::reaction*, df::reaction_product_itemst*, df::unit *, std::vector<df::item*> *,std::vector<df::reaction_reagent*> *,std::vector<df::item*> *,bool *); DEFINE_LUA_EVENT_7(onReactionComplete, handle_reaction_done,df::reaction*, df::reaction_product_itemst*, df::unit *, std::vector<df::item*> *,std::vector<df::reaction_reagent*> *,std::vector<df::item*> *,bool *);
DEFINE_LUA_EVENT_5(onItemContaminateWound, handle_contaminate_wound, df::item_actual*,df::unit* , df::unit_wound* , uint8_t , int16_t ); DEFINE_LUA_EVENT_5(onItemContaminateWound, handle_contaminate_wound, df::item_actual*,df::unit* , df::unit_wound* , uint8_t , int16_t );
@ -287,6 +288,22 @@ struct workshop_hook : df::building_workshopst{
} }
}; };
IMPLEMENT_VMETHOD_INTERPOSE(workshop_hook, fillSidebarMenu); IMPLEMENT_VMETHOD_INTERPOSE(workshop_hook, fillSidebarMenu);
struct furnace_hook : df::building_furnacest{
typedef df::building_furnacest interpose_base;
DEFINE_VMETHOD_INTERPOSE(void,fillSidebarMenu,())
{
CoreSuspendClaimer suspend;
color_ostream_proxy out(Core::getInstance().getConsole());
bool call_native=true;
onWorkshopFillSidebarMenu(out,this,&call_native);
if(call_native)
INTERPOSE_NEXT(fillSidebarMenu)();
postWorkshopFillSidebarMenu(out,this);
}
};
IMPLEMENT_VMETHOD_INTERPOSE(furnace_hook, fillSidebarMenu);
struct product_hook : item_product { struct product_hook : item_product {
typedef item_product interpose_base; typedef item_product interpose_base;
@ -430,6 +447,7 @@ static bool find_reactions(color_ostream &out)
static void enable_hooks(bool enable) static void enable_hooks(bool enable)
{ {
INTERPOSE_HOOK(workshop_hook,fillSidebarMenu).apply(enable); INTERPOSE_HOOK(workshop_hook,fillSidebarMenu).apply(enable);
INTERPOSE_HOOK(furnace_hook,fillSidebarMenu).apply(enable);
INTERPOSE_HOOK(item_hooks,contaminateWound).apply(enable); INTERPOSE_HOOK(item_hooks,contaminateWound).apply(enable);
INTERPOSE_HOOK(proj_unit_hook,checkImpact).apply(enable); INTERPOSE_HOOK(proj_unit_hook,checkImpact).apply(enable);
INTERPOSE_HOOK(proj_unit_hook,checkMovement).apply(enable); INTERPOSE_HOOK(proj_unit_hook,checkMovement).apply(enable);

@ -1,51 +0,0 @@
#include "Core.h"
#include "Console.h"
#include "Export.h"
#include "PluginManager.h"
#include "DataDefs.h"
#include "df/d_init.h"
using std::vector;
using std::string;
using std::endl;
using namespace DFHack;
using namespace df::enums;
DFHACK_PLUGIN("initflags");
REQUIRE_GLOBAL(d_init);
command_result twaterlvl(color_ostream &out, vector <string> & parameters);
command_result tidlers(color_ostream &out, vector <string> & parameters);
DFhackCExport command_result plugin_init (color_ostream &out, std::vector <PluginCommand> &commands)
{
if (d_init) {
commands.push_back(PluginCommand("twaterlvl", "Toggle display of water/magma depth.",
twaterlvl, Gui::dwarfmode_hotkey));
commands.push_back(PluginCommand("tidlers", "Toggle display of idlers.",
tidlers, Gui::dwarfmode_hotkey));
}
return CR_OK;
}
DFhackCExport command_result plugin_shutdown ( color_ostream &out )
{
return CR_OK;
}
command_result twaterlvl(color_ostream &out, vector <string> & parameters)
{
// HOTKEY COMMAND: CORE ALREADY SUSPENDED
d_init->flags1.toggle(d_init_flags1::SHOW_FLOW_AMOUNTS);
out << "Toggled the display of water/magma depth." << endl;
return CR_OK;
}
command_result tidlers(color_ostream &out, vector <string> & parameters)
{
// HOTKEY COMMAND: CORE ALREADY SUSPENDED
d_init->idlers = ENUM_NEXT_ITEM(d_init_idlers, d_init->idlers);
out << "Toggled the display of idlers to " << ENUM_KEY_STR(d_init_idlers, d_init->idlers) << endl;
return CR_OK;
}

@ -21,6 +21,12 @@ using namespace google::protobuf::io;
using namespace DFHack; using namespace DFHack;
using df::global::world; using df::global::world;
/*
mapexport
=========
Export the current loaded map as a file. This was used by visualizers for
DF 0.34.11, but is now basically obsolete.
*/
typedef std::vector<df::plant *> PlantList; typedef std::vector<df::plant *> PlantList;

@ -14,6 +14,21 @@
using namespace std; using namespace std;
using namespace DFHack; using namespace DFHack;
/*
misery
======
When enabled, every new negative dwarven thought will be multiplied by a factor (2 by default).
Usage:
:misery enable n: enable misery with optional magnitude n. If specified, n must be positive.
:misery n: same as "misery enable n"
:misery enable: same as "misery enable 2"
:misery disable: stop adding new negative thoughts. This will not remove existing
duplicated thoughts. Equivalent to "misery 1"
:misery clear: remove fake thoughts added in this session of DF. Saving makes them
permanent! Does not change factor.
*/
DFHACK_PLUGIN("misery"); DFHACK_PLUGIN("misery");
DFHACK_PLUGIN_IS_ENABLED(is_enabled); DFHACK_PLUGIN_IS_ENABLED(is_enabled);

@ -20,6 +20,24 @@
//#include "df/world.h" //#include "df/world.h"
using namespace DFHack; using namespace DFHack;
/*
treefarm
========
Automatically manages special burrows and regularly schedules tree chopping
and digging when appropriate.
Every time the plugin runs, it checks for burrows with a name containing the
string ``"treefarm"``. For each such burrow, it checks every tile in it for
fully-grown trees and for diggable walls. For each fully-grown tree it finds,
it designates the tree to be chopped, and for each natural wall it finds, it
designates the wall to be dug.
Usage:
:treefarm: Enables treefarm monitoring, starting next frame
:treefarm n: Enables treefarm monitoring, starting next frame, and sets
interval to n frames. If n is less than one, disables monitoring.
*/
DFHACK_PLUGIN("treefarm"); DFHACK_PLUGIN("treefarm");
DFHACK_PLUGIN_IS_ENABLED(enabled); DFHACK_PLUGIN_IS_ENABLED(enabled);

@ -1 +1 @@
Subproject commit 8cf05cc89782206235f4bef1b5ef98e1bc74e266 Subproject commit 0a75d5ff69916cf9b3739f4b20d36ab4cfdcf824

@ -1 +1 @@
Subproject commit 38a8415ffc23e89590260a4502fa6aeeac95146d Subproject commit 0b8303f6b03d574e3a0b3fd8b17b7ff0014af47f

@ -1 +1 @@
Subproject commit ac6dae2ff06d1576873b8e508017e8043e7aa701 Subproject commit 45c78449e71d1ba263044fb00108509088ad0026

@ -1 +1 @@
Subproject commit 0c32075d2205fe3aa80794fc45b2c49e3dace8dc Subproject commit b337e931b8b7a167ee5ce1ac6b5c3155c291f260

@ -4,7 +4,7 @@ DFHACK_3RDPARTY_SCRIPT_REPO(kane-t)
DFHACK_3RDPARTY_SCRIPT_REPO(lethosor) DFHACK_3RDPARTY_SCRIPT_REPO(lethosor)
DFHACK_3RDPARTY_SCRIPT_REPO(maienm) DFHACK_3RDPARTY_SCRIPT_REPO(maienm)
DFHACK_3RDPARTY_SCRIPT_REPO(maxthyme) DFHACK_3RDPARTY_SCRIPT_REPO(maxthyme)
DFHACK_3RDPARTY_SCRIPT_REPO(roses) # DFHACK_3RDPARTY_SCRIPT_REPO(roses)
install(DIRECTORY ${dfhack_SOURCE_DIR}/scripts install(DIRECTORY ${dfhack_SOURCE_DIR}/scripts
DESTINATION ${DFHACK_DATA_DESTINATION} DESTINATION ${DFHACK_DATA_DESTINATION}

@ -0,0 +1,2 @@
Basic scripts are not stored in any subdirectory, and can be invoked directly.
They are generally useful tools for any player.

@ -1,5 +1,14 @@
# View or set level of cavern adaptation for the selected unit or the whole fort # View or set level of cavern adaptation for the selected unit or the whole fort
# based on removebadthoughts.rb # based on removebadthoughts.rb
=begin
adaptation
==========
View or set level of cavern adaptation for the selected unit or the whole fort.
Usage: ``adaptation <show|set> <him|all> [value]``. The ``value`` must be
between 0 and 800,000 inclusive.
=end
# Color constants, values mapped to color_value enum in include/ColorText.h # Color constants, values mapped to color_value enum in include/ColorText.h
COLOR_GREEN = 2 COLOR_GREEN = 2

@ -1,18 +1,14 @@
-- Adds emotions to creatures. -- Adds emotions to creatures.
--@ module = true --@ module = true
--[[ --[[=begin
BEGIN_DOCS
.. _scripts/add-thought
add-thought add-thought
=========== ===========
Adds a thought or emotion to the selected unit. Can be used by other scripts, Adds a thought or emotion to the selected unit. Can be used by other scripts,
or the gui invoked by running ``add-thought gui`` with a unit selected. or the gui invoked by running ``add-thought gui`` with a unit selected.
END_DOCS =end]]
]]
local utils=require('utils') local utils=require('utils')

@ -3,7 +3,16 @@
-- arguments allow for skills to be adjusted as well -- arguments allow for skills to be adjusted as well
-- WARNING: USING THIS SCRIPT WILL ADJUST ALL DWARVES IN PLAY! -- WARNING: USING THIS SCRIPT WILL ADJUST ALL DWARVES IN PLAY!
-- by vjek -- by vjek
--[[=begin
armoks-blessing
===============
Runs the equivalent of `rejuvenate`, `elevate-physical`, `elevate-mental`, and
`brainwash` on all dwarves currently on the map. This is an extreme change,
which sets every stat to an ideal - legendary skills, great traits, and
easy-to-satisfy preferences.
=end]]
function rejuvenate(unit) function rejuvenate(unit)
if unit==nil then if unit==nil then
print ("No unit available! Aborting with extreme prejudice.") print ("No unit available! Aborting with extreme prejudice.")

@ -1,3 +1,19 @@
=begin
autofarm
========
Automatically handle crop selection in farm plots based on current plant stocks.
Selects a crop for planting if current stock is below a threshold.
Selected crops are dispatched on all farmplots.
Usage::
autofarm start
autofarm default 30
autofarm threshold 150 helmet_plump tail_pig
=end
class AutoFarm class AutoFarm
def initialize def initialize

@ -1,5 +1,12 @@
-- Executes an autolabor command for each labor where skill level influences output quality. -- Executes an autolabor command for each labor where skill level influences output quality.
--[[=begin
autolabor-artisans
==================
Runs `autolabor`, with settings tuned for small but highly skilled workforces.
=end]]
local artisan_labors = { local artisan_labors = {
"CARPENTER", "CARPENTER",
"DETAIL", "DETAIL",

@ -1,4 +1,12 @@
# un-suspend construction jobs, on a recurring basis # un-suspend construction jobs, on a recurring basis
=begin
autounsuspend
=============
Automatically unsuspend jobs in workshops, on a recurring basis.
See `unsuspend` for one-off use, or `resume` ``all``.
=end
class AutoUnsuspend class AutoUnsuspend
attr_accessor :running attr_accessor :running

@ -1,4 +1,13 @@
# convenient way to ban cooking categories of food # convenient way to ban cooking categories of food
=begin
ban-cooking
===========
A more convenient way to ban cooking various categories of foods than the
kitchen interface. Usage: ``ban-cooking <type>``. Valid types are ``booze``,
``honey``, ``tallow``, ``oil``, and ``seeds`` (non-tree plants with seeds).
=end
already_banned = {} already_banned = {}
kitchen = df.ui.kitchen kitchen = df.ui.kitchen

@ -1,4 +1,11 @@
-- Apply or remove binary patches at runtime. -- Apply or remove binary patches at runtime.
--[[=begin
binpatch
========
Implements functions for in-memory binpatches. See `binpatches`.
=end]]
local bp = require('binpatch') local bp = require('binpatch')

@ -1,6 +1,15 @@
-- This script will brainwash a dwarf, modifying their personality -- This script will brainwash a dwarf, modifying their personality
-- usage is: target a unit in DF, and execute this script in dfhack -- usage is: target a unit in DF, and execute this script in dfhack
-- by vjek -- by vjek
--[[=begin
brainwash
=========
Modify the personality traits of the selected dwarf to match an 'ideal'
personality - as stable and reliable as possible. This makes dwarves very
stable, preventing tantrums even after months of misery.
=end]]
function brainwash_unit(profile) function brainwash_unit(profile)
local i,unit_name local i,unit_name

@ -1,5 +1,13 @@
-- allows burial in unowned coffins -- allows burial in unowned coffins
-- by Putnam https://gist.github.com/Putnam3145/e7031588f4d9b24b9dda -- by Putnam https://gist.github.com/Putnam3145/e7031588f4d9b24b9dda
--[[=begin
burial
======
Sets all unowned coffins to allow burial. ``burial -pets`` also allows burial
of pets.
=end]]
local utils=require('utils') local utils=require('utils')

@ -1,4 +1,34 @@
# create first necessity items under cursor # create first necessity items under cursor
=begin
create-items
============
Spawn items under the cursor, to get your fortress started.
The first argument gives the item category, the second gives the material,
and the optionnal third gives the number of items to create (defaults to 20).
Currently supported item categories: ``boulder``, ``bar``, ``plant``, ``log``,
``web``.
Instead of material, using ``list`` makes the script list eligible materials.
The ``web`` item category will create an uncollected cobweb on the floor.
Note that the script does not enforce anything, and will let you create
boulders of toad blood and stuff like that.
However the ``list`` mode will only show 'normal' materials.
Examples::
create-items boulders COAL_BITUMINOUS 12
create-items plant tail_pig
create-items log list
create-items web CREATURE:SPIDER_CAVE_GIANT:SILK
create-items bar CREATURE:CAT:SOAP
create-items bar adamantine
=end
category = $script_args[0] || 'help' category = $script_args[0] || 'help'
mat_raw = $script_args[1] || 'list' mat_raw = $script_args[1] || 'list'

@ -1,4 +1,12 @@
# show death cause of a creature # show death cause of a creature
=begin
deathcause
==========
Select a body part ingame, or a unit from the :kbd:`u` unit list, and this
script will display the cause of death of the creature.
=end
def display_death_event(e) def display_death_event(e)
str = "The #{e.victim_hf_tg.race_tg.name[0]} #{e.victim_hf_tg.name} died in year #{e.year}" str = "The #{e.victim_hf_tg.race_tg.name[0]} #{e.victim_hf_tg.name} died in year #{e.year}"

@ -0,0 +1,6 @@
``devel/*`` scripts are intended for developer use, but many may
be of interest to anyone investigating odd phenomema or just messing
around. They are documented to encourage such inquiry.
Some can PERMANENTLY DAMAGE YOUR SAVE if misused, so please be careful.
The warnings are real; if in doubt make backups before running the command.

@ -1,6 +1,14 @@
--all-bob.lua --all-bob.lua
--author expwnent --author expwnent
--names all units bob. Useful for testing interaction trigger events --
--[[=begin
devel/all-bob
=============
Changes the first name of all units to "Bob".
Useful for testing `modtools/interaction-trigger` events.
=end]]
for _,v in ipairs(df.global.world.units.all) do for _,v in ipairs(df.global.world.units.all) do
v.name.first_name = "Bob" v.name.first_name = "Bob"

@ -0,0 +1,26 @@
-- Clear script environment
--[[=begin
devel/clear-script-env
======================
Clears the environment of the specified lua script(s).
=end]]
args = {...}
if #args < 1 then qerror("script name(s) required") end
for _, name in pairs(args) do
local file = dfhack.findScript(name)
if file then
local script = dfhack.internal.scripts[file]
if script then
local env = script.env
while next(env) do
env[next(env)] = nil
end
else
dfhack.printerr("Script not loaded: " .. name)
end
else
dfhack.printerr("Can't find script: " .. name)
end
end

@ -1,5 +1,13 @@
-- Lists and/or compares two tiletype material groups. -- Lists and/or compares two tiletype material groups.
-- Usage: devel/cmptiles material1 [material2] --[[=begin
devel/cmptiles
==============
Lists and/or compares two tiletype material groups.
Usage: ``devel/cmptiles material1 [material2]``
=end]]
local nmat1,nmat2=... local nmat1,nmat2=...
local mat1 = df.tiletype_material[nmat1] local mat1 = df.tiletype_material[nmat1]

@ -1,4 +1,11 @@
-- Exports an ini file for Dwarf Therapist. -- Exports an ini file for Dwarf Therapist.
--[[=begin
devel/export-dt-ini
===================
Exports an ini file containing memory addresses for Dwarf Therapist.
=end]]
local utils = require 'utils' local utils = require 'utils'
local ms = require 'memscan' local ms = require 'memscan'

@ -1,19 +1,39 @@
-- Find some offsets for linux. -- Find some offsets for linux.
--[[=begin
local utils = require 'utils' devel/find-offsets
local ms = require 'memscan' ==================
local gui = require 'gui' WARNING: THIS SCRIPT IS STRICTLY FOR DFHACK DEVELOPERS.
Running this script on a new DF version will NOT
MAKE IT RUN CORRECTLY if any data structures
changed, thus possibly leading to CRASHES AND/OR
PERMANENT SAVE CORRUPTION.
Finding the first few globals requires this script to be
started immediately after loading the game, WITHOUT
first loading a world. The rest expect a loaded save,
not a fresh embark. Finding current_weather requires
a special save previously processed with `devel/prepare-save`
on a DF version with working dfhack.
--[[ The script expects vanilla game configuration, without
any custom tilesets or init file changes. Never unpause
the game unless instructed. When done, quit the game
without saving using 'die'.
Arguments: Arguments:
* global names to force finding them * global names to force finding them
* 'all' to force all globals * ``all`` to force all globals
* 'nofeed' to block automated fake input searches * ``nofeed`` to block automated fake input searches
* 'nozoom' to disable neighboring object heuristics * ``nozoom`` to disable neighboring object heuristics
]] =end]]
local utils = require 'utils'
local ms = require 'memscan'
local gui = require 'gui'
local is_known = dfhack.internal.getAddress local is_known = dfhack.internal.getAddress

@ -1,14 +1,26 @@
-- Injects new reaction, item and building defs into the world. -- Injects new reaction, item and building defs into the world.
--[[=begin
-- The savegame contains a list of the relevant definition tokens in devel/inject-raws
-- the right order, but all details are read from raws every time. =================
-- This allows just adding stub definitions, and simply saving and WARNING: THIS SCRIPT CAN PERMANENLY DAMAGE YOUR SAVE.
-- reloading the game.
-- Usage example: This script attempts to inject new raw objects into your
--[[ world. If the injected references do not match the actual
devel/inject-raws trapcomp ITEM_TRAPCOMP_STEAM_PISTON workshop STEAM_ENGINE MAGMA_STEAM_ENGINE reaction STOKE_BOILER edited raws, your save will refuse to load, or load but crash.
]]
The savegame contains a list of the relevant definition tokens in
the right order, but all details are read from raws every time.
This allows just adding stub definitions, and simply saving and
reloading the game.
This is useful enough for modders and some users to justify the danger.
Usage example::
devel/inject-raws trapcomp ITEM_TRAPCOMP_STEAM_PISTON workshop STEAM_ENGINE MAGMA_STEAM_ENGINE reaction STOKE_BOILER
=end]]
local utils = require 'utils' local utils = require 'utils'

@ -1,4 +1,11 @@
-- Read the tiles from the screen and display info about them. -- Read the tiles from the screen and display info about them.
--[[=begin
devel/inspect-screen
====================
Read the tiles from the screen and display info about them.
=end]]
local utils = require 'utils' local utils = require 'utils'
local gui = require 'gui' local gui = require 'gui'

@ -1,4 +1,15 @@
-- an experimental lighting engine for df. param: "static" to not recalc when in game. press "~" to recalculate. "`" to exit -- an experimental lighting engine
--[[=begin
devel/light
===========
An experimental lighting engine for DF, using the `rendermax` plugin.
Call ``devel/light static`` to not recalculate lighting when in game.
Press :kbd:`~` to recalculate lighting. Press :kbd:`\`` to exit.
=end]]
local gui = require 'gui' local gui = require 'gui'
local guidm = require 'gui.dwarfmode' local guidm = require 'gui.dwarfmode'
local render = require 'plugins.rendermax' local render = require 'plugins.rendermax'

@ -1,6 +1,12 @@
-- List input items for the building currently being built. -- List input items for the building currently being built.
-- --[[=begin
-- This is where the filters in lua/dfhack/buildings.lua come from.
devel/list-filters
==================
List input items for the building currently being built.
This is where the filters in lua/dfhack/buildings.lua come from.
=end]]
local dumper = require 'dumper' local dumper = require 'dumper'
local utils = require 'utils' local utils = require 'utils'

@ -1,4 +1,11 @@
-- Prints memory ranges of the process. -- Prints memory ranges of the process.
--[[=begin
devel/lsmem
===========
Prints memory ranges of the process.
=end]]
for _,v in ipairs(dfhack.internal.getMemRanges()) do for _,v in ipairs(dfhack.internal.getMemRanges()) do
local access = { '-', '-', '-', 'p' } local access = { '-', '-', '-', 'p' }

@ -1,4 +1,12 @@
-- Example of a lua script. -- Example of a lua script.
--[[=begin
devel/lua-example
=================
An example lua script, which reports the number of times it has
been called. Useful for testing environment persistence.
=end]]
run_count = (run_count or 0) + 1 run_count = (run_count or 0) + 1

@ -1,9 +0,0 @@
-- Force a migrants event in next 10 ticks.
df.global.timed_events:insert('#',{
new = true,
type = df.timed_event_type.Migrants,
season = df.global.cur_season,
season_ticks = df.global.cur_season_tick+1,
entity = df.historical_entity.find(df.global.ui.civ_id)
})

@ -1,6 +1,12 @@
-- Deletes ALL items not held by units, buildings or jobs. -- Deletes ALL items not held by units, buildings or jobs.
-- --[[=begin
-- Intended solely for lag investigation.
devel/nuke-items
================
Deletes ALL items not held by units, buildings or jobs.
Intended solely for lag investigation.
=end]]
local count = 0 local count = 0

@ -1,3 +1,10 @@
-- For killing bugged out gui script screens. -- For killing bugged out gui script screens.
--[[=begin
devel/pop-screen
================
For killing bugged out gui script screens.
=end]]
dfhack.screen.dismiss(dfhack.gui.getCurViewscreen()) dfhack.screen.dismiss(dfhack.gui.getCurViewscreen())

@ -1,4 +1,16 @@
-- Prepare the current save for use with devel/find-offsets. -- Prepare the current save for use with devel/find-offsets.
--[[=begin
devel/prepare-save
==================
WARNING: THIS SCRIPT IS STRICTLY FOR DFHACK DEVELOPERS.
This script prepares the current savegame to be used
with `devel/find-offsets`. It CHANGES THE GAME STATE
to predefined values, and initiates an immediate
`quicksave`, thus PERMANENTLY MODIFYING the save.
=end]]
local utils = require 'utils' local utils = require 'utils'

@ -1,6 +1,13 @@
--print-args.lua --print-args.lua
--author expwnent --author expwnent
--prints all the arguments on their own line. useful for debugging --[[=begin
devel/print-args
================
Prints all the arguments you supply to the script on their own line.
Useful for debugging other scripts.
=end]]
local args = {...} local args = {...}
for _,arg in ipairs(args) do for _,arg in ipairs(args) do

@ -1,6 +1,13 @@
--print-args2.lua --print-args2.lua
--author expwnent --author expwnent
--prints all the arguments on their own line with quotes around them. useful for debugging --[[=begin
devel/print-args2
=================
Prints all the arguments you supply to the script on their own line
with quotes around them.
=end]]
local args = {...} local args = {...}
print("print-args") print("print-args")

@ -1,5 +1,11 @@
# list indexes in world.item.other[] where current selected item appears # list indices in world.item.other[] where current selected item appears
=begin
devel/scanitemother
===================
List indices in ``world.item.other[]`` where current selected item appears.
=end
tg = df.item_find tg = df.item_find
raise 'select an item' if not tg raise 'select an item' if not tg

@ -13,17 +13,23 @@ df.world.raws.creatures.all.length.times { |r_idx|
df.world.arena_spawn.creature_cnt[df.world.arena_spawn.race.length-1] = 0 df.world.arena_spawn.creature_cnt[df.world.arena_spawn.race.length-1] = 0
puts <<EOS puts <<EOS
Arena spawn data initialized. =begin
Now enter the 'k' menu, change mode using: devel/spawn-unit-helper
rb_eval df.gametype = :DWARF_ARENA =======================
Setup stuff to allow arena creature spawn after a mode change.
spawn creatures ('c' ingame), With Arena spawn data initialized:
revert to game mode using: - enter the :kbd:`k` menu and change mode using
rb_eval df.gametype = #{df.gametype.inspect} ``rb_eval df.gametype = :DWARF_ARENA``
To convert spawned creatures to livestock, select each one with the 'v' menu, and enter: - spawn creatures (:kbd:`c` ingame)
rb_eval df.unit_find.civ_id = df.ui.civ_id
- revert to game mode using ``rb_eval df.gametype = #{df.gametype.inspect}``
- To convert spawned creatures to livestock, select each one with
the :kbd:`v` menu, and enter ``rb_eval df.unit_find.civ_id = df.ui.civ_id``
=end
EOS EOS

@ -1,4 +1,11 @@
-- Generates an image using multiple octaves of perlin noise. -- Generates an image using multiple octaves of perlin noise.
--[[=begin
devel/test-perlin
=================
Generates an image using multiple octaves of perlin noise.
=end]]
local args = {...} local args = {...}
local rng = dfhack.random.new(3) local rng = dfhack.random.new(3)

@ -1,3 +1,10 @@
# unforbid all items # unforbid all items
=begin
devel/unforbidall
=================
Unforbid all items.
=end
df.world.items.all.each { |i| i.flags.forbid = false } df.world.items.all.each { |i| i.flags.forbid = false }

@ -1,4 +1,11 @@
-- Show the internal path a unit is currently following. -- Show the internal path a unit is currently following.
--[[=begin
devel/unit-path
===============
Show the internal path a unit is currently following.
=end]]
local utils = require 'utils' local utils = require 'utils'
local gui = require 'gui' local gui = require 'gui'

@ -1,4 +1,13 @@
-- Logs minecart coordinates and speeds to console. -- Logs minecart coordinates and speeds to console.
--[[=begin
devel/watch-minecarts
=====================
Logs minecart coordinates and speeds to console.
Usage: ``devel/watch-minecarts start|stop``
=end]]
last_stats = last_stats or {} last_stats = last_stats or {}

@ -1,4 +1,12 @@
-- a collection of misc lua scripts -- a collection of misc lua scripts
--[[=begin
dfusion
=======
Interface to a lecacy script system.
=end]]
local dfu=require("plugins.dfusion") local dfu=require("plugins.dfusion")
local myos=dfhack.getOSType() local myos=dfhack.getOSType()
args={...} args={...}

@ -1,4 +1,33 @@
# designate an area for digging according to a plan in csv format # designate an area for digging according to a plan in csv format
=begin
digfort
=======
A script to designate an area for digging according to a plan in csv format.
This script, inspired from quickfort, can designate an area for digging.
Your plan should be stored in a .csv file like this::
# this is a comment
d;d;u;d;d;skip this tile;d
d;d;d;i
Available tile shapes are named after the 'dig' menu shortcuts:
``d`` for dig, ``u`` for upstairs, ``j`` downstairs, ``i`` updown,
``h`` channel, ``r`` upward ramp, ``x`` remove designation.
Unrecognized characters are ignored (eg the 'skip this tile' in the sample).
Empty lines and data after a ``#`` are ignored as comments.
To skip a row in your design, use a single ``;``.
One comment in the file may contain the phrase ``start(3,5)``. It is interpreted
as an offset for the pattern: instead of starting at the cursor, it will start
3 tiles left and 5 tiles up from the cursor.
The script takes the plan filename, starting from the root df folder (where
``Dwarf Fortress.exe`` is found).
=end
fname = $script_args[0].to_s fname = $script_args[0].to_s

@ -1,4 +1,11 @@
-- Remove all aquifers from the map -- Remove all aquifers from the map
--[[=begin
drain-aquifer
=============
Remove all 'aquifer' tag from the map blocks. Irreversible.
=end]]
local function drain() local function drain()
local layers = {} local layers = {}

@ -1,7 +1,14 @@
-- This script will elevate all the mental attributes of a unit -- This script will elevate all the mental attributes of a unit
-- usage is: target a unit in DF, and execute this script in dfhack
-- all physical attributes will be set to whatever the max value is
-- by vjek -- by vjek
--[[=begin
elevate-mental
==============
Set all mental attributes of the selected dwarf to 2600, which is very high.
Numbers between 0 and 5000 can be passed as an argument: ``elevate-mental 100``
for example would make the dwarf very stupid indeed.
=end]]
function ElevateMentalAttributes(value) function ElevateMentalAttributes(value)
unit=dfhack.gui.getSelectedUnit() unit=dfhack.gui.getSelectedUnit()

@ -1,7 +1,13 @@
-- This script will elevate all the physical attributes of a unit -- This script will elevate all the physical attributes of a unit
-- usage is: target a unit in DF, and execute this script in dfhack
-- all physical attributes will be set to whatever the max value is
-- by vjek -- by vjek
--[[=begin
elevate-physical
================
As for elevate-mental, but for physical traits. High is good for soldiers,
while having an ineffective hammerer can be useful too...
=end]]
function ElevatePhysicalAttributes(value) function ElevatePhysicalAttributes(value)
unit=dfhack.gui.getSelectedUnit() unit=dfhack.gui.getSelectedUnit()

@ -0,0 +1,130 @@
--Allow stressed dwarves to emigrate from the fortress
-- For 34.11 by IndigoFenix; update and cleanup by PeridexisErrant
-- old version: http://dffd.bay12games.com/file.php?id=8404
--[[=begin
emigration
==========
Allows dwarves to emigrate from the fortress when stressed,
in proportion to how badly stressed they are and adjusted
for who they would have to leave with - a dwarven merchant
being more attractive than leaving alone (or with an elf).
The check is made monthly.
A happy dwarf (ie with negative stress) will never emigrate.
Usage: ``emigration enable|disable``
=end]]
local args = {...}
if args[1] == "enable" then
enabled = true
elseif args[1] == "disable" then
enabled = false
end
function desireToStay(unit,method,civ_id)
-- on a percentage scale
value = 100 - unit.status.current_soul.personality.stress_level / 5000
if method == 'merchant' or method == 'diplomat' then
if civ_id ~= unit.civ_id then value = value*2 end end
if method == 'wild' then
value = value*5 end
return value
end
function desert(u,method,civ)
u.relations.following = nil
local line = dfhack.TranslateName(dfhack.units.getVisibleName(u)) .. " has "
if method == 'merchant' then
line = line.."joined the merchants"
u.flags1.merchant = true
u.civ_id = civ
elseif method == 'diplomat' then
line = line.."followed the diplomat"
u.flags1.diplomat = true
u.civ_id = civ
else
line = line.."abandoned the settlement in search of a better life."
u.civ_id = -1
u.flags1.forest = true
u.animal.leave_countdown = 2
end
print(line)
dfhack.gui.showAnnouncement(line, COLOR_WHITE)
end
function canLeave(unit)
for _, skill in pairs(unit.status.current_soul.skills) do
if skill.rating > 14 then return false end
end
if unit.flags1.caged
or u.race ~= df.global.ui.race_id
or u.civ_id ~= df.global.ui.civ_id
or dfhack.units.isDead(u)
or dfhack.units.isOpposedToLife(u)
or u.flags1.merchant
or u.flags1.diplomat
or unit.flags1.chained
or dfhack.units.getNoblePositions(unit) ~= nil
or unit.military.squad_id ~= -1
or dfhack.units.isCitizen(unit)
or dfhack.units.isSane(unit)
or unit.profession ~= 103
or not dfhack.units.isDead(unit)
then return false end
return true
end
function checkForDeserters(method,civ_id)
local allUnits = df.global.world.units.active
for i=#allUnits-1,0,-1 do -- search list in reverse
local u = allUnits[i]
if canLeave(u) and math.random(100) < desireToStay(u,method,civ_id) then
desert(u,method,civ_id)
end
end
end
function checkmigrationnow()
local merchant_civ_ids = {}
local diplomat_civ_ids = {}
local allUnits = df.global.world.units.active
for i=0, #allUnits-1 do
local unit = allUnits[i]
if dfhack.units.isSane(unit)
and not dfhack.units.isDead(unit)
and not dfhack.units.isOpposedToLife(unit)
and not unit.flags1.tame
then
if unit.flags1.merchant then table.insert(merchant_civ_ids, unit.civ_id) end
if unit.flags1.diplomat then table.insert(diplomat_civ_ids, unit.civ_id) end
end
end
for _, civ_id in pairs(merchant_civ_ids) do checkForDeserters('merchant', civ_id) end
for _, civ_id in pairs(diplomat_civ_ids) do checkForDeserters('diplomat', civ_id) end
checkForDeserters('wild', -1)
end
local function event_loop()
checkmigrationnow()
dfhack.timeout(1, 'months', event_loop)
end
dfhack.onStateChange.loadEmigration = function(code)
if code==SC_MAP_LOADED then
if enabled then
print("Emigration enabled.")
event_loop()
else
print("Emigration disabled.")
end
end
end
if dfhack.isMapLoaded() then
dfhack.onStateChange.loadEmigration(SC_MAP_LOADED)
end

@ -1,5 +1,23 @@
-- Export everything from legends mode -- Export everything from legends mode
-- Valid args: "all", "info", "maps", "sites" --[[=begin
exportlegends
=============
Controls legends mode to export data - especially useful to set-and-forget large
worlds, or when you want a map of every site when there are several hundred.
The 'info' option exports more data than is possible in vanilla, to a
:file:`region-date-legends_plus.xml` file developed to extend
:forums:`World Viewer <128932>` and other legends utilities.
Options:
:info: Exports the world/gen info, the legends XML, and a custom XML with more information
:sites: Exports all available site maps
:maps: Exports all seventeen detailed maps
:all: Equivalent to calling all of the above, in that order
=end]]
gui = require 'gui' gui = require 'gui'
local args = {...} local args = {...}

@ -1,7 +1,48 @@
# exterminate creatures # exterminate creatures
=begin
exterminate
===========
Kills any unit of a given race.
With no argument, lists the available races and count eligible targets.
With the special argument ``him``, targets only the selected creature.
With the special argument ``undead``, targets all undeads on the map,
regardless of their race.
When specifying a race, a caste can be specified to further restrict the
targeting. To do that, append and colon and the caste name after the race.
Any non-dead non-caged unit of the specified race gets its ``blood_count``
set to 0, which means immediate death at the next game tick. For creatures
such as vampires, it also sets animal.vanish_countdown to 2.
An alternate mode is selected by adding a 2nd argument to the command,
``magma``. In this case, a column of 7/7 magma is generated on top of the
targets until they die (Warning: do not call on magma-safe creatures. Also,
using this mode on birds is not recommended.) The final alternate mode
is ``butcher``, which marks them for butchering but does not kill.
Will target any unit on a revealed tile of the map, including ambushers,
but ignore caged/chained creatures.
Ex::
exterminate gob
exterminate gob:male
To kill a single creature, select the unit with the 'v' cursor and::
exterminate him
To purify all elves on the map with fire (may have side-effects)::
exterminate elve magma
=end
# race = name of the race to eradicate, use 'him' to target only the selected creature
# use 'undead' to target all undeads
race = $script_args[0] race = $script_args[0]
# if the 2nd parameter is 'magma', magma rain for the targets instead of instant death # if the 2nd parameter is 'magma', magma rain for the targets instead of instant death

@ -3,20 +3,21 @@
-- original author: Tacomagic -- original author: Tacomagic
-- minor fixes by PeridexisErrant, Lethosor -- minor fixes by PeridexisErrant, Lethosor
--@ module = true --@ module = true
--[[=begin
--[[ fix-ster
This script utilizes the orientation tag to either fix infertile creatures ========
or inflict infertility on creatures that you do not want to breed Utilizes the orientation tag to either fix infertile creatures or inflict
infertility on creatures that you do not want to breed. Usage::
Required arg: fix-ster [fert|ster] [all|animals|only:<creature>]
fert: sets the flag to assure creature(s) are fertile
ster: sets the flag to assure creature(s) are sterile ``fert`` or ``ster`` is a required argument; whether to make the target fertile
Optional args: or sterile. Optional arguments specify the target: no argument for the
<no arg> the script will only process the currently selected creature selected unit, ``all`` for all units on the map, ``animals`` for all non-dwarf
all: process all creatures currently on the map creatures, or ``only:<creature>`` to only process matching creatures.
animals: processes everything but dwarves on the map
only:<creature>: processes all of the creatures matching the specified creature on the map =end]]
]]--
function changeorient(unit, ori) function changeorient(unit, ori)
--Sets the fertility flag based on gender. --Sets the fertility flag based on gender.

@ -0,0 +1 @@
``fix/*`` scripts fix various bugs and issues, some of them obscure.

@ -1,8 +1,13 @@
--blood-del.lua
--makes it so that civs won't come with barrels full of blood, ichor, or goo --makes it so that civs won't come with barrels full of blood, ichor, or goo
--author Urist Da Vinci --author Urist Da Vinci
--edited by expwnent, scamtank --edited by expwnent, scamtank
--[[=begin
fix/blood-del
=============
Makes it so that future caravans won't bring barrels full of blood, ichor, or goo.
=end]]
local my_entity=df.historical_entity.find(df.global.ui.civ_id) local my_entity=df.historical_entity.find(df.global.ui.civ_id)
local sText=" " local sText=" "
local k=0 local k=0

@ -1,7 +1,15 @@
-- Lets constructions reconsider the build location. -- Lets constructions reconsider the build location.
-- Partial work-around for http://www.bay12games.com/dwarves/mantisbt/view.php?id=5991 -- Partial work-around for http://www.bay12games.com/dwarves/mantisbt/view.php?id=5991
--[[=begin
fix/build-location
==================
Fixes construction jobs that are stuck trying to build a wall while standing
on the same exact tile (:bug:`5991`), designates the tile restricted traffic to
hopefully avoid jamming it again, and unsuspends them.
=end]]
local utils = require('utils') local utils = require('utils')
local count = 0 local count = 0

@ -1,5 +1,13 @@
-- Remove uninteresting dead units from the unit list. -- Remove uninteresting dead units from the unit list.
--[[=begin
fix/dead-units
==============
Removes uninteresting dead units from the unit list. Doesn't seem to give any
noticeable performance gain, but migrants normally stop if the unit list grows
to around 3000 units, and this script reduces it back.
=end]]
local units = df.global.world.units.active local units = df.global.world.units.active
local dwarf_race = df.global.ui.race_id local dwarf_race = df.global.ui.race_id
local dwarf_civ = df.global.ui.civ_id local dwarf_civ = df.global.ui.civ_id

@ -2,7 +2,16 @@
-- --
-- See for more info: -- See for more info:
-- http://www.bay12games.com/dwarves/mantisbt/view.php?id=5971 -- http://www.bay12games.com/dwarves/mantisbt/view.php?id=5971
--[[=begin
fix/fat-dwarves
===============
Avoids 5-10% FPS loss due to constant recalculation of insulation for dwarves at
maximum fatness, by reducing the cap from 1,000,000 to 999,999.
Recalculation is triggered in steps of 250 units, and very fat dwarves
constantly bounce off the maximum value while eating.
=end]]
local num_fat = 0 local num_fat = 0
local num_lagging = 0 local num_lagging = 0

@ -2,7 +2,13 @@
-- original author: tejón -- original author: tejón
-- rewritten by expwnent -- rewritten by expwnent
-- see repeat.lua for how to run this every so often automatically -- see repeat.lua for how to run this every so often automatically
--[[=begin
fix/feeding-timers
==================
Reset the GiveWater and GiveFood timers of all units as appropriate.
=end]]
local args = {...} local args = {...}
if args[1] ~= nil then if args[1] ~= nil then
print("fix/feeding-timers usage") print("fix/feeding-timers usage")

Some files were not shown because too many files have changed in this diff Show More