Made a menu to select abilities and grant them (with a few hardcoded stuff)
This commit is contained in:
@@ -24,6 +24,8 @@ var _initial_focus_control
|
||||
var _scene_tree : SceneTree
|
||||
|
||||
func _exit_tree() -> void:
|
||||
if Engine.is_editor_hint(): return
|
||||
|
||||
GUIDE.disable_mapping_context(menu_context)
|
||||
for previous_context in previous_mapping_contexts:
|
||||
GUIDE.enable_mapping_context(previous_context)
|
||||
|
||||
55
menus/scenes/components/AbilitySelection.cs
Normal file
55
menus/scenes/components/AbilitySelection.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using Godot;
|
||||
using Movementtests.systems;
|
||||
|
||||
[Tool, GlobalClass]
|
||||
public partial class AbilitySelection : Control
|
||||
{
|
||||
[Signal] public delegate void AbilityAddedEventHandler(WeaponSystem.WeaponEvent forEvent, string abilityName);
|
||||
|
||||
[Export] public WeaponSystem.WeaponEvent ForEvent { get; set; } = WeaponSystem.WeaponEvent.StartedFlying;
|
||||
|
||||
private string _title = string.Empty;
|
||||
[Export] public string Title {
|
||||
get => _title;
|
||||
set
|
||||
{
|
||||
_title = value;
|
||||
TitleChanged();
|
||||
}
|
||||
}
|
||||
|
||||
[Export] public PackedScene AbilitySelectionItem { get; set; }
|
||||
|
||||
private VBoxContainer _abilities;
|
||||
private MenuButton _addAbility;
|
||||
private PopupMenu _addAbilityMenu;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_abilities = GetNode<VBoxContainer>("%SelectedAbilities");
|
||||
_addAbility = GetNode<MenuButton>("%AddAbility");
|
||||
_addAbilityMenu = _addAbility.GetPopup();
|
||||
|
||||
_addAbilityMenu.IdPressed += AddAbilityMenuOnIdPressed;
|
||||
_addAbilityMenu.IndexPressed += AddAbilityMenuOnIndexPressed;
|
||||
}
|
||||
|
||||
private void AddAbilityMenuOnIndexPressed(long index)
|
||||
{
|
||||
var indexInt = Convert.ToInt32(index);
|
||||
var metadata = _addAbilityMenu.GetItemMetadata(indexInt);
|
||||
var name = _addAbilityMenu.GetItemText(indexInt);
|
||||
EmitSignalAbilityAdded(ForEvent, name);
|
||||
}
|
||||
|
||||
private void AddAbilityMenuOnIdPressed(long id)
|
||||
{
|
||||
}
|
||||
|
||||
public void TitleChanged()
|
||||
{
|
||||
var titleLabel = GetNode<Label>("%TitleLabel");
|
||||
titleLabel.Text = Title;
|
||||
}
|
||||
}
|
||||
1
menus/scenes/components/AbilitySelection.cs.uid
Normal file
1
menus/scenes/components/AbilitySelection.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://5emed8iegtui
|
||||
45
menus/scenes/components/ability_selection.tscn
Normal file
45
menus/scenes/components/ability_selection.tscn
Normal file
@@ -0,0 +1,45 @@
|
||||
[gd_scene format=3 uid="uid://dmv685sskgh3l"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://5emed8iegtui" path="res://menus/scenes/components/AbilitySelection.cs" id="1_fcxyu"]
|
||||
[ext_resource type="Texture2D" uid="uid://by5v33lu8v1fm" path="res://assets/ui/input-prompts/Flairs/Vector/flair_plus.svg" id="2_uf3m5"]
|
||||
[ext_resource type="Texture2D" uid="uid://c2akxlg7tdb67" path="res://assets/ui/IconGodotNode/node/icon_projectile.png" id="3_41pdy"]
|
||||
|
||||
[node name="AbilitySelection" type="MarginContainer" unique_id=1373426933]
|
||||
size_flags_horizontal = 3
|
||||
theme_override_constants/margin_left = 4
|
||||
theme_override_constants/margin_top = 4
|
||||
theme_override_constants/margin_right = 4
|
||||
theme_override_constants/margin_bottom = 4
|
||||
script = ExtResource("1_fcxyu")
|
||||
|
||||
[node name="HBoxContainer" type="VBoxContainer" parent="." unique_id=364343452]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="TitleLabel" type="Label" parent="HBoxContainer" unique_id=8350369]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
|
||||
[node name="SelectedAbilities" type="VBoxContainer" parent="HBoxContainer" unique_id=1173689490]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="HBoxContainer" unique_id=51872459]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 4
|
||||
theme_override_constants/margin_top = 4
|
||||
theme_override_constants/margin_right = 4
|
||||
theme_override_constants/margin_bottom = 4
|
||||
|
||||
[node name="PanelContainer" type="PanelContainer" parent="HBoxContainer/MarginContainer" unique_id=886085404]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="AddAbility" type="MenuButton" parent="HBoxContainer/MarginContainer/PanelContainer" unique_id=1898027483]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
focus_mode = 2
|
||||
text = "Add ability"
|
||||
icon = ExtResource("2_uf3m5")
|
||||
item_count = 1
|
||||
popup/item_0/text = "Weapon explosion"
|
||||
popup/item_0/icon = ExtResource("3_41pdy")
|
||||
popup/item_0/id = 0
|
||||
@@ -1,10 +1,28 @@
|
||||
using Godot;
|
||||
using Movementtests.systems;
|
||||
|
||||
[GlobalClass, Icon("res://assets/ui/IconGodotNode/control/icon_crate.png")]
|
||||
[Tool, GlobalClass, Icon("res://assets/ui/IconGodotNode/control/icon_crate.png")]
|
||||
public partial class Inventory : Control
|
||||
{
|
||||
public PlayerController? Player { get; set; }
|
||||
|
||||
private AbilitySelection _startedFlyingSelection;
|
||||
private AbilitySelection _whileFlyingSelection;
|
||||
private AbilitySelection _stoppedFlyingSelection;
|
||||
public override void _Ready()
|
||||
{
|
||||
_startedFlyingSelection = GetNode<AbilitySelection>("%StartedFlying");
|
||||
_whileFlyingSelection = GetNode<AbilitySelection>("%WhileFlying");
|
||||
_stoppedFlyingSelection = GetNode<AbilitySelection>("%StoppedFlying");
|
||||
|
||||
_startedFlyingSelection.AbilityAdded += AddAbilityForEvent;
|
||||
_whileFlyingSelection.AbilityAdded += AddAbilityForEvent;
|
||||
_stoppedFlyingSelection.AbilityAdded += AddAbilityForEvent;
|
||||
}
|
||||
|
||||
public void AddAbilityForEvent(WeaponSystem.WeaponEvent forEvent, string abilityName)
|
||||
{
|
||||
if (Player is null) return;
|
||||
Player.GrantWeaponExplosionAbilityForEvent(forEvent, abilityName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
[ext_resource type="Script" uid="uid://vu5kh5amnta" path="res://menus/scenes/overlaid_menus/inventory_wrapper.gd" id="1_yst23"]
|
||||
[ext_resource type="Script" uid="uid://1nf36h0gms3q" path="res://addons/maaacks_game_template/base/scripts/capture_focus.gd" id="2_ijoei"]
|
||||
[ext_resource type="Script" uid="uid://7yil0fiftvaf" path="res://menus/scenes/overlaid_menus/Inventory.cs" id="2_sb1gh"]
|
||||
[ext_resource type="PackedScene" uid="uid://dmv685sskgh3l" path="res://menus/scenes/components/ability_selection.tscn" id="3_ijoei"]
|
||||
|
||||
[node name="InventoryWrapper" type="Control" unique_id=1853168495]
|
||||
process_mode = 3
|
||||
@@ -68,99 +69,27 @@ vertical = true
|
||||
|
||||
[node name="PlayerSectionLabel" type="Label" parent="Inventory/MenuPanelContainer/MarginContainer/BoxContainer/PlayerSectionMargin/PlayerSection" unique_id=1100827847]
|
||||
layout_mode = 2
|
||||
text = "Player"
|
||||
text = "Weapon abilities"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="PlayerUtilsContainer" type="HBoxContainer" parent="Inventory/MenuPanelContainer/MarginContainer/BoxContainer/PlayerSectionMargin/PlayerSection" unique_id=993608648]
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="Inventory/MenuPanelContainer/MarginContainer/BoxContainer/PlayerSectionMargin/PlayerSection" unique_id=75337901]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
theme_override_constants/separation = 8
|
||||
|
||||
[node name="PlayerInvicibleToggle" type="CheckButton" parent="Inventory/MenuPanelContainer/MarginContainer/BoxContainer/PlayerSectionMargin/PlayerSection/PlayerUtilsContainer" unique_id=960956060]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Invincible"
|
||||
script = ExtResource("2_ijoei")
|
||||
search_depth = 10
|
||||
|
||||
[node name="KillPlayerButton" type="Button" parent="Inventory/MenuPanelContainer/MarginContainer/BoxContainer/PlayerSectionMargin/PlayerSection/PlayerUtilsContainer" unique_id=472828424]
|
||||
layout_mode = 2
|
||||
text = "Kill in 1s"
|
||||
|
||||
[node name="PlayerStatsContainer" type="VBoxContainer" parent="Inventory/MenuPanelContainer/MarginContainer/BoxContainer/PlayerSectionMargin/PlayerSection" unique_id=201095522]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
theme_override_constants/separation = 8
|
||||
|
||||
[node name="PlayerHealth" type="HBoxContainer" parent="Inventory/MenuPanelContainer/MarginContainer/BoxContainer/PlayerSectionMargin/PlayerSection/PlayerStatsContainer" unique_id=823599662]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
theme_override_constants/separation = 8
|
||||
|
||||
[node name="Label" type="Label" parent="Inventory/MenuPanelContainer/MarginContainer/BoxContainer/PlayerSectionMargin/PlayerSection/PlayerStatsContainer/PlayerHealth" unique_id=159028563]
|
||||
custom_minimum_size = Vector2(200, 0)
|
||||
layout_mode = 2
|
||||
text = "Player base health"
|
||||
|
||||
[node name="PlayerHealthSpinBox" type="SpinBox" parent="Inventory/MenuPanelContainer/MarginContainer/BoxContainer/PlayerSectionMargin/PlayerSection/PlayerStatsContainer/PlayerHealth" unique_id=211258886]
|
||||
[node name="StartedFlying" parent="Inventory/MenuPanelContainer/MarginContainer/BoxContainer/PlayerSectionMargin/PlayerSection/HBoxContainer" unique_id=1373426933 instance=ExtResource("3_ijoei")]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
min_value = 1.0
|
||||
max_value = 1000.0
|
||||
value = 1.0
|
||||
rounded = true
|
||||
allow_greater = true
|
||||
Title = "Started flying"
|
||||
|
||||
[node name="PlayerDamage" type="HBoxContainer" parent="Inventory/MenuPanelContainer/MarginContainer/BoxContainer/PlayerSectionMargin/PlayerSection/PlayerStatsContainer" unique_id=560862269]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
|
||||
[node name="Label" type="Label" parent="Inventory/MenuPanelContainer/MarginContainer/BoxContainer/PlayerSectionMargin/PlayerSection/PlayerStatsContainer/PlayerDamage" unique_id=16098677]
|
||||
custom_minimum_size = Vector2(200, 0)
|
||||
layout_mode = 2
|
||||
text = "Player damage"
|
||||
|
||||
[node name="PlayerDamageSpinBox" type="SpinBox" parent="Inventory/MenuPanelContainer/MarginContainer/BoxContainer/PlayerSectionMargin/PlayerSection/PlayerStatsContainer/PlayerDamage" unique_id=223936754]
|
||||
[node name="WhileFlying" parent="Inventory/MenuPanelContainer/MarginContainer/BoxContainer/PlayerSectionMargin/PlayerSection/HBoxContainer" unique_id=1771285257 instance=ExtResource("3_ijoei")]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
min_value = 1.0
|
||||
max_value = 1000.0
|
||||
value = 1.0
|
||||
rounded = true
|
||||
allow_greater = true
|
||||
ForEvent = 2
|
||||
Title = "While flying"
|
||||
|
||||
[node name="LevelSelectionMargin" type="MarginContainer" parent="Inventory/MenuPanelContainer/MarginContainer/BoxContainer" unique_id=517648431]
|
||||
[node name="StoppedFlying" parent="Inventory/MenuPanelContainer/MarginContainer/BoxContainer/PlayerSectionMargin/PlayerSection/HBoxContainer" unique_id=324047638 instance=ExtResource("3_ijoei")]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_top = 16
|
||||
theme_override_constants/margin_bottom = 16
|
||||
|
||||
[node name="LevelSelectionSection" type="BoxContainer" parent="Inventory/MenuPanelContainer/MarginContainer/BoxContainer/LevelSelectionMargin" unique_id=2038380087]
|
||||
custom_minimum_size = Vector2(128, 0)
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
theme_override_constants/separation = 16
|
||||
vertical = true
|
||||
|
||||
[node name="LevelSelectionLabel" type="Label" parent="Inventory/MenuPanelContainer/MarginContainer/BoxContainer/LevelSelectionMargin/LevelSelectionSection" unique_id=950442689]
|
||||
layout_mode = 2
|
||||
text = "Levels"
|
||||
|
||||
[node name="LevelSelectionContainer" type="HBoxContainer" parent="Inventory/MenuPanelContainer/MarginContainer/BoxContainer/LevelSelectionMargin/LevelSelectionSection" unique_id=1674253271]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
theme_override_constants/separation = 8
|
||||
|
||||
[node name="RestartCurrentButton" type="Button" parent="Inventory/MenuPanelContainer/MarginContainer/BoxContainer/LevelSelectionMargin/LevelSelectionSection/LevelSelectionContainer" unique_id=1059727667]
|
||||
layout_mode = 2
|
||||
text = "Restart current
|
||||
"
|
||||
|
||||
[node name="SelectLevel" type="Button" parent="Inventory/MenuPanelContainer/MarginContainer/BoxContainer/LevelSelectionMargin/LevelSelectionSection/LevelSelectionContainer" unique_id=2015444126]
|
||||
layout_mode = 2
|
||||
text = "Select level
|
||||
"
|
||||
|
||||
[connection signal="toggled" from="Inventory/MenuPanelContainer/MarginContainer/BoxContainer/PlayerSectionMargin/PlayerSection/PlayerUtilsContainer/PlayerInvicibleToggle" to="." method="_on_player_invicible_toggled"]
|
||||
[connection signal="pressed" from="Inventory/MenuPanelContainer/MarginContainer/BoxContainer/PlayerSectionMargin/PlayerSection/PlayerUtilsContainer/KillPlayerButton" to="." method="_on_kill_player_button_pressed"]
|
||||
[connection signal="value_changed" from="Inventory/MenuPanelContainer/MarginContainer/BoxContainer/PlayerSectionMargin/PlayerSection/PlayerStatsContainer/PlayerHealth/PlayerHealthSpinBox" to="." method="_on_player_health_changed"]
|
||||
[connection signal="value_changed" from="Inventory/MenuPanelContainer/MarginContainer/BoxContainer/PlayerSectionMargin/PlayerSection/PlayerStatsContainer/PlayerDamage/PlayerDamageSpinBox" to="." method="_on_player_damage_changed"]
|
||||
[connection signal="pressed" from="Inventory/MenuPanelContainer/MarginContainer/BoxContainer/LevelSelectionMargin/LevelSelectionSection/LevelSelectionContainer/RestartCurrentButton" to="." method="_on_restart_current_level_pressed"]
|
||||
[connection signal="pressed" from="Inventory/MenuPanelContainer/MarginContainer/BoxContainer/LevelSelectionMargin/LevelSelectionSection/LevelSelectionContainer/SelectLevel" to="." method="_on_select_level_pressed"]
|
||||
ForEvent = 1
|
||||
Title = "Stopped flying"
|
||||
|
||||
@@ -8,6 +8,7 @@ extends OverlaidMenu
|
||||
@onready var inventory: Control = %Inventory
|
||||
|
||||
func _ready() -> void:
|
||||
if Engine.is_editor_hint(): return
|
||||
inventory.Player = player
|
||||
|
||||
func _on_close_button_pressed() -> void:
|
||||
|
||||
@@ -15,7 +15,7 @@ warnings/check_invalid_track_paths=false
|
||||
[application]
|
||||
|
||||
config/name="Movement tests"
|
||||
run/main_scene="uid://dwo50456dv6va"
|
||||
run/main_scene="uid://cgi7qekk387cf"
|
||||
config/features=PackedStringArray("4.6", "C#", "Forward Plus")
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
[ext_resource type="Resource" uid="uid://ccrb5xsnphc8" path="res://inputs/base_mode/rotate_floorplane.tres" id="5_4u7i3"]
|
||||
[ext_resource type="PackedScene" uid="uid://hpsg4fqwrx1u" path="res://scenes/components/damage/CDamageable.tscn" id="5_jb43f"]
|
||||
[ext_resource type="Resource" uid="uid://f3vs6l4m623s" path="res://inputs/base_mode/move_left.tres" id="5_q14ux"]
|
||||
[ext_resource type="Resource" uid="uid://ifeavnlps7hy" path="res://scenes/player_controller/resources/forge/exploding_sword.tres" id="5_u8yay"]
|
||||
[ext_resource type="PackedScene" uid="uid://duju3atqgltkg" path="res://scenes/explosion/explosion.tscn" id="5_ue7xq"]
|
||||
[ext_resource type="Resource" uid="uid://dyru7mxo121w6" path="res://scenes/player_controller/resources/player_normal_damage_mod.tres" id="6_cmijs"]
|
||||
[ext_resource type="Resource" uid="uid://t612lts1wi1s" path="res://inputs/base_mode/move_right.tres" id="6_q7bng"]
|
||||
@@ -156,6 +157,7 @@ script = ExtResource("1_poq2x")
|
||||
BaseTags = SubResource("Resource_mpigw")
|
||||
EmpoweredActionUsed = SubResource("Resource_5gbhg")
|
||||
EmpoweredActionAbility = ExtResource("10_2rkt1")
|
||||
WeaponExplosionBehavior = ExtResource("5_u8yay")
|
||||
DefaultPermanentEffects = [ExtResource("5_2rkt1")]
|
||||
EmpoweredActionEffects = [ExtResource("6_u8yay")]
|
||||
AimAssistStrength = 0.3
|
||||
|
||||
@@ -251,7 +251,7 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
|
||||
FlyingTick
|
||||
}
|
||||
|
||||
public void GrantNewAbilityForEvent(WeaponEvent forEvent, ForgeAbilityData ability)
|
||||
public void GrantNewAbilityForEvent(WeaponEvent forEvent, ForgeAbilityBehavior abilityBehavior)
|
||||
{
|
||||
var abilitiesMap = new Dictionary<WeaponEvent, List<ActiveEffectHandle>>
|
||||
{
|
||||
@@ -260,8 +260,20 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
|
||||
{ WeaponEvent.FlyingTick, _grantedWeaponFlyingTickAbilities },
|
||||
};
|
||||
|
||||
var eventTagsMap = new Dictionary<WeaponEvent, Tag>
|
||||
{
|
||||
{ WeaponEvent.StartedFlying, WeaponStartedFlyingEventTag },
|
||||
{ WeaponEvent.StoppedFlying, WeaponStoppedFlyingEventTag },
|
||||
{ WeaponEvent.FlyingTick, WeaponFlyingTickEventTag },
|
||||
};
|
||||
|
||||
var ability = new AbilityData(
|
||||
"Ability",
|
||||
behaviorFactory: abilityBehavior.GetBehavior,
|
||||
abilityTriggerData: AbilityTriggerData.ForEvent(eventTagsMap[forEvent]));
|
||||
|
||||
var leftGrantAbilityConfig = new GrantAbilityConfig(
|
||||
ability.GetAbilityData(),
|
||||
ability,
|
||||
ScalableLevel: new ScalableInt(1),
|
||||
RemovalPolicy: AbilityDeactivationPolicy.CancelImmediately,
|
||||
InhibitionPolicy: AbilityDeactivationPolicy.CancelImmediately,
|
||||
|
||||
@@ -3,11 +3,9 @@
|
||||
[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://cw525n4mjqgw0" path="res://addons/forge/resources/ForgeTagContainer.cs" id="2_l1xlx"]
|
||||
[ext_resource type="Script" uid="uid://jitubgv6judn" path="res://scenes/components/damage/RDamage.cs" id="2_m0v1h"]
|
||||
[ext_resource type="Resource" uid="uid://cu0685gspk2fk" path="res://scenes/player_controller/resources/forge/exploding_sword_weapon_land.tres" id="2_pgbtr"]
|
||||
[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="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"]
|
||||
@@ -66,7 +64,6 @@ contact_monitor = true
|
||||
max_contacts_reported = 1
|
||||
script = ExtResource("1_csqwk")
|
||||
BaseTags = SubResource("Resource_06gln")
|
||||
WeaponAbilities = [ExtResource("2_pgbtr"), ExtResource("4_2wsgo")]
|
||||
FlyingTickAbility = ExtResource("4_7bruw")
|
||||
RDamage = SubResource("Resource_jpdh0")
|
||||
|
||||
|
||||
@@ -120,8 +120,9 @@ public partial class PlayerController : CharacterBody3D,
|
||||
[ExportSubgroup("Common and defaults")]
|
||||
[Export] public ForgeAbilityData EmpoweredActionAbility = null!;
|
||||
[Export] public ForgeAbilityData[] DefaultPermanentAbilities = [];
|
||||
[ExportSubgroup("WeaponThrow")]
|
||||
[Export] public ForgeAbilityData[] AbilityLoadout = [];
|
||||
|
||||
[ExportSubgroup("WeaponThrow")] [Export]
|
||||
public ForgeAbilityBehavior WeaponExplosionBehavior;
|
||||
|
||||
[ExportGroup("Effects")]
|
||||
[ExportSubgroup("Common and defaults")]
|
||||
@@ -713,25 +714,7 @@ public partial class PlayerController : CharacterBody3D,
|
||||
_attackDash.StateEntered += OnDashAttackStarted;
|
||||
_parryStandard.StateEntered += OnStandardParryStarted;
|
||||
_parryDash.StateEntered += OnDashParryStarted;
|
||||
|
||||
foreach (var weaponLandAbility in AbilityLoadout)
|
||||
{
|
||||
var leftGrantAbilityConfig = new GrantAbilityConfig(
|
||||
weaponLandAbility.GetAbilityData(),
|
||||
ScalableLevel: new ScalableInt(1),
|
||||
RemovalPolicy: AbilityDeactivationPolicy.CancelImmediately,
|
||||
InhibitionPolicy: AbilityDeactivationPolicy.CancelImmediately,
|
||||
TryActivateOnGrant: false,
|
||||
TryActivateOnEnable: false,
|
||||
LevelOverridePolicy: LevelComparison.Higher);
|
||||
|
||||
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)));
|
||||
}
|
||||
|
||||
// Forge events
|
||||
var weaponLeftToken = WeaponSystem.Events.Subscribe(WeaponSystem.WeaponStartedFlyingEventTag, OnWeaponLeft);
|
||||
var weaponLandedToken = WeaponSystem.Events.Subscribe(WeaponSystem.WeaponStoppedFlyingEventTag, OnWeaponLanded);
|
||||
@@ -746,7 +729,7 @@ public partial class PlayerController : CharacterBody3D,
|
||||
if (weaponLeftTag == null) return;
|
||||
Abilities.TryActivateAbilitiesByTag(weaponLeftTag, target, out var landedFailures);
|
||||
}
|
||||
|
||||
|
||||
public void OnWeaponLanded(EventData data)
|
||||
{
|
||||
var source = data.Source;
|
||||
@@ -763,6 +746,11 @@ public partial class PlayerController : CharacterBody3D,
|
||||
target,
|
||||
out var failures);
|
||||
}
|
||||
|
||||
public void GrantWeaponExplosionAbilityForEvent(WeaponSystem.WeaponEvent forEvent, string abilityName)
|
||||
{
|
||||
WeaponSystem.GrantNewAbilityForEvent(forEvent, WeaponExplosionBehavior);
|
||||
}
|
||||
|
||||
///////////////////////////
|
||||
// Settings & tutorial //
|
||||
|
||||
Reference in New Issue
Block a user