Small storage refactor and examine change

This commit is contained in:
Joe Schmoe
2019-06-08 20:48:29 +02:00
parent 7a823ca965
commit 2ce3bb43e4
23 changed files with 124 additions and 77 deletions

View File

@@ -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_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_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_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 // /atom signals
#define COMSIG_PARENT_ATTACKBY "atom_attackby" //from base of atom/attackby(): (/obj/item, /mob/living, params) #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 #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 // /datum/component/storage signals
#define COMSIG_CONTAINS_STORAGE "is_storage" //() - returns bool. #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_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_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_FROM "storage_hide_from" //(mob/hide_from) - returns bool
#define COMSIG_TRY_STORAGE_HIDE_ALL "storage_hide_all" //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_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_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_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_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_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_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_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 // /datum/action signals
#define COMSIG_ACTION_TRIGGER "action_trigger" //from base of datum/action/proc/Trigger(): (datum/action) #define COMSIG_ACTION_TRIGGER "action_trigger" //from base of datum/action/proc/Trigger(): (datum/action)

View File

@@ -9,7 +9,7 @@
/datum/component/storage/concrete/implant/Initialize() /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) /datum/component/storage/concrete/implant/InheritComponent(datum/component/storage/concrete/implant/I, original)
if(!istype(I)) if(!istype(I))

View File

@@ -43,24 +43,26 @@
/datum/component/storage/concrete/pockets/shoes/Initialize() /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 set_holdable(list(
can_hold = typecacheof(list(
/obj/item/kitchen/knife, /obj/item/switchblade, /obj/item/pen, /obj/item/kitchen/knife, /obj/item/switchblade, /obj/item/pen,
/obj/item/scalpel, /obj/item/reagent_containers/syringe, /obj/item/dnainjector, /obj/item/scalpel, /obj/item/reagent_containers/syringe, /obj/item/dnainjector,
/obj/item/reagent_containers/hypospray/medipen, /obj/item/reagent_containers/dropper, /obj/item/reagent_containers/hypospray/medipen, /obj/item/reagent_containers/dropper,
/obj/item/implanter, /obj/item/screwdriver, /obj/item/weldingtool/mini, /obj/item/implanter, /obj/item/screwdriver, /obj/item/weldingtool/mini,
/obj/item/firing_pin /obj/item/firing_pin
)) ),
list(/obj/item/screwdriver/power)
)
/datum/component/storage/concrete/pockets/shoes/clown/Initialize() /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 set_holdable(list(
can_hold = typecacheof(list(
/obj/item/kitchen/knife, /obj/item/switchblade, /obj/item/pen, /obj/item/kitchen/knife, /obj/item/switchblade, /obj/item/pen,
/obj/item/scalpel, /obj/item/reagent_containers/syringe, /obj/item/dnainjector, /obj/item/scalpel, /obj/item/reagent_containers/syringe, /obj/item/dnainjector,
/obj/item/reagent_containers/hypospray/medipen, /obj/item/reagent_containers/dropper, /obj/item/reagent_containers/hypospray/medipen, /obj/item/reagent_containers/dropper,
/obj/item/implanter, /obj/item/screwdriver, /obj/item/weldingtool/mini, /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 /datum/component/storage/concrete/pockets/pocketprotector
max_items = 3 max_items = 3
@@ -70,12 +72,13 @@
/datum/component/storage/concrete/pockets/pocketprotector/Initialize() /datum/component/storage/concrete/pockets/pocketprotector/Initialize()
original_parent = parent 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/pen,
/obj/item/toy/crayon, /obj/item/toy/crayon,
/obj/item/lipstick, /obj/item/lipstick,
/obj/item/flashlight/pen, /obj/item/flashlight/pen,
/obj/item/clothing/mask/cigarette)) /obj/item/clothing/mask/cigarette)
)
/datum/component/storage/concrete/pockets/pocketprotector/real_location() /datum/component/storage/concrete/pockets/pocketprotector/real_location()
// if the component is reparented to a jumpsuit, the items still go in the protector // 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() /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)) /obj/item/ammo_box/a762))

View File

@@ -14,9 +14,11 @@
dupe_mode = COMPONENT_DUPE_UNIQUE 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/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/can_hold //if this is set, only items, and their children, will fit
var/list/cant_hold //if this is set, anything in this typecache will not be able to 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/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. 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_HIDE_ALL, .proc/close_all)
RegisterSignal(parent, COMSIG_TRY_STORAGE_RETURN_INVENTORY, .proc/signal_return_inv) 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_PARENT_ATTACKBY, .proc/attackby)
RegisterSignal(parent, COMSIG_ATOM_ATTACK_HAND, .proc/on_attack_hand) RegisterSignal(parent, COMSIG_ATOM_ATTACK_HAND, .proc/on_attack_hand)
@@ -115,6 +119,24 @@
/datum/component/storage/PreTransfer() /datum/component/storage/PreTransfer()
update_actions() 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<span class='notice'>[desc.Join("\n\t")]</span>"
/datum/component/storage/proc/update_actions() /datum/component/storage/proc/update_actions()
QDEL_NULL(modeswitch_action) QDEL_NULL(modeswitch_action)
if(!isitem(parent) || !allow_quick_gather) if(!isitem(parent) || !allow_quick_gather)
@@ -502,6 +524,13 @@
interface |= return_inv(recursive) interface |= return_inv(recursive)
return TRUE 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, "<span class='notice'>[source] can hold: [can_hold_description]</span>")
/datum/component/storage/proc/mousedrop_onto(datum/source, atom/over_object, mob/M) /datum/component/storage/proc/mousedrop_onto(datum/source, atom/over_object, mob/M)
set waitfor = FALSE set waitfor = FALSE
. = COMPONENT_NO_MOUSEDROP . = COMPONENT_NO_MOUSEDROP

View File

@@ -19,6 +19,10 @@
var/list/cached_vars var/list/cached_vars
#endif #endif
/datum/Topic(href, href_list[])
..()
SEND_SIGNAL(src, COMSIG_TOPIC, usr, href_list)
// Default implementation of clean-up code. // Default implementation of clean-up code.
// This should be overridden to remove all references pointing to the object being destroyed. // 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. // Return the appropriate QDEL_HINT; in most cases this is QDEL_HINT_QUEUE.

View File

@@ -525,7 +525,7 @@
. = ..() . = ..()
GET_COMPONENT(STR, /datum/component/storage) GET_COMPONENT(STR, /datum/component/storage)
STR.max_items = 7 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() /obj/item/storage/crayons/PopulateContents()
new /obj/item/toy/crayon/red(src) new /obj/item/toy/crayon/red(src)

View File

@@ -326,7 +326,7 @@
STR.max_items = 20 STR.max_items = 20
STR.max_combined_w_class = 40 STR.max_combined_w_class = 40
STR.display_numerical_stacking = TRUE STR.display_numerical_stacking = TRUE
STR.can_hold = typecacheof(list( STR.set_holdable(list(
/obj/item/throwing_star/magspear /obj/item/throwing_star/magspear
)) ))

View File

@@ -305,7 +305,7 @@
. = ..() . = ..()
GET_COMPONENT(STR, /datum/component/storage) GET_COMPONENT(STR, /datum/component/storage)
STR.max_combined_w_class = 15 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) /obj/item/storage/backpack/satchel/flat/hide(intact)
if(intact) if(intact)

View File

@@ -48,7 +48,7 @@
STR.max_w_class = WEIGHT_CLASS_SMALL STR.max_w_class = WEIGHT_CLASS_SMALL
STR.max_combined_w_class = 30 STR.max_combined_w_class = 30
STR.max_items = 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) /obj/item/storage/bag/trash/suicide_act(mob/user)
user.visible_message("<span class='suicide'>[user] puts [src] over [user.p_their()] head and starts chomping at the insides! Disgusting!</span>") user.visible_message("<span class='suicide'>[user] puts [src] over [user.p_their()] head and starts chomping at the insides! Disgusting!</span>")
@@ -114,7 +114,7 @@
. = ..() . = ..()
GET_COMPONENT(STR, /datum/component/storage/concrete/stack) GET_COMPONENT(STR, /datum/component/storage/concrete/stack)
STR.allow_quick_empty = TRUE 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_w_class = WEIGHT_CLASS_HUGE
STR.max_combined_stack_amount = 50 STR.max_combined_stack_amount = 50
@@ -195,8 +195,7 @@
STR.max_w_class = WEIGHT_CLASS_NORMAL STR.max_w_class = WEIGHT_CLASS_NORMAL
STR.max_combined_w_class = 100 STR.max_combined_w_class = 100
STR.max_items = 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 /obj/item/storage/bag/plants/portaseeder
@@ -233,8 +232,7 @@
. = ..() . = ..()
GET_COMPONENT(STR, /datum/component/storage/concrete/stack) GET_COMPONENT(STR, /datum/component/storage/concrete/stack)
STR.allow_quick_empty = TRUE STR.allow_quick_empty = TRUE
STR.can_hold = typecacheof(list(/obj/item/stack/sheet)) STR.set_holdable(list(/obj/item/stack/sheet), list(/obj/item/stack/sheet/mineral/sandstone, /obj/item/stack/sheet/mineral/wood))
STR.cant_hold = typecacheof(list(/obj/item/stack/sheet/mineral/sandstone, /obj/item/stack/sheet/mineral/wood))
STR.max_combined_stack_amount = 300 STR.max_combined_stack_amount = 300
// ----------------------------- // -----------------------------
@@ -270,7 +268,7 @@
STR.max_combined_w_class = 21 STR.max_combined_w_class = 21
STR.max_items = 7 STR.max_items = 7
STR.display_numerical_stacking = FALSE 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 * Trays - Agouri
@@ -348,7 +346,11 @@
STR.max_combined_w_class = 200 STR.max_combined_w_class = 200
STR.max_items = 50 STR.max_items = 50
STR.insert_preposition = "in" 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.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) * Biowaste bag (mostly for xenobiologists)
@@ -368,4 +370,8 @@
STR.max_combined_w_class = 200 STR.max_combined_w_class = 200
STR.max_items = 25 STR.max_items = 25
STR.insert_preposition = "in" 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.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)

View File

@@ -43,7 +43,7 @@
/obj/item/storage/belt/utility/ComponentInitialize() /obj/item/storage/belt/utility/ComponentInitialize()
. = ..() . = ..()
GET_COMPONENT(STR, /datum/component/storage) GET_COMPONENT(STR, /datum/component/storage)
var/static/list/can_hold = typecacheof(list( STR.set_holdable(list(
/obj/item/crowbar, /obj/item/crowbar,
/obj/item/screwdriver, /obj/item/screwdriver,
/obj/item/weldingtool, /obj/item/weldingtool,
@@ -64,7 +64,6 @@
/obj/item/assembly/signaler, /obj/item/assembly/signaler,
/obj/item/lightreplacer /obj/item/lightreplacer
)) ))
STR.can_hold = can_hold
/obj/item/storage/belt/utility/chief /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 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) GET_COMPONENT(STR, /datum/component/storage)
STR.max_w_class = WEIGHT_CLASS_BULKY STR.max_w_class = WEIGHT_CLASS_BULKY
STR.can_hold = typecacheof(list( STR.set_holdable(list(
/obj/item/healthanalyzer, /obj/item/healthanalyzer,
/obj/item/dnainjector, /obj/item/dnainjector,
/obj/item/reagent_containers/dropper, /obj/item/reagent_containers/dropper,
@@ -190,7 +189,7 @@
GET_COMPONENT(STR, /datum/component/storage) GET_COMPONENT(STR, /datum/component/storage)
STR.max_items = 5 STR.max_items = 5
STR.max_w_class = WEIGHT_CLASS_NORMAL STR.max_w_class = WEIGHT_CLASS_NORMAL
STR.can_hold = typecacheof(list( STR.set_holdable(list(
/obj/item/melee/baton, /obj/item/melee/baton,
/obj/item/melee/classic_baton, /obj/item/melee/classic_baton,
/obj/item/grenade, /obj/item/grenade,
@@ -244,7 +243,7 @@
STR.max_items = 6 STR.max_items = 6
STR.max_w_class = WEIGHT_CLASS_BULKY STR.max_w_class = WEIGHT_CLASS_BULKY
STR.max_combined_w_class = 20 STR.max_combined_w_class = 20
STR.can_hold = typecacheof(list( STR.set_holdable(list(
/obj/item/crowbar, /obj/item/crowbar,
/obj/item/screwdriver, /obj/item/screwdriver,
/obj/item/weldingtool, /obj/item/weldingtool,
@@ -312,7 +311,7 @@
. = ..() . = ..()
GET_COMPONENT(STR, /datum/component/storage) GET_COMPONENT(STR, /datum/component/storage)
STR.max_items = 6 STR.max_items = 6
STR.can_hold = typecacheof(list( STR.set_holdable(list(
/obj/item/soulstone /obj/item/soulstone
)) ))
@@ -335,9 +334,9 @@
. = ..() . = ..()
GET_COMPONENT(STR, /datum/component/storage) GET_COMPONENT(STR, /datum/component/storage)
STR.max_items = 1 STR.max_items = 1
STR.can_hold = list( STR.set_holdable(list(
/obj/item/clothing/mask/luchador /obj/item/clothing/mask/luchador
) ))
/obj/item/storage/belt/military /obj/item/storage/belt/military
name = "chest rig" name = "chest rig"
@@ -364,7 +363,7 @@
GET_COMPONENT(STR, /datum/component/storage) GET_COMPONENT(STR, /datum/component/storage)
STR.max_items = 6 STR.max_items = 6
STR.max_w_class = WEIGHT_CLASS_SMALL 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/snacks,
/obj/item/reagent_containers/food/drinks /obj/item/reagent_containers/food/drinks
)) ))
@@ -444,7 +443,7 @@
STR.display_numerical_stacking = TRUE STR.display_numerical_stacking = TRUE
STR.max_combined_w_class = 60 STR.max_combined_w_class = 60
STR.max_w_class = WEIGHT_CLASS_BULKY STR.max_w_class = WEIGHT_CLASS_BULKY
STR.can_hold = typecacheof(list( STR.set_holdable(list(
/obj/item/grenade, /obj/item/grenade,
/obj/item/screwdriver, /obj/item/screwdriver,
/obj/item/lighter, /obj/item/lighter,
@@ -479,7 +478,7 @@
. = ..() . = ..()
GET_COMPONENT(STR, /datum/component/storage) GET_COMPONENT(STR, /datum/component/storage)
STR.max_items = 6 STR.max_items = 6
STR.can_hold = typecacheof(list( STR.set_holdable(list(
/obj/item/gun/magic/wand /obj/item/gun/magic/wand
)) ))
@@ -506,7 +505,7 @@
GET_COMPONENT(STR, /datum/component/storage) GET_COMPONENT(STR, /datum/component/storage)
STR.max_items = 6 STR.max_items = 6
STR.max_w_class = WEIGHT_CLASS_BULKY // Set to this so the light replacer can fit. 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/grenade/chem_grenade,
/obj/item/lightreplacer, /obj/item/lightreplacer,
/obj/item/flashlight, /obj/item/flashlight,
@@ -538,7 +537,7 @@
GET_COMPONENT(STR, /datum/component/storage) GET_COMPONENT(STR, /datum/component/storage)
STR.max_items = 18 STR.max_items = 18
STR.display_numerical_stacking = TRUE STR.display_numerical_stacking = TRUE
STR.can_hold = typecacheof(list( STR.set_holdable(list(
/obj/item/ammo_casing/shotgun /obj/item/ammo_casing/shotgun
)) ))
@@ -554,7 +553,7 @@
GET_COMPONENT(STR, /datum/component/storage) GET_COMPONENT(STR, /datum/component/storage)
STR.max_items = 3 STR.max_items = 3
STR.max_w_class = WEIGHT_CLASS_NORMAL 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/automatic/pistol,
/obj/item/gun/ballistic/revolver, /obj/item/gun/ballistic/revolver,
/obj/item/ammo_box, /obj/item/ammo_box,
@@ -654,7 +653,7 @@
STR.max_items = 1 STR.max_items = 1
STR.rustle_sound = FALSE STR.rustle_sound = FALSE
STR.max_w_class = WEIGHT_CLASS_BULKY STR.max_w_class = WEIGHT_CLASS_BULKY
STR.can_hold = typecacheof(list( STR.set_holdable(list(
/obj/item/melee/sabre /obj/item/melee/sabre
)) ))

View File

@@ -402,7 +402,7 @@
/obj/item/storage/box/donkpockets/ComponentInitialize() /obj/item/storage/box/donkpockets/ComponentInitialize()
. = ..() . = ..()
GET_COMPONENT(STR, /datum/component/storage) 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() /obj/item/storage/box/donkpockets/PopulateContents()
for(var/i in 1 to 6) for(var/i in 1 to 6)
@@ -419,7 +419,7 @@
. = ..() . = ..()
GET_COMPONENT(STR, /datum/component/storage) GET_COMPONENT(STR, /datum/component/storage)
STR.max_items = 7 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() /obj/item/storage/box/monkeycubes/PopulateContents()
for(var/i in 1 to 5) for(var/i in 1 to 5)
@@ -439,7 +439,7 @@
. = ..() . = ..()
GET_COMPONENT(STR, /datum/component/storage) GET_COMPONENT(STR, /datum/component/storage)
STR.max_items = 3 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() /obj/item/storage/box/gorillacubes/PopulateContents()
for(var/i in 1 to 3) for(var/i in 1 to 3)
@@ -591,7 +591,7 @@
/obj/item/storage/box/snappops/ComponentInitialize() /obj/item/storage/box/snappops/ComponentInitialize()
. = ..() . = ..()
GET_COMPONENT(STR, /datum/component/storage) 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 STR.max_items = 8
/obj/item/storage/box/snappops/PopulateContents() /obj/item/storage/box/snappops/PopulateContents()
@@ -610,8 +610,13 @@
. = ..() . = ..()
GET_COMPONENT(STR, /datum/component/storage) GET_COMPONENT(STR, /datum/component/storage)
STR.max_items = 10 STR.max_items = 10
<<<<<<< HEAD
STR.can_hold = typecacheof(list(/obj/item/match)) STR.can_hold = typecacheof(list(/obj/item/match))
// yogs start -- make matches play nice with holodeck // 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() /obj/item/storage/box/matches/PopulateContents()
for(var/i in 1 to 10) for(var/i in 1 to 10)
new /obj/item/match(src) new /obj/item/match(src)
@@ -634,7 +639,7 @@
. = ..() . = ..()
GET_COMPONENT(STR, /datum/component/storage) GET_COMPONENT(STR, /datum/component/storage)
STR.max_items = 21 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.max_combined_w_class = 21
STR.click_gather = FALSE //temp workaround to re-enable filling the light replacer with the box STR.click_gather = FALSE //temp workaround to re-enable filling the light replacer with the box

View File

@@ -74,7 +74,7 @@
. = ..() . = ..()
GET_COMPONENT(STR, /datum/component/storage) GET_COMPONENT(STR, /datum/component/storage)
STR.max_items = 6 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 * Egg Box
@@ -95,7 +95,7 @@
. = ..() . = ..()
GET_COMPONENT(STR, /datum/component/storage) GET_COMPONENT(STR, /datum/component/storage)
STR.max_items = 12 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 * Candle Box
@@ -140,7 +140,7 @@
. = ..() . = ..()
GET_COMPONENT(STR, /datum/component/storage) GET_COMPONENT(STR, /datum/component/storage)
STR.max_items = 6 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) /obj/item/storage/fancy/cigarettes/examine(mob/user)
..() ..()
@@ -278,7 +278,7 @@
. = ..() . = ..()
GET_COMPONENT(STR, /datum/component/storage) GET_COMPONENT(STR, /datum/component/storage)
STR.max_items = 10 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() /obj/item/storage/fancy/rollingpapers/update_icon()
cut_overlays() cut_overlays()
@@ -302,7 +302,7 @@
. = ..() . = ..()
GET_COMPONENT(STR, /datum/component/storage) GET_COMPONENT(STR, /datum/component/storage)
STR.max_items = 5 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() /obj/item/storage/fancy/cigarettes/cigars/update_icon()
cut_overlays() cut_overlays()
@@ -349,4 +349,4 @@
. = ..() . = ..()
GET_COMPONENT(STR, /datum/component/storage) GET_COMPONENT(STR, /datum/component/storage)
STR.max_items = 8 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))

View File

@@ -219,7 +219,7 @@
GET_COMPONENT(STR, /datum/component/storage) GET_COMPONENT(STR, /datum/component/storage)
STR.allow_quick_gather = TRUE STR.allow_quick_gather = TRUE
STR.click_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) /obj/item/storage/pill_bottle/suicide_act(mob/user)
user.visible_message("<span class='suicide'>[user] is trying to get the cap off [src]! It looks like [user.p_theyre()] trying to commit suicide!</span>") user.visible_message("<span class='suicide'>[user] is trying to get the cap off [src]! It looks like [user.p_theyre()] trying to commit suicide!</span>")

View File

@@ -103,7 +103,7 @@
STR.max_w_class = WEIGHT_CLASS_SMALL STR.max_w_class = WEIGHT_CLASS_SMALL
STR.max_items = 10 STR.max_items = 10
STR.max_combined_w_class = 20 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) /obj/item/storage/lockbox/medal/examine(mob/user)
..() ..()

View File

@@ -171,7 +171,7 @@
/obj/item/storage/secure/safe/ComponentInitialize() /obj/item/storage/secure/safe/ComponentInitialize()
. = ..() . = ..()
GET_COMPONENT(STR, /datum/component/storage) 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 //?? STR.max_w_class = 8 //??
/obj/item/storage/secure/safe/PopulateContents() /obj/item/storage/secure/safe/PopulateContents()

View File

@@ -257,7 +257,7 @@
. = ..() . = ..()
GET_COMPONENT(STR, /datum/component/storage) GET_COMPONENT(STR, /datum/component/storage)
STR.max_w_class = WEIGHT_CLASS_NORMAL 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() /obj/item/storage/box/syndie_kit/space/PopulateContents()
if(prob(50)) if(prob(50))

View File

@@ -13,8 +13,7 @@
. = ..() . = ..()
GET_COMPONENT(STR, /datum/component/storage) GET_COMPONENT(STR, /datum/component/storage)
STR.max_items = 4 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.set_holdable(list(
STR.can_hold = typecacheof(list(
/obj/item/stack/spacecash, /obj/item/stack/spacecash,
/obj/item/holochip, /obj/item/holochip,
/obj/item/card, /obj/item/card,
@@ -36,7 +35,8 @@
/obj/item/reagent_containers/dropper, /obj/item/reagent_containers/dropper,
/obj/item/reagent_containers/syringe, /obj/item/reagent_containers/syringe,
/obj/item/screwdriver, /obj/item/screwdriver,
/obj/item/stamp)) /obj/item/stamp),
list(/obj/item/screwdriver/power))
/obj/item/storage/wallet/Exited(atom/movable/AM) /obj/item/storage/wallet/Exited(atom/movable/AM)
. = ..() . = ..()

View File

@@ -124,8 +124,10 @@
how_cool_are_your_threads += "[src]'s storage opens when clicked.\n" how_cool_are_your_threads += "[src]'s storage opens when clicked.\n"
else else
how_cool_are_your_threads += "[src]'s storage opens when dragged to yourself.\n" 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" if (!pockets.can_hold.len) // If pocket type can hold anything, vs only specific items
how_cool_are_your_threads += "[src] can store items that are [weightclass2text(pockets.max_w_class)] or smaller.\n" 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] <a href='?src=[REF(src)];show_valid_pocket_items=1'>item\s</a>.\n"
if(pockets.quickdraw) if(pockets.quickdraw)
how_cool_are_your_threads += "You can quickly remove an item from [src] using Alt-Click.\n" how_cool_are_your_threads += "You can quickly remove an item from [src] using Alt-Click.\n"
if(pockets.silent) if(pockets.silent)

View File

@@ -69,7 +69,7 @@
/obj/item/storage/bag/easterbasket/Initialize() /obj/item/storage/bag/easterbasket/Initialize()
. = ..() . = ..()
GET_COMPONENT(STR, /datum/component/storage) 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() /obj/item/storage/bag/easterbasket/proc/countEggs()
cut_overlays() cut_overlays()

View File

@@ -15,7 +15,7 @@
STR.max_w_class = WEIGHT_CLASS_NORMAL STR.max_w_class = WEIGHT_CLASS_NORMAL
STR.max_items = 40 STR.max_items = 40
STR.max_combined_w_class = 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() /obj/item/storage/bag/money/vault/PopulateContents()
new /obj/item/coin/silver(src) new /obj/item/coin/silver(src)
@@ -24,4 +24,4 @@
new /obj/item/coin/silver(src) new /obj/item/coin/silver(src)
new /obj/item/coin/gold(src) new /obj/item/coin/gold(src)
new /obj/item/coin/gold(src) new /obj/item/coin/gold(src)
new /obj/item/coin/adamantine(src) new /obj/item/coin/adamantine(src)

View File

@@ -684,8 +684,6 @@
to_chat(src, "<span class='notice'>You succesfuly remove the durathread strand.</span>") to_chat(src, "<span class='notice'>You succesfuly remove the durathread strand.</span>")
remove_status_effect(STATUS_EFFECT_CHOKINGSTRAND) remove_status_effect(STATUS_EFFECT_CHOKINGSTRAND)
return return
visible_message("[src] examines [p_them()]self.", \
"<span class='notice'>You check yourself for injuries.</span>")
check_self_for_injuries() check_self_for_injuries()

View File

@@ -14,7 +14,7 @@
/obj/item/storage/photo_album/Initialize() /obj/item/storage/photo_album/Initialize()
. = ..() . = ..()
GET_COMPONENT(STR, /datum/component/storage) 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_combined_w_class = 42
STR.max_items = 21 STR.max_items = 21
LAZYADD(SSpersistence.photo_albums, src) LAZYADD(SSpersistence.photo_albums, src)

View File

@@ -321,7 +321,7 @@
GET_COMPONENT(STR, /datum/component/storage) GET_COMPONENT(STR, /datum/component/storage)
STR.max_w_class = WEIGHT_CLASS_SMALL STR.max_w_class = WEIGHT_CLASS_SMALL
STR.max_items = 2 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() /obj/item/storage/lockbox/dueling/update_icon()
cut_overlays() cut_overlays()