From 4dee4799e67c68f40bdb8a2b58618513bf4bf651 Mon Sep 17 00:00:00 2001
From: Kapu1178 <75460809+Kapu1178@users.noreply.github.com>
Date: Sun, 11 Feb 2024 19:22:07 -0500
Subject: [PATCH] Refactors hud code, MASSIVELY improves Observe verb. (#657)
* pass hud into screen object new
* sanitize all screen object clicks
* robust observe
* fix action buttons and gunpoint
* fix skew
* fix radials and the crafting menu
* fix craft menu for real
* fix crafting 4 real
* use timer uses new format
* fix
---
code/_onclick/click.dm | 13 +-
code/_onclick/hud/action_button.dm | 65 +++--
code/_onclick/hud/ai.dm | 55 ++---
code/_onclick/hud/alert.dm | 6 +-
code/_onclick/hud/alien.dm | 50 ++--
code/_onclick/hud/alien_larva.dm | 21 +-
code/_onclick/hud/blob_overmind.dm | 116 +++++----
code/_onclick/hud/blobbernaut.dm | 3 +-
code/_onclick/hud/drones.dm | 7 +-
code/_onclick/hud/generic_dextrous.dm | 36 +--
code/_onclick/hud/ghost.dm | 45 ++--
code/_onclick/hud/guardian.dm | 91 ++++---
code/_onclick/hud/hud.dm | 23 +-
code/_onclick/hud/human.dm | 136 ++++------
code/_onclick/hud/living.dm | 8 +-
code/_onclick/hud/ooze.dm | 6 +-
code/_onclick/hud/pai.dm | 38 +--
code/_onclick/hud/parallax.dm | 13 +-
code/_onclick/hud/radial.dm | 23 +-
code/_onclick/hud/radial_persistent.dm | 6 +-
code/_onclick/hud/revenanthud.dm | 6 +-
code/_onclick/hud/robot.dm | 50 ++--
code/_onclick/hud/screen_objects.dm | 233 +++++++++++-------
code/_onclick/observer.dm | 2 +-
code/controllers/subsystem/ambience.dm | 4 +-
code/controllers/subsystem/packetnets.dm | 2 +-
.../subsystem/points_of_interest.dm | 4 +-
code/datums/actions/action.dm | 2 +-
code/datums/actions/cooldown_action.dm | 2 +-
code/datums/components/crafting/crafting.dm | 2 +-
code/datums/components/lock_on_cursor.dm | 7 +-
code/datums/status_effects/debuffs/debuffs.dm | 5 +-
code/datums/storage/storage.dm | 9 +-
code/game/objects/items.dm | 8 +-
code/game/say.dm | 4 +
code/game/sound.dm | 3 +
.../antagonists/changeling/changeling.dm | 7 +-
code/modules/antagonists/ert/ert.dm | 2 +-
code/modules/buildmode/buildmode.dm | 8 +-
code/modules/buildmode/buttons.dm | 24 ++
code/modules/mob/dead/observer/logout.dm | 2 +-
code/modules/mob/dead/observer/observer.dm | 97 +++++---
.../mob/living/carbon/carbon_update_icons.dm | 4 +-
.../living/carbon/human/human_update_icons.dm | 7 +-
code/modules/mob/living/carbon/inventory.dm | 6 +-
code/modules/mob/living/living.dm | 2 +-
code/modules/mob/living/living_say.dm | 6 +
.../modules/mob/living/silicon/ai/multicam.dm | 2 +-
.../modules/mob/living/silicon/robot/robot.dm | 6 +-
.../simple_animal/hostile/jungle/seedling.dm | 2 +-
.../living/simple_animal/hostile/vatbeast.dm | 2 +-
tgui/packages/tgui/interfaces/Orbit.js | 2 +-
52 files changed, 695 insertions(+), 588 deletions(-)
diff --git a/code/_onclick/click.dm b/code/_onclick/click.dm
index e68e94b839a7..a1ebbbfab898 100644
--- a/code/_onclick/click.dm
+++ b/code/_onclick/click.dm
@@ -353,9 +353,12 @@
/atom/proc/ShiftClick(mob/user)
var/flags = SEND_SIGNAL(user, COMSIG_CLICK_SHIFT, src)
- if(user.client && (user.client.eye == user || user.client.eye == user.loc || flags & COMPONENT_ALLOW_EXAMINATE))
- user.examinate(src)
- return
+ if(!user.client)
+ return
+ if(!((user.client.eye == user) || (user.client.eye == user.loc) || isobserver(user)) && !(flags & COMPONENT_ALLOW_EXAMINATE))
+ return
+
+ user.examinate(src)
/**
* Ctrl click
@@ -548,6 +551,10 @@
transform = M
/atom/movable/screen/click_catcher/Click(location, control, params)
+ . = ..()
+ if(.)
+ return FALSE
+
var/list/modifiers = params2list(params)
if(LAZYACCESS(modifiers, MIDDLE_CLICK) && iscarbon(usr))
var/mob/living/carbon/C = usr
diff --git a/code/_onclick/hud/action_button.dm b/code/_onclick/hud/action_button.dm
index 962977a2d1f1..23b8918e23cf 100644
--- a/code/_onclick/hud/action_button.dm
+++ b/code/_onclick/hud/action_button.dm
@@ -1,7 +1,6 @@
DEFINE_INTERACTABLE(/atom/movable/screen/movable/action_button)
/atom/movable/screen/movable/action_button
var/datum/action/linked_action
- var/datum/hud/our_hud
var/actiontooltipstyle = ""
screen_loc = null
@@ -21,31 +20,30 @@ DEFINE_INTERACTABLE(/atom/movable/screen/movable/action_button)
var/datum/weakref/last_hovored_ref
/atom/movable/screen/movable/action_button/Destroy()
- if(our_hud)
- var/mob/viewer = our_hud.mymob
- our_hud.hide_action(src)
+ if(hud)
+ var/mob/viewer = hud.mymob
+ hud.hide_action(src)
viewer?.client?.screen -= src
- linked_action.viewers -= our_hud
+ linked_action.viewers -= hud
viewer.update_action_buttons()
- our_hud = null
linked_action = null
return ..()
-/atom/movable/screen/movable/action_button/proc/can_use(mob/user)
+/atom/movable/screen/movable/action_button/can_usr_use(mob/user)
+ // Observers can only click on action buttons if they're not observing something
if(isobserver(user))
- var/mob/dead/observer/dead_mob = user
- if(dead_mob.observetarget) // Observers can only click on action buttons if they're not observing something
+ var/mob/dead/observer/O = user
+ if(O.observetarget)
return FALSE
if(linked_action)
if(linked_action.viewers[user.hud_used])
return TRUE
- return FALSE
-
- return TRUE
+ return FALSE
/atom/movable/screen/movable/action_button/Click(location,control,params)
- if (!can_use(usr))
+ . = ..()
+ if(.)
return FALSE
var/list/modifiers = params2list(params)
@@ -55,6 +53,7 @@ DEFINE_INTERACTABLE(/atom/movable/screen/movable/action_button)
return TRUE
if(usr.next_click > world.time)
return
+
usr.next_click = world.time + 1
var/trigger_flags
if(LAZYACCESS(modifiers, RIGHT_CLICK))
@@ -66,7 +65,7 @@ DEFINE_INTERACTABLE(/atom/movable/screen/movable/action_button)
// Very much byond logic, but I want nice behavior, so we fake it with drag
/atom/movable/screen/movable/action_button/MouseDrag(atom/over_object, src_location, over_location, src_control, over_control, params)
. = ..()
- if(!can_use(usr))
+ if(!can_usr_use(usr))
return
if(IS_WEAKREF_OF(over_object, last_hovored_ref))
return
@@ -95,7 +94,7 @@ DEFINE_INTERACTABLE(/atom/movable/screen/movable/action_button)
/atom/movable/screen/movable/action_button/MouseDrop(over_object)
last_hovored_ref = null
- if(!can_use(usr))
+ if(!can_usr_use(usr))
return
var/datum/hud/our_hud = usr.hud_used
if(over_object == src)
@@ -123,7 +122,7 @@ DEFINE_INTERACTABLE(/atom/movable/screen/movable/action_button)
save_position()
/atom/movable/screen/movable/action_button/proc/save_position()
- var/mob/user = our_hud.mymob
+ var/mob/user = hud.mymob
if(!user?.client)
return
var/position_info = ""
@@ -138,14 +137,14 @@ DEFINE_INTERACTABLE(/atom/movable/screen/movable/action_button)
user.client.prefs.action_buttons_screen_locs["[name]_[id]"] = position_info
/atom/movable/screen/movable/action_button/proc/load_position()
- var/mob/user = our_hud.mymob
+ var/mob/user = hud.mymob
if(!user)
return
var/position_info = user.client?.prefs?.action_buttons_screen_locs["[name]_[id]"] || SCRN_OBJ_DEFAULT
user.hud_used.position_action(src, position_info)
/atom/movable/screen/movable/action_button/proc/dump_save()
- var/mob/user = our_hud.mymob
+ var/mob/user = hud.mymob
if(!user?.client)
return
user.client.prefs.action_buttons_screen_locs -= "[name]_[id]"
@@ -253,12 +252,12 @@ DEFINE_INTERACTABLE(/atom/movable/screen/movable/action_button)
/atom/movable/screen/button_palette/Destroy()
if(our_hud)
- our_hud.mymob?.client?.screen -= src
+ our_hud.mymob?.canon_client?.screen -= src
our_hud.toggle_palette = null
our_hud = null
return ..()
-/atom/movable/screen/button_palette/Initialize(mapload)
+/atom/movable/screen/button_palette/Initialize(mapload, datum/hud/hud_owner)
. = ..()
update_appearance()
@@ -318,15 +317,10 @@ GLOBAL_LIST_INIT(palette_removed_matrix, list(1.4,0,0,0, 0.7,0.4,0,0, 0.4,0,0.6,
color_timer_id = null
remove_atom_colour(TEMPORARY_COLOUR_PRIORITY, to_remove)
-/atom/movable/screen/button_palette/proc/can_use(mob/user)
- if (isobserver(user))
- var/mob/dead/observer/O = user
- return !O.observetarget
- return TRUE
-
/atom/movable/screen/button_palette/Click(location, control, params)
- if(!can_use(usr))
- return
+ . = ..()
+ if(.)
+ return FALSE
var/list/modifiers = params2list(params)
@@ -376,7 +370,8 @@ GLOBAL_LIST_INIT(palette_removed_matrix, list(1.4,0,0,0, 0.7,0.4,0,0, 0.4,0,0.6,
var/scroll_direction = 0
var/datum/hud/our_hud
-/atom/movable/screen/palette_scroll/proc/can_use(mob/user)
+/atom/movable/screen/palette_scroll/can_usr_use(mob/user)
+ . = ..()
if (isobserver(user))
var/mob/dead/observer/O = user
return !O.observetarget
@@ -395,8 +390,10 @@ GLOBAL_LIST_INIT(palette_removed_matrix, list(1.4,0,0,0, 0.7,0.4,0,0, 0.4,0,0.6,
icon = settings["bg_icon"]
/atom/movable/screen/palette_scroll/Click(location, control, params)
- if(!can_use(usr))
- return
+ . = ..()
+ if(.)
+ return FALSE
+
our_hud.palette_actions.scroll(scroll_direction)
/atom/movable/screen/palette_scroll/MouseEntered(location, control, params)
@@ -417,7 +414,7 @@ GLOBAL_LIST_INIT(palette_removed_matrix, list(1.4,0,0,0, 0.7,0.4,0,0, 0.4,0,0.6,
/atom/movable/screen/palette_scroll/down/Destroy()
if(our_hud)
- our_hud.mymob?.client?.screen -= src
+ our_hud.mymob?.canon_client?.screen -= src
our_hud.palette_down = null
our_hud = null
return ..()
@@ -430,7 +427,7 @@ GLOBAL_LIST_INIT(palette_removed_matrix, list(1.4,0,0,0, 0.7,0.4,0,0, 0.4,0,0.6,
/atom/movable/screen/palette_scroll/up/Destroy()
if(our_hud)
- our_hud.mymob?.client?.screen -= src
+ our_hud.mymob?.canon_client?.screen -= src
our_hud.palette_up = null
our_hud = null
return ..()
@@ -448,7 +445,7 @@ GLOBAL_LIST_INIT(palette_removed_matrix, list(1.4,0,0,0, 0.7,0.4,0,0, 0.4,0,0.6,
/atom/movable/screen/action_landing/Destroy()
if(owner)
owner.landing = null
- owner?.owner?.mymob?.client?.screen -= src
+ owner?.owner?.mymob?.canon_client?.screen -= src
owner.refresh_actions()
owner = null
return ..()
diff --git a/code/_onclick/hud/ai.dm b/code/_onclick/hud/ai.dm
index fabbdae41ab5..0b3c4ebcabae 100644
--- a/code/_onclick/hud/ai.dm
+++ b/code/_onclick/hud/ai.dm
@@ -2,6 +2,10 @@
icon = 'icons/hud/screen_ai.dmi'
/atom/movable/screen/ai/Click()
+ . = ..()
+ if(.)
+ return FALSE
+
if(isobserver(usr) || usr.incapacitated())
return TRUE
@@ -184,106 +188,89 @@
var/mob/living/silicon/ai/myai = mymob
// Language menu
- using = new /atom/movable/screen/language_menu
+ using = new /atom/movable/screen/language_menu(null, src)
using.screen_loc = ui_ai_language_menu
- using.hud = src
static_inventory += using
//AI core
- using = new /atom/movable/screen/ai/aicore()
+ using = new /atom/movable/screen/ai/aicore(null, src)
using.screen_loc = ui_ai_core
- using.hud = src
static_inventory += using
//Camera list
- using = new /atom/movable/screen/ai/camera_list()
+ using = new /atom/movable/screen/ai/camera_list(null, src)
using.screen_loc = ui_ai_camera_list
- using.hud = src
static_inventory += using
//Track
- using = new /atom/movable/screen/ai/camera_track()
+ using = new /atom/movable/screen/ai/camera_track(null, src)
using.screen_loc = ui_ai_track_with_camera
- using.hud = src
static_inventory += using
//Camera light
- using = new /atom/movable/screen/ai/camera_light()
+ using = new /atom/movable/screen/ai/camera_light(null, src)
using.screen_loc = ui_ai_camera_light
- using.hud = src
static_inventory += using
//Crew Monitoring
- using = new /atom/movable/screen/ai/crew_monitor()
+ using = new /atom/movable/screen/ai/crew_monitor(null, src)
using.screen_loc = ui_ai_crew_monitor
- using.hud = src
static_inventory += using
//Crew Manifest
- using = new /atom/movable/screen/ai/crew_manifest()
+ using = new /atom/movable/screen/ai/crew_manifest(null, src)
using.screen_loc = ui_ai_crew_manifest
- using.hud = src
static_inventory += using
//Alerts
- using = new /atom/movable/screen/ai/alerts()
+ using = new /atom/movable/screen/ai/alerts(null, src)
using.screen_loc = ui_ai_alerts
- using.hud = src
static_inventory += using
//Announcement
- using = new /atom/movable/screen/ai/announcement()
+ using = new /atom/movable/screen/ai/announcement(null, src)
using.screen_loc = ui_ai_announcement
- using.hud = src
static_inventory += using
//Shuttle
- using = new /atom/movable/screen/ai/call_shuttle()
+ using = new /atom/movable/screen/ai/call_shuttle(null, src)
using.screen_loc = ui_ai_shuttle
- using.hud = src
static_inventory += using
//Laws
- using = new /atom/movable/screen/ai/state_laws()
+ using = new /atom/movable/screen/ai/state_laws(null, src)
using.screen_loc = ui_ai_state_laws
- using.hud = src
static_inventory += using
// Modular Interface
- using = new /atom/movable/screen/ai/modpc()
+ using = new /atom/movable/screen/ai/modpc(null, src)
using.screen_loc = ui_ai_mod_int
- using.hud = src
static_inventory += using
myai.interfaceButton = using
var/atom/movable/screen/ai/modpc/tabletbutton = using
tabletbutton.robot = myai
//Take image
- using = new /atom/movable/screen/ai/image_take()
+ using = new /atom/movable/screen/ai/image_take(null, src)
using.screen_loc = ui_ai_take_picture
- using.hud = src
static_inventory += using
//View images
- using = new /atom/movable/screen/ai/image_view()
+ using = new /atom/movable/screen/ai/image_view(null, src)
using.screen_loc = ui_ai_view_images
- using.hud = src
static_inventory += using
//Medical/Security sensors
- using = new /atom/movable/screen/ai/sensors()
+ using = new /atom/movable/screen/ai/sensors(null, src)
using.screen_loc = ui_ai_sensor
- using.hud = src
static_inventory += using
//Multicamera mode
- using = new /atom/movable/screen/ai/multicam()
+ using = new /atom/movable/screen/ai/multicam(null, src)
using.screen_loc = ui_ai_multicam
- using.hud = src
static_inventory += using
//Add multicamera camera
- using = new /atom/movable/screen/ai/add_multicam()
+ using = new /atom/movable/screen/ai/add_multicam(null, src)
using.screen_loc = ui_ai_add_multicam
- using.hud = src
static_inventory += using
diff --git a/code/_onclick/hud/alert.dm b/code/_onclick/hud/alert.dm
index a91c547c4837..53a4c61d8325 100644
--- a/code/_onclick/hud/alert.dm
+++ b/code/_onclick/hud/alert.dm
@@ -109,6 +109,8 @@
/// Boolean. If TRUE, the Click() proc will attempt to Click() on the master first if there is a master.
var/click_master = TRUE
+/atom/movable/screen/alert/can_usr_use(mob/user)
+ return owner == usr
/atom/movable/screen/alert/MouseEntered(location,control,params)
. = ..()
@@ -871,8 +873,10 @@ or shoot a gun to move around via Newton's 3rd Law of Motion."
return 1
/atom/movable/screen/alert/Click(location, control, params)
- if(!usr || !usr.client)
+ . = ..()
+ if(.)
return FALSE
+
if(usr != owner)
return FALSE
var/list/modifiers = params2list(params)
diff --git a/code/_onclick/hud/alien.dm b/code/_onclick/hud/alien.dm
index ee521cf2025a..165f6bfcb23d 100644
--- a/code/_onclick/hud/alien.dm
+++ b/code/_onclick/hud/alien.dm
@@ -6,9 +6,11 @@
icon_state = "leap_off"
/atom/movable/screen/alien/leap/Click()
- if(isalienhunter(usr))
- var/mob/living/carbon/alien/humanoid/hunter/AH = usr
- AH.toggle_leap()
+ . = ..()
+ if(.)
+ return FALSE
+ var/mob/living/carbon/alien/humanoid/hunter/AH = hud.mymob
+ AH.toggle_leap()
/atom/movable/screen/alien/plasma_display
name = "plasma stored"
@@ -36,90 +38,76 @@
//begin buttons
- using = new /atom/movable/screen/swap_hand()
+ using = new /atom/movable/screen/swap_hand(null, src)
using.icon = ui_style
using.icon_state = "swap_1"
using.screen_loc = ui_swaphand_position(owner,1)
- using.hud = src
static_inventory += using
- using = new /atom/movable/screen/swap_hand()
+ using = new /atom/movable/screen/swap_hand(null, src)
using.icon = ui_style
using.icon_state = "swap_2"
using.screen_loc = ui_swaphand_position(owner,2)
- using.hud = src
static_inventory += using
- action_intent = new /atom/movable/screen/combattoggle/flashy()
- action_intent.hud = src
+ action_intent = new /atom/movable/screen/combattoggle/flashy(null, src)
action_intent.icon = ui_style
action_intent.screen_loc = ui_combat_toggle
static_inventory += action_intent
if(isalienhunter(mymob))
var/mob/living/carbon/alien/humanoid/hunter/H = mymob
- H.leap_icon = new /atom/movable/screen/alien/leap()
+ H.leap_icon = new /atom/movable/screen/alien/leap(null, src)
H.leap_icon.screen_loc = ui_alien_storage_r
static_inventory += H.leap_icon
- using = new/atom/movable/screen/language_menu
+ using = new/atom/movable/screen/language_menu(null, src)
using.screen_loc = ui_alien_language_menu
- using.hud = src
static_inventory += using
- using = new /atom/movable/screen/navigate
+ using = new /atom/movable/screen/navigate(null, src)
using.screen_loc = ui_alien_navigate_menu
- using.hud = src
static_inventory += using
- using = new /atom/movable/screen/drop()
+ using = new /atom/movable/screen/drop(null, src)
using.icon = ui_style
using.screen_loc = ui_drop_throw
- using.hud = src
static_inventory += using
- using = new /atom/movable/screen/resist()
+ using = new /atom/movable/screen/resist(null, src)
using.icon = ui_style
using.screen_loc = ui_above_movement
- using.hud = src
hotkeybuttons += using
- throw_icon = new /atom/movable/screen/throw_catch()
+ throw_icon = new /atom/movable/screen/throw_catch(null, src)
throw_icon.icon = ui_style
throw_icon.screen_loc = ui_drop_throw
- throw_icon.hud = src
hotkeybuttons += throw_icon
- pull_icon = new /atom/movable/screen/pull()
+ pull_icon = new /atom/movable/screen/pull(null, src)
pull_icon.icon = ui_style
pull_icon.update_appearance()
pull_icon.screen_loc = ui_above_movement
- pull_icon.hud = src
static_inventory += pull_icon
//begin indicators
- healths = new /atom/movable/screen/healths/alien()
- healths.hud = src
+ healths = new /atom/movable/screen/healths/alien(null, src)
infodisplay += healths
- alien_plasma_display = new /atom/movable/screen/alien/plasma_display()
- alien_plasma_display.hud = src
+ alien_plasma_display = new /atom/movable/screen/alien/plasma_display(null, src)
infodisplay += alien_plasma_display
if(!isalienqueen(mymob))
- alien_queen_finder = new /atom/movable/screen/alien/alien_queen_finder
- alien_queen_finder.hud = src
+ alien_queen_finder = new /atom/movable/screen/alien/alien_queen_finder(null, src)
infodisplay += alien_queen_finder
- zone_select = new /atom/movable/screen/zone_sel/alien()
- zone_select.hud = src
+ zone_select = new /atom/movable/screen/zone_sel/alien(null, src)
zone_select.update_appearance()
static_inventory += zone_select
for(var/atom/movable/screen/inventory/inv in (static_inventory + toggleable_inventory))
if(inv.slot_id)
- inv.hud = src
inv_slots[TOBITSHIFT(inv.slot_id) + 1] = inv
inv.update_appearance()
diff --git a/code/_onclick/hud/alien_larva.dm b/code/_onclick/hud/alien_larva.dm
index 434d1cb5b2ea..7d3b50da0c75 100644
--- a/code/_onclick/hud/alien_larva.dm
+++ b/code/_onclick/hud/alien_larva.dm
@@ -5,38 +5,31 @@
..()
var/atom/movable/screen/using
- action_intent = new /atom/movable/screen/combattoggle/flashy()
- action_intent.hud = src
+ action_intent = new /atom/movable/screen/combattoggle/flashy(null, src)
action_intent.icon = ui_style
action_intent.screen_loc = ui_combat_toggle
static_inventory += action_intent
- healths = new /atom/movable/screen/healths/alien()
- healths.hud = src
+ healths = new /atom/movable/screen/healths/alien(null, src)
infodisplay += healths
- alien_queen_finder = new /atom/movable/screen/alien/alien_queen_finder()
- alien_queen_finder.hud = src
+ alien_queen_finder = new /atom/movable/screen/alien/alien_queen_finder(null, src)
infodisplay += alien_queen_finder
- pull_icon = new /atom/movable/screen/pull()
+ pull_icon = new /atom/movable/screen/pull(null, src)
pull_icon.icon = 'icons/hud/screen_alien.dmi'
pull_icon.update_appearance()
pull_icon.screen_loc = ui_above_movement
- pull_icon.hud = src
hotkeybuttons += pull_icon
- using = new/atom/movable/screen/language_menu
+ using = new/atom/movable/screen/language_menu(null, src)
using.screen_loc = ui_alien_language_menu
- using.hud = src
static_inventory += using
- using = new /atom/movable/screen/navigate
+ using = new /atom/movable/screen/navigate(null, src)
using.screen_loc = ui_alien_navigate_menu
- using.hud = src
static_inventory += using
- zone_select = new /atom/movable/screen/zone_sel/alien()
- zone_select.hud = src
+ zone_select = new /atom/movable/screen/zone_sel/alien(null, src)
zone_select.update_appearance()
static_inventory += zone_select
diff --git a/code/_onclick/hud/blob_overmind.dm b/code/_onclick/hud/blob_overmind.dm
index bdd295cda434..e77c38b7a977 100644
--- a/code/_onclick/hud/blob_overmind.dm
+++ b/code/_onclick/hud/blob_overmind.dm
@@ -16,9 +16,11 @@
desc = "Help on playing blob!"
/atom/movable/screen/blob/blob_help/Click()
- if(isovermind(usr))
- var/mob/camera/blob/B = usr
- B.blob_help()
+ . = ..()
+ if(.)
+ return FALSE
+ var/mob/camera/blob/B = hud.mymob
+ B.blob_help()
/atom/movable/screen/blob/jump_to_node
icon_state = "ui_tonode"
@@ -26,9 +28,11 @@
desc = "Moves your camera to a selected blob node."
/atom/movable/screen/blob/jump_to_node/Click()
- if(isovermind(usr))
- var/mob/camera/blob/B = usr
- B.jump_to_node()
+ . = ..()
+ if(.)
+ return FALSE
+ var/mob/camera/blob/B = hud.mymob
+ B.jump_to_node()
/atom/movable/screen/blob/jump_to_core
icon_state = "ui_tocore"
@@ -47,11 +51,14 @@
return ..()
/atom/movable/screen/blob/jump_to_core/Click()
- if(isovermind(usr))
- var/mob/camera/blob/B = usr
- if(!B.placed)
- B.place_blob_core(BLOB_NORMAL_PLACEMENT)
- B.transport_core()
+ . = ..()
+ if(.)
+ return FALSE
+
+ var/mob/camera/blob/B = hud.mymob
+ if(!B.placed)
+ B.place_blob_core(BLOB_NORMAL_PLACEMENT)
+ B.transport_core()
/atom/movable/screen/blob/blobbernaut
icon_state = "ui_blobbernaut"
@@ -65,9 +72,12 @@
desc = "Produces a strong, smart blobbernaut from a factory blob for [BLOBMOB_BLOBBERNAUT_RESOURCE_COST] resources.
The factory blob used will become fragile and unable to produce spores."
/atom/movable/screen/blob/blobbernaut/Click()
- if(isovermind(usr))
- var/mob/camera/blob/B = usr
- B.create_blobbernaut()
+ . = ..()
+ if(.)
+ return FALSE
+
+ var/mob/camera/blob/B = hud.mymob
+ B.create_blobbernaut()
/atom/movable/screen/blob/resource_blob
icon_state = "ui_resource"
@@ -81,9 +91,12 @@
desc = "Produces a resource blob for [BLOB_STRUCTURE_RESOURCE_COST] resources.
Resource blobs will give you resources every few seconds."
/atom/movable/screen/blob/resource_blob/Click()
- if(isovermind(usr))
- var/mob/camera/blob/B = usr
- B.createSpecial(BLOB_STRUCTURE_RESOURCE_COST, /obj/structure/blob/special/resource, BLOB_RESOURCE_MIN_DISTANCE, TRUE)
+ . = ..()
+ if(.)
+ return FALSE
+
+ var/mob/camera/blob/B = hud.mymob
+ B.createSpecial(BLOB_STRUCTURE_RESOURCE_COST, /obj/structure/blob/special/resource, BLOB_RESOURCE_MIN_DISTANCE, TRUE)
/atom/movable/screen/blob/node_blob
icon_state = "ui_node"
@@ -97,9 +110,12 @@
desc = "Produces a node blob for [BLOB_STRUCTURE_NODE_COST] resources.
Node blobs will expand and activate nearby resource and factory blobs."
/atom/movable/screen/blob/node_blob/Click()
- if(isovermind(usr))
- var/mob/camera/blob/B = usr
- B.createSpecial(BLOB_STRUCTURE_NODE_COST, /obj/structure/blob/special/node, BLOB_NODE_MIN_DISTANCE, FALSE)
+ . = ..()
+ if(.)
+ return FALSE
+
+ var/mob/camera/blob/B = hud.mymob
+ B.createSpecial(BLOB_STRUCTURE_NODE_COST, /obj/structure/blob/special/node, BLOB_NODE_MIN_DISTANCE, FALSE)
/atom/movable/screen/blob/factory_blob
icon_state = "ui_factory"
@@ -113,9 +129,12 @@
desc = "Produces a factory blob for [BLOB_STRUCTURE_FACTORY_COST] resources.
Factory blobs will produce spores every few seconds."
/atom/movable/screen/blob/factory_blob/Click()
- if(isovermind(usr))
- var/mob/camera/blob/B = usr
- B.createSpecial(BLOB_STRUCTURE_FACTORY_COST, /obj/structure/blob/special/factory, BLOB_FACTORY_MIN_DISTANCE, TRUE)
+ . = ..()
+ if(.)
+ return FALSE
+
+ var/mob/camera/blob/B = hud.mymob
+ B.createSpecial(BLOB_STRUCTURE_FACTORY_COST, /obj/structure/blob/special/factory, BLOB_FACTORY_MIN_DISTANCE, TRUE)
/atom/movable/screen/blob/readapt_strain
icon_state = "ui_chemswap"
@@ -135,9 +154,12 @@
return ..()
/atom/movable/screen/blob/readapt_strain/Click()
- if(isovermind(usr))
- var/mob/camera/blob/B = usr
- B.strain_reroll()
+ . = ..()
+ if(.)
+ return FALSE
+
+ var/mob/camera/blob/B = hud.mymob
+ B.strain_reroll()
/atom/movable/screen/blob/relocate_core
icon_state = "ui_swap"
@@ -151,68 +173,60 @@
desc = "Swaps a node and your core for [BLOB_POWER_RELOCATE_COST] resources."
/atom/movable/screen/blob/relocate_core/Click()
- if(isovermind(usr))
- var/mob/camera/blob/B = usr
- B.relocate_core()
+ . = ..()
+ if(.)
+ return FALSE
+
+ var/mob/camera/blob/B = hud.mymob
+ B.relocate_core()
/datum/hud/blob_overmind/New(mob/owner)
..()
var/atom/movable/screen/using
- blobpwrdisplay = new /atom/movable/screen()
+ blobpwrdisplay = new /atom/movable/screen(null, src)
blobpwrdisplay.name = "blob power"
blobpwrdisplay.icon_state = "block"
blobpwrdisplay.screen_loc = ui_health
blobpwrdisplay.mouse_opacity = MOUSE_OPACITY_TRANSPARENT
blobpwrdisplay.plane = ABOVE_HUD_PLANE
- blobpwrdisplay.hud = src
infodisplay += blobpwrdisplay
- healths = new /atom/movable/screen/healths/blob()
- healths.hud = src
+ healths = new /atom/movable/screen/healths/blob(null, src)
infodisplay += healths
- using = new /atom/movable/screen/blob/blob_help()
+ using = new /atom/movable/screen/blob/blob_help(null, src)
using.screen_loc = "WEST:6,NORTH:-3"
- using.hud = src
static_inventory += using
- using = new /atom/movable/screen/blob/jump_to_node()
+ using = new /atom/movable/screen/blob/jump_to_node(null, src)
using.screen_loc = ui_inventory
- using.hud = src
static_inventory += using
- using = new /atom/movable/screen/blob/jump_to_core()
+ using = new /atom/movable/screen/blob/jump_to_core(null, src)
using.screen_loc = ui_zonesel
- using.hud = src
static_inventory += using
- using = new /atom/movable/screen/blob/blobbernaut()
+ using = new /atom/movable/screen/blob/blobbernaut(null, src)
using.screen_loc = ui_belt
- using.hud = src
static_inventory += using
- using = new /atom/movable/screen/blob/resource_blob()
+ using = new /atom/movable/screen/blob/resource_blob(null, src)
using.screen_loc = ui_back
- using.hud = src
static_inventory += using
- using = new /atom/movable/screen/blob/node_blob()
+ using = new /atom/movable/screen/blob/node_blob(null, src)
using.screen_loc = ui_hand_position(2)
- using.hud = src
static_inventory += using
- using = new /atom/movable/screen/blob/factory_blob()
+ using = new /atom/movable/screen/blob/factory_blob(null, src)
using.screen_loc = ui_hand_position(1)
- using.hud = src
static_inventory += using
- using = new /atom/movable/screen/blob/readapt_strain()
+ using = new /atom/movable/screen/blob/readapt_strain(null, src)
using.screen_loc = ui_storage1
- using.hud = src
static_inventory += using
- using = new /atom/movable/screen/blob/relocate_core()
+ using = new /atom/movable/screen/blob/relocate_core(null, src)
using.screen_loc = ui_storage2
- using.hud = src
static_inventory += using
diff --git a/code/_onclick/hud/blobbernaut.dm b/code/_onclick/hud/blobbernaut.dm
index d8531516d41e..59c12a5aa0fa 100644
--- a/code/_onclick/hud/blobbernaut.dm
+++ b/code/_onclick/hud/blobbernaut.dm
@@ -1,6 +1,5 @@
/datum/hud/living/blobbernaut/New(mob/living/owner)
. = ..()
- blobpwrdisplay = new /atom/movable/screen/healths/blob/overmind()
- blobpwrdisplay.hud = src
+ blobpwrdisplay = new /atom/movable/screen/healths/blob/overmind(null, src)
infodisplay += blobpwrdisplay
diff --git a/code/_onclick/hud/drones.dm b/code/_onclick/hud/drones.dm
index 61c006ac6fe5..1cb8ade6311e 100644
--- a/code/_onclick/hud/drones.dm
+++ b/code/_onclick/hud/drones.dm
@@ -2,29 +2,26 @@
..()
var/atom/movable/screen/inventory/inv_box
- inv_box = new /atom/movable/screen/inventory()
+ inv_box = new /atom/movable/screen/inventory(null, src)
inv_box.name = "internal storage"
inv_box.icon = ui_style
inv_box.icon_state = "suit_storage"
// inv_box.icon_full = "template"
inv_box.screen_loc = ui_drone_storage
inv_box.slot_id = ITEM_SLOT_DEX_STORAGE
- inv_box.hud = src
static_inventory += inv_box
- inv_box = new /atom/movable/screen/inventory()
+ inv_box = new /atom/movable/screen/inventory(null, src)
inv_box.name = "head/mask"
inv_box.icon = ui_style
inv_box.icon_state = "mask"
// inv_box.icon_full = "template"
inv_box.screen_loc = ui_drone_head
inv_box.slot_id = ITEM_SLOT_HEAD
- inv_box.hud = src
static_inventory += inv_box
for(var/atom/movable/screen/inventory/inv in (static_inventory + toggleable_inventory))
if(inv.slot_id)
- inv.hud = src
inv_slots[TOBITSHIFT(inv.slot_id) + 1] = inv
inv.update_appearance()
diff --git a/code/_onclick/hud/generic_dextrous.dm b/code/_onclick/hud/generic_dextrous.dm
index a8b83569380c..2862b0b9f704 100644
--- a/code/_onclick/hud/generic_dextrous.dm
+++ b/code/_onclick/hud/generic_dextrous.dm
@@ -3,78 +3,66 @@
..()
var/atom/movable/screen/using
- using = new /atom/movable/screen/drop()
+ using = new /atom/movable/screen/drop(null, src)
using.icon = ui_style
using.screen_loc = ui_drone_drop
- using.hud = src
static_inventory += using
- pull_icon = new /atom/movable/screen/pull()
+ pull_icon = new /atom/movable/screen/pull(null, src)
pull_icon.icon = ui_style
pull_icon.update_appearance()
pull_icon.screen_loc = ui_drone_pull
- pull_icon.hud = src
static_inventory += pull_icon
build_hand_slots()
- using = new /atom/movable/screen/swap_hand()
+ using = new /atom/movable/screen/swap_hand(null, src)
using.icon = ui_style
using.icon_state = "swap_1_m"
using.screen_loc = ui_swaphand_position(owner,1)
- using.hud = src
static_inventory += using
- using = new /atom/movable/screen/swap_hand()
+ using = new /atom/movable/screen/swap_hand(null, src)
using.icon = ui_style
using.icon_state = "swap_2"
using.screen_loc = ui_swaphand_position(owner,2)
- using.hud = src
static_inventory += using
- action_intent = new /atom/movable/screen/combattoggle/flashy()
- action_intent.hud = src
+ action_intent = new /atom/movable/screen/combattoggle/flashy(null, src)
action_intent.icon = ui_style
action_intent.screen_loc = ui_combat_toggle
static_inventory += action_intent
- zone_select = new /atom/movable/screen/zone_sel()
+ zone_select = new /atom/movable/screen/zone_sel(null, src)
zone_select.icon = ui_style
- zone_select.hud = src
zone_select.update_appearance()
static_inventory += zone_select
- using = new /atom/movable/screen/area_creator
+ using = new /atom/movable/screen/area_creator(null, src)
using.icon = ui_style
- using.hud = src
static_inventory += using
- mymob.client.screen = list()
+ mymob.canon_client.screen = list()
for(var/atom/movable/screen/inventory/inv in (static_inventory + toggleable_inventory))
if(inv.slot_id)
- inv.hud = src
inv_slots[TOBITSHIFT(inv.slot_id) + 1] = inv
inv.update_appearance()
- gun_setting_icon = new /atom/movable/screen/gun_mode()
+ gun_setting_icon = new /atom/movable/screen/gun_mode(null, src)
gun_setting_icon.icon = ui_style
- gun_setting_icon.hud = src
- var/atom/movable/screen/gun_option = new /atom/movable/screen/gun_radio()
+ var/atom/movable/screen/gun_option = new /atom/movable/screen/gun_radio(null, src)
gun_option.icon = ui_style
- gun_option.hud = src
gunpoint_options += gun_option
- gun_option = new /atom/movable/screen/gun_item()
+ gun_option = new /atom/movable/screen/gun_item(null, src)
gun_option.icon = ui_style
- gun_option.hud = src
gunpoint_options += gun_option
- gun_option = new /atom/movable/screen/gun_move()
+ gun_option = new /atom/movable/screen/gun_move(null, src)
gun_option.icon = ui_style
- gun_option.hud = src
gunpoint_options += gun_option
diff --git a/code/_onclick/hud/ghost.dm b/code/_onclick/hud/ghost.dm
index eeb8dccb933d..b027ddf785fe 100644
--- a/code/_onclick/hud/ghost.dm
+++ b/code/_onclick/hud/ghost.dm
@@ -1,5 +1,6 @@
/atom/movable/screen/ghost
icon = 'icons/hud/screen_ghost.dmi'
+ private_screen = FALSE
/atom/movable/screen/ghost/MouseEntered(location, control, params)
. = ..()
@@ -10,6 +11,9 @@
icon_state = "spawners"
/atom/movable/screen/ghost/spawners_menu/Click()
+ . = ..()
+ if(.)
+ return FALSE
var/mob/dead/observer/observer = usr
observer.open_spawners_menu()
@@ -18,6 +22,9 @@
icon_state = "orbit"
/atom/movable/screen/ghost/orbit/Click()
+ . = ..()
+ if(.)
+ return FALSE
var/mob/dead/observer/G = usr
G.follow()
@@ -26,6 +33,9 @@
icon_state = "reenter_corpse"
/atom/movable/screen/ghost/reenter_corpse/Click()
+ . = ..()
+ if(.)
+ return FALSE
var/mob/dead/observer/G = usr
G.reenter_corpse()
@@ -34,6 +44,10 @@
icon_state = "teleport"
/atom/movable/screen/ghost/teleport/Click()
+ . = ..()
+ if(.)
+ return FALSE
+
var/mob/dead/observer/G = usr
G.dead_tele()
@@ -42,14 +56,22 @@
icon_state = "pai"
/atom/movable/screen/ghost/pai/Click()
+ . = ..()
+ if(.)
+ return FALSE
+
var/mob/dead/observer/G = usr
G.register_pai()
/atom/movable/screen/ghost/minigames_menu
name ="Minigames"
icon_state = "minigames"
-
+
/atom/movable/screen/ghost/minigames_menu/Click()
+ . = ..()
+ if(.)
+ return FALSE
+
var/mob/dead/observer/observer = usr
observer.open_minigames_menu()
@@ -57,40 +79,33 @@
..()
var/atom/movable/screen/using
- using = new /atom/movable/screen/ghost/spawners_menu()
+ using = new /atom/movable/screen/ghost/spawners_menu(null, src)
using.screen_loc = ui_ghost_spawners_menu
- using.hud = src
static_inventory += using
- using = new /atom/movable/screen/ghost/orbit()
+ using = new /atom/movable/screen/ghost/orbit(null, src)
using.screen_loc = ui_ghost_orbit
- using.hud = src
static_inventory += using
- using = new /atom/movable/screen/ghost/reenter_corpse()
+ using = new /atom/movable/screen/ghost/reenter_corpse(null, src)
using.screen_loc = ui_ghost_reenter_corpse
- using.hud = src
static_inventory += using
- using = new /atom/movable/screen/ghost/teleport()
+ using = new /atom/movable/screen/ghost/teleport(null, src)
using.screen_loc = ui_ghost_teleport
- using.hud = src
static_inventory += using
- using = new /atom/movable/screen/ghost/pai()
+ using = new /atom/movable/screen/ghost/pai(null, src)
using.screen_loc = ui_ghost_pai
- using.hud = src
static_inventory += using
- using = new /atom/movable/screen/ghost/minigames_menu()
+ using = new /atom/movable/screen/ghost/minigames_menu(null, src)
using.screen_loc = ui_ghost_minigames
- using.hud = src
static_inventory += using
- using = new /atom/movable/screen/language_menu
+ using = new /atom/movable/screen/language_menu(null, src)
using.screen_loc = ui_ghost_language_menu
using.icon = ui_style
- using.hud = src
static_inventory += using
/datum/hud/ghost/show_hud(version = 0, mob/viewmob)
diff --git a/code/_onclick/hud/guardian.dm b/code/_onclick/hud/guardian.dm
index e5fbab5ddefa..5db5aa3f1fbc 100644
--- a/code/_onclick/hud/guardian.dm
+++ b/code/_onclick/hud/guardian.dm
@@ -5,40 +5,33 @@
..()
var/atom/movable/screen/using
- pull_icon = new /atom/movable/screen/pull()
+ pull_icon = new /atom/movable/screen/pull(null, src)
pull_icon.icon = ui_style
pull_icon.update_appearance()
pull_icon.screen_loc = ui_living_pull
- pull_icon.hud = src
static_inventory += pull_icon
- healths = new /atom/movable/screen/healths/guardian()
- healths.hud = src
+ healths = new /atom/movable/screen/healths/guardian(null, src)
infodisplay += healths
- using = new /atom/movable/screen/guardian/manifest()
+ using = new /atom/movable/screen/guardian/manifest(null, src)
using.screen_loc = ui_hand_position(2)
- using.hud = src
static_inventory += using
- using = new /atom/movable/screen/guardian/recall()
+ using = new /atom/movable/screen/guardian/recall(null, src)
using.screen_loc = ui_hand_position(1)
- using.hud = src
static_inventory += using
- using = new owner.toggle_button_type()
+ using = new owner.toggle_button_type(null, src)
using.screen_loc = ui_storage1
- using.hud = src
static_inventory += using
- using = new /atom/movable/screen/guardian/toggle_light()
+ using = new /atom/movable/screen/guardian/toggle_light(null, src)
using.screen_loc = ui_inventory
- using.hud = src
static_inventory += using
- using = new /atom/movable/screen/guardian/communicate()
+ using = new /atom/movable/screen/guardian/communicate(null, src)
using.screen_loc = ui_back
- using.hud = src
static_inventory += using
/datum/hud/dextrous/guardian/New(mob/living/simple_animal/hostile/guardian/owner) //for a dextrous guardian
@@ -47,56 +40,47 @@
if(istype(owner, /mob/living/simple_animal/hostile/guardian/dextrous))
var/atom/movable/screen/inventory/inv_box
- inv_box = new /atom/movable/screen/inventory()
+ inv_box = new /atom/movable/screen/inventory(null, src)
inv_box.name = "internal storage"
inv_box.icon = ui_style
inv_box.icon_state = "suit_storage"
inv_box.screen_loc = ui_id
inv_box.slot_id = ITEM_SLOT_DEX_STORAGE
- inv_box.hud = src
static_inventory += inv_box
- using = new /atom/movable/screen/guardian/communicate()
+ using = new /atom/movable/screen/guardian/communicate(null, src)
using.screen_loc = ui_sstore1
- using.hud = src
static_inventory += using
else
- using = new /atom/movable/screen/guardian/communicate()
+ using = new /atom/movable/screen/guardian/communicate(null, src)
using.screen_loc = ui_id
- using.hud = src
static_inventory += using
- pull_icon = new /atom/movable/screen/pull()
+ pull_icon = new /atom/movable/screen/pull(null, src)
pull_icon.icon = 'icons/hud/guardian.dmi'
pull_icon.update_appearance()
pull_icon.screen_loc = ui_living_pull
- pull_icon.hud = src
static_inventory += pull_icon
- healths = new /atom/movable/screen/healths/guardian()
- healths.hud = src
+ healths = new /atom/movable/screen/healths/guardian(null, src)
infodisplay += healths
- using = new /atom/movable/screen/guardian/manifest()
+ using = new /atom/movable/screen/guardian/manifest(null, src)
using.screen_loc = ui_belt
- using.hud = src
static_inventory += using
- using = new /atom/movable/screen/guardian/recall()
+ using = new /atom/movable/screen/guardian/recall(null, src)
using.screen_loc = ui_back
- using.hud = src
static_inventory += using
- using = new owner.toggle_button_type()
+ using = new owner.toggle_button_type(null, src)
using.screen_loc = ui_storage2
- using.hud = src
static_inventory += using
- using = new /atom/movable/screen/guardian/toggle_light()
+ using = new /atom/movable/screen/guardian/toggle_light(null, src)
using.screen_loc = ui_inventory
- using.hud = src
static_inventory += using
/datum/hud/dextrous/guardian/persistent_inventory_update()
@@ -124,9 +108,12 @@
desc = "Spring forth into battle!"
/atom/movable/screen/guardian/manifest/Click()
- if(isguardian(usr))
- var/mob/living/simple_animal/hostile/guardian/G = usr
- G.Manifest()
+ . = ..()
+ if(.)
+ return FALSE
+
+ var/mob/living/simple_animal/hostile/guardian/G = hud.mymob
+ G.Manifest()
/atom/movable/screen/guardian/recall
@@ -135,9 +122,11 @@
desc = "Return to your user."
/atom/movable/screen/guardian/recall/Click()
- if(isguardian(usr))
- var/mob/living/simple_animal/hostile/guardian/G = usr
- G.Recall()
+ . = ..()
+ if(.)
+ return FALSE
+ var/mob/living/simple_animal/hostile/guardian/G = hud.mymob
+ G.Recall()
/atom/movable/screen/guardian/toggle_mode
icon_state = "toggle"
@@ -145,9 +134,12 @@
desc = "Switch between ability modes."
/atom/movable/screen/guardian/toggle_mode/Click()
- if(isguardian(usr))
- var/mob/living/simple_animal/hostile/guardian/G = usr
- G.ToggleMode()
+ . = ..()
+ if(.)
+ return FALSE
+
+ var/mob/living/simple_animal/hostile/guardian/G = hud.mymob
+ G.ToggleMode()
/atom/movable/screen/guardian/toggle_mode/inactive
icon_state = "notoggle" //greyed out so it doesn't look like it'll work
@@ -163,9 +155,11 @@
desc = "Communicate telepathically with your user."
/atom/movable/screen/guardian/communicate/Click()
- if(isguardian(usr))
- var/mob/living/simple_animal/hostile/guardian/G = usr
- G.Communicate()
+ . = ..()
+ if(.)
+ return FALSE
+ var/mob/living/simple_animal/hostile/guardian/G = hud.mymob
+ G.Communicate()
/atom/movable/screen/guardian/toggle_light
@@ -174,6 +168,9 @@
desc = "Glow like star dust."
/atom/movable/screen/guardian/toggle_light/Click()
- if(isguardian(usr))
- var/mob/living/simple_animal/hostile/guardian/G = usr
- G.ToggleLight()
+ . = ..()
+ if(.)
+ return FALSE
+
+ var/mob/living/simple_animal/hostile/guardian/G = hud.mymob
+ G.ToggleLight()
diff --git a/code/_onclick/hud/hud.dm b/code/_onclick/hud/hud.dm
index 2652fd86ab55..f9b0cfdae343 100644
--- a/code/_onclick/hud/hud.dm
+++ b/code/_onclick/hud/hud.dm
@@ -108,7 +108,7 @@ GLOBAL_LIST_INIT(available_ui_styles, list(
hand_slots = list()
for(var/mytype in subtypesof(/atom/movable/screen/plane_master)- /atom/movable/screen/plane_master/rendering_plate)
- var/atom/movable/screen/plane_master/instance = new mytype()
+ var/atom/movable/screen/plane_master/instance = new mytype(null, src)
plane_masters["[instance.plane]"] = instance
instance.backdrop(mymob)
@@ -277,6 +277,7 @@ GLOBAL_LIST_INIT(available_ui_styles, list(
show_hud(hud_version, M)
else if (viewmob.hud_used)
viewmob.hud_used.plane_masters_update()
+ viewmob.show_other_mob_action_buttons(mymob)
return TRUE
@@ -285,7 +286,7 @@ GLOBAL_LIST_INIT(available_ui_styles, list(
for(var/thing in plane_masters)
var/atom/movable/screen/plane_master/PM = plane_masters[thing]
PM.backdrop(mymob)
- mymob.client.screen += PM
+ mymob.canon_client.screen += PM
/datum/hud/human/show_hud(version = 0,mob/viewmob)
. = ..()
@@ -307,10 +308,11 @@ GLOBAL_LIST_INIT(available_ui_styles, list(
if(!mymob)
return
-/datum/hud/proc/update_gunpoint(mob/living/screenmob)
- if(!istype(screenmob))
+/datum/hud/proc/update_gunpoint(mob/screenmob)
+ var/mob/living/L = mymob
+ if(!istype(screenmob) || !istype(L))
return
- if(!screenmob.hud_used.gun_setting_icon)
+ if(!mymob.hud_used.gun_setting_icon)
return
screenmob.client.screen -= gun_setting_icon
@@ -319,7 +321,7 @@ GLOBAL_LIST_INIT(available_ui_styles, list(
return
screenmob.client.screen += gun_setting_icon
- if(screenmob.use_gunpoint)
+ if(L.use_gunpoint || screenmob != L)
screenmob.client.screen += gunpoint_options
@@ -358,14 +360,13 @@ GLOBAL_LIST_INIT(available_ui_styles, list(
hand_slots = list()
var/atom/movable/screen/inventory/hand/hand_box
for(var/i in 1 to mymob.held_items.len)
- hand_box = new /atom/movable/screen/inventory/hand()
+ hand_box = new /atom/movable/screen/inventory/hand(null, src)
hand_box.name = mymob.get_held_index_name(i)
hand_box.icon = ui_style
hand_box.icon_state = "hand_[mymob.held_index_to_dir(i)]"
hand_box.screen_loc = ui_hand_position(i)
hand_box.held_index = i
hand_slots["[i]"] = hand_box
- hand_box.hud = src
static_inventory += hand_box
hand_box.update_appearance()
@@ -419,7 +420,7 @@ GLOBAL_LIST_INIT(available_ui_styles, list(
palette_actions.insert_action(button, palette_actions.index_of(relative_to))
if(SCRN_OBJ_FLOATING) // If we don't have it as a define, this is a screen_loc, and we should be floating
floating_actions += button
- var/client/our_client = mymob.client
+ var/client/our_client = mymob.canon_client
if(!our_client)
position_action(button, button.linked_action.default_button_position)
return
@@ -460,7 +461,7 @@ GLOBAL_LIST_INIT(available_ui_styles, list(
/// Ensures all of our buttons are properly within the bounds of our client's view, moves them if they're not
/datum/hud/proc/view_audit_buttons()
- var/our_view = mymob?.client?.view
+ var/our_view = mymob?.canon_client?.view
if(!our_view)
return
listed_actions.check_against_view()
@@ -576,7 +577,7 @@ GLOBAL_LIST_INIT(available_ui_styles, list(
return "WEST[coord_col]:[coord_col_offset],NORTH[coord_row]:-[pixel_north_offset]"
/datum/action_group/proc/check_against_view()
- var/owner_view = owner?.mymob?.client?.view
+ var/owner_view = owner?.mymob?.canon_client?.view
if(!owner_view)
return
// Unlikey as it is, we may have been changed. Want to start from our target position and fail down
diff --git a/code/_onclick/hud/human.dm b/code/_onclick/hud/human.dm
index 24451694a7cb..f65045638ddd 100644
--- a/code/_onclick/hud/human.dm
+++ b/code/_onclick/hud/human.dm
@@ -5,7 +5,12 @@
name = "toggle"
icon_state = "toggle"
+ private_screen = FALSE // We handle cases where usr != owner.
+
/atom/movable/screen/human/toggle/Click()
+ . = ..()
+ if(.)
+ return FALSE
var/mob/targetmob = usr
@@ -28,8 +33,12 @@
icon_state = "act_equip"
/atom/movable/screen/human/equip/Click()
+ . = ..()
+ if(.)
+ return FALSE
if(ismecha(usr.loc)) // stops inventory actions in a mech
return TRUE
+
var/mob/living/carbon/human/H = usr
H.quick_equip()
@@ -47,9 +56,11 @@
invisibility = INVISIBILITY_ABSTRACT
/atom/movable/screen/ling/sting/Click()
- if(isobserver(usr))
- return
- var/mob/living/carbon/carbon_user = usr
+ . = ..()
+ if(.)
+ return FALSE
+
+ var/mob/living/carbon/carbon_user = hud.mymob
carbon_user.unset_sting()
/datum/hud/human/New(mob/living/carbon/human/owner)
@@ -58,282 +69,243 @@
var/atom/movable/screen/using
var/atom/movable/screen/inventory/inv_box
- using = new/atom/movable/screen/language_menu
+ using = new/atom/movable/screen/language_menu(null, src)
using.icon = ui_style
- using.hud = src
static_inventory += using
- using = new/atom/movable/screen/navigate
+ using = new/atom/movable/screen/navigate(null, src)
using.icon = ui_style
- using.hud = src
static_inventory += using
- using = new /atom/movable/screen/area_creator
+ using = new /atom/movable/screen/area_creator(null, src)
using.icon = ui_style
- using.hud = src
static_inventory += using
- action_intent = new /atom/movable/screen/combattoggle/flashy()
- action_intent.hud = src
+ action_intent = new /atom/movable/screen/combattoggle/flashy(null, src)
action_intent.icon = ui_style
action_intent.screen_loc = ui_combat_toggle
static_inventory += action_intent
- using = new /atom/movable/screen/mov_intent
+ using = new /atom/movable/screen/mov_intent(null, src)
using.icon = ui_style
using.icon_state = (mymob.m_intent == MOVE_INTENT_WALK ? "walking" : "running")
using.screen_loc = ui_movi
- using.hud = src
static_inventory += using
- using = new /atom/movable/screen/drop()
+ using = new /atom/movable/screen/drop(null, src)
using.icon = ui_style
using.screen_loc = ui_drop_throw
- using.hud = src
static_inventory += using
- inv_box = new /atom/movable/screen/inventory()
+ inv_box = new /atom/movable/screen/inventory(null, src)
inv_box.name = "i_clothing"
inv_box.icon = ui_style
inv_box.slot_id = ITEM_SLOT_ICLOTHING
inv_box.icon_state = "uniform"
inv_box.screen_loc = ui_iclothing
- inv_box.hud = src
toggleable_inventory += inv_box
- inv_box = new /atom/movable/screen/inventory()
+ inv_box = new /atom/movable/screen/inventory(null, src)
inv_box.name = "o_clothing"
inv_box.icon = ui_style
inv_box.slot_id = ITEM_SLOT_OCLOTHING
inv_box.icon_state = "suit"
inv_box.screen_loc = ui_oclothing
- inv_box.hud = src
toggleable_inventory += inv_box
build_hand_slots()
- using = new /atom/movable/screen/swap_hand()
+ using = new /atom/movable/screen/swap_hand(null, src)
using.icon = ui_style
using.icon_state = "swap_1"
using.screen_loc = ui_swaphand_position(owner,1)
- using.hud = src
static_inventory += using
- using = new /atom/movable/screen/swap_hand()
+ using = new /atom/movable/screen/swap_hand(null, src)
using.icon = ui_style
using.icon_state = "swap_2"
using.screen_loc = ui_swaphand_position(owner,2)
- using.hud = src
static_inventory += using
- inv_box = new /atom/movable/screen/inventory()
+ inv_box = new /atom/movable/screen/inventory(null, src)
inv_box.name = "id"
inv_box.icon = ui_style
inv_box.icon_state = "id"
inv_box.screen_loc = ui_id
inv_box.slot_id = ITEM_SLOT_ID
- inv_box.hud = src
static_inventory += inv_box
- inv_box = new /atom/movable/screen/inventory()
+ inv_box = new /atom/movable/screen/inventory(null, src)
inv_box.name = "mask"
inv_box.icon = ui_style
inv_box.icon_state = "mask"
inv_box.screen_loc = ui_mask
inv_box.slot_id = ITEM_SLOT_MASK
- inv_box.hud = src
toggleable_inventory += inv_box
- inv_box = new /atom/movable/screen/inventory()
+ inv_box = new /atom/movable/screen/inventory(null, src)
inv_box.name = "neck"
inv_box.icon = ui_style
inv_box.icon_state = "neck"
inv_box.screen_loc = ui_neck
inv_box.slot_id = ITEM_SLOT_NECK
- inv_box.hud = src
toggleable_inventory += inv_box
- inv_box = new /atom/movable/screen/inventory()
+ inv_box = new /atom/movable/screen/inventory(null, src)
inv_box.name = "back"
inv_box.icon = ui_style
inv_box.icon_state = "back"
inv_box.screen_loc = ui_back
inv_box.slot_id = ITEM_SLOT_BACK
- inv_box.hud = src
static_inventory += inv_box
- inv_box = new /atom/movable/screen/inventory()
+ inv_box = new /atom/movable/screen/inventory(null, src)
inv_box.name = "storage1"
inv_box.icon = ui_style
inv_box.icon_state = "pocket"
inv_box.screen_loc = ui_storage1
inv_box.slot_id = ITEM_SLOT_LPOCKET
- inv_box.hud = src
static_inventory += inv_box
- inv_box = new /atom/movable/screen/inventory()
+ inv_box = new /atom/movable/screen/inventory(null, src)
inv_box.name = "storage2"
inv_box.icon = ui_style
inv_box.icon_state = "pocket"
inv_box.screen_loc = ui_storage2
inv_box.slot_id = ITEM_SLOT_RPOCKET
- inv_box.hud = src
static_inventory += inv_box
- inv_box = new /atom/movable/screen/inventory()
+ inv_box = new /atom/movable/screen/inventory(null, src)
inv_box.name = "suit storage"
inv_box.icon = ui_style
inv_box.icon_state = "suit_storage"
inv_box.screen_loc = ui_sstore1
inv_box.slot_id = ITEM_SLOT_SUITSTORE
- inv_box.hud = src
static_inventory += inv_box
- using = new /atom/movable/screen/resist()
+ using = new /atom/movable/screen/resist(null, src)
using.icon = ui_style
using.screen_loc = ui_above_intent
- using.hud = src
hotkeybuttons += using
- using = new /atom/movable/screen/human/toggle()
+ using = new /atom/movable/screen/human/toggle(null, src)
using.icon = ui_style
using.screen_loc = ui_inventory
- using.hud = src
static_inventory += using
- using = new /atom/movable/screen/human/equip()
+ using = new /atom/movable/screen/human/equip(null, src)
using.icon = ui_style
using.screen_loc = ui_equip_position(mymob)
- using.hud = src
static_inventory += using
- inv_box = new /atom/movable/screen/inventory()
+ inv_box = new /atom/movable/screen/inventory(null, src)
inv_box.name = "gloves"
inv_box.icon = ui_style
inv_box.icon_state = "gloves"
inv_box.screen_loc = ui_gloves
inv_box.slot_id = ITEM_SLOT_GLOVES
- inv_box.hud = src
toggleable_inventory += inv_box
- inv_box = new /atom/movable/screen/inventory()
+ inv_box = new /atom/movable/screen/inventory(null, src)
inv_box.name = "eyes"
inv_box.icon = ui_style
inv_box.icon_state = "glasses"
inv_box.screen_loc = ui_glasses
inv_box.slot_id = ITEM_SLOT_EYES
- inv_box.hud = src
toggleable_inventory += inv_box
- inv_box = new /atom/movable/screen/inventory()
+ inv_box = new /atom/movable/screen/inventory(null, src)
inv_box.name = "ears"
inv_box.icon = ui_style
inv_box.icon_state = "ears"
inv_box.screen_loc = ui_ears
inv_box.slot_id = ITEM_SLOT_EARS
- inv_box.hud = src
toggleable_inventory += inv_box
- inv_box = new /atom/movable/screen/inventory()
+ inv_box = new /atom/movable/screen/inventory(null, src)
inv_box.name = "head"
inv_box.icon = ui_style
inv_box.icon_state = "head"
inv_box.screen_loc = ui_head
inv_box.slot_id = ITEM_SLOT_HEAD
- inv_box.hud = src
toggleable_inventory += inv_box
- inv_box = new /atom/movable/screen/inventory()
+ inv_box = new /atom/movable/screen/inventory(null, src)
inv_box.name = "shoes"
inv_box.icon = ui_style
inv_box.icon_state = "shoes"
inv_box.screen_loc = ui_shoes
inv_box.slot_id = ITEM_SLOT_FEET
- inv_box.hud = src
toggleable_inventory += inv_box
- inv_box = new /atom/movable/screen/inventory()
+ inv_box = new /atom/movable/screen/inventory(null, src)
inv_box.name = "belt"
inv_box.icon = ui_style
inv_box.icon_state = "belt"
// inv_box.icon_full = "template_small"
inv_box.screen_loc = ui_belt
inv_box.slot_id = ITEM_SLOT_BELT
- inv_box.hud = src
static_inventory += inv_box
- throw_icon = new /atom/movable/screen/throw_catch()
+ throw_icon = new /atom/movable/screen/throw_catch(null, src)
throw_icon.icon = ui_style
throw_icon.screen_loc = ui_drop_throw
- throw_icon.hud = src
hotkeybuttons += throw_icon
- rest_icon = new /atom/movable/screen/rest()
+ rest_icon = new /atom/movable/screen/rest(null, src)
rest_icon.icon = ui_style
rest_icon.screen_loc = ui_above_movement
- rest_icon.hud = src
rest_icon.update_appearance()
static_inventory += rest_icon
- spacesuit = new /atom/movable/screen/spacesuit
- spacesuit.hud = src
+ spacesuit = new /atom/movable/screen/spacesuit(null, src)
infodisplay += spacesuit
- healthdoll = new /atom/movable/screen/healthdoll()
+ healthdoll = new /atom/movable/screen/healthdoll(null, src)
healthdoll.hud = src
infodisplay += healthdoll
- stamina = new /atom/movable/screen/stamina()
- stamina.hud = src
+ stamina = new /atom/movable/screen/stamina(null, src)
infodisplay += stamina
- pull_icon = new /atom/movable/screen/pull()
+ pull_icon = new /atom/movable/screen/pull(null, src)
pull_icon.icon = ui_style
pull_icon.screen_loc = ui_above_intent
- pull_icon.hud = src
pull_icon.update_appearance()
static_inventory += pull_icon
- zone_select = new /atom/movable/screen/zone_sel()
+ zone_select = new /atom/movable/screen/zone_sel(null, src)
zone_select.icon = ui_style
- zone_select.hud = src
zone_select.update_appearance()
static_inventory += zone_select
- combo_display = new /atom/movable/screen/combo()
+ combo_display = new /atom/movable/screen/combo(null, src)
infodisplay += combo_display
- gun_setting_icon = new /atom/movable/screen/gun_mode()
+ gun_setting_icon = new /atom/movable/screen/gun_mode(null, src)
gun_setting_icon.icon = ui_style
- gun_setting_icon.hud = src
- var/atom/movable/screen/gun_option = new /atom/movable/screen/gun_radio()
+ var/atom/movable/screen/gun_option = new /atom/movable/screen/gun_radio(null, src)
gun_option.icon = ui_style
- gun_option.hud = src
gunpoint_options += gun_option
- gun_option = new /atom/movable/screen/gun_item()
+ gun_option = new /atom/movable/screen/gun_item(null, src)
gun_option.icon = ui_style
- gun_option.hud = src
gunpoint_options += gun_option
- gun_option = new /atom/movable/screen/gun_move()
+ gun_option = new /atom/movable/screen/gun_move(null, src)
gun_option.icon = ui_style
- gun_option.hud = src
gunpoint_options += gun_option
- pain = new
- pain.hud = src
+ pain = new(null, src)
- use_timer = new()
- use_timer.hud = src
+ use_timer = new(null, src)
use_timer.RegisterSignal(mymob, COMSIG_LIVING_CHANGENEXT_MOVE, TYPE_PROC_REF(/atom/movable/screen/progbar_container, on_changenext))
static_inventory += use_timer
for(var/atom/movable/screen/inventory/inv in (static_inventory + toggleable_inventory))
if(inv.slot_id)
- inv.hud = src
inv_slots[TOBITSHIFT(inv.slot_id) + 1] = inv
inv.update_appearance()
diff --git a/code/_onclick/hud/living.dm b/code/_onclick/hud/living.dm
index 366079f233d1..ecd6ecc1eba7 100644
--- a/code/_onclick/hud/living.dm
+++ b/code/_onclick/hud/living.dm
@@ -4,17 +4,15 @@
/datum/hud/living/New(mob/living/owner)
..()
- pull_icon = new /atom/movable/screen/pull()
+ pull_icon = new /atom/movable/screen/pull(null, src)
pull_icon.icon = ui_style
pull_icon.update_appearance()
pull_icon.screen_loc = ui_living_pull
- pull_icon.hud = src
static_inventory += pull_icon
- combo_display = new /atom/movable/screen/combo()
+ combo_display = new /atom/movable/screen/combo(null, src)
infodisplay += combo_display
//mob health doll! assumes whatever sprite the mob is
- healthdoll = new /atom/movable/screen/healthdoll/living()
- healthdoll.hud = src
+ healthdoll = new /atom/movable/screen/healthdoll/living(null, src)
infodisplay += healthdoll
diff --git a/code/_onclick/hud/ooze.dm b/code/_onclick/hud/ooze.dm
index d3ebe3e72885..1b466f7ff979 100644
--- a/code/_onclick/hud/ooze.dm
+++ b/code/_onclick/hud/ooze.dm
@@ -2,14 +2,12 @@
/datum/hud/ooze/New(mob/living/owner)
. = ..()
- zone_select = new /atom/movable/screen/zone_sel()
+ zone_select = new /atom/movable/screen/zone_sel(null, src)
zone_select.icon = ui_style
- zone_select.hud = src
zone_select.update_appearance()
static_inventory += zone_select
- alien_plasma_display = new /atom/movable/screen/ooze_nutrition_display //Just going to use the alien plasma display because making new vars for each object is braindead.
- alien_plasma_display.hud = src
+ alien_plasma_display = new /atom/movable/screen/ooze_nutrition_display(null, src) //Just going to use the alien plasma display because making new vars for each object is braindead.
infodisplay += alien_plasma_display
/atom/movable/screen/ooze_nutrition_display
diff --git a/code/_onclick/hud/pai.dm b/code/_onclick/hud/pai.dm
index c76f5a43aa27..24a9514dc014 100644
--- a/code/_onclick/hud/pai.dm
+++ b/code/_onclick/hud/pai.dm
@@ -5,8 +5,12 @@
var/required_software
/atom/movable/screen/pai/Click()
- if(isobserver(usr) || usr.incapacitated())
+ . = ..()
+ if(.)
+ return FALSE
+ if(usr.incapacitated())
return FALSE
+
var/mob/living/silicon/pai/pAI = usr
if(required_software && !pAI.software.Find(required_software))
to_chat(pAI, PAI_MISSING_SOFTWARE_MESSAGE)
@@ -183,62 +187,62 @@
var/mob/living/silicon/pai/mypai = mymob
// Software menu
- using = new /atom/movable/screen/pai/software
+ using = new /atom/movable/screen/pai/software(null, src)
using.screen_loc = ui_pai_software
static_inventory += using
// Holoform
- using = new /atom/movable/screen/pai/shell
+ using = new /atom/movable/screen/pai/shell(null, src)
using.screen_loc = ui_pai_shell
static_inventory += using
// Chassis Select Menu
- using = new /atom/movable/screen/pai/chassis
+ using = new /atom/movable/screen/pai/chassis(null, src)
using.screen_loc = ui_pai_chassis
static_inventory += using
// Rest
- using = new /atom/movable/screen/pai/rest
+ using = new /atom/movable/screen/pai/rest(null, src)
using.screen_loc = ui_pai_rest
static_inventory += using
// Integrated Light
- using = new /atom/movable/screen/pai/light
+ using = new /atom/movable/screen/pai/light(null, src)
using.screen_loc = ui_pai_light
static_inventory += using
// Newscaster
- using = new /atom/movable/screen/pai/newscaster
+ using = new /atom/movable/screen/pai/newscaster(null, src)
using.screen_loc = ui_pai_newscaster
static_inventory += using
// Language menu
- using = new /atom/movable/screen/language_menu
+ using = new /atom/movable/screen/language_menu(null, src)
using.screen_loc = ui_pai_language_menu
static_inventory += using
// Navigation
- using = new /atom/movable/screen/navigate
+ using = new /atom/movable/screen/navigate(null, src)
using.screen_loc = ui_pai_navigate_menu
static_inventory += using
// Host Monitor
- using = new /atom/movable/screen/pai/host_monitor()
+ using = new /atom/movable/screen/pai/host_monitor(null, src)
using.screen_loc = ui_pai_host_monitor
static_inventory += using
// Crew Manifest
- using = new /atom/movable/screen/pai/crew_manifest()
+ using = new /atom/movable/screen/pai/crew_manifest(null, src)
using.screen_loc = ui_pai_crew_manifest
static_inventory += using
// Laws
- using = new /atom/movable/screen/pai/state_laws()
+ using = new /atom/movable/screen/pai/state_laws(null, src)
using.screen_loc = ui_pai_state_laws
static_inventory += using
// Modular Interface
- using = new /atom/movable/screen/pai/modpc()
+ using = new /atom/movable/screen/pai/modpc(null, src)
using.screen_loc = ui_pai_mod_int
static_inventory += using
mypai.interfaceButton = using
@@ -246,22 +250,22 @@
tabletbutton.pAI = mypai
// Internal GPS
- using = new /atom/movable/screen/pai/internal_gps()
+ using = new /atom/movable/screen/pai/internal_gps(null, src)
using.screen_loc = ui_pai_internal_gps
static_inventory += using
// Take image
- using = new /atom/movable/screen/pai/image_take()
+ using = new /atom/movable/screen/pai/image_take(null, src)
using.screen_loc = ui_pai_take_picture
static_inventory += using
// View images
- using = new /atom/movable/screen/pai/image_view()
+ using = new /atom/movable/screen/pai/image_view(null, src)
using.screen_loc = ui_pai_view_images
static_inventory += using
// Radio
- using = new /atom/movable/screen/pai/radio()
+ using = new /atom/movable/screen/pai/radio(null, src)
using.screen_loc = ui_pai_radio
static_inventory += using
diff --git a/code/_onclick/hud/parallax.dm b/code/_onclick/hud/parallax.dm
index 1b0122c8b5ae..47f49eb377d8 100755
--- a/code/_onclick/hud/parallax.dm
+++ b/code/_onclick/hud/parallax.dm
@@ -9,8 +9,8 @@
if(!length(C.parallax_layers_cached))
C.parallax_layers_cached = list()
- C.parallax_layers_cached += new /atom/movable/screen/parallax_layer/layer_1(null, screenmob)
- C.parallax_layers_cached += new /atom/movable/screen/parallax_layer/stars(null, screenmob)
+ C.parallax_layers_cached += new /atom/movable/screen/parallax_layer/layer_1(null, src)
+ C.parallax_layers_cached += new /atom/movable/screen/parallax_layer/stars(null, src)
C.parallax_layers = C.parallax_layers_cached.Copy()
@@ -252,9 +252,14 @@ INITIALIZE_IMMEDIATE(/atom/movable/screen/parallax_layer)
screen_loc = "CENTER-7,CENTER-7"
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
-/atom/movable/screen/parallax_layer/Initialize(mapload, mob/owner)
+/atom/movable/screen/parallax_layer/Initialize(mapload, datum/hud/hud_owner)
. = ..()
- var/client/boss = owner?.client
+ // Parallax layers are independant of hud, they care about client
+ // Not doing this will just create a bunch of hard deletes
+ hud = null
+
+ var/client/boss = hud_owner?.mymob?.canon_client
+
if(!boss) // If this typepath all starts to harddel your culprit is likely this
return INITIALIZE_HINT_QDEL
diff --git a/code/_onclick/hud/radial.dm b/code/_onclick/hud/radial.dm
index 247e1ea26acb..d0d4e971386c 100644
--- a/code/_onclick/hud/radial.dm
+++ b/code/_onclick/hud/radial.dm
@@ -8,6 +8,9 @@ GLOBAL_LIST_EMPTY(radial_menus)
plane = ABOVE_HUD_PLANE
var/datum/radial_menu/parent
+/atom/movable/screen/radial/can_usr_use(mob/user)
+ return usr.client == parent.current_user
+
/atom/movable/screen/radial/proc/set_parent(new_value)
if(parent)
UnregisterSignal(parent, COMSIG_PARENT_QDELETING)
@@ -49,11 +52,14 @@ GLOBAL_LIST_EMPTY(radial_menus)
closeToolTip(usr)
/atom/movable/screen/radial/slice/Click(location, control, params)
- if(usr.client == parent.current_user)
- if(next_page)
- parent.next_page()
- else
- parent.element_chosen(choice, usr, params)
+ . = ..()
+ if(.)
+ return FALSE
+
+ if(next_page)
+ parent.next_page()
+ else
+ parent.element_chosen(choice, usr, params)
/atom/movable/screen/radial/center
name = "Close Menu"
@@ -68,8 +74,11 @@ GLOBAL_LIST_EMPTY(radial_menus)
icon_state = "radial_center"
/atom/movable/screen/radial/center/Click(location, control, params)
- if(usr.client == parent.current_user)
- parent.finished = TRUE
+ . = ..()
+ if(.)
+ return FALSE
+
+ parent.finished = TRUE
/datum/radial_menu
/// List of choice IDs
diff --git a/code/_onclick/hud/radial_persistent.dm b/code/_onclick/hud/radial_persistent.dm
index 4e83f161a3b8..7483eee64e4f 100644
--- a/code/_onclick/hud/radial_persistent.dm
+++ b/code/_onclick/hud/radial_persistent.dm
@@ -7,8 +7,10 @@
icon_state = "radial_center"
/atom/movable/screen/radial/persistent/center/Click(location, control, params)
- if(usr.client == parent.current_user)
- parent.element_chosen(null, usr, params)
+ . = ..()
+ if(.)
+ return FALSE
+ parent.element_chosen(null, usr, params)
/atom/movable/screen/radial/persistent/center/MouseEntered(location, control, params)
. = ..()
diff --git a/code/_onclick/hud/revenanthud.dm b/code/_onclick/hud/revenanthud.dm
index 75865d3d4547..c47ea4c24180 100644
--- a/code/_onclick/hud/revenanthud.dm
+++ b/code/_onclick/hud/revenanthud.dm
@@ -4,13 +4,11 @@
/datum/hud/revenant/New(mob/owner)
..()
- pull_icon = new /atom/movable/screen/pull()
+ pull_icon = new /atom/movable/screen/pull(null, src)
pull_icon.icon = ui_style
pull_icon.update_appearance()
pull_icon.screen_loc = ui_living_pull
- pull_icon.hud = src
static_inventory += pull_icon
- healths = new /atom/movable/screen/healths/revenant()
- healths.hud = src
+ healths = new /atom/movable/screen/healths/revenant(null, src)
infodisplay += healths
diff --git a/code/_onclick/hud/robot.dm b/code/_onclick/hud/robot.dm
index 271a0e7f7273..0df2168a2ed7 100644
--- a/code/_onclick/hud/robot.dm
+++ b/code/_onclick/hud/robot.dm
@@ -5,10 +5,6 @@
name = "cyborg module"
icon_state = "nomod"
-/atom/movable/screen/robot/Click()
- if(isobserver(usr))
- return 1
-
/atom/movable/screen/robot/module/Click()
if(..())
return
@@ -77,62 +73,55 @@
var/mob/living/silicon/robot/robit = mymob
var/atom/movable/screen/using
- using = new/atom/movable/screen/language_menu
+ using = new/atom/movable/screen/language_menu(null, src)
using.screen_loc = ui_borg_language_menu
static_inventory += using
// Navigation
- using = new /atom/movable/screen/navigate
+ using = new /atom/movable/screen/navigate(null, src)
using.screen_loc = ui_borg_navigate_menu
static_inventory += using
//Radio
- using = new /atom/movable/screen/robot/radio()
+ using = new /atom/movable/screen/robot/radio(null, src)
using.screen_loc = ui_borg_radio
- using.hud = src
static_inventory += using
//Module select
if(!robit.inv1)
- robit.inv1 = new /atom/movable/screen/robot/module1()
+ robit.inv1 = new /atom/movable/screen/robot/module1(null, src)
robit.inv1.screen_loc = ui_inv1
- robit.inv1.hud = src
static_inventory += robit.inv1
if(!robit.inv2)
- robit.inv2 = new /atom/movable/screen/robot/module2()
+ robit.inv2 = new /atom/movable/screen/robot/module2(null, src)
robit.inv2.screen_loc = ui_inv2
- robit.inv2.hud = src
static_inventory += robit.inv2
if(!robit.inv3)
- robit.inv3 = new /atom/movable/screen/robot/module3()
+ robit.inv3 = new /atom/movable/screen/robot/module3(null, src)
robit.inv3.screen_loc = ui_inv3
- robit.inv3.hud = src
static_inventory += robit.inv3
//End of module select
- using = new /atom/movable/screen/robot/lamp()
+ using = new /atom/movable/screen/robot/lamp(null, src)
using.screen_loc = ui_borg_lamp
- using.hud = src
static_inventory += using
robit.lampButton = using
var/atom/movable/screen/robot/lamp/lampscreen = using
lampscreen.robot = robit
//Photography stuff
- using = new /atom/movable/screen/ai/image_take()
+ using = new /atom/movable/screen/ai/image_take(null, src)
using.screen_loc = ui_borg_camera
- using.hud = src
static_inventory += using
//Borg Integrated Tablet
- using = new /atom/movable/screen/robot/modpc()
+ using = new /atom/movable/screen/robot/modpc(null, src)
using.screen_loc = ui_borg_tablet
- using.hud = src
static_inventory += using
robit.interfaceButton = using
if(robit.modularInterface)
@@ -141,43 +130,36 @@
tabletbutton.robot = robit
//Alerts
- using = new /atom/movable/screen/robot/alerts()
+ using = new /atom/movable/screen/robot/alerts(null, src)
using.screen_loc = ui_borg_alerts
- using.hud = src
static_inventory += using
//Combat Mode
- action_intent = new /atom/movable/screen/combattoggle/robot()
- action_intent.hud = src
+ action_intent = new /atom/movable/screen/combattoggle/robot(null, src)
action_intent.icon = ui_style
action_intent.screen_loc = ui_combat_toggle
static_inventory += action_intent
//Health
- healths = new /atom/movable/screen/healths/robot()
- healths.hud = src
+ healths = new /atom/movable/screen/healths/robot(null, src)
infodisplay += healths
//Installed Module
- robit.hands = new /atom/movable/screen/robot/module()
+ robit.hands = new /atom/movable/screen/robot/module(null, src)
robit.hands.screen_loc = ui_borg_module
- robit.hands.hud = src
static_inventory += robit.hands
//Store
- module_store_icon = new /atom/movable/screen/robot/store()
+ module_store_icon = new /atom/movable/screen/robot/store(null, src)
module_store_icon.screen_loc = ui_borg_store
- module_store_icon.hud = src
- pull_icon = new /atom/movable/screen/pull/robot()
+ pull_icon = new /atom/movable/screen/pull/robot(null, src)
pull_icon.screen_loc = ui_borg_pull
- pull_icon.hud = src
pull_icon.update_appearance()
hotkeybuttons += pull_icon
- zone_select = new /atom/movable/screen/zone_sel/robot()
- zone_select.hud = src
+ zone_select = new /atom/movable/screen/zone_sel/robot(null, src)
zone_select.update_appearance()
static_inventory += zone_select
diff --git a/code/_onclick/hud/screen_objects.dm b/code/_onclick/hud/screen_objects.dm
index 276592560d68..d0f1d6b0b42c 100644
--- a/code/_onclick/hud/screen_objects.dm
+++ b/code/_onclick/hud/screen_objects.dm
@@ -32,11 +32,33 @@
*/
var/del_on_map_removal = TRUE
+ /// If set to TRUE, mobs that do not own this hud cannot click this screen object.
+ var/private_screen = TRUE
+
+/atom/movable/screen/Initialize(mapload, datum/hud/hud_owner)
+ . = ..()
+ if(istype(hud_owner))
+ hud = hud_owner
+
/atom/movable/screen/Destroy()
master_ref = null
hud = null
return ..()
+/atom/movable/screen/Click(location, control, params)
+ SHOULD_CALL_PARENT(TRUE)
+ . = !(TRUE || ..())
+
+ if(!can_usr_use(usr))
+ return TRUE
+
+ SEND_SIGNAL(src, COMSIG_CLICK, location, control, params, usr)
+
+/atom/movable/screen/proc/can_usr_use(mob/user)
+ . = TRUE
+ if(private_screen && (hud?.mymob != user))
+ return FALSE
+
/atom/movable/screen/examine(mob/user)
return list()
@@ -59,6 +81,10 @@
name = "swap hand"
/atom/movable/screen/swap_hand/Click()
+ . = ..()
+ if(.)
+ return FALSE
+
// At this point in client Click() code we have passed the 1/10 sec check and little else
// We don't even know if it's a middle click
if(world.time <= usr.next_move)
@@ -79,8 +105,9 @@
screen_loc = ui_navigate_menu
/atom/movable/screen/navigate/Click()
- if(!isliving(usr))
- return TRUE
+ . = ..()
+ if(.)
+ return FALSE
var/mob/living/navigator = usr
navigator.navigate()
@@ -97,8 +124,12 @@
screen_loc = ui_building
/atom/movable/screen/area_creator/Click()
+ . = ..()
+ if(.)
+ return FALSE
if(usr.incapacitated() || (isobserver(usr) && !isAdminGhostAI(usr)))
return TRUE
+
var/area/A = get_area(usr)
if(!A.outdoors)
to_chat(usr, span_warning("There is already a defined structure here."))
@@ -112,6 +143,10 @@
screen_loc = ui_language_menu
/atom/movable/screen/language_menu/Click()
+ . = ..()
+ if(.)
+ return FALSE
+
var/mob/M = usr
var/datum/language_holder/H = M.get_language_holder()
H.open_language_menu(usr)
@@ -131,6 +166,10 @@
/atom/movable/screen/inventory/Click(location, control, params)
// At this point in client Click() code we have passed the 1/10 sec check and little else
// We don't even know if it's a middle click
+ . = ..()
+ if(.)
+ return FALSE
+
if(world.time <= usr.next_move)
return TRUE
@@ -237,10 +276,11 @@
/atom/movable/screen/inventory/hand/Click(location, control, params)
// At this point in client Click() code we have passed the 1/10 sec check and little else
// We don't even know if it's a middle click
- var/mob/user = hud?.mymob
- if(usr != user)
- return TRUE
+ . = ..()
+ if(!can_usr_use(usr))
+ return FALSE
+ var/mob/user = hud?.mymob
if(world.time <= user.next_move)
return TRUE
@@ -293,11 +333,18 @@
plane = ABOVE_HUD_PLANE
icon_state = "backpack_close"
-/atom/movable/screen/close/Initialize(mapload, new_master)
+/atom/movable/screen/close/Initialize(mapload, datum/hud/hud_owner, new_master)
. = ..()
master_ref = WEAKREF(new_master)
+/atom/movable/screen/close/can_usr_use(mob/user)
+ return TRUE
+
/atom/movable/screen/close/Click()
+ . = ..()
+ if(.)
+ return
+
var/datum/storage/storage = master_ref?.resolve()
if(!storage)
return
@@ -311,6 +358,9 @@
plane = HUD_PLANE
/atom/movable/screen/drop/Click()
+ . = ..()
+ if(.)
+ return FALSE
if(usr.stat == CONSCIOUS)
usr.dropItemToGround(usr.get_active_held_item())
@@ -325,6 +375,9 @@
update_appearance()
/atom/movable/screen/combattoggle/Click()
+ . = ..()
+ if(.)
+ return FALSE
if(isliving(usr))
var/mob/living/owner = usr
owner.set_combat_mode(!owner.combat_mode, FALSE)
@@ -371,6 +424,9 @@
icon_state = "running"
/atom/movable/screen/mov_intent/Click()
+ . = ..()
+ if(.)
+ return FALSE
toggle(usr)
/atom/movable/screen/mov_intent/update_icon_state()
@@ -382,8 +438,6 @@
return ..()
/atom/movable/screen/mov_intent/proc/toggle(mob/user)
- if(isobserver(user))
- return
if(user.m_intent != MOVE_INTENT_WALK)
user.set_move_intent(MOVE_INTENT_WALK)
else
@@ -396,11 +450,12 @@
base_icon_state = "pull"
/atom/movable/screen/pull/Click()
- if(isobserver(usr))
- return
- if(isliving(usr) && usr == hud.mymob)
- var/mob/living/L = usr
- L.release_all_grabs()
+ . = ..()
+ if(.)
+ return FALSE
+
+ var/mob/living/L = usr
+ L.release_all_grabs()
/atom/movable/screen/pull/update_icon_state()
icon_state = "[base_icon_state][LAZYLEN(hud?.mymob?:active_grabs) ? null : 0]"
@@ -423,9 +478,11 @@
plane = HUD_PLANE
/atom/movable/screen/resist/Click()
- if(isliving(usr))
- var/mob/living/L = usr
- L.resist()
+ . = ..()
+ if(.)
+ return FALSE
+ var/mob/living/L = usr
+ L.resist()
/atom/movable/screen/rest
name = "rest"
@@ -435,9 +492,12 @@
plane = HUD_PLANE
/atom/movable/screen/rest/Click()
- if(isliving(usr))
- var/mob/living/L = usr
- L.toggle_resting()
+ . = ..()
+ if(.)
+ return FALSE
+
+ var/mob/living/L = usr
+ L.toggle_resting()
/atom/movable/screen/rest/update_icon_state()
var/mob/living/user = hud?.mymob
@@ -453,11 +513,19 @@
plane = HUD_PLANE
mouse_drop_zone = TRUE
-/atom/movable/screen/storage/Initialize(mapload, new_master)
+/atom/movable/screen/storage/Initialize(mapload, datum/hud/hud_owner, new_master)
. = ..()
master_ref = WEAKREF(new_master)
+/atom/movable/screen/storage/can_usr_use(mob/user)
+ // Storage does all of it's own sanity checking and stuff.
+ return TRUE
+
/atom/movable/screen/storage/Click(location, control, params)
+ . = ..()
+ if(.)
+ return
+
var/datum/storage/storage_master = master_ref?.resolve()
if(!istype(storage_master))
return FALSE
@@ -510,9 +578,12 @@
icon_state = "act_throw_off"
/atom/movable/screen/throw_catch/Click()
- if(iscarbon(usr))
- var/mob/living/carbon/C = usr
- C.toggle_throw_mode()
+ . = ..()
+ if(.)
+ return FALSE
+
+ var/mob/living/carbon/C = usr
+ C.toggle_throw_mode()
/atom/movable/screen/zone_sel
name = "damage zone"
@@ -523,8 +594,9 @@
var/hovering
/atom/movable/screen/zone_sel/Click(location, control,params)
- if(isobserver(usr))
- return
+ . = ..()
+ if(.)
+ return FALSE
var/list/modifiers = params2list(params)
var/icon_x = text2num(LAZYACCESS(modifiers, ICON_X))
@@ -695,9 +767,12 @@
screen_loc = ui_healthdoll
/atom/movable/screen/healthdoll/Click()
- if (iscarbon(usr))
- var/mob/living/carbon/C = usr
- C.check_self_for_injuries()
+ . = ..()
+ if(.)
+ return FALSE
+
+ var/mob/living/carbon/C = usr
+ C.check_self_for_injuries()
/atom/movable/screen/healthdoll/living
icon_state = "fullhealth0"
@@ -712,6 +787,10 @@
src.parent = parent
/atom/movable/screen/component_button/Click(params)
+ . = ..()
+ if(.)
+ return FALSE
+
if(parent)
parent.component_click(src, params)
@@ -750,25 +829,26 @@
name = "stamina"
icon_state = "stamina0"
screen_loc = ui_stamina
+ private_screen = FALSE
/atom/movable/screen/stamina/Click(location, control, params)
- if (iscarbon(usr))
- var/mob/living/carbon/C = usr
- var/content = {"
-