Keeps zone selection and gun mode toggle HUD elements visible when scoped

This commit is contained in:
mwerezak
2015-02-21 16:01:47 -05:00
parent 11719a380e
commit 47cbfdd59e
2 changed files with 98 additions and 59 deletions

View File

@@ -256,8 +256,14 @@ datum/hud/New(mob/owner)
set name = "F12"
set hidden = 1
if(hud_used)
if(ishuman(src))
if(!hud_used)
usr << "\red This mob type does not use a HUD."
return
if(!ishuman(src))
usr << "\red Inventory hiding is currently only supported for human mobs, sorry."
return
if(!client) return
if(client.view != world.view)
return
@@ -308,7 +314,41 @@ datum/hud/New(mob/owner)
hud_used.hidden_inventory_update()
hud_used.persistant_inventory_update()
update_action_buttons()
//Similar to button_pressed_F12() but keeps zone_sel, gun_setting_icon, and healths.
/mob/proc/toggle_zoom_hud()
if(!hud_used)
return
if(!ishuman(src))
return
if(!client)
return
if(client.view != world.view)
return
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
if(src.hud_used.item_action_list)
src.client.screen -= src.hud_used.item_action_list
src.client.screen -= src.internals
else
usr << "\red Inventory hiding is currently only supported for human mobs, sorry."
else
usr << "\red This mob type does not use a HUD."
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.internals)
src.client.screen |= src.internals
src.hud_used.action_intent.screen_loc = ui_acti //Restore intent selection to the original position
hud_used.hidden_inventory_update()
hud_used.persistant_inventory_update()
update_action_buttons()

View File

@@ -656,9 +656,8 @@ modules/mob/living/carbon/human/life.dm if you die, you will be zoomed out.
cannotzoom = 1
if(!zoom && !cannotzoom)
if(!usr.hud_used.hud_shown)
usr.button_pressed_F12(1) // If the user has already limited their HUD this avoids them having a HUD when they zoom in
usr.button_pressed_F12(1)
if(usr.hud_used.hud_shown)
usr.toggle_zoom_hud() // If the user has already limited their HUD this avoids them having a HUD when they zoom in
usr.client.view = viewsize
zoom = 1
@@ -684,7 +683,7 @@ modules/mob/living/carbon/human/life.dm if you die, you will be zoomed out.
else
usr.client.view = world.view
if(!usr.hud_used.hud_shown)
usr.button_pressed_F12(1)
usr.toggle_zoom_hud()
zoom = 0
usr.client.pixel_x = 0