From 6ba52d7a0d833e5ec3aa1b8a30861fd664f0f74b Mon Sep 17 00:00:00 2001 From: "elly1989@rocketmail.com" Date: Fri, 16 Mar 2012 22:56:29 +0000 Subject: [PATCH] Sanity check for jobban_isbanned() to prevent any antag jobban resulting in a ban from any antag jobs that may be added or renamed or whatever. Tidied human/examine.dm a bit more. Can no longer examine mobs while unconscious/blind/whatever. A more extensive fix is in the works. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@3313 316c924e-a436-60f5-8080-3fe189b3f50e --- code/modules/admin/banjob.dm | 4 +- .../mob/living/carbon/human/examine.dm | 49 ++++++++++--------- .../mob/living/carbon/metroid/examine.dm | 5 ++ .../mob/living/carbon/monkey/examine.dm | 5 ++ code/modules/mob/living/silicon/ai/examine.dm | 5 ++ .../mob/living/silicon/robot/examine.dm | 6 +++ 6 files changed, 50 insertions(+), 24 deletions(-) diff --git a/code/modules/admin/banjob.dm b/code/modules/admin/banjob.dm index 6eb44ed9611..cd6ef81420c 100644 --- a/code/modules/admin/banjob.dm +++ b/code/modules/admin/banjob.dm @@ -14,8 +14,8 @@ var //returns a reason if M is banned from rank, returns 0 otherwise /proc/jobban_isbanned(mob/M, rank) - if(_jobban_isbanned(M, rank)) return "Reason Unspecified" //for old jobban - if(M) + if(M && rank) + if(_jobban_isbanned(M, rank)) return "Reason Unspecified" //for old jobban if (guest_jobbans(rank)) if(config.guest_jobban && IsGuestKey(M.key)) return "Guest Job-ban" diff --git a/code/modules/mob/living/carbon/human/examine.dm b/code/modules/mob/living/carbon/human/examine.dm index 17727a3398d..c5f1debf2b7 100644 --- a/code/modules/mob/living/carbon/human/examine.dm +++ b/code/modules/mob/living/carbon/human/examine.dm @@ -1,6 +1,11 @@ /mob/living/carbon/human/examine() set src in oview() + if(!usr || !src) return + if((usr.sdisabilities & 1) || usr.blinded || usr.stat) + usr << "Something is there but you can't see it." + return + var/skipgloves = 0 var/skipsuitstorage = 0 var/skipjumpsuit = 0 @@ -145,12 +150,12 @@ //ID if (src.wear_id) var/id - if(istype(src:wear_id, /obj/item/device/pda)) - var/obj/item/device/pda/pda = src:wear_id + if(istype(src.wear_id, /obj/item/device/pda)) + var/obj/item/device/pda/pda = src.wear_id id = pda.owner - else + else if(istype(src.wear_id, /obj/item/weapon/card/id)) //just in case something other than a PDA/ID card somehow gets in the ID slot :[ id = src.wear_id.registered - if (id != src.real_name && in_range(src, usr) && prob(10)) + if (id && (id != src.real_name) && (get_dist(src, usr) <= 1) && prob(10)) msg += "[t_He] [t_is] wearing \icon[src.wear_id] \a [src.wear_id] yet something doesn't seem right...\n" else msg += "[t_He] [t_is] wearing \icon[src.wear_id] \a [src.wear_id].\n" @@ -158,38 +163,37 @@ //Jitters if (src.is_jittery) if(src.jitteriness >= 300) - msg += "[t_He] [t_is] convulsing violently!\n" + msg += "[t_He] [t_is] convulsing violently!\n" else if(src.jitteriness >= 200) msg += "[t_He] [t_is] extremely jittery.\n" else if(src.jitteriness >= 100) msg += "[t_He] [t_is] twitching ever so slightly.\n" - if (src.suiciding == 1) - msg += "[t_He] [t_has] bitten off [t_his] own tongue and suffered major bloodloss!\n" + if (src.suiciding) + msg += "[t_He] [t_has] bitten off [t_his] own tongue and [t_has] suffered major bloodloss!\n" - if (src.stat == DEAD || (changeling && changeling.changeling_fakedeath == 1)) - msg += "[t_He] [t_is] limp and unresponsive" - //Carn: yes I'm a pedant, you aren't seeing their lifeless eyes unless you can see their eyes in the first place. - if(!skipeyes) - msg += ", with a dull lifeless look in [t_his] eyes...\n" - else - msg += "...\n" + if (src.stat == DEAD || (changeling && (changeling.changeling_fakedeath == 1))) + msg += "[t_He] [t_is] limp and unresponsive; there are no signs of life...\n" else msg += "" - if (src.getBruteLoss()) - if (src.getBruteLoss() < 30) + + var/temp = src.getBruteLoss() //no need to calculate each of these twice + if(temp) + if (temp < 30) msg += "[t_He] [t_has] minor bruising.\n" else msg += "[t_He] [t_has] severe bruising!\n" - if (src.getFireLoss()) - if (src.getFireLoss() < 30) + temp = src.getFireLoss() + if (temp) + if (temp < 30) msg += "[t_He] [t_has] minor burns.\n" else msg += "[t_He] [t_has] severe burns!\n" - if (src.getCloneLoss()) - if (src.getCloneLoss() < 30) + temp = src.getCloneLoss() + if (temp) + if (temp < 30) msg += "[t_He] [t_has] minor genetic deformities.\n" else msg += "[t_He] [t_has] severe genetic deformities.\n" @@ -202,11 +206,12 @@ else msg += "[t_He] [t_is] quite chubby.\n" + msg += "" + if (src.stat == UNCONSCIOUS) - msg += "[t_He] [t_is]n't responding to anything around [t_him]; [t_his] eyes are closed as though asleep.\n" + msg += "[t_He] [t_is]n't responding to anything around [t_him] and seems to be asleep.\n" else if (src.getBrainLoss() >= 60) msg += "[t_He] [t_has] a stupid expression on [t_his] face.\n" - msg += "" if (!src.client) msg += "[t_He] [t_has] a vacant, braindead stare...\n" diff --git a/code/modules/mob/living/carbon/metroid/examine.dm b/code/modules/mob/living/carbon/metroid/examine.dm index 22122001de8..6fd157cdec5 100644 --- a/code/modules/mob/living/carbon/metroid/examine.dm +++ b/code/modules/mob/living/carbon/metroid/examine.dm @@ -1,6 +1,11 @@ /mob/living/carbon/metroid/examine() set src in oview() + if(!usr || !src) return + if((usr.sdisabilities & 1) || usr.blinded || usr.stat) + usr << "Something is there but you can't see it." + return + var/msg = "*---------*\nThis is \icon[src] \a [src]!\n" if (src.stat == DEAD) msg += "It is limp and unresponsive.\n" diff --git a/code/modules/mob/living/carbon/monkey/examine.dm b/code/modules/mob/living/carbon/monkey/examine.dm index 26cf636630a..2f6eadb9f3f 100644 --- a/code/modules/mob/living/carbon/monkey/examine.dm +++ b/code/modules/mob/living/carbon/monkey/examine.dm @@ -1,6 +1,11 @@ /mob/living/carbon/monkey/examine() set src in oview() + if(!usr || !src) return + if((usr.sdisabilities & 1) || usr.blinded || usr.stat) + usr << "Something is there but you can't see it." + return + var/msg = "*---------*\nThis is \icon[src] \a [src]!\n" if (src.handcuffed) diff --git a/code/modules/mob/living/silicon/ai/examine.dm b/code/modules/mob/living/silicon/ai/examine.dm index ac856907658..781846f361b 100644 --- a/code/modules/mob/living/silicon/ai/examine.dm +++ b/code/modules/mob/living/silicon/ai/examine.dm @@ -1,6 +1,11 @@ /mob/living/silicon/ai/examine() set src in oview() + if(!usr || !src) return + if((usr.sdisabilities & 1) || usr.blinded || usr.stat) + usr << "Something is there but you can't see it." + return + var/msg = "*---------*\nThis is \icon[src] [src]!\n" if (src.stat == DEAD) msg += "It appears to be powered-down.\n" diff --git a/code/modules/mob/living/silicon/robot/examine.dm b/code/modules/mob/living/silicon/robot/examine.dm index 53c038635b9..11f4da029c5 100644 --- a/code/modules/mob/living/silicon/robot/examine.dm +++ b/code/modules/mob/living/silicon/robot/examine.dm @@ -1,5 +1,11 @@ /mob/living/silicon/robot/examine() set src in oview() + + if(!usr || !src) return + if((usr.sdisabilities & 1) || usr.blinded || usr.stat) + usr << "Something is there but you can't see it." + return + var/msg = "*---------*\nThis is \icon[src] \a [src]!\n" msg += "" if (src.getBruteLoss())