Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a save reminder to notifications panel #1373

Merged
merged 8 commits into from
Jan 16, 2025
Merged
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 @@ -35,6 +35,7 @@ Template for new versions:
- `gui/settings-manager`: standing orders save/load now includes the reserved barrels setting
- `gui/rename`: add overlay to worldgen screen allowing you to rename the world before the new world is saved
- `gui/rename`: add overlay to the "Prepare carefully" embark screen that transparently fixes a DF bug where you can't give units nicknames or custom professions
- `gui/notify`: new notification type: save reminder; appears 15 minutes after a save is created or loaded, click to be asked to quicksave

## Fixes
- `fix/dry-buckets`: don't empty buckets for wells that are actively in use
Expand Down
17 changes: 17 additions & 0 deletions internal/notify/notifications.lua
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,23 @@ NOTIFICATIONS_BY_IDX = {
adv_fn=curry(get_bar, get_blood, get_max_blood, "Blood", COLOR_RED),
on_click=nil,
},
{
name='save-reminder',
desc='Shows a reminder if it has been more than 15 minutes since your last save.',
default=true,
dwarf_fn=function ()
local minsSinceSave = dfhack.persistent.getUnsavedSeconds()//60
if minsSinceSave >= 15 then
return "Last save: ".. (dfhack.formatInt(minsSinceSave)) ..' mins ago'
end
end,
on_click=function()
local minsSinceSave = dfhack.persistent.getUnsavedSeconds()//60
local message = 'It has been ' .. dfhack.formatInt(minsSinceSave) .. ' minutes since your last save. \n\nWould you like to save now? ' ..
'(Note: You can also close this reminder and save manually)'
dlg.showYesNoPrompt('Save now?', message, nil, function() dfhack.run_script('quicksave') end)
end,
},
}

NOTIFICATIONS_BY_NAME = {}
Expand Down
Loading