The maintenance crate spawning crate is now a spawner (#80083)

## About The Pull Request

`/obj/structure/closet/crate/maint` was a type of crate that spawned a
completely different crate, and then deleted itself. I have decided to
swap this out for an actual spawning effect.

I have also did some subtypery to remove some duplicate code that
handled randomly opening the spawned closet/crate (through I am not that
satisfied with
`/obj/effect/spawner/random/structure/closet_empty/crate/with_loot` as a
sensible typepath name, I would like to ask for suggestions). I also
removed a loot define, because it was no longer needed as its contents
were used on a single page.

## Why It's Good For The Game

Things that act like spawners should be spawners.

Maybe this fixes the CI issue on northstar where a mousetrap box gets
deleted before it initializes during create and destroy? It was placed
above a spawner that spawned one of these self deleting crates. I am
unsure, I could not replicate this issue during testing.

## Changelog

Nothing player facing.
This commit is contained in:
Profakos
2023-12-03 23:46:58 +01:00
committed by GitHub
parent eb7ea525e9
commit bb781627ab
24 changed files with 121 additions and 131 deletions

View File

@@ -131,6 +131,16 @@
if(elevation)
AddElement(/datum/element/elevation, pixel_shift = elevation)
///Spawns two to six maintenance spawners inside the closet
/obj/structure/closet/proc/populate_with_random_maint_loot()
SIGNAL_HANDLER
for (var/i in 1 to rand(2,6))
new /obj/effect/spawner/random/maintenance(src)
UnregisterSignal(src, COMSIG_CLOSET_POPULATE_CONTENTS)
///Removes the supply manifest from the closet
/obj/structure/closet/crate/proc/tear_manifest(mob/user)
to_chat(user, span_notice("You tear the manifest off of [src]."))
playsound(src, 'sound/items/poster_ripped.ogg', 75, TRUE)
@@ -162,27 +172,6 @@
paint_jobs = null
elevation_open = 0
/obj/structure/closet/crate/maint
/obj/structure/closet/crate/maint/Initialize(mapload)
..()
var/static/list/possible_crates = RANDOM_CRATE_LOOT
var/crate_path = pick_weight(possible_crates)
var/obj/structure/closet/crate/random_crate = new crate_path(loc)
random_crate.RegisterSignal(random_crate, COMSIG_CLOSET_POPULATE_CONTENTS, TYPE_PROC_REF(/obj/structure/closet/, populate_with_random_maint_loot))
if (prob(50))
random_crate.open(null, special_effects = FALSE) //crates spawned as immediatly opened don't need to animate into being opened
return INITIALIZE_HINT_QDEL
/obj/structure/closet/proc/populate_with_random_maint_loot()
SIGNAL_HANDLER
for (var/i in 1 to rand(2,6))
new /obj/effect/spawner/random/maintenance(src)
/obj/structure/closet/crate/trashcart //please make this a generic cart path later after things calm down a little
desc = "A heavy, metal trashcart with wheels."
name = "trash cart"