diff --git a/player_controller/PlayerController.tscn b/player_controller/PlayerController.tscn index 4349c003..c0891398 100644 --- a/player_controller/PlayerController.tscn +++ b/player_controller/PlayerController.tscn @@ -14,22 +14,22 @@ [ext_resource type="Script" uid="uid://dd1yrt7eiiyf4" path="res://player_controller/Scripts/CapsuleCollider.cs" id="8_lmtjd"] [ext_resource type="Resource" uid="uid://c3e0ivgaxrsyb" path="res://systems/inputs/base_mode/aim_down.tres" id="8_obsfv"] [ext_resource type="PackedScene" uid="uid://wq1okogkhc5l" path="res://systems/mantle/mantle_system.tscn" id="8_qu4wy"] -[ext_resource type="Resource" uid="uid://7wm8ywvujwf" path="res://systems/inputs/base_mode/aim_cancel.tres" id="9_5p2qc"] [ext_resource type="Resource" uid="uid://bebstkm608wxx" path="res://systems/inputs/base_mode/aim_pressed.tres" id="9_nob5r"] [ext_resource type="Resource" uid="uid://bdit2jy5gbpts" path="res://systems/inputs/base_mode/jump.tres" id="10_4u7i3"] [ext_resource type="Script" uid="uid://g8idirw62qe0" path="res://player_controller/Scripts/Bobbing.cs" id="10_7wk1w"] -[ext_resource type="Resource" uid="uid://b334rau1yxmm7" path="res://systems/inputs/base_mode/slide_down.tres" id="10_nodcl"] [ext_resource type="Resource" uid="uid://b5gx3q8nvu72e" path="res://systems/inputs/base_mode/hit.tres" id="11_cresl"] -[ext_resource type="Resource" uid="uid://bbce5wfwxpns1" path="res://systems/inputs/base_mode/slide_release.tres" id="11_ruloh"] [ext_resource type="PackedScene" uid="uid://0ysqmqphq6mq" path="res://systems/head/head_system.tscn" id="11_rxwoh"] [ext_resource type="Resource" uid="uid://d2r0ur8k3cuu3" path="res://systems/inputs/base_mode/dash.tres" id="12_34snm"] [ext_resource type="Script" uid="uid://b6k73aj5povgv" path="res://player_controller/Scripts/FieldOfView.cs" id="12_m2mxi"] [ext_resource type="Resource" uid="uid://55b0dsvioj08" path="res://systems/inputs/base_mode/jump_pressed.tres" id="13_nob5r"] [ext_resource type="Shape3D" uid="uid://keseacdcooot" path="res://player_controller/resources/PlayerShape.tres" id="13_r7i3q"] -[ext_resource type="Resource" uid="uid://bw5k2gsv3jqcv" path="res://systems/inputs/base_mode/throw.tres" id="16_nob5r"] [ext_resource type="Script" uid="uid://b5nk6ntlps3x0" path="res://systems/inputs/input_system.gd" id="16_v31n3"] +[ext_resource type="Resource" uid="uid://b334rau1yxmm7" path="res://systems/inputs/base_mode/slide.tres" id="17_6lejt"] [ext_resource type="Resource" uid="uid://htqvokm8mufq" path="res://systems/inputs/base_mode/move.tres" id="17_h6vvl"] [ext_resource type="PackedScene" uid="uid://cqduhd4opgwvm" path="res://systems/dash/dash_system.tscn" id="18_q5h8a"] +[ext_resource type="Resource" uid="uid://bbce5wfwxpns1" path="res://systems/inputs/base_mode/slide_pressed.tres" id="18_q14ux"] +[ext_resource type="Resource" uid="uid://spo3pbqjx0eb" path="res://systems/inputs/base_mode/parry.tres" id="18_ruloh"] +[ext_resource type="Resource" uid="uid://dxy0071ic1wdj" path="res://systems/inputs/base_mode/slam.tres" id="20_nob5r"] [ext_resource type="PackedScene" uid="uid://dbe5f0p6lvqtr" path="res://systems/tween_queue/tween_queue_system.tscn" id="22_rpwev"] [ext_resource type="PackedScene" uid="uid://bcwkugn6v3oy7" path="res://addons/godot_state_charts/utilities/state_chart_debugger.tscn" id="24_q5h8a"] [ext_resource type="Script" uid="uid://couw105c3bde4" path="res://addons/godot_state_charts/state_chart.gd" id="25_wv70j"] @@ -67,12 +67,14 @@ blend_mode = 1 [node name="Player" type="CharacterBody3D"] script = ExtResource("1_poq2x") WalkSpeed = 7.5 +AccelerationFloor = 4.0 +DecelerationFloor = 3.0 AccelerationAir = 0.8 DecelerationAir = 0.02 Weight = 4.0 MantlePath = ExtResource("2_6lejt") -MantleDashStrength = 20.0 -MantleJumpStartVelocity = 13.0 +MantleDashStrength = 25.0 +MantleJumpStartVelocity = 15.0 CoyoteTime = 0.3 InputBufferFrames = 5 SimpleJumpStartVelocity = 6.0 @@ -80,13 +82,9 @@ SimpleJumpHangTimeInFrames = 1 SimpleJumpGravityLesseningFactor = 2.0 DoubleJumpHangTimeInFrames = 3 DoubleJumpGravityLesseningFactor = 1.5 -MegaJumpStartVelocity = 30.0 -MegaJumpHangTimeInFrames = 12 -MegaJumpGravityLesseningFactor = 1.2 WallJumpStartVelocity = 8.0 MaxNumberOfEmpoweredActions = 3 SimpleDashStrength = 15.0 -PoweredDashStrength = 30.0 AimedDashTime = 0.2 PostDashSpeed = 30.0 WallHugGravityLesseningFactor = 15.0 @@ -107,19 +105,19 @@ move_left = ExtResource("5_q14ux") move_right = ExtResource("6_q7bng") move_front = ExtResource("7_m8gvy") move_back = ExtResource("8_jb43f") -rotate_y = ExtResource("4_rxwoh") +rotate_vertical = ExtResource("4_rxwoh") rotate_floorplane = ExtResource("5_4u7i3") aim_down = ExtResource("8_obsfv") aim_pressed = ExtResource("9_nob5r") aim_released = ExtResource("8_lhb11") jump = ExtResource("10_4u7i3") jump_pressed = ExtResource("13_nob5r") -empower_down = ExtResource("10_nodcl") -empower_released = ExtResource("11_ruloh") -aim_canceled = ExtResource("9_5p2qc") +slide = ExtResource("17_6lejt") +slide_pressed = ExtResource("18_q14ux") hit = ExtResource("11_cresl") +parry = ExtResource("18_ruloh") dash = ExtResource("12_34snm") -throw = ExtResource("16_nob5r") +slam = ExtResource("20_nob5r") [node name="MeshInstance3D" type="MeshInstance3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.85, 0) @@ -395,28 +393,6 @@ delay_in_seconds = "0.0" [node name="Canceled" type="Node" parent="StateChart/Root/Aim"] script = ExtResource("27_34snm") -[node name="Empower" type="Node" parent="StateChart/Root"] -script = ExtResource("26_infe6") -initial_state = NodePath("Off") - -[node name="Off" type="Node" parent="StateChart/Root/Empower"] -script = ExtResource("27_34snm") - -[node name="ToOn" type="Node" parent="StateChart/Root/Empower/Off"] -script = ExtResource("28_n7qhm") -to = NodePath("../../On") -event = &"empower_down" -delay_in_seconds = "0.0" - -[node name="On" type="Node" parent="StateChart/Root/Empower"] -script = ExtResource("27_34snm") - -[node name="ToOff" type="Node" parent="StateChart/Root/Empower/On"] -script = ExtResource("28_n7qhm") -to = NodePath("../../Off") -event = &"empower_released" -delay_in_seconds = "0.0" - [node name="PowerReserve" type="Node" parent="StateChart/Root"] script = ExtResource("26_infe6") initial_state = NodePath("Full") @@ -669,7 +645,6 @@ script = ExtResource("27_34snm") [node name="OnWallHug" type="Node" parent="StateChart/Root/Movement/Airborne/DoubleJumpEnabled"] script = ExtResource("28_n7qhm") -to = NodePath("../../../OnWall/HuggingCoyoteEnabled") event = &"wall_hug" delay_in_seconds = "0.0" @@ -728,18 +703,9 @@ to = NodePath("../../Mantling") event = &"mantle" delay_in_seconds = "0.0" -[node name="HuggingCoyoteEnabled" type="Node" parent="StateChart/Root/Movement/OnWall"] -script = ExtResource("27_34snm") - -[node name="OnExpiration" type="Node" parent="StateChart/Root/Movement/OnWall/HuggingCoyoteEnabled"] +[node name="OnJump" type="Node" parent="StateChart/Root/Movement/OnWall"] script = ExtResource("28_n7qhm") -to = NodePath("../../Hugging") -event = &"coyote_expired" -delay_in_seconds = "0.0" - -[node name="OnJump" type="Node" parent="StateChart/Root/Movement/OnWall/HuggingCoyoteEnabled"] -script = ExtResource("28_n7qhm") -to = NodePath("../../../Jump/DoubleJump") +to = NodePath("../../Jump/DoubleJump") event = &"jump" delay_in_seconds = "0.0" @@ -752,12 +718,6 @@ to = NodePath("../../../Dashing/Dash") event = &"dash" delay_in_seconds = "0.0" -[node name="OnJump" type="Node" parent="StateChart/Root/Movement/OnWall/Hugging"] -script = ExtResource("28_n7qhm") -to = NodePath("../../../Jump/DoubleJump") -event = &"jump" -delay_in_seconds = "0.0" - [node name="Hanging" type="Node" parent="StateChart/Root/Movement/OnWall"] script = ExtResource("27_34snm") @@ -767,63 +727,31 @@ to = NodePath("../../../Dashing/Dash") event = &"dash" delay_in_seconds = "0.0" -[node name="OnJump" type="Node" parent="StateChart/Root/Movement/OnWall/Hanging"] -script = ExtResource("28_n7qhm") -to = NodePath("../../../Jump/DoubleJump") -event = &"jump" -delay_in_seconds = "0.0" - -[node name="RunningCoyoteEnabled" type="Node" parent="StateChart/Root/Movement/OnWall"] -script = ExtResource("27_34snm") - -[node name="OnJump" type="Node" parent="StateChart/Root/Movement/OnWall/RunningCoyoteEnabled"] -script = ExtResource("28_n7qhm") -to = NodePath("../../../Jump/DoubleJump") -event = &"jump" -delay_in_seconds = "0.0" - -[node name="OnExpiration" type="Node" parent="StateChart/Root/Movement/OnWall/RunningCoyoteEnabled"] -script = ExtResource("28_n7qhm") -to = NodePath("../../Running") -event = &"coyote_expired" -delay_in_seconds = "0.0" - -[node name="OnLeaveWall" type="Node" parent="StateChart/Root/Movement/OnWall/RunningCoyoteEnabled"] -script = ExtResource("28_n7qhm") -to = NodePath("../../../Airborne/CoyoteEnabled") -event = &"start_falling" -delay_in_seconds = "0.0" - [node name="Running" type="Node" parent="StateChart/Root/Movement/OnWall"] script = ExtResource("27_34snm") -[node name="OnJump" type="Node" parent="StateChart/Root/Movement/OnWall/Running"] -script = ExtResource("28_n7qhm") -to = NodePath("../../../Jump/SimpleJump") -event = &"jump" -delay_in_seconds = "0.0" - [node name="OnLeaveWall" type="Node" parent="StateChart/Root/Movement/OnWall/Running"] script = ExtResource("28_n7qhm") to = NodePath("../../../Airborne/CoyoteEnabled") event = &"start_falling" delay_in_seconds = "0.0" -[connection signal="input_aim_canceled" from="InputController" to="." method="OnInputAimCanceled"] [connection signal="input_aim_down" from="InputController" to="." method="OnInputAimDown"] [connection signal="input_aim_pressed" from="InputController" to="." method="OnInputAimPressed"] [connection signal="input_aim_released" from="InputController" to="." method="OnInputAimReleased"] [connection signal="input_dash" from="InputController" to="." method="OnInputDashPressed"] [connection signal="input_device_changed" from="InputController" to="." method="InputDeviceChanged"] -[connection signal="input_empower_down" from="InputController" to="." method="OnInputEmpowerDown"] -[connection signal="input_empower_released" from="InputController" to="." method="OnInputEmpowerReleased"] [connection signal="input_hit" from="InputController" to="." method="OnInputHitPressed"] [connection signal="input_jump_ended" from="InputController" to="." method="OnInputJumpEnded"] [connection signal="input_jump_ongoing" from="InputController" to="." method="OnInputJumpOngoing"] [connection signal="input_jump_started" from="InputController" to="." method="OnInputJumpStarted"] [connection signal="input_move" from="InputController" to="." method="OnInputMove"] [connection signal="input_move_keyboard" from="InputController" to="." method="OnInputMoveKeyboard"] +[connection signal="input_parry" from="InputController" to="." method="OnInputParryPressed"] [connection signal="input_rotate_floorplane" from="InputController" to="." method="OnInputRotateFloorplane"] [connection signal="input_rotate_y" from="InputController" to="." method="OnInputRotateY"] -[connection signal="input_throw" from="InputController" to="." method="OnInputThrowPressed"] +[connection signal="input_slam" from="InputController" to="." method="OnInputSlamPressed"] +[connection signal="input_slide_ended" from="InputController" to="." method="OnInputSlideEnded"] +[connection signal="input_slide_ongoing" from="InputController" to="." method="OnInputSlideOngoing"] +[connection signal="input_slide_started" from="InputController" to="." method="OnInputSlideStarted"] [connection signal="WallDetected" from="WallHugSystem" to="." method="OnWallDetected"] diff --git a/player_controller/Scripts/PlayerController.cs b/player_controller/Scripts/PlayerController.cs index ef85e7c6..2605022f 100644 --- a/player_controller/Scripts/PlayerController.cs +++ b/player_controller/Scripts/PlayerController.cs @@ -129,22 +129,10 @@ public partial class PlayerController : CharacterBody3D [Export(PropertyHint.Range, "1,10,0.1,or_greater")] public float DoubleJumpGravityLesseningFactor { get; set; } = 3f; - - // Mega jump - [ExportSubgroup("Mega jump")] - [Export(PropertyHint.Range, "0,100,1,or_greater")] - public float MegaJumpStartVelocity { get; set; } = 10.0f; - [Export(PropertyHint.Range, "0,10,1,or_greater")] - public int MegaJumpHangTimeInFrames { get; set; } = 5; - [Export(PropertyHint.Range, "1,10,0.1,or_greater")] - public float MegaJumpGravityLesseningFactor { get; set; } = 3f; - // Wall jump [ExportSubgroup("Wall jump")] [Export(PropertyHint.Range, "0,100,1,or_greater")] public float WallJumpStartVelocity { get; set; } = 10.0f; - [Export(PropertyHint.Range, "0,100,1,or_greater")] - public float WallMegajumpStartVelocity { get; set; } = 20.0f; // Dash [ExportGroup("Dash")] @@ -154,12 +142,6 @@ public partial class PlayerController : CharacterBody3D [ExportSubgroup("Simple")] [Export(PropertyHint.Range, "0,50,0.1")] public float SimpleDashStrength { get; set; } = 10f; - // Powered Dash - [ExportSubgroup("Powered")] - [Export(PropertyHint.Range, "0,1,0.01,or_greater")] - public float PoweredDashTime { get; set; } = 0.3f; - [Export(PropertyHint.Range, "0,100,0.1")] - public float PoweredDashStrength { get; set; } = 10f; // Aimed Dash [ExportSubgroup("Special")] [Export(PropertyHint.Range, "0,1,0.01,or_greater")] @@ -217,7 +199,6 @@ public partial class PlayerController : CharacterBody3D private StateChart _playerState; private StateChartState _aiming; - private StateChartState _empowerOn; private StateChartState _powerExpired; private StateChartState _powerRecharging; private StateChartState _powerFull; @@ -227,25 +208,15 @@ public partial class PlayerController : CharacterBody3D private StateChartState _coyoteEnabled; private StateChartState _simpleJump; private StateChartState _doubleJump; - private StateChartState _megaJump; private StateChartState _mantling; private StateChartState _simpleDash; - private StateChartState _poweredDash; private StateChartState _aimedDash; private StateChartState _onWall; private StateChartState _onWallHugging; - private StateChartState _onWallHuggingCoyoteEnabled; private StateChartState _onWallHanging; private StateChartState _onWallRunning; - private StateChartState _onWallRunningCoyoteEnabled; - private Transition _onJumpFromWallCoyote; - private Transition _onJumpFromWallRunCoyote; - private Transition _onJumpFromWall1; - private Transition _onJumpFromWall2; - private Transition _onJumpFromWall3; - private Transition _onMegajumpFromWall; - private Transition _onLeaveWallFromRunCoyote; + private Transition _onJumpFromWall; private Transition _onLeaveWallFromRun; private int _currentInputBufferFrames; @@ -316,10 +287,8 @@ public partial class PlayerController : CharacterBody3D _aiming = StateChartState.Of(GetNode("StateChart/Root/Aim/On")); _simpleDash = StateChartState.Of(GetNode("StateChart/Root/Movement/Dashing/Dash")); - _poweredDash = StateChartState.Of(GetNode("StateChart/Root/Movement/Dashing/PoweredDash")); _aimedDash = StateChartState.Of(GetNode("StateChart/Root/Movement/Dashing/AimedDash")); // _actionHanging = StateChartState.Of(GetNode("StateChart/Root/Actions/Hanging")); - _empowerOn = StateChartState.Of(GetNode("StateChart/Root/Empower/On")); _powerExpired = StateChartState.Of(GetNode("StateChart/Root/PowerReserve/Expired")); _powerRecharging = StateChartState.Of(GetNode("StateChart/Root/PowerReserve/AtLeastOneCharge")); _powerFull = StateChartState.Of(GetNode("StateChart/Root/PowerReserve/Full")); @@ -330,22 +299,13 @@ public partial class PlayerController : CharacterBody3D // _doubleJumpEnabled = StateChartState.Of(GetNode("StateChart/Root/Movement/Airborne/DoubleJumpEnabled")); _simpleJump = StateChartState.Of(GetNode("StateChart/Root/Movement/Jump/SimpleJump")); _doubleJump = StateChartState.Of(GetNode("StateChart/Root/Movement/Jump/DoubleJump")); - _megaJump = StateChartState.Of(GetNode("StateChart/Root/Movement/Jump/MegaJump")); _mantling = StateChartState.Of(GetNode("StateChart/Root/Movement/Mantling")); - _onJumpFromWallCoyote = Transition.Of(GetNode("StateChart/Root/Movement/OnWall/HuggingCoyoteEnabled/OnJump")); - _onJumpFromWallRunCoyote = Transition.Of(GetNode("StateChart/Root/Movement/OnWall/RunningCoyoteEnabled/OnJump")); - _onJumpFromWall1 = Transition.Of(GetNode("StateChart/Root/Movement/OnWall/Hugging/OnJump")); - _onJumpFromWall2 = Transition.Of(GetNode("StateChart/Root/Movement/OnWall/Hanging/OnJump")); - _onJumpFromWall3 = Transition.Of(GetNode("StateChart/Root/Movement/OnWall/Running/OnJump")); - _onMegajumpFromWall = Transition.Of(GetNode("StateChart/Root/Movement/OnWall/OnMegajump")); + _onJumpFromWall = Transition.Of(GetNode("StateChart/Root/Movement/OnWall/OnJump")); _onWall = StateChartState.Of(GetNode("StateChart/Root/Movement/OnWall")); - _onWallHuggingCoyoteEnabled = StateChartState.Of(GetNode("StateChart/Root/Movement/OnWall/HuggingCoyoteEnabled")); _onWallHugging = StateChartState.Of(GetNode("StateChart/Root/Movement/OnWall/Hugging")); _onWallHanging = StateChartState.Of(GetNode("StateChart/Root/Movement/OnWall/Hanging")); _onWallRunning = StateChartState.Of(GetNode("StateChart/Root/Movement/OnWall/Running")); - _onWallRunningCoyoteEnabled = StateChartState.Of(GetNode("StateChart/Root/Movement/OnWall/RunningCoyoteEnabled")); _onLeaveWallFromRun = Transition.Of(GetNode("StateChart/Root/Movement/OnWall/Running/OnLeaveWall")); - _onLeaveWallFromRunCoyote = Transition.Of(GetNode("StateChart/Root/Movement/OnWall/RunningCoyoteEnabled/OnLeaveWall")); // State timers _powerCooldownTimer = GetNode("PowerCooldown"); _timeScaleAimInAirTimer = GetNode("TimeScaleAimInAir"); @@ -405,18 +365,11 @@ public partial class PlayerController : CharacterBody3D _doubleJump.StateEntered += OnDoubleJumpStarted; _doubleJump.StatePhysicsProcessing += HandleDoubleJump; - _megaJump.StateEntered += OnMegaJumpStarted; - _megaJump.StatePhysicsProcessing += HandleMegaJump; - _mantling.StateEntered += OnMantleStarted; _mantling.StatePhysicsProcessing += HandleMantling; _simpleDash.StateEntered += OnSimpleDashStarted; _simpleDash.StatePhysicsProcessing += HandleSimpleDash; - - _poweredDash.StateEntered += OnPoweredDashStarted; - _poweredDash.StatePhysicsProcessing += HandlePoweredDash; - _poweredDash.StateExited += OnPoweredDashFinished; _aimedDash.StateEntered += OnAimedDashStarted; _aimedDash.StateExited += OnAimedDashFinished; @@ -426,33 +379,14 @@ public partial class PlayerController : CharacterBody3D _onWall.StateEntered += OnWallStarted; _onWall.StateExited += OnWallStopped; - _onWallHuggingCoyoteEnabled.StateEntered += OnWallHuggingStarted; - _onWallHuggingCoyoteEnabled.StatePhysicsProcessing += HandleWallHugging; _onWallHugging.StatePhysicsProcessing += HandleWallHugging; _onWallHanging.StatePhysicsProcessing += HandleWallHanging; - _onWallRunningCoyoteEnabled.StateEntered += OnWallRunningStarted; - _onWallRunningCoyoteEnabled.StatePhysicsProcessing += HandleWallRunning; _onWallRunning.StatePhysicsProcessing += HandleWallRunning; - _onJumpFromWallCoyote.Taken += OnJumpFromWallCoyote; - _onJumpFromWallRunCoyote.Taken += OnJumpFromWallCoyote; - _onJumpFromWall1.Taken += OnJumpFromWall; - _onJumpFromWall2.Taken += OnJumpFromWall; - _onJumpFromWall3.Taken += OnJumpFromWall; - _onMegajumpFromWall.Taken += OnMegajumpFromWall; + _onJumpFromWall.Taken += OnJumpFromWall; _onLeaveWallFromRun.Taken += OnLeaveWallFromRun; - _onLeaveWallFromRunCoyote.Taken += OnLeaveWallFromRun; } - - public void OnGroundDetected(Node3D _) - { - GD.Print("Ground-like"); - } - public void OnGroundLost(Node3D _) - { - GD.Print("Ground-less"); - } - + public void SetAllowedInputsAll() { CurrentlyAllowedInputs = AllowedInputs.All; @@ -595,20 +529,8 @@ public partial class PlayerController : CharacterBody3D if (IsTryingToMantle()) _playerState.SendEvent("mantle"); } - public void OnWallHuggingStarted() - { - GetTree().CreateTimer(CoyoteTime).Timeout += CoyoteExpired; - } - - public void OnWallRunningStarted() - { - GetTree().CreateTimer(CoyoteTime).Timeout += CoyoteExpired; - } - public void OnWallDetected() { - FinishPoweredDash(); - if (!_onWall.Active) return; @@ -713,12 +635,6 @@ public partial class PlayerController : CharacterBody3D return; } - if (_empowerOn.Active && CanPerformEmpoweredAction()) - { - _playerState.SendEvent("megajump"); - return; - } - _playerState.SendEvent("jump"); } @@ -752,11 +668,6 @@ public partial class PlayerController : CharacterBody3D // _canDashAirborne = true; OnJumpStarted(DoubleJumpStartVelocity); } - public void OnMegaJumpStarted() - { - PerformEmpoweredAction(); - OnJumpStarted(MegaJumpStartVelocity); - } public void ComputeJumpFromWallHSpeed(float jumpStrength) { @@ -773,11 +684,6 @@ public partial class PlayerController : CharacterBody3D SetHorizontalVelocity(currentHorizontalVelocity + wallJumpHorizontalVelocity); } - - public void OnJumpFromWallCoyote() - { - _isWallJumpAvailable = false; - } public void OnJumpFromWall() { @@ -790,9 +696,15 @@ public partial class PlayerController : CharacterBody3D _airborneDashCooldownTimer.Start(); _isWallJumpAvailable = false; } - public void OnMegajumpFromWall() + + public void OnInputSlideStarted() + { + } + public void OnInputSlideOngoing() + { + } + public void OnInputSlideEnded() { - ComputeJumpFromWallHSpeed(WallMegajumpStartVelocity); } public void InputDeviceChanged(bool isUsingGamepad) @@ -963,10 +875,6 @@ public partial class PlayerController : CharacterBody3D { HandleJump(delta, DoubleJumpGravityLesseningFactor, DoubleJumpHangTimeInFrames); } - public void HandleMegaJump(float delta) - { - HandleJump(delta, MegaJumpGravityLesseningFactor, MegaJumpHangTimeInFrames); - } public void PowerRecharging(float delta) { @@ -1035,14 +943,6 @@ public partial class PlayerController : CharacterBody3D ThrowWeapon(); } } - public void OnInputEmpowerDown() - { - // _playerState.SendEvent("empower_down"); - } - public void OnInputEmpowerReleased() - { - // _playerState.SendEvent("empower_released"); - } public void OnInputDashPressed() { if (_aiming.Active && CanPerformEmpoweredAction()) @@ -1052,12 +952,6 @@ public partial class PlayerController : CharacterBody3D _playerState.SendEvent("cancel_aim"); return; } - if (_empowerOn.Active && CanPerformEmpoweredAction()) - { - PerformEmpoweredAction(); - _playerState.SendEvent("powered_dash"); - return; - } if (_airborne.Active) { @@ -1070,11 +964,14 @@ public partial class PlayerController : CharacterBody3D _bufferedAction = _mantling.Active ? BufferedActions.MantleDash : BufferedActions.Dash; _playerState.SendEvent("dash"); } - public void OnAimingEntered() + + public void OnInputSlamPressed() + { + GD.Print("Slam pressed"); + } + + public void OnInputParryPressed() { - if (!CanPerformEmpoweredAction()) - return; - if (WeaponSystem.FlyingState.Active) { DashToFlyingWeapon(); @@ -1086,10 +983,14 @@ public partial class PlayerController : CharacterBody3D DashToPlantedWeapon(); return; } + } + public void OnAimingEntered() + { + if (!CanPerformEmpoweredAction()) + return; DashSystem.StartPreparingDash(); DashIndicatorMesh.Visible = true; - if (!isOnFloorCustom()) ReduceTimeScaleWhileAiming(); } @@ -1280,31 +1181,7 @@ public partial class PlayerController : CharacterBody3D var direction = GetMoveInput(); return new Vector3(direction.X, 0, direction.Z).Normalized(); } - - public void OnPoweredDashStarted() - { - Velocity = GetInputGlobalHDirection() * PoweredDashStrength; - GetTree().CreateTimer(PoweredDashTime).Timeout += FinishPoweredDash; - } - - public void OnPoweredDashFinished() - { - } - - public void FinishPoweredDash() - { - _playerState.SendEvent("dash_finished"); - } - - public void HandlePoweredDash(float delta) - { - var collision = MoveAndCollide(Velocity * delta, maxCollisions: 10); - if (collision != null) - { - FinishPoweredDash(); - } - } - + public bool CanPerformEmpoweredAction() { return EmpoweredActionsLeft > 0 && TutorialDone; @@ -1334,7 +1211,7 @@ public partial class PlayerController : CharacterBody3D Vector2 inputLookDir = new Vector2(_inputRotateY, _inputRotateFloorplane); var lookSensitivity = _isUsingGamepad ? _lookSensitivityMultiplier : _mouseSensitivityMultiplier; - var wallHugContactPoint = _onWallRunning.Active || _onWallRunningCoyoteEnabled.Active ? _currentWallContactPoint : Vector3.Zero; + var wallHugContactPoint = _onWallRunning.Active ? _currentWallContactPoint : Vector3.Zero; var playerVelocity = GetGlobalMoveInput(); HeadSystem.LookAround(delta, inputLookDir, playerVelocity, wallHugContactPoint, lookSensitivity); } @@ -1414,7 +1291,7 @@ public partial class PlayerController : CharacterBody3D Bobbing.CameraBobbingParams cameraBobbingParams = new Bobbing.CameraBobbingParams { Delta = delta, - IsOnFloorCustom = isOnFloorCustom() || _onWallRunning.Active || _onWallRunningCoyoteEnabled.Active, + IsOnFloorCustom = isOnFloorCustom() || _onWallRunning.Active, Velocity = Velocity, SettingsMultiplier = _headBobbingMultiplier }; diff --git a/systems/inputs/base_mode/aim_cancel.tres b/systems/inputs/base_mode/aim_cancel.tres deleted file mode 100644 index bee7164e..00000000 --- a/systems/inputs/base_mode/aim_cancel.tres +++ /dev/null @@ -1,14 +0,0 @@ -[gd_resource type="Resource" script_class="GUIDEAction" load_steps=2 format=3 uid="uid://7wm8ywvujwf"] - -[ext_resource type="Script" uid="uid://cluhc11vixkf1" path="res://addons/guide/guide_action.gd" id="1_36r6u"] - -[resource] -script = ExtResource("1_36r6u") -name = &"" -action_value_type = 0 -block_lower_priority_actions = true -emit_as_godot_actions = false -is_remappable = false -display_name = "" -display_category = "" -metadata/_custom_type_script = "uid://cluhc11vixkf1" diff --git a/systems/inputs/base_mode/base_mode.tres b/systems/inputs/base_mode/base_mode.tres index 5cf937f9..268653a8 100644 --- a/systems/inputs/base_mode/base_mode.tres +++ b/systems/inputs/base_mode/base_mode.tres @@ -1,4 +1,4 @@ -[gd_resource type="Resource" script_class="GUIDEMappingContext" load_steps=159 format=3 uid="uid://bl5crtu1gkrtr"] +[gd_resource type="Resource" script_class="GUIDEMappingContext" load_steps=157 format=3 uid="uid://bl5crtu1gkrtr"] [ext_resource type="Script" uid="uid://cpplm41b5bt6m" path="res://addons/guide/guide_action_mapping.gd" id="1_qmhk6"] [ext_resource type="Resource" uid="uid://htqvokm8mufq" path="res://systems/inputs/base_mode/move.tres" id="2_g6bbx"] @@ -22,13 +22,13 @@ [ext_resource type="Resource" uid="uid://j1o5ud0plk4" path="res://systems/inputs/base_mode/aim_release.tres" id="16_rvpjj"] [ext_resource type="Script" uid="uid://vgjlx6p007lp" path="res://addons/guide/inputs/guide_input_mouse_button.gd" id="17_kxb2c"] [ext_resource type="Script" uid="uid://biiggjw6tv4uq" path="res://addons/guide/triggers/guide_trigger_released.gd" id="17_s8kjn"] -[ext_resource type="Resource" uid="uid://bbce5wfwxpns1" path="res://systems/inputs/base_mode/slide_release.tres" id="19_li5ak"] [ext_resource type="Script" uid="uid://rvttn472ix6v" path="res://addons/guide/inputs/guide_input_joy_button.gd" id="19_qkgmj"] [ext_resource type="Resource" uid="uid://bdit2jy5gbpts" path="res://systems/inputs/base_mode/jump.tres" id="21_818lq"] [ext_resource type="Resource" uid="uid://b5gx3q8nvu72e" path="res://systems/inputs/base_mode/hit.tres" id="22_2hs2y"] [ext_resource type="Resource" uid="uid://d2r0ur8k3cuu3" path="res://systems/inputs/base_mode/dash.tres" id="23_g6bbx"] [ext_resource type="Script" uid="uid://dsa1dnifd6w32" path="res://addons/guide/guide_mapping_context.gd" id="23_llfhp"] -[ext_resource type="Resource" uid="uid://b334rau1yxmm7" path="res://systems/inputs/base_mode/slide_down.tres" id="23_rvpjj"] +[ext_resource type="Resource" uid="uid://bbce5wfwxpns1" path="res://systems/inputs/base_mode/slide_pressed.tres" id="23_rvpjj"] +[ext_resource type="Resource" uid="uid://b334rau1yxmm7" path="res://systems/inputs/base_mode/slide.tres" id="25_s8kjn"] [ext_resource type="Resource" uid="uid://55b0dsvioj08" path="res://systems/inputs/base_mode/jump_pressed.tres" id="25_si4d4"] [ext_resource type="Resource" uid="uid://dgluj0ql5vth7" path="res://systems/inputs/base_mode/pause.tres" id="29_q86qg"] [ext_resource type="Script" uid="uid://cw71o87tvdx3q" path="res://addons/guide/inputs/guide_input_key.gd" id="30_cvxqo"] @@ -229,40 +229,54 @@ action = ExtResource("16_rvpjj") input_mappings = Array[ExtResource("3_yp12v")]([SubResource("Resource_bkx7d"), SubResource("Resource_yxj6r")]) metadata/_guide_input_mappings_collapsed = false -[sub_resource type="Resource" id="Resource_fykw6"] -script = ExtResource("10_cvxqo") -axis = 5 - -[sub_resource type="Resource" id="Resource_rvpjj"] -script = ExtResource("15_fykw6") - -[sub_resource type="Resource" id="Resource_s8kjn"] -script = ExtResource("3_yp12v") -input = SubResource("Resource_fykw6") -triggers = Array[ExtResource("8_2tfaw")]([SubResource("Resource_rvpjj")]) -metadata/_guide_triggers_collapsed = false - -[sub_resource type="Resource" id="Resource_vibkn"] -script = ExtResource("1_qmhk6") -action = ExtResource("23_rvpjj") -input_mappings = Array[ExtResource("3_yp12v")]([SubResource("Resource_s8kjn")]) - [sub_resource type="Resource" id="Resource_qkgmj"] script = ExtResource("10_cvxqo") axis = 5 [sub_resource type="Resource" id="Resource_st2ej"] -script = ExtResource("17_s8kjn") +script = ExtResource("15_fykw6") -[sub_resource type="Resource" id="Resource_818lq"] +[sub_resource type="Resource" id="Resource_s8kjn"] script = ExtResource("3_yp12v") input = SubResource("Resource_qkgmj") triggers = Array[ExtResource("8_2tfaw")]([SubResource("Resource_st2ej")]) +metadata/_guide_triggers_collapsed = false + +[sub_resource type="Resource" id="Resource_wcvib"] +script = ExtResource("30_cvxqo") +key = 4194326 + +[sub_resource type="Resource" id="Resource_imjft"] +script = ExtResource("3_yp12v") +input = SubResource("Resource_wcvib") +triggers = Array[ExtResource("8_2tfaw")]([SubResource("Resource_st2ej")]) +metadata/_guide_triggers_collapsed = false + +[sub_resource type="Resource" id="Resource_vibkn"] +script = ExtResource("1_qmhk6") +action = ExtResource("23_rvpjj") +input_mappings = Array[ExtResource("3_yp12v")]([SubResource("Resource_s8kjn"), SubResource("Resource_imjft")]) + +[sub_resource type="Resource" id="Resource_f3pn5"] +script = ExtResource("10_cvxqo") +axis = 5 + +[sub_resource type="Resource" id="Resource_818lq"] +script = ExtResource("3_yp12v") +input = SubResource("Resource_f3pn5") + +[sub_resource type="Resource" id="Resource_qksfw"] +script = ExtResource("30_cvxqo") +key = 4194326 + +[sub_resource type="Resource" id="Resource_woy8j"] +script = ExtResource("3_yp12v") +input = SubResource("Resource_qksfw") [sub_resource type="Resource" id="Resource_2hs2y"] script = ExtResource("1_qmhk6") -action = ExtResource("19_li5ak") -input_mappings = Array[ExtResource("3_yp12v")]([SubResource("Resource_818lq")]) +action = ExtResource("25_s8kjn") +input_mappings = Array[ExtResource("3_yp12v")]([SubResource("Resource_818lq"), SubResource("Resource_woy8j")]) [sub_resource type="Resource" id="Resource_1fkas"] script = ExtResource("19_qkgmj") @@ -354,16 +368,16 @@ script = ExtResource("3_yp12v") input = SubResource("Resource_kx31q") triggers = Array[ExtResource("8_2tfaw")]([SubResource("Resource_oux88")]) -[sub_resource type="Resource" id="Resource_f3pn5"] -script = ExtResource("17_kxb2c") -button = 2 +[sub_resource type="Resource" id="Resource_jk2g8"] +script = ExtResource("30_cvxqo") +key = 70 [sub_resource type="Resource" id="Resource_y7p41"] script = ExtResource("15_fykw6") [sub_resource type="Resource" id="Resource_3uxou"] script = ExtResource("3_yp12v") -input = SubResource("Resource_f3pn5") +input = SubResource("Resource_jk2g8") triggers = Array[ExtResource("8_2tfaw")]([SubResource("Resource_y7p41")]) [sub_resource type="Resource" id="Resource_3frwi"] @@ -395,22 +409,10 @@ script = ExtResource("3_yp12v") input = SubResource("Resource_xbeov") triggers = Array[ExtResource("8_2tfaw")]([SubResource("Resource_rt8uw")]) -[sub_resource type="Resource" id="Resource_jk2g8"] -script = ExtResource("30_cvxqo") -key = 70 - -[sub_resource type="Resource" id="Resource_wcvib"] -script = ExtResource("15_fykw6") - -[sub_resource type="Resource" id="Resource_imjft"] -script = ExtResource("3_yp12v") -input = SubResource("Resource_jk2g8") -triggers = Array[ExtResource("8_2tfaw")]([SubResource("Resource_wcvib")]) - [sub_resource type="Resource" id="Resource_0qat1"] script = ExtResource("1_qmhk6") action = ExtResource("23_g6bbx") -input_mappings = Array[ExtResource("3_yp12v")]([SubResource("Resource_1rw8g"), SubResource("Resource_hj46p"), SubResource("Resource_imjft")]) +input_mappings = Array[ExtResource("3_yp12v")]([SubResource("Resource_1rw8g"), SubResource("Resource_hj46p")]) metadata/_guide_input_mappings_collapsed = false [sub_resource type="Resource" id="Resource_o5yys"] @@ -425,17 +427,9 @@ script = ExtResource("3_yp12v") input = SubResource("Resource_o5yys") triggers = Array[ExtResource("8_2tfaw")]([SubResource("Resource_kxb2c")]) -[sub_resource type="Resource" id="Resource_qksfw"] -script = ExtResource("30_cvxqo") -key = 69 - -[sub_resource type="Resource" id="Resource_woy8j"] -script = ExtResource("3_yp12v") -input = SubResource("Resource_qksfw") - [sub_resource type="Resource" id="Resource_qpgnj"] script = ExtResource("30_cvxqo") -key = 4194326 +key = 69 [sub_resource type="Resource" id="Resource_s6d3g"] script = ExtResource("3_yp12v") @@ -444,7 +438,7 @@ input = SubResource("Resource_qpgnj") [sub_resource type="Resource" id="Resource_vtk18"] script = ExtResource("1_qmhk6") action = ExtResource("32_s8kjn") -input_mappings = Array[ExtResource("3_yp12v")]([SubResource("Resource_v2ywt"), SubResource("Resource_woy8j"), SubResource("Resource_s6d3g")]) +input_mappings = Array[ExtResource("3_yp12v")]([SubResource("Resource_v2ywt"), SubResource("Resource_s6d3g")]) [sub_resource type="Resource" id="Resource_s4bc4"] script = ExtResource("30_cvxqo") diff --git a/systems/inputs/base_mode/slide_down.tres b/systems/inputs/base_mode/slide.tres similarity index 100% rename from systems/inputs/base_mode/slide_down.tres rename to systems/inputs/base_mode/slide.tres diff --git a/systems/inputs/base_mode/slide_release.tres b/systems/inputs/base_mode/slide_pressed.tres similarity index 100% rename from systems/inputs/base_mode/slide_release.tres rename to systems/inputs/base_mode/slide_pressed.tres diff --git a/systems/inputs/base_mode/throw.tres b/systems/inputs/base_mode/throw.tres deleted file mode 100644 index 990f6c61..00000000 --- a/systems/inputs/base_mode/throw.tres +++ /dev/null @@ -1,14 +0,0 @@ -[gd_resource type="Resource" script_class="GUIDEAction" load_steps=2 format=3 uid="uid://bw5k2gsv3jqcv"] - -[ext_resource type="Script" uid="uid://cluhc11vixkf1" path="res://addons/guide/guide_action.gd" id="1_7f0q6"] - -[resource] -script = ExtResource("1_7f0q6") -name = &"" -action_value_type = 0 -block_lower_priority_actions = true -emit_as_godot_actions = false -is_remappable = false -display_name = "" -display_category = "" -metadata/_custom_type_script = "uid://cluhc11vixkf1" diff --git a/systems/inputs/input_system.gd b/systems/inputs/input_system.gd index 1c316c2a..1e812908 100644 --- a/systems/inputs/input_system.gd +++ b/systems/inputs/input_system.gd @@ -10,7 +10,7 @@ class_name InputController @export var move_right:GUIDEAction @export var move_front:GUIDEAction @export var move_back:GUIDEAction -@export var rotate_y:GUIDEAction +@export var rotate_vertical:GUIDEAction @export var rotate_floorplane:GUIDEAction @export_group("Trigger actions") @@ -21,13 +21,14 @@ class_name InputController @export_subgroup("Jump") @export var jump:GUIDEAction @export var jump_pressed:GUIDEAction +@export_subgroup("Slide") +@export var slide:GUIDEAction +@export var slide_pressed:GUIDEAction @export_subgroup("Other") -@export var empower_down:GUIDEAction -@export var empower_released:GUIDEAction -@export var aim_canceled:GUIDEAction @export var hit:GUIDEAction +@export var parry:GUIDEAction @export var dash:GUIDEAction -@export var throw:GUIDEAction +@export var slam:GUIDEAction signal input_device_changed(is_gamepad: bool) var _using_gamepad = false @@ -46,13 +47,14 @@ signal input_aim_pressed signal input_aim_down signal input_aim_released -signal input_empower_down -signal input_empower_released -signal input_aim_canceled +signal input_slide_started +signal input_slide_ongoing +signal input_slide_ended signal input_hit +signal input_parry signal input_dash -signal input_throw +signal input_slam func _ready() -> void: GUIDE.enable_mapping_context(base_mode) @@ -60,53 +62,50 @@ func _ready() -> void: aim_down.triggered.connect(on_input_aim_down) aim_pressed.triggered.connect(on_input_aim_pressed) aim_released.triggered.connect(on_input_aim_released) - empower_down.triggered.connect(on_input_empower_down) - empower_released.triggered.connect(on_input_empower_released) - aim_canceled.triggered.connect(on_input_aim_canceled) jump_pressed.triggered.connect(on_input_jump_started) jump.triggered.connect(on_input_jump_ongoing) jump.completed.connect(on_input_jump_ended) - hit.triggered.connect(on_input_hit) - dash.triggered.connect(on_input_dash) - throw.triggered.connect(on_input_throw) - -func on_input_dash(): - input_dash.emit() + slide_pressed.triggered.connect(on_input_slide_started) + slide.triggered.connect(on_input_slide_ongoing) + slide.completed.connect(on_input_slide_ended) -func on_input_throw(): - input_throw.emit() + hit.triggered.connect(on_input_hit) + parry.triggered.connect(on_input_parry) + dash.triggered.connect(on_input_dash) + slam.triggered.connect(on_input_slam) + func on_input_hit(): input_hit.emit() +func on_input_parry(): + input_parry.emit() +func on_input_dash(): + input_dash.emit() +func on_input_slam(): + input_slam.emit() func on_input_jump_started(): input_jump_started.emit() - func on_input_jump_ongoing(): input_jump_ongoing.emit() - func on_input_jump_ended(): input_jump_ended.emit() func on_input_aim_down(): input_aim_down.emit() - func on_input_aim_pressed(): input_aim_pressed.emit() - func on_input_aim_released(): input_aim_released.emit() - -func on_input_empower_down(): - input_empower_down.emit() - -func on_input_empower_released(): - input_empower_released.emit() - -func on_input_aim_canceled(): - input_aim_canceled.emit() + +func on_input_slide_started(): + input_slide_started.emit() +func on_input_slide_ongoing(): + input_slide_ongoing.emit() +func on_input_slide_ended(): + input_slide_ended.emit() func _input(event: InputEvent) -> void: if event is InputEventKey: @@ -130,5 +129,5 @@ func _process(_delta: float) -> void: input_move_keyboard.emit(keyboard_input_vector) input_move.emit(move.value_axis_3d) - input_rotate_y.emit(rotate_y.value_axis_1d) + input_rotate_y.emit(rotate_vertical.value_axis_1d) input_rotate_floorplane.emit(rotate_floorplane.value_axis_1d)