|
|
@ -422,11 +422,19 @@ WorkshopOverlay = defclass(WorkshopOverlay, MenuOverlay)
|
|
|
|
WorkshopOverlay.ATTRS={
|
|
|
|
WorkshopOverlay.ATTRS={
|
|
|
|
workshop=DEFAULT_NIL,
|
|
|
|
workshop=DEFAULT_NIL,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function WorkshopOverlay:onAboutToShow(below)
|
|
|
|
|
|
|
|
WorkshopOverlay.super.onAboutToShow(self,below)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if df.global.world.selected_building ~= self.workshop then
|
|
|
|
|
|
|
|
error("The workshop overlay tried to show up for incorrect workshop")
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
function WorkshopOverlay:onInput(keys)
|
|
|
|
function WorkshopOverlay:onInput(keys)
|
|
|
|
local allowedKeys={ --TODO add options: job management, profile, etc...
|
|
|
|
local allowedKeys={ --TODO add options: job management, profile, etc...
|
|
|
|
"CURSOR_RIGHT","CURSOR_LEFT","CURSOR_UP","CURSOR_DOWN",
|
|
|
|
"CURSOR_RIGHT","CURSOR_LEFT","CURSOR_UP","CURSOR_DOWN",
|
|
|
|
"CURSOR_UPRIGHT","CURSOR_UPLEFT","CURSOR_DOWNRIGHT","CURSOR_DOWNLEFT",
|
|
|
|
"CURSOR_UPRIGHT","CURSOR_UPLEFT","CURSOR_DOWNRIGHT","CURSOR_DOWNLEFT",
|
|
|
|
"CURSOR_UP_Z","CURSOR_DOWN_Z","DESTROYBUILDING","CHANGETAB"}
|
|
|
|
"CURSOR_UP_Z","CURSOR_DOWN_Z","DESTROYBUILDING","CHANGETAB","SUSPENDBUILDING"}
|
|
|
|
|
|
|
|
|
|
|
|
if keys.LEAVESCREEN then
|
|
|
|
if keys.LEAVESCREEN then
|
|
|
|
self:dismiss()
|
|
|
|
self:dismiss()
|
|
|
|
self:sendInputToParent('LEAVESCREEN')
|
|
|
|
self:sendInputToParent('LEAVESCREEN')
|
|
|
@ -448,9 +456,26 @@ function WorkshopOverlay:onInput(keys)
|
|
|
|
return
|
|
|
|
return
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function WokshopOverlay:onGetSelectedBuilding()
|
|
|
|
function WokshopOverlay:onGetSelectedBuilding()
|
|
|
|
return self.workshop
|
|
|
|
return self.workshop
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
local function is_slated_for_remove( bld )
|
|
|
|
|
|
|
|
for i,v in ipairs(bld.jobs) do
|
|
|
|
|
|
|
|
if v.job_type==df.job_type.DestroyBuilding then
|
|
|
|
|
|
|
|
return true
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
return false
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
function WorkshopOverlay:render(dc)
|
|
|
|
|
|
|
|
self:renderParent()
|
|
|
|
|
|
|
|
if df.global.world.selected_building ~= self.workshop then
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
if is_slated_for_remove(self.workshop) then
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WorkshopOverlay.super.render(self, dc)
|
|
|
|
|
|
|
|
end
|
|
|
|
return _ENV
|
|
|
|
return _ENV
|
|
|
|