From 4eaf8e1d1a8bb0fae5bfad06785aeea8b88eb674 Mon Sep 17 00:00:00 2001 From: "vageyenaman@gmail.com" Date: Sun, 26 Feb 2012 02:17:17 +0000 Subject: [PATCH] Sanity checks, miscellaneous bugfixes, failsafes. Disposals no longer indiscriminately let items land inside it - the items have to have been thrown by someone. The ongoing attempt to fix the thousands of runtimes plaguing the game. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@3195 316c924e-a436-60f5-8080-3fe189b3f50e --- code/game/mecha/mech_fabricator.dm | 9 +++++---- code/game/objects/radio/radio.dm | 2 ++ code/game/turf.dm | 4 ++++ code/modules/admin/admin.dm | 1 + code/modules/chemical/Chemistry-Tools.dm | 17 +++++++++-------- code/modules/mob/living/carbon/human/human.dm | 1 + code/modules/mob/living/silicon/ai/laws.dm | 9 +++++---- code/modules/mob/mob.dm | 2 +- code/modules/recycling/disposal.dm | 2 +- 9 files changed, 29 insertions(+), 18 deletions(-) diff --git a/code/game/mecha/mech_fabricator.dm b/code/game/mecha/mech_fabricator.dm index 51704513586..20f5b561d27 100644 --- a/code/game/mecha/mech_fabricator.dm +++ b/code/game/mecha/mech_fabricator.dm @@ -288,13 +288,14 @@ return output proc/remove_resources(var/obj/item/mecha_parts/part) - for(var/resource in part.construction_cost) - if(resource in src.resources) - src.resources[resource] -= get_resource_cost_w_coeff(part,resource) + if(istype(part, /obj/item/mecha_parts/part)) + for(var/resource in part.construction_cost) + if(resource in src.resources) + src.resources[resource] -= get_resource_cost_w_coeff(part,resource) return proc/check_resources(var/obj/item/mecha_parts/part) - if(istype(part, /obj/item)) + if(istype(part, /obj/item/mecha_parts/part)) for(var/resource in part.construction_cost) if(resource in src.resources) if(src.resources[resource] < get_resource_cost_w_coeff(part,resource)) diff --git a/code/game/objects/radio/radio.dm b/code/game/objects/radio/radio.dm index 31e3d1e6537..3b84d8e5551 100644 --- a/code/game/objects/radio/radio.dm +++ b/code/game/objects/radio/radio.dm @@ -261,6 +261,8 @@ var/GLOBAL_RADIO_TYPE = 1 // radio type to use channel = null if (!istype(connection)) return + if (!connection) + return diff --git a/code/game/turf.dm b/code/game/turf.dm index 093569186a2..46bb078b13a 100644 --- a/code/game/turf.dm +++ b/code/game/turf.dm @@ -496,6 +496,10 @@ usr << "\red You don't have the dexterity to do this!" return + if(!istype(src, /turf/simulated/wall/r_wall)) + return // this may seem stupid and redundant but apparently floors can call this attackby() proc, it was spamming shit up. -- Doohl + + if (istype(W, /obj/item/weapon/weldingtool) && W:welding) W:eyecheck(user) var/turf/T = user.loc diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index 27afb649501..813ff9e1778 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -2579,6 +2579,7 @@ if (!M.mind) usr << "Sorry, this mob has no mind!" + return M.mind.edit_memory() diff --git a/code/modules/chemical/Chemistry-Tools.dm b/code/modules/chemical/Chemistry-Tools.dm index d707958e1dd..c93fd85f764 100644 --- a/code/modules/chemical/Chemistry-Tools.dm +++ b/code/modules/chemical/Chemistry-Tools.dm @@ -545,15 +545,16 @@ if(D.loc == trg) break step_towards(D,trg) - for(var/mob/living/carbon/M in D.loc) - if(!istype(M,/mob/living/carbon)) continue - if(M == user) continue - D.reagents.trans_to(M, 15) - M.take_organ_damage(5) - for(var/mob/O in viewers(world.view, D)) - O.show_message(text("\red [] was hit by the syringe!", M), 1) + if(D) + for(var/mob/living/carbon/M in D.loc) + if(!istype(M,/mob/living/carbon)) continue + if(M == user) continue + D.reagents.trans_to(M, 15) + M.take_organ_damage(5) + for(var/mob/O in viewers(world.view, D)) + O.show_message(text("\red [] was hit by the syringe!", M), 1) - del(D) + del(D) if(D) for(var/atom/A in D.loc) if(A == user) continue diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 66bc9378e21..4e43acd37f8 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1544,6 +1544,7 @@ It can still be worn/put on as normal. if (W) W.loc = target.loc W.dropped(target) + if (W) W.layer = initial(W.layer) W.add_fingerprint(source) else diff --git a/code/modules/mob/living/silicon/ai/laws.dm b/code/modules/mob/living/silicon/ai/laws.dm index 714b6334043..98e8133be21 100644 --- a/code/modules/mob/living/silicon/ai/laws.dm +++ b/code/modules/mob/living/silicon/ai/laws.dm @@ -90,10 +90,11 @@ var/law = src.laws.supplied[index] if (length(law) > 0) - if (src.lawcheck[number+1] == "Yes") - src.say("[number]. [law]") - sleep(10) - number++ + if(src.lawcheck.len >= number+1) + if (src.lawcheck[number+1] == "Yes") + src.say("[number]. [law]") + sleep(10) + number++ /mob/living/silicon/ai/verb/checklaws() //Gives you a link-driven interface for deciding what laws the statelaws() proc will share with the crew. --NeoFite diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 6d4d8d04d82..c98e9121d60 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -632,7 +632,7 @@ return. var/t = input("Message:", text("Private message to [C.key]")) as text|null - if (!t || !usr || !C) + if (!t || !usr || !C || !usr.client) return if (usr.client && usr.client.holder) //Admin is messaging a player C << "\red -- Administrator private message --" diff --git a/code/modules/recycling/disposal.dm b/code/modules/recycling/disposal.dm index 7ee24449ffd..ceb14a05eeb 100644 --- a/code/modules/recycling/disposal.dm +++ b/code/modules/recycling/disposal.dm @@ -386,7 +386,7 @@ del(H) CanPass(atom/movable/mover, turf/target, height=0, air_group=0) - if (istype(mover,/obj/item)) + if (istype(mover,/obj/item) && mover.throwing) var/obj/item/I = mover if(istype(I, /obj/item/weapon/dummy) || istype(I, /obj/item/projectile)) return