From b385ed83b58dbb78cfb7f7bdf80f68076f11f1bc Mon Sep 17 00:00:00 2001 From: ikarrus Date: Sun, 11 May 2014 00:41:40 -0600 Subject: [PATCH] -Added checks to prevent the nuke disk from leaving z1 -If the disk is deleted while it's inside a nuke, the nuke will lock itself Conflicts: code/game/gamemodes/nuclear/nuclearbomb.dm code/game/turfs/space/space.dm --- code/__HELPERS/unsorted.dm | 20 +++++++++++++++++ code/game/turfs/space/space.dm | 40 ++++++++++++++++++++-------------- 2 files changed, 44 insertions(+), 16 deletions(-) diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 32f759539c3..9671769aaef 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -1602,3 +1602,23 @@ proc/check_target_facings(mob/living/initator, mob/living/target) ext_python("voice.py", "\"[accent]\" \"[voice]\" \"[pitch]\" \"[echo]\" \"[speed]\" \"[text]\" \"[src.ckey]\"") +atom/proc/GetTypeInAllContents(typepath) + var/list/processing_list = list(src) + var/list/processed = list() + + var/atom/found = null + + while(processing_list.len && found==null) + var/atom/A = processing_list[1] + if(istype(A, typepath)) + found = A + + processing_list -= A + + for(var/atom/a in A) + if(!(a in processed)) + processing_list |= a + + processed |= A + + return found \ No newline at end of file diff --git a/code/game/turfs/space/space.dm b/code/game/turfs/space/space.dm index a27c4378f23..8d929eb6510 100644 --- a/code/game/turfs/space/space.dm +++ b/code/game/turfs/space/space.dm @@ -94,12 +94,13 @@ del(A) //The disk's Destroy() proc ensures a new one is created return - var/list/disk_search = A.search_contents_for(/obj/item/weapon/disk/nuclear) - if(!isemptylist(disk_search)) - if(istype(A, /mob/living)) - var/mob/living/MM = A + var/mob/living/MM = null + var/fukkendisk = A.GetTypeInAllContents(/obj/item/weapon/disk/nuclear) + if(fukkendisk) + if(isliving(A)) + MM = A if(MM.client && !MM.stat) - MM << "\red Something you are carrying is preventing you from leaving. Don't play stupid; you know exactly what it is." + MM << "Something you are carrying is preventing you from leaving. Don't play stupid; you know exactly what it is." if(MM.x <= TRANSITIONEDGE) MM.inertia_dir = 4 else if(MM.x >= world.maxx -TRANSITIONEDGE) @@ -109,18 +110,25 @@ else if(MM.y >= world.maxy -TRANSITIONEDGE) MM.inertia_dir = 2 else - for(var/obj/item/weapon/disk/nuclear/N in disk_search) - del(N)//Make the disk respawn it is on a clientless mob or corpse + qdel(fukkendisk)//Make the disk respawn if it is on a clientless mob or corpse else - for(var/obj/item/weapon/disk/nuclear/N in disk_search) - del(N)//Make the disk respawn if it is floating on its own + qdel(fukkendisk)//Make the disk respawn if it is floating on its own return - var/mob/living/MOB = null + //Check if it's a mob pulling an object. Have the object transition with the mob if it's not the nuke disk var/obj/was_pulling = null if(isliving(A)) - MOB = A - was_pulling = MOB.pulling + MM = A + if(MM.pulling) + //Check for that fucking disk + if(istype(MM.pulling, /obj/item/weapon/disk/nuclear)) + qdel(MM.pulling) + else + was_pulling = MM.pulling + fukkendisk = was_pulling.GetTypeInAllContents(/obj/item/weapon/disk/nuclear) + if(fukkendisk) + MM << "You think you saw something slip out of [was_pulling], but you couldn't tell where it went..." + qdel(fukkendisk) var/move_to_z = src.z var/safety = 1 @@ -154,10 +162,10 @@ A.x = rand(TRANSITIONEDGE + 2, world.maxx - TRANSITIONEDGE - 2) spawn (0) - if(was_pulling) - was_pulling.loc = MOB.loc - MOB.pulling = was_pulling - was_pulling.pulledby = MOB + if(was_pulling && MM) + was_pulling.loc = MM.loc + MM.pulling = was_pulling + was_pulling.pulledby = MM if ((A && A.loc)) A.loc.Entered(A)