can plant weapon in targetables, dash towards it, jump in the air.
Some checks failed
Create tag and build when new code gets to main / BumpTag (push) Successful in 28s
Create tag and build when new code gets to main / Export (push) Failing after 1m47s

This commit is contained in:
2026-01-24 15:22:16 +01:00
parent b84b7e4dd5
commit 18c8b741dd
10 changed files with 116 additions and 36 deletions

View File

@@ -54,7 +54,7 @@
[sub_resource type="Resource" id="Resource_cb2lu"]
script = ExtResource("2_x835q")
DamageDealt = 3.0
DamageDealt = 30.0
metadata/_custom_type_script = "uid://jitubgv6judn"
[sub_resource type="Resource" id="Resource_abfq8"]

View File

@@ -313,6 +313,7 @@ public partial class PlayerController : CharacterBody3D,
private StateChartState _mantling;
private StateChartState _simpleDash;
private StateChartState _aimedDash;
private StateChartState _weaponDash;
private StateChartState _sliding;
private StateChartState _groundSliding;
private StateChartState _airGliding;
@@ -436,6 +437,7 @@ public partial class PlayerController : CharacterBody3D,
_aiming = StateChartState.Of(GetNode("StateChart/Root/Aim/On"));
_simpleDash = StateChartState.Of(GetNode("StateChart/Root/Movement/Dashing/Dash"));
_aimedDash = StateChartState.Of(GetNode("StateChart/Root/Movement/Dashing/AimedDash"));
_weaponDash = StateChartState.Of(GetNode("StateChart/Root/Movement/Dashing/ToWeaponDash"));
_slamming = StateChartState.Of(GetNode("StateChart/Root/Movement/Slamming"));
_sliding = StateChartState.Of(GetNode("StateChart/Root/Movement/Sliding"));
@@ -499,7 +501,7 @@ public partial class PlayerController : CharacterBody3D,
MantleSystem.Init();
StairsSystem.Init(stairsBelowRayCast3D, stairsAheadRayCast3D, cameraSmooth);
DashSystem.Init(HeadSystem, _camera);
WeaponSystem.Init(HeadSystem, _camera);
WeaponSystem.Init();
WallHugSystem.Init();
EmpoweredActionsLeft = MaxNumberOfEmpoweredActions;
@@ -548,6 +550,8 @@ public partial class PlayerController : CharacterBody3D,
_aimedDash.StateEntered += OnAimedDashStarted;
_aimedDash.StateExited += OnAimedDashFinished;
_weaponDash.StateExited += OnWeaponDashFinished;
_sliding.StateEntered += SlideStarted;
_sliding.StateExited += SlideEnded;
_slideCanceled.StateEntered += OnSlideCanceled;
@@ -576,7 +580,7 @@ public partial class PlayerController : CharacterBody3D,
_onWallRunning.StatePhysicsProcessing += HandleWallRunning;
_onWallHanging.StateExited += RecoverWeapon;
_onDashEnded.Taken += RecoverWeapon;
// _onDashEnded.Taken += RecoverWeapon;
_onJumpFromWall.Taken += OnJumpFromWall;
_onJumpFromWallFalling.Taken += OnJumpFromWall;
@@ -975,7 +979,7 @@ public partial class PlayerController : CharacterBody3D,
}
public void RecoverChildNode(Node3D node)
{
GetTree().GetRoot().RemoveChild(node);
node.GetParent().RemoveChild(node);
AddChild(node);
node.SetGlobalPosition(GlobalPosition);
}
@@ -1703,8 +1707,6 @@ public partial class PlayerController : CharacterBody3D,
if (DashSystem.CanDashThroughTarget && DashSystem.CollidedObject is ITargetable targetable)
correctedLocation = ComputePositionAfterTargetedDash(targetable.GetTargetGlobalPosition(), DashSystem.CollisionPoint);
if (DashSystem.CollidedObject is IDamageable damageable)
_hitEnemies.Add(damageable);
// Start invincibility timer for the duration of the dash and a bit more afterwards
OnHitInvincibility();
@@ -1726,7 +1728,8 @@ public partial class PlayerController : CharacterBody3D,
}
public void OnAimedDashFinished()
{
TriggerDamage();
ManageAttackedEnemyPostDash(DashSystem.CollidedObject as Node);
DashSystem.CollidedObject = null;
if (_customMantle)
{
@@ -1751,23 +1754,27 @@ public partial class PlayerController : CharacterBody3D,
weaponTargetLocation,
DashSystem.HasHit,
DashSystem.CollisionPoint,
DashSystem.CollisionNormal);
DashSystem.CollisionNormal,
DashSystem.CollidedObject as Node);
}
public void RecoverWeapon()
{
if (WeaponSystem.GetParent() == this) return;
HeadSystem.ShowWeapon();
RecoverChildNode(WeaponSystem);
WeaponSystem.ResetWeapon();
RecoverChildNode(WeaponSystem);
}
public void DashToFlyingWeapon()
{
_playerState.SendEvent("cancel_aim");
_playerState.SendEvent("weapon_dash");
PerformEmpoweredAction();
_audioStream.SwitchToClipByName("dash");
// Start invincibility timer for the duration of the dash and a bit more afterwards
OnHitInvincibility();
DashSystem.ShouldMantle = false;
_dashDirection = (WeaponSystem.GlobalPosition - GlobalPosition).Normalized();
@@ -1788,8 +1795,11 @@ public partial class PlayerController : CharacterBody3D,
{
_playerState.SendEvent("cancel_aim");
_playerState.SendEvent("weapon_dash");
PerformEmpoweredAction();
_audioStream.SwitchToClipByName("dash");
// Start invincibility timer for the duration of the dash and a bit more afterwards
OnHitInvincibility();
DashSystem.ShouldMantle = false;
var dashLocation = WeaponSystem.PlantLocation;
@@ -1797,7 +1807,9 @@ public partial class PlayerController : CharacterBody3D,
dashLocation += WeaponSystem.PlantNormal * _playerRadius;
if (WeaponSystem.IsPlantedUnderPlatform())
dashLocation += Vector3.Down * _playerHeight;
if (WeaponSystem.PlantObject is ITargetable targetable)
dashLocation = targetable.GetTargetGlobalPosition();
_wallHugStartNormal = WeaponSystem.PlantNormal;
_currentWallContactPoint = WeaponSystem.PlantLocation;
_wallHugStartLocation = dashLocation;
@@ -1811,11 +1823,37 @@ public partial class PlayerController : CharacterBody3D,
// Store the weapon state before resetting it
var isPlantedOnWall = WeaponSystem.IsPlantedInWall();
var isPlantedUnderPlatform = WeaponSystem.IsPlantedUnderPlatform();
var shouldDashToHanging = isPlantedOnWall || isPlantedUnderPlatform;
var isPlantedInTarget = WeaponSystem.PlantObject is ITargetable;
var shouldDashToHanging = (isPlantedOnWall || isPlantedUnderPlatform) && !isPlantedInTarget;
var resultingEvent = shouldDashToHanging ? "dash_to_planted" : "dash_finished";
if (!shouldDashToHanging) RecoverWeapon(); // Manually recover weapon before enemy is freed in case it owns the weapon object
if (WeaponSystem.PlantObject is ITargetable targetable)
{
HeadSystem.OnMantle(); // Recycle mantle animation
SetVerticalVelocity(PostDashSpeed);
}
ManageAttackedEnemyPostDash(WeaponSystem.PlantObject);
WeaponSystem.PlantObject = null;
_playerState.SendEvent(resultingEvent);
}
public void ManageAttackedEnemyPostDash(Node enemy)
{
if (enemy is IDamageable damageable)
{
_hitEnemies.Add(damageable);
TriggerDamage();
}
if (enemy is IStunnable stunnable)
stunnable.Stun();
}
public void OnWeaponDashFinished()
{
}
///////////////////////////
// Processes //////////////