diff --git a/modular_bandastation/objects/_objects.dme b/modular_bandastation/objects/_objects.dme index 3c50b0a43eb25..6f301ca7ddbb7 100644 --- a/modular_bandastation/objects/_objects.dme +++ b/modular_bandastation/objects/_objects.dme @@ -1,4 +1,5 @@ #include "_objects.dm" +#include "code/papershredder.dm" #include "code/material_pouch.dm" #include "code/structures/posters.dm" diff --git a/modular_bandastation/objects/code/papershredder.dm b/modular_bandastation/objects/code/papershredder.dm new file mode 100644 index 0000000000000..568b04fdfc9d6 --- /dev/null +++ b/modular_bandastation/objects/code/papershredder.dm @@ -0,0 +1,106 @@ +/obj/machinery/papershredder + name = "\improper paper shredder" + desc = "For those documents you don't want seen." + icon = 'modular_bandastation/objects/icons/papershredder.dmi' + icon_state = "papershredder0" + density = TRUE + anchored = TRUE + var/max_paper = 15 + var/paper_amount = 0 + var/list/shred_amounts = list( + /obj/item/photo = 1, + /obj/item/shredded_paper = 1, + /obj/item/paper = 1, + /obj/item/newspaper = 3, + /obj/item/card/id = 3, + /obj/item/folder = 4, + /obj/item/book = 5 + ) + +/obj/machinery/papershredder/Initialize(mapload) + . = ..() + AddElement(/datum/element/contextual_screentip_bare_hands, rmb_text = "Empty shredded paper bin") + register_context() + +/obj/machinery/papershredder/add_context(atom/source, list/context, obj/item/held_item, mob/user) + . = ..() + if(held_item.tool_behaviour == TOOL_WRENCH) + context[SCREENTIP_CONTEXT_LMB] = anchored ? "Unanchor" : "Anchor" + return CONTEXTUAL_SCREENTIP_SET + if(held_item.type in shred_amounts) + context[SCREENTIP_CONTEXT_LMB] = "Shred item" + return CONTEXTUAL_SCREENTIP_SET + return NONE + +/obj/machinery/papershredder/attack_hand_secondary(mob/user, list/modifiers) + . = ..() + if(. == SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN) + return + empty_contents(user) + return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN + +/obj/machinery/papershredder/attackby(obj/item/item, mob/user, params) + if(!(item.type in shred_amounts)) + return ..() + if(paper_amount == max_paper) + to_chat(user, span_warning("[src] is full. Please empty it before you continue.")) + return + var/paper_result = shred_amounts[item.type] + paper_amount += paper_result + qdel(item) + playsound(loc, 'modular_bandastation/objects/sounds/pshred.ogg', 75, 1) + update_icon_state() + add_fingerprint(user) + +/obj/machinery/papershredder/wrench_act(mob/living/user, obj/item/tool) + . = ..() + default_unfasten_wrench(user, tool) + return ITEM_INTERACT_SUCCESS + +/obj/machinery/papershredder/examine(mob/user) + . = ..() + . += span_info("Right-Click to empty [src].") + +/obj/machinery/papershredder/proc/empty_contents(mob/living/user) + if(HAS_TRAIT(user, TRAIT_RESTRAINED)) + to_chat(user, span_warning("You need your hands free for this.")) + return + + if(!paper_amount) + to_chat(user, span_notice("[src] is empty.")) + return + + get_shredded_paper() + update_icon_state() + +/obj/machinery/papershredder/proc/get_shredded_paper() + if(!paper_amount) + return + paper_amount-- + return new /obj/item/shredded_paper(get_turf(src)) + +/obj/machinery/papershredder/update_icon_state() + icon_state = "papershredder[clamp(round(paper_amount/3), 0, 5)]" + return ..() + +/obj/item/shredded_paper + name = "shredded paper" + icon = 'modular_bandastation/objects/icons/papershredder.dmi' + icon_state = "shredp" + throwforce = 0 + w_class = WEIGHT_CLASS_TINY + resistance_flags = FLAMMABLE + layer = BELOW_MOB_LAYER + max_integrity = 25 + throw_range = 3 + throw_speed = 2 + +/obj/item/shredded_paper/Initialize() + . = ..() + if(prob(65)) + color = pick("#8b8b8b","#e7e4e4", "#c9c9c9") + +/obj/item/shredded_paper/attackby(obj/item/attacking_item, mob/user, params) + if(burn_paper_product_attackby_check(attacking_item, user)) + return + . = ..() diff --git a/modular_bandastation/objects/icons/papershredder.dmi b/modular_bandastation/objects/icons/papershredder.dmi new file mode 100644 index 0000000000000..2cb519d6d4a20 Binary files /dev/null and b/modular_bandastation/objects/icons/papershredder.dmi differ diff --git a/modular_bandastation/objects/sounds/pshred.ogg b/modular_bandastation/objects/sounds/pshred.ogg new file mode 100644 index 0000000000000..a722f30068992 Binary files /dev/null and b/modular_bandastation/objects/sounds/pshred.ogg differ