From 8077108012cd02fde3db2031e0a50a647d8609ce Mon Sep 17 00:00:00 2001 From: Bloop <13398309+vinylspiders@users.noreply.github.com> Date: Fri, 29 Dec 2023 22:07:44 -0500 Subject: [PATCH] Fixes being able to fish up qdeleted spawners (#80646) ## About The Pull Request Fixes https://github.com/NovaSector/NovaSector/issues/152 This is mostly a downstream issue, I think, but should a spawner ever get added to the fish tables here this bug will be present. Basically spawners, when created, do their item spawning behavior on the src loc and then immediately qdel themselves. If you try to forceMove() the spawners out of nullspace, like what was happening with fishing, you'd end up with an unmovable broken item that cannot be easily admin deleted. This PR also adds a stack_trace when you forceMove() a qdeleted spawner, because this is not the first time I've seen this issue come up. It doesn't stop it from happening, though, because it's easier to visually see the bug that way. This just provides some useful feedback as to why the bug is happening should you check the debug logs. ## Why It's Good For The Game Fixes a bug ## Changelog :cl: fix: fishing up a spawner will now give you the spawned item instead of a broken, undeletable spawner object code: adds a warning to the stack trace when something tries to forceMove() a qdeleted spawner /:cl: --- code/game/objects/effects/misc.dm | 5 +++++ code/modules/fishing/sources/_fish_source.dm | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/code/game/objects/effects/misc.dm b/code/game/objects/effects/misc.dm index 5a23ff32b09..2b8abcb1728 100644 --- a/code/game/objects/effects/misc.dm +++ b/code/game/objects/effects/misc.dm @@ -38,6 +38,11 @@ moveToNullspace() return QDEL_HINT_QUEUE +/obj/effect/spawner/forceMove(atom/destination) + if(destination && QDELETED(src)) // throw a warning if we try to forceMove a qdeleted spawner to somewhere other than nullspace + stack_trace("Warning: something tried to forceMove() a qdeleted [src]([type]) to non-null destination [destination]([destination.type])!") + return ..() + /obj/effect/list_container name = "list container" diff --git a/code/modules/fishing/sources/_fish_source.dm b/code/modules/fishing/sources/_fish_source.dm index 5061d84a018..120348038f1 100644 --- a/code/modules/fishing/sources/_fish_source.dm +++ b/code/modules/fishing/sources/_fish_source.dm @@ -170,10 +170,13 @@ GLOBAL_LIST_INIT(specific_fish_icons, zebra_typecacheof(list( var/atom/movable/reward = spawn_reward(reward_path, fisherman, fishing_spot) if(!reward) //balloon alert instead - fisherman.balloon_alert(fisherman,pick(duds)) + fisherman.balloon_alert(fisherman, pick(duds)) return if(isitem(reward)) //Try to put it in hand INVOKE_ASYNC(fisherman, TYPE_PROC_REF(/mob, put_in_hands), reward) + else if(istype(reward, /obj/effect/spawner)) // Do not attempt to forceMove() a spawner. It will break things, and the spawned item should already be at the mob's turf by now. + fisherman.balloon_alert(fisherman, "caught something!") + return else // for fishing things like corpses, move them to the turf of the fisherman INVOKE_ASYNC(reward, TYPE_PROC_REF(/atom/movable, forceMove), get_turf(fisherman)) fisherman.balloon_alert(fisherman, "caught [reward]!")