mirror of
https://gitlab.com/open-fpsz/open-fpsz.git
synced 2026-07-15 16:34:48 +00:00
✨ Implement Teams and disallow team damage in Rabbit
This commit is contained in:
parent
1a19e5edfa
commit
ac8bd2d07c
10 changed files with 46 additions and 23 deletions
|
|
@ -39,6 +39,7 @@ enum PlayerState { PLAYER_ALIVE, PLAYER_DEAD }
|
|||
set(id):
|
||||
player_id = id
|
||||
$PlayerInput.set_multiplayer_authority(id)
|
||||
@export var team_id : int = 1
|
||||
@export var nickname : String
|
||||
|
||||
@onready var input : PlayerInput = $PlayerInput
|
||||
|
|
@ -113,7 +114,7 @@ func _jump() -> void:
|
|||
_jumping = true
|
||||
|
||||
func _throw_flag() -> void:
|
||||
flag_carry_component.throw(linear_velocity)
|
||||
flag_carry_component.throw(linear_velocity, self)
|
||||
|
||||
func is_on_floor() -> bool:
|
||||
if shape_cast.is_colliding():
|
||||
|
|
@ -228,12 +229,13 @@ func _is_player_dead() -> bool:
|
|||
return player_state != PlayerState.PLAYER_ALIVE
|
||||
|
||||
func die(killer_id : int) -> void:
|
||||
flag_carry_component.drop()
|
||||
flag_carry_component.drop(self)
|
||||
player_state = PlayerState.PLAYER_DEAD
|
||||
if _is_pawn():
|
||||
animation_player.play("death")
|
||||
died.emit(self, killer_id)
|
||||
|
||||
@rpc("call_local", "reliable")
|
||||
func respawn(location : Vector3) -> void:
|
||||
animation_player.stop()
|
||||
player_state = PlayerState.PLAYER_ALIVE
|
||||
|
|
@ -243,7 +245,7 @@ func respawn(location : Vector3) -> void:
|
|||
|
||||
func _exit_tree() -> void:
|
||||
player_state = PlayerState.PLAYER_DEAD
|
||||
flag_carry_component.drop()
|
||||
flag_carry_component.drop(self)
|
||||
|
||||
func display_jetpack_particles() -> void:
|
||||
for particle: GPUParticles3D in jetpack_particles:
|
||||
|
|
|
|||
|
|
@ -77,6 +77,9 @@ properties/4/replication_mode = 2
|
|||
properties/5/path = NodePath(".:nickname")
|
||||
properties/5/spawn = true
|
||||
properties/5/replication_mode = 2
|
||||
properties/6/path = NodePath(".:team_id")
|
||||
properties/6/spawn = true
|
||||
properties/6/replication_mode = 2
|
||||
|
||||
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_5j4ew"]
|
||||
properties/0/path = NodePath(".:direction")
|
||||
|
|
@ -237,7 +240,8 @@ shape = ExtResource("2_vjqny")
|
|||
|
||||
[node name="HUD" parent="." instance=ExtResource("3_ccety")]
|
||||
|
||||
[node name="HealthComponent" parent="." instance=ExtResource("5_t6i6e")]
|
||||
[node name="HealthComponent" parent="." node_paths=PackedStringArray("_player") instance=ExtResource("5_t6i6e")]
|
||||
_player = NodePath("..")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="HealthComponent"]
|
||||
shape = ExtResource("2_vjqny")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue