add DFHack title version overlay

develop
Myk Taylor 2023-04-23 17:26:45 -07:00
parent 35468e3f7f
commit 33142a5dfc
No known key found for this signature in database
2 changed files with 39 additions and 0 deletions

@ -44,6 +44,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
- `gui/control-panel`: add preference option for hiding the terminal console on startup
- `gui/control-panel`: add preference option for hiding "armok" tools in command lists
- ``Dwarf Therapist``: add a warning to the Labors screen when Dwarf Therapist is active so players know that changes they make to that screen will have no effect. If you're starting a new embark and nobody seems to be doing anything, check your Labors tab for this warning to see if Dwarf Therapist thinks it is in control (even if it's not running).
- `overlay`: add the DFHack version string to the DF title screen
## Documentation

@ -562,4 +562,42 @@ function OverlayWidget:init()
self.frame.h = self.frame.h or 1
end
-- ------------------- --
-- TitleVersionOverlay --
-- ------------------- --
TitleVersionOverlay = defclass(TitleVersionOverlay, OverlayWidget)
TitleVersionOverlay.ATTRS{
default_pos={x=50, y=-2},
default_enabled=true,
viewscreens='title',
frame={w=30, h=3},
}
function TitleVersionOverlay:init()
local text = {}
table.insert(text, 'DFHack ' .. dfhack.getDFHackVersion() ..
(dfhack.isPrerelease() and (' (%s)'):format(dfhack.getGitCommit():sub(1,7)) or ''))
if #dfhack.getDFHackBuildID() > 0 then
table.insert(text, NEWLINE)
table.insert(text, 'Build ID: ' .. dfhack.getDFHackBuildID())
end
if dfhack.isPrerelease() then
table.insert(text, NEWLINE)
table.insert(text, {text='Pre-release build', pen=COLOR_LIGHTRED})
end
self:addviews{
widgets.Label{
frame={b=0, l=0},
text=text,
text_pen=COLOR_WHITE,
},
}
end
OVERLAY_WIDGETS = {
title_version = TitleVersionOverlay,
}
return _ENV