Prototype/EntityWithHealth: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
(Removed old prototype docs)
Tag: Replaced
 
(32 intermediate revisions by 4 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/EntityWithHealthPrototype.html https://lua-api.factorio.com/latest/prototypes/EntityWithHealthPrototype.html]
The common properties of all entities with health in the game.
Extends the [[Prototype/Entity]]


== Extensions ==
</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/Accumulator]]
*[[Prototype/Character]]
*[[Prototype/Unit]]
*[[Prototype/PipeConnectable]]
*[[Prototype/Car]]
*[[Prototype/Market]]
 
== Properties ==
=== max_health ===
'''Type''': [[Types/float]]
 
The unit health can never go over the maxmum. Default health of units on creation is set to max.
    max_health = 50
 
=== healing_per_tick ===
'''Type''': [[Types/float]]
 
The amount of health cured by tick naturally.
Works only on active entities. (Todo explain)
  healing_per_tick = 0.01
 
=== dying_explosion ===
'''Type''': [[Types/EntityID]]
 
Todo, this should be removed and [[Type/AttackResult]] should be used for dying event.
This would allow much more variability.
 
=== loot ===
'''Type''': [[Types/LootSpecification]]
The loot is generated when the entity is killed.
    loot =
    {
      {
        count_max = 10,
        count_min = 2,
        item = "alien-artifact",
        probability = 1
      }
    }
=== resistances ===
'''Type''': [[Types/Resistances]]
 
'''See''': [[Damage]]
    resistances =
    {
      {
        type = "fire",
        percent = 80
      },
      {
        type = "explosion",
        percent = 30
      }
    }
 
=== attack_reaction ===
'''Type''': [[Types/AttackReaction]]
 
'''Default''': Empty
=== corpse ===
'''Type''': [[Types/string]] (single value or list)
 
'''Default''': Empty
 
Specifies the name of the [[Prototypes/Corpse]] entity to be used when this entity dies.
 
== 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"},
      collision_box = {{-0.4, -0.4}, {0.4, 0.4}},
      selection_box = {{-0.5, -0.5}, {0.5, 0.5}},
      max_health = 50,
      corpse = "small-remnants",
      fast_replaceable_group = "container",
      inventory_size = 16,
      picture =
      {
        filename = "__base__/graphics/entity/wooden-chest/wooden-chest.png",
        priority = "extra-high",
        width = 46,
        height = 33,
        shift = {0.3, 0}
      }
    }

Latest revision as of 14:32, 25 October 2024

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/EntityWithHealthPrototype.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.