updates
This commit is contained in:
parent
276d43613d
commit
4298caf5cb
552 changed files with 42990 additions and 776 deletions
24
game/scripts/gdsync_link.gd
Normal file
24
game/scripts/gdsync_link.gd
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
class_name GDSyncLink
|
||||
extends CoopLink
|
||||
## The co-op wire over GD-Sync (the GDSync autoload; LAN or online): every message is a remote
|
||||
## call of CoopSession.net_receive on the other machine (the same node path on both, since both
|
||||
## run main.tscn), reliable or unreliable. The session exposes that function to GD-Sync.
|
||||
|
||||
var gdsync: Node
|
||||
var peer: int = -1
|
||||
var session: Node
|
||||
|
||||
|
||||
func _init(p_gdsync: Node, p_peer: int, p_session: Node) -> void:
|
||||
gdsync = p_gdsync
|
||||
peer = p_peer
|
||||
session = p_session
|
||||
|
||||
|
||||
func _deliver(kind: String, data: Variant, reliable: bool) -> void:
|
||||
if closed or gdsync == null or peer < 0:
|
||||
return
|
||||
if reliable:
|
||||
gdsync.call_func_on(peer, session.net_receive, kind, data)
|
||||
else:
|
||||
gdsync.call_func_on_unreliable(peer, session.net_receive, kind, data)
|
||||
Loading…
Add table
Add a link
Reference in a new issue