From 3dcdccbd8187cd81ace0bf461193581833791250 Mon Sep 17 00:00:00 2001 From: "mport2004@gmail.com" Date: Mon, 2 Jan 2012 20:03:01 +0000 Subject: [PATCH] Added a limit to the Entered loop. Doors will only check for the presence of a mob rather than looping though all of them and will play a sound rather than message when it does find one. Door damage lowered to 5 with Urist's permission, you have a chance to get someone to help you before you are crushed to death now. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@2902 316c924e-a436-60f5-8080-3fe189b3f50e --- code/game/machinery/doors/airlock.dm | 28 +++++++++++++--------------- code/game/turf.dm | 23 ++++++++++++++++------- code/setup.dm | 2 +- 3 files changed, 30 insertions(+), 23 deletions(-) diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index 56a6ddca2ca..f11fa5f00f7 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -1047,25 +1047,23 @@ About the new airlock wires panel: if(src.welded || src.locked || (!src.arePowerSystemsOn()) || (stat & NOPOWER) || src.isWireCut(AIRLOCK_WIRE_DOOR_BOLTS)) return if(safe) - for(var/mob/M in src.loc) - M << "The door buzzes angerly." - for(var/mob/M in src.loc) + if(locate(/mob/living) in get_turf(src)) + playsound(src.loc, 'buzz-two.ogg', 50, 0) spawn (60) close() return - else // OH FUCK MOVE - for(var/mob/M in src.loc) - if(isrobot(M)) - M.adjustBruteLoss(DOOR_CRUSH_DAMAGE) - else - M.adjustBruteLoss(DOOR_CRUSH_DAMAGE) - M.SetStunned(5) - M.SetWeakened(5) - M.emote("scream") - var/turf/location = src.loc - if(istype(location, /turf/simulated)) - location.add_blood(M) + for(var/mob/M in get_turf(src)) + if(isrobot(M)) + M.adjustBruteLoss(DOOR_CRUSH_DAMAGE) + else + M.adjustBruteLoss(DOOR_CRUSH_DAMAGE) + M.SetStunned(5) + M.SetWeakened(5) + M.emote("scream") + var/turf/location = src.loc + if(istype(location, /turf/simulated)) + location.add_blood(M) use_power(50) playsound(src.loc, 'airlock.ogg', 30, 1) diff --git a/code/game/turf.dm b/code/game/turf.dm index bc9104b1368..9e412cccf23 100644 --- a/code/game/turf.dm +++ b/code/game/turf.dm @@ -80,18 +80,25 @@ /turf/Entered(atom/movable/M as mob|obj) + var/loopsanity = 10 if(ismob(M)) if(M.flags & NOGRAV) inertial_drift(M) else if(!istype(src, /turf/space)) M:inertia_dir = 0 ..() + var/objects = 0 for(var/atom/A as mob|obj|turf|area in src) + if(objects > loopsanity) break + objects++ spawn( 0 ) if ((A && M)) A.HasEntered(M, 1) return + objects = 0 for(var/atom/A as mob|obj|turf|area in range(1)) + if(objects > loopsanity) break + objects++ spawn( 0 ) if ((A && M)) A.HasProximity(M, 1) @@ -168,17 +175,19 @@ if (istype(A,/mob/living/carbon)) var/mob/living/carbon/M = A if(M.lying) return - if(istype(M, /mob/living/carbon/human)) // Split this into two seperate if checks, when non-humans were being checked it would throw a null error -- TLE - if(istype(M:shoes, /obj/item/clothing/shoes/clown_shoes)) - if(M.m_intent == "run") - if(M.footstep >= 2) - M.footstep = 0 + if(istype(M, /mob/living/carbon/human)) + var/mob/living/carbon/human/H = M + if(istype(H.shoes, /obj/item/clothing/shoes/clown_shoes)) + if(H.m_intent == "run") + if(H.footstep >= 2) + H.footstep = 0 else - M.footstep++ - if(M.footstep == 0) + H.footstep++ + if(H.footstep == 0) playsound(src, "clownstep", 50, 1) // this will get annoying very fast. else playsound(src, "clownstep", 20, 1) + switch (src.wet) if(1) if(istype(M, /mob/living/carbon/human)) // Added check since monkeys don't have shoes diff --git a/code/setup.dm b/code/setup.dm index ae3486217ea..3e6f0a8ab27 100644 --- a/code/setup.dm +++ b/code/setup.dm @@ -27,7 +27,7 @@ #define MAX_PRESSURE_DAMAGE 20 // Doors! -#define DOOR_CRUSH_DAMAGE 20 +#define DOOR_CRUSH_DAMAGE 5 // Factor of how fast mob nutrition decreases #define HUNGER_FACTOR 0.1