From af155db3beca208cf1f842246db342db09bdc5cc Mon Sep 17 00:00:00 2001 From: Warmist Date: Sat, 1 Sep 2012 01:22:51 +0300 Subject: [PATCH] Added whole bunch of editable things (units, jobs, flows) --- scripts/gui/gm-Items.lua | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/scripts/gui/gm-Items.lua b/scripts/gui/gm-Items.lua index 82a1da154..839d3158a 100644 --- a/scripts/gui/gm-Items.lua +++ b/scripts/gui/gm-Items.lua @@ -2,8 +2,27 @@ -- TODO use this: MechanismList = defclass(MechanismList, guidm.MenuOverlay) local gui = require 'gui' -if dfhack.gui.getCurFocus() ~= 'item' then - qerror("This script requires the item view.") +local my_trg +if dfhack.gui.getCurFocus() == 'item' then + my_trg=dfhack.gui.getCurViewscreen().item +elseif dfhack.gui.getCurFocus() == 'joblist' then + local t_screen=dfhack.gui.getCurViewscreen() + my_trg=t_screen.jobs[t_screen.cursor_pos] +elseif dfhack.gui.getCurFocus() == 'createquota' then + local t_screen=dfhack.gui.getCurViewscreen() + my_trg=t_screen.orders[t_screen.sel_idx] +elseif dfhack.gui.getCurFocus() == 'dwarfmode/LookAround/Flow' then + local t_look=df.global.ui_look_list.items[df.global.ui_look_cursor] + my_trg=t_look.flow + +elseif dfhack.gui.getSelectedUnit(true) then + my_trg=dfhack.gui.getSelectedUnit(true) +elseif dfhack.gui.getSelectedItem(true) then + my_trg=dfhack.gui.getSelectedItem(true) +elseif dfhack.gui.getSelectedJob(true) then + my_trg=dfhack.gui.getSelectedJob(true) +else + qerror("No valid target found") end TextInputDialog = defclass(TextInputDialog, gui.FramedScreen) @@ -177,5 +196,5 @@ local item_screen={ -local screen = mkinstance(gui.FramedScreen,item_screen):init(dfhack.gui.getCurViewscreen().item) +local screen = mkinstance(gui.FramedScreen,item_screen):init(my_trg) screen:show() \ No newline at end of file