Reduced number of global variables
This commit is contained in:
@ -19,7 +19,7 @@ func handle_packet(data: PackedByteArray):
|
||||
server_position.y = buffer.get_float()
|
||||
server_position.z = buffer.get_float()
|
||||
|
||||
print("[%s] Add player: %s %s @ %v" % [Global.username, player_id, player_name, server_position])
|
||||
print("[%s] Add player: %s %s @ %v" % [Global.account.name, player_id, player_name, server_position])
|
||||
|
||||
var player := spawn_player(player_id)
|
||||
player.position = server_position
|
||||
@ -31,7 +31,7 @@ func spawn_player(id: String) -> Player:
|
||||
if Global.players.has(id):
|
||||
player = Global.players.get_player(id)
|
||||
|
||||
if id == Global.account_id:
|
||||
if id == Global.account.id:
|
||||
Global.player = player
|
||||
|
||||
return player
|
||||
@ -39,7 +39,7 @@ func spawn_player(id: String) -> Player:
|
||||
player = player_scene.instantiate()
|
||||
player.id = id
|
||||
|
||||
if id == Global.account_id:
|
||||
if id == Global.account.id:
|
||||
player.controller = PlayerController.new(player)
|
||||
Global.player = player
|
||||
main_player_spawned.emit(player)
|
||||
|
Reference in New Issue
Block a user