From b5415335d3d49c0a85a1b81d7b4c9128d5b46391 Mon Sep 17 00:00:00 2001 From: SkyMarshal Date: Sat, 18 Feb 2012 12:45:01 -0700 Subject: [PATCH 1/2] Fixed a few runtimes, added debug verbs to help find WTF is up with DNA and 'prints Improved how disabilities are handled Fixed some stupid from googol's "smallsize" power --- code/defines/procs/command_alert.dm | 4 +- code/game/dna.dm | 4 +- code/game/events/EventProcs/space_ninja.dm | 36 +++++----- code/game/objects/devices/scanners.dm | 2 +- code/game/objects/items/item.dm | 9 ++- .../objects/items/weapons/dna_injector.dm | 2 +- code/modules/admin/verbs/debug.dm | 66 +++++++++++++++++++ code/modules/admin/verbs/randomverbs.dm | 9 ++- code/modules/mob/living/carbon/human/life.dm | 12 ++-- code/modules/mob/new_player/preferences.dm | 26 +++----- 10 files changed, 122 insertions(+), 48 deletions(-) diff --git a/code/defines/procs/command_alert.dm b/code/defines/procs/command_alert.dm index 23ee3c1119b..d7a97fe2547 100644 --- a/code/defines/procs/command_alert.dm +++ b/code/defines/procs/command_alert.dm @@ -1,5 +1,5 @@ -/proc/command_alert(var/text, var/title = "") - world << "

[command_name()] Update

" +/proc/command_alert(var/text, var/title = "", var/maintitle = "NanoTrasen Update") + world << "

[maintitle]

" if (title && length(title) > 0) world << "

[html_encode(title)]

" diff --git a/code/game/dna.dm b/code/game/dna.dm index 0e56c006581..38a15fbf1d7 100644 --- a/code/game/dna.dm +++ b/code/game/dna.dm @@ -66,7 +66,9 @@ uni_identity = temp - var/mutstring = "43359156756131E13763334D1C369012032164D4FE4CD61544B6C03F251B6C60A42821D26BA3B02D6" + var/mutstring = "" + for(var/i = 1, i <= 26, i++) + mutstring += add_zero2(num2hex(rand(1,1024)),3) struc_enzymes = mutstring diff --git a/code/game/events/EventProcs/space_ninja.dm b/code/game/events/EventProcs/space_ninja.dm index 355801614b9..ac62c0e1fd6 100644 --- a/code/game/events/EventProcs/space_ninja.dm +++ b/code/game/events/EventProcs/space_ninja.dm @@ -230,12 +230,14 @@ In either case, it's a good idea to spawn the ninja with a semi-random set of ob objective_list -= 3 switch(pick(objective_list)) if(1)//kill - current_mind = pick(hostile_targets) + while (!isnull(current_mind) && hostile_targets.len) + current_mind = pick(hostile_targets) - var/datum/objective/assassinate/ninja_objective = new - ninja_objective.owner = ninja_mind - ninja_objective.find_target_by_role((current_mind.special_role ? current_mind.special_role : current_mind.assigned_role),(current_mind.special_role?1:0))//If they have a special role, use that instead to find em. - ninja_mind.objectives += ninja_objective + if(current_mind) + var/datum/objective/assassinate/ninja_objective = new + ninja_objective.owner = ninja_mind + ninja_objective.find_target_by_role((current_mind.special_role ? current_mind.special_role : current_mind.assigned_role),(current_mind.special_role?1:0))//If they have a special role, use that instead to find em. + ninja_mind.objectives += ninja_objective hostile_targets -= current_mind//Remove them from the list. if(2)//Steal @@ -246,21 +248,25 @@ In either case, it's a good idea to spawn the ninja with a semi-random set of ob objective_list -= 2 if(3)//Protect. Keeping people alive can be pretty difficult. - current_mind = pick(friendly_targets) + while (!isnull(current_mind) && friendly_targets.len) + current_mind = pick(friendly_targets) - var/datum/objective/protect/ninja_objective = new - ninja_objective.owner = ninja_mind - ninja_objective.find_target_by_role((current_mind.special_role ? current_mind.special_role : current_mind.assigned_role),(current_mind.special_role?1:0)) - ninja_mind.objectives += ninja_objective + if(current_mind) + var/datum/objective/protect/ninja_objective = new + ninja_objective.owner = ninja_mind + ninja_objective.find_target_by_role((current_mind.special_role ? current_mind.special_role : current_mind.assigned_role),(current_mind.special_role?1:0)) + ninja_mind.objectives += ninja_objective friendly_targets -= current_mind if(4)//Debrain - current_mind = pick(hostile_targets) + while (!isnull(current_mind) && hostile_targets.len) + current_mind = pick(hostile_targets) - var/datum/objective/debrain/ninja_objective = new - ninja_objective.owner = ninja_mind - ninja_objective.find_target_by_role((current_mind.special_role ? current_mind.special_role : current_mind.assigned_role),(current_mind.special_role?1:0)) - ninja_mind.objectives += ninja_objective + if(current_mind) + var/datum/objective/debrain/ninja_objective = new + ninja_objective.owner = ninja_mind + ninja_objective.find_target_by_role((current_mind.special_role ? current_mind.special_role : current_mind.assigned_role),(current_mind.special_role?1:0)) + ninja_mind.objectives += ninja_objective hostile_targets -= current_mind//Remove them from the list. if(5)//Download research diff --git a/code/game/objects/devices/scanners.dm b/code/game/objects/devices/scanners.dm index 3740305c330..2056c0aa4e5 100644 --- a/code/game/objects/devices/scanners.dm +++ b/code/game/objects/devices/scanners.dm @@ -143,7 +143,7 @@ MASS SPECTROMETER src.add_fingerprint(user) if (istype(A, /obj/effect/decal/cleanable/blood) || istype(A, /obj/effect/rune)) if(!isnull(A.blood_DNA.len)) - for(var/i = 1, i < A.blood_DNA.len, i++) + for(var/i = 1, i <= A.blood_DNA.len, i++) var/list/templist = A.blood_DNA[i] user << "\blue Blood type: [templist[2]]\nDNA: [templist[1]]" return diff --git a/code/game/objects/items/item.dm b/code/game/objects/items/item.dm index a68dbe441e5..0cd654e7ba7 100755 --- a/code/game/objects/items/item.dm +++ b/code/game/objects/items/item.dm @@ -209,7 +209,7 @@ return if(istype(src.loc,/obj/item/weapon/storage)) //Taking stuff out of storage duplicates it. var/obj/item/weapon/storage/U = src.loc - user.client.screen -= src + user.client.screen -= src //Fixed! U.contents.Remove(src) if(istype(src.loc,/obj/item/clothing/suit/storage/)) var/obj/item/clothing/suit/storage/X = src.loc @@ -224,6 +224,11 @@ src.loc = P O.amount -= 1 else if(istype(W,/obj/item/wardrobe)) + if(src in user) + return + if(!istype(src.loc,/turf)) + user << "It's got to be on the ground to do that!" + return var/obj/item/wardrobe/I = W var/could_fill = 1 for (var/obj/O in locate(src.x,src.y,src.z)) @@ -241,7 +246,7 @@ user << "\blue You pick up all the items." else user << "\blue You try to pick up all of the items, but run out of space in the bag." - user.visible_message("\blue [user] gathers up[could_fill ? " " : " most of "]the pile of items and puts it into the [W].") + user.visible_message("\blue [user] gathers up[could_fill ? " " : " most of "]the pile of items and puts it into the [W].") I.update_icon() /obj/item/attack_self(mob/user as mob) diff --git a/code/game/objects/items/weapons/dna_injector.dm b/code/game/objects/items/weapons/dna_injector.dm index 0e3aa57dd81..328953f011f 100644 --- a/code/game/objects/items/weapons/dna_injector.dm +++ b/code/game/objects/items/weapons/dna_injector.dm @@ -75,7 +75,7 @@ O.place = "dnainjector" M.requests += O if (dnatype == "se") - if (isblockon(getblock(dna, 14,3),14) && istype(M, /mob/living/carbon/human)) + if (isblockon(getblock(dna, MONKEYBLOCK,3),MONKEYBLOCK) && istype(M, /mob/living/carbon/human)) message_admins("[key_name_admin(user)] injected [key_name_admin(M)] with the [name] \red(MONKEY)") log_game("[key_name(user)] injected [key_name(M)] with the [name] (MONKEY)") else diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm index 8e7b58020b3..0a80926cc0b 100644 --- a/code/modules/admin/verbs/debug.dm +++ b/code/modules/admin/verbs/debug.dm @@ -814,3 +814,69 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that M.update_clothing() return + + +/client/proc/cmd_debug_blood() + set category = "Debug" + set name = "Analyze all blood_DNA" + + // to prevent REALLY stupid activations + switch(alert("Are you sure?", ,"Yes", "No")) + if("No") + return + world << "\red ALERT! \black Standby for high CPU bugtesting to determine missing blood_DNA values!" + world << "\red THIS WILL PROBABLY LAG LIKE HELL." + world << "Initiating in 10 BYOND seconds..." + log_admin("[key_name(src)] has initiated a scan of all blood_DNA lists!") + message_admins("[key_name_admin(src)] has initiated a scan of all blood_DNA lists!", 0) + sleep(100) + world << "\red SCAN INITIATED." + spawn(0) //I am not stupid enough to leave that in a regular loop. + for(var/atom/O in world) + if(!islist(O.blood_DNA)) + var/turf/T = get_turf(O) + if(istype(O.loc,/turf)) + src << "[O] at [T.x],[T.y],[T.z] has a non-list blood_DNA variable!" + else + src << "[O] in [O.loc] at [T.x],[T.y],[T.z] has a non-list blood_DNA variable!" + world << "\red SCAN COMPLETE." + world << "Thank you for your patience." + + +/client/proc/cmd_debug_prints() + set category = "Debug" + set name = "Analyze all fingerprints" + + // to prevent REALLY stupid activations + switch(alert("Are you sure?", ,"Yes", "No")) + if("No") + return + world << "\red ALERT! \black Standby for high CPU bugtesting to determine incorrect fingerprint values!" + world << "\red THIS WILL PROBABLY LAG LIKE HELL." + world << "Initiating in 10 BYOND seconds..." + log_admin("[key_name(src)] has initiated a scan of all fingerprints!") + message_admins("[key_name_admin(src)] has initiated a scan of all fingerprints!", 0) + sleep(100) + world << "\red SCAN INITIATED." + spawn(0) //I am not stupid enough to leave that in a regular loop. + for(var/atom/O in world) + if(istype(O, /mob)) //Lets not. + continue + if(!islist(O.fingerprints)) + var/turf/T = get_turf(O) + if(istype(O.loc,/turf)) + src << "[O] at [T.x],[T.y],[T.z] has a non-list fingerprints variable!" + else + src << "[O] in [O.loc] at [T.x],[T.y],[T.z] has a non-list fingerprints variable!" + else + for(var/i, i <= O.fingerprints.len, i++) + if(length(O.fingerprints[i]) != 69) + var/turf/T = get_turf(O) + if(istype(O.loc,/turf)) + src << "[O] at [T.x],[T.y],[T.z] has a fingerprints variable of incorrect length!" + else + src << "[O] in [O.loc] at [T.x],[T.y],[T.z] has a fingerprints variable of incorrect length!" + break + + world << "\red SCAN COMPLETE." + world << "Thank you for your patience." \ No newline at end of file diff --git a/code/modules/admin/verbs/randomverbs.dm b/code/modules/admin/verbs/randomverbs.dm index 55c60abafcb..a784f21f8f4 100644 --- a/code/modules/admin/verbs/randomverbs.dm +++ b/code/modules/admin/verbs/randomverbs.dm @@ -538,12 +538,17 @@ Traitors and the like can also be revived with the previous role mostly intact. for (var/obj/machinery/computer/communications/C in machines) if(! (C.stat & (BROKEN|NOPOWER) ) ) var/obj/item/weapon/paper/P = new /obj/item/weapon/paper( C.loc ) - P.name = "paper - '[command_name()] Update.'" + P.name = "'[command_name()] Update.'" P.info = input + P.update_icon() C.messagetitle.Add("[command_name()] Update") C.messagetext.Add(P.info) - command_alert(input, maintitle=customname); + switch(alert("Should this be announced to the general population?",,"Yes","No")) + if("Yes") + command_alert(input, maintitle=customname); + if("No") + world << "\red New NanoTrasen Update availible at all communication consoles." world << sound('commandreport.ogg') log_admin("[key_name(src)] has created a command report: [input]") diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 55c92dcb590..229aa9fdc83 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -157,7 +157,7 @@ if(hallucination > 0) if(hallucinations.len == 0 && hallucination >= 20 && health > 0) - if(prob(5)) + if(prob(2)) //Waaay to often. fake_attack(src) //for(var/atom/a in hallucinations) // a.hallucinate(src) @@ -174,11 +174,11 @@ if(mutations & mSmallsize) - if(!(flags & TABLEPASS)) - flags |= TABLEPASS + if(!(flags & PASSTABLE)) + flags |= PASSTABLE else - if(flags & TABLEPASS) - flags &= ~TABLEPASS + if(flags & PASSTABLE) + flags &= ~PASSTABLE if (mutations & mHallucination) hallucination = 100 @@ -249,7 +249,7 @@ pixel_x = old_x pixel_y = old_y if (disabilities & 16) - if (prob(10)) + if (prob(20))//Instant Chad Ore! stuttering = max(10, stuttering) if (brainloss >= 60 && stat != 2) diff --git a/code/modules/mob/new_player/preferences.dm b/code/modules/mob/new_player/preferences.dm index f4c561f76aa..c07e23d86f8 100644 --- a/code/modules/mob/new_player/preferences.dm +++ b/code/modules/mob/new_player/preferences.dm @@ -170,7 +170,13 @@ datum/preferences dat += "
Eyes
" dat += "Change Color
__
" - dat += "
Disabilities: [disabilities]
" + dat += "
Disabilities:
" + dat += "Need Glasses? [disabilities & (1<<1) ? "Yes" : "No"]
" + dat += "Seizures? [disabilities & (1<<2) ? "Yes" : "No"]
" + dat += "Coughing? [disabilities & (1<<3) ? "Yes" : "No"]
" + dat += "Tourettes/Twitching? [disabilities & (1<<4) ? "Yes" : "No"]
" + dat += "Nervousness? [disabilities & (1<<5) ? "Yes" : "No"]
" + dat += "Trenna's Disorder? (Deafness) [disabilities & (1<<6) ? "Yes" : "No"]
" dat += "
Flavor Text
" dat += "Change
" @@ -688,23 +694,7 @@ datum/preferences midis = 1 disabilities = 0 if(link_tags["disabilities"]) - var/temp = input(usr,"Disability number","Disabilities",disabilities) as num - disabilities = min(max(temp,0),63) - usr << "You have chosen..." - if(disabilities == 0) - usr << "No disabilities" - if(disabilities & 1) - usr << "Nearsightedness" - if(disabilities & 2) - usr << "Headaches" - if(disabilities & 4) - usr << "Coughing" - if(disabilities & 8) - usr << "Twitchiness/Tourettes (You must hate yourself)" - if(disabilities & 16) - usr << "Nervousness" - if(disabilities & 32) - usr << "Trenna's Disorder (Deafness)" + disabilities ^= (1< Date: Sat, 18 Feb 2012 12:52:23 -0700 Subject: [PATCH 2/2] Fixed a typo. --- code/modules/admin/verbs/randomverbs.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/admin/verbs/randomverbs.dm b/code/modules/admin/verbs/randomverbs.dm index a784f21f8f4..f11e01b277c 100644 --- a/code/modules/admin/verbs/randomverbs.dm +++ b/code/modules/admin/verbs/randomverbs.dm @@ -548,7 +548,7 @@ Traitors and the like can also be revived with the previous role mostly intact. if("Yes") command_alert(input, maintitle=customname); if("No") - world << "\red New NanoTrasen Update availible at all communication consoles." + world << "\red New NanoTrasen Update available at all communication consoles." world << sound('commandreport.ogg') log_admin("[key_name(src)] has created a command report: [input]")