From fc73fe2b3cc69c21c8b496c7453d6e2122dc7831 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E6=9C=88=E7=8C=AB?= Date: Sat, 2 Jan 2021 20:38:10 -0500 Subject: [PATCH] Mechanical Curtains (#55751) good for better mapping, I have seen some mappers wish to utilize fancy curtains on their rooms windows (for example, a psychologist office) but wanted to be able to have privacy when with a patient, which curtains can be opened from either side of the window, and shutters just dont fit the theme, this way mappers can add in curtains which are button operated and cant be opened manually, basically, it functions like a shutter, only it looks and acts like curtains (can be destroyed like one, etc... it is literally a curtain subtype) --- code/_globalvars/lists/objects.dm | 1 + code/game/machinery/buttons.dm | 7 +++++ code/game/objects/structures/watercloset.dm | 32 +++++++++++++++++++++ code/modules/assembly/doorcontrol.dm | 21 ++++++++++++++ 4 files changed, 61 insertions(+) diff --git a/code/_globalvars/lists/objects.dm b/code/_globalvars/lists/objects.dm index cf291490aa5..a4519f592fb 100644 --- a/code/_globalvars/lists/objects.dm +++ b/code/_globalvars/lists/objects.dm @@ -1,6 +1,7 @@ GLOBAL_LIST_EMPTY(cable_list) //Index for all cables, so that powernets don't have to look through the entire world all the time GLOBAL_LIST_EMPTY(portals) //list of all /obj/effect/portal GLOBAL_LIST_EMPTY(airlocks) //list of all airlocks +GLOBAL_LIST_EMPTY(curtains) //list of all curtains GLOBAL_LIST_EMPTY(mechas_list) //list of all mechs. Used by hostile mobs target tracking. GLOBAL_LIST_EMPTY(shuttle_caller_list) //list of all communication consoles and AIs, for automatic shuttle calls when there are none. GLOBAL_LIST_EMPTY(machines) //NOTE: this is a list of ALL machines now. The processing machines list is SSmachine.processing ! diff --git a/code/game/machinery/buttons.dm b/code/game/machinery/buttons.dm index e27586ac19f..916fc9ebbcf 100644 --- a/code/game/machinery/buttons.dm +++ b/code/game/machinery/buttons.dm @@ -277,6 +277,13 @@ skin = "launcher" device_type = /obj/item/assembly/control/flasher +/obj/machinery/button/curtain + name = "curtain button" + desc = "A remote control switch for a mechanical curtain." + icon_state = "launcher" + skin = "launcher" + device_type = /obj/item/assembly/control/curtain + /obj/machinery/button/flasher/indestructible resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF diff --git a/code/game/objects/structures/watercloset.dm b/code/game/objects/structures/watercloset.dm index 3d9cc37a948..5df4317db8f 100644 --- a/code/game/objects/structures/watercloset.dm +++ b/code/game/objects/structures/watercloset.dm @@ -708,3 +708,35 @@ /obj/structure/curtain/cloth/fancy icon_type = "cur_fancy" icon_state = "cur_fancy-open" + +/obj/structure/curtain/cloth/fancy/mechanical + var/id = null + +/obj/structure/curtain/cloth/fancy/mechanical/Destroy() + GLOB.curtains -= src + return ..() + +/obj/structure/curtain/cloth/fancy/mechanical/Initialize() + . = ..() + GLOB.curtains += src + +/obj/structure/curtain/cloth/fancy/mechanical/connect_to_shuttle(obj/docking_port/mobile/port, obj/docking_port/stationary/dock) + id = "[port.id]_[id]" + +/obj/structure/curtain/cloth/fancy/mechanical/proc/open() + icon_state = "[icon_type]-open" + layer = SIGN_LAYER + density = FALSE + open = TRUE + set_opacity(FALSE) + +/obj/structure/curtain/cloth/fancy/mechanical/proc/close() + icon_state = "[icon_type]-closed" + layer = WALL_OBJ_LAYER + density = TRUE + open = FALSE + if(opaque_closed) + set_opacity(TRUE) + +/obj/structure/curtain/cloth/fancy/mechanical/attack_hand(mob/user) + return diff --git a/code/modules/assembly/doorcontrol.dm b/code/modules/assembly/doorcontrol.dm index f1eb58b0ade..e1e813c5ff6 100644 --- a/code/modules/assembly/doorcontrol.dm +++ b/code/modules/assembly/doorcontrol.dm @@ -25,6 +25,27 @@ INVOKE_ASYNC(M, openclose ? /obj/machinery/door/poddoor.proc/open : /obj/machinery/door/poddoor.proc/close) addtimer(VARSET_CALLBACK(src, cooldown, FALSE), 10) +/obj/item/assembly/control/curtain + name = "curtain controller" + desc = "A small electronic device able to control a mechanical curtain remotely." + +/obj/item/assembly/control/curtain/examine(mob/user) + . = ..() + if(id) + . += "Its channel ID is '[id]'." + +/obj/item/assembly/control/curtain/activate() + var/openclose + if(cooldown) + return + cooldown = TRUE + for(var/obj/structure/curtain/cloth/fancy/mechanical/M in GLOB.curtains) + if(M.id == src.id) + if(openclose == null || !sync_doors) + openclose = M.density + INVOKE_ASYNC(M, openclose ? /obj/structure/curtain/cloth/fancy/mechanical.proc/open : /obj/structure/curtain/cloth/fancy/mechanical.proc/close) + addtimer(VARSET_CALLBACK(src, cooldown, FALSE), 5) + /obj/item/assembly/control/airlock name = "airlock controller"