Debian Codegraph @

CorsixTH/Lua/objects/machines/operating_table.lua

raw
1 --[[ Copyright (c) 2010 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 = "operating_table"
23 object.slave_id = "operating_table_b"
24 object.class = "OperatingTable"
25 object.thob = 30
26 object.research_category = "cure"
27 object.research_fallback = 19 -- Kidney beans
28 object.name = _S.object.operating_table
29 object.tooltip = _S.tooltip.objects.operating_table
30 object.ticks = false
31 object.build_preview_animation = 5080
32 object.default_strength = 8
33 object.crashed_animation = 3392
34 object.show_in_town_map = true
35 object.smoke_animation = 3472
36 local function copy_north_to_south(t)
37 t.south = t.north
38 return t
39 end
40 object.idle_animations = copy_north_to_south {
41 north = 2314,
42 }
43 object.usage_animations = copy_north_to_south {
44 north = {
45 in_use = {
46 Handyman = 660,
47 },
48 },
49 }
50 object.multi_usage_animations = {
51 ["Surgeon - Gowned Male Patient"] = copy_north_to_south {
52 north = {
53 begin_use = 2318,
54 begin_use_2 = 2322,
55 in_use = 2348,
56 finish_use = 2346,
57 finish_use_2 = 2338,
58 secondary = {
59 begin_use = 416,
60 finish_use_2 = 416,
61 },
62 },
63 },
64 ["Surgeon - Gowned Female Patient"] = copy_north_to_south {
65 north = {
66 begin_use = 2318,
67 begin_use_2 = 2932,
68 in_use = 2938,
69 finish_use = 2936,
70 finish_use_2 = 2338,
71 secondary = {
72 begin_use = 2886,
73 finish_use_2 = 2886,
74 },
75 },
76 },
77 }
78
79 local anim_mgr = TheApp.animation_manager
80 -- Slight hack: there seems to be no animation for a patient just lying on the
81 -- table, so we take a duplicate of the animation for the patient leaving the
82 -- table, and force its length to be 1, hence causing just the first frame to
83 -- be used.
84 anim_mgr:setAnimLength(2348, 1)
85 anim_mgr:setAnimLength(2938, 1)
86
87 -- Mood icon positions
88 anim_mgr:setPatientMarker(object.idle_animations.north, {-1.59, -2.41})
89 anim_mgr:setStaffMarker({2318, 2322, 2348, 2346, 2338, 2318, 2932, 2938, 2936, 2238}, {-1, -2})
90
91 anim_mgr:setStaffMarker(object.usage_animations.north.in_use.Handyman, {29, -52, "px"})
92
93
94 object.orientations = {
95 north = {
96 use_position = {-1, -2},
97 use_position_secondary = {-2, -1},
98 footprint = {
99 {-2, -1, only_passable = true},
100 {-1, -1, complete_cell = true}, {-1, -2, only_passable = true},
101 {0, -1, complete_cell = true}, {0, -2, complete_cell = true},
102 {1, 0, complete_cell = true}, {1, -2, complete_cell = true}, {1, -1, only_passable = true},
103 },
104 render_attach_position = {0, -1},
105 slave_position = {1, -1},
106 smoke_position = {0, 0},
107 },
108 east = {
109 use_position = {-2, -1},
110 use_position_secondary = {-1, -2},
111 footprint = {
112 {-1, -2, only_passable = true},
113 {-1, -1, complete_cell = true}, {-2, -1, only_passable = true},
114 {-1, 0, complete_cell = true}, {-2, 0, complete_cell = true},
115 {0, 1, complete_cell = true}, {-2, 1, complete_cell = true}, {-1, 1, only_passable = true}, {0, 0}
116 },
117 slave_position = {-1, 1},
118 render_attach_position = {-1, 0},
119 smoke_position = {0, 0},
120 },
121 }
122
123 class "OperatingTable" (Machine)
124
125 ---@type OperatingTable
126 local OperatingTable = _G["OperatingTable"]
127
128 OperatingTable:slaveMixinClass()
129
130 function OperatingTable:machineUsed(...)
131 -- Only if the table is the primary/master of the pair
132 if not self.master then
133 return Machine.machineUsed(self, ...)
134 end
135 end
136
137 return object