Debian Codegraph @

CorsixTH/Lua/rooms/slack_tongue.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 room = {}
22 room.id = "slack_tongue"
23 room.vip_must_visit = false
24 room.level_config_id = 20
25 room.class = "SlackTongueRoom"
26 room.name = _S.rooms_short.tongue_clinic
27 room.long_name = _S.rooms_long.tongue_clinic
28 room.tooltip = _S.tooltip.rooms.tongue_clinic
29 room.objects_additional = { "extinguisher", "radiator", "plant", "bin" }
30 room.objects_needed = { slicer = 1 }
31 room.build_preview_animation = 932
32 room.categories = {
33 clinics = 2,
34 }
35 room.minimum_size = 4
36 room.wall_type = "blue"
37 room.floor_tile = 17
38 room.required_staff = {
39 Doctor = 1,
40 }
41 room.maximum_staff = room.required_staff
42 room.call_sound = "reqd005.wav"
43 room.handyman_call_sound = "maint004.wav"
44
45 class "SlackTongueRoom" (Room)
46
47 ---@type SlackTongueRoom
48 local SlackTongueRoom = _G["SlackTongueRoom"]
49
50 function SlackTongueRoom:SlackTongueRoom(...)
51 self:Room(...)
52 end
53
54 function SlackTongueRoom:commandEnteringPatient(patient)
55 local staff = self.staff_member
56 local slicer, pat_x, pat_y = self.world:findObjectNear(patient, "slicer")
57 local stf_x, stf_y = slicer:getSecondaryUsageTile()
58
59 staff:setNextAction(WalkAction(stf_x, stf_y))
60 staff:queueAction(IdleAction():setDirection(slicer.direction == "north" and "east" or "south"))
61
62 patient:setNextAction(WalkAction(pat_x, pat_y))
63
64 local after_use_slack_tongue = --[[persistable:slack_tongue_after_use]] function()
65 if patient:isType("Slack Male Patient") then
66 patient:setType "Standard Male Patient" -- Change to normal head
67 else
68 patient:setLayer(0, patient.layers[0] - 8) -- Change to normal head
69 end
70 -- if no other actions for staff member meander in room
71 if #staff.action_queue == 1 then
72 staff:setNextAction(MeanderAction())
73 else
74 staff:finishAction(staff:getCurrentAction())
75 end
76 self:dealtWithPatient(patient)
77 end
78
79 patient:queueAction(MultiUseObjectAction(slicer, staff):setAfterUse(after_use_slack_tongue))
80 return Room.commandEnteringPatient(self, patient)
81 end
82
83 return room