label the mechanisms appropriately when linking a plate

only call it a lever when it's a lever
develop
Myk Taylor 2023-11-14 09:28:57 -08:00
parent affcc8bfaa
commit 2a52011492
No known key found for this signature in database
1 changed files with 11 additions and 1 deletions

@ -18,6 +18,16 @@ MechanismOverlay.ATTRS{
frame={w=57, h=13},
}
local function get_label()
local bld = dfhack.gui.getSelectedBuilding(true)
if bld and bld:getType() == df.building_type.Trap and
bld:getSubtype() == df.trap_type.PressurePlate
then
return 'Plate:'
end
return 'Lever:'
end
function MechanismOverlay:init()
self:addviews{
widgets.BannerPanel{
@ -31,7 +41,7 @@ function MechanismOverlay:init()
view_id='safety_lever',
frame={t=0, l=20, w=15},
key='CUSTOM_G',
label='Lever:',
label=get_label,
options={
{label='Any', value=0},
{label='Magma', value=2, pen=COLOR_RED},