mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-20 04:26:03 +01:00
Completely Culls req_access_txt/req_one_access_txt (#72281)
Hey there, Now that every instance of `req_access` and `req_one_access` is a list of strings, there is absolutely no reason for req_access_txt/req_access_one_txt to exist. In fact, any instance where they were still used in the codebase was very convoluted and was very broken! Don't worry, I fixed it all out, and life is good. I also dmdoc the surviving access variables, because those were missing. I went on the side of caution and made a more verbose documentation with an example just to have people really grasp this (it took me a while to actually get it) I believe that we changed _everything_ over to the req_access/req_one_access system earlier this year in VV, but the problem is that _new mappers don't understand the difference between the two systems_. In fact, the "txt" system is completely redundant since all it does is transition stuff to the "base" system. So, let's just completely cull the one that's all but deprecated and ensure this confusion no longer arises. The whole purpose of "txt" seemed to be to convert the access, but it's all pointless now that we can just read the list directly. I'm also 99% certain that the "access check" on vending machines broke (and didn't seem to have correct logic in the first place? I legitimately couldn't find a case where it could fail in testing, so I changed that up), and that's fixed up now. Let me know if I was clueless there. I know it's short-circuiting now as opposed to "all must be true", but it just didn't work.
This commit is contained in:
@@ -46455,7 +46455,7 @@
|
||||
/obj/machinery/door/window/right/directional/south{
|
||||
dir = 8;
|
||||
name = "Jim Norton's Quebecois Coffee";
|
||||
req_one_access_txt = list("service","maint_tunnels")
|
||||
req_one_access = list("service","maint_tunnels")
|
||||
},
|
||||
/obj/effect/turf_decal/trimline/green/line,
|
||||
/turf/open/floor/iron/dark,
|
||||
@@ -50123,7 +50123,7 @@
|
||||
/obj/machinery/button/door{
|
||||
id = "ordnancebridge";
|
||||
pixel_x = -24;
|
||||
req_one_access_txt = list("maint_tunnels","science")
|
||||
req_one_access = list("maint_tunnels","science")
|
||||
},
|
||||
/obj/effect/turf_decal/caution/stand_clear{
|
||||
dir = 1
|
||||
@@ -50356,7 +50356,7 @@
|
||||
/obj/machinery/button/door{
|
||||
id = "ordnancebridge";
|
||||
pixel_y = 24;
|
||||
req_one_access_txt = list("maint_tunnels","science")
|
||||
req_one_access = list("maint_tunnels","science")
|
||||
},
|
||||
/obj/effect/turf_decal/caution/stand_clear{
|
||||
dir = 4
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
/obj/effect/turf_decal/delivery/red,
|
||||
/obj/item/key/security,
|
||||
/obj/machinery/door/window/left/directional/north{
|
||||
req_access_txt = "security";
|
||||
req_access = list("security");
|
||||
name = "Secway Storage"
|
||||
},
|
||||
/turf/open/floor/iron/smooth,
|
||||
|
||||
@@ -352,7 +352,7 @@
|
||||
/obj/item/key/security,
|
||||
/obj/machinery/door/window/left/directional/north{
|
||||
name = "Secway Storage";
|
||||
req_access_txt = "security"
|
||||
req_access = list("security")
|
||||
},
|
||||
/turf/open/floor/iron/smooth,
|
||||
/area/station/maintenance/department/security)
|
||||
|
||||
@@ -39,9 +39,9 @@
|
||||
|
||||
src.check_access(null)
|
||||
|
||||
if(req_access.len || req_one_access.len)
|
||||
if(length(req_access) || length(req_one_access))
|
||||
board = new(src)
|
||||
if(req_access.len)
|
||||
if(length(req_access))
|
||||
board.accesses = req_access
|
||||
else
|
||||
board.one_access = 1
|
||||
|
||||
@@ -1364,7 +1364,6 @@
|
||||
var/obj/item/electronics/airlock/ae
|
||||
if(!electronics)
|
||||
ae = new/obj/item/electronics/airlock(loc)
|
||||
gen_access()
|
||||
if(length(req_one_access))
|
||||
ae.one_access = 1
|
||||
ae.accesses = req_one_access
|
||||
|
||||
@@ -335,7 +335,7 @@
|
||||
|
||||
/obj/machinery/door/airlock/external/Initialize(mapload, ...)
|
||||
// default setting is for mapping only, let overrides work
|
||||
if(!mapload || req_access_txt || req_one_access_txt)
|
||||
if(!mapload)
|
||||
req_access = null
|
||||
|
||||
return ..()
|
||||
|
||||
@@ -28,10 +28,13 @@
|
||||
var/infinite_reskin = FALSE
|
||||
|
||||
// Access levels, used in modules\jobs\access.dm
|
||||
/// List of accesses needed to use this object: The user must possess all accesses in this list in order to use the object.
|
||||
/// Example: If req_access = list(ACCESS_ENGINE, ACCESS_CE)- then the user must have both ACCESS_ENGINE and ACCESS_CE in order to use the object.
|
||||
var/list/req_access
|
||||
var/req_access_txt = "0"
|
||||
/// List of accesses needed to use this object: The user must possess at least one access in this list in order to use the object.
|
||||
/// Example: If req_one_access = list(ACCESS_ENGINE, ACCESS_CE)- then the user must have either ACCESS_ENGINE or ACCESS_CE in order to use the object.
|
||||
var/list/req_one_access
|
||||
var/req_one_access_txt = "0"
|
||||
|
||||
/// Custom fire overlay icon
|
||||
var/custom_fire_overlay
|
||||
|
||||
|
||||
@@ -490,7 +490,6 @@
|
||||
var/obj/item/electronics/airlock/electronics_ref
|
||||
if (!electronics)
|
||||
electronics_ref = new /obj/item/electronics/airlock(loc)
|
||||
gen_access()
|
||||
if (req_one_access.len)
|
||||
electronics_ref.one_access = 1
|
||||
electronics_ref.accesses = req_one_access
|
||||
|
||||
@@ -53,35 +53,11 @@
|
||||
/obj/item/proc/InsertID()
|
||||
return FALSE
|
||||
|
||||
/obj/proc/text2access(access_text)
|
||||
. = list()
|
||||
if(!access_text)
|
||||
return
|
||||
var/list/split = splittext(access_text,";")
|
||||
for(var/x in split)
|
||||
var/n = text2num(x)
|
||||
if(n)
|
||||
. += n
|
||||
|
||||
//Call this before using req_access or req_one_access directly
|
||||
/obj/proc/gen_access()
|
||||
//These generations have been moved out of /obj/New() because they were slowing down the creation of objects that never even used the access system.
|
||||
if(!req_access)
|
||||
req_access = list()
|
||||
for(var/a in text2access(req_access_txt))
|
||||
req_access += a
|
||||
if(!req_one_access)
|
||||
req_one_access = list()
|
||||
for(var/b in text2access(req_one_access_txt))
|
||||
req_one_access += b
|
||||
|
||||
// Check if an item has access to this object
|
||||
/obj/proc/check_access(obj/item/I)
|
||||
return check_access_list(I ? I.GetAccess() : null)
|
||||
|
||||
/obj/proc/check_access_list(list/access_list)
|
||||
gen_access()
|
||||
|
||||
if(!islist(req_access)) //something's very wrong
|
||||
return TRUE
|
||||
|
||||
|
||||
@@ -169,10 +169,6 @@
|
||||
///A variable to change on a per instance basis on the map that allows the instance to force cost and ID requirements
|
||||
var/onstation_override = FALSE //change this on the object on the map to override the onstation check. DO NOT APPLY THIS GLOBALLY.
|
||||
|
||||
///ID's that can load this vending machine wtih refills
|
||||
var/list/canload_access_list
|
||||
|
||||
|
||||
var/list/vending_machine_input = list()
|
||||
///Display header on the input view
|
||||
var/input_display_header = "Custom Vendor"
|
||||
@@ -806,30 +802,17 @@
|
||||
. = ..()
|
||||
|
||||
/**
|
||||
* Is the passed in user allowed to load this vending machines compartments
|
||||
* Is the passed in user allowed to load this vending machines compartments? This only is ran if we are using a /obj/item/storage/bag to load the vending machine, and not a dedicated restocker.
|
||||
*
|
||||
* Arguments:
|
||||
* * user - mob that is doing the loading of the vending machine
|
||||
*/
|
||||
/obj/machinery/vending/proc/compartmentLoadAccessCheck(mob/user)
|
||||
if(!canload_access_list)
|
||||
if(!req_access || allowed(user) || (obj_flags & EMAGGED) || !scan_id)
|
||||
return TRUE
|
||||
else
|
||||
var/do_you_have_access = FALSE
|
||||
var/req_access_txt_holder = req_access_txt
|
||||
for(var/i in canload_access_list)
|
||||
req_access_txt = i
|
||||
if(!allowed(user) && !(obj_flags & EMAGGED) && scan_id)
|
||||
continue
|
||||
else
|
||||
do_you_have_access = TRUE
|
||||
break //you passed don't bother looping anymore
|
||||
req_access_txt = req_access_txt_holder // revert to normal (before the proc ran)
|
||||
if(do_you_have_access)
|
||||
return TRUE
|
||||
else
|
||||
to_chat(user, span_warning("[src]'s input compartment blinks red: Access denied."))
|
||||
return FALSE
|
||||
|
||||
to_chat(user, span_warning("[src]'s input compartment blinks red: Access denied."))
|
||||
return FALSE
|
||||
|
||||
/obj/machinery/vending/exchange_parts(mob/user, obj/item/storage/part_replacer/W)
|
||||
if(!istype(W))
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
/obj/item/food/pistachios = 3,
|
||||
)
|
||||
refill_canister = /obj/item/vending_refill/snack
|
||||
canload_access_list = list(ACCESS_KITCHEN)
|
||||
req_access = list(ACCESS_KITCHEN)
|
||||
default_price = PAYCHECK_CREW * 0.6
|
||||
extra_price = PAYCHECK_CREW
|
||||
payment_department = ACCOUNT_SRV
|
||||
|
||||
@@ -16,10 +16,6 @@
|
||||
"id-card" = "access",
|
||||
)
|
||||
|
||||
/obj/item/circuit_component/compare/access/Initialize(mapload)
|
||||
. = ..()
|
||||
gen_access()
|
||||
|
||||
/obj/item/circuit_component/compare/access/get_ui_notices()
|
||||
. = ..()
|
||||
. += create_ui_notice("When \"Check Any\" is true, returns true if \"Access To Check\" contains ANY value in \"Required Access\".", "orange", "info")
|
||||
|
||||
Reference in New Issue
Block a user