CallsDispatcher Class
Method Index
- actionInterruptHandler(action, humanoid)
- addChangeCallback(callback, self_value)
- answerCall(staff)
- callForRepair(object, urgent, manual)
- callForStaff(room)
- callForStaffEachRoom(room, attribute, key)
- callForWatering(plant)
- callNurseForVaccination(patient)
- dropFromQueue(object, key)
- dump()
- dumpCall(call, message)
- enqueue(object, key, description, verification, priority, execute)
- executeCall(call, staff)
- findSuitableStaff(call)
- getPriorityForRoom(room, attribute, staff)
- getPriorityForVaccination(patient, nurse)
- onChange()
- onCheckpointCompleted(call)
- onTick()
- queueCallCheckpointAction(humanoid, interrupt_handler)
- removeChangeCallback(callback)
- sendNurseToVaccinate(patient, nurse)
- sendStaffToRepair(object, handyman)
- sendStaffToRoom(room, staff)
- sendStaffToWatering(plant, handyman)
- staffActionInterruptHandler(action, humanoid)
- unassignCall(call, answer_next_call)
- verifyStaffForRoom(room, attribute, staff)
- verifyStaffForVaccination(patient, staff)
Member Index
- call_queue
- change_callback
- tick
- world
function CallsDispatcher:CallsDispatcher(world)
Turn on for debug message
Parameters:
| Name | Type | Description |
|---|---|---|
| world | ? | ? |
Declared on: line 30 of Lua/calls_dispatcher.lua.
function CallsDispatcher.actionInterruptHandler(action, humanoid)
Default checkpoint interrupt handler
Reset the assigned status, and find an replacement staff
Parameters:
| Name | Type | Description |
|---|---|---|
| action | ? | ? |
| humanoid | ? | ? |
Declared on: line 410 of Lua/calls_dispatcher.lua.
Note: Is a function rather than a method.
function CallsDispatcher:addChangeCallback(callback, self_value)
Parameters:
| Name | Type | Description |
|---|---|---|
| callback | ? | ? |
| self_value | ? | ? |
Declared on: line 43 of Lua/calls_dispatcher.lua.
function CallsDispatcher:answerCall(staff)
Find the best call for a staff to work on.
When a staff goes to meandering mode, it should call this function to look for new call
Return true if a call is answered. False if there is no suitable call waiting and the staff is really free.
Parameters:
| Name | Type | Description |
|---|---|---|
| staff | ? | ? |
Declared on: line 319 of Lua/calls_dispatcher.lua.
function CallsDispatcher:callForRepair(object, urgent, manual)
Call for repair
Parameters:
| Name | Type | Description |
|---|---|---|
| object | ? | ? |
| urgent | ? | Announcement should be made |
| manual | ? | This call should not trigger advisor for "your machine is failing" |
Declared on: line 94 of Lua/calls_dispatcher.lua.
function CallsDispatcher:callForStaff(room)
Parameters:
| Name | Type | Description |
|---|---|---|
| room | ? | ? |
Declared on: line 57 of Lua/calls_dispatcher.lua.
function CallsDispatcher:callForStaffEachRoom(room, attribute, key)
Parameters:
| Name | Type | Description |
|---|---|---|
| room | ? | ? |
| attribute | ? | ? |
| key | ? | ? |
Declared on: line 73 of Lua/calls_dispatcher.lua.
function CallsDispatcher:callForWatering(plant)
Parameters:
| Name | Type | Description |
|---|---|---|
| plant | ? | ? |
Declared on: line 126 of Lua/calls_dispatcher.lua.
function CallsDispatcher:callNurseForVaccination(patient)
Queues a call for vaccination of a patient
@param patient (Patient) the patient who wishes to be vaccinated
@return call (table) the call which was queued
Parameters:
| Name | Type | Description |
|---|---|---|
| patient | ? | ? |
Declared on: line 148 of Lua/calls_dispatcher.lua.
function CallsDispatcher:dropFromQueue(object, key)
Drop any call associated with the object (and/or key).
Expected to be called when the call is no longer needed
(like a machine that needed repaired were replaced),
or when the object is destroyed, etc.
Parameters:
| Name | Type | Description |
|---|---|---|
| object | ? | ? |
| key | ? | ? |
Declared on: line 440 of Lua/calls_dispatcher.lua.
function CallsDispatcher:dump()
Dump the current call table for debugging
Declared on: line 365 of Lua/calls_dispatcher.lua.
function CallsDispatcher.dumpCall(call, message)
Parameters:
| Name | Type | Description |
|---|---|---|
| call | ? | ? |
| message | ? | ? |
Declared on: line 376 of Lua/calls_dispatcher.lua.
Note: Is a function rather than a method.
function CallsDispatcher:enqueue(object, key, description, verification, priority, execute)
Enqueue the call
returns: True if the call is inserted and queued, but not served
False if the call is served right away, or has been queued and assigned
Parameters:
| Name | Type | Description |
|---|---|---|
| object | ? | ? |
| key | ? | ? |
| description | ? | ? |
| verification | ? | ? |
| priority | ? | ? |
| execute | ? | ? |
Declared on: line 255 of Lua/calls_dispatcher.lua.
function CallsDispatcher:executeCall(call, staff)
Parameters:
| Name | Type | Description |
|---|---|---|
| call | ? | ? |
| staff | ? | ? |
Declared on: line 430 of Lua/calls_dispatcher.lua.
function CallsDispatcher:findSuitableStaff(call)
Find suitable (best) staff for working on a specific call
True
Parameters:
| Name | Type | Description |
|---|---|---|
| call | ? | ? |
Declared on: line 281 of Lua/calls_dispatcher.lua.
function CallsDispatcher.getPriorityForRoom(room, attribute, staff)
Parameters:
| Name | Type | Description |
|---|---|---|
| room | ? | ? |
| attribute | ? | ? |
| staff | ? | ? |
Declared on: line 497 of Lua/calls_dispatcher.lua.
Note: Is a function rather than a method.
function CallsDispatcher.getPriorityForVaccination(patient, nurse)
Determine which nurse has the highest priority to vaccinate a patient
the patient should be easily reachable from the nurse
@param patient (Patient) the patient calling for vaccination
@param nurse (Staff, humanoid_class Nurse) the nurse to verify if they
have priority to vaccinate
@return score (Integer) lowest score has higher priority to vaccinate
Parameters:
| Name | Type | Description |
|---|---|---|
| patient | ? | ? |
| nurse | ? | ? |
Declared on: line 207 of Lua/calls_dispatcher.lua.
Note: Is a function rather than a method.
function CallsDispatcher.onCheckpointCompleted(call)
Called when a call is completed successfully.
Parameters:
| Name | Type | Description |
|---|---|---|
| call | ? | ? |
Declared on: line 420 of Lua/calls_dispatcher.lua.
Note: Is a function rather than a method.
function CallsDispatcher.queueCallCheckpointAction(humanoid, interrupt_handler)
Add checkpoint action
All call execution method should add this action in appropriate place to signify
the job is finished.
A interrupt handler could be supplied if special handling is needed.
If not, the default would be reinsert the call into the queue
Parameters:
| Name | Type | Description |
|---|---|---|
| humanoid | ? | ? |
| interrupt_handler | ? | ? |
Declared on: line 400 of Lua/calls_dispatcher.lua.
Note: Is a function rather than a method.
function CallsDispatcher:removeChangeCallback(callback)
Parameters:
| Name | Type | Description |
|---|---|---|
| callback | ? | ? |
Declared on: line 47 of Lua/calls_dispatcher.lua.
function CallsDispatcher.sendNurseToVaccinate(patient, nurse)
Once a nurse has been verified and priority decided do the actions to
perform the actually vaccination, delegated to Epidemic class (@see
Epidemic:createVaccinationActions) @param patient (Patient) the patient calling
for vaccination @param nurse (Staff, humanoid_class Nurse) the nurse to perform
the vaccination actions
Parameters:
| Name | Type | Description |
|---|---|---|
| patient | ? | ? |
| nurse | ? | ? |
Declared on: line 233 of Lua/calls_dispatcher.lua.
Note: Is a function rather than a method.
function CallsDispatcher.sendStaffToRepair(object, handyman)
'execute' callback for repairing an object (eg a machine).
Parameters:
| Name | Type | Description |
|---|---|---|
| object | ? | Object to repair. |
| handyman | ? | Staff to use. |
Declared on: line 555 of Lua/calls_dispatcher.lua.
Note: Is a function rather than a method.
function CallsDispatcher.sendStaffToRoom(room, staff)
Parameters:
| Name | Type | Description |
|---|---|---|
| room | ? | ? |
| staff | ? | ? |
Declared on: line 533 of Lua/calls_dispatcher.lua.
Note: Is a function rather than a method.
function CallsDispatcher.sendStaffToWatering(plant, handyman)
'execute' callback for watering a plant.
Parameters:
| Name | Type | Description |
|---|---|---|
| plant | ? | Plant to give water. |
| handyman | ? | Staff to use. |
Declared on: line 562 of Lua/calls_dispatcher.lua.
Note: Is a function rather than a method.
function CallsDispatcher.staffActionInterruptHandler(action, humanoid)
Parameters:
| Name | Type | Description |
|---|---|---|
| action | ? | ? |
| humanoid | ? | ? |
Declared on: line 545 of Lua/calls_dispatcher.lua.
Note: Is a function rather than a method.
function CallsDispatcher.unassignCall(call, answer_next_call)
Unassign call
Parameters:
| Name | Type | Description |
|---|---|---|
| call | ? | call to unassign from assigned humanoid. |
| answer_next_call | bool | should the humanoid assigned to this call then answer for another new call |
Declared on: line 468 of Lua/calls_dispatcher.lua.
Note: Is a function rather than a method.
function CallsDispatcher.verifyStaffForRoom(room, attribute, staff)
Parameters:
| Name | Type | Description |
|---|---|---|
| room | ? | ? |
| attribute | ? | ? |
| staff | ? | ? |
Declared on: line 482 of Lua/calls_dispatcher.lua.
Note: Is a function rather than a method.
function CallsDispatcher.verifyStaffForVaccination(patient, staff)
Determines if a member of staff is suitable to vaccinate a patient they
must be a nurse and not busy or too far away.
@param patient (Patient) the patient calling for vaccination
@param staff (Staff) staff member to verify if suitable to vaccinate
@return true if suitable for vaccination false otherwise (boolean)
Parameters:
| Name | Type | Description |
|---|---|---|
| patient | ? | ? |
| staff | ? | ? |
Declared on: line 179 of Lua/calls_dispatcher.lua.
Note: Is a function rather than a method.