Adds true observing -- letting you see what your target sees (#24855)

* bring it back now y'all

* adds a bunch of other changes

* pretty much works at this point

* grep

* Fixes some bugs, still chasing some down

* Add observers to recursive mob check, ensuring they can see messages from their orbitted atom

* tidy some things up

* resolve

* remove unnecessary checks

* Address todos, minor cleanups

* oh dear

* initial testing

* Fix some vulnerabilities (oops)

* Fix some other bugs from testing

* ci fixes

* Add some contingencies against clicking things you shouldn't

* fix some noted bugs

* Add observe to admin jump, improve messaging

* add a few more fixes that should mostly address some runtimes

* oh this wasn't really great

* one last thing

* Fix suit inventory problem

* Remove merge artifact

* Add some missing parens

* Prevents you from observing other ghosts, and should fix the getting stuck outside of your body issue.

* we love testing

* adds to player panel

* Fix more bugs with observers getting stuck outside of their body

* cleans up player panel, verb offerings

* shit

* Update code/_onclick/hud/alert.dm

welp

Co-authored-by: GDN <96800819+GDNgit@users.noreply.github.com>
Signed-off-by: Luc <89928798+lewcc@users.noreply.github.com>

* Fixes some targeting issues

* Fixes targeting on aobserve

* Fix some weird storage bugs

* clean up some doulbed up follow links

* Update code/modules/admin/player_panel.dm

Signed-off-by: Luc <89928798+lewcc@users.noreply.github.com>

* Adds some checks for ghost observe

* Remove mentor debug log

* ahhhhhhhhh that'll do it

* Cleans up some additional checks that were not quite what they should have been

* better logging, too

* mochi review

* one more thing

* Gets robot huds mostly working

* hopefully fix folks not getting observe

* Fix order of operations causing a runtime on qdeleting

* Remove some unnecessary stack traces

* Apply suggestions from code review

Co-authored-by: 1080pCat <96908085+1080pCat@users.noreply.github.com>
Signed-off-by: Luc <89928798+lewcc@users.noreply.github.com>

* Fix bug with items in your inventory disappearing on changing HUD modes

* Fix some bugs with the observe verbs

* possibly fix nullspace issues

* funny review

* missed one

---------

Signed-off-by: Luc <89928798+lewcc@users.noreply.github.com>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: GDN <96800819+GDNgit@users.noreply.github.com>
Co-authored-by: S34N <12197162+S34NW@users.noreply.github.com>
Co-authored-by: 1080pCat <96908085+1080pCat@users.noreply.github.com>
This commit is contained in:
Luc
2024-05-23 15:46:43 +00:00
committed by GitHub
co-authored by GDN 1080pCat github-actions <41898282+github-actions[bot]@users.noreply.github.com> S34N
parent 7bf45dce58
commit 23ad8a48fa
38 changed files with 1108 additions and 384 deletions
+55 -1
View File
@@ -16,6 +16,8 @@
var/id
/// UID of the last thing we hovered over. Used for managing action button dragging.
var/last_hovered_ref
/// Whether or not this should be shown to observers
var/shown_to_observers = FALSE
/// Whether or not this button is locked, preventing it from being dragged.
var/locked = FALSE
@@ -32,8 +34,14 @@
return ..()
/atom/movable/screen/movable/action_button/proc/can_use(mob/user)
if(isobserver(user))
var/mob/dead/observer/dead_mob = user
if(dead_mob.mob_observed) // Observers can only click on action buttons if they're not observing something
return FALSE
if(!linked_action)
return TRUE
if(linked_action.owner != user)
return FALSE
return !isnull(linked_action.viewers[user.hud_used])
// Entered and Exited won't fire while you're dragging something, because you're still "holding" it
@@ -60,7 +68,8 @@
last_hovered.MouseExited(over_location, over_control, params)
closeToolTip(usr)
last_hovered_ref = UID(over_object)
over_object.MouseEntered(over_location, over_control, params)
if(!isnull(over_object))
over_object.MouseEntered(over_location, over_control, params)
/atom/movable/screen/movable/action_button/MouseDrop(over_object)
last_hovered_ref = null
@@ -113,6 +122,8 @@
animate(src, transform = matrix(), time = 0.4 SECONDS, alpha = 255)
/atom/movable/screen/movable/action_button/Click(location, control, params)
if(!can_use(usr))
return FALSE
var/list/modifiers = params2list(params)
if(modifiers["ctrl"] && modifiers["shift"])
INVOKE_ASYNC(src, PROC_REF(set_to_keybind), usr)
@@ -578,4 +589,47 @@ GLOBAL_LIST_INIT(palette_removed_matrix, list(1.4,0,0,0, 0.7,0.4,0,0, 0.4,0,0.6,
button = action.viewers[src]
position_action(button, button.location)
/**
* Show (most) of the another mob's action buttons to this mob
*
* Used for observers viewing another mob's screen
*/
/mob/proc/show_other_mob_action_buttons(mob/take_from)
if(!hud_used || !client)
return
for(var/datum/action/action as anything in take_from.actions)
if(!action.show_to_observers)
continue
action.GiveAction(src)
RegisterSignal(take_from, COMSIG_MOB_GRANTED_ACTION, PROC_REF(on_observing_action_granted), override = TRUE)
RegisterSignal(take_from, COMSIG_MOB_REMOVED_ACTION, PROC_REF(on_observing_action_removed), override = TRUE)
/**
* Hide another mob's action buttons from this mob
*
* Used for observers viewing another mob's screen
*/
/mob/proc/hide_other_mob_action_buttons(mob/take_from)
for(var/datum/action/action as anything in take_from.actions)
action.HideFrom(src)
UnregisterSignal(take_from, list(COMSIG_MOB_GRANTED_ACTION, COMSIG_MOB_REMOVED_ACTION))
/// Signal proc for [COMSIG_MOB_GRANTED_ACTION] - If we're viewing another mob's action buttons,
/// we need to update with any newly added buttons granted to the mob.
/mob/proc/on_observing_action_granted(mob/living/source, datum/action/action)
SIGNAL_HANDLER // COMSIG_MOB_GRANTED_ACTION
if(!action.show_to_observers)
return
action.GiveAction(src)
/// Signal proc for [COMSIG_MOB_REMOVED_ACTION] - If we're viewing another mob's action buttons,
/// we need to update with any removed buttons from the mob.
/mob/proc/on_observing_action_removed(mob/living/source, datum/action/action)
SIGNAL_HANDLER // COMSIG_MOB_REMOVED_ACTION
action.HideFrom(src)
#undef AB_MAX_COLUMNS
+58 -35
View File
@@ -1,20 +1,27 @@
/atom/movable/screen/ai
icon = 'icons/mob/screen_ai.dmi'
/atom/movable/screen/ai/Click()
if(isobserver(usr) || usr.incapacitated())
return TRUE
/atom/movable/screen/ai/aicore
name = "AI core"
icon_state = "ai_core"
/atom/movable/screen/ai/aicore/Click()
if(isAI(usr))
var/mob/living/silicon/ai/AI = usr
AI.view_core()
if(..())
return
var/mob/living/silicon/ai/AI = usr
AI.view_core()
/atom/movable/screen/ai/camera_list
name = "Show Camera List"
icon_state = "camera"
/atom/movable/screen/ai/camera_list/Click()
if(..())
return
var/mob/living/silicon/ai/AI = usr
var/camera = tgui_input_list(AI, "Choose which camera you want to view", "Cameras", AI.get_camera_list())
AI.ai_camera_list(camera)
@@ -24,53 +31,60 @@
icon_state = "track"
/atom/movable/screen/ai/camera_track/Click()
if(isAI(usr))
var/mob/living/silicon/ai/AI = usr
var/target_name = tgui_input_list(AI, "Choose a target you want to track", "Tracking", AI.trackable_mobs())
if(target_name)
AI.ai_camera_track(target_name)
if(..())
return
var/mob/living/silicon/ai/AI = usr
var/target_name = tgui_input_list(AI, "Choose a target you want to track", "Tracking", AI.trackable_mobs())
if(target_name)
AI.ai_camera_track(target_name)
/atom/movable/screen/ai/camera_light
name = "Toggle Camera Light"
icon_state = "camera_light"
/atom/movable/screen/ai/camera_light/Click()
if(isAI(usr))
var/mob/living/silicon/ai/AI = usr
AI.toggle_camera_light()
if(..())
return
var/mob/living/silicon/ai/AI = usr
AI.toggle_camera_light()
/atom/movable/screen/ai/crew_monitor
name = "Crew Monitoring Console"
icon_state = "crew_monitor"
/atom/movable/screen/ai/crew_monitor/Click()
if(isAI(usr))
var/mob/living/silicon/ai/AI = usr
AI.subsystem_crew_monitor()
if(..())
return
var/mob/living/silicon/ai/AI = usr
AI.subsystem_crew_monitor()
/atom/movable/screen/ai/crew_manifest
name = "Crew Manifest"
icon_state = "manifest"
/atom/movable/screen/ai/crew_manifest/Click()
if(isAI(usr))
var/mob/living/silicon/ai/AI = usr
AI.ai_roster()
if(..())
return
var/mob/living/silicon/ai/AI = usr
AI.ai_roster()
/atom/movable/screen/ai/alerts
name = "Show Alerts"
icon_state = "alerts"
/atom/movable/screen/ai/alerts/Click()
if(isAI(usr))
var/mob/living/silicon/ai/AI = usr
AI.ai_alerts()
if(..())
return
var/mob/living/silicon/ai/AI = usr
AI.ai_alerts()
/atom/movable/screen/ai/announcement
name = "Make Announcement"
icon_state = "announcement"
/atom/movable/screen/ai/announcement/Click()
if(..())
return
var/mob/living/silicon/ai/AI = usr
AI.announcement()
@@ -79,15 +93,18 @@
icon_state = "call_shuttle"
/atom/movable/screen/ai/call_shuttle/Click()
if(isAI(usr))
var/mob/living/silicon/ai/AI = usr
AI.ai_call_shuttle()
if(..())
return
var/mob/living/silicon/ai/AI = usr
AI.ai_call_shuttle()
/atom/movable/screen/ai/state_laws
name = "Law Manager"
icon_state = "state_laws"
/atom/movable/screen/ai/state_laws/Click()
if(..())
return
if(isAI(usr))
var/mob/living/silicon/ai/AI = usr
AI.subsystem_law_manager()
@@ -97,42 +114,48 @@
icon_state = "pda_send"
/atom/movable/screen/ai/pda_msg_send/Click()
if(isAI(usr))
var/mob/living/silicon/ai/AI = usr
AI.aiPDA.cmd_send_pdamesg()
if(..())
return
var/mob/living/silicon/ai/AI = usr
AI.aiPDA.cmd_send_pdamesg()
/atom/movable/screen/ai/pda_msg_show
name = "PDA - Show Message Log"
icon_state = "pda_receive"
/atom/movable/screen/ai/pda_msg_show/Click()
if(isAI(usr))
var/mob/living/silicon/ai/AI = usr
AI.aiPDA.cmd_show_message_log()
if(..())
return
var/mob/living/silicon/ai/AI = usr
AI.aiPDA.cmd_show_message_log()
/atom/movable/screen/ai/image_take
name = "Take Image"
icon_state = "take_picture"
/atom/movable/screen/ai/image_take/Click()
if(isAI(usr))
var/mob/living/silicon/ai/AI = usr
AI.aiCamera.toggle_camera_mode()
if(..())
return
var/mob/living/silicon/ai/AI = usr
AI.aiCamera.toggle_camera_mode()
/atom/movable/screen/ai/image_view
name = "View Images"
icon_state = "view_images"
/atom/movable/screen/ai/image_view/Click()
if(isAI(usr))
var/mob/living/silicon/ai/AI = usr
AI.aiCamera.viewpictures()
if(..())
return
var/mob/living/silicon/ai/AI = usr
AI.aiCamera.viewpictures()
/atom/movable/screen/ai/sensors
name = "Toggle Sensor Augmentation"
icon_state = "ai_sensor"
/atom/movable/screen/ai/sensors/Click()
if(..())
return
if(isAI(usr))
var/mob/living/silicon/ai/AI = usr
AI.sensor_mode()
+75 -36
View File
@@ -48,6 +48,8 @@
if(override)
alert.timeout = null
alert.attach_owner(src)
if(icon_override)
alert.icon = icon_override
@@ -100,10 +102,50 @@
name = "Alert"
desc = "Something seems to have gone wrong with this alert, so report this bug please"
mouse_opacity = MOUSE_OPACITY_ICON
var/timeout = 0 //If set to a number, this alert will clear itself after that many deciseconds
/// How long before this alert automatically clears itself (in deciseconds). If zero, remains until cleared.
var/timeout = 0
/// Some alerts may have different icon states based on severity, this adjusts that.
var/severity = 0
/// Tool-tip for the alert.
var/alerttooltipstyle = ""
var/override_alerts = FALSE //If it is overriding other alerts of the same type
/// If true, this should override any other alerts of the same type thrown.
var/override_alerts = FALSE
/// The mob that this alert was originally thrown to.
var/mob/owner
/atom/movable/screen/alert/proc/attach_owner(mob/new_owner)
owner = new_owner
RegisterSignal(owner, COMSIG_PARENT_QDELETING, PROC_REF(remove_owner))
/atom/movable/screen/alert/proc/remove_owner(mob/source, force)
SIGNAL_HANDLER // COMSIG_PARENT_QDELETING
if(owner == source && !isnull(owner))
UnregisterSignal(owner, COMSIG_PARENT_QDELETING)
owner = null
/atom/movable/screen/alert/Destroy()
if(owner)
UnregisterSignal(owner, COMSIG_PARENT_QDELETING)
owner = null
severity = 0
master = null
screen_loc = ""
return ..()
/atom/movable/screen/alert/Click(location, control, params)
..()
if(!usr || !usr.client)
return FALSE
if(usr != owner)
to_chat(usr, "<span class='notice'>Only [owner] can use that!</span>")
return FALSE
var/paramslist = params2list(params)
if(paramslist["shift"]) // screen objects don't do the normal Click() stuff so we'll cheat
to_chat(usr, "<span class='boldnotice'>[name]</span> - <span class='info'>[desc]</span>")
return FALSE
if(master)
usr.client.Click(master, location, control, params)
return TRUE
/atom/movable/screen/alert/MouseEntered(location, control, params)
. = ..()
@@ -310,7 +352,7 @@ or something covering your eyes."
icon_state = "embeddedobject"
/atom/movable/screen/alert/embeddedobject/Click()
if(isliving(usr))
if(isliving(usr) && ..())
var/mob/living/carbon/human/M = usr
return M.help_shake_act(M)
@@ -333,7 +375,7 @@ or shoot a gun to move around via Newton's 3rd Law of Motion."
icon_state = "fire"
/atom/movable/screen/alert/fire/Click()
if(isliving(usr))
if(isliving(usr) && ..())
var/mob/living/L = usr
return L.resist()
@@ -343,7 +385,7 @@ or shoot a gun to move around via Newton's 3rd Law of Motion."
icon_state = "direction_lock"
/atom/movable/screen/alert/direction_lock/Click()
if(isliving(usr))
if(isliving(usr) && ..())
var/mob/living/L = usr
return L.clear_forced_look()
@@ -406,7 +448,7 @@ Recharging stations are available in robotics, the dormitory bathrooms, and the
desc = "You have merged with a diona gestalt and are now part of it's biomass. You can still wiggle yourself free though."
/atom/movable/screen/alert/nymph/Click()
if(!usr || !usr.client)
if(!..())
return
if(isnymph(usr))
var/mob/living/simple_animal/diona/D = usr
@@ -417,7 +459,7 @@ Recharging stations are available in robotics, the dormitory bathrooms, and the
desc = "You have merged with one or more diona nymphs. Click here to drop it (or one of them)."
/atom/movable/screen/alert/gestalt/Click()
if(!usr || !usr.client)
if(!..())
return
var/list/nymphs = list()
@@ -465,7 +507,7 @@ so as to remain in compliance with the most up-to-date laws."
return ..()
/atom/movable/screen/alert/hackingapc/Click()
if(!usr || !usr.client)
if(!..())
return
if(!target)
return
@@ -491,7 +533,7 @@ so as to remain in compliance with the most up-to-date laws."
return ..()
/atom/movable/screen/alert/mech_port_available/Click()
if(!usr || !usr.client)
if(!..())
return
if(!ismecha(usr.loc) || !target)
return
@@ -507,7 +549,7 @@ so as to remain in compliance with the most up-to-date laws."
icon_state = "mech_port_x"
/atom/movable/screen/alert/mech_port_disconnect/Click()
if(!usr || !usr.client)
if(!..())
return
if(!ismecha(usr.loc))
return
@@ -566,7 +608,7 @@ so as to remain in compliance with the most up-to-date laws."
timeout = 300
/atom/movable/screen/alert/notify_cloning/Click()
if(!usr || !usr.client)
if(!..())
return
var/mob/dead/observer/G = usr
G.reenter_corpse()
@@ -585,6 +627,8 @@ so as to remain in compliance with the most up-to-date laws."
overlays += I
/atom/movable/screen/alert/ghost/Click()
if(!..())
return
var/mob/living/carbon/human/infected_user = usr
if(!istype(infected_user) || infected_user.stat == DEAD)
infected_user.clear_alert("ghost_nest")
@@ -640,7 +684,7 @@ so as to remain in compliance with the most up-to-date laws."
return ..()
/atom/movable/screen/alert/notify_action/Click()
if(!usr || !usr.client)
if(!..())
return
var/mob/dead/observer/G = usr
@@ -721,7 +765,7 @@ so as to remain in compliance with the most up-to-date laws."
var/stoner = null
/atom/movable/screen/alert/notify_soulstone/Click()
if(!usr || !usr.client)
if(!..())
return
if(stone)
if(tgui_alert(usr, "Do you want to be captured by [stoner]'s soul stone? This will destroy your corpse and make it \
@@ -738,6 +782,7 @@ so as to remain in compliance with the most up-to-date laws."
icon_state = "map_vote"
/atom/movable/screen/alert/notify_mapvote/Click()
// ehh sure let observers click on it if they really want, who cares
usr.client.vote()
//OBJECT-BASED
@@ -756,11 +801,14 @@ so as to remain in compliance with the most up-to-date laws."
desc = "You're legcuffed, which slows you down considerably. Click the alert to free yourself."
/atom/movable/screen/alert/restrained/Click()
if(isliving(usr))
var/mob/living/L = usr
return L.resist()
if(!isliving(usr) || !..())
return
var/mob/living/L = usr
return L.resist()
/atom/movable/screen/alert/restrained/buckled/Click()
if(!isliving(usr) || !..())
return
var/mob/living/L = usr
if(!istype(L) || !L.can_resist())
return
@@ -770,20 +818,23 @@ so as to remain in compliance with the most up-to-date laws."
// PRIVATE = only edit, use, or override these if you're editing the system as a whole
// Re-render all alerts - also called in /datum/hud/show_hud() because it's needed there
/datum/hud/proc/reorganize_alerts()
/datum/hud/proc/reorganize_alerts(mob/viewmob)
var/mob/screenmob = viewmob || mymob
if(!screenmob.client)
return
var/list/alerts = mymob.alerts
if(!alerts)
return FALSE
var/icon_pref
if(!hud_shown)
for(var/i in 1 to length(alerts))
mymob.client.screen -= alerts[alerts[i]]
screenmob.client.screen -= alerts[alerts[i]]
return TRUE
for(var/i in 1 to length(alerts))
var/atom/movable/screen/alert/alert = alerts[alerts[i]]
if(alert.icon_state == "template")
if(!icon_pref)
icon_pref = ui_style2icon(mymob.client.prefs.UI_style)
icon_pref = ui_style2icon(screenmob.client.prefs.UI_style)
alert.icon = icon_pref
switch(i)
if(1)
@@ -799,24 +850,12 @@ so as to remain in compliance with the most up-to-date laws."
else
. = ""
alert.screen_loc = .
mymob.client.screen |= alert
screenmob.client.screen |= alert
if(!viewmob)
for(var/viewer in mymob.observers)
reorganize_alerts(viewer)
return TRUE
/atom/movable/screen/alert/Click(location, control, params)
if(!usr || !usr.client)
return
var/paramslist = params2list(params)
if(paramslist["shift"]) // screen objects don't do the normal Click() stuff so we'll cheat
to_chat(usr, "<span class='boldnotice'>[name]</span> - <span class='info'>[desc]</span>")
return
if(master)
return usr.client.Click(master, location, control, params)
/atom/movable/screen/alert/Destroy()
severity = 0
master = null
screen_loc = ""
return ..()
/// Gives the player the option to succumb while in critical condition
/atom/movable/screen/alert/succumb
@@ -825,7 +864,7 @@ so as to remain in compliance with the most up-to-date laws."
icon_state = "succumb"
/atom/movable/screen/alert/succumb/Click()
if(!usr || !usr.client)
if(!..())
return
var/mob/living/living_owner = usr
if(!istype(usr))
+6 -3
View File
@@ -146,19 +146,22 @@
inv_slots[inv.slot_id] = inv
inv.update_icon()
/datum/hud/alien/persistent_inventory_update()
/datum/hud/alien/persistent_inventory_update(mob/viewer)
if(!mymob)
return
var/mob/living/carbon/alien/humanoid/H = mymob
var/mob/screenmob = viewer || H
if(hud_version != HUD_STYLE_NOHUD)
if(H.r_hand)
H.r_hand.screen_loc = ui_rhand
H.client.screen += H.r_hand
screenmob.client.screen += H.r_hand
if(H.l_hand)
H.l_hand.screen_loc = ui_lhand
H.client.screen += H.l_hand
screenmob.client.screen += H.l_hand
else
if(H.r_hand)
H.r_hand.screen_loc = null
screenmob.client.screen -= H.r_hand
if(H.l_hand)
H.l_hand.screen_loc = null
screenmob.client.screen -= H.l_hand
+11 -10
View File
@@ -49,16 +49,17 @@
for(var/category in screens)
clear_fullscreen(category)
/datum/hud/proc/reload_fullscreen()
if(mymob.client)
var/atom/movable/screen/fullscreen/screen
var/list/screens = mymob.screens
for(var/category in screens)
screen = screens[category]
if(screen.should_show_to(mymob))
mymob.client.screen |= screen
continue
mymob.client.screen -= screen
/mob/proc/reload_fullscreen()
if(!client)
return
var/atom/movable/screen/fullscreen/screen
for(var/category in screens)
screen = screens[category]
if(screen.should_show_to(src))
screen.update_for_view(client.view)
client.screen |= screen
else
client.screen -= screen
/atom/movable/screen/fullscreen
icon = 'icons/mob/screen_full.dmi'
+21 -4
View File
@@ -110,7 +110,24 @@
for(var/atom/movable/screen/S in (static_inventory + toggleable_inventory))
S.hud = src
/datum/hud/ghost/show_hud()
mymob.client.screen = list()
mymob.client.screen += static_inventory
..()
/datum/hud/ghost/show_hud(version = 0, mob/viewmob)
// don't show this HUD if observing; show the HUD of the observee
var/mob/dead/observer/O = mymob
if(istype(O) && O.mob_observed)
plane_masters_update()
return FALSE
. = ..()
if(!.)
return
var/mob/screenmob = viewmob || mymob
screenmob.client.screen += static_inventory
// We should only see observed mob alerts.
/datum/hud/ghost/reorganize_alerts(mob/viewmob)
var/mob/dead/observer/O = mymob
if(istype(O) && O.mob_observed)
return
return ..()
+53 -35
View File
@@ -11,7 +11,7 @@
var/hud_shown = TRUE
/// Current displayed version of the HUD
var/hud_version = 1
/// Whether or not their toggleable inventory
/// Whether or not their toggleable inventory (generally their contents on the left) is expanded
var/inventory_shown = TRUE
/// This is to hide the buttons that can be used via hotkeys. (hotkeybuttons list of buttons)
var/hotkey_ui_hidden = FALSE
@@ -147,14 +147,22 @@
QDEL_NULL(screentip_text)
return ..()
/datum/hud/proc/show_hud(version = 0)
/**
* Shows this hud's hud to some mob
*
* Arguments
* * version - denotes which style should be displayed. blank or 0 means "next version"
* * viewmob - what mob to show the hud to. Can be this hud's mob, can be another mob, can be null (will use this hud's mob if so)
*/
/datum/hud/proc/show_hud(version = 0, mob/viewmob)
if(!ismob(mymob))
return FALSE
if(!mymob.client)
var/mob/screenmob = viewmob || mymob
if(!screenmob.client)
return FALSE
mymob.client.screen = list()
screenmob.client.clear_screen()
screenmob.client.apply_clickcatcher()
var/display_hud_version = version
if(!display_hud_version) //If 0 or blank, display the next hud version
@@ -166,15 +174,15 @@
if(HUD_STYLE_STANDARD) //Default HUD
hud_shown = TRUE //Governs behavior of other procs
if(length(static_inventory))
mymob.client.screen += static_inventory
if(length(toggleable_inventory) && inventory_shown)
mymob.client.screen += toggleable_inventory
if(length(hotkeybuttons) && !hotkey_ui_hidden)
mymob.client.screen += hotkeybuttons
screenmob.client.screen += static_inventory
if(length(toggleable_inventory) && screenmob.hud_used?.inventory_shown)
screenmob.client.screen += toggleable_inventory
if(length(hotkeybuttons) && !screenmob.hud_used?.hotkey_ui_hidden)
screenmob.client.screen += hotkeybuttons
if(length(infodisplay))
mymob.client.screen += infodisplay
screenmob.client.screen += infodisplay
mymob.client.screen += toggle_palette
screenmob.client.screen += toggle_palette
if(action_intent)
action_intent.screen_loc = initial(action_intent.screen_loc) //Restore intent selection to the original position
@@ -182,33 +190,33 @@
if(HUD_STYLE_REDUCED) //Reduced HUD
hud_shown = FALSE //Governs behavior of other procs
if(length(static_inventory))
mymob.client.screen -= static_inventory
screenmob.client.screen -= static_inventory
if(length(toggleable_inventory))
mymob.client.screen -= toggleable_inventory
screenmob.client.screen -= toggleable_inventory
if(length(hotkeybuttons))
mymob.client.screen -= hotkeybuttons
screenmob.client.screen -= hotkeybuttons
if(length(infodisplay))
mymob.client.screen += infodisplay
screenmob.client.screen += infodisplay
//These ones are a part of 'static_inventory', 'toggleable_inventory' or 'hotkeybuttons' but we want them to stay
if(inv_slots[SLOT_HUD_LEFT_HAND])
mymob.client.screen += inv_slots[SLOT_HUD_LEFT_HAND] //we want the hands to be visible
screenmob.client.screen += inv_slots[SLOT_HUD_LEFT_HAND] //we want the hands to be visible
if(inv_slots[SLOT_HUD_RIGHT_HAND])
mymob.client.screen += inv_slots[SLOT_HUD_RIGHT_HAND] //we want the hands to be visible
screenmob.client.screen += inv_slots[SLOT_HUD_RIGHT_HAND] //we want the hands to be visible
if(action_intent)
mymob.client.screen += action_intent //we want the intent switcher visible
screenmob.client.screen += action_intent //we want the intent switcher visible
action_intent.screen_loc = ui_acti_alt //move this to the alternative position, where zone_select usually is.
if(HUD_STYLE_NOHUD) //No HUD
hud_shown = FALSE //Governs behavior of other procs
if(length(static_inventory))
mymob.client.screen -= static_inventory
screenmob.client.screen -= static_inventory
if(length(toggleable_inventory))
mymob.client.screen -= toggleable_inventory
screenmob.client.screen -= toggleable_inventory
if(length(hotkeybuttons))
mymob.client.screen -= hotkeybuttons
screenmob.client.screen -= hotkeybuttons
if(length(infodisplay))
mymob.client.screen -= infodisplay
screenmob.client.screen -= infodisplay
if(HUD_STYLE_ACTIONHUD) //No HUD
hud_shown = TRUE //Governs behavior of other procs
@@ -220,36 +228,46 @@
mymob.client.screen -= infodisplay
hud_version = display_hud_version
persistent_inventory_update()
mymob.update_action_buttons(1)
reorganize_alerts()
reload_fullscreen()
update_parallax_pref(mymob)
persistent_inventory_update(screenmob)
screenmob.update_action_buttons(TRUE)
reorganize_alerts(screenmob)
screenmob.reload_fullscreen()
update_parallax_pref(screenmob)
if(!viewmob)
// working off of mymob
plane_masters_update()
for(var/M in mymob.observers)
show_hud(hud_version, M)
else if(viewmob.hud_used)
viewmob.hud_used.plane_masters_update()
viewmob.show_other_mob_action_buttons(mymob)
plane_masters_update()
return TRUE
/datum/hud/proc/plane_masters_update()
// Plane masters are always shown to OUR mob, never to observers
for(var/thing in plane_masters)
var/atom/movable/screen/plane_master/PM = plane_masters[thing]
PM.backdrop(mymob)
mymob.client.screen += PM
mymob.client?.screen += PM
/datum/hud/human/show_hud(version = 0)
/datum/hud/human/show_hud(version = 0, mob/viewmob)
. = ..()
if(!.)
return
hidden_inventory_update()
var/mob/screenmob = viewmob || mymob
hidden_inventory_update(screenmob)
/datum/hud/robot/show_hud(version = 0)
/datum/hud/robot/show_hud(version = 0, mob/viewmob)
. = ..()
if(!.)
return
update_robot_modules_display()
update_robot_modules_display(viewmob)
/datum/hud/proc/hidden_inventory_update()
/datum/hud/proc/hidden_inventory_update(mob/viewer)
return
/datum/hud/proc/persistent_inventory_update()
/datum/hud/proc/persistent_inventory_update(mob/viewer)
return
/mob/proc/hide_hud()
+95 -67
View File
@@ -6,14 +6,22 @@
icon_state = "toggle"
/atom/movable/screen/human/toggle/Click()
if(usr.hud_used.inventory_shown)
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(usr.hud_used.inventory_shown && targetmob.hud_used)
usr.hud_used.inventory_shown = FALSE
usr.client.screen -= usr.hud_used.toggleable_inventory
usr.client.screen -= targetmob.hud_used.toggleable_inventory
else
usr.hud_used.inventory_shown = TRUE
usr.client.screen += usr.hud_used.toggleable_inventory
usr.client.screen += targetmob.hud_used.toggleable_inventory
usr.hud_used.hidden_inventory_update()
targetmob.hud_used.hidden_inventory_update(usr)
/atom/movable/screen/human/equip
name = "equip"
@@ -21,7 +29,7 @@
/atom/movable/screen/human/equip/Click()
if(ismecha(usr.loc)) // stops inventory actions in a mech
return 1
return TRUE
var/mob/living/carbon/human/H = usr
H.quick_equip()
@@ -33,6 +41,8 @@
screen_loc = ui_lingstingdisplay
/atom/movable/screen/ling/sting/Click()
if(isobserver(usr))
return
var/datum/antagonist/changeling/cling = usr.mind.has_antag_datum(/datum/antagonist/changeling)
cling?.chosen_sting?.unset_sting()
@@ -389,100 +399,118 @@
else
crafting.invisibility = initial(crafting.invisibility)
/datum/hud/human/hidden_inventory_update()
/datum/hud/human/hidden_inventory_update(mob/viewer)
if(!mymob)
return
var/mob/living/carbon/human/H = mymob
if(inventory_shown && hud_version == HUD_STYLE_STANDARD)
var/mob/screenmob = viewer || H
if(screenmob.hud_used.inventory_shown && screenmob.hud_used.hud_shown && screenmob.hud_used.hud_version == HUD_STYLE_STANDARD)
if(H.shoes)
H.shoes.screen_loc = ui_shoes
H.client.screen += H.shoes
screenmob.client.screen += H.shoes
if(H.gloves)
H.gloves.screen_loc = ui_gloves
H.client.screen += H.gloves
screenmob.client.screen += H.gloves
if(H.l_ear)
H.l_ear.screen_loc = ui_l_ear
H.client.screen += H.l_ear
screenmob.client.screen += H.l_ear
if(H.r_ear)
H.r_ear.screen_loc = ui_r_ear
H.client.screen += H.r_ear
screenmob.client.screen += H.r_ear
if(H.glasses)
H.glasses.screen_loc = ui_glasses
H.client.screen += H.glasses
screenmob.client.screen += H.glasses
if(H.w_uniform)
H.w_uniform.screen_loc = ui_iclothing
H.client.screen += H.w_uniform
screenmob.client.screen += H.w_uniform
if(H.wear_suit)
H.wear_suit.screen_loc = ui_oclothing
H.client.screen += H.wear_suit
screenmob.client.screen += H.wear_suit
if(H.wear_mask)
H.wear_mask.screen_loc = ui_mask
H.client.screen += H.wear_mask
screenmob.client.screen += H.wear_mask
if(H.head)
H.head.screen_loc = ui_head
H.client.screen += H.head
screenmob.client.screen += H.head
else
if(H.shoes) H.shoes.screen_loc = null
if(H.gloves) H.gloves.screen_loc = null
if(H.l_ear) H.l_ear.screen_loc = null
if(H.r_ear) H.r_ear.screen_loc = null
if(H.glasses) H.glasses.screen_loc = null
if(H.w_uniform) H.w_uniform.screen_loc = null
if(H.wear_suit) H.wear_suit.screen_loc = null
if(H.wear_mask) H.wear_mask.screen_loc = null
if(H.head) H.head.screen_loc = null
if(H.shoes)
screenmob.client.screen -= H.shoes
if(H.gloves)
screenmob.client.screen -= H.gloves
if(H.l_ear)
screenmob.client.screen -= H.l_ear
if(H.r_ear)
screenmob.client.screen -= H.r_ear
if(H.glasses)
screenmob.client.screen -= H.glasses
if(H.w_uniform)
screenmob.client.screen -= H.w_uniform
if(H.wear_suit)
screenmob.client.screen -= H.wear_suit
if(H.wear_mask)
screenmob.client.screen -= H.wear_mask
if(H.head)
screenmob.client.screen -= H.head
/datum/hud/human/persistent_inventory_update()
/datum/hud/human/persistent_inventory_update(mob/viewer)
if(!mymob)
return
..()
var/mob/living/carbon/human/H = mymob
if(hud_version == HUD_STYLE_STANDARD)
if(H.s_store)
H.s_store.screen_loc = ui_sstore1
H.client.screen += H.s_store
if(H.wear_id)
H.wear_id.screen_loc = ui_id
H.client.screen += H.wear_id
if(H.wear_pda)
H.wear_pda.screen_loc = ui_pda
H.client.screen += H.wear_pda
if(H.belt)
H.belt.screen_loc = ui_belt
H.client.screen += H.belt
if(H.back)
H.back.screen_loc = ui_back
H.client.screen += H.back
if(H.l_store)
H.l_store.screen_loc = ui_storage1
H.client.screen += H.l_store
if(H.r_store)
H.r_store.screen_loc = ui_storage2
H.client.screen += H.r_store
else
if(H.s_store)
H.s_store.screen_loc = null
if(H.wear_id)
H.wear_id.screen_loc = null
if(H.wear_pda)
H.wear_pda.screen_loc = null
if(H.belt)
H.belt.screen_loc = null
if(H.back)
H.back.screen_loc = null
if(H.l_store)
H.l_store.screen_loc = null
if(H.r_store)
H.r_store.screen_loc = null
var/mob/screenmob = viewer || H
if(screenmob.hud_used)
if(screenmob.hud_used.hud_shown && screenmob.hud_used.hud_version == HUD_STYLE_STANDARD)
if(H.s_store)
H.s_store.screen_loc = ui_sstore1
screenmob.client.screen += H.s_store
if(H.wear_id)
H.wear_id.screen_loc = ui_id
screenmob.client.screen += H.wear_id
if(H.wear_pda)
H.wear_pda.screen_loc = ui_pda
screenmob.client.screen += H.wear_pda
if(H.belt)
H.belt.screen_loc = ui_belt
screenmob.client.screen += H.belt
if(H.back)
H.back.screen_loc = ui_back
screenmob.client.screen += H.back
if(H.l_store)
H.l_store.screen_loc = ui_storage1
screenmob.client.screen += H.l_store
if(H.r_store)
H.r_store.screen_loc = ui_storage2
screenmob.client.screen += H.r_store
else
if(H.s_store)
screenmob.client.screen -= H.s_store
if(H.wear_id)
screenmob.client.screen -= H.wear_id
if(H.wear_pda)
screenmob.client.screen -= H.wear_pda
if(H.belt)
screenmob.client.screen -= H.belt
if(H.back)
screenmob.client.screen -= H.back
if(H.l_store)
screenmob.client.screen -= H.l_store
if(H.r_store)
screenmob.client.screen -= H.r_store
if(hud_version != HUD_STYLE_NOHUD)
if(H.r_hand)
H.r_hand.screen_loc = ui_rhand
H.client.screen += H.r_hand
screenmob.client.screen += H.r_hand
if(H.l_hand)
H.l_hand.screen_loc = ui_lhand
H.client.screen += H.l_hand
screenmob.client.screen += H.l_hand
else
if(H.r_hand)
H.r_hand.screen_loc = null
screenmob.r_hand.screen_loc = null
screenmob.client.screen -= H.r_hand
if(H.l_hand)
H.l_hand.screen_loc = null
screenmob.l_hand.screen_loc = null
screenmob.client.screen -= H.l_hand
+32 -18
View File
@@ -1,6 +1,9 @@
/datum/hud/proc/create_parallax()
var/client/C = mymob.client
if(!apply_parallax_pref())
/datum/hud/proc/create_parallax(mob/viewmob)
var/mob/screenmob = viewmob || mymob
if(!screenmob.client)
return
var/client/C = screenmob.client
if(!apply_parallax_pref(screenmob))
return
// this is needed so it blends properly with the space plane and blackness plane.
var/atom/movable/screen/plane_master/space/S = plane_masters["[PLANE_SPACE]"]
@@ -34,16 +37,20 @@
C.screen |= (C.parallax_layers + C.parallax_static_layers_tail)
/datum/hud/proc/remove_parallax()
var/client/C = mymob.client
/datum/hud/proc/remove_parallax(mob/viewmob)
var/mob/screenmob = viewmob || mymob
var/client/C = screenmob.client
C.screen -= (C.parallax_layers_cached + C.parallax_static_layers_tail)
C.parallax_layers = null
var/atom/movable/screen/plane_master/space/S = plane_masters["[PLANE_SPACE]"]
S.color = null
S.appearance_flags &= ~NO_CLIENT_COLOR
/datum/hud/proc/apply_parallax_pref()
var/client/C = mymob.client
/datum/hud/proc/apply_parallax_pref(mob/viewmob)
var/mob/screen_mob = viewmob || mymob
var/client/C = screen_mob.client
if(!istype(C))
return FALSE
if(C.prefs)
var/pref = C.prefs.parallax
if(isnull(pref))
@@ -72,16 +79,22 @@
C.parallax_layers_max = 4
return TRUE
/datum/hud/proc/update_parallax_pref()
remove_parallax()
create_parallax()
update_parallax()
/datum/hud/proc/update_parallax_pref(mob/viewmob)
var/mob/screen_mob = viewmob || mymob
if(!screen_mob.client)
return
remove_parallax(screen_mob)
create_parallax(screen_mob)
update_parallax(screen_mob)
// This sets which way the current shuttle is moving (returns true if the shuttle has stopped moving so the caller can append their animation)
// Well, it would if our shuttle code had dynamic areas
/datum/hud/proc/set_parallax_movedir(new_parallax_movedir, skip_windups)
/datum/hud/proc/set_parallax_movedir(mob/viewmob, new_parallax_movedir, skip_windups)
. = FALSE
var/client/C = mymob.client
var/mob/screen_mob = viewmob || mymob
var/client/C = screen_mob.client
if(!istype(C))
return
if(new_parallax_movedir == C.parallax_movedir)
return
var/animatedir = new_parallax_movedir
@@ -157,8 +170,9 @@
animate(L, transform = L.transform, time = 0, loop = -1, flags = ANIMATION_END_NOW)
animate(transform = matrix(), time = T)
/datum/hud/proc/update_parallax()
var/client/C = mymob.client
/datum/hud/proc/update_parallax(mob/viewmob)
var/mob/screenmob = viewmob || mymob
var/client/C = screenmob.client
var/turf/posobj = get_turf(C.eye)
if(!posobj)
return
@@ -167,9 +181,9 @@
// Update the movement direction of the parallax if necessary (for shuttles)
var/area/shuttle/SA = areaobj
if(!SA || !SA.moving)
set_parallax_movedir(0)
set_parallax_movedir(screenmob, 0)
else
set_parallax_movedir(SA.parallax_move_direction)
set_parallax_movedir(screenmob, SA.parallax_move_direction)
var/force
if(!C.previous_turf || (C.previous_turf.z != posobj.z))
@@ -193,7 +207,7 @@
for(var/thing in C.parallax_layers)
var/atom/movable/screen/parallax_layer/L = thing
L.update_status(mymob)
L.update_status(screenmob)
if(L.view_sized != C.view)
L.update_o(C.view)
+97 -24
View File
@@ -1,23 +1,34 @@
/atom/movable/screen/robot
icon = 'icons/mob/screen_robot.dmi'
/atom/movable/screen/robot/Click()
. = ..()
if(isobserver(usr))
return TRUE
/atom/movable/screen/robot/module
name = "cyborg module"
icon_state = "nomod"
/atom/movable/screen/robot/module/Click()
if(isrobot(usr))
if(isrobot(usr) && !..())
var/mob/living/silicon/robot/R = usr
if(R.module)
R.hud_used.toggle_show_robot_modules()
return 1
R.pick_module()
if(!R.module)
R.pick_module()
return
// we can let ghosts mess with this one
usr.hud_used.toggle_show_robot_modules(usr)
return TRUE
/atom/movable/screen/robot/module1
name = "module1"
icon_state = "inv1"
/atom/movable/screen/robot/module1/Click()
if(..())
return
if(isrobot(usr))
var/mob/living/silicon/robot/R = usr
R.toggle_module(1)
@@ -27,6 +38,8 @@
icon_state = "inv2"
/atom/movable/screen/robot/module2/Click()
if(..())
return
if(isrobot(usr))
var/mob/living/silicon/robot/R = usr
R.toggle_module(2)
@@ -36,6 +49,8 @@
icon_state = "inv3"
/atom/movable/screen/robot/module3/Click()
if(..())
return
if(isrobot(usr))
var/mob/living/silicon/robot/R = usr
R.toggle_module(3)
@@ -46,6 +61,8 @@
icon_state = "radio"
/atom/movable/screen/robot/radio/Click()
if(..())
return
if(issilicon(usr))
var/mob/living/silicon/robot/R = usr
R.radio_menu()
@@ -55,6 +72,8 @@
icon_state = "store"
/atom/movable/screen/robot/store/Click()
if(..())
return
if(isrobot(usr))
var/mob/living/silicon/robot/R = usr
R.uneq_active()
@@ -66,6 +85,8 @@
screen_loc = ui_borg_lamp
/atom/movable/screen/robot/lamp/Click()
if(..())
return
if(isrobot(usr))
var/mob/living/silicon/robot/R = usr
R.control_headlamp()
@@ -75,6 +96,8 @@
icon_state = "ionpulse0"
/atom/movable/screen/robot/thrusters/Click()
if(..())
return
var/mob/living/silicon/robot/R = usr
R.toggle_ionpulse()
@@ -83,11 +106,23 @@
icon_state = "running"
/atom/movable/screen/robot/mov_intent/Click()
if(..())
return
usr.toggle_move_intent()
/datum/hud/robot
var/shown_robot_modules = FALSE // Used to determine whether they have the module menu shown or not
var/atom/movable/screen/robot_modules_background
/datum/hud/robot/New(mob/user)
..()
robot_modules_background = new()
robot_modules_background.icon_state = "block"
robot_modules_background.layer = HUD_LAYER // Objects that appear on screen are on layer 20, UI should be just below it.
robot_modules_background.plane = HUD_PLANE
var/atom/movable/screen/using
var/mob/living/silicon/robot/mymobR = mymob
@@ -184,41 +219,51 @@
return ..()
/datum/hud/proc/toggle_show_robot_modules()
/datum/hud/proc/toggle_show_robot_modules(mob/viewmob)
return
/datum/hud/robot/toggle_show_robot_modules(mob/viewmob)
var/mob/screenmob = viewmob || mymob
if(istype(viewmob.hud_used, /datum/hud/robot))
var/datum/hud/robot/robohud = screenmob.hud_used
robohud.shown_robot_modules = !robohud.shown_robot_modules
update_robot_modules_display(viewmob)
/datum/hud/proc/update_robot_modules_display(mob/viewer)
return
/datum/hud/robot/update_robot_modules_display(mob/viewer)
if(!isrobot(mymob))
return
var/mob/living/silicon/robot/R = mymob
R.shown_robot_modules = !R.shown_robot_modules
update_robot_modules_display()
/datum/hud/proc/update_robot_modules_display()
if(!isrobot(mymob))
return
var/mob/living/silicon/robot/R = mymob
var/mob/screenmob = viewer || R
if(!R.client)
return
if(!R.module)
shown_robot_modules = FALSE
screenmob.client.screen -= robot_modules_background
screenmob.client?.screen -= screenmob.hud_used.module_store_icon
return
if(R.shown_robot_modules && hud_version == HUD_STYLE_STANDARD)
if(shown_robot_modules && hud_shown && hud_version == HUD_STYLE_STANDARD)
//Modules display is shown
R.client.screen += module_store_icon //"store" icon
screenmob.client.screen += module_store_icon //"store" icon
if(!R.module.modules)
to_chat(usr, "<span class='danger'>Selected module has no modules to select.</span>")
return
if(!R.robot_modules_background)
if(!robot_modules_background)
return
var/display_rows = CEILING(length(R.module.modules) / 8, 1)
R.robot_modules_background.screen_loc = "CENTER-4:16,SOUTH+1:7 to CENTER+3:16,SOUTH+[display_rows]:7"
R.client.screen += R.robot_modules_background
robot_modules_background.screen_loc = "CENTER-4:16,SOUTH+1:7 to CENTER+3:16,SOUTH+[display_rows]:7"
screenmob.client.screen += robot_modules_background
var/x = -4 //Start at CENTER-4,SOUTH+1
var/y = 1
@@ -226,7 +271,7 @@
for(var/atom/movable/A in R.module.modules)
if((A != R.module_state_1) && (A != R.module_state_2) && (A != R.module_state_3))
//Module is not currently active
R.client.screen += A
screenmob.client.screen += A
if(x < 0)
A.screen_loc = "CENTER[x]:16,SOUTH+[y]:7"
else
@@ -241,11 +286,39 @@
else
//Modules display is hidden
R.client.screen -= module_store_icon
screenmob.client.screen -= module_store_icon
for(var/atom/A in R.module.modules)
if((A != R.module_state_1) && (A != R.module_state_2) && (A != R.module_state_3))
//Module is not currently active
R.client.screen -= A
R.shown_robot_modules = FALSE
R.client.screen -= R.robot_modules_background
screenmob.client.screen -= A
shown_robot_modules = FALSE
screenmob.client.screen -= robot_modules_background
/datum/hud/robot/persistent_inventory_update(mob/viewer)
if(!mymob)
return
var/mob/living/silicon/robot/R = mymob
var/mob/screenmob = viewer || R
var/held_items = list(R.module_state_1, R.module_state_2, R.module_state_3)
if(!screenmob.hud_used)
return
if(screenmob.hud_used.hud_shown)
for(var/i in 1 to length(held_items))
var/obj/item/I = held_items[i]
if(I)
switch(i)
if(1)
I.screen_loc = ui_inv1
if(2)
I.screen_loc = ui_inv2
if(3)
I.screen_loc = ui_inv3
else
return
screenmob.client.screen += I
else
for(var/obj/item/I in held_items)
screenmob.client.screen -= I
+17 -13
View File
@@ -367,6 +367,8 @@
screen_loc = ui_crafting
/atom/movable/screen/craft/Click()
if(!isliving(usr))
return
var/mob/living/M = usr
M.OpenCraftingMenu()
@@ -396,24 +398,26 @@
object_overlays.Cut()
/atom/movable/screen/inventory/proc/add_overlays()
var/mob/user = hud.mymob
var/mob/user = hud?.mymob
if(hud && user && slot_id)
var/obj/item/holding = user.get_active_hand()
if(!user || !slot_id || user != usr)
return
if(!holding || user.get_item_by_slot(slot_id))
return
var/obj/item/holding = user.get_active_hand()
var/image/item_overlay = image(holding)
item_overlay.alpha = 92
if(!holding || user.get_item_by_slot(slot_id))
return
if(!user.can_equip(holding, slot_id, disable_warning = TRUE))
item_overlay.color = "#ff0000"
else
item_overlay.color = "#00ff00"
var/image/item_overlay = image(holding)
item_overlay.alpha = 92
object_overlays += item_overlay
add_overlay(object_overlays)
if(!user.can_equip(holding, slot_id, TRUE))
item_overlay.color = "#ff0000"
else
item_overlay.color = "#00ff00"
object_overlays += item_overlay
add_overlay(object_overlays)
/atom/movable/screen/inventory/MouseDrop(atom/over)
cut_overlay(object_overlays)