fixed hp based plants

This commit is contained in:
Rendo 2025-07-13 15:36:52 +05:00
commit f351e53a03
7 changed files with 261 additions and 36 deletions

View file

@ -0,0 +1,16 @@
[gd_resource type="Resource" script_class="ZombieResource" load_steps=3 format=3 uid="uid://cugwy5bw4wljr"]
[ext_resource type="PackedScene" uid="uid://p5jhgg2r7e07" path="res://scenes/entities/Zombies/door_zombie.tscn" id="1_3664b"]
[ext_resource type="Script" uid="uid://cqxj7o8hdm82n" path="res://scripts/resources/ZombieResource.cs" id="3_bydiv"]
[resource]
script = ExtResource("3_bydiv")
name_key = "doorz"
description_key = "doorz_desc"
Cost = 4.5
Scene = ExtResource("1_3664b")
ReloadTime = 1.0
ReloadProgress = 0.0
Layer = 1
Order = 4
metadata/_custom_type_script = "uid://cqxj7o8hdm82n"

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=15 format=3 uid="uid://hhjbqkjqpt7x"]
[gd_scene load_steps=16 format=3 uid="uid://hhjbqkjqpt7x"]
[ext_resource type="PackedScene" uid="uid://co11v3w8hbwgf" path="res://scenes/entities/Zombies/zombie.tscn" id="1_3dq4c"]
[ext_resource type="Shader" uid="uid://d0eo5uuj222c4" path="res://assets/shaders/CG_color_blender.gdshader" id="2_2dq8e"]
@ -20,6 +20,13 @@ shader_parameter/amount = 0.0
[sub_resource type="CircleShape2D" id="CircleShape2D_67t4t"]
[sub_resource type="Resource" id="Resource_011r0"]
resource_local_to_scene = true
script = ExtResource("4_qof5v")
flat_value = 5.0
percentage_value = 0.0
mult_value = 1.0
[sub_resource type="Resource" id="Resource_b6mal"]
resource_local_to_scene = true
script = ExtResource("4_qof5v")
@ -34,48 +41,53 @@ _armor = NodePath("Armor")
material = SubResource("ShaderMaterial_sat5k")
[node name="RightUpperLeg" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt" index="1"]
scale = Vector2(0.999835, 0.999835)
scale = Vector2(0.999832, 0.999832)
[node name="RightLowerLeg" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/RightUpperLeg" index="1"]
scale = Vector2(0.999834, 0.999834)
scale = Vector2(0.999835, 0.999835)
[node name="RightFoot" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/RightUpperLeg/RightLowerLeg" index="0"]
scale = Vector2(0.999832, 0.999832)
scale = Vector2(0.999836, 0.999836)
[node name="LeftUpperLeg" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt" index="2"]
scale = Vector2(0.999834, 0.999834)
[node name="LeftLowerLeg" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/LeftUpperLeg" index="1"]
scale = Vector2(0.999835, 0.999835)
scale = Vector2(0.999836, 0.999836)
[node name="LeftFoot" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/LeftUpperLeg/LeftLowerLeg" index="1"]
scale = Vector2(0.99983, 0.99983)
scale = Vector2(0.999828, 0.999828)
[node name="Body" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt" index="3"]
scale = Vector2(0.999829, 0.999829)
[node name="RightUpperArm" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body" index="0"]
scale = Vector2(0.999826, 0.999826)
scale = Vector2(0.99983, 0.99983)
[node name="RightLowerArm" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/RightUpperArm" index="1"]
scale = Vector2(0.999826, 0.999826)
scale = Vector2(0.99983, 0.99983)
[node name="RightHand" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/RightUpperArm/RightLowerArm" index="0"]
scale = Vector2(0.99983, 0.99983)
[node name="Tie" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body" index="2"]
rotation = 0.16518
skew = -9.81092e-05
rotation = -0.146474
skew = -9.9659e-05
[node name="Head" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body" index="3"]
scale = Vector2(0.999827, 0.999827)
[node name="Right_Eye" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/Head/HeadParticle/Head" index="0"]
position = Vector2(-16, -8.00001)
position = Vector2(-16, -7.99999)
scale = Vector2(1, 1)
[node name="Left_Eye" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/Head/HeadParticle/Head" index="1"]
position = Vector2(-4, -9)
scale = Vector2(1, 1)
[node name="Jaw" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/Head/HeadParticle/Head" index="2"]
position = Vector2(-2.99036, 2.96833)
rotation = 0.0171523
position = Vector2(-2.8181, 2.56097)
rotation = -0.102313
scale = Vector2(0.999828, 0.999828)
[node name="Jaw" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/Head" index="1"]
@ -109,26 +121,29 @@ position = Vector2(1, -6)
shape = SubResource("CircleShape2D_67t4t")
[node name="LeftUpperArm" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body" index="4"]
scale = Vector2(0.999829, 0.999829)
scale = Vector2(0.999827, 0.999827)
[node name="Left_Lower_Arm" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/LeftUpperArm/HandProjectile" index="0"]
rotation = 0.160346
scale = Vector2(0.999999, 0.999999)
rotation = -0.15525
scale = Vector2(1, 1)
[node name="Left_Hand" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/LeftUpperArm/HandProjectile/Left_Lower_Arm" index="0"]
position = Vector2(-0.99983, 12.9978)
rotation = -0.0733402
scale = Vector2(0.999659, 0.999659)
position = Vector2(-0.999828, 12.9978)
rotation = -0.127972
scale = Vector2(0.999657, 0.999657)
[node name="LeftLowerArm" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/LeftUpperArm" index="2"]
scale = Vector2(0.999829, 0.999829)
scale = Vector2(0.99983, 0.99983)
[node name="LeftHand" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/LeftUpperArm/LeftLowerArm" index="0"]
scale = Vector2(0.999829, 0.999829)
scale = Vector2(0.999827, 0.999827)
[node name="Eatbox" parent="." index="2"]
_damage = SubResource("Resource_011r0")
[node name="Mover" parent="." index="4"]
_speed = SubResource("Resource_b6mal")
_speedControlMult = 1.48524
_speedControlMult = 0.899509
[node name="Armor" type="Node" parent="." index="6"]
script = ExtResource("3_5s7in")

View file

@ -0,0 +1,189 @@
[gd_scene load_steps=19 format=3 uid="uid://p5jhgg2r7e07"]
[ext_resource type="PackedScene" uid="uid://co11v3w8hbwgf" path="res://scenes/entities/Zombies/zombie.tscn" id="1_k7yv2"]
[ext_resource type="Shader" uid="uid://d0eo5uuj222c4" path="res://assets/shaders/CG_color_blender.gdshader" id="2_g7fge"]
[ext_resource type="Script" uid="uid://dildme6epx8l4" path="res://scripts/zombies/RuntimeZombieData.cs" id="2_uhol2"]
[ext_resource type="Script" uid="uid://c3cfnrmnnuqms" path="res://addons/floatmodifiers/FloatModifiers.cs" id="3_uvlkc"]
[ext_resource type="Texture2D" uid="uid://b18blso5pbc6a" path="res://assets/sprites/atlases/zombies/armor.png" id="4_ed67f"]
[ext_resource type="Script" uid="uid://dt5uj25u0g6y3" path="res://scripts/particles/FallParticle.cs" id="4_woxi6"]
[ext_resource type="Script" uid="uid://fd4im1fmwc5n" path="res://scripts/Armor.cs" id="5_ed67f"]
[ext_resource type="Script" uid="uid://bbw848msxb4re" path="res://scripts/DegradingSprite.cs" id="6_woxi6"]
[ext_resource type="Script" uid="uid://c36bj8u7jghc7" path="res://scripts/audio/ChannelPlayer.cs" id="7_tj3uj"]
[ext_resource type="Script" uid="uid://d3l8e8ko5r5i3" path="res://scripts/ArmorHPObserver.cs" id="7_uhol2"]
[ext_resource type="AudioStream" uid="uid://bu1egfsyplpx4" path="res://assets/audio/sfx/metalhit_generic.tres" id="8_uhol2"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ed67f"]
size = Vector2(20, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_woxi6"]
atlas = ExtResource("4_ed67f")
region = Rect2(0, 71, 48, 88)
[sub_resource type="AtlasTexture" id="AtlasTexture_yhtii"]
atlas = ExtResource("4_ed67f")
region = Rect2(48, 71, 48, 88)
[sub_resource type="AtlasTexture" id="AtlasTexture_tj3uj"]
atlas = ExtResource("4_ed67f")
region = Rect2(96, 71, 47, 88)
[sub_resource type="ShaderMaterial" id="ShaderMaterial_p0ieu"]
resource_local_to_scene = true
shader = ExtResource("2_g7fge")
shader_parameter/blend_color = Color(0.73, 0.73, 0.73, 1)
shader_parameter/amount = 0.0
[sub_resource type="Resource" id="Resource_ed67f"]
resource_local_to_scene = true
script = ExtResource("3_uvlkc")
flat_value = 5.0
percentage_value = 0.0
mult_value = 1.0
[sub_resource type="Resource" id="Resource_woxi6"]
resource_local_to_scene = true
script = ExtResource("3_uvlkc")
flat_value = 0.2
percentage_value = 0.0
mult_value = 1.0
[node name="DoorZombie" instance=ExtResource("1_k7yv2")]
[node name="Shield" type="Node2D" parent="." index="0" node_paths=PackedStringArray("_armor")]
position = Vector2(-29, 0)
script = ExtResource("2_uhol2")
_armor = NodePath("MainHP")
completeInvulnerability = true
metadata/_custom_type_script = "uid://3tw88wj1nrj1"
[node name="Hitbox" type="Area2D" parent="Shield" index="0"]
collision_layer = 8
collision_mask = 0
[node name="CollisionShape2D" type="CollisionShape2D" parent="Shield/Hitbox" index="0"]
position = Vector2(0, -25)
shape = SubResource("RectangleShape2D_ed67f")
[node name="MainHP" type="Node" parent="Shield" index="1"]
script = ExtResource("5_ed67f")
MaxHP = 375.0
metadata/_custom_type_script = "uid://fd4im1fmwc5n"
[node name="Particle" type="RigidBody2D" parent="Shield" index="2" node_paths=PackedStringArray("data")]
use_parent_material = true
position = Vector2(0, -43)
collision_layer = 128
collision_mask = 64
freeze = true
script = ExtResource("4_woxi6")
data = NodePath("..")
minTorque = 100.0
maxTorque = -100.0
[node name="Sprite2D" type="Sprite2D" parent="Shield/Particle" index="0" node_paths=PackedStringArray("armor")]
z_index = 1
use_parent_material = true
texture = SubResource("AtlasTexture_woxi6")
script = ExtResource("6_woxi6")
armor = NodePath("../../MainHP")
degradationStages = Array[Texture2D]([SubResource("AtlasTexture_woxi6"), SubResource("AtlasTexture_yhtii"), SubResource("AtlasTexture_tj3uj")])
thresholdPercentage = Array[float]([1.0, 0.667, 0.333])
[node name="CollisionShape2D" type="CollisionShape2D" parent="Shield/Particle" index="1"]
position = Vector2(0, 18)
shape = SubResource("RectangleShape2D_ed67f")
[node name="Observer" type="Node" parent="Shield/Particle" index="2" node_paths=PackedStringArray("_observedArmor")]
script = ExtResource("7_uhol2")
_threshold = 0.0
_observedArmor = NodePath("../../MainHP")
[node name="ChannelPlayer" type="Node" parent="Shield" index="3"]
script = ExtResource("7_tj3uj")
audioStream = ExtResource("8_uhol2")
channel = "metalhit"
metadata/_custom_type_script = "uid://c36bj8u7jghc7"
[node name="CanvasGroup" parent="." index="1"]
material = SubResource("ShaderMaterial_p0ieu")
[node name="RightUpperLeg" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt" index="1"]
scale = Vector2(0.999818, 0.999818)
[node name="RightLowerLeg" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/RightUpperLeg" index="1"]
scale = Vector2(0.999838, 0.999838)
[node name="RightFoot" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/RightUpperLeg/RightLowerLeg" index="0"]
scale = Vector2(0.999833, 0.999833)
[node name="LeftUpperLeg" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt" index="2"]
scale = Vector2(0.999826, 0.999826)
[node name="LeftLowerLeg" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/LeftUpperLeg" index="1"]
scale = Vector2(0.999821, 0.999821)
[node name="LeftFoot" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/LeftUpperLeg/LeftLowerLeg" index="1"]
scale = Vector2(0.999822, 0.999822)
[node name="Body" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt" index="3"]
scale = Vector2(0.999818, 0.999818)
[node name="RightUpperArm" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body" index="0"]
scale = Vector2(0.999823, 0.999823)
[node name="RightLowerArm" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/RightUpperArm" index="1"]
scale = Vector2(0.999823, 0.999823)
[node name="RightHand" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/RightUpperArm/RightLowerArm" index="0"]
scale = Vector2(0.999834, 0.999834)
[node name="Tie" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body" index="2"]
rotation = -0.090966
skew = -0.000511765
[node name="Head" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body" index="3"]
scale = Vector2(0.99984, 0.99984)
[node name="Right_Eye" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/Head/HeadParticle/Head" index="0"]
position = Vector2(-16, -8)
scale = Vector2(1, 1)
[node name="Left_Eye" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/Head/HeadParticle/Head" index="1"]
position = Vector2(-4, -9)
scale = Vector2(1, 1)
[node name="Jaw" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/Head/HeadParticle/Head" index="2"]
position = Vector2(-2.88703, 2.72734)
rotation = -0.0635403
scale = Vector2(0.99984, 0.99984)
[node name="Jaw" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/Head" index="1"]
scale = Vector2(0.99984, 0.99984)
[node name="LeftUpperArm" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body" index="4"]
scale = Vector2(0.999834, 0.999834)
[node name="Left_Lower_Arm" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/LeftUpperArm/HandProjectile" index="0"]
rotation = -0.096416
scale = Vector2(0.99999, 0.99999)
[node name="Left_Hand" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/LeftUpperArm/HandProjectile/Left_Lower_Arm" index="0"]
position = Vector2(-0.99983, 12.9978)
rotation = -0.0794755
scale = Vector2(0.999646, 0.999646)
[node name="LeftLowerArm" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/LeftUpperArm" index="2"]
scale = Vector2(0.99982, 0.99982)
[node name="LeftHand" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/LeftUpperArm/LeftLowerArm" index="0"]
scale = Vector2(0.999816, 0.999816)
[node name="Eatbox" parent="." index="3"]
_damage = SubResource("Resource_ed67f")
[node name="Mover" parent="." index="5"]
_speed = SubResource("Resource_woxi6")
_speedControlMult = 0.299272
[connection signal="OnDamaged" from="Shield" to="Shield/ChannelPlayer" method="Play"]
[connection signal="ThresholdReached" from="Shield/Particle/Observer" to="Shield/Particle" method="FallOff"]

View file

@ -42,14 +42,14 @@ animation = &"garlic/low_hp"
blend_point_0/node = SubResource("AnimationNodeAnimation_mdv0r")
blend_point_0/pos = 1.0
blend_point_1/node = SubResource("AnimationNodeAnimation_j5xqj")
blend_point_1/pos = 0.7
blend_point_1/pos = 0.5
blend_point_2/node = SubResource("AnimationNodeAnimation_tlgpl")
blend_point_2/pos = 0.3
blend_point_2/pos = 0.0
min_space = 0.0
blend_mode = 1
[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_2o7sr"]
graph_offset = Vector2(-397, 76)
graph_offset = Vector2(-389, 166)
nodes/TimeScale/node = SubResource("AnimationNodeTimeScale_2d3xk")
nodes/TimeScale/position = Vector2(100, 160)
nodes/Tree/node = SubResource("AnimationNodeBlendSpace1D_8mvpm")

View file

@ -20,14 +20,14 @@ animation = &"wallnut/idle_low"
blend_point_0/node = SubResource("AnimationNodeAnimation_ds5ry")
blend_point_0/pos = 1.0
blend_point_1/node = SubResource("AnimationNodeAnimation_frsxy")
blend_point_1/pos = 0.7
blend_point_1/pos = 0.5
blend_point_2/node = SubResource("AnimationNodeAnimation_7avgo")
blend_point_2/pos = 0.3
blend_point_2/pos = 0.0
min_space = 0.0
blend_mode = 1
[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_bi7an"]
graph_offset = Vector2(-498, 95)
graph_offset = Vector2(-338.2, 175.4)
nodes/TimeScale/node = SubResource("AnimationNodeTimeScale_y3tlf")
nodes/TimeScale/position = Vector2(60, 140)
nodes/Tree/node = SubResource("AnimationNodeBlendSpace1D_nij8v")
@ -44,7 +44,7 @@ MaxHP = 600.0
texture = ExtResource("2_o5tda")
hframes = 12
vframes = 3
frame = 4
frame = 9
[node name="AnimationPlayer" parent="." index="1"]
libraries = {

View file

@ -365,8 +365,8 @@ autostart = true
[node name="SurvivalAI" type="Node" parent="."]
script = ExtResource("10_1kjp6")
supportPool = Array[String](["hobo"])
tankPool = Array[String](["conehead", "buckethead", "hobo"])
supportPool = Array[String](["hobo", "door_zombie"])
tankPool = Array[String](["conehead", "buckethead", "hobo", "door_zombie"])
hordePool = Array[String](["basic", "conehead", "buckethead"])
velocity_curve = SubResource("Curve_1kjp6")

View file

@ -48,20 +48,25 @@ public partial class Entity : Node2D
[Export] private AnimationTree _tree;
public virtual void DisableBrain()
{
if (_player != null)
_player.ProcessMode = ProcessModeEnum.Always;
if (_tree != null)
_tree.ProcessMode = ProcessModeEnum.Always;
ProcessMode = ProcessModeEnum.Disabled;
}
public virtual void EnableBrain()
{
if (_player != null)
_player.ProcessMode = ProcessModeEnum.Inherit;
if (_tree != null)
_tree.ProcessMode = ProcessModeEnum.Inherit;
ProcessMode = ProcessModeEnum.Inherit;
}
#endregion
#region Effects
[Export] private Array<Effect> _effectImmunities = new();
[Export] private bool completeInvulnerability = false;
private readonly Dictionary<string, Effect> _activeEffectSlots = new();
private readonly Dictionary<string, Timer> _effectSlotTimers = new();
@ -72,7 +77,7 @@ public partial class Entity : Node2D
public virtual void GiveEffect(Effect what)
{
if (_effectImmunities.Contains(what))
if (_effectImmunities.Contains(what) || completeInvulnerability)
{
return;
}