removed editor granted weapon abilities and prepared granting abilites through an inventory
This commit is contained in:
@@ -13,22 +13,28 @@ public partial class CueHandlerInspectorPlugin : EditorInspectorPlugin
|
||||
public override bool _CanHandle(GodotObject @object)
|
||||
{
|
||||
// Find out if its an implementation of CueHandler without having to add [Tool] attribute to them.
|
||||
if (@object?.GetScript().As<CSharpScript>() is CSharpScript script)
|
||||
try
|
||||
{
|
||||
StringName className = script.GetGlobalName();
|
||||
|
||||
Type baseType = typeof(ForgeCueHandler);
|
||||
System.Reflection.Assembly assembly = baseType.Assembly;
|
||||
|
||||
Type? implementationType =
|
||||
Array.Find(assembly.GetTypes(), x =>
|
||||
x.Name == className &&
|
||||
baseType.IsAssignableFrom(x));
|
||||
|
||||
return implementationType is not null;
|
||||
if (@object?.GetScript().As<CSharpScript>() is null)
|
||||
return false;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
var script = @object?.GetScript().As<CSharpScript>();
|
||||
StringName className = script.GetGlobalName();
|
||||
|
||||
Type baseType = typeof(ForgeCueHandler);
|
||||
System.Reflection.Assembly assembly = baseType.Assembly;
|
||||
|
||||
Type? implementationType =
|
||||
Array.Find(assembly.GetTypes(), x =>
|
||||
x.Name == className &&
|
||||
baseType.IsAssignableFrom(x));
|
||||
|
||||
return implementationType is not null;
|
||||
}
|
||||
|
||||
public override bool _ParseProperty(
|
||||
|
||||
@@ -2,5 +2,4 @@
|
||||
|
||||
[node name="BackgroundMusicPlayer" type="AudioStreamPlayer" unique_id=676077136]
|
||||
process_mode = 3
|
||||
autoplay = true
|
||||
bus = &"Music"
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
[ext_resource type="Resource" uid="uid://brswsknpgwal2" path="res://inputs/base_mode/move_front.tres" id="34_rvpjj"]
|
||||
[ext_resource type="Resource" uid="uid://ca68r7n3bwba3" path="res://inputs/base_mode/toolbox.tres" id="34_s8kjn"]
|
||||
[ext_resource type="Resource" uid="uid://f3vs6l4m623s" path="res://inputs/base_mode/move_left.tres" id="35_s8kjn"]
|
||||
[ext_resource type="Resource" uid="uid://7ne5mdytlidm" path="res://inputs/base_mode/inventory.tres" id="36_4uwbh"]
|
||||
[ext_resource type="Resource" uid="uid://t612lts1wi1s" path="res://inputs/base_mode/move_right.tres" id="36_vibkn"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_vkvga"]
|
||||
@@ -487,16 +488,16 @@ action = ExtResource("29_q86qg")
|
||||
input_mappings = Array[ExtResource("3_yp12v")]([SubResource("Resource_ai85f"), SubResource("Resource_1ycft")])
|
||||
metadata/_guide_input_mappings_collapsed = false
|
||||
|
||||
[sub_resource type="Resource" id="Resource_8e1uk"]
|
||||
[sub_resource type="Resource" id="Resource_qd4lk"]
|
||||
script = ExtResource("19_qkgmj")
|
||||
button = 4
|
||||
button = 11
|
||||
|
||||
[sub_resource type="Resource" id="Resource_k8i2y"]
|
||||
script = ExtResource("15_fykw6")
|
||||
|
||||
[sub_resource type="Resource" id="Resource_ilhhf"]
|
||||
script = ExtResource("3_yp12v")
|
||||
input = SubResource("Resource_8e1uk")
|
||||
input = SubResource("Resource_qd4lk")
|
||||
triggers = Array[ExtResource("8_2tfaw")]([SubResource("Resource_k8i2y")])
|
||||
|
||||
[sub_resource type="Resource" id="Resource_qrtf1"]
|
||||
@@ -516,6 +517,35 @@ script = ExtResource("1_qmhk6")
|
||||
action = ExtResource("34_s8kjn")
|
||||
input_mappings = Array[ExtResource("3_yp12v")]([SubResource("Resource_ilhhf"), SubResource("Resource_4uwbh")])
|
||||
|
||||
[sub_resource type="Resource" id="Resource_g1qol"]
|
||||
script = ExtResource("19_qkgmj")
|
||||
button = 4
|
||||
|
||||
[sub_resource type="Resource" id="Resource_xmmrk"]
|
||||
script = ExtResource("15_fykw6")
|
||||
|
||||
[sub_resource type="Resource" id="Resource_oq22i"]
|
||||
script = ExtResource("3_yp12v")
|
||||
input = SubResource("Resource_g1qol")
|
||||
triggers = Array[ExtResource("8_2tfaw")]([SubResource("Resource_xmmrk")])
|
||||
|
||||
[sub_resource type="Resource" id="Resource_krlhw"]
|
||||
script = ExtResource("30_cvxqo")
|
||||
key = 4194306
|
||||
|
||||
[sub_resource type="Resource" id="Resource_gpvxe"]
|
||||
script = ExtResource("15_fykw6")
|
||||
|
||||
[sub_resource type="Resource" id="Resource_0nktr"]
|
||||
script = ExtResource("3_yp12v")
|
||||
input = SubResource("Resource_krlhw")
|
||||
triggers = Array[ExtResource("8_2tfaw")]([SubResource("Resource_gpvxe")])
|
||||
|
||||
[sub_resource type="Resource" id="Resource_u35df"]
|
||||
script = ExtResource("1_qmhk6")
|
||||
action = ExtResource("36_4uwbh")
|
||||
input_mappings = Array[ExtResource("3_yp12v")]([SubResource("Resource_oq22i"), SubResource("Resource_0nktr")])
|
||||
|
||||
[sub_resource type="Resource" id="Resource_kcylj"]
|
||||
script = ExtResource("30_cvxqo")
|
||||
key = 83
|
||||
@@ -570,5 +600,5 @@ input_mappings = Array[ExtResource("3_yp12v")]([SubResource("Resource_7io5e")])
|
||||
|
||||
[resource]
|
||||
script = ExtResource("23_llfhp")
|
||||
mappings = Array[ExtResource("1_qmhk6")]([SubResource("Resource_88x08"), SubResource("Resource_tgr2g"), SubResource("Resource_iarn8"), SubResource("Resource_cvxqo"), SubResource("Resource_tb8ii"), SubResource("Resource_iihs4"), SubResource("Resource_vibkn"), SubResource("Resource_2hs2y"), SubResource("Resource_d2r0d"), SubResource("Resource_xt1x5"), SubResource("Resource_ew1hw"), SubResource("Resource_3frwi"), SubResource("Resource_0qat1"), SubResource("Resource_vtk18"), SubResource("Resource_weyro"), SubResource("Resource_o5fur"), SubResource("Resource_fjku4"), SubResource("Resource_odnhd"), SubResource("Resource_0eff7"), SubResource("Resource_gt77e")])
|
||||
mappings = Array[ExtResource("1_qmhk6")]([SubResource("Resource_88x08"), SubResource("Resource_tgr2g"), SubResource("Resource_iarn8"), SubResource("Resource_cvxqo"), SubResource("Resource_tb8ii"), SubResource("Resource_iihs4"), SubResource("Resource_vibkn"), SubResource("Resource_2hs2y"), SubResource("Resource_d2r0d"), SubResource("Resource_xt1x5"), SubResource("Resource_ew1hw"), SubResource("Resource_3frwi"), SubResource("Resource_0qat1"), SubResource("Resource_vtk18"), SubResource("Resource_weyro"), SubResource("Resource_o5fur"), SubResource("Resource_u35df"), SubResource("Resource_fjku4"), SubResource("Resource_odnhd"), SubResource("Resource_0eff7"), SubResource("Resource_gt77e")])
|
||||
metadata/_custom_type_script = "uid://dsa1dnifd6w32"
|
||||
|
||||
7
inputs/base_mode/inventory.tres
Normal file
7
inputs/base_mode/inventory.tres
Normal file
@@ -0,0 +1,7 @@
|
||||
[gd_resource type="Resource" script_class="GUIDEAction" format=3 uid="uid://7ne5mdytlidm"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cluhc11vixkf1" path="res://addons/guide/guide_action.gd" id="1_48ulw"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_48ulw")
|
||||
metadata/_custom_type_script = "uid://cluhc11vixkf1"
|
||||
@@ -257,6 +257,9 @@ script = ExtResource("1_5g5a0")
|
||||
[node name="GuideDebugger" parent="DebugLayer" unique_id=636020765 instance=ExtResource("10_gm8ij")]
|
||||
visible = false
|
||||
|
||||
[node name="InventoryLayer" type="CanvasLayer" parent="." unique_id=406590925]
|
||||
layer = 10
|
||||
|
||||
[node name="BackgroundMusicPlayer" parent="." unique_id=879496303 instance=ExtResource("2_roiv2")]
|
||||
stream = ExtResource("3_boadi")
|
||||
|
||||
@@ -285,7 +288,6 @@ libraries/ = SubResource("AnimationLibrary_nyvgt")
|
||||
|
||||
[node name="Player" parent="." unique_id=1309399929 instance=ExtResource("17_clkha")]
|
||||
transform = Transform3D(0.99999994, 0, 0, 0, 1, 0, 0, 0, 0.99999994, 0, 0, 0)
|
||||
TutorialDone = true
|
||||
AccelerationAir = 1.5
|
||||
|
||||
[node name="ShaderComp-Explosion" parent="Player" unique_id=1876014452 instance=ExtResource("9_r1bdn")]
|
||||
|
||||
10
menus/scenes/overlaid_menus/Inventory.cs
Normal file
10
menus/scenes/overlaid_menus/Inventory.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using Godot;
|
||||
|
||||
[GlobalClass, Icon("res://assets/ui/IconGodotNode/control/icon_crate.png")]
|
||||
public partial class Inventory : Control
|
||||
{
|
||||
public PlayerController? Player { get; set; }
|
||||
public override void _Ready()
|
||||
{
|
||||
}
|
||||
}
|
||||
1
menus/scenes/overlaid_menus/Inventory.cs.uid
Normal file
1
menus/scenes/overlaid_menus/Inventory.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://7yil0fiftvaf
|
||||
166
menus/scenes/overlaid_menus/inventory.tscn
Normal file
166
menus/scenes/overlaid_menus/inventory.tscn
Normal file
@@ -0,0 +1,166 @@
|
||||
[gd_scene format=3 uid="uid://oq1jjvjs4qga"]
|
||||
|
||||
[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"]
|
||||
|
||||
[node name="InventoryWrapper" type="Control" unique_id=1853168495]
|
||||
process_mode = 3
|
||||
top_level = true
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_yst23")
|
||||
pauses_game = true
|
||||
|
||||
[node name="Inventory" type="MarginContainer" parent="." unique_id=1581374847]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 1
|
||||
anchors_preset = 9
|
||||
anchor_bottom = 1.0
|
||||
offset_right = 1920.0
|
||||
grow_vertical = 2
|
||||
theme_override_constants/margin_left = 256
|
||||
theme_override_constants/margin_top = 32
|
||||
theme_override_constants/margin_right = 256
|
||||
theme_override_constants/margin_bottom = 32
|
||||
script = ExtResource("2_sb1gh")
|
||||
|
||||
[node name="MenuPanelContainer" type="PanelContainer" parent="Inventory" unique_id=494302799]
|
||||
unique_name_in_owner = true
|
||||
process_mode = 3
|
||||
layout_mode = 2
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="Inventory/MenuPanelContainer" unique_id=890844332]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 128
|
||||
theme_override_constants/margin_top = 16
|
||||
theme_override_constants/margin_right = 128
|
||||
theme_override_constants/margin_bottom = 16
|
||||
|
||||
[node name="BoxContainer" type="BoxContainer" parent="Inventory/MenuPanelContainer/MarginContainer" unique_id=1551508149]
|
||||
layout_mode = 2
|
||||
vertical = true
|
||||
|
||||
[node name="TitleMargin" type="MarginContainer" parent="Inventory/MenuPanelContainer/MarginContainer/BoxContainer" unique_id=1278279788]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="TitleLabel" type="Label" parent="Inventory/MenuPanelContainer/MarginContainer/BoxContainer/TitleMargin" unique_id=1966063657]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 24
|
||||
text = "Inventory"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="PlayerSectionMargin" type="MarginContainer" parent="Inventory/MenuPanelContainer/MarginContainer/BoxContainer" unique_id=461792371]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_top = 16
|
||||
theme_override_constants/margin_bottom = 16
|
||||
|
||||
[node name="PlayerSection" type="BoxContainer" parent="Inventory/MenuPanelContainer/MarginContainer/BoxContainer/PlayerSectionMargin" unique_id=469432036]
|
||||
custom_minimum_size = Vector2(128, 0)
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
theme_override_constants/separation = 16
|
||||
vertical = true
|
||||
|
||||
[node name="PlayerSectionLabel" type="Label" parent="Inventory/MenuPanelContainer/MarginContainer/BoxContainer/PlayerSectionMargin/PlayerSection" unique_id=1100827847]
|
||||
layout_mode = 2
|
||||
text = "Player"
|
||||
|
||||
[node name="PlayerUtilsContainer" type="HBoxContainer" parent="Inventory/MenuPanelContainer/MarginContainer/BoxContainer/PlayerSectionMargin/PlayerSection" unique_id=993608648]
|
||||
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")
|
||||
|
||||
[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]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
min_value = 1.0
|
||||
max_value = 1000.0
|
||||
value = 1.0
|
||||
rounded = true
|
||||
allow_greater = true
|
||||
|
||||
[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]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
min_value = 1.0
|
||||
max_value = 1000.0
|
||||
value = 1.0
|
||||
rounded = true
|
||||
allow_greater = true
|
||||
|
||||
[node name="LevelSelectionMargin" type="MarginContainer" parent="Inventory/MenuPanelContainer/MarginContainer/BoxContainer" unique_id=517648431]
|
||||
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"]
|
||||
14
menus/scenes/overlaid_menus/inventory_wrapper.gd
Normal file
14
menus/scenes/overlaid_menus/inventory_wrapper.gd
Normal file
@@ -0,0 +1,14 @@
|
||||
@tool
|
||||
@icon("res://assets/ui/IconGodotNode/control/icon_crate_02.png")
|
||||
class_name InventoryWrapper
|
||||
extends OverlaidMenu
|
||||
|
||||
@export var player: PlayerController
|
||||
|
||||
@onready var inventory: Control = %Inventory
|
||||
|
||||
func _ready() -> void:
|
||||
inventory.Player = player
|
||||
|
||||
func _on_close_button_pressed() -> void:
|
||||
close()
|
||||
1
menus/scenes/overlaid_menus/inventory_wrapper.gd.uid
Normal file
1
menus/scenes/overlaid_menus/inventory_wrapper.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://vu5kh5amnta
|
||||
@@ -188,7 +188,8 @@ MaxNumberOfEmpoweredActions = 3
|
||||
SimpleDashStrength = 18.0
|
||||
SimpleDashTime = 0.2
|
||||
AimedDashTime = 0.2
|
||||
PostDashSpeed = 30.0
|
||||
PostDashSpeed = 25.0
|
||||
TimeScaleAimInAir = 0.08
|
||||
SlamSpeed = 80.0
|
||||
FlatGroundSlideSpeedLossRate = 0.996
|
||||
GroundSlideJumpMultiplier = 0.1
|
||||
|
||||
@@ -41,13 +41,11 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
|
||||
|
||||
[Export]
|
||||
public ForgeTagContainer BaseTags { get; set; }
|
||||
[Export] public ForgeAbilityData[] WeaponAbilities { get; set; } = Array.Empty<ForgeAbilityData>();
|
||||
[Export] public ForgeAbilityData FlyingTickAbility { get; set; }
|
||||
[Export] public ForgeEffectData[] PermanentEffects { get; set; } = Array.Empty<ForgeEffectData>();
|
||||
|
||||
[Export]
|
||||
public RDamage RDamage { get; set; }
|
||||
[Export(PropertyHint.Range, "0,100,1,or_greater")]
|
||||
[Export(PropertyHint.Range, "0,2,0.01,or_greater")]
|
||||
public float ThrowForce { get; set; } = 1f;
|
||||
[Export(PropertyHint.Range, "0,0.2,0.01,or_greater")]
|
||||
public float StraightThrowDuration { get; set; } = 0.1f;
|
||||
@@ -168,30 +166,6 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
|
||||
// TODO: Waiting on bug resolve
|
||||
_weaponFlyingAbility = Abilities.GrantAbilityPermanently(FlyingTickAbility.GetAbilityData(), 1, LevelComparison.None, this);
|
||||
|
||||
foreach (var ability in WeaponAbilities)
|
||||
{
|
||||
var leftGrantAbilityConfig = new GrantAbilityConfig(
|
||||
ability.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 Ability",
|
||||
new DurationData(DurationType.Infinite),
|
||||
effectComponents: [leftGrantComponent]);
|
||||
EffectsManager.ApplyEffect(new Effect(leftGrantEffect, new EffectOwnership(this, this)));
|
||||
}
|
||||
|
||||
foreach (var effect in PermanentEffects)
|
||||
{
|
||||
EffectsManager.ApplyEffect(new Effect(effect.GetEffectData(), new EffectOwnership(this, this)));
|
||||
}
|
||||
|
||||
BodyEntered += OnThrownWeaponReachesGround;
|
||||
|
||||
InHandState.StateExited += WeaponLeft;
|
||||
@@ -263,13 +237,50 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
|
||||
});
|
||||
};
|
||||
|
||||
Events.Subscribe(WeaponStoppedFlyingEventTag, data =>
|
||||
{
|
||||
// TODO: Waiting on bug resolve
|
||||
_weaponFlyingAbility.Cancel();
|
||||
});
|
||||
Events.Subscribe(WeaponStoppedFlyingEventTag, _ => { _weaponFlyingAbility.Cancel(); });
|
||||
}
|
||||
|
||||
private List<ActiveEffectHandle> _grantedWeaponStartedFlyingAbilities = new List<ActiveEffectHandle>();
|
||||
private List<ActiveEffectHandle> _grantedWeaponStoppedFlyingAbilities = new List<ActiveEffectHandle>();
|
||||
private List<ActiveEffectHandle> _grantedWeaponFlyingTickAbilities = new List<ActiveEffectHandle>();
|
||||
|
||||
public enum WeaponEvent
|
||||
{
|
||||
StartedFlying,
|
||||
StoppedFlying,
|
||||
FlyingTick
|
||||
}
|
||||
|
||||
public void GrantNewAbilityForEvent(WeaponEvent forEvent, ForgeAbilityData ability)
|
||||
{
|
||||
var abilitiesMap = new Dictionary<WeaponEvent, List<ActiveEffectHandle>>
|
||||
{
|
||||
{ WeaponEvent.StartedFlying, _grantedWeaponStartedFlyingAbilities },
|
||||
{ WeaponEvent.StoppedFlying, _grantedWeaponStoppedFlyingAbilities },
|
||||
{ WeaponEvent.FlyingTick, _grantedWeaponFlyingTickAbilities },
|
||||
};
|
||||
|
||||
var leftGrantAbilityConfig = new GrantAbilityConfig(
|
||||
ability.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 Ability",
|
||||
new DurationData(DurationType.Infinite),
|
||||
effectComponents: [leftGrantComponent]);
|
||||
var effectHandle = EffectsManager.ApplyEffect(new Effect(leftGrantEffect, new EffectOwnership(this, this)));
|
||||
if (effectHandle == null) return;
|
||||
|
||||
abilitiesMap[forEvent].Add(effectHandle);
|
||||
}
|
||||
|
||||
|
||||
public void WeaponLeft()
|
||||
{
|
||||
Visible = true;
|
||||
|
||||
@@ -9,22 +9,26 @@ extends Node
|
||||
@export_group("Overlaid")
|
||||
@export var lost_menu_scene : PackedScene = preload("uid://ciyq8eiv1mtie")
|
||||
@export var toolbox_scene : PackedScene = preload("uid://bcn582q8qd4ns")
|
||||
@export var inventory_scene : PackedScene = preload("uid://oq1jjvjs4qga")
|
||||
|
||||
@export_category("Others")
|
||||
@export var focused_viewport : Viewport
|
||||
@export var toolbox_action:GUIDEAction = preload("uid://ca68r7n3bwba3")
|
||||
@export var inventory_action:GUIDEAction = preload("uid://7ne5mdytlidm")
|
||||
|
||||
# Debug
|
||||
@onready var debug_layer: CanvasLayer = $"../DebugLayer"
|
||||
@onready var inventory_layer: CanvasLayer = $"../InventoryLayer"
|
||||
@onready var player: PlayerController = $"../Player"
|
||||
|
||||
func _ready() -> void:
|
||||
toolbox_action.triggered.connect(open_toolbox)
|
||||
inventory_action.triggered.connect(open_inventory)
|
||||
|
||||
func open_overlaid_menu(menu: PackedScene) -> Node:
|
||||
if not focused_viewport:
|
||||
focused_viewport = get_viewport()
|
||||
var _initial_focus_control = focused_viewport.gui_get_focus_owner()
|
||||
var _initial_focus_control: Control = focused_viewport.gui_get_focus_owner()
|
||||
return menu.instantiate()
|
||||
|
||||
func open_toolbox() -> void:
|
||||
@@ -32,6 +36,11 @@ func open_toolbox() -> void:
|
||||
toolbox.player = player
|
||||
debug_layer.call_deferred("add_child", toolbox)
|
||||
|
||||
func open_inventory() -> void:
|
||||
var inventory: Control = open_overlaid_menu(inventory_scene)
|
||||
inventory.player = player
|
||||
inventory_layer.call_deferred("add_child", inventory)
|
||||
|
||||
func on_player_died() -> void:
|
||||
var lost_menu: LevelLostMenu = open_overlaid_menu(lost_menu_scene)
|
||||
get_tree().current_scene.call_deferred("add_child", lost_menu)
|
||||
|
||||
Reference in New Issue
Block a user