Prototype/EntityWithHealth: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
No edit summary
Line 13: Line 13:
=== max_health ===
=== max_health ===
'''Type''': [[Types/float]]
'''Type''': [[Types/float]]
The unit health can never go over the maxmum. Default health of units on creations is set to max.
The unit health can never go over the maxmum. Default health of units on creations is set to max.
     max_health = 50
     max_health = 50
=== healing_per_tick ===
=== healing_per_tick ===
'''Type''': [[Types/float]]
'''Type''': [[Types/float]]

Revision as of 15:06, 12 October 2013

Basics

The common properties of all entities with health in the game. Extends the Prototype/Entity

Extensions

Properties

max_health

Type: Types/float

The unit health can never go over the maxmum. Default health of units on creations 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)

dying_explosion

Type: Types/EntityID

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

   resistances = 
   {
     {
       type = "fire",
       percent = 80
     },
     {
       type = "explosion",
       percent = 30
     }
   }

attack_reaction

Type: Types/AttackReaction

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}
     }
   }