| 1 |
--[[ Copyright (c) 2011 William "sadger" Gatens |
| 2 |
|
| 3 |
Permission is hereby granted, free of charge, to any person obtaining a copy of |
| 4 |
this software and associated documentation files (the "Software"), to deal in |
| 5 |
the Software without restriction, including without limitation the rights to |
| 6 |
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies |
| 7 |
of the Software, and to permit persons to whom the Software is furnished to do |
| 8 |
so, subject to the following conditions: |
| 9 |
|
| 10 |
The above copyright notice and this permission notice shall be included in all |
| 11 |
copies or substantial portions of the Software. |
| 12 |
|
| 13 |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 14 |
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 15 |
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 16 |
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 17 |
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 18 |
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 19 |
SOFTWARE. --]] |
| 20 |
|
| 21 |
corsixth.require("announcer") |
| 22 |
|
| 23 |
local AnnouncementPriority = _G["AnnouncementPriority"] |
| 24 |
|
| 25 |
--[[ An `Inspector` is called to the hospital after an epidemic to issue a report]] |
| 26 |
class "Inspector" (Humanoid) |
| 27 |
|
| 28 |
---@type Inspector |
| 29 |
local Inspector = _G["Inspector"] |
| 30 |
|
| 31 |
function Inspector:Inspector(...) |
| 32 |
self:Humanoid(...) |
| 33 |
self.hover_cursor = TheApp.gfx:loadMainCursor("default") |
| 34 |
self.has_been_announced = false |
| 35 |
end |
| 36 |
|
| 37 |
--[[ Labels the inspector as the "Health Inspector" ]] |
| 38 |
function Inspector:updateDynamicInfo(action_string) |
| 39 |
self:setDynamicInfo('text', {_S.dynamic_info.health_inspector}) |
| 40 |
end |
| 41 |
|
| 42 |
-- Disable showing inspector mood on hover |
| 43 |
function Inspector:setIfHoverMoodsVisible() |
| 44 |
self.hover_moods = false |
| 45 |
end |
| 46 |
|
| 47 |
--[[ Sends the inspector home ]] |
| 48 |
function Inspector:goHome() |
| 49 |
if self.going_home then |
| 50 |
return |
| 51 |
end |
| 52 |
--Store a reference to the hospital last visited to send fax to |
| 53 |
self.last_hospital = self.hospital |
| 54 |
|
| 55 |
self:unregisterCallbacks() |
| 56 |
self.going_home = true |
| 57 |
self:despawn() |
| 58 |
end |
| 59 |
|
| 60 |
--[[ Called when the inspector has left the map ]] |
| 61 |
function Inspector:onDestroy() |
| 62 |
return Humanoid.onDestroy(self) |
| 63 |
end |
| 64 |
|
| 65 |
function Inspector:announce() |
| 66 |
self.world.ui:playAnnouncement("vip008.wav", AnnouncementPriority.High) |
| 67 |
end |
| 68 |
|
| 69 |
function Inspector:afterLoad(old, new) |
| 70 |
if old < 213 then |
| 71 |
self.mood_marker = 2 |
| 72 |
end |
| 73 |
|
| 74 |
self:updateDynamicInfo() |
| 75 |
Humanoid.afterLoad(self, old, new) |
| 76 |
end |