Prototype/AmmoItem: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
(Added AmmoItem prototype based off of observed values in base ammo.lua file)
 
(Updated styling of prototype doc migration note)
 
(7 intermediate revisions by 3 users not shown)
Line 1: Line 1:
== Basics ==
<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/AmmoItemPrototype.html https://lua-api.factorio.com/latest/prototypes/AmmoItemPrototype.html]
Prototype type: '''ammo'''


</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>
{{Prototype parent|Prototype/Item}}
Ammo used for a gun.
Ammo used for a gun.
{{Prototype TOC|ammo}}


== Mandatory properties ==
== Mandatory properties ==
Inherits all properties from [[Prototype/Item]].
Inherits all properties from [[Prototype/Item]].


=== ammo_type ===
{{Prototype property|ammo_type|[[Types/table|table]] of [[Types/AmmoType|AmmoType]] or [[Types/AmmoType|AmmoType]]}}
'''Type''': [[Types/AmmoType]]
When using an array of AmmoType, the AmmoType has an extra property:
* source_type - [[Types/AmmoSourceType|AmmoSourceType]] - Mandatory. - Defines for which kind of entity this ammo type applies. Each entity kind can only be used once per array.
 
When using a plain [[Types/AmmoType|AmmoType]], the ammo type applies to everything ("default").


== Optional properties ==
== Optional properties ==
=== magazine_size ===
'''Type''': [[Types/uint32]]


'''Default''': 1
{{Prototype property|magazine_size|[[Types/float|float]]|1|optional=true}}
Number of shots before ammo item is consumed. Must be >= 1.


Number of shots before ammo item is consumed.
{{Prototype property|reload_time|[[Types/float|float]]|0|optional=true}}
Amount of extra time (in ticks) it takes to reload the weapon after depleting the magazine. Must be >= 0.

Latest revision as of 10:42, 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/AmmoItemPrototype.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.


Prototype definitions » PrototypeBase » Prototype/Item » Prototype/AmmoItem


Ammo used for a gun.


Prototype/AmmoItem — ammo
ammo_type::table of AmmoType or AmmoType
magazine_size::float (optional)
reload_time::float (optional)
Inherited from Prototype/Item
icons, icon, icon_size (IconSpecification)::IconSpecification
stack_size::ItemCountType
burnt_result::string (optional)
close_sound::Sound (optional)
dark_background_icons, dark_background_icon, icon_size (IconSpecification)::IconSpecification (optional)
default_request_amount::ItemCountType (optional)
flags::ItemPrototypeFlags (optional)
fuel_acceleration_multiplier::double (optional)
fuel_category::string (optional)
fuel_emissions_multiplier::double (optional)
fuel_glow_color::Color (optional)
fuel_top_speed_multiplier::double (optional)
fuel_value::Energy (optional)
open_sound::Sound (optional)
pictures::SpriteVariations (optional)
place_as_tile::PlaceAsTile (optional)
place_result::string (optional)
placed_as_equipment_result::string (optional)
rocket_launch_product::ItemProductPrototype (optional)
rocket_launch_products::table (array) of ItemProductPrototype (optional)
subgroup::string (optional)
wire_count::ItemCountType (optional)
Inherited from PrototypeBase
name::string
type::string
localised_description::LocalisedString (optional)
localised_name::LocalisedString (optional)
order::Order (optional)

Mandatory properties

Inherits all properties from Prototype/Item.

ammo_type

Type: table of AmmoType or AmmoType
When using an array of AmmoType, the AmmoType has an extra property:

  • source_type - AmmoSourceType - Mandatory. - Defines for which kind of entity this ammo type applies. Each entity kind can only be used once per array.

When using a plain AmmoType, the ammo type applies to everything ("default").

Optional properties

magazine_size

Type: float
Default: 1
Number of shots before ammo item is consumed. Must be >= 1.

reload_time

Type: float
Default: 0
Amount of extra time (in ticks) it takes to reload the weapon after depleting the magazine. Must be >= 0.