From eeaed3af6cb446e50c815ae16627df5cd27e7936 Mon Sep 17 00:00:00 2001 From: Sealed101 <75863639+Sealed101@users.noreply.github.com> Date: Fri, 10 Sep 2021 21:20:56 +0300 Subject: [PATCH] Autolathe fixes: screwdrivers are recyclable, no inserting mats with an open maint panel (#61275) Screwdrivers are now recyclable in the autolathe. Moves screwdrivering the maintenance panel to right click instead. Fixes being able to feed the autolathe while the maintenance panel is open. (if this is a feature (which i'm fairly certain it's not since i remember not being able to put things into the machine with the panel open) then we need sprites to support the feeding animation with the panel open). Trying to feed the machine with its panel open now produces a balloon message that points out the panel and its open state. Kills off three defines made obsolete by the #60800. --- code/game/machinery/autolathe.dm | 41 +++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/code/game/machinery/autolathe.dm b/code/game/machinery/autolathe.dm index b6721566fb4..700bb2b41d4 100644 --- a/code/game/machinery/autolathe.dm +++ b/code/game/machinery/autolathe.dm @@ -1,7 +1,3 @@ -#define AUTOLATHE_MAIN_MENU 1 -#define AUTOLATHE_CATEGORY_MENU 2 -#define AUTOLATHE_SEARCH_MENU 3 - /obj/machinery/autolathe name = "autolathe" desc = "It produces items using iron and glass." @@ -181,7 +177,7 @@ var/multiplier = text2num(params["multiplier"]) if(!multiplier) - to_chat(usr, "[src] only accepts a numerical multiplier!") + to_chat(usr, span_alert("[src] only accepts a numerical multiplier!")) return var/is_stack = ispath(being_built.build_path, /obj/item/stack) multiplier = clamp(round(multiplier),1,50) @@ -219,27 +215,24 @@ if(materials.has_materials(materials_used)) busy = TRUE - to_chat(usr, "You print [multiplier] item(s) from the [src]") + to_chat(usr, span_notice("You print [multiplier] item(s) from the [src]")) use_power(power) icon_state = "autolathe_n" var/time = is_stack ? 32 : (32 * coeff * multiplier) ** 0.8 addtimer(CALLBACK(src, .proc/make_item, power, materials_used, custom_materials, multiplier, coeff, is_stack, usr), time) . = TRUE else - to_chat(usr, "Not enough materials for this operation.") + to_chat(usr, span_alert("Not enough materials for this operation.")) else - to_chat(usr, "The autolathe is busy. Please wait for completion of previous operation.") + to_chat(usr, span_alert("The autolathe is busy. Please wait for completion of previous operation.")) /obj/machinery/autolathe/on_deconstruction() var/datum/component/material_container/materials = GetComponent(/datum/component/material_container) materials.retrieve_all() /obj/machinery/autolathe/attackby(obj/item/O, mob/living/user, params) - if (busy) - to_chat(user, "The autolathe is busy. Please wait for completion of previous operation.") - return TRUE - - if(default_deconstruction_screwdriver(user, "autolathe_t", "autolathe", O)) + if(busy) + balloon_alert(user, "it's busy!") return TRUE if(default_deconstruction_crowbar(O)) @@ -257,7 +250,7 @@ if(istype(O, /obj/item/disk/design_disk)) user.visible_message(span_notice("[user] begins to load \the [O] in \the [src]..."), - span_notice("You begin to load a design from \the [O]..."), + balloon_alert(user, "uploading design..."), span_hear("You hear the chatter of a floppy drive.")) busy = TRUE var/obj/item/disk/design_disk/D = O @@ -268,8 +261,28 @@ busy = FALSE return TRUE + if(panel_open) + balloon_alert(user, "close the panel first!") + return FALSE + return ..() +/obj/machinery/autolathe/attackby_secondary(obj/item/weapon, mob/living/user, params) + if(busy) + balloon_alert(user, "it's busy!") + return TRUE + + if(default_deconstruction_screwdriver(user, "autolathe_t", "autolathe", weapon)) + return FALSE //returning this as FALSE prevents the screwdriver from being immediately eaten by the autolathe after you screw the panel open/closed. why? don't ask me + + if(machine_stat) + return TRUE + + if(panel_open) + balloon_alert(user, "close the panel first!") + return FALSE + + return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN /obj/machinery/autolathe/proc/AfterMaterialInsert(obj/item/item_inserted, id_inserted, amount_inserted) if(istype(item_inserted, /obj/item/stack/ore/bluespace_crystal))