Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Helmet HUDs skip over HUDs that are already in effect on the player #5600

Merged
merged 8 commits into from
Feb 3, 2024
Merged
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions code/modules/clothing/head/helmet.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -680,15 +687,16 @@ 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

Staykeu marked this conversation as resolved.
Show resolved Hide resolved
active_visor = null
recalculate_visors(user)
return FALSE

return FALSE
harryob marked this conversation as resolved.
Show resolved Hide resolved
/datum/action/item_action/cycle_helmet_huds/New(Target, obj/item/holder)
. = ..()
name = "Cycle helmet HUD"
Expand Down
Loading