GameScreen.textures_path = "graphics/screens/02_shaft/location/"

GameScreen.hint_table = {
    {obj = {"02_return_hint", 632, 662}, fun = function() if(GetState(CURRENT_SCREEN, "ho") == "completed") then return true end end},
}

function GameScreen:RestoreScene()
    if(GetState(CURRENT_SCREEN, "ho") == "") then
       self:StartHO();
    elseif(GetState(CURRENT_SCREEN, "ho") == "active") then
        self:StartHO();
    elseif(GetState(CURRENT_SCREEN, "ho") == "completed") then   
    end
    
    for found_item in string.gmatch(GetState(CURRENT_SCREEN, "found_obj"), "[_%a%d]+") do
		ItemRemove(self.name, found_item)
    end 
end


function GameScreen:InitScreen()
    self:LoadScreen()       
         
    self:RestoreScene();
    
    self:AddHiddenCrystal("crystal_02a_part")
    self:SetItemSound("plastic_bottle_01", "sound/plastic_bottle_01.ogg");
    self:SetItemSound("soda_can_wobble", "sound/soda_can_wobble.ogg");
    self:SetItemSound("bedpan", "sound/bedpan.ogg");
    self:SetItemSound("chain", "sound/chain.ogg");       
    self:CreateLocationPortal("02_return_eye", "002_elevator", "eye")
       
    MusicPlay({"sound/ambient/02_ambient.ogg", "sound/ambient/03_ambient.ogg"}, 2) 
end

---------------------------------------------------------------------
function GameScreen:StartHO()
    local ho_end = function()  
        Inventory:save_tool("panel_002", true)
        self.mini_game = nil;
        SetState(CURRENT_SCREEN, "ho", "completed") 
        SetState("screen_002_elevator", "state", "panel")
        clApplication.curret_win = clScreenManager:add_screen("tool_found_screen") 
        clApplication.curret_win._resource = "graphics/screens/02_shaft/location/object_found_02a"
        clApplication.curret_win.end_fun = function()
            Inventory:ToolFound("panel_002", 800, 600)
        end
    end

    self.item_list = {
       {obj = {"glove", {x = 1141, y = 239}}, },
        {obj = {"weight", {x = 433, y = 961}}, },
        {obj = {"awl", {x = 695, y = 830}}, },
        {obj = {"floppy", {x = 546, y = 915}}, },
        {obj = {"lock", {x = 635, y = 678}}, },
        {obj = {"microchip", {x = 322, y = 589}}, },
        {obj = {"spring", {x = 1234, y = 661}}, },
        {obj = {"button_panel", {x = 1027, y = 493}}, },
        {obj = {"tube", {x = 301, y = 743}}, },
        {obj = {"flashlight", {x = 143, y = 503}}, },
        {obj = {"pliers", {x = 1081, y = 954}}, },
        {obj = {"lamp", {x = 293, y = 100}}, },
    }

    self:SetMiniGame(mgt_hidden_object)   
    --self.mini_game.list_type = 2;
    self.mini_game:Init(self.item_list, ho_end);
end

function GameScreen:OnFinish()
end
------------------------------------------------------------------------------------------------------
-------------------------------------------Mouse functions--------------------------------------------
------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------
function GameScreen:LoadScreen()
	--[[---Background---]]--
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "02_shaft", "graphics/screens/02_shaft/location/02_shaft",0, 0);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "crystal_02a_part", "graphics/screens/02_shaft/location/crystal_02a_part",493, 913);

    self:CreateObj(OBJ_TYPE.TRIGGER, "plastic_bottle_01", "graphics/screens/02_shaft/location/plastic_bottle_01", 633, 961);
    self:CreateObj(OBJ_TYPE.TRIGGER, "soda_can_wobble", "graphics/screens/02_shaft/location/soda_can_wobble", 312, 578);
    self:CreateObj(OBJ_TYPE.TRIGGER, "bedpan", "graphics/screens/02_shaft/location/bedpan", 544, 319);
    self:CreateObj(OBJ_TYPE.TRIGGER, "chain", "graphics/screens/02_shaft/location/chain", 1094, 0);
    
    self:CreateObj(OBJ_TYPE.TRIGGER, "02_return_eye", "graphics/screens/02_shaft/location/02_return_eye",668, 678);
    
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "glove", "graphics/screens/02_shaft/location/glove_part",1190, 272);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "weight", "graphics/screens/02_shaft/location/weight_part",391, 1029);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "awl", "graphics/screens/02_shaft/location/awl_part",721, 890);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "floppy", "graphics/screens/02_shaft/location/floppy_part",561, 961);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "lock", "graphics/screens/02_shaft/location/lock_part",633, 751);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "microchip", "graphics/screens/02_shaft/location/microchip_part",340, 619);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "spring", "graphics/screens/02_shaft/location/spring_part",1281, 680);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "button_panel", "graphics/screens/02_shaft/location/button_panel_part",1075, 523);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "tube", "graphics/screens/02_shaft/location/tube_part",341, 758);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "flashlight", "graphics/screens/02_shaft/location/flashlight_part",142, 533);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "pliers", "graphics/screens/02_shaft/location/pliers_part",1171, 997);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "lamp", "graphics/screens/02_shaft/location/lamp_part",354, 119);

    clScreenManager:add_screen("hud") 

end

