Class TrapDef
A fixed-position deployment with separate arming, detection, trigger count and lifetime.
public sealed class TrapDef : IAbilityAction
- Inheritance
-
TrapDef
- Implements
- Inherited Members
Constructors
TrapDef(string, DamageDef, float, float, float, int, float, int, AreaEffectDef, bool, bool, bool, MechanicTargetDef, bool, PointRuleDef, TrapPlacement, float, Vec2)
Creates a finite data-only deployment. Public PlaceTrap can supply an explicit point instead of automatic placement.
public TrapDef(string id, DamageDef damage, float triggerRadius, float lifetime, float armDelay = 0, int maxTriggers = 1, float triggerCooldown = 0, int populationLimit = 0, AreaEffectDef area = null, bool targetsEnemies = true, bool targetsFlying = false, bool targetsGround = true, MechanicTargetDef targets = null, bool cancelWithSource = false, PointRuleDef pointRule = null, TrapPlacement placement = TrapPlacement.Rally, float placementRange = 0, Vec2 offset = default)
Parameters
idstringdamageDamageDeftriggerRadiusfloatlifetimefloatarmDelayfloatmaxTriggersinttriggerCooldownfloatpopulationLimitintareaAreaEffectDeftargetsEnemiesbooltargetsFlyingbooltargetsGroundbooltargetsMechanicTargetDefcancelWithSourceboolpointRulePointRuleDefplacementTrapPlacementplacementRangefloatoffsetVec2
Properties
Area
Optional region created once per trigger.
public AreaEffectDef Area { get; }
Property Value
ArmDelay
Game delay before detection. New deployments never act in their creation tick.
public float ArmDelay { get; }
Property Value
CancelWithSource
Removes deployments when their source dies or disappears; false preserves captured output and credit.
public bool CancelWithSource { get; }
Property Value
Damage
Hit payload; area damage is centered on the trap, single damage on the trigger recipient.
public DamageDef Damage { get; }
Property Value
Id
Neutral deployment/event identity.
public string Id { get; }
Property Value
Lifetime
Total game lifetime, including arming.
public float Lifetime { get; }
Property Value
MaxTriggers
Maximum activations before removal.
public int MaxTriggers { get; }
Property Value
Offset
Offset applied before point validation, in world coordinates.
public Vec2 Offset { get; }
Property Value
Placement
Automatic ability placement mode.
public TrapPlacement Placement { get; }
Property Value
PlacementRange
Opponent placement search range, affected by attack range modifiers.
public float PlacementRange { get; }
Property Value
PointRule
Shared placement policy; null selects the standard on-path policy.
public PointRuleDef PointRule { get; }
Property Value
PopulationLimit
Maximum live deployments per source and Id; zero disables this authoring limit.
public int PopulationLimit { get; }
Property Value
Targets
Additional trigger eligibility; collateral area victims use their normal damage eligibility.
public MechanicTargetDef Targets { get; }
Property Value
TargetsEnemies
Global enemy faction rather than friendly soldiers/heroes.
public bool TargetsEnemies { get; }
Property Value
TargetsFlying
Allows flying trigger recipients.
public bool TargetsFlying { get; }
Property Value
TargetsGround
Allows ground trigger recipients.
public bool TargetsGround { get; }
Property Value
TriggerCooldown
Delay between activations; zero still permits at most one per fixed tick.
public float TriggerCooldown { get; }
Property Value
TriggerRadius
Horizontal detection radius, independent of damage radius.
public float TriggerRadius { get; }