local map = ...
local game = map:get_game()

-- #2021: Teletransporter::notify_creating() used to guess which map border
-- to test (x or y) from the teletransporter's width/height ratio. A side
-- teletransporter thickened so it fully covers a hero taller than it is
-- wide (something quest makers need as soon as the hero is not the default
-- 16x16) can end up with height >= width even though it is a top/bottom
-- teletransporter, making the engine test the wrong axis. It then never
-- matches its map border, destination_side stays -1, and the engine used to
-- reach Debug::die("Invalid destination side") / "Destination side was not
-- set" as soon as the hero touched it.

function map:on_opening_transition_finished()

  local hero = map:get_hero()

  -- A hero taller than it is wide: exactly the shape that defeats the old
  -- width/height heuristic for this teletransporter (8 wide, 24 tall).
  hero:set_size(12, 28)
  hero:set_origin(6, 25)

  game:simulate_command_pressed("up")
end
