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/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) => { /> + +