Prototype/Unit: Difference between revisions
(Converted to SMW format) |
(better description what this prototype type is) |
||
(5 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{Prototype parent|Prototype/ | {{Prototype parent|Prototype/EntityWithOwner}} | ||
Entity that attacks players. | Entity that moves around and attacks players, for example [[enemies#Creatures|biters and spitters]]. | ||
{{Prototype TOC|unit}} | {{Prototype TOC|unit}} | ||
Line 8: | Line 8: | ||
== Mandatory properties == | == Mandatory properties == | ||
This prototype inherits all the properties from [[Prototype/ | This prototype inherits all the properties from [[Prototype/EntityWithOwner]]. | ||
{{Prototype property|run_animation|[[Types/RotatedAnimation|RotatedAnimation]]}} | {{Prototype property|run_animation|[[Types/RotatedAnimation|RotatedAnimation]]}} | ||
Line 16: | Line 16: | ||
{{Prototype property|movement_speed|[[Types/float|float]]}} | {{Prototype property|movement_speed|[[Types/float|float]]}} | ||
Movement speed of the unit in the world, in tiles per tick. | |||
Must be equal to or greater than 0. | Must be equal to or greater than 0. | ||
{{Prototype property|distance_per_frame|[[Types/float|float]]}} | {{Prototype property|distance_per_frame|[[Types/float|float]]}} | ||
How fast the <code>run_animation</code> frames are advanced. The animations are advanced animation_speed frames per <code>distance_per_frame</code> that the unit moves. | |||
frames_advanced = (distance_moved ÷ distance_per_frame) * animation_speed | |||
{{Prototype property|pollution_to_join_attack|[[Types/float|float]]}} | {{Prototype property|pollution_to_join_attack|[[Types/float|float]]}} | ||
Line 29: | Line 33: | ||
Note: Setting to 50 or above can lead to undocumented behavior of individual units creating groups on their own when attacking or being attacked. | 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 == | == Optional properties == | ||
{{Prototype property|rotation_speed|[[Types/ | {{Prototype property|rotation_speed|[[Types/float|float]]|0.025|optional=true}} | ||
{{Prototype property|dying_sound|[[Types/Sound|Sound]]|optional=true}} | {{Prototype property|dying_sound|[[Types/Sound|Sound]]|optional=true}} | ||
Line 49: | Line 51: | ||
{{Prototype property|radar_range|[[Types/uint32|uint32]]|0|optional=true}} | {{Prototype property|radar_range|[[Types/uint32|uint32]]|0|optional=true}} | ||
{{Prototype property|ai_settings|[[Types/UnitAISettings|UnitAISettings]]|optional=true}} | |||
{{Prototype property|move_while_shooting|[[Types/bool|bool]]|false|optional=true}} | {{Prototype property|move_while_shooting|[[Types/bool|bool]]|false|optional=true}} | ||
Line 57: | Line 61: | ||
{{Prototype property|render_layer|[[Types/RenderLayer|RenderLayer]]|"object"|optional=true}} | {{Prototype property|render_layer|[[Types/RenderLayer|RenderLayer]]|"object"|optional=true}} | ||
{{Prototype property|light|[[Types/LightDefinition|LightDefinition]]|optional=true}} | |||
{{Prototype property|walking_sound|[[Types/Sound|Sound]]|optional=true}} | |||
{{Prototype property|alternative_attacking_frame_sequence|[[Types/table|table]]|optional=true}} | {{Prototype property|alternative_attacking_frame_sequence|[[Types/table|table]]|optional=true}} | ||
Table with the following mandatory properties: | Table with the following mandatory properties: | ||
* warmup_frame_sequence - Array of [[Types/ | * warmup_frame_sequence - Array of [[Types/uint16|uint16]] - Indices of frames from the attack parameter animation. | ||
* warmup2_frame_sequence - Array of [[Types/ | * warmup2_frame_sequence - Array of [[Types/uint16|uint16]] - Indices of frames from the attack parameter animation. | ||
* attacking_frame_sequence - Array of [[Types/ | * attacking_frame_sequence - Array of [[Types/uint16|uint16]] - Indices of frames from the attack parameter animation. | ||
* cooldown_frame_sequence - Array of [[Types/ | * cooldown_frame_sequence - Array of [[Types/uint16|uint16]] - Indices of frames from the attack parameter animation. | ||
* prepared_frame_sequence - Array of [[Types/ | * prepared_frame_sequence - Array of [[Types/uint16|uint16]] - Indices of frames from the attack parameter animation. | ||
* back_to_walk_frame_sequence - Array of [[Types/ | * back_to_walk_frame_sequence - Array of [[Types/uint16|uint16]] - Indices of frames from the attack parameter animation. | ||
* warmup_animation_speed - [[Types/float|float]] | * warmup_animation_speed - [[Types/float|float]] | ||
* attacking_animation_speed - [[Types/float|float]] | * attacking_animation_speed - [[Types/float|float]] | ||
Line 72: | Line 80: | ||
* prepared_animation_speed - [[Types/float|float]] | * prepared_animation_speed - [[Types/float|float]] | ||
* back_to_walk_animation_speed - [[Types/float|float]] | * back_to_walk_animation_speed - [[Types/float|float]] | ||
{{Prototype property|running_sound_animation_positions|[[Types/table|table]] (array) of [[Types/float|float]]|optional=true}} | |||
Ignored if <code>walking_sounds</code> is not defined. | |||
== Mandatory values == | |||
Units have additional requirements for the properties inherited from [[Prototype/EntityWithOwner]]: | |||
* [[Prototype/EntityWithOwner#is_military_target]] must be true. | |||
* [[Prototype/EntityWithOwner#allow_run_time_change_of_is_military_target]] must be false. |
Latest revision as of 10:12, 25 February 2022
Prototype definitions » PrototypeBase » Prototype/Entity » Prototype/EntityWithHealth » Prototype/EntityWithOwner » Prototype/Unit
Entity that moves around and attacks players, for example biters and spitters.
Usage in base
Mandatory properties
This prototype inherits all the properties from Prototype/EntityWithOwner.
run_animation
Type: RotatedAnimation
attack_parameters
Type: AttackParameters
Requires animation in attack_parameters. Requires ammo_type in attack_parameters.
movement_speed
Type: float
Movement speed of the unit in the world, in tiles per tick.
Must be equal to or greater than 0.
distance_per_frame
Type: float
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
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.
Optional properties
rotation_speed
Type: float
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
ai_settings
Type: UnitAISettings
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"
light
Type: LightDefinition
walking_sound
Type: Sound
alternative_attacking_frame_sequence
Type: table
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
running_sound_animation_positions
Type: table (array) of float
Ignored if walking_sounds
is not defined.
Mandatory values
Units have additional requirements for the properties inherited from Prototype/EntityWithOwner:
- Prototype/EntityWithOwner#is_military_target must be true.
- Prototype/EntityWithOwner#allow_run_time_change_of_is_military_target must be false.