Part 1: Storage Improvements (#90365)

## About The Pull Request
- Removed duplicate definition of
`/obj/item/storage/contents_explosion()`
- Removed var `rummage_if_nodrop`. It's always `TRUE` and nowhere in
game is it modified so we implement its value directly
- Autodoc for procs `PopulateContents()` & `emptyStorage()`
- Deconstructing storages is faster as it drops the contents directly on
the turf instead of refreshing views, animating parent, updating
appearance & other stuff done in `removeAll()`. It also has no side
effects as presently indestructible contents is moved to the turf inside
`Destroy()`

## Changelog
🆑
code: improved storage code
/🆑
This commit is contained in:
SyncIt21
2025-04-07 10:49:57 +02:00
committed by GitHub
parent dc53bcf584
commit aee65d742d
2 changed files with 51 additions and 57 deletions
+12 -9
View File
@@ -161,7 +161,7 @@
/datum/storage/proc/on_deconstruct()
SIGNAL_HANDLER
remove_all()
remove_all(update_storage = FALSE)
/// Automatically ran on all object insertions: flag marking and view refreshing.
/datum/storage/proc/handle_enter(datum/source, obj/item/arrived)
@@ -552,8 +552,9 @@ GLOBAL_LIST_EMPTY(cached_storage_typecaches)
* * obj/item/thing - the object we're removing
* * atom/remove_to_loc - where we're placing the item
* * silent - if TRUE, we won't play any exit sounds
* * visual_updates - if TRUE we update storage views & animate parent appearance
*/
/datum/storage/proc/attempt_remove(obj/item/thing, atom/remove_to_loc, silent = FALSE)
/datum/storage/proc/attempt_remove(obj/item/thing, atom/remove_to_loc, silent = FALSE, visual_updates = TRUE)
SHOULD_NOT_SLEEP(TRUE)
if(istype(thing) && ismob(parent.loc))
@@ -564,7 +565,7 @@ GLOBAL_LIST_EMPTY(cached_storage_typecaches)
reset_item(thing)
thing.forceMove(remove_to_loc)
if(do_rustle && !silent)
if(!silent && do_rustle)
if(remove_rustle_sound)
playsound(parent, remove_rustle_sound, 50, TRUE, -5)
else if(rustle_sound)
@@ -572,11 +573,12 @@ GLOBAL_LIST_EMPTY(cached_storage_typecaches)
else
thing.moveToNullspace()
if(animated)
animate_parent()
if(visual_updates)
if(animated)
animate_parent()
refresh_views()
parent.update_appearance()
refresh_views()
parent.update_appearance()
SEND_SIGNAL(parent, COMSIG_ATOM_REMOVED_ITEM, thing, remove_to_loc, silent)
SEND_SIGNAL(src, COMSIG_STORAGE_REMOVED_ITEM, thing, remove_to_loc, silent)
@@ -587,10 +589,11 @@ GLOBAL_LIST_EMPTY(cached_storage_typecaches)
*
* Arguments
* * atom/drop_loc - where we're placing the item
* * update_storage - should we update the parent to show visual effects
*/
/datum/storage/proc/remove_all(atom/drop_loc = parent.drop_location())
/datum/storage/proc/remove_all(atom/drop_loc = parent.drop_location(), update_storage = TRUE)
for(var/obj/item/thing in real_location)
if(!attempt_remove(thing, drop_loc, silent = TRUE))
if(!attempt_remove(thing, drop_loc, silent = TRUE, visual_updates = update_storage))
continue
thing.pixel_x = thing.base_pixel_x + rand(-8, 8)
thing.pixel_y = thing.base_pixel_y + rand(-8, 8)