Skip to content

Commit

Permalink
Merge remote-tracking branch 'DFHack/develop' into Autoclothing
Browse files Browse the repository at this point in the history
# Conflicts:
#	docs/changelog.txt
  • Loading branch information
RosaryMala committed Feb 2, 2023
2 parents 7d304db + 7d05a68 commit 840f728
Show file tree
Hide file tree
Showing 32 changed files with 1,008 additions and 1,350 deletions.
Binary file added data/art/control-panel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions data/init/dfhack.keybindings.init
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ keybinding add Ctrl-Shift-P "gui/launcher --minimal"
# show hotkey popup menu
keybinding add Ctrl-Shift-C hotkeys

# control panel
keybinding add Shift-` gui/control-panel

# on-screen keyboard
keybinding add Ctrl-Shift-K gui/cp437-table

Expand Down
111 changes: 62 additions & 49 deletions docs/Quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,53 +46,66 @@ Here are some common tasks people use DFHack tools to accomplish:
your mining efforts

Some tools are one-shot commands. For example, you can run `unforbid all <unforbid>`
to claim all items on the map after a messy siege.
to claim all (reachable) items on the map after a messy siege.

Other tools must be `enabled <enable>` and then they will run in the background.
For example, `enable seedwatch <seedwatch>` will start monitoring your stocks of
seeds and prevent your chefs from cooking seeds that you need for planting.
Tools that are enabled in the context of a fort will save their state with that
fort, and the will remember that they are enabled the next time you load your save.
fort, and they will remember that they are enabled the next time you load your save.

A third class of tools add information to the screen or provide new integrated
functionality via the DFHack `overlay` framework. For example, the `unsuspend`
tool, in addition to its basic function of unsuspending all building construction
jobs, can also overlay a marker on suspended buildings to indicate that they are
suspended (and will use different markers to tell you whether this is a problem).
These overlays can be enabled and configured with the `gui/overlay` interface.

How can I figure out which commands to run?
-------------------------------------------

There are several ways to scan DFHack tools and find the one you need right now.
There are several ways to scan DFHack tools and find the ones you need right now.

The first place to check is the DFHack logo hover hotspot. It's in the upper
left corner of the screen by default, though you can move it anywhere you want
with the `gui/overlay` tool.
with the `gui/overlay` configuration UI.

When you hover the mouse over the logo (or hit the Ctrl-Shift-C keyboard shortcut)
a list of DFHack tools relevant to the current context comes up. For example, when
you have a unit selected, the hotspot will show a list of tools that inspect
units, allow you to edit them, or maybe even teleport them. Next to each tool,
you'll see the global hotkey you can hit to invoke the command without even
opening the hover list.

You can run any DFHack tool from `gui/launcher`, which is always listed first in
the hover list. You can also bring up the launcher by tapping the backtick key
(\`) or hitting Ctrl-Shift-D. In the launcher, you can quickly autocomplete any
command name by selecting it in the list on the right side of the window.
Commands are ordered by how often you run them, so your favorite commands will
always be on top. You can also pull full commandlines out of your history with
Alt-S (or by clicking on the "history search" hotkey hint).
you'll see the hotkey you can hit to invoke the command without even opening the
hover list.

The second place to check is the DFHack control panel: `gui/control-panel`. It
will give you an overview of which tools are currently enabled, and will allow
you to toggle them on or off, see help text for them, or launch their dedicated
configuration UIs. You can launch the control panel from anywhere with the
tilde key (Shift-\`) or from the logo hover list.

In the control panel, you can also select which tools you'd like to be
automatically enabled when you start a new fort. There are also system settings
you can change, like whether DFHack windows will pause the game when they come
up.

Finally, you can explore the full extent of the DFHack catalog in `gui/launcher`,
which is always listed first in the DFHack logo hover list. You can also bring up
the launcher by tapping the backtick key (\`) or hitting Ctrl-Shift-D. In the
launcher, you can quickly autocomplete any command name by selecting it in the
list on the right side of the window. Commands are ordered by how often you run
them, so your favorite commands will always be on top. You can also pull full
commandlines out of your history with Alt-S or by clicking on the "history search"
hotkey hint.

Once you have typed (or autocompleted, or searched for) a command, other commands
related to the one you have selected will appear in the autocomplete list.
Scanning through that list is a great way to learn about new tools that you might
find useful. You can also see how commands are grouped by running the `tags` command.
related to the one you have selected will appear in the right-hand panel. Scanning
through that list is a great way to learn about new tools that you might find
useful. You can also see how commands are grouped by running the `tags` command.

The bottom panel will show the full help text for the command you are running,
allowing you to refer to the usage documentation and examples when you are typing
your command.
your command. After you run a command, the bottom panel switches to command output
mode, but you can get back to the help text by hitting Ctrl-T or clicking on the
``Showing`` selector.

How do DFHack in-game windows work?
-----------------------------------
Expand All @@ -106,26 +119,27 @@ whether they capture keyboard and mouse input.
The DFHack windowing system allows multiple overlapping windows to be active at
once. The one with the highlighted title bar has focus and will receive anything
you type at the keyboard. Hit Esc or right click to close the window or cancel
the current operation. You can click anywhere on the screen that is not a
DFHack window to unfocus the window and let it just sit in the background. It won't
the current action. You can click anywhere on the screen that is not a DFHack
window to unfocus the window and let it just sit in the background. It won't
respond to key presses or mouse clicks until you click on it again to give it
focus. You can right click directly on an unfocused window to close it without
left clicking to activate it first.
focus. If no DFHack windows are focused, you can right click directly on a window
to close it without left clicking to focus it first.

DFHack windows are draggable from the title bar or from anywhere on the window
that doesn't have a mouse-clickable widget on it. Many are resizable as well
(if the tool window has components that can reasonably be resized).

You can generally use DFHack tools without interrupting the game. That is, if the
game is unpaused, it can continue to run while a DFHack window is open. Many tools
will initially pause the game to let you focus on the task at hand, but you can
unpause like normal if you want. You can also interact with the map, scrolling it
with the keyboard or mouse and selecting units, buildings, and items. Some tools
will capture all keyboard input, such as tools with editable text fields, and some
will force-pause the game if it makes sense to, like `gui/quickfort`, since you
cannot interact with the map normally while trying to apply a blueprint. Windows
for tools that force-pause the game will have a pause icon in their upper right
corner to indicate which tool is responsible for the pausing.
game is unpaused, it can continue to run while a DFHack window is open. If configured
to do so in `gui/control-panel`, tools will initially pause the game to let you
focus on the task at hand, but you can unpause like normal if you want. You can
also interact with the map, scrolling it with the keyboard or mouse and selecting
units, buildings, and items. Some tools will capture all keyboard input, such as
tools with editable text fields, and some will force-pause the game if it makes
sense to, like `gui/quickfort`, since you cannot interact with the map normally
while trying to apply a blueprint. Windows for tools that force-pause the game
will have a pause icon in their upper right corner to indicate which tool is
preventing you from unpausing.

Where do I go next?
-------------------
Expand All @@ -135,33 +149,32 @@ To recap:
You can get to popular, relevant tools for the current context by hovering
the mouse over the DFHack logo or by hitting Ctrl-Shift-C.

You can enable DFHack tools and configure settings with `gui/control-panel`,
which you can access directly with the tilde key (Shift-\`).

You can get to the launcher and its integrated autocomplete, history search,
and help text by hitting backtick (\`) or Ctrl-Shift-D, or, of course, by
running it from the logo hover list.

You can list and start tools that run in the background with the `enable`
command.

You can configure screen overlays with the `gui/overlay` tool.

With those four tools, you have the complete DFHack tool suite at your
With those three tools, you have the complete DFHack tool suite at your
fingertips. So what to run first? Here are a few commands to get you started.
You can run them all from the launcher.

First, let's import some useful manager orders to keep your fort stocked with
basic necessities. Run ``orders import library/basic``. If you go to your
mangager orders screen, you can see all the orders that have been created for you.

Next, try setting up `autochop` by running the GUI configuration `gui/autochop`.
You can enable it from the GUI, so you don't need to run `enable autochop <enable>`
directly. You can set a target number of logs, and autochop will manage
your logging industry for you. You can control where your woodsdwarves go to
cut down trees by setting up burrows and configuring autochop to only cut in
those burrows. If you have the extra screen space, go ahead and set the
`gui/autochop` window to minimal mode (click on the hint near the upper right
corner of the window or hit Alt-M) and click on the map so the window loses
keyboard focus. As you play the game, you can glance at the status panel to
check on your stocks of wood.
Note that you could have imported the orders directly from this screen as well,
using the DFHack `overlay` widget at the bottom of the manager orders panel.

Next, try setting up `autochop` to automatically designate trees for chopping when
you get low on usable logs. Run `gui/control-panel` and select ``autochop`` in the
list. Click on the button to the left of the name or hit Enter to enable it. You
can then click on the ``[configure]`` button to launch `gui/autochop` if you'd
like to customize its settings. If you have the extra screen space, you can go
ahead and set the `gui/autochop` window to minimal mode (click on the hint near
the upper right corner of the window or hit Alt-M) and click on the map so the
window loses keyboard focus. As you play the game, you can glance at the live
status panel to check on your stocks of wood.

Finally, let's do some fort design copy-pasting. Go to some bedrooms that you have
set up in your fort. Run `gui/blueprint`, set a name for your blueprint by
Expand Down
8 changes: 8 additions & 0 deletions docs/about/Removed.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ work (e.g. links from the `changelog`).
:local:
:depth: 1

.. _autohauler:

autohauler
==========
An automated labor management tool that only addressed hauling labors, leaving the assignment
of skilled labors entirely up to the player. Fundamentally incompatible with the work detail
system of labor management in v50 of Dwarf Fortress.

.. _command-prompt:

command-prompt
Expand Down
43 changes: 30 additions & 13 deletions docs/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,40 +34,57 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
# Future

## New Plugins
- `autoslab`: automatically create work orders to engrave slabs for ghostly dwarves

## Fixes
-@ DF screens can no longer get "stuck" on transitions when DFHack tool windows are visible. Instead, those DF screens are force-paused while DFHack windows are visible so the player can close them first and not corrupt the screen sequence. The "force pause" indicator will appear on these DFHack windows to indicate what is happening.
-@ ``Screen``: allow `gui/launcher` and `gui/quickcmd` to launch themselves without hanging the game
-@ Fix issues with clicks "passing through" some DFHack window elements, like scrollbars
- `getplants`: tree are now designated correctly
-@ DF screens can no longer get "stuck" on transitions when DFHack tool windows are visible. Instead, those DF screens are force-paused while DFHack windows are visible so the player can close them first and not corrupt the screen sequence. The "PAUSE FORCED" indicator will appear on these DFHack windows to indicate what is happening.
-@ allow launcher tools to launch themselves without hanging the game
-@ fix issues with clicks "passing through" some DFHack window elements to the screen below
- `getplants`: trees are now designated correctly
- `autoclothing`: fixed a crash that can happen when units are holding invalid items.
-@ `orders`: fix orders in library/basic that create bags
- `orders`: library/military now sticks to vanilla rules and does not add orders for normally-mood-only platinum weapons. A new library orders file ``library/military_include_artifact_materials`` is now offered as an alternate ``library/military`` set of orders that still includes the platinum weapons.

## Misc Improvements
- A new cross-compile build script was added for building the Windows files from a Linux Docker builder (see the Compile instructions in the docs)
- You can now configure whether DFHack tool windows should pause the game by default
- `hotkeys`: clicking on the DFHack logo no longer closes the popup menu
- `gui/launcher`: sped up initialization time for faster load of the UI
- `orders`: orders plugin functionality is now offered via an overlay widget when the manager orders screen is open
- `gui/quickcmd`: now has it's own global keybinding for your convenience: Ctrl-Shift-A
- Many DFHack windows can now be unfocused by clicking somewhere not over the tool window. This has the same effect as pinning previously did, but without the extra clicking.
- `overlay`: overlay widgets can now specify a default enabled state if they are not already set in the player's overlay config file
- DFHack windows can now be "defocused" by clicking somewhere not over the tool window. This has the same effect as pinning previously did, but without the extra clicking.
- `getplants`: ID values will now be accepted regardless of case
- Windows now display "PAUSE FORCED" on the lower border if the tool is forcing the game to pause
-@ New borders for DFHack tool windows -- tell us what you think!
- `autoclothing`: merged the two separate reports into the same command.
- `automelt`: stockpile configuration can now be set from the commandline
- `channel-safely`: new monitoring for cave-in prevention
- `gui/control-panel`: you can now configure whether DFHack tool windows should pause the game by default
- `gui/control-panel`: new global hotkey: tilde (Shift-backtick on most keyboards)
- `hotkeys`: clicking on the DFHack logo no longer closes the popup menu
- `nestboxes`: now saves enabled state in your savegame
- `gui/launcher`: sped up initialization time for faster window appearance
- `orders`: orders plugin functionality is now accessible via an `overlay` widget when the manager orders screen is open
- `gui/quickcmd`: now has its own global keybinding for your convenience: Ctrl-Shift-A
- `seedwatch`: now persists enabled state in the savegame, automatically loads useful defaults, and respects reachability when counting available seeds
- `quickfort`: planned buildings are now properly attached to any pertinent overlapping zones

## Documentation
- `compile`: instructions added for cross-compiling DFHack for Windows from a Linux Docker builder
-@ Quickstart guide has been updated with info on new window behavior and how to use the control panel

## API
- ``Buildings::containsTile()``: no longer takes a ``room`` parameter since that's not how rooms work anymore. If the building has extents, the extents will be checked. otherwise, the result just depends on whether the tile is within the building's bounding box.
- ``Units::getCitizens()``: gets a list of citizens, which otherwise you'd have to iterate over all units the world to discover
- ``Screen::Pen``: now accepts ``top_of_text`` and ``bottom_of_text`` properties to support offset text in graphics mode
- `overlay`: overlay widgets can now specify a default enabled state if they are not already set in the player's overlay config file
- ``Lua::Push``: now supports ``std::unordered_map``

## Lua
- `helpdb`: new function: ``helpdb.refresh()`` to force a refresh of the database. Call if you are a developer adding new scripts, loading new plugins, or changing help text during play
- `helpdb`: changed from auto-refreshing every 60 seconds to only refreshing on explicit call to ``helpdb.refresh()``. docs very rarely change during a play session, and the automatic database refreshes were slowing down the startup of `gui/launcher`
- `helpdb`: changed from auto-refreshing every 60 seconds to only refreshing on explicit call to ``helpdb.refresh()``. docs very rarely change during a play session, and the automatic database refreshes were slowing down the startup of `gui/launcher` and anything else that displays help text.
- ``widgets.Label``: ``label.scroll()`` now understands ``home`` and ``end`` keywords for scrolling to the top or bottom
- ``dfhack.units.getCitizens()``: gets a list of citizens
- ``gui.ZScreen``: new attribute: ``defocusable`` for controlling whether a window loses keyboard focus when the map is clicked
- ``Label``: token ``tile`` properties can now be either pens or numeric texture ids
- `tiletypes`: now has a Lua API! ``tiletypes_setTile``

## Removed
- `autohauler`: no plans to port to v50, as it just doesn't make sense with the new work detail system

# 50.05-alpha2

Expand Down
15 changes: 14 additions & 1 deletion docs/dev/Lua API.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2292,6 +2292,12 @@ a table with the following possible fields:
``write_to_lower``
If set to true, the specified ``tile`` will be written to the background
instead of the foreground.
``top_of_text``
If set to true, the specified ``tile`` will have the top half of the specified
``ch`` character superimposed over the lower half of the tile.
``bottom_of_text``
If set to true, the specified ``tile`` will have the bottom half of the specified
``ch`` character superimposed over the top half of the tile.

Alternatively, it may be a pre-parsed native object with the following API:

Expand Down Expand Up @@ -4187,6 +4193,12 @@ ZScreen provides the following functions:

ZScreen subclasses can set the following attributes:

* ``defocusable`` (default: ``true``)

Whether the ZScreen loses keyboard focus when the player clicks on an area
of the screen other than the tool window. If the player clicks on a different
ZScreen window, focus still transfers to that other ZScreen.

* ``initial_pause`` (default: ``DEFAULT_INITIAL_PAUSE``)

Whether to pause the game when the ZScreen is shown. ``DEFAULT_INITIAL_PAUSE``
Expand Down Expand Up @@ -4658,7 +4670,8 @@ containing newlines, or a table with the following possible fields:

* ``token.tile = pen``

Specifies a pen to paint as one tile before the main part of the token.
Specifies a pen or texture index to paint as one tile before the main part of
the token.

* ``token.width = ...``

Expand Down
Loading

0 comments on commit 840f728

Please sign in to comment.