Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion addons/netfox.extras/plugin.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
name="netfox.extras"
description="Game-specific utilities for Netfox"
author="Tamas Galffy and contributors"
version="1.35.0"
version="1.35.1"
script="netfox-extras.gd"
2 changes: 1 addition & 1 deletion addons/netfox.internals/plugin.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
name="netfox.internals"
description="Shared internals for netfox addons"
author="Tamas Galffy and contributors"
version="1.35.0"
version="1.35.1"
script="plugin.gd"
2 changes: 1 addition & 1 deletion addons/netfox.noray/plugin.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
name="netfox.noray"
description="Bulletproof your connectivity with noray integration for netfox"
author="Tamas Galffy and contributors"
version="1.35.0"
version="1.35.1"
script="netfox-noray.gd"
9 changes: 6 additions & 3 deletions addons/netfox/network-time-synchronizer.gd
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,17 @@ func _loop() -> void:
on_initial_sync.emit()

while _active:
if multiplayer.is_server():
return stop()

var sample := NetworkClockSample.new()
_awaiting_samples[_sample_idx] = sample

sample.ping_sent = _clock.get_time()
_send_ping.rpc_id(1, _sample_idx)

_sample_idx += 1

await get_tree().create_timer(sync_interval).timeout

func _discipline_clock() -> void:
Expand Down
8 changes: 7 additions & 1 deletion addons/netfox/network-time.gd
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ func start() -> int:
_initial_sync_done = true

# Remove clients from the synced cache when disconnected
multiplayer.peer_disconnected.connect(func(peer): _synced_peers.erase(peer))
multiplayer.peer_disconnected.connect(_handle_peer_disconnect)

# Set initial clock state
_clock.set_time(NetworkTimeSynchronizer.get_time())
Expand All @@ -470,6 +470,9 @@ func stop() -> void:
_state = _STATE_INACTIVE
_synced_peers.clear()

if multiplayer.peer_disconnected.is_connected(_handle_peer_disconnect):
multiplayer.peer_disconnected.disconnect(_handle_peer_disconnect)

## Check if the initial time sync is done.
func is_initial_sync_done() -> bool:
return _initial_sync_done
Expand Down Expand Up @@ -583,6 +586,9 @@ func _notification(what) -> void:
func _is_active() -> bool:
return _state == _STATE_ACTIVE

func _handle_peer_disconnect(peer: int) -> void:
_synced_peers.erase(peer)

@rpc("any_peer", "reliable", "call_local")
func _submit_sync_success() -> void:
var peer_id := multiplayer.get_remote_sender_id()
Expand Down
2 changes: 1 addition & 1 deletion addons/netfox/plugin.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
name="netfox"
description="Shared internals for netfox addons"
author="Tamas Galffy and contributors"
version="1.35.0"
version="1.35.1"
script="netfox.gd"
2 changes: 1 addition & 1 deletion addons/netfox/time/network-tickrate-handshake.gd
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func run() -> void:
## [br][br]
## Called by [_NetworkTime], no need to call manually.
func stop() -> void:
if multiplayer.is_server():
if multiplayer.peer_connected.is_connected(_handle_new_peer):
multiplayer.peer_connected.disconnect(_handle_new_peer)

func _ready() -> void:
Expand Down
Loading