Fixed team interactions

This commit is contained in:
Rendo 2025-11-27 11:30:42 +05:00
commit 917d52680c
5 changed files with 45 additions and 21 deletions

View file

@ -4,6 +4,8 @@ class_name Player
@export var team: Session.TEAMS
signal spawned
const MAX_HP = 100
@export var hp: int = 100:
@ -30,10 +32,15 @@ func _physics_process(_delta: float) -> void:
move_and_slide()
func die() -> void:
if not is_multiplayer_authority():
return
global_position = TEMP_start_pos
hp = MAX_HP
@rpc("any_peer","call_local","reliable")
func set_start_position(start_position: Vector3):
func set_after_spawn(start_position: Vector3,new_team: int):
global_position = start_position
TEMP_start_pos = global_position
team = new_team as Session.TEAMS
spawned.emit()