enemy grant hit ability + prep projectiles

This commit is contained in:
2026-05-06 19:55:05 +02:00
parent 7ba4a3db3f
commit 01a2e7582b
19 changed files with 390 additions and 64 deletions

View File

@@ -44,6 +44,10 @@ public partial class ForgeEntityNode : Node3D, IForgeEntity
public required Variables SharedVariables { get; set; }
public void OnReady()
{
}
public void OnResolved()
{
BaseTags ??= new ForgeTagContainer();
Tags = new EntityTags(BaseTags.GetTagContainer());
@@ -53,10 +57,7 @@ public partial class ForgeEntityNode : Node3D, IForgeEntity
SharedVariables = new Variables();
SharedVariableDefinitions?.PopulateVariables(SharedVariables);
}
public void OnResolved()
{
EffectsManager = new EffectsManager(this, CuesManager);
var effectApplier = new EffectApplier(this);
effectApplier.ApplyEffects(this, this, this);

View File

@@ -4,4 +4,4 @@
[resource]
script = ExtResource("1_l686n")
RegisteredTags = Array[String](["character.player", "character.enemy", "weapon", "status.stunned", "status.burning", "status.frozen", "abilities.weapon.land", "abilities.weapon.flying", "abilities.weapon.left", "events.combat.damage", "events.combat.hit", "events.weapon.flyingTick", "events.weapon.startedFlying", "events.weapon.stoppedFlying", "events.weapon.handToFlying", "events.weapon.flyingToHand", "events.weapon.plantedToHand", "events.weapon.plantedToFlying", "events.weapon.planted", "cooldown.empoweredAction", "cooldown.empoweredSwordThrow", "cues.resources.mana", "events.player.empowered_action_used", "cues.resources.mana.inhibited", "cues.resources.health", "cooldown.enemy.hit", "events.combat.death", "cooldown.hit", "events.player.hit", "cues.enemy.health", "immunity.damage", "status", "traits.damageable", "traits.knockbackable", "events.combat.knockback_dealt", "events.combat.knockback_received", "events.weapon.plantedtick", "events.weapon.unplanted", "abilities.weapon.planted"])
RegisteredTags = Array[String](["character.player", "character.enemy", "weapon", "status.stunned", "status.burning", "status.frozen", "abilities.weapon.land", "abilities.weapon.flying", "abilities.weapon.left", "events.combat.damage", "events.combat.hit", "events.weapon.flyingTick", "events.weapon.startedFlying", "events.weapon.stoppedFlying", "events.weapon.handToFlying", "events.weapon.flyingToHand", "events.weapon.plantedToHand", "events.weapon.plantedToFlying", "events.weapon.planted", "cooldown.empoweredAction", "cooldown.empoweredSwordThrow", "cues.resources.mana", "events.player.empowered_action_used", "cues.resources.mana.inhibited", "cues.resources.health", "cooldown.enemy.hit", "events.combat.death", "cooldown.hit", "events.player.hit", "cues.enemy.health", "immunity.damage", "status", "traits.damageable", "traits.knockbackable", "events.combat.knockback_dealt", "events.combat.knockback_received", "events.weapon.plantedtick", "events.weapon.unplanted", "abilities.weapon.planted", "events.enemy.try_hit", "events.enemy.launch_projectile"])

View File

@@ -11,6 +11,7 @@
[ext_resource type="Script" uid="uid://n6efm5o4uxvr" path="res://forge/abilities/ForgeSimpleHitBehavior.cs" id="10_m4f1m"]
[ext_resource type="Script" uid="uid://dngf30hxy5go4" path="res://addons/forge/resources/components/ModifierTags.cs" id="11_8c5sq"]
[ext_resource type="Script" uid="uid://2gm1hdhi8u08" path="res://addons/forge/resources/magnitudes/ForgeModifierMagnitude.cs" id="12_2x5q6"]
[ext_resource type="Resource" uid="uid://csh8jcxtrs11k" path="res://forge/resources/tag_containers/on_enemy_try_hit.tres" id="12_f6jpb"]
[ext_resource type="Script" uid="uid://dhxfbxh54pyxp" path="res://addons/forge/resources/abilities/ForgeAbilityData.cs" id="13_4nn3y"]
[sub_resource type="Resource" id="Resource_rjo6h"]
@@ -154,5 +155,7 @@ script = ExtResource("13_4nn3y")
Name = "Hit"
CooldownEffects = [SubResource("Resource_0gdnn")]
AbilityBehavior = SubResource("Resource_m0osh")
TriggerSource = 1
TriggerTag = ExtResource("12_f6jpb")
ActivationBlockedTags = SubResource("Resource_msmv1")
metadata/_custom_type_script = "uid://dhxfbxh54pyxp"

View File

@@ -0,0 +1,8 @@
[gd_resource type="Resource" script_class="ForgeTag" format=3 uid="uid://bkr1xfokymvp4"]
[ext_resource type="Script" uid="uid://dpakv7agvir6y" path="res://addons/forge/resources/ForgeTag.cs" id="1_ux16b"]
[resource]
script = ExtResource("1_ux16b")
Tag = "events.enemy.launch_projectile"
metadata/_custom_type_script = "uid://dpakv7agvir6y"

View File

@@ -0,0 +1,8 @@
[gd_resource type="Resource" script_class="ForgeTag" format=3 uid="uid://csh8jcxtrs11k"]
[ext_resource type="Script" uid="uid://dpakv7agvir6y" path="res://addons/forge/resources/ForgeTag.cs" id="1_3ab6s"]
[resource]
script = ExtResource("1_3ab6s")
Tag = "events.enemy.try_hit"
metadata/_custom_type_script = "uid://dpakv7agvir6y"

View File

@@ -50,7 +50,6 @@ EnemyToSpawn = ExtResource("5_iq67o")
MovementInputs = ExtResource("6_l44fp")
Target = NodePath("../Player")
SpawnInterval = 5.0
IsActiveOnStart = false
[node name="GroundedSpawner3" parent="." index="10" unique_id=241829575 node_paths=PackedStringArray("Target") instance=ExtResource("4_jaqjx")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 44.5, 0, -3)

View File

@@ -8,6 +8,7 @@
[ext_resource type="PackedScene" uid="uid://cmlud1hwkd6sv" path="res://scenes/enemies/flying_enemy/flying_enemy.tscn" id="7_vkl5g"]
[ext_resource type="PackedScene" uid="uid://c305mfrtumcyq" path="res://scenes/spawners/spawner.tscn" id="8_1upfw"]
[ext_resource type="Resource" uid="uid://bqq6uukbdfysr" path="res://scenes/enemies/grounded_enemy/grounded_enemy_movement.tres" id="9_ynw2y"]
[ext_resource type="PackedScene" uid="uid://dx3y8sjftqk8f" path="res://scenes/enemies/projectile_enemy/projectile_enemy.tscn" id="10_mm5sa"]
[ext_resource type="Resource" uid="uid://bwqjaom4k7rc3" path="res://scenes/enemies/flying_enemy/flying_enemy_movement.tres" id="11_luuoi"]
[sub_resource type="Resource" id="Resource_xixm3"]
@@ -110,19 +111,23 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 10, 7, -16)
Target = NodePath("../Player")
RMovement = SubResource("Resource_xixm3")
[node name="GroundedSpawner" parent="." index="14" unique_id=557145011 node_paths=PackedStringArray("Target") instance=ExtResource("8_1upfw")]
[node name="ProjectileEnemy" parent="." index="14" unique_id=1747444936 node_paths=PackedStringArray("Target") instance=ExtResource("10_mm5sa")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.0893264, -1.9073486e-06, -17.405575)
Target = NodePath("../Player")
[node name="GroundedSpawner" parent="." index="15" unique_id=557145011 node_paths=PackedStringArray("Target") instance=ExtResource("8_1upfw")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5, 2.5, -15)
EnemyToSpawn = ExtResource("4_1cb4f")
MovementInputs = ExtResource("9_ynw2y")
Target = NodePath("../Player")
IsActiveOnStart = false
[node name="FlyingSpawner" parent="." index="15" unique_id=974076606 node_paths=PackedStringArray("Target") instance=ExtResource("8_1upfw")]
[node name="FlyingSpawner" parent="." index="16" unique_id=974076606 node_paths=PackedStringArray("Target") instance=ExtResource("8_1upfw")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 18, 11, -14)
EnemyToSpawn = ExtResource("7_vkl5g")
MovementInputs = ExtResource("11_luuoi")
Target = NodePath("../Player")
IsActiveOnStart = false
[node name="Player" parent="." index="17" unique_id=1309399929]
[node name="Player" parent="." index="18" unique_id=1309399929]
transform = Transform3D(0.99999994, 0, 0, 0, 1, 0, 0, 0, 0.99999994, 2, 1.5, 9.5)

View File

@@ -8,6 +8,7 @@ using Gamesmiths.Forge.Core;
using Gamesmiths.Forge.Cues;
using Gamesmiths.Forge.Effects;
using Gamesmiths.Forge.Events;
using Gamesmiths.Forge.Godot.Resources;
using Gamesmiths.Forge.Godot.Resources.Abilities;
using Gamesmiths.Forge.Statescript;
using Gamesmiths.Forge.Tags;
@@ -44,7 +45,6 @@ public partial class Enemy : CharacterBody3D,
// Public export components
[Export]
public Node3D? Target { get; set; }
[Export] public required ForgeAbilityData HitAbility { get; set; }
[Export]
public float EnemyHeight { get; set; } = 1f;
[Export]
@@ -108,7 +108,6 @@ public partial class Enemy : CharacterBody3D,
public void OnReady()
{
Init();
SetupSignals();
}
public void Init()
@@ -118,7 +117,7 @@ public partial class Enemy : CharacterBody3D,
CKnockback = GetNode<Node>("CKnockback") as IKnockbackable ?? throw new Exception("Knockback component not found");
CKnockback.RKnockback = RKnockback;
_hitAbilityHandle = Abilities.GrantAbilityPermanently(HitAbility.GetAbilityData(), 1, LevelComparison.None, this);
// _hitAbilityHandle = Abilities.GrantAbilityPermanently(HitAbility.GetAbilityData(), 1, LevelComparison.None, this);
}
public void OnResolved()
@@ -132,6 +131,13 @@ public partial class Enemy : CharacterBody3D,
Events.Subscribe<DamageDone>(Tag.RequestTag(TagsManager, "events.combat.damage"), OnDamageReceived);
Events.Subscribe<KnockbackDone>(Tag.RequestTag(TagsManager, "events.combat.knockback_received"), OnKnockbackReceived);
Events.Subscribe(Tag.RequestTag(TagsManager, "events.combat.death"), OnDeath);
GetTree().CreateTimer(3).Timeout += () => Events.Raise(new EventData
{
EventTags = Tag.RequestTag(TagsManager, "events.enemy.launch_projectile").GetSingleTagContainer()!,
Source = this,
Target = Target as IForgeEntity
});
}
public void OnKnockbackReceived(EventData<KnockbackDone> data)
@@ -139,10 +145,6 @@ public partial class Enemy : CharacterBody3D,
RegisterKnockback(new KnockbackRecord(data.Payload.knockbackDirection, data.EventMagnitude));
}
public void SetupSignals()
{
}
public override void _PhysicsProcess(double delta)
{
// Only trigger gameplay related effects on specific frames
@@ -165,16 +167,18 @@ public partial class Enemy : CharacterBody3D,
public void ProcessGameplay(double delta)
{
if (_hitAbilityHandle == null) return;
// if (_hitAbilityHandle == null) return;
var bodies = DamageBox.GetOverlappingBodies();
foreach (var body in bodies)
{
if (body is not IForgeEntity forgeEntity) continue;
var canActivate = _hitAbilityHandle.CanActivate(out var _);
if (!canActivate) return;
_hitAbilityHandle.Activate(out var _, forgeEntity);
Events.Raise(new EventData
{
EventTags = Tag.RequestTag(TagsManager, "events.enemy.try_hit").GetSingleTagContainer()!,
Source = this,
Target = forgeEntity
});
}
}

View File

@@ -10,8 +10,13 @@
[ext_resource type="Script" uid="uid://ccovd5i0wr3kk" path="res://addons/forge/editor/attributes/AttributeValues.cs" id="8_46wn3"]
[ext_resource type="Resource" uid="uid://bocsykxbh8l0g" path="res://forge/resources/tag_containers/enemy_base_tags.tres" id="8_oj1ws"]
[ext_resource type="Script" uid="uid://dtpxijlnb2c5" path="res://scenes/components/movement/RMovement.cs" id="8_on7rt"]
[ext_resource type="Script" uid="uid://dps0oef50noil" path="res://addons/forge/nodes/ForgeEffect.cs" id="9_46wn3"]
[ext_resource type="PackedScene" uid="uid://bctpe34ddamg5" path="res://scenes/components/knockback/CKnockback.tscn" id="10_dejyg"]
[ext_resource type="Script" uid="uid://1hgogislo1l6" path="res://addons/forge/resources/magnitudes/ForgeScalableInt.cs" id="10_oj1ws"]
[ext_resource type="Resource" uid="uid://dt7a1io5o0b8s" path="res://scenes/enemies/flying_enemy/flying_enemy_knockback.tres" id="11_mpa2u"]
[ext_resource type="Script" uid="uid://72kj3n4lm1em" path="res://addons/forge/resources/components/ForgeGrantAbilityConfig.cs" id="11_vfi88"]
[ext_resource type="Script" uid="uid://b3wo2uge4ddnj" path="res://addons/forge/resources/components/GrantAbility.cs" id="12_hf6k8"]
[ext_resource type="Script" uid="uid://b83hf13nj37k3" path="res://addons/forge/resources/ForgeEffectData.cs" id="13_m4ble"]
[sub_resource type="Resource" id="Resource_wxisp"]
script = ExtResource("8_46wn3")
@@ -25,7 +30,41 @@ Default = 1
Min = 1
Max = 100
[sub_resource type="ViewportTexture" id="ViewportTexture_ykkxn"]
[sub_resource type="Resource" id="Resource_t0vud"]
script = ExtResource("10_oj1ws")
BaseValue = 1
[sub_resource type="Resource" id="Resource_ecuuy"]
script = ExtResource("11_vfi88")
AbilityData = ExtResource("2_46wn3")
AbilityLevel = SubResource("Resource_t0vud")
metadata/_custom_type_script = "uid://72kj3n4lm1em"
[sub_resource type="Resource" id="Resource_sk2ji"]
script = ExtResource("12_hf6k8")
GrantAbilityConfigs = [SubResource("Resource_ecuuy")]
metadata/_custom_type_script = "uid://b3wo2uge4ddnj"
[sub_resource type="Resource" id="Resource_8x1id"]
script = ExtResource("10_oj1ws")
BaseValue = 1
[sub_resource type="Resource" id="Resource_66opa"]
script = ExtResource("10_oj1ws")
BaseValue = 1
[sub_resource type="Resource" id="Resource_7y1tn"]
script = ExtResource("13_m4ble")
Name = "GrantAbilities"
Modifiers = []
Components = Array[Object]([SubResource("Resource_sk2ji")])
Executions = []
StackLimit = SubResource("Resource_66opa")
InitialStack = SubResource("Resource_8x1id")
Cues = []
metadata/_custom_type_script = "uid://b83hf13nj37k3"
[sub_resource type="ViewportTexture" id="ViewportTexture_4oy82"]
viewport_path = NodePath("SubViewport")
[sub_resource type="Resource" id="Resource_on7rt"]
@@ -57,7 +96,6 @@ collision_layer = 16
collision_mask = 273
motion_mode = 1
script = ExtResource("1_q8l7o")
HitAbility = ExtResource("2_46wn3")
EnemyHeight = 0.5
RKnockback = ExtResource("11_mpa2u")
RMovement = ExtResource("4_dejyg")
@@ -96,9 +134,14 @@ InitialAttributeValues = Dictionary[String, ExtResource("8_46wn3")]({
})
metadata/_custom_type_script = "uid://cxihb42t2mfqi"
[node name="GrantEffect" type="Node" parent="ForgeEntityNode" unique_id=169684942]
script = ExtResource("9_46wn3")
EffectData = SubResource("Resource_7y1tn")
metadata/_custom_type_script = "uid://dps0oef50noil"
[node name="CHealthBar" parent="." unique_id=1635725931 instance=ExtResource("7_ykkxn")]
transform = Transform3D(0.3, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.70000005, 0)
texture = SubResource("ViewportTexture_ykkxn")
texture = SubResource("ViewportTexture_4oy82")
[node name="CMovement" parent="." unique_id=1699571730 instance=ExtResource("7_vaeds")]
RMovement = SubResource("Resource_on7rt")

View File

@@ -1,8 +0,0 @@
[gd_resource type="Resource" script_class="RDamage" format=3 uid="uid://dgo65k2ceqfvy"]
[ext_resource type="Script" uid="uid://jitubgv6judn" path="res://scenes/components/damage/RDamage.cs" id="1_h6law"]
[resource]
script = ExtResource("1_h6law")
DamageDealt = 1.0
metadata/_custom_type_script = "uid://jitubgv6judn"

View File

@@ -1,8 +0,0 @@
[gd_resource type="Resource" script_class="RHealth" format=3 uid="uid://dg1xbjhyhgnnk"]
[ext_resource type="Script" uid="uid://baiapod3csndf" path="res://scenes/components/health/RHealth.cs" id="1_jht15"]
[resource]
script = ExtResource("1_jht15")
StartingHealth = 5.0
metadata/_custom_type_script = "uid://baiapod3csndf"

View File

@@ -10,8 +10,13 @@
[ext_resource type="Script" uid="uid://ccovd5i0wr3kk" path="res://addons/forge/editor/attributes/AttributeValues.cs" id="7_x50ya"]
[ext_resource type="Resource" uid="uid://bocsykxbh8l0g" path="res://forge/resources/tag_containers/enemy_base_tags.tres" id="8_4jf2q"]
[ext_resource type="Script" uid="uid://dtpxijlnb2c5" path="res://scenes/components/movement/RMovement.cs" id="8_6d4gl"]
[ext_resource type="Script" uid="uid://dps0oef50noil" path="res://addons/forge/nodes/ForgeEffect.cs" id="9_4jf2q"]
[ext_resource type="PackedScene" uid="uid://bctpe34ddamg5" path="res://scenes/components/knockback/CKnockback.tscn" id="10_jqqi6"]
[ext_resource type="Script" uid="uid://1hgogislo1l6" path="res://addons/forge/resources/magnitudes/ForgeScalableInt.cs" id="10_ub34u"]
[ext_resource type="Script" uid="uid://72kj3n4lm1em" path="res://addons/forge/resources/components/ForgeGrantAbilityConfig.cs" id="11_0mf3g"]
[ext_resource type="Resource" uid="uid://cektf6waf4s04" path="res://scenes/enemies/grounded_enemy/grounded_enemy_knockback.tres" id="11_8k3xb"]
[ext_resource type="Script" uid="uid://b3wo2uge4ddnj" path="res://addons/forge/resources/components/GrantAbility.cs" id="12_v6xmd"]
[ext_resource type="Script" uid="uid://b83hf13nj37k3" path="res://addons/forge/resources/ForgeEffectData.cs" id="13_jryek"]
[sub_resource type="Resource" id="Resource_x50ya"]
script = ExtResource("7_x50ya")
@@ -25,7 +30,41 @@ Default = 1
Min = 1
Max = 100
[sub_resource type="ViewportTexture" id="ViewportTexture_18xwy"]
[sub_resource type="Resource" id="Resource_msmv1"]
script = ExtResource("10_ub34u")
BaseValue = 1
[sub_resource type="Resource" id="Resource_m0osh"]
script = ExtResource("11_0mf3g")
AbilityData = ExtResource("6_4jf2q")
AbilityLevel = SubResource("Resource_msmv1")
metadata/_custom_type_script = "uid://72kj3n4lm1em"
[sub_resource type="Resource" id="Resource_3gkmr"]
script = ExtResource("12_v6xmd")
GrantAbilityConfigs = [SubResource("Resource_m0osh")]
metadata/_custom_type_script = "uid://b3wo2uge4ddnj"
[sub_resource type="Resource" id="Resource_oo2a1"]
script = ExtResource("10_ub34u")
BaseValue = 1
[sub_resource type="Resource" id="Resource_q86ag"]
script = ExtResource("10_ub34u")
BaseValue = 1
[sub_resource type="Resource" id="Resource_5eesh"]
script = ExtResource("13_jryek")
Name = "Grant abilities"
Modifiers = null
Components = Array[Object]([SubResource("Resource_3gkmr")])
Executions = null
StackLimit = SubResource("Resource_q86ag")
InitialStack = SubResource("Resource_oo2a1")
Cues = null
metadata/_custom_type_script = "uid://b83hf13nj37k3"
[sub_resource type="ViewportTexture" id="ViewportTexture_5lf6m"]
viewport_path = NodePath("SubViewport")
[sub_resource type="Resource" id="Resource_6d4gl"]
@@ -95,9 +134,14 @@ InitialAttributeValues = Dictionary[String, ExtResource("7_x50ya")]({
})
metadata/_custom_type_script = "uid://cxihb42t2mfqi"
[node name="GrantEffect" type="Node" parent="ForgeEntityNode" unique_id=462009360]
script = ExtResource("9_4jf2q")
EffectData = SubResource("Resource_5eesh")
metadata/_custom_type_script = "uid://dps0oef50noil"
[node name="CHealthBar" parent="." unique_id=1278247727 instance=ExtResource("7_18xwy")]
transform = Transform3D(0.4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.2, 0)
texture = SubResource("ViewportTexture_18xwy")
texture = SubResource("ViewportTexture_5lf6m")
[node name="CMovement" parent="." unique_id=1080640834 node_paths=PackedStringArray("WallInFrontRayCast") instance=ExtResource("7_qyswd")]
RMovement = SubResource("Resource_6d4gl")

View File

@@ -1,8 +0,0 @@
[gd_resource type="Resource" script_class="RDamage" format=3 uid="uid://otfc2snh8umc"]
[ext_resource type="Script" uid="uid://jitubgv6judn" path="res://scenes/components/damage/RDamage.cs" id="1_y415a"]
[resource]
script = ExtResource("1_y415a")
DamageDealt = 2.0
metadata/_custom_type_script = "uid://jitubgv6judn"

View File

@@ -1,8 +0,0 @@
[gd_resource type="Resource" script_class="RHealth" format=3 uid="uid://bohbojc68j7y1"]
[ext_resource type="Script" uid="uid://baiapod3csndf" path="res://scenes/components/health/RHealth.cs" id="1_h6jgd"]
[resource]
script = ExtResource("1_h6jgd")
StartingHealth = 20.0
metadata/_custom_type_script = "uid://baiapod3csndf"

View File

@@ -0,0 +1,227 @@
[gd_scene format=3 uid="uid://dx3y8sjftqk8f"]
[ext_resource type="Script" uid="uid://bn7sc6id7n166" path="res://scenes/enemies/Enemy.cs" id="1_ha67n"]
[ext_resource type="Resource" uid="uid://qpdw62ubaclc" path="res://forge/resources/ability_datas/grounded_enemy_hit.tres" id="2_nbf6l"]
[ext_resource type="Resource" uid="uid://cektf6waf4s04" path="res://scenes/enemies/grounded_enemy/grounded_enemy_knockback.tres" id="3_gciy3"]
[ext_resource type="Resource" uid="uid://c3ys18t0tkbq8" path="res://scenes/enemies/projectile_enemy/projectile_enemy_knockback.tres" id="3_ymgar"]
[ext_resource type="Resource" uid="uid://rchgikroifmg" path="res://scenes/enemies/projectile_enemy/projectile_enemy_movement.tres" id="4_0f52b"]
[ext_resource type="Script" uid="uid://rpcbb54q4atx" path="res://forge/ForgeEntityNode.cs" id="5_ya0fp"]
[ext_resource type="Resource" uid="uid://bocsykxbh8l0g" path="res://forge/resources/tag_containers/enemy_base_tags.tres" id="6_ttkdf"]
[ext_resource type="Script" uid="uid://cxihb42t2mfqi" path="res://addons/forge/nodes/ForgeAttributeSet.cs" id="7_2triq"]
[ext_resource type="Script" uid="uid://ccovd5i0wr3kk" path="res://addons/forge/editor/attributes/AttributeValues.cs" id="8_ti0v2"]
[ext_resource type="PackedScene" uid="uid://bwx2um43k0ou4" path="res://scenes/components/health/CHealthbar.tscn" id="9_6ew2r"]
[ext_resource type="Script" uid="uid://dps0oef50noil" path="res://addons/forge/nodes/ForgeEffect.cs" id="9_xdj1j"]
[ext_resource type="Script" uid="uid://dhxfbxh54pyxp" path="res://addons/forge/resources/abilities/ForgeAbilityData.cs" id="10_b62xo"]
[ext_resource type="PackedScene" uid="uid://dbr7ioio158ew" path="res://scenes/components/movement/CGroundedMovement.tscn" id="10_d3cra"]
[ext_resource type="Script" uid="uid://1hgogislo1l6" path="res://addons/forge/resources/magnitudes/ForgeScalableInt.cs" id="11_f6vvi"]
[ext_resource type="Script" uid="uid://dtpxijlnb2c5" path="res://scenes/components/movement/RMovement.cs" id="11_fi4yv"]
[ext_resource type="PackedScene" uid="uid://bctpe34ddamg5" path="res://scenes/components/knockback/CKnockback.tscn" id="12_7k8no"]
[ext_resource type="Resource" uid="uid://ifeavnlps7hy" path="res://forge/resources/behaviors/exploding_sword.tres" id="12_f6vvi"]
[ext_resource type="Script" uid="uid://72kj3n4lm1em" path="res://addons/forge/resources/components/ForgeGrantAbilityConfig.cs" id="12_ssnfc"]
[ext_resource type="Script" uid="uid://b3wo2uge4ddnj" path="res://addons/forge/resources/components/GrantAbility.cs" id="13_5ac6t"]
[ext_resource type="Resource" uid="uid://bkr1xfokymvp4" path="res://forge/resources/tag_containers/on_enemy_lauch_project.tres" id="13_ssnfc"]
[ext_resource type="Script" uid="uid://b83hf13nj37k3" path="res://addons/forge/resources/ForgeEffectData.cs" id="14_rlvdp"]
[sub_resource type="Resource" id="Resource_x50ya"]
script = ExtResource("8_ti0v2")
Default = 1
Min = 1
Max = 100
[sub_resource type="Resource" id="Resource_yk4hc"]
script = ExtResource("8_ti0v2")
Default = 1
Min = 1
Max = 100
[sub_resource type="Resource" id="Resource_55uge"]
script = ExtResource("11_f6vvi")
BaseValue = 1
[sub_resource type="Resource" id="Resource_xabdf"]
script = ExtResource("12_ssnfc")
AbilityData = ExtResource("2_nbf6l")
AbilityLevel = SubResource("Resource_55uge")
metadata/_custom_type_script = "uid://72kj3n4lm1em"
[sub_resource type="Resource" id="Resource_5ac6t"]
script = ExtResource("10_b62xo")
Name = "Test projectile"
CooldownEffects = []
AbilityBehavior = ExtResource("12_f6vvi")
TriggerSource = 1
TriggerTag = ExtResource("13_ssnfc")
metadata/_custom_type_script = "uid://dhxfbxh54pyxp"
[sub_resource type="Resource" id="Resource_rlvdp"]
script = ExtResource("11_f6vvi")
BaseValue = 1
[sub_resource type="Resource" id="Resource_ei7hs"]
script = ExtResource("12_ssnfc")
AbilityData = SubResource("Resource_5ac6t")
AbilityLevel = SubResource("Resource_rlvdp")
metadata/_custom_type_script = "uid://72kj3n4lm1em"
[sub_resource type="Resource" id="Resource_ufku3"]
script = ExtResource("13_5ac6t")
GrantAbilityConfigs = [SubResource("Resource_xabdf"), SubResource("Resource_ei7hs")]
metadata/_custom_type_script = "uid://b3wo2uge4ddnj"
[sub_resource type="Resource" id="Resource_hgi6f"]
script = ExtResource("11_f6vvi")
BaseValue = 1
[sub_resource type="Resource" id="Resource_17f1o"]
script = ExtResource("11_f6vvi")
BaseValue = 1
[sub_resource type="Resource" id="Resource_ytrix"]
script = ExtResource("14_rlvdp")
Name = "Grant abilities"
Modifiers = null
Components = Array[Object]([SubResource("Resource_ufku3")])
Executions = null
StackLimit = SubResource("Resource_17f1o")
InitialStack = SubResource("Resource_hgi6f")
Cues = null
metadata/_custom_type_script = "uid://b83hf13nj37k3"
[sub_resource type="ViewportTexture" id="ViewportTexture_3kqd1"]
viewport_path = NodePath("SubViewport")
[sub_resource type="Resource" id="Resource_6d4gl"]
script = ExtResource("11_fi4yv")
Speed = 5.0
metadata/_custom_type_script = "uid://dtpxijlnb2c5"
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_62kkh"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_3kqd1"]
albedo_color = Color(0.9888099, 0.33454797, 0.39278528, 1)
[sub_resource type="CapsuleMesh" id="CapsuleMesh_3uydm"]
material = SubResource("StandardMaterial3D_3kqd1")
[sub_resource type="SphereMesh" id="SphereMesh_4yfjf"]
radius = 0.05
height = 0.1
radial_segments = 4
rings = 4
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_4yfjf"]
albedo_color = Color(0.06469653, 0.06469653, 0.06469653, 1)
[sub_resource type="BoxShape3D" id="BoxShape3D_4yfjf"]
size = Vector3(1, 2, 1.5)
[sub_resource type="SphereShape3D" id="SphereShape3D_k2cew"]
radius = 2.0
[node name="ProjectileEnemy" type="CharacterBody3D" unique_id=1747444936]
collision_layer = 16
collision_mask = 273
script = ExtResource("1_ha67n")
HitAbility = ExtResource("2_nbf6l")
EnemyHeight = 2.0
RKnockback = ExtResource("3_ymgar")
RMovement = ExtResource("4_0f52b")
[node name="ForgeEntityNode" type="Node3D" parent="." unique_id=289553407]
script = ExtResource("5_ya0fp")
BaseTags = ExtResource("6_ttkdf")
metadata/_custom_type_script = "uid://rpcbb54q4atx"
[node name="CharacterAttributeSet" type="Node" parent="ForgeEntityNode" unique_id=1699781551]
script = ExtResource("7_2triq")
AttributeSetClass = "CharacterAttributeSet"
InitialAttributeValues = Dictionary[String, ExtResource("8_ti0v2")]({
"Health": Object(RefCounted,"script":ExtResource("8_ti0v2"),"Default":100,"Min":0,"Max":100)
})
metadata/_custom_type_script = "uid://cxihb42t2mfqi"
[node name="MetaAttributeSet" type="Node" parent="ForgeEntityNode" unique_id=1794036161]
script = ExtResource("7_2triq")
AttributeSetClass = "MetaAttributeSet"
InitialAttributeValues = Dictionary[String, ExtResource("8_ti0v2")]({
"IncomingDamage": Object(RefCounted,"script":ExtResource("8_ti0v2"),"Default":0,"Min":0,"Max":1000)
})
metadata/_custom_type_script = "uid://cxihb42t2mfqi"
[node name="EnnemyAttributeSet" type="Node" parent="ForgeEntityNode" unique_id=804252284]
script = ExtResource("7_2triq")
AttributeSetClass = "EnemyAttributeSet"
InitialAttributeValues = Dictionary[String, ExtResource("8_ti0v2")]({
"Health": Object(RefCounted,"script":ExtResource("8_ti0v2"),"Default":100,"Min":0,"Max":100)
,
"Speed": SubResource("Resource_x50ya"),
"Strength": SubResource("Resource_yk4hc")
})
metadata/_custom_type_script = "uid://cxihb42t2mfqi"
[node name="ForgeEffect" type="Node" parent="ForgeEntityNode" unique_id=401970791]
script = ExtResource("9_xdj1j")
EffectData = SubResource("Resource_ytrix")
metadata/_custom_type_script = "uid://dps0oef50noil"
[node name="CHealthBar" parent="." unique_id=1278247727 instance=ExtResource("9_6ew2r")]
transform = Transform3D(0.4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.2, 0)
texture = SubResource("ViewportTexture_3kqd1")
[node name="CMovement" parent="." unique_id=1080640834 node_paths=PackedStringArray("WallInFrontRayCast") instance=ExtResource("10_d3cra")]
RMovement = SubResource("Resource_6d4gl")
WallInFrontRayCast = NodePath("../WallInFrontRayCast")
[node name="CKnockback" parent="." unique_id=1769689477 instance=ExtResource("12_7k8no")]
RKnockback = ExtResource("3_gciy3")
[node name="CTarget" type="Marker3D" parent="." unique_id=383414478]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
[node name="CollisionShape3D" type="CollisionShape3D" parent="." unique_id=237956006]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
shape = SubResource("CapsuleShape3D_62kkh")
[node name="MeshInstance3D" type="MeshInstance3D" parent="." unique_id=1261225229]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
layers = 33
mesh = SubResource("CapsuleMesh_3uydm")
[node name="MeshInstance3D2" type="MeshInstance3D" parent="." unique_id=934245732]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.2, 1.5, -0.5)
layers = 33
cast_shadow = 0
ignore_occlusion_culling = true
mesh = SubResource("SphereMesh_4yfjf")
surface_material_override/0 = SubResource("StandardMaterial3D_4yfjf")
[node name="MeshInstance3D3" type="MeshInstance3D" parent="." unique_id=1877433806]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.2, 1.5, -0.5)
layers = 33
cast_shadow = 0
ignore_occlusion_culling = true
mesh = SubResource("SphereMesh_4yfjf")
surface_material_override/0 = SubResource("StandardMaterial3D_4yfjf")
[node name="WallInFrontRayCast" type="RayCast3D" parent="." unique_id=834403687]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.1, 0)
target_position = Vector3(0, 0, -1.5)
collision_mask = 272
[node name="DamageBox" type="Area3D" parent="." unique_id=399872344]
collision_layer = 0
monitorable = false
[node name="CollisionShape3D" type="CollisionShape3D" parent="DamageBox" unique_id=978720734]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, -0.25)
shape = SubResource("BoxShape3D_4yfjf")
[node name="AimAssistTarget" type="Area3D" parent="." unique_id=328174571]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
collision_layer = 64
collision_mask = 0
[node name="CollisionShape3D" type="CollisionShape3D" parent="AimAssistTarget" unique_id=1960476920]
shape = SubResource("SphereShape3D_k2cew")

View File

@@ -0,0 +1,8 @@
[gd_resource type="Resource" script_class="RKnockback" format=3 uid="uid://c3ys18t0tkbq8"]
[ext_resource type="Script" uid="uid://b44cse62qru7j" path="res://scenes/components/knockback/RKnockback.cs" id="1_5r2lx"]
[resource]
script = ExtResource("1_5r2lx")
Modifier = 1.0
metadata/_custom_type_script = "uid://b44cse62qru7j"

View File

@@ -0,0 +1,8 @@
[gd_resource type="Resource" script_class="RMovement" format=3 uid="uid://rchgikroifmg"]
[ext_resource type="Script" uid="uid://dtpxijlnb2c5" path="res://scenes/components/movement/RMovement.cs" id="1_vkids"]
[resource]
script = ExtResource("1_vkids")
GravityModifier = 5.0
metadata/_custom_type_script = "uid://dtpxijlnb2c5"

View File

@@ -670,8 +670,8 @@ public partial class PlayerController : CharacterBody3D, IForgeEntity, ICueHandl
// Forge events
HealthAttribute.OnValueChanged += OnHealthChanged;
var weaponLeftToken = WeaponSystem.Events.Subscribe(WeaponSystem.WeaponStartedFlyingEventTag, OnWeaponLeft);
var weaponLandedToken = WeaponSystem.Events.Subscribe(WeaponSystem.WeaponStoppedFlyingEventTag, OnWeaponLanded);
// var weaponLeftToken = WeaponSystem.Events.Subscribe(WeaponSystem.WeaponStartedFlyingEventTag, OnWeaponLeft);
// var weaponLandedToken = WeaponSystem.Events.Subscribe(WeaponSystem.WeaponStoppedFlyingEventTag, OnWeaponLanded);
}
#region LifecycleManagement

View File

@@ -34,12 +34,12 @@ public partial class Spawner : Node3D
if (EnemyToSpawn.Instantiate() is not Enemy spawnedInstance) return;
spawnedInstance.RequestReady();
GetTree().GetCurrentScene().AddChild(spawnedInstance);
spawnedInstance.GlobalPosition = GlobalPosition;
spawnedInstance.Target = Target;
spawnedInstance.RMovement = MovementInputs;
spawnedInstance.Init();
GetTree().GetCurrentScene().AddChild(spawnedInstance);
spawnedInstance.GlobalPosition = GlobalPosition;
}
public void StartSpawning()