WIP: Damage/frag system is implemented without ragdolls

This commit is contained in:
2025-02-03 23:03:36 +01:00
parent 7012846b00
commit b63b7a7d09
31 changed files with 5748 additions and 4972 deletions

View File

@ -3,14 +3,10 @@ class_name HitDetector
var health = 5
@export var color: Color = Color(0, 0, 0)
@export var color: Color = Color(0.0, 0.0, 0.0, 0)
var colors = [Color(1.0, 0.0, 0.0, 1.0),
Color(0.0, 1.0, 0.0, 1.0),
Color(0.0, 0.0, 1.0, 0.0)]
func hit(damage: int):
color = Color(randf(), randf(), randf())
color = Color(randf(), randf(), randf(), randi())
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
@ -19,6 +15,6 @@ func _ready() -> void:
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
material_override.albedo_color = color
material.albedo_color = color
if health < 1:
queue_free()

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=5 format=3 uid="uid://cdcbn8mglqlyh"]
[gd_scene load_steps=4 format=3 uid="uid://cdcbn8mglqlyh"]
[ext_resource type="Script" path="res://scenes/maps/tools/hit_detector.gd" id="1_4w4v8"]
@ -7,9 +7,7 @@ properties/0/path = NodePath("Box:color")
properties/0/spawn = true
properties/0/replication_mode = 1
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_petk4"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_5m44n"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_r26tj"]
[node name="HitDetector" type="Node3D"]
@ -17,8 +15,7 @@ properties/0/replication_mode = 1
replication_config = SubResource("SceneReplicationConfig_8tws6")
[node name="Box" type="CSGBox3D" parent="." groups=["target"]]
material_override = SubResource("StandardMaterial3D_petk4")
use_collision = true
collision_layer = 9
material = SubResource("StandardMaterial3D_5m44n")
material = SubResource("StandardMaterial3D_r26tj")
script = ExtResource("1_4w4v8")