From db93e8f68e85a720e66da28840958b306242b75f Mon Sep 17 00:00:00 2001 From: Minimata Date: Thu, 5 Feb 2026 10:44:32 +0100 Subject: [PATCH] base movement tutorial done --- maps/levels/tuto_movement.tscn | 182 +++++++++++++++--- .../player_controller/PlayerController.tscn | 13 +- .../components/head/HeadSystem.cs | 6 + .../components/head/head_system.tscn | 3 +- .../scripts/PlayerController.cs | 49 ++++- 5 files changed, 217 insertions(+), 36 deletions(-) diff --git a/maps/levels/tuto_movement.tscn b/maps/levels/tuto_movement.tscn index 49a543fe..7b41e7f5 100644 --- a/maps/levels/tuto_movement.tscn +++ b/maps/levels/tuto_movement.tscn @@ -8,6 +8,10 @@ [node name="Main" unique_id=955321579 instance=ExtResource("1_jyq54")] +[node name="Player" parent="." index="6" unique_id=1309399929] +HasSword = false +HasParry = false + [node name="Greybox" type="CSGCombiner3D" parent="." index="7" unique_id=2082385716] use_collision = true collision_layer = 256 @@ -392,13 +396,13 @@ size = Vector3(4.5, 19.5, 5.5) material = ExtResource("2_lpm4c") [node name="CSGBox3D95" type="CSGBox3D" parent="Greybox" index="53" unique_id=1030736240] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -31.75, 20.25, -34.25) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -31, 20.25, -34.25) use_collision = true -size = Vector3(7.5, 19.5, 5.5) +size = Vector3(9, 19.5, 5.5) material = ExtResource("2_lpm4c") [node name="CSGBox3D100" type="CSGBox3D" parent="Greybox" index="54" unique_id=251951336] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -26.5, 20.25, -40.75) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -25.5, 20.25, -40.75) use_collision = true size = Vector3(3, 19.5, 18.5) material = ExtResource("2_lpm4c") @@ -434,9 +438,9 @@ size = Vector3(24.5, 21.5, 1) material = ExtResource("2_lpm4c") [node name="CSGBox3D101" type="CSGBox3D" parent="Greybox" index="60" unique_id=1731327176] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -12.75, 26.25, -49.5) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -12.25, 26.25, -49.5) use_collision = true -size = Vector3(30.5, 35.5, 1) +size = Vector3(29.5, 35.5, 1) material = ExtResource("2_lpm4c") [node name="CSGBox3D105" type="CSGBox3D" parent="Greybox" index="61" unique_id=1110625285] @@ -632,9 +636,9 @@ size = Vector3(10, 1, 1) material = ExtResource("3_u8sr4") [node name="CSGBox3D98" type="CSGBox3D" parent="Greybox" index="93" unique_id=447434163] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -12.25, 15.5, -51.5) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -13.75, 15.5, -51.5) use_collision = true -size = Vector3(29.5, 14, 3) +size = Vector3(32.5, 14, 3) material = ExtResource("2_lpm4c") [node name="CSGBox3D104" type="CSGBox3D" parent="Greybox" index="94" unique_id=1442208554] @@ -644,97 +648,227 @@ size = Vector3(20, 1.5, 35) material = ExtResource("2_lpm4c") [node name="CSGBox3D99" type="CSGBox3D" parent="Greybox" index="95" unique_id=2008353765] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -27.5, 22, -51.5) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -28.5, 22, -49.5) use_collision = true -size = Vector3(1, 1, 3) +size = Vector3(3, 1, 1) material = ExtResource("3_u8sr4") -[node name="CSGBox3D68" type="CSGBox3D" parent="Greybox" index="96" unique_id=743815889] +[node name="CSGBox3D109" type="CSGBox3D" parent="Greybox" index="96" unique_id=519906200] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -30.5, 22, -51) +use_collision = true +size = Vector3(1, 1, 4) +material = ExtResource("3_u8sr4") + +[node name="CSGBox3D68" type="CSGBox3D" parent="Greybox" index="97" unique_id=743815889] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -36.5, 16.5, 0.5) use_collision = true size = Vector3(12, 4, 8) material = ExtResource("2_lpm4c") -[node name="CSGBox3D69" type="CSGBox3D" parent="Greybox" index="97" unique_id=1709107988] +[node name="CSGBox3D69" type="CSGBox3D" parent="Greybox" index="98" unique_id=1709107988] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -36.5, 19.5, -2.75) use_collision = true size = Vector3(12, 4, 1.5) material = ExtResource("2_lpm4c") -[node name="CSGBox3D72" type="CSGBox3D" parent="Greybox" index="98" unique_id=547486564] +[node name="CSGBox3D72" type="CSGBox3D" parent="Greybox" index="99" unique_id=547486564] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -34.75, 10, -24.75) use_collision = true size = Vector3(19.5, 3, 58.5) material = ExtResource("2_lpm4c") -[node name="CSGBox3D81" type="CSGBox3D" parent="Greybox" index="99" unique_id=1566599507] +[node name="CSGBox3D81" type="CSGBox3D" parent="Greybox" index="100" unique_id=1566599507] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -37, 19.5, -12) use_collision = true size = Vector3(3, 4, 1) material = ExtResource("2_lpm4c") -[node name="CSGBox3D82" type="CSGBox3D" parent="Greybox" index="100" unique_id=1617624220] +[node name="CSGBox3D82" type="CSGBox3D" parent="Greybox" index="101" unique_id=1617624220] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -37, 16, -12.5) use_collision = true size = Vector3(3, 3, 2) material = ExtResource("2_lpm4c") -[node name="CSGBox3D83" type="CSGBox3D" parent="Greybox" index="101" unique_id=1568985583] +[node name="CSGBox3D83" type="CSGBox3D" parent="Greybox" index="102" unique_id=1568985583] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -37, 18, -13) use_collision = true size = Vector3(3, 1, 1) material = ExtResource("3_u8sr4") -[node name="CSGBox3D84" type="CSGBox3D" parent="Greybox" index="102" unique_id=631880926] +[node name="CSGBox3D84" type="CSGBox3D" parent="Greybox" index="103" unique_id=631880926] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -37, 13, -13) use_collision = true size = Vector3(3, 3, 3) material = ExtResource("2_lpm4c") -[node name="CSGBox3D85" type="CSGBox3D" parent="Greybox" index="103" unique_id=996930960] +[node name="CSGBox3D85" type="CSGBox3D" parent="Greybox" index="104" unique_id=996930960] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -37, 15, -14) use_collision = true size = Vector3(3, 1, 1) material = ExtResource("3_u8sr4") -[node name="CSGBox3D89" type="CSGBox3D" parent="Greybox" index="104" unique_id=1602075080] +[node name="CSGBox3D89" type="CSGBox3D" parent="Greybox" index="105" unique_id=1602075080] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -37, 22, -36.5) use_collision = true size = Vector3(3, 1, 1) material = ExtResource("3_u8sr4") -[node name="CSGBox3D90" type="CSGBox3D" parent="Greybox" index="105" unique_id=1904513833] +[node name="CSGBox3D90" type="CSGBox3D" parent="Greybox" index="106" unique_id=1904513833] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -37, 19.5, -36.5) use_collision = true size = Vector3(3, 4, 1) material = ExtResource("2_lpm4c") -[node name="CSGBox3D91" type="CSGBox3D" parent="Greybox" index="106" unique_id=1314237812] +[node name="CSGBox3D91" type="CSGBox3D" parent="Greybox" index="107" unique_id=1314237812] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -37, 16, -37) use_collision = true size = Vector3(3, 3, 2) material = ExtResource("2_lpm4c") -[node name="CSGBox3D92" type="CSGBox3D" parent="Greybox" index="107" unique_id=560010720] +[node name="CSGBox3D92" type="CSGBox3D" parent="Greybox" index="108" unique_id=560010720] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -37, 18, -37.5) use_collision = true size = Vector3(3, 1, 1) material = ExtResource("3_u8sr4") -[node name="CSGBox3D93" type="CSGBox3D" parent="Greybox" index="108" unique_id=147254481] +[node name="CSGBox3D93" type="CSGBox3D" parent="Greybox" index="109" unique_id=147254481] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -37, 13, -37.5) use_collision = true size = Vector3(3, 3, 3) material = ExtResource("2_lpm4c") -[node name="CSGBox3D94" type="CSGBox3D" parent="Greybox" index="109" unique_id=691195821] +[node name="CSGBox3D94" type="CSGBox3D" parent="Greybox" index="110" unique_id=691195821] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -37, 15, -38.5) use_collision = true size = Vector3(3, 1, 1) material = ExtResource("3_u8sr4") -[node name="CSGBox3D47" type="CSGBox3D" parent="Greybox" index="110" unique_id=1635436254] +[node name="CSGBox3D47" type="CSGBox3D" parent="Greybox" index="111" unique_id=1635436254] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 7, 12.5, 21.5) use_collision = true size = Vector3(1, 1, 5) material = ExtResource("3_u8sr4") + +[node name="Lights" type="Node3D" parent="." index="8" unique_id=395750804] + +[node name="OmniLight3D" type="OmniLight3D" parent="Lights" index="0" unique_id=1759925856] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4, 2, -12) +omni_range = 6.0 + +[node name="OmniLight3D2" type="OmniLight3D" parent="Lights" index="1" unique_id=458028986] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -14.5, 2.5, -18) +omni_range = 6.0 + +[node name="OmniLight3D3" type="OmniLight3D" parent="Lights" index="2" unique_id=735245103] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -16, 7, -39.5) +omni_range = 9.5 + +[node name="OmniLight3D31" type="OmniLight3D" parent="Lights" index="3" unique_id=829009277] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -14, 4.5, -24.5) +omni_range = 9.5 + +[node name="OmniLight3D4" type="OmniLight3D" parent="Lights" index="4" unique_id=92911518] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3, 5.5, -38.5) +omni_range = 5.5 + +[node name="OmniLight3D30" type="OmniLight3D" parent="Lights" index="5" unique_id=697077536] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -7.5, 3, -38.5) + +[node name="OmniLight3D5" type="OmniLight3D" parent="Lights" index="6" unique_id=1550409099] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 11.5, 9.5, -39) +omni_range = 6.5 + +[node name="OmniLight3D6" type="OmniLight3D" parent="Lights" index="7" unique_id=342293346] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 12, 10.5, -32) +omni_range = 3.5 + +[node name="OmniLight3D7" type="OmniLight3D" parent="Lights" index="8" unique_id=1443833930] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 12, 19.5, -32) +omni_range = 8.0 + +[node name="OmniLight3D8" type="OmniLight3D" parent="Lights" index="9" unique_id=260674221] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 12, 20, -15) +omni_range = 4.0 + +[node name="OmniLight3D9" type="OmniLight3D" parent="Lights" index="10" unique_id=1269832640] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 12, 20, 3.5) +omni_range = 4.0 + +[node name="OmniLight3D10" type="OmniLight3D" parent="Lights" index="11" unique_id=21886206] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 12, 17.5, -6.5) +omni_range = 7.5 + +[node name="OmniLight3D11" type="OmniLight3D" parent="Lights" index="12" unique_id=1631281854] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 12, 17.5, 11.5) +omni_range = 7.5 + +[node name="OmniLight3D12" type="OmniLight3D" parent="Lights" index="13" unique_id=1292223180] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5.5, 19, 17.5) +omni_range = 4.5 + +[node name="OmniLight3D15" type="OmniLight3D" parent="Lights" index="14" unique_id=895379786] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -16.5, 21, 22.5) +omni_range = 3.5 + +[node name="OmniLight3D18" type="OmniLight3D" parent="Lights" index="15" unique_id=277657948] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -24.5, 24.5, 17.5) +omni_range = 15.5 + +[node name="OmniLight3D13" type="OmniLight3D" parent="Lights" index="16" unique_id=305122268] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 11, 22.5, 20.5) +omni_range = 7.0 + +[node name="OmniLight3D14" type="OmniLight3D" parent="Lights" index="17" unique_id=915168140] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5, 22.5, 17.5) +omni_range = 10.0 + +[node name="OmniLight3D16" type="OmniLight3D" parent="Lights" index="18" unique_id=1080888977] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -35.5, 25.5, 22) +omni_range = 7.0 + +[node name="OmniLight3D17" type="OmniLight3D" parent="Lights" index="19" unique_id=922282838] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -36.5, 25.5, 10.5) +omni_range = 7.0 + +[node name="OmniLight3D19" type="OmniLight3D" parent="Lights" index="20" unique_id=1959866895] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -37, 25.5, -5.5) +omni_range = 7.0 + +[node name="OmniLight3D29" type="OmniLight3D" parent="Lights" index="21" unique_id=2143811783] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -37, 25.5, -16.5) +omni_range = 7.0 + +[node name="OmniLight3D20" type="OmniLight3D" parent="Lights" index="22" unique_id=1665621589] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -37, 24.5, -29) +omni_range = 7.0 + +[node name="OmniLight3D21" type="OmniLight3D" parent="Lights" index="23" unique_id=1870279999] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -37, 24.5, -29) +omni_range = 7.0 + +[node name="OmniLight3D22" type="OmniLight3D" parent="Lights" index="24" unique_id=1284564847] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -37, 24.5, -39.5) +omni_range = 7.0 + +[node name="OmniLight3D23" type="OmniLight3D" parent="Lights" index="25" unique_id=1612575478] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -37, 24.5, -39.5) +omni_range = 7.0 + +[node name="OmniLight3D24" type="OmniLight3D" parent="Lights" index="26" unique_id=1748145610] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -33.5, 24.5, -47) +omni_range = 10.0 + +[node name="OmniLight3D25" type="OmniLight3D" parent="Lights" index="27" unique_id=727558952] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -28, 24.5, -51) + +[node name="OmniLight3D26" type="OmniLight3D" parent="Lights" index="28" unique_id=1646376304] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -20, 24.5, -51.5) +omni_range = 7.0 + +[node name="OmniLight3D27" type="OmniLight3D" parent="Lights" index="29" unique_id=1849438050] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -20, 24.5, -51.5) +omni_range = 4.5 + +[node name="OmniLight3D28" type="OmniLight3D" parent="Lights" index="30" unique_id=915210790] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -7, 25.5, -54.5) +omni_range = 4.5 diff --git a/scenes/player_controller/PlayerController.tscn b/scenes/player_controller/PlayerController.tscn index 82dbe972..2f59f0e6 100644 --- a/scenes/player_controller/PlayerController.tscn +++ b/scenes/player_controller/PlayerController.tscn @@ -399,7 +399,6 @@ offset_left = 1524.0 offset_top = 1.0 offset_right = -8.0 offset_bottom = 1.0 -enabled = false initial_node_to_watch = NodePath("../StateChart") [node name="UI" type="Control" parent="." unique_id=856532641] @@ -790,6 +789,12 @@ to = NodePath("../../Mantling") event = &"mantle" delay_in_seconds = "0.0" +[node name="OnWallRun" type="Node" parent="StateChart/Root/Movement/Jump" unique_id=1685494079] +script = ExtResource("28_n7qhm") +to = NodePath("../../OnWall/Running") +event = &"wall_run" +delay_in_seconds = "0.0" + [node name="SimpleJump" type="Node" parent="StateChart/Root/Movement/Jump" unique_id=591943461] script = ExtResource("27_34snm") @@ -1089,6 +1094,12 @@ delay_in_seconds = "0.0" [node name="Hugging" type="Node" parent="StateChart/Root/Movement/OnWall" unique_id=162057636] script = ExtResource("27_34snm") +[node name="OnWallRun" type="Node" parent="StateChart/Root/Movement/OnWall/Hugging" unique_id=979474050] +script = ExtResource("28_n7qhm") +to = NodePath("../../Running") +event = &"wall_run" +delay_in_seconds = "0.0" + [node name="OnDash" type="Node" parent="StateChart/Root/Movement/OnWall/Hugging" unique_id=43147957] script = ExtResource("28_n7qhm") to = NodePath("../../../Dashing/Dash") diff --git a/scenes/player_controller/components/head/HeadSystem.cs b/scenes/player_controller/components/head/HeadSystem.cs index 997abf4b..eadf8c52 100644 --- a/scenes/player_controller/components/head/HeadSystem.cs +++ b/scenes/player_controller/components/head/HeadSystem.cs @@ -126,6 +126,12 @@ public partial class HeadSystem : Node3D _slidingNoise.SetFrequency(SlidingJitterFrequency); } + public void SetWeaponsVisible(bool swordVisible, bool parryVisible) + { + _rightHandedWeapon.Visible = swordVisible; + _leftHandedWeapon.Visible = parryVisible; + } + public void OnMantle() { _animationTree.Set("parameters/OnMantle/request", (int) AnimationNodeOneShot.OneShotRequest.Fire); diff --git a/scenes/player_controller/components/head/head_system.tscn b/scenes/player_controller/components/head/head_system.tscn index 7acdf3e4..cfd4822e 100644 --- a/scenes/player_controller/components/head/head_system.tscn +++ b/scenes/player_controller/components/head/head_system.tscn @@ -160,7 +160,7 @@ tracks/6/keys = { } tracks/7/type = "value" tracks/7/imported = false -tracks/7/enabled = true +tracks/7/enabled = false tracks/7/path = NodePath("../../FPRig/Parry:visible") tracks/7/interp = 1 tracks/7/loop_wrap = true @@ -671,6 +671,7 @@ mesh = ExtResource("2_c5qep") [node name="Parry" type="Node3D" parent="FPRig" unique_id=1218775403] transform = Transform3D(0.43521196, -1.1178209, 0.03266725, -0.65402746, -0.2828554, -0.96552634, 0.9071047, 0.33236945, -0.711823, -0.22145952, -0.19867475, -1.3653086) +visible = false [node name="ParryMesh" type="MeshInstance3D" parent="FPRig/Parry" unique_id=1993291456] mesh = ExtResource("3_1ay6d") diff --git a/scenes/player_controller/scripts/PlayerController.cs b/scenes/player_controller/scripts/PlayerController.cs index d8790824..94828b04 100644 --- a/scenes/player_controller/scripts/PlayerController.cs +++ b/scenes/player_controller/scripts/PlayerController.cs @@ -76,6 +76,8 @@ public partial class PlayerController : CharacterBody3D, // Inspector stuff [Export] public Marker3D TutorialWeaponTarget; [Export] public bool TutorialDone { get; set; } + [Export] public bool HasSword { get; set; } = true; + [Export] public bool HasParry { get; set; } = true; // Combat stuff [ExportCategory("Combat")] @@ -523,8 +525,10 @@ public partial class PlayerController : CharacterBody3D, EmpoweredActionsLeft = MaxNumberOfEmpoweredActions; - if (!TutorialDone) - PlaceWeaponForTutorial(); + // if (!TutorialDone) + // PlaceWeaponForTutorial(); + + HeadSystem.SetWeaponsVisible(HasSword, HasParry); /////////////////////////// // Signal setup /////////// @@ -826,14 +830,7 @@ public partial class PlayerController : CharacterBody3D, return; // Should we start a wall run - var wallNormal = WallHugSystem.WallHugNormal.UnwrapOr(Vector3.Zero); - var isIndeedWall = wallNormal.Y < 0.1; - var hvel = new Vector3(Velocity.X, 0, Velocity.Z); - var hvelProjected = hvel.Slide(_wallHugStartNormal); - var haveEnoughSpeed = hvelProjected.Length() > WallRunSpeedThreshold; - var isCoplanarEnough = Velocity.AngleTo(wallNormal) > Math.PI/4 && Velocity.AngleTo(wallNormal) < 3*Math.PI/4; - var isGoingDownwards = Velocity.AngleTo(Vector3.Down) < Math.PI/4; - if (haveEnoughSpeed && isCoplanarEnough && !isGoingDownwards && isIndeedWall && !_coyoteEnabled.Active) + if (ShouldStartWallRun()) { SetVerticalVelocity(WallRunUpwardVelocity); _playerState.SendEvent("wall_run"); @@ -841,12 +838,25 @@ public partial class PlayerController : CharacterBody3D, } // If all else fail and we go down, we hug + var wallNormal = WallHugSystem.WallHugNormal.UnwrapOr(Vector3.Zero); if (Velocity.Y < 0 && IsInputTowardsWall(wallNormal)) { _playerState.SendEvent("wall_hug"); } } + public bool ShouldStartWallRun() + { + var wallNormal = WallHugSystem.WallHugNormal.UnwrapOr(Vector3.Zero); + var isIndeedWall = wallNormal.Y < 0.1; + var hvel = new Vector3(Velocity.X, 0, Velocity.Z); + var hvelProjected = hvel.Slide(_wallHugStartNormal); + var haveEnoughSpeed = hvelProjected.Length() > WallRunSpeedThreshold; + var isCoplanarEnough = Velocity.AngleTo(wallNormal) > Math.PI/4 && Velocity.AngleTo(wallNormal) < 3*Math.PI/4; + var isGoingDownwards = Velocity.AngleTo(Vector3.Down) < Math.PI/4; + return haveEnoughSpeed && isCoplanarEnough && !isGoingDownwards && isIndeedWall && !_coyoteEnabled.Active; + } + public float ComputeVerticalSpeedGravity(float delta) { return Velocity.Y - CalculateGravityForce() * delta; @@ -1135,6 +1145,12 @@ public partial class PlayerController : CharacterBody3D, _canDashAirborne = true; WallHug(delta); + if (ShouldStartWallRun()) + { + SetVerticalVelocity(WallRunUpwardVelocity); + _playerState.SendEvent("wall_run"); + return; + } if (isOnFloorCustom()) _playerState.SendEvent("grounded"); if (!WallHugSystem.IsWallHugging() || !IsInputTowardsWall(_wallHugStartNormal)) @@ -1268,6 +1284,13 @@ public partial class PlayerController : CharacterBody3D, { if (IsTryingToMantle()) _playerState.SendEvent("mantle"); + // if (ShouldStartWallRun()) + // { + // SetVerticalVelocity(WallRunUpwardVelocity); + // _playerState.SendEvent("wall_run"); + // return; + // } + // Update horizontal velocity var horizontalVelocity = ComputeHVelocityAir(delta); Velocity = new Vector3(horizontalVelocity.X, Velocity.Y, horizontalVelocity.Z); @@ -1667,10 +1690,12 @@ public partial class PlayerController : CharacterBody3D, /////////////////////////// public void OnInputAimPressed() { + if (!HasSword) return; _playerState.SendEvent("aim_pressed"); } public void OnInputAimDown() { + if (!HasSword) return; _playerState.SendEvent("aim_down"); } public void OnInputAimReleased() @@ -1722,6 +1747,8 @@ public partial class PlayerController : CharacterBody3D, /////////////////////////// public void OnInputParryPressed() { + if (!HasParry) return; + var attackToDo = _isEnemyInDashAttackRange ? "dash_parry" : "standard_parry"; _playerState.SendEvent(attackToDo); } @@ -2115,6 +2142,8 @@ public partial class PlayerController : CharacterBody3D, public void OnInputHitPressed() { + if (!HasSword) return; + if (_onWallHanging.Active) return; if (_aiming.Active && WeaponSystem.InHandState.Active)