Sync daemon authority migration

This commit is contained in:
Meta Vens 2026-06-21 09:37:54 +01:00
commit 39a0dc8737
295 changed files with 25121 additions and 7360 deletions

View file

@ -1,13 +1,12 @@
using System;
using Unity.Mathematics;
using static Unity.Mathematics.math;
using float2 = Unity.Mathematics.float2;
using static CultMath.math;
using cfloat2 = CultMath.float2;
public abstract class MoveToState : BaseState
{
private VelocityLimit _velocityLimit;
protected abstract float2 TargetPosition { get; }
protected abstract cfloat2 TargetPosition { get; }
public float Distance { get; private set; }
protected MoveToState(Agent agent) : base(agent)
@ -16,13 +15,13 @@ public abstract class MoveToState : BaseState
public override void Update(float delta)
{
var diff = TargetPosition - _agent.Ship.Position.xz;
var diff = TargetPosition - _agent.Ship.CultPositionXZ;
var dir = normalize(diff);
Distance = length(diff);
// We want to go top speed in the direction of our target
var desiredVelocity = dir * _agent.TopSpeed;
_agent.Ship.LookDirection = float3(dir.x, 0, dir.y);
_agent.Ship.CultLookDirectionXZ = dir;
_agent.Accelerate(desiredVelocity);
}
}
@ -30,7 +29,7 @@ public abstract class MoveToState : BaseState
public class MoveToEntityState : MoveToState
{
public Entity TargetEntity { get; set; }
protected override float2 TargetPosition => TargetEntity?.Position.xz ?? float2.zero;
protected override cfloat2 TargetPosition => TargetEntity != null ? TargetEntity.CultPositionXZ : cfloat2.zero;
public MoveToEntityState(Agent agent) : base(agent) { }
}
@ -40,5 +39,5 @@ public class MoveToOrbitState : MoveToState
public string OrbitKey { get; set; } = "";
public MoveToOrbitState(Agent agent) : base(agent) { }
protected override float2 TargetPosition => _agent.Ship.Zone.GetOrbitPosition(OrbitKey);
protected override cfloat2 TargetPosition => AetheriaMath.ToCult(_agent.Ship.Zone.GetOrbitPosition(OrbitKey));
}