mirror of
https://gitlab.com/open-fpsz/open-fpsz.git
synced 2026-07-16 00:44:50 +00:00
🐛 Refactored AreaDamageComponent to be an ExplosiveDamageComponent
This commit is contained in:
parent
dc7896a591
commit
49a59e8c31
12 changed files with 1331 additions and 1340 deletions
|
|
@ -1,22 +1,9 @@
|
|||
extends Node3D
|
||||
|
||||
@onready var fire = $Fire
|
||||
@onready var area_damage : AreaDamageComponent = $AreaDamageComponent
|
||||
@onready var explosive_damage : ExplosiveDamageComponent = $ExplosiveDamageComponent
|
||||
var explosion_effect_pending : bool = false
|
||||
|
||||
const impulse_force = 1000;
|
||||
|
||||
func _ready():
|
||||
fire.emitting = true
|
||||
|
||||
func _physics_process(_delta):
|
||||
var bodies = area_damage.get_overlapping_bodies() if area_damage.monitoring else []
|
||||
for body in bodies:
|
||||
if body is RigidBody3D:
|
||||
var direction = (body.global_position - global_position).normalized()
|
||||
body.apply_central_impulse(direction * impulse_force)
|
||||
|
||||
area_damage.monitorable = false
|
||||
area_damage.monitoring = false
|
||||
await get_tree().create_timer(1.0).timeout
|
||||
queue_free()
|
||||
fire.finished.connect(func(): queue_free())
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
[gd_scene load_steps=9 format=3 uid="uid://8atq41j7wd55"]
|
||||
|
||||
[ext_resource type="Script" path="res://weapons/space_gun/projectile_explosion.gd" id="1_fp5td"]
|
||||
[ext_resource type="PackedScene" uid="uid://ds1hekx1dq1bg" path="res://components/area_damage_component.tscn" id="2_reyvo"]
|
||||
[ext_resource type="PackedScene" uid="uid://ds1hekx1dq1bg" path="res://components/explosive_damage_component.tscn" id="2_d4sf4"]
|
||||
|
||||
[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]
|
||||
|
|
@ -41,8 +41,8 @@ fixed_fps = 60
|
|||
process_material = SubResource("ParticleProcessMaterial_3mf41")
|
||||
draw_pass_1 = SubResource("SphereMesh_k3pnh")
|
||||
|
||||
[node name="AreaDamageComponent" parent="." instance=ExtResource("2_reyvo")]
|
||||
[node name="ExplosiveDamageComponent" parent="." instance=ExtResource("2_d4sf4")]
|
||||
damage = 35
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="AreaDamageComponent"]
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="ExplosiveDamageComponent"]
|
||||
shape = SubResource("SphereShape3D_mlo2k")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue