target_priorities

class TargetPrioritiesMixin(
priority_list=NOTHING,
ignore_unprioritized: bool = False,
set_priority_list: bool = False,
set_ignore_unprioritized: bool = False,
ignore_unlisted_targets_condition: Any = NOTHING,
*,
extra_keys: dict[str, Any] | None = None,
)

Enables the entity to prioritize specific targets either statically or dynamically via the circuit network.

ignore_unlisted_targets_condition : Condition

Serialized

This attribute is imported/exported from blueprint strings.

The condition to use when determining whether or not to ignore unprioritized targets dynamically via the circuit network.

Added in version 3.0.0: (Factorio 2.0)

ignore_unprioritized : bool

Serialized

This attribute is imported/exported from blueprint strings.

Whether or not to entirely ignore enemies not present in it’s priority_list. This value is overridden by the circuit network if set_ignore_prioritized is True.

Added in version 3.0.0: (Factorio 2.0)

priority_list : list[TargetID]

Serialized

This attribute is imported/exported from blueprint strings.

A (static) list of entities to prefer targeting. Overwritten by values given by the circuit network if set_priority_list is True.

Added in version 3.0.0: (Factorio 2.0)

set_ignore_unprioritized : bool

Serialized

This attribute is imported/exported from blueprint strings.

If this value is True, the turret will only ignore unprioritized targets if the condition ignore_unlisted_targets_condition passes.

Added in version 3.0.0: (Factorio 2.0)

set_priority_list : bool

Serialized

This attribute is imported/exported from blueprint strings.

Whether or not priority filters should be set via the circuit network.

Added in version 3.0.0: (Factorio 2.0)

set_ignore_unlisted_targets_condition(
first_operand: SignalID | None = None,
comparator: '>' | '<' | '=' | '==' | '≥' | '>=' | '≤' | '<=' | '≠' | '!=' = '<',
second_operand: SignalID | int = 0,
)

Sets the condition under which non-prioritized targets should be ignored.

comparator can be specified as stored as the single unicode character which is used by Factorio, or you can use the Python formatted 2-character equivalents:

# One of:
[">", "<", "=",  "≥",  "≤",  "≠"]
# Or, alternatively:
[">", "<", "==", ">=", "<=", "!="]

If specified in the second format, they are converted to and stored as the first format.

Parameters:
first_operand: SignalID | None = None

The string name of the first signal.

comparator: '>' | '<' | '=' | '==' | '≥' | '>=' | '≤' | '<=' | '≠' | '!=' = '<'

The operation to use, as specified above.

second_operand: SignalID | int = 0

The string name of the second signal, or some 32-bit constant.

Raises:

DataFormatError – If first_operand is not a valid signal name, if comparator is not a valid operation, or if second_operand is neither a valid signal name nor a constant.