mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-16 17:49:27 +01:00
Closes #77631 ## About The Pull Request Hey there, Ticked File Enforcement simply wasn't catching files that were missed. That's a bit stupid, so I decided to look into what the issue might be, and whoopsie daisies I did double periods back in #76592 (020ac24053).  I also added some debug info and some more checks to prevent such a break from happening again on runtime of this script. I thought it was a weird string concatenation issue (and not the simple break I thought it was), so I rewrote how it adds `glob`s. I think it's cleaner so I'll keep it anyhow This PR also corrects the oversight of the missing unit test (introduced in #77218 (69827604c4)) by reticking it in the `_unit_tests.dm` file, and also makes it compile because it didn't do that. I also then had to do some more work to get the unit test to work. * Genericizes the Create-and-Destroy "ignore" list to be a static list on `/datum/unit_test` to allow it to be shared between these types of tests that we need to test. * Adds that list to C&D and the broken unit test regarding fantasy bonuses * Fixes some actually broken that the unit test was made to catch (beam rifles, butterdogs and other slippery items, random ingredient boxes). * Adds cases for things that the unit test and overall framework really shouldn't be altering anyways (mythril), and was likely causing inappropriate stack traces on master ## Why It's Good For The Game Unit Tests WORK. Tools WORK.  ## Changelog 🆑 fix: Beam rifles will no longer inappropriately retain any bonuses they may gain from wizardry. fix: Inappropriate stack traces over bonuses being applied to components that gain bonuses innately (like Mythril stacks) should cease. /🆑
113 lines
3.5 KiB
Plaintext
113 lines
3.5 KiB
Plaintext
/obj/item/storage
|
|
name = "storage"
|
|
icon = 'icons/obj/storage/storage.dmi'
|
|
w_class = WEIGHT_CLASS_NORMAL
|
|
var/rummage_if_nodrop = TRUE
|
|
/// Should we preload the contents of this type?
|
|
/// BE CAREFUL, THERE'S SOME REALLY NASTY SHIT IN THIS TYPEPATH
|
|
/// SANTA IS EVIL
|
|
var/preload = FALSE
|
|
/// What storage type to use for this item
|
|
var/datum/storage/storage_type = /datum/storage
|
|
|
|
/obj/item/storage/apply_fantasy_bonuses(bonus)
|
|
. = ..()
|
|
if(isnull(atom_storage)) // some abstract types of storage (yes i know) don't get a datum
|
|
return
|
|
|
|
atom_storage.max_slots = modify_fantasy_variable("max_slots", atom_storage.max_slots, round(bonus/2))
|
|
atom_storage.max_total_storage = modify_fantasy_variable("max_total_storage", atom_storage.max_total_storage, round(bonus/2))
|
|
LAZYSET(fantasy_modifications, "max_specific_storage", atom_storage.max_specific_storage)
|
|
if(bonus >= 15)
|
|
atom_storage.max_specific_storage = max(WEIGHT_CLASS_HUGE, atom_storage.max_specific_storage)
|
|
else if(bonus >= 10)
|
|
atom_storage.max_specific_storage = max(WEIGHT_CLASS_BULKY, atom_storage.max_specific_storage)
|
|
else if(bonus <= -10)
|
|
atom_storage.max_specific_storage = WEIGHT_CLASS_SMALL
|
|
else if(bonus <= -15)
|
|
atom_storage.max_specific_storage = WEIGHT_CLASS_TINY
|
|
|
|
/obj/item/storage/remove_fantasy_bonuses(bonus)
|
|
if(isnull(atom_storage)) // some abstract types of storage (yes i know) don't get a datum
|
|
return ..()
|
|
|
|
atom_storage.max_slots = reset_fantasy_variable("max_slots", atom_storage.max_slots)
|
|
atom_storage.max_total_storage = reset_fantasy_variable("max_total_storage", atom_storage.max_total_storage)
|
|
var/previous_max_storage = LAZYACCESS(fantasy_modifications, "max_specific_storage")
|
|
LAZYREMOVE(fantasy_modifications, "max_specific_storage")
|
|
if(previous_max_storage)
|
|
atom_storage.max_specific_storage = previous_max_storage
|
|
return ..()
|
|
|
|
/obj/item/storage/Initialize(mapload)
|
|
. = ..()
|
|
|
|
create_storage(storage_type = storage_type)
|
|
|
|
PopulateContents()
|
|
|
|
for (var/obj/item/item in src)
|
|
item.item_flags |= IN_STORAGE
|
|
|
|
/obj/item/storage/create_storage(
|
|
max_slots,
|
|
max_specific_storage,
|
|
max_total_storage,
|
|
numerical_stacking,
|
|
allow_quick_gather,
|
|
allow_quick_empty,
|
|
collection_mode,
|
|
attack_hand_interact,
|
|
list/canhold,
|
|
list/canthold,
|
|
storage_type,
|
|
)
|
|
if(!storage_type) // If no type was passed in, default to what we already have
|
|
storage_type = src.storage_type
|
|
return ..()
|
|
|
|
|
|
/obj/item/storage/AllowDrop()
|
|
return FALSE
|
|
|
|
/obj/item/storage/contents_explosion(severity, target)
|
|
switch(severity)
|
|
if(EXPLODE_DEVASTATE)
|
|
SSexplosions.high_mov_atom += contents
|
|
if(EXPLODE_HEAVY)
|
|
SSexplosions.med_mov_atom += contents
|
|
if(EXPLODE_LIGHT)
|
|
SSexplosions.low_mov_atom += contents
|
|
|
|
/obj/item/storage/canStrip(mob/who)
|
|
. = ..()
|
|
if(!. && rummage_if_nodrop)
|
|
return TRUE
|
|
|
|
/obj/item/storage/doStrip(mob/who)
|
|
if(HAS_TRAIT(src, TRAIT_NODROP) && rummage_if_nodrop)
|
|
atom_storage.remove_all()
|
|
return TRUE
|
|
return ..()
|
|
|
|
/obj/item/storage/contents_explosion(severity, target)
|
|
//Cyberboss says: "USE THIS TO FILL IT, NOT INITIALIZE OR NEW"
|
|
|
|
/obj/item/storage/proc/PopulateContents()
|
|
|
|
/obj/item/storage/proc/emptyStorage()
|
|
atom_storage.remove_all()
|
|
|
|
/obj/item/storage/Destroy()
|
|
for(var/obj/important_thing in contents)
|
|
if(!(important_thing.resistance_flags & INDESTRUCTIBLE))
|
|
continue
|
|
important_thing.forceMove(drop_location())
|
|
return ..()
|
|
|
|
/// Returns a list of object types to be preloaded by our code
|
|
/// I'll say it again, be very careful with this. We only need it for a few things
|
|
/// Don't do anything stupid, please
|
|
/obj/item/storage/proc/get_types_to_preload()
|
|
return
|