Skip to content

Commit

Permalink
Uncommented "Observe" verb (#4345)
Browse files Browse the repository at this point in the history
# 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 <[email protected]>
Co-authored-by: Morrow <[email protected]>
  • Loading branch information
3 people authored Sep 19, 2023
1 parent 48a89d1 commit ecac37c
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 15 deletions.
8 changes: 6 additions & 2 deletions code/_onclick/hud/screen_objects.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand Down Expand Up @@ -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")
Expand Down
10 changes: 1 addition & 9 deletions code/modules/mob/dead/observer/orbit.dm
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions code/modules/mob/mob_verbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
// M.Login() //wat
return

/*/mob/dead/observer/verb/observe()
/mob/dead/observer/verb/observe()
set name = "Observe"
set category = "Ghost"

Expand All @@ -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"
Expand Down
24 changes: 22 additions & 2 deletions tgui/packages/tgui/interfaces/Orbit/index.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -36,11 +36,18 @@ const ObservableSearch = (props, context) => {
survivors = [],
xenos = [],
} = data;

const [autoObserve, setAutoObserve] = useLocalState<boolean>(
context,
'autoObserve',
false
);
const [searchQuery, setSearchQuery] = useLocalState<string>(
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. */
Expand All @@ -56,6 +63,7 @@ const ObservableSearch = (props, context) => {
if (mostRelevant !== undefined) {
act('orbit', {
ref: mostRelevant.ref,
auto_observe: autoObserve,
});
}
};
Expand All @@ -77,6 +85,16 @@ const ObservableSearch = (props, context) => {
/>
</Stack.Item>
<Stack.Divider />
<Stack.Item>
<Button
color={autoObserve ? 'good' : 'transparent'}
icon={autoObserve ? 'toggle-on' : 'toggle-off'}
onClick={() => setAutoObserve(!autoObserve)}
tooltip={multiline`Toggle Auto-Observe. When active, you'll
see the UI / full inventory of whoever you're orbiting. Neat!`}
tooltipPosition="bottom-start"
/>
</Stack.Item>
<Stack.Item>
<Button
color="transparent"
Expand Down Expand Up @@ -199,6 +217,8 @@ const ObservableItem = (
const { health, icon, full_name, nickname, orbiters, ref, background_color } =
item;

const [autoObserve] = useLocalState<boolean>(context, 'autoObserve', false);

return (
<Button
color={'transparent'}
Expand All @@ -208,7 +228,7 @@ const ObservableItem = (
'border-width': '1px',
'color': color ? 'white' : 'grey',
}}
onClick={() => act('orbit', { ref: ref })}
onClick={() => act('orbit', { auto_observe: autoObserve, ref: ref })}
tooltip={!!health && <ObservableTooltip item={item} />}
tooltipPosition="bottom-start">
{!!health && (
Expand Down

0 comments on commit ecac37c

Please sign in to comment.