Debian Codegraph @

CorsixTH/Lua/diseases/fractured_bones.lua

raw
1 --[[ Copyright (c) 2009 Edvin "Lego3" Linge
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 local disease = {}
22 disease.id = "fractured_bones"
23 disease.expertise_id = 9
24 disease.visuals_id = 7
25 disease.name = _S.diseases.fractured_bones.name
26 disease.cause = _S.diseases.fractured_bones.cause
27 disease.symptoms = _S.diseases.fractured_bones.symptoms
28 disease.cure = _S.diseases.fractured_bones.cure
29 disease.cure_price = 450
30 disease.emergency_sound = "emerg005.wav"
31 disease.emergency_number = 16
32 disease.contagious = false
33 disease.initPatient = function(patient)
34 if not TheApp.config.disable_fractured_bones_females and math.random(1, 2) == 2 then -- The female animation in the cast remover is bad
35 -- so by default it is disabled. They can though be allowed by turning them on in config
36 patient:setType("Standard Female Patient")
37 patient:setLayer(0, math.random(1, 4) * 2)
38 local num1 = math.random(0, 1) -- The first bandage yes/no
39 patient:setLayer(2, num1 * 2)
40 -- There needs to be at least one bandage on the patient
41 patient:setLayer(3, (num1 == 0 and 1 or math.random(0, 1)) * 2)
42 patient:setLayer(4, 0)
43 else
44 patient:setType("Alternate Male Patient")
45 patient:setLayer(0, math.random(1, 5) * 2)
46 -- Some bandage types may be duplicated, then it shall be so
47 local num1 = math.random(0, 2) -- The first bandage yes/no
48 patient:setLayer(2, num1 * 2)
49 local num2 = math.random(0, 5) -- The second bandage yes/no
50 -- 6 does not exist, a few more arm bandages instead
51 if num2 == 3 then num2 = 4 end
52 patient:setLayer(3, num2 * 2)
53 -- There needs to be at least one bandage on the patient
54 local num3 = math.random(0, 5)
55 if num3 == 3 then num3 = 4 end
56 patient:setLayer(4, ((num1 == 0 and num2 == 0) and 1 or num3) * 2)
57 end
58 patient:setLayer(1, math.random(0, 3) * 2)
59 end
60 -- Diagnosis rooms are the rooms other than the GPs office which can be visited
61 -- to aid in diagnosis. The need not be visited, and if they are visited, the
62 -- order in which they are visited is not fixed.
63 disease.diagnosis_rooms = {
64 "scanner",
65 }
66 -- Treatment rooms are the rooms which must be visited, in the given order, to
67 -- cure the disease.
68 disease.treatment_rooms = {
69 "fracture_clinic",
70 }
71
72 -- If a machine is required a small icon should appear in the drug casebook.
73 disease.requires_machine = true
74
75 return disease