Factorio.com|Forums|Wiki|Mod Portal|API Docs

# Factorio Prototype Docs Version 2.0.77

# BaseAttackParameters - Prototype Docs

## BaseAttackParameters :: struct - abstract

The abstract base of all AttackParameters.

Children BeamAttackParameters ProjectileAttackParameters StreamAttackParameters

## Properties

- default
- sorted

range | :: float | Before an entity can attack, the distance (in tiles) between the entity and target must be less than or equal to this.
Before an entity can attack, the distance (in tiles) between the entity and target must be less than or equal to this.
cooldown | :: float | Number of ticks in which it will be possible to shoot again. [...]
Number of ticks in which it will be possible to shoot again. [...]
min_range optional | :: float | The minimum distance (in tiles) between an entity and target. [...]
The minimum distance (in tiles) between an entity and target. [...]
turn_range optional | :: float | If this is <= 0, it is set to 1. [...]
If this is <= 0, it is set to 1. [...]
fire_penalty optional | :: float | Used when searching for the nearest enemy, when this is > 0, enemies that aren't burning are preferred over burning enemies. [...]
Used when searching for the nearest enemy, when this is > 0, enemies that aren't burning are preferred over burning enemies. [...]
rotate_penalty optional | :: float | A higher penalty will discourage turrets from targeting units that would take longer to turn to face.
A higher penalty will discourage turrets from targeting units that would take longer to turn to face.
health_penalty optional | :: float | A higher penalty will discourage turrets from targeting units with higher health. [...]
A higher penalty will discourage turrets from targeting units with higher health. [...]
range_mode optional | :: RangeMode |
min_attack_distance optional | :: float | If less than `range`, the entity will choose a random distance between `range` and `min_attack_distance` and attack from that distance.
If less than `range`, the entity will choose a random distance between `range` and `min_attack_distance` and attack from that distance.
damage_modifier optional | :: float |
ammo_consumption_modifier optional | :: float | Must be greater than or equal to `0`.
Must be greater than or equal to `0`.
cooldown_deviation optional | :: float | Must be between `0` and `1`.
Must be between `0` and `1`.
warmup optional | :: uint32 | Number of ticks it takes for the weapon to actually shoot after the order for shooting has been made. [...]
Number of ticks it takes for the weapon to actually shoot after the order for shooting has been made. [...]
lead_target_for_projectile_speed optional | :: float | Setting this to anything but zero causes homing projectiles to aim for the predicted location based on enemy movement instead of the current enemy location. [...]
Setting this to anything but zero causes homing projectiles to aim for the predicted location based on enemy movement instead of the current enemy location. [...]
lead_target_for_projectile_delay optional | :: uint32 | Setting this to anything but zero causes projectiles to aim for the predicted location based on enemy movement instead of the current enemy location. [...]
Setting this to anything but zero causes projectiles to aim for the predicted location based on enemy movement instead of the current enemy location. [...]
movement_slow_down_cooldown optional | :: float |
movement_slow_down_factor optional | :: double |
ammo_type optional | :: AmmoType | Can be mandatory.
Can be mandatory.
activation_type optional | :: `"shoot"` or `"throw"` or `"consume"` or `"activate"` | Used in tooltips to set the tooltip category. [...]
Used in tooltips to set the tooltip category. [...]
sound optional | :: LayeredSound | Played once at the start of the attack if these are ProjectileAttackParameters.
Played once at the start of the attack if these are ProjectileAttackParameters.
animation optional | :: RotatedAnimation |
cyclic_sound optional | :: CyclicSound | Played during the attack.
Played during the attack.
use_shooter_direction optional | :: boolean |
ammo_categories optional | :: array[AmmoCategoryID] | Mandatory if `ammo_category` is not defined.
Mandatory if `ammo_category` is not defined.
ammo_category optional | :: AmmoCategoryID | Mandatory if `ammo_categories` is not defined.
Mandatory if `ammo_categories` is not defined.
true_collinear_ejection optional | :: boolean | Projectile will be creation position and orientation will be collinear with shooter and target (unless offset projectile center is specified). [...]
Projectile will be creation position and orientation will be collinear with shooter and target (unless offset projectile center is specified). [...]

cooldown | :: float | Number of ticks in which it will be possible to shoot again. [...]
Number of ticks in which it will be possible to shoot again. [...]
range | :: float | Before an entity can attack, the distance (in tiles) between the entity and target must be less than or equal to this.
Before an entity can attack, the distance (in tiles) between the entity and target must be less than or equal to this.
activation_type optional | :: `"shoot"` or `"throw"` or `"consume"` or `"activate"` | Used in tooltips to set the tooltip category. [...]
Used in tooltips to set the tooltip category. [...]
ammo_categories optional | :: array[AmmoCategoryID] | Mandatory if `ammo_category` is not defined.
Mandatory if `ammo_category` is not defined.
ammo_category optional | :: AmmoCategoryID | Mandatory if `ammo_categories` is not defined.
Mandatory if `ammo_categories` is not defined.
ammo_consumption_modifier optional | :: float | Must be greater than or equal to `0`.
Must be greater than or equal to `0`.
ammo_type optional | :: AmmoType | Can be mandatory.
Can be mandatory.
animation optional | :: RotatedAnimation |
cooldown_deviation optional | :: float | Must be between `0` and `1`.
Must be between `0` and `1`.
cyclic_sound optional | :: CyclicSound | Played during the attack.
Played during the attack.
damage_modifier optional | :: float |
fire_penalty optional | :: float | Used when searching for the nearest enemy, when this is > 0, enemies that aren't burning are preferred over burning enemies. [...]
Used when searching for the nearest enemy, when this is > 0, enemies that aren't burning are preferred over burning enemies. [...]
health_penalty optional | :: float | A higher penalty will discourage turrets from targeting units with higher health. [...]
A higher penalty will discourage turrets from targeting units with higher health. [...]
lead_target_for_projectile_delay optional | :: uint32 | Setting this to anything but zero causes projectiles to aim for the predicted location based on enemy movement instead of the current enemy location. [...]
Setting this to anything but zero causes projectiles to aim for the predicted location based on enemy movement instead of the current enemy location. [...]
lead_target_for_projectile_speed optional | :: float | Setting this to anything but zero causes homing projectiles to aim for the predicted location based on enemy movement instead of the current enemy location. [...]
Setting this to anything but zero causes homing projectiles to aim for the predicted location based on enemy movement instead of the current enemy location. [...]
min_attack_distance optional | :: float | If less than `range`, the entity will choose a random distance between `range` and `min_attack_distance` and attack from that distance.
If less than `range`, the entity will choose a random distance between `range` and `min_attack_distance` and attack from that distance.
min_range optional | :: float | The minimum distance (in tiles) between an entity and target. [...]
The minimum distance (in tiles) between an entity and target. [...]
movement_slow_down_cooldown optional | :: float |
movement_slow_down_factor optional | :: double |
range_mode optional | :: RangeMode |
rotate_penalty optional | :: float | A higher penalty will discourage turrets from targeting units that would take longer to turn to face.
A higher penalty will discourage turrets from targeting units that would take longer to turn to face.
sound optional | :: LayeredSound | Played once at the start of the attack if these are ProjectileAttackParameters.
Played once at the start of the attack if these are ProjectileAttackParameters.
true_collinear_ejection optional | :: boolean | Projectile will be creation position and orientation will be collinear with shooter and target (unless offset projectile center is specified). [...]
Projectile will be creation position and orientation will be collinear with shooter and target (unless offset projectile center is specified). [...]
turn_range optional | :: float | If this is <= 0, it is set to 1. [...]
If this is <= 0, it is set to 1. [...]
use_shooter_direction optional | :: boolean |
warmup optional | :: uint32 | Number of ticks it takes for the weapon to actually shoot after the order for shooting has been made. [...]
Number of ticks it takes for the weapon to actually shoot after the order for shooting has been made. [...]

## Properties

### range :: float

Before an entity can attack, the distance (in tiles) between the entity and target must be less than or equal to this.

### cooldown :: float

Number of ticks in which it will be possible to shoot again. If < 1, multiple shots can be performed in one tick.

### min_range :: float optional

Default: `0`

The minimum distance (in tiles) between an entity and target. If a unit's target is less than this, the unit will attempt to move away before attacking. A flamethrower turret does not move, but has a minimum range. Less than this, it is unable to target an enemy.

### turn_range :: float optional

Default: `1`

If this is <= 0, it is set to 1. Arc from 0 to 1, so for example 0.25 is 90°. Used by the flamethrower turret in the base game. Arcs greater than 0.5 but less than 1 will be clamped to 0.5 as targeting in arcs larger than half circle is not implemented.

### fire_penalty :: float optional

Default: `0`

Used when searching for the nearest enemy, when this is > 0, enemies that aren't burning are preferred over burning enemies. Definition of "burning" for this: Entity has sticker attached to it, and the sticker has a spread_fire_entity set.

### rotate_penalty :: float optional

Default: `0`

A higher penalty will discourage turrets from targeting units that would take longer to turn to face.

### health_penalty :: float optional

Default: `0`

A higher penalty will discourage turrets from targeting units with higher health. A negative penalty will encourage turrets to target units with higher health.

### range_mode :: RangeMode optional

Default: `"center-to-center"`

### min_attack_distance :: float optional

Default: equal to `range` property

If less than `range`, the entity will choose a random distance between `range` and `min_attack_distance` and attack from that distance.

### damage_modifier :: float optional

Default: `1`

### ammo_consumption_modifier :: float optional

Default: `1`

Must be greater than or equal to `0`.

### cooldown_deviation :: float optional

Default: `0`

Must be between `0` and `1`.

### warmup :: uint32 optional

Default: `0`

Number of ticks it takes for the weapon to actually shoot after the order for shooting has been made. This also allows to "adjust" the shooting animation to the effect of shooting.

CapsuleActions cannot have attack parameters with non-zero warmup.

### lead_target_for_projectile_speed :: float optional

Default: `0`

Setting this to anything but zero causes homing projectiles to aim for the predicted location based on enemy movement instead of the current enemy location. If set, this property specifies the distance travelled per tick of the fired projectile.

#### Example

    -- this is same as particle horizontal speed of flamethrower fire stream
    lead_target_for_projectile_speed = 0.2* 0.75 * 1.5

### lead_target_for_projectile_delay :: uint32 optional

Default: `0`

Setting this to anything but zero causes projectiles to aim for the predicted location based on enemy movement instead of the current enemy location. If set, this property adds a flat number of ticks atop `lead_target_for_projectile_speed` that the shooter must lead.

### movement_slow_down_cooldown :: float optional

Default: equal to `cooldown` property

### movement_slow_down_factor :: double optional

Default: `1`

### ammo_type :: AmmoType optional

Can be mandatory.

### activation_type :: `"shoot"` or `"throw"` or `"consume"` or `"activate"` optional

Default: `"shoot"`

Used in tooltips to set the tooltip category. It is also used to get the locale keys for activation instructions and speed of the action for the tooltip.

For example, an activation_type of "throw" will result in the tooltip category "thrown" and the tooltip locale keys "gui.instruction-to-throw" and "description.throwing-speed".

### sound :: LayeredSound optional

Played once at the start of the attack if these are ProjectileAttackParameters.

### animation :: RotatedAnimation optional

### cyclic_sound :: CyclicSound optional

Played during the attack.

### use_shooter_direction :: boolean optional

Default: `false`

### ammo_categories :: array[AmmoCategoryID] optional

Mandatory if `ammo_category` is not defined.

### ammo_category :: AmmoCategoryID optional

Mandatory if `ammo_categories` is not defined.

### true_collinear_ejection :: boolean optional

Default: `false`

Projectile will be creation position and orientation will be collinear with shooter and target (unless offset projectile center is specified). Used for railgun turrets to avoid unexpected friendly fire incidents.