mirror of
https://gitlab.com/open-fpsz/open-fpsz.git
synced 2026-07-15 16:34:48 +00:00
Merge branch 'develop' into feat/settings
This commit is contained in:
commit
76c970d5b7
29 changed files with 301 additions and 164 deletions
39
entities/components/explosive_damage_component.gd
Normal file
39
entities/components/explosive_damage_component.gd
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
# This file is part of open-fpsz.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
class_name ExplosiveDamageComponent extends Area3D
|
||||
|
||||
@export var damage : int = 35
|
||||
@export var impulse_force : int = 1000
|
||||
var damage_dealer : MatchParticipantComponent
|
||||
|
||||
func _ready() -> void:
|
||||
# this component only scans to apply explosion damage/impulse
|
||||
# at the moment layers: 1 Object, 3 Damage, 4 Objective
|
||||
monitorable = false
|
||||
monitoring = true
|
||||
collision_mask = 0b10000000_00000000_00000000_00001101
|
||||
|
||||
func _physics_process(_delta : float) -> void:
|
||||
for body in get_overlapping_bodies():
|
||||
if body is RigidBody3D:
|
||||
var center_of_mass_global_position : Vector3 = body.center_of_mass + body.global_position
|
||||
var direction : Vector3 = ( center_of_mass_global_position - global_position).normalized()
|
||||
body.apply_central_impulse(direction * impulse_force)
|
||||
|
||||
for area in get_overlapping_areas():
|
||||
if area is HealthComponent and is_multiplayer_authority():
|
||||
(area as HealthComponent).damage.rpc(damage, damage_dealer.player_id, damage_dealer.team_id)
|
||||
|
||||
set_physics_process(false)
|
||||
62
entities/components/flag_carry_component.gd
Normal file
62
entities/components/flag_carry_component.gd
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
# This file is part of open-fpsz.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
class_name FlagCarryComponent extends Node3D
|
||||
## This component allows its entity to grab, carry and throw flags
|
||||
##
|
||||
## To work correctly the owner MUST set an attachment point for carried flags
|
||||
## and a sensor to detect when flags are within grab range
|
||||
|
||||
@export var max_throw_speed : float = 10.0
|
||||
@export var sensor : Area3D
|
||||
@export var carrier : Player
|
||||
|
||||
var _carried_flag : Flag
|
||||
|
||||
func _ready() -> void:
|
||||
sensor.body_entered.connect(_sensor_on_body_entered)
|
||||
|
||||
func _physics_process(_delta : float) -> void:
|
||||
if _is_carrying():
|
||||
_carried_flag.global_position = global_position
|
||||
_carried_flag.global_rotation = global_rotation
|
||||
|
||||
func _grab(flag : Flag) -> void:
|
||||
if not _is_carrying():
|
||||
flag.grab(carrier)
|
||||
_carried_flag = flag
|
||||
show()
|
||||
|
||||
func _release(inherited_velocity : Vector3, throw_speed : float, dropper : Player) -> void:
|
||||
if _is_carrying():
|
||||
_carried_flag.drop(dropper)
|
||||
_carried_flag.rotation_degrees.x = 0.0
|
||||
_carried_flag.linear_velocity = inherited_velocity + (global_basis.z * throw_speed)
|
||||
# Throw the flag from some distance in front of the player to avoid regrabbing mid-air
|
||||
_carried_flag.global_position = carrier.global_position + (global_basis.z * 1.7)
|
||||
_carried_flag = null
|
||||
hide()
|
||||
|
||||
func _is_carrying() -> bool:
|
||||
return _carried_flag != null
|
||||
|
||||
func _sensor_on_body_entered(collider : Flag) -> void:
|
||||
if collider is Flag:
|
||||
_grab(collider)
|
||||
|
||||
func drop(dropper : Player) -> void:
|
||||
_release(Vector3.ZERO, 0.0, dropper)
|
||||
|
||||
func throw(inherited_velocity : Vector3, dropper : Player) -> void:
|
||||
_release(inherited_velocity, max_throw_speed, dropper)
|
||||
51
entities/components/health_component.gd
Normal file
51
entities/components/health_component.gd
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
# This file is part of open-fpsz.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
class_name HealthComponent extends Area3D
|
||||
|
||||
@export var max_health : float = 100.0
|
||||
@export var health : float = 100.0:
|
||||
set(value):
|
||||
health = value
|
||||
health_changed.emit(value)
|
||||
@export var match_participant_component : MatchParticipantComponent
|
||||
|
||||
signal health_zeroed(killer_id : int)
|
||||
signal health_changed(value : float)
|
||||
|
||||
func _ready() -> void:
|
||||
# only collide with the "Damage" layer, disable monitoring completely
|
||||
collision_layer = 0b00000000_00000000_00000000_00000100
|
||||
monitoring = false
|
||||
collision_mask = 0
|
||||
heal_full()
|
||||
|
||||
@rpc("call_local", "reliable")
|
||||
func damage(amount : float, damage_dealer_player_id : int, damage_dealer_team_id : int) -> void:
|
||||
if (damage_dealer_team_id == match_participant_component.team_id) and (damage_dealer_player_id != match_participant_component.player_id):
|
||||
return
|
||||
|
||||
health = clampf(health - amount, 0.0, max_health)
|
||||
if health == 0.0:
|
||||
health_zeroed.emit(damage_dealer_player_id)
|
||||
|
||||
@rpc("call_local", "reliable")
|
||||
func _heal(amount : float) -> void:
|
||||
health = clampf(health + amount, 0.0, max_health)
|
||||
|
||||
func heal_full() -> void:
|
||||
if not is_multiplayer_authority():
|
||||
return
|
||||
|
||||
_heal.rpc(max_health)
|
||||
26
entities/components/match_participant_component.gd
Normal file
26
entities/components/match_participant_component.gd
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
class_name MatchParticipantComponent extends MultiplayerSynchronizer
|
||||
|
||||
signal player_id_changed(new_player_id : int)
|
||||
signal nickname_changed(new_nickname : String)
|
||||
|
||||
@export var player_id : int:
|
||||
set(value):
|
||||
player_id = value
|
||||
player_id_changed.emit(player_id)
|
||||
@export var team_id : int = 1
|
||||
@export var nickname : String = "<Newblood>":
|
||||
set(value):
|
||||
nickname = value
|
||||
nickname_changed.emit(nickname)
|
||||
|
||||
func _ready() -> void:
|
||||
replication_config = SceneReplicationConfig.new()
|
||||
root_path = "."
|
||||
|
||||
_set_replication_for(NodePath("player_id").get_as_property_path())
|
||||
_set_replication_for(NodePath("team_id").get_as_property_path())
|
||||
_set_replication_for(NodePath("nickname").get_as_property_path())
|
||||
|
||||
func _set_replication_for(property_node_path : NodePath) -> void:
|
||||
replication_config.add_property(property_node_path)
|
||||
replication_config.property_set_replication_mode(property_node_path, SceneReplicationConfig.REPLICATION_MODE_ON_CHANGE)
|
||||
|
|
@ -5,7 +5,7 @@ enum FlagState { FLAG_STATE_ON_STAND, FLAG_STATE_DROPPED, FLAG_STATE_TAKEN }
|
|||
@export var flag_state : FlagState = FlagState.FLAG_STATE_ON_STAND
|
||||
|
||||
signal grabbed(grabber : Player)
|
||||
signal regrabbed
|
||||
signal regrabbed(grabber : Player)
|
||||
signal dropped(dropper : Player)
|
||||
|
||||
var last_carrier : Player = null
|
||||
|
|
@ -22,7 +22,7 @@ func grab(grabber : Player) -> void:
|
|||
grabbed.emit(grabber)
|
||||
last_carrier = grabber
|
||||
else:
|
||||
regrabbed.emit()
|
||||
regrabbed.emit(grabber)
|
||||
|
||||
func drop(dropper : Player) -> void:
|
||||
if flag_state == FlagState.FLAG_STATE_TAKEN:
|
||||
|
|
|
|||
|
|
@ -35,12 +35,6 @@ enum PlayerState { PLAYER_ALIVE, PLAYER_DEAD }
|
|||
|
||||
@export_group("State")
|
||||
@export var player_state : PlayerState = PlayerState.PLAYER_ALIVE
|
||||
@export var player_id : int = 1:
|
||||
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
|
||||
@onready var camera : Camera3D = $Smoothing/SpringArm3D/Camera3D
|
||||
|
|
@ -55,25 +49,26 @@ enum PlayerState { PLAYER_ALIVE, PLAYER_DEAD }
|
|||
@onready var _original_weapon_transform : Transform3D = weapon.transform
|
||||
@onready var tp_player : Vanguard = $Smoothing/ThirdPerson/PlayerMesh
|
||||
@onready var jetpack_particles : Array = $Smoothing/ThirdPerson/PlayerMesh/JetpackFX.get_children()
|
||||
@onready var match_participant_component : MatchParticipantComponent = $MatchParticipantComponent
|
||||
|
||||
signal died(player : Player, killer_id : int)
|
||||
signal energy_changed(energy : float)
|
||||
|
||||
static var pawn_player : Player
|
||||
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
|
||||
|
||||
@rpc("call_local", "reliable")
|
||||
func set_nickname(value : String) -> void:
|
||||
nickname = value
|
||||
|
||||
func _ready() -> void:
|
||||
energy_changed.connect(hud._on_energy_changed)
|
||||
match_participant_component.player_id_changed.connect(_setup_pawn)
|
||||
match_participant_component.player_id_changed.connect(input.update_multiplayer_authority)
|
||||
match_participant_component.nickname_changed.connect(iff.set_nickname)
|
||||
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)
|
||||
|
||||
energy_changed.connect(hud._on_energy_changed)
|
||||
input.fired_primary.connect(_fire_primary)
|
||||
input.jumped.connect(_jump)
|
||||
input.throwed_flag.connect(_throw_flag)
|
||||
|
|
@ -81,21 +76,22 @@ func _ready() -> void:
|
|||
input.MOUSE_SENSITIVITY = Settings.get_value("controls", "mouse_sensitivity")
|
||||
input.inverted_y_axis = Settings.get_value("controls", "inverted_y_axis")
|
||||
|
||||
func _setup_pawn(_new_player_id : int) -> void:
|
||||
if _is_pawn():
|
||||
camera.current = true
|
||||
camera.fov = Settings.get_value("video", "fov")
|
||||
pawn_player = self
|
||||
# set the spring arm translation to be about head height level
|
||||
$Smoothing/SpringArm3D.transform = Transform3D().translated(Vector3(0, collision_shape.shape.height / 2, 0) * 0.9)
|
||||
|
||||
$Smoothing.remove_child($Smoothing/ThirdPerson)
|
||||
$Smoothing/ThirdPerson.hide()
|
||||
else:
|
||||
# set the iff attachment translation to be about head height level
|
||||
$Smoothing/ThirdPerson/IFFAttachment.transform = Transform3D().translated(Vector3(0, collision_shape.shape.height / 2, 0) * 0.9)
|
||||
remove_child(hud)
|
||||
hud.hide()
|
||||
weapon.hide()
|
||||
|
||||
func _is_pawn() -> bool:
|
||||
return player_id == multiplayer.get_unique_id()
|
||||
return multiplayer.get_unique_id() == match_participant_component.player_id
|
||||
|
||||
func _fire_primary() -> void:
|
||||
if _is_player_dead():
|
||||
|
|
|
|||
|
|
@ -1,18 +1,19 @@
|
|||
[gd_scene load_steps=41 format=3 uid="uid://cbhx1xme0sb7k"]
|
||||
[gd_scene load_steps=42 format=3 uid="uid://cbhx1xme0sb7k"]
|
||||
|
||||
[ext_resource type="Script" path="res://entities/player/player.gd" id="1_mk68k"]
|
||||
[ext_resource type="PackedScene" uid="uid://drbefw6akui2v" path="res://entities/player/assets/vanguard.tscn" id="2_beyex"]
|
||||
[ext_resource type="Shape3D" uid="uid://cb8esdlnottdn" path="res://entities/player/collision_shape.tres" id="2_vjqny"]
|
||||
[ext_resource type="PackedScene" uid="uid://bcv81ku26xo" path="res://interfaces/hud/hud.tscn" id="3_ccety"]
|
||||
[ext_resource type="PackedScene" uid="uid://c8co0qa2omjmh" path="res://entities/weapons/space_gun/space_gun.tscn" id="4_6jh57"]
|
||||
[ext_resource type="PackedScene" uid="uid://bof3mg7wgxrmn" path="res://components/health_component.tscn" id="5_t6i6e"]
|
||||
[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="PackedScene" uid="uid://2t8ql8pkxv6c" path="res://components/flag_carry_component.tscn" id="7_e7s1a"]
|
||||
[ext_resource type="Script" path="res://entities/components/flag_carry_component.gd" id="8_pdfbn"]
|
||||
[ext_resource type="PackedScene" uid="uid://d3l7fvbdg6m5g" path="res://entities/flag/assets/flag.glb" id="9_fce2y"]
|
||||
[ext_resource type="Script" path="res://addons/smoothing/smoothing.gd" id="11_k330l"]
|
||||
[ext_resource type="Texture2D" uid="uid://ct1v5iadtpadm" path="res://entities/player/assets/jetpackfx/smoke_01.png" id="12_ypuho"]
|
||||
[ext_resource type="Texture2D" uid="uid://doxo4vfn0bjlp" path="res://entities/player/assets/jetpackfx/smoke_02.png" id="13_wvbf0"]
|
||||
[ext_resource type="Script" path="res://entities/components/health_component.gd" id="14_ctgxn"]
|
||||
[ext_resource type="Texture2D" uid="uid://dmf12llra7aq5" path="res://entities/player/assets/jetpackfx/Particle01.png" id="14_vughy"]
|
||||
|
||||
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_clur0"]
|
||||
|
|
@ -65,21 +66,12 @@ properties/0/replication_mode = 1
|
|||
properties/1/path = NodePath(".:position")
|
||||
properties/1/spawn = true
|
||||
properties/1/replication_mode = 1
|
||||
properties/2/path = NodePath(".:player_id")
|
||||
properties/2/path = NodePath("HealthComponent:health")
|
||||
properties/2/spawn = true
|
||||
properties/2/replication_mode = 2
|
||||
properties/3/path = NodePath("HealthComponent:health")
|
||||
properties/3/path = NodePath(".:player_state")
|
||||
properties/3/spawn = true
|
||||
properties/3/replication_mode = 2
|
||||
properties/4/path = NodePath(".:player_state")
|
||||
properties/4/spawn = true
|
||||
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")
|
||||
|
|
@ -238,14 +230,15 @@ monitorable = false
|
|||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Sensor"]
|
||||
shape = ExtResource("2_vjqny")
|
||||
|
||||
[node name="HUD" parent="." instance=ExtResource("3_ccety")]
|
||||
|
||||
[node name="HealthComponent" parent="." node_paths=PackedStringArray("_player") instance=ExtResource("5_t6i6e")]
|
||||
_player = NodePath("..")
|
||||
[node name="HealthComponent" type="Area3D" parent="." node_paths=PackedStringArray("match_participant_component")]
|
||||
script = ExtResource("14_ctgxn")
|
||||
match_participant_component = NodePath("../MatchParticipantComponent")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="HealthComponent"]
|
||||
shape = ExtResource("2_vjqny")
|
||||
|
||||
[node name="HUD" parent="." instance=ExtResource("3_ccety")]
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_hg307")
|
||||
|
|
@ -261,6 +254,9 @@ root_path = NodePath(".")
|
|||
replication_config = SubResource("SceneReplicationConfig_5j4ew")
|
||||
script = ExtResource("6_ymcrr")
|
||||
|
||||
[node name="MatchParticipantComponent" type="MultiplayerSynchronizer" parent="."]
|
||||
script = ExtResource("6_lrose")
|
||||
|
||||
[node name="Smoothing" type="Node3D" parent="."]
|
||||
script = ExtResource("11_k330l")
|
||||
target = NodePath("..")
|
||||
|
|
@ -280,19 +276,20 @@ unique_name_in_owner = true
|
|||
|
||||
[node name="SpaceGun" parent="Smoothing/SpringArm3D/Inventory" node_paths=PackedStringArray("holder") instance=ExtResource("4_6jh57")]
|
||||
transform = Transform3D(-1, 0, 2.53518e-06, 0, 1, 0, -2.53518e-06, 0, -1, 0.15, -0.3, -0.55)
|
||||
holder = NodePath("../../../..")
|
||||
holder = NodePath("../../../../MatchParticipantComponent")
|
||||
|
||||
[node name="SpineIKTarget" type="Node3D" parent="Smoothing/SpringArm3D"]
|
||||
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0)
|
||||
|
||||
[node name="FlagCarryComponent" parent="Smoothing/SpringArm3D" node_paths=PackedStringArray("sensor", "carrier") instance=ExtResource("7_e7s1a")]
|
||||
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0.150603)
|
||||
[node name="FlagCarryComponent" type="Node3D" parent="Smoothing/SpringArm3D" node_paths=PackedStringArray("sensor", "carrier")]
|
||||
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0)
|
||||
visible = false
|
||||
script = ExtResource("8_pdfbn")
|
||||
sensor = NodePath("../../../Sensor")
|
||||
carrier = NodePath("../../..")
|
||||
|
||||
[node name="FlagMesh" parent="Smoothing/SpringArm3D/FlagCarryComponent" instance=ExtResource("9_fce2y")]
|
||||
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, -0.602515, 0)
|
||||
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 1.559e-08, -0.462981, -0.178329)
|
||||
|
||||
[node name="ThirdPerson" type="Node3D" parent="Smoothing"]
|
||||
|
||||
|
|
@ -330,6 +327,7 @@ 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)
|
||||
|
||||
[node name="IFF" parent="Smoothing/ThirdPerson" node_paths=PackedStringArray("player", "attach_point") instance=ExtResource("7_8hc80")]
|
||||
[node name="IFF" parent="Smoothing/ThirdPerson" node_paths=PackedStringArray("player", "match_participant_component", "attach_point") instance=ExtResource("7_8hc80")]
|
||||
player = NodePath("../../..")
|
||||
match_participant_component = NodePath("../../../MatchParticipantComponent")
|
||||
attach_point = NodePath("../IFFAttachment")
|
||||
|
|
|
|||
|
|
@ -26,6 +26,10 @@ signal fired_primary
|
|||
signal throwed_flag
|
||||
|
||||
func _ready() -> void:
|
||||
update_multiplayer_authority(0)
|
||||
|
||||
func update_multiplayer_authority(player_id : int) -> void:
|
||||
set_multiplayer_authority(player_id)
|
||||
var has_authority : bool = is_multiplayer_authority()
|
||||
set_process(has_authority)
|
||||
set_process_unhandled_input(has_authority)
|
||||
|
|
|
|||
|
|
@ -16,13 +16,11 @@ class_name DummyTarget extends RigidBody3D
|
|||
|
||||
@export var respawn_time := 0.0 # seconds
|
||||
|
||||
@onready var health_component: HealthComponent = $HealthComponent
|
||||
@onready var collision_shape_3d: CollisionShape3D = $CollisionShape3D
|
||||
|
||||
var start_pos : Vector3
|
||||
|
||||
func _ready() -> void:
|
||||
health_component.health_zeroed.connect(spawn)
|
||||
start_pos = global_position
|
||||
$TargetMesh/AnimationPlayer.play("gunTwoHanded")
|
||||
|
||||
|
|
@ -30,7 +28,6 @@ func spawn(_killer_id : int) -> void:
|
|||
hide()
|
||||
collision_shape_3d.disabled = true
|
||||
await get_tree().create_timer(respawn_time).timeout
|
||||
health_component.heal_full()
|
||||
global_position = start_pos
|
||||
show()
|
||||
collision_shape_3d.disabled = false
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://dpnu1lvfncx6q"]
|
||||
[gd_scene load_steps=4 format=3 uid="uid://dpnu1lvfncx6q"]
|
||||
|
||||
[ext_resource type="Script" path="res://entities/target_dummy/target_dummy.gd" id="1_iup5v"]
|
||||
[ext_resource type="Shape3D" uid="uid://cb8esdlnottdn" path="res://entities/player/collision_shape.tres" id="2_i5k5j"]
|
||||
[ext_resource type="PackedScene" uid="uid://chuein4frnvwt" path="res://entities/target_dummy/assets/player_mesh.glb" id="4_fuync"]
|
||||
[ext_resource type="PackedScene" uid="uid://bof3mg7wgxrmn" path="res://components/health_component.tscn" id="4_l1exy"]
|
||||
|
||||
[node name="DummyTarget" type="RigidBody3D"]
|
||||
collision_layer = 2147483649
|
||||
|
|
@ -19,7 +18,5 @@ script = ExtResource("1_iup5v")
|
|||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
|
||||
shape = ExtResource("2_i5k5j")
|
||||
|
||||
[node name="HealthComponent" parent="." instance=ExtResource("4_l1exy")]
|
||||
|
||||
[node name="TargetMesh" parent="." instance=ExtResource("4_fuync")]
|
||||
transform = Transform3D(0.75, 0, 0, 0, 0.75, 0, 0, 0, 0.75, 0, 0, 0)
|
||||
|
|
|
|||
|
|
@ -25,9 +25,10 @@ class_name Projectile extends Node3D
|
|||
@onready var projectile_trail : Trail3D = $Smoothing/ProjectileTrail
|
||||
|
||||
var velocity : Vector3 = Vector3.ZERO
|
||||
var shooter : Player
|
||||
var shooter : MatchParticipantComponent
|
||||
|
||||
func _ready() -> void:
|
||||
assert(shooter)
|
||||
var lifespan_timer : Timer = Timer.new()
|
||||
lifespan_timer.wait_time = lifespan
|
||||
lifespan_timer.one_shot = true
|
||||
|
|
|
|||
|
|
@ -14,13 +14,14 @@
|
|||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
extends Node3D
|
||||
|
||||
var shooter : Player
|
||||
var shooter : MatchParticipantComponent
|
||||
|
||||
@onready var fire : GPUParticles3D = $Fire
|
||||
@onready var explosive_damage : ExplosiveDamageComponent = $ExplosiveDamageComponent
|
||||
var explosion_effect_pending : bool = false
|
||||
|
||||
func _ready() -> void:
|
||||
assert(shooter)
|
||||
explosive_damage.damage_dealer = shooter
|
||||
fire.emitting = true
|
||||
fire.finished.connect(func() -> void: queue_free())
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
[gd_scene load_steps=9 format=3 uid="uid://8atq41j7wd55"]
|
||||
|
||||
[ext_resource type="Script" path="res://entities/weapons/space_gun/projectile_explosion.gd" id="1_fp5td"]
|
||||
[ext_resource type="PackedScene" uid="uid://ds1hekx1dq1bg" path="res://components/explosive_damage_component.tscn" id="2_d4sf4"]
|
||||
[ext_resource type="Script" path="res://entities/components/explosive_damage_component.gd" id="2_28ymv"]
|
||||
|
||||
[sub_resource type="Curve" id="Curve_rg204"]
|
||||
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
|
||||
|
|
@ -25,7 +25,8 @@ emission_energy_multiplier = 4.0
|
|||
[sub_resource type="SphereMesh" id="SphereMesh_k3pnh"]
|
||||
material = SubResource("StandardMaterial3D_wpu51")
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_mlo2k"]
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_nj68w"]
|
||||
margin = 0.05
|
||||
radius = 5.0
|
||||
|
||||
[node name="ProjectileExplosion" type="Node3D"]
|
||||
|
|
@ -41,8 +42,8 @@ fixed_fps = 60
|
|||
process_material = SubResource("ParticleProcessMaterial_3mf41")
|
||||
draw_pass_1 = SubResource("SphereMesh_k3pnh")
|
||||
|
||||
[node name="ExplosiveDamageComponent" parent="." instance=ExtResource("2_d4sf4")]
|
||||
damage = 35
|
||||
[node name="ExplosiveDamageComponent" type="Area3D" parent="."]
|
||||
script = ExtResource("2_28ymv")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="ExplosiveDamageComponent"]
|
||||
shape = SubResource("SphereShape3D_mlo2k")
|
||||
shape = SubResource("SphereShape3D_nj68w")
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ extends Node3D
|
|||
class_name SpaceGun
|
||||
|
||||
@export var PROJECTILE : PackedScene
|
||||
@export var holder : Player
|
||||
@export var holder : MatchParticipantComponent
|
||||
|
||||
@onready var nozzle : Node3D = $Nozzle
|
||||
@onready var inventory : Node3D = get_parent()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue