simple slam and changed wall hugging to only work when input is towards the wall
This commit is contained in:
@@ -92,8 +92,8 @@ AirGlideVSpeed = 3.0
|
||||
AccelerationAirGlide = 0.2
|
||||
DecelerationAirGlide = 0.0
|
||||
WallHugGravityLesseningFactor = 15.0
|
||||
WallHugDownwardMaxSpeed = 8.0
|
||||
WallHugHorizontalDeceleration = 0.5
|
||||
WallHugDownwardMaxSpeed = 4.0
|
||||
WallHugHorizontalDeceleration = 1.0
|
||||
|
||||
[node name="WallRunSnapper" type="RayCast3D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
@@ -526,6 +526,15 @@ to = NodePath("../../OnWall/Hugging")
|
||||
event = &"on_wall"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
[node name="Slamming" type="Node" parent="StateChart/Root/Movement"]
|
||||
script = ExtResource("27_34snm")
|
||||
|
||||
[node name="OnSlamEnded" type="Node" parent="StateChart/Root/Movement/Slamming"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../../Grounded")
|
||||
event = &"grounded"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
[node name="Jump" type="Node" parent="StateChart/Root/Movement"]
|
||||
script = ExtResource("26_infe6")
|
||||
initial_state = NodePath("SimpleJump")
|
||||
@@ -660,6 +669,12 @@ to = NodePath("../../Sliding/AirGlide")
|
||||
event = &"slide"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
[node name="OnSlam" type="Node" parent="StateChart/Root/Movement/Airborne"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../../Slamming")
|
||||
event = &"slam"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
[node name="CoyoteEnabled" type="Node" parent="StateChart/Root/Movement/Airborne"]
|
||||
script = ExtResource("27_34snm")
|
||||
|
||||
@@ -705,6 +720,12 @@ to = NodePath("../../DoubleJumpEnabled")
|
||||
event = &"enable_double_jump"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
[node name="OnWallJump" type="Node" parent="StateChart/Root/Movement/Airborne/Falling"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../../../Jump/DoubleJump")
|
||||
event = &"jump"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
[node name="OnWall" type="Node" parent="StateChart/Root/Movement"]
|
||||
script = ExtResource("26_infe6")
|
||||
initial_state = NodePath("Hugging")
|
||||
|
||||
@@ -128,6 +128,10 @@ public partial class PlayerController : CharacterBody3D
|
||||
public float PostDashSpeed { get; set; } = 100f;
|
||||
[Export(PropertyHint.Range, "0,1,0.01,or_greater")]
|
||||
public float TimeScaleAimInAir { get; set; } = 0.05f;
|
||||
// Slam
|
||||
[ExportSubgroup("Slam")]
|
||||
[Export(PropertyHint.Range, "0,100,1,or_greater")]
|
||||
public float SlamSpeed { get; set; } = 50.0f;
|
||||
|
||||
// Sliding and gliding
|
||||
[ExportGroup("Slide")]
|
||||
@@ -254,12 +258,14 @@ public partial class PlayerController : CharacterBody3D
|
||||
private StateChartState _sliding;
|
||||
private StateChartState _groundSliding;
|
||||
private StateChartState _airGliding;
|
||||
private StateChartState _slamming;
|
||||
private StateChartState _onWall;
|
||||
private StateChartState _onWallHugging;
|
||||
private StateChartState _onWallHanging;
|
||||
private StateChartState _onWallRunning;
|
||||
|
||||
private Transition _onJumpFromWall;
|
||||
private Transition _onJumpFromWallFalling;
|
||||
private Transition _onLeaveWallFromRun;
|
||||
|
||||
public override void _Ready()
|
||||
@@ -322,6 +328,7 @@ public partial class PlayerController : CharacterBody3D
|
||||
_sliding = StateChartState.Of(GetNode("StateChart/Root/Movement/Sliding"));
|
||||
_groundSliding = StateChartState.Of(GetNode("StateChart/Root/Movement/Sliding/GroundSlide"));
|
||||
_airGliding = StateChartState.Of(GetNode("StateChart/Root/Movement/Sliding/AirGlide"));
|
||||
_slamming = StateChartState.Of(GetNode("StateChart/Root/Movement/Slamming"));
|
||||
|
||||
// _actionHanging = StateChartState.Of(GetNode("StateChart/Root/Actions/Hanging"));
|
||||
_powerExpired = StateChartState.Of(GetNode("StateChart/Root/PowerReserve/Expired"));
|
||||
@@ -336,6 +343,7 @@ public partial class PlayerController : CharacterBody3D
|
||||
_doubleJump = StateChartState.Of(GetNode("StateChart/Root/Movement/Jump/DoubleJump"));
|
||||
_mantling = StateChartState.Of(GetNode("StateChart/Root/Movement/Mantling"));
|
||||
_onJumpFromWall = Transition.Of(GetNode("StateChart/Root/Movement/OnWall/OnJump"));
|
||||
_onJumpFromWallFalling = Transition.Of(GetNode("StateChart/Root/Movement/Airborne/Falling/OnWallJump"));
|
||||
_onWall = StateChartState.Of(GetNode("StateChart/Root/Movement/OnWall"));
|
||||
_onWallHugging = StateChartState.Of(GetNode("StateChart/Root/Movement/OnWall/Hugging"));
|
||||
_onWallHanging = StateChartState.Of(GetNode("StateChart/Root/Movement/OnWall/Hanging"));
|
||||
@@ -414,6 +422,10 @@ public partial class PlayerController : CharacterBody3D
|
||||
_groundSliding.StatePhysicsProcessing += HandleGroundSlide;
|
||||
_airGliding.StatePhysicsProcessing += HandleAirGlide;
|
||||
|
||||
_slamming.StateEntered += SlamStarted;
|
||||
_slamming.StateExited += SlamEnded;
|
||||
_slamming.StatePhysicsProcessing += HandleSlam;
|
||||
|
||||
_simpleDashCooldownTimer.Timeout += DashCooldownTimeout;
|
||||
_airborneDashCooldownTimer.Timeout += AirborneDashCooldownTimeout;
|
||||
|
||||
@@ -424,6 +436,7 @@ public partial class PlayerController : CharacterBody3D
|
||||
_onWallRunning.StatePhysicsProcessing += HandleWallRunning;
|
||||
|
||||
_onJumpFromWall.Taken += OnJumpFromWall;
|
||||
_onJumpFromWallFalling.Taken += OnJumpFromWall;
|
||||
_onLeaveWallFromRun.Taken += OnLeaveWallFromRun;
|
||||
}
|
||||
|
||||
@@ -528,7 +541,7 @@ public partial class PlayerController : CharacterBody3D
|
||||
Velocity = new Vector3(horizontalVelocity.X, Velocity.Y, horizontalVelocity.Z);
|
||||
}
|
||||
|
||||
private void HandleStairs(float delta)
|
||||
private void MoveSlideAndHandleStairs(float delta)
|
||||
{
|
||||
StairsSystem.UpStairsCheckParams upStairsCheckParams = new StairsSystem.UpStairsCheckParams
|
||||
{
|
||||
@@ -638,7 +651,7 @@ public partial class PlayerController : CharacterBody3D
|
||||
}
|
||||
|
||||
// If all else fail and we go down, we hug
|
||||
if (Velocity.Y < 0 && !_coyoteEnabled.Active)
|
||||
if (Velocity.Y < 0 && IsInputTowardsWall(wallNormal))
|
||||
{
|
||||
_playerState.SendEvent("wall_hug");
|
||||
}
|
||||
@@ -876,6 +889,11 @@ public partial class PlayerController : CharacterBody3D
|
||||
///////////////////////////
|
||||
// On wall management //
|
||||
///////////////////////////
|
||||
|
||||
public bool IsInputTowardsWall(Vector3 wallNormal)
|
||||
{
|
||||
return wallNormal.Dot(GetInputGlobalHDirection()) < -0.5;
|
||||
}
|
||||
public void HandleOnWall(float delta)
|
||||
{
|
||||
if (IsTryingToMantle()) _playerState.SendEvent("mantle");
|
||||
@@ -914,10 +932,8 @@ public partial class PlayerController : CharacterBody3D
|
||||
WallHug(delta);
|
||||
if (isOnFloorCustom())
|
||||
_playerState.SendEvent("grounded");
|
||||
if (!WallHugSystem.IsWallHugging())
|
||||
{
|
||||
if (!WallHugSystem.IsWallHugging() || !IsInputTowardsWall(_wallHugStartNormal))
|
||||
_playerState.SendEvent("start_falling");
|
||||
}
|
||||
}
|
||||
public void HandleWallHanging(float delta)
|
||||
{
|
||||
@@ -1001,7 +1017,7 @@ public partial class PlayerController : CharacterBody3D
|
||||
_playerState.SendEvent("mantle");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
_playerState.SendEvent("jump");
|
||||
}
|
||||
|
||||
@@ -1198,7 +1214,20 @@ public partial class PlayerController : CharacterBody3D
|
||||
///////////////////////////
|
||||
public void OnInputSlamPressed()
|
||||
{
|
||||
GD.Print("Slam pressed");
|
||||
_playerState.SendEvent("slam");
|
||||
}
|
||||
|
||||
public void SlamStarted()
|
||||
{
|
||||
SetHorizontalVelocity(Vector2.Zero);
|
||||
SetVerticalVelocity(-SlamSpeed);
|
||||
}
|
||||
public void HandleSlam(float delta)
|
||||
{
|
||||
if (isOnFloorCustom()) _playerState.SendEvent("grounded");
|
||||
}
|
||||
public void SlamEnded()
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////
|
||||
@@ -1438,7 +1467,7 @@ public partial class PlayerController : CharacterBody3D
|
||||
|
||||
LookAround(delta);
|
||||
CameraModifications((float) delta);
|
||||
HandleStairs((float) delta);
|
||||
MoveSlideAndHandleStairs((float) delta);
|
||||
MantleSystem.ProcessMantle(_grounded.Active);
|
||||
if (WeaponSystem.InHandState.Active)
|
||||
RotateWeaponWithPlayer();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_resource type="Resource" script_class="GUIDEMappingContext" load_steps=160 format=3 uid="uid://bl5crtu1gkrtr"]
|
||||
[gd_resource type="Resource" script_class="GUIDEMappingContext" load_steps=161 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"]
|
||||
@@ -430,21 +430,25 @@ metadata/_guide_input_mappings_collapsed = false
|
||||
script = ExtResource("19_qkgmj")
|
||||
button = 2
|
||||
|
||||
[sub_resource type="Resource" id="Resource_kxb2c"]
|
||||
script = ExtResource("15_fykw6")
|
||||
[sub_resource type="Resource" id="Resource_06f1o"]
|
||||
script = ExtResource("15_g6bbx")
|
||||
|
||||
[sub_resource type="Resource" id="Resource_v2ywt"]
|
||||
script = ExtResource("3_yp12v")
|
||||
input = SubResource("Resource_o5yys")
|
||||
triggers = Array[ExtResource("8_2tfaw")]([SubResource("Resource_kxb2c")])
|
||||
triggers = Array[ExtResource("8_2tfaw")]([SubResource("Resource_06f1o")])
|
||||
|
||||
[sub_resource type="Resource" id="Resource_qpgnj"]
|
||||
script = ExtResource("30_cvxqo")
|
||||
key = 69
|
||||
|
||||
[sub_resource type="Resource" id="Resource_g5tel"]
|
||||
script = ExtResource("15_g6bbx")
|
||||
|
||||
[sub_resource type="Resource" id="Resource_s6d3g"]
|
||||
script = ExtResource("3_yp12v")
|
||||
input = SubResource("Resource_qpgnj")
|
||||
triggers = Array[ExtResource("8_2tfaw")]([SubResource("Resource_g5tel")])
|
||||
|
||||
[sub_resource type="Resource" id="Resource_vtk18"]
|
||||
script = ExtResource("1_qmhk6")
|
||||
|
||||
Reference in New Issue
Block a user