mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
Fixes occasional issue with req_(one_)access being null.
Refactors the code a bit as well.
This commit is contained in:
@@ -110,23 +110,11 @@
|
||||
return null
|
||||
|
||||
/obj/proc/check_access(obj/item/I)
|
||||
if(!(!req_access || req_access.len) && !(req_one_access || req_one_access.len)) //no requirements
|
||||
return 1
|
||||
if(!I)
|
||||
return 0
|
||||
for(var/req in src.req_access)
|
||||
if(!(req in I.GetAccess())) //doesn't have this access
|
||||
return 0
|
||||
if(src.req_one_access.len)
|
||||
for(var/req in src.req_one_access)
|
||||
if(req in I.GetAccess()) //has an access from the single access list
|
||||
return 1
|
||||
return 0
|
||||
return 1
|
||||
|
||||
return check_access_list(I ? I.GetAccess() : list())
|
||||
|
||||
/obj/proc/check_access_list(var/list/L)
|
||||
if(!src.req_access.len && !src.req_one_access.len) return 1
|
||||
if(!req_access) req_access = list()
|
||||
if(!req_one_access) req_one_access = list()
|
||||
if(!L) return 0
|
||||
if(!istype(L, /list)) return 0
|
||||
for(var/req in src.req_access)
|
||||
|
||||
Reference in New Issue
Block a user