From 6f8f57121aa355d53e65210e73667ee5a89c04e2 Mon Sep 17 00:00:00 2001 From: Staykeu Date: Tue, 30 Jan 2024 20:35:36 -0500 Subject: [PATCH] base --- code/modules/clothing/head/helmet.dm | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/code/modules/clothing/head/helmet.dm b/code/modules/clothing/head/helmet.dm index 3d7d774bd1ed..bc39d054a714 100644 --- a/code/modules/clothing/head/helmet.dm +++ b/code/modules/clothing/head/helmet.dm @@ -670,8 +670,15 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list( for(var/hud_type in total_visors) if(hud_type == active_visor) if(length(total_visors) > iterator) - active_visor = total_visors[(iterator + 1)] - toggle_visor(user, total_visors[iterator], TRUE) + var/obj/item/device/helmet_visor/current_visor = total_visors[iterator] + var/obj/item/device/helmet_visor/next_visor = total_visors[iterator + 1] + + if(!isnull(GLOB.huds[next_visor.hud_type].hudusers[user])) + iterator++ + continue + + active_visor = next_visor + toggle_visor(user, current_visor, silent = TRUE) // disables the old visor toggle_visor(user) return active_visor else @@ -680,15 +687,15 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list( return FALSE iterator++ - if(total_visors[1]) - active_visor = total_visors[1] + for(var/obj/item/device/helmet_visor/new_visor in total_visors) + + if(!isnull(GLOB.huds[new_visor.hud_type].hudusers[user])) + continue + + active_visor = new_visor toggle_visor(user) return active_visor - active_visor = null - recalculate_visors(user) - return FALSE - /datum/action/item_action/cycle_helmet_huds/New(Target, obj/item/holder) . = ..() name = "Cycle helmet HUD"