Debian Codegraph @

CorsixTH/Lua/hospitals/ai_hospital.lua

raw
1 --[[ Copyright (c) 2020 Albert "Alberth" Hofkamp
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 class "AIHospital" (Hospital)
22
23 ---@type AIHospital
24 local AIHospital = _G["AIHospital"]
25
26 function AIHospital:AIHospital(competitor, world, avail_rooms, name)
27 self:Hospital(world, avail_rooms, name)
28 if name then
29 self.name = name
30 elseif _S.competitor_names[competitor] then
31 self.name = _S.competitor_names[competitor]
32 else
33 self.name = "NONAME"
34 end
35 self.is_in_world = false
36 end
37
38 function AIHospital:spawnPatient()
39 -- TODO: Simulate patient
40 end
41
42 function AIHospital:logTransaction()
43 -- AI doesn't need a log of transactions, as it is only used for UI purposes
44 end
45
46 function AIHospital:afterLoad(old, new)
47 if old < 145 then
48 self.hosp_cheats = nil
49 end
50
51 Hospital.afterLoad(self, old, new)
52 end