|
|
@ -1,7 +1,8 @@
|
|
|
|
-- Interface powered item editor.
|
|
|
|
-- Interface powered item editor.
|
|
|
|
local gui = require 'gui'
|
|
|
|
local gui = require 'gui'
|
|
|
|
local dialog = require 'gui.dialogs'
|
|
|
|
local dialog = require 'gui.dialogs'
|
|
|
|
|
|
|
|
local args={...}
|
|
|
|
|
|
|
|
function getTargetFromScreens()
|
|
|
|
local my_trg
|
|
|
|
local my_trg
|
|
|
|
if dfhack.gui.getCurFocus() == 'item' then
|
|
|
|
if dfhack.gui.getCurFocus() == 'item' then
|
|
|
|
my_trg=dfhack.gui.getCurViewscreen().item
|
|
|
|
my_trg=dfhack.gui.getCurViewscreen().item
|
|
|
@ -24,6 +25,9 @@ elseif dfhack.gui.getSelectedJob(true) then
|
|
|
|
else
|
|
|
|
else
|
|
|
|
qerror("No valid target found")
|
|
|
|
qerror("No valid target found")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
return my_trg
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local MODE_BROWSE=0
|
|
|
|
local MODE_BROWSE=0
|
|
|
|
local MODE_EDIT=1
|
|
|
|
local MODE_EDIT=1
|
|
|
@ -199,7 +203,22 @@ function GmEditorUi:popTarget()
|
|
|
|
self:dismiss()
|
|
|
|
self:dismiss()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function show_editor(trg)
|
|
|
|
local screen = GmEditorUi{target=my_trg}
|
|
|
|
local screen = GmEditorUi{target=trg}
|
|
|
|
|
|
|
|
|
|
|
|
screen:show()
|
|
|
|
screen:show()
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
if #args~=0 then
|
|
|
|
|
|
|
|
if args[1]=="dialog" then
|
|
|
|
|
|
|
|
function thunk(entry)
|
|
|
|
|
|
|
|
local t=load("return "..entry)()
|
|
|
|
|
|
|
|
show_editor(t)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
dialog.showInputPrompt("Gm Editor", "Object to edit:", COLOR_GRAY, "",thunk)
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
local t=load("return "..args[1])()
|
|
|
|
|
|
|
|
show_editor(t)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
show_editor(getTargetFromScreens())
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|