Ghost Spawner Manifest (#18001)

This commit is contained in:
Geeves
2023-12-24 02:20:27 +00:00
committed by GitHub
parent c5202baa39
commit bc1887a728
5 changed files with 57 additions and 4 deletions
+9 -1
View File
@@ -119,6 +119,12 @@ SUBSYSTEM_DEF(ghostroles)
if(G.cant_see(user))
continue
var/cant_spawn = G.cant_spawn(user)
var/list/manifest = list()
if(LAZYLEN(G.spawned_mobs))
for(var/datum/weakref/mob_ref in G.spawned_mobs)
var/mob/spawned_mob = mob_ref.resolve()
if(spawned_mob)
manifest += spawned_mob.real_name
var/list/spawner = list(
"short_name" = G.short_name,
"name" = G.name,
@@ -132,7 +138,8 @@ SUBSYSTEM_DEF(ghostroles)
"spawn_atoms" = length(G.spawn_atoms),
"max_count" = G.max_count,
"tags" = G.tags,
"spawnpoints" = G.spawnpoints
"spawnpoints" = G.spawnpoints,
"manifest" = manifest
)
data["categories"] |= G.tags
data["spawners"] += list(spawner)
@@ -166,6 +173,7 @@ SUBSYSTEM_DEF(ghostroles)
if(!S.post_spawn(M))
to_chat(usr, "Unable to spawn: post_spawn failed. Report this on GitHub")
return
LAZYADD(S.spawned_mobs, WEAKREF(M))
log_and_message_admins("joined as GhostRole: [S.name]", M)
SStgui.update_uis(src)
. = TRUE
+1
View File
@@ -411,6 +411,7 @@ var/global/list/frozen_crew = list()
var/mob/living/carbon/human/H = occupant
if(H.ghost_spawner)
var/datum/ghostspawner/human/GS = H.ghost_spawner.resolve()
LAZYREMOVE(GS.spawned_mobs, WEAKREF(H))
GS.count--
// Let SSjobs handle the rest.
+3
View File
@@ -40,6 +40,9 @@
var/mob_name_suffix = null //The suffix that should be applied to the mob name
var/away_site = FALSE
/// A lazylist of weakrefs to mobs this spawner has spawned
var/list/datum/weakref/spawned_mobs
/datum/ghostspawner/New()
. = ..()
if(!jobban_job)
@@ -0,0 +1,6 @@
author: Geeves
delete-after: True
changes:
- rscadd: "Updated the ghost spawner UI to have a candystripe theme and also show a manifest for the currently active mobs."
+38 -3
View File
@@ -1,6 +1,7 @@
import { BooleanLike } from '../../common/react';
import { useBackend, useLocalState } from '../backend';
import { Button, Input, Section, Table, Tabs } from '../components';
import { Box, Button, Input, Section, Table, Tabs } from '../components';
import { TableCell, TableRow } from '../components/Table';
import { Window } from '../layouts';
export type SpawnerData = {
@@ -22,6 +23,7 @@ type Spawner = {
spawn_atoms: any;
tags: string[];
spawnpoints: string[];
manifest: string[];
};
export const GhostSpawner = (props, context) => {
@@ -79,9 +81,42 @@ export const GhostSpawner = (props, context) => {
.map(
(spawner) =>
(spawner.tags.indexOf(tab) > -1 || tab === 'All') && (
<Table.Row key={spawner.short_name}>
<Table.Row key={spawner.short_name} className="candystripe">
<Table.Cell>{spawner.name}</Table.Cell>
<Table.Cell>{spawner.desc}</Table.Cell>
<Table.Cell>
<Box pb={2} pt={2}>
{spawner.desc}
{spawner.manifest.length > 0 ? (
<Box
style={{
'background-color': 'rgba(0, 0, 0, 0.25)',
'border': '1px solid rgba(0, 0, 0, 0.5)',
}}
mt={2}
pb={1}
pt={1}
pl={1}>
<Box fontSize="1.2rem" textAlign="center">
Manifest
</Box>
<Table>
{spawner.manifest.map((spawned_mob_name) => {
return (
<TableRow
pb={1}
key={spawned_mob_name}
overflow="hidden">
<TableCell>
{' - ' + spawned_mob_name}
</TableCell>
</TableRow>
);
})}
</Table>
</Box>
) : null}
</Box>
</Table.Cell>
<Table.Cell>
{spawner.max_count > 0
? spawner.max_count -