From c36b095146a97cf072f1b224dde3699c5a976635 Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Sun, 21 Jan 2018 10:13:59 -0500 Subject: [PATCH] Fixes ghost show_hud runtime --- code/_onclick/hud/ghost.dm | 90 ++++++++++++++++++++++++++++++++++++++ code/_onclick/hud/hud.dm | 41 +++++++++-------- code/_onclick/hud/human.dm | 8 ++-- 3 files changed, 116 insertions(+), 23 deletions(-) diff --git a/code/_onclick/hud/ghost.dm b/code/_onclick/hud/ghost.dm index acda7f36e5..4b1e65547e 100644 --- a/code/_onclick/hud/ghost.dm +++ b/code/_onclick/hud/ghost.dm @@ -1,3 +1,4 @@ +<<<<<<< HEAD /obj/screen/ghost icon = 'icons/mob/screen_ghost.dmi' @@ -82,3 +83,92 @@ /mob/dead/observer/create_mob_hud() if(client && !hud_used) hud_used = new /datum/hud/ghost(src, ui_style2icon(client.prefs.UI_style)) +======= +/obj/screen/ghost + icon = 'icons/mob/screen_ghost.dmi' + +/obj/screen/ghost/MouseEntered() + flick(icon_state + "_anim", src) + +/obj/screen/ghost/jumptomob + name = "Jump to mob" + icon_state = "jumptomob" + +/obj/screen/ghost/jumptomob/Click() + var/mob/dead/observer/G = usr + G.jumptomob() + +/obj/screen/ghost/orbit + name = "Orbit" + icon_state = "orbit" + +/obj/screen/ghost/orbit/Click() + var/mob/dead/observer/G = usr + G.follow() + +/obj/screen/ghost/reenter_corpse + name = "Reenter corpse" + icon_state = "reenter_corpse" + +/obj/screen/ghost/reenter_corpse/Click() + var/mob/dead/observer/G = usr + G.reenter_corpse() + +/obj/screen/ghost/teleport + name = "Teleport" + icon_state = "teleport" + +/obj/screen/ghost/teleport/Click() + var/mob/dead/observer/G = usr + G.dead_tele() + +/obj/screen/ghost/pai + name = "pAI Candidate" + icon_state = "pai" + +/obj/screen/ghost/pai/Click() + var/mob/dead/observer/G = usr + G.register_pai() + +/datum/hud/ghost/New(mob/owner, ui_style = 'icons/mob/screen_midnight.dmi') + ..() + var/obj/screen/using + + using = new /obj/screen/ghost/jumptomob() + using.screen_loc = ui_ghost_jumptomob + static_inventory += using + + using = new /obj/screen/ghost/orbit() + using.screen_loc = ui_ghost_orbit + static_inventory += using + + using = new /obj/screen/ghost/reenter_corpse() + using.screen_loc = ui_ghost_reenter_corpse + static_inventory += using + + using = new /obj/screen/ghost/teleport() + using.screen_loc = ui_ghost_teleport + static_inventory += using + + using = new /obj/screen/ghost/pai() + using.screen_loc = ui_ghost_pai + static_inventory += using + + using = new /obj/screen/language_menu + using.icon = ui_style + static_inventory += using + +/datum/hud/ghost/show_hud(version = 0, mob/viewmob) + . = ..() + if(!.) + return + var/mob/screenmob = viewmob || mymob + if(!screenmob.client.prefs.ghost_hud) + screenmob.client.screen -= static_inventory + else + screenmob.client.screen += static_inventory + +/mob/dead/observer/create_mob_hud() + if(client && !hud_used) + hud_used = new /datum/hud/ghost(src, ui_style2icon(client.prefs.UI_style)) +>>>>>>> e59c43d... Merge pull request #34629 from ShizCalev/showhud-runtime diff --git a/code/_onclick/hud/hud.dm b/code/_onclick/hud/hud.dm index a212d46f99..5693e9c47e 100644 --- a/code/_onclick/hud/hud.dm +++ b/code/_onclick/hud/hud.dm @@ -7,11 +7,10 @@ /datum/hud var/mob/mymob - var/hud_shown = 1 //Used for the HUD toggle (F12) - var/hud_version = 1 //Current displayed version of the HUD - var/inventory_shown = 0 //Equipped item inventory - var/show_intent_icons = 0 - var/hotkey_ui_hidden = 0 //This is to hide the buttons that can be used via hotkeys. (hotkeybuttons list of buttons) + var/hud_shown = TRUE //Used for the HUD toggle (F12) + var/hud_version = HUD_STYLE_STANDARD //Current displayed version of the HUD + var/inventory_shown = FALSE //Equipped item inventory + var/hotkey_ui_hidden = FALSE //This is to hide the buttons that can be used via hotkeys. (hotkeybuttons list of buttons) var/obj/screen/ling/chems/lingchemdisplay var/obj/screen/ling/sting/lingstingdisplay @@ -23,7 +22,6 @@ var/obj/screen/devil/soul_counter/devilsouldisplay - var/obj/screen/nightvisionicon var/obj/screen/action_intent var/obj/screen/zone_select var/obj/screen/pull_icon @@ -40,7 +38,7 @@ var/list/obj/screen/plane_master/plane_masters = list() // see "appearance_flags" in the ref, assoc list of "[plane]" = object var/obj/screen/movable/action_button/hide_toggle/hide_actions_toggle - var/action_buttons_hidden = 0 + var/action_buttons_hidden = FALSE var/obj/screen/healths var/obj/screen/healthdoll @@ -111,7 +109,6 @@ blobpwrdisplay = null alien_plasma_display = null alien_queen_finder = null - nightvisionicon = null if(plane_masters.len) for(var/thing in plane_masters) @@ -134,10 +131,10 @@ //Version denotes which style should be displayed. blank or 0 means "next version" /datum/hud/proc/show_hud(version = 0,mob/viewmob) if(!ismob(mymob)) - return 0 + return FALSE var/mob/screenmob = viewmob || mymob if(!screenmob.client) - return 0 + return FALSE screenmob.client.screen = list() screenmob.client.apply_clickcatcher() @@ -150,7 +147,7 @@ switch(display_hud_version) if(HUD_STYLE_STANDARD) //Default HUD - hud_shown = 1 //Governs behavior of other procs + hud_shown = TRUE //Governs behavior of other procs if(static_inventory.len) screenmob.client.screen += static_inventory if(toggleable_inventory.len && screenmob.hud_used && screenmob.hud_used.inventory_shown) @@ -166,7 +163,7 @@ action_intent.screen_loc = initial(action_intent.screen_loc) //Restore intent selection to the original position if(HUD_STYLE_REDUCED) //Reduced HUD - hud_shown = 0 //Governs behavior of other procs + hud_shown = FALSE //Governs behavior of other procs if(static_inventory.len) screenmob.client.screen -= static_inventory if(toggleable_inventory.len) @@ -186,7 +183,7 @@ action_intent.screen_loc = ui_acti_alt //move this to the alternative position, where zone_select usually is. if(HUD_STYLE_NOHUD) //No HUD - hud_shown = 0 //Governs behavior of other procs + hud_shown = FALSE //Governs behavior of other procs if(static_inventory.len) screenmob.client.screen -= static_inventory if(toggleable_inventory.len) @@ -201,17 +198,23 @@ hud_version = display_hud_version persistent_inventory_update(screenmob) - mymob.update_action_buttons(1) + screenmob.update_action_buttons(1) reorganize_alerts() - mymob.reload_fullscreen() + screenmob.reload_fullscreen() update_parallax_pref(screenmob) + return TRUE /datum/hud/human/show_hud(version = 0,mob/viewmob) - ..() - hidden_inventory_update(viewmob) + . = ..() + if(!.) + return + var/mob/screenmob = viewmob || mymob + hidden_inventory_update(screenmob) /datum/hud/robot/show_hud(version = 0, mob/viewmob) - ..() + . = ..() + if(!.) + return update_robot_modules_display() /datum/hud/proc/hidden_inventory_update() @@ -224,7 +227,7 @@ //Triggered when F12 is pressed (Unless someone changed something in the DMF) /mob/verb/button_pressed_F12() set name = "F12" - set hidden = 1 + set hidden = TRUE if(hud_used && client) hud_used.show_hud() //Shows the next hud preset diff --git a/code/_onclick/hud/human.dm b/code/_onclick/hud/human.dm index fe53528155..f9f1849c87 100644 --- a/code/_onclick/hud/human.dm +++ b/code/_onclick/hud/human.dm @@ -15,10 +15,10 @@ targetmob = M if(usr.hud_used.inventory_shown && targetmob.hud_used) - usr.hud_used.inventory_shown = 0 + usr.hud_used.inventory_shown = FALSE usr.client.screen -= targetmob.hud_used.toggleable_inventory else - usr.hud_used.inventory_shown = 1 + usr.hud_used.inventory_shown = TRUE usr.client.screen += targetmob.hud_used.toggleable_inventory targetmob.hud_used.hidden_inventory_update(usr) @@ -438,7 +438,7 @@ if(hud_used.hotkey_ui_hidden) client.screen += hud_used.hotkeybuttons - hud_used.hotkey_ui_hidden = 0 + hud_used.hotkey_ui_hidden = FALSE else client.screen -= hud_used.hotkeybuttons - hud_used.hotkey_ui_hidden = 1 + hud_used.hotkey_ui_hidden = TRUE