Class TrapDef

Namespace
TDMaker.Core.Defs
Assembly
TDMaker.Core.dll

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

id string
damage DamageDef
triggerRadius float
lifetime float
armDelay float
maxTriggers int
triggerCooldown float
populationLimit int
area AreaEffectDef
targetsEnemies bool
targetsFlying bool
targetsGround bool
targets MechanicTargetDef
cancelWithSource bool
pointRule PointRuleDef
placement TrapPlacement
placementRange float
offset Vec2

Properties

Area

Optional region created once per trigger.

public AreaEffectDef Area { get; }

Property Value

AreaEffectDef

ArmDelay

Game delay before detection. New deployments never act in their creation tick.

public float ArmDelay { get; }

Property Value

float

CancelWithSource

Removes deployments when their source dies or disappears; false preserves captured output and credit.

public bool CancelWithSource { get; }

Property Value

bool

Damage

Hit payload; area damage is centered on the trap, single damage on the trigger recipient.

public DamageDef Damage { get; }

Property Value

DamageDef

Id

Neutral deployment/event identity.

public string Id { get; }

Property Value

string

Lifetime

Total game lifetime, including arming.

public float Lifetime { get; }

Property Value

float

MaxTriggers

Maximum activations before removal.

public int MaxTriggers { get; }

Property Value

int

Offset

Offset applied before point validation, in world coordinates.

public Vec2 Offset { get; }

Property Value

Vec2

Placement

Automatic ability placement mode.

public TrapPlacement Placement { get; }

Property Value

TrapPlacement

PlacementRange

Opponent placement search range, affected by attack range modifiers.

public float PlacementRange { get; }

Property Value

float

PointRule

Shared placement policy; null selects the standard on-path policy.

public PointRuleDef PointRule { get; }

Property Value

PointRuleDef

PopulationLimit

Maximum live deployments per source and Id; zero disables this authoring limit.

public int PopulationLimit { get; }

Property Value

int

Targets

Additional trigger eligibility; collateral area victims use their normal damage eligibility.

public MechanicTargetDef Targets { get; }

Property Value

MechanicTargetDef

TargetsEnemies

Global enemy faction rather than friendly soldiers/heroes.

public bool TargetsEnemies { get; }

Property Value

bool

TargetsFlying

Allows flying trigger recipients.

public bool TargetsFlying { get; }

Property Value

bool

TargetsGround

Allows ground trigger recipients.

public bool TargetsGround { get; }

Property Value

bool

TriggerCooldown

Delay between activations; zero still permits at most one per fixed tick.

public float TriggerCooldown { get; }

Property Value

float

TriggerRadius

Horizontal detection radius, independent of damage radius.

public float TriggerRadius { get; }

Property Value

float