Skip to content

Commit ca1cb2a

Browse files
authored
Merge pull request #1622 from Alistair-Afton/fix-hide-tutorials-5779
hide-tutorials: suppress the adventure mode start tutorial
2 parents cc7a056 + 12bc1c0 commit ca1cb2a

3 files changed

Lines changed: 33 additions & 1 deletion

File tree

‎changelog.txt‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,14 @@ Template for new versions:
3939
- `idle-crafting`: support cloth, silk, and yarn crafts
4040

4141
## Fixes
42-
- `combine`: dyes are combined again, but only when their ``dye_profile`` matches, so mixed dyes no longer revert to a component dye
4342
- `bodyswap`: fix "invalid argument count" when the target unit has no nemesis record
4443
- `caravan`: fix doubled "total value of items marked for trade" after toggling filter options, and keep item marks when switching between filter views in the ``Bring goods to depot`` overlay
44+
- `combine`: dyes are combined again, but only when their ``dye_profile`` matches, so mixed dyes no longer revert to a component dye
4545
- `fix/loyaltycascade`: guard against citizens that are not historical figures and emit a warning.
4646
- `gui/settings-manager`: preserve built-in work details added after saved settings were created
4747
- `gui/siegemanager`: fix nil index if there are no siege engines on the map
4848
- `item`: the ``reachable``/``unreachable`` filters no longer count installed building parts, and now treat loose contents of unwalkable buildings (like bolts loaded in a bolt thrower) as reachable when a citizen can stand next to the building
49+
- `hide-tutorials`: also suppress the adventure mode start tutorial (defaults its checkbox to off and dismisses the popups)
4950

5051
## Misc Improvements
5152
- `caravan`: the ``Bring goods to depot``, ``Trade``, and ``Assign items for display`` overlays now allow searching for items with non-ASCII characters in their description

‎docs/hide-tutorials.rst‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ Specifically, this tool hides:
1818
other similar screens in a new fort
1919
- Popups displayed when you perform certain actions for the first time in an
2020
adventure
21+
- The tutorial checkbox when creating an adventurer (it will default to
22+
unchecked, but you can still enable it if you want the tutorial) and the
23+
tutorial popups it would otherwise show at the start of the game
2124

2225
Note that only unsolicited tutorial popups are hidden. If you directly request
2326
a tutorial page from the help, then it will still function normally.

‎hide-tutorials.lua‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,22 @@ function skip_tutorial_prompt()
3939
end
4040
end
4141

42+
local ADVENTURE_TUTORIAL_CONTEXTS = utils.invert{
43+
'ADVENTURE_START_MESSAGE',
44+
'ADVENTURE_START_TUTORIAL_CAMERA_CONTROLS',
45+
'ADVENTURE_START_TUTORIAL_MOVEMENT',
46+
'ADVENTURE_START_TUTORIAL_MENU_OVERVIEW',
47+
'ADVENTURE_DONE_WITH_FIRST_STEPS_MESSAGE',
48+
}
49+
50+
function skip_adventure_tutorial()
51+
if not dfhack.world.isAdventureMode() then return end
52+
df.global.plotinfo.flags.need_to_do_tutorial = false
53+
if help.open and ADVENTURE_TUTORIAL_CONTEXTS[df.help_context_type[help.context]] then
54+
close_help()
55+
end
56+
end
57+
4258
local function get_prefix()
4359
if dfhack.world.isFortressMode() then
4460
return 'POPUP_'
@@ -81,9 +97,19 @@ dfhack.onStateChange[GLOBAL_KEY] = function(sc)
8197
dfhack.timeout(10, 'frames', skip_tutorial_prompt)
8298
dfhack.timeout(100, 'frames', skip_tutorial_prompt)
8399
dfhack.timeout(1000, 'frames', skip_tutorial_prompt)
100+
elseif df.viewscreen_setupadventurest:is_instance(scr) then
101+
-- default the "tutorial" checkbox to off; the player can still
102+
-- check it if they want the tutorial
103+
scr.want_tutorial = false
104+
elseif df.viewscreen_dungeonmodest:is_instance(scr) then
105+
-- the start tutorial can pop up shortly after the screen appears
106+
skip_adventure_tutorial()
107+
dfhack.timeout(10, 'frames', skip_adventure_tutorial)
108+
dfhack.timeout(100, 'frames', skip_adventure_tutorial)
84109
end
85110
elseif sc == SC_MAP_LOADED then
86111
hide_all_popups()
112+
skip_adventure_tutorial()
87113
end
88114
end
89115

@@ -100,13 +126,15 @@ if args[1] == "enable" then
100126
enabled = true
101127
if dfhack.isMapLoaded() then
102128
hide_all_popups()
129+
skip_adventure_tutorial()
103130
end
104131
elseif args[1] == "disable" then
105132
enabled = false
106133
elseif args[1] == "reset" then
107134
show_all_popups()
108135
elseif dfhack.isMapLoaded() then
109136
hide_all_popups()
137+
skip_adventure_tutorial()
110138
else
111139
qerror('hide-tutorials needs a loaded fortress or adventure map to work')
112140
end

0 commit comments

Comments
 (0)