From 9ec585ec68bd2f1c2875647588715a9bbcf694e7 Mon Sep 17 00:00:00 2001 From: Arokha Sieyes Date: Fri, 15 May 2020 11:57:44 -0400 Subject: [PATCH] Allow hiding other huds like ghost huds with F12 --- code/_onclick/hud/hud.dm | 93 +++++++++++++++++++++------------------- 1 file changed, 49 insertions(+), 44 deletions(-) diff --git a/code/_onclick/hud/hud.dm b/code/_onclick/hud/hud.dm index c4dabaf3ca..917fbb7c56 100644 --- a/code/_onclick/hud/hud.dm +++ b/code/_onclick/hud/hud.dm @@ -332,61 +332,66 @@ datum/hud/New(mob/owner) if(!hud_used) to_chat(usr, "This mob type does not use a HUD.") - return - - if(!ishuman(src)) - to_chat(usr, "Inventory hiding is currently only supported for human mobs, sorry.") - return - - if(!client) return + return FALSE + if(!client) + return FALSE if(client.view != world.view) - return + return FALSE + + toggle_hud_vis(full) + +/mob/proc/toggle_hud_vis(full) if(hud_used.hud_shown) hud_used.hud_shown = 0 - if(src.hud_used.adding) - src.client.screen -= src.hud_used.adding - if(src.hud_used.other) - src.client.screen -= src.hud_used.other - if(src.hud_used.hotkeybuttons) - src.client.screen -= src.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. - + if(hud_used.adding) + client.screen -= hud_used.adding + if(hud_used.other) + client.screen -= hud_used.other + if(hud_used.hotkeybuttons) + client.screen -= hud_used.hotkeybuttons else hud_used.hud_shown = 1 - if(src.hud_used.adding) - src.client.screen += src.hud_used.adding - if(src.hud_used.other && src.hud_used.inventory_shown) - src.client.screen += src.hud_used.other - if(src.hud_used.hotkeybuttons && !src.hud_used.hotkey_ui_hidden) - src.client.screen += src.hud_used.hotkeybuttons - if(src.healths) - src.client.screen |= src.healths - if(src.internals) - src.client.screen |= src.internals - if(src.gun_setting_icon) - src.client.screen |= src.gun_setting_icon + if(hud_used.adding) + client.screen += hud_used.adding + if(hud_used.other && hud_used.inventory_shown) + client.screen += hud_used.other + if(hud_used.hotkeybuttons && !hud_used.hotkey_ui_hidden) + client.screen += hud_used.hotkeybuttons + if(healths) + client.screen |= healths + if(internals) + client.screen |= internals + if(gun_setting_icon) + client.screen |= gun_setting_icon - src.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 + hud_used?.action_intent.screen_loc = ui_acti //Restore intent selection to the original position + client.screen += zone_sel //This one is a special snowflake hud_used.hidden_inventory_update() hud_used.persistant_inventory_update() update_action_buttons() 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. /mob/proc/toggle_zoom_hud()