adj: respawning kills self

This commit is contained in:
DottsGit
2026-06-06 14:23:28 -04:00
parent 2a3e6a2c78
commit d3680765da
2 changed files with 20 additions and 1 deletions
+5
View File
@@ -410,6 +410,11 @@ func _process(delta: float) -> void:
if is_instance_valid(spring_arm): if is_instance_valid(spring_arm):
# Follow torso position exactly to avoid lerp bobbing # Follow torso position exactly to avoid lerp bobbing
spring_arm.global_position = torso.global_position spring_arm.global_position = torso.global_position
if death_screen and death_screen.visible:
if Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT) or Input.is_mouse_button_pressed(MOUSE_BUTTON_RIGHT) or Input.is_key_pressed(KEY_SPACE) or Input.is_key_pressed(KEY_ENTER) or Input.is_key_pressed(KEY_ESCAPE) == false and (Input.is_action_just_pressed("ui_accept") or Input.is_action_just_pressed("jump") or Input.is_action_just_pressed("fire")):
_on_respawn_pressed()
return return
# Shield recharge logic # Shield recharge logic
+15 -1
View File
@@ -92,7 +92,21 @@ func _resume() -> void:
func _respawn() -> void: func _respawn() -> void:
_resume() # Unpause _resume() # Unpause
get_tree().reload_current_scene()
# Find local player
var local_player: Node3D = null
if get_tree().current_scene.has_node("Players"):
for p in get_tree().current_scene.get_node("Players").get_children():
if p.has_method("is_multiplayer_authority") and p.is_multiplayer_authority():
local_player = p
break
if not local_player:
local_player = get_tree().current_scene.get_node_or_null("Player")
if local_player and local_player.has_method("take_damage"):
local_player.take_damage(9999, Vector3.ZERO)
func _build_ui() -> void: func _build_ui() -> void:
bg = ColorRect.new() bg = ColorRect.new()