Skip to content

LegalTarget

Whether the type may be picked as a target by an automatic scan or by a player pointing at it.

Object targetability

Specification — Object targetability
Applies to
ObjectType and derived types
AircraftTypeBuildingTypeBulletTypeInfantryTypeOverlayTypeParticleSystemTypeParticleTypeSmudgeTypeTerrainTypeUnitTypeVoxelAnimType
File
rules.ini
Section
[<ObjectType ID>]
Value
boolean
When omitted
Context-dependentMost object types start targetable. A BulletType, SmudgeType, TerrainType or VoxelAnimType starts untargetable instead, and a TerrainType is forced back to targetable when its section sets IsVeinhole=yes.

With LegalTarget=no, no automatic target scan picks an object of this type, and pointing at one does not offer the attack cursor. On an OverlayType, pointing at the overlay’s cell does not offer the attack cursor.

rules.ini
[MYPROP] ; example BuildingType used as scenery
LegalTarget=no

The flag is checked only when a scan picks candidates and when the cursor is chosen, so it does not stop every attack:

  • A player can still order an attack by holding the force-fire key, left Ctrl by default.
  • An object that already has one of these objects as its target keeps attacking it.
  • Retaliation does not scan, so an object damaged by one of these objects can still fire back at it.

With TreeTargeting=yes in [CombatDamage], pointing at a TerrainType offers the attack cursor whatever this key says.

Animation targetability

Specification — Animation targetability
Applies to
AnimType
File
art.ini
Section
[<ObjectType ID>]
Value
boolean
When omitted
no
Used by the game
No — loaded but not used

An animation can never be a target, whatever this key says. Automatic target scans never consider one. The cursor cannot land on one either: pointing at the map picks the nearest infantry, vehicle, aircraft, structure or veinhole monster drawn near the pointer, or else whatever stands in the cell, and an animation is none of these.

An animation that rides on an object, such as flames on a damaged structure, follows the same rule. The cursor finds only the object underneath, and that object’s type decides whether it can be attacked.

See also — target-selection