GameScreen.textures_path = "graphics/screens/06_basement/zoom/"

function GameScreen:RestoreScene()  
    if(GetState("zoom_006", "state") == "oiled") then
        self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "lock_closed_oiled", "graphics/screens/06_basement/zoom/lock_closed_oiled", 470, 337);
        ItemRemove(self.name, "lock_closed_rusty")
    else
        HUDScreen:ShowTips({path = self.textures_path.."Text_06d", x = 392, y = 1128})
    end
end

function GameScreen:InitScreen()
    self:LoadScreen()
    
    local oil_apply = function()
        Inventory:ActiveToolApply()
        ItemRemove(self.name, "lock_closed_rusty", 0.3)
        PlaySfx("sound/drop.ogg")
        SetState("zoom_006", "state", "oiled")
        self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "lock_closed_oiled", "graphics/screens/06_basement/zoom/lock_closed_oiled", 470, 337);
        ItemSetOpacity("lock_closed_oiled", 0.0)
        ItemChangeOpacity("lock_closed_oiled", 1.0, 0.3)
    end
    self:AddToolApplyZone("lock_closed_rusty", "oil_can_006", oil_apply, true);
            
    self:RestoreScene()   
end

function GameScreen:onObjectClick(item_name)
    if(item_name == "lock_closed_oiled") then
        PlaySfx("sound/lock.ogg")
        ItemRemove(self.name, "lock_closed_oiled", 0.3)
        self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "lock_open", "graphics/screens/06_basement/zoom/lock_open", 470, 110);
        ItemSetOpacity("lock_open", 0.0)
        ItemChangeOpacity("lock_open", 1.0, 0.3)
        DelayedExec(0.5, function()
            CurrentScreen:OpenDoor007()
            self:Disable()
        end)
    end
end

function GameScreen:LoadScreen()
	--[[---Background---]]--
	self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "back_trigger", "graphics/trigger", 0, 0, WINDOW_WIDTH, WINDOW_HEIGHT);
	ItemSetOpacity("back_trigger", 0.7)
	
	self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "back_zoom", "graphics/screens/06_basement/zoom/lock_zoom", 341, 91);
	
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "lock_closed_rusty", "graphics/screens/06_basement/zoom/lock_closed_rusty", 501, 324);

    
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "zoom_close", "graphics/interface/hud/continue_zoom", 667, 892);
	
	clScreenManager:add_screen("hud") 
end