Refactored to allow hotseat and multiplayer. TODO: Create interface class for webrtc/enet multiplayer

This commit is contained in:
Sch1nken 2024-03-22 01:37:05 +01:00
parent d688eaf9c6
commit 5fe8f22ccb
27 changed files with 798 additions and 135 deletions

View file

@ -15,6 +15,7 @@ func _ready():
func _mp_peer_disconnected(id: int) -> void:
has_opponent = false
GameData.peer_id = 1
start_game_button.disabled = true
if game_in_progress or id == 1:
@ -41,6 +42,7 @@ func _mp_server_disconnect():
func _mp_peer_connected(id: int):
_log("[Multiplayer] Peer %d connected" % id)
has_opponent = true
GameData.peer_id = id
start_game_button.disabled = false
@onready var lobby_info = $LobbyInfo
@ -62,4 +64,3 @@ func load_game() -> void:
func _on_start_game_button_pressed():
# tell other peer to now load the world via rpc
load_game.rpc()
pass # Replace with function body.