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,79 +1,17 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UniRx;
|
||||
using CultMath;
|
||||
using CultMath.UnityBridge;
|
||||
using static CultMath.math;
|
||||
using UnityEngine;
|
||||
using float2 = CultMath.float2;
|
||||
using CultMath.UnityBridge;
|
||||
|
||||
// Cut 3 (docs/fire-control-cut.md) FORK, reported rather than worked around silently: the map's Cut 3 deletion
|
||||
// list calls for Hit, Splash, SendHit and SendSplash to go away here outright. They cannot, yet, without
|
||||
// breaking the build -- ConstantLaser.cs, ConstantLightning.cs, ConstantParticleWeapon.cs, HitscanEffect.cs
|
||||
// and Mine.cs (Cut 4's "unused kinds," R9) still call hull.SendHit/SendSplash from their own live Physics
|
||||
// queries, and Cut 4 is the cut that migrates them. Deleting these methods now is a compile break in
|
||||
// out-of-scope files, not a behaviour change in this cut's own scope.
|
||||
//
|
||||
// What Cut 3 actually owns and has delivered: nothing in Assets/Scripts/Gameplay/Weapons/{Projectile,
|
||||
// GuidedProjectile,Laser,Lightning}.cs calls SendHit/SendSplash any more (see those files), and
|
||||
// EntityInstance.cs no longer subscribes to Hit/Splash at all -- so for the four weapon kinds this cut owns,
|
||||
// these events have no subscriber and decide nothing. They fire into the void until Cut 4 deletes them
|
||||
// together with their last remaining callers. OnCollisionEnter stays regardless: ship-on-ship collision
|
||||
// impulse is a deferred Unity-physics surface, not part of fire control.
|
||||
// Cut 4 (docs/fire-control-cut.md): Hit, Splash, SendHit and SendSplash are deleted -- their last callers
|
||||
// (ConstantLaser, ConstantLightning, ConstantParticleWeapon, HitscanEffect, Mine) are gone too (see those
|
||||
// files and FireControl.Splash). Nothing decides or applies damage through a Unity collider any more (R8):
|
||||
// this component is now purely a physics surface for ship-on-ship collision impulse and Mine's own proximity
|
||||
// arming query (Q7), neither of which is hit detection.
|
||||
public class HullCollider : MonoBehaviour
|
||||
{
|
||||
public Subject<HullHitEventArgs> Hit = new Subject<HullHitEventArgs>();
|
||||
public Subject<HullSplashEventArgs> Splash = new Subject<HullSplashEventArgs>();
|
||||
|
||||
public Entity Entity { get; set; }
|
||||
|
||||
public void SendHit(float damage, float penetration, float spread, DamageType damageType, Entity source, Vector2 texCoord, Vector3 direction)
|
||||
{
|
||||
Hit.OnNext(new HullHitEventArgs
|
||||
{
|
||||
Damage = damage,
|
||||
Penetration = penetration,
|
||||
Spread = spread,
|
||||
DamageType = damageType,
|
||||
Source = source,
|
||||
TexCoord = texCoord.ToCultMath(),
|
||||
Direction = direction.ToCultMath()
|
||||
});
|
||||
}
|
||||
|
||||
public void SendSplash(float damage, DamageType damageType, Entity source, Vector3 direction)
|
||||
{
|
||||
Splash.OnNext(new HullSplashEventArgs
|
||||
{
|
||||
Damage = damage,
|
||||
DamageType = damageType,
|
||||
Source = source,
|
||||
Direction = direction.ToCultMath()
|
||||
});
|
||||
}
|
||||
|
||||
private void OnCollisionEnter(Collision other)
|
||||
{
|
||||
Entity.Velocity += other.impulse.ToCultMath().xz / Time.deltaTime;
|
||||
}
|
||||
|
||||
public class HullHitEventArgs
|
||||
{
|
||||
public float Damage;
|
||||
public float Penetration;
|
||||
public float Spread;
|
||||
public DamageType DamageType;
|
||||
public Entity Source;
|
||||
public float2 TexCoord;
|
||||
public float3 Direction;
|
||||
}
|
||||
|
||||
public class HullSplashEventArgs
|
||||
{
|
||||
public float Damage;
|
||||
public DamageType DamageType;
|
||||
public Entity Source;
|
||||
public float3 Direction;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue