[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:
SkyratBot
2020-09-27 00:41:14 +01:00
committed by GitHub
co-authored by Emmanuel S
parent ed3333e3e3
commit e1a009ce06
4 changed files with 35 additions and 7 deletions
+19
View File
@@ -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
+4 -1
View File
@@ -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
+11 -5
View File
@@ -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