Skip to content

Commit

Permalink
Merge pull request #858 from myk002/myk_hide_tutorials
Browse files Browse the repository at this point in the history
[hide-tutorial] don't click too quickly for embark tutorial
  • Loading branch information
myk002 authored Oct 12, 2023
2 parents 20d5414 + 973537c commit 4e8ad9d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Template for new versions:
## Fixes
- `suspendmanager`: fix errors when constructing near the map edge
- `gui/sandbox`: fix scrollbar moving double distance on click
- `hide-tutorials`: fix the embark tutorial prompt sometimes not being skipped

## Misc Improvements

Expand Down
12 changes: 10 additions & 2 deletions hide-tutorials.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ local function close_help()
help.open = false
end

function skip_tutorial_prompt(scr)
function skip_tutorial_prompt()
if not help.open then return end
local scr = dfhack.gui.getDFViewscreen(true)
local mouse_y = 23
if help.context == df.help_context_type.EMBARK_TUTORIAL_CHOICE then
help.context = df.help_context_type.EMBARK_MESSAGE
Expand All @@ -36,6 +37,10 @@ function skip_tutorial_prompt(scr)
df.global.gps.mouse_y = mouse_y
gui.simulateInput(scr, '_MOUSE_L')
end
if help.open then
-- retry later
help.context = df.help_context_type.EMBARK_TUTORIAL_CHOICE
end
end

local function hide_all_popups()
Expand All @@ -55,7 +60,10 @@ dfhack.onStateChange[GLOBAL_KEY] = function(sc)
if df.viewscreen_new_regionst:is_instance(scr) then
close_help()
elseif df.viewscreen_choose_start_sitest:is_instance(scr) then
skip_tutorial_prompt(scr)
skip_tutorial_prompt()
dfhack.timeout(10, 'frames', skip_tutorial_prompt)
dfhack.timeout(100, 'frames', skip_tutorial_prompt)
dfhack.timeout(1000, 'frames', skip_tutorial_prompt)
end
elseif sc == SC_MAP_LOADED and df.global.gamemode == df.game_mode.DWARF then
hide_all_popups()
Expand Down

0 comments on commit 4e8ad9d

Please sign in to comment.