Debian Codegraph @

CorsixTH/Lua/rooms/staff_room.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 room = {}
22 room.id = "staff_room"
23 room.vip_must_visit = false
24 room.level_config_id = 25
25 room.class = "StaffRoom"
26 room.name = _S.rooms_short.staffroom
27 room.long_name = _S.rooms_long.staffroom
28 room.tooltip = _S.tooltip.rooms.staffroom
29 room.objects_additional = { "extinguisher", "radiator", "plant", "sofa", "pool_table", "tv", "video_game" }
30 room.objects_needed = { sofa = 1 }
31 room.build_preview_animation = 5066
32 room.categories = {
33 facilities = 1,
34 }
35 room.minimum_size = 4
36 room.wall_type = "green"
37 room.floor_tile = 17
38 room.has_no_queue_dialog = true
39
40 class "StaffRoom" (Room)
41
42 ---@type StaffRoom
43 local StaffRoom = _G["StaffRoom"]
44
45 function StaffRoom:StaffRoom(...)
46 self:Room(...)
47 end
48
49 function StaffRoom:onHumanoidEnter(humanoid)
50 self.humanoids[humanoid] = true
51 self:tryAdvanceQueue()
52 humanoid:setDynamicInfoText("")
53 -- Other humanoids shouldn't be entering, so don't worry about them
54 if class.is(humanoid, Staff) then
55 -- Receptionists cannot enter, so we do not have to worry about them
56 -- If it is a handyman and he is here to do a job, let him pass
57 if not humanoid.on_call then
58 humanoid:setNextAction(UseStaffRoomAction())
59 self.door.queue.visitor_count = self.door.queue.visitor_count + 1
60 end
61 end
62 end
63
64 function StaffRoom:testStaffCriteria(criteria, extra_humanoid)
65 -- The staff room always accept more tired staff members.
66 if extra_humanoid then
67 return true
68 else
69 return false
70 end
71 end
72
73 return room