Fire control Cut 4, part 2: the last five weapon kinds join FireControl
Deletes the last live Physics.* hit queries and every remaining SendHit/ SendSplash call in Assets/Scripts/Gameplay/Weapons: ConstantLaser's RaycastAll, ConstantLightning's SphereCastAll, ConstantParticleWeapon's trigger-collider plumbing, HitscanEffect's RaycastAll, and Mine's blast OverlapSphere. Each becomes presentation only, the same convention Cut 3 gave Projectile/GuidedProjectile/Laser/Lightning: ConstantLaser/ ConstantLightning/HitscanEffect draw to TargetTransform (or out to Range with no target); ConstantParticleWeapon keeps only its visual emission. ConstantWeapon.Execute (previous commit) already rolled the damage before any of these ever draw. Mine keeps its proximity-arming OverlapSphere (Q7: contact detection, not hit detection) but Explode() now calls FireControl.Splash instead of walking colliders and calling SendSplash itself. HullCollider.Hit/Splash/SendHit/SendSplash and their event-arg classes are deleted outright -- their last callers are gone. HullCollider is now purely a physics surface for ship-on-ship collision impulse; no Physics.* query decides damage anywhere in Assets/Scripts/Gameplay/Weapons except Mine's own named exception. Every manager (ConstantLaserManager, ConstantLightningManager, ConstantParticleWeaponManager, HitscanManager) is updated to match: no more Damage/Penetration/Spread/DamageType plumbing into a presentation component that no longer decides anything with it, and HitscanManager now passes ShotId and TargetTransform the way LaserManager already does. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
482c47bffe
commit
78a4cf36bf
10 changed files with 71 additions and 273 deletions
|
|
@ -1,8 +1,11 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using static CultMath.math;
|
||||
|
||||
// Cut 4 (docs/fire-control-cut.md): the raycast, shield branch and SendHit are deleted -- FireControl already
|
||||
// rolls this weapon's damage once per GameplaySettings.BeamResolveInterval (ConstantWeapon.Execute) before
|
||||
// this beam is ever drawn (R8). What is left is pure endpoint presentation, the same convention Laser.cs
|
||||
// (Cut 3) uses for a discrete shot: draw to the target's current position, or out to Range with no target.
|
||||
public class ConstantLaser : MonoBehaviour
|
||||
{
|
||||
public AnimationCurve StartCurve;
|
||||
|
|
@ -13,13 +16,10 @@ public class ConstantLaser : MonoBehaviour
|
|||
public float FadeDuration;
|
||||
public float CycleDuration;
|
||||
public LineRenderer LineRenderer;
|
||||
|
||||
public float Damage { get; set; }
|
||||
public float Penetration { get; set; }
|
||||
public float Spread { get; set; }
|
||||
public DamageType DamageType { get; set; }
|
||||
|
||||
public Entity SourceEntity { get; set; }
|
||||
public float Range { get; set; }
|
||||
public Transform TargetTransform { get; set; }
|
||||
|
||||
private float _intensity;
|
||||
private float _stopIntensity;
|
||||
|
|
@ -70,45 +70,9 @@ public class ConstantLaser : MonoBehaviour
|
|||
}
|
||||
|
||||
LineRenderer.SetPosition(0, transform.position);
|
||||
bool hitFound = false;
|
||||
foreach (var hit in Physics.RaycastAll(new Ray(transform.position, transform.forward), Range, 1 | (1 << 17)))
|
||||
{
|
||||
var shield = hit.collider.GetComponent<ShieldManager>();
|
||||
if (shield)
|
||||
{
|
||||
var shieldBehavior = shield.Entity.Shield;
|
||||
var shieldActive = shieldBehavior != null && shieldBehavior.Item.Active.Value;
|
||||
var shieldAbsorbs = shieldActive && shieldBehavior.CanTakeHit(DamageType, Damage);
|
||||
// F5 (docs/stats-and-power-cut.md, Soul pass 2026-09-19): CanTakeHit is a pure query now -- read
|
||||
// once into shieldAbsorbs, and break the shield exactly once, right here, at the point this hit
|
||||
// is actually decided to route past it (to the hull collider RaycastAll returns further down
|
||||
// this same loop) instead of being absorbed. The hull branch below re-queries CanTakeHit safely
|
||||
// -- it is side-effect-free -- and will see Broken already true.
|
||||
if (shieldActive && !shieldAbsorbs) shieldBehavior.Break();
|
||||
if (!shieldAbsorbs) continue;
|
||||
if (shield.Entity != SourceEntity)
|
||||
{
|
||||
shieldBehavior.TakeHit(DamageType, Damage);
|
||||
shield.ShowHit(hit.point, sqrt(Damage));
|
||||
LineRenderer.SetPosition(1, hit.point);
|
||||
hitFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
var hull = hit.collider.GetComponent<HullCollider>();
|
||||
if (hull && !(hull.Entity.Shield != null && hull.Entity.Shield.Item.Active.Value && hull.Entity.Shield.CanTakeHit(DamageType, Damage)))
|
||||
{
|
||||
if (hull.Entity != SourceEntity)
|
||||
{
|
||||
hull.SendHit(Damage * Time.deltaTime, Penetration, Spread, DamageType, SourceEntity, hit.textureCoord, transform.forward);
|
||||
LineRenderer.SetPosition(1, hit.point);
|
||||
hitFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!hitFound)
|
||||
LineRenderer.SetPosition(1, transform.position + transform.forward * Range);
|
||||
LineRenderer.SetPosition(1, TargetTransform != null
|
||||
? TargetTransform.position
|
||||
: transform.position + transform.forward * Range);
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
|
|
|
|||
Loading…
Reference in a new issue