Debian Codegraph @

CorsixTH/Lua/objects/chair.lua

raw
1 --[[ Copyright (c) 2009 Peter "Corsix" Cawley
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 object = {}
22 object.id = "chair"
23 object.thob = 6
24 object.name = _S.object.chair
25 object.tooltip = _S.tooltip.objects.chair
26 object.ticks = false
27 object.build_preview_animation = 5056
28 object.idle_animations = {
29 north = 686,
30 east = 688,
31 }
32 object.walk_in_to_use = true
33 local function make_list(not_talking, nodding, talking)
34 local list = {}
35 for _ = 1, 16 do list[#list+1] = not_talking end
36 if nodding then
37 for _ = 1, 3 do list[#list+1] = nodding end
38 end
39 if talking then
40 for _ = 1, 1 do list[#list+1] = talking end
41 end
42 return list
43 end
44 object.usage_animations = {
45 north = {
46 begin_use = {
47 ["Standard Male Patient" ] = 678,
48 ["Slack Male Patient" ] = 4580,
49 ["Elvis Patient" ] = 1054,
50 ["Standard Female Patient" ] = 2824,
51 ["Slack Female Patient" ] = 2824,
52 ["Chewbacca Patient" ] = 3792,
53 ["Invisible Patient" ] = 4228,
54 ["Transparent Male Patient" ] = 4360,
55 ["Alternate Male Patient" ] = 4480,
56 ["Transparent Female Patient"] = 4816,
57 ["Alien Male Patient" ] = 678, -- TEMP
58 ["Alien Female Patient" ] = 2824, -- TEMP
59 },
60 in_use = {
61 -- Note that patient mouth not visible in this orientation, so we only
62 -- need one animation, and not the collection of animations.
63 ["Standard Male Patient" ] = 702,
64 ["Slack Male Patient" ] = 4588,
65 ["Elvis Patient" ] = 1038,
66 ["Standard Female Patient" ] = 2814,
67 ["Slack Female Patient" ] = 2814,
68 ["Chewbacca Patient" ] = 3784,
69 ["Invisible Patient" ] = 4236,
70 ["Transparent Male Patient" ] = 4344,
71 ["Alternate Male Patient" ] = 4488,
72 ["Transparent Female Patient"] = 4808,
73 ["Alien Male Patient" ] = 702, -- TEMP
74 ["Alien Female Patient" ] = 2814, -- TEMP
75 },
76 finish_use = {
77 ["Standard Male Patient" ] = 694,
78 ["Slack Male Patient" ] = 4596,
79 ["Standard Female Patient" ] = 2832,
80 ["Slack Female Patient" ] = 2832,
81 ["Chewbacca Patient" ] = 3776,
82 ["Elvis Patient" ] = 4070,
83 ["Invisible Patient" ] = 4244,
84 ["Transparent Male Patient" ] = 4368,
85 ["Alternate Male Patient" ] = 4504,
86 ["Transparent Female Patient"] = 4824,
87 ["Alien Male Patient" ] = 694, -- TEMP
88 ["Alien Female Patient" ] = 2832, -- TEMP
89 }
90 },
91 east = {
92 begin_use = {
93 ["Standard Male Patient" ] = 680,
94 ["Elvis Patient" ] = 1056,
95 ["Slack Male Patient" ] = 1540,
96 ["Standard Female Patient" ] = 2826,
97 ["Slack Female Patient" ] = 2826,
98 ["Chewbacca Patient" ] = 3794,
99 ["Invisible Patient" ] = 4230,
100 ["Transparent Male Patient" ] = 4362,
101 ["Alternate Male Patient" ] = 4482,
102 ["Transparent Female Patient"] = 4818,
103 ["Alien Male Patient" ] = 680, -- TEMP
104 ["Alien Female Patient" ] = 2826, -- TEMP
105 },
106 in_use = { -- Not talking, head nodding, talking
107 ["Standard Male Patient" ] = make_list( 704, 736, 744),
108 ["Elvis Patient" ] = make_list(1040, nil, 4080),
109 ["Slack Male Patient" ] = make_list(1544, nil, 4606),
110 ["Standard Female Patient" ] = make_list(2818, 3002, 2994),
111 ["Slack Female Patient" ] = make_list(2818, 3002, 2994),
112 ["Chewbacca Patient" ] = make_list(3786, nil, 4144),
113 ["Invisible Patient" ] = make_list(4238, nil, 4250),
114 ["Transparent Male Patient" ] = make_list(4378, 4346, 4354),
115 ["Alternate Male Patient" ] = make_list(4490, nil, 4498),
116 -- NB: 4498 also seems to include big-head patients
117 ["Transparent Female Patient"] = make_list(4810, 4842, 4834),
118 ["Alien Male Patient" ] = make_list( 704, 736, 744), -- TEMP
119 ["Alien Female Patient" ] = make_list(2818, 3002, 2994), -- TEMP
120 },
121 finish_use = {
122 ["Standard Male Patient" ] = 696,
123 ["Slack Male Patient" ] = 1552,
124 ["Standard Female Patient" ] = 2834,
125 ["Slack Female Patient" ] = 2834,
126 ["Chewbacca Patient" ] = 3778,
127 ["Elvis Patient" ] = 4072,
128 ["Invisible Patient" ] = 4246,
129 ["Transparent Male Patient" ] = 4370,
130 ["Alternate Male Patient" ] = 4506,
131 ["Transparent Female Patient"] = 4826,
132 ["Alien Male Patient" ] = 696, -- TEMP
133 ["Alien Female Patient" ] = 2834, -- TEMP
134 }
135 },
136 }
137 object.orientations = {
138 north = {
139 footprint = { {0, 0, complete_cell = true}, {0, -1, only_passable = true, invisible = true, shareable = true} },
140 use_position = "passable",
141 },
142 east = {
143 footprint = { {0, 0, complete_cell = true}, {1, 0, only_passable = true, invisible = true, shareable = true} },
144 use_position = "passable",
145 },
146 south = {
147 footprint = { {0, 0, complete_cell = true}, {0, 1, only_passable = true, invisible = true, shareable = true} },
148 use_position = "passable",
149 },
150 west = {
151 footprint = { {0, 0, complete_cell = true}, {-1, 0, only_passable = true, invisible = true, shareable = true} },
152 use_position = "passable",
153 },
154 }
155
156 class "Chair" (Object)
157
158 ---@type Chair
159 local Chair = _G["Chair"]
160
161 function Chair:Chair(...)
162 self:Object(...)
163 end
164
165 --! This function is automatically called after loading a game and serves for compatibility.
166 function Chair:afterLoad(old, new)
167 if old < 119 then
168 self.footprint = object.orientations[self.direction].footprint
169 end
170 Object.afterLoad(self, old, new)
171 end
172
173 return object