From b0e69dcd9982e2ee2b827ceac2cd2772a2a7b1dd Mon Sep 17 00:00:00 2001 From: "vageyenaman@gmail.com" Date: Wed, 27 Jul 2011 20:57:21 +0000 Subject: [PATCH] Bugfixes: Fixed a boatload of runtime errors. There's so many I just completely forgot what they all were! Explosions / Singularities now do not gib people "one-by-one" as some people may have noticed. This looked absolutely weird. Sounds: I was planning on making sounds become all distorted and whatnot if you were "high", but there were some problems. I've instead just settled with making deaf people not being able to hear non-ambient sounds at all. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@1941 316c924e-a436-60f5-8080-3fe189b3f50e --- code/WorkInProgress/Chemistry-Holder.dm | 21 +++++++------ code/WorkInProgress/cloning.dm | 17 +++++----- code/datums/diseases/cold.dm | 8 ++--- code/datums/diseases/cold9.dm | 2 +- code/game/dna.dm | 12 ++++--- code/game/gamemodes/nuclear/nuclear.dm | 6 ++-- code/game/machinery/rechargestation.dm | 4 ++- code/game/magic/cultist/runes.dm | 12 +++---- code/game/objects/alien/facehugger.dm | 4 +-- code/game/objects/explosion.dm | 10 ++++-- code/game/research/rdconsole.dm | 16 +++++----- code/game/sound.dm | 13 +++++--- .../living/carbon/alien/humanoid/humanoid.dm | 2 +- code/modules/mob/mob.dm | 31 ++++++++++--------- code/modules/power/singularity/singularity.dm | 4 ++- 15 files changed, 91 insertions(+), 71 deletions(-) diff --git a/code/WorkInProgress/Chemistry-Holder.dm b/code/WorkInProgress/Chemistry-Holder.dm index 268abbd94b..7d7b1921c9 100644 --- a/code/WorkInProgress/Chemistry-Holder.dm +++ b/code/WorkInProgress/Chemistry-Holder.dm @@ -139,7 +139,7 @@ datum metabolize(var/mob/M) for(var/A in reagent_list) var/datum/reagent/R = A - if(M) + if(M && R) R.on_mob_life(M) update_total() @@ -298,16 +298,17 @@ datum my_atom.on_reagent_change() // mix dem viruses - if(R.data && data) - if(R.data && R.data["viruses"] || data && data["viruses"]) - var/list/this = R.data["viruses"] - var/list/that = data["viruses"] - this += that // combine the two + if(R.id == "blood" && reagent == "blood") + if(R.data && data) + if(R.data && R.data["viruses"] || data && data["viruses"]) + var/list/this = R.data["viruses"] + var/list/that = data["viruses"] + this += that // combine the two - for(var/datum/disease/D in this) // makes sure no two viruses are in the reagent at the same time - for(var/datum/disease/d in this) - if(d != D) - D.cure(0) + for(var/datum/disease/D in this) // makes sure no two viruses are in the reagent at the same time + for(var/datum/disease/d in this) + if(d != D) + D.cure(0) return 0 diff --git a/code/WorkInProgress/cloning.dm b/code/WorkInProgress/cloning.dm index a8b2285463..84de13c6ee 100644 --- a/code/WorkInProgress/cloning.dm +++ b/code/WorkInProgress/cloning.dm @@ -276,16 +276,17 @@ else if (href_list["clone"]) var/datum/data/record/C = locate(href_list["clone"]) //Look for that player! They better be dead! - var/mob/selected = find_dead_player("[C.fields["ckey"]]") + if(C) + var/mob/selected = find_dead_player("[C.fields["ckey"]]") //Can't clone without someone to clone. Or a pod. Or if the pod is busy. Or full of gibs. - if ((!selected) || (!src.pod1) || (src.pod1.occupant) || (src.pod1.mess)) - src.temp = "Unable to initiate cloning cycle." // most helpful error message in THE HISTORY OF THE WORLD - else if (src.pod1.growclone(selected, C.fields["name"], C.fields["UI"], C.fields["SE"], C.fields["mind"], C.fields["mrace"])) - src.temp = "Cloning cycle activated." - src.records.Remove(C) - del(C) - src.menu = 1 + if ((!selected) || (!src.pod1) || (src.pod1.occupant) || (src.pod1.mess)) + src.temp = "Unable to initiate cloning cycle." // most helpful error message in THE HISTORY OF THE WORLD + else if (src.pod1.growclone(selected, C.fields["name"], C.fields["UI"], C.fields["SE"], C.fields["mind"], C.fields["mrace"])) + src.temp = "Cloning cycle activated." + src.records.Remove(C) + del(C) + src.menu = 1 else if (href_list["menu"]) src.menu = text2num(href_list["menu"]) diff --git a/code/datums/diseases/cold.dm b/code/datums/diseases/cold.dm index 7fdfe1cb24..ef9afc2ed9 100644 --- a/code/datums/diseases/cold.dm +++ b/code/datums/diseases/cold.dm @@ -16,11 +16,11 @@ if(2) if(affected_mob.sleeping && prob(40)) affected_mob << "\blue You feel better." - affected_mob.virus.cure() + cure() return if(prob(1) && prob(10)) affected_mob << "\blue You feel better." - affected_mob.virus.cure() + cure() return if(prob(1)) affected_mob.emote("sneeze") @@ -33,11 +33,11 @@ if(3) if(affected_mob.sleeping && prob(25)) affected_mob << "\blue You feel better." - src.cure() + cure() return if(prob(1) && prob(10)) affected_mob << "\blue You feel better." - affected_mob.virus.cure() + cure() if(prob(1)) affected_mob.emote("sneeze") if(prob(1)) diff --git a/code/datums/diseases/cold9.dm b/code/datums/diseases/cold9.dm index c10aae21de..bea72ec36e 100644 --- a/code/datums/diseases/cold9.dm +++ b/code/datums/diseases/cold9.dm @@ -17,7 +17,7 @@ affected_mob.bodytemperature -= 10 if(prob(1) && prob(10)) affected_mob << "\blue You feel better." - affected_mob.virus.cure() + cure() return if(prob(1)) affected_mob.emote("sneeze") diff --git a/code/game/dna.dm b/code/game/dna.dm index 51ff1eeede..4f0f90d251 100644 --- a/code/game/dna.dm +++ b/code/game/dna.dm @@ -321,7 +321,7 @@ M.mutations |= COLD_RESISTANCE if (isblockon(getblock(M.dna.struc_enzymes, BLINDBLOCK,3),11)) M.sdisabilities |= 1 - M << "\red You cant seem to see anything." + M << "\red You can't seem to see anything." if (isblockon(getblock(M.dna.struc_enzymes, TELEBLOCK,3),12)) if(inj || prob(15)) M << "\blue You feel smarter." @@ -329,7 +329,7 @@ if (isblockon(getblock(M.dna.struc_enzymes, DEAFBLOCK,3),13)) M.sdisabilities |= 4 M.ear_deaf = 1 - M << "\red Its kinda quiet..." + M << "\red You can't seem to hear anything..." //////////////////////////////////////////////////////////// Monkey Block if (isblockon(getblock(M.dna.struc_enzymes, 14,3),14) && istype(M, /mob/living/carbon/human)) @@ -360,9 +360,11 @@ del(animation) var/mob/living/carbon/monkey/O = new(src) - if (M.dna) - O.dna = M.dna - M.dna = null + + if(M) + if (M.dna) + O.dna = M.dna + M.dna = null for(var/datum/disease/D in M.viruses) diff --git a/code/game/gamemodes/nuclear/nuclear.dm b/code/game/gamemodes/nuclear/nuclear.dm index 98e6dd5ad6..96192df6f7 100644 --- a/code/game/gamemodes/nuclear/nuclear.dm +++ b/code/game/gamemodes/nuclear/nuclear.dm @@ -226,8 +226,10 @@ /datum/game_mode/proc/is_operatives_are_dead() for(var/datum/mind/operative_mind in syndicates) - if (!istype(operative_mind.current,/mob/living/carbon/human) && operative_mind.current.stat!=2) - return 0 + if (!istype(operative_mind.current,/mob/living/carbon/human)) + if(operative_mind.current) + if(operative_mind.current.stat!=2) + return 0 return 1 /datum/game_mode/nuclear/declare_completion() diff --git a/code/game/machinery/rechargestation.dm b/code/game/machinery/rechargestation.dm index f17a20fd48..6c030064da 100644 --- a/code/game/machinery/rechargestation.dm +++ b/code/game/machinery/rechargestation.dm @@ -118,7 +118,9 @@ if(O.reagents.get_reagent_amount("anti_toxin") < 30) O.reagents.add_reagent("anti_toxin", 1) - R.module.respawn_consumable(R) + if(R) + if(R.module) + R.module.respawn_consumable(R) verb diff --git a/code/game/magic/cultist/runes.dm b/code/game/magic/cultist/runes.dm index c45ddff690..2d0a97a970 100644 --- a/code/game/magic/cultist/runes.dm +++ b/code/game/magic/cultist/runes.dm @@ -775,13 +775,13 @@ var/list/sacrificed = list() if (iscultist(C)) continue C.ear_deaf += 50 - C.show_message("\red World around you suddenly becomes quiet.", 3) + C.show_message("\red The world around you suddenly becomes quiet.", 3) affected++ if(prob(1)) C.disabilities |= 4 if(affected) usr.say("Sti' kaliedir!") - usr << "\red World becomes quiet as deafening rune dissipates into fine dust." + usr << "\red The world becomes quiet as the deafening rune dissipates into fine dust." del(src) else return fizzle() @@ -792,7 +792,7 @@ var/list/sacrificed = list() continue C.ear_deaf += 30 //talismans is weaker. - C.show_message("\red World around you suddenly becomes quiet.", 3) + C.show_message("\red The world around you suddenly becomes quiet.", 3) affected++ if(affected) usr.whisper("Sti' kaliedir!") @@ -814,11 +814,11 @@ var/list/sacrificed = list() C.disabilities |= 1 if(prob(10)) C.sdisabilities |= 1 - C.show_message("\red Suddenly you see red flash, that blinds you.", 3) + C.show_message("\red Suddenly you see red flash that blinds you.", 3) affected++ if(affected) usr.say("Sti' kaliesin!") - usr << "\red Rune flashes, blinding those who not follow the Nar-Sie, and dissipates into fine dust." + usr << "\red The rune flashes, blinding those who not follow the Nar-Sie, and dissipates into fine dust." del(src) else return fizzle() @@ -831,7 +831,7 @@ var/list/sacrificed = list() C.eye_blind += 10 //talismans is weaker. affected++ - C.show_message("\red You feel sharp pain in your eyes, and the world disappears into darkness..", 3) + C.show_message("\red You feel a sharp pain in your eyes, and the world disappears into darkness..", 3) if(affected) usr.whisper("Sti' kaliesin!") usr << "\red Your talisman turns into gray dust, blinding those who not follow the Nar-Sie." diff --git a/code/game/objects/alien/facehugger.dm b/code/game/objects/alien/facehugger.dm index ad13321c6a..99e990a45c 100644 --- a/code/game/objects/alien/facehugger.dm +++ b/code/game/objects/alien/facehugger.dm @@ -240,14 +240,14 @@ loc = target.loc if(!target.alien_egg_flag && ( ishuman(target) || ismonkey(target) ) ) - if (!lamarr) + if (!lamarr && target) var/mob/trg = target death() //if(trg.virus)//Viruses are stored in a global database. //trg.virus.cure(0)//You need to either cure() or del() them to stop their processing. trg.contract_disease(new /datum/disease/alien_embryo(0))//So after that you need to infect the target anew. for(var/datum/disease/alien_embryo/A in trg.viruses) - target.alien_egg_flag = 1//We finally set their flag to 1. + trg.alien_egg_flag = 1//We finally set their flag to 1. return else sleep(50) diff --git a/code/game/objects/explosion.dm b/code/game/objects/explosion.dm index c8613e9d94..b63fa41129 100644 --- a/code/game/objects/explosion.dm +++ b/code/game/objects/explosion.dm @@ -36,14 +36,16 @@ proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impa distance = 0 if(distance < devastation_range) for(var/atom/object in T.contents) - object.ex_act(1) + spawn() + object.ex_act(1) if(prob(5)) T.ex_act(2) else T.ex_act(1) else if(distance < heavy_impact_range) for(var/atom/object in T.contents) - object.ex_act(2) + spawn() + object.ex_act(2) T.ex_act(2) else if (distance == heavy_impact_range) for(var/atom/object in T.contents) @@ -54,11 +56,13 @@ proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impa T.ex_act(2) else if(distance <= light_impact_range) for(var/atom/object in T.contents) - object.ex_act(3) + spawn() + object.ex_act(3) T.ex_act(3) for(var/mob/living/carbon/mob in T) flick("flash", mob:flash) + sleep(3) defer_powernet_rebuild = 0 return 1 diff --git a/code/game/research/rdconsole.dm b/code/game/research/rdconsole.dm index 73a8159a68..a029d58314 100644 --- a/code/game/research/rdconsole.dm +++ b/code/game/research/rdconsole.dm @@ -365,13 +365,15 @@ won't update every console in existence) but it's more of a hassle to do. Also, linked_lathe.clown_amount = max(0, (linked_lathe.clown_amount-being_built.materials[M])) else linked_lathe.reagents.remove_reagent(M, being_built.materials[M]) - var/obj/new_item = new being_built.build_path(src) - new_item.reliability = being_built.reliability - if(linked_lathe.hacked) being_built.reliability = max((reliability / 2), 0) - new_item.loc = linked_lathe.loc - linked_lathe.busy = 0 - screen = 3.1 - updateUsrDialog() + + if(being_built.build_path) + var/obj/new_item = new being_built.build_path(src) + new_item.reliability = being_built.reliability + if(linked_lathe.hacked) being_built.reliability = max((reliability / 2), 0) + new_item.loc = linked_lathe.loc + linked_lathe.busy = 0 + screen = 3.1 + updateUsrDialog() else if(href_list["imprint"]) //Causes the Circuit Imprinter to build something. if(linked_imprinter) diff --git a/code/game/sound.dm b/code/game/sound.dm index 42bd3a738c..dcbd8aff63 100644 --- a/code/game/sound.dm +++ b/code/game/sound.dm @@ -20,13 +20,15 @@ S.frequency = rand(32000, 55000) for (var/mob/M in range(world.view+extrarange, source)) if (M.client) - if(isturf(source)) - var/dx = source.x - M.x - S.pan = max(-100, min(100, dx/8.0 * 100)) - M << S + if(M.ear_deaf <= 0 || !M.ear_deaf) + if(isturf(source)) + var/dx = source.x - M.x + S.pan = max(-100, min(100, dx/8.0 * 100)) + + M << S /mob/proc/playsound_local(var/atom/source, soundin, vol as num, vary, extrarange as num) - if(!src.client) + if(!src.client && ear_deaf > 0) return switch(soundin) if ("shatter") soundin = pick('Glassbr1.ogg','Glassbr2.ogg','Glassbr3.ogg') @@ -48,6 +50,7 @@ if(isturf(source)) var/dx = source.x - src.x S.pan = max(-100, min(100, dx/8.0 * 100)) + src << S client/verb/Toggle_Soundscape() diff --git a/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm b/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm index 970a786a58..916427012e 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm @@ -194,7 +194,7 @@ return else if (stat == 2 && !client) - gibs(loc, viruses) + xgibs(loc, viruses) del(src) return diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 49398dc0bc..cd86d32f08 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -2037,23 +2037,24 @@ It's fairly easy to fix if dealing with single letters but not so much with comp else flick("gibbed-r", animation) - if(key) - if (istype(src, /mob/living/silicon)) - robogibs(loc, viruses) - else if (istype(src, /mob/living/carbon/alien)) - xgibs(loc, viruses) - else - gibs(loc, viruses) + spawn() + if(key) + if (istype(src, /mob/living/silicon)) + robogibs(loc, viruses) + else if (istype(src, /mob/living/carbon/alien)) + xgibs(loc, viruses) + else + gibs(loc, viruses) - else - if (istype(src, /mob/living/silicon)) - robogibs(loc, viruses) - else if (istype(src, /mob/living/carbon/alien)) - xgibs(loc, viruses) else - gibs(loc, viruses) - sleep(15) - del(src) + if (istype(src, /mob/living/silicon)) + robogibs(loc, viruses) + else if (istype(src, /mob/living/carbon/alien)) + xgibs(loc, viruses) + else + gibs(loc, viruses) + sleep(15) + del(src) /* This is the proc for turning a mob into ash. Mostly a copy of gib code (above). diff --git a/code/modules/power/singularity/singularity.dm b/code/modules/power/singularity/singularity.dm index adf576c4e7..a8bc112d0b 100644 --- a/code/modules/power/singularity/singularity.dm +++ b/code/modules/power/singularity/singularity.dm @@ -237,7 +237,9 @@ var/global/list/uneatable = list( if(A:mind) if((A:mind:assigned_role == "Station Engineer") || (A:mind:assigned_role == "Chief Engineer") ) gain = 100 - A:gib() + spawn() + A:gib() + sleep(1) else if(istype(A,/obj/)) A:ex_act(1.0) if(A) del(A)