Skip to content

Commit

Permalink
[MIRROR] Material container drops sheets only on object deconstruct &…
Browse files Browse the repository at this point in the history
… not destroy. (#793)

* Material container drops sheets only on object deconstruct & not destroy. (#81290)

## About The Pull Request
- Fixes #81289

It has nothing to do with `dump_contents()` but with the material
container that drops its materials on `Destroy()` causing side effects.
Now it only drops sheets when an object is deconstructed but not
destroyed.

For this to work properly on all instances we have to ensure
`deconstruct()` is not overridden at least on machines for now, so they
can send `COMSIG_OBJ_DECONSTRUCT` signal. That comes in the next PR

## Changelog
:cl:
fix: deleting objects with local material storage(autolathe, drone
dispenser etc) no longer drops sheets, they only drop materials when
deconstructed
/:cl:

* Material container drops sheets only on object deconstruct & not destroy.

---------

Co-authored-by: SyncIt21 <[email protected]>
  • Loading branch information
2 people authored and FFMirrorBot committed Feb 7, 2024
1 parent 1730d73 commit d657f90
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion code/datums/components/material/material_container.dm
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@
for(var/signal in container_signals)
parent.RegisterSignal(src, signal, container_signals[signal])

//drop sheets when the object is deconstructed but not deleted
RegisterSignal(parent, COMSIG_OBJ_DECONSTRUCT, PROC_REF(drop_sheets))

if(_mat_container_flags & MATCONTAINER_NO_INSERT)
return

Expand All @@ -75,7 +78,6 @@
RegisterSignal(atom_target, COMSIG_ATOM_REQUESTING_CONTEXT_FROM_ITEM, PROC_REF(on_requesting_context_from_item))

/datum/component/material_container/Destroy(force)
retrieve_all()
materials = null
allowed_materials = null
return ..()
Expand All @@ -88,6 +90,11 @@
if(mat_container_flags & MATCONTAINER_EXAMINE)
RegisterSignal(parent, COMSIG_ATOM_EXAMINE, PROC_REF(on_examine))

/datum/component/material_container/proc/drop_sheets()
SIGNAL_HANDLER

retrieve_all()

/datum/component/material_container/proc/on_examine(datum/source, mob/user, list/examine_texts)
SIGNAL_HANDLER

Expand Down

0 comments on commit d657f90

Please sign in to comment.