Skip to content

Commit

Permalink
Initial
Browse files Browse the repository at this point in the history
  • Loading branch information
morrowwolf committed Sep 21, 2023
1 parent 088437f commit 1d5fb3e
Show file tree
Hide file tree
Showing 34 changed files with 210 additions and 169 deletions.
6 changes: 6 additions & 0 deletions code/__DEFINES/dcs/signals/signals_client.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,9 @@

/// Called after a client logs into a mob: (mob)
#define COMSIG_CLIENT_MOB_LOGIN "client_mob_changed"

/// Called when something is added to a client's screen : /client/proc/add_to_screen(screen_add)
#define COMSIG_CLIENT_SCREEN_ADD "client_screen_add"

/// Called when something is removed from a client's screen : /client/proc/remove_from_screen(screen_remove)
#define COMSIG_CLIENT_SCREEN_REMOVE "client_screen_remove"
2 changes: 1 addition & 1 deletion code/_onclick/click.dm
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@
/client/proc/create_clickcatcher()
if(!void)
void = new()
screen += void
add_to_screen(void)

/client/proc/apply_clickcatcher()
create_clickcatcher()
Expand Down
4 changes: 2 additions & 2 deletions code/_onclick/hud/alien.dm
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@
var/mob/living/carbon/xenomorph/H = mymob
if(hud_version != HUD_STYLE_NOHUD)
if(H.r_hand)
H.client.screen += H.r_hand
H.client.add_to_screen(H.r_hand)
H.r_hand.screen_loc = ui_alien_datum.hud_slot_offset(H.r_hand, ui_alien_datum.ui_rhand)
if(H.l_hand)
H.client.screen += H.l_hand
H.client.add_to_screen(H.l_hand)
H.l_hand.screen_loc = ui_alien_datum.hud_slot_offset(H.l_hand, ui_alien_datum.ui_lhand)
else
if(H.r_hand)
Expand Down
12 changes: 6 additions & 6 deletions code/_onclick/hud/fullscreen.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
screen.severity = severity
if (client && screen.should_show_to(src))
screen.update_for_view(client.view)
client.screen += screen
client.add_to_screen(screen)

return screen

Expand All @@ -33,12 +33,12 @@
addtimer(CALLBACK(src, PROC_REF(clear_fullscreen_after_animate), screen), animated, TIMER_CLIENT_TIME)
else
if(client)
client.screen -= screen
client.remove_from_screen(screen)
qdel(screen)

/mob/proc/clear_fullscreen_after_animate(atom/movable/screen/fullscreen/screen)
if(client)
client.screen -= screen
client.remove_from_screen(screen)
qdel(screen)

/mob/proc/clear_fullscreens()
Expand All @@ -48,7 +48,7 @@
/mob/proc/hide_fullscreens()
if(client)
for(var/category in fullscreens)
client.screen -= fullscreens[category]
client.remove_from_screen(fullscreens[category])

/mob/proc/reload_fullscreens()
if(client)
Expand All @@ -57,9 +57,9 @@
screen = fullscreens[category]
if(screen.should_show_to(src))
screen.update_for_view(client.view)
client.screen |= screen
client.add_to_screen(screen)
else
client.screen -= screen
client.remove_from_screen(screen)


/atom/movable/screen/fullscreen
Expand Down
4 changes: 2 additions & 2 deletions code/_onclick/hud/ghost.dm
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,6 @@
var/mob/screenmob = viewmob || mymob

if(!hud_shown)
screenmob.client.screen -= static_inventory
screenmob.client.remove_from_screen(static_inventory)
else
screenmob.client.screen += static_inventory
screenmob.client.add_to_screen(static_inventory)
44 changes: 26 additions & 18 deletions code/_onclick/hud/hud.dm
Original file line number Diff line number Diff line change
Expand Up @@ -189,43 +189,43 @@
if(HUD_STYLE_STANDARD) //Default HUD
hud_shown = 1 //Governs behavior of other procs
if(static_inventory.len)
screenmob.client.screen += static_inventory
screenmob.client.add_to_screen(static_inventory)
if(toggleable_inventory.len && inventory_shown)
screenmob.client.screen += toggleable_inventory
screenmob.client.add_to_screen(toggleable_inventory)
if(hotkeybuttons.len && !hotkey_ui_hidden)
screenmob.client.screen += hotkeybuttons
screenmob.client.add_to_screen(hotkeybuttons)
if(infodisplay.len)
screenmob.client.screen += infodisplay
screenmob.client.add_to_screen(infodisplay)

if(HUD_STYLE_REDUCED) //Reduced HUD
hud_shown = 0 //Governs behavior of other procs
if(static_inventory.len)
screenmob.client.screen -= static_inventory
screenmob.client.remove_from_screen(static_inventory)
if(toggleable_inventory.len)
screenmob.client.screen -= toggleable_inventory
screenmob.client.remove_from_screen(toggleable_inventory)
if(hotkeybuttons.len)
screenmob.client.screen -= hotkeybuttons
screenmob.client.remove_from_screen(hotkeybuttons)
if(infodisplay.len)
screenmob.client.screen += infodisplay
screenmob.client.add_to_screen(infodisplay)

//These ones are a part of 'static_inventory', 'toggleable_inventory' or 'hotkeybuttons' but we want them to stay
if(l_hand_hud_object)
screenmob.client.screen += l_hand_hud_object //we want the hands to be visible
screenmob.client.add_to_screen(l_hand_hud_object) //we want the hands to be visible
if(r_hand_hud_object)
screenmob.client.screen += r_hand_hud_object //we want the hands to be visible
screenmob.client.add_to_screen(r_hand_hud_object) //we want the hands to be visible
if(action_intent)
screenmob.client.screen += action_intent //we want the intent switcher visible
screenmob.client.add_to_screen(action_intent) //we want the intent switcher visible

if(HUD_STYLE_NOHUD) //No HUD
hud_shown = 0 //Governs behavior of other procs
if(static_inventory.len)
screenmob.client.screen -= static_inventory
screenmob.client.remove_from_screen(static_inventory)
if(toggleable_inventory.len)
screenmob.client.screen -= toggleable_inventory
screenmob.client.remove_from_screen(toggleable_inventory)
if(hotkeybuttons.len)
screenmob.client.screen -= hotkeybuttons
screenmob.client.remove_from_screen(hotkeybuttons)
if(infodisplay.len)
screenmob.client.screen -= infodisplay
screenmob.client.remove_from_screen(infodisplay)

hud_version = display_hud_version
persistent_inventory_update(screenmob)
Expand All @@ -247,7 +247,7 @@
for(var/thing in plane_masters)
var/atom/movable/screen/plane_master/PM = plane_masters[thing]
PM.backdrop(mymob)
mymob.client.screen += PM
mymob.client.add_to_screen(PM)

/datum/hud/human/show_hud(version = 0, mob/viewmob)
. = ..()
Expand Down Expand Up @@ -412,7 +412,7 @@
if(!hud_shown)
for(var/category in alerts)
var/atom/movable/screen/alert/alert = alerts[category]
screenmob.client.screen -= alert
screenmob.client.remove_from_screen(alert)
return TRUE
var/c = 0
for(var/category in alerts)
Expand All @@ -432,8 +432,16 @@
else
. = ""
alert.screen_loc = .
screenmob.client.screen |= alert
screenmob.client.add_to_screen(alert)
if(!viewmob)
for(var/obs in mymob.observers)
reorganize_alerts(obs)
return TRUE

/client/proc/add_to_screen(screen_add)
screen += screen_add
SEND_SIGNAL(src, COMSIG_CLIENT_SCREEN_ADD, screen_add)

/client/proc/remove_from_screen(screen_remove)
screen -= screen_remove
SEND_SIGNAL(src, COMSIG_CLIENT_SCREEN_REMOVE, screen_remove)
82 changes: 45 additions & 37 deletions code/_onclick/hud/human.dm
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@
set desc = "This disables or enables the user interface buttons which can be used with hotkeys."

if(hud_used.hotkey_ui_hidden)
client.screen += hud_used.hotkeybuttons
client.add_to_screen(hud_used.hotkeybuttons)
hud_used.hotkey_ui_hidden = 0
else
client.screen -= hud_used.hotkeybuttons
client.remove_from_screen(hud_used.hotkeybuttons)
hud_used.hotkey_ui_hidden = TRUE

/datum/hud/human/hidden_inventory_update(mob/viewer)
Expand All @@ -120,53 +120,57 @@
inventory_shown = FALSE
return //species without inv slots don't show items.

if(screenmob.hud_used.inventory_shown && screenmob.hud_used.hud_shown)
if(H.hud_used.inventory_shown && H.hud_used.hud_shown)
if(H.shoes)
H.shoes.screen_loc = ui_datum.ui_shoes
screenmob.client.screen += H.shoes
screenmob.client.add_to_screen(H.shoes)
if(H.gloves)
H.gloves.screen_loc = ui_datum.ui_gloves
screenmob.client.screen += H.gloves
screenmob.client.add_to_screen(H.gloves)
if(H.wear_l_ear)
H.wear_l_ear.screen_loc = ui_datum.ui_wear_l_ear
screenmob.client.screen += H.wear_l_ear
screenmob.client.add_to_screen(H.wear_l_ear)
if(H.wear_r_ear)
H.wear_r_ear.screen_loc = ui_datum.ui_wear_r_ear
screenmob.client.screen += H.wear_r_ear
screenmob.client.add_to_screen(H.wear_r_ear)
if(H.glasses)
H.glasses.screen_loc = ui_datum.ui_glasses
screenmob.client.screen += H.glasses
screenmob.client.add_to_screen(H.glasses)
if(H.w_uniform)
H.w_uniform.screen_loc = ui_datum.ui_iclothing
screenmob.client.screen += H.w_uniform
screenmob.client.add_to_screen(H.w_uniform)
if(H.wear_suit)
H.wear_suit.screen_loc = ui_datum.ui_oclothing
screenmob.client.screen += H.wear_suit
screenmob.client.add_to_screen(H.wear_suit)
if(H.wear_mask)
H.wear_mask.screen_loc = ui_datum.ui_mask
screenmob.client.screen += H.wear_mask
screenmob.client.add_to_screen(H.wear_mask)
if(H.head)
H.head.screen_loc = ui_datum.ui_head
screenmob.client.screen += H.head
screenmob.client.add_to_screen(H.head)
else
if(H.shoes)
screenmob.client.screen -= H.shoes
screenmob.client.remove_from_screen(H.shoes)
if(H.gloves)
screenmob.client.screen -= H.gloves
screenmob.client.remove_from_screen(H.gloves)
if(H.wear_r_ear)
screenmob.client.screen -= H.wear_r_ear
screenmob.client.remove_from_screen(H.wear_r_ear)
if(H.wear_l_ear)
screenmob.client.screen -= H.wear_l_ear
screenmob.client.remove_from_screen(H.wear_l_ear)
if(H.glasses)
screenmob.client.screen -= H.glasses
screenmob.client.remove_from_screen(H.glasses)
if(H.w_uniform)
screenmob.client.screen -= H.w_uniform
screenmob.client.remove_from_screen(H.w_uniform)
if(H.wear_suit)
screenmob.client.screen -= H.wear_suit
screenmob.client.remove_from_screen(H.wear_suit)
if(H.wear_mask)
screenmob.client.screen -= H.wear_mask
screenmob.client.remove_from_screen(H.wear_mask)
if(H.head)
screenmob.client.screen -= H.head
screenmob.client.remove_from_screen(H.head)

if(screenmob == mymob)
for(var/M in mymob.observers)
hidden_inventory_update(M)

/datum/hud/human/persistent_inventory_update(mob/viewer)
if(!mymob)
Expand All @@ -177,53 +181,57 @@
var/mob/living/carbon/human/H = mymob
var/mob/screenmob = viewer || H

if(screenmob.hud_used)
if(screenmob.hud_used.hud_shown)
if(H.hud_used)
if(H.hud_used.hud_shown)
if(H.s_store)
H.s_store.screen_loc = ui_datum.hud_slot_offset(H.s_store, ui_datum.ui_sstore1)
screenmob.client.screen += H.s_store
screenmob.client.add_to_screen(H.s_store)
if(H.wear_id)
H.wear_id.screen_loc = ui_datum.hud_slot_offset(H.wear_id, ui_datum.ui_id)
screenmob.client.screen += H.wear_id
screenmob.client.add_to_screen(H.wear_id)
if(H.belt)
H.belt.screen_loc = ui_datum.hud_slot_offset(H.belt, ui_datum.ui_belt)
screenmob.client.screen += H.belt
screenmob.client.add_to_screen(H.belt)
if(H.back)
H.back.screen_loc = ui_datum.hud_slot_offset(H.back, ui_datum.ui_back)
screenmob.client.screen += H.back
screenmob.client.add_to_screen(H.back)
if(H.l_store)
H.l_store.screen_loc = ui_datum.hud_slot_offset(H.l_store, ui_datum.ui_storage1)
screenmob.client.screen += H.l_store
screenmob.client.add_to_screen(H.l_store)
if(H.r_store)
H.r_store.screen_loc = ui_datum.hud_slot_offset(H.r_store, ui_datum.ui_storage2)
screenmob.client.screen += H.r_store
screenmob.client.add_to_screen(H.r_store)
else
if(H.s_store)
screenmob.client.screen -= H.s_store
screenmob.client.remove_from_screen(H.s_store)
if(H.wear_id)
screenmob.client.screen -= H.wear_id
screenmob.client.remove_from_screen(H.wear_id)
if(H.belt)
screenmob.client.screen -= H.belt
screenmob.client.remove_from_screen(H.belt)
if(H.back)
screenmob.client.screen -= H.back
screenmob.client.remove_from_screen(H.back)
if(H.l_store)
screenmob.client.screen -= H.l_store
screenmob.client.remove_from_screen(H.l_store)
if(H.r_store)
screenmob.client.screen -= H.r_store
screenmob.client.remove_from_screen(H.r_store)

if(hud_version != HUD_STYLE_NOHUD)
if(H.r_hand)
H.r_hand.screen_loc = ui_datum.hud_slot_offset(H.r_hand, ui_datum.ui_rhand)
H.client.screen += H.r_hand
screenmob.client.add_to_screen(H.r_hand)
if(H.l_hand)
H.l_hand.screen_loc = ui_datum.hud_slot_offset(H.l_hand, ui_datum.ui_lhand)
H.client.screen += H.l_hand
screenmob.client.add_to_screen(H.l_hand)
else
if(H.r_hand)
H.r_hand.screen_loc = null
if(H.l_hand)
H.l_hand.screen_loc = null

if(screenmob == mymob)
for(var/M in mymob.observers)
persistent_inventory_update(M)

/datum/hud/human/proc/draw_inventory_slots(gear, datum/custom_hud/ui_datum, ui_alpha, ui_color)
for(var/gear_slot in gear)
var/atom/movable/screen/inventory/inv_box = new /atom/movable/screen/inventory()
Expand Down
2 changes: 1 addition & 1 deletion code/_onclick/hud/map_popups.dm
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
if(!screen_map.Find(screen_obj))
screen_map += screen_obj
if(!screen.Find(screen_obj))
screen += screen_obj
add_to_screen(screen_obj)

/**
* Clears the map of registered screen objects.
Expand Down
2 changes: 1 addition & 1 deletion code/_onclick/hud/rendering/render_plate.dm
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,6 @@
relay.blend_mode = blend_mode
relay.mouse_opacity = mouse_opacity
relay.name = render_target
mymob.client.screen += relay
mymob.client.add_to_screen(relay)
if(blend_mode != BLEND_MULTIPLY)
blend_mode = BLEND_DEFAULT
6 changes: 3 additions & 3 deletions code/_onclick/hud/robot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,13 @@
if(hud_shown)
if(R.module_state_1)
R.module_state_1.screen_loc = ui_robot_datum.ui_inv1
R.client.screen += R.module_state_1
R.client.add_to_screen(R.module_state_1)
if(R.module_state_2)
R.module_state_2.screen_loc = ui_robot_datum.ui_inv2
R.client.screen += R.module_state_2
R.client.add_to_screen(R.module_state_2)
if(R.module_state_3)
R.module_state_3.screen_loc = ui_robot_datum.ui_inv3
R.client.screen += R.module_state_3
R.client.add_to_screen(R.module_state_3)
else
if(R.module_state_1)
R.module_state_1.screen_loc = null
Expand Down
Loading

0 comments on commit 1d5fb3e

Please sign in to comment.