Fix - Persistent stashed trash (#21412)

# Summary

This PR fixes trash items becoming persistent when they get stashed in
storage containers (e.g. backpacks or lunchboxes).

## Details

When items get added to storage containers like backpacks, during the
insertion `dropped` is called and makes the item persistent.

During feature dev this was an unknown edge case of `dropped`.
This commit is contained in:
FabianK3
2025-09-28 20:43:56 +00:00
committed by GitHub
parent f3d39de03d
commit ac8a42373e
2 changed files with 24 additions and 12 deletions
+18 -12
View File
@@ -505,18 +505,24 @@
/obj/item/proc/try_make_persistent_trash()
SHOULD_NOT_OVERRIDE(TRUE)
PROTECTED_PROC(TRUE)
if(persistency_considered_trash) // Persistent trash - Applicable if considered_persistent_trash is true
// Trash-like items should become only persistent when they are not dropped in a maint or disposals, otherwise they get deregistered
var/turf/T = get_turf(src)
if(T)
var/area/A = get_area(T)
if(A && !(A.area_flags & AREA_FLAG_PREVENT_PERSISTENT_TRASH))
persistance_expiration_time_days = 3 // Ensure expiration date is set to prevent long term trash
SSpersistence.register_track(src, usr == null ? null : ckey(usr.key))
else
SSpersistence.deregister_track(src)
else
SSpersistence.deregister_track(src)
if(!persistency_considered_trash)
return
if(in_storage) // Items getting moved into storages (lunchboxes, backpacks) triggers the dropped handler and requires no persistency as a result
SSpersistence.deregister_track(src)
return
// Trash-like items should become only persistent when they are not dropped in an area flagged with AREA_FLAG_PREVENT_PERSISTENT_TRASH
var/turf/T = get_turf(src)
if(T)
var/area/A = get_area(T)
if(A && !(A.area_flags & AREA_FLAG_PREVENT_PERSISTENT_TRASH))
persistance_expiration_time_days = 3 // Ensure expiration date is set to prevent long term trash
SSpersistence.register_track(src, usr == null ? null : ckey(usr.key))
return
// Fallback - No persistency
SSpersistence.deregister_track(src)
/obj/item/proc/remove_item_verbs(mob/user)
if(ismech(user)) //very snowflake, but necessary due to how mechs work