From 4f58f4ab01f1edb4f9466da6dceaaab985a67090 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Sun, 6 Nov 2022 22:26:33 +0100 Subject: [PATCH] [MIRROR] Ensures bunkering someone doesn't runtime due to a divide by 0 error [MDB IGNORE] (#17392) * Ensures bunkering someone doesn't runtime due to a divide by 0 error (#71081) ## About The Pull Request HAHHHHHHHHHHHHHHHH * Ensures bunkering someone doesn't runtime due to a divide by 0 error Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com> --- code/modules/admin/verbs/panicbunker.dm | 2 +- code/modules/client/client_procs.dm | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/code/modules/admin/verbs/panicbunker.dm b/code/modules/admin/verbs/panicbunker.dm index 25c9127a63d..8a5ac67a5a8 100644 --- a/code/modules/admin/verbs/panicbunker.dm +++ b/code/modules/admin/verbs/panicbunker.dm @@ -10,7 +10,7 @@ var/time_rec = 0 var/message = "" if(new_pb) - time_rec = input(src, "How many living minutes should they need to play?", "Shit's fucked isn't it", CONFIG_GET(number/panic_bunker_living)) as num + time_rec = input(src, "How many living minutes should they need to play? 0 to disable.", "Shit's fucked isn't it", CONFIG_GET(number/panic_bunker_living)) as num message = input(src, "What should they see when they log in?", "MMM", CONFIG_GET(string/panic_bunker_message)) as text message = replacetext(message, "%minutes%", time_rec) CONFIG_SET(number/panic_bunker_living, time_rec) diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm index 9336b0a6d6a..d47b85650eb 100644 --- a/code/modules/client/client_procs.dm +++ b/code/modules/client/client_procs.dm @@ -643,9 +643,9 @@ GLOBAL_LIST_INIT(blacklisted_builds, list( if(!CONFIG_GET(flag/panic_bunker_interview)) // If we don't have panic_bunker_living set and the client is not in the DB, reject them. // Otherwise, if we do have a panic_bunker_living set, check if they have enough minutes played. - if((!living_recs && !client_is_in_db) || living_recs >= minutes) + if((living_recs == 0 && !client_is_in_db) || living_recs >= minutes) var/reject_message = "Failed Login: [key] - [client_is_in_db ? "":"New "]Account attempting to connect during panic bunker, but\ - [living_recs == -1 ? " was rejected due to no prior connections to game servers (no database entry)":" they do not have the required living time [minutes]/[living_recs]"]." + [living_recs == 0 ? " was rejected due to no prior connections to game servers (no database entry)":" they do not have the required living time [minutes]/[living_recs]"]." log_access(reject_message) message_admins(span_adminnotice("[reject_message]")) var/message = CONFIG_GET(string/panic_bunker_message)