Prototype/Projectile: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
(Added prototype type to page)
mNo edit summary
 
(13 intermediate revisions by 3 users not shown)
Line 1: Line 1:
== Basics ==
{{Prototype parent|Prototype/Entity}}
Prototype type: '''projectile'''
Entity with limited lifetime that can hit other entities and has triggers when this happens.


Extends [[Prototype/Entity]].
{{Prototype TOC|projectile}}


== Mandatory properties ==
== Mandatory properties ==
This prototype inherits all the properties from [[Prototype/Entity]].
This prototype inherits all the properties from [[Prototype/Entity]].


=== animation ===
{{Prototype property|acceleration|[[Types/double|double]]}}
'''Type''': [[Types/Animation]]
Must be != 0 if turning_speed_increases_exponentially_with_projectile_speed is true.


=== acceleration ===
== Optional properties ==
'''Type''': [[Types/double]]


== Optional properties ==
{{Prototype property|animation|[[Types/Animation|Animation]]|optional=true}}
 
{{Prototype property|rotatable|[[Types/bool|bool]]|true|optional=true}}
Whether the animation of the projectile is rotated to match the direction of travel.


=== rotatable ===
{{Prototype property|enable_drawing_with_mask|[[Types/bool|bool]]|false|optional=true}}
'''Type''': [[Types/bool]]


'''Default''': true
{{Prototype property|direction_only|[[Types/bool|bool]]|false|optional=true}}
Setting this to true can be used to disable projectile homing behaviour.


=== action ===
{{Prototype property|hit_at_collision_position|[[Types/bool|bool]]|false|optional=true}}
'''Type''': [[Types/Trigger]]
When true the entity is hit at the position on its collision box the projectile first collides with. When false the entity is hit at its own position.


Executed when the projectile hits something.
{{Prototype property|force_condition|[[Types/ForceCondition|ForceCondition]]|"all"|optional=true}}


=== final_action ===
{{Prototype property|piercing_damage|[[Types/float|float]]|0|optional=true}}
'''Type''': [[Types/Trigger]]
Whenever an entity is hit by the projectile, this number gets reduced by the health of the entity. If the number is then below 0, the <code>final_action</code> is applied and the projectile destroyed. Otherwise, the projectile simply continues to its destination.


Executed when the projectile hits something, after <code>action</code> and only if the entity that was hit was destroyed. The projectile is destroyed right after the final_action.
{{Prototype property|max_speed|[[Types/double|double]]|MAX_DOUBLE|optional=true}}
Must be greater than or equal to 0.


=== light ===
{{Prototype property|turn_speed|[[Types/float|float]]|1|optional=true}}
'''Type''': [[Types/LightDefinition]]
Must be greater than or equal to 0.


=== smoke ===
{{Prototype property|speed_modifier|[[Types/vector|vector]]|<nowiki>{1, 1}</nowiki>|optional=true}}
'''Type''': Array of [[Types/SmokeSource]]


=== direction_only ===
{{Prototype property|height|[[Types/double|double]]|1|optional=true}}
'''Type''': [[Types/bool]]


'''Default''': false
{{Prototype property|action|[[Types/Trigger|Trigger]]|optional=true}}
Executed when the projectile hits something.


=== piercing_damage ===
{{Prototype property|final_action|[[Types/Trigger|Trigger]]|optional=true}}
'''Type''': [[Types/float]]
Executed when the projectile hits something, after <code>action</code> and only if the entity that was hit was destroyed. The projectile is destroyed right after the final_action.


'''Default''': 0
{{Prototype property|light|[[Types/LightDefinition|LightDefinition]]|optional=true}}


Whenever an entity is hit by the projectile, this number gets reduced by the health of the entity. If the number is then below 0, the <code>final_action</code> is applied and the projectile destroyed. Otherwise, the projectile simply continues to its destination.
{{Prototype property|smoke|Array of [[Types/SmokeSource|SmokeSource]]|optional=true}}


=== height ===
{{Prototype property|hit_collision_mask|[[Types/CollisionMask|CollisionMask]]|<nowiki>{"player-layer", "train-layer"}</nowiki>|optional=true}}
'''Type''': [[Types/double]]


'''Default''': 1
{{Prototype property|turning_speed_increases_exponentially_with_projectile_speed|[[Types/bool|bool]]|false|optional=true}}


=== shadow ===
{{Prototype property|shadow|[[Types/Animation|Animation]]|optional=true}}
'''Type''': [[Types/Animation]]

Latest revision as of 16:08, 7 April 2022

Prototype definitions » PrototypeBase » Prototype/Entity » Prototype/Projectile


Entity with limited lifetime that can hit other entities and has triggers when this happens.


Prototype/Projectile — projectile
acceleration::double
action::Trigger (optional)
animation::Animation (optional)
direction_only::bool (optional)
enable_drawing_with_mask::bool (optional)
final_action::Trigger (optional)
force_condition::ForceCondition (optional)
height::double (optional)
hit_at_collision_position::bool (optional)
hit_collision_mask::CollisionMask (optional)
light::LightDefinition (optional)
max_speed::double (optional)
piercing_damage::float (optional)
rotatable::bool (optional)
shadow::Animation (optional)
smoke::Array of SmokeSource (optional)
speed_modifier::vector (optional)
turn_speed::float (optional)
turning_speed_increases_exponentially_with_projectile_speed::bool (optional)
Inherited from Prototype/Entity
icons, icon, icon_size (IconSpecification)::IconSpecification
additional_pastable_entities::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_grid_size::uint8 (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)
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)
mining_sound::Sound (optional)
next_upgrade::string (optional)
open_sound::Sound (optional)
placeable_by::ItemToPlace or table of ItemToPlace (optional)
protected_from_tile_building::bool (optional)
radius_visualisation_specification::RadiusVisualisationSpecification (optional)
remains_when_mined::string or table of string (optional)
remove_decoratives::string (optional)
rotated_sound::Sound (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)
trigger_target_mask::TriggerTargetMask (optional)
vehicle_impact_sound::Sound (optional)
water_reflection::WaterReflectionDefinition (optional)
working_sound::WorkingSound (optional)
Inherited from PrototypeBase
name::string
type::string
localised_description::LocalisedString (optional)
localised_name::LocalisedString (optional)
order::Order (optional)

Mandatory properties

This prototype inherits all the properties from Prototype/Entity.

acceleration

Type: double
Must be != 0 if turning_speed_increases_exponentially_with_projectile_speed is true.

Optional properties

animation

Type: Animation

rotatable

Type: bool
Default: true
Whether the animation of the projectile is rotated to match the direction of travel.

enable_drawing_with_mask

Type: bool
Default: false

direction_only

Type: bool
Default: false
Setting this to true can be used to disable projectile homing behaviour.

hit_at_collision_position

Type: bool
Default: false
When true the entity is hit at the position on its collision box the projectile first collides with. When false the entity is hit at its own position.

force_condition

Type: ForceCondition
Default: "all"

piercing_damage

Type: float
Default: 0
Whenever an entity is hit by the projectile, this number gets reduced by the health of the entity. If the number is then below 0, the final_action is applied and the projectile destroyed. Otherwise, the projectile simply continues to its destination.

max_speed

Type: double
Default: MAX_DOUBLE
Must be greater than or equal to 0.

turn_speed

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

speed_modifier

Type: vector
Default: {1, 1}

height

Type: double
Default: 1

action

Type: Trigger
Executed when the projectile hits something.

final_action

Type: Trigger
Executed when the projectile hits something, after action and only if the entity that was hit was destroyed. The projectile is destroyed right after the final_action.

light

Type: LightDefinition

smoke

Type: Array of SmokeSource

hit_collision_mask

Type: CollisionMask
Default: {"player-layer", "train-layer"}

turning_speed_increases_exponentially_with_projectile_speed

Type: bool
Default: false

shadow

Type: Animation