From 7e7bfcc7a14911a63c2a2115a41a72c0c66ead5c Mon Sep 17 00:00:00 2001 From: Mickyan <38563876+Mickyan@users.noreply.github.com> Date: Sat, 18 Apr 2020 01:02:39 +0200 Subject: [PATCH] Fixes explosions damaging the contents of atoms with the PREVENT_CONTENTS_EXPLOSION_1 flag (#50397) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #49986 Fixes #49232 🆑 fix: Being at the epicenter of explosions no longer damage the contents of storage that is meant to prevent it (most commonly photos inside photo albums) /🆑 --- code/__HELPERS/unsorted.dm | 12 +++++++----- code/datums/explosion.dm | 4 ++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 97fbb9b7d98..3627ee88f2b 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -449,7 +449,7 @@ Turf and target are separate in case you want to teleport some distance from a t Gets all contents of contents and returns them all in a list. */ -/atom/proc/GetAllContents(var/T) +/atom/proc/GetAllContents(var/T, ignore_flag_1) var/list/processing_list = list(src) if(T) . = list() @@ -458,14 +458,16 @@ Turf and target are separate in case you want to teleport some distance from a t var/atom/A = processing_list[++i] //Byond does not allow things to be in multiple contents, or double parent-child hierarchies, so only += is needed //This is also why we don't need to check against assembled as we go along - processing_list += A.contents - if(istype(A,T)) - . += A + if (!(A.flags_1 & ignore_flag_1)) + processing_list += A.contents + if(istype(A,T)) + . += A else var/i = 0 while(i < length(processing_list)) var/atom/A = processing_list[++i] - processing_list += A.contents + if (!(A.flags_1 & ignore_flag_1)) + processing_list += A.contents return processing_list /atom/proc/GetAllContentsIgnoring(list/ignore_typecache) diff --git a/code/datums/explosion.dm b/code/datums/explosion.dm index f751de8bc86..8a3e931bdac 100644 --- a/code/datums/explosion.dm +++ b/code/datums/explosion.dm @@ -198,8 +198,8 @@ GLOBAL_LIST_EMPTY(explosions) var/list/items = list() for(var/I in T) var/atom/A = I - if (!(A.flags_1 & PREVENT_CONTENTS_EXPLOSION_1)) //The atom/contents_explosion() proc returns null if the contents ex_acting has been handled by the atom, and TRUE if it hasn't. - items += A.GetAllContents() + if (!(A.flags_1 & PREVENT_CONTENTS_EXPLOSION_1)) + items += A.GetAllContents(ignore_flag_1 = PREVENT_CONTENTS_EXPLOSION_1) for(var/O in items) var/atom/A = O if(!QDELETED(A))