Skip to content
aubergine10 edited this page Oct 29, 2015 · 3 revisions

##Overview

This property exists on all objects and defines how damaged they are.

##Syntax

local damage = obj.Damage -- <number>

obj.Damage = <number>

Values:

  • <number> - valid values are in the range 0 to 1
  • nil - sometimes used to indicate no damage (equivalent to value of 0)

##Examples

function Update()
  if ( this.Damage or 0 ) >= 0.7 then
    -- my object is broken / my entity is unconscious
  else
    -- still functional / conscious
  end
end

##Notes

Damage is primarily caused by Prisoner entities during attacks, fights and riots. Another major (and sometimes devastating) cause of .Damage is the [Fire special effect](Fire (Special Effect)).

###Entities

  • Dead: >= 1
  • Unconscious: >= 0.7
  • Severely injured: ?
  • Injured: > 0
  • Healthy: <= 0

During attacks, the weapon and traits will determine the amount of damage inflicted.

When defending, .BodyArmour will reduce the amount of damage taken. The Toughness setting defines the amount of damage that can be sustained.

If an entity becomes unconscious or dead, they will drop any .Equipment they have, which can then be picked up by nearby Prisoner entities (or Workman entities when clearing up the aftermath).

###Materials

Materials can only be damaged by the Fire special effect, and after prolonged exposure will be replaced by [BurntWall material](BurntWall (Material)) or [BurntFloor](BurntFloor (Material)) as applicable.

It is not currently possible to get the .Damage of materials.

###All other Objects

  • Destroyed: >= 1 (object remains on map and must be dumped)
  • Broken: >= 0.7 (object should stop working)
  • Damaged: > 0
  • Undamaged: <= 0

##See Also

^ Open "Pages" to Search



Guides:

  • [Lua Basics](Lua Basics Guide)
  • [Save-Load Cycle](Save-Load Cycle Guide)

[Globals](Object Globals):

  • [Game](Game (Global))
  • [me](me (Global))
  • [Object](Object (Global))
  • [this](this (Global))

[Events](Object Events):

Psuedo-Types:

  • [Rotation table](Rotation table)
  • [Id table](Id table)
  • [Location table](Location table)
  • [Velocity table](Velocity table)

[Methods](Object Methods):

[Properties](Object Properties):

Clone this wiki locally