Replicated the weapon flying tick setup using resources
This commit is contained in:
@@ -14,6 +14,7 @@ using Gamesmiths.Forge.Godot.Core;
|
||||
using Gamesmiths.Forge.Godot.Nodes;
|
||||
using Gamesmiths.Forge.Godot.Resources;
|
||||
using Gamesmiths.Forge.Godot.Resources.Abilities;
|
||||
using Gamesmiths.Forge.Statescript;
|
||||
using Gamesmiths.Forge.Tags;
|
||||
using Godot;
|
||||
using GodotStateCharts;
|
||||
@@ -24,6 +25,7 @@ using Movementtests.scenes.player_controller.components.weapon;
|
||||
using Movementtests.systems.damage;
|
||||
using Movementtests.tools;
|
||||
using Movementtests.tools.calculators;
|
||||
using Node = Godot.Node;
|
||||
|
||||
namespace Movementtests.systems;
|
||||
|
||||
@@ -54,7 +56,8 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
|
||||
public EffectsManager EffectsManager { get; set; } = null!;
|
||||
public EntityAbilities Abilities { get; set; } = null!;
|
||||
public EventManager Events { get; set; } = null!;
|
||||
|
||||
public Variables SharedVariables { get; }
|
||||
|
||||
private StateChart _weaponState = null!;
|
||||
public StateChartState InHandState = null!;
|
||||
public StateChartState FlyingState = null!;
|
||||
@@ -162,7 +165,7 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
|
||||
Events = new();
|
||||
|
||||
// TODO: Waiting on bug resolve
|
||||
// _weaponFlyingAbility = Abilities.GrantAbilityPermanently(FlyingTickAbility.GetAbilityData(), 1, LevelComparison.None, this);
|
||||
_weaponFlyingAbility = Abilities.GrantAbilityPermanently(FlyingTickAbility.GetAbilityData(), 1, LevelComparison.None, this);
|
||||
|
||||
foreach (var ability in WeaponAbilities)
|
||||
{
|
||||
@@ -257,7 +260,7 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
|
||||
Events.Subscribe(WeaponStoppedFlyingEventTag, data =>
|
||||
{
|
||||
// TODO: Waiting on bug resolve
|
||||
// _weaponFlyingAbility.Cancel();
|
||||
_weaponFlyingAbility.Cancel();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
[ext_resource type="Script" uid="uid://couw105c3bde4" path="res://addons/godot_state_charts/state_chart.gd" id="3_5owyf"]
|
||||
[ext_resource type="Resource" uid="uid://busdbvfi3jiic" path="res://scenes/player_controller/resources/forge/exploding_sword_weapon_left.tres" id="3_7bruw"]
|
||||
[ext_resource type="ArrayMesh" uid="uid://cho5fixitrbds" path="res://assets/meshes/swords/resources/sword23.tres" id="3_svc06"]
|
||||
[ext_resource type="Resource" uid="uid://bl0mng4kl1xy8" path="res://scenes/player_controller/resources/forge/exploding_sword_weapon_flight.tres" id="4_2wsgo"]
|
||||
[ext_resource type="Resource" uid="uid://btnnpqann3ktp" path="res://scenes/player_controller/resources/forge/weapon_flying_tick_ability.tres" id="4_7bruw"]
|
||||
[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"]
|
||||
@@ -59,7 +60,7 @@ continuous_cd = true
|
||||
contact_monitor = true
|
||||
max_contacts_reported = 1
|
||||
script = ExtResource("1_csqwk")
|
||||
WeaponAbilities = [ExtResource("2_pgbtr"), ExtResource("3_7bruw")]
|
||||
WeaponAbilities = [ExtResource("2_pgbtr"), ExtResource("3_7bruw"), ExtResource("4_2wsgo")]
|
||||
FlyingTickAbility = ExtResource("4_7bruw")
|
||||
RDamage = SubResource("Resource_jpdh0")
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
[sub_resource type="Resource" id="Resource_gi65x"]
|
||||
script = ExtResource("1_bi1d8")
|
||||
ContainerTags = Array[String](["character.player.mana.regen.inhibited"])
|
||||
ContainerTags = Array[String](["character.player.mana.regen.inhibited", "cues.resources.mana.inhibited"])
|
||||
metadata/_custom_type_script = "uid://cw525n4mjqgw0"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_bi1d8"]
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
[sub_resource type="Resource" id="Resource_5yygy"]
|
||||
script = ExtResource("1_q8tml")
|
||||
ContainerTags = Array[String](["character.player.mana.regen.inhibited"])
|
||||
ContainerTags = Array[String](["character.player.mana.regen.inhibited", "cues.resources.mana.inhibited"])
|
||||
metadata/_custom_type_script = "uid://cw525n4mjqgw0"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_ncjx6"]
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
[gd_resource type="Resource" script_class="ForgeRaiseEventTagExecution" format=3 uid="uid://oe2suroa1klj"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cw525n4mjqgw0" path="res://addons/forge/resources/ForgeTagContainer.cs" id="1_iqjlm"]
|
||||
[ext_resource type="Script" path="res://forge/calculators/ForgeRaiseEventTagExecution.cs" id="2_am2ak"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_sxbq4"]
|
||||
script = ExtResource("1_iqjlm")
|
||||
ContainerTags = Array[String](["events.weapon.flyingtick"])
|
||||
[ext_resource type="Resource" uid="uid://x7vtcobi7s4r" path="res://scenes/player_controller/resources/forge/weapon_flyingtick_tagcontainer.tres" id="1_ce5fv"]
|
||||
[ext_resource type="Script" uid="uid://br7ut4lbau66w" path="res://forge/calculators/ForgeRaiseEventTagExecution.cs" id="2_am2ak"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("2_am2ak")
|
||||
EventTags = ExtResource("1_ce5fv")
|
||||
metadata/_custom_type_script = "uid://br7ut4lbau66w"
|
||||
|
||||
@@ -23,6 +23,7 @@ BaseValue = 1
|
||||
|
||||
[sub_resource type="Resource" id="Resource_esyoj"]
|
||||
script = ExtResource("4_e2sm2")
|
||||
Name = "Call Flying Tick Event Periodically"
|
||||
Modifiers = []
|
||||
Components = []
|
||||
Executions = Array[Object]([ExtResource("1_pdt6v")])
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
[gd_resource type="Resource" script_class="ForgeTagContainer" format=3 uid="uid://x7vtcobi7s4r"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cw525n4mjqgw0" path="res://addons/forge/resources/ForgeTagContainer.cs" id="1_nlohk"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_nlohk")
|
||||
ContainerTags = Array[String](["events.weapon.flyingtick"])
|
||||
@@ -15,6 +15,7 @@ using Gamesmiths.Forge.Godot.Core;
|
||||
using Gamesmiths.Forge.Godot.Nodes;
|
||||
using Gamesmiths.Forge.Godot.Resources;
|
||||
using Gamesmiths.Forge.Godot.Resources.Abilities;
|
||||
using Gamesmiths.Forge.Statescript;
|
||||
using Gamesmiths.Forge.Tags;
|
||||
|
||||
using Godot;
|
||||
@@ -29,6 +30,7 @@ using Movementtests.tools;
|
||||
using Movementtests.forge.abilities;
|
||||
using Movementtests.tools.calculators;
|
||||
using RustyOptions;
|
||||
using Node = Godot.Node;
|
||||
|
||||
public record struct EmpoweredActionPayload;
|
||||
|
||||
@@ -103,6 +105,7 @@ public partial class PlayerController : CharacterBody3D,
|
||||
public EffectsManager EffectsManager { get; set; } = null!;
|
||||
public EntityAbilities Abilities { get; set; } = null!;
|
||||
public EventManager Events { get; set; } = null!;
|
||||
public Variables SharedVariables { get; }
|
||||
|
||||
// Inspector stuff
|
||||
[Export] public Marker3D TutorialWeaponTarget = null!;
|
||||
@@ -763,7 +766,6 @@ public partial class PlayerController : CharacterBody3D,
|
||||
effectComponents: [leftGrantComponent]);
|
||||
EffectsManager.ApplyEffect(new Effect(leftGrantEffect, new EffectOwnership(this, this)));
|
||||
}
|
||||
// GetTree().CreateTimer(5).Timeout += () => WeaponSystem.GrantNewAbilityForWeaponFly(weaponLandAbility);
|
||||
// Forge events
|
||||
var weaponLeftToken = WeaponSystem.Events.Subscribe(WeaponSystem.WeaponStartedFlyingEventTag, OnWeaponLeft);
|
||||
var weaponLandedToken = WeaponSystem.Events.Subscribe(WeaponSystem.WeaponStoppedFlyingEventTag, OnWeaponLanded);
|
||||
|
||||
Reference in New Issue
Block a user