[MIRROR] Holodeck closet & crate items are marked as holograms (#28455)

* Holodeck closet & crate items are marked as holograms (#84326)

## About The Pull Request
- Fixes #83834
- Fixes #74765

When a holographic closet/crate is opened for the 1st time all their
items are marked as holograms & get deleted when the simulation is
changed

## Changelog
🆑
fix: Holodeck closet & crate items are marked as holograms as well
fix: Holodeck closet & crate items delete themselves when the program is
changed
/🆑

* Holodeck closet & crate items are marked as holograms

---------

Co-authored-by: SyncIt21 <110812394+SyncIt21@users.noreply.github.com>
This commit is contained in:
SkyratBot
2024-06-29 10:46:56 +05:30
committed by GitHub
co-authored by SyncIt21
parent eb8685d32a
commit 0c98a70953
5 changed files with 15 additions and 4 deletions
+1 -1
View File
@@ -1,2 +1,2 @@
/// Called in /obj/structure/closet/PopulateContents()
#define COMSIG_CLOSET_POPULATE_CONTENTS "closet_populate_contents"
#define COMSIG_CLOSET_CONTENTS_INITIALIZED "closet_initialize_contents"
@@ -123,7 +123,7 @@
/obj/effect/spawner/random/structure/closet_empty/crate/with_loot/make_item(spawn_loc, type_path_to_make)
var/obj/structure/closet/closet_to_fill = ..()
closet_to_fill.RegisterSignal(closet_to_fill, COMSIG_CLOSET_POPULATE_CONTENTS, TYPE_PROC_REF(/obj/structure/closet/, populate_with_random_maint_loot))
closet_to_fill.RegisterSignal(closet_to_fill, COMSIG_CLOSET_CONTENTS_INITIALIZED, TYPE_PROC_REF(/obj/structure/closet/, populate_with_random_maint_loot))
return closet_to_fill
@@ -182,7 +182,7 @@ GLOBAL_LIST_EMPTY(roundstart_station_closets)
//USE THIS TO FILL IT, NOT INITIALIZE OR NEW
/obj/structure/closet/proc/PopulateContents()
SEND_SIGNAL(src, COMSIG_CLOSET_POPULATE_CONTENTS)
return
/// Populate the closet with stuff that needs to be added before it is opened.
/// This is useful for things like traitor objectives.
@@ -452,6 +452,7 @@ GLOBAL_LIST_EMPTY(roundstart_station_closets)
if (!contents_initialized)
contents_initialized = TRUE
PopulateContents()
SEND_SIGNAL(src, COMSIG_CLOSET_CONTENTS_INITIALIZED)
var/atom/L = drop_location()
for(var/atom/movable/AM in src)
@@ -140,7 +140,7 @@
for (var/i in 1 to rand(2,6))
new /obj/effect/spawner/random/maintenance(src)
UnregisterSignal(src, COMSIG_CLOSET_POPULATE_CONTENTS)
UnregisterSignal(src, COMSIG_CLOSET_CONTENTS_INITIALIZED)
///Removes the supply manifest from the closet
/obj/structure/closet/crate/proc/tear_manifest(mob/user)
+10
View File
@@ -293,6 +293,8 @@ GLOBAL_LIST_INIT(typecache_holodeck_linked_floorcheck_ok, typecacheof(list(/turf
if(isstructure(holo_object))
holo_object.obj_flags |= NO_DEBRIS_AFTER_DECONSTRUCTION
if(istype(holo_object, /obj/structure/closet))
RegisterSignal(holo_object, COMSIG_CLOSET_CONTENTS_INITIALIZED, PROC_REF(register_contents))
return
if(ismachinery(holo_object))
@@ -304,6 +306,14 @@ GLOBAL_LIST_INIT(typecache_holodeck_linked_floorcheck_ok, typecacheof(list(/turf
var/obj/machinery/button/holo_button = holo_machine
holo_button.setup_device()
/obj/machinery/computer/holodeck/proc/register_contents(obj/structure/closet/storage)
SIGNAL_HANDLER
for(var/atom/movable/item as anything in storage.get_all_contents_type(/atom/movable))
if(item == storage)
continue
add_to_spawned(item)
/**
* A separate proc for objects that weren't loaded by the template nor spawned by holo effects
* yet need to be added to the list of spawned objects. (e.g. holographic fishes)