From be45c18c961b4758a7df5ab394a4d8dfa56fc9bb Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Sun, 19 Feb 2023 04:25:12 +0100 Subject: [PATCH] [MIRROR] Don't print a misleading message when not picking a spider. [MDB IGNORE] (#19429) * Don't print a misleading message when not picking a spider. (#73483) ## About The Pull Request Fixes #73468 The admin message in `mob_spawn/ghost_role/attack_ghost` was warning admins any time a ghost role spawner did not create a mob, however clicking a spider egg opens a radial menu. Neglecting to choose one of the options (and closing the menu) does not return a mob, and was implying that some kind of error occurred when this is actually expected behaviour. Also as noted in the comments this probably needn't message admins in the first place, we now log it as a crash instead. ## Why It's Good For The Game We shouldn't print a log message in admin chat for expected behaviour. Logging changes will help diagnose if this was masking an _actual_ bug. ## Changelog :cl: fix: Clicking a spider egg and then closing the radial menu won't print a message in admin channel informing admins that the egg didn't spawn anything. /:cl: * Don't print a misleading message when not picking a spider. --------- Co-authored-by: Jacquerel --- code/modules/mob_spawn/mob_spawn.dm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/code/modules/mob_spawn/mob_spawn.dm b/code/modules/mob_spawn/mob_spawn.dm index 37736ac08a2..1a7fbafcf11 100644 --- a/code/modules/mob_spawn/mob_spawn.dm +++ b/code/modules/mob_spawn/mob_spawn.dm @@ -36,6 +36,7 @@ if(faction) faction = string_list(faction) +/// Creates whatever mob the spawner makes. Return FALSE if we want to exit from here without doing that, returning NULL will be logged to admins. /obj/effect/mob_spawn/proc/create(mob/mob_possessor, newname) var/mob/living/spawned_mob = new mob_type(get_turf(src)) //living mobs only name_mob(spawned_mob, newname) @@ -194,9 +195,12 @@ user.log_message("became a [prompt_name].", LOG_GAME) uses -= 1 // Remove a use before trying to spawn to prevent strangeness like the spawner trying to spawn more mobs than it should be able to - if(!(create(user))) - message_admins("[src] didn't return anything when creating a mob, this might be broken! The use of the spawner it would have taken has been refunded.") - uses += 1 // Oops! We messed up and somehow the mob didn't spawn, but that's alright we can refund the use. + var/created = create(user) + if(!created) + if(isnull(created)) // If we explicitly return FALSE instead of just not returning a mob, we don't want to spam the admins + CRASH("An instance of [type] didn't return anything when creating a mob, this might be broken!") + + uses += 1 // Refund use because we didn't actually spawn anything check_uses() // Now we check if the spawner should delete itself or not