-- LocMailRoom

LocMailRoom = Location:new("LocMailRoom")

----------------------------------------------------------------------------------------------------
function LocMailRoom_UPDATE()
	return 0
end

----------------------------------------------------------------------------------------------------
function LocMailRoom_INIT()
    LocMailRoom:init()
end

----------------------------------------------------------------------------------------------------
LocMailRoom:setSceneHandler(1,
    function(aScene, aEvent)
        if aEvent == "capture" then
            aScene:captureObjects({'saw'})
        elseif aEvent == "generic_init" then
            
            
            aScene:setWinTerms({"ho_collected", "activate_box1"})
            aScene:setHidsParams({"saw"}, {inventory = true})

        elseif aEvent == "start" then
        
            aScene:setRemark('ids_remark_locmailroom_1')
            aScene:setTask('ids_challenge_locmailroom_1')
            aScene:setHidsParams({"bascetball"}, {active = false})
            aScene:attachHids(aScene:getHidList())
            aScene:attachInteract("box1", "saw")

        elseif aEvent == "activate_box1" then
            aScene:setHidsParams({"bascetball"}, {active = true})
            aScene:setInteractParams("box1", {visible = false})
            aScene:onChallengeComplete()
            aScene:setTask("ids_collect_ho")

        end
    end)

----------------------------------------------------------------------------------------------------
LocMailRoom:setSceneHandler(2,
    function(aScene, aEvent)
        if aEvent == "capture" then
            aScene:captureObjects({'gazzcandle', 'bagofmoney'})
        elseif aEvent == "generic_init" then
            
            aScene:setWinTerms({"ho_collected", "activate_safe"})

            aScene:setHidsParams({"gazzcandle"}, {inventory = true})
            aScene:setHidsParams({"bagofmoney"}, {active = false, visible = false})
            
        elseif aEvent == "start" then
			aScene:setRemark('ids_remark_locmailroom_2')
            aScene:setTask('ids_challenge_locmailroom_2')
            aScene:attachHids(aScene:getHidList())
            aScene:attachInteract("safe", "gazzcandle")
            
        elseif aEvent == "activate_safe" then
            aScene:setHidsParams({"bagofmoney"}, {active = true, visible = true})
            aScene:onChallengeComplete()
            aScene:setTask("ids_collect_ho")
        
        end
    end)

----------------------------------------------------------------------------------------------------
LocMailRoom:setSceneHandler(3,
    function(aScene, aEvent)
    
        -- exit -> exit
    
        if aEvent == "capture" then
            aScene:captureObjects({'exit'})
        elseif aEvent == "generic_init" then
            
            aScene:setWinTerms({"ho_collected", "activate_exit"})
            aScene:setHidsParams({"exit"}, {inventory = true})

        elseif aEvent == "start" then
            aScene:attachHids(aScene:getHidList())
            aScene:attachInteract("exit", "exit")
            aScene:setRemark('ids_remark_locmailroom_3')
            aScene:setTask('ids_challenge_locmailroom_3')

        elseif aEvent == "activate_exit" then
            aScene:onChallengeComplete()
            aScene:setTask("ids_collect_ho")

        end
    end)

----------------------------------------------------------------------------------------------------
LocMailRoom:setSceneHandler(4,
    function (aScene, aEvent)
        if aEvent == "generic_init" then
            
            aScene:setWinTerms({"ho_collected", "found_bug_frame"})
            aScene:setHidsParams({"spy_bug"}, {inventory = true})
            
        elseif aEvent == "start" then
            aScene:attachHids(aScene:getHidList({except = {'bug_frame'}}))
            --aScene:attachInteract("picture_frame", "spy_bug")
            aScene:addItemMix('bug_frame', {'spy_bug', 'picture_frame'})
            aScene:setRemark('ids_remark_locmailroom_4') 
            aScene:setTask('ids_challenge_locmailroom_4')
            

        elseif aEvent == "found_bug_frame" then
            aScene:onChallengeComplete()
            aScene:setTask('ids_collect_ho')
        end
    end)

----------------------------------------------------------------------------------------------------
LocMailRoom:setSceneHandler(5,
    function(aScene, aEvent)

        -- lamp -> lamp

        if aEvent == "capture" then
            aScene:captureObjects({'lamp', 'boots'})
        elseif aEvent == "generic_init" then
            
            aScene:setWinTerms({"ho_collected", "activate_lamp"})
            aScene:setHidsParams({"lamp"}, {inventory = true})

        elseif aEvent == "start" then
            aScene:attachHids(aScene:getHidList())
            aScene:attachInteract("lamp", "lamp")
            aScene:setRemark('ids_remark_locmailroom_5')
            aScene:setTask('ids_challenge_locmailroom_5')

        elseif aEvent == "activate_lamp" then
            aScene:onChallengeComplete()
            aScene:setTask("ids_collect_ho")

        end
    end)