obj.Damage
##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 range0
to1
-
nil
- sometimes used to indicate no damage (equivalent to value of0
)
##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
- [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):
- [Rotation table](Rotation table)
- [Id table](Id table)
- [Location table](Location table)
- [Velocity table](Velocity table)
[Methods](Object Methods):
.ApplyVelocity()
.ClearRouting()
.CreateJob()
.Delete()
.GetNearbyObjects()
.LeaveMap()
.NavigateTo()
.Sound()
[Properties](Object Properties):
.Active
.Age
.AiSetTarget
.AiWalkSpeed
.AnimateRotation
.AnimateVelocity
.AssignedRoom
.Attacker
.AttackTimer
.AvailableMoney
.AvatarControl
.BodyArmour
.BoilingPoint
.BookInCell
.Carried
.CarrierId
.Carrying
.CarryingBook
.Category
.Cell
.CellId
.CellIdTimer
.CloseTimer
-
.Connections
⚠️ .Contents
.CutsceneActor
.Damage
.Dest
.Door
.Driver
.Energy
.Equipment
.Entity
-
.ExternalPower
⚠️ .FailedToFindCell
.FeedJobId
.FireEngine
.Fireman
.FollowerId
.Fuel
.Gang
.Garbage
.HealingJobId
.Hidden
.Hose
.HoseOffset
.Hostage
.Id
.Intensity
.IsExternalTeacher
.IsNewIntake
.JobId
.LastAccess
.LastAte
.LastTreated
.LastVisitors
.LeavingMap
.Library
.Loaded
.Locked
.Misbehaviour
.Mode
.Naked
.Name
.Needs
.Office
-
.On
⚠️ .Open
.OpenDir
.Opened
.OpenOnTrigger
.OpenTimer
.Operation
.OperationTimer
.Or
.Patrol
.PermitPlayerControl
.PlayerOrderPos
.Pos
-
.Powered
⚠️ .Prisoner
.ProcessingRoom
.Quantity
.ReloadTimer
.RemotelyOpenable
.RequiredCellType
.RestState
.Result
.RotateDir
.SectorTimer
.Shackled
.Slot0..7
.SnitchTimer
.Speed
.State
.Station
.StatusEffects
.SubType
.TargetObject
.TazerTrained
.TimeOfLastMisconduct
.Timer
.Tooltip
.Triggered
.TriggeredBy
.TriggeredTime
.Type
.UnlockingDoor
.Vel
.WallCheckTimer
.Walls
.WatchingFight
.Weight
-
.Wired
⚠️ .WorldObject