local monocle = require("#monocle")

local vector2 = require("#microsoft.xna.framework.vector2")

function onBegin(room)
  disableMovement()
  disableRetry()
  player.ForceCameraUpdate = true
  wait(1)
  walkTo(9087, false, 0.5, false)
  wait(1)
  coroutine.yield(getLevel():ZoomTo(vector2(160, 100), 1.35, 2))
  wait(0.5)
  say("Ch3_TalkToMom_Donk")
  wait(1)
  say("Ch3_TalkToMom_Donk2")
  wait(1)
  setFlag("Donk_MusicFadeEnding_IcePlanet", true)
  engine.Scene:NextColorGrade("Donker19/LackOfInsiration/0_BlackFade")
  wait(2)
  say("Ch3_TalkToMom_Donk_Dying")
  wait(2)
  playSound("event:/Donk_OrionsBelt/sfx_RingRingRing", player.Position)
  wait(2)
  setFlag("Donk_TeleportToFinal_IcePlanet", true)
  coroutine.yield(engine.Scene:ZoomBack(1))
  enableMovement()
end

function onEnd(room, wasSkipped)
  enableMovement()
  setFlag("Donk_TeleportToFinal_IcePlanet", true)
  engine.Scene:NextColorGrade("Donker19/LackOfInsiration/0_BlackFade")
  player.DummyAutoAnimate = true
  player.ForceCameraUpdate = true
  getLevel():ResetZoom()
  enableMovement()
end