Files
Bubberstation/code/game/objects/items/storage/briefcase.dm
T
magatsuchi 7d0f393f5d 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.
2022-07-08 18:13:18 -07:00

74 lines
3.0 KiB
Plaintext

/obj/item/storage/briefcase
name = "briefcase"
desc = "It's made of AUTHENTIC faux-leather and has a price-tag still attached. Its owner must be a real professional."
icon_state = "briefcase"
lefthand_file = 'icons/mob/inhands/equipment/briefcase_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/briefcase_righthand.dmi'
flags_1 = CONDUCT_1
force = 8
hitsound = SFX_SWING_HIT
throw_speed = 2
throw_range = 4
w_class = WEIGHT_CLASS_BULKY
attack_verb_continuous = list("bashes", "batters", "bludgeons", "thrashes", "whacks")
attack_verb_simple = list("bash", "batter", "bludgeon", "thrash", "whack")
resistance_flags = FLAMMABLE
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/Initialize()
. = ..()
atom_storage.max_specific_storage = WEIGHT_CLASS_NORMAL
atom_storage.max_total_storage = 21
/obj/item/storage/briefcase/PopulateContents()
new /obj/item/pen(src)
var/obj/item/folder/folder = new folder_path(src)
for(var/i in 1 to 6)
new /obj/item/paper(folder)
/obj/item/storage/briefcase/lawyer
folder_path = /obj/item/folder/blue
/obj/item/storage/briefcase/lawyer/PopulateContents()
new /obj/item/stamp/law(src)
..()
/obj/item/storage/briefcase/suicide_act(mob/user)
var/list/papers_found = list()
var/turf/item_loc = get_turf(src)
if(!item_loc)
return OXYLOSS
for(var/obj/item/potentially_paper in contents)
if(istype(potentially_paper, /obj/item/paper) || istype(potentially_paper, /obj/item/paperplane))
papers_found += potentially_paper
if(!papers_found.len || !item_loc)
user.visible_message(span_suicide("[user] bashes [user.p_them()]self in the head with [src]! It looks like [user.p_theyre()] trying to commit suicide!"))
return BRUTELOSS
user.visible_message(span_suicide("[user] opens [src] and all of [user.p_their()] papers fly out!"))
for(var/obj/item/paper as anything in papers_found) //Throws the papers in a random direction
var/turf/turf_to_throw_at = prob(20) ? item_loc : get_ranged_target_turf(item_loc, pick(GLOB.alldirs))
paper.throw_at(turf_to_throw_at, 2)
stoplag(1 SECONDS)
user.say("ARGGHH, HOW WILL I GET THIS WORK DONE NOW?!!")
user.visible_message(span_suicide("[user] looks overwhelmed with paperwork! It looks like [user.p_theyre()] trying to commit suicide!"))
return OXYLOSS
/obj/item/storage/briefcase/sniperbundle
desc = "Its label reads \"genuine hardened Captain leather\", but suspiciously has no other tags or branding. Smells like L'Air du Temps."
force = 10
/obj/item/storage/briefcase/sniperbundle/PopulateContents()
..() // in case you need any paperwork done after your rampage
new /obj/item/gun/ballistic/automatic/sniper_rifle/syndicate(src)
new /obj/item/clothing/neck/tie/red/hitman(src)
new /obj/item/clothing/under/syndicate/sniper(src)
new /obj/item/ammo_box/magazine/sniper_rounds/soporific(src)
new /obj/item/ammo_box/magazine/sniper_rounds/soporific(src)
new /obj/item/suppressor/specialoffer(src)