Command seam, agents: delete the 17 direct pilot writes in Agent, Flight, Combat, MoveTo, Follow
Each write is replaced by a /*DEL*/ marker; the next commit routes every marked site through the entity's PilotCommand. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
3efc8cddd7
commit
b13aa7385a
5 changed files with 17 additions and 17 deletions
|
|
@ -57,7 +57,7 @@ public class Agent
|
|||
{
|
||||
// The pilot tick writes Turn every tick, in every state: a state that pilots overwrites this zero with its
|
||||
// demand, and one that does not leaves the hull holding course instead of inheriting the last state's rate.
|
||||
Ship.Turn = 0;
|
||||
/*DEL turn0*/
|
||||
VentOnTrack();
|
||||
_currentState.Update(delta);
|
||||
foreach (var transition in _currentState.Transitions)
|
||||
|
|
@ -84,7 +84,7 @@ public class Agent
|
|||
{
|
||||
if (Ship.HasActiveConsumable(kind)) return;
|
||||
var consumable = Ship.FirstCarriedConsumable(kind);
|
||||
if (consumable != null) Ship.TryActivateConsumable(consumable);
|
||||
if (consumable != null) /*DEL use*/;
|
||||
}
|
||||
|
||||
public void Accelerate(float2 targetVelocity, bool noTurn = false)
|
||||
|
|
@ -95,18 +95,18 @@ public class Agent
|
|||
// If Delta V is above the threshold, direct the ship towards the delta and use only main thrusters
|
||||
if (!noTurn && deltaVMag > FORWARD_DELTA_THRESHOLD)
|
||||
{
|
||||
Ship.Turn = Steering.Toward(Ship, deltaVDirection);
|
||||
Ship.MovementDirection = float2(0, pow(dot(Ship.Direction, deltaVDirection), 2));
|
||||
/*DEL accel-turn*/
|
||||
/*DEL accel-move1*/
|
||||
}
|
||||
// If Delta V is low, use all thrusters and leave Turn to the caller (MoveTo already pointed it at the target)
|
||||
else if(deltaVMag > THRUST_DELTA_THRESHOLD)
|
||||
{
|
||||
var right = Ship.Direction.Rotate(ItemRotation.Clockwise);
|
||||
Ship.MovementDirection = float2(dot(right, deltaVDirection), dot(Ship.Direction, deltaVDirection));
|
||||
/*DEL accel-move2*/
|
||||
}
|
||||
else
|
||||
{
|
||||
Ship.MovementDirection = float2.zero;
|
||||
/*DEL accel-move3*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ public class Flight
|
|||
{
|
||||
track.Phase = Phase.Hailing;
|
||||
track.Start = _time;
|
||||
if (!string.IsNullOrEmpty(_doctrine.Hail)) Nearest(entity)?.Agent.Ship.SetMessage(_doctrine.Hail);
|
||||
if (!string.IsNullOrEmpty(_doctrine.Hail)) /*DEL hail*/;
|
||||
}
|
||||
else track.Phase = Phase.Engaged;
|
||||
break;
|
||||
|
|
@ -175,7 +175,7 @@ public class Flight
|
|||
private static void Aim(Ship ship, Entity target)
|
||||
{
|
||||
var wanted = target == null ? TargetRef.None : new TargetRef(target);
|
||||
if (!ship.Target.Value.Equals(wanted)) ship.SetTarget(wanted);
|
||||
if (!ship.Target.Value.Equals(wanted)) /*DEL designate*/;
|
||||
}
|
||||
|
||||
private float Standoff(Ship ship)
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ public class CombatState : BaseState
|
|||
bestTargetItem = reveal.Item;
|
||||
}
|
||||
}
|
||||
_agent.Ship.TrySelectTargetItem(bestTargetItem);
|
||||
/*DEL select*/
|
||||
|
||||
for (var i = 0; i < _agent.Ship.WeaponGroups.Length; i++)
|
||||
{
|
||||
|
|
@ -94,7 +94,7 @@ public class CombatState : BaseState
|
|||
if (dps > .1) _availableGroups.Add((i, dps));
|
||||
}
|
||||
|
||||
foreach(var w in _availableLockingWeapons) w.Activate();
|
||||
foreach(var w in _availableLockingWeapons) /*DEL lock*/;
|
||||
|
||||
UseConsumables(toTarget, targetDistance);
|
||||
|
||||
|
|
@ -140,13 +140,13 @@ public class CombatState : BaseState
|
|||
foreach (var weapon in _agent.Ship.WeaponGroups[selectedGroup].weapons)
|
||||
{
|
||||
if (FireControl.AgentFires(weapon, _agent.Ship, target, _agent.Doctrine.MinHitProbability))
|
||||
weapon.Activate();
|
||||
/*DEL pull*/;
|
||||
else if (weapon.Firing)
|
||||
weapon.Deactivate();
|
||||
/*DEL release*/;
|
||||
}
|
||||
}
|
||||
_agent.Ship.Aim = toTarget;
|
||||
_agent.Ship.Turn = Steering.Toward(_agent.Ship, toTarget.xz);
|
||||
/*DEL aim*/
|
||||
/*DEL turn*/
|
||||
_agent.Accelerate(movementDirection * _agent.TopSpeed, true);//selectedGroup >= 0);
|
||||
|
||||
// Fire charged guns!
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ public class FollowState : BaseState
|
|||
var pull = direction * (float) sign(error) * saturate(abs(error) / max(task.Standoff, 1f));
|
||||
var desired = task.Anchor.Velocity + pull * _agent.TopSpeed;
|
||||
|
||||
_agent.Ship.Aim = float3(direction.x, 0, direction.y);
|
||||
/*DEL aim*/
|
||||
_agent.Accelerate(desired);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ public abstract class MoveToState : BaseState
|
|||
|
||||
// We want to go top speed in the direction of our target
|
||||
var desiredVelocity = dir * _agent.TopSpeed;
|
||||
_agent.Ship.Aim = float3(dir.x, 0, dir.y);
|
||||
_agent.Ship.Turn = Steering.Toward(_agent.Ship, dir);
|
||||
/*DEL aim*/
|
||||
/*DEL turn*/
|
||||
_agent.Accelerate(desiredVelocity);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue