WeaponAutoTargetRules

From Cosmoteer Wiki
< Modding‎ | ComponentsModding/Components/WeaponAutoTargetRules
Jump to navigation Jump to search
.rules file/node location: Cosmoteer.Ships.Parts.Weapons.WeaponAutoTargetRules

Stores rules for how a weapon should auto-target.

Used by most (probably all) weapons.

Particularly important for point defense weapons.

Name Type Required? Buffable? Default value Description
TargetType WeaponTargetType Yes - - The type of targets the weapon can auto-target, with respect to the Toggle.
BulletTargetCategories ID<BulletTargetableRules>[]? - - - What kinds of projectile this weapon can shoot down.

Used only by point_defense ( [missile, mine, bullet] ), and flak_cannon_large ( [missile, laser, bullet, mine] ).

Toggle ID<PartComponentRules>? - - - If this is On, the auto-targeting is enabled, else it isn't.

Usually set to AutoTargetToggle, but point defense weapons (PD and flak) have DefendToggle here instead.

Overridable bool - - false

(effectively)

Function unclear.

Point defense weapons have "true".

EnableInDirectControlMode bool - - - Presumably, if On, the weapon will still auto-target when direct control is enabled.[clarification needed][1]

Notes

  • Oddly enough, fixed weapons put it in an Autotarget{}, while turreted weapons use an Autotargets[{}]. Notice the [] difference.

This may be just a coincidence (also, see below).

  • The chaingun's .rules has 1 Autotargets[{}] and 2 Autotarget{}, despite having just 1 bullet emitter.
  • In almost all weapons, the code is exactly either this ... :
AutoTarget
{
	TargetType = ShipParts
	Toggle = AutoTargetToggle
}
  • ... or this :
AutoTargets
[
	{
		TargetType = ShipParts
		Toggle = AutoTargetToggle
	}
]

Point defense weapons

point_defense :

AutoTargets
[
	{
		TargetType = Bullets
		BulletTargetCategories = [missile, mine, bullet]
		Toggle = DefendToggle
	}
	{
		TargetType = ShipParts
		Toggle = AttackToggle
		Overridable = true
	}
]

flak_cannon_large :

AutoTargets
[
	{
		TargetType = Bullets
		BulletTargetCategories = [missile, laser, bullet, mine]
		Toggle = DefendToggle
	}
	{
		TargetType = ShipParts
		Toggle = AttackToggle
		Overridable = true
	}
]
  1. clarification needed: See the label for the context.