Skip to content

Commit

Permalink
Adds "Highlights" to the Orbit menu (ParadiseSS13#19168)
Browse files Browse the repository at this point in the history
* adds highlights

* comment update

* misc support

* weird spacing begone

* requested changes
  • Loading branch information
Contrabang authored Oct 4, 2022
1 parent 61c4d66 commit 0fbfa2c
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 3 deletions.
7 changes: 7 additions & 0 deletions code/__HELPERS/unsorted.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1868,6 +1868,13 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new)

return pois

/proc/get_observers()
var/list/ghosts = list()
for(var/mob/dead/observer/M in GLOB.player_list) // for every observer with a client
ghosts += M

return ghosts

#define RANDOM_COLOUR (rgb(rand(0,255),rand(0,255),rand(0,255)))

/proc/make_bit_triplet()
Expand Down
10 changes: 9 additions & 1 deletion code/modules/mob/dead/observer/orbit.dm
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@
var/list/data = list()

var/list/alive = list()
var/list/highlights = list()
var/list/antagonists = list()
var/list/dead = list()
var/list/ghosts = list()
var/list/misc = list()
var/list/npcs = list()
var/length_of_ghosts = length(get_observers())

var/list/pois = getpois(mobs_only = FALSE, skip_mindless = FALSE)
for(var/name in pois)
Expand Down Expand Up @@ -72,6 +74,8 @@
else if(M.stat == DEAD)
dead += list(serialized)
else
if(length(orbiters) >= 0.2 * length_of_ghosts) // They're important if 20% of observers are watching them
highlights += list(serialized)
alive += list(serialized)

var/datum/mind/mind = M.mind
Expand All @@ -85,6 +89,7 @@
- traitor
- mindslaves/vampire thralls
- vampire
- changelings
*/
for(var/_A in mind.antag_datums)
var/datum/antagonist/A = _A
Expand Down Expand Up @@ -134,10 +139,13 @@
antag_serialized["antag"] = "Slaughter Demon"
antagonists += list(antag_serialized)
else
if(length(orbiters) >= 0.2 * length_of_ghosts) // If a bunch of people are orbiting an object, like the nuke disk.
highlights += list(serialized)
misc += list(serialized)

data["alive"] = alive
data["antagonists"] = antagonists
data["highlights"] = highlights
data["alive"] = alive
data["dead"] = dead
data["ghosts"] = ghosts
data["misc"] = misc
Expand Down
11 changes: 10 additions & 1 deletion tgui/packages/tgui/interfaces/Orbit.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const OrbitedButton = (props, context) => {

export const Orbit = (props, context) => {
const { act, data } = useBackend(context);
const { alive, antagonists, auto_observe, dead, ghosts, misc, npcs } = data;
const { alive, antagonists, highlights, auto_observe, dead, ghosts, misc, npcs } = data;

const [searchText, setSearchText] = useLocalState(context, 'searchText', '');

Expand All @@ -109,6 +109,7 @@ export const Orbit = (props, context) => {
const orbitMostRelevant = (searchText) => {
for (const source of [
sortedAntagonists.map(([_, antags]) => antags),
highlights,
alive,
ghosts,
dead,
Expand Down Expand Up @@ -172,6 +173,14 @@ export const Orbit = (props, context) => {
))}
</Section>
)}
{highlights.length > 0 && (
<BasicSection
title="Highlights"
source={highlights}
searchText={searchText}
color={'teal'}
/>
)}

<BasicSection
title="Alive"
Expand Down
Loading

0 comments on commit 0fbfa2c

Please sign in to comment.