Prototype/Entity: Difference between revisions
(Fix of default) |
(Updated styling of prototype doc migration note) |
||
(38 intermediate revisions by 9 users not shown) | |||
Line 1: | Line 1: | ||
<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/EntityPrototype.html https://lua-api.factorio.com/latest/prototypes/EntityPrototype.html] | |||
</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|PrototypeBase}} | {{Prototype parent|PrototypeBase}} | ||
Abstract base of all entities in the game. | Abstract base of all entities in the game. | ||
Line 9: | Line 15: | ||
<div class="factorio-list"> | <div class="factorio-list"> | ||
* [[Prototype/Arrow]] '''arrow''' | * [[Prototype/Arrow]] '''arrow''' | ||
* [[Prototype/ArtilleryFlare]] '''artillery-flare''' | |||
* [[Prototype/ArtilleryProjectile]] '''artillery-projectile''' | * [[Prototype/ArtilleryProjectile]] '''artillery-projectile''' | ||
* [[Prototype/Beam]] '''beam''' | * [[Prototype/Beam]] '''beam''' | ||
Line 17: | Line 24: | ||
* [[Prototype/DeconstructibleTileProxy]] '''deconstructible-tile-proxy''' | * [[Prototype/DeconstructibleTileProxy]] '''deconstructible-tile-proxy''' | ||
* [[Prototype/EntityGhost]] '''entity-ghost''' | * [[Prototype/EntityGhost]] '''entity-ghost''' | ||
* [[Prototype/EntityParticle]] '''particle''' (for migration, cannot be used) | |||
** [[Prototype/LeafParticle]] '''leaf-particle''' (for migration, cannot be used) | |||
* [[Prototype/EntityWithHealth]] <abstract> | * [[Prototype/EntityWithHealth]] <abstract> | ||
** [[Prototype/Accumulator]] '''accumulator''' | ** [[Prototype/EntityWithOwner]] <abstract> | ||
** [[Prototype/ArtilleryTurret]] '''artillery-turret''' | *** [[Prototype/Accumulator]] '''accumulator''' | ||
** [[Prototype/Beacon]] '''beacon''' | *** [[Prototype/ArtilleryTurret]] '''artillery-turret''' | ||
** [[Prototype/Boiler]] '''boiler''' | *** [[Prototype/Beacon]] '''beacon''' | ||
** [[Prototype/Character]] '''character''' | *** [[Prototype/Boiler]] '''boiler''' | ||
** [[Prototype/Combinator]] <abstract> | *** [[Prototype/BurnerGenerator]] '''burner-generator''' | ||
*** [[Prototype/ArithmeticCombinator]] '''arithmetic-combinator''' | *** [[Prototype/Character]] '''character''' | ||
*** [[Prototype/DeciderCombinator]] '''decider-combinator''' | *** [[Prototype/Combinator]] <abstract> | ||
** [[Prototype/ConstantCombinator]] '''constant-combinator''' | **** [[Prototype/ArithmeticCombinator]] '''arithmetic-combinator''' | ||
** [[Prototype/Container]] '''container''' | **** [[Prototype/DeciderCombinator]] '''decider-combinator''' | ||
*** [[Prototype/LogisticContainer]] '''logistic-container''' | *** [[Prototype/ConstantCombinator]] '''constant-combinator''' | ||
**** [[Prototype/InfinityContainer]] '''infinity-container''' | *** [[Prototype/Container]] '''container''' | ||
** [[Prototype/CraftingMachine]] <abstract> | **** [[Prototype/LogisticContainer]] '''logistic-container''' | ||
*** [[Prototype/AssemblingMachine]] '''assembling-machine''' | ***** [[Prototype/InfinityContainer]] '''infinity-container''' | ||
**** [[Prototype/RocketSilo]] '''rocket-silo''' | *** [[Prototype/CraftingMachine]] <abstract> | ||
*** [[Prototype/Furnace]] '''furnace''' | **** [[Prototype/AssemblingMachine]] '''assembling-machine''' | ||
** [[Prototype/ElectricEnergyInterface]] '''electric-energy-interface''' | ***** [[Prototype/RocketSilo]] '''rocket-silo''' | ||
** [[Prototype/ElectricPole]] '''electric-pole''' | **** [[Prototype/Furnace]] '''furnace''' | ||
** [[Prototype/EnemySpawner]] '''unit-spawner''' | *** [[Prototype/ElectricEnergyInterface]] '''electric-energy-interface''' | ||
*** [[Prototype/ElectricPole]] '''electric-pole''' | |||
*** [[Prototype/EnemySpawner]] '''unit-spawner''' | |||
*** [[Prototype/FlyingRobot]] <abstract> | |||
**** [[Prototype/CombatRobot]] '''combat-robot''' | |||
**** [[Prototype/RobotWithLogisticInterface]] <abstract> | |||
***** [[Prototype/ConstructionRobot]] '''construction-robot''' | |||
***** [[Prototype/LogisticRobot]] '''logistic-robot''' | |||
*** [[Prototype/Gate]] '''gate''' | |||
*** [[Prototype/Generator]] '''generator''' | |||
*** [[Prototype/HeatInterface]] '''heat-interface''' | |||
*** [[Prototype/HeatPipe]] '''heat-pipe''' | |||
*** [[Prototype/Inserter]] '''inserter''' | |||
*** [[Prototype/Lab]] '''lab''' | |||
*** [[Prototype/Lamp]] '''lamp''' | |||
*** [[Prototype/LandMine]] '''land-mine''' | |||
*** [[Prototype/LinkedContainer]] '''linked-container''' | |||
*** [[Prototype/Market]] '''market''' | |||
*** [[Prototype/MiningDrill]] '''mining-drill''' | |||
*** [[Prototype/OffshorePump]] '''offshore-pump''' | |||
*** [[Prototype/Pipe]] '''pipe''' | |||
**** [[Prototype/InfinityPipe]] '''infinity-pipe''' | |||
*** [[Prototype/PipeToGround]] '''pipe-to-ground''' | |||
*** [[Prototype/PlayerPort]] '''player-port''' | |||
*** [[Prototype/PowerSwitch]] '''power-switch''' | |||
*** [[Prototype/ProgrammableSpeaker]] '''programmable-speaker''' | |||
*** [[Prototype/Pump]] '''pump''' | |||
*** [[Prototype/Radar]] '''radar''' | |||
*** [[Prototype/Rail]] <abstract> | |||
**** [[Prototype/CurvedRail]] '''curved-rail''' | |||
**** [[Prototype/StraightRail]] '''straight-rail''' | |||
*** [[Prototype/RailSignalBase]] <abstract> | |||
**** [[Prototype/RailChainSignal]] '''rail-chain-signal''' | |||
**** [[Prototype/RailSignal]] '''rail-signal''' | |||
*** [[Prototype/Reactor]] '''reactor''' | |||
*** [[Prototype/Roboport]] '''roboport''' | |||
*** [[Prototype/SimpleEntityWithOwner]] '''simple-entity-with-owner''' | |||
**** [[Prototype/SimpleEntityWithForce]] '''simple-entity-with-force''' | |||
*** [[Prototype/SolarPanel]] '''solar-panel''' | |||
*** [[Prototype/StorageTank]] '''storage-tank''' | |||
*** [[Prototype/TrainStop]] '''train-stop''' | |||
*** [[Prototype/TransportBeltConnectable]] <abstract> | |||
**** [[Prototype/LinkedBelt]] '''linked-belt''' | |||
**** [[Prototype/Loader1x1]] '''loader-1x1''' | |||
**** [[Prototype/Loader1x2]] '''loader''' | |||
**** [[Prototype/Splitter]] '''splitter''' | |||
**** [[Prototype/TransportBelt]] '''transport-belt''' | |||
**** [[Prototype/UndergroundBelt]] '''underground-belt''' | |||
*** [[Prototype/Turret]] '''turret''' | |||
**** [[Prototype/AmmoTurret]] '''ammo-turret''' | |||
**** [[Prototype/ElectricTurret]] '''electric-turret''' | |||
**** [[Prototype/FluidTurret]] '''fluid-turret''' | |||
*** [[Prototype/Unit]] '''unit''' | |||
*** [[Prototype/Vehicle]] <abstract> | |||
**** [[Prototype/Car]] '''car''' | |||
**** [[Prototype/RollingStock]] <abstract> | |||
***** [[Prototype/ArtilleryWagon]] '''artillery-wagon''' | |||
***** [[Prototype/CargoWagon]] '''cargo-wagon''' | |||
***** [[Prototype/FluidWagon]] '''fluid-wagon''' | |||
***** [[Prototype/Locomotive]] '''locomotive''' | |||
**** [[Prototype/SpiderVehicle]] '''spider-vehicle''' | |||
*** [[Prototype/Wall]] '''wall''' | |||
** [[Prototype/Fish]] '''fish''' | ** [[Prototype/Fish]] '''fish''' | ||
** [[Prototype/SimpleEntity]] '''simple-entity''' | ** [[Prototype/SimpleEntity]] '''simple-entity''' | ||
** [[Prototype/ | ** [[Prototype/SpiderLeg]] '''spider-leg''' | ||
** [[Prototype/Tree]] '''tree''' | ** [[Prototype/Tree]] '''tree''' | ||
* [[Prototype/Explosion]] '''explosion''' | * [[Prototype/Explosion]] '''explosion''' | ||
** [[Prototype/FlameThrowerExplosion]] '''flame-thrower-explosion''' | ** [[Prototype/FlameThrowerExplosion]] '''flame-thrower-explosion''' | ||
Line 103: | Line 119: | ||
* [[Prototype/ItemEntity]] '''item-entity''' | * [[Prototype/ItemEntity]] '''item-entity''' | ||
* [[Prototype/ItemRequestProxy]] '''item-request-proxy''' | * [[Prototype/ItemRequestProxy]] '''item-request-proxy''' | ||
* [[Prototype/ParticleSource]] '''particle-source''' | * [[Prototype/ParticleSource]] '''particle-source''' | ||
* [[Prototype/Projectile]] '''projectile''' | * [[Prototype/Projectile]] '''projectile''' | ||
Line 113: | Line 125: | ||
* [[Prototype/RocketSiloRocketShadow]] '''rocket-silo-rocket-shadow''' | * [[Prototype/RocketSiloRocketShadow]] '''rocket-silo-rocket-shadow''' | ||
* [[Prototype/Smoke]] <abstract> | * [[Prototype/Smoke]] <abstract> | ||
** [[Prototype/SimpleSmoke]] '''smoke''' | ** [[Prototype/SimpleSmoke]] '''smoke''' (for migration, cannot be used) | ||
** [[Prototype/SmokeWithTrigger]] '''smoke-with-trigger''' | ** [[Prototype/SmokeWithTrigger]] '''smoke-with-trigger''' | ||
* [[Prototype/SpeechBubble]] '''speech-bubble''' | * [[Prototype/SpeechBubble]] '''speech-bubble''' | ||
Line 122: | Line 134: | ||
== Mandatory properties == | == Mandatory properties == | ||
Inherits all properties from [[PrototypeBase]]. | Inherits all properties from [[PrototypeBase]]. | ||
{{Prototype property|icons, icon, icon_size (IconSpecification)|[[Types/IconSpecification|IconSpecification]]}} | {{Prototype property|icons, icon, icon_size (IconSpecification)|[[Types/IconSpecification|IconSpecification]]}} | ||
An icon is mandatory for entities that have at least one of these flags active: placeable-neutral, placeable-player, placeable-enemy. | An icon is mandatory for entities that have at least one of these flags active: placeable-neutral, placeable-player, placeable-enemy. | ||
The icon will be used in the editor building selection and the bonus gui. | The icon will be used in the electric network statistics, editor building selection, and the bonus gui. | ||
<syntaxhighlight lang="lua">icon = "__base__/graphics/icons/wooden-chest.png"</syntaxhighlight> | <syntaxhighlight lang="lua">icon = "__base__/graphics/icons/wooden-chest.png"</syntaxhighlight> | ||
== Optional properties == | == Optional properties == | ||
=== order === | |||
:''See [[PrototypeBase#order]]'' | |||
Inherited from [[PrototypeBase]]. | |||
The order string is taken from the items in <code>placeable_by</code> if they exist, or from an item that has its [[Prototype/Item#place_result|place_result]] set to this entity if it exists. | |||
{{Prototype property|collision_box|[[Types/BoundingBox|BoundingBox]]|Empty=<nowiki>{{0, 0}, {0, 0}} means no collisions.</nowiki>|optional=true}} | {{Prototype property|collision_box|[[Types/BoundingBox|BoundingBox]]|Empty=<nowiki>{{0, 0}, {0, 0}} means no collisions.</nowiki>|optional=true}} | ||
Line 154: | Line 168: | ||
<div class="mw-collapsible-content"> | <div class="mw-collapsible-content"> | ||
* [[Prototype/Arrow]] - no masks | * [[Prototype/Arrow]] - no masks | ||
* [[Prototype/ArtilleryFlare]] - no masks | |||
* [[Prototype/ArtilleryProjectile]] - no masks | * [[Prototype/ArtilleryProjectile]] - no masks | ||
* [[Prototype/Beam]] - no masks | * [[Prototype/Beam]] - no masks | ||
Line 163: | Line 178: | ||
* [[Prototype/DeconstructibleTileProxy]] - <code>{"ground-tile"}</code> | * [[Prototype/DeconstructibleTileProxy]] - <code>{"ground-tile"}</code> | ||
* [[Prototype/EntityGhost]] - <code>{"ghost-layer"}</code> | * [[Prototype/EntityGhost]] - <code>{"ghost-layer"}</code> | ||
* [[Prototype/EntityParticle]] - no masks | |||
* [[Prototype/Explosion]] - no masks | * [[Prototype/Explosion]] - no masks | ||
* [[Prototype/FireFlame]] - no masks | * [[Prototype/FireFlame]] - no masks | ||
Line 174: | Line 190: | ||
* [[Prototype/ItemEntity]] - <code>{"item-layer"}</code> | * [[Prototype/ItemEntity]] - <code>{"item-layer"}</code> | ||
* [[Prototype/ItemRequestProxy]] - no masks | * [[Prototype/ItemRequestProxy]] - no masks | ||
* [[Prototype/LandMine]] - <code>{"object-layer", "water-tile"}</code> | * [[Prototype/LandMine]] - <code>{"object-layer", "water-tile", "rail-layer"}</code> | ||
* [[Prototype/ | * [[Prototype/LinkedBelt]] - <code>{"object-layer", "item-layer", "transport-belt-layer", "water-tile"}</code> | ||
* [[Prototype/ | * [[Prototype/Loader1x1]] - <code>{"object-layer", "item-layer", "transport-belt-layer", "water-tile"}</code> | ||
* [[Prototype/ | * [[Prototype/Loader1x2]] - <code>{"object-layer", "item-layer", "transport-belt-layer", "water-tile"}</code> | ||
* [[Prototype/ParticleSource]] - no masks | * [[Prototype/ParticleSource]] - no masks | ||
* [[Prototype/PlayerPort]] - <code>{"object-layer", "floor-layer", "water-tile"}</code> | * [[Prototype/PlayerPort]] - <code>{"object-layer", "floor-layer", "water-tile"}</code> | ||
* [[Prototype/Projectile]] - no masks | * [[Prototype/Projectile]] - no masks | ||
* [[Prototype/Rail]] - <code>{"item-layer", "object-layer", "floor-layer", "water-tile"}</code> | * [[Prototype/Rail]] - <code>{"item-layer", "object-layer", "rail-layer", "floor-layer", "water-tile"}</code> | ||
* [[Prototype/RailSignalBase]] - <code>{" | * [[Prototype/RailSignalBase]] - <code>{"floor-layer", "rail-layer", "item-layer"}</code> | ||
* [[Prototype/ResourceEntity]] - <code>{"resource-layer"}</code> | * [[Prototype/ResourceEntity]] - <code>{"resource-layer"}</code> | ||
* [[Prototype/RollingStock]] - <code>{"train-layer"}</code> | * [[Prototype/RollingStock]] - <code>{"train-layer"}</code> | ||
* [[Prototype/Smoke]] - no masks | * [[Prototype/Smoke]] - no masks | ||
* [[Prototype/SpeechBubble]] - no masks | * [[Prototype/SpeechBubble]] - no masks | ||
* [[Prototype/Splitter]] - <code>{"object-layer", "item-layer", "water-tile"}</code> | * [[Prototype/SpiderLeg]] - <code>{"player-layer", "rail-layer"}</code> | ||
* [[Prototype/Splitter]] - <code>{"object-layer", "item-layer", "transport-belt-layer", "water-tile"}</code> | |||
* [[Prototype/Sticker]] - no masks | * [[Prototype/Sticker]] - no masks | ||
* [[Prototype/TileGhost]] - <code>{"ghost-layer"}</code> | * [[Prototype/TileGhost]] - <code>{"ghost-layer"}</code> | ||
* [[Prototype/TransportBelt]] - <code>{"object-layer", "floor-layer", "water-tile"}</code> | * [[Prototype/TransportBelt]] - <code>{"object-layer", "floor-layer", "transport-belt-layer", "water-tile"}</code> | ||
* [[Prototype/UndergroundBelt]] - <code>{"object-layer", "item-layer", "water-tile"}</code> | * [[Prototype/UndergroundBelt]] - <code>{"object-layer", "item-layer", "transport-belt-layer", "water-tile"}</code> | ||
* [[Prototype/Unit]] - <code>{"player-layer", "train-layer", "not-colliding-with-itself"}</code> | * [[Prototype/Unit]] - <code>{"player-layer", "train-layer", "not-colliding-with-itself"}</code> | ||
* [[Prototype/Vehicle]] - <code>{"player-layer", "train-layer"}</code> | * [[Prototype/Vehicle]] - <code>{"player-layer", "train-layer"}</code> | ||
Line 218: | Line 235: | ||
{{Prototype property|hit_visualization_box|[[Types/BoundingBox|BoundingBox]]|<nowiki>Empty = {{0, 0}, {0, 0}}</nowiki>|optional=true}} | {{Prototype property|hit_visualization_box|[[Types/BoundingBox|BoundingBox]]|<nowiki>Empty = {{0, 0}, {0, 0}}</nowiki>|optional=true}} | ||
Where beams should hit the entity. Useful if the bounding box only covers part of the entity (e.g. feet of the character) and beams only hitting there would look weird. | Where beams should hit the entity. Useful if the bounding box only covers part of the entity (e.g. feet of the character) and beams only hitting there would look weird. | ||
{{Prototype property|trigger_target_mask|[[Types/TriggerTargetMask|TriggerTargetMask]]|optional=true}} | |||
{{Prototype property|flags|[[Types/EntityPrototypeFlags|EntityPrototypeFlags]]|optional=true}} | {{Prototype property|flags|[[Types/EntityPrototypeFlags|EntityPrototypeFlags]]|optional=true}} | ||
Line 231: | Line 250: | ||
{{Prototype property|selection_priority|[[Types/uint8|uint8]]|50|optional=true}} | {{Prototype property|selection_priority|[[Types/uint8|uint8]]|50|optional=true}} | ||
The entity with the higher number is selectable before the entity with the lower number. | The entity with the higher number is selectable before the entity with the lower number. When two entities have the same selection priority, the one with the highest [[Types/CollisionMask|collision mask]] (as determined by the order on that page) is selected. | ||
{{Prototype property|build_grid_size|[[Types/uint8|uint8]]|1|optional=true}} | |||
Supported values are 1 (for 1x1 grid) and 2 (for 2x2 grid, like rails). | |||
Internally forced to be <code>2</code> for [[Prototype/Rail]], [[Prototype/RailRemnants]] and [[Prototype/TrainStop]]. | |||
{{Prototype property|remove_decoratives|[[Types/string|string]]|"automatic"|optional=true}} | |||
Either "automatic", "true" or "false". Whether this entity should remove decoratives that collide with it when this entity is built. When set to "automatic", if the entity type is considered [https://lua-api.factorio.com/latest/LuaEntityPrototype.html#LuaEntityPrototype.is_building a building] (e.g. an assembling machine or a wall) it will remove decoratives. | |||
{{Prototype property|emissions_per_second|[[Types/double|double]]|0|optional=true}} | {{Prototype property|emissions_per_second|[[Types/double|double]]|0|optional=true}} | ||
Line 238: | Line 265: | ||
Currently used just for trees. | Currently used just for trees. | ||
<syntaxhighlight lang="lua">emissions_per_second = -0. | <syntaxhighlight lang="lua">emissions_per_second = -0.001 -- cleaning effect of big tree</syntaxhighlight> | ||
{{Prototype property|shooting_cursor_size|[[Types/double|double]]|optional=true}} | {{Prototype property|shooting_cursor_size|[[Types/double|double]]|optional=true}} | ||
The cursor size used when shooting at this entity. | The cursor size used when shooting at this entity. | ||
{{Prototype property|created_smoke|[[Types/CreateTrivialSmokeEffectItem|CreateTrivialSmokeEffectItem]]|optional=true}} | {{Prototype property|created_smoke|[[Types/CreateTrivialSmokeEffectItem|CreateTrivialSmokeEffectItem]]|The "smoke-building"-smoke|optional=true}} | ||
The smoke that is shown when the entity is placed | The smoke that is shown when the entity is placed. | ||
{{Prototype property|working_sound|[[Types/WorkingSound|WorkingSound]]|optional=true}} | {{Prototype property|working_sound|[[Types/WorkingSound|WorkingSound]]|optional=true}} | ||
Line 261: | Line 282: | ||
{{Prototype property|mined_sound|[[Types/Sound|Sound]]|optional=true}} | {{Prototype property|mined_sound|[[Types/Sound|Sound]]|optional=true}} | ||
{{Prototype property|mining_sound|[[Types/Sound|Sound]]|optional=true}} | |||
{{Prototype property|rotated_sound|[[Types/Sound|Sound]]|optional=true}} | |||
{{Prototype property|vehicle_impact_sound|[[Types/Sound|Sound]]|optional=true}} | {{Prototype property|vehicle_impact_sound|[[Types/Sound|Sound]]|optional=true}} | ||
When playing this sound, the volume is scaled by the speed of the vehicle when colliding with this entity. | |||
{{Prototype property|open_sound|[[Types/Sound|Sound]]|optional=true}} | {{Prototype property|open_sound|[[Types/Sound|Sound]]|optional=true}} | ||
{{Prototype property|close_sound|[[Types/Sound|Sound]]|optional=true}} | {{Prototype property|close_sound|[[Types/Sound|Sound]]|optional=true}} | ||
{{Prototype property|radius_visualisation_specification|[[Types/RadiusVisualisationSpecification|RadiusVisualisationSpecification]]|optional=true}} | |||
{{Prototype property|build_base_evolution_requirement|[[Types/double|double]]|0|optional=true}} | {{Prototype property|build_base_evolution_requirement|[[Types/double|double]]|0|optional=true}} | ||
Line 274: | Line 302: | ||
{{Prototype property|alert_icon_scale|[[Types/float|float]]|optional=true}} | {{Prototype property|alert_icon_scale|[[Types/float|float]]|optional=true}} | ||
{{Prototype property|fast_replaceable_group|[[Types/string|string]]|optional=true}} | {{Prototype property|fast_replaceable_group|[[Types/string|string]]|""|optional=true}} | ||
This allows you to replace an entity that's already placed, with a different one in your inventory. For example, replacing a burner inserter with a fast inserter. | This allows you to replace an entity that's already placed, with a different one in your inventory. For example, replacing a burner inserter with a fast inserter. The replacement entity can be a different rotation to the replaced entity and you can replace an entity with the same type. | ||
This is simply a string, so any string can be used here. The entity that should be replaced simply has to use the same string here. | This is simply a string, so any string can be used here. The entity that should be replaced simply has to use the same string here. | ||
Line 281: | Line 309: | ||
The ones the game uses are: | The ones the game uses are: | ||
"constant-combinator" | |||
"container" | |||
"furnace" | |||
"transport-belt" | |||
"electric-pole" | |||
"steam-engine" | |||
"inserter" | |||
"long-handed-inserter" | |||
"pipe" | |||
"assembling-machine" | |||
"wall" | |||
"loader" | |||
"rail-signal" | |||
"linked-belts" | |||
"mining-drill" | |||
"pumpjack" | |||
{{Prototype property|next_upgrade|[[Types/string|string]]|optional=true}} | {{Prototype property|next_upgrade|[[Types/string|string]]|optional=true}} | ||
Name of the entity that will be automatically selected as the upgrade of this entity when using the [[upgrade planner]] without configuration. | Name of the entity that will be automatically selected as the upgrade of this entity when using the [[upgrade planner]] without configuration. | ||
This entity may not have 'not-upgradable' flag set and must be minable. This entity must | This entity may not have 'not-upgradable' flag set and must be minable. This entity mining result must not contain item product with "hidden" flag set. Mining results with no item products are allowed. The entity may not be a [[Prototype/RollingStock]].<br> | ||
The upgrade target entity needs to have the same bounding box, collision mask, and fast replaceable group as this entity. The upgrade target entity must have least 1 item that builds it that isn't hidden. | The upgrade target entity needs to have the same bounding box, collision mask, and fast replaceable group as this entity. The upgrade target entity must have least 1 item that builds it that isn't hidden. | ||
{{Prototype property|protected_from_tile_building|[[Types/bool|bool]]|true|optional=true}} | |||
When this is true, this entity prototype should be included during tile collision checks with tiles that have [[Prototype/Tile#check_collision_with_entities]] set to true. | |||
{{Prototype property|placeable_by|[[Types/ItemToPlace|ItemToPlace]] or [[Types/table|table]] of [[Types/ItemToPlace|ItemToPlace]]|optional=true}} | {{Prototype property|placeable_by|[[Types/ItemToPlace|ItemToPlace]] or [[Types/table|table]] of [[Types/ItemToPlace|ItemToPlace]]|optional=true}} | ||
Item that when placed creates this entity. | Item that when placed creates this entity. Determines which item is picked when "Q" (smart pipette) is used on the entity, determines which item is needed in a blueprint of this entity. | ||
The item count specified here can't be larger than the stack size of that item. | |||
{{Prototype property|remains_when_mined|[[Types/string|string]] or [[Types/table|table]] of [[Types/string|string]]|optional=true}} | {{Prototype property|remains_when_mined|[[Types/string|string]] or [[Types/table|table]] of [[Types/string|string]]|optional=true}} | ||
The entity that remains when this one is mined, deconstructed or fast-replaced. The entity wont actually be spawned if it would collide with the entity that is in the process of being mined. | The entity that remains when this one is mined, deconstructed or fast-replaced. The entity wont actually be spawned if it would collide with the entity that is in the process of being mined. | ||
{{Prototype property|additional_pastable_entities| | {{Prototype property|additional_pastable_entities|[[Types/table|table]] of [[Types/string|string]]|optional=true}} | ||
Names of the entity prototypes this entity prototype can be pasted on to in addition to the standard supported types. | |||
This is used to allow copying between types that aren't compatible on the C++ code side. | This is used to allow copying between types that aren't compatible on the C++ code side, by allowing mods to receive the [https://lua-api.factorio.com/latest/events.html#on_entity_settings_pasted on_entity_settings_pasted] event for the given entity and do the setting pasting via script.<br> | ||
additional_pastable_entities = {"steel-chest", "iron-chest"} | |||
{{Prototype property|tile_width|[[Types/uint32|uint32]]|calculated by the collision box width rounded up.|optional=true}} | {{Prototype property|tile_width|[[Types/uint32|uint32]]|calculated by the collision box width rounded up.|optional=true}} | ||
Line 317: | Line 353: | ||
{{Prototype property|tile_height|[[Types/uint32|uint32]]|calculated by the collision box height rounded up.|optional=true}} | {{Prototype property|tile_height|[[Types/uint32|uint32]]|calculated by the collision box height rounded up.|optional=true}} | ||
{{Prototype property|autoplace|[[Types/AutoplaceSpecification|AutoplaceSpecification]]|nil (entity is not autoplacable)|optional=true}} | |||
Used to specify the rules for placing this entity during map generation. | |||
{{Prototype property|map_color|[[Types/Color|Color]]|optional=true}} | {{Prototype property|map_color|[[Types/Color|Color]]|optional=true}} | ||
Line 323: | Line 362: | ||
{{Prototype property|enemy_map_color|[[Types/Color|Color]]|optional=true}} | {{Prototype property|enemy_map_color|[[Types/Color|Color]]|optional=true}} | ||
{{Prototype property|water_reflection|[[Types/WaterReflectionDefinition|WaterReflectionDefinition]]|optional=true}} | |||
May also be defined inside <code>graphics_set</code> instead of directly in the entity prototype. This is useful for entities that use the a <code>graphics_set</code> property to define their graphics, because then all graphics can be defined in one place.<br> | |||
Currently only renders for [[Prototype/EntityWithHealth]].[https://forums.factorio.com/100703] | |||
== Example == | == Example == |
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/EntityPrototype.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 Abstract base of all entities in the game. Entity is basically everything that can be on the map (except tiles). For in game script access to entity, take a look at LuaEntity
Extensions
- Prototype/Arrow arrow
- Prototype/ArtilleryFlare artillery-flare
- Prototype/ArtilleryProjectile artillery-projectile
- Prototype/Beam beam
- Prototype/CharacterCorpse character-corpse
- Prototype/Cliff cliff
- Prototype/Corpse corpse
- Prototype/RailRemnants rail-remnants
- Prototype/DeconstructibleTileProxy deconstructible-tile-proxy
- Prototype/EntityGhost entity-ghost
- Prototype/EntityParticle particle (for migration, cannot be used)
- Prototype/LeafParticle leaf-particle (for migration, cannot be used)
- Prototype/EntityWithHealth <abstract>
- Prototype/EntityWithOwner <abstract>
- Prototype/Accumulator accumulator
- Prototype/ArtilleryTurret artillery-turret
- Prototype/Beacon beacon
- Prototype/Boiler boiler
- Prototype/BurnerGenerator burner-generator
- Prototype/Character character
- Prototype/Combinator <abstract>
- Prototype/ArithmeticCombinator arithmetic-combinator
- Prototype/DeciderCombinator decider-combinator
- Prototype/ConstantCombinator constant-combinator
- Prototype/Container container
- Prototype/LogisticContainer logistic-container
- Prototype/InfinityContainer infinity-container
- Prototype/LogisticContainer logistic-container
- Prototype/CraftingMachine <abstract>
- Prototype/AssemblingMachine assembling-machine
- Prototype/RocketSilo rocket-silo
- Prototype/Furnace furnace
- Prototype/AssemblingMachine assembling-machine
- Prototype/ElectricEnergyInterface electric-energy-interface
- Prototype/ElectricPole electric-pole
- Prototype/EnemySpawner unit-spawner
- Prototype/FlyingRobot <abstract>
- Prototype/CombatRobot combat-robot
- Prototype/RobotWithLogisticInterface <abstract>
- Prototype/ConstructionRobot construction-robot
- Prototype/LogisticRobot logistic-robot
- Prototype/Gate gate
- Prototype/Generator generator
- Prototype/HeatInterface heat-interface
- Prototype/HeatPipe heat-pipe
- Prototype/Inserter inserter
- Prototype/Lab lab
- Prototype/Lamp lamp
- Prototype/LandMine land-mine
- Prototype/LinkedContainer linked-container
- Prototype/Market market
- Prototype/MiningDrill mining-drill
- Prototype/OffshorePump offshore-pump
- Prototype/Pipe pipe
- Prototype/InfinityPipe infinity-pipe
- Prototype/PipeToGround pipe-to-ground
- Prototype/PlayerPort player-port
- Prototype/PowerSwitch power-switch
- Prototype/ProgrammableSpeaker programmable-speaker
- Prototype/Pump pump
- Prototype/Radar radar
- Prototype/Rail <abstract>
- Prototype/CurvedRail curved-rail
- Prototype/StraightRail straight-rail
- Prototype/RailSignalBase <abstract>
- Prototype/RailChainSignal rail-chain-signal
- Prototype/RailSignal rail-signal
- Prototype/Reactor reactor
- Prototype/Roboport roboport
- Prototype/SimpleEntityWithOwner simple-entity-with-owner
- Prototype/SimpleEntityWithForce simple-entity-with-force
- Prototype/SolarPanel solar-panel
- Prototype/StorageTank storage-tank
- Prototype/TrainStop train-stop
- Prototype/TransportBeltConnectable <abstract>
- Prototype/LinkedBelt linked-belt
- Prototype/Loader1x1 loader-1x1
- Prototype/Loader1x2 loader
- Prototype/Splitter splitter
- Prototype/TransportBelt transport-belt
- Prototype/UndergroundBelt underground-belt
- Prototype/Turret turret
- Prototype/AmmoTurret ammo-turret
- Prototype/ElectricTurret electric-turret
- Prototype/FluidTurret fluid-turret
- Prototype/Unit unit
- Prototype/Vehicle <abstract>
- Prototype/Car car
- Prototype/RollingStock <abstract>
- Prototype/ArtilleryWagon artillery-wagon
- Prototype/CargoWagon cargo-wagon
- Prototype/FluidWagon fluid-wagon
- Prototype/Locomotive locomotive
- Prototype/SpiderVehicle spider-vehicle
- Prototype/Wall wall
- Prototype/Fish fish
- Prototype/SimpleEntity simple-entity
- Prototype/SpiderLeg spider-leg
- Prototype/Tree tree
- Prototype/EntityWithOwner <abstract>
- Prototype/Explosion explosion
- Prototype/FlameThrowerExplosion flame-thrower-explosion
- Prototype/FireFlame fire
- Prototype/FluidStream stream
- Prototype/FlyingText flying-text
- Prototype/HighlightBoxEntity highlight-box
- Prototype/ItemEntity item-entity
- Prototype/ItemRequestProxy item-request-proxy
- Prototype/ParticleSource particle-source
- Prototype/Projectile projectile
- Prototype/ResourceEntity resource
- Prototype/RocketSiloRocket rocket-silo-rocket
- Prototype/RocketSiloRocketShadow rocket-silo-rocket-shadow
- Prototype/Smoke <abstract>
- Prototype/SimpleSmoke smoke (for migration, cannot be used)
- Prototype/SmokeWithTrigger smoke-with-trigger
- Prototype/SpeechBubble speech-bubble
- Prototype/Sticker sticker
- Prototype/TileGhost tile-ghost
Mandatory properties
Inherits all properties from PrototypeBase.
Template:Prototype property An icon is mandatory for entities that have at least one of these flags active: placeable-neutral, placeable-player, placeable-enemy.
The icon will be used in the electric network statistics, editor building selection, and the bonus gui.
icon = "__base__/graphics/icons/wooden-chest.png"
Optional properties
order
Inherited from PrototypeBase.
The order string is taken from the items in placeable_by
if they exist, or from an item that has its place_result set to this entity if it exists.
Template:Prototype property Specification of the entity collision boundaries.
Empty collision box is used for smoke, projectiles, particles, explosions etc.
collision_box = {{-0.4, -0.4}, {0.4, 0.4}}
The {0,0} coordinate in the collision box will match the entity position.
It should be near the center of the collision box, to keep correct entity drawing order. It must include the {0,0} coordinate.
Note, that for buildings, it is customary to leave 0.1 wide border between the edge of the tile and the edge of the building, this lets the player move between the building and electric poles/inserters etc.
Two entities can collide only if they share a layer from the collision mask.
NOTE: Some entity types have their own default that differs from the above default. They are listed here:
- Prototype/Arrow - no masks
- Prototype/ArtilleryFlare - no masks
- Prototype/ArtilleryProjectile - no masks
- Prototype/Beam - no masks
- Prototype/Car -
{"player-layer", "train-layer", "consider-tile-transitions"}
- Prototype/Character -
{"player-layer", "train-layer", "consider-tile-transitions"}
- Prototype/CharacterCorpse - no masks
- Prototype/Cliff -
{ "item-layer", "object-layer", "player-layer", "water-tile", "not-colliding-with-itself"}
- Prototype/Corpse - no masks
- Prototype/DeconstructibleTileProxy -
{"ground-tile"}
- Prototype/EntityGhost -
{"ghost-layer"}
- Prototype/EntityParticle - no masks
- Prototype/Explosion - no masks
- Prototype/FireFlame - no masks
- Prototype/Fish -
{"ground-tile", "colliding-with-tiles-only"}
- Prototype/FluidStream - no masks
- Prototype/FlyingRobot - no masks
- Prototype/FlyingText - no masks
- Prototype/Gate -
{"item-layer", "object-layer", "player-layer", "water-tile", "train-layer"}
- Prototype/HeatPipe -
{"object-layer", "floor-layer", "water-tile"}
- Prototype/HighlightBoxEntity - no masks
- Prototype/ItemEntity -
{"item-layer"}
- Prototype/ItemRequestProxy - no masks
- Prototype/LandMine -
{"object-layer", "water-tile", "rail-layer"}
- Prototype/LinkedBelt -
{"object-layer", "item-layer", "transport-belt-layer", "water-tile"}
- Prototype/Loader1x1 -
{"object-layer", "item-layer", "transport-belt-layer", "water-tile"}
- Prototype/Loader1x2 -
{"object-layer", "item-layer", "transport-belt-layer", "water-tile"}
- Prototype/ParticleSource - no masks
- Prototype/PlayerPort -
{"object-layer", "floor-layer", "water-tile"}
- Prototype/Projectile - no masks
- Prototype/Rail -
{"item-layer", "object-layer", "rail-layer", "floor-layer", "water-tile"}
- Prototype/RailSignalBase -
{"floor-layer", "rail-layer", "item-layer"}
- Prototype/ResourceEntity -
{"resource-layer"}
- Prototype/RollingStock -
{"train-layer"}
- Prototype/Smoke - no masks
- Prototype/SpeechBubble - no masks
- Prototype/SpiderLeg -
{"player-layer", "rail-layer"}
- Prototype/Splitter -
{"object-layer", "item-layer", "transport-belt-layer", "water-tile"}
- Prototype/Sticker - no masks
- Prototype/TileGhost -
{"ghost-layer"}
- Prototype/TransportBelt -
{"object-layer", "floor-layer", "transport-belt-layer", "water-tile"}
- Prototype/UndergroundBelt -
{"object-layer", "item-layer", "transport-belt-layer", "water-tile"}
- Prototype/Unit -
{"player-layer", "train-layer", "not-colliding-with-itself"}
- Prototype/Vehicle -
{"player-layer", "train-layer"}
Template:Prototype property Used instead of the collision box during map generation. Allows space entities differently during map generation, for example if the box is bigger, the entities will be placed farther apart.
Template:Prototype property Specification of the entity selection area. When empty the entity will have no selection area (and thus is not selectable).
selection_box = {{-0.5, -0.5}, {0.5, 0.5}}
The selection box is usually a little bit bigger than the collision box, for tilable entities (like buildings) it should match the tile size of the building.
Template:Prototype property Specification of space needed to see the whole entity.
This is used to calculate the correct zoom and positioning in the entity info gui.
drawing_box = {{-0.5, -0.5}, {0.5, 0.5}}
Template:Prototype property Used to set the area of the entity that can have stickers on it, currently only used for units to specify the area where the green slow down stickers can appear. It is optional and the collision box is used when not specified.
sticker_box = {{-0.5, -0.5}, {0.5, 0.5}}
Template:Prototype property Where beams should hit the entity. Useful if the bounding box only covers part of the entity (e.g. feet of the character) and beams only hitting there would look weird.
Template:Prototype property The name of the subgroup this entity should be sorted into in the map editor building selection.
Template:Prototype property The entity with the higher number is selectable before the entity with the lower number. When two entities have the same selection priority, the one with the highest collision mask (as determined by the order on that page) is selected.
Template:Prototype property Supported values are 1 (for 1x1 grid) and 2 (for 2x2 grid, like rails).
Internally forced to be 2
for Prototype/Rail, Prototype/RailRemnants and Prototype/TrainStop.
Template:Prototype property Either "automatic", "true" or "false". Whether this entity should remove decoratives that collide with it when this entity is built. When set to "automatic", if the entity type is considered a building (e.g. an assembling machine or a wall) it will remove decoratives.
Template:Prototype property Amount of emissions created (positive number) or cleaned (negative number) every second by the entity. This is passive, and it is independent concept of the emissions of machines, these are created actively depending on the power consumption. Currently used just for trees.
emissions_per_second = -0.001 -- cleaning effect of big tree
Template:Prototype property The cursor size used when shooting at this entity.
Template:Prototype property The smoke that is shown when the entity is placed.
Template:Prototype property Will also work on entities that don't actually do work.
Template:Prototype property The effect/trigger that happens when the entity is placed.
Template:Prototype property When playing this sound, the volume is scaled by the speed of the vehicle when colliding with this entity.
Template:Prototype property This allows you to replace an entity that's already placed, with a different one in your inventory. For example, replacing a burner inserter with a fast inserter. The replacement entity can be a different rotation to the replaced entity and you can replace an entity with the same type.
This is simply a string, so any string can be used here. The entity that should be replaced simply has to use the same string here.
The ones the game uses are:
"constant-combinator" "container" "furnace" "transport-belt" "electric-pole" "steam-engine" "inserter" "long-handed-inserter" "pipe" "assembling-machine" "wall" "loader" "rail-signal" "linked-belts" "mining-drill" "pumpjack"
Template:Prototype property Name of the entity that will be automatically selected as the upgrade of this entity when using the upgrade planner without configuration.
This entity may not have 'not-upgradable' flag set and must be minable. This entity mining result must not contain item product with "hidden" flag set. Mining results with no item products are allowed. The entity may not be a Prototype/RollingStock.
The upgrade target entity needs to have the same bounding box, collision mask, and fast replaceable group as this entity. The upgrade target entity must have least 1 item that builds it that isn't hidden.
Template:Prototype property When this is true, this entity prototype should be included during tile collision checks with tiles that have Prototype/Tile#check_collision_with_entities set to true.
Template:Prototype property Item that when placed creates this entity. Determines which item is picked when "Q" (smart pipette) is used on the entity, determines which item is needed in a blueprint of this entity.
The item count specified here can't be larger than the stack size of that item.
Template:Prototype property The entity that remains when this one is mined, deconstructed or fast-replaced. The entity wont actually be spawned if it would collide with the entity that is in the process of being mined.
Template:Prototype property
Names of the entity prototypes this entity prototype can be pasted on to in addition to the standard supported types.
This is used to allow copying between types that aren't compatible on the C++ code side, by allowing mods to receive the on_entity_settings_pasted event for the given entity and do the setting pasting via script.
additional_pastable_entities = {"steel-chest", "iron-chest"}
Template:Prototype property Used to determine how the center of the entity should be positioned when building (unless the offgrid flag is specified). When the tile width is odd, the center will be in the center of the tile, when it is even, the center is on the tile transition.
Template:Prototype property Used to specify the rules for placing this entity during map generation.
Template:Prototype property
May also be defined inside graphics_set
instead of directly in the entity prototype. This is useful for entities that use the a graphics_set
property to define their graphics, because then all graphics can be defined in one place.
Currently only renders for Prototype/EntityWithHealth.[1]
Example
{
type = "container",
name = "wooden-chest",
icon = "__base__/graphics/icons/wooden-chest.png",
flags = {"placeable-neutral", "player-creation"},
minable = {mining_time = 1, result = "wooden-chest"},
max_health = 100,
corpse = "small-remnants",
collision_box = {{-0.35, -0.35}, {0.35, 0.35}},
fast_replaceable_group = "container",
selection_box = {{-0.5, -0.5}, {0.5, 0.5}},
inventory_size = 16,
open_sound = { filename = "__base__/sound/wooden-chest-open.ogg" },
close_sound = { filename = "__base__/sound/wooden-chest-close.ogg" },
vehicle_impact_sound = { filename = "__base__/sound/car-wood-impact.ogg", volume = 1.0 },
picture =
{
filename = "__base__/graphics/entity/wooden-chest/wooden-chest.png",
priority = "extra-high",
width = 46,
height = 33,
shift = {0.25, 0.015625}
},
circuit_wire_connection_point =
{
shadow =
{
red = {0.734375, 0.453125},
green = {0.609375, 0.515625},
},
wire =
{
red = {0.40625, 0.21875},
green = {0.40625, 0.375},
}
},
circuit_connector_sprites = get_circuit_connector_sprites({0.1875, 0.15625}, nil, 18),
circuit_wire_max_distance = 9
}