make initial pause configurable

develop
Myk Taylor 2023-01-27 14:57:45 -08:00
parent f420b4b77e
commit 4c455224f9
No known key found for this signature in database
3 changed files with 15 additions and 3 deletions

@ -41,6 +41,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
## Misc Improvements ## 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) - 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 - `hotkeys`: clicking on the DFHack logo no longer closes the popup menu
- `gui/launcher`: sped up initialization time for faster load of the UI - `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 - `orders`: orders plugin functionality is now offered via an overlay widget when the manager orders screen is open

@ -4182,9 +4182,12 @@ ZScreen provides the following functions:
ZScreen subclasses can set the following attributes: ZScreen subclasses can set the following attributes:
* ``initial_pause`` (default: ``true``) * ``initial_pause`` (default: ``DEFAULT_INITIAL_PAUSE``)
Whether to pause the game when the ZScreen is shown. Whether to pause the game when the ZScreen is shown. ``DEFAULT_INITIAL_PAUSE``
defaults to ``true`` but can be set via running a command like::
:lua require('gui.widgets').DEFAULT_INITIAL_PAUSE = false
* ``force_pause`` (default: ``false``) * ``force_pause`` (default: ``false``)

@ -693,17 +693,25 @@ end
-- Z-order swapping screen -- -- Z-order swapping screen --
----------------------------- -----------------------------
DEFAULT_INITIAL_PAUSE = true
local zscreen_inhibit_mouse_l = false local zscreen_inhibit_mouse_l = false
ZScreen = defclass(ZScreen, Screen) ZScreen = defclass(ZScreen, Screen)
ZScreen.ATTRS{ ZScreen.ATTRS{
initial_pause=true, initial_pause=DEFAULT_NIL,
force_pause=false, force_pause=false,
pass_pause=true, pass_pause=true,
pass_movement_keys=false, pass_movement_keys=false,
pass_mouse_clicks=true, pass_mouse_clicks=true,
} }
function ZScreen:preinit(args)
if args.initial_pause == nil then
args.initial_pause = DEFAULT_INITIAL_PAUSE
end
end
function ZScreen:init() function ZScreen:init()
self.saved_pause_state = df.global.pause_state self.saved_pause_state = df.global.pause_state
if self.initial_pause then if self.initial_pause then