Skip to content

Commit a28dd7c

Browse files
authored
Merge pull request #1373 from SquidCoderIndustries/squid-save-reminder
Add a save reminder to notifications panel
2 parents a8e6119 + c577e9b commit a28dd7c

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Template for new versions:
3535
- `gui/settings-manager`: standing orders save/load now includes the reserved barrels setting
3636
- `gui/rename`: add overlay to worldgen screen allowing you to rename the world before the new world is saved
3737
- `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
38+
- `gui/notify`: new notification type: save reminder; appears 15 minutes after a save is created or loaded, click to be asked to quicksave
3839

3940
## Fixes
4041
- `fix/dry-buckets`: don't empty buckets for wells that are actively in use

internal/notify/notifications.lua

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,23 @@ NOTIFICATIONS_BY_IDX = {
524524
adv_fn=curry(get_bar, get_blood, get_max_blood, "Blood", COLOR_RED),
525525
on_click=nil,
526526
},
527+
{
528+
name='save-reminder',
529+
desc='Shows a reminder if it has been more than 15 minutes since your last save.',
530+
default=true,
531+
dwarf_fn=function ()
532+
local minsSinceSave = dfhack.persistent.getUnsavedSeconds()//60
533+
if minsSinceSave >= 15 then
534+
return "Last save: ".. (dfhack.formatInt(minsSinceSave)) ..' mins ago'
535+
end
536+
end,
537+
on_click=function()
538+
local minsSinceSave = dfhack.persistent.getUnsavedSeconds()//60
539+
local message = 'It has been ' .. dfhack.formatInt(minsSinceSave) .. ' minutes since your last save. \n\nWould you like to save now? ' ..
540+
'(Note: You can also close this reminder and save manually)'
541+
dlg.showYesNoPrompt('Save now?', message, nil, function() dfhack.run_script('quicksave') end)
542+
end,
543+
},
527544
}
528545

529546
NOTIFICATIONS_BY_NAME = {}

0 commit comments

Comments
 (0)