Mines in the sim: a mine layer lays a free-floating mine body in Zone
MineLayerData (union 40) lays through InstantWeapon -> FireControl.Fire -> Lay; Zone.Mines steps each mine as a KinematicBody after the entity loop, arms it, triggers it on a hostile hull its blast disc touches (FireControl.Touches, the coverage Detonate uses) and detonates it through FireControl.Detonate at the fuse delay or lifetime. Hostile trigger, faction-blind blast, no owner leash. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
9f8b3f4536
commit
23aa848315
8 changed files with 782 additions and 2 deletions
25
Assets/Scripts/ServerShared/Mines.cs
Normal file
25
Assets/Scripts/ServerShared/Mines.cs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
// A laid mine: a free-floating body with a frozen payload. Not an Entity, never priced or rolled, never saved.
|
||||
// Zone.Lay is the only adder and Zone's mine step the only remover; every removal is its blast.
|
||||
public sealed class Mine
|
||||
{
|
||||
public FloatingBodyId Id;
|
||||
public KinematicBody Body;
|
||||
public double LaidAt;
|
||||
public float ArmingDelay;
|
||||
public float FuseDelay;
|
||||
public float Lifetime;
|
||||
public float BlastRadius;
|
||||
public float Damage;
|
||||
public DamageType DamageType;
|
||||
// The layer and its faction, frozen at lay (ruling mine-trigger-iff).
|
||||
public Entity Layer;
|
||||
public Faction LayerFaction;
|
||||
// Set once, when an eligible hull first touches the armed disc; the fuse counts from it.
|
||||
public double? TriggeredAt;
|
||||
|
||||
public bool Armed(double now) => now >= LaidAt + ArmingDelay;
|
||||
|
||||
// Ruling mine-trigger-iff: only an entity that is neither the layer nor of the layer's faction triggers it.
|
||||
public bool Triggers(Entity entity) =>
|
||||
entity != Layer && (LayerFaction == null || entity.Faction != LayerFaction);
|
||||
}
|
||||
Loading…
Reference in a new issue