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:
Meta Vens 2026-10-07 19:47:21 +02:00
commit 23aa848315
8 changed files with 782 additions and 2 deletions

View file

@ -186,6 +186,7 @@ public interface IPowerConsumer
// Cut 2 (docs/fire-control-cut.md): 39 is the next free index against this list, not the 39 the
// superseded draft quoted -- checked directly here rather than trusted from that document.
Union(39, typeof(TargetingSystemData)),
Union(40, typeof(MineLayerData)),
JsonObject(MemberSerialization.OptIn)]
public abstract class BehaviorData
{

View file

@ -0,0 +1,27 @@
using MessagePack;
using Newtonsoft.Json;
// A weapon that lays a mine instead of firing a round: InstantWeapon pays for it (cooldown, ammo, energy, heat,
// wear, visibility) and FireControl.Fire routes it to Lay. The mine's own timings live here until gear supplies
// them (ruling missile-stats-now-gear-later). The blast radius is the item's BlastRadius, read through
// FireControl.FuseOf like every other blast.
[Inspectable, MessagePackObject, JsonObject(MemberSerialization.OptIn), RuntimeInspectable]
public class MineLayerData : InstantWeaponData
{
// Seconds after laying before the mine can be triggered.
[Inspectable, JsonProperty("armingDelay"), Key(21)]
public float ArmingDelay = 2f;
// Seconds from the trigger to the blast.
[Inspectable, JsonProperty("fuseDelay"), Key(22)]
public float FuseDelay = 2f;
// Seconds after laying at which an untriggered mine detonates.
[Inspectable, JsonProperty("lifetime"), Key(23)]
public float Lifetime = 30f;
public override Behavior CreateInstance(EquippedItem item)
{
return new InstantWeapon(this, item);
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1cc95be85eee47c79199bea20a6d7509
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: