From bc1887a728fdb8ce8db7ddc4de60afad25e373d2 Mon Sep 17 00:00:00 2001 From: Geeves Date: Sun, 24 Dec 2023 04:20:27 +0200 Subject: [PATCH] Ghost Spawner Manifest (#18001) --- code/controllers/subsystems/ghostroles.dm | 10 ++++- code/game/machinery/cryopod.dm | 1 + code/modules/ghostroles/spawner/base.dm | 3 ++ .../geeves-ghost_spawner_manifest.yml | 6 +++ .../packages/tgui/interfaces/GhostSpawner.tsx | 41 +++++++++++++++++-- 5 files changed, 57 insertions(+), 4 deletions(-) create mode 100644 html/changelogs/geeves-ghost_spawner_manifest.yml diff --git a/code/controllers/subsystems/ghostroles.dm b/code/controllers/subsystems/ghostroles.dm index b5457b0f1e5..a77049cae47 100644 --- a/code/controllers/subsystems/ghostroles.dm +++ b/code/controllers/subsystems/ghostroles.dm @@ -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 diff --git a/code/game/machinery/cryopod.dm b/code/game/machinery/cryopod.dm index ecc22e3d41a..3c69a06554b 100644 --- a/code/game/machinery/cryopod.dm +++ b/code/game/machinery/cryopod.dm @@ -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. diff --git a/code/modules/ghostroles/spawner/base.dm b/code/modules/ghostroles/spawner/base.dm index 44da2fff227..ef95b0e1ce3 100644 --- a/code/modules/ghostroles/spawner/base.dm +++ b/code/modules/ghostroles/spawner/base.dm @@ -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) diff --git a/html/changelogs/geeves-ghost_spawner_manifest.yml b/html/changelogs/geeves-ghost_spawner_manifest.yml new file mode 100644 index 00000000000..02d47b2655b --- /dev/null +++ b/html/changelogs/geeves-ghost_spawner_manifest.yml @@ -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." \ No newline at end of file diff --git a/tgui/packages/tgui/interfaces/GhostSpawner.tsx b/tgui/packages/tgui/interfaces/GhostSpawner.tsx index ee66fda295e..ceedbc4db74 100644 --- a/tgui/packages/tgui/interfaces/GhostSpawner.tsx +++ b/tgui/packages/tgui/interfaces/GhostSpawner.tsx @@ -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') && ( - + {spawner.name} - {spawner.desc} + + + {spawner.desc} + {spawner.manifest.length > 0 ? ( + + + Manifest + + + {spawner.manifest.map((spawned_mob_name) => { + return ( + + + {' - ' + spawned_mob_name} + + + ); + })} +
+
+ ) : null} +
+
{spawner.max_count > 0 ? spawner.max_count -