feat: Implement comprehensive lobby system with main menu, room management, and loading screen.
This commit is contained in:
@@ -290,19 +290,21 @@ func leave_room() -> void:
|
||||
reset()
|
||||
_stop_lan_broadcast()
|
||||
|
||||
# Emit before nulling peer so UI can still access peer info if needed
|
||||
emit_signal("room_left")
|
||||
|
||||
if is_lan_mode:
|
||||
# LAN mode: just close the ENet peer directly
|
||||
if multiplayer.has_multiplayer_peer():
|
||||
multiplayer.set_multiplayer_peer(null)
|
||||
is_lan_mode = false
|
||||
# LAN mode: Host should keep peer alive long enough to reach lobby
|
||||
if not is_host or get_tree().current_scene.name == "Lobby":
|
||||
if multiplayer.has_multiplayer_peer():
|
||||
multiplayer.set_multiplayer_peer(null)
|
||||
is_lan_mode = false
|
||||
else:
|
||||
# Nakama mode: full Nakama cleanup
|
||||
NakamaManager.cleanup()
|
||||
|
||||
# Important: Clean up game state as well to prevent ghost players
|
||||
GameStateManager.reset()
|
||||
|
||||
emit_signal("room_left")
|
||||
|
||||
func refresh_room_list() -> void:
|
||||
"""Request updated room list from Nakama or scan for LAN rooms."""
|
||||
|
||||
Reference in New Issue
Block a user