Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Template for new versions:
## New Features

## Fixes
- `hide-tutorials`: also suppress the adventure mode start tutorial (defaults its checkbox to off and dismisses the popups)
- `bodyswap`: fix "invalid argument count" when the target unit has no nemesis record
- `fix/loyaltycascade`: guard against citizens that are not historical figures and emit a warning.
- `gui/siegemanager`: fix nil index if there are no siege engines on the map
Expand Down
3 changes: 3 additions & 0 deletions docs/hide-tutorials.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ Specifically, this tool hides:
other similar screens in a new fort
- Popups displayed when you perform certain actions for the first time in an
adventure
- The tutorial checkbox when creating an adventurer (it will default to
unchecked, but you can still enable it if you want the tutorial) and the
tutorial popups it would otherwise show at the start of the game

Note that only unsolicited tutorial popups are hidden. If you directly request
a tutorial page from the help, then it will still function normally.
Expand Down
28 changes: 28 additions & 0 deletions hide-tutorials.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,22 @@ function skip_tutorial_prompt()
end
end

local ADVENTURE_TUTORIAL_CONTEXTS = utils.invert{
'ADVENTURE_START_MESSAGE',
'ADVENTURE_START_TUTORIAL_CAMERA_CONTROLS',
'ADVENTURE_START_TUTORIAL_MOVEMENT',
'ADVENTURE_START_TUTORIAL_MENU_OVERVIEW',
'ADVENTURE_DONE_WITH_FIRST_STEPS_MESSAGE',
}

function skip_adventure_tutorial()
if not dfhack.world.isAdventureMode() then return end
df.global.plotinfo.flags.need_to_do_tutorial = false
if help.open and ADVENTURE_TUTORIAL_CONTEXTS[df.help_context_type[help.context]] then
close_help()
end
end

local function get_prefix()
if dfhack.world.isFortressMode() then
return 'POPUP_'
Expand Down Expand Up @@ -81,9 +97,19 @@ dfhack.onStateChange[GLOBAL_KEY] = function(sc)
dfhack.timeout(10, 'frames', skip_tutorial_prompt)
dfhack.timeout(100, 'frames', skip_tutorial_prompt)
dfhack.timeout(1000, 'frames', skip_tutorial_prompt)
elseif df.viewscreen_setupadventurest:is_instance(scr) then
-- default the "tutorial" checkbox to off; the player can still
-- check it if they want the tutorial
scr.want_tutorial = false
elseif df.viewscreen_dungeonmodest:is_instance(scr) then
-- the start tutorial can pop up shortly after the screen appears
skip_adventure_tutorial()
dfhack.timeout(10, 'frames', skip_adventure_tutorial)
dfhack.timeout(100, 'frames', skip_adventure_tutorial)
end
elseif sc == SC_MAP_LOADED then
hide_all_popups()
skip_adventure_tutorial()
end
end

Expand All @@ -100,13 +126,15 @@ if args[1] == "enable" then
enabled = true
if dfhack.isMapLoaded() then
hide_all_popups()
skip_adventure_tutorial()
end
elseif args[1] == "disable" then
enabled = false
elseif args[1] == "reset" then
show_all_popups()
elseif dfhack.isMapLoaded() then
hide_all_popups()
skip_adventure_tutorial()
else
qerror('hide-tutorials needs a loaded fortress or adventure map to work')
end