pass getAny calls through ZScreens

develop
Myk Taylor 2023-01-09 09:35:55 -08:00
parent f8728a4388
commit f39684dbfd
No known key found for this signature in database
1 changed files with 17 additions and 0 deletions

@ -756,6 +756,23 @@ function ZScreen:isMouseOver()
end end
end end
local function zscreen_get_any(scr, thing)
if not scr._native or not scr._native.parent then return nil end
return dfhack.gui['getAny'..thing](scr._native.parent)
end
function ZScreen:onGetSelectedUnit()
return zscreen_get_any(self, 'Unit')
end
function ZScreen:onGetSelectedItem()
return zscreen_get_any(self, 'Item')
end
function ZScreen:onGetSelectedBuilding()
return zscreen_get_any(self, 'Building')
end
function ZScreen:onGetSelectedPlant()
return zscreen_get_any(self, 'Plant')
end
-------------------------- --------------------------
-- Framed screen object -- -- Framed screen object --
-------------------------- --------------------------