From 2ce3bb43e4be5342357e454fcc52c2d418e50ba9 Mon Sep 17 00:00:00 2001 From: Joe Schmoe Date: Sat, 8 Jun 2019 20:48:29 +0200 Subject: [PATCH] Small storage refactor and examine change --- code/__DEFINES/components.dm | 25 ++++++------- .../components/storage/concrete/implant.dm | 2 +- .../components/storage/concrete/pockets.dm | 21 ++++++----- code/datums/components/storage/storage.dm | 35 +++++++++++++++++-- code/datums/datum.dm | 4 +++ code/game/objects/items/crayons.dm | 2 +- code/game/objects/items/pneumaticCannon.dm | 2 +- code/game/objects/items/storage/backpack.dm | 2 +- code/game/objects/items/storage/bags.dm | 20 +++++++---- code/game/objects/items/storage/belt.dm | 29 ++++++++------- code/game/objects/items/storage/boxes.dm | 15 +++++--- code/game/objects/items/storage/fancy.dm | 12 +++---- code/game/objects/items/storage/firstaid.dm | 2 +- code/game/objects/items/storage/lockbox.dm | 2 +- code/game/objects/items/storage/secure.dm | 2 +- .../game/objects/items/storage/uplink_kits.dm | 2 +- code/game/objects/items/storage/wallets.dm | 6 ++-- code/modules/clothing/clothing.dm | 6 ++-- code/modules/holiday/easter.dm | 2 +- code/modules/mining/money_bag.dm | 4 +-- .../mob/living/carbon/human/human_defense.dm | 2 -- code/modules/photography/photos/album.dm | 2 +- .../projectiles/guns/energy/dueling.dm | 2 +- 23 files changed, 124 insertions(+), 77 deletions(-) diff --git a/code/__DEFINES/components.dm b/code/__DEFINES/components.dm index 544c85717c7e..1d14a17c382f 100644 --- a/code/__DEFINES/components.dm +++ b/code/__DEFINES/components.dm @@ -36,6 +36,7 @@ #define COMSIG_COMPONENT_REMOVING "component_removing" //before a component is removed from a datum because of RemoveComponent: (/datum/component) #define COMSIG_PARENT_PREQDELETED "parent_preqdeleted" //before a datum's Destroy() is called: (force), returning a nonzero value will cancel the qdel operation #define COMSIG_PARENT_QDELETED "parent_qdeleted" //after a datum's Destroy() is called: (force, qdel_hint), at this point none of the other components chose to interrupt qdel and Destroy has been called +#define COMSIG_TOPIC "handle_topic" //generic topic handler (usr, href_list) // /atom signals #define COMSIG_PARENT_ATTACKBY "atom_attackby" //from base of atom/attackby(): (/obj/item, /mob/living, params) @@ -255,19 +256,19 @@ #define COMSIG_NANITE_SYNC "nanite_sync" //(datum/component/nanites, full_overwrite, copy_activation) Called to sync the target's nanites to a given nanite component // /datum/component/storage signals -#define COMSIG_CONTAINS_STORAGE "is_storage" //() - returns bool. -#define COMSIG_TRY_STORAGE_INSERT "storage_try_insert" //(obj/item/inserting, mob/user, silent, force) - returns bool -#define COMSIG_TRY_STORAGE_SHOW "storage_show_to" //(mob/show_to, force) - returns bool. -#define COMSIG_TRY_STORAGE_HIDE_FROM "storage_hide_from" //(mob/hide_from) - returns bool -#define COMSIG_TRY_STORAGE_HIDE_ALL "storage_hide_all" //returns bool -#define COMSIG_TRY_STORAGE_SET_LOCKSTATE "storage_lock_set_state" //(newstate) -#define COMSIG_IS_STORAGE_LOCKED "storage_get_lockstate" //() - returns bool. MUST CHECK IF STORAGE IS THERE FIRST! -#define COMSIG_TRY_STORAGE_TAKE_TYPE "storage_take_type" //(type, atom/destination, amount = INFINITY, check_adjacent, force, mob/user, list/inserted) - returns bool - type can be a list of types. -#define COMSIG_TRY_STORAGE_FILL_TYPE "storage_fill_type" //(type, amount = INFINITY, force = FALSE) //don't fuck this up. Force will ignore max_items, and amount is normally clamped to max_items. -#define COMSIG_TRY_STORAGE_TAKE "storage_take_obj" //(obj, new_loc, force = FALSE) - returns bool -#define COMSIG_TRY_STORAGE_QUICK_EMPTY "storage_quick_empty" //(loc) - returns bool - if loc is null it will dump at parent location. +#define COMSIG_CONTAINS_STORAGE "is_storage" //() - returns bool. +#define COMSIG_TRY_STORAGE_INSERT "storage_try_insert" //(obj/item/inserting, mob/user, silent, force) - returns bool +#define COMSIG_TRY_STORAGE_SHOW "storage_show_to" //(mob/show_to, force) - returns bool. +#define COMSIG_TRY_STORAGE_HIDE_FROM "storage_hide_from" //(mob/hide_from) - returns bool +#define COMSIG_TRY_STORAGE_HIDE_ALL "storage_hide_all" //returns bool +#define COMSIG_TRY_STORAGE_SET_LOCKSTATE "storage_lock_set_state" //(newstate) +#define COMSIG_IS_STORAGE_LOCKED "storage_get_lockstate" //() - returns bool. MUST CHECK IF STORAGE IS THERE FIRST! +#define COMSIG_TRY_STORAGE_TAKE_TYPE "storage_take_type" //(type, atom/destination, amount = INFINITY, check_adjacent, force, mob/user, list/inserted) - returns bool - type can be a list of types. +#define COMSIG_TRY_STORAGE_FILL_TYPE "storage_fill_type" //(type, amount = INFINITY, force = FALSE) //don't fuck this up. Force will ignore max_items, and amount is normally clamped to max_items. +#define COMSIG_TRY_STORAGE_TAKE "storage_take_obj" //(obj, new_loc, force = FALSE) - returns bool +#define COMSIG_TRY_STORAGE_QUICK_EMPTY "storage_quick_empty" //(loc) - returns bool - if loc is null it will dump at parent location. #define COMSIG_TRY_STORAGE_RETURN_INVENTORY "storage_return_inventory" //(list/list_to_inject_results_into, recursively_search_inside_storages = TRUE) -#define COMSIG_TRY_STORAGE_CAN_INSERT "storage_can_equip" //(obj/item/insertion_candidate, mob/user, silent) - returns bool +#define COMSIG_TRY_STORAGE_CAN_INSERT "storage_can_equip" //(obj/item/insertion_candidate, mob/user, silent) - returns bool // /datum/action signals #define COMSIG_ACTION_TRIGGER "action_trigger" //from base of datum/action/proc/Trigger(): (datum/action) diff --git a/code/datums/components/storage/concrete/implant.dm b/code/datums/components/storage/concrete/implant.dm index 0348d340ae1b..95a929494dfe 100644 --- a/code/datums/components/storage/concrete/implant.dm +++ b/code/datums/components/storage/concrete/implant.dm @@ -9,7 +9,7 @@ /datum/component/storage/concrete/implant/Initialize() . = ..() - cant_hold = typecacheof(list(/obj/item/disk/nuclear)) + set_holdable(null, list(/obj/item/disk/nuclear)) /datum/component/storage/concrete/implant/InheritComponent(datum/component/storage/concrete/implant/I, original) if(!istype(I)) diff --git a/code/datums/components/storage/concrete/pockets.dm b/code/datums/components/storage/concrete/pockets.dm index ada34e076b85..1a4fae7b0bc5 100644 --- a/code/datums/components/storage/concrete/pockets.dm +++ b/code/datums/components/storage/concrete/pockets.dm @@ -43,24 +43,26 @@ /datum/component/storage/concrete/pockets/shoes/Initialize() . = ..() - cant_hold = typecacheof(list(/obj/item/screwdriver/power)) //Must be specifically called out since normal screwdrivers can fit but not the wrench form of the drill - can_hold = typecacheof(list( + set_holdable(list( /obj/item/kitchen/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 - )) + ), + list(/obj/item/screwdriver/power) + ) /datum/component/storage/concrete/pockets/shoes/clown/Initialize() . = ..() - cant_hold = typecacheof(list(/obj/item/screwdriver/power)) //Must be specifically called out since normal screwdrivers can fit but not the wrench form of the drill - can_hold = typecacheof(list( + set_holdable(list( /obj/item/kitchen/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/bikehorn)) + /obj/item/firing_pin, /obj/item/bikehorn), + list(/obj/item/screwdriver/power) + ) /datum/component/storage/concrete/pockets/pocketprotector max_items = 3 @@ -70,12 +72,13 @@ /datum/component/storage/concrete/pockets/pocketprotector/Initialize() original_parent = parent . = ..() - can_hold = typecacheof(list( //Same items as a PDA + 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/clothing/mask/cigarette) + ) /datum/component/storage/concrete/pockets/pocketprotector/real_location() // if the component is reparented to a jumpsuit, the items still go in the protector @@ -87,5 +90,5 @@ /datum/component/storage/concrete/pockets/small/helmet/Initialize() . = ..() - can_hold = typecacheof(list(/obj/item/reagent_containers/glass/bottle, + set_holdable(list(/obj/item/reagent_containers/glass/bottle, /obj/item/ammo_box/a762)) diff --git a/code/datums/components/storage/storage.dm b/code/datums/components/storage/storage.dm index 0285d83ff526..480b204e0c3a 100644 --- a/code/datums/components/storage/storage.dm +++ b/code/datums/components/storage/storage.dm @@ -14,9 +14,11 @@ dupe_mode = COMPONENT_DUPE_UNIQUE var/datum/component/storage/concrete/master //If not null, all actions act on master and this is just an access point. - var/list/can_hold //if this is set, only things in this typecache will fit, if within the size limit. - var/list/cant_hold //if this is set, anything in this typecache will not be able to fit. - var/list/exception_hold //if set, these items will be the exception to the max size of object that can fit. + var/list/can_hold //if this is set, only items, and their children, will fit + var/list/cant_hold //if this is set, items, and their children, won't fit + var/list/exception_hold //if set, these items will be the exception to the max size of object that can fit. + + var/can_hold_description var/list/mob/is_using //lazy list of mobs looking at the contents of this storage. @@ -82,6 +84,8 @@ RegisterSignal(parent, COMSIG_TRY_STORAGE_HIDE_ALL, .proc/close_all) RegisterSignal(parent, COMSIG_TRY_STORAGE_RETURN_INVENTORY, .proc/signal_return_inv) + RegisterSignal(parent, COMSIG_TOPIC, .proc/topic_handle) + RegisterSignal(parent, COMSIG_PARENT_ATTACKBY, .proc/attackby) RegisterSignal(parent, COMSIG_ATOM_ATTACK_HAND, .proc/on_attack_hand) @@ -115,6 +119,24 @@ /datum/component/storage/PreTransfer() update_actions() +/datum/component/storage/proc/set_holdable(can_hold_list, cant_hold_list) + can_hold_description = generate_hold_desc(can_hold_list) + + if (can_hold_list != null) + can_hold = typecacheof(can_hold_list) + + if (cant_hold_list != null) + cant_hold = typecacheof(cant_hold_list) + +/datum/component/storage/proc/generate_hold_desc(can_hold_list) + var/list/desc = list() + + for(var/valid_type in can_hold_list) + var/obj/item/valid_item = valid_type + desc += "\a [initial(valid_item.name)]" + + return "\n\t[desc.Join("\n\t")]" + /datum/component/storage/proc/update_actions() QDEL_NULL(modeswitch_action) if(!isitem(parent) || !allow_quick_gather) @@ -502,6 +524,13 @@ interface |= return_inv(recursive) return TRUE +/datum/component/storage/proc/topic_handle(datum/source, user, href_list) + if(href_list["show_valid_pocket_items"]) + handle_show_valid_items(source, user) + +/datum/component/storage/proc/handle_show_valid_items(datum/source, user) + to_chat(user, "[source] can hold: [can_hold_description]") + /datum/component/storage/proc/mousedrop_onto(datum/source, atom/over_object, mob/M) set waitfor = FALSE . = COMPONENT_NO_MOUSEDROP diff --git a/code/datums/datum.dm b/code/datums/datum.dm index 5c0935b05939..111675dbfcd9 100644 --- a/code/datums/datum.dm +++ b/code/datums/datum.dm @@ -19,6 +19,10 @@ var/list/cached_vars #endif +/datum/Topic(href, href_list[]) + ..() + SEND_SIGNAL(src, COMSIG_TOPIC, usr, href_list) + // Default implementation of clean-up code. // This should be overridden to remove all references pointing to the object being destroyed. // Return the appropriate QDEL_HINT; in most cases this is QDEL_HINT_QUEUE. diff --git a/code/game/objects/items/crayons.dm b/code/game/objects/items/crayons.dm index ce81f8bad4a8..79bb99f634bf 100644 --- a/code/game/objects/items/crayons.dm +++ b/code/game/objects/items/crayons.dm @@ -525,7 +525,7 @@ . = ..() GET_COMPONENT(STR, /datum/component/storage) STR.max_items = 7 - STR.can_hold = typecacheof(list(/obj/item/toy/crayon)) + STR.set_holdable(list(/obj/item/toy/crayon)) /obj/item/storage/crayons/PopulateContents() new /obj/item/toy/crayon/red(src) diff --git a/code/game/objects/items/pneumaticCannon.dm b/code/game/objects/items/pneumaticCannon.dm index 70cde4c75e1a..7013824feb6a 100644 --- a/code/game/objects/items/pneumaticCannon.dm +++ b/code/game/objects/items/pneumaticCannon.dm @@ -326,7 +326,7 @@ STR.max_items = 20 STR.max_combined_w_class = 40 STR.display_numerical_stacking = TRUE - STR.can_hold = typecacheof(list( + STR.set_holdable(list( /obj/item/throwing_star/magspear )) diff --git a/code/game/objects/items/storage/backpack.dm b/code/game/objects/items/storage/backpack.dm index f13fe2f593e4..9171fb12e2df 100644 --- a/code/game/objects/items/storage/backpack.dm +++ b/code/game/objects/items/storage/backpack.dm @@ -305,7 +305,7 @@ . = ..() GET_COMPONENT(STR, /datum/component/storage) STR.max_combined_w_class = 15 - STR.cant_hold = typecacheof(list(/obj/item/storage/backpack/satchel/flat)) //muh recursive backpacks + STR.set_holdable(null, list(/obj/item/storage/backpack/satchel/flat)) //muh recursive backpacks) /obj/item/storage/backpack/satchel/flat/hide(intact) if(intact) diff --git a/code/game/objects/items/storage/bags.dm b/code/game/objects/items/storage/bags.dm index a651b91c495a..cd39a9ea2185 100644 --- a/code/game/objects/items/storage/bags.dm +++ b/code/game/objects/items/storage/bags.dm @@ -48,7 +48,7 @@ STR.max_w_class = WEIGHT_CLASS_SMALL STR.max_combined_w_class = 30 STR.max_items = 30 - STR.cant_hold = typecacheof(list(/obj/item/disk/nuclear)) + STR.set_holdable(null, list(/obj/item/disk/nuclear)) /obj/item/storage/bag/trash/suicide_act(mob/user) user.visible_message("[user] puts [src] over [user.p_their()] head and starts chomping at the insides! Disgusting!") @@ -114,7 +114,7 @@ . = ..() GET_COMPONENT(STR, /datum/component/storage/concrete/stack) STR.allow_quick_empty = TRUE - STR.can_hold = typecacheof(list(/obj/item/stack/ore)) + STR.set_holdable(list(/obj/item/stack/ore)) STR.max_w_class = WEIGHT_CLASS_HUGE STR.max_combined_stack_amount = 50 @@ -195,8 +195,7 @@ STR.max_w_class = WEIGHT_CLASS_NORMAL STR.max_combined_w_class = 100 STR.max_items = 100 - STR.can_hold = typecacheof(list(/obj/item/reagent_containers/food/snacks/grown, /obj/item/seeds, /obj/item/grown, /obj/item/reagent_containers/honeycomb)) - + STR.set_holdable(list(/obj/item/reagent_containers/food/snacks/grown, /obj/item/seeds, /obj/item/grown, /obj/item/reagent_containers/honeycomb)) //////// /obj/item/storage/bag/plants/portaseeder @@ -233,8 +232,7 @@ . = ..() GET_COMPONENT(STR, /datum/component/storage/concrete/stack) STR.allow_quick_empty = TRUE - STR.can_hold = typecacheof(list(/obj/item/stack/sheet)) - STR.cant_hold = typecacheof(list(/obj/item/stack/sheet/mineral/sandstone, /obj/item/stack/sheet/mineral/wood)) + STR.set_holdable(list(/obj/item/stack/sheet), list(/obj/item/stack/sheet/mineral/sandstone, /obj/item/stack/sheet/mineral/wood)) STR.max_combined_stack_amount = 300 // ----------------------------- @@ -270,7 +268,7 @@ STR.max_combined_w_class = 21 STR.max_items = 7 STR.display_numerical_stacking = FALSE - STR.can_hold = typecacheof(list(/obj/item/book, /obj/item/storage/book, /obj/item/spellbook)) + STR.set_holdable(list(/obj/item/book, /obj/item/storage/book, /obj/item/spellbook)) /* * Trays - Agouri @@ -348,7 +346,11 @@ STR.max_combined_w_class = 200 STR.max_items = 50 STR.insert_preposition = "in" +<<<<<<< HEAD STR.can_hold = typecacheof(list(/obj/item/reagent_containers/pill, /obj/item/reagent_containers/glass/beaker, /obj/item/reagent_containers/glass/bottle)) +======= + STR.set_holdable(list(/obj/item/reagent_containers/pill, /obj/item/reagent_containers/glass/beaker, /obj/item/reagent_containers/glass/bottle, /obj/item/reagent_containers/medspray, /obj/item/reagent_containers/syringe, /obj/item/reagent_containers/dropper)) +>>>>>>> 2d32be1904... Small storage refactor and examine change (#44109) /* * Biowaste bag (mostly for xenobiologists) @@ -368,4 +370,8 @@ STR.max_combined_w_class = 200 STR.max_items = 25 STR.insert_preposition = "in" +<<<<<<< HEAD STR.can_hold = typecacheof(list(/obj/item/slime_extract, /obj/item/reagent_containers/syringe, /obj/item/reagent_containers/glass/beaker, /obj/item/reagent_containers/glass/bottle, /obj/item/reagent_containers/blood, /obj/item/reagent_containers/hypospray/medipen, /obj/item/reagent_containers/food/snacks/deadmouse, /obj/item/reagent_containers/food/snacks/monkeycube)) +======= + STR.set_holdable(list(/obj/item/slime_extract, /obj/item/reagent_containers/syringe, /obj/item/reagent_containers/dropper, /obj/item/reagent_containers/glass/beaker, /obj/item/reagent_containers/glass/bottle, /obj/item/reagent_containers/blood, /obj/item/reagent_containers/hypospray/medipen, /obj/item/reagent_containers/food/snacks/deadmouse, /obj/item/reagent_containers/food/snacks/monkeycube)) +>>>>>>> 2d32be1904... Small storage refactor and examine change (#44109) diff --git a/code/game/objects/items/storage/belt.dm b/code/game/objects/items/storage/belt.dm index a661b9946cab..f31fad62f132 100644 --- a/code/game/objects/items/storage/belt.dm +++ b/code/game/objects/items/storage/belt.dm @@ -43,7 +43,7 @@ /obj/item/storage/belt/utility/ComponentInitialize() . = ..() GET_COMPONENT(STR, /datum/component/storage) - var/static/list/can_hold = typecacheof(list( + STR.set_holdable(list( /obj/item/crowbar, /obj/item/screwdriver, /obj/item/weldingtool, @@ -64,7 +64,6 @@ /obj/item/assembly/signaler, /obj/item/lightreplacer )) - STR.can_hold = can_hold /obj/item/storage/belt/utility/chief name = "\improper Chief Engineer's toolbelt" //"the Chief Engineer's toolbelt", because "Chief Engineer's toolbelt" is not a proper noun @@ -129,7 +128,7 @@ . = ..() GET_COMPONENT(STR, /datum/component/storage) STR.max_w_class = WEIGHT_CLASS_BULKY - STR.can_hold = typecacheof(list( + STR.set_holdable(list( /obj/item/healthanalyzer, /obj/item/dnainjector, /obj/item/reagent_containers/dropper, @@ -190,7 +189,7 @@ GET_COMPONENT(STR, /datum/component/storage) STR.max_items = 5 STR.max_w_class = WEIGHT_CLASS_NORMAL - STR.can_hold = typecacheof(list( + STR.set_holdable(list( /obj/item/melee/baton, /obj/item/melee/classic_baton, /obj/item/grenade, @@ -244,7 +243,7 @@ STR.max_items = 6 STR.max_w_class = WEIGHT_CLASS_BULKY STR.max_combined_w_class = 20 - STR.can_hold = typecacheof(list( + STR.set_holdable(list( /obj/item/crowbar, /obj/item/screwdriver, /obj/item/weldingtool, @@ -312,7 +311,7 @@ . = ..() GET_COMPONENT(STR, /datum/component/storage) STR.max_items = 6 - STR.can_hold = typecacheof(list( + STR.set_holdable(list( /obj/item/soulstone )) @@ -335,9 +334,9 @@ . = ..() GET_COMPONENT(STR, /datum/component/storage) STR.max_items = 1 - STR.can_hold = list( + STR.set_holdable(list( /obj/item/clothing/mask/luchador - ) + )) /obj/item/storage/belt/military name = "chest rig" @@ -364,7 +363,7 @@ GET_COMPONENT(STR, /datum/component/storage) STR.max_items = 6 STR.max_w_class = WEIGHT_CLASS_SMALL - STR.can_hold = typecacheof(list( + STR.set_holdable(list( /obj/item/reagent_containers/food/snacks, /obj/item/reagent_containers/food/drinks )) @@ -444,7 +443,7 @@ STR.display_numerical_stacking = TRUE STR.max_combined_w_class = 60 STR.max_w_class = WEIGHT_CLASS_BULKY - STR.can_hold = typecacheof(list( + STR.set_holdable(list( /obj/item/grenade, /obj/item/screwdriver, /obj/item/lighter, @@ -479,7 +478,7 @@ . = ..() GET_COMPONENT(STR, /datum/component/storage) STR.max_items = 6 - STR.can_hold = typecacheof(list( + STR.set_holdable(list( /obj/item/gun/magic/wand )) @@ -506,7 +505,7 @@ GET_COMPONENT(STR, /datum/component/storage) STR.max_items = 6 STR.max_w_class = WEIGHT_CLASS_BULKY // Set to this so the light replacer can fit. - STR.can_hold = typecacheof(list( + STR.set_holdable(list( /obj/item/grenade/chem_grenade, /obj/item/lightreplacer, /obj/item/flashlight, @@ -538,7 +537,7 @@ GET_COMPONENT(STR, /datum/component/storage) STR.max_items = 18 STR.display_numerical_stacking = TRUE - STR.can_hold = typecacheof(list( + STR.set_holdable(list( /obj/item/ammo_casing/shotgun )) @@ -554,7 +553,7 @@ GET_COMPONENT(STR, /datum/component/storage) STR.max_items = 3 STR.max_w_class = WEIGHT_CLASS_NORMAL - STR.can_hold = typecacheof(list( + STR.set_holdable(list( /obj/item/gun/ballistic/automatic/pistol, /obj/item/gun/ballistic/revolver, /obj/item/ammo_box, @@ -654,7 +653,7 @@ STR.max_items = 1 STR.rustle_sound = FALSE STR.max_w_class = WEIGHT_CLASS_BULKY - STR.can_hold = typecacheof(list( + STR.set_holdable(list( /obj/item/melee/sabre )) diff --git a/code/game/objects/items/storage/boxes.dm b/code/game/objects/items/storage/boxes.dm index 2451fb6fc268..a6d425ab59d5 100644 --- a/code/game/objects/items/storage/boxes.dm +++ b/code/game/objects/items/storage/boxes.dm @@ -402,7 +402,7 @@ /obj/item/storage/box/donkpockets/ComponentInitialize() . = ..() GET_COMPONENT(STR, /datum/component/storage) - STR.can_hold = typecacheof(list(/obj/item/reagent_containers/food/snacks/donkpocket)) + STR.set_holdable(list(/obj/item/reagent_containers/food/snacks/donkpocket)) /obj/item/storage/box/donkpockets/PopulateContents() for(var/i in 1 to 6) @@ -419,7 +419,7 @@ . = ..() GET_COMPONENT(STR, /datum/component/storage) STR.max_items = 7 - STR.can_hold = typecacheof(list(/obj/item/reagent_containers/food/snacks/monkeycube)) + STR.set_holdable(list(/obj/item/reagent_containers/food/snacks/monkeycube)) /obj/item/storage/box/monkeycubes/PopulateContents() for(var/i in 1 to 5) @@ -439,7 +439,7 @@ . = ..() GET_COMPONENT(STR, /datum/component/storage) STR.max_items = 3 - STR.can_hold = typecacheof(list(/obj/item/reagent_containers/food/snacks/monkeycube)) + STR.set_holdable(list(/obj/item/reagent_containers/food/snacks/monkeycube)) /obj/item/storage/box/gorillacubes/PopulateContents() for(var/i in 1 to 3) @@ -591,7 +591,7 @@ /obj/item/storage/box/snappops/ComponentInitialize() . = ..() GET_COMPONENT(STR, /datum/component/storage) - STR.can_hold = typecacheof(list(/obj/item/toy/snappop)) + STR.set_holdable(list(/obj/item/toy/snappop)) STR.max_items = 8 /obj/item/storage/box/snappops/PopulateContents() @@ -610,8 +610,13 @@ . = ..() GET_COMPONENT(STR, /datum/component/storage) STR.max_items = 10 +<<<<<<< HEAD STR.can_hold = typecacheof(list(/obj/item/match)) // yogs start -- make matches play nice with holodeck +======= + STR.set_holdable(list(/obj/item/match)) + +>>>>>>> 2d32be1904... Small storage refactor and examine change (#44109) /obj/item/storage/box/matches/PopulateContents() for(var/i in 1 to 10) new /obj/item/match(src) @@ -634,7 +639,7 @@ . = ..() GET_COMPONENT(STR, /datum/component/storage) STR.max_items = 21 - STR.can_hold = typecacheof(list(/obj/item/light/tube, /obj/item/light/bulb)) + STR.set_holdable(list(/obj/item/light/tube, /obj/item/light/bulb)) STR.max_combined_w_class = 21 STR.click_gather = FALSE //temp workaround to re-enable filling the light replacer with the box diff --git a/code/game/objects/items/storage/fancy.dm b/code/game/objects/items/storage/fancy.dm index 95639918bb4d..52a20ea6462a 100644 --- a/code/game/objects/items/storage/fancy.dm +++ b/code/game/objects/items/storage/fancy.dm @@ -74,7 +74,7 @@ . = ..() GET_COMPONENT(STR, /datum/component/storage) STR.max_items = 6 - STR.can_hold = typecacheof(list(/obj/item/reagent_containers/food/snacks/donut)) + STR.set_holdable(list(/obj/item/reagent_containers/food/snacks/donut)) /* * Egg Box @@ -95,7 +95,7 @@ . = ..() GET_COMPONENT(STR, /datum/component/storage) STR.max_items = 12 - STR.can_hold = typecacheof(list(/obj/item/reagent_containers/food/snacks/egg)) + STR.set_holdable(list(/obj/item/reagent_containers/food/snacks/egg)) /* * Candle Box @@ -140,7 +140,7 @@ . = ..() GET_COMPONENT(STR, /datum/component/storage) STR.max_items = 6 - STR.can_hold = typecacheof(list(/obj/item/clothing/mask/cigarette, /obj/item/lighter)) + STR.set_holdable(list(/obj/item/clothing/mask/cigarette, /obj/item/lighter)) /obj/item/storage/fancy/cigarettes/examine(mob/user) ..() @@ -278,7 +278,7 @@ . = ..() GET_COMPONENT(STR, /datum/component/storage) STR.max_items = 10 - STR.can_hold = typecacheof(list(/obj/item/rollingpaper)) + STR.set_holdable(list(/obj/item/rollingpaper)) /obj/item/storage/fancy/rollingpapers/update_icon() cut_overlays() @@ -302,7 +302,7 @@ . = ..() GET_COMPONENT(STR, /datum/component/storage) STR.max_items = 5 - STR.can_hold = typecacheof(list(/obj/item/clothing/mask/cigarette/cigar)) + STR.set_holdable(list(/obj/item/clothing/mask/cigarette/cigar)) /obj/item/storage/fancy/cigarettes/cigars/update_icon() cut_overlays() @@ -349,4 +349,4 @@ . = ..() GET_COMPONENT(STR, /datum/component/storage) STR.max_items = 8 - STR.can_hold = typecacheof(list(/obj/item/reagent_containers/food/snacks/tinychocolate)) + STR.set_holdable(list(/obj/item/reagent_containers/food/snacks/tinychocolate)) diff --git a/code/game/objects/items/storage/firstaid.dm b/code/game/objects/items/storage/firstaid.dm index 531ac28eeab8..ac35677e7368 100644 --- a/code/game/objects/items/storage/firstaid.dm +++ b/code/game/objects/items/storage/firstaid.dm @@ -219,7 +219,7 @@ GET_COMPONENT(STR, /datum/component/storage) STR.allow_quick_gather = TRUE STR.click_gather = TRUE - STR.can_hold = typecacheof(list(/obj/item/reagent_containers/pill, /obj/item/dice)) + STR.set_holdable(list(/obj/item/reagent_containers/pill, /obj/item/dice)) /obj/item/storage/pill_bottle/suicide_act(mob/user) user.visible_message("[user] is trying to get the cap off [src]! It looks like [user.p_theyre()] trying to commit suicide!") diff --git a/code/game/objects/items/storage/lockbox.dm b/code/game/objects/items/storage/lockbox.dm index bce38548cc9a..33df3e408558 100644 --- a/code/game/objects/items/storage/lockbox.dm +++ b/code/game/objects/items/storage/lockbox.dm @@ -103,7 +103,7 @@ STR.max_w_class = WEIGHT_CLASS_SMALL STR.max_items = 10 STR.max_combined_w_class = 20 - STR.can_hold = typecacheof(list(/obj/item/clothing/accessory/medal)) + STR.set_holdable(list(/obj/item/clothing/accessory/medal)) /obj/item/storage/lockbox/medal/examine(mob/user) ..() diff --git a/code/game/objects/items/storage/secure.dm b/code/game/objects/items/storage/secure.dm index e7ee1552b8cb..7abbc3cc4df6 100644 --- a/code/game/objects/items/storage/secure.dm +++ b/code/game/objects/items/storage/secure.dm @@ -171,7 +171,7 @@ /obj/item/storage/secure/safe/ComponentInitialize() . = ..() GET_COMPONENT(STR, /datum/component/storage) - STR.cant_hold = typecacheof(list(/obj/item/storage/secure/briefcase)) + STR.set_holdable(null, list(/obj/item/storage/secure/briefcase)) STR.max_w_class = 8 //?? /obj/item/storage/secure/safe/PopulateContents() diff --git a/code/game/objects/items/storage/uplink_kits.dm b/code/game/objects/items/storage/uplink_kits.dm index 826a96a3c8b3..b04977dbac6f 100644 --- a/code/game/objects/items/storage/uplink_kits.dm +++ b/code/game/objects/items/storage/uplink_kits.dm @@ -257,7 +257,7 @@ . = ..() GET_COMPONENT(STR, /datum/component/storage) STR.max_w_class = WEIGHT_CLASS_NORMAL - STR.can_hold = typecacheof(list(/obj/item/clothing/suit/space/syndicate, /obj/item/clothing/head/helmet/space/syndicate)) + STR.set_holdable(list(/obj/item/clothing/suit/space/syndicate, /obj/item/clothing/head/helmet/space/syndicate)) /obj/item/storage/box/syndie_kit/space/PopulateContents() if(prob(50)) diff --git a/code/game/objects/items/storage/wallets.dm b/code/game/objects/items/storage/wallets.dm index 0b28a103c077..b765665f7423 100644 --- a/code/game/objects/items/storage/wallets.dm +++ b/code/game/objects/items/storage/wallets.dm @@ -13,8 +13,7 @@ . = ..() GET_COMPONENT(STR, /datum/component/storage) STR.max_items = 4 - STR.cant_hold = typecacheof(list(/obj/item/screwdriver/power)) //Must be specifically called out since normal screwdrivers can fit but not the wrench form of the drill - STR.can_hold = typecacheof(list( + STR.set_holdable(list( /obj/item/stack/spacecash, /obj/item/holochip, /obj/item/card, @@ -36,7 +35,8 @@ /obj/item/reagent_containers/dropper, /obj/item/reagent_containers/syringe, /obj/item/screwdriver, - /obj/item/stamp)) + /obj/item/stamp), + list(/obj/item/screwdriver/power)) /obj/item/storage/wallet/Exited(atom/movable/AM) . = ..() diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm index 107ad218933e..c1ca42342424 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -124,8 +124,10 @@ how_cool_are_your_threads += "[src]'s storage opens when clicked.\n" else how_cool_are_your_threads += "[src]'s storage opens when dragged to yourself.\n" - how_cool_are_your_threads += "[src] can store [pockets.max_items] item\s.\n" - how_cool_are_your_threads += "[src] can store items that are [weightclass2text(pockets.max_w_class)] or smaller.\n" + if (!pockets.can_hold.len) // If pocket type can hold anything, vs only specific items + how_cool_are_your_threads += "[src] can store [pockets.max_items] item\s that are [weightclass2text(pockets.max_w_class)] or smaller.\n" + else + how_cool_are_your_threads += "[src] can store [pockets.max_items] item\s.\n" if(pockets.quickdraw) how_cool_are_your_threads += "You can quickly remove an item from [src] using Alt-Click.\n" if(pockets.silent) diff --git a/code/modules/holiday/easter.dm b/code/modules/holiday/easter.dm index 84cffbaca6ec..f35735d2d81b 100644 --- a/code/modules/holiday/easter.dm +++ b/code/modules/holiday/easter.dm @@ -69,7 +69,7 @@ /obj/item/storage/bag/easterbasket/Initialize() . = ..() GET_COMPONENT(STR, /datum/component/storage) - STR.can_hold = typecacheof(list(/obj/item/reagent_containers/food/snacks/egg, /obj/item/reagent_containers/food/snacks/chocolateegg, /obj/item/reagent_containers/food/snacks/boiledegg)) + STR.set_holdable(list(/obj/item/reagent_containers/food/snacks/egg, /obj/item/reagent_containers/food/snacks/chocolateegg, /obj/item/reagent_containers/food/snacks/boiledegg)) /obj/item/storage/bag/easterbasket/proc/countEggs() cut_overlays() diff --git a/code/modules/mining/money_bag.dm b/code/modules/mining/money_bag.dm index 5d2fc6f4bd8f..92a6d34c4b3d 100644 --- a/code/modules/mining/money_bag.dm +++ b/code/modules/mining/money_bag.dm @@ -15,7 +15,7 @@ STR.max_w_class = WEIGHT_CLASS_NORMAL STR.max_items = 40 STR.max_combined_w_class = 40 - STR.can_hold = typecacheof(list(/obj/item/coin, /obj/item/stack/spacecash, /obj/item/holochip)) + STR.set_holdable(list(/obj/item/coin, /obj/item/stack/spacecash, /obj/item/holochip)) /obj/item/storage/bag/money/vault/PopulateContents() new /obj/item/coin/silver(src) @@ -24,4 +24,4 @@ new /obj/item/coin/silver(src) new /obj/item/coin/gold(src) new /obj/item/coin/gold(src) - new /obj/item/coin/adamantine(src) \ No newline at end of file + new /obj/item/coin/adamantine(src) diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index c1bf51259f76..0c727a3c501a 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -684,8 +684,6 @@ to_chat(src, "You succesfuly remove the durathread strand.") remove_status_effect(STATUS_EFFECT_CHOKINGSTRAND) return - visible_message("[src] examines [p_them()]self.", \ - "You check yourself for injuries.") check_self_for_injuries() diff --git a/code/modules/photography/photos/album.dm b/code/modules/photography/photos/album.dm index bd77d468d739..ef2b803b9db2 100644 --- a/code/modules/photography/photos/album.dm +++ b/code/modules/photography/photos/album.dm @@ -14,7 +14,7 @@ /obj/item/storage/photo_album/Initialize() . = ..() GET_COMPONENT(STR, /datum/component/storage) - STR.can_hold = typecacheof(list(/obj/item/photo)) + STR.set_holdable(list(/obj/item/photo)) STR.max_combined_w_class = 42 STR.max_items = 21 LAZYADD(SSpersistence.photo_albums, src) diff --git a/code/modules/projectiles/guns/energy/dueling.dm b/code/modules/projectiles/guns/energy/dueling.dm index 35517d6d3935..de8c630b1151 100644 --- a/code/modules/projectiles/guns/energy/dueling.dm +++ b/code/modules/projectiles/guns/energy/dueling.dm @@ -321,7 +321,7 @@ GET_COMPONENT(STR, /datum/component/storage) STR.max_w_class = WEIGHT_CLASS_SMALL STR.max_items = 2 - STR.can_hold = typecacheof(list(/obj/item/gun/energy/dueling)) + STR.set_holdable(list(/obj/item/gun/energy/dueling)) /obj/item/storage/lockbox/dueling/update_icon() cut_overlays()