Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c1108e96d7 | |||
| 15cb80d045 | |||
| 1d298b3080 | |||
| 42ff38f39b | |||
| dafb0c96cc | |||
| ef454e9502 | |||
| cc70fb361b |
@@ -1,7 +1,7 @@
|
||||
[gd_resource type="Resource" load_steps=2 format=3 uid="uid://8j4xg16o3qnl"]
|
||||
[gd_resource type="Resource" format=3 uid="uid://8j4xg16o3qnl"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bq4vlbfx00hea" path="res://addons/forge/core/ForgeData.cs" id="1_x0pne"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_x0pne")
|
||||
RegisteredTags = Array[String](["effect.fire", "effect.wet", "cue.floating.text", "cue.vfx.fire", "cue.vfx.wet", "cue.vfx.regen", "cooldown.enemy.attack", "set_by_caller.damage", "event.damage", "cooldown", "cooldown.skill.projectile", "cooldown.skill.shield", "cooldown.skill.dash", "movement.block", "immunity.damage", "effect.mana_shield", "cue.vfx.shield", "event.damage.taken", "event.damage.dealt", "event", "set_by_caller", "trait.flammable", "trait.healable", "trait.damageable", "trait.wettable", "cue.vfx.reflect", "cue.vfx", "cooldown.skill", "cooldown.skill.reflect"])
|
||||
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"])
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
using Gamesmiths.Forge.Cues;
|
||||
using Gamesmiths.Forge.Tags;
|
||||
using Godot;
|
||||
|
||||
namespace Movementtests.tools;
|
||||
|
||||
public partial class ForgeManager : Node
|
||||
{
|
||||
public CuesManager CuesManager { get; private set; } = new CuesManager();
|
||||
public TagsManager TagsManager { get; private set; } = new TagsManager(
|
||||
[
|
||||
// entities
|
||||
"character.player",
|
||||
"weapon",
|
||||
|
||||
// Statuses
|
||||
"status.stunned",
|
||||
|
||||
// Abilities
|
||||
"abilities.weapon.land",
|
||||
|
||||
// Events
|
||||
"events.combat.damage",
|
||||
"events.combat.hit",
|
||||
"events.weapon.land",
|
||||
|
||||
// Cooldowns
|
||||
"cooldown.empoweredAction",
|
||||
"cooldown.empoweredSwordThrow",
|
||||
|
||||
// Cues
|
||||
"cues.resources.mana",
|
||||
]);
|
||||
|
||||
public static ForgeManager GetForgeManager(Node node)
|
||||
{
|
||||
return node.GetTree().Root.GetNode<ForgeManager>("ForgeManager");
|
||||
}
|
||||
|
||||
public static TagsManager GetTagsManager(Node node)
|
||||
{
|
||||
return GetForgeManager(node).TagsManager;
|
||||
}
|
||||
|
||||
public static CuesManager GetCuesManager(Node node)
|
||||
{
|
||||
return GetForgeManager(node).CuesManager;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
uid://c75tpswl62eew
|
||||
@@ -13,28 +13,13 @@ using Movementtests.interfaces;
|
||||
namespace Movementtests.forge.abilities;
|
||||
|
||||
[GlobalClass]
|
||||
public partial class RAbilityBase(float cost, float cooldown) : Resource, IAbilityBase
|
||||
public partial class RAbilityBase : Resource
|
||||
{
|
||||
[Export(PropertyHint.Range, "0,100,1,or_greater")]
|
||||
public float Cost { get; set; } = cost;
|
||||
[Export(PropertyHint.Range, "0,10,0.1,or_greater")]
|
||||
public float Cooldown { get; set; } = cooldown;
|
||||
|
||||
public RAbilityBase() : this(20.0f, 0.0f)
|
||||
public RAbilityBase()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual AbilityData Ability(TagsManager tagsManager, Node3D owner)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public virtual EffectData CostEffect(TagsManager tagsManager)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public virtual EffectData CooldownEffect(TagsManager tagsManager)
|
||||
public virtual AbilityData Ability(TagContainer? tags, Node3D owner)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
95
forge/abilities/RExplodingSword.cs
Normal file
95
forge/abilities/RExplodingSword.cs
Normal file
@@ -0,0 +1,95 @@
|
||||
using System;
|
||||
using Gamesmiths.Forge.Abilities;
|
||||
using Gamesmiths.Forge.Core;
|
||||
using Gamesmiths.Forge.Cues;
|
||||
using Gamesmiths.Forge.Effects;
|
||||
using Gamesmiths.Forge.Effects.Components;
|
||||
using Gamesmiths.Forge.Effects.Duration;
|
||||
using Gamesmiths.Forge.Effects.Magnitudes;
|
||||
using Gamesmiths.Forge.Effects.Modifiers;
|
||||
using Gamesmiths.Forge.Tags;
|
||||
using Godot;
|
||||
using Movementtests.interfaces;
|
||||
using Movementtests.systems;
|
||||
|
||||
namespace Movementtests.forge.abilities;
|
||||
|
||||
public record struct ExplodingSwordCreation(Node3D Owner);
|
||||
|
||||
[GlobalClass, Icon("res://assets/ui/IconGodotNode/white/icon_projectile.png")]
|
||||
public partial class RExplodingSword(PackedScene? explosion) : Resource, IAbilityBase<ExplodingSwordCreation, WeaponEventPayload>
|
||||
{
|
||||
[Export] public PackedScene? Explosion { get; set; } = explosion;
|
||||
|
||||
public RExplodingSword() : this(null) {}
|
||||
|
||||
public AbilityData Ability(ExplodingSwordCreation creationData, TagContainer? tags)
|
||||
{
|
||||
return new AbilityData(
|
||||
name: "Exploding Sword Throw",
|
||||
abilityTags: tags,
|
||||
instancingPolicy: AbilityInstancingPolicy.PerEntity,
|
||||
behaviorFactory: () => new ExplodingSwordThrowBehavior<WeaponEventPayload>(creationData.Owner, Explosion));
|
||||
}
|
||||
|
||||
public IAbilityBehavior<WeaponEventPayload> Behavior(ExplodingSwordCreation creationData)
|
||||
{
|
||||
return new ExplodingSwordThrowBehavior<WeaponEventPayload>(creationData.Owner, Explosion);
|
||||
}
|
||||
}
|
||||
|
||||
public class ExplodingSwordThrowBehavior<TPayload>(Node3D owner, PackedScene? explosion) : IAbilityBehavior<TPayload>
|
||||
{
|
||||
private Node3D _owner = owner;
|
||||
private PackedScene? _explosion = explosion;
|
||||
public void OnStarted(AbilityBehaviorContext context, TPayload payload)
|
||||
{
|
||||
if (_explosion?.Instantiate() is not Explosion explosion)
|
||||
{
|
||||
GD.Print("Cannot instantiate");
|
||||
context.InstanceHandle.End();
|
||||
return;
|
||||
}
|
||||
if (!_owner.IsInsideTree())
|
||||
{
|
||||
GD.Print("Not inside tree");
|
||||
context.InstanceHandle.End();
|
||||
return;
|
||||
}
|
||||
|
||||
GD.Print("EXPLOSION");
|
||||
|
||||
explosion.Radius = 6f;
|
||||
|
||||
_owner.GetTree().GetRoot().CallDeferred(Node.MethodName.AddChild, explosion);
|
||||
explosion.CallDeferred(Node3D.MethodName.SetGlobalPosition, _owner.GlobalPosition);
|
||||
|
||||
context.AbilityHandle.CommitAbility();
|
||||
context.InstanceHandle.End();
|
||||
}
|
||||
|
||||
public void OnEnded(AbilityBehaviorContext context)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class FlyingSwordBehavior(IForgeEntity owner, EffectData effectData) : IAbilityBehavior
|
||||
{
|
||||
private ActiveEffectHandle? _effectHandle;
|
||||
public void OnStarted(AbilityBehaviorContext context)
|
||||
{
|
||||
GD.Print("This is applying the periodic effect to the flying weapon");
|
||||
_effectHandle = owner.EffectsManager.ApplyEffect(new Effect(effectData, new EffectOwnership(owner, owner)));
|
||||
context.AbilityHandle.CommitAbility();
|
||||
}
|
||||
|
||||
public void OnEnded(AbilityBehaviorContext context)
|
||||
{
|
||||
GD.Print("This is removing the periodic effect from the flying weapon");
|
||||
if (_effectHandle is not null)
|
||||
owner.EffectsManager.RemoveEffect(_effectHandle);
|
||||
context.InstanceHandle.End();
|
||||
}
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
using Gamesmiths.Forge.Abilities;
|
||||
using Gamesmiths.Forge.Cues;
|
||||
using Gamesmiths.Forge.Effects;
|
||||
using Gamesmiths.Forge.Effects.Components;
|
||||
using Gamesmiths.Forge.Effects.Duration;
|
||||
using Gamesmiths.Forge.Effects.Magnitudes;
|
||||
using Gamesmiths.Forge.Effects.Modifiers;
|
||||
using Gamesmiths.Forge.Tags;
|
||||
using Godot;
|
||||
|
||||
namespace Movementtests.forge.abilities;
|
||||
|
||||
[GlobalClass, Icon("res://assets/ui/IconGodotNode/white/icon_projectile.png")]
|
||||
public partial class RExplodingSwordThrow(PackedScene? explosion, float cost, float cooldown) : RAbilityBase(cost, cooldown)
|
||||
{
|
||||
[Export] public PackedScene? Explosion { get; set; } = explosion;
|
||||
|
||||
public RExplodingSwordThrow() : this(null, 20.0f, 0.0f)
|
||||
{
|
||||
}
|
||||
|
||||
public override AbilityData Ability(TagsManager tagsManager, Node3D owner)
|
||||
{
|
||||
return new AbilityData(
|
||||
name: "Exploding Sword Throw",
|
||||
costEffect: CostEffect(tagsManager),
|
||||
cooldownEffects: [CooldownEffect(tagsManager)],
|
||||
abilityTags: Tag.RequestTag(tagsManager, "abilities.weapon.land").GetSingleTagContainer(),
|
||||
instancingPolicy: AbilityInstancingPolicy.PerEntity,
|
||||
behaviorFactory: () => new ExplodingSwordThrowBehavior(owner, Explosion));
|
||||
}
|
||||
|
||||
public override EffectData CostEffect(TagsManager tagsManager)
|
||||
{
|
||||
return new(
|
||||
"Exploding Sword Throw Mana Cost",
|
||||
new DurationData(DurationType.Instant),
|
||||
new[]
|
||||
{
|
||||
new Modifier(
|
||||
"PlayerAttributeSet.Mana",
|
||||
ModifierOperation.FlatBonus,
|
||||
new ModifierMagnitude(
|
||||
MagnitudeCalculationType.ScalableFloat,
|
||||
new ScalableFloat(-Cost)
|
||||
)
|
||||
)
|
||||
},
|
||||
cues: new []
|
||||
{
|
||||
new CueData(
|
||||
CueTags: Tag.RequestTag(tagsManager, "cues.resources.mana").GetSingleTagContainer(),
|
||||
MinValue: 0,
|
||||
MaxValue: 100,
|
||||
MagnitudeType: CueMagnitudeType.AttributeValueChange,
|
||||
MagnitudeAttribute: "PlayerAttributeSet.Mana"
|
||||
)
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public override EffectData CooldownEffect(TagsManager tagsManager)
|
||||
{
|
||||
return new(
|
||||
"Exploding Sword Throw Cooldown",
|
||||
new DurationData(
|
||||
DurationType.HasDuration,
|
||||
new ModifierMagnitude(
|
||||
MagnitudeCalculationType.ScalableFloat,
|
||||
new ScalableFloat(Cooldown))),
|
||||
effectComponents: new[]
|
||||
{
|
||||
new ModifierTagsEffectComponent(
|
||||
tagsManager.RequestTagContainer(new[] { "cooldown.empoweredSwordThrow" })
|
||||
)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public class ExplodingSwordThrowBehavior(Node3D owner, PackedScene? explosion) : IAbilityBehavior
|
||||
{
|
||||
private Node3D _owner = owner;
|
||||
private PackedScene? _explosion = explosion;
|
||||
public void OnStarted(AbilityBehaviorContext context)
|
||||
{
|
||||
if (_explosion?.Instantiate() is not Explosion explosion)
|
||||
{
|
||||
context.InstanceHandle.End();
|
||||
return;
|
||||
}
|
||||
|
||||
explosion.Radius = 10f;
|
||||
_owner.GetTree().GetRoot().AddChild(explosion);
|
||||
explosion.GlobalPosition = _owner.GlobalPosition;
|
||||
|
||||
context.AbilityHandle.CommitAbility();
|
||||
context.InstanceHandle.End();
|
||||
}
|
||||
|
||||
public void OnEnded(AbilityBehaviorContext context)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
30
forge/calculators/FlyingWeaponExecution.cs
Normal file
30
forge/calculators/FlyingWeaponExecution.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System.Collections.Generic;
|
||||
using Gamesmiths.Forge.Attributes;
|
||||
using Gamesmiths.Forge.Core;
|
||||
using Gamesmiths.Forge.Effects;
|
||||
using Gamesmiths.Forge.Effects.Calculator;
|
||||
using Gamesmiths.Forge.Effects.Magnitudes;
|
||||
using Gamesmiths.Forge.Effects.Modifiers;
|
||||
using Gamesmiths.Forge.Events;
|
||||
using Godot;
|
||||
using Movementtests.systems;
|
||||
|
||||
namespace Movementtests.tools.calculators;
|
||||
|
||||
|
||||
public class FlyingWeaponExecution(WeaponSystem weaponSystem) : CustomExecution
|
||||
{
|
||||
public override ModifierEvaluatedData[] EvaluateExecution(Effect effect, IForgeEntity target, EffectEvaluatedData? effectEvaluatedData)
|
||||
{
|
||||
GD.Print("Custom execution executed");
|
||||
weaponSystem.Events.Raise(new EventData<WeaponEventPayload>
|
||||
{
|
||||
EventTags = weaponSystem.WeaponFlyingTickEventTag.GetSingleTagContainer()!,
|
||||
Source = weaponSystem,
|
||||
EventMagnitude = 12f,
|
||||
Payload = new WeaponEventPayload(Message: "flying")
|
||||
});
|
||||
|
||||
return [];
|
||||
}
|
||||
}
|
||||
1
forge/calculators/FlyingWeaponExecution.cs.uid
Normal file
1
forge/calculators/FlyingWeaponExecution.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://br7ut4lbau66w
|
||||
7
forge/forge_data.tres
Normal file
7
forge/forge_data.tres
Normal file
@@ -0,0 +1,7 @@
|
||||
[gd_resource type="Resource" format=3 uid="uid://dugyoyn4fda3s"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bq4vlbfx00hea" path="res://addons/forge/core/ForgeData.cs" id="1_l686n"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_l686n")
|
||||
RegisteredTags = Array[String](["effect.fire", "effect.wet", "cue.floating.text", "cue.vfx.fire", "cue.vfx.wet", "cue.vfx.regen", "cooldown.enemy.attack", "set_by_caller.damage", "event.damage", "cooldown", "cooldown.skill.projectile", "cooldown.skill.shield", "cooldown.skill.dash", "movement.block", "immunity.damage", "effect.mana_shield", "cue.vfx.shield", "event.damage.taken", "event.damage.dealt", "event", "set_by_caller", "trait.flammable", "trait.healable", "trait.damageable", "trait.wettable", "cue.vfx.reflect", "cue.vfx", "cooldown.skill", "cooldown.skill.reflect"])
|
||||
@@ -5,9 +5,8 @@ using Godot;
|
||||
|
||||
namespace Movementtests.interfaces;
|
||||
|
||||
public interface IAbilityBase
|
||||
public interface IAbilityBase<TCreation, TPayload>
|
||||
{
|
||||
AbilityData Ability(TagsManager tagsManager, Node3D owner);
|
||||
EffectData CostEffect(TagsManager tagsManager);
|
||||
EffectData CooldownEffect(TagsManager tagsManager);
|
||||
AbilityData Ability(TCreation creationData, TagContainer? tags);
|
||||
IAbilityBehavior<TPayload> Behavior(TCreation creationData);
|
||||
}
|
||||
@@ -30,7 +30,6 @@ Shaker="*uid://c7flmumgr5w3u"
|
||||
CsgToolkitAutoload="*uid://w8ad8q4lneis"
|
||||
"Forge Bootstrap"="*uid://ba8fquhtwu5mu"
|
||||
GlobalHelpers="*uid://dqcm83o8e66a2"
|
||||
ForgeManager="*uid://c75tpswl62eew"
|
||||
|
||||
[display]
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@ using System;
|
||||
using Gamesmiths.Forge.Core;
|
||||
using Gamesmiths.Forge.Effects;
|
||||
using Gamesmiths.Forge.Events;
|
||||
using Gamesmiths.Forge.Godot.Core;
|
||||
using Gamesmiths.Forge.Godot.Nodes;
|
||||
using Gamesmiths.Forge.Tags;
|
||||
using Godot;
|
||||
using Movementtests.interfaces;
|
||||
@@ -63,16 +65,38 @@ public partial class Enemy : CharacterBody3D,
|
||||
set => CHealth.CurrentHealth = value;
|
||||
}
|
||||
|
||||
public EntityAttributes Attributes { get; set; } = null!;
|
||||
public EntityTags Tags { get; set; } = null!;
|
||||
public EffectsManager EffectsManager { get; set; } = null!;
|
||||
public EntityAbilities Abilities { get; set; } = null!;
|
||||
public EventManager Events { get; set; } = null!;
|
||||
// Perfectly forward the IForgeEntity interface to the ForgeEntity component
|
||||
public EntityAttributes Attributes
|
||||
{
|
||||
get => _forgeEntity.Attributes;
|
||||
set => _forgeEntity.Attributes = value;
|
||||
}
|
||||
public EntityTags Tags
|
||||
{
|
||||
get => _forgeEntity.Tags;
|
||||
set => _forgeEntity.Tags = value;
|
||||
}
|
||||
public EffectsManager EffectsManager
|
||||
{
|
||||
get => _forgeEntity.EffectsManager;
|
||||
set => _forgeEntity.EffectsManager = value;
|
||||
}
|
||||
public EntityAbilities Abilities
|
||||
{
|
||||
get => _forgeEntity.Abilities;
|
||||
set => _forgeEntity.Abilities = value;
|
||||
}
|
||||
public EventManager Events
|
||||
{
|
||||
get => _forgeEntity.Events;
|
||||
set => _forgeEntity.Events = value;
|
||||
}
|
||||
|
||||
// Private stuff
|
||||
private Area3D _damageBox = null!;
|
||||
internal Node3D _target = null!;
|
||||
private Healthbar _healthbar = null!;
|
||||
private ForgeEntity _forgeEntity;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
@@ -84,21 +108,7 @@ public partial class Enemy : CharacterBody3D,
|
||||
{
|
||||
_damageBox = GetNode<Area3D>("DamageBox");
|
||||
_target = GetNode<Node3D>("CTarget");
|
||||
|
||||
// Forge stuff
|
||||
var forgeManager = GetTree().Root.GetNode<ForgeManager>("ForgeManager")!;
|
||||
var baseTags = new TagContainer(
|
||||
forgeManager.TagsManager,
|
||||
[
|
||||
Tag.RequestTag(forgeManager.TagsManager, "character.player"),
|
||||
Tag.RequestTag(forgeManager.TagsManager, "class.warrior")
|
||||
]);
|
||||
|
||||
Attributes = new EntityAttributes(new EnemyAttributeSet());
|
||||
Tags = new EntityTags(baseTags);
|
||||
EffectsManager = new EffectsManager(this, forgeManager.CuesManager);
|
||||
Abilities = new(this);
|
||||
Events = new();
|
||||
_forgeEntity = GetNode<ForgeEntity>("ForgeEntity");
|
||||
|
||||
CDamageable = (GetNode<Node>("CDamageable") as IDamageable)!;
|
||||
CMovement = (GetNode<Node>("CMovement") as IMoveable)!;
|
||||
|
||||
@@ -6,14 +6,34 @@
|
||||
[ext_resource type="Resource" uid="uid://dgo65k2ceqfvy" path="res://scenes/enemies/flying_enemy/flying_enemy_damage.tres" id="2_on7rt"]
|
||||
[ext_resource type="Resource" uid="uid://bwqjaom4k7rc3" path="res://scenes/enemies/flying_enemy/flying_enemy_movement.tres" id="4_dejyg"]
|
||||
[ext_resource type="Script" uid="uid://bjwrpv3jpsc1e" path="res://scenes/components/health/CHealth.cs" id="4_ys4jv"]
|
||||
[ext_resource type="Script" uid="uid://8uj04dfe8oql" path="res://addons/forge/nodes/ForgeEntity.cs" id="6_wxisp"]
|
||||
[ext_resource type="Script" uid="uid://cxihb42t2mfqi" path="res://addons/forge/nodes/ForgeAttributeSet.cs" id="7_2digf"]
|
||||
[ext_resource type="PackedScene" uid="uid://dmw5ibwrb483f" path="res://scenes/components/movement/CFlyingMovement.tscn" id="7_vaeds"]
|
||||
[ext_resource type="PackedScene" uid="uid://bwx2um43k0ou4" path="res://scenes/components/health/CHealthbar.tscn" id="7_ykkxn"]
|
||||
[ext_resource type="Script" uid="uid://ccovd5i0wr3kk" path="res://addons/forge/editor/attributes/AttributeValues.cs" id="8_46wn3"]
|
||||
[ext_resource type="Script" uid="uid://dtpxijlnb2c5" path="res://scenes/components/movement/RMovement.cs" id="8_on7rt"]
|
||||
[ext_resource type="Script" uid="uid://b0u23nkpaimyc" path="res://scenes/components/damage/CDamageable.cs" id="8_uotso"]
|
||||
[ext_resource type="PackedScene" uid="uid://bctpe34ddamg5" path="res://scenes/components/knockback/CKnockback.tscn" id="10_dejyg"]
|
||||
[ext_resource type="Resource" uid="uid://dt7a1io5o0b8s" path="res://scenes/enemies/flying_enemy/flying_enemy_knockback.tres" id="11_mpa2u"]
|
||||
|
||||
[sub_resource type="ViewportTexture" id="ViewportTexture_ykkxn"]
|
||||
[sub_resource type="Resource" id="Resource_oj1ws"]
|
||||
script = ExtResource("8_46wn3")
|
||||
Default = 50
|
||||
Max = 100
|
||||
|
||||
[sub_resource type="Resource" id="Resource_yk4hc"]
|
||||
script = ExtResource("8_46wn3")
|
||||
Default = 1
|
||||
Min = 1
|
||||
Max = 100
|
||||
|
||||
[sub_resource type="Resource" id="Resource_wxisp"]
|
||||
script = ExtResource("8_46wn3")
|
||||
Default = 2
|
||||
Min = 1
|
||||
Max = 100
|
||||
|
||||
[sub_resource type="ViewportTexture" id="ViewportTexture_hf6k8"]
|
||||
viewport_path = NodePath("SubViewport")
|
||||
|
||||
[sub_resource type="Resource" id="Resource_jnv07"]
|
||||
@@ -62,6 +82,20 @@ RDamage = ExtResource("2_on7rt")
|
||||
RKnockback = ExtResource("11_mpa2u")
|
||||
RMovement = ExtResource("4_dejyg")
|
||||
|
||||
[node name="ForgeEntity" type="Node" parent="." unique_id=622209781]
|
||||
script = ExtResource("6_wxisp")
|
||||
metadata/_custom_type_script = "uid://8uj04dfe8oql"
|
||||
|
||||
[node name="ForgeAttributeSet" type="Node" parent="ForgeEntity" unique_id=1840910245]
|
||||
script = ExtResource("7_2digf")
|
||||
AttributeSetClass = "EnemyAttributeSet"
|
||||
InitialAttributeValues = Dictionary[String, ExtResource("8_46wn3")]({
|
||||
"Health": SubResource("Resource_oj1ws"),
|
||||
"Speed": SubResource("Resource_wxisp"),
|
||||
"Strength": SubResource("Resource_yk4hc")
|
||||
})
|
||||
metadata/_custom_type_script = "uid://cxihb42t2mfqi"
|
||||
|
||||
[node name="CHealth" type="Node" parent="." unique_id=1717035166]
|
||||
script = ExtResource("4_ys4jv")
|
||||
RHealth = ExtResource("2_ma2bq")
|
||||
@@ -69,7 +103,7 @@ metadata/_custom_type_script = "uid://bjwrpv3jpsc1e"
|
||||
|
||||
[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_hf6k8")
|
||||
|
||||
[node name="CDamageable" type="Node" parent="." unique_id=1785297232]
|
||||
script = ExtResource("8_uotso")
|
||||
|
||||
@@ -6,14 +6,34 @@
|
||||
[ext_resource type="Script" uid="uid://b6y3ugfydvch0" path="res://scenes/components/damage/RDamageModifier.cs" id="2_r3cnf"]
|
||||
[ext_resource type="Resource" uid="uid://bohbojc68j7y1" path="res://scenes/enemies/grounded_enemy/grounded_enemy_health.tres" id="2_w4lm8"]
|
||||
[ext_resource type="Resource" uid="uid://bqq6uukbdfysr" path="res://scenes/enemies/grounded_enemy/grounded_enemy_movement.tres" id="4_na24f"]
|
||||
[ext_resource type="Script" uid="uid://8uj04dfe8oql" path="res://addons/forge/nodes/ForgeEntity.cs" id="6_x50ya"]
|
||||
[ext_resource type="Script" uid="uid://cxihb42t2mfqi" path="res://addons/forge/nodes/ForgeAttributeSet.cs" id="6_yk4hc"]
|
||||
[ext_resource type="Script" uid="uid://b0u23nkpaimyc" path="res://scenes/components/damage/CDamageable.cs" id="7_1tw73"]
|
||||
[ext_resource type="PackedScene" uid="uid://bwx2um43k0ou4" path="res://scenes/components/health/CHealthbar.tscn" id="7_18xwy"]
|
||||
[ext_resource type="PackedScene" uid="uid://dbr7ioio158ew" path="res://scenes/components/movement/CGroundedMovement.tscn" id="7_qyswd"]
|
||||
[ext_resource type="Script" uid="uid://ccovd5i0wr3kk" path="res://addons/forge/editor/attributes/AttributeValues.cs" id="7_x50ya"]
|
||||
[ext_resource type="Script" uid="uid://dtpxijlnb2c5" path="res://scenes/components/movement/RMovement.cs" id="8_6d4gl"]
|
||||
[ext_resource type="PackedScene" uid="uid://bctpe34ddamg5" path="res://scenes/components/knockback/CKnockback.tscn" id="10_jqqi6"]
|
||||
[ext_resource type="Resource" uid="uid://cektf6waf4s04" path="res://scenes/enemies/grounded_enemy/grounded_enemy_knockback.tres" id="11_8k3xb"]
|
||||
|
||||
[sub_resource type="ViewportTexture" id="ViewportTexture_18xwy"]
|
||||
[sub_resource type="Resource" id="Resource_f22p3"]
|
||||
script = ExtResource("7_x50ya")
|
||||
Default = 100
|
||||
Max = 100
|
||||
|
||||
[sub_resource type="Resource" id="Resource_yk4hc"]
|
||||
script = ExtResource("7_x50ya")
|
||||
Default = 1
|
||||
Min = 1
|
||||
Max = 100
|
||||
|
||||
[sub_resource type="Resource" id="Resource_x50ya"]
|
||||
script = ExtResource("7_x50ya")
|
||||
Default = 1
|
||||
Min = 1
|
||||
Max = 100
|
||||
|
||||
[sub_resource type="ViewportTexture" id="ViewportTexture_0mf3g"]
|
||||
viewport_path = NodePath("SubViewport")
|
||||
|
||||
[sub_resource type="Resource" id="Resource_qj0ob"]
|
||||
@@ -62,6 +82,20 @@ RDamage = ExtResource("2_bn56u")
|
||||
RKnockback = ExtResource("11_8k3xb")
|
||||
RMovement = ExtResource("4_na24f")
|
||||
|
||||
[node name="ForgeEntity" type="Node" parent="." unique_id=432521027]
|
||||
script = ExtResource("6_x50ya")
|
||||
metadata/_custom_type_script = "uid://8uj04dfe8oql"
|
||||
|
||||
[node name="ForgeAttributeSet" type="Node" parent="ForgeEntity" unique_id=804252284]
|
||||
script = ExtResource("6_yk4hc")
|
||||
AttributeSetClass = "EnemyAttributeSet"
|
||||
InitialAttributeValues = Dictionary[String, ExtResource("7_x50ya")]({
|
||||
"Health": SubResource("Resource_f22p3"),
|
||||
"Speed": SubResource("Resource_x50ya"),
|
||||
"Strength": SubResource("Resource_yk4hc")
|
||||
})
|
||||
metadata/_custom_type_script = "uid://cxihb42t2mfqi"
|
||||
|
||||
[node name="CHealth" type="Node" parent="." unique_id=188153645]
|
||||
script = ExtResource("2_gsmti")
|
||||
RHealth = ExtResource("2_w4lm8")
|
||||
@@ -69,7 +103,7 @@ metadata/_custom_type_script = "uid://bjwrpv3jpsc1e"
|
||||
|
||||
[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_0mf3g")
|
||||
|
||||
[node name="CDamageable" type="Node" parent="." unique_id=1601518000]
|
||||
script = ExtResource("7_1tw73")
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
[ext_resource type="Resource" uid="uid://bl5crtu1gkrtr" path="res://inputs/base_mode/base_mode.tres" id="3_cresl"]
|
||||
[ext_resource type="Resource" uid="uid://dtmhtlix2amme" path="res://scenes/player_controller/resources/player_mana_regen.tres" id="3_n24vh"]
|
||||
[ext_resource type="PackedScene" uid="uid://c4ikbhojckpnc" path="res://scenes/components/health/CHealth.tscn" id="3_q7bng"]
|
||||
[ext_resource type="Script" uid="uid://rux15j7q78e8" path="res://forge/abilities/RExplodingSwordThrow.cs" id="4_11013"]
|
||||
[ext_resource type="Resource" uid="uid://cdxbwirfiaipi" path="res://scenes/player_controller/resources/forge/exploding_sword_throw.tres" id="4_11013"]
|
||||
[ext_resource type="Script" uid="uid://baiapod3csndf" path="res://scenes/components/health/RHealth.cs" id="4_abfq8"]
|
||||
[ext_resource type="Resource" uid="uid://bjyd801wvverk" path="res://scenes/player_controller/resources/player_health.tres" id="4_m8gvy"]
|
||||
[ext_resource type="Resource" uid="uid://cpdaw41ah5gic" path="res://inputs/base_mode/rotate_y.tres" id="4_rxwoh"]
|
||||
@@ -29,6 +29,8 @@
|
||||
[ext_resource type="AudioStream" uid="uid://clfggn87oeg1s" path="res://scenes/player_controller/audio/InteractiveSFX.tres" id="9_jb43f"]
|
||||
[ext_resource type="Resource" uid="uid://bebstkm608wxx" path="res://inputs/base_mode/aim_pressed.tres" id="9_nob5r"]
|
||||
[ext_resource type="Resource" uid="uid://bdit2jy5gbpts" path="res://inputs/base_mode/jump.tres" id="10_4u7i3"]
|
||||
[ext_resource type="Script" uid="uid://cxihb42t2mfqi" path="res://addons/forge/nodes/ForgeAttributeSet.cs" id="10_pw5r7"]
|
||||
[ext_resource type="Script" uid="uid://ccovd5i0wr3kk" path="res://addons/forge/editor/attributes/AttributeValues.cs" id="11_2rkt1"]
|
||||
[ext_resource type="Resource" uid="uid://b5gx3q8nvu72e" path="res://inputs/base_mode/hit.tres" id="11_cresl"]
|
||||
[ext_resource type="PackedScene" uid="uid://0ysqmqphq6mq" path="res://scenes/player_controller/components/head/head_system.tscn" id="11_rxwoh"]
|
||||
[ext_resource type="Resource" uid="uid://d2r0ur8k3cuu3" path="res://inputs/base_mode/dash.tres" id="12_34snm"]
|
||||
@@ -56,12 +58,6 @@
|
||||
[ext_resource type="Texture2D" uid="uid://c40orhfdgsim" path="res://assets/ui/IconGodotNode/white/icon_circle.png" id="45_u8rdp"]
|
||||
[ext_resource type="PackedScene" uid="uid://cyw8p0p6a78tl" path="res://scenes/ui/healthbar/healthbar.tscn" id="47_76kmc"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_5b7hb"]
|
||||
script = ExtResource("4_11013")
|
||||
Explosion = ExtResource("5_ue7xq")
|
||||
Cost = 10.0
|
||||
metadata/_custom_type_script = "uid://rux15j7q78e8"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_cb2lu"]
|
||||
script = ExtResource("2_x835q")
|
||||
DamageDealt = 10.0
|
||||
@@ -77,6 +73,28 @@ script = ExtResource("4_abfq8")
|
||||
StartingHealth = 10.0
|
||||
metadata/_custom_type_script = "uid://baiapod3csndf"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_u8yay"]
|
||||
script = ExtResource("11_2rkt1")
|
||||
Default = 100
|
||||
Max = 100
|
||||
|
||||
[sub_resource type="Resource" id="Resource_uqalc"]
|
||||
script = ExtResource("11_2rkt1")
|
||||
Default = 100
|
||||
Max = 100
|
||||
|
||||
[sub_resource type="Resource" id="Resource_cn5a8"]
|
||||
script = ExtResource("11_2rkt1")
|
||||
Default = 1
|
||||
Min = 1
|
||||
Max = 100
|
||||
|
||||
[sub_resource type="Resource" id="Resource_b0xmb"]
|
||||
script = ExtResource("11_2rkt1")
|
||||
Default = 1
|
||||
Min = 1
|
||||
Max = 100
|
||||
|
||||
[sub_resource type="CapsuleMesh" id="CapsuleMesh_xc2g5"]
|
||||
height = 1.7
|
||||
|
||||
@@ -126,7 +144,7 @@ collision_mask = 272
|
||||
script = ExtResource("1_poq2x")
|
||||
EmpoweredAction = ExtResource("7_qheee")
|
||||
ManaRegen = ExtResource("3_n24vh")
|
||||
AbilityLoadout = [SubResource("Resource_5b7hb")]
|
||||
AbilityLoadout = [ExtResource("4_11013")]
|
||||
AimAssistStrength = 0.3
|
||||
AimAssistReductionWhenCloseToTarget = 0.1
|
||||
AimAssistReductionStartDistance = 8.0
|
||||
@@ -178,6 +196,17 @@ MinimumWallRunHorizontalSpeed = 8.0
|
||||
WallRunAltitudeLossSpeed = 8.0
|
||||
WallRunSpeedThreshold = 1.0
|
||||
|
||||
[node name="PlayerAttributeSet" type="Node" parent="." unique_id=421846088]
|
||||
script = ExtResource("10_pw5r7")
|
||||
AttributeSetClass = "PlayerAttributeSet"
|
||||
InitialAttributeValues = Dictionary[String, ExtResource("11_2rkt1")]({
|
||||
"Health": SubResource("Resource_u8yay"),
|
||||
"Mana": SubResource("Resource_uqalc"),
|
||||
"Speed": SubResource("Resource_cn5a8"),
|
||||
"Strength": SubResource("Resource_b0xmb")
|
||||
})
|
||||
metadata/_custom_type_script = "uid://cxihb42t2mfqi"
|
||||
|
||||
[node name="CHealth" parent="." unique_id=1244478698 instance=ExtResource("3_q7bng")]
|
||||
RHealth = ExtResource("4_m8gvy")
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ using Godot;
|
||||
using System;
|
||||
using Gamesmiths.Forge.Core;
|
||||
using Gamesmiths.Forge.Cues;
|
||||
using Gamesmiths.Forge.Godot.Core;
|
||||
using Gamesmiths.Forge.Tags;
|
||||
using Movementtests.interfaces;
|
||||
using Movementtests.tools;
|
||||
@@ -38,9 +39,8 @@ public partial class PlayerUi : Control, ICueHandler
|
||||
_healthbar = GetNode<Healthbar>("%Healthbar");
|
||||
_manabar = GetNode<Healthbar>("%Manabar");
|
||||
|
||||
var forgeManager = GetTree().Root.GetNode<ForgeManager>("ForgeManager")!;
|
||||
var tagsManager = forgeManager.TagsManager;
|
||||
var cuesManager = forgeManager.CuesManager;
|
||||
var tagsManager = ForgeManagers.Instance.TagsManager;
|
||||
var cuesManager = ForgeManagers.Instance.CuesManager;
|
||||
cuesManager.RegisterCue(Tag.RequestTag(tagsManager, "cues.resources.mana"), this);
|
||||
}
|
||||
|
||||
@@ -90,16 +90,9 @@ public partial class PlayerUi : Control, ICueHandler
|
||||
|
||||
public void OnExecute(IForgeEntity? target, CueParameters? parameters)
|
||||
{
|
||||
// One-shot effect (like impact)
|
||||
// Called when an instant effect with this cue is applied
|
||||
// Also called when a periodic effect with this cue executes its period
|
||||
if (target == null || !parameters.HasValue) return;
|
||||
if (target == null || !parameters.HasValue || !IsInstanceValid(_manabar)) return;
|
||||
|
||||
// Extract parameters
|
||||
float magnitude = parameters.Value.Magnitude;
|
||||
// Play effects scaled by magnitude
|
||||
// PlayFireImpactSound(normalizedMagnitude);
|
||||
// SpawnFireImpactParticles(target, magnitude);
|
||||
_manabar.CurrentHealth += magnitude;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,18 +1,45 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Gamesmiths.Forge.Abilities;
|
||||
using Gamesmiths.Forge.Attributes;
|
||||
using Gamesmiths.Forge.Core;
|
||||
using Gamesmiths.Forge.Effects;
|
||||
using Gamesmiths.Forge.Effects.Calculator;
|
||||
using Gamesmiths.Forge.Effects.Components;
|
||||
using Gamesmiths.Forge.Effects.Duration;
|
||||
using Gamesmiths.Forge.Effects.Magnitudes;
|
||||
using Gamesmiths.Forge.Effects.Periodic;
|
||||
using Gamesmiths.Forge.Events;
|
||||
using Gamesmiths.Forge.Godot.Core;
|
||||
using Gamesmiths.Forge.Godot.Nodes;
|
||||
using Gamesmiths.Forge.Godot.Resources;
|
||||
using Gamesmiths.Forge.Tags;
|
||||
using Godot;
|
||||
using GodotStateCharts;
|
||||
using Movementtests.addons.godot_state_charts.csharp;
|
||||
using Movementtests.forge.abilities;
|
||||
using Movementtests.interfaces;
|
||||
using Movementtests.scenes.player_controller.components.weapon;
|
||||
using Movementtests.systems.damage;
|
||||
using Movementtests.tools;
|
||||
using Movementtests.tools.calculators;
|
||||
|
||||
namespace Movementtests.systems;
|
||||
|
||||
public record struct WeaponLandPayload(int Damage, bool IsCritical);
|
||||
public record struct WeaponEventPayload(String Message);
|
||||
|
||||
|
||||
public class ClosureBehavior<TPayload>(
|
||||
Action<AbilityBehaviorContext, TPayload> callback) : IAbilityBehavior<TPayload>
|
||||
{
|
||||
public void OnStarted(AbilityBehaviorContext context, TPayload data)
|
||||
{
|
||||
callback(context, data);
|
||||
context.InstanceHandle.End();
|
||||
}
|
||||
|
||||
public void OnEnded(AbilityBehaviorContext context){}
|
||||
}
|
||||
|
||||
[GlobalClass, Icon("res://assets/ui/IconGodotNode/node_3D/icon_sword.png")]
|
||||
public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
|
||||
@@ -23,6 +50,10 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
|
||||
[Signal]
|
||||
public delegate void WeaponRetrievedEventHandler();
|
||||
|
||||
|
||||
[Export]
|
||||
public ForgeTagContainer BaseTags { get; set; } = new();
|
||||
|
||||
[Export]
|
||||
public RDamage RDamage { get; set; }
|
||||
[Export(PropertyHint.Range, "0,100,1,or_greater")]
|
||||
@@ -36,11 +67,18 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
|
||||
public EntityAbilities Abilities { get; set; } = null!;
|
||||
public EventManager Events { get; set; } = null!;
|
||||
|
||||
private StateChart _weaponState = null!;
|
||||
private StateChart _weaponState = null!;
|
||||
public StateChartState InHandState = null!;
|
||||
public StateChartState FlyingState = null!;
|
||||
public StateChartState PlantedState = null!;
|
||||
private Transition _handToFlying = null!;
|
||||
private Transition _flyingToHand = null!;
|
||||
private Transition _plantedToHand = null!;
|
||||
private Transition _plantedToFlying = null!;
|
||||
private Transition _toPlanted = null!;
|
||||
|
||||
private ShapeCast3D _dashCast3D = null!;
|
||||
public Timer WeaponFlyingTick = null!;
|
||||
|
||||
private Transform3D _startTransform;
|
||||
private Vector3 _startMeshRotation;
|
||||
@@ -54,7 +92,23 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
|
||||
public StandardMaterial3D WeaponLocationIndicatorMaterial { get; set; } = null!;
|
||||
public MeshInstance3D WeaponMesh { get; set; } = null!;
|
||||
|
||||
public Tag WeaponLandTag;
|
||||
public Tag WeaponFlyingTickEventTag;
|
||||
public Tag WeaponStartedFlyingEventTag;
|
||||
public Tag WeaponStoppedFlyingEventTag;
|
||||
public Tag WeaponHandToFlyingEventTag;
|
||||
public Tag WeaponFlyingToHandEventTag;
|
||||
public Tag WeaponPlantedToHandEventTag;
|
||||
public Tag WeaponPlantedToFlyingEventTag;
|
||||
public Tag WeaponPlantedEventTag;
|
||||
|
||||
public Tag WeaponInHandStatusTag;
|
||||
public Tag WeaponFlyingStatusTag;
|
||||
public Tag WeaponPlantedStatusTag;
|
||||
|
||||
public Tag WeaponFlyingAbilityTag;
|
||||
|
||||
private RAbilityBase? _flyingAbility;
|
||||
public List<RAbilityBase> AbilityLoadout { get; } = [];
|
||||
|
||||
public void Init()
|
||||
{
|
||||
@@ -62,11 +116,18 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
|
||||
InHandState = StateChartState.Of(GetNode("StateChart/Root/InHand"));
|
||||
FlyingState = StateChartState.Of(GetNode("StateChart/Root/Flying"));
|
||||
PlantedState = StateChartState.Of(GetNode("StateChart/Root/Planted"));
|
||||
_handToFlying = Transition.Of(GetNode("StateChart/Root/InHand/ToFlying"));
|
||||
_flyingToHand = Transition.Of(GetNode("StateChart/Root/Flying/ToHand"));
|
||||
_plantedToHand = Transition.Of(GetNode("StateChart/Root/Planted/ToHand"));
|
||||
_plantedToFlying = Transition.Of(GetNode("StateChart/Root/Planted/ToFlying"));
|
||||
_toPlanted = Transition.Of(GetNode("StateChart/Root/ToPlanted"));
|
||||
|
||||
WeaponLocationIndicator = GetNode<MeshInstance3D>("WeaponLocationIndicator");
|
||||
WeaponLocationIndicator.Visible = false;
|
||||
WeaponLocationIndicatorMaterial = (WeaponLocationIndicator.GetActiveMaterial(0) as StandardMaterial3D)!;
|
||||
|
||||
WeaponFlyingTick = GetNode<Timer>("WeaponFlyingTick");
|
||||
|
||||
WeaponMesh = GetNode<MeshInstance3D>("Weapon");
|
||||
_startMeshRotation = WeaponMesh.Rotation;
|
||||
|
||||
@@ -74,26 +135,183 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
|
||||
Freeze = true;
|
||||
Visible = false;
|
||||
|
||||
var tagsManager = ForgeManager.GetTagsManager(this);
|
||||
var cuesManager = ForgeManager.GetCuesManager(this);
|
||||
var baseTags = new TagContainer(
|
||||
tagsManager,
|
||||
[
|
||||
Tag.RequestTag(tagsManager, "weapon")
|
||||
]);
|
||||
// Forge
|
||||
var tagsManager = ForgeManagers.Instance.TagsManager;
|
||||
var cuesManager = ForgeManagers.Instance.CuesManager;
|
||||
|
||||
Attributes = new EntityAttributes(new WeaponAttributeSet());
|
||||
Tags = new EntityTags(baseTags);
|
||||
WeaponFlyingTickEventTag = Tag.RequestTag(tagsManager, "events.weapon.flyingTick");
|
||||
WeaponStartedFlyingEventTag = Tag.RequestTag(tagsManager, "events.weapon.startedFlying");
|
||||
WeaponStoppedFlyingEventTag = Tag.RequestTag(tagsManager, "events.weapon.stoppedFlying");
|
||||
WeaponHandToFlyingEventTag = Tag.RequestTag(tagsManager, "events.weapon.handToFlying");
|
||||
WeaponFlyingToHandEventTag = Tag.RequestTag(tagsManager, "events.weapon.flyingToHand");
|
||||
WeaponPlantedToHandEventTag = Tag.RequestTag(tagsManager, "events.weapon.plantedToHand");
|
||||
WeaponPlantedToFlyingEventTag = Tag.RequestTag(tagsManager, "events.weapon.plantedToFlying");
|
||||
WeaponPlantedEventTag = Tag.RequestTag(tagsManager, "events.weapon.planted");
|
||||
|
||||
// WeaponInHandStatusTag = Tag.RequestTag(tagsManager, "status.weapon.inHand");
|
||||
// WeaponFlyingStatusTag = Tag.RequestTag(tagsManager, "status.weapon.flying");
|
||||
// WeaponPlantedStatusTag = Tag.RequestTag(tagsManager, "status.weapon.planted");
|
||||
|
||||
WeaponFlyingAbilityTag = Tag.RequestTag(tagsManager,"abilities.weapon.flying");
|
||||
|
||||
List<AttributeSet> attributeSetList = [];
|
||||
foreach (Node node in GetChildren())
|
||||
{
|
||||
if (node is ForgeAttributeSet attributeSetNode)
|
||||
{
|
||||
AttributeSet? attributeSet = attributeSetNode.GetAttributeSet();
|
||||
|
||||
if (attributeSet is not null)
|
||||
{
|
||||
attributeSetList.Add(attributeSet);
|
||||
}
|
||||
}
|
||||
}
|
||||
Attributes = new EntityAttributes([.. attributeSetList]);
|
||||
|
||||
Tags = new(BaseTags.GetTagContainer());
|
||||
EffectsManager = new EffectsManager(this, cuesManager);
|
||||
Abilities = new(this);
|
||||
Events = new();
|
||||
|
||||
WeaponLandTag = Tag.RequestTag(tagsManager, "events.weapon.land");
|
||||
CreateFlyingAbility();
|
||||
|
||||
BodyEntered += OnThrownWeaponReachesGround;
|
||||
|
||||
InHandState.StateExited += WeaponLeft;
|
||||
InHandState.StateEntered += WeaponBack;
|
||||
|
||||
_handToFlying.Taken += () =>
|
||||
{
|
||||
Events.Raise(new EventData<WeaponEventPayload>
|
||||
{
|
||||
EventTags = WeaponHandToFlyingEventTag.GetSingleTagContainer()!,
|
||||
Source = this,
|
||||
Payload = new WeaponEventPayload(Message: "handToFlying")
|
||||
});
|
||||
Events.Raise(new EventData<WeaponEventPayload>
|
||||
{
|
||||
EventTags = WeaponStartedFlyingEventTag.GetSingleTagContainer()!,
|
||||
Source = this,
|
||||
Payload = new WeaponEventPayload(Message: "startedFlying")
|
||||
});
|
||||
};
|
||||
|
||||
_flyingToHand.Taken += () =>
|
||||
{
|
||||
Events.Raise(new EventData<WeaponEventPayload>
|
||||
{
|
||||
EventTags = WeaponFlyingToHandEventTag.GetSingleTagContainer()!,
|
||||
Source = this,
|
||||
Payload = new WeaponEventPayload(Message: "flyingToHand")
|
||||
});
|
||||
Events.Raise(new EventData<WeaponEventPayload>
|
||||
{
|
||||
EventTags = WeaponStoppedFlyingEventTag.GetSingleTagContainer()!,
|
||||
Source = this,
|
||||
Payload = new WeaponEventPayload(Message: "stoppedFlying")
|
||||
});
|
||||
};
|
||||
|
||||
_plantedToHand.Taken += () =>
|
||||
{
|
||||
Events.Raise(new EventData<WeaponEventPayload>
|
||||
{
|
||||
EventTags = WeaponPlantedToHandEventTag.GetSingleTagContainer()!,
|
||||
Source = this,
|
||||
Payload = new WeaponEventPayload(Message: "plantedToHand")
|
||||
});
|
||||
};
|
||||
|
||||
_plantedToFlying.Taken += () =>
|
||||
{
|
||||
Events.Raise(new EventData<WeaponEventPayload>
|
||||
{
|
||||
EventTags = WeaponPlantedToFlyingEventTag.GetSingleTagContainer()!,
|
||||
Source = this,
|
||||
Payload = new WeaponEventPayload(Message: "plantedToFlying")
|
||||
});
|
||||
Events.Raise(new EventData<WeaponEventPayload>
|
||||
{
|
||||
EventTags = WeaponStartedFlyingEventTag.GetSingleTagContainer()!,
|
||||
Source = this,
|
||||
Payload = new WeaponEventPayload(Message: "startedFlying")
|
||||
});
|
||||
};
|
||||
|
||||
_toPlanted.Taken += () =>
|
||||
{
|
||||
Events.Raise(new EventData<WeaponEventPayload>
|
||||
{
|
||||
EventTags = WeaponPlantedEventTag.GetSingleTagContainer()!,
|
||||
Source = this,
|
||||
Target = _plantedEntity,
|
||||
Payload = new WeaponEventPayload(Message: "planted")
|
||||
});
|
||||
Events.Raise(new EventData<WeaponEventPayload>
|
||||
{
|
||||
EventTags = WeaponStoppedFlyingEventTag.GetSingleTagContainer()!,
|
||||
Source = this,
|
||||
Payload = new WeaponEventPayload(Message: "stoppedFlying")
|
||||
});
|
||||
};
|
||||
|
||||
Events.Subscribe<WeaponEventPayload>(WeaponStoppedFlyingEventTag, data =>
|
||||
{
|
||||
_weaponFlyingAbility.Cancel();
|
||||
});
|
||||
}
|
||||
private ActiveEffectHandle? _flyingWeaponEffectHandle;
|
||||
|
||||
public void CreateFlyingAbility()
|
||||
{
|
||||
var flyingWeaponEffectData = new EffectData(
|
||||
"Flying Weapon Effect Data",
|
||||
new DurationData(DurationType.Infinite),
|
||||
customExecutions:
|
||||
[
|
||||
new FlyingWeaponExecution(this)
|
||||
],
|
||||
periodicData: new PeriodicData(new ScalableFloat(0.2f), false, PeriodInhibitionRemovedPolicy.ResetPeriod)
|
||||
);
|
||||
|
||||
var weaponHandToFlyingAbilityData = new AbilityData(
|
||||
name: "WeaponHandToFlyingSword",
|
||||
abilityTags: WeaponFlyingAbilityTag.GetSingleTagContainer(),
|
||||
instancingPolicy: AbilityInstancingPolicy.PerEntity,
|
||||
abilityTriggerData: AbilityTriggerData.ForEvent<WeaponEventPayload>(WeaponStartedFlyingEventTag),
|
||||
behaviorFactory: () => new FlyingSwordBehavior(this, flyingWeaponEffectData));
|
||||
_weaponFlyingAbility = Abilities.GrantAbilityPermanently(weaponHandToFlyingAbilityData, 1, LevelComparison.None, this);
|
||||
}
|
||||
|
||||
private AbilityHandle _weaponFlyingAbility;
|
||||
|
||||
public void GrantNewAbilityForWeaponFly(RExplodingSword ability)
|
||||
{
|
||||
var weaponFlyingAbilityData = new AbilityData(
|
||||
name: "WeaponFlyingSwordAbility",
|
||||
abilityTags: WeaponFlyingAbilityTag.GetSingleTagContainer(),
|
||||
instancingPolicy: AbilityInstancingPolicy.PerEntity,
|
||||
abilityTriggerData: AbilityTriggerData.ForEvent<WeaponEventPayload>(WeaponFlyingTickEventTag),
|
||||
behaviorFactory: () => ability.Behavior(new ExplodingSwordCreation(this)));
|
||||
|
||||
var weaponFlyGrantAbilityConfig = new GrantAbilityConfig(
|
||||
weaponFlyingAbilityData,
|
||||
ScalableLevel: new ScalableInt(1),
|
||||
RemovalPolicy: AbilityDeactivationPolicy.CancelImmediately,
|
||||
InhibitionPolicy: AbilityDeactivationPolicy.CancelImmediately,
|
||||
TryActivateOnGrant: false,
|
||||
TryActivateOnEnable: false,
|
||||
LevelOverridePolicy: LevelComparison.Higher);
|
||||
|
||||
var weaponFlyGrantComponent = new GrantAbilityEffectComponent([weaponFlyGrantAbilityConfig]);
|
||||
var weaponFlyGrantEffect = new EffectData(
|
||||
"Grant Weapon Fly Ability",
|
||||
new DurationData(DurationType.Infinite),
|
||||
effectComponents: [weaponFlyGrantComponent]);
|
||||
EffectsManager.ApplyEffect(new Effect(weaponFlyGrantEffect, new EffectOwnership(this, this)));
|
||||
|
||||
GD.Print("New weapon flight ability granted");
|
||||
}
|
||||
|
||||
public void WeaponLeft()
|
||||
@@ -122,14 +340,11 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
|
||||
{
|
||||
_weaponState.SendEvent("throw");
|
||||
|
||||
// WeaponLocationIndicatorMaterial.StencilColor = new Color(1f, 1f, 1f);
|
||||
|
||||
_throwDirection = (end - GlobalPosition).Normalized();
|
||||
PlantLocation = collisionLocation;
|
||||
PlantNormal = collisionNormal;
|
||||
LookAt(end);
|
||||
|
||||
|
||||
var tween = GetTree().CreateTween();
|
||||
tween.TweenProperty(this, "global_position", end, StraightThrowDuration);
|
||||
if (hasHit)
|
||||
@@ -141,25 +356,14 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
|
||||
tween.Finished += ThrowWeaponOnCurve;
|
||||
}
|
||||
|
||||
public void RaiseWeaponLandEvent(IForgeEntity? victim = null)
|
||||
{
|
||||
Events.Raise(new EventData<WeaponLandPayload>
|
||||
{
|
||||
EventTags = WeaponLandTag.GetSingleTagContainer(),
|
||||
Source = this,
|
||||
Target = victim,
|
||||
EventMagnitude = 25f,
|
||||
Payload = new WeaponLandPayload(Damage: 25, IsCritical: true)
|
||||
});
|
||||
}
|
||||
|
||||
private IForgeEntity? _plantedEntity;
|
||||
public void PlantInEnemy(Node3D enemy)
|
||||
{
|
||||
GetTree().GetRoot().CallDeferred(Node.MethodName.RemoveChild, this);
|
||||
enemy.CallDeferred(Node.MethodName.AddChild, this);
|
||||
|
||||
if (enemy is IForgeEntity victim) RaiseWeaponLandEvent(victim);
|
||||
else RaiseWeaponLandEvent();
|
||||
if (enemy is IForgeEntity victim) _plantedEntity = victim;
|
||||
else _plantedEntity = null;
|
||||
|
||||
if (enemy is IDamageable damageable)
|
||||
{
|
||||
@@ -170,6 +374,7 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
|
||||
public void RethrowWeapon()
|
||||
{
|
||||
_weaponState.SendEvent("throw");
|
||||
|
||||
_throwDirection = Vector3.Up;
|
||||
ThrowWeaponOnCurve();
|
||||
}
|
||||
@@ -182,17 +387,14 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
|
||||
|
||||
public void PlantWeaponInWall()
|
||||
{
|
||||
_weaponState.SendEvent("plant");
|
||||
|
||||
Freeze = true;
|
||||
WeaponMesh.Rotation = _startMeshRotation;
|
||||
|
||||
// WeaponLocationIndicatorMaterial.StencilColor = new Color(1f, 0.2f, 0.2f);
|
||||
if (PlantObject is Node3D node)
|
||||
{
|
||||
PlantInEnemy(node);
|
||||
}
|
||||
else RaiseWeaponLandEvent();
|
||||
|
||||
_weaponState.SendEvent("plant");
|
||||
|
||||
CallDeferred(Node3D.MethodName.SetGlobalPosition, PlantLocation);
|
||||
CallDeferred(Node3D.MethodName.LookAt, GlobalTransform.Origin + PlantNormal, Vector3.Up, true);
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
|
||||
[ext_resource type="Script" uid="uid://iii3wfto4t5b" path="res://scenes/player_controller/components/weapon/WeaponSystem.cs" id="1_csqwk"]
|
||||
[ext_resource type="Script" uid="uid://jitubgv6judn" path="res://scenes/components/damage/RDamage.cs" id="2_m0v1h"]
|
||||
[ext_resource type="Script" uid="uid://cxihb42t2mfqi" path="res://addons/forge/nodes/ForgeAttributeSet.cs" id="3_3xjpi"]
|
||||
[ext_resource type="Script" uid="uid://couw105c3bde4" path="res://addons/godot_state_charts/state_chart.gd" id="3_5owyf"]
|
||||
[ext_resource type="ArrayMesh" uid="uid://cho5fixitrbds" path="res://assets/meshes/swords/resources/sword23.tres" id="3_svc06"]
|
||||
[ext_resource type="Script" uid="uid://ccovd5i0wr3kk" path="res://addons/forge/editor/attributes/AttributeValues.cs" id="4_q6xv7"]
|
||||
[ext_resource type="Script" uid="uid://jk2jm1g6q853" path="res://addons/godot_state_charts/compound_state.gd" id="4_svc06"]
|
||||
[ext_resource type="Script" uid="uid://cytafq8i1y8qm" path="res://addons/godot_state_charts/atomic_state.gd" id="5_m0v1h"]
|
||||
[ext_resource type="Script" uid="uid://cf1nsco3w0mf6" path="res://addons/godot_state_charts/transition.gd" id="6_jpdh0"]
|
||||
@@ -13,6 +15,12 @@ script = ExtResource("2_m0v1h")
|
||||
DamageDealt = 2.0
|
||||
metadata/_custom_type_script = "uid://jitubgv6judn"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_pgbtr"]
|
||||
script = ExtResource("4_q6xv7")
|
||||
Default = 1
|
||||
Min = 1
|
||||
Max = 100
|
||||
|
||||
[sub_resource type="CylinderShape3D" id="CylinderShape3D_avini"]
|
||||
height = 1.0
|
||||
radius = 0.1
|
||||
@@ -50,6 +58,17 @@ max_contacts_reported = 1
|
||||
script = ExtResource("1_csqwk")
|
||||
RDamage = SubResource("Resource_jpdh0")
|
||||
|
||||
[node name="WeaponAttributeSet" type="Node" parent="." unique_id=14845649]
|
||||
script = ExtResource("3_3xjpi")
|
||||
AttributeSetClass = "WeaponAttributeSet"
|
||||
InitialAttributeValues = Dictionary[String, ExtResource("4_q6xv7")]({
|
||||
"Level": SubResource("Resource_pgbtr")
|
||||
})
|
||||
metadata/_custom_type_script = "uid://cxihb42t2mfqi"
|
||||
|
||||
[node name="WeaponFlyingTick" type="Timer" parent="." unique_id=656309486]
|
||||
wait_time = 0.2
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="." unique_id=884463982]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0)
|
||||
shape = SubResource("CylinderShape3D_avini")
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
[gd_resource type="Resource" script_class="RExplodingSwordThrow" format=3 uid="uid://cdxbwirfiaipi"]
|
||||
[gd_resource type="Resource" script_class="RExplodingSword" format=3 uid="uid://cdxbwirfiaipi"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://rux15j7q78e8" path="res://forge/abilities/RExplodingSwordThrow.cs" id="1_5iq8v"]
|
||||
[ext_resource type="PackedScene" uid="uid://duju3atqgltkg" path="res://scenes/explosion/explosion.tscn" id="1_aru71"]
|
||||
[ext_resource type="Script" path="res://forge/abilities/RExplodingSword.cs" id="2_syk3q"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_5iq8v")
|
||||
Cost = 20.0
|
||||
script = ExtResource("2_syk3q")
|
||||
Explosion = ExtResource("1_aru71")
|
||||
Cost = 10.0
|
||||
metadata/_custom_type_script = "uid://rux15j7q78e8"
|
||||
|
||||
@@ -1,12 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Gamesmiths.Forge.Abilities;
|
||||
using Gamesmiths.Forge.Attributes;
|
||||
using Gamesmiths.Forge.Core;
|
||||
using Gamesmiths.Forge.Effects;
|
||||
using Gamesmiths.Forge.Effects.Calculator;
|
||||
using Gamesmiths.Forge.Effects.Components;
|
||||
using Gamesmiths.Forge.Effects.Duration;
|
||||
using Gamesmiths.Forge.Effects.Magnitudes;
|
||||
using Gamesmiths.Forge.Effects.Modifiers;
|
||||
using Gamesmiths.Forge.Effects.Periodic;
|
||||
using Gamesmiths.Forge.Events;
|
||||
using Gamesmiths.Forge.Godot.Core;
|
||||
using Gamesmiths.Forge.Godot.Nodes;
|
||||
using Gamesmiths.Forge.Godot.Resources;
|
||||
using Gamesmiths.Forge.Godot.Resources.Abilities;
|
||||
using Gamesmiths.Forge.Tags;
|
||||
|
||||
using Godot;
|
||||
@@ -19,6 +27,7 @@ using Movementtests.player_controller.Scripts;
|
||||
using Movementtests.scenes.player_controller.scripts;
|
||||
using Movementtests.tools;
|
||||
using Movementtests.forge.abilities;
|
||||
using Movementtests.tools.calculators;
|
||||
using Movementtests.tools.effects;
|
||||
using RustyOptions;
|
||||
|
||||
@@ -103,12 +112,14 @@ public partial class PlayerController : CharacterBody3D,
|
||||
// Forge stuff
|
||||
[ExportCategory("Forge")]
|
||||
[ExportGroup("General")]
|
||||
[Export]
|
||||
public ForgeTagContainer BaseTags { get; set; } = new();
|
||||
[Export] public REmpoweredAction EmpoweredAction = null!;
|
||||
[Export] public RManaRegen ManaRegen = null!;
|
||||
|
||||
[ExportGroup("Abilities")]
|
||||
[ExportSubgroup("WeaponThrow")]
|
||||
[Export] public RAbilityBase[] AbilityLoadout = [];
|
||||
[Export] public RExplodingSword[] AbilityLoadout = [];
|
||||
|
||||
// Combat stuff
|
||||
[ExportCategory("Combat")]
|
||||
@@ -436,16 +447,24 @@ public partial class PlayerController : CharacterBody3D,
|
||||
_aimAssisRayCast.TargetPosition = _aimAssisRayCast.TargetPosition.Normalized() * (TargetingDistance*1.5f);
|
||||
|
||||
// Forge stuff
|
||||
var tagsManager = ForgeManager.GetTagsManager(this);
|
||||
var cuesManager = ForgeManager.GetCuesManager(this);
|
||||
var baseTags = new TagContainer(
|
||||
tagsManager,
|
||||
[
|
||||
Tag.RequestTag(tagsManager, "character.player")
|
||||
]);
|
||||
var tagsManager = ForgeManagers.Instance.TagsManager;
|
||||
var cuesManager = ForgeManagers.Instance.CuesManager;
|
||||
|
||||
Attributes = new EntityAttributes(new PlayerAttributeSet());
|
||||
Tags = new EntityTags(baseTags);
|
||||
List<AttributeSet> attributeSetList = [];
|
||||
foreach (Node node in GetChildren())
|
||||
{
|
||||
if (node is ForgeAttributeSet attributeSetNode)
|
||||
{
|
||||
AttributeSet? attributeSet = attributeSetNode.GetAttributeSet();
|
||||
|
||||
if (attributeSet is not null)
|
||||
{
|
||||
attributeSetList.Add(attributeSet);
|
||||
}
|
||||
}
|
||||
}
|
||||
Attributes = new EntityAttributes([.. attributeSetList]);
|
||||
Tags = new(BaseTags.GetTagContainer());
|
||||
EffectsManager = new EffectsManager(this, cuesManager);
|
||||
Abilities = new(this);
|
||||
Events = new();
|
||||
@@ -461,11 +480,6 @@ public partial class PlayerController : CharacterBody3D,
|
||||
var manaRegenEffect = new Effect(ManaRegen.ManaRegen(tagsManager), new EffectOwnership(this, this));
|
||||
_manaRegenEffectHandle = EffectsManager.ApplyEffect(manaRegenEffect);
|
||||
|
||||
var health = Attributes["PlayerAttributeSet.Health"].CurrentValue; // 100
|
||||
var mana = Attributes["PlayerAttributeSet.Mana"].CurrentValue; // 100
|
||||
var strength = Attributes["PlayerAttributeSet.Strength"].CurrentValue; // 10
|
||||
var speed = Attributes["PlayerAttributeSet.Speed"].CurrentValue; // 5
|
||||
|
||||
// DashIndicator = GetNode<TextureRect>("%DashIndicator");
|
||||
PowerCooldownIndicator = GetNode<ColorRect>("%DashCooldownIndicator");
|
||||
PowerCooldownIndicator.Visible = false;
|
||||
@@ -707,8 +721,9 @@ public partial class PlayerController : CharacterBody3D,
|
||||
|
||||
foreach (var weaponLandAbility in AbilityLoadout)
|
||||
{
|
||||
var grantAbilityConfig = new GrantAbilityConfig(
|
||||
weaponLandAbility.Ability(tagsManager, WeaponSystem),
|
||||
var weaponLeftTag = Tag.RequestTag(tagsManager,"abilities.weapon.left").GetSingleTagContainer();
|
||||
var leftGrantAbilityConfig = new GrantAbilityConfig(
|
||||
weaponLandAbility.Ability(new ExplodingSwordCreation(WeaponSystem), weaponLeftTag),
|
||||
ScalableLevel: new ScalableInt(1),
|
||||
RemovalPolicy: AbilityDeactivationPolicy.CancelImmediately,
|
||||
InhibitionPolicy: AbilityDeactivationPolicy.CancelImmediately,
|
||||
@@ -716,35 +731,62 @@ public partial class PlayerController : CharacterBody3D,
|
||||
TryActivateOnEnable: false,
|
||||
LevelOverridePolicy: LevelComparison.Higher);
|
||||
|
||||
var grantComponent = new GrantAbilityEffectComponent([grantAbilityConfig]);
|
||||
var grantEffect = new EffectData(
|
||||
var leftGrantComponent = new GrantAbilityEffectComponent([leftGrantAbilityConfig]);
|
||||
var leftGrantEffect = new EffectData(
|
||||
"Grant Weapon Left Ability",
|
||||
new DurationData(DurationType.Infinite),
|
||||
effectComponents: [leftGrantComponent]);
|
||||
EffectsManager.ApplyEffect(new Effect(leftGrantEffect, new EffectOwnership(this, this)));
|
||||
|
||||
var weaponLandedTag = Tag.RequestTag(tagsManager, "abilities.weapon.land").GetSingleTagContainer();
|
||||
var landGrantAbilityConfig = new GrantAbilityConfig(
|
||||
weaponLandAbility.Ability(new ExplodingSwordCreation(WeaponSystem), weaponLandedTag),
|
||||
ScalableLevel: new ScalableInt(1),
|
||||
RemovalPolicy: AbilityDeactivationPolicy.CancelImmediately,
|
||||
InhibitionPolicy: AbilityDeactivationPolicy.CancelImmediately,
|
||||
TryActivateOnGrant: false,
|
||||
TryActivateOnEnable: false,
|
||||
LevelOverridePolicy: LevelComparison.Higher);
|
||||
|
||||
var landGrantComponent = new GrantAbilityEffectComponent([landGrantAbilityConfig]);
|
||||
var landGrantEffect = new EffectData(
|
||||
"Grant Weapon Land Ability",
|
||||
new DurationData(DurationType.Infinite),
|
||||
effectComponents: [grantComponent]);
|
||||
EffectsManager.ApplyEffect(new Effect(grantEffect, new EffectOwnership(this, this)));
|
||||
}
|
||||
effectComponents: [landGrantComponent]);
|
||||
EffectsManager.ApplyEffect(new Effect(landGrantEffect, new EffectOwnership(this, this)));
|
||||
|
||||
GetTree().CreateTimer(5).Timeout += () => WeaponSystem.GrantNewAbilityForWeaponFly(weaponLandAbility);
|
||||
}
|
||||
// Forge events
|
||||
EventSubscriptionToken token = WeaponSystem.Events.Subscribe<WeaponLandPayload>(WeaponSystem.WeaponLandTag, OnWeaponLanded);
|
||||
var weaponLeftToken = WeaponSystem.Events.Subscribe<WeaponEventPayload>(WeaponSystem.WeaponStartedFlyingEventTag, OnWeaponLeft);
|
||||
var weaponLandedToken = WeaponSystem.Events.Subscribe<WeaponEventPayload>(WeaponSystem.WeaponStoppedFlyingEventTag, OnWeaponLanded);
|
||||
}
|
||||
|
||||
public void OnWeaponLanded(EventData<WeaponLandPayload> data)
|
||||
public void OnWeaponLeft(EventData<WeaponEventPayload> data)
|
||||
{
|
||||
var target = data.Target;
|
||||
|
||||
var tagsManager = ForgeManagers.Instance.TagsManager;
|
||||
var weaponLeftTag = Tag.RequestTag(tagsManager, "abilities.weapon.left").GetSingleTagContainer();
|
||||
if (weaponLeftTag == null) return;
|
||||
Abilities.TryActivateAbilitiesByTag(weaponLeftTag, target, out var landedFailures);
|
||||
}
|
||||
|
||||
public void OnWeaponLanded(EventData<WeaponEventPayload> data)
|
||||
{
|
||||
var source = data.Source;
|
||||
var target = data.Target;
|
||||
var magnitude = data.EventMagnitude;
|
||||
var weaponLandPayload = data.Payload;
|
||||
|
||||
var tagsManager = ForgeManager.GetTagsManager(this);
|
||||
var tagsManager = ForgeManagers.Instance.TagsManager;
|
||||
|
||||
var weaponLandTag = Tag.RequestTag(tagsManager, "abilities.weapon.land").GetSingleTagContainer();
|
||||
if (weaponLandTag == null) return;
|
||||
var anyActivated = Abilities.TryActivateAbilitiesByTag(
|
||||
weaponLandTag,
|
||||
target,
|
||||
out var failures);
|
||||
if (anyActivated)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user