Comprehensive cleanup of storage datum, replaces the weakrefs with just refs (because they were managed already) (#81120)

## About The Pull Request

- Large amount of storage datum cleanup.
   - Documentation.
   - Maybe more consistent use of parent vs real_location. 
   - Removes the weakrefs, replaces it with just references.
      - These were already managed references anyways so why bother?
- Removes a bunch of arguments no one used and would ever used so only
the most useful args are left.
 
- Some bugfixes. 

## Why It's Good For The Game

Aiming to make storage easier to work with. The whole intent of this was
to bugfix the whole "weight class" thing that keeps popping up but I had
to do this first.

## Changelog

🆑 Melbert
fix: When placing an item into storage (such as backpacks), all nearby
mobs now get a message, rather than just the first mob.
fix: TGC decks of cards should act a bit less odd when looking inside.  
refactor: Refactored a bit of storage, cleaned up a fair bit of its
code. Let me know if you notice anything funky about storage (like
backpacks).
/🆑
This commit is contained in:
MrMelbert
2024-02-05 11:42:03 -08:00
committed by GitHub
parent a74a8eeede
commit 12afcb911e
51 changed files with 715 additions and 829 deletions
+3 -1
View File
@@ -138,8 +138,10 @@
#define COMSIG_ITEM_PICKUP "item_pickup"
///from base of obj/item/on_outfit_equip(): (mob/equipper, visuals_only, slot)
#define COMSIG_ITEM_EQUIPPED_AS_OUTFIT "item_equip_as_outfit"
///from base of datum/storage/attempt_insert(): ()
///from base of datum/storage/handle_enter(): (datum/storage/storage)
#define COMSIG_ITEM_STORED "item_stored"
///from base of datum/storage/handle_exit(): (datum/storage/storage)
#define COMSIG_ITEM_UNSTORED "item_unstored"
///from base of obj/item/apply_fantasy_bonuses(): (bonus)
#define COMSIG_ITEM_APPLY_FANTASY_BONUSES "item_apply_fantasy_bonuses"
-10
View File
@@ -314,16 +314,6 @@ rough example of the "cone" made by the 3 dirs checked
/proc/pass(...)
return
///Returns a list of the parents of all storage components that contain the target item
/proc/get_storage_locs(obj/item/target)
. = list()
if(!istype(target) || !(target.item_flags & IN_STORAGE))
return
var/datum/storage/storage_datum = target.loc.atom_storage
if(!storage_datum)
return
. += storage_datum.real_location?.resolve()
/// Returns an x and y value require to reverse the transformations made to center an oversized icon
/atom/proc/get_oversized_icon_offsets()
if (pixel_x == 0 && pixel_y == 0)
File diff suppressed because it is too large Load Diff
+25 -18
View File
@@ -5,33 +5,40 @@
allow_big_nesting = TRUE
/datum/storage/bag_of_holding/attempt_insert(obj/item/to_insert, mob/user, override, force)
var/obj/item/resolve_parent = parent?.resolve()
if(!resolve_parent)
return
var/list/obj/item/storage/backpack/holding/matching = typecache_filter_list(to_insert.get_all_contents(), typecacheof(/obj/item/storage/backpack/holding))
matching -= resolve_parent
matching -= parent
matching -= real_location
if((istype(to_insert, /obj/item/storage/backpack/holding) || matching.len) && can_insert(to_insert, user))
INVOKE_ASYNC(src, PROC_REF(recursive_insertion), to_insert, user, resolve_parent)
return
if((istype(to_insert, /obj/item/storage/backpack/holding) || length(matching)) && can_insert(to_insert, user))
INVOKE_ASYNC(src, PROC_REF(recursive_insertion), to_insert, user)
return FALSE
return ..()
/datum/storage/bag_of_holding/proc/recursive_insertion(obj/item/to_insert, mob/living/user, atom/resolve_parent)
/datum/storage/bag_of_holding/proc/recursive_insertion(obj/item/to_insert, mob/living/user)
var/safety = tgui_alert(user, "Doing this will have extremely dire consequences for the station and its crew. Be sure you know what you're doing.", "Put in [to_insert.name]?", list("Proceed", "Abort"))
if(safety != "Proceed" || QDELETED(to_insert) || QDELETED(resolve_parent) || QDELETED(user) || !iscarbon(user) || !user.can_perform_action(resolve_parent, NEED_DEXTERITY) || !can_insert(to_insert, user))
if(safety != "Proceed" \
|| QDELETED(to_insert) \
|| QDELETED(parent) \
|| QDELETED(real_location) \
|| QDELETED(user) \
|| !user.can_perform_action(parent, NEED_DEXTERITY) \
|| !can_insert(to_insert, user) \
)
return
var/turf/loccheck = get_turf(resolve_parent)
to_chat(user, span_danger("The Bluespace interfaces of the two devices catastrophically malfunction!"))
qdel(to_insert)
playsound(loccheck,'sound/effects/supermatter.ogg', 200, TRUE)
var/turf/rift_loc = get_turf(parent)
user.visible_message(
span_userdanger("The Bluespace interfaces of the two devices catastrophically malfunction!"),
span_danger("The Bluespace interfaces of the two devices catastrophically malfunction!"),
)
playsound(rift_loc, 'sound/effects/supermatter.ogg', 200, TRUE)
message_admins("[ADMIN_LOOKUPFLW(user)] detonated a bag of holding at [ADMIN_VERBOSEJMP(loccheck)].")
user.log_message("detonated a bag of holding at [loc_name(loccheck)].", LOG_ATTACK, color="red")
message_admins("[ADMIN_LOOKUPFLW(user)] detonated a bag of holding at [ADMIN_VERBOSEJMP(rift_loc)].")
user.log_message("detonated a bag of holding at [loc_name(rift_loc)].", LOG_ATTACK, color = "red")
user.investigate_log("has been gibbed by a bag of holding recursive insertion.", INVESTIGATE_DEATHS)
user.gib()
new/obj/boh_tear(loccheck)
qdel(resolve_parent)
new /obj/boh_tear(rift_loc)
qdel(to_insert)
qdel(parent)
+42 -51
View File
@@ -5,61 +5,52 @@
max_specific_storage = WEIGHT_CLASS_TINY
max_slots = 30
max_total_storage = WEIGHT_CLASS_TINY * 30
/datum/storage/tcg/New()
. = ..()
set_holdable(list(/obj/item/tcgcard))
/datum/storage/tcg/attempt_remove(obj/item/thing, atom/newLoc, silent = FALSE)
/datum/storage/tcg/New(
atom/parent,
max_slots,
max_specific_storage,
max_total_storage,
)
. = ..()
handle_empty_deck()
set_holdable(/obj/item/tcgcard)
/datum/storage/tcg/attempt_remove(obj/item/thing, atom/remove_to_loc, silent = FALSE)
. = ..()
if(!.)
return
var/obj/item/tcgcard_deck/deck = parent
var/obj/item/tcgcard/card = thing
card.flipped = deck.flipped
card.update_appearance(UPDATE_ICON_STATE)
if(length(real_location.contents) == 0)
qdel(parent)
/datum/storage/tcg/show_contents(mob/to_show)
// sometimes, show contents is called when the mob is already seeing the contents of the deck, to refresh the view.
// to avoid spam, we only show the message if they weren't already seeing the contents.
var/was_already_seeing = to_show.active_storage == src
. = ..()
if(!.)
return .
if(!was_already_seeing)
to_show.visible_message(
span_notice("[to_show] starts to look through the contents of [parent]!"),
span_notice("You begin looking into the contents of [parent]."),
)
return .
var/obj/item/resolve_parent = parent?.resolve()
if(!resolve_parent)
return
to_show.visible_message(span_notice("[to_show] starts to look through the contents of \the [resolve_parent]!"), \
span_notice("You begin looking into the contents of \the [resolve_parent]!"))
/datum/storage/tcg/hide_contents()
/datum/storage/tcg/hide_contents(mob/to_hide)
// see above
var/was_actually_seeing = to_hide.active_storage == src
. = ..()
var/obj/item/resolve_parent = parent?.resolve()
if(!resolve_parent)
return
var/obj/item/resolve_location = real_location?.resolve()
if(!resolve_location)
return
resolve_location.visible_message(span_notice("\the [resolve_parent] is shuffled after looking through it."))
resolve_location.contents = shuffle(resolve_location.contents)
/datum/storage/tcg/dump_content_at(atom/dest_object, mob/user)
. = ..()
var/obj/item/resolve_parent = parent?.resolve()
if(!resolve_parent)
return
if(!resolve_parent.contents.len)
qdel(resolve_parent)
/datum/storage/tcg/proc/handle_empty_deck()
var/obj/item/resolve_parent = parent?.resolve()
if(!resolve_parent)
return
var/obj/item/resolve_location = real_location?.resolve()
if(!real_location)
return
//You can't have a deck of one card!
if(resolve_location.contents.len == 1)
var/obj/item/tcgcard_deck/deck = resolve_location
var/obj/item/tcgcard/card = resolve_location.contents[1]
attempt_remove(card, card.drop_location())
card.flipped = deck.flipped
card.update_icon_state()
qdel(resolve_parent)
if(!.)
return .
if(QDELING(src))
return .
if(was_actually_seeing)
real_location.visible_message(span_notice("[parent] is shuffled after looking through it."))
real_location.contents = shuffle(real_location.contents)
return .
+6 -1
View File
@@ -10,7 +10,12 @@
silent = TRUE
exception_max = 2
/datum/storage/duffel/syndicate/New()
/datum/storage/duffel/syndicate/New(
atom/parent,
max_slots,
max_specific_storage,
max_total_storage,
)
. = ..()
var/static/list/exception_type_list = list(
@@ -8,31 +8,28 @@
rustle_sound = FALSE
silent = TRUE
/datum/storage/extract_inventory/New()
/datum/storage/extract_inventory/New(
atom/parent,
max_slots,
max_specific_storage,
max_total_storage,
)
. = ..()
set_holdable(/obj/item/food/monkeycube)
var/obj/item/slimecross/reproductive/parentSlimeExtract = parent?.resolve()
if(!parentSlimeExtract)
return
if(!istype(parentSlimeExtract, /obj/item/slimecross/reproductive))
stack_trace("storage subtype extract_inventory incompatible with [parentSlimeExtract]")
var/obj/item/slimecross/reproductive/parent_slime = parent
if(!istype(parent_slime, /obj/item/slimecross/reproductive))
stack_trace("storage subtype ([type]) incompatible with [parent_slime] ([parent_slime.type])")
qdel(src)
/datum/storage/extract_inventory/proc/processCubes(mob/user)
var/obj/item/slimecross/reproductive/parentSlimeExtract = parent?.resolve()
if(!parentSlimeExtract)
return
if(parentSlimeExtract.contents.len >= max_slots)
var/obj/item/slimecross/reproductive/parentSlimeExtract = parent
if(real_location.contents.len >= max_slots)
QDEL_LIST(parentSlimeExtract.contents)
createExtracts(user)
/datum/storage/extract_inventory/proc/createExtracts(mob/user)
var/obj/item/slimecross/reproductive/parentSlimeExtract = parent?.resolve()
if(!parentSlimeExtract)
return
var/obj/item/slimecross/reproductive/parentSlimeExtract = parent
var/cores = rand(1,4)
playsound(parentSlimeExtract, 'sound/effects/splat.ogg', 40, TRUE)
+36 -21
View File
@@ -1,33 +1,48 @@
/datum/storage/fish_case
max_slots = 1
max_specific_storage = WEIGHT_CLASS_HUGE
can_hold_trait = TRAIT_FISH_CASE_COMPATIBILE
can_hold_description = "fish and aquarium equipment"
can_hold_description = "Fish and aquarium equipment"
/**
/datum/storage/fish_case/can_insert(obj/item/to_insert, mob/user, messages, force)
. = ..()
if(!.)
return .
if(!HAS_TRAIT(to_insert, TRAIT_FISH_CASE_COMPATIBILE))
if(messages && user)
user.balloon_alert(user, "can't hold!")
return FALSE
return .
/*
* Change the size of the storage item to match the inserted item's
* Because of that, we also check if conditions to keep it inside another storage or pockets are still met.
*/
/datum/storage/fish_case/handle_enter(obj/item/storage/fish_case/source, obj/item/arrived)
/datum/storage/fish_case/handle_enter(datum/source, obj/item/arrived)
. = ..()
if(!istype(arrived) || arrived.w_class == source.w_class)
if(!isitem(parent) || !istype(arrived))
return
source.w_class = arrived.w_class
var/obj/item/resolve_parent = parent?.resolve()
if(resolve_parent?.item_flags & IN_STORAGE)
source.moveToNullspace() //temporarily remove source from its location so that attempt_insert may work correctly.
if(!resolve_parent.atom_storage?.attempt_insert(source, override = TRUE))
source.forceMove(resolve_parent.drop_location())
source.visible_message("[source] spills out of [resolve_parent] as it expands to hold [arrived]", vision_distance = 1)
else if(!isliving(source.loc))
var/obj/item/item_parent = parent
if(arrived.w_class <= item_parent.w_class)
return
item_parent.w_class = arrived.w_class
// Since we're changing weight class we need to check if our storage's loc's storage can still hold us
// in the future we need a generic solution to this to solve a bunch of other exploits
var/datum/storage/loc_storage = item_parent.loc.atom_storage
if(!isnull(loc_storage) && !loc_storage.can_insert(item_parent))
item_parent.forceMove(item_parent.loc.drop_location())
item_parent.visible_message(span_warning("[item_parent] spills out of [item_parent.loc] as it expands to hold [arrived]!"), vision_distance = 1)
return
var/mob/living/living_loc = source.loc
var/equipped_slot = living_loc.get_slot_by_item(source)
if(equipped_slot & (ITEM_SLOT_RPOCKET|ITEM_SLOT_LPOCKET) && source.w_class > WEIGHT_CLASS_SMALL)
source.forceMove(living_loc.drop_location())
to_chat(living_loc, "[source] drops out of your pockets as it expands to hold [arrived]")
/datum/storage/fish_case/handle_exit(obj/item/storage/fish_case/source, obj/item/gone)
if(isliving(item_parent.loc))
var/mob/living/living_loc = item_parent.loc
if((living_loc.get_slot_by_item(item_parent) & (ITEM_SLOT_RPOCKET|ITEM_SLOT_LPOCKET)) && item_parent.w_class > WEIGHT_CLASS_SMALL)
item_parent.forceMove(living_loc.drop_location())
to_chat(living_loc, span_warning("[item_parent] drops out of your pockets as it expands to hold [arrived]!"))
return
/datum/storage/fish_case/handle_exit(datum/source, obj/item/gone)
. = ..()
if(istype(gone))
source.w_class = initial(source.w_class)
if(!isitem(parent) || !istype(gone))
return
var/obj/item/item_parent = parent
item_parent.w_class = initial(item_parent.w_class)
+7 -2
View File
@@ -5,6 +5,11 @@
silent = TRUE
allow_big_nesting = TRUE
/datum/storage/implant/New()
/datum/storage/implant/New(
atom/parent,
max_slots,
max_specific_storage,
max_total_storage,
)
. = ..()
set_holdable(cant_hold_list = list(/obj/item/disk/nuclear))
set_holdable(cant_hold_list = /obj/item/disk/nuclear)
+82 -47
View File
@@ -9,17 +9,13 @@
if(!.)
return
var/obj/item/resolve_parent = parent?.resolve()
if(!resolve_parent)
return
if(!silent || override)
return
if(quickdraw)
to_chat(user, span_notice("You discreetly slip [to_insert] into [resolve_parent]. Right-click [resolve_parent] to remove it."))
to_chat(user, span_notice("You discreetly slip [to_insert] into [parent]. Right-click to remove it."))
else
to_chat(user, span_notice("You discreetly slip [to_insert] into [resolve_parent]."))
to_chat(user, span_notice("You discreetly slip [to_insert] into [parent]."))
/datum/storage/pockets/small
max_slots = 1
@@ -31,7 +27,12 @@
max_specific_storage = WEIGHT_CLASS_TINY
attack_hand_interact = FALSE
/datum/storage/pockets/small/fedora/New()
/datum/storage/pockets/small/fedora/New(
atom/parent,
max_slots,
max_specific_storage,
max_total_storage,
)
. = ..()
var/static/list/exception_cache = typecacheof(list(
/obj/item/katana,
@@ -50,7 +51,12 @@
max_slots = 1
max_specific_storage = WEIGHT_CLASS_NORMAL
/datum/storage/pockets/chefhat/New()
/datum/storage/pockets/chefhat/New(
atom/parent,
max_slots,
max_specific_storage,
max_total_storage,
)
. = ..()
set_holdable(list(
/obj/item/clothing/head/mob_holder,
@@ -71,7 +77,12 @@
quickdraw = TRUE
silent = TRUE
/datum/storage/pockets/shoes/New()
/datum/storage/pockets/shoes/New(
atom/parent,
max_slots,
max_specific_storage,
max_total_storage,
)
. = ..()
set_holdable(list(
/obj/item/knife,
@@ -108,61 +119,80 @@
/obj/item/toy/crayon/spraycan)
)
/datum/storage/pockets/shoes/clown/New()
/datum/storage/pockets/shoes/clown/New(
atom/parent,
max_slots,
max_specific_storage,
max_total_storage,
)
. = ..()
set_holdable(list(
/obj/item/knife,
/obj/item/spess_knife,
/obj/item/switchblade,
/obj/item/pen,
/obj/item/scalpel,
/obj/item/reagent_containers/syringe,
/obj/item/dnainjector,
/obj/item/reagent_containers/hypospray/medipen,
/obj/item/reagent_containers/dropper,
/obj/item/implanter,
/obj/item/screwdriver,
/obj/item/weldingtool/mini,
/obj/item/firing_pin,
/obj/item/suppressor,
/obj/item/ammo_box/magazine/m9mm,
/obj/item/ammo_box/magazine/m10mm,
/obj/item/ammo_box/magazine/m45,
/obj/item/ammo_casing,
/obj/item/lipstick,
/obj/item/clothing/mask/cigarette,
/obj/item/lighter,
/obj/item/match,
/obj/item/holochip,
/obj/item/toy/crayon,
/obj/item/bikehorn,
/obj/item/reagent_containers/cup/glass/flask),
list(/obj/item/screwdriver/power,
/obj/item/ammo_casing/rocket,
/obj/item/clothing/mask/cigarette/pipe,
/obj/item/toy/crayon/spraycan)
)
set_holdable(
can_hold_list = list(
/obj/item/ammo_box/magazine/m10mm,
/obj/item/ammo_box/magazine/m45,
/obj/item/ammo_box/magazine/m9mm,
/obj/item/ammo_casing,
/obj/item/bikehorn,
/obj/item/clothing/mask/cigarette,
/obj/item/dnainjector,
/obj/item/firing_pin,
/obj/item/holochip,
/obj/item/implanter,
/obj/item/knife,
/obj/item/lighter,
/obj/item/lipstick,
/obj/item/match,
/obj/item/pen,
/obj/item/reagent_containers/cup/glass/flask,
/obj/item/reagent_containers/dropper,
/obj/item/reagent_containers/hypospray/medipen,
/obj/item/reagent_containers/syringe,
/obj/item/scalpel,
/obj/item/screwdriver,
/obj/item/spess_knife,
/obj/item/suppressor,
/obj/item/switchblade,
/obj/item/toy/crayon,
/obj/item/weldingtool/mini,
),
cant_hold_list = list(
/obj/item/ammo_casing/rocket,
/obj/item/clothing/mask/cigarette/pipe,
/obj/item/screwdriver/power,
/obj/item/toy/crayon/spraycan,
),
)
/datum/storage/pockets/pocketprotector
max_slots = 3
max_specific_storage = WEIGHT_CLASS_TINY
/datum/storage/pockets/pocketprotector/New()
/datum/storage/pockets/pocketprotector/New(
atom/parent,
max_slots,
max_specific_storage,
max_total_storage,
)
. = ..()
set_holdable(list( //Same items as a PDA
/obj/item/pen,
/obj/item/toy/crayon,
/obj/item/lipstick,
/obj/item/flashlight/pen,
/obj/item/clothing/mask/cigarette)
)
/obj/item/lipstick,
))
/datum/storage/pockets/helmet
max_slots = 2
quickdraw = TRUE
max_total_storage = 6
/datum/storage/pockets/helmet/New()
/datum/storage/pockets/helmet/New(
atom/parent,
max_slots,
max_specific_storage,
max_total_storage,
)
. = ..()
set_holdable(list(/obj/item/reagent_containers/cup/glass/bottle/vodka,
/obj/item/reagent_containers/cup/glass/bottle/molotov,
@@ -175,7 +205,12 @@
max_total_storage = 5 // 2 small items + 1 tiny item, or 1 normal item + 1 small item
max_slots = 3
/datum/storage/pockets/void_cloak/New()
/datum/storage/pockets/void_cloak/New(
atom/parent,
max_slots,
max_specific_storage,
max_total_storage,
)
. = ..()
set_holdable(list(
/obj/item/ammo_box/strilka310/lionhunter,
+14 -30
View File
@@ -32,13 +32,10 @@
/obj/item/stack/sheet/bluespace_crystal,
)
/datum/storage/rped/New(atom/parent, max_slots, max_specific_storage, max_total_storage, numerical_stacking, allow_quick_gather, allow_quick_empty, collection_mode, attack_hand_interact)
. = ..()
var/atom/resolve_parent = src.parent?.resolve()
RegisterSignal(resolve_parent, COMSIG_ITEM_ATTACK_SELF, PROC_REF(rped_mass_empty), TRUE)
/datum/storage/rped/can_insert(obj/item/to_insert, mob/user, messages = TRUE, force = FALSE)
. = ..()
if(!.)
return .
//we check how much of glass,plasteel & cable the user can insert
if(isstack(to_insert))
@@ -49,12 +46,8 @@
var/obj/item/stack/the_stack = to_insert
var/present_amount = 0
var/obj/item/resolve_location = real_location?.resolve()
if(!resolve_location)
return FALSE
//we try to count & limit how much the user can insert of each type to prevent them from using it as an normal storage medium
for(var/obj/item/stack/stack_content in resolve_location.contents)
for(var/obj/item/stack/stack_content in real_location)
//is user trying to insert any of these listed bluespace stuff
if(is_type_in_list(to_insert, allowed_bluespace_types))
//if yes count total bluespace stuff is the RPED and then compare the total amount to the value the user is trying to insert
@@ -83,44 +76,35 @@
return .
/// overridden mass_empty, so as to dump only the lowest tier of parts currently in the RPED
/datum/storage/rped/proc/rped_mass_empty(datum/source, atom/location, force)
SIGNAL_HANDLER
if(!allow_quick_empty && !force)
/datum/storage/rped/mass_empty(datum/source, mob/user)
if(!allow_quick_empty)
return
remove_lowest_tier(get_turf(location))
remove_lowest_tier(user.drop_location())
/**
* Searches through everything currently in storage, calculates the lowest tier of parts inside of it,
* and then dumps out every part that has the equal tier of parts. Likely a worse implementation of remove_all.
*
* @param atom/target where we're placing the item
* Arguments
* * atom/dump_loc - where we're placing the item
*/
/datum/storage/rped/proc/remove_lowest_tier(atom/target) // look whatever happens here i'm not proud of this. at all.
var/obj/item/resolve_parent = parent?.resolve()
var/obj/item/resolve_location = real_location?.resolve()
/datum/storage/rped/proc/remove_lowest_tier(atom/dump_loc = parent.drop_location())
var/list/obj/item/parts_list = list()
var/current_lowest_tier = INFINITY
if(!resolve_parent || !resolve_location)
return
if(!target)
target = get_turf(resolve_parent)
for(var/obj/item/thing in real_location)
parts_list += thing
for(var/obj/item/thing in resolve_location)
if(thing.loc != resolve_location)
continue
parts_list.Add(thing)
if(parts_list.len > 0)
parts_list = reverse_range(sortTim(parts_list, GLOBAL_PROC_REF(cmp_rped_sort)))
current_lowest_tier = parts_list[1].get_part_rating()
resolve_parent.balloon_alert(resolve_parent.loc, "dropping lowest rated parts...")
if(ismob(parent.loc))
parent.balloon_alert(parent.loc, "dropping lowest rated parts...")
for(var/obj/item/part in parts_list)
if(part.get_part_rating() != current_lowest_tier)
break
if(!attempt_remove(part, target, silent = TRUE))
if(!attempt_remove(part, dump_loc, silent = TRUE))
continue
part.pixel_x = part.base_pixel_x + rand(-8, 8)
part.pixel_y = part.base_pixel_y + rand(-8, 8)
+6 -1
View File
@@ -4,7 +4,12 @@
max_slots = 14
animated = FALSE
/datum/storage/surgery_tray/New()
/datum/storage/surgery_tray/New(
atom/parent,
max_slots,
max_specific_storage,
max_total_storage,
)
. = ..()
set_holdable(list(
/obj/item/autopsy_scanner,
+7 -10
View File
@@ -1,14 +1,11 @@
/datum/storage/trash
/datum/storage/trash/remove_single(mob/removing, obj/item/thing, atom/newLoc, silent)
var/obj/item/resolve_location = real_location?.resolve()
if(!resolve_location)
return
resolve_location.visible_message(span_notice("[removing] starts fishing around inside \the [resolve_location]."),
span_notice("You start digging around in \the [resolve_location] to try and pull something out."))
if(!do_after(removing, 1.5 SECONDS, resolve_location))
return
/datum/storage/trash/remove_single(mob/removing, obj/item/thing, atom/remove_to_loc, silent)
real_location.visible_message(
span_notice("[removing] starts fishing around inside [parent]."),
span_notice("You start digging around in [parent] to try and pull something out."),
)
if(!do_after(removing, 1.5 SECONDS, parent))
return FALSE
return ..()
+10 -8
View File
@@ -7,32 +7,34 @@
max_slots,
max_specific_storage,
max_total_storage,
numerical_stacking = FALSE,
allow_quick_gather = FALSE,
allow_quick_empty = FALSE,
collection_mode = COLLECT_ONE,
attack_hand_interact = TRUE,
list/canhold,
list/canthold,
storage_type = /datum/storage,
)
RETURN_TYPE(/datum/storage)
if(atom_storage)
QDEL_NULL(atom_storage)
atom_storage = new storage_type(src, max_slots, max_specific_storage, max_total_storage, numerical_stacking, allow_quick_gather, collection_mode, attack_hand_interact)
atom_storage = new storage_type(src, max_slots, max_specific_storage, max_total_storage)
if(canhold || canthold)
atom_storage.set_holdable(canhold, canthold)
return atom_storage
/// A quick and easy way to /clone/ a storage datum for an atom (does not copy over contents, only the datum details)
/**
* A quick and easy way to /clone/ a storage datum for an atom (does not copy over contents, only the datum details)
*
* Imperfect, does not copy over ALL variables, only important ones (max storage size, etc)
*/
/atom/proc/clone_storage(datum/storage/cloning)
RETURN_TYPE(/datum/storage)
if(atom_storage)
QDEL_NULL(atom_storage)
atom_storage = new cloning.type(src, cloning.max_slots, cloning.max_specific_storage, cloning.max_total_storage, cloning.numerical_stacking, cloning.allow_quick_gather, cloning.collection_mode, cloning.attack_hand_interact)
atom_storage = new cloning.type(src, cloning.max_slots, cloning.max_specific_storage, cloning.max_total_storage)
if(cloning.can_hold || cloning.cant_hold)
if(!atom_storage.can_hold && !atom_storage.cant_hold) //In the event that the can/can't hold lists are already in place (such as from storage objects added on initialize).
+1 -2
View File
@@ -766,8 +766,7 @@
/obj/item/on_exit_storage(datum/storage/master_storage)
. = ..()
var/atom/location = master_storage.real_location?.resolve()
do_drop_animation(location)
do_drop_animation(master_storage.parent)
/obj/item/throw_impact(atom/hit_atom, datum/thrownthing/throwingdatum)
if(QDELETED(hit_atom))
+5 -3
View File
@@ -691,12 +691,14 @@
/obj/item/storage/crayons/Initialize(mapload)
. = ..()
atom_storage.set_holdable(list(/obj/item/toy/crayon),
list(
atom_storage.set_holdable(
can_hold_list = /obj/item/toy/crayon,
cant_hold_list = list(
/obj/item/toy/crayon/spraycan,
/obj/item/toy/crayon/mime,
/obj/item/toy/crayon/rainbow,
))
),
)
/obj/item/storage/crayons/PopulateContents()
new /obj/item/toy/crayon/red(src)
+1 -1
View File
@@ -13,7 +13,7 @@
/obj/item/storage/dice/Initialize(mapload)
. = ..()
atom_storage.allow_quick_gather = TRUE
atom_storage.set_holdable(list(/obj/item/dice))
atom_storage.set_holdable(/obj/item/dice)
/obj/item/storage/dice/PopulateContents()
new /obj/item/dice/d4(src)
@@ -19,7 +19,7 @@
atom_storage.remove_all()
implantee.visible_message(span_warning("A bluespace pocket opens around [src] as it exits [implantee], spewing out its contents and rupturing the surrounding tissue!"))
implantee.apply_damage(20, BRUTE, BODY_ZONE_CHEST)
qdel(atom_storage)
QDEL_NULL(atom_storage)
return ..()
/obj/item/implant/storage/implant(mob/living/target, mob/user, silent = FALSE, force = FALSE)
+2 -6
View File
@@ -117,14 +117,10 @@
return ..()
/obj/item/melee/sabre/on_exit_storage(datum/storage/container)
var/obj/item/storage/belt/sabre/sabre = container.real_location?.resolve()
if(istype(sabre))
playsound(sabre, 'sound/items/unsheath.ogg', 25, TRUE)
playsound(container.parent, 'sound/items/unsheath.ogg', 25, TRUE)
/obj/item/melee/sabre/on_enter_storage(datum/storage/container)
var/obj/item/storage/belt/sabre/sabre = container.real_location?.resolve()
if(istype(sabre))
playsound(sabre, 'sound/items/sheath.ogg', 25, TRUE)
playsound(container.parent, 'sound/items/sheath.ogg', 25, TRUE)
/obj/item/melee/sabre/suicide_act(mob/living/user)
user.visible_message(span_suicide("[user] is trying to cut off all [user.p_their()] limbs with [src]! it looks like [user.p_theyre()] trying to commit suicide!"))
+1 -1
View File
@@ -385,7 +385,7 @@
. = ..()
AddElement(/datum/element/undertile, TRAIT_T_RAY_VISIBLE, INVISIBILITY_OBSERVER, use_anchor = TRUE)
atom_storage.max_total_storage = 15
atom_storage.set_holdable(cant_hold_list = list(/obj/item/storage/backpack/satchel/flat)) //muh recursive backpacks)
atom_storage.set_holdable(cant_hold_list = /obj/item/storage/backpack/satchel/flat) //muh recursive backpacks
/obj/item/storage/backpack/satchel/flat/PopulateContents()
for(var/items in 1 to 4)
+16 -17
View File
@@ -49,7 +49,7 @@
atom_storage.max_specific_storage = WEIGHT_CLASS_SMALL
atom_storage.max_total_storage = 30
atom_storage.max_slots = 30
atom_storage.set_holdable(cant_hold_list = list(/obj/item/disk/nuclear))
atom_storage.set_holdable(cant_hold_list = /obj/item/disk/nuclear)
atom_storage.supports_smart_equip = FALSE
RegisterSignal(atom_storage, COMSIG_STORAGE_DUMP_POST_TRANSFER, PROC_REF(post_insertion))
@@ -137,7 +137,7 @@
atom_storage.numerical_stacking = TRUE
atom_storage.allow_quick_empty = TRUE
atom_storage.allow_quick_gather = TRUE
atom_storage.set_holdable(list(/obj/item/stack/ore))
atom_storage.set_holdable(/obj/item/stack/ore)
atom_storage.silent_for_user = TRUE
/obj/item/storage/bag/ore/equipped(mob/user)
@@ -245,8 +245,7 @@
/obj/item/grown,
/obj/item/food/honeycomb,
/obj/item/seeds,
))
////////
))
/obj/item/storage/bag/plants/portaseeder
name = "portable seed extractor"
@@ -290,20 +289,22 @@
icon_state = "sheetsnatcher"
worn_icon_state = "satchel"
var/capacity = 300; //the number of sheets it can carry.
var/capacity = 300 //the number of sheets it can carry.
/obj/item/storage/bag/sheetsnatcher/Initialize(mapload)
. = ..()
atom_storage.allow_quick_empty = TRUE
atom_storage.allow_quick_gather = TRUE
atom_storage.numerical_stacking = TRUE
atom_storage.set_holdable(list(
atom_storage.set_holdable(
can_hold_list = list(
/obj/item/stack/sheet
),
list(
),
cant_hold_list = list(
/obj/item/stack/sheet/mineral/sandstone,
/obj/item/stack/sheet/mineral/wood,
))
),
)
atom_storage.max_total_storage = capacity / 2
// -----------------------------
@@ -373,7 +374,7 @@
/obj/item/storage/box/matches,
/obj/item/storage/fancy,
/obj/item/trash,
)) //Should cover: Bottles, Beakers, Bowls, Booze, Glasses, Food, Food Containers, Food Trash, Organs, Tobacco Products, Lighters, and Kitchen Tools.
)) //Should cover: Bottles, Beakers, Bowls, Booze, Glasses, Food, Food Containers, Food Trash, Organs, Tobacco Products, Lighters, and Kitchen Tools.
atom_storage.insert_preposition = "on"
atom_storage.max_slots = 7
@@ -457,7 +458,7 @@
/obj/item/reagent_containers/medigel,
/obj/item/reagent_containers/pill,
/obj/item/reagent_containers/syringe,
))
))
/*
* Biowaste bag (mostly for virologists)
@@ -487,7 +488,7 @@
/obj/item/reagent_containers/cup/tube,
/obj/item/reagent_containers/hypospray/medipen,
/obj/item/reagent_containers/syringe,
))
))
/*
* Science bag (mostly for xenobiologists)
@@ -518,7 +519,7 @@
/obj/item/reagent_containers/syringe,
/obj/item/slime_extract,
/obj/item/swab,
))
))
/*
* Construction bag (for engineering, holds stock parts and electronics)
@@ -547,7 +548,7 @@
/obj/item/stack/ore/bluespace_crystal,
/obj/item/stock_parts,
/obj/item/wallframe/camera,
))
))
/obj/item/storage/bag/harpoon_quiver
name = "harpoon quiver"
@@ -562,9 +563,7 @@
atom_storage.max_specific_storage = WEIGHT_CLASS_TINY
atom_storage.max_slots = 40
atom_storage.max_total_storage = 100
atom_storage.set_holdable(list(
/obj/item/ammo_casing/harpoon
))
atom_storage.set_holdable(/obj/item/ammo_casing/harpoon)
/obj/item/storage/bag/harpoon_quiver/PopulateContents()
for(var/i in 1 to 40)
+4 -14
View File
@@ -487,9 +487,7 @@
/obj/item/storage/belt/soulstone/Initialize(mapload)
. = ..()
atom_storage.max_slots = 6
atom_storage.set_holdable(list(
/obj/item/soulstone,
))
atom_storage.set_holdable(/obj/item/soulstone)
/obj/item/storage/belt/soulstone/full/PopulateContents()
for(var/i in 1 to 6)
@@ -510,9 +508,7 @@
/obj/item/storage/belt/champion/Initialize(mapload)
. = ..()
atom_storage.max_slots = 1
atom_storage.set_holdable(list(
/obj/item/clothing/mask/luchador,
))
atom_storage.set_holdable(/obj/item/clothing/mask/luchador)
/obj/item/storage/belt/military
name = "chest rig"
@@ -663,9 +659,7 @@
/obj/item/storage/belt/wands/Initialize(mapload)
. = ..()
atom_storage.max_slots = 6
atom_storage.set_holdable(list(
/obj/item/gun/magic/wand,
))
atom_storage.set_holdable(/obj/item/gun/magic/wand)
/obj/item/storage/belt/wands/full/PopulateContents()
new /obj/item/gun/magic/wand/death(src)
@@ -824,11 +818,7 @@
atom_storage.max_slots = 1
atom_storage.rustle_sound = FALSE
atom_storage.max_specific_storage = WEIGHT_CLASS_BULKY
atom_storage.set_holdable(
list(
/obj/item/melee/sabre,
)
)
atom_storage.set_holdable(/obj/item/melee/sabre)
/obj/item/storage/belt/sabre/examine(mob/user)
. = ..()
@@ -14,7 +14,7 @@
/obj/item/storage/box/donkpockets/Initialize(mapload)
. = ..()
atom_storage.set_holdable(list(/obj/item/food/donkpocket))
atom_storage.set_holdable(/obj/item/food/donkpocket)
/obj/item/storage/box/donkpockets/donkpocketspicy
name = "box of spicy-flavoured donk-pockets"
@@ -337,7 +337,7 @@
/obj/item/storage/box/gum/Initialize(mapload)
. = ..()
atom_storage.set_holdable(list(/obj/item/food/bubblegum))
atom_storage.set_holdable(/obj/item/food/bubblegum)
atom_storage.max_slots = 4
/obj/item/storage/box/gum/PopulateContents()
@@ -508,7 +508,7 @@
/obj/item/storage/box/coffeepack/Initialize(mapload)
. = ..()
atom_storage.set_holdable(list(/obj/item/food/grown/coffee))
atom_storage.set_holdable(/obj/item/food/grown/coffee)
/obj/item/storage/box/coffeepack/PopulateContents()
atom_storage.max_slots = 5
@@ -151,7 +151,7 @@
/obj/item/stack/medical/bandage,
/obj/item/reagent_containers/pill,
/obj/item/reagent_containers/pill/patch,
))
))
/obj/item/storage/box/bandages/PopulateContents()
for(var/i in 1 to 5)
@@ -43,7 +43,7 @@
/obj/item/storage/box/monkeycubes/Initialize(mapload)
. = ..()
atom_storage.max_slots = 7
atom_storage.set_holdable(list(/obj/item/food/monkeycube))
atom_storage.set_holdable(/obj/item/food/monkeycube)
/obj/item/storage/box/monkeycubes/PopulateContents()
for(var/i in 1 to 5)
@@ -62,7 +62,7 @@
/obj/item/storage/box/gorillacubes/Initialize(mapload)
. = ..()
atom_storage.max_slots = 3
atom_storage.set_holdable(list(/obj/item/food/monkeycube))
atom_storage.set_holdable(/obj/item/food/monkeycube)
/obj/item/storage/box/gorillacubes/PopulateContents()
for(var/i in 1 to 3)
@@ -63,7 +63,7 @@
/obj/item/storage/box/snappops/Initialize(mapload)
. = ..()
atom_storage.set_holdable(list(/obj/item/toy/snappop))
atom_storage.set_holdable(/obj/item/toy/snappop)
atom_storage.max_slots = 8
/obj/item/storage/box/snappops/PopulateContents()
@@ -90,7 +90,7 @@
/obj/item/storage/box/matches/Initialize(mapload)
. = ..()
atom_storage.max_slots = 10
atom_storage.set_holdable(list(/obj/item/match))
atom_storage.set_holdable(/obj/item/match)
/obj/item/storage/box/matches/PopulateContents()
for(var/i in 1 to 10)
+8 -8
View File
@@ -106,7 +106,7 @@
/obj/item/storage/fancy/donut_box/Initialize(mapload)
. = ..()
atom_storage.set_holdable(list(/obj/item/food/donut))
atom_storage.set_holdable(/obj/item/food/donut)
/obj/item/storage/fancy/donut_box/PopulateContents()
. = ..()
@@ -153,7 +153,7 @@
/obj/item/storage/fancy/egg_box/Initialize(mapload)
. = ..()
atom_storage.set_holdable(list(/obj/item/food/egg))
atom_storage.set_holdable(/obj/item/food/egg)
/*
* Fertile Egg Box
@@ -186,7 +186,7 @@
/obj/item/storage/fancy/candle_box/Initialize(mapload)
. = ..()
atom_storage.set_holdable(list(/obj/item/flashlight/flare/candle))
atom_storage.set_holdable(/obj/item/flashlight/flare/candle)
////////////
//CIG PACK//
@@ -405,7 +405,7 @@
/obj/item/storage/fancy/rollingpapers/Initialize(mapload)
. = ..()
atom_storage.set_holdable(list(/obj/item/rollingpaper))
atom_storage.set_holdable(/obj/item/rollingpaper)
/obj/item/storage/fancy/rollingpapers/update_overlays()
. = ..()
@@ -431,7 +431,7 @@
/obj/item/storage/fancy/cigarettes/cigars/Initialize(mapload)
. = ..()
atom_storage.set_holdable(list(/obj/item/clothing/mask/cigarette/cigar))
atom_storage.set_holdable(/obj/item/clothing/mask/cigarette/cigar)
/obj/item/storage/fancy/cigarettes/cigars/update_icon_state()
. = ..()
@@ -486,7 +486,7 @@
/obj/item/storage/fancy/heart_box/Initialize(mapload)
. = ..()
atom_storage.set_holdable(list(/obj/item/food/bonbon))
atom_storage.set_holdable(/obj/item/food/bonbon)
/obj/item/storage/fancy/nugget_box
@@ -501,7 +501,7 @@
/obj/item/storage/fancy/nugget_box/Initialize(mapload)
. = ..()
atom_storage.set_holdable(list(/obj/item/food/nugget))
atom_storage.set_holdable(/obj/item/food/nugget)
/*
* Jar of pickles
@@ -523,7 +523,7 @@
/obj/item/storage/fancy/pickles_jar/Initialize(mapload)
. = ..()
atom_storage.set_holdable(list(/obj/item/food/pickle))
atom_storage.set_holdable(/obj/item/food/pickle)
/obj/item/storage/fancy/pickles_jar/update_icon_state()
. = ..()
+1 -3
View File
@@ -45,9 +45,7 @@
atom_storage.max_total_storage = 200
atom_storage.max_slots = 15
atom_storage.insert_preposition = "in"
atom_storage.set_holdable(list(
/obj/item/clothing,
))
atom_storage.set_holdable(/obj/item/clothing)
/obj/item/storage/bag/garment/captain/PopulateContents()
new /obj/item/clothing/under/rank/captain(src)
+1 -1
View File
@@ -113,7 +113,7 @@
atom_storage.max_specific_storage = WEIGHT_CLASS_SMALL
atom_storage.max_slots = 10
atom_storage.max_total_storage = 20
atom_storage.set_holdable(list(/obj/item/clothing/accessory/medal))
atom_storage.set_holdable(/obj/item/clothing/accessory/medal)
/obj/item/storage/lockbox/medal/examine(mob/user)
. = ..()
+11 -9
View File
@@ -666,12 +666,16 @@
/obj/item/storage/organbox/Initialize(mapload)
. = ..()
create_storage(storage_type = /datum/storage/organ_box, max_specific_storage = WEIGHT_CLASS_BULKY, max_total_storage = 21)
atom_storage.set_holdable(list(
/obj/item/organ,
/obj/item/bodypart,
/obj/item/food/icecream
))
create_storage(
storage_type = /datum/storage/organ_box,
max_specific_storage = WEIGHT_CLASS_BULKY,
max_total_storage = 21,
canhold = list(
/obj/item/organ,
/obj/item/bodypart,
/obj/item/food/icecream,
),
)
create_reagents(100, TRANSPARENT)
START_PROCESSING(SSobj, src)
@@ -766,9 +770,7 @@
atom_storage.max_slots = 8
atom_storage.screen_max_columns = 4
atom_storage.screen_max_rows = 2
atom_storage.set_holdable(list(
/obj/item/reagent_containers/cup/tube,
))
atom_storage.set_holdable(/obj/item/reagent_containers/cup/tube)
/obj/item/storage/test_tube_rack/attack_self(mob/user)
emptyStorage()
+2 -2
View File
@@ -30,8 +30,8 @@
/obj/item/reagent_containers/cup/soda_cans,
/obj/item/reagent_containers/cup/glass/bottle/beer,
/obj/item/reagent_containers/cup/glass/bottle/ale,
/obj/item/reagent_containers/cup/glass/waterbottle
))
/obj/item/reagent_containers/cup/glass/waterbottle,
))
/obj/item/storage/cans/sixsoda
name = "soda bottle ring"
+4 -8
View File
@@ -53,17 +53,13 @@
max_slots,
max_specific_storage,
max_total_storage,
numerical_stacking,
allow_quick_gather,
allow_quick_empty,
collection_mode,
attack_hand_interact,
list/canhold,
list/canthold,
storage_type = /datum/storage,
storage_type,
)
if(!storage_type) // If no type was passed in, default to what we already have
storage_type = src.storage_type
)
// If no type was passed in, default to what we already have
storage_type ||= src.storage_type
return ..()
-25
View File
@@ -1,28 +1,3 @@
/datum/storage/surgery_tray
max_total_storage = 30
max_specific_storage = WEIGHT_CLASS_NORMAL
max_slots = 14
/datum/storage/surgery_tray/New()
. = ..()
set_holdable(list(
/obj/item/autopsy_scanner,
/obj/item/blood_filter,
/obj/item/bonesetter,
/obj/item/cautery,
/obj/item/circular_saw,
/obj/item/clothing/mask/surgical,
/obj/item/hemostat,
/obj/item/razor,
/obj/item/reagent_containers/medigel,
/obj/item/retractor,
/obj/item/scalpel,
/obj/item/stack/medical/bone_gel,
/obj/item/stack/sticky_tape/surgical,
/obj/item/surgical_drapes,
/obj/item/surgicaldrill,
))
/**
* Surgery Trays
* A storage object that displays tools in its contents based on tier, better tools are more visible.
+1 -1
View File
@@ -414,7 +414,7 @@ GLOBAL_LIST_EMPTY(tcgcard_radial_choices)
/obj/item/storage/card_binder/Initialize(mapload)
. = ..()
atom_storage.set_holdable(list(/obj/item/tcgcard))
atom_storage.set_holdable(/obj/item/tcgcard)
atom_storage.max_total_storage = 120
atom_storage.max_slots = 60
+1 -1
View File
@@ -60,7 +60,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/secure_safe/caps_spare, 32)
/obj/structure/secure_safe/caps_spare/Initialize(mapload)
. = ..()
atom_storage.set_holdable(can_hold_list = list(/obj/item/card/id))
atom_storage.set_holdable(/obj/item/card/id)
AddComponent(/datum/component/lockable_storage, \
lock_code = SSid_access.spare_id_safe_code, \
can_hack_open = FALSE, \
+2 -4
View File
@@ -11,11 +11,9 @@
/obj/structure/toiletbong/Initialize(mapload)
. = ..()
create_storage()
create_storage(max_total_storage = 100, max_slots = 12, canhold = /obj/item/food)
atom_storage.attack_hand_interact = FALSE
atom_storage.set_holdable(list(/obj/item/food/))
atom_storage.max_total_storage = 100
atom_storage.max_slots = 12
weed_overlay = mutable_appearance('icons/obj/watercloset.dmi', "toiletbong_overlay")
START_PROCESSING(SSobj, src)
+1 -2
View File
@@ -120,9 +120,8 @@
//Copy backpack contents if exist.
var/obj/item/backpack = get_item_by_slot(ITEM_SLOT_BACK)
if(istype(backpack) && backpack.atom_storage)
var/list/bp_stuff = list()
var/list/bp_stuff = backpack.atom_storage.return_inv(recursive = FALSE)
var/list/typecounts = list()
backpack.atom_storage.return_inv(bp_stuff, FALSE)
for(var/obj/item/backpack_item in bp_stuff)
if(typecounts[backpack_item.type])
typecounts[backpack_item.type] += 1
@@ -59,7 +59,7 @@
. = ..()
var/obj/item/clothing/under/attached_to = loc
if(!istype(attached_to))
return
@@ -79,8 +79,10 @@
SHOULD_CALL_PARENT(TRUE)
if(atom_storage)
atom_storage.close_all()
attach_to.clone_storage(atom_storage)
attach_to.atom_storage.set_real_location(src)
attach_to.atom_storage.rustle_sound = TRUE // it's on the suit now
var/num_other_accessories = LAZYLEN(attach_to.attached_accessories)
layer = FLOAT_LAYER + clamp(attach_to.max_number_of_accessories - num_other_accessories, 0, 10)
@@ -118,9 +120,8 @@
/obj/item/clothing/accessory/proc/detach(obj/item/clothing/under/detach_from)
SHOULD_CALL_PARENT(TRUE)
if(IS_WEAKREF_OF(src, detach_from.atom_storage?.real_location))
if(detach_from.atom_storage?.real_location == src)
// Ensure void items do not stick around
atom_storage.close_all()
detach_from.atom_storage.close_all()
// And clean up the storage we made
QDEL_NULL(detach_from.atom_storage)
+2 -3
View File
@@ -70,9 +70,8 @@ GLOBAL_LIST_EMPTY(exodrone_launchers)
else
name_counter[name] = 1
GLOB.exodrones += src
/// Cargo storage
create_storage(max_slots = EXODRONE_CARGO_SLOTS)
atom_storage.set_holdable(cant_hold_list = GLOB.blacklisted_cargo_types)
// Cargo storage
create_storage(max_slots = EXODRONE_CARGO_SLOTS, canthold = GLOB.blacklisted_cargo_types)
/obj/item/exodrone/Destroy()
. = ..()
+2 -2
View File
@@ -202,10 +202,10 @@
/obj/item/storage/toolbox/fishing/Initialize(mapload)
. = ..()
// Can hold fishing rod despite the size
var/static/list/exception_cache = typecacheof(
var/static/list/exception_cache = typecacheof(list(
/obj/item/fishing_rod,
/obj/item/fishing_line,
)
))
atom_storage.exception_hold = exception_cache
/obj/item/storage/toolbox/fishing/PopulateContents()
@@ -489,7 +489,7 @@
/obj/item/storage/fancy/coffee_cart_rack/Initialize(mapload)
. = ..()
atom_storage.max_slots = 4
atom_storage.set_holdable(list(/obj/item/coffee_cartridge))
atom_storage.set_holdable(/obj/item/coffee_cartridge)
/*
* impressa coffee maker
@@ -151,23 +151,21 @@
default_unfasten_wrench(user, tool, time = 2 SECONDS)
return ITEM_INTERACT_SUCCESS
/obj/machinery/griddle/proc/on_storage_dump(datum/source, obj/item/storage_source, mob/user)
/obj/machinery/griddle/proc/on_storage_dump(datum/source, datum/storage/storage, mob/user)
SIGNAL_HANDLER
for(var/obj/item/to_dump in storage_source)
if(to_dump.loc != storage_source)
continue
for(var/obj/item/to_dump in storage.real_location)
if(griddled_objects.len >= max_items)
break
if(!storage_source.atom_storage.attempt_remove(to_dump, src, silent = TRUE))
if(!storage.attempt_remove(to_dump, src, silent = TRUE))
continue
to_dump.pixel_x = to_dump.base_pixel_x + rand(-5, 5)
to_dump.pixel_y = to_dump.base_pixel_y + rand(-5, 5)
AddToGrill(to_dump, user)
to_chat(user, span_notice("You dump out [storage_source] onto [src]."))
to_chat(user, span_notice("You dump out [storage.parent] onto [src]."))
return STORAGE_DUMP_HANDLED
/obj/machinery/griddle/process(seconds_per_tick)
@@ -467,8 +467,6 @@
resistance_flags = INDESTRUCTIBLE
/obj/item/shared_storage/red
name = "paradox bag"
desc = "Somehow, it's in two places at once."
/obj/item/shared_storage/red/Initialize(mapload)
. = ..()
+1 -3
View File
@@ -562,9 +562,7 @@
while(i < length(processing_list))
var/atom/A = processing_list[++i]
if(A.atom_storage)
var/list/item_stuff = list()
A.atom_storage.return_inv(item_stuff)
processing_list += item_stuff
processing_list += A.atom_storage.return_inv()
return processing_list
/// Returns a list of things that the provided mob has, including any storage-capable implants.
@@ -438,11 +438,10 @@
if(!equipped_item.atom_storage?.attempt_insert(thing, src))
to_chat(src, span_warning("You can't fit [thing] into your [equipped_item.name]!"))
return
var/atom/real_location = storage.real_location?.resolve()
if(!real_location.contents.len) // nothing to take out
if(!storage.real_location.contents.len) // nothing to take out
to_chat(src, span_warning("There's nothing in your [equipped_item.name] to take out!"))
return
var/obj/item/stored = real_location.contents[real_location.contents.len]
var/obj/item/stored = storage.real_location.contents[storage.real_location.contents.len]
if(!stored || stored.on_found(src))
return
stored.attack_hand(src) // take out thing from item in storage slot
+9 -6
View File
@@ -726,10 +726,10 @@
/mob/living/get_contents()
var/list/ret = list()
ret |= contents //add our contents
for(var/atom/iter_atom as anything in ret.Copy()) //iterate storage objects
iter_atom.atom_storage?.return_inv(ret)
for(var/obj/item/folder/F in ret.Copy()) //very snowflakey-ly iterate folders
ret |= F.contents
for(var/atom/iter_atom as anything in ret) //iterate storage objects
ret |= iter_atom.atom_storage?.return_inv()
for(var/obj/item/folder/folder in ret) //very snowflakey-ly iterate folders
ret |= folder.contents
return ret
/**
@@ -1004,8 +1004,11 @@
var/mob/living/L = pulledby
L.set_pull_offsets(src, pulledby.grab_state)
if(active_storage && !((active_storage.parent?.resolve() in important_recursive_contents?[RECURSIVE_CONTENTS_ACTIVE_STORAGE]) || CanReach(active_storage.parent?.resolve(),view_only = TRUE)))
active_storage.hide_contents(src)
if(active_storage)
var/storage_is_important_recurisve = (active_storage.parent in important_recursive_contents?[RECURSIVE_CONTENTS_ACTIVE_STORAGE])
var/can_reach_active_storage = CanReach(active_storage.parent, view_only = TRUE)
if(!storage_is_important_recurisve && !can_reach_active_storage)
active_storage.hide_contents(src)
if(body_position == LYING_DOWN && !buckled && prob(getBruteLoss()*200/maxHealth))
makeTrail(newloc, T, old_direction)
+2 -3
View File
@@ -31,11 +31,10 @@
RegisterSignal(mod.chestplate, COMSIG_ITEM_PRE_UNEQUIP, PROC_REF(on_chestplate_unequip))
/obj/item/mod/module/storage/on_uninstall(deleting = FALSE)
var/datum/storage/modstorage = mod.atom_storage
atom_storage.locked = STORAGE_FULLY_LOCKED
qdel(modstorage)
QDEL_NULL(mod.atom_storage)
if(!deleting)
atom_storage.remove_all(get_turf(src))
atom_storage.remove_all(mod.drop_location())
UnregisterSignal(mod.chestplate, COMSIG_ITEM_PRE_UNEQUIP)
/obj/item/mod/module/storage/proc/on_chestplate_unequip(obj/item/source, force, atom/newloc, no_move, invdrop, silent)
+8 -3
View File
@@ -58,12 +58,17 @@
max_total_storage = 42
max_slots = 21
/datum/storage/photo_album/New(atom/parent, max_slots, max_specific_storage, max_total_storage, numerical_stacking, allow_quick_gather, allow_quick_empty, collection_mode, attack_hand_interact)
/datum/storage/photo_album/New(
atom/parent,
max_slots,
max_specific_storage,
max_total_storage,
)
. = ..()
set_holdable(list(/obj/item/photo))
set_holdable(/obj/item/photo)
/datum/storage/photo_album/proc/save_everything()
var/obj/item/storage/photo_album/album = parent.resolve()
var/obj/item/storage/photo_album/album = parent
ASSERT(istype(album))
SSpersistence.photo_albums_database.set_key(album.persistence_id, album.get_picture_id_list())
@@ -15,9 +15,7 @@
atom_storage.max_specific_storage = WEIGHT_CLASS_TINY
atom_storage.max_slots = 40
atom_storage.max_total_storage = 100
atom_storage.set_holdable(list(
/obj/item/ammo_casing/arrow,
))
atom_storage.set_holdable(/obj/item/ammo_casing/arrow)
/obj/item/storage/bag/quiver/PopulateContents()
. = ..()
@@ -370,7 +370,7 @@
. = ..()
atom_storage.max_specific_storage = WEIGHT_CLASS_SMALL
atom_storage.max_slots = 2
atom_storage.set_holdable(list(/obj/item/gun/energy/dueling))
atom_storage.set_holdable(/obj/item/gun/energy/dueling)
/obj/item/storage/lockbox/dueling/update_icon_state()
if(atom_storage?.locked)
+5 -7
View File
@@ -292,19 +292,17 @@
..()
///How disposal handles getting a storage dump from a storage object
/obj/machinery/disposal/proc/on_storage_dump(datum/source, obj/item/storage_source, mob/user)
/obj/machinery/disposal/proc/on_storage_dump(datum/source, datum/storage/storage, mob/user)
SIGNAL_HANDLER
. = STORAGE_DUMP_HANDLED
to_chat(user, span_notice("You dump out [storage_source] into [src]."))
to_chat(user, span_notice("You dump out [storage.parent] into [src]."))
for(var/obj/item/to_dump in storage_source)
if(to_dump.loc != storage_source)
continue
if(user.active_storage != storage_source && to_dump.on_found(user))
for(var/obj/item/to_dump in storage.real_location)
if(user.active_storage != storage && to_dump.on_found(user))
return
if(!storage_source.atom_storage.attempt_remove(to_dump, src, silent = TRUE))
if(!storage.attempt_remove(to_dump, src, silent = TRUE))
continue
to_dump.pixel_x = to_dump.base_pixel_x + rand(-5, 5)
to_dump.pixel_y = to_dump.base_pixel_y + rand(-5, 5)