Aetheria/Assets/Scripts/ServerShared/Behaviors/MineLayer.cs
Meta Vens 23aa848315 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>
2026-10-07 19:47:21 +02:00

27 lines
1.1 KiB
C#

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);
}
}