commit cc115ddf46efbe22e155b0fbfac9b3a65aac389d
parent 325c8cfcdc7fda9d10da57229609a4c61cea98c6
Author: FIGBERT <figbert@figbert.com>
Date: Fri, 5 Feb 2021 21:49:05 -0800
Revert "Merge duplicate rpc_id use into rpc calls"
This reverts commit 0100c838385804e66735dbcf099c391e1730a6af.
After testing on physical devices, the fix causes the message
to be sent to the joining devices as well, which is undesired
behavior.
Diffstat:
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/scripts/main.gd b/src/scripts/main.gd
@@ -55,14 +55,18 @@ func _client_joined_server(id: int) -> void:
var peers := _join_array(players.keys(), "\n ")
var message: String = "Some players are already here:\n %s" % peers
rpc_id(id, "print_message_from_server", message)
- rpc("print_message_from_server", "%s has joined the server!" % id)
+ for player in players:
+ var message := "%s has joined the server!" % id
+ rpc_id(player, "print_message_from_server", message)
players[id] = { "gelt": PLAYER_STARTING_GELT, "in": true }
func _client_left_server(id: int) -> void:
print("%s disconnected from the server" % id)
players.erase(id)
- rpc("print_message_from_server", "%s has left the server." % id)
+ for player in players:
+ var message := "%s has left the server." % id
+ rpc_id(player, "print_message_from_server", message)
### Game Phases