From dede4f9376ba3ddd2f0699502332ffd2a98ded89 Mon Sep 17 00:00:00 2001
From: Arkatos1 <43862960+Arkatos1@users.noreply.github.com>
Date: Sat, 25 Apr 2020 10:13:19 +0200
Subject: [PATCH] tgui: RCD Access Control (#50600)
* First version
* Integrated electronics version
* Access Control naming
---
.../machinery/doors/airlock_electronics.dm | 14 +++-
code/game/objects/items/RCD.dm | 82 ++-----------------
code/game/turfs/open/floor.dm | 14 ++--
3 files changed, 25 insertions(+), 85 deletions(-)
diff --git a/code/game/machinery/doors/airlock_electronics.dm b/code/game/machinery/doors/airlock_electronics.dm
index 6d4e055bbd5..ae8a069b332 100644
--- a/code/game/machinery/doors/airlock_electronics.dm
+++ b/code/game/machinery/doors/airlock_electronics.dm
@@ -2,10 +2,14 @@
name = "airlock electronics"
req_access = list(ACCESS_MAINT_TUNNELS)
custom_price = 50
-
+ /// A list of all granted accesses
var/list/accesses = list()
+ /// If the airlock should require ALL or only ONE of the listed accesses
var/one_access = 0
- var/unres_sides = 0 //unrestricted sides, or sides of the airlock that will open regardless of access
+ /// Unrestricted sides, or sides of the airlock that will open regardless of access
+ var/unres_sides = 0
+ /// A holder of the electronics, in case of them working as an integrated part
+ var/holder
/obj/item/electronics/airlock/examine(mob/user)
. = ..()
@@ -44,7 +48,6 @@
data["accesses"] = accesses
data["oneAccess"] = one_access
data["unres_direction"] = unres_sides
-
return data
/obj/item/electronics/airlock/ui_act(action, params)
@@ -84,3 +87,8 @@
return
accesses -= get_region_accesses(region)
. = TRUE
+
+/obj/item/electronics/airlock/ui_host()
+ if(holder)
+ return holder
+ return src
diff --git a/code/game/objects/items/RCD.dm b/code/game/objects/items/RCD.dm
index 5c0d8f57e4f..3f0288e88ef 100644
--- a/code/game/objects/items/RCD.dm
+++ b/code/game/objects/items/RCD.dm
@@ -202,10 +202,10 @@ RLD
var/airlock_glass = FALSE // So the floor's rcd_act knows how much ammo to use
var/window_type = /obj/structure/window/fulltile
var/advanced_airlock_setting = 1 //Set to 1 if you want more paintjobs available
- var/list/conf_access = null
- var/use_one_access = 0 //If the airlock should require ALL or only ONE of the listed accesses.
var/delay_mod = 1
var/canRturf = FALSE //Variable for R walls to deconstruct them
+ /// Integrated airlock electronics for setting access to a newly built airlocks
+ var/obj/item/electronics/airlock/airlock_electronics
/obj/item/construction/rcd/suicide_act(mob/user)
user.visible_message("[user] sets the RCD to 'Wall' and points it down [user.p_their()] throat! It looks like [user.p_theyre()] trying to commit suicide..")
@@ -242,78 +242,6 @@ RLD
else
to_chat(user, "\the [src] dont have remote storage connection.")
-
-/obj/item/construction/rcd/proc/change_airlock_access(mob/user)
- if (!ishuman(user) && !user.has_unlimited_silicon_privilege)
- return
-
- var/t1 = ""
-
- if(use_one_access)
- t1 += "Restriction Type: At least one access required
"
- else
- t1 += "Restriction Type: All accesses required
"
-
- t1 += "Remove All
"
-
- var/accesses = ""
- accesses += "
| [get_region_accesses_name(i)]: | " - accesses += "
| "
- for(var/A in get_region_accesses(i))
- if(A in conf_access)
- accesses += "[replacetext(get_access_desc(A), " ", " ")] "
- else
- accesses += "[replacetext(get_access_desc(A), " ", " ")] "
- accesses += " " - accesses += " | "
- accesses += "