Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIRROR] Spawners menu now displays the amount of uses left appropriately #2022

Merged
merged 1 commit into from
Feb 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions code/datums/spawners_menu.dm
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
this["important_warning"] = ""
this["amount_left"] = 0
for(var/spawner_obj in GLOB.mob_spawners[spawner])
var/obj/effect/mob_spawn/ghost_role/mob_spawner = spawner_obj
if(!this["desc"])
if(istype(spawner_obj, /obj/effect/mob_spawn))
var/obj/effect/mob_spawn/ghost_role/mob_spawner = spawner_obj
if(!mob_spawner.allow_spawn(user, silent = TRUE))
continue
this["you_are_text"] = mob_spawner.you_are_text
Expand All @@ -41,8 +41,9 @@
else
var/obj/object = spawner_obj
this["desc"] = object.desc
this["amount_left"] += 1
if(this["amount_left"] > 0)
this["amount_left"] += mob_spawner.uses
this["infinite"] += mob_spawner.infinite_use
if(this["amount_left"] > 0 || this["infinite"])
data["spawners"] += list(this)
for(var/mob_type in GLOB.joinable_mobs)
var/list/this = list()
Expand Down
13 changes: 10 additions & 3 deletions tgui/packages/tgui/interfaces/SpawnersMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ type SpawnersMenuContext = {
type spawner = {
name: string;
amount_left: number;
infinite: boolean;
desc?: string;
you_are_text?: string;
flavor_text?: string;
Expand All @@ -31,9 +32,15 @@ export const SpawnersMenu = (props) => {
title={capitalizeAll(spawner.name)}
buttons={
<Stack>
<Stack.Item fontSize="14px" color="green">
{spawner.amount_left} left
</Stack.Item>
{spawner.infinite ? (
<Stack.Item fontSize="14px" color="green">
Infinite
</Stack.Item>
) : (
<Stack.Item fontSize="14px" color="green">
{spawner.amount_left} left
</Stack.Item>
)}
<Stack.Item>
<Button
content="Jump"
Expand Down
Loading