Work on pickups and multiplayer
This commit is contained in:
@@ -65,8 +65,8 @@ func is_multiplayer() -> bool:
|
||||
return multiplayer_game
|
||||
|
||||
|
||||
func start_level(pawns : Dictionary[int, StringName]) -> void:
|
||||
pawns_selected = pawns
|
||||
func start_level(pawn_dict : Dictionary[int, StringName]) -> void:
|
||||
pawns_selected = pawn_dict
|
||||
if !Multiplayer.is_host():
|
||||
return
|
||||
|
||||
@@ -135,11 +135,11 @@ func level_spawned(peer_id : int) -> void:
|
||||
check_level_ready()
|
||||
|
||||
func check_level_ready() -> void:
|
||||
var ready : bool = true
|
||||
var level_ready : bool = true
|
||||
for id in level_synced:
|
||||
if level_synced[id] == false:
|
||||
ready = false
|
||||
if ready:
|
||||
level_ready = false
|
||||
if level_ready:
|
||||
level.setup()
|
||||
|
||||
func oneshot(stream : AudioStream) -> void:
|
||||
|
||||
@@ -81,26 +81,26 @@ func is_server() -> bool:
|
||||
func is_host() -> bool:
|
||||
return id == 1
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
func _process(_delta: float) -> void:
|
||||
if waiting:
|
||||
var ready : bool = true
|
||||
var group_ready : bool = true
|
||||
for pr in player_readiness.values():
|
||||
if !pr:
|
||||
ready = false
|
||||
group_ready = false
|
||||
break
|
||||
if ready:
|
||||
if group_ready:
|
||||
all_ready.emit()
|
||||
waiting = false
|
||||
for pr in player_readiness.keys():
|
||||
player_readiness[pr] = false
|
||||
|
||||
func _add_player_to_game(id : int) -> void:
|
||||
print("Player %s joined the game!" % id)
|
||||
func _add_player_to_game(pid : int) -> void:
|
||||
print("Player %s joined the game!" % pid)
|
||||
await get_tree().create_timer(0.5).timeout
|
||||
get_handle_from_peer(id)
|
||||
get_handle_from_peer(pid)
|
||||
|
||||
func _remove_player_from_game(id : int) -> void:
|
||||
print("Player %s left the game!" % id)
|
||||
func _remove_player_from_game(pid : int) -> void:
|
||||
print("Player %s left the game!" % pid)
|
||||
|
||||
func get_handle_from_peer(peer_id) -> void:
|
||||
rpc_id(peer_id, "report_handle_to_peer", id)
|
||||
|
||||
Reference in New Issue
Block a user