fix: reset interrupted fishing state

This commit is contained in:
Alexander Sellite 2026-08-15 19:20:04 -04:00
parent d07adb530c
commit d7c887db21
3 changed files with 61 additions and 2 deletions

View file

@ -176,6 +176,31 @@ func _run() -> void:
assert(fishing_status.text.is_empty())
assert(not fishing_status.visible)
assert(not fishing_panel.visible)
var reset_test_deadline: int = Time.get_ticks_msec() + 3000
while (
Time.get_ticks_msec() < reset_test_deadline
and fishing_spot.state != FishingSpotType.FishingState.READY
):
await process_frame
assert(fishing_spot.state == FishingSpotType.FishingState.READY)
# Leaving a session during the cast presentation must release every local
# action and equipment lock. This is the same cleanup path used by an
# in-game server switch or a lost connection.
fishing_spot.call("_begin_aiming", player)
fishing_spot.set("_cast_charge", 0.32)
fishing_spot.call("_update_cast_charge", 0.0)
fishing_spot.call("_confirm_cast")
assert(fishing_spot.state == FishingSpotType.FishingState.CASTING)
assert(not player.is_movement_enabled())
fishing_spot.call(
"_on_network_session_state_changed",
NetworkSession.State.DISCONNECTING,
)
assert(fishing_spot.state == FishingSpotType.FishingState.READY)
assert(player.is_movement_enabled())
assert(fishing_spot.can_change_hotbar_selection())
assert(fishing_spot.can_open_fishing_shop())
print("Fishing authority validation: PASS")
session.disconnect_session("")

View file

@ -146,6 +146,17 @@ func _run_host() -> void:
):
await process_frame
assert(remote_animation_player.current_animation == &"retract_sit")
var retract_completion_deadline: int = Time.get_ticks_msec() + 5000
while (
Time.get_ticks_msec() < retract_completion_deadline
and not remote_avatar.is_retract_visual_complete()
):
await process_frame
assert(remote_avatar.is_retract_visual_complete())
# Give the client that owns the same presentation a frame boundary to finish
# local cleanup before the host intentionally tears down this test session.
for _frame: int in 4:
await physics_frame
print("Fishing multiplayer host validation: PASS")
session.disconnect_session("")