diff options
| author | Alexander Gavrilov | 2012-08-21 20:34:15 +0400 |
|---|---|---|
| committer | Alexander Gavrilov | 2012-08-21 20:34:15 +0400 |
| commit | 44e3e318d0f0f5f31dcc4c19fed9b60df88b5eff (patch) | |
| tree | ab200a929a7609058a7a28916b2ab5f7c4f4890f /scripts | |
| parent | 15235cc93820a7ff712c71893c5f0df7af4f7873 (diff) | |
| download | dfhack-44e3e318d0f0f5f31dcc4c19fed9b60df88b5eff.tar.gz dfhack-44e3e318d0f0f5f31dcc4c19fed9b60df88b5eff.tar.bz2 dfhack-44e3e318d0f0f5f31dcc4c19fed9b60df88b5eff.tar.xz | |
Add a key handler to refresh the mechanism screen without exiting it.
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/gui/mechanisms.lua | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/scripts/gui/mechanisms.lua b/scripts/gui/mechanisms.lua index f96d8d63..b8c01b59 100644 --- a/scripts/gui/mechanisms.lua +++ b/scripts/gui/mechanisms.lua @@ -45,17 +45,25 @@ MechanismList = defclass(MechanismList, guidm.MenuOverlay) MechanismList.focus_path = 'mechanisms' function MechanismList.new(building) - local links = listMechanismLinks(building) local self = { - links = links, + links = {}, selected = 1 } + return mkinstance(MechanismList, self):init(building) +end + +function MechanismList:init(building) + local links = listMechanismLinks(building) + links[1].viewport = guidm.getViewportPos() links[1].cursor = guidm.getCursorPos() if #links <= 1 then links[1].mode = 'none' end - return mkinstance(MechanismList, self) + + self.links = links + self.selected = 1 + return self end local colors = { @@ -117,6 +125,11 @@ function MechanismList:onInput(keys) if self.selected ~= 1 then self:zoomToLink(self.links[1]) end + elseif keys.SELECT_ALL then + if self.selected > 1 then + self:init(self.links[self.selected].obj) + self.invalidate() + end elseif keys.SELECT then self:dismiss() end |
