Prototype/Unit: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
m (Protected "Prototype/Unit": Migrated prototype doc to separate website ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)))
(Updated styling of prototype doc migration note)
Line 1: Line 1:
'''The prototype docs have moved to a new website with an improved format.''' This documentation page can now be found here: [https://lua-api.factorio.com/latest/prototypes/UnitPrototype.html https://lua-api.factorio.com/latest/prototypes/UnitPrototype.html]
<div class="stub"><p>'''The prototype docs have moved to a new website with an improved format.''' This documentation page can now be found here: [https://lua-api.factorio.com/latest/prototypes/UnitPrototype.html https://lua-api.factorio.com/latest/prototypes/UnitPrototype.html]


This wiki page is no longer updated and '''will be removed at some point in the future''', so please update your browser bookmarks or other links that sent you here. If you'd like to contribute to the new docs, you can leave your feedback [https://forums.factorio.com/viewforum.php?f=233 on the forums].
</p><p>This wiki page is no longer updated and '''will be removed at some point in the future''', so please update your browser bookmarks or other links that sent you here. If you'd like to contribute to the new docs, you can leave your feedback [https://forums.factorio.com/viewforum.php?f=233 on the forums].</p></div>





Revision as of 10:43, 21 September 2023

The prototype docs have moved to a new website with an improved format. This documentation page can now be found here: https://lua-api.factorio.com/latest/prototypes/UnitPrototype.html

This wiki page is no longer updated and will be removed at some point in the future, so please update your browser bookmarks or other links that sent you here. If you'd like to contribute to the new docs, you can leave your feedback on the forums.


Template:Prototype parent Entity that moves around and attacks players, for example biters and spitters.

Template:Prototype TOC

Usage in base

Mandatory properties

This prototype inherits all the properties from Prototype/EntityWithOwner.

Template:Prototype property

Template:Prototype property Requires animation in attack_parameters. Requires ammo_type in attack_parameters.

Template:Prototype property Movement speed of the unit in the world, in tiles per tick. Must be equal to or greater than 0.

Template:Prototype property How fast the run_animation frames are advanced. The animations are advanced animation_speed frames per distance_per_frame that the unit moves.

frames_advanced = (distance_moved ÷ distance_per_frame) * animation_speed

Template:Prototype property 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.

Template:Prototype property

Template:Prototype property 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.

Optional properties

Template:Prototype property

Template:Prototype property The sound file to play when entity dies.

Template:Prototype property

Template:Prototype property If the unit is immune to movement by belts.

Template:Prototype property

Template:Prototype property

Template:Prototype property

Template:Prototype property

Template:Prototype property

Template:Prototype property

Template:Prototype property

Template:Prototype property

Template:Prototype property

Template:Prototype property

Template:Prototype property Table with the following mandatory properties:

  • warmup_frame_sequence - Array of uint16 - Indices of frames from the attack parameter animation.
  • warmup2_frame_sequence - Array of uint16 - Indices of frames from the attack parameter animation.
  • attacking_frame_sequence - Array of uint16 - Indices of frames from the attack parameter animation.
  • cooldown_frame_sequence - Array of uint16 - Indices of frames from the attack parameter animation.
  • prepared_frame_sequence - Array of uint16 - Indices of frames from the attack parameter animation.
  • back_to_walk_frame_sequence - Array of uint16 - 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

Template:Prototype property Ignored if walking_sounds is not defined.

Mandatory values

Units have additional requirements for the properties inherited from Prototype/EntityWithOwner: