mirror of
https://gitlab.com/open-fpsz/open-fpsz.git
synced 2026-07-15 08:24:48 +00:00
✨ Assign kills and points on kill, not on respawn
This commit is contained in:
parent
baa4d2d5f1
commit
c3ce3b96b0
2 changed files with 15 additions and 17 deletions
|
|
@ -62,6 +62,10 @@ var g : float = ProjectSettings.get_setting("physics/3d/default_gravity") # in m
|
|||
var gravity : Vector3 = g * ProjectSettings.get_setting("physics/3d/default_gravity_vector")
|
||||
var _jumping : bool = false
|
||||
|
||||
@rpc("call_local")
|
||||
func set_nickname(value : String) -> void:
|
||||
nickname = value
|
||||
|
||||
func _ready() -> void:
|
||||
energy_changed.connect(hud._on_energy_changed)
|
||||
health_component.health_changed.connect(hud._on_health_changed)
|
||||
|
|
@ -228,28 +232,17 @@ func _update_third_person_animations() -> void:
|
|||
tp_player.set_locomotion(Vector2(local_velocity.x, local_velocity.z), bias)
|
||||
|
||||
func _is_player_dead() -> bool:
|
||||
return player_state == PlayerState.PLAYER_DEAD
|
||||
return player_state != PlayerState.PLAYER_ALIVE
|
||||
|
||||
func die(killer_id : int) -> void:
|
||||
flag_carry_component.drop()
|
||||
player_state = PlayerState.PLAYER_DEAD
|
||||
if _is_pawn():
|
||||
animation_player.stop()
|
||||
animation_player.play("death")
|
||||
var tween : Tween = create_tween()
|
||||
tween.tween_interval(4)
|
||||
tween.tween_callback(func() -> void:
|
||||
died.emit(self, killer_id)
|
||||
if _is_pawn():
|
||||
animation_player.stop()
|
||||
)
|
||||
flag_carry_component.drop()
|
||||
|
||||
@rpc("call_local")
|
||||
func set_nickname(value : String) -> void:
|
||||
nickname = value
|
||||
died.emit(self, killer_id)
|
||||
|
||||
func respawn(location : Vector3) -> void:
|
||||
player_state = PlayerState.PLAYER_ALIVE
|
||||
linear_velocity = Vector3()
|
||||
health_component.heal_full()
|
||||
position = location
|
||||
player_state = PlayerState.PLAYER_ALIVE
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue