Announcer Class
Announces audible messages to the player.
Full description:
The announcer plays announcements based on their priority. If the caller requests an announcement to be played, it will be played directly if there are no announcements currently being announced. Note that announcements are only played if there is a worker at the reception desk and announcements are enabled in the settings.
Method Index
- _onPlayed(entry)
- _play(entry)
- _setRandomAnnouncementTarget()
- onTick()
- playAnnouncement(name, priority, decay_hours, played_callback, played_callback_delay)
Member Index
- app
- entries
- playing
- random_announcement_ticks_target
- ticks_since_last_announcement
function Announcer:Announcer(app)
Constructor.
Parameters:
| Name | Type | Description |
|---|---|---|
| app | App | The CorsixTH app |
Declared on: line 132 of Lua/announcer.lua.
function Announcer:_onPlayed(entry)
Private function. Handles the playSound completed event. Also calls the callback of the announcement.
Parameters:
| Name | Type | Description |
|---|---|---|
| entry | AnnouncementEntry | The announcement that has been played. |
Declared on: line 246 of Lua/announcer.lua.
function Announcer:_play(entry)
Private function. Plays the actual sound of an announcement.
Parameters:
| Name | Type | Description |
|---|---|---|
| entry | AnnouncementEntry | The announcement to play. |
Declared on: line 236 of Lua/announcer.lua.
function Announcer:_setRandomAnnouncementTarget()
Private function. Sets the new time (in ticks) when a random announcement should be played.
Declared on: line 224 of Lua/announcer.lua.
function Announcer:onTick()
The announcer's (game) tick handler.
Plays the actual sound of the announcements, if available.
Also queues random announcements if no announcements have been played for a while.
Declared on: line 183 of Lua/announcer.lua.
function Announcer:playAnnouncement(name, priority, decay_hours, played_callback, played_callback_delay)
Requests the announcer to play an announcement.
Parameters:
| Name | Type | Description |
|---|---|---|
| name | string | The filename to play. |
| priority | int or nil | The priority of the announcement. See AnnouncementPriority. |
| decay_hours | float or nil | After this amount of hours the announcement should be considered irrelevant. Provide nil for a decay time based on the provided priority. |
| played_callback | function or nil | The callback to trigger when the announcement was successfully played. |
| played_callback_delay | int or nil | Delay the callback with this amount of milliseconds. |
Declared on: line 143 of Lua/announcer.lua.