This wiki is about 0.17, the current experimental version of Factorio.

Information about 0.16, the current stable version of Factorio, can be found on stable.wiki.factorio.com.

Prototype/Unit

From Official Factorio Wiki
Jump to: navigation, search

Prototype definitions » PrototypeBase » Prototype/Entity » Prototype/EntityWithHealth » Prototype/Unit


Entity that attacks players.


Prototype/Unit — unit
ai_settings::UnitAISettings
attack_parameters::AttackParameters
distance_per_frame::float
distraction_cooldown::uint32
movement_speed::float
pollution_to_join_attack::float
run_animation::RotatedAnimation
vision_distance::double
affected_by_tiles::bool (optional)
alternative_attacking_frame_sequence::table (optional)
can_open_gates::bool (optional)
dying_sound::Sound (optional)
has_belt_immunity::bool (optional)
max_pursue_distance::double (optional)
min_pursue_time::uint32 (optional)
move_while_shooting::bool (optional)
radar_range::uint32 (optional)
render_layer::RenderLayer (optional)
rotation_speed::double (optional)
spawning_time_modifier::double (optional)
Inherited from Prototype/EntityWithHealth
alert_when_damaged::bool (optional)
attack_reaction::AttackReaction (optional)
corpse::string or table of strings (optional)
create_ghost_on_death::bool (optional)
dying_explosion::string (optional)
dying_trigger_effect::TriggerEffect (optional)
healing_per_tick::float (optional)
hide_resistances::bool (optional)
integration_patch::Sprite4Way (optional)
integration_patch_render_layer::RenderLayer (optional)
loot::Loot (optional)
max_health::float (optional)
repair_sound::Sound (optional)
repair_speed_modifier::float (optional)
resistances::Resistances (optional)
Inherited from Prototype/Entity
icons, icon, icon_size (IconSpecification)::IconSpecification
additional_pastable_entities::string or table of string (optional)
alert_icon_scale::float (optional)
alert_icon_shift::vector (optional)
allow_copy_paste::bool (optional)
autoplace::AutoplaceSpecification (optional)
build_base_evolution_requirement::double (optional)
build_sound::Sound (optional)
close_sound::Sound (optional)
collision_box::BoundingBox (optional)
collision_mask::CollisionMask (optional)
created_effect::Trigger (optional)
created_smoke::CreateTrivialSmokeEffectItem (optional)
drawing_box::BoundingBox (optional)
emissions_per_second::double (optional)
emissions_per_tick::double (optional)
enemy_map_color::Color (optional)
fast_replaceable_group::string (optional)
flags::EntityPrototypeFlags (optional)
friendly_map_color::Color (optional)
hit_visualization_box::BoundingBox (optional)
map_color::Color (optional)
map_generator_bounding_box::BoundingBox (optional)
minable::MinableProperties (optional)
mined_sound::Sound (optional)
next_upgrade::string (optional)
open_sound::Sound (optional)
placeable_by::ItemToPlace or table of ItemToPlace (optional)
remains_when_mined::string or table of string (optional)
selectable_in_game::bool (optional)
selection_box::BoundingBox (optional)
selection_priority::uint8 (optional)
shooting_cursor_size::double (optional)
sticker_box::BoundingBox (optional)
subgroup::string (optional)
tile_height::uint32 (optional)
tile_width::uint32 (optional)
vehicle_impact_sound::Sound (optional)
working_sound::WorkingSound (optional)
Inherited from PrototypeBase
name::string
type::string
localised_description::LocalisedString (optional)
localised_name::LocalisedString (optional)
order::Order (optional)

Usage in base

Mandatory properties

This prototype inherits all the properties from Prototype/EntityWithHealth.

run_animation

Type: RotatedAnimation

attack_parameters

Type: AttackParameters
Requires animation in attack_parameters. Requires ammo_type in attack_parameters.

movement_speed

Type: float
Must be equal to or greater than 0.

distance_per_frame

Type: float

pollution_to_join_attack

Type: float
The amount of pollution that has to be absorbed by the unit's spawner before the unit will leave the spawner and attack the source of the pollution.

distraction_cooldown

Type: uint32

vision_distance

Type: double
Max is 100.

Note: Setting to 50 or above can lead to undocumented behavior of individual units creating groups on their own when attacking or being attacked.

ai_settings

Type: UnitAISettings

Optional properties

rotation_speed

Type: double
Default: 0.025

dying_sound

Type: Sound
The sound file to play when entity dies.

min_pursue_time

Type: uint32
Default: 10 * 60

has_belt_immunity

Type: bool
Default: false
If the unit is immune to movement by belts.

spawning_time_modifier

Type: double
Default: 1

max_pursue_distance

Type: double
Default: 50

radar_range

Type: uint32
Default: 0

move_while_shooting

Type: bool
Default: false

can_open_gates

Type: bool
Default: false

affected_by_tiles

Type: bool
Default: false

render_layer

Type: RenderLayer
Default: "object"

alternative_attacking_frame_sequence

Type: table
Table with the following mandatory properties:

  • warmup_frame_sequence - Array of float - Indices of frames from the attack parameter animation.
  • warmup2_frame_sequence - Array of float - Indices of frames from the attack parameter animation.
  • attacking_frame_sequence - Array of float - Indices of frames from the attack parameter animation.
  • cooldown_frame_sequence - Array of float - Indices of frames from the attack parameter animation.
  • prepared_frame_sequence - Array of float - Indices of frames from the attack parameter animation.
  • back_to_walk_frame_sequence - Array of float - Indices of frames from the attack parameter animation.
  • warmup_animation_speed - float
  • attacking_animation_speed - float
  • cooldown_animation_speed - float
  • prepared_animation_speed - float
  • back_to_walk_animation_speed - float