Skip to content

Commit

Permalink
Hotel Rooms Fixes (ELYSIUM-SPACE#59)
Browse files Browse the repository at this point in the history
* Added separate hotel airlocks.

* Main hotel rooms fixes

1. Reworked how hotel rooms are being initialized and their components being linked in.
2. Hotel rooms airlocks were replaced with separate type, that is linked to rooms better.
  • Loading branch information
JeserTheFox authored Apr 4, 2024
1 parent 18a81a3 commit e51ac8b
Show file tree
Hide file tree
Showing 9 changed files with 63,545 additions and 2,589 deletions.
1 change: 1 addition & 0 deletions baystation12.dme
Original file line number Diff line number Diff line change
Expand Up @@ -3210,6 +3210,7 @@
#include "code_ark\code\game\machinery\lightswitch_adv.dm"
#include "code_ark\code\game\machinery\metal_detector.dm"
#include "code_ark\code\game\machinery\music_system.dm"
#include "code_ark\code\game\machinery\doors\airlock.dm"
#include "code_ark\code\game\machinery\doors\blast_door.dm"
#include "code_ark\code\game\machinery\doors\multi_tile.dm"
#include "code_ark\code\game\objects\items\buttons.dm"
Expand Down
19 changes: 19 additions & 0 deletions code_ark/code/game/machinery/doors/airlock.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
GLOBAL_LIST_EMPTY(hotel_room_airlocks)

//hotel room airlock
/obj/machinery/door/airlock/civilian/hotel
name = "\improper Room Unset"
desc = "A promising sight of comfort for a weary space traveler. It opens and closes."

/obj/machinery/door/airlock/civilian/hotel/Initialize()
. = ..()
GLOB.hotel_room_airlocks += src

/obj/machinery/door/airlock/civilian/hotel/Destroy()
for(var/datum/hotel_room/HR in GLOB.hotel_rooms)
if(HR.room_airlock == src)
HR.room_airlock = null
HR.room_test_n_update()

GLOB.hotel_room_airlocks -= src
. = ..()
20 changes: 20 additions & 0 deletions code_ark/code/game/machinery/doors/multi_tile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,23 @@

/obj/machinery/door/airlock/multi_tile/glass
opacity = 0

//hotel penthause multitile airlock
/obj/machinery/door/airlock/multi_tile/civilian/hotel
name = "\improper Penthouse Hotel Room"
desc = "A gate to a luxurious heaven. It opens and closes."

id_tag = "room_penthouse_airlock"

/obj/machinery/door/airlock/multi_tile/civilian/Initialize()
. = ..()
GLOB.hotel_room_airlocks += src

/obj/machinery/door/airlock/multi_tile/civilian/Destroy()
for(var/datum/hotel_room/HR in GLOB.hotel_rooms)
if(HR.room_airlock == src)
HR.room_airlock = null
HR.room_test_n_update()

GLOB.hotel_room_airlocks -= src
. = ..()
34 changes: 17 additions & 17 deletions code_ark/code/modules/hotel/hotel_rooms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,6 @@ GLOBAL_LIST_INIT(hotel_room_presets, list( // Make sure any rooms you've creat

GLOBAL_LIST_EMPTY(hotel_rooms)

/proc/setup_hotel_rooms()
if (!LAZYLEN(GLOB.hotel_rooms))
var/rooms_list = GLOB.hotel_room_presets
for(var/room_number in rooms_list)
var/hotel_room_preset_path = rooms_list[room_number]
GLOB.hotel_rooms += new/datum/hotel_room(room_number, hotel_room_preset_path)

// Defining room datums

/datum/hotel_room
Expand All @@ -108,33 +101,32 @@ GLOBAL_LIST_EMPTY(hotel_rooms)
var/obj/machinery/door/airlock/room_airlock

/datum/hotel_room/New(var/room_number, var/hotel_room_preset_path)
src.room_number = room_number
room_number = room_number
if(ispath(hotel_room_preset_path, /hotel_room_preset))
var/hotel_room_preset/hotel_room_preset = decls_repository.get_decl(hotel_room_preset_path)
src.bed_count = hotel_room_preset.bed_count
bed_count = hotel_room_preset.bed_count
if(hotel_room_preset.guest_count)
src.guest_count = hotel_room_preset.guest_count
guest_count = hotel_room_preset.guest_count
else
src.guest_count = hotel_room_preset.bed_count
src.hourly_price = hotel_room_preset.hourly_price
src.special_room = hotel_room_preset.special_room
guest_count = hotel_room_preset.bed_count
hourly_price = hotel_room_preset.hourly_price
special_room = hotel_room_preset.special_room

for(var/obj/machinery/hotel_room_sign/S in world)
for(var/obj/machinery/hotel_room_sign/S in GLOB.hotel_room_signs)
if (S.id_tag == "room_[room_number]_sign")
room_sign = S
break
if(!room_sign)
crash_with("Hotel room ([room_number]) is unable to find its sign!")

for(var/obj/machinery/hotel_room_controller/C in world)
for(var/obj/machinery/hotel_room_controller/C in GLOB.hotel_room_controllers)
if (C.id_tag == "room_[room_number]_controller")
room_controller = C
room_controller.hotel_room = src
break
if(!room_controller)
crash_with("Hotel room ([room_number]) is unable to find its controller!")

for(var/obj/machinery/door/airlock/A in world)
for(var/obj/machinery/door/airlock/A in GLOB.hotel_room_airlocks)
if (A.id_tag == "room_[room_number]_airlock")
room_airlock = A
break
Expand Down Expand Up @@ -182,6 +174,14 @@ GLOBAL_LIST_EMPTY(hotel_rooms)
else
return 1

/datum/hotel_room/Destroy()
if(room_controller)
room_controller.hotel_room = null
if(room_controller)
room_sign.hotel_room = null

. = ..()

// SUPPORT PROCS

/datum/hotel_room/proc/room_guests2text()
Expand Down
15 changes: 13 additions & 2 deletions code_ark/code/modules/hotel/reservation_computers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,25 @@
/obj/machinery/hotel_terminal/Initialize()
. = ..()
update_icon()
setup_hotel_rooms()

/obj/machinery/hotel_terminal/LateInitialize()
setup_hotel_rooms()

/obj/machinery/hotel_terminal/Destroy()
if(master_program)
master_program.connected_terminal = null
. = ..()

/obj/machinery/hotel_terminal/proc/setup_hotel_rooms()
if (!LAZYLEN(GLOB.hotel_rooms))
var/rooms_list = GLOB.hotel_room_presets
for(var/room_number in rooms_list)
var/hotel_room_preset_path = rooms_list[room_number]
var/datum/hotel_room/HR = new(room_number, hotel_room_preset_path)
GLOB.hotel_rooms += HR
HR.room_sign.update_icon()
HR.room_controller.update_icon()

/obj/machinery/hotel_terminal/attackby(obj/item/W, mob/user)
var/obj/item/card/id/I = W.GetIdCard()

Expand Down Expand Up @@ -364,4 +375,4 @@
key_created.expiration_time = room_for_cards.room_end_time2text()
room_for_cards.room_keys += key_created

key_created.pixel_x = 10
key_created.pixel_x = 10
6 changes: 5 additions & 1 deletion code_ark/code/modules/hotel/room_controllers.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
GLOBAL_LIST_EMPTY(hotel_room_controllers)

/obj/machinery/hotel_room_controller
name = "hotel room controller"
desc = "It's a small wall screen with various functions to improve the guests' experience."
Expand All @@ -14,11 +16,13 @@
/obj/machinery/hotel_room_controller/Initialize()
. = ..()
update_icon()
GLOB.hotel_room_controllers += src

/obj/machinery/hotel_room_controller/Destroy()
if(hotel_room)
hotel_room.room_controller = null
hotel_room.room_test_n_update()
GLOB.hotel_room_controllers -= src
. = ..()

/obj/machinery/hotel_room_controller/power_change()
Expand Down Expand Up @@ -73,4 +77,4 @@
ui = new(user, src, ui_key, "hotel__room_controller.tmpl", "Room [hotel_room.room_number] Controller", 390, 500)
ui.set_initial_data(data)
ui.open()
ui.set_auto_update(1)
ui.set_auto_update(1)
13 changes: 9 additions & 4 deletions code_ark/code/modules/hotel/room_signs.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
GLOBAL_LIST_EMPTY(hotel_room_signs)

/obj/machinery/hotel_room_sign
name = "room sign"
desc = "This sign indicates the room number. Yellow color indicates that room cleaning is required, while red stands for 'do not disturb'."
Expand All @@ -12,17 +14,20 @@

/obj/machinery/hotel_room_sign/Initialize()
. = ..()
GLOB.hotel_room_signs += src
update_icon()

/obj/machinery/hotel_room_sign/Destroy()
hotel_room.room_sign = null
hotel_room.room_test_n_update()
if(hotel_room)
hotel_room.room_sign = null
hotel_room.room_test_n_update()
GLOB.hotel_room_signs -= src
. = ..()

/obj/machinery/hotel_room_sign/on_update_icon()
overlays.Cut()
var/image/I = image(icon, icon_state)
if((stat & NOPOWER) || hotel_room.room_status == 0)
if((stat & NOPOWER) || !hotel_room || hotel_room.room_status == 0)
I.color = "#999999"
set_light(0)
overlays += I
Expand Down Expand Up @@ -76,4 +81,4 @@

/obj/machinery/hotel_room_sign/penthouse
icon_state = "penthouse"
id_tag = "room_Penthouse_sign"
id_tag = "room_Penthouse_sign"
Loading

0 comments on commit e51ac8b

Please sign in to comment.