basic forge setup and refactored for some warning
All checks were successful
Create tag and build when new code gets to main / BumpTag (push) Successful in 30s
Create tag and build when new code gets to main / Export (push) Successful in 5m10s

This commit is contained in:
2026-02-24 10:27:57 +01:00
parent 4f64139d61
commit 5da2aa31ab
14 changed files with 284 additions and 228 deletions

View File

@@ -19,28 +19,26 @@ public partial class DashSystem: Node3D
public Vector3 TargetLocation { get; set; }
public Vector3 CollisionPoint { get; set; }
public Vector3 CollisionNormal { get; set; }
public GodotObject CollidedObject { get; set; }
public GodotObject? CollidedObject { get; set; }
public Vector3 PlannedLocation { get; set; }
public bool ShouldMantle { get; set; }
public Vector3 PlannedMantleLocation { get; set; }
public MantleSystem MantleSystem { get; set; }
public MantleSystem MantleSystem { get; set; } = null!;
internal HeadSystem _head;
public ShapeCast3D DashCast3D;
internal Camera3D _camera;
internal Vector3 _dashDirection = Vector3.Zero;
internal HeadSystem Head = null!;
public ShapeCast3D DashCast3D = null!;
internal Camera3D Camera = null!;
internal Vector3 DashDirection = Vector3.Zero;
internal ShapeCast3D _dashCastDrop;
internal MeshInstance3D _dashDropIndicator;
internal MeshInstance3D _dashDropLocationIndicator;
internal ShapeCast3D DashCastDrop = null!;
internal MeshInstance3D DashDropIndicator = null!;
internal MeshInstance3D DashDropLocationIndicator = null!;
internal MeshInstance3D DashTarget = null!;
internal CpuParticles3D DashIndicator = null!;
internal AnimationPlayer DashIndicatorAnim = null!;
internal MeshInstance3D _dashTarget;
internal CpuParticles3D _dashIndicator;
internal AnimationPlayer _dashIndicatorAnim;
[Export]
public PackedScene DashIndicatorScene { get; set; }
[Export] public PackedScene DashIndicatorScene { get; set; } = null!;
[Signal]
public delegate void DashStartedEventHandler();
@@ -59,22 +57,22 @@ public partial class DashSystem: Node3D
var dashShape = DashCast3D.GetShape() as SphereShape3D;
DashCastRadius = dashShape!.Radius;
_dashCastDrop = GetNode<ShapeCast3D>("DashCastDrop");
_dashDropIndicator = GetNode<MeshInstance3D>("DashDropIndicator");
_dashDropIndicator.Visible = false;
_dashDropLocationIndicator = GetNode<MeshInstance3D>("DashDropLocationIndicator");
_dashDropLocationIndicator.Visible = false;
DashCastDrop = GetNode<ShapeCast3D>("DashCastDrop");
DashDropIndicator = GetNode<MeshInstance3D>("DashDropIndicator");
DashDropIndicator.Visible = false;
DashDropLocationIndicator = GetNode<MeshInstance3D>("DashDropLocationIndicator");
DashDropLocationIndicator.Visible = false;
_head = head;
_camera = camera;
Head = head;
Camera = camera;
MantleSystem = GetNode<MantleSystem>("MantleSystem");
MantleSystem.Init();
_dashTarget = GetNode<MeshInstance3D>("DashTarget");
_dashTarget.SetVisible(false);
_dashIndicator = GetNode<CpuParticles3D>("DashIndicator");
_dashIndicatorAnim = GetNode<AnimationPlayer>("DashIndicator/AnimationPlayer");
DashTarget = GetNode<MeshInstance3D>("DashTarget");
DashTarget.SetVisible(false);
DashIndicator = GetNode<CpuParticles3D>("DashIndicator");
DashIndicatorAnim = GetNode<AnimationPlayer>("DashIndicator/AnimationPlayer");
}
internal DashLocation ComputeDashLocation()
@@ -98,13 +96,13 @@ public partial class DashSystem: Node3D
public void PrepareDash()
{
DashCast3D.SetRotation(_head.GetGlobalLookRotation());
DashCast3D.SetRotation(Head.GetGlobalLookRotation());
(HasHit, PlannedLocation, CollisionPoint, CollisionNormal, CollidedObject) = ComputeDashLocation();
CanDashThroughTarget = false;
if (CollidedObject is ITargetable targetable)
if (CollidedObject is ITargetable)
{
_dashTarget.SetVisible(false);
DashTarget.SetVisible(false);
CanDashThroughTarget = true;
return;
}
@@ -112,7 +110,7 @@ public partial class DashSystem: Node3D
MantleSystem.SetGlobalPosition(PlannedLocation);
MantleSystem.SetRotation(new Vector3(
MantleSystem.Rotation.X,
_head.Rotation.Y,
Head.Rotation.Y,
MantleSystem.Rotation.Z));
MantleSystem.ProcessMantle(false);
ShouldMantle = MantleSystem.IsMantlePossible;
@@ -120,41 +118,18 @@ public partial class DashSystem: Node3D
// Setup dash target
var targetColor = HasHit ? new Color(1f, 0.2f, 0.2f) : new Color(1f, 1f, 1f);
targetColor = ShouldMantle ? new Color(0.2f, 0.2f, 1f) : targetColor;
var targetMaterial = (StandardMaterial3D) _dashTarget.GetSurfaceOverrideMaterial(0);
var targetMaterial = (StandardMaterial3D) DashTarget.GetSurfaceOverrideMaterial(0);
targetMaterial.SetAlbedo(targetColor);
_dashTarget.SetVisible(true);
DashTarget.SetVisible(true);
var targetLocation = ShouldMantle ? MantleSystem.FirstMantleProfilePoint : PlannedLocation;
_dashTarget.SetGlobalPosition(targetLocation);
return;
var shouldShowDropIndicator = !HasHit && !ShouldMantle;
_dashDropIndicator.SetVisible(shouldShowDropIndicator);
_dashDropLocationIndicator.SetVisible(shouldShowDropIndicator);
if (shouldShowDropIndicator)
{
_dashCastDrop.GlobalPosition = targetLocation; // Place drop indication cast at dash location
var startDropLocation = targetLocation; // Start of the drop is the dash target location
// End of the drop is either max cast distance or first collision
var hasDropLocationHit = _dashCastDrop.IsColliding();
var endDropLocation = hasDropLocationHit ? _dashCastDrop.GetCollisionPoint(0) : _dashCastDrop.ToGlobal(DashCast3D.TargetPosition);
// Only show drop location indicator if drop cast has hit
_dashDropLocationIndicator.SetVisible(hasDropLocationHit);
_dashDropLocationIndicator.SetGlobalPosition(endDropLocation);
var dropLength = (endDropLocation - startDropLocation).Length();
var dropDirection = (endDropLocation - startDropLocation).Normalized();
_dashDropIndicator.SetScale(new Vector3(1, dropLength, 1));
_dashDropIndicator.SetGlobalPosition(startDropLocation + dropDirection * dropLength * 0.5f);
}
DashTarget.SetGlobalPosition(targetLocation);
}
public void StopPreparingDash()
{
CanDashThroughTarget = false;
_dashTarget.SetVisible(false);
_dashDropIndicator.SetVisible(false);
_dashDropLocationIndicator.SetVisible(false);
DashTarget.SetVisible(false);
DashDropIndicator.SetVisible(false);
DashDropLocationIndicator.SetVisible(false);
}
}

View File

@@ -22,12 +22,11 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer
[Export(PropertyHint.Range, "0,0.2,0.01,or_greater")]
public float StraightThrowDuration { get; set; } = 0.1f;
private StateChart _weaponState;
public StateChartState InHandState;
public StateChartState FlyingState;
public StateChartState PlantedState;
private ShapeCast3D _dashCast3D;
private StateChart _weaponState = null!;
public StateChartState InHandState = null!;
public StateChartState FlyingState = null!;
public StateChartState PlantedState = null!;
private ShapeCast3D _dashCast3D = null!;
private Transform3D _startTransform;
private Vector3 _startMeshRotation;
@@ -35,11 +34,11 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer
private Vector3 _throwDirection;
public Vector3 PlantLocation { get; set; }
public Vector3 PlantNormal { get; set; }
public Node PlantObject { get; set; }
public MeshInstance3D WeaponLocationIndicator { get; set; }
public StandardMaterial3D WeaponLocationIndicatorMaterial { get; set; }
public MeshInstance3D WeaponMesh { get; set; }
public Node? PlantObject { get; set; }
public MeshInstance3D WeaponLocationIndicator { get; set; } = null!;
public StandardMaterial3D WeaponLocationIndicatorMaterial { get; set; } = null!;
public MeshInstance3D WeaponMesh { get; set; } = null!;
public void Init()
{
@@ -50,7 +49,7 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer
WeaponLocationIndicator = GetNode<MeshInstance3D>("WeaponLocationIndicator");
WeaponLocationIndicator.Visible = false;
WeaponLocationIndicatorMaterial = WeaponLocationIndicator.GetActiveMaterial(0) as StandardMaterial3D;
WeaponLocationIndicatorMaterial = (WeaponLocationIndicator.GetActiveMaterial(0) as StandardMaterial3D)!;
WeaponMesh = GetNode<MeshInstance3D>("Weapon");
_startMeshRotation = WeaponMesh.Rotation;
@@ -100,7 +99,6 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer
var tween = GetTree().CreateTween();
tween.SetParallel(true);
tween.TweenProperty(this, "global_position", end, StraightThrowDuration);
if (hasHit)
{