mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-24 05:30:05 +01:00
[MIRROR] Orbit menu checks ghosts recursively, ghosts have orbit counters (#1004)
* Orbit menu checks ghosts recursively, ghosts have orbit counters (#53826) * Recursive Orbit Checker UI change len -> length() Rebuild tgui another len -> length() * tgui * Orbit menu checks ghosts recursively, ghosts have orbit counters Co-authored-by: Emmanuel S <mrdoomboyo@gmail.com>
This commit is contained in:
@@ -1556,3 +1556,22 @@
|
||||
var/mouseparams = list2params(paramslist)
|
||||
usr_client.Click(src, loc, null, mouseparams)
|
||||
return TRUE
|
||||
|
||||
/**
|
||||
* Recursive getter method to return a list of all ghosts orbitting this atom
|
||||
*
|
||||
* This will work fine without manually passing arguments.
|
||||
*/
|
||||
/atom/proc/get_all_orbiters(list/processed, source = TRUE)
|
||||
var/list/output = list()
|
||||
if (!processed)
|
||||
processed = list()
|
||||
if (src in processed)
|
||||
return output
|
||||
if (!source)
|
||||
output += src
|
||||
processed += src
|
||||
for (var/o in orbiters?.orbiter_list)
|
||||
var/atom/atom_orbiter = o
|
||||
output += atom_orbiter.get_all_orbiters(processed, source = FALSE)
|
||||
return output
|
||||
|
||||
@@ -47,13 +47,16 @@
|
||||
var/mob/M = poi
|
||||
if (istype(M))
|
||||
if (isobserver(M))
|
||||
var/number_of_orbiters = length(M.get_all_orbiters())
|
||||
if (number_of_orbiters)
|
||||
serialized["orbiters"] = number_of_orbiters
|
||||
ghosts += list(serialized)
|
||||
else if (M.stat == DEAD)
|
||||
dead += list(serialized)
|
||||
else if (M.mind == null)
|
||||
npcs += list(serialized)
|
||||
else
|
||||
var/number_of_orbiters = M.orbiters?.orbiter_list?.len
|
||||
var/number_of_orbiters = length(M.get_all_orbiters())
|
||||
if (number_of_orbiters)
|
||||
serialized["orbiters"] = number_of_orbiters
|
||||
|
||||
|
||||
@@ -173,11 +173,17 @@ export const Orbit = (props, context) => {
|
||||
))}
|
||||
</Section>
|
||||
|
||||
<BasicSection
|
||||
title="Ghosts"
|
||||
source={ghosts}
|
||||
searchText={searchText}
|
||||
/>
|
||||
<Section title="Ghosts">
|
||||
{ghosts
|
||||
.filter(searchFor(searchText))
|
||||
.sort(compareNumberedText)
|
||||
.map(thing => (
|
||||
<OrbitedButton
|
||||
key={thing.name}
|
||||
color="grey"
|
||||
thing={thing} />
|
||||
))}
|
||||
</Section>
|
||||
|
||||
<BasicSection
|
||||
title="Dead"
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user