## Emitted when a copy of the target level has been initialized by [method init_target].
signaltarget_initialized(level:GolfLevel)
## Replicate the [method target] onto the [method level] of all currently connected clients if no peer_id is specified, or to only that client if a peer_id is specified.
funcbuild_level(peer_id:int=0)->void:
Log.peer(self,"Building level...")
level.build(peer_id)
Log.peer(self,"Emitting level_built signal...")
level_built.emit(level)
## Emitted on the server when it has finished sending out RPCs for the [method GolfLevel.build] of the [field target] level.
signallevel_built(level:GolfLevel)
## Send the current level to a given client.
funcsync_level(peer_id:int=0)->void:
Log.peer(self,"Repeating the current level to: %d"%peer_id)
iflevel:
ifpeer_id>0:
rpc_wipe_level.rpc_id(peer_id)
else:
rpc_wipe_level.rpc()
build_level(peer_id)
## Add a new player to the current level.
funcadd_player(playernode:PlayerNode):
Log.peer(self,"Adding a new player to the level in progress...")
iflevel!=null:
level.build_new_ball(playernode.player_name)
## Advance to the next level.
funcnext_level()->void:
Log.peer(self,"Advancing to the next level...")
determine_next_level()
ifnext!=null:
rpc_wipe_level.rpc()
init_target()
build_level()
## Clear the current level on all clients and prepare to build a new one.