Deletes the Unity physics hit path (HullCollider.Hit/Splash, and the raycast/shield/SendHit blocks in Projectile, GuidedProjectile, Laser and Lightning) and replaces it with a single owner in the same cut: FireControl now decides whether a shot hits, Zone owns the pending-shot lifecycle, and Entity.DamageSchematic/ApplyHit (moved verbatim from EntityInstance) apply the result. Presentation subscribes to Zone.ShotCommitted/ShotResolved and applies nothing. FireControl.HitProbability is the pure targeting solution (Accuracy * pSensor * pSpread, gated by detection/range/lock/arc). FireControl.Fire freezes the weapon's payload and the shooter's resolved targeting stats at the instant the trigger is pulled (Q6), computes the predicted intercept through the one shared PredictedIntercept function (CombatState now calls the same function instead of duplicating first_order_intercept), and queues a PendingShot. FireControl.Step commits each shot's outcome at ArrivalTime - CommitHorizon -- deviation from the predicted intercept, measured once, live, at that instant -- and applies it at ArrivalTime. A shot whose flight is shorter than the horizon commits and resolves in the same tick it fires. Rolls draw from the shooter's own ItemManager.Random (Q5, seeded and reproducible); an out-of-arc or otherwise gated shot draws nothing. Player fire is arc-gated through the same predicate AI and turret fire use (Weapon.ArcAllowsFire, checked in InstantWeapon.Trigger -- the one point every shooter's trigger passes through), closing Q2. Adds GameplaySettings.CommitHorizon, SchematicCellSize and AgentMinHitProbability (first guesses; the headless suite is the tuning harness, operator play smoke is the arbiter). FORK reported, not worked around silently: HullCollider.SendHit/SendSplash cannot be deleted yet without breaking ConstantLaser.cs, ConstantLightning.cs, ConstantParticleWeapon.cs, HitscanEffect.cs and Mine.cs, which still call them from their own live Physics queries -- that's Cut 4's migration. They fire into the void today: nothing subscribes to Hit/Splash any more for the four weapon kinds this cut owns. tests/Aetheria.Shared.Tests/FireAuthorityTests.cs pins the roll's seeding, the gate-consumes-no-draw rule, resolve-on-arrival, the commit horizon and its evasion window, short-flight degradation, the frozen-payload snapshot, aimed hits, the item-then-hull damage order, the planar penetration march and the shield-absorbs branch. FireControlTests.cs and InputCapacitorTests.cs are updated for the new AI gate and OnFire(int) signature. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
42 lines
1.5 KiB
C#
42 lines
1.5 KiB
C#
using UnityEngine;
|
|
|
|
// Cut 3 (docs/fire-control-cut.md): the SphereCast, shield branch and SendHit are deleted -- FireControl
|
|
// already rolled and resolved this shot before Fire() below ever ran (a velocity-0 weapon like this one
|
|
// commits and resolves in the same tick it fires). The endpoint capture stays as a visual: it now just tracks
|
|
// the target's transform instead of a physics hit (R8).
|
|
public class Lightning : MonoBehaviour
|
|
{
|
|
public LightningCompute LightningCompute;
|
|
public float HitRadius;
|
|
|
|
public EntityInstance Source { get; set; }
|
|
public float Range { get; set; }
|
|
public EntityInstance Target { get; set; }
|
|
public Transform Barrel { get; set; }
|
|
|
|
// Cut 3: FireControl.Fire's ShotId. Unused by this simple endpoint-only presentation today, kept so a
|
|
// future pass can draw to the exact rolled cell instead of the target's overall position.
|
|
public int ShotId { get; set; }
|
|
|
|
private Vector3 _endpoint;
|
|
|
|
public void Fire()
|
|
{
|
|
LightningCompute.OnLeaderComplete = null;
|
|
LightningCompute.FixedEndpoint = Target != null;
|
|
LightningCompute.OnPulseComplete = () =>
|
|
GetComponent<Prototype>().ReturnToPool();
|
|
LightningCompute.StartAnimation();
|
|
_endpoint = Barrel.position + Barrel.forward * Range;
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (Barrel == null) return;
|
|
|
|
if (Target != null) _endpoint = Target.transform.position;
|
|
|
|
LightningCompute.EndPosition = _endpoint;
|
|
LightningCompute.StartPosition = Barrel.position;
|
|
}
|
|
}
|