Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions code/__DEFINES/atom_hud.dm
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,12 @@

/// cooldown for being shown the images for any particular data hud
#define ADD_HUD_TO_COOLDOWN 20


#define GHOST_DATA_HUDS (1<<0)
#define GHOST_VISION (1<<1)
#define GHOST_HEALTH (1<<2)
#define GHOST_CHEM (1<<3)
#define GHOST_GAS (1<<4)
#define GHOST_TRAY (1<<5)
#define GHOST_DARKNESS_LEVEL (1<<6)
11 changes: 5 additions & 6 deletions code/_onclick/hud/_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,10 @@
#define ui_pai_view_images "SOUTH:6,WEST+13"

//Ghosts
#define ui_ghost_respawn "SOUTH:6,CENTER-3:24"
#define ui_ghost_orbit "SOUTH:6,CENTER-2:24"
#define ui_ghost_reenter_corpse "SOUTH:6,CENTER-1:24"
#define ui_ghost_teleport "SOUTH:6,CENTER:24"
#define ui_ghost_pai "SOUTH: 6,CENTER+1:24"
#define ui_ghost_spawner_menu "SOUTH:6,CENTER+2:24"
#define ui_ghost_orbit "SOUTH:6,CENTER-3:24"
#define ui_ghost_reenter_corpse "SOUTH:6,CENTER-2:24"
#define ui_ghost_teleport "SOUTH:6,CENTER-1:24"
#define ui_dnr "SOUTH:6,CENTER:24"
#define ui_ghost_respawn "SOUTH:6,CENTER+1:24"

#define ui_wanted_lvl "NORTH,11"
136 changes: 116 additions & 20 deletions code/_onclick/hud/ghost.dm
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@
var/mob/dead/observer/G = usr
G.reenter_corpse()

/atom/movable/screen/ghost/dnr
name = "Do Not Resuscitate"
icon_state = "dnr"

/atom/movable/screen/ghost/dnr/Click()
var/mob/dead/observer/dnring = usr
dnring.stay_dead()

/atom/movable/screen/ghost/teleport
name = "Teleport"
icon_state = "teleport"
Expand All @@ -47,23 +55,106 @@
var/mob/dead/observer/G = usr
G.dead_tele()

/atom/movable/screen/ghost/pai
/atom/movable/screen/ghost/hudbox
icon_state = "smallbox"
bad_type = /atom/movable/screen/ghost/hudbox
/// Icon state used for the overlay representing this hudbox
var/hud_icon_state
/// The flag this hudbox toggles
var/relevant_flag

/atom/movable/screen/ghost/hudbox/update_overlays()
. = ..()
. += hud_icon_state

/atom/movable/screen/ghost/hudbox/update_icon_state()
. = ..()
var/mob/dead/observer/observer = usr
if(!istype(observer))
return

icon_state = "smallbox[is_active(observer) ? "_active" : ""]"

/atom/movable/screen/ghost/hudbox/proc/is_active(mob/dead/observer/observer)
return (observer.ghost_hud_flags & relevant_flag)

/atom/movable/screen/ghost/hudbox/Click(location, control, params)
var/mob/dead/observer/observer = usr
switch(relevant_flag)
if(GHOST_DARKNESS_LEVEL)
observer.toggle_darkness()
if(GHOST_TRAY)
observer.tray_view()
else
observer.toggle_ghost_hud_flag(relevant_flag)

update_appearance(UPDATE_ICON_STATE)

/atom/movable/screen/ghost/hudbox/health_scanner
name = "Health Scanner"
desc = "Toggles your ability to health scan mobs on click."
hud_icon_state = "health_vision"
relevant_flag = GHOST_HEALTH

/atom/movable/screen/ghost/hudbox/chem_scanner
name = "Chem Scanner"
desc = "Toggles your ability to chemical scan mobs on click."
hud_icon_state = "chem_vision"
relevant_flag = GHOST_CHEM

/atom/movable/screen/ghost/hudbox/gas_scanner
name = "Gas Scanner"
desc = "Toggles your ability to gas scan objects on click."
hud_icon_state = "atmos_vision"
relevant_flag = GHOST_GAS

/atom/movable/screen/ghost/hudbox/ghost
name = "Ghost Vision"
desc = "Toggles whether you can see other ghosts."
hud_icon_state = "ghost_vision"
relevant_flag = GHOST_VISION

/atom/movable/screen/ghost/hudbox/data_huds
name = "Data HUDs"
desc = "Toggles the display of data HUDs (health, security, diagnostics, etc)."
hud_icon_state = "data_vision"
relevant_flag = GHOST_DATA_HUDS

/atom/movable/screen/ghost/hudbox/pai
name = "pAI Candidate"
icon_state = "pai"
hud_icon_state = "pai"

/atom/movable/screen/ghost/pai/Click()
/atom/movable/screen/ghost/hudbox/pai/Click()
var/mob/dead/observer/G = usr
G.register_pai()

/atom/movable/screen/ghost/spawner_menu
/atom/movable/screen/ghost/hudbox/spawner_menu
name = "Spawner Menu"
icon = 'icons/hud/screen_ghost.dmi'
icon_state = "spawner_menu"
hud_icon_state = "spawner_menu"

/atom/movable/screen/ghost/spawner_menu/Click()
/atom/movable/screen/ghost/hudbox/spawner_menu/Click()
var/mob/dead/observer/G = usr
G.open_spawners_menu()

/atom/movable/screen/ghost/hudbox/tray_icon
name = "Tray View"
desc = "Shows the t-ray view of the area around your ghost."
hud_icon_state = "tray_vision"
relevant_flag = GHOST_TRAY

/atom/movable/screen/ghost/hudbox/darkness_level
name = "Darkness Level"
desc = "Cycles through different darkness levels for ghost vision."
hud_icon_state = "darkness_vision"
relevant_flag = GHOST_DARKNESS_LEVEL

/atom/movable/screen/ghost/hudbox/language_menu
name = "language menu"
hud_icon_state = "talk_wheel"

/atom/movable/screen/ghost/hudbox/language_menu/Click()
usr.get_language_holder().open_language_menu(usr)

/datum/hud/ghost/New(mob/owner)
..()
var/atom/movable/screen/using
Expand All @@ -83,25 +174,28 @@
using.hud = src
static_inventory += using

using = new /atom/movable/screen/ghost/teleport()
using.screen_loc = ui_ghost_teleport
using = new /atom/movable/screen/ghost/dnr(null, src)
using.screen_loc = ui_dnr
using.hud = src
static_inventory += using

using = new /atom/movable/screen/ghost/pai()
using.screen_loc = ui_ghost_pai
using = new /atom/movable/screen/ghost/teleport()
using.screen_loc = ui_ghost_teleport
using.hud = src
static_inventory += using

using = new /atom/movable/screen/language_menu
using.icon = ui_style
using.hud = src
static_inventory += using
var/list/hudboxes = subtypesof(/atom/movable/screen/ghost/hudbox)
for(var/i in 1 to length(hudboxes))
var/hudbox_type = hudboxes[i]
var/atom/movable/screen/ghost/hudbox/hudbox = new hudbox_type(null, src)
hudbox.screen_loc = position_hudbox(i - 1)
static_inventory += hudbox
hudbox.update_appearance()

using = new /atom/movable/screen/ghost/spawner_menu()
using.screen_loc = ui_ghost_spawner_menu
using.hud = src
static_inventory += using
/datum/hud/ghost/proc/position_hudbox(i)
var/row = floor(i / 5)
var/column = i % 5
return "SOUTH:[6 + row * 16], CENTER+2:[7 + column * 15]"

/datum/hud/ghost/show_hud(version = 0, mob/viewmob)
// don't show this HUD if observing; show the HUD of the observee
Expand All @@ -115,7 +209,9 @@
return
var/mob/screenmob = viewmob || mymob
if(!screenmob.client.prefs.ghost_hud)
screenmob.client.screen -= static_inventory
screenmob.client.screen |= static_inventory
for(var/atom/movable/screen/ghost/hudbox/hud in static_inventory)
hud.update_appearance()
else
screenmob.client.screen += static_inventory

Expand Down
12 changes: 8 additions & 4 deletions code/_onclick/observer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
if(SEND_SIGNAL(src, COMSIG_ATOM_ATTACK_GHOST, user) & COMPONENT_NO_ATTACK_HAND)
return TRUE
if(user.client)
if(user.gas_scan && atmosanalyzer_scan(user, src))
if((user.ghost_hud_flags & GHOST_GAS) && atmosanalyzer_scan(user, src))
return TRUE
else if(isAdminGhostAI(user))
attack_ai(user)
Expand All @@ -60,9 +60,13 @@
return FALSE

/mob/living/attack_ghost(mob/dead/observer/user)
if(user.client && user.health_scan)
healthscan(user, src, 2, TRUE, TRUE)
if(user.client && user.chem_scan)
. = ..()
if(isnull(user.client))
return

if (user.ghost_hud_flags & GHOST_HEALTH)
healthscan(user, src, 1, TRUE)
if (user.ghost_hud_flags & GHOST_CHEM)
chemscan(user, src)
return ..()

Expand Down
Loading
Loading