Skip to content

Commit

Permalink
Merge pull request #1 from TheSecondReal0/reset-network-data
Browse files Browse the repository at this point in the history
Reset network data
  • Loading branch information
Damjan94 authored Jan 23, 2021
2 parents 841184b + a11620d commit 1a98b52
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/assets/autoload/network.gd
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,14 @@ func get_player_name(id: int = myID) -> String:
func get_peers() -> Array:
return peers

func reset():
peers = []
names = {}
server = null
client = null
myID = 1
player_name = ""

# warning-ignore:unused_argument
func _on_state_changed_priority(old_state: int, new_state: int, priority: int) -> void:
if priority != 0:
Expand All @@ -185,3 +193,5 @@ func _on_state_changed_priority(old_state: int, new_state: int, priority: int) -
GameManager.State.Lobby:
print('Network manager allowing connections')
get_tree().set_refuse_new_network_connections(false)
GameManager.State.Start:
reset()

0 comments on commit 1a98b52

Please sign in to comment.