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

local function trigger_check_position()
  -- Re-setting the hero's position in place forces check_position(), which
  -- re-evaluates can_be_lifted() on the facing entity.
  local x, y = hero:get_position()
  hero:set_position(x, y)
end

function map:on_opening_transition_finished()

  -- Hero faces a liftable+cuttable+regenerating vase: the lift icon should show.
  assert_equal(game:get_command_effect("action"), "lift")

  -- Cut the vase; is_being_cut becomes true.
  the_vase:cut()

  -- While is_being_cut, can_be_lifted() must return false.
  trigger_check_position()
  assert_equal(game:get_command_effect("action"), nil)

  -- Wait for the destroy animation to finish (is_waiting_for_regeneration becomes true).
  sol.timer.start(map, 2000, function()
    assert(the_vase ~= nil, "regenerating vase should still exist on map")

    -- While is_waiting_for_regeneration, can_be_lifted() must also return false.
    trigger_check_position()
    assert_equal(game:get_command_effect("action"), nil)

    sol.main.exit()
  end)
end
