Queue Class
Manages a list of `Humanoid`s which are waiting to use an `Object`.
Full description:
A queue stores a list of humanoids waiting to use an object. For a reception desk, this is as expected. For a room, the queue is for the door, not the room. Hence the queue stores the list of patients waiting to enter (the traditional queue for the room), the list of staff waiting to enter (because of the door being in use for example), the list of staff and patients waiting to leave (again due to door being in use). Queues are currently implemented as normal Lua arrays, but you should access a queue via its methods rather than directly.
Method Index
- back()
- decreaseMaxSize(amount)
- expect(humanoid, callback)
- expectedSize()
- front()
- hasEmergencyPatient()
- increaseMaxSize(amount)
- isFull()
- move(index, new_index)
- movePatient(index, new_index)
- patientSize()
- pop()
- push(humanoid, callbacks_on)
- remove(index)
- removeValue(value)
- reportedHumanoid(index)
- reportedSize()
- rerouteAllPatients(room_id)
- setBenchThreshold(standing_count)
- setMaxQueue(queue_count)
- setPriorityForSameRoom(entity)
- size()
- unexpect(humanoid)
Member Index
- bench_threshold
- callbacks
- expected
- expected_count
- max_size
- reported_size
- same_room_priority
- visitor_count
function Queue:Queue()
Constructor of a queue.
Declared on: line 36 of Lua/queue.lua.
function Queue:back()
Get the last person in the queue (queue is not changed).
Declared on: line 240 of Lua/queue.lua.
function Queue:decreaseMaxSize(amount)
Lower the max queue length.
Parameters:
| Name | Type | Description |
|---|---|---|
| amount | int | Decrement length value of the queue. |
Declared on: line 76 of Lua/queue.lua.
function Queue:expect(humanoid, callback)
A humanoid is expected in a queue.
Parameters:
| Name | Type | Description |
|---|---|---|
| humanoid | ? | - any humanoid expected for the room |
| callback | ? | - register a callback for when queue is 'destroyed' |
Declared on: line 51 of Lua/queue.lua.
function Queue:expectedSize()
Get the number of expected patients.
Declared on: line 122 of Lua/queue.lua.
function Queue:front()
Get the first person in the queue (queue is not changed).
Note that first person may not be a patient, use Queue:reportedHumanoid to get patients
Declared on: line 233 of Lua/queue.lua.
function Queue:hasEmergencyPatient()
Check if the queue has an emergency patient.
Declared on: line 128 of Lua/queue.lua.
function Queue:increaseMaxSize(amount)
Increase max queue length.
Parameters:
| Name | Type | Description |
|---|---|---|
| amount | int | Increment length value of the queue. |
Declared on: line 82 of Lua/queue.lua.
function Queue:isFull()
Retrieve whether the queue is full.
Declared on: line 110 of Lua/queue.lua.
function Queue:move(index, new_index)
Move the person at position 'index' to position 'new_index'.
Persons between 'index' and 'new_index' move one place to 'index'.
Parameters:
| Name | Type | Description |
|---|---|---|
| index | int | Index number of the person to move. |
| new_index | int | Destination of the person being moved. |
Declared on: line 307 of Lua/queue.lua.
function Queue:movePatient(index, new_index)
Persons between 'index' and 'new_index' move one place to 'index'.
Values are relative to the reported humanoids in the queue
Parameters:
| Name | Type | Description |
|---|---|---|
| index | int | Index number of the person to move. |
| new_index | string | 'front' or 'back' as relative markers |
Declared on: line 331 of Lua/queue.lua.
function Queue:patientSize()
Retrieve the total number of queued and expected patients.
return (int) Number of patients.
Declared on: line 139 of Lua/queue.lua.
function Queue:pop()
Pop first person from the queue.
Note that first person may not be a patient, use Queue:reportedHumanoid to get patients
Declared on: line 246 of Lua/queue.lua.
function Queue:push(humanoid, callbacks_on)
Insert the humanoid at the proper spot in the queue.
Parameters:
| Name | Type | Description |
|---|---|---|
| humanoid | object | Humanoid we want to put in the queue. |
| callbacks_on | ? | ? |
Declared on: line 199 of Lua/queue.lua.
function Queue:remove(index)
Remove person from the queue by index number.
Note that the person may not be a patient.
Parameters:
| Name | Type | Description |
|---|---|---|
| index | jnt | Index in the queue of the person to remove. |
Declared on: line 270 of Lua/queue.lua.
function Queue:removeValue(value)
Remove a person by value from the queue.
Parameters:
| Name | Type | Description |
|---|---|---|
| value | ? | Person to remove. |
Declared on: line 294 of Lua/queue.lua.
function Queue:reportedHumanoid(index)
Get the 'index' real patient.
Parameters:
| Name | Type | Description |
|---|---|---|
| index | int | Index of the patient to retrieve (runs up to Queue:reportedSize). |
Declared on: line 145 of Lua/queue.lua.
function Queue:reportedSize()
Get the number of real patients in the queue.
Declared on: line 116 of Lua/queue.lua.
function Queue:rerouteAllPatients(room_id)
Called when reception desk is destroyed, or when a room is destroyed from a crashed machine.
Parameters:
| Name | Type | Description |
|---|---|---|
| room_id | ? | Id of the room to reroute to, 'nil' for reception. |
Declared on: line 351 of Lua/queue.lua.
function Queue:setBenchThreshold(standing_count)
Parameters:
| Name | Type | Description |
|---|---|---|
| standing_count | ? | ? |
Declared on: line 88 of Lua/queue.lua.
function Queue:setMaxQueue(queue_count)
Set max queue length.
Parameters:
| Name | Type | Description |
|---|---|---|
| queue_count | int | New max queue length to set. |
Declared on: line 92 of Lua/queue.lua.
function Queue:setPriorityForSameRoom(entity)
Parameters:
| Name | Type | Description |
|---|---|---|
| entity | ? | ? |
Declared on: line 152 of Lua/queue.lua.
function Queue:size()
Total size of the queue, which are various people wanting in or out of the room.
For a true patient queue count, use Queue:reportedSize.
Declared on: line 98 of Lua/queue.lua.
function Queue:unexpect(humanoid)
A humanoid is canceled as expected in a queue.
Parameters:
| Name | Type | Description |
|---|---|---|
| humanoid | ? | - Humanoid that is not coming to this queue. |
Declared on: line 64 of Lua/queue.lua.