mock out potential UI

develop
Myk Taylor 2023-11-03 11:02:43 -07:00
parent 2825bf5111
commit 74464f3b61
No known key found for this signature in database
2 changed files with 72 additions and 0 deletions

@ -14,6 +14,7 @@ local _ENV = mkmodule('plugins.buildingplan')
local argparse = require('argparse')
local inspector = require('plugins.buildingplan.inspectoroverlay')
local mechanisms = require('plugins.buildingplan.mechanisms')
local pens = require('plugins.buildingplan.pens')
local planner = require('plugins.buildingplan.planneroverlay')
require('dfhack.buildings')
@ -134,12 +135,14 @@ function reload_modules()
reload('plugins.buildingplan.itemselection')
reload('plugins.buildingplan.planneroverlay')
reload('plugins.buildingplan.inspectoroverlay')
reload('plugins.buildingplan.mechanisms')
reload('plugins.buildingplan')
end
OVERLAY_WIDGETS = {
planner=planner.PlannerOverlay,
inspector=inspector.InspectorOverlay,
mechanisms=mechanisms.MechanismOverlay,
}
return _ENV

@ -0,0 +1,69 @@
local _ENV = mkmodule('plugins.buildingplan.mechanisms')
local overlay = require('plugins.overlay')
local widgets = require('gui.widgets')
--------------------------------
-- MechanismOverlay
--
MechanismOverlay = defclass(MechanismOverlay, overlay.OverlayWidget)
MechanismOverlay.ATTRS{
default_pos={x=5,y=5},
default_enabled=true,
viewscreens='dwarfmode/LinkingLever',
frame={w=57, h=13},
}
function MechanismOverlay:init()
self:addviews{
widgets.CycleHotkeyLabel{
view_id='safety1',
frame={t=4, l=4, w=40},
key='CUSTOM_G',
label='Lever mechanism safety:',
options={
{label='Any', value=0},
{label='Magma', value=2, pen=COLOR_RED},
{label='Fire', value=1, pen=COLOR_LIGHTRED},
},
initial_option=0,
},
widgets.CycleHotkeyLabel{
view_id='safety2',
frame={t=5, l=4, w=40},
key='CUSTOM_SHIFT_G',
label='Target mechanism safety:',
options={
{label='Any', value=0},
{label='Magma', value=2, pen=COLOR_RED},
{label='Fire', value=1, pen=COLOR_LIGHTRED},
},
initial_option=0,
},
widgets.HotkeyLabel{
frame={t=6, l=9, w=48, h=3},
key='CUSTOM_M',
label='Choose',
auto_height=false,
on_activate=function() end,
},
widgets.HotkeyLabel{
frame={t=9, l=9, w=48, h=3},
key='CUSTOM_SHIFT_M',
label='Choose',
auto_height=false,
on_activate=function() end,
},
}
end
function MechanismOverlay:onInput(keys)
if keys._MOUSE_L and self:getMousePos() then
MechanismOverlay.super.onInput(self, keys)
-- don't let clicks bleed through the panel
return true
end
end
return _ENV