Merge pull request #7871 from VOREStation/aro-hudhiding

Allow hiding other huds like ghost huds with F12
This commit is contained in:
Aronai Sieyes
2020-05-15 20:48:45 -04:00
committed by GitHub

View File

@@ -332,61 +332,66 @@ datum/hud/New(mob/owner)
if(!hud_used) if(!hud_used)
to_chat(usr, "<span class='warning'>This mob type does not use a HUD.</span>") to_chat(usr, "<span class='warning'>This mob type does not use a HUD.</span>")
return return FALSE
if(!client)
if(!ishuman(src)) return FALSE
to_chat(usr, "<span class='warning'>Inventory hiding is currently only supported for human mobs, sorry.</span>")
return
if(!client) return
if(client.view != world.view) if(client.view != world.view)
return return FALSE
toggle_hud_vis(full)
/mob/proc/toggle_hud_vis(full)
if(hud_used.hud_shown) if(hud_used.hud_shown)
hud_used.hud_shown = 0 hud_used.hud_shown = 0
if(src.hud_used.adding) if(hud_used.adding)
src.client.screen -= src.hud_used.adding client.screen -= hud_used.adding
if(src.hud_used.other) if(hud_used.other)
src.client.screen -= src.hud_used.other client.screen -= hud_used.other
if(src.hud_used.hotkeybuttons) if(hud_used.hotkeybuttons)
src.client.screen -= src.hud_used.hotkeybuttons client.screen -= hud_used.hotkeybuttons
//Due to some poor coding some things need special treatment:
//These ones are a part of 'adding', 'other' or 'hotkeybuttons' but we want them to stay
if(!full)
src.client.screen += src.hud_used.l_hand_hud_object //we want the hands to be visible
src.client.screen += src.hud_used.r_hand_hud_object //we want the hands to be visible
src.client.screen += src.hud_used.action_intent //we want the intent swticher visible
src.hud_used.action_intent.screen_loc = ui_acti_alt //move this to the alternative position, where zone_select usually is.
else
src.client.screen -= src.healths
src.client.screen -= src.internals
src.client.screen -= src.gun_setting_icon
//These ones are not a part of 'adding', 'other' or 'hotkeybuttons' but we want them gone.
src.client.screen -= src.zone_sel //zone_sel is a mob variable for some reason.
else else
hud_used.hud_shown = 1 hud_used.hud_shown = 1
if(src.hud_used.adding) if(hud_used.adding)
src.client.screen += src.hud_used.adding client.screen += hud_used.adding
if(src.hud_used.other && src.hud_used.inventory_shown) if(hud_used.other && hud_used.inventory_shown)
src.client.screen += src.hud_used.other client.screen += hud_used.other
if(src.hud_used.hotkeybuttons && !src.hud_used.hotkey_ui_hidden) if(hud_used.hotkeybuttons && !hud_used.hotkey_ui_hidden)
src.client.screen += src.hud_used.hotkeybuttons client.screen += hud_used.hotkeybuttons
if(src.healths) if(healths)
src.client.screen |= src.healths client.screen |= healths
if(src.internals) if(internals)
src.client.screen |= src.internals client.screen |= internals
if(src.gun_setting_icon) if(gun_setting_icon)
src.client.screen |= src.gun_setting_icon client.screen |= gun_setting_icon
src.hud_used.action_intent.screen_loc = ui_acti //Restore intent selection to the original position hud_used?.action_intent.screen_loc = ui_acti //Restore intent selection to the original position
src.client.screen += src.zone_sel //This one is a special snowflake client.screen += zone_sel //This one is a special snowflake
hud_used.hidden_inventory_update() hud_used.hidden_inventory_update()
hud_used.persistant_inventory_update() hud_used.persistant_inventory_update()
update_action_buttons() update_action_buttons()
hud_used.reorganize_alerts() hud_used.reorganize_alerts()
return TRUE
/mob/living/carbon/human/toggle_hud_vis(full)
..()
// Prevents humans from hiding a few hud elements
if(!hud_used.hud_shown) // transitioning to hidden
//Due to some poor coding some things need special treatment:
//These ones are a part of 'adding', 'other' or 'hotkeybuttons' but we want them to stay
if(!full)
client.screen += hud_used.l_hand_hud_object //we want the hands to be visible
client.screen += hud_used.r_hand_hud_object //we want the hands to be visible
client.screen += hud_used.action_intent //we want the intent swticher visible
hud_used?.action_intent.screen_loc = ui_acti_alt //move this to the alternative position, where zone_select usually is.
else
client.screen -= healths
client.screen -= internals
client.screen -= gun_setting_icon
//These ones are not a part of 'adding', 'other' or 'hotkeybuttons' but we want them gone.
client.screen -= zone_sel //zone_sel is a mob variable for some reason.
//Similar to button_pressed_F12() but keeps zone_sel, gun_setting_icon, and healths. //Similar to button_pressed_F12() but keeps zone_sel, gun_setting_icon, and healths.
/mob/proc/toggle_zoom_hud() /mob/proc/toggle_zoom_hud()