multiplayer: added basic server and client functionality

This commit is contained in:
Simon Ward 2026-01-27 12:12:18 +13:00 committed by Jeremy Baxter
parent e16f87cbfa
commit f1a4ad761c
5 changed files with 138 additions and 6 deletions

View file

@ -18,6 +18,11 @@ var target_velocity = Vector3.ZERO
var _health = 100
# Multiplayer
func _enter_tree():
set_multiplayer_authority(str(name).to_int())
# Player UI
func resize_ui():
@ -239,8 +244,18 @@ func _ready():
resize_ui()
respawn()
if is_multiplayer_authority():
$CameraGimbal/InnerGimbal/Camera3D.current = true
else:
$CameraGimbal/InnerGimbal/Camera3D.current = false
func _physics_process(delta):
if dead:
if dead or not is_multiplayer_authority():
return
if health() < 1 or position.y <= -1000:
die()
if suspended:
return
if health() < 1 or position.y <= -1000: