From 44135180f99d69947441cacf7c205c45d22180da Mon Sep 17 00:00:00 2001 From: n3ophyt3 Date: Tue, 1 Nov 2011 18:17:22 +0000 Subject: [PATCH] MAPPERS, TAKE NOTE Improved my access change from last commit. In addition to req_access_txt, there is now req_one_access_txt. As long as an ID has at least one access from the new list, it is able to open the airlock (assuming any access in the other list is also satisfied). So, for instance, if you left req_access_txt blank, and put access_honk and access_silent into req_one_access_txt, the mime AND the clown would be able to open the airlock. Fixed the advanced energy gun checking for failure constantly instead of only when recharging, and thus breaking stupidly quickly. Stop breaking my stuff, other coders. >:C git-svn-id: http://tgstation13.googlecode.com/svn/trunk@2473 316c924e-a436-60f5-8080-3fe189b3f50e --- code/game/jobs/access.dm | 36 ++++++++++++++----- code/modules/admin/admin.dm | 8 +++-- .../projectiles/guns/energy/nuclear.dm | 9 ++--- 3 files changed, 37 insertions(+), 16 deletions(-) diff --git a/code/game/jobs/access.dm b/code/game/jobs/access.dm index 9f3eeee44a7..c9770ba2529 100644 --- a/code/game/jobs/access.dm +++ b/code/game/jobs/access.dm @@ -80,7 +80,9 @@ /obj/var/list/req_access = null /obj/var/req_access_txt = "0" -/obj/var/req_all_accesses = 1 +/obj/var/list/req_one_access = null +/obj/var/req_one_access_txt = "0" + /obj/New() //NOTE: If a room requires more than one access (IE: Morgue + medbay) set the req_acesss_txt to "5;6" if it requires 5 and 6 if(src.req_access_txt) @@ -91,6 +93,16 @@ var/n = text2num(x) if(n) req_access += n + + if(src.req_one_access_txt) + var/list/req_one_access_str = dd_text2list(req_one_access_txt,";") + if(!req_one_access) + req_one_access = list() + for(var/x in req_one_access_str) + var/n = text2num(x) + if(n) + req_one_access += n + ..() //returns 1 if this mob has sufficient access to use this object @@ -119,35 +131,41 @@ var/obj/item/device/pda/pda = I I = pda.id - if(!src.req_access) //no requirements + if(!src.req_access && !src.req_one_access) //no requirements return 1 if(!istype(src.req_access, /list)) //something's very wrong return 1 var/list/L = src.req_access - if(!L.len) //no requirements + if(!L.len && (!src.req_one_access || !src.req_one_access.len)) //no requirements return 1 if(!I || !istype(I, /obj/item/weapon/card/id) || !I.access) //not ID or no access return 0 for(var/req in src.req_access) - if((req in L) && !src.req_all_accesses) - return 1 //If the object only requires one of the accesses, let it pass after a match. if(!(req in I.access)) //doesn't have this access return 0 + if(src.req_one_access && src.req_one_access.len) + for(var/req in src.req_one_access) + if(req in I.access) //has an access from the single access list + return 1 + return 0 return 1 /obj/proc/check_access_list(var/list/L) - if(!src.req_access) return 1 + if(!src.req_access && !src.req_one_access) return 1 if(!istype(src.req_access, /list)) return 1 - if(!src.req_access.len) return 1 + if(!src.req_access.len && (!src.req_one_access || !src.req_one_access.len)) return 1 if(!L) return 0 if(!istype(L, /list)) return 0 for(var/req in src.req_access) - if((req in L) && !src.req_all_accesses) - return 1 //If the object only requires one of the accesses, let it pass after a match. if(!(req in L)) //doesn't have this access return 0 + if(src.req_one_access && src.req_one_access.len) + for(var/req in src.req_one_access) + if(req in L) //has an access from the single access list + return 1 + return 0 return 1 diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index 8dcefaee89f..d4abbad10aa 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -1650,12 +1650,14 @@ usr << browse(dat, "window=admin_log") if("maint_access_brig") for(var/obj/machinery/door/airlock/maintenance/M in world) - M.req_access = list(access_brig) + if (access_maint_tunnels in M.req_access) + M.req_access = list(access_brig) message_admins("[key_name_admin(usr)] made all maint doors brig access-only.") if("maint_access_engiebrig") for(var/obj/machinery/door/airlock/maintenance/M in world) - M.req_all_accesses = 0 - M.req_access = list(access_brig,access_engine) + if (access_maint_tunnels in M.req_access) + M.req_access = list() + M.req_one_access = list(access_brig,access_engine) message_admins("[key_name_admin(usr)] made all maint doors engineering and brig access-only.") if("infinite_sec") var/datum/job/J = job_master.GetJob("Security Officer") diff --git a/code/modules/projectiles/guns/energy/nuclear.dm b/code/modules/projectiles/guns/energy/nuclear.dm index 6a8aeb8523d..445c4cd5a05 100644 --- a/code/modules/projectiles/guns/energy/nuclear.dm +++ b/code/modules/projectiles/guns/energy/nuclear.dm @@ -54,9 +54,10 @@ if(!charge_tick >= 10) return 0 charge_tick = 0 if(!power_supply) return 0 - if(!failcheck()) return 0 - power_supply.give(100) - update_icon() + if((power_supply.charge / power_supply.maxcharge) != 1) + if(!failcheck()) return 0 + power_supply.give(100) + update_icon() return 1 @@ -106,7 +107,7 @@ update_mode() - if (mode == 2) + if (mode == 0) overlays += "nucgun-stun" else if (mode == 1) overlays += "nucgun-kill"