function init()
	triggers = FindTriggers()
	horseCam = false
	t = 0
end

function update(dt)
	if checkPlayerinCave() then
		changeHorseVar("true")
	else
		changeHorseVar("false")
	end
end

function tick(dt)

	if checkPlayerinCave() then
		if GetBool("game.map.enabled") then
			if t < 0.1 then
				t = t + dt
				transform = GetPlayerCameraTransform()
				SetCameraTransform(transform)
			end
		else
			if t > 0 then 
				t = t - dt
				transform = GetPlayerCameraTransform()
				SetCameraTransform(transform)
			end
		end
	end
end


function checkPlayerinCave()
	local incave = false
	for i = 1, #triggers do
		if IsPointInTrigger(triggers[i], GetPlayerPos()) then
			incave = true
		end
	end
	return incave
end

function changeHorseVar(param)
	if param == "true" and not horseCam then
		SetBool("level.horseCam", true)
		horseCam = true
	elseif param == "false" and horseCam then
		SetBool("level.horseCam", false)
		horseCam = false
	end
end