From e78f6c0d5050154da40362f0aa54a94f21171755 Mon Sep 17 00:00:00 2001 From: "n3ophyt3@gmail.com" Date: Thu, 3 Feb 2011 02:37:10 +0000 Subject: [PATCH] Fixed some runtime errors. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@944 316c924e-a436-60f5-8080-3fe189b3f50e --- code/WorkInProgress/Chemistry-Holder.dm | 31 +++++++++++++++---- code/WorkInProgress/Chemistry-Reagents.dm | 20 ++++++------ code/WorkInProgress/Chemistry-Tools.dm | 3 +- code/game/machinery/Sleeper.dm | 1 + code/game/machinery/singularity.dm | 2 +- code/game/objects/structures.dm | 8 +++-- code/game/objects/weapons.dm | 1 + code/modules/mob/living/carbon/human/human.dm | 3 ++ code/modules/mob/mob.dm | 4 ++- 9 files changed, 51 insertions(+), 22 deletions(-) diff --git a/code/WorkInProgress/Chemistry-Holder.dm b/code/WorkInProgress/Chemistry-Holder.dm index 88da13bd247..426abf46378 100644 --- a/code/WorkInProgress/Chemistry-Holder.dm +++ b/code/WorkInProgress/Chemistry-Holder.dm @@ -173,17 +173,36 @@ datum return 0 reaction(var/atom/A, var/method=TOUCH, var/volume_modifier=0) + switch(method) if(TOUCH) for(var/datum/reagent/R in reagent_list) - if(ismob(A)) spawn(0) R.reaction_mob(A, TOUCH, R.volume+volume_modifier) - if(isturf(A)) spawn(0) R.reaction_turf(A, R.volume+volume_modifier) - if(isobj(A)) spawn(0) R.reaction_obj(A, R.volume+volume_modifier) + if(ismob(A)) + spawn(0) + if(!R) return + else R.reaction_mob(A, TOUCH, R.volume+volume_modifier) + if(isturf(A)) + spawn(0) + if(!R) return + else R.reaction_turf(A, R.volume+volume_modifier) + if(isobj(A)) + spawn(0) + if(!R) return + else R.reaction_obj(A, R.volume+volume_modifier) if(INGEST) for(var/datum/reagent/R in reagent_list) - if(ismob(A) && R) spawn(0) R.reaction_mob(A, INGEST, R.volume+volume_modifier) - if(isturf(A) && R) spawn(0) R.reaction_turf(A, R.volume+volume_modifier) - if(isobj(A) && R) spawn(0) R.reaction_obj(A, R.volume+volume_modifier) + if(ismob(A) && R) + spawn(0) + if(!R) return + else R.reaction_mob(A, INGEST, R.volume+volume_modifier) + if(isturf(A) && R) + spawn(0) + if(!R) return + else R.reaction_turf(A, R.volume+volume_modifier) + if(isobj(A) && R) + spawn(0) + if(!R) return + else R.reaction_obj(A, R.volume+volume_modifier) return add_reagent(var/reagent, var/amount, var/data=null) diff --git a/code/WorkInProgress/Chemistry-Reagents.dm b/code/WorkInProgress/Chemistry-Reagents.dm index c3dde048874..d1f95d8309c 100644 --- a/code/WorkInProgress/Chemistry-Reagents.dm +++ b/code/WorkInProgress/Chemistry-Reagents.dm @@ -166,6 +166,7 @@ datum reagent_state = LIQUID reaction_turf(var/turf/T, var/volume) + if (istype(T, /turf/space)) return src = null if(volume >= 3) if(T:wet >= 1) return @@ -210,16 +211,15 @@ datum reagent_state = LIQUID reaction_turf(var/turf/T, var/volume) - if (!istype(T, /turf/space)) - src = null - if(T:wet >= 2) return - T:wet = 2 - spawn(800) - T:wet = 0 - if(T:wet_overlay) - T:overlays -= T:wet_overlay - T:wet_overlay = null - + if (istype(T, /turf/space)) return + src = null + if(T:wet >= 2) return + T:wet = 2 + spawn(800) + T:wet = 0 + if(T:wet_overlay) + T:overlays -= T:wet_overlay + T:wet_overlay = null return bilk diff --git a/code/WorkInProgress/Chemistry-Tools.dm b/code/WorkInProgress/Chemistry-Tools.dm index d8d4f833e4b..cb544396dc7 100644 --- a/code/WorkInProgress/Chemistry-Tools.dm +++ b/code/WorkInProgress/Chemistry-Tools.dm @@ -254,6 +254,7 @@ playsound(user.loc, 'syringeproj.ogg', 50, 1) for(var/i=0, i<6, i++) + if(!D) break if(D.loc == trg) break step_towards(D,trg) @@ -273,7 +274,7 @@ sleep(1) - spawn(10) del(D) + if (D) spawn(10) del(D) return diff --git a/code/game/machinery/Sleeper.dm b/code/game/machinery/Sleeper.dm index 292765984aa..4a37710ae29 100644 --- a/code/game/machinery/Sleeper.dm +++ b/code/game/machinery/Sleeper.dm @@ -158,6 +158,7 @@ for (var/mob/V in viewers(user)) V.show_message("[user] starts putting [G.affecting.name] into the sleeper.", 3) if(do_after(user, 20)) + if(!G.affecting) return var/mob/M = G.affecting if (M.client) M.client.perspective = EYE_PERSPECTIVE diff --git a/code/game/machinery/singularity.dm b/code/game/machinery/singularity.dm index 619e5430c4f..aa6afd0720d 100644 --- a/code/game/machinery/singularity.dm +++ b/code/game/machinery/singularity.dm @@ -154,7 +154,7 @@ However people seem to like it for some reason. var/oldsrc = src src = null //for spawn() working even after Del(), see byond documentation about sleep() -rastaf0 for(var/obj/machinery/power/collector_control/myCC in orange(collector_control_range,oldsrc)) - spawn() myCC.updatecons() + spawn() if(myCC) myCC.updatecons() /obj/machinery/the_singularity var/global/list/uneatable = list(\ diff --git a/code/game/objects/structures.dm b/code/game/objects/structures.dm index d0ee70a10f9..503296aa7d0 100644 --- a/code/game/objects/structures.dm +++ b/code/game/objects/structures.dm @@ -84,7 +84,8 @@ obj/structure user << "\blue Wall fully reinforced!" var/turf/Tsrc = get_turf(src) Tsrc.ReplaceWithRWall() - W:use(1) + if (W) + W:use(1) del(src) return else @@ -101,7 +102,7 @@ obj/structure /obj/structure/girder/blob_act() if(prob(40)) del(src) - + /obj/structure/girder/ex_act(severity) switch(severity) if(1.0) @@ -149,7 +150,8 @@ obj/structure C:build(get_turf(src)) C:use(1) playsound(src.loc, 'Genhit.ogg', 50, 1) - C.add_fingerprint(user) + if (C) + C.add_fingerprint(user) del(src) return if (istype(C, /obj/item/weapon/weldingtool) && C:welding) diff --git a/code/game/objects/weapons.dm b/code/game/objects/weapons.dm index a87eb55d189..5afc7bb3c22 100644 --- a/code/game/objects/weapons.dm +++ b/code/game/objects/weapons.dm @@ -351,6 +351,7 @@ return /obj/item/assembly/rad_prox/receive_signal(datum/signal/signal) + if (!src.part2 || !src.part1) return if (signal.source == src.part2) src.part1.send_signal("ACTIVATE") return diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 046bd495072..eb512956e5b 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -842,6 +842,9 @@ return var/confirm if (src.wear_suit) + if(!src.wear_suit.allowed) + usr << "You somehow have a suit with no defined allowed items for suit storage, stop that." + return for(var/i=1, i<=src.wear_suit.allowed.len, i++) // world << "[src.wear_suit.allowed[i]] and [W.type]" if (findtext("[W.type]","[src.wear_suit.allowed[i]]") || istype(W, /obj/item/device/pda) || istype(W, /obj/item/weapon/pen)) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index ad1f43bec39..8c1a21dc7d2 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -1225,7 +1225,8 @@ var/obj/item/weapon/grab/G = src.r_hand if (!( L.container.Find(G.affecting) )) L.container += G.affecting - G.affecting.ret_grab(L, 1) + if (G.affecting) + G.affecting.ret_grab(L, 1) if (!( flag )) if (L.master == src) var/list/temp = list( ) @@ -1497,6 +1498,7 @@ var/t = input("Message:", text("Private message to [M.key]")) as text if (!( t )) return + if (!usr) return if (usr.client && usr.client.holder) M << "\red Admin PM from-[key_name(usr, M, 0)]: [t]" usr << "\blue Admin PM to-[key_name(M, usr, 1)]: [t]"