diff --git a/code/modules/mining/machine_stacking.dm b/code/modules/mining/machine_stacking.dm index 2392d22bdb2d..697646c1b892 100644 --- a/code/modules/mining/machine_stacking.dm +++ b/code/modules/mining/machine_stacking.dm @@ -61,9 +61,17 @@ src.updateUsrDialog() return +/obj/machinery/mineral/stacking_unit_console/attackby(obj/item/W, mob/user, params) + if(default_deconstruction_screwdriver(user, "console-open", "console", W)) + updateUsrDialog() + return + if(default_deconstruction_crowbar(W)) + return + return ..() /**********************Mineral stacking unit**************************/ - +#define INPUT 0 +#define OUTPUT 1 /obj/machinery/mineral/stacking_machine name = "stacking machine" @@ -81,6 +89,19 @@ var/stack_amt = 50 //amount to stack before releassing var/datum/component/remote_materials/materials var/force_connect = FALSE + var/io = INPUT //This is used for determining whether we change the Input or Output + + +/obj/machinery/mineral/stacking_machine/examine(mob/user) + . = ..() + . += "Currently outputting stacks at [stack_amt] sheet[(stack_amt > 1) ? "s" : ""]" + if(panel_open) + . += "The I/O is set to change [io ? "output" : "input"] currently." + . += "Input is [dir2text(input_dir)]" + . += "Output is [dir2text(output_dir)]." + . += "There is a dial that can be turned by hand to change direction." + . += "The I/O setting can be changed with a multitool to change what the dial controls." + . += "There are some bolts to limit stack size." /obj/machinery/mineral/stacking_machine/Initialize(mapload) . = ..() @@ -88,17 +109,11 @@ materials = AddComponent(/datum/component/remote_materials, "stacking", mapload, FALSE, mapload && force_connect) /obj/machinery/mineral/stacking_machine/HasProximity(atom/movable/AM) + if(panel_open || (stat & (BROKEN|NOPOWER))) + return if(istype(AM, /obj/item/stack/sheet) && AM.loc == get_step(src, input_dir)) process_sheet(AM) -/obj/machinery/mineral/stacking_machine/multitool_act(mob/living/user, obj/item/multitool/M) - if(istype(M)) - if(istype(M.buffer, /obj/machinery/mineral/stacking_unit_console)) - CONSOLE = M.buffer - CONSOLE.machine = src - to_chat(user, "You link [src] to the console in [M]'s buffer.") - return TRUE - /obj/machinery/mineral/stacking_machine/proc/process_sheet(obj/item/stack/sheet/inp) var/key = inp.merge_type var/obj/item/stack/sheet/storage = stack_list[key] @@ -120,3 +135,51 @@ var/obj/item/stack/sheet/out = new inp.type(null, stack_amt) unload_mineral(out) storage.amount -= stack_amt + +/obj/machinery/mineral/stacking_machine/attackby(obj/item/W, mob/user, params) + if(default_deconstruction_screwdriver(user, "stacker-open", "stacker", W)) + updateUsrDialog() + return + if(default_deconstruction_crowbar(W)) + return + + if(!powered()) + return + + if(W.tool_behaviour == TOOL_WRENCH && panel_open) + var/stsize = input(user, "How much should [src] stack to? (1-50)", "Stack size") as null|num + if(stsize) + stack_amt = CLAMP(stsize,1,50) + to_chat(user, "[src] is now set to output [stack_amt] sheet[(stack_amt > 1) ? "s" : ""]") + return + + return ..() + +/obj/machinery/mineral/stacking_machine/attack_hand(mob/user) + if(!panel_open) + return ..() + if(io == INPUT) + input_dir = turn(input_dir, -90) + if(input_dir == output_dir) //Input and output can't be the same or you create the immovable sheet. + input_dir = turn(input_dir, -90) + to_chat(user, "You set [src]'s input to take from the [dir2text(input_dir)].") + return + else if (io == OUTPUT) + output_dir = turn(output_dir, -90) + if(input_dir == output_dir) + output_dir = turn(output_dir, -90) + to_chat(user, "You set [src]'s output to drop stacks [dir2text(output_dir)].") + return + return ..() + +/obj/machinery/mineral/stacking_machine/multitool_act(mob/living/user, obj/item/multitool/M) + if(istype(M)) + if(istype(M.buffer, /obj/machinery/mineral/stacking_unit_console) && !panel_open) + CONSOLE = M.buffer + CONSOLE.machine = src + to_chat(user, "You link [src] to the console in [M]'s buffer.") + return TRUE + if(panel_open) + io = !io + to_chat(user, "You set the I/O to change [io ? "output" : "input"].") + return TRUE diff --git a/icons/obj/machines/mining_machines.dmi b/icons/obj/machines/mining_machines.dmi index 28d608125d70..ed2580befc6c 100644 Binary files a/icons/obj/machines/mining_machines.dmi and b/icons/obj/machines/mining_machines.dmi differ