progress bar / waypoint / iffs improvements

This commit is contained in:
anyreso 2024-05-11 15:25:22 -04:00
parent 2dfea5b250
commit 1588224d45
13 changed files with 307 additions and 218 deletions

View file

@ -16,7 +16,10 @@ class_name Player extends RigidBody3D
enum PlayerState { PLAYER_ALIVE, PLAYER_DEAD }
@export var iff : Control
signal died(player : Player, killer_id : int)
signal energy_changed(energy : float)
@export var iff : IFF
@export var health_component : HealthComponent
@export var flag_carry_component : FlagCarryComponent
@export var walkable_surface_sensor : ShapeCast3D
@ -50,12 +53,9 @@ enum PlayerState { PLAYER_ALIVE, PLAYER_DEAD }
@onready var hud : CanvasLayer = $HUD
@onready var animation_player : AnimationPlayer = $AnimationPlayer
@onready var collision_shape : CollisionShape3D = $CollisionShape3D
@onready var jetpack_particles : Array = $Smoothing/ThirdPerson/Mesh/JetpackFX.get_children()
@onready var jetpack_particles : Array = $ThirdPerson/Mesh/JetpackFX.get_children()
@onready var match_participant_component : MatchParticipantComponent = $MatchParticipantComponent
signal died(player : Player, killer_id : int)
signal energy_changed(energy : float)
var g : float = ProjectSettings.get_setting("physics/3d/default_gravity") # in m/s²
var gravity : Vector3 = g * ProjectSettings.get_setting("physics/3d/default_gravity_vector")
var _jumping : bool = false
@ -64,11 +64,14 @@ static var pawn_player : Player
func _ready() -> void:
match_participant_component.player_id_changed.connect(_setup_pawn)
match_participant_component.nickname_changed.connect(iff._on_username_changed)
match_participant_component.player_id_changed.connect(input.update_multiplayer_authority)
health_component.health_changed.connect(hud._on_health_changed)
health_component.health_changed.connect(iff._on_health_changed)
health_component.health_changed.emit(health_component.health)
health_component.health_zeroed.connect(die)
inventory.selection_changed.connect(_on_inventory_selection_changed)
input.fired_primary.connect(_trigger)
@ -76,16 +79,14 @@ func _ready() -> void:
input.throwed_flag.connect(_throw_flag)
func _process(_delta : float) -> void:
if _is_player_dead():
iff.hide()
return
else:
iff.show()
%Pivot.global_transform.basis = Basis.from_euler(Vector3(input.camera_rotation.y, input.camera_rotation.x, 0.0))
if not _is_pawn():
tp_mesh.global_transform.basis = Basis.from_euler(Vector3(.0, input.camera_rotation.x + PI, 0.0))
if match_participant_component and pawn_player:
if pawn_player.match_participant_component.team_id == match_participant_component.team_id:
iff.fill = Color.GREEN
else:
iff.fill = Color.RED
func _physics_process(delta : float) -> void:
_update_jetpack_energy(delta)
@ -95,8 +96,9 @@ func _setup_pawn(_new_player_id : int) -> void:
camera.current = true
camera.fov = Settings.get_value("video", "fov")
pawn_player = self
iff.hide()
else:
$Smoothing/ThirdPerson.show()
$ThirdPerson.show()
%Inventory.hide()
hud.hide()

View file

@ -1,11 +1,11 @@
[gd_scene load_steps=45 format=3 uid="uid://cbhx1xme0sb7k"]
[ext_resource type="Script" path="res://entities/player/player.gd" id="1_mk68k"]
[ext_resource type="PackedScene" uid="uid://bbeecp3jusppn" path="res://interfaces/hud/iffs/IFF.tscn" id="2_s5wgp"]
[ext_resource type="PackedScene" uid="uid://bcv81ku26xo" path="res://interfaces/hud/hud.tscn" id="3_ccety"]
[ext_resource type="Shape3D" uid="uid://cb8esdlnottdn" path="res://entities/player/resources/collider.tres" id="4_8kvcy"]
[ext_resource type="Script" path="res://entities/components/match_participant_component.gd" id="6_lrose"]
[ext_resource type="Script" path="res://entities/player/player_input.gd" id="6_ymcrr"]
[ext_resource type="PackedScene" uid="uid://dsysi2rd3bu76" path="res://interfaces/hud/iffs/iff.tscn" id="7_8hc80"]
[ext_resource type="Script" path="res://entities/components/inventory.gd" id="8_768qh"]
[ext_resource type="PackedScene" uid="uid://drbefw6akui2v" path="res://entities/player/vanguard.tscn" id="8_eiy7q"]
[ext_resource type="Script" path="res://entities/components/flag_carry_component.gd" id="8_pdfbn"]
@ -217,14 +217,18 @@ physics_material_override = SubResource("PhysicsMaterial_clur0")
can_sleep = false
continuous_cd = true
script = ExtResource("1_mk68k")
iff = NodePath("Smoothing/ThirdPerson/IFFAttachment/IFF")
iff = NodePath("IFF")
health_component = NodePath("HealthComponent")
flag_carry_component = NodePath("Pivot/FlagCarryComponent")
walkable_surface_sensor = NodePath("WalkableSurfaceSensor")
inventory = NodePath("Pivot/Inventory")
tp_mesh = NodePath("Smoothing/ThirdPerson/Mesh")
tp_mesh = NodePath("ThirdPerson/Mesh")
jump_height = 1.5
[node name="IFF" parent="." instance=ExtResource("2_s5wgp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.1, 0)
fill = Color(0, 1, 0, 1)
[node name="HealthComponent" type="Area3D" parent="." node_paths=PackedStringArray("match_participant_component")]
script = ExtResource("14_ctgxn")
match_participant_component = NodePath("../MatchParticipantComponent")
@ -300,19 +304,14 @@ mesh = NodePath("FlagMesh")
[node name="FlagMesh" parent="Pivot/FlagCarryComponent" instance=ExtResource("18_7nkei")]
[node name="Smoothing" type="Node3D" parent="."]
script = ExtResource("11_k330l")
target = NodePath("..")
flags = 3
[node name="ThirdPerson" type="Node3D" parent="Smoothing"]
[node name="ThirdPerson" type="Node3D" parent="."]
visible = false
[node name="Mesh" parent="Smoothing/ThirdPerson" node_paths=PackedStringArray("spine_ik_target_attachment") instance=ExtResource("8_eiy7q")]
[node name="Mesh" parent="ThirdPerson" node_paths=PackedStringArray("spine_ik_target_attachment") instance=ExtResource("8_eiy7q")]
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0)
spine_ik_target_attachment = NodePath("../../../Pivot/SpineIKTarget")
spine_ik_target_attachment = NodePath("../../Pivot/SpineIKTarget")
[node name="Skeleton3D" parent="Smoothing/ThirdPerson/Mesh/Node" index="0"]
[node name="Skeleton3D" parent="ThirdPerson/Mesh/Node" index="0"]
bones/0/position = Vector3(-0.0048219, 0.946668, 0.00678214)
bones/0/rotation = Quaternion(-0.0341192, -0.409249, -0.0209221, 0.911545)
bones/2/rotation = Quaternion(-0.00595832, -0.0014545, 0.0101407, 0.99993)
@ -365,52 +364,52 @@ bones/122/rotation = Quaternion(-0.494906, -0.0647935, 0.0183973, 0.866332)
bones/124/rotation = Quaternion(0.417677, -0.0431149, 0.00625689, 0.90755)
bones/126/rotation = Quaternion(0.397818, -0.0427722, -0.00601182, 0.916447)
[node name="HandAttachment" parent="Smoothing/ThirdPerson/Mesh/Node/Skeleton3D" index="0"]
[node name="HandAttachment" parent="ThirdPerson/Mesh/Node/Skeleton3D" index="0"]
transform = Transform3D(-0.152214, 0.0548832, 0.986823, 0.933991, 0.334546, 0.125459, -0.323252, 0.94078, -0.102183, -0.261612, 1.14328, 0.0896011)
[node name="grip" parent="Smoothing/ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/SpaceGun/Mesh/Armature/Skeleton3D" index="0"]
[node name="grip" parent="ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/SpaceGun/Mesh/Armature/Skeleton3D" index="0"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.84217e-14, 1.19209e-07, 2.38419e-07)
[node name="main" parent="Smoothing/ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/SpaceGun/Mesh/Armature/Skeleton3D" index="1"]
[node name="main" parent="ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/SpaceGun/Mesh/Armature/Skeleton3D" index="1"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.84217e-14, 1.19209e-07, 2.38419e-07)
[node name="sides" parent="Smoothing/ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/SpaceGun/Mesh/Armature/Skeleton3D" index="2"]
[node name="sides" parent="ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/SpaceGun/Mesh/Armature/Skeleton3D" index="2"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.84217e-14, 1.19209e-07, 2.38419e-07)
[node name="BarrelsInner" parent="Smoothing/ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/ChainGun/Armature/Skeleton3D" index="0"]
[node name="BarrelsInner" parent="ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/ChainGun/Armature/Skeleton3D" index="0"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.692504, 1.30946)
[node name="BarrelsOuter" parent="Smoothing/ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/ChainGun/Armature/Skeleton3D" index="1"]
[node name="BarrelsOuter" parent="ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/ChainGun/Armature/Skeleton3D" index="1"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.692504, 1.30946)
[node name="Base" parent="Smoothing/ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/ChainGun/Armature/Skeleton3D" index="2"]
[node name="Base" parent="ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/ChainGun/Armature/Skeleton3D" index="2"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.692504, 1.30946)
[node name="Grip" parent="Smoothing/ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/ChainGun/Armature/Skeleton3D" index="3"]
[node name="Grip" parent="ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/ChainGun/Armature/Skeleton3D" index="3"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.692504, 1.30946)
[node name="Barrels" parent="Smoothing/ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/ChainGun" index="3"]
[node name="Barrels" parent="ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/ChainGun" index="3"]
transform = Transform3D(-1, -1.49012e-08, 8.801e-08, 8.19564e-08, -3.72529e-09, 1, 0, 1, -7.45058e-09, 5.96046e-08, 0, -0.55315)
[node name="Skeleton3D" parent="Smoothing/ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/GrenadeLauncher/Armature" index="0"]
[node name="Skeleton3D" parent="ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/GrenadeLauncher/Armature" index="0"]
bones/0/rotation = Quaternion(0, 0.707107, 0.707107, 0)
bones/1/rotation = Quaternion(0, 0.707107, 0.707107, 0)
bones/2/rotation = Quaternion(0, 0.707107, 0.707107, 0)
bones/3/rotation = Quaternion(0, 0.707107, 0.707107, 0)
[node name="barrel" parent="Smoothing/ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/GrenadeLauncher/Armature/Skeleton3D" index="0"]
[node name="barrel" parent="ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/GrenadeLauncher/Armature/Skeleton3D" index="0"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.19209e-07, 0)
[node name="grip" parent="Smoothing/ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/GrenadeLauncher/Armature/Skeleton3D" index="1"]
[node name="grip" parent="ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/GrenadeLauncher/Armature/Skeleton3D" index="1"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.082471, -0.0653242)
[node name="main" parent="Smoothing/ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/GrenadeLauncher/Armature/Skeleton3D" index="2"]
[node name="main" parent="ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/GrenadeLauncher/Armature/Skeleton3D" index="2"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.19209e-07, 0)
[node name="JetpackFX" type="Node3D" parent="Smoothing/ThirdPerson/Mesh"]
[node name="JetpackFX" type="Node3D" parent="ThirdPerson/Mesh"]
transform = Transform3D(0.467164, -0.312366, -0.827155, -0.12476, 0.902867, -0.41142, 0.875325, 0.295397, 0.382816, 0.143745, 0.353192, -0.140279)
[node name="Smoke1" type="GPUParticles3D" parent="Smoothing/ThirdPerson/Mesh/JetpackFX"]
[node name="Smoke1" type="GPUParticles3D" parent="ThirdPerson/Mesh/JetpackFX"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.150648, 0)
emitting = false
lifetime = 0.5
@ -419,7 +418,7 @@ fixed_fps = 60
process_material = SubResource("ParticleProcessMaterial_v556h")
draw_pass_1 = SubResource("QuadMesh_hegkl")
[node name="Smoke2" type="GPUParticles3D" parent="Smoothing/ThirdPerson/Mesh/JetpackFX"]
[node name="Smoke2" type="GPUParticles3D" parent="ThirdPerson/Mesh/JetpackFX"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.108846, 0)
emitting = false
lifetime = 0.5
@ -428,7 +427,7 @@ fixed_fps = 60
process_material = SubResource("ParticleProcessMaterial_l8e6j")
draw_pass_1 = SubResource("QuadMesh_aeure")
[node name="Fire1" type="GPUParticles3D" parent="Smoothing/ThirdPerson/Mesh/JetpackFX"]
[node name="Fire1" type="GPUParticles3D" parent="ThirdPerson/Mesh/JetpackFX"]
emitting = false
amount = 16
lifetime = 0.3
@ -437,20 +436,15 @@ fixed_fps = 60
process_material = SubResource("ParticleProcessMaterial_q1vdw")
draw_pass_1 = SubResource("QuadMesh_uc7ts")
[node name="IFFAttachment" type="Marker3D" parent="Smoothing/ThirdPerson"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.27457, 0)
visible = false
[node name="IFF" parent="Smoothing/ThirdPerson/IFFAttachment" node_paths=PackedStringArray("player", "match_participant_component", "attach_point") instance=ExtResource("7_8hc80")]
visible = false
player = NodePath("../../../..")
match_participant_component = NodePath("../../../../MatchParticipantComponent")
attach_point = NodePath("..")
[node name="Smoothing" type="Node3D" parent="."]
script = ExtResource("11_k330l")
target = NodePath("..")
flags = 3
[connection signal="energy_changed" from="." to="HUD" method="_on_player_energy_changed"]
[editable path="Smoothing/ThirdPerson/Mesh"]
[editable path="Smoothing/ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/SpaceGun"]
[editable path="Smoothing/ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/SpaceGun/Mesh"]
[editable path="Smoothing/ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/ChainGun"]
[editable path="Smoothing/ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/GrenadeLauncher"]
[editable path="ThirdPerson/Mesh"]
[editable path="ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/SpaceGun"]
[editable path="ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/SpaceGun/Mesh"]
[editable path="ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/ChainGun"]
[editable path="ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/GrenadeLauncher"]