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 = {" -
- [span_boldnotice("You have [C.stamina.current]/[C.stamina.maximum] stamina.")] -
- "} - to_chat(C, content) + . = ..() + if(.) + return FALSE + var/mob/living/carbon/C = hud.mymob + var/content = {" +
+ [span_boldnotice("You have [C.stamina.current]/[C.stamina.maximum] stamina.")] +
+ "} + to_chat(usr, content) /atom/movable/screen/stamina/MouseEntered(location, control, params) . = ..() - var/mob/living/L = usr - if(!istype(L)) - return - if(QDELETED(src)) return + + var/mob/living/L = hud.mymob var/_content = {" Stamina: [L.stamina.current]/[L.stamina.maximum]
Regen: [L.stamina.regen_rate] @@ -786,26 +866,22 @@ /atom/movable/screen/gun_mode/Click(location, control, params) . = ..() - var/mob/targetmob = usr - if(isobserver(usr)) - if(ishuman(usr.client.eye) && (usr.client.eye != usr)) - var/mob/M = usr.client.eye - targetmob = M + if(.) + return FALSE - var/datum/hud/hud = targetmob.hud_used - if(!hud?.gun_setting_icon) + var/mob/living/user = hud?.mymob + if(!user) return + user.use_gunpoint = !user.use_gunpoint hud.gun_setting_icon.update_icon_state() - hud.update_gunpoint(targetmob) - + hud.update_gunpoint(user) /atom/movable/screen/gun_mode/update_icon_state() . = ..() var/mob/living/user = hud?.mymob if(!user) return - user.use_gunpoint = !user.use_gunpoint if(!user.use_gunpoint) icon_state = "gun0" @@ -821,25 +897,20 @@ /atom/movable/screen/gun_radio/Click(location, control, params) . = ..() - var/mob/targetmob = usr - if(isobserver(usr)) - if(ishuman(usr.client.eye) && (usr.client.eye != usr)) - var/mob/M = usr.client.eye - targetmob = M + if(.) + return FALSE - var/datum/hud/hud = targetmob.hud_used - if(!hud?.gun_setting_icon) + var/mob/living/user = hud?.mymob + if(!user) return - locate(type, hud.gunpoint_options):update_icon_state() + user.toggle_gunpoint_flag(TARGET_CAN_RADIO) + update_icon_state() /atom/movable/screen/gun_radio/update_icon_state() . = ..() - var/mob/living/user = hud?.mymob - if(!user) - return - user.toggle_gunpoint_flag(TARGET_CAN_RADIO) + var/mob/living/user = hud?.mymob if(user.gunpoint_flags & TARGET_CAN_RADIO) icon_state = "no_radio1" else @@ -852,25 +923,20 @@ /atom/movable/screen/gun_item/Click(location, control, params) . = ..() - var/mob/targetmob = usr - if(isobserver(usr)) - if(ishuman(usr.client.eye) && (usr.client.eye != usr)) - var/mob/M = usr.client.eye - targetmob = M + if(.) + return FALSE - var/datum/hud/hud = targetmob.hud_used - if(!hud?.gun_setting_icon) + var/mob/living/user = hud?.mymob + if(!user) return - locate(type, hud.gunpoint_options):update_icon_state() + user.toggle_gunpoint_flag(TARGET_CAN_INTERACT) + update_icon_state() /atom/movable/screen/gun_item/update_icon_state() . = ..() - var/mob/living/user = hud?.mymob - if(!user) - return - user.toggle_gunpoint_flag(TARGET_CAN_INTERACT) + var/mob/living/user = hud?.mymob if(user.gunpoint_flags & TARGET_CAN_INTERACT) icon_state = "no_item1" else @@ -883,25 +949,20 @@ /atom/movable/screen/gun_move/Click(location, control, params) . = ..() - var/mob/targetmob = usr - if(isobserver(usr)) - if(ishuman(usr.client.eye) && (usr.client.eye != usr)) - var/mob/M = usr.client.eye - targetmob = M + if(.) + return FALSE - var/datum/hud/hud = targetmob.hud_used - if(!hud?.gun_setting_icon) + var/mob/living/user = hud?.mymob + if(!user) return - locate(type, hud.gunpoint_options):update_icon_state() + user.toggle_gunpoint_flag(TARGET_CAN_MOVE) + update_icon_state() /atom/movable/screen/gun_move/update_icon_state() . = ..() - var/mob/living/user = hud?.mymob - if(!user) - return - user.toggle_gunpoint_flag(TARGET_CAN_MOVE) + var/mob/living/user = hud?.mymob if(user.gunpoint_flags & TARGET_CAN_MOVE) icon_state = "no_walk1" else diff --git a/code/_onclick/observer.dm b/code/_onclick/observer.dm index cb56a9b3986f..b57884370fde 100644 --- a/code/_onclick/observer.dm +++ b/code/_onclick/observer.dm @@ -58,7 +58,7 @@ return TRUE else if(isAdminGhostAI(user)) attack_ai(user) - else if(user.client.prefs.read_preference(/datum/preference/toggle/inquisitive_ghost)) + else if(user.client.prefs.read_preference(/datum/preference/toggle/inquisitive_ghost) && !user.observetarget) user.examinate(src) return FALSE diff --git a/code/controllers/subsystem/ambience.dm b/code/controllers/subsystem/ambience.dm index f131c90e1174..ac37ab8c222c 100644 --- a/code/controllers/subsystem/ambience.dm +++ b/code/controllers/subsystem/ambience.dm @@ -21,8 +21,8 @@ SUBSYSTEM_DEF(ambience) cached_clients.len-- //Check to see if the client exists and isn't held by a new player - var/mob/client_mob = client_iterator?.mob - if(isnull(client_iterator) || !client_mob || isnewplayer(client_mob)) + var/mob/client_mob = client_iterator?.mob.hear_location() + if(isnull(client_iterator) || isnewplayer(client_mob)) ambience_listening_clients -= client_iterator client_old_areas -= client_iterator continue diff --git a/code/controllers/subsystem/packetnets.dm b/code/controllers/subsystem/packetnets.dm index b7d22525954e..04063fe0ccfd 100644 --- a/code/controllers/subsystem/packetnets.dm +++ b/code/controllers/subsystem/packetnets.dm @@ -395,7 +395,7 @@ SUBSYSTEM_DEF(packets) // Add observers who have ghost radio enabled. for(var/mob/dead/observer/ghost in GLOB.player_list) - if(ghost.client.prefs?.chat_toggles & CHAT_GHOSTRADIO) + if(!ghost.observetarget && (ghost.client.prefs?.chat_toggles & CHAT_GHOSTRADIO)) globally_receiving |= ghost // Render the message and have everybody hear it. diff --git a/code/controllers/subsystem/points_of_interest.dm b/code/controllers/subsystem/points_of_interest.dm index e588386bad97..d3cf1ebfe350 100644 --- a/code/controllers/subsystem/points_of_interest.dm +++ b/code/controllers/subsystem/points_of_interest.dm @@ -100,7 +100,7 @@ SUBSYSTEM_DEF(points_of_interest) * * poi_validation_override - [OPTIONAL] Callback to a proc that takes a single argument for the POI and returns TRUE if this POI should be included. Overrides standard POI validation. * * append_dead_role - [OPTIONAL] If TRUE, adds a ghost tag to the end of observer names and a dead tag to the end of any other mob which is not alive. */ -/datum/controller/subsystem/points_of_interest/proc/get_mob_pois(datum/callback/poi_validation_override = null, append_dead_role = TRUE) +/datum/controller/subsystem/points_of_interest/proc/get_mob_pois(datum/callback/poi_validation_override = null, append_dead_role = TRUE, cliented_mobs_only = FALSE) var/list/pois = list() var/list/used_name_list = list() @@ -112,6 +112,8 @@ SUBSYSTEM_DEF(points_of_interest) continue var/mob/target_mob = mob_poi.target + if(cliented_mobs_only && !target_mob.client) + return var/name = avoid_assoc_duplicate_keys(target_mob.name, used_name_list) + target_mob.get_realname_string() // Add the ghost/dead tag to the end of dead mob POIs. diff --git a/code/datums/actions/action.dm b/code/datums/actions/action.dm index 20e5e9e46bf4..4124f4747870 100644 --- a/code/datums/actions/action.dm +++ b/code/datums/actions/action.dm @@ -311,7 +311,7 @@ var/atom/movable/screen/movable/action_button/button = create_button() SetId(button, viewer) - button.our_hud = our_hud + button.hud = our_hud viewers[our_hud] = button if(viewer.client) viewer.client.screen += button diff --git a/code/datums/actions/cooldown_action.dm b/code/datums/actions/cooldown_action.dm index f04000f64a7d..d185ff33b6a3 100644 --- a/code/datums/actions/cooldown_action.dm +++ b/code/datums/actions/cooldown_action.dm @@ -102,7 +102,7 @@ return ..() /datum/action/cooldown/is_action_active(atom/movable/screen/movable/action_button/current_button) - return click_to_activate && current_button.our_hud?.mymob?.click_intercept == src + return click_to_activate && current_button.hud?.mymob?.click_intercept == src /datum/action/cooldown/Destroy() QDEL_LIST(initialized_actions) diff --git a/code/datums/components/crafting/crafting.dm b/code/datums/components/crafting/crafting.dm index 2f860e612bae..332207360f58 100644 --- a/code/datums/components/crafting/crafting.dm +++ b/code/datums/components/crafting/crafting.dm @@ -6,7 +6,7 @@ SIGNAL_HANDLER var/datum/hud/H = user.hud_used - var/atom/movable/screen/craft/C = new() + var/atom/movable/screen/craft/C = new(null, H) C.icon = H.ui_style H.static_inventory += C CL.screen += C diff --git a/code/datums/components/lock_on_cursor.dm b/code/datums/components/lock_on_cursor.dm index 72f2d9e9154c..b57b536ae5a3 100644 --- a/code/datums/components/lock_on_cursor.dm +++ b/code/datums/components/lock_on_cursor.dm @@ -204,8 +204,11 @@ /atom/movable/screen/fullscreen/cursor_catcher/lock_on /atom/movable/screen/fullscreen/cursor_catcher/lock_on/Click(location, control, params) - if(usr == owner) - calculate_params() + . = ..() + if(.) + return FALSE + + calculate_params() given_turf.Click(location, control, params) #undef LOCKON_IGNORE_RESULT diff --git a/code/datums/status_effects/debuffs/debuffs.dm b/code/datums/status_effects/debuffs/debuffs.dm index bcb4965b79cf..4c043f23a507 100644 --- a/code/datums/status_effects/debuffs/debuffs.dm +++ b/code/datums/status_effects/debuffs/debuffs.dm @@ -1069,8 +1069,11 @@ icon_state = "antalert" /atom/movable/screen/alert/status_effect/ants/Click() + . = ..() + if(.) + return FALSE var/mob/living/living = owner - if(!istype(living) || !living.can_resist() || living != owner) + if(!istype(living) || !living.can_resist()) return to_chat(living, span_notice("You start to shake the ants off!")) if(!do_after(living, time = 2 SECONDS)) diff --git a/code/datums/storage/storage.dm b/code/datums/storage/storage.dm index 2b90666eb388..7d610b4bf06a 100644 --- a/code/datums/storage/storage.dm +++ b/code/datums/storage/storage.dm @@ -82,8 +82,8 @@ var/datum/weakref/modeswitch_action_ref /datum/storage/New(atom/parent, max_slots, max_specific_storage, max_total_storage, numerical_stacking, allow_quick_gather, allow_quick_empty, collection_mode, attack_hand_interact) - boxes = new(null, src) - closer = new(null, src) + boxes = new(null, null, src) + closer = new(null, null, src) src.parent = WEAKREF(parent) src.real_location = src.parent @@ -953,7 +953,10 @@ GLOBAL_LIST_EMPTY(cached_storage_typecaches) return FALSE if(isobserver(to_show)) - show_contents(to_show) + if(to_show.active_storage == src) + hide_contents(to_show) + else + show_contents(to_show) return FALSE if(!to_show.CanReach(resolve_parent)) diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index d6cc717f55ce..7fb0c05e9ef2 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -1184,7 +1184,13 @@ DEFINE_INTERACTABLE(/obj/item) /obj/item/MouseEntered(location, control, params) . = ..() - if(((get(src, /mob) == usr) || loc?.atom_storage || (src.item_flags & IN_STORAGE)) && !QDELETED(src)) + var/mob/in_contents_of = get(src, /mob) + var/in_our_inventory = (in_contents_of == usr) + if(!in_our_inventory && isobserver(usr)) + var/mob/dead/observer/O = usr + in_our_inventory = (O.observetarget == in_contents_of) + + if((in_our_inventory || loc?.atom_storage || (src.item_flags & IN_STORAGE)) && !QDELETED(src)) var/mob/living/L = usr if(usr.client.prefs.read_preference(/datum/preference/toggle/enable_tooltips)) var/timedelay = usr.client.prefs.read_preference(/datum/preference/numeric/tooltip_delay) / 100 diff --git a/code/game/say.dm b/code/game/say.dm index 7fd667d1057e..d853e8e04e89 100644 --- a/code/game/say.dm +++ b/code/game/say.dm @@ -37,6 +37,10 @@ GLOBAL_LIST_INIT(freqtospan, list( /mob/Hear(message, atom/movable/speaker, message_language, raw_message, radio_freq, list/spans, list/message_mods = list(), atom/sound_loc) . = ..() + if(LAZYLEN(observers)) + for(var/mob/dead/observer/O as anything in observers) + O.Hear(arglist(args)) + if(client && radio_freq) var/atom/movable/virtualspeaker/V = speaker if(isAI(V.source)) diff --git a/code/game/sound.dm b/code/game/sound.dm index 758e81b044c9..a00d0d0622fa 100644 --- a/code/game/sound.dm +++ b/code/game/sound.dm @@ -154,6 +154,9 @@ sound_to_use.echo[4] = 0 //RoomHF setting, 0 means normal reverb. SEND_SOUND(src, sound_to_use) + if(LAZYLEN(observers)) + for(var/mob/dead/observer/O as anything in observers) + SEND_SOUND(src, sound_to_use) /proc/sound_to_playing_players(soundin, volume = 100, vary = FALSE, frequency = 0, channel = 0, pressure_affected = FALSE, sound/S) if(!S) diff --git a/code/modules/antagonists/changeling/changeling.dm b/code/modules/antagonists/changeling/changeling.dm index 485941638cde..8eb234e63055 100644 --- a/code/modules/antagonists/changeling/changeling.dm +++ b/code/modules/antagonists/changeling/changeling.dm @@ -134,12 +134,11 @@ if(living_mob.hud_used) var/datum/hud/hud_used = living_mob.hud_used - lingchemdisplay = new /atom/movable/screen/ling/chems() - lingchemdisplay.hud = hud_used + lingchemdisplay = new /atom/movable/screen/ling/chems(null, hud_used) hud_used.infodisplay += lingchemdisplay - lingstingdisplay = new /atom/movable/screen/ling/sting() - lingstingdisplay.hud = hud_used + lingstingdisplay = new /atom/movable/screen/ling/sting(null, hud_used) + hud_used.infodisplay += lingstingdisplay hud_used.show_hud(hud_used.hud_version) diff --git a/code/modules/antagonists/ert/ert.dm b/code/modules/antagonists/ert/ert.dm index 5208303a61e1..bd62e44e694e 100644 --- a/code/modules/antagonists/ert/ert.dm +++ b/code/modules/antagonists/ert/ert.dm @@ -262,7 +262,7 @@ var/mob/living/M = mob_override || owner.current if(M.hud_used) var/datum/hud/H = M.hud_used - var/atom/movable/screen/wanted/giving_wanted_lvl = new /atom/movable/screen/wanted() + var/atom/movable/screen/wanted/giving_wanted_lvl = new /atom/movable/screen/wanted(null, M.hud_used) H.wanted_lvl = giving_wanted_lvl giving_wanted_lvl.hud = H H.infodisplay += giving_wanted_lvl diff --git a/code/modules/buildmode/buildmode.dm b/code/modules/buildmode/buildmode.dm index 836748ac7434..f69350eb91c7 100644 --- a/code/modules/buildmode/buildmode.dm +++ b/code/modules/buildmode/buildmode.dm @@ -65,13 +65,13 @@ /datum/buildmode/proc/create_buttons() // keep a reference so we can update it upon mode switch - modebutton = new /atom/movable/screen/buildmode/mode(src) + modebutton = new /atom/movable/screen/buildmode/mode(src, holder.mob.hud_used) buttons += modebutton - buttons += new /atom/movable/screen/buildmode/help(src) + buttons += new /atom/movable/screen/buildmode/help(src, holder.mob.hud_used) // keep a reference so we can update it upon dir switch - dirbutton = new /atom/movable/screen/buildmode/bdir(src) + dirbutton = new /atom/movable/screen/buildmode/bdir(src, holder.mob.hud_used) buttons += dirbutton - buttons += new /atom/movable/screen/buildmode/quit(src) + buttons += new /atom/movable/screen/buildmode/quit(src, holder.mob.hud_used) // build the lists of switching buttons build_options_grid(subtypesof(/datum/buildmode_mode), modeswitch_buttons, /atom/movable/screen/buildmode/modeswitch) build_options_grid(GLOB.alldirs, dirswitch_buttons, /atom/movable/screen/buildmode/dirswitch) diff --git a/code/modules/buildmode/buttons.dm b/code/modules/buildmode/buttons.dm index e21d808d7c2a..1b342597c6c3 100644 --- a/code/modules/buildmode/buttons.dm +++ b/code/modules/buildmode/buttons.dm @@ -4,6 +4,9 @@ // If we don't do this, we get occluded by item action buttons plane = ABOVE_HUD_PLANE +/atom/movable/screen/buildmode/can_usr_use(mob/user) + return bd.holder == user.client + /atom/movable/screen/buildmode/New(bld) bd = bld return ..() @@ -18,6 +21,10 @@ screen_loc = "NORTH,WEST" /atom/movable/screen/buildmode/mode/Click(location, control, params) + . = ..() + if(.) + return FALSE + var/list/modifiers = params2list(params) if(LAZYACCESS(modifiers, LEFT_CLICK)) bd.toggle_modeswitch() @@ -37,6 +44,10 @@ name = "Buildmode Help" /atom/movable/screen/buildmode/help/Click(location, control, params) + . = ..() + if(.) + return FALSE + bd.mode.show_help(usr.client) return 1 @@ -50,6 +61,10 @@ return ..() /atom/movable/screen/buildmode/bdir/Click() + . = ..() + if(.) + return FALSE + bd.toggle_dirswitch() update_appearance() return 1 @@ -65,6 +80,9 @@ return ..(bld) /atom/movable/screen/buildmode/modeswitch/Click() + . = ..() + if(.) + return FALSE bd.change_mode(modetype) return 1 @@ -78,6 +96,9 @@ return ..(bld) /atom/movable/screen/buildmode/dirswitch/Click() + . = ..() + if(.) + return FALSE bd.change_dir(dir) return 1 @@ -87,5 +108,8 @@ name = "Quit Buildmode" /atom/movable/screen/buildmode/quit/Click() + . = ..() + if(.) + return FALSE bd.quit() return 1 diff --git a/code/modules/mob/dead/observer/logout.dm b/code/modules/mob/dead/observer/logout.dm index 1b666a88bcd3..c5d02c6dbab3 100644 --- a/code/modules/mob/dead/observer/logout.dm +++ b/code/modules/mob/dead/observer/logout.dm @@ -2,7 +2,7 @@ update_z(null) if(observetarget && ismob(observetarget)) - cleanup_observe() + stop_observing() ..() // This is one of very few spawn()s left in our codebase // Yes it needs to be like this diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index a9218dd53829..4852cb00858a 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -242,7 +242,21 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp return ghostize(FALSE) +/mob/dead/observer/keyLoop(client/user) + if(observetarget) + var/trying_to_move = FALSE + for(var/_key in user?.keys_held) + if(user.movement_keys[_key]) + trying_to_move = TRUE + break + if(trying_to_move) + stop_observing() + return ..() + /mob/dead/observer/Move(NewLoc, direct, glide_size_override = 32, z_movement_flags) + if(observetarget) + stop_observing() + setDir(direct) if(glide_size_override) @@ -381,7 +395,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp // This is the ghost's follow verb with an argument /mob/dead/observer/proc/ManualFollow(atom/movable/target) - if (!istype(target) || (is_secret_level(target.z) && !client?.holder)) + if (!istype(target) || !target.z || (is_secret_level(target.z) && !client?.holder)) return var/icon/I = icon(target.icon,target.icon_state,target.dir) @@ -406,6 +420,9 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp orbit(target,orbitsize, FALSE, 20, rot_seg) /mob/dead/observer/orbit() + if(observetarget) + stop_observing() + setDir(2)//reset dir so the right directional sprites show up return ..() @@ -515,12 +532,13 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp update_sight() /mob/dead/observer/update_sight() - if (!ghostvision) + if(observetarget) + return + + if(!ghostvision) see_invisible = SEE_INVISIBLE_LIVING else see_invisible = SEE_INVISIBLE_OBSERVER - - ..() /mob/dead/observer/verb/possess() @@ -722,24 +740,39 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp remove_verb(src, /mob/dead/observer/verb/possess) /mob/dead/observer/reset_perspective(atom/A) - if(client) - if(ismob(client.eye) && (client.eye != src)) - cleanup_observe() + if(client && observetarget) + stop_observing() + return + if(..()) if(hud_used) client.screen = list() hud_used.show_hud(hud_used.hud_version) -/mob/dead/observer/proc/cleanup_observe() +/mob/dead/observer/proc/stop_observing() if(isnull(observetarget)) return + + if(!QDELETED(src)) + if(QDELETED(observetarget)) + var/obj/effect/landmark/observer_start/O = locate(/obj/effect/landmark/observer_start) in GLOB.landmarks_list + if (O) + forceMove(O.loc) + else + abstract_move(get_turf(observetarget)) + var/mob/target = observetarget observetarget = null + reset_perspective(null) // Comes after nulling, otherwise it would cause an infinite loop + client?.perspective = initial(client.perspective) sight = initial(sight) + see_invisible = initial(see_invisible) + if(target) - UnregisterSignal(target, COMSIG_MOVABLE_Z_CHANGED) + hide_other_mob_action_buttons(target) + UnregisterSignal(target, COMSIG_MOB_UPDATE_SIGHT) LAZYREMOVE(target.observers, src) /mob/dead/observer/verb/observe() @@ -749,9 +782,12 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp if(!isobserver(usr)) //Make sure they're an observer! return + var/was_observing = observetarget reset_perspective(null) + if(was_observing) + return - var/list/possible_destinations = SSpoints_of_interest.get_mob_pois() + var/list/possible_destinations = SSpoints_of_interest.get_mob_pois(cliented_mobs_only = TRUE) var/target = null target = tgui_input_list(usr, "Please, select a player!", "Jump to Mob", possible_destinations) @@ -769,31 +805,36 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp do_observe(chosen_target) /mob/dead/observer/proc/do_observe(mob/mob_eye) + //Istype so we filter out points of interest that are not mobs + if(!client || !istype(mob_eye)) + return + if(isnewplayer(mob_eye)) stack_trace("/mob/dead/new_player: \[[mob_eye]\] is being observed by [key_name(src)]. This should never happen and has been blocked.") message_admins("[ADMIN_LOOKUPFLW(src)] attempted to observe someone in the lobby: [ADMIN_LOOKUPFLW(mob_eye)]. This should not be possible and has been blocked.") return - //Istype so we filter out points of interest that are not mobs - if(client && mob_eye && istype(mob_eye)) - client.eye = mob_eye - client.perspective = EYE_PERSPECTIVE - if(is_secret_level(mob_eye.z) && !client?.holder) - sight = null //we dont want ghosts to see through walls in secret areas - RegisterSignal(mob_eye, COMSIG_MOVABLE_Z_CHANGED, PROC_REF(on_observing_z_changed)) - if(mob_eye.hud_used) - client.screen = list() - LAZYOR(mob_eye.observers, src) - mob_eye.hud_used.show_hud(mob_eye.hud_used.hud_version, src) - observetarget = mob_eye + orbit(mob_eye) + + client.eye = mob_eye + client.perspective = EYE_PERSPECTIVE + sight = mob_eye.sight + see_invisible = mob_eye.see_invisible + + if(mob_eye.hud_used) + client.screen = list() + LAZYOR(mob_eye.observers, src) + mob_eye.hud_used.show_hud(mob_eye.hud_used.hud_version, src) + observetarget = mob_eye -/mob/dead/observer/proc/on_observing_z_changed(datum/source, turf/old_turf, turf/new_turf) + RegisterSignal(mob_eye, COMSIG_MOB_UPDATE_SIGHT, PROC_REF(on_observing_sight_changed)) + + moveToNullspace() + +/mob/dead/observer/proc/on_observing_sight_changed(datum/source) SIGNAL_HANDLER - if(is_secret_level(new_turf.z) && !client?.holder) - sight = null //we dont want ghosts to see through walls in secret areas - else - sight = initial(sight) + sight = observetarget.sight /mob/dead/observer/verb/register_pai_candidate() set category = "Ghost" @@ -921,4 +962,4 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp return GLOB.ghost_lighting_options[prefs.read_preference(/datum/preference/choiced/ghost_lighting)] /mob/dead/observer/hear_location() - return orbit_target || ..() + return observetarget || orbit_target || ..() diff --git a/code/modules/mob/living/carbon/carbon_update_icons.dm b/code/modules/mob/living/carbon/carbon_update_icons.dm index 435bc4c434f5..79bf1f2c1f2c 100644 --- a/code/modules/mob/living/carbon/carbon_update_icons.dm +++ b/code/modules/mob/living/carbon/carbon_update_icons.dm @@ -100,13 +100,13 @@ if(client && hud_used && hud_used.hud_version != HUD_STYLE_NOHUD) I.screen_loc = ui_hand_position(get_held_index_of_item(I)) client.screen += I - if(length(observers)) + if(LAZYLEN(observers)) for(var/mob/dead/observe as anything in observers) if(observe.client && observe.client.eye == src) observe.client.screen += I else observers -= observe - if(!observers.len) + if(!length(observers)) observers = null break diff --git a/code/modules/mob/living/carbon/human/human_update_icons.dm b/code/modules/mob/living/carbon/human/human_update_icons.dm index d78c6d6be319..5ad8a04883e7 100644 --- a/code/modules/mob/living/carbon/human/human_update_icons.dm +++ b/code/modules/mob/living/carbon/human/human_update_icons.dm @@ -698,14 +698,13 @@ There are several things that need to be remembered: if(client && hud_used && hud_used.hud_version != HUD_STYLE_NOHUD) worn_item.screen_loc = ui_hand_position(get_held_index_of_item(worn_item)) client.screen += worn_item - if(observers?.len) - for(var/M in observers) - var/mob/dead/observe = M + if(LAZYLEN(observers)) + for(var/mob/dead/observe as anything in observers) if(observe.client && observe.client.eye == src) observe.client.screen += worn_item else observers -= observe - if(!observers.len) + if(!length(observers)) observers = null break diff --git a/code/modules/mob/living/carbon/inventory.dm b/code/modules/mob/living/carbon/inventory.dm index d75df0897f1f..dddf1edf3380 100644 --- a/code/modules/mob/living/carbon/inventory.dm +++ b/code/modules/mob/living/carbon/inventory.dm @@ -73,10 +73,8 @@ I.screen_loc = null if(client) client.screen -= I - - if(observers?.len) - for(var/M in observers) - var/mob/dead/observe = M + if(LAZYLEN(observers)) + for(var/mob/dead/observe as anything in observers) if(observe.client) observe.client.screen -= I diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 14365735b30b..908dc994d654 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -2195,7 +2195,7 @@ GLOBAL_LIST_EMPTY(fire_appearances) if(istype(A, /atom/movable/screen/movable/action_button)) var/atom/movable/screen/movable/action_button/action = A - if(action.can_use(src)) + if(action.can_usr_use(src)) return MOUSE_ICON_HOVERING_INTERACTABLE return diff --git a/code/modules/mob/living/living_say.dm b/code/modules/mob/living/living_say.dm index 83081d466d6e..16cba623498f 100644 --- a/code/modules/mob/living/living_say.dm +++ b/code/modules/mob/living/living_say.dm @@ -280,6 +280,10 @@ GLOBAL_LIST_INIT(message_modes_stat_limits, list( /mob/living/Hear(message, atom/movable/speaker, datum/language/message_language, raw_message, radio_freq, list/spans, list/message_mods = list(), atom/sound_loc) SEND_SIGNAL(src, COMSIG_MOVABLE_HEAR, args) + if(LAZYLEN(observers)) + for(var/mob/dead/observer/O as anything in observers) + O.Hear(arglist(args)) + if(!client) return @@ -379,6 +383,8 @@ GLOBAL_LIST_INIT(message_modes_stat_limits, list( continue //Remove if underlying cause (likely byond issue) is fixed. See TG PR #49004. if(player_mob.stat != DEAD) //not dead, not important continue + if(!player_mob.z) //Observing ghosts are in nullspace, pretend they don't exist + continue if(player_mob.z != z || get_dist(player_mob, src) > 7) //they're out of range of normal hearing if(eavesdrop_range) if(!(player_mob.client?.prefs.chat_toggles & CHAT_GHOSTWHISPER)) //they're whispering and we have hearing whispers at any range off diff --git a/code/modules/mob/living/silicon/ai/multicam.dm b/code/modules/mob/living/silicon/ai/multicam.dm index 338f85ab3007..c734a4ae1837 100644 --- a/code/modules/mob/living/silicon/ai/multicam.dm +++ b/code/modules/mob/living/silicon/ai/multicam.dm @@ -206,7 +206,7 @@ GLOBAL_DATUM(ai_camera_room_landmark, /obj/effect/landmark/ai_multicam_room) if(!silent) to_chat(src, span_warning("Cannot place more than [max_multicams] multicamera windows.")) return - var/atom/movable/screen/movable/pic_in_pic/ai/C = new /atom/movable/screen/movable/pic_in_pic/ai() + var/atom/movable/screen/movable/pic_in_pic/ai/C = new /atom/movable/screen/movable/pic_in_pic/ai(null, hud_used) C.set_view_size(3, 3, FALSE) C.set_view_center(get_turf(eyeobj)) C.set_ai(src) diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index 43ca4db1cfc4..03b1dca6aeef 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -24,9 +24,9 @@ robot_modules_background.icon_state = "block" robot_modules_background.plane = HUD_PLANE - inv1 = new /atom/movable/screen/robot/module1() - inv2 = new /atom/movable/screen/robot/module2() - inv3 = new /atom/movable/screen/robot/module3() + inv1 = new /atom/movable/screen/robot/module1(null, hud_used) + inv2 = new /atom/movable/screen/robot/module2(null, hud_used) + inv3 = new /atom/movable/screen/robot/module3(null, hud_used) ident = rand(1, 999) diff --git a/code/modules/mob/living/simple_animal/hostile/jungle/seedling.dm b/code/modules/mob/living/simple_animal/hostile/jungle/seedling.dm index d8e0fecac20c..899e2b24afeb 100644 --- a/code/modules/mob/living/simple_animal/hostile/jungle/seedling.dm +++ b/code/modules/mob/living/simple_animal/hostile/jungle/seedling.dm @@ -83,7 +83,7 @@ /datum/status_effect/seedling_beam_indicator/on_apply() if(owner.client) - seedling_screen_object = new /atom/movable/screen/seedling() + seedling_screen_object = new /atom/movable/screen/seedling(null, owner.hud_used) owner.client.screen += seedling_screen_object tick() return ..() diff --git a/code/modules/mob/living/simple_animal/hostile/vatbeast.dm b/code/modules/mob/living/simple_animal/hostile/vatbeast.dm index 556dd5ae884a..813ba544c9b9 100644 --- a/code/modules/mob/living/simple_animal/hostile/vatbeast.dm +++ b/code/modules/mob/living/simple_animal/hostile/vatbeast.dm @@ -51,7 +51,7 @@ ranged_mousepointer = 'icons/effects/mouse_pointers/supplypod_target.dmi' /datum/action/cooldown/tentacle_slap/update_button_name(atom/movable/screen/movable/action_button/button, force) - if(button.our_hud.mymob != owner) + if(button.hud.mymob != owner) // For buttons given to mobs which are not our owner, give it this alt name button.name = "Command Tentacle Slap" button.desc = "Command your steed to slap a creature with its tentacles." diff --git a/tgui/packages/tgui/interfaces/Orbit.js b/tgui/packages/tgui/interfaces/Orbit.js index 4142b30ef097..0a3301815487 100644 --- a/tgui/packages/tgui/interfaces/Orbit.js +++ b/tgui/packages/tgui/interfaces/Orbit.js @@ -92,7 +92,7 @@ export const Orbit = (props, context) => { } = data; const [searchText, setSearchText] = useLocalState(context, "searchText", ""); - const [autoObserve, setAutoObserve] = useLocalState(context, "autoObserve", false); + const [autoObserve, setAutoObserve] = useLocalState(context, "autoObserve", true); const collatedAntagonists = {}; for (const antagonist of antagonists) {