Prototype/EntityWithHealth: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
(Set prototype parent)
(Converted to SMW format)
Line 1: Line 1:
{{Prototype parent|Prototype/Entity}}
{{Prototype parent|Prototype/Entity}}
The common properties of all entities with health in the game.


==Basics==
{{Prototype TOC|''abstract''}}
This type is abstract and cannot be created directly.
 
The common properties of all entities with health in the game.
Extends the [[Prototype/Entity]]


== Extensions ==
== Extensions ==
Line 88: Line 85:
</div>
</div>


== Properties ==
== Optional properties ==
=== max_health ===
'''Type''': [[Types/float]]
 
'''Default''': 10


{{Prototype property|max_health|[[Types/float|float]]|10|optional=true}}
The unit health can never go over the maxmum. Default health of units on creation is set to max. Must be greater than 0.
The unit health can never go over the maxmum. Default health of units on creation is set to max. Must be greater than 0.
     max_health = 50
     max_health = 50


=== healing_per_tick ===
{{Prototype property|healing_per_tick|[[Types/float|float]]|0|optional=true}}
'''Type''': [[Types/float]]
 
'''Default''': 0
 
The amount of health cured by tick naturally.
The amount of health cured by tick naturally.
Works only on active entities. (Todo explain)
Works only on active entities. (Todo explain)
   healing_per_tick = 0.01
   healing_per_tick = 0.01


=== repair_speed_modifier ===
{{Prototype property|repair_speed_modifier|[[Types/float|float]]|1|optional=true}}
'''Type''': [[Types/float]]
 
'''Default''': 1
 
=== dying_explosion ===
'''Type''': [[Types/string]]


{{Prototype property|dying_explosion|[[Types/string|string]]|optional=true}}
The entity that is spawned in place of this one when it dies.
The entity that is spawned in place of this one when it dies.


=== dying_trigger_effect ===
{{Prototype property|dying_trigger_effect|[[Types/TriggerEffect|TriggerEffect]]|optional=true}}
'''Type''': [[Types/TriggerEffect]]
 
=== loot ===
'''Type''': [[Types/Loot]]


{{Prototype property|loot|[[Types/Loot|Loot]]|optional=true}}
The loot is dropped on the ground when the entity is killed.
The loot is dropped on the ground when the entity is killed.
<syntaxhighlight lang="lua">loot =
<syntaxhighlight lang="lua">loot =
Line 133: Line 115:
}</syntaxhighlight>
}</syntaxhighlight>


=== resistances ===
{{Prototype property|resistances|[[Types/Resistances|Resistances]]|optional=true}}
'''Type''': [[Types/Resistances]]
 
'''See''': [[Damage]]
'''See''': [[Damage]]
<syntaxhighlight lang="lua">resistances =  
<syntaxhighlight lang="lua">resistances =  
Line 149: Line 129:
}</syntaxhighlight>
}</syntaxhighlight>


=== attack_reaction ===
{{Prototype property|attack_reaction|[[Types/AttackReaction|AttackReaction]]|Empty|optional=true}}
'''Type''': [[Types/AttackReaction]]


'''Default''': Empty
{{Prototype property|repair_sound|[[Types/Sound|Sound]]|Utility sound (defaultManualRepair)|optional=true}}


=== repair_sound ===
{{Prototype property|alert_when_damaged|[[Types/bool|bool]]|true|optional=true}}
'''Type''': [[Types/Sound]]


'''Default''': Utility sound (defaultManualRepair)
{{Prototype property|hide_resistances|[[Types/bool|bool]]|true|optional=true}}


=== alert_when_damaged ===
{{Prototype property|create_ghost_on_death|[[Types/bool|bool]]|true|optional=true}}
'''Type''': [[Types/bool]]
 
'''Default''': true
 
=== hide_resistances ===
'''Type''': [[Types/bool]]
 
'''Default''': true
 
=== create_ghost_on_death ===
'''Type''': [[Types/bool]]
 
'''Default''': true
 
=== corpse ===
'''Type''': [[Types/string]] or [[Types/table]] of [[Types/string]]s
 
'''Default''': Empty


{{Prototype property|corpse|[[Types/string|string]] or [[Types/table|table]] of [[Types/string|string]]s|Empty|optional=true}}
Specifies the name(s) of the [[Prototype/Corpse]] entity to be used when this entity dies.
Specifies the name(s) of the [[Prototype/Corpse]] entity to be used when this entity dies.


=== integration_patch ===
{{Prototype property|integration_patch|[[Types/Sprite4Way|Sprite4Way]]|optional=true}}
'''Type''': [[Types/Sprite4Way]]
 
Sprite drawn on ground under the entity to make it feel more integrated into the ground.
Sprite drawn on ground under the entity to make it feel more integrated into the ground.



Revision as of 11:36, 28 July 2019

Template:Prototype parent The common properties of all entities with health in the game.

Template:Prototype TOC

Extensions

Optional properties

Template:Prototype property The unit health can never go over the maxmum. Default health of units on creation is set to max. Must be greater than 0.

   max_health = 50

Template:Prototype property The amount of health cured by tick naturally. Works only on active entities. (Todo explain)

  healing_per_tick = 0.01

Template:Prototype property

Template:Prototype property The entity that is spawned in place of this one when it dies.

Template:Prototype property

Template:Prototype property The loot is dropped on the ground when the entity is killed.

loot =
{
  {
    count_max = 10,
    count_min = 2,
    item = "stone",
    probability = 1
  }
}

Template:Prototype property See: Damage

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

Template:Prototype property

Template:Prototype property

Template:Prototype property

Template:Prototype property

Template:Prototype property

Template:Prototype property Specifies the name(s) of the Prototype/Corpse entity to be used when this entity dies.

Template:Prototype property Sprite drawn on ground under the entity to make it feel more integrated into the ground.

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
  }