From 94d7c40234fe2ee3e6dcf1f8481e616812be917e Mon Sep 17 00:00:00 2001 From: SabreML <57483089+SabreML@users.noreply.github.com> Date: Sat, 24 Feb 2024 20:58:41 +0000 Subject: [PATCH] Not 100% sure about using `switch()` here --- code/modules/clothing/head/helmet.dm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/code/modules/clothing/head/helmet.dm b/code/modules/clothing/head/helmet.dm index adfbfb023309..f1ee7e82d8bc 100644 --- a/code/modules/clothing/head/helmet.dm +++ b/code/modules/clothing/head/helmet.dm @@ -511,7 +511,17 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list( new_action.give_to(user) return - if(HAS_TRAIT(attacking_item, TRAIT_TOOL_SCREWDRIVER) && length(inserted_visors)) + if(HAS_TRAIT(attacking_item, TRAIT_TOOL_SCREWDRIVER)) + // If there isn't anything to remove, return. + if(!length(inserted_visors)) + // If the user is trying to remove a built-in visor, give them a more helpful failure message. + switch(length(built_in_visors)) + if(1) // Messy plural handling + to_chat(user, SPAN_WARNING("The visor on [src] is built-in!")) + if(2 to INFINITY) + to_chat(user, SPAN_WARNING("The visors on [src] are built-in!")) + return + if(active_visor) var/obj/item/device/helmet_visor/temp_visor_holder = active_visor active_visor = null