2023-02-01 15:26:47 -07:00
|
|
|
local _ENV = mkmodule('plugins.autolabor')
|
|
|
|
|
|
|
|
local gui = require('gui')
|
|
|
|
local overlay = require('plugins.overlay')
|
|
|
|
local widgets = require('gui.widgets')
|
|
|
|
|
|
|
|
AutolaborOverlay = defclass(AutolaborOverlay, overlay.OverlayWidget)
|
|
|
|
AutolaborOverlay.ATTRS{
|
|
|
|
default_pos={x=7,y=-13},
|
|
|
|
default_enabled=true,
|
2023-05-15 18:52:20 -06:00
|
|
|
viewscreens='dwarfmode/Info/LABOR/WORK_DETAILS',
|
2023-02-01 15:26:47 -07:00
|
|
|
frame={w=29, h=5},
|
2023-05-15 18:52:20 -06:00
|
|
|
frame_style=gui.MEDIUM_FRAME,
|
2023-02-01 15:26:47 -07:00
|
|
|
frame_background=gui.CLEAR_PEN,
|
|
|
|
}
|
|
|
|
|
|
|
|
function AutolaborOverlay:init()
|
|
|
|
self:addviews{
|
|
|
|
widgets.Label{
|
|
|
|
frame={t=0, l=0},
|
2023-04-18 16:50:59 -06:00
|
|
|
text_pen=COLOR_LIGHTRED,
|
|
|
|
text='DFHack autolabor is active!',
|
|
|
|
visible=isEnabled,
|
|
|
|
},
|
|
|
|
widgets.Label{
|
|
|
|
frame={t=0, l=0},
|
|
|
|
text_pen=COLOR_LIGHTRED,
|
|
|
|
text='Dwarf Therapist is active!',
|
|
|
|
visible=function() return not isEnabled() end,
|
|
|
|
},
|
|
|
|
widgets.Label{
|
|
|
|
frame={t=1, l=0},
|
|
|
|
text_pen=COLOR_WHITE,
|
2023-02-01 15:26:47 -07:00
|
|
|
text={
|
|
|
|
'Any changes made on this', NEWLINE,
|
|
|
|
'screen will have no effect.'
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
function AutolaborOverlay:render(dc)
|
2023-04-18 16:50:59 -06:00
|
|
|
if df.global.game_extra.external_flag ~= 1 then return end
|
2023-02-01 15:26:47 -07:00
|
|
|
AutolaborOverlay.super.render(self, dc)
|
|
|
|
end
|
|
|
|
|
|
|
|
OVERLAY_WIDGETS = {
|
|
|
|
overlay=AutolaborOverlay,
|
|
|
|
}
|
|
|
|
|
|
|
|
return _ENV
|