Presentation follows the committed shot, not the selection (F7)

EntityInstance handed effect managers the shooter's selected target whatever
FireControl decided. A fused round whose target was invalid or out of arc
flies at none, and GuidedProjectileManager dropped a launcher shot with no
target entirely, so a real burst had no missile.

- Zone.TryGetShot: a presentation reads the shot the simulation committed
  (its target, its burst point) by the ShotId OnFire hands it.
- EntityInstance passes the shot's own target; a launcher round with none
  flies to the shot's burst point.

Unity-only; compile-checked by reading.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-09-29 16:27:54 +02:00
commit 9c0029931a
3 changed files with 30 additions and 3 deletions

View file

@ -203,8 +203,11 @@ public class EntityInstance : MonoBehaviour
// Cut 3 (docs/fire-control-cut.md): carries the ShotId FireControl.Fire assigned so the
// effect manager (and whatever it spawns) can bind its presentation to Zone.ShotCommitted /
// ShotResolved instead of deciding or applying anything itself.
// The target handed to the effect is the shot's own, not the shooter's selection: a fused round
// whose selected target was invalid, or out of arc, flies at none (FireControl.Fire) and the
// effect must not chase one.
instantWeapon.OnFire += shotId =>
_instantWeaponManagers[data].Fire(instantWeapon, item, this, entity.Target.Value != null && ZoneRenderer.EntityInstances.ContainsKey(entity.Target.Value) ? ZoneRenderer.EntityInstances[entity.Target.Value] : null, shotId);
_instantWeaponManagers[data].Fire(instantWeapon, item, this, ShotTarget(shotId), shotId);
if (behavior is ChargedWeapon chargedWeapon)
{
@ -336,6 +339,10 @@ public class EntityInstance : MonoBehaviour
}
}
private EntityInstance ShotTarget(int shotId) =>
Entity.Zone.TryGetShot(shotId, out var shot) && shot.Target != null &&
ZoneRenderer.EntityInstances.TryGetValue(shot.Target, out var instance) ? instance : null;
private void OnSensorPingEnd()
{
Destroy(_currentPing.transform.gameObject);