Tewam spawner

This commit is contained in:
Rendo 2025-11-27 11:02:42 +05:00
commit 2bfbfa5089
8 changed files with 126 additions and 67 deletions

View file

@ -18,7 +18,7 @@ const MAX_HP = 100
get:
return hp
@onready var TEMP_start_pos = global_position
var TEMP_start_pos
func _enter_tree() -> void:
set_multiplayer_authority(str(name).to_int())
@ -32,3 +32,8 @@ func _physics_process(_delta: float) -> void:
func die() -> void:
global_position = TEMP_start_pos
hp = MAX_HP
@rpc("any_peer","call_local","reliable")
func set_start_position(start_position: Vector3):
global_position = start_position
TEMP_start_pos = global_position

View file

@ -12,15 +12,11 @@ var compensation_speed: float
@export var compensation_time: float = 1.0
@export var compensation_delay: float = 0.5
func _enter_tree() -> void:
set_multiplayer_authority(get_parent().name.to_int())
func _ready() -> void:
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
# Move to level controller when possible
#Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
if not is_multiplayer_authority():
return
# Move to level controller when possible
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
current = true
func _process(delta: float) -> void:

View file

@ -3,6 +3,16 @@ extends Camera3D
@export var SENSITIVITY = 0.02
@export var SPEED = 10.0
func _enter_tree() -> void:
set_multiplayer_authority(int(name))
func _ready() -> void:
if not is_multiplayer_authority():
return
# Move to level controller when possible
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
current = true
func _process(delta: float) -> void:
var xz_plane = Input.get_vector("plr_strafe_l","plr_strafe_r","plr_forward","plr_back")
var y = Input.get_axis("spc_down","spc_up")
@ -18,3 +28,7 @@ func rotate_camera(x,y) -> void:
func _input(event: InputEvent) -> void:
if event is InputEventMouseMotion:
rotate_camera(-event.relative.x * SENSITIVITY,-event.relative.y * SENSITIVITY)
@rpc("any_peer","call_local","reliable")
func set_start_position(start_position: Vector3):
global_position = start_position