Tsu's Brand Spanking New Storage: or, How I Learned To Pass Github Copilot As My Own Code (#67478)

Currently, storage works as a subtype of /datum/component, utilizing GetComponent() and signals to operate. While this is a pretty good idea in theory, the execution was pretty trash, and we end up with alot of GetComponent() snowflake code (something that shouldn't even need to be used frankly), and a heaping load of scattered procs that lead into one another, and procs that don't get utilized properly.

Instead, this PR adds atom_storage and proc/create_storage(. . .) to every atom, allowing for the possibility of storage on quite frankly anything. Not only does this entirely remove the need for signals, but it heavily squashes down the number of needed procs in total (removing snowflake signal procs that just lead to one another), reducing overall proc overhead and improving performance.
This commit is contained in:
magatsuchi
2022-07-08 18:13:18 -07:00
committed by GitHub
parent 944eb14541
commit 7d0f393f5d
133 changed files with 2056 additions and 2358 deletions
+2 -4
View File
@@ -599,9 +599,7 @@
/obj/item/storage/crayons/Initialize(mapload)
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_items = 7
STR.set_holdable(list(/obj/item/toy/crayon))
create_storage(canhold = list(/obj/item/toy/crayon))
/obj/item/storage/crayons/PopulateContents()
new /obj/item/toy/crayon/red(src)
@@ -822,7 +820,7 @@
return SECONDARY_ATTACK_CONTINUE_CHAIN
/obj/item/toy/crayon/spraycan/attackby_storage_insert(datum/component/storage, atom/storage_holder, mob/user)
/obj/item/toy/crayon/spraycan/attackby_storage_insert(datum/storage, atom/storage_holder, mob/user)
return is_capped
/obj/item/toy/crayon/spraycan/update_icon_state()
@@ -18,13 +18,11 @@
///If the UI has the pH meter shown
var/show_ph = TRUE
/obj/item/storage/portable_chem_mixer/ComponentInitialize()
/obj/item/storage/portable_chem_mixer/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_combined_w_class = 200
STR.max_items = 50
STR.insert_preposition = "in"
STR.set_holdable(list(
atom_storage.max_total_storage = 200
atom_storage.max_slots = 50
atom_storage.set_holdable(list(
/obj/item/reagent_containers/glass/beaker,
/obj/item/reagent_containers/glass/bottle,
/obj/item/reagent_containers/food/drinks/waterbottle,
@@ -40,8 +38,7 @@
return ..()
/obj/item/storage/portable_chem_mixer/attackby(obj/item/I, mob/user, params)
var/locked = SEND_SIGNAL(src, COMSIG_IS_STORAGE_LOCKED)
if (istype(I, /obj/item/reagent_containers) && !(I.item_flags & ABSTRACT) && I.is_open_container() && locked)
if (istype(I, /obj/item/reagent_containers) && !(I.item_flags & ABSTRACT) && I.is_open_container() && atom_storage.locked)
var/obj/item/reagent_containers/B = I
. = TRUE //no afterattack
if(!user.transferItemToLoc(B, src))
@@ -70,7 +67,7 @@
return
/obj/item/storage/portable_chem_mixer/update_icon_state()
if(!SEND_SIGNAL(src, COMSIG_IS_STORAGE_LOCKED))
if(!atom_storage.locked)
icon_state = "portablechemicalmixer_open"
return ..()
if(beaker)
@@ -81,8 +78,7 @@
/obj/item/storage/portable_chem_mixer/AltClick(mob/living/user)
var/locked = SEND_SIGNAL(src, COMSIG_IS_STORAGE_LOCKED)
if(!locked)
if(!atom_storage.locked)
return ..()
if(!can_interact(user) || !user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
return
@@ -90,11 +86,10 @@
update_appearance()
/obj/item/storage/portable_chem_mixer/CtrlClick(mob/living/user)
var/locked = SEND_SIGNAL(src, COMSIG_IS_STORAGE_LOCKED)
SEND_SIGNAL(src, COMSIG_TRY_STORAGE_SET_LOCKSTATE, !locked)
if (!locked)
atom_storage.locked = !atom_storage.locked
if (!atom_storage.locked)
update_contents()
if (locked)
if (atom_storage.locked)
replace_beaker(user)
update_appearance()
playsound(src, 'sound/items/screwdriver2.ogg', 50)
@@ -122,17 +117,15 @@
if (loc != user)
return ..()
else
var/locked = SEND_SIGNAL(src, COMSIG_IS_STORAGE_LOCKED)
if (!locked)
if (!atom_storage.locked)
return ..()
if(SEND_SIGNAL(src, COMSIG_IS_STORAGE_LOCKED))
if(atom_storage?.locked)
ui_interact(user)
return
/obj/item/storage/portable_chem_mixer/attack_self(mob/user)
if(loc == user)
var/locked = SEND_SIGNAL(src, COMSIG_IS_STORAGE_LOCKED)
if (locked)
if (atom_storage.locked)
ui_interact(user)
return
else
+2 -4
View File
@@ -8,10 +8,8 @@
/obj/item/storage/dice/Initialize(mapload)
. = ..()
var/datum/component/storage/storage = GetComponent(/datum/component/storage)
storage.allow_quick_gather = TRUE
storage.click_gather = TRUE
storage.set_holdable(list(/obj/item/dice))
atom_storage.allow_quick_gather = TRUE
atom_storage.set_holdable(list(/obj/item/dice))
/obj/item/storage/dice/PopulateContents()
new /obj/item/dice/d4(src)
@@ -7,31 +7,34 @@
/obj/item/implant/storage/activate()
. = ..()
SEND_SIGNAL(src, COMSIG_TRY_STORAGE_SHOW, imp_in, TRUE)
atom_storage?.open_storage(src, imp_in)
/obj/item/implant/storage/removed(source, silent = FALSE, special = 0)
if(!special)
var/datum/component/storage/lostimplant = GetComponent(/datum/component/storage/concrete/implant)
var/mob/living/implantee = source
for (var/obj/item/I in lostimplant.contents())
var/atom/resolve_parent = atom_storage.parent?.resolve()
if(!resolve_parent)
return
for (var/obj/item/I in resolve_parent.contents)
I.add_mob_blood(implantee)
lostimplant.do_quick_empty()
atom_storage.remove_all(implantee)
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(lostimplant)
qdel(atom_storage)
return ..()
/obj/item/implant/storage/implant(mob/living/target, mob/user, silent = FALSE, force = FALSE)
for(var/X in target.implants)
if(istype(X, type))
var/obj/item/implant/storage/imp_e = X
var/datum/component/storage/STR = imp_e.GetComponent(/datum/component/storage)
if(!STR || (STR && STR.max_items < max_slot_stacking))
imp_e.AddComponent(/datum/component/storage/concrete/implant)
if(!imp_e.atom_storage || (imp_e.atom_storage && imp_e.atom_storage.max_slots < max_slot_stacking))
imp_e.create_storage(type = /datum/storage/implant)
qdel(src)
return TRUE
return FALSE
AddComponent(/datum/component/storage/concrete/implant)
create_storage(type = /datum/storage/implant)
return ..()
+6 -7
View File
@@ -268,14 +268,13 @@
worn_icon_state = "mailbag"
resistance_flags = FLAMMABLE
/obj/item/storage/bag/mail/ComponentInitialize()
/obj/item/storage/bag/mail/Initialize()
. = ..()
var/datum/component/storage/storage = GetComponent(/datum/component/storage)
storage.max_w_class = WEIGHT_CLASS_NORMAL
storage.max_combined_w_class = 42
storage.max_items = 21
storage.display_numerical_stacking = FALSE
storage.set_holdable(list(
atom_storage.max_specific_storage = WEIGHT_CLASS_NORMAL
atom_storage.max_total_storage = 42
atom_storage.max_slots = 21
atom_storage.numerical_stacking = FALSE
atom_storage.set_holdable(list(
/obj/item/mail,
/obj/item/delivery/small,
/obj/item/paper
+4 -4
View File
@@ -86,13 +86,13 @@
final_block_chance = 0 //Don't bring a sword to a gunfight
return ..()
/obj/item/melee/sabre/on_exit_storage(datum/component/storage/concrete/container)
var/obj/item/storage/belt/sabre/sabre = container.real_location()
/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)
/obj/item/melee/sabre/on_enter_storage(datum/component/storage/concrete/container)
var/obj/item/storage/belt/sabre/sabre = container.real_location()
/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)
+1 -2
View File
@@ -254,8 +254,7 @@
/obj/item/storage/backpack/bannerpack/Initialize(mapload)
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_combined_w_class = 27 //6 more then normal, for the tradeoff of declaring yourself an antag at all times.
atom_storage.max_total_storage = 27 //6 more then normal, for the tradeoff of declaring yourself an antag at all times.
/obj/item/storage/backpack/bannerpack/red
name = "red banner backpack"
+1
View File
@@ -670,6 +670,7 @@
var/obj/item/stack/F = new type(user? user : drop_location(), amount, FALSE, mats_per_unit)
. = F
F.copy_evidences(src)
loc.atom_storage?.refresh_views()
if(user)
if(!user.put_in_hands(F, merge_stacks = FALSE))
F.forceMove(user.drop_location())
+25 -42
View File
@@ -21,21 +21,17 @@
resistance_flags = NONE
max_integrity = 300
/obj/item/storage/backpack/ComponentInitialize()
/obj/item/storage/backpack/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_combined_w_class = 21
STR.max_w_class = WEIGHT_CLASS_NORMAL
STR.max_items = 21
create_storage(max_slots = 21, max_total_storage = 21)
/*
* Backpack Types
*/
/obj/item/storage/backpack/old/ComponentInitialize()
/obj/item/storage/backpack/old/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_combined_w_class = 12
atom_storage.max_total_storage = 12
/obj/item/bag_of_holding_inert
name = "inert bag of holding"
@@ -57,14 +53,12 @@
resistance_flags = FIRE_PROOF
item_flags = NO_MAT_REDEMPTION
armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 0, BOMB = 0, BIO = 0, FIRE = 60, ACID = 50)
component_type = /datum/component/storage/concrete/bluespace/bag_of_holding
/obj/item/storage/backpack/holding/ComponentInitialize()
/obj/item/storage/backpack/holding/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.allow_big_nesting = TRUE
STR.max_w_class = WEIGHT_CLASS_GIGANTIC
STR.max_combined_w_class = 35
create_storage(max_specific_storage = WEIGHT_CLASS_GIGANTIC, max_total_storage = 35, max_slots = 30, type = /datum/storage/bag_of_holding)
atom_storage.allow_big_nesting = TRUE
/obj/item/storage/backpack/holding/suicide_act(mob/living/user)
user.visible_message(span_suicide("[user] is jumping into [src]! It looks like [user.p_theyre()] trying to commit suicide."))
@@ -85,11 +79,10 @@
. = ..()
regenerate_presents()
/obj/item/storage/backpack/santabag/ComponentInitialize()
/obj/item/storage/backpack/santabag/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_w_class = WEIGHT_CLASS_NORMAL
STR.max_combined_w_class = 60
atom_storage.max_specific_storage = WEIGHT_CLASS_NORMAL
atom_storage.max_total_storage = 60
/obj/item/storage/backpack/santabag/suicide_act(mob/user)
user.visible_message(span_suicide("[user] places [src] over [user.p_their()] head and pulls it tight! It looks like [user.p_they()] [user.p_are()]n't in the Christmas spirit..."))
@@ -98,17 +91,14 @@
/obj/item/storage/backpack/santabag/proc/regenerate_presents()
addtimer(CALLBACK(src, .proc/regenerate_presents), 30 SECONDS)
var/mob/M = get(loc, /mob)
if(!istype(M))
var/mob/user = get(loc, /mob)
if(!istype(user))
return
if(M.mind && HAS_TRAIT(M.mind, TRAIT_CANNOT_OPEN_PRESENTS))
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
if(user.mind && HAS_TRAIT(user.mind, TRAIT_CANNOT_OPEN_PRESENTS))
var/turf/floor = get_turf(src)
var/obj/item/I = new /obj/item/a_gift/anything(floor)
if(STR.can_be_inserted(I, stop_messages=TRUE))
STR.handle_item_insertion(I, prevent_warning=TRUE)
else
qdel(I)
var/obj/item/thing = new /obj/item/a_gift/anything(floor)
if(!atom_storage.attempt_insert(src, thing, user, override = TRUE))
qdel(thing)
/obj/item/storage/backpack/cultpack
@@ -314,12 +304,8 @@
/obj/item/storage/backpack/satchel/flat/Initialize(mapload)
. = ..()
AddElement(/datum/element/undertile, TRAIT_T_RAY_VISIBLE, INVISIBILITY_OBSERVER, use_anchor = TRUE)
/obj/item/storage/backpack/satchel/flat/ComponentInitialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_combined_w_class = 15
STR.set_holdable(null, list(/obj/item/storage/backpack/satchel/flat)) //muh recursive backpacks)
atom_storage.max_total_storage = 15
atom_storage.set_holdable(cant_hold_list = list(/obj/item/storage/backpack/satchel/flat)) //muh recursive backpacks)
/obj/item/storage/backpack/satchel/flat/PopulateContents()
var/datum/supply_pack/costumes_toys/randomised/contraband/C = new
@@ -345,10 +331,9 @@
inhand_icon_state = "duffel"
slowdown = 1
/obj/item/storage/backpack/duffelbag/ComponentInitialize()
/obj/item/storage/backpack/duffelbag/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_combined_w_class = 30
atom_storage.max_total_storage = 30
/obj/item/storage/backpack/duffelbag/cursed
name = "living duffel bag"
@@ -498,10 +483,9 @@
slowdown = 0
resistance_flags = FIRE_PROOF
/obj/item/storage/backpack/duffelbag/syndie/ComponentInitialize()
/obj/item/storage/backpack/duffelbag/syndie/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.silent = TRUE
atom_storage.silent = TRUE
/obj/item/storage/backpack/duffelbag/syndie/hitman
desc = "A large duffel bag for holding extra things. There is a Nanotrasen logo on the back."
@@ -655,11 +639,10 @@
new /obj/item/grenade/syndieminibomb(src)
// For ClownOps.
/obj/item/storage/backpack/duffelbag/clown/syndie/ComponentInitialize()
/obj/item/storage/backpack/duffelbag/clown/syndie/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
slowdown = 0
STR.silent = TRUE
atom_storage.silent = TRUE
/obj/item/storage/backpack/duffelbag/clown/syndie/PopulateContents()
new /obj/item/modular_computer/tablet/pda/clown(src)
+86 -105
View File
@@ -20,13 +20,11 @@
slot_flags = ITEM_SLOT_BELT
w_class = WEIGHT_CLASS_BULKY
/obj/item/storage/bag/ComponentInitialize()
/obj/item/storage/bag/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.allow_quick_gather = TRUE
STR.allow_quick_empty = TRUE
STR.display_numerical_stacking = TRUE
STR.click_gather = TRUE
atom_storage.allow_quick_gather = TRUE
atom_storage.allow_quick_empty = TRUE
atom_storage.numerical_stacking = TRUE
// -----------------------------
// Trash bag
@@ -43,13 +41,12 @@
///If true, can be inserted into the janitor cart
var/insertable = TRUE
/obj/item/storage/bag/trash/ComponentInitialize()
/obj/item/storage/bag/trash/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_w_class = WEIGHT_CLASS_SMALL
STR.max_combined_w_class = 30
STR.max_items = 30
STR.set_holdable(null, list(/obj/item/disk/nuclear))
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))
/obj/item/storage/bag/trash/suicide_act(mob/user)
user.visible_message(span_suicide("[user] puts [src] over [user.p_their()] head and starts chomping at the insides! Disgusting!"))
@@ -87,11 +84,10 @@
inhand_icon_state = "bluetrashbag"
item_flags = NO_MAT_REDEMPTION
/obj/item/storage/bag/trash/bluespace/ComponentInitialize()
/obj/item/storage/bag/trash/bluespace/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_combined_w_class = 60
STR.max_items = 60
atom_storage.max_total_storage = 60
atom_storage.max_slots = 60
/obj/item/storage/bag/trash/bluespace/cyborg
insertable = FALSE
@@ -108,17 +104,17 @@
worn_icon_state = "satchel"
slot_flags = ITEM_SLOT_BELT | ITEM_SLOT_POCKETS
w_class = WEIGHT_CLASS_NORMAL
component_type = /datum/component/storage/concrete/stack
var/spam_protection = FALSE //If this is TRUE, the holder won't receive any messages when they fail to pick up ore through crossing it
var/mob/listeningTo
/obj/item/storage/bag/ore/ComponentInitialize()
/obj/item/storage/bag/ore/Initialize(mapload)
. = ..()
var/datum/component/storage/concrete/stack/STR = GetComponent(/datum/component/storage/concrete/stack)
STR.allow_quick_empty = TRUE
STR.set_holdable(list(/obj/item/stack/ore))
STR.max_w_class = WEIGHT_CLASS_HUGE
STR.max_combined_stack_amount = 50
atom_storage.max_specific_storage = WEIGHT_CLASS_HUGE
atom_storage.max_total_storage = 50
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))
/obj/item/storage/bag/ore/equipped(mob/user)
. = ..()
@@ -126,7 +122,7 @@
return
if(listeningTo)
UnregisterSignal(listeningTo, COMSIG_MOVABLE_MOVED)
RegisterSignal(user, COMSIG_MOVABLE_MOVED, .proc/Pickup_ores)
RegisterSignal(user, COMSIG_MOVABLE_MOVED, .proc/pickup_ores)
listeningTo = user
/obj/item/storage/bag/ore/dropped()
@@ -135,24 +131,27 @@
UnregisterSignal(listeningTo, COMSIG_MOVABLE_MOVED)
listeningTo = null
/obj/item/storage/bag/ore/proc/Pickup_ores(mob/living/user)
/obj/item/storage/bag/ore/proc/pickup_ores(mob/living/user)
SIGNAL_HANDLER
var/show_message = FALSE
var/obj/structure/ore_box/box
var/turf/tile = user.loc
if (!isturf(tile))
var/turf/tile = get_turf(user)
if(!isturf(tile))
return
if (istype(user.pulling, /obj/structure/ore_box))
if(istype(user.pulling, /obj/structure/ore_box))
box = user.pulling
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
if(STR)
for(var/A in tile)
if (!is_type_in_typecache(A, STR.can_hold))
if(atom_storage)
for(var/thing in tile)
if(!is_type_in_typecache(thing, atom_storage.can_hold))
continue
if (box)
user.transferItemToLoc(A, box)
if(box)
user.transferItemToLoc(thing, box)
show_message = TRUE
else if(SEND_SIGNAL(src, COMSIG_TRY_STORAGE_INSERT, A, user, TRUE))
else if(atom_storage.attempt_insert(src, thing, user))
show_message = TRUE
else
if(!spam_protection)
@@ -161,12 +160,14 @@
continue
if(show_message)
playsound(user, SFX_RUSTLE, 50, TRUE)
if (box)
user.visible_message(span_notice("[user] offloads the ores beneath [user.p_them()] into [box]."), \
span_notice("You offload the ores beneath you into your [box]."))
span_notice("You offload the ores beneath you into your [box]."))
else
user.visible_message(span_notice("[user] scoops up the ores beneath [user.p_them()]."), \
span_notice("You scoop up the ores beneath you with your [name]."))
spam_protection = FALSE
/obj/item/storage/bag/ore/cyborg
@@ -177,12 +178,11 @@
desc = "A revolution in convenience, this satchel allows for huge amounts of ore storage. It's been outfitted with anti-malfunction safety measures."
icon_state = "satchel_bspace"
/obj/item/storage/bag/ore/holding/ComponentInitialize()
/obj/item/storage/bag/ore/holding/Initialize()
. = ..()
var/datum/component/storage/concrete/stack/STR = GetComponent(/datum/component/storage/concrete/stack)
STR.max_items = INFINITY
STR.max_combined_w_class = INFINITY
STR.max_combined_stack_amount = INFINITY
atom_storage.max_slots = INFINITY
atom_storage.max_specific_storage = INFINITY
atom_storage.max_total_storage = INFINITY
// -----------------------------
// Plant bag
@@ -195,13 +195,12 @@
worn_icon_state = "plantbag"
resistance_flags = FLAMMABLE
/obj/item/storage/bag/plants/ComponentInitialize()
/obj/item/storage/bag/plants/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_w_class = WEIGHT_CLASS_NORMAL
STR.max_combined_w_class = 100
STR.max_items = 100
STR.set_holdable(list(
atom_storage.max_specific_storage = WEIGHT_CLASS_NORMAL
atom_storage.max_total_storage = 100
atom_storage.max_slots = 100
atom_storage.set_holdable(list(
/obj/item/food/grown,
/obj/item/graft,
/obj/item/grown,
@@ -243,8 +242,7 @@
// -----------------------------
// Sheet Snatcher
// -----------------------------
// Because it stacks stacks, this doesn't operate normally.
// However, making it a storage/bag allows us to reuse existing code in some places. -Sayu
// sorry sayu your sheet snatcher is now OBSOLETE but i'm leaving it because idc
/obj/item/storage/bag/sheetsnatcher
name = "sheet snatcher"
@@ -254,20 +252,20 @@
worn_icon_state = "satchel"
var/capacity = 300; //the number of sheets it can carry.
component_type = /datum/component/storage/concrete/stack
/obj/item/storage/bag/sheetsnatcher/ComponentInitialize()
/obj/item/storage/bag/sheetsnatcher/Initialize()
. = ..()
var/datum/component/storage/concrete/stack/STR = GetComponent(/datum/component/storage/concrete/stack)
STR.allow_quick_empty = TRUE
STR.set_holdable(list(
atom_storage.allow_quick_empty = TRUE
atom_storage.allow_quick_gather = TRUE
atom_storage.numerical_stacking = TRUE
atom_storage.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
atom_storage.max_total_storage = capacity / 2
// -----------------------------
// Sheet Snatcher (Cyborg)
@@ -278,11 +276,6 @@
desc = ""
capacity = 500//Borgs get more because >specialization
/obj/item/storage/bag/sheetsnatcher/borg/ComponentInitialize()
. = ..()
var/datum/component/storage/concrete/stack/STR = GetComponent(/datum/component/storage/concrete/stack)
STR.max_combined_stack_amount = 500
// -----------------------------
// Book bag
// -----------------------------
@@ -295,14 +288,12 @@
worn_icon_state = "bookbag"
resistance_flags = FLAMMABLE
/obj/item/storage/bag/books/ComponentInitialize()
/obj/item/storage/bag/books/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_w_class = WEIGHT_CLASS_NORMAL
STR.max_combined_w_class = 21
STR.max_items = 7
STR.display_numerical_stacking = FALSE
STR.set_holdable(list(
atom_storage.max_specific_storage = WEIGHT_CLASS_NORMAL
atom_storage.max_total_storage = 21
atom_storage.max_slots = 7
atom_storage.set_holdable(list(
/obj/item/book,
/obj/item/spellbook,
/obj/item/storage/book,
@@ -326,11 +317,10 @@
custom_materials = list(/datum/material/iron=3000)
custom_price = PAYCHECK_CREW * 0.6
/obj/item/storage/bag/tray/ComponentInitialize()
/obj/item/storage/bag/tray/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_w_class = WEIGHT_CLASS_BULKY //Plates are required bulky to keep them out of backpacks
STR.set_holdable(list(
atom_storage.max_specific_storage = WEIGHT_CLASS_BULKY //Plates are required bulky to keep them out of backpacks
atom_storage.set_holdable(list(
/obj/item/clothing/mask/cigarette,
/obj/item/food,
/obj/item/kitchen,
@@ -345,14 +335,14 @@
/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.
STR.insert_preposition = "on"
STR.max_items = 7
atom_storage.insert_preposition = "on"
atom_storage.max_slots = 7
/obj/item/storage/bag/tray/attack(mob/living/M, mob/living/user)
. = ..()
// Drop all the things. All of them.
var/list/obj/item/oldContents = contents.Copy()
SEND_SIGNAL(src, COMSIG_TRY_STORAGE_QUICK_EMPTY)
atom_storage.remove_all(user)
// Make each item scatter a bit
for(var/obj/item/tray_item in oldContents)
do_scatter(tray_item)
@@ -414,13 +404,11 @@
desc = "A bag for storing pills, patches, and bottles."
resistance_flags = FLAMMABLE
/obj/item/storage/bag/chemistry/ComponentInitialize()
/obj/item/storage/bag/chemistry/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_combined_w_class = 200
STR.max_items = 50
STR.insert_preposition = "in"
STR.set_holdable(list(
atom_storage.max_total_storage = 200
atom_storage.max_slots = 50
atom_storage.set_holdable(list(
/obj/item/reagent_containers/chem_pack,
/obj/item/reagent_containers/dropper,
/obj/item/reagent_containers/food/drinks/waterbottle,
@@ -443,13 +431,11 @@
desc = "A bag for the safe transportation and disposal of biowaste and other virulent materials."
resistance_flags = FLAMMABLE
/obj/item/storage/bag/bio/ComponentInitialize()
/obj/item/storage/bag/bio/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_combined_w_class = 200
STR.max_items = 25
STR.insert_preposition = "in"
STR.set_holdable(list(
atom_storage.max_total_storage = 200
atom_storage.max_slots = 25
atom_storage.set_holdable(list(
/obj/item/bodypart,
/obj/item/food/monkeycube,
/obj/item/healthanalyzer,
@@ -474,13 +460,11 @@
desc = "A bag for the storage and transport of anomalous materials."
resistance_flags = FLAMMABLE
/obj/item/storage/bag/xeno/ComponentInitialize()
/obj/item/storage/bag/xeno/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_combined_w_class = 200
STR.max_items = 25
STR.insert_preposition = "in"
STR.set_holdable(list(
atom_storage.max_total_storage = 200
atom_storage.max_slots = 25
atom_storage.set_holdable(list(
/obj/item/bodypart,
/obj/item/food/deadmouse,
/obj/item/food/monkeycube,
@@ -507,14 +491,12 @@
slot_flags = ITEM_SLOT_BELT | ITEM_SLOT_POCKETS
resistance_flags = FLAMMABLE
/obj/item/storage/bag/construction/ComponentInitialize()
/obj/item/storage/bag/construction/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_combined_w_class = 100
STR.max_items = 50
STR.max_w_class = WEIGHT_CLASS_SMALL
STR.insert_preposition = "in"
STR.set_holdable(list(
atom_storage.max_total_storage = 100
atom_storage.max_slots = 50
atom_storage.max_specific_storage = WEIGHT_CLASS_SMALL
atom_storage.set_holdable(list(
/obj/item/assembly,
/obj/item/circuitboard,
/obj/item/electronics,
@@ -532,13 +514,12 @@
inhand_icon_state = "quiver"
worn_icon_state = "harpoon_quiver"
/obj/item/storage/bag/harpoon_quiver/ComponentInitialize()
/obj/item/storage/bag/harpoon_quiver/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_w_class = WEIGHT_CLASS_TINY
STR.max_items = 40
STR.max_combined_w_class = 100
STR.set_holdable(list(
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/caseless/harpoon
))
+3 -4
View File
@@ -5,8 +5,7 @@
w_class = WEIGHT_CLASS_BULKY
resistance_flags = FLAMMABLE
/obj/item/storage/basket/ComponentInitialize()
/obj/item/storage/basket/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_w_class = WEIGHT_CLASS_NORMAL
STR.max_combined_w_class = 21
atom_storage.max_specific_storage = WEIGHT_CLASS_NORMAL
atom_storage.max_total_storage = 21
+66 -83
View File
@@ -41,12 +41,11 @@
drop_sound = 'sound/items/handling/toolbelt_drop.ogg'
pickup_sound = 'sound/items/handling/toolbelt_pickup.ogg'
/obj/item/storage/belt/utility/ComponentInitialize()
/obj/item/storage/belt/utility/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_w_class = WEIGHT_CLASS_NORMAL
STR.max_combined_w_class = 21
STR.set_holdable(list(
atom_storage.max_specific_storage = WEIGHT_CLASS_NORMAL
atom_storage.max_total_storage = 21
atom_storage.set_holdable(list(
/obj/item/airlock_painter,
/obj/item/analyzer,
/obj/item/assembly/signaler,
@@ -206,12 +205,11 @@
inhand_icon_state = "medical"
worn_icon_state = "medical"
/obj/item/storage/belt/medical/ComponentInitialize()
/obj/item/storage/belt/medical/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_w_class = WEIGHT_CLASS_NORMAL
STR.max_combined_w_class = 21
STR.set_holdable(list(
atom_storage.max_specific_storage = WEIGHT_CLASS_NORMAL
atom_storage.max_total_storage = 21
atom_storage.set_holdable(list(
/obj/item/bikehorn/rubberducky,
/obj/item/blood_filter,
/obj/item/bonesetter,
@@ -320,12 +318,11 @@
worn_icon_state = "security"
content_overlays = TRUE
/obj/item/storage/belt/security/ComponentInitialize()
/obj/item/storage/belt/security/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_items = 5
STR.max_w_class = WEIGHT_CLASS_NORMAL
STR.set_holdable(list(
atom_storage.max_slots = 5
atom_storage.max_specific_storage = WEIGHT_CLASS_NORMAL
atom_storage.set_holdable(list(
/obj/item/ammo_box,
/obj/item/ammo_casing/shotgun,
/obj/item/assembly/flash/handheld,
@@ -360,10 +357,9 @@
content_overlays = FALSE
custom_premium_price = PAYCHECK_COMMAND * 3
/obj/item/storage/belt/security/webbing/ComponentInitialize()
/obj/item/storage/belt/security/webbing/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_items = 6
atom_storage.max_slots = 6
/obj/item/storage/belt/mining
name = "explorer's webbing"
@@ -373,13 +369,12 @@
worn_icon_state = "explorer1"
w_class = WEIGHT_CLASS_BULKY
/obj/item/storage/belt/mining/ComponentInitialize()
/obj/item/storage/belt/mining/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_items = 6
STR.max_w_class = WEIGHT_CLASS_NORMAL
STR.max_combined_w_class = 20
STR.set_holdable(list(
atom_storage.max_slots = 6
atom_storage.max_specific_storage = WEIGHT_CLASS_NORMAL
atom_storage.max_total_storage = 20
atom_storage.set_holdable(list(
/obj/item/analyzer,
/obj/item/clothing/gloves,
/obj/item/crowbar,
@@ -435,10 +430,9 @@
inhand_icon_state = "ebelt"
worn_icon_state = "ebelt"
/obj/item/storage/belt/mining/primitive/ComponentInitialize()
/obj/item/storage/belt/mining/primitive/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_items = 5
atom_storage.max_slots = 5
/obj/item/storage/belt/soulstone
name = "soul stone belt"
@@ -447,11 +441,10 @@
inhand_icon_state = "soulstonebelt"
worn_icon_state = "soulstonebelt"
/obj/item/storage/belt/soulstone/ComponentInitialize()
/obj/item/storage/belt/soulstone/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_items = 6
STR.set_holdable(list(
atom_storage.max_slots = 6
atom_storage.set_holdable(list(
/obj/item/soulstone
))
@@ -471,11 +464,10 @@
worn_icon_state = "championbelt"
custom_materials = list(/datum/material/gold=400)
/obj/item/storage/belt/champion/ComponentInitialize()
/obj/item/storage/belt/champion/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_items = 1
STR.set_holdable(list(
atom_storage.max_slots = 1
atom_storage.set_holdable(list(
/obj/item/clothing/mask/luchador
))
@@ -494,10 +486,9 @@
worn_icon_state = "militarywebbing"
resistance_flags = FIRE_PROOF
/obj/item/storage/belt/military/ComponentInitialize()
/obj/item/storage/belt/military/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_w_class = WEIGHT_CLASS_SMALL
atom_storage.max_specific_storage = WEIGHT_CLASS_SMALL
/obj/item/storage/belt/military/snack
name = "tactical snack rig"
@@ -507,12 +498,11 @@
var/sponsor = pick("Donk Co.", "Waffle Co.", "Roffle Co.", "Gorlax Marauders", "Tiger Cooperative")
desc = "A set of snack-tical webbing worn by athletes of the [sponsor] VR sports division."
/obj/item/storage/belt/military/snack/ComponentInitialize()
/obj/item/storage/belt/military/snack/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_items = 6
STR.max_w_class = WEIGHT_CLASS_SMALL
STR.set_holdable(list(
atom_storage.max_slots = 6
atom_storage.max_specific_storage = WEIGHT_CLASS_SMALL
atom_storage.set_holdable(list(
/obj/item/food,
/obj/item/reagent_containers/food/drinks
))
@@ -578,10 +568,9 @@
inhand_icon_state = "security"
worn_icon_state = "assault"
/obj/item/storage/belt/military/assault/ComponentInitialize()
/obj/item/storage/belt/military/assault/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_items = 6
atom_storage.max_slots = 6
/obj/item/storage/belt/military/assault/full/PopulateContents()
generate_items_inside(list(
@@ -596,14 +585,13 @@
inhand_icon_state = "security"
worn_icon_state = "grenadebeltnew"
/obj/item/storage/belt/grenade/ComponentInitialize()
/obj/item/storage/belt/grenade/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_items = 30
STR.display_numerical_stacking = TRUE
STR.max_combined_w_class = 60
STR.max_w_class = WEIGHT_CLASS_BULKY
STR.set_holdable(list(
atom_storage.max_slots = 30
atom_storage.numerical_stacking = TRUE
atom_storage.max_total_storage = 60
atom_storage.max_specific_storage = WEIGHT_CLASS_BULKY
atom_storage.set_holdable(list(
/obj/item/food/grown/cherry_bomb,
/obj/item/food/grown/firelemon,
/obj/item/grenade,
@@ -636,11 +624,10 @@
inhand_icon_state = "soulstonebelt"
worn_icon_state = "soulstonebelt"
/obj/item/storage/belt/wands/ComponentInitialize()
/obj/item/storage/belt/wands/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_items = 6
STR.set_holdable(list(
atom_storage.max_slots = 6
atom_storage.set_holdable(list(
/obj/item/gun/magic/wand
))
@@ -663,12 +650,11 @@
inhand_icon_state = "janibelt"
worn_icon_state = "janibelt"
/obj/item/storage/belt/janitor/ComponentInitialize()
/obj/item/storage/belt/janitor/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_items = 6
STR.max_w_class = WEIGHT_CLASS_NORMAL // Set to this so the light replacer can fit.
STR.set_holdable(list(
atom_storage.max_slots = 6
atom_storage.max_specific_storage = WEIGHT_CLASS_NORMAL // Set to this so the light replacer can fit.
atom_storage.set_holdable(list(
/obj/item/assembly/mousetrap,
/obj/item/clothing/gloves,
/obj/item/flashlight,
@@ -699,13 +685,12 @@
inhand_icon_state = "bandolier"
worn_icon_state = "bandolier"
/obj/item/storage/belt/bandolier/ComponentInitialize()
/obj/item/storage/belt/bandolier/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_items = 18
STR.max_combined_w_class = 18
STR.display_numerical_stacking = TRUE
STR.set_holdable(list(
atom_storage.max_slots = 18
atom_storage.max_total_storage = 18
atom_storage.numerical_stacking = TRUE
atom_storage.set_holdable(list(
/obj/item/ammo_casing/a762,
/obj/item/ammo_casing/shotgun,
))
@@ -719,11 +704,10 @@
dying_key = DYE_REGISTRY_FANNYPACK
custom_price = PAYCHECK_CREW * 2
/obj/item/storage/belt/fannypack/ComponentInitialize()
/obj/item/storage/belt/fannypack/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_items = 3
STR.max_w_class = WEIGHT_CLASS_SMALL
atom_storage.max_slots = 3
atom_storage.max_specific_storage = WEIGHT_CLASS_SMALL
/obj/item/storage/belt/fannypack/black
name = "black fannypack"
@@ -793,14 +777,14 @@
worn_icon_state = "sheath"
w_class = WEIGHT_CLASS_BULKY
/obj/item/storage/belt/sabre/ComponentInitialize()
/obj/item/storage/belt/sabre/Initialize()
. = ..()
AddElement(/datum/element/update_icon_updates_onmob)
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_items = 1
STR.rustle_sound = FALSE
STR.max_w_class = WEIGHT_CLASS_BULKY
STR.set_holdable(list(
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,
))
@@ -842,12 +826,11 @@
worn_icon_state = "plantbelt"
content_overlays = TRUE
/obj/item/storage/belt/plant/ComponentInitialize()
/obj/item/storage/belt/plant/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_items = 6
STR.max_w_class = WEIGHT_CLASS_NORMAL
STR.set_holdable(list(
atom_storage.max_slots = 6
atom_storage.max_specific_storage = WEIGHT_CLASS_NORMAL
atom_storage.set_holdable(list(
/obj/item/cultivator,
/obj/item/geneshears,
/obj/item/graft,
+2 -3
View File
@@ -10,10 +10,9 @@
resistance_flags = FLAMMABLE
var/title = "book"
/obj/item/storage/book/ComponentInitialize()
/obj/item/storage/book/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_items = 1
atom_storage.max_slots = 1
/obj/item/storage/book/attack_self(mob/user)
to_chat(user, span_notice("The pages of [title] have been cut out!"))
+27 -32
View File
@@ -462,10 +462,9 @@
for(var/i in 1 to 6)
new donktype(src)
/obj/item/storage/box/donkpockets/ComponentInitialize()
/obj/item/storage/box/donkpockets/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.set_holdable(list(/obj/item/food/donkpocket))
atom_storage.set_holdable(list(/obj/item/food/donkpocket))
/obj/item/storage/box/donkpockets/donkpocketspicy
name = "box of spicy-flavoured donk-pockets"
@@ -504,11 +503,10 @@
illustration = null
var/cube_type = /obj/item/food/monkeycube
/obj/item/storage/box/monkeycubes/ComponentInitialize()
/obj/item/storage/box/monkeycubes/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_items = 7
STR.set_holdable(list(/obj/item/food/monkeycube))
atom_storage.max_slots = 7
atom_storage.set_holdable(list(/obj/item/food/monkeycube))
/obj/item/storage/box/monkeycubes/PopulateContents()
for(var/i in 1 to 5)
@@ -524,11 +522,10 @@
icon_state = "monkeycubebox"
illustration = null
/obj/item/storage/box/gorillacubes/ComponentInitialize()
/obj/item/storage/box/gorillacubes/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_items = 3
STR.set_holdable(list(/obj/item/food/monkeycube))
atom_storage.max_slots = 3
atom_storage.set_holdable(list(/obj/item/food/monkeycube))
/obj/item/storage/box/gorillacubes/PopulateContents()
for(var/i in 1 to 3)
@@ -682,15 +679,15 @@
icon_state = "spbox"
illustration = ""
/obj/item/storage/box/snappops/ComponentInitialize()
/obj/item/storage/box/snappops/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.set_holdable(list(/obj/item/toy/snappop))
STR.max_items = 8
atom_storage.set_holdable(list(/obj/item/toy/snappop))
atom_storage.max_slots = 8
/obj/item/storage/box/snappops/PopulateContents()
SEND_SIGNAL(src, COMSIG_TRY_STORAGE_FILL_TYPE, /obj/item/toy/snappop)
for(var/i in 1 to 8)
new /obj/item/toy/snappop(src)
/obj/item/storage/box/matches
name = "matchbox"
desc = "A small box of Almost But Not Quite Plasma Premium Matches."
@@ -706,14 +703,14 @@
base_icon_state = "matchbox"
illustration = null
/obj/item/storage/box/matches/ComponentInitialize()
/obj/item/storage/box/matches/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_items = 10
STR.set_holdable(list(/obj/item/match))
atom_storage.max_slots = 10
atom_storage.set_holdable(list(/obj/item/match))
/obj/item/storage/box/matches/PopulateContents()
SEND_SIGNAL(src, COMSIG_TRY_STORAGE_FILL_TYPE, /obj/item/match)
for(var/i in 1 to 10)
new /obj/item/match(src)
/obj/item/storage/box/matches/attackby(obj/item/match/W as obj, mob/user as mob, params)
if(istype(W, /obj/item/match))
@@ -741,13 +738,12 @@
righthand_file = 'icons/mob/inhands/equipment/medical_righthand.dmi'
foldable = /obj/item/stack/sheet/cardboard //BubbleWrap
/obj/item/storage/box/lights/ComponentInitialize()
/obj/item/storage/box/lights/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_items = 21
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
atom_storage.max_slots = 21
atom_storage.set_holdable(list(/obj/item/light/tube, /obj/item/light/bulb))
atom_storage.max_total_storage = 21
atom_storage.allow_quick_gather = FALSE //temp workaround to re-enable filling the light replacer with the box
/obj/item/storage/box/lights/bulbs/PopulateContents()
for(var/i in 1 to 21)
@@ -1239,11 +1235,10 @@
foldable = null
custom_price = PAYCHECK_CREW
/obj/item/storage/box/gum/ComponentInitialize()
/obj/item/storage/box/gum/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.set_holdable(list(/obj/item/food/bubblegum))
STR.max_items = 4
atom_storage.set_holdable(list(/obj/item/food/bubblegum))
atom_storage.max_slots = 4
/obj/item/storage/box/gum/PopulateContents()
for(var/i in 1 to 4)
+3 -4
View File
@@ -16,11 +16,10 @@
max_integrity = 150
var/folder_path = /obj/item/folder //this is the path of the folder that gets spawned in New()
/obj/item/storage/briefcase/ComponentInitialize()
/obj/item/storage/briefcase/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_w_class = WEIGHT_CLASS_NORMAL
STR.max_combined_w_class = 21
atom_storage.max_specific_storage = WEIGHT_CLASS_NORMAL
atom_storage.max_total_storage = 21
/obj/item/storage/briefcase/PopulateContents()
new /obj/item/pen(src)
+32 -67
View File
@@ -21,16 +21,22 @@
var/contents_tag = "errors"
/// What type of thing to fill this storage with.
var/spawn_type = null
/// How many of the things to fill this storage with.
var/spawn_count = 0
/// Whether the container is open or not
var/is_open = FALSE
/// What this container folds up into when it's empty.
var/obj/fold_result = /obj/item/stack/sheet/cardboard
/obj/item/storage/fancy/Initialize()
. = ..()
atom_storage.max_slots = spawn_count
/obj/item/storage/fancy/PopulateContents()
if(!spawn_type)
return
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
for(var/i = 1 to STR.max_items)
for(var/i = 1 to spawn_count)
new spawn_type(src)
/obj/item/storage/fancy/update_icon_state()
@@ -80,16 +86,15 @@
icon_state = "donutbox_open" //composite image used for mapping
base_icon_state = "donutbox"
spawn_type = /obj/item/food/donut/plain
spawn_count = 6
is_open = TRUE
appearance_flags = KEEP_TOGETHER|LONG_GLIDE
custom_premium_price = PAYCHECK_COMMAND * 1.75
contents_tag = "donut"
/obj/item/storage/fancy/donut_box/ComponentInitialize()
/obj/item/storage/fancy/donut_box/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_items = 6
STR.set_holdable(list(/obj/item/food/donut))
atom_storage.set_holdable(list(/obj/item/food/donut))
/obj/item/storage/fancy/donut_box/PopulateContents()
. = ..()
@@ -131,13 +136,12 @@
name = "egg box"
desc = "A carton for containing eggs."
spawn_type = /obj/item/food/egg
spawn_count = 12
contents_tag = "egg"
/obj/item/storage/fancy/egg_box/ComponentInitialize()
/obj/item/storage/fancy/egg_box/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_items = 12
STR.set_holdable(list(/obj/item/food/egg))
atom_storage.set_holdable(list(/obj/item/food/egg))
/*
* Candle Box
@@ -154,14 +158,10 @@
throwforce = 2
slot_flags = ITEM_SLOT_BELT
spawn_type = /obj/item/candle
spawn_count = 5
is_open = TRUE
contents_tag = "candle"
/obj/item/storage/fancy/candle_box/ComponentInitialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_items = 5
/obj/item/storage/fancy/candle_box/attack_self(mob/user)
if(!contents.len)
new fold_result(user.drop_location())
@@ -184,6 +184,7 @@
throwforce = 0
slot_flags = ITEM_SLOT_BELT
spawn_type = /obj/item/clothing/mask/cigarette/space_cigarette
spawn_count = 6
custom_price = PAYCHECK_CREW
age_restricted = TRUE
contents_tag = "cigarette"
@@ -208,15 +209,13 @@
spawn_coupon = FALSE
name = "discarded cigarette packet"
desc = "An old cigarette packet with the back torn off, worth less than nothing now."
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_items = 0
atom_storage.max_slots = 0
return
/obj/item/storage/fancy/cigarettes/ComponentInitialize()
/obj/item/storage/fancy/cigarettes/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_items = 6
STR.set_holdable(list(/obj/item/clothing/mask/cigarette, /obj/item/lighter))
atom_storage.quickdraw = TRUE
atom_storage.set_holdable(list(/obj/item/clothing/mask/cigarette, /obj/item/lighter))
/obj/item/storage/fancy/cigarettes/examine(mob/user)
. = ..()
@@ -225,18 +224,6 @@
if(spawn_coupon)
. += span_notice("There's a coupon on the back of the pack! You can tear it off once it's empty.")
/obj/item/storage/fancy/cigarettes/AltClick(mob/user)
if(!user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, TRUE))
return
var/obj/item/clothing/mask/cigarette/W = locate(/obj/item/clothing/mask/cigarette) in contents
if(W && contents.len > 0)
SEND_SIGNAL(src, COMSIG_TRY_STORAGE_TAKE, W, user)
user.put_in_hands(W)
contents -= W
to_chat(user, span_notice("You take \a [W] out of the pack."))
else
to_chat(user, span_notice("There are no [contents_tag]s left in the pack."))
/obj/item/storage/fancy/cigarettes/update_icon_state()
. = ..()
icon_state = "[base_icon_state][contents.len ? null : "_empty"]"
@@ -267,24 +254,6 @@
. += "[use_icon_state]_[cig_position]"
cig_position++
/obj/item/storage/fancy/cigarettes/attack(mob/living/carbon/target, mob/living/carbon/user)
if(!istype(target))
return
var/obj/item/clothing/mask/cigarette/cig = locate() in contents
if(!cig)
to_chat(user, span_notice("There are no [contents_tag]s left in the pack."))
return
if(target != user || !contents.len || user.wear_mask)
return ..()
SEND_SIGNAL(src, COMSIG_TRY_STORAGE_TAKE, cig, target)
target.equip_to_slot_if_possible(cig, ITEM_SLOT_MASK)
contents -= cig
to_chat(user, span_notice("You take \a [cig] out of the pack."))
return
/obj/item/storage/fancy/cigarettes/dromedaryco
name = "\improper DromedaryCo packet"
desc = "A packet of six imported DromedaryCo cancer sticks. A label on the packaging reads, \"Wouldn't a slow death make a change?\""
@@ -388,11 +357,10 @@
spawn_type = /obj/item/rollingpaper
custom_price = PAYCHECK_LOWER
/obj/item/storage/fancy/rollingpapers/ComponentInitialize()
/obj/item/storage/fancy/rollingpapers/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_items = 10
STR.set_holdable(list(/obj/item/rollingpaper))
atom_storage.max_slots = 10
atom_storage.set_holdable(list(/obj/item/rollingpaper))
///Overrides to do nothing because fancy boxes are fucking insane.
/obj/item/storage/fancy/rollingpapers/update_icon_state()
@@ -417,14 +385,13 @@
w_class = WEIGHT_CLASS_NORMAL
contents_tag = "premium cigar"
spawn_type = /obj/item/clothing/mask/cigarette/cigar
spawn_count = 5
spawn_coupon = FALSE
display_cigs = FALSE
/obj/item/storage/fancy/cigarettes/cigars/ComponentInitialize()
/obj/item/storage/fancy/cigarettes/cigars/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_items = 5
STR.set_holdable(list(/obj/item/clothing/mask/cigarette/cigar))
atom_storage.set_holdable(list(/obj/item/clothing/mask/cigarette/cigar))
/obj/item/storage/fancy/cigarettes/cigars/update_icon_state()
. = ..()
@@ -469,12 +436,11 @@
righthand_file = 'icons/mob/inhands/misc/food_righthand.dmi'
contents_tag = "chocolate"
spawn_type = /obj/item/food/tinychocolate
spawn_count = 8
/obj/item/storage/fancy/heart_box/ComponentInitialize()
/obj/item/storage/fancy/heart_box/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_items = 8
STR.set_holdable(list(/obj/item/food/tinychocolate))
atom_storage.set_holdable(list(/obj/item/food/tinychocolate))
/obj/item/storage/fancy/nugget_box
@@ -485,9 +451,8 @@
base_icon_state = "nuggetbox"
contents_tag = "nugget"
spawn_type = /obj/item/food/nugget
spawn_count = 6
/obj/item/storage/fancy/nugget_box/ComponentInitialize()
/obj/item/storage/fancy/nugget_box/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_items = 6
STR.set_holdable(list(/obj/item/food/nugget))
atom_storage.set_holdable(list(/obj/item/food/nugget))
+7 -8
View File
@@ -30,15 +30,14 @@
name = "chief engineer's garment bag"
desc = "A bag for storing extra clothes and shoes. This one belongs to the chief engineer."
/obj/item/storage/bag/garment/ComponentInitialize()
/obj/item/storage/bag/garment/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_w_class = WEIGHT_CLASS_NORMAL
STR.display_numerical_stacking = FALSE
STR.max_combined_w_class = 200
STR.max_items = 15
STR.insert_preposition = "in"
STR.set_holdable(list(
atom_storage.max_specific_storage = WEIGHT_CLASS_NORMAL
atom_storage.numerical_stacking = FALSE
atom_storage.max_total_storage = 200
atom_storage.max_slots = 15
atom_storage.insert_preposition = "in"
atom_storage.set_holdable(list(
/obj/item/clothing,
))
+22 -28
View File
@@ -17,12 +17,11 @@
. = ..()
REMOVE_TRAIT(user, TRAIT_GUNFLIP, CLOTHING_TRAIT)
/obj/item/storage/belt/holster/ComponentInitialize()
/obj/item/storage/belt/holster/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_items = 1
STR.max_w_class = WEIGHT_CLASS_NORMAL
STR.set_holdable(list(
atom_storage.max_slots = 1
atom_storage.max_total_storage = 16
atom_storage.set_holdable(list(
/obj/item/gun/ballistic/automatic/pistol,
/obj/item/gun/ballistic/revolver,
/obj/item/gun/energy/e_gun/mini,
@@ -36,12 +35,11 @@
name = "thermal shoulder holsters"
desc = "A rather plain pair of shoulder holsters with a bit of insulated padding inside. Meant to hold a twinned pair of thermal pistols, but can fit several kinds of energy handguns as well."
/obj/item/storage/belt/holster/thermal/ComponentInitialize()
/obj/item/storage/belt/holster/thermal/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_items = 2
STR.max_w_class = WEIGHT_CLASS_NORMAL
STR.set_holdable(list(
atom_storage.max_slots = 2
atom_storage.max_specific_storage = WEIGHT_CLASS_NORMAL
atom_storage.set_holdable(list(
/obj/item/gun/energy/e_gun/mini,
/obj/item/gun/energy/disabler,
/obj/item/gun/energy/dueling,
@@ -60,12 +58,11 @@
desc = "A holster able to carry handguns and some ammo. WARNING: Badasses only."
w_class = WEIGHT_CLASS_BULKY
/obj/item/storage/belt/holster/detective/ComponentInitialize()
/obj/item/storage/belt/holster/detective/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_items = 3
STR.max_w_class = WEIGHT_CLASS_NORMAL
STR.set_holdable(list(
atom_storage.max_slots = 3
atom_storage.max_specific_storage = WEIGHT_CLASS_NORMAL
atom_storage.set_holdable(list(
/obj/item/gun/ballistic/automatic/pistol,
/obj/item/ammo_box/magazine/m9mm, // Pistol magazines.
/obj/item/ammo_box/magazine/m9mm_aps,
@@ -119,10 +116,9 @@
chameleon_action.initialize_disguises()
add_item_action(chameleon_action)
/obj/item/storage/belt/holster/chameleon/ComponentInitialize()
/obj/item/storage/belt/holster/chameleon/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.silent = TRUE
atom_storage.silent = TRUE
/obj/item/storage/belt/holster/chameleon/emp_act(severity)
. = ..()
@@ -134,12 +130,11 @@
. = ..()
chameleon_action.emp_randomise(INFINITY)
/obj/item/storage/belt/holster/chameleon/ComponentInitialize()
/obj/item/storage/belt/holster/chameleon/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_items = 2
STR.max_w_class = WEIGHT_CLASS_NORMAL
STR.set_holdable(list(
atom_storage.max_slots = 2
atom_storage.max_total_storage = WEIGHT_CLASS_NORMAL
atom_storage.set_holdable(list(
/obj/item/gun/ballistic/automatic/pistol,
/obj/item/ammo_box/magazine/m9mm,
/obj/item/ammo_box/magazine/m9mm_aps,
@@ -164,12 +159,11 @@
worn_icon_state = "syndicate_holster"
w_class = WEIGHT_CLASS_BULKY
/obj/item/storage/belt/holster/nukie/ComponentInitialize()
/obj/item/storage/belt/holster/nukie/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_items = 2
STR.max_w_class = WEIGHT_CLASS_BULKY
STR.set_holdable(list(
atom_storage.max_slots = 2
atom_storage.max_specific_storage = WEIGHT_CLASS_BULKY
atom_storage.set_holdable(list(
/obj/item/gun, // ALL guns.
/obj/item/ammo_box/magazine, // ALL magazines.
/obj/item/ammo_box/c38, //There isn't a speedloader parent type, so I just put these three here by hand.
+21 -25
View File
@@ -13,27 +13,26 @@
var/icon_closed = "lockbox"
var/icon_broken = "lockbox+b"
/obj/item/storage/lockbox/ComponentInitialize()
/obj/item/storage/lockbox/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_w_class = WEIGHT_CLASS_NORMAL
STR.max_combined_w_class = 14
STR.max_items = 4
STR.locked = TRUE
atom_storage.max_specific_storage = WEIGHT_CLASS_NORMAL
atom_storage.max_total_storage = 14
atom_storage.max_slots = 4
atom_storage.locked = TRUE
/obj/item/storage/lockbox/attackby(obj/item/W, mob/user, params)
var/locked = SEND_SIGNAL(src, COMSIG_IS_STORAGE_LOCKED)
var/locked = atom_storage.locked
if(W.GetID())
if(broken)
to_chat(user, span_danger("It appears to be broken."))
return
if(allowed(user))
SEND_SIGNAL(src, COMSIG_TRY_STORAGE_SET_LOCKSTATE, !locked)
locked = SEND_SIGNAL(src, COMSIG_IS_STORAGE_LOCKED)
atom_storage.locked = !locked
locked = atom_storage.locked
if(locked)
icon_state = icon_locked
to_chat(user, span_danger("You lock the [src.name]!"))
SEND_SIGNAL(src, COMSIG_TRY_STORAGE_HIDE_ALL)
atom_storage.close_all()
return
else
icon_state = icon_closed
@@ -50,7 +49,7 @@
/obj/item/storage/lockbox/emag_act(mob/user)
if(!broken)
broken = TRUE
SEND_SIGNAL(src, COMSIG_TRY_STORAGE_SET_LOCKSTATE, FALSE)
atom_storage.locked = FALSE
desc += "It appears to be broken."
icon_state = src.icon_broken
if(user)
@@ -97,22 +96,21 @@
icon_closed = "medalbox"
icon_broken = "medalbox+b"
/obj/item/storage/lockbox/medal/ComponentInitialize()
/obj/item/storage/lockbox/medal/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_w_class = WEIGHT_CLASS_SMALL
STR.max_items = 10
STR.max_combined_w_class = 20
STR.set_holdable(list(/obj/item/clothing/accessory/medal))
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))
/obj/item/storage/lockbox/medal/examine(mob/user)
. = ..()
if(!SEND_SIGNAL(src, COMSIG_IS_STORAGE_LOCKED))
if(!atom_storage.locked)
. += span_notice("Alt-click to [open ? "close":"open"] it.")
/obj/item/storage/lockbox/medal/AltClick(mob/user)
if(user.canUseTopic(src, BE_CLOSE))
if(!SEND_SIGNAL(src, COMSIG_IS_STORAGE_LOCKED))
if(!atom_storage.locked)
open = (open ? FALSE : TRUE)
update_appearance()
..()
@@ -129,8 +127,7 @@
new /obj/item/clothing/accessory/medal/conduct(src)
/obj/item/storage/lockbox/medal/update_icon_state()
var/locked = SEND_SIGNAL(src, COMSIG_IS_STORAGE_LOCKED)
if(locked)
if(atom_storage?.locked)
icon_state = "medalbox+l"
return ..()
@@ -145,8 +142,7 @@
. = ..()
if(!contents || !open)
return
var/locked = SEND_SIGNAL(src, COMSIG_IS_STORAGE_LOCKED)
if(locked)
if(atom_storage?.locked)
return
for(var/i in 1 to contents.len)
var/obj/item/clothing/accessory/medal/M = contents[i]
@@ -240,8 +236,8 @@
to_chat(user, span_warning("Bank account does not match with buyer!"))
return
SEND_SIGNAL(src, COMSIG_TRY_STORAGE_SET_LOCKSTATE, !privacy_lock)
privacy_lock = SEND_SIGNAL(src, COMSIG_IS_STORAGE_LOCKED)
atom_storage.locked = !privacy_lock
privacy_lock = atom_storage.locked
user.visible_message(span_notice("[user] [privacy_lock ? "" : "un"]locks [src]'s privacy lock."),
span_notice("You [privacy_lock ? "" : "un"]lock [src]'s privacy lock."))
+15 -20
View File
@@ -60,13 +60,12 @@
inhand_icon_state = "medkit"
desc = "A high capacity aid kit for doctors, full of medical supplies and basic surgical equipment"
/obj/item/storage/medkit/surgery/ComponentInitialize()
/obj/item/storage/medkit/surgery/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_w_class = WEIGHT_CLASS_NORMAL //holds the same equipment as a medibelt
STR.max_items = 12
STR.max_combined_w_class = 24
STR.set_holdable(list(
atom_storage.max_specific_storage = WEIGHT_CLASS_NORMAL //holds the same equipment as a medibelt
atom_storage.max_slots = 12
atom_storage.max_total_storage = 24
atom_storage.set_holdable(list(
/obj/item/healthanalyzer,
/obj/item/dnainjector,
/obj/item/reagent_containers/dropper,
@@ -259,10 +258,9 @@
icon_state = "medkit_tactical"
damagetype_healed = "all"
/obj/item/storage/medkit/tactical/ComponentInitialize()
/obj/item/storage/medkit/tactical/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_w_class = WEIGHT_CLASS_NORMAL
atom_storage.max_specific_storage = WEIGHT_CLASS_NORMAL
/obj/item/storage/medkit/tactical/PopulateContents()
if(empty)
@@ -318,12 +316,10 @@
righthand_file = 'icons/mob/inhands/equipment/medical_righthand.dmi'
w_class = WEIGHT_CLASS_SMALL
/obj/item/storage/pill_bottle/ComponentInitialize()
/obj/item/storage/pill_bottle/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.allow_quick_gather = TRUE
STR.click_gather = TRUE
STR.set_holdable(list(/obj/item/reagent_containers/pill))
atom_storage.allow_quick_gather = TRUE
atom_storage.set_holdable(list(/obj/item/reagent_containers/pill))
/obj/item/storage/pill_bottle/suicide_act(mob/user)
user.visible_message(span_suicide("[user] is trying to get the cap off [src]! It looks like [user.p_theyre()] trying to commit suicide!"))
@@ -528,12 +524,11 @@
/// var to prevent it freezing the same things over and over
var/cooling = FALSE
/obj/item/storage/organbox/ComponentInitialize()
/obj/item/storage/organbox/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_w_class = WEIGHT_CLASS_BULKY /// you have to remove it from your bag before opening it but I think that's fine
STR.max_combined_w_class = 21
STR.set_holdable(list(
atom_storage.max_specific_storage = WEIGHT_CLASS_BULKY /// you have to remove it from your bag before opening it but I think that's fine
atom_storage.max_total_storage = 21
atom_storage.set_holdable(list(
/obj/item/organ,
/obj/item/bodypart,
/obj/item/food/icecream
@@ -543,7 +538,7 @@
. = ..()
create_reagents(100, TRANSPARENT)
RegisterSignal(src, COMSIG_ATOM_ENTERED, .proc/freeze)
RegisterSignal(src, COMSIG_TRY_STORAGE_TAKE, .proc/unfreeze)
RegisterSignal(src, COMSIG_ATOM_EXITED, .proc/unfreeze)
START_PROCESSING(SSobj, src)
/obj/item/storage/organbox/process(delta_time)
+15 -18
View File
@@ -33,11 +33,10 @@
var/can_hack_open = TRUE
/obj/item/storage/secure/ComponentInitialize()
/obj/item/storage/secure/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_w_class = WEIGHT_CLASS_SMALL
STR.max_combined_w_class = 14
atom_storage.max_specific_storage = WEIGHT_CLASS_SMALL
atom_storage.max_total_storage = 14
/obj/item/storage/secure/examine(mob/user)
. = ..()
@@ -45,7 +44,7 @@
. += "The service panel is currently <b>[panel_open ? "unscrewed" : "screwed shut"]</b>."
/obj/item/storage/secure/tool_act(mob/living/user, obj/item/tool)
if(can_hack_open && SEND_SIGNAL(src, COMSIG_IS_STORAGE_LOCKED))
if(can_hack_open && atom_storage.locked)
return ..()
else
return FALSE
@@ -78,7 +77,7 @@
to_chat(user, span_warning("You must <b>unscrew</b> the service panel before you can pulse the wiring!"))
/obj/item/storage/secure/attack_self(mob/user)
var/locked = SEND_SIGNAL(src, COMSIG_IS_STORAGE_LOCKED)
var/locked = atom_storage.locked
user.set_machine(src)
var/dat = text("<TT><B>[]</B><BR>\n\nLock Status: []",src, (locked ? "LOCKED" : "UNLOCKED"))
var/message = "Code"
@@ -100,7 +99,7 @@
lock_code = entered_code
lock_set = TRUE
else if ((entered_code == lock_code) && lock_set)
SEND_SIGNAL(src, COMSIG_TRY_STORAGE_SET_LOCKSTATE, FALSE)
atom_storage.locked = TRUE
cut_overlays()
add_overlay(icon_opened)
entered_code = null
@@ -108,10 +107,10 @@
entered_code = "ERROR"
else
if (href_list["type"] == "R")
SEND_SIGNAL(src, COMSIG_TRY_STORAGE_SET_LOCKSTATE, TRUE)
atom_storage.locked = FALSE
cut_overlays()
entered_code = null
SEND_SIGNAL(src, COMSIG_TRY_STORAGE_HIDE_FROM, usr)
atom_storage.hide_contents(usr)
else
entered_code += text("[]", sanitize_text(href_list["type"]))
if (length(entered_code) > 5)
@@ -144,11 +143,10 @@
new /obj/item/paper(src)
new /obj/item/pen(src)
/obj/item/storage/secure/briefcase/ComponentInitialize()
/obj/item/storage/secure/briefcase/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_combined_w_class = 21
STR.max_w_class = WEIGHT_CLASS_NORMAL
atom_storage.max_total_storage = 21
atom_storage.max_specific_storage = WEIGHT_CLASS_NORMAL
///Syndie variant of Secure Briefcase. Contains space cash, slightly more robust.
/obj/item/storage/secure/briefcase/syndie
@@ -174,11 +172,10 @@
MAPPING_DIRECTIONAL_HELPERS(/obj/item/storage/secure/safe, 32)
/obj/item/storage/secure/safe/ComponentInitialize()
/obj/item/storage/secure/safe/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.set_holdable(null, list(/obj/item/storage/secure/briefcase))
STR.max_w_class = 8 //??
atom_storage.set_holdable(cant_hold_list = list(/obj/item/storage/secure/briefcase))
atom_storage.max_specific_storage = WEIGHT_CLASS_GIGANTIC
/obj/item/storage/secure/safe/PopulateContents()
new /obj/item/paper(src)
@@ -219,7 +216,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/item/storage/secure/safe/caps_spare, 32)
lock_code = SSid_access.spare_id_safe_code
lock_set = TRUE
SEND_SIGNAL(src, COMSIG_TRY_STORAGE_SET_LOCKSTATE, TRUE)
atom_storage.locked = TRUE
/obj/item/storage/secure/safe/caps_spare/PopulateContents()
new /obj/item/card/id/advanced/gold/captains_spare(src)
+5 -6
View File
@@ -21,13 +21,12 @@
. = ..()
update_appearance()
/obj/item/storage/cans/ComponentInitialize()
/obj/item/storage/cans/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_w_class = WEIGHT_CLASS_SMALL
STR.max_combined_w_class = 12
STR.max_items = 6
STR.set_holdable(list(
atom_storage.max_specific_storage = WEIGHT_CLASS_SMALL
atom_storage.max_total_storage = 12
atom_storage.max_slots = 6
atom_storage.set_holdable(list(
/obj/item/reagent_containers/food/drinks/soda_cans,
/obj/item/reagent_containers/food/drinks/bottle/beer,
/obj/item/reagent_containers/food/drinks/bottle/ale,
+6 -8
View File
@@ -3,7 +3,6 @@
icon = 'icons/obj/storage.dmi'
w_class = WEIGHT_CLASS_NORMAL
var/rummage_if_nodrop = TRUE
var/component_type = /datum/component/storage/concrete
/// Should we preload the contents of this type?
/// BE CAREFUL, THERE'S SOME REALLY NASTY SHIT IN THIS TYPEPATH
/// SANTA IS EVIL
@@ -11,13 +10,14 @@
/obj/item/storage/Initialize(mapload)
. = ..()
create_storage()
PopulateContents()
for (var/obj/item/item in src)
item.item_flags |= IN_STORAGE
/obj/item/storage/ComponentInitialize()
AddComponent(component_type)
/obj/item/storage/AllowDrop()
return FALSE
@@ -37,8 +37,7 @@
/obj/item/storage/doStrip(mob/who)
if(HAS_TRAIT(src, TRAIT_NODROP) && rummage_if_nodrop)
var/datum/component/storage/CP = GetComponent(/datum/component/storage)
CP.do_quick_empty()
atom_storage.remove_all()
return TRUE
return ..()
@@ -48,8 +47,7 @@
/obj/item/storage/proc/PopulateContents()
/obj/item/storage/proc/emptyStorage()
var/datum/component/storage/ST = GetComponent(/datum/component/storage)
ST.do_quick_empty()
atom_storage.remove_all()
/obj/item/storage/Destroy()
for(var/obj/important_thing in contents)
+14 -19
View File
@@ -38,10 +38,9 @@
if(has_latches)
. += latches
/obj/item/storage/toolbox/ComponentInitialize()
/obj/item/storage/toolbox/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_w_class = WEIGHT_CLASS_NORMAL
atom_storage.max_specific_storage = WEIGHT_CLASS_NORMAL
/obj/item/storage/toolbox/suicide_act(mob/user)
user.visible_message(span_suicide("[user] robusts [user.p_them()]self with [src]! It looks like [user.p_theyre()] trying to commit suicide!"))
@@ -102,10 +101,9 @@
force = 5
w_class = WEIGHT_CLASS_NORMAL
/obj/item/storage/toolbox/mechanical/old/heirloom/ComponentInitialize()
/obj/item/storage/toolbox/mechanical/old/heirloom/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_w_class = WEIGHT_CLASS_SMALL
atom_storage.max_specific_storage = WEIGHT_CLASS_SMALL
/obj/item/storage/toolbox/mechanical/old/heirloom/PopulateContents()
return
@@ -170,10 +168,9 @@
throwforce = 18
material_flags = NONE
/obj/item/storage/toolbox/syndicate/ComponentInitialize()
/obj/item/storage/toolbox/syndicate/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.silent = TRUE
atom_storage.silent = TRUE
/obj/item/storage/toolbox/syndicate/PopulateContents()
new /obj/item/screwdriver/nuke(src)
@@ -208,11 +205,10 @@
w_class = WEIGHT_CLASS_GIGANTIC //Holds more than a regular toolbox!
material_flags = NONE
/obj/item/storage/toolbox/artistic/ComponentInitialize()
/obj/item/storage/toolbox/artistic/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_combined_w_class = 20
STR.max_items = 10
atom_storage.max_total_storage = 20
atom_storage.max_slots = 10
/obj/item/storage/toolbox/artistic/PopulateContents()
new /obj/item/storage/crayons(src)
@@ -275,13 +271,12 @@
w_class = WEIGHT_CLASS_NORMAL
has_latches = FALSE
/obj/item/storage/toolbox/infiltrator/ComponentInitialize()
/obj/item/storage/toolbox/infiltrator/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_items = 10
STR.max_w_class = WEIGHT_CLASS_NORMAL
STR.max_combined_w_class = 24
STR.set_holdable(list(
atom_storage.max_slots = 10
atom_storage.max_specific_storage = WEIGHT_CLASS_NORMAL
atom_storage.max_total_storage = 24
atom_storage.set_holdable(list(
/obj/item/clothing/head/helmet/infiltrator,
/obj/item/clothing/suit/armor/vest/infiltrator,
/obj/item/clothing/under/syndicate/bloodred,
@@ -385,11 +385,10 @@
/obj/item/storage/box/syndie_kit/space
name = "boxed space suit and helmet"
/obj/item/storage/box/syndie_kit/space/ComponentInitialize()
/obj/item/storage/box/syndie_kit/space/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_w_class = WEIGHT_CLASS_NORMAL
STR.set_holdable(list(/obj/item/clothing/suit/space/syndicate, /obj/item/clothing/head/helmet/space/syndicate))
atom_storage.max_specific_storage = WEIGHT_CLASS_NORMAL
atom_storage.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))
@@ -411,10 +410,9 @@
/obj/item/storage/box/syndie_kit/chemical
name = "chemical kit"
/obj/item/storage/box/syndie_kit/chemical/ComponentInitialize()
/obj/item/storage/box/syndie_kit/chemical/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_items = 14
atom_storage.max_slots = 14
/obj/item/storage/box/syndie_kit/chemical/PopulateContents()
new /obj/item/reagent_containers/glass/bottle/polonium(src)
+3 -5
View File
@@ -5,17 +5,15 @@
w_class = WEIGHT_CLASS_SMALL
resistance_flags = FLAMMABLE
slot_flags = ITEM_SLOT_ID
component_type = /datum/component/storage/concrete/wallet
var/obj/item/card/id/front_id = null
var/list/combined_access
var/cached_flat_icon
/obj/item/storage/wallet/ComponentInitialize()
/obj/item/storage/wallet/Initialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage/concrete/wallet)
STR.max_items = 4
STR.set_holdable(list(
atom_storage.max_slots = 4
atom_storage.set_holdable(list(
/obj/item/stack/spacecash,
/obj/item/holochip,
/obj/item/card,
+5 -6
View File
@@ -184,7 +184,7 @@ GLOBAL_LIST_EMPTY(tcgcard_radial_choices)
/obj/item/tcgcard_deck/Initialize(mapload)
. = ..()
LoadComponent(/datum/component/storage/concrete/tcg)
create_storage(type = /datum/storage/tcg)
/obj/item/tcgcard_deck/update_icon_state()
if(!flipped)
@@ -284,7 +284,7 @@ GLOBAL_LIST_EMPTY(tcgcard_radial_choices)
return
contents = shuffle(contents)
if(user.active_storage)
user.active_storage.close(user)
user.active_storage.hide_contents(user)
if(visable)
user.visible_message(span_notice("[user] shuffles \the [src]!"), \
span_notice("You shuffle \the [src]!"))
@@ -396,10 +396,9 @@ GLOBAL_LIST_EMPTY(tcgcard_radial_choices)
/obj/item/storage/card_binder/Initialize(mapload)
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.set_holdable(list(/obj/item/tcgcard))
STR.max_combined_w_class = 120
STR.max_items = 60
atom_storage.set_holdable(list(/obj/item/tcgcard))
atom_storage.max_total_storage = 120
atom_storage.max_slots = 60
///Returns a list of cards ids of card_cnt weighted by rarity from the pack's tables that have matching series, with gnt_cnt of the guarenteed table.
/obj/item/cardpack/proc/buildCardListWithRarity(card_cnt, rarity_cnt)