Skip to content

CollisionEffect ​

Inherits: CompositeEffect < Effect < DatabaseResource < Resource

Inherited by: AreaEffect, WeaponCollisionEffect

CollisionEffect using pure raycast collision detection for reliability

Properties ​

AffectedTargetsaffected_targetsAffectedTargets.ALL
boolaffects_neutralsfalse
boolgain_on_enterfalse
boolremove_on_exitfalse
boolprevent_duplicate_hitstrue
intmax_targets0
TargetPrioritytarget_priorityTargetPriority.NONE
CapRulecap_ruleCapRule.CONCURRENT
InteractableRuleinteractable_ruleInteractableRule.TREAT_AS_EQUALS

Variables ​

floatcollision_poll_interval0.5

Methods ​

voidspecific_effect_logic( effect_instance: EffectInstance )
voidon_apply_finished( effect_instance: EffectInstance )
Array[Variant]get_entities_in_area( effect_instance: EffectInstance )
boolis_entity_in_area( effect_instance: EffectInstance, entity: Variant )
intget_entity_count_in_area( effect_instance: EffectInstance )
voidforce_collision_check( effect_instance: EffectInstance )
voidset_collision_poll_interval( interval: float )
Stringget_effect_description()
Stringget_editor_description()

Enumerations ​

enum AffectedTargets ​

The options of affected targets: all, enemies, allies.

  • ALL = 0
  • ENEMIES = 1
  • ALLIES = 2

enum TargetPriority ​

The options of target priority: none, closest to center, closest to originator, random, lowest health percent, highest health percent.

  • NONE = 0 - Take whatever order the physics query returns
  • CLOSEST_TO_CENTER = 1 - Closest to the collision shape's origin first
  • CLOSEST_TO_ORIGINATOR = 2 - Closest to the originator's position first
  • RANDOM = 3 - Random shuffle before capping
  • LOWEST_HEALTH_PERCENT = 4 - Lowest HP% first — useful for heal prioritisation
  • HIGHEST_HEALTH_PERCENT = 5 - Highest HP% first

enum CapRule ​

The options of cap rule: concurrent, total.

  • CONCURRENT = 0 - At most max_targets entities are affected at once; exits free a slot
  • TOTAL = 1 - Once max_targets entities have been hit the cap locks — exits do not free slots

enum InteractableRule ​

The options of interactable rule: ignore, treat as equals, treat after entities.

  • IGNORE = 0 - Exclude InteractableObjects from targeting entirely
  • TREAT_AS_EQUALS = 1 - Include in the same pool as entities; sorted and capped together
  • TREAT_AFTER_ENTITIES = 2 - Include but always placed after all entities in priority order

Property descriptions ​

AffectedTargets affected_targets = AffectedTargets.ALL ​

Which entities in the area are affected (all, enemies, allies ...).

bool affects_neutrals = false ​

Does an "enemies" area also hit neutral entities (not hostile, not friendly)? Off by default: a neutral bystander is not an enemy. Destructible scenery (the environmental faction) is hit either way. Has no effect on "all" and "allies"

bool gain_on_enter = false ​

True when an entity gets the child effects when it enters the area.

bool remove_on_exit = false ​

True when the child effects end when the entity leaves the area.

bool prevent_duplicate_hits = true ​

Prevents the same entity from being hit multiple times by the same effect instance. Highly recommended to keep enabled — disable only for effects that intentionally need to re-apply to the same target (e.g. a damage aura ticking on overlapping entities).

Target Filtering

int max_targets = 0 ​

Maximum number of targets to affect. 0 = unlimited.

TargetPriority target_priority = TargetPriority.NONE ​

How to order targets when a cap is applied. Has no effect when max_targets is 0.

CapRule cap_rule = CapRule.CONCURRENT ​

Whether the cap tracks concurrent or total hits. Only relevant in persistent mode. CONCURRENT: slots free when entities exit the area. TOTAL: once max_targets have been hit the gate closes permanently.

InteractableRule interactable_rule = InteractableRule.TREAT_AS_EQUALS ​

How InteractableObjects are treated relative to entities during filtering.

Variable descriptions ​

float collision_poll_interval = 0.5 ​

How many seconds between checks of who is in the area.

Method descriptions ​

void specific_effect_logic( effect_instance: EffectInstance ) ​

What the effect does to its target when it is applied.

void on_apply_finished( effect_instance: EffectInstance ) ​

Called when the effect ends: takes back what it did.

Array[Variant] get_entities_in_area( effect_instance: EffectInstance ) ​

The entities in the area of the effect now.

bool is_entity_in_area( effect_instance: EffectInstance, entity: Variant ) ​

Is the entity in the area now?

int get_entity_count_in_area( effect_instance: EffectInstance ) ​

How many entities are in the area now.

void force_collision_check( effect_instance: EffectInstance ) ​

Checks who is in the area now, without waiting for the interval.

void set_collision_poll_interval( interval: float ) ​

Sets the seconds between checks (at least 0.1).

String get_effect_description() ​

The text of the effect for tooltips, with its values filled in.

String get_editor_description() ​

A short text for the effect editor that says what the effect does.