GameScreen.textures_path = "graphics/screens/06_prison/location/"

GameScreen.hint_table = {
    {obj = {"basement_hint", 1406, 136}, 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_06a_part")

    self:SetItemSound("bedpan", "sound/bedpan.ogg");
    self:SetItemSound("bottle_02", "sound/bottle_02.ogg");
    self:SetItemSound("bottle_04", "sound/bottle_04.ogg");
    self:SetItemSound("bottle_05", "sound/bottle_05.ogg");
    self:SetItemSound("bottle_06", "sound/bottle_06.ogg");
    self:SetItemSound("bottle_07", "sound/bottle_07.ogg");
    self:SetItemSound("chain", "sound/chain.ogg");
    self:SetItemSound("lamp_hit", "sound/lamp_hit.ogg");
    self:SetItemSound("metalware_02", "sound/metalware_02.ogg");
    self:SetItemSound("metalware_03", "sound/metalware_03.ogg");
    self:SetItemSound("plastic_bottle_01", "sound/plastic_bottle_01.ogg");
    self:SetItemSound("soda_can_wobble", "sound/soda_can_wobble.ogg");
    self:SetItemSound("ward_can", "sound/ward_can.ogg");
           
    self:CreateLocationPortal("basement_eye", "006_basement", "eye")
       
    MusicPlay({"sound/music/basement2.ogg", "sound/ambient/20_ambient.ogg"}, 6) 
end

---------------------------------------------------------------------
function GameScreen:StartHO()
    local ho_end = function()  
        Inventory:add_tool("oil_can_006", true)
        self.mini_game = nil;
        SetState(CURRENT_SCREEN, "ho", "completed") 
        SetState("screen_006_basement", "state", "storeroom1")
        clApplication.curret_win = clScreenManager:add_screen("tool_found_screen") 
        clApplication.curret_win._resource = "graphics/screens/06_prison/location/object_found_06a"
        clApplication.curret_win.end_fun = function()
            Inventory:ToolFound("oil_can_006", 800, 600)
        end
    end
    
    self.item_list = {
        {obj = {"handcuffs", {x = 1193, y = 253}}, },
        {obj = {"thermometer", {x = 276, y = 734}}, },
        {obj = {"oil_can", {x = 83, y = 296}}, hint = {x = 72, y = 285}},
        {obj = {"roller_bandage", {x = 338, y = 109}}, },
        {obj = {"metal_bottle", {x = 801, y = 165}}, },
        {obj = {"tweezers", {x = 813, y = 1066}}, },
        {obj = {"hacksaw", {x = 343, y = 539}}, },
        {obj = {"stethoscope", {x = 403, y = 986}}, },
        {obj = {"scissors", {x = 1296, y = 861}}, },
        {obj = {"dropper", {x = 1068, y = 710}}, },
        {obj = {"xray", {x = 1015, y = 213}}, },
        {obj = {"glass_flask", {x = 1056, y = 773}}, },
    }

    tip_end = function()    
    end
    self:SetMiniGame(mgt_hidden_object)   
    self.mini_game:Init(self.item_list, ho_end);
    self.mini_game.is_end_immediately = true;
    
    HUDScreen:ShowTips({path = self.textures_path.."Text_06p", x = 494, y = 1128, end_fun = tip_end})
end

function GameScreen:OnFinish()
end
------------------------------------------------------------------------------------------------------
-------------------------------------------Mouse functions--------------------------------------------
------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------
function GameScreen:LoadScreen()
	--[[---Background---]]--
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "06_prison", "graphics/screens/06_prison/location/06_prison",0, 0);
    
    self:CreateObj(OBJ_TYPE.TRIGGER, "basement_eye", "graphics/screens/06_prison/location/basement_eye",1420, 149);

    self:CreateObj(OBJ_TYPE.TRIGGER, "bedpan", "graphics/screens/06_prison/location/bedpan", 289, 638);
    self:CreateObj(OBJ_TYPE.TRIGGER, "bottle_02", "graphics/screens/06_prison/location/bottle_02", 888, 712);
    self:CreateObj(OBJ_TYPE.TRIGGER, "bottle_04", "graphics/screens/06_prison/location/bottle_04", 669, 864);
    self:CreateObj(OBJ_TYPE.TRIGGER, "bottle_05", "graphics/screens/06_prison/location/bottle_05", 1464, 993);
    self:CreateObj(OBJ_TYPE.TRIGGER, "bottle_06", "graphics/screens/06_prison/location/bottle_06", 525, 969);
    self:CreateObj(OBJ_TYPE.TRIGGER, "bottle_07", "graphics/screens/06_prison/location/bottle_07", 1186, 907);
    self:CreateObj(OBJ_TYPE.TRIGGER, "chain", "graphics/screens/06_prison/location/chain", 622, 138);
    self:CreateObj(OBJ_TYPE.TRIGGER, "lamp_hit", "graphics/screens/06_prison/location/lamp_hit", 733, 0);
    self:CreateObj(OBJ_TYPE.TRIGGER, "metalware_02", "graphics/screens/06_prison/location/metalware_02", 1051, 1076);
    self:CreateObj(OBJ_TYPE.TRIGGER, "metalware_03", "graphics/screens/06_prison/location/metalware_03", 772, 833);
    self:CreateObj(OBJ_TYPE.TRIGGER, "plastic_bottle_01", "graphics/screens/06_prison/location/plastic_bottle_01", 86, 509);
    self:CreateObj(OBJ_TYPE.TRIGGER, "soda_can_wobble", "graphics/screens/06_prison/location/soda_can_wobble", 457, 1015);
    self:CreateObj(OBJ_TYPE.TRIGGER, "ward_can", "graphics/screens/06_prison/location/ward_can", 653, 592);
    
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "handcuffs", "graphics/screens/06_prison/location/handcuffs_part",1215, 300);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "thermometer", "graphics/screens/06_prison/location/thermometer_part",289, 762);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "oil_can", "graphics/screens/06_prison/location/oil_can_part",142, 427);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "roller_bandage", "graphics/screens/06_prison/location/roller_bandage_part",392, 153);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "metal_bottle", "graphics/screens/06_prison/location/metal_bottle_part",825, 233);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "tweezers", "graphics/screens/06_prison/location/tweezers_part",866, 1074);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "hacksaw", "graphics/screens/06_prison/location/hacksaw_part",401, 568);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "hacksaw_shadow", "graphics/screens/06_prison/location/hacksaw_shadow",417, 561);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "stethoscope", "graphics/screens/06_prison/location/stethoscope_part",430, 1058);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "scissors", "graphics/screens/06_prison/location/scissors_part",1346, 923);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "dropper", "graphics/screens/06_prison/location/dropper_part",1133, 733);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "xray", "graphics/screens/06_prison/location/xray_part",1054, 251);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "glass_flask", "graphics/screens/06_prison/location/glass_flask_part",1074, 807);
      
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "crystal_06a_part", "graphics/screens/06_prison/location/crystal_06a_part",608, 1037);
   

    clScreenManager:add_screen("hud") 

end

