File tree Expand file tree Collapse file tree 7 files changed +18
-9
lines changed Expand file tree Collapse file tree 7 files changed +18
-9
lines changed Original file line number Diff line number Diff line change 33name =" netfox.extras"
44description =" Game-specific utilities for Netfox"
55author =" Tamas Galffy and contributors"
6- version =" 1.35.0 "
6+ version =" 1.35.1 "
77script =" netfox-extras.gd"
Original file line number Diff line number Diff line change 33name =" netfox.internals"
44description =" Shared internals for netfox addons"
55author =" Tamas Galffy and contributors"
6- version =" 1.35.0 "
6+ version =" 1.35.1 "
77script =" plugin.gd"
Original file line number Diff line number Diff line change 33name =" netfox.noray"
44description =" Bulletproof your connectivity with noray integration for netfox"
55author =" Tamas Galffy and contributors"
6- version =" 1.35.0 "
6+ version =" 1.35.1 "
77script =" netfox-noray.gd"
Original file line number Diff line number Diff line change @@ -162,14 +162,17 @@ func _loop() -> void:
162162 on_initial_sync .emit ()
163163
164164 while _active :
165+ if multiplayer .is_server ():
166+ return stop ()
167+
165168 var sample := NetworkClockSample .new ()
166169 _awaiting_samples [_sample_idx ] = sample
167-
170+
168171 sample .ping_sent = _clock .get_time ()
169172 _send_ping .rpc_id (1 , _sample_idx )
170-
173+
171174 _sample_idx += 1
172-
175+
173176 await get_tree ().create_timer (sync_interval ).timeout
174177
175178func _discipline_clock () -> void :
Original file line number Diff line number Diff line change @@ -447,7 +447,7 @@ func start() -> int:
447447 _initial_sync_done = true
448448
449449 # Remove clients from the synced cache when disconnected
450- multiplayer .peer_disconnected .connect (func ( peer ): _synced_peers . erase ( peer ) )
450+ multiplayer .peer_disconnected .connect (_handle_peer_disconnect )
451451
452452 # Set initial clock state
453453 _clock .set_time (NetworkTimeSynchronizer .get_time ())
@@ -470,6 +470,9 @@ func stop() -> void:
470470 _state = _STATE_INACTIVE
471471 _synced_peers .clear ()
472472
473+ if multiplayer .peer_disconnected .is_connected (_handle_peer_disconnect ):
474+ multiplayer .peer_disconnected .disconnect (_handle_peer_disconnect )
475+
473476## Check if the initial time sync is done.
474477func is_initial_sync_done () -> bool :
475478 return _initial_sync_done
@@ -583,6 +586,9 @@ func _notification(what) -> void:
583586func _is_active () -> bool :
584587 return _state == _STATE_ACTIVE
585588
589+ func _handle_peer_disconnect (peer : int ) -> void :
590+ _synced_peers .erase (peer )
591+
586592@rpc ("any_peer" , "reliable" , "call_local" )
587593func _submit_sync_success () -> void :
588594 var peer_id := multiplayer .get_remote_sender_id ()
Original file line number Diff line number Diff line change 33name =" netfox"
44description =" Shared internals for netfox addons"
55author =" Tamas Galffy and contributors"
6- version =" 1.35.0 "
6+ version =" 1.35.1 "
77script =" netfox.gd"
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ func run() -> void:
5454## [br][br]
5555## Called by [_NetworkTime], no need to call manually.
5656func stop () -> void :
57- if multiplayer .is_server ( ):
57+ if multiplayer .peer_connected . is_connected ( _handle_new_peer ):
5858 multiplayer .peer_connected .disconnect (_handle_new_peer )
5959
6060func _ready () -> void :
You can’t perform that action at this time.
0 commit comments