Skip to content

Commit

Permalink
Not 100% sure about using switch() here
Browse files Browse the repository at this point in the history
  • Loading branch information
SabreML committed Feb 24, 2024
1 parent 031dff0 commit 94d7c40
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion code/modules/clothing/head/helmet.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 94d7c40

Please sign in to comment.