obj.RestState
This property requires further investigation
##Overview
Defines whether an Entity is rested, needs rest, or is resting.
This property is not present on entities which have
Properties DoesNotTire
in theirmaterials.txt
definition.
Prisoner
rest requirements are handled by theirNeeds.Sleep
which gradually increases throughout the day, and can be decreased by suitable needs providers (namely, aBed
). That being said, they still have a.RestState
property - needs more investigation!
##Syntax
local state = someEntity.RestState -- string
someEntity.RestState = <number> -- Bug 9969
Values:
-
'RestStateRequired'
– they are tired and need rest -
'RestStateResting'
– they are currently resting - (unconfirmed)
'RestStateOK'
– they don't currently need rest -
nil
- either not an entity, or the entityDoesNotTire
PA Bug 9969: When setting the value of the property you need to use an integer. Currently not tested to see which integer relates to the various states.
##Examples
if this.RestState == 'RestStateResting' then
-- the entity is currently resting
end
##Mods
##Notes
When the Energy
value of an entity drops to a certain point, the entity will become "Tired" and its RestState
will be set to 'RestStateRequired'
. It's not yet known which Energy
values relate to which RestState
values, or whether the two properties can be used independently of each other.
The entity will then go to its designated resting room, which depends on the type of entity:
- [
Dogs
](Dog (Entity)) rest in their kennels - Other staff entities rest in the
Staffroom
While resting, the entity will have a RestState
of 'RestStateResting'
and its Energy
value will gradually increase until they are fully rested.
Once fully rested, the RestState
will change to 'RestStateOK'
(unconfirmed) and the entity will resume their work.
-
Doctor
entities will often go to theInfirmary
that's closest to theStaffroom
they were resting in, rather than the infirmary they were previously stationed at (this might have been fixed, needs further testing) - Guards will look for whatever work needs doing (utility station, deployment, patrols, opening doors, watching rooms based on active regime slot) and if they can't find work they'll usually wander around Storage areas.
The Energy
value will gradually decrease whilst not resting, until it reaches a point where more rest is required.
##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