From ecac37c10744ccf2aa630ef35de3d40dfc9274b9 Mon Sep 17 00:00:00 2001 From: BeagleGaming1 <56142455+BeagleGaming1@users.noreply.github.com> Date: Tue, 19 Sep 2023 05:29:31 -0400 Subject: [PATCH] Uncommented "Observe" verb (#4345) # About the pull request Apparently, there was an exploit with it, but I have been unable to reproduce it (This will most likely need a test merge just in case) # Explain why it's good for the game It's qol, it has no effect on anything beyond allowing observers to spectate better # Changelog :cl: add: Uncommented the "Observe" verb for ghosts, allowing ghosts to see from a humans HUD /:cl: --------- Co-authored-by: harryob <55142896+harryob@users.noreply.github.com> Co-authored-by: Morrow --- code/_onclick/hud/screen_objects.dm | 8 +++++-- code/modules/mob/dead/observer/orbit.dm | 10 +------- code/modules/mob/mob_verbs.dm | 4 ++-- tgui/packages/tgui/interfaces/Orbit/index.tsx | 24 +++++++++++++++++-- 4 files changed, 31 insertions(+), 15 deletions(-) diff --git a/code/_onclick/hud/screen_objects.dm b/code/_onclick/hud/screen_objects.dm index 206b1dbf9979..685fc3d5498b 100644 --- a/code/_onclick/hud/screen_objects.dm +++ b/code/_onclick/hud/screen_objects.dm @@ -144,7 +144,7 @@ /atom/movable/screen/zone_sel/clicked(mob/user, list/mods) if (..()) - return 1 + return TRUE var/icon_x = text2num(mods["icon-x"]) var/icon_y = text2num(mods["icon-y"]) @@ -209,7 +209,11 @@ icon = 'icons/mob/hud/screen1_robot.dmi' /atom/movable/screen/clicked(mob/user) - if(!user) return 1 + if(!user) + return TRUE + + if(isobserver(user)) + return TRUE switch(name) if("equip") diff --git a/code/modules/mob/dead/observer/orbit.dm b/code/modules/mob/dead/observer/orbit.dm index a77138668d72..d9d4d4eddad0 100644 --- a/code/modules/mob/dead/observer/orbit.dm +++ b/code/modules/mob/dead/observer/orbit.dm @@ -1,5 +1,4 @@ /datum/orbit_menu - var/auto_observe = FALSE var/mob/dead/observer/owner /datum/orbit_menu/New(mob/dead/observer/new_owner) @@ -24,6 +23,7 @@ switch(action) if("orbit") var/ref = params["ref"] + var/auto_observe = params["auto_observe"] var/atom/movable/poi = locate(ref) in GLOB.mob_list if (poi == null) poi = locate(ref) in GLOB.all_multi_vehicles @@ -38,19 +38,11 @@ if("refresh") update_static_data(owner) . = TRUE - if("toggle_observe") - auto_observe = !auto_observe - if(auto_observe && owner.orbit_target) - owner.do_observe(owner.orbit_target) - else - owner.reset_perspective(null) - . = TRUE /datum/orbit_menu/ui_data(mob/user) var/list/data = list() - data["auto_observe"] = auto_observe return data /datum/orbit_menu/ui_static_data(mob/user) diff --git a/code/modules/mob/mob_verbs.dm b/code/modules/mob/mob_verbs.dm index 8153032446dd..19296ba90b20 100644 --- a/code/modules/mob/mob_verbs.dm +++ b/code/modules/mob/mob_verbs.dm @@ -159,7 +159,7 @@ // M.Login() //wat return -/*/mob/dead/observer/verb/observe() +/mob/dead/observer/verb/observe() set name = "Observe" set category = "Ghost" @@ -169,7 +169,7 @@ if(!target) return - do_observe(target) */ //disabled thanks to le exploiterinos + do_observe(target) /mob/verb/cancel_camera() set name = "Cancel Camera View" diff --git a/tgui/packages/tgui/interfaces/Orbit/index.tsx b/tgui/packages/tgui/interfaces/Orbit/index.tsx index a900ee804a28..e3fbb04d0ea9 100644 --- a/tgui/packages/tgui/interfaces/Orbit/index.tsx +++ b/tgui/packages/tgui/interfaces/Orbit/index.tsx @@ -1,6 +1,6 @@ import { filter, sortBy } from 'common/collections'; import { flow } from 'common/fp'; -import { capitalizeFirst } from 'common/string'; +import { capitalizeFirst, multiline } from 'common/string'; import { useBackend, useLocalState } from 'tgui/backend'; import { Box, Button, Collapsible, ColorBox, Icon, Input, LabeledList, Section, Stack } from 'tgui/components'; import { Window } from 'tgui/layouts'; @@ -36,11 +36,18 @@ const ObservableSearch = (props, context) => { survivors = [], xenos = [], } = data; + + const [autoObserve, setAutoObserve] = useLocalState( + context, + 'autoObserve', + false + ); const [searchQuery, setSearchQuery] = useLocalState( context, 'searchQuery', '' ); + /** Gets a list of Observables, then filters the most relevant to orbit */ const orbitMostRelevant = (searchQuery: string) => { /** Returns the most orbited observable that matches the search. */ @@ -56,6 +63,7 @@ const ObservableSearch = (props, context) => { if (mostRelevant !== undefined) { act('orbit', { ref: mostRelevant.ref, + auto_observe: autoObserve, }); } }; @@ -77,6 +85,16 @@ const ObservableSearch = (props, context) => { /> + +