
print("Lua script loaded successfully!")

game_api.set_location_callbacks(
    function()
        -- player just arrived here
        if game_api.is_darklands() then
            -- arrived while in darklands mode
        end
    end,
    function()
        -- player is about to leave
    end
)

function darklands_exit001_enter_callback()
	if game_api.is_darklands() then
		print("Lua script start_darklands_transition")
		game_api.start_darklands_transition()
	end
end

function on_container_clicked()
local player_container_aware = game_api.getIntValue("player_container_aware")
if player_container_aware == 1 then
game_api.start_dialogue("dialog_contaier002")
game_api.pickup_item("coursework")
game_api.setIntValue("player_has_coursework", 1)
else
game_api.start_dialogue("dialog_contaier001")
end
end

game_api.set_darklands_callbacks(
    nil,
    function()
		game_api.start_cutscene("darklands_exit001")
		game_api.setIntValue("day", 1)
		game_api.setIntValue("need_sleep", 1)
		game_api.set_player_hp(10)
    end
)


game_api.set_location_callbacks(
    function()
		print("Enter location uni exterior")
        local hp = game_api.getFloatValue("player_hp")
		game_api.set_player_hp(hp)
    end,
    function()
		print("Exit location uni exterior")
        local hp = game_api.get_player_hp()
		game_api.setFloatValue("player_hp", hp)
    end
)

game_api.set_trigger_zone_callbacks("darklands_exit001",
    darklands_exit001_enter_callback,
    nil
)
game_api.set_trigger_zone_callbacks("darklands_exit002",
    darklands_exit001_enter_callback,
    nil
)
game_api.set_trigger_zone_callbacks("darklands_exit003",
    darklands_exit001_enter_callback,
    nil
)