From eec89c6a7e93e21743a5c857f5fe20dd3ea0c40e Mon Sep 17 00:00:00 2001 From: Crazylemon64 Date: Mon, 22 Aug 2016 21:56:39 -0700 Subject: [PATCH 1/2] Fixes a runtime when the recycler eats something and destroys something else it was going to munch --- code/game/machinery/recycler.dm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/game/machinery/recycler.dm b/code/game/machinery/recycler.dm index 4cdc3494927..194c384a175 100644 --- a/code/game/machinery/recycler.dm +++ b/code/game/machinery/recycler.dm @@ -123,7 +123,8 @@ var/const/SAFETY_COOLDOWN = 100 items_recycled++ else playsound(loc, 'sound/machines/buzz-sigh.ogg', 50, 0) - AM.loc = loc + if(AM) + AM.loc = loc if(items_recycled && sound) playsound(loc, item_recycle_sound, 100, 0) From 5b20506b02430bcf09ccbe29627c3af44b0dc491 Mon Sep 17 00:00:00 2001 From: Crazylemon64 Date: Mon, 22 Aug 2016 23:49:33 -0700 Subject: [PATCH 2/2] Replaces qdeleted with a cleaner macro --- code/__DEFINES/qdel.dm | 5 ++++- code/game/machinery/recycler.dm | 7 ++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/code/__DEFINES/qdel.dm b/code/__DEFINES/qdel.dm index 3042ff6d302..b623ce72158 100644 --- a/code/__DEFINES/qdel.dm +++ b/code/__DEFINES/qdel.dm @@ -6,4 +6,7 @@ #define QDEL_HINT_HARDDEL_NOW 4 //qdel should assume this object won't gc, and hard del it post haste. #define QDEL_HINT_PUTINPOOL 5 //qdel will put this object in the atom pool. #define QDEL_HINT_FINDREFERENCE 6 //functionally identical to QDEL_HINT_QUEUE if TESTING is not enabled in _compiler_options.dm. - //if TESTING is enabled, qdel will call this object's find_references() verb. \ No newline at end of file + //if TESTING is enabled, qdel will call this object's find_references() verb. + +// A convenient wrapper around checking for qdeletion/non-existence +#define exists(A) (A && !qdeleted(A)) diff --git a/code/game/machinery/recycler.dm b/code/game/machinery/recycler.dm index 194c384a175..4a9d8c439ae 100644 --- a/code/game/machinery/recycler.dm +++ b/code/game/machinery/recycler.dm @@ -113,7 +113,9 @@ var/const/SAFETY_COOLDOWN = 100 for(var/i in to_eat) var/atom/movable/AM = i - if(isliving(AM)) + if(!exists(AM)) + continue + else if(isliving(AM)) if(emagged) crush_living(AM) else @@ -123,8 +125,7 @@ var/const/SAFETY_COOLDOWN = 100 items_recycled++ else playsound(loc, 'sound/machines/buzz-sigh.ogg', 50, 0) - if(AM) - AM.loc = loc + AM.forceMove(loc) if(items_recycled && sound) playsound(loc, item_recycle_sound, 100, 0)