From 892fcf33937bb52d0163f1c1cf6b6ea1aee1aaa6 Mon Sep 17 00:00:00 2001 From: Shadowlight213 Date: Tue, 28 Jun 2016 20:31:45 -0700 Subject: [PATCH] Finishes up hud stuff. Remaining issue: hide action buttons action button changing icon for both. Also action buttons arent shown for observer, but the button is shifted over. --- code/_onclick/hud/hud.dm | 2 +- code/_onclick/hud/human.dm | 52 +++++++++++-------- code/_onclick/hud/screen_objects.dm | 2 + .../modules/mob/living/carbon/update_icons.dm | 10 ++++ code/modules/mob/mob.dm | 10 ++++ code/modules/mob/mob_defines.dm | 4 +- 6 files changed, 56 insertions(+), 24 deletions(-) diff --git a/code/_onclick/hud/hud.dm b/code/_onclick/hud/hud.dm index 69668b7a3eb..9c096362431 100644 --- a/code/_onclick/hud/hud.dm +++ b/code/_onclick/hud/hud.dm @@ -197,7 +197,7 @@ /datum/hud/proc/hidden_inventory_update() return -/datum/hud/proc/persistant_inventory_update() +/datum/hud/proc/persistant_inventory_update(mob/viewer) return //Triggered when F12 is pressed (Unless someone changed something in the DMF) diff --git a/code/_onclick/hud/human.dm b/code/_onclick/hud/human.dm index 5522abe218a..cbaa21ec23e 100644 --- a/code/_onclick/hud/human.dm +++ b/code/_onclick/hud/human.dm @@ -6,14 +6,22 @@ icon_state = "toggle" /obj/screen/human/toggle/Click() - if(usr.hud_used.inventory_shown) + + var/mob/targetmob = usr + + if(isobserver(usr)) + if(ishuman(usr.client.eye) && (usr.client.eye != usr)) + var/mob/M = usr.client.eye + targetmob = M + + if(usr.hud_used.inventory_shown && targetmob.hud_used) usr.hud_used.inventory_shown = 0 - usr.client.screen -= usr.hud_used.toggleable_inventory + usr.client.screen -= targetmob.hud_used.toggleable_inventory else usr.hud_used.inventory_shown = 1 - usr.client.screen += usr.hud_used.toggleable_inventory + usr.client.screen += targetmob.hud_used.toggleable_inventory - usr.hud_used.hidden_inventory_update() + targetmob.hud_used.hidden_inventory_update(usr) /obj/screen/human/equip name = "equip" @@ -321,7 +329,7 @@ if(viewer) screenmob = viewer - if(inventory_shown && hud_shown) + if(screenmob.hud_used.inventory_shown && screenmob.hud_used.hud_shown) if(H.shoes) H.shoes.screen_loc = ui_shoes screenmob.client.screen += H.shoes @@ -347,14 +355,14 @@ H.head.screen_loc = ui_head screenmob.client.screen += H.head else - if(H.shoes) H.shoes.screen_loc = null - if(H.gloves) H.gloves.screen_loc = null - if(H.ears) H.ears.screen_loc = null - if(H.glasses) H.glasses.screen_loc = null - if(H.w_uniform) H.w_uniform.screen_loc = null - if(H.wear_suit) H.wear_suit.screen_loc = null - if(H.wear_mask) H.wear_mask.screen_loc = null - if(H.head) H.head.screen_loc = null + if(H.shoes) screenmob.client.screen -= H.shoes + if(H.gloves) screenmob.client.screen -= H.gloves + if(H.ears) screenmob.client.screen -= H.ears + if(H.glasses) screenmob.client.screen -= H.glasses + if(H.w_uniform) screenmob.client.screen -= H.w_uniform + if(H.wear_suit) screenmob.client.screen -= H.wear_suit + if(H.wear_mask) screenmob.client.screen -= H.wear_mask + if(H.head) screenmob.client.screen -= H.head /datum/hud/human/persistant_inventory_update(mob/viewer) if(!mymob) @@ -365,7 +373,7 @@ if(viewer) screenmob = viewer - if(hud_shown) + if(screenmob.hud_used.hud_shown) if(H.s_store) H.s_store.screen_loc = ui_sstore1 screenmob.client.screen += H.s_store @@ -386,17 +394,17 @@ screenmob.client.screen += H.r_store else if(H.s_store) - H.s_store.screen_loc = null + screenmob.client.screen -= H.s_store if(H.wear_id) - H.wear_id.screen_loc = null + screenmob.client.screen -= H.wear_id if(H.belt) - H.belt.screen_loc = null + screenmob.client.screen -= H.belt if(H.back) - H.back.screen_loc = null + screenmob.client.screen -= H.back if(H.l_store) - H.l_store.screen_loc = null + screenmob.client.screen -= H.l_store if(H.r_store) - H.r_store.screen_loc = null + screenmob.client.screen -= H.r_store if(hud_version != HUD_STYLE_NOHUD) if(H.r_hand) @@ -407,9 +415,9 @@ screenmob.client.screen += H.l_hand else if(H.r_hand) - H.r_hand.screen_loc = null + screenmob.client.screen -= H.r_hand if(H.l_hand) - H.l_hand.screen_loc = null + screenmob.client.screen -= H.l_hand /mob/living/carbon/human/verb/toggle_hotkey_verbs() set category = "OOC" diff --git a/code/_onclick/hud/screen_objects.dm b/code/_onclick/hud/screen_objects.dm index 71e0adca78c..2bada8c4877 100644 --- a/code/_onclick/hud/screen_objects.dm +++ b/code/_onclick/hud/screen_objects.dm @@ -54,6 +54,8 @@ /obj/screen/inventory/craft/Click() var/mob/living/M = usr + if(isobserver(usr)) + return M.OpenCraftingMenu() /obj/screen/inventory diff --git a/code/modules/mob/living/carbon/update_icons.dm b/code/modules/mob/living/carbon/update_icons.dm index ab898f6571d..25c916f326d 100644 --- a/code/modules/mob/living/carbon/update_icons.dm +++ b/code/modules/mob/living/carbon/update_icons.dm @@ -49,6 +49,11 @@ if(client && hud_used && hud_used.hud_version != HUD_STYLE_NOHUD) r_hand.screen_loc = ui_rhand client.screen += r_hand + if(observers && observers.len) + for(var/M in observers) + var/mob/dead/observe = M + if(observe.client) + observe.client.screen += r_hand var/t_state = r_hand.item_state if(!t_state) @@ -68,6 +73,11 @@ if(client && hud_used && hud_used.hud_version != HUD_STYLE_NOHUD) l_hand.screen_loc = ui_lhand client.screen += l_hand + if(observers && observers.len) + for(var/M in observers) + var/mob/dead/observe = M + if(observe.client) + observe.client.screen += l_hand var/t_state = l_hand.item_state if(!t_state) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index dd8e6124c0c..ec9a6dcf3b8 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -276,6 +276,13 @@ var/next_mob_id = 0 update_pipe_vision() /mob/dead/reset_perspective(atom/A) + if(client) + if(ismob(client.eye) && (client.eye != src)) + var/mob/target = client.eye + target.observers -= src + var/list/L = target.observers + if(!L.len) + target.observers = null if(..()) if(hud_used) client.screen = list() @@ -508,6 +515,9 @@ var/next_mob_id = 0 if(isobserver(src)) src.client.screen = list() if(mob_eye.hud_used) + if(!mob_eye.observers) + mob_eye.observers = list() + mob_eye.observers |= src mob_eye.hud_used.show_hud(1,src) /mob/verb/cancel_camera() diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index e6d1f17a3dc..b361cf48130 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -141,4 +141,6 @@ var/list/permanent_huds = list() - var/resize = 1 //Badminnery resize \ No newline at end of file + var/resize = 1 //Badminnery resize + + var/list/observers = null //The list of people observing this mob. \ No newline at end of file