diff --git a/code/datums/elements/tool_blocker.dm b/code/datums/elements/tool_blocker.dm new file mode 100644 index 00000000000..e7fdefd6c87 --- /dev/null +++ b/code/datums/elements/tool_blocker.dm @@ -0,0 +1,24 @@ +/// Blocks using the passed tool type on this atom +/datum/element/tool_blocker + element_flags = ELEMENT_BESPOKE + argument_hash_start_idx = 2 + var/tool_type + +/datum/element/tool_blocker/Attach(datum/target, tool_type) + . = ..() + src.tool_type = tool_type + RegisterSignals(target, list( + COMSIG_ATOM_TOOL_ACT(tool_type), + COMSIG_ATOM_SECONDARY_TOOL_ACT(tool_type), + ), PROC_REF(block_tool)) + +/datum/element/tool_blocker/Detach(datum/source, ...) + UnregisterSignal(source, list( + COMSIG_ATOM_TOOL_ACT(tool_type), + COMSIG_ATOM_SECONDARY_TOOL_ACT(tool_type), + )) + return ..() + +/datum/element/tool_blocker/proc/block_tool(...) + SIGNAL_HANDLER + return ITEM_INTERACT_SKIP_TO_ATTACK diff --git a/code/game/machinery/_machinery.dm b/code/game/machinery/_machinery.dm index 6e4968b1ac8..fc61e5f062e 100644 --- a/code/game/machinery/_machinery.dm +++ b/code/game/machinery/_machinery.dm @@ -626,6 +626,10 @@ var/old_value = panel_open panel_open = new_value on_set_panel_open(old_value) + update_appearance() + // if this is a machine that cares about whether the panel is open for UIs, force an update + if(interaction_flags_machine & (INTERACT_MACHINE_OPEN_SILICON|INTERACT_MACHINE_OPEN)) + SStgui.update_uis(src) ///Called when the value of `panel_open` changes, so we can react to it. /obj/machinery/proc/on_set_panel_open(old_value) @@ -838,26 +842,81 @@ update_current_power_usage() SEND_SIGNAL(src, COMSIG_MACHINERY_REFRESH_PARTS) -/obj/machinery/proc/default_pry_open(obj/item/crowbar, close_after_pry = FALSE, open_density = FALSE, closed_density = TRUE) +/** + * Checks if the machine is in a state where it can be pried open with a crowbar, + * which is used by the default crowbar pry open method. + */ +/obj/machinery/proc/can_crowbar_pry_open() + PROTECTED_PROC(TRUE) + return !state_open && !panel_open && !is_operational + +/** + * Default method for prying a machine open, setting it to open state + * + * * crowbar - The crowbar being used to pry the machine open. + * You do not have to assert the crowbar is a crowbar, it is checked for you. + * * close_after_pry - If TRUE, the machine will immediately close after being pried open. Defaults to FALSE. + * Best used for machines that don't have a real open state, effectively making this proc a "dump contents on crowbar" action. + * * open_density - If TRUE, the machine will be set to dense when pried open. Defaults to FALSE. + * * closed_density - If TRUE, the machine will be set to dense when closed after being pried open. Defaults to TRUE. + * Only applies if close_after_pry is TRUE. + * * deconstruct_on_fail - If TRUE, runs default_deconstruction_crowbar if the machine cannot be pried open. Defaults to FALSE. + * + * Returns NONE on failure + * Returns ITEM_INTERACT_SUCCESS on success + */ +/obj/machinery/proc/default_pry_open( + mob/living/user, + obj/item/crowbar, + close_after_pry = FALSE, + open_density = FALSE, + closed_density = TRUE, + deconstruct_on_fail = FALSE, +) PROTECTED_PROC(TRUE) - . = !(state_open || panel_open || is_operational) && crowbar.tool_behaviour == TOOL_CROWBAR - if(!.) - return + if(crowbar.tool_behaviour != TOOL_CROWBAR) + return NONE + if(!can_crowbar_pry_open()) + return deconstruct_on_fail ? default_deconstruction_crowbar(user, crowbar) : ITEM_INTERACT_BLOCKING + crowbar.play_tool_sound(src, 50) - visible_message(span_notice("[usr] pries open \the [src]."), span_notice("You pry open \the [src].")) + user.visible_message(span_notice("[user] pries open [src]."), span_notice("You pry open [src].")) open_machine(density_to_set = open_density) if (close_after_pry) //Should it immediately close after prying? (If not, it must be closed elsewhere) close_machine(density_to_set = closed_density) + return ITEM_INTERACT_SUCCESS -/obj/machinery/proc/default_deconstruction_crowbar(obj/item/crowbar, ignore_panel = 0, custom_deconstruct = FALSE) +/** + * Checks if the machine is in a state where it can be deconstructed with a crowbar, + * which is used by the default crowbar deconstruction method. + */ +/obj/machinery/proc/can_crowbar_deconstruct() + PROTECTED_PROC(TRUE) + return panel_open + +/** + * Default method of deconstructing a machine with a crowbar + * Requires panel be open to work, unless ignore_panel is set to TRUE. + * + * * crowbar - The crowbar being used to deconstruct the machine. + * You do not have to assert the crowbar is a crowbar, it is checked for you. + * + * Returns NONE on failure, or if custom_deconstruct is set to TRUE. + * Returns ITEM_INTERACT_SUCCESS on success. + */ +/obj/machinery/proc/default_deconstruction_crowbar(mob/living/user, obj/item/crowbar) PROTECTED_PROC(TRUE) - . = (panel_open || ignore_panel) && crowbar.tool_behaviour == TOOL_CROWBAR - if(!. || custom_deconstruct) - return + if(crowbar.tool_behaviour != TOOL_CROWBAR) + return NONE + if(!can_crowbar_deconstruct()) + return ITEM_INTERACT_BLOCKING + crowbar.play_tool_sound(src, 50) + // user.visible_message(span_notice("[user] deconstructs [src]."), span_notice("You deconstruct [src].")) deconstruct(TRUE) + return ITEM_INTERACT_SUCCESS /obj/machinery/handle_deconstruct(disassembled = TRUE) SHOULD_NOT_OVERRIDE(TRUE) @@ -973,29 +1032,45 @@ for(var/atom/atom_part in old_components) qdel(atom_part) -/obj/machinery/proc/default_deconstruction_screwdriver(mob/user, icon_state_open, icon_state_closed, obj/item/screwdriver) +/** + * Default method of opening a machine's maintenance panel with a screwdriver + * + * * user - The mob using the screwdriver + * * screwdriver - The screwdriver being used to open the panel. + * You do not have to assert the screwdriver is a screwdriver, it is checked for you. + * + * Returns NONE on failure + * Returns ITEM_INTERACT_SUCCESS on success + */ +/obj/machinery/proc/default_deconstruction_screwdriver(mob/user, obj/item/screwdriver) if(screwdriver.tool_behaviour != TOOL_SCREWDRIVER) - return FALSE + return NONE screwdriver.play_tool_sound(src, 50) toggle_panel_open() - if(panel_open) - icon_state = icon_state_open - to_chat(user, span_notice("You open the maintenance hatch of [src].")) - else - icon_state = icon_state_closed - to_chat(user, span_notice("You close the maintenance hatch of [src].")) - return TRUE + balloon_alert(user, "maintenance hatch [panel_open ? "opened" : "closed"]") + return ITEM_INTERACT_SUCCESS +/** + * Default method of rotating a machine with a wrench + * Requires panel to be opened to work. + * + * * user - The mob using the wrench + * * wrench - The wrench being used to rotate the machine + * You do not have to assert the wrench is a wrench, it is checked for you. + * + * Returns NONE on failure + * Returns ITEM_INTERACT_SUCCESS on success + */ /obj/machinery/proc/default_change_direction_wrench(mob/user, obj/item/wrench) if(!panel_open || wrench.tool_behaviour != TOOL_WRENCH) - return FALSE + return NONE wrench.play_tool_sound(src, 50) setDir(turn(dir,-90)) to_chat(user, span_notice("You rotate [src].")) SEND_SIGNAL(src, COMSIG_MACHINERY_DEFAULT_ROTATE_WRENCH, user, wrench) - return TRUE + return ITEM_INTERACT_SUCCESS /obj/machinery/proc/exchange_parts(mob/user, obj/item/storage/part_replacer/replacer_tool) if(!istype(replacer_tool) || !component_parts) diff --git a/code/game/machinery/announcement_system.dm b/code/game/machinery/announcement_system.dm index a66cd3209a2..d43bb608fc8 100644 --- a/code/game/machinery/announcement_system.dm +++ b/code/game/machinery/announcement_system.dm @@ -62,15 +62,10 @@ GLOBAL_LIST_EMPTY(announcement_systems) return ..() /obj/machinery/announcement_system/screwdriver_act(mob/living/user, obj/item/tool) - var/icon_state_assemble = "[base_icon_state]_[is_operational && !(machine_stat & EMPED) ? "On" : "Off"]" - if(default_deconstruction_screwdriver(user, "[icon_state_assemble]_Open", icon_state_assemble, tool)) - return ITEM_INTERACT_SUCCESS - return ITEM_INTERACT_BLOCKING + return default_deconstruction_screwdriver(user, tool) /obj/machinery/announcement_system/crowbar_act(mob/living/user, obj/item/tool) - . = ..() - if(default_deconstruction_crowbar(tool)) - return ITEM_INTERACT_SUCCESS + return default_deconstruction_crowbar(user, tool) /obj/machinery/announcement_system/multitool_act(mob/living/user, obj/item/tool) if(!panel_open || !(machine_stat & EMPED)) diff --git a/code/game/machinery/atmos_field_gen.dm b/code/game/machinery/atmos_field_gen.dm index 91749477395..d5fc514f5af 100644 --- a/code/game/machinery/atmos_field_gen.dm +++ b/code/game/machinery/atmos_field_gen.dm @@ -110,13 +110,13 @@ if(!panel_open && locked) balloon_alert(user, "locked!") return ITEM_INTERACT_FAILURE - return default_deconstruction_screwdriver(user, icon_state, icon_state, tool) + return default_deconstruction_screwdriver(user, tool) /obj/machinery/atmos_shield_gen/crowbar_act(mob/user, obj/item/tool) if(on) balloon_alert(user, "turn off first!") return ITEM_INTERACT_FAILURE - return default_deconstruction_crowbar(tool) + return default_deconstruction_crowbar(user, tool) /obj/machinery/atmos_shield_gen/wrench_act(mob/living/user, obj/item/tool) if(on) diff --git a/code/game/machinery/autolathe.dm b/code/game/machinery/autolathe.dm index fff9be1ef6b..3343bd9416e 100644 --- a/code/game/machinery/autolathe.dm +++ b/code/game/machinery/autolathe.dm @@ -3,6 +3,7 @@ desc = "It produces items using iron, glass, plastic and maybe some more." icon = 'icons/obj/machines/lathes.dmi' icon_state = "autolathe" + base_icon_state = "autolathe" density = TRUE ///Energy cost per full stack of sheets worth of materials used. Material insertion is 40% of this. active_power_usage = 0.025 * STANDARD_CELL_RATE @@ -88,14 +89,14 @@ return CONTEXTUAL_SCREENTIP_SET /obj/machinery/autolathe/crowbar_act(mob/living/user, obj/item/tool) - . = NONE - if(default_deconstruction_crowbar(tool)) - return ITEM_INTERACT_SUCCESS + return default_deconstruction_crowbar(user, tool) /obj/machinery/autolathe/screwdriver_act(mob/living/user, obj/item/tool) - . = ITEM_INTERACT_BLOCKING - if(default_deconstruction_screwdriver(user, "autolathe_t", "autolathe", tool)) - return ITEM_INTERACT_SUCCESS + return default_deconstruction_screwdriver(user, tool) + +/obj/machinery/autolathe/update_icon_state() + . = ..() + icon_state = busy ? "[base_icon_state]_n" : panel_open ? "[base_icon_state]_t" : base_icon_state /obj/machinery/autolathe/proc/AfterMaterialInsert(container, obj/item/item_inserted, last_inserted_id, mats_consumed, amount_inserted, atom/context) SIGNAL_HANDLER @@ -320,7 +321,7 @@ //do the printing sequentially busy = TRUE - icon_state = "autolathe_n" + update_appearance() SStgui.update_uis(src) // play this after all checks passed individually for each item. print_sound.start() @@ -427,8 +428,8 @@ /obj/machinery/autolathe/proc/finalize_build() PROTECTED_PROC(TRUE) print_sound.stop() - icon_state = initial(icon_state) busy = FALSE + update_appearance() SStgui.update_uis(src) /obj/machinery/autolathe/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) diff --git a/code/game/machinery/big_manipulator/big_manipulator.dm b/code/game/machinery/big_manipulator/big_manipulator.dm index 27d85155242..3a9e9d83d35 100644 --- a/code/game/machinery/big_manipulator/big_manipulator.dm +++ b/code/game/machinery/big_manipulator/big_manipulator.dm @@ -373,15 +373,10 @@ remove_all_huds() /obj/machinery/big_manipulator/screwdriver_act(mob/living/user, obj/item/tool) - if(default_deconstruction_screwdriver(user, icon_state, icon_state, tool)) - return ITEM_INTERACT_SUCCESS - return ITEM_INTERACT_BLOCKING + return default_deconstruction_screwdriver(user, tool) /obj/machinery/big_manipulator/crowbar_act(mob/living/user, obj/item/tool) - . = ..() - if(default_deconstruction_crowbar(tool)) - return ITEM_INTERACT_SUCCESS - return ITEM_INTERACT_BLOCKING + return default_deconstruction_crowbar(user, tool) /obj/machinery/big_manipulator/item_interaction(mob/living/user, obj/item/tool, list/modifiers) if(user.combat_mode) diff --git a/code/game/machinery/botlaunchpad.dm b/code/game/machinery/botlaunchpad.dm index 9cd9c647acc..857e9278af0 100644 --- a/code/game/machinery/botlaunchpad.dm +++ b/code/game/machinery/botlaunchpad.dm @@ -3,6 +3,7 @@ desc = "A lighter version of the orbital mech pad modified to launch bots. Requires linking to a remote to function." icon = 'icons/obj/machines/telepad.dmi' icon_state = "botpad" + base_icon_state = "botpad" circuit = /obj/item/circuitboard/machine/botpad // ID of the console, used for linking up var/id = "botlauncher" @@ -16,10 +17,15 @@ launched_bot = null return ..() +/obj/machinery/botpad/update_icon_state() + . = ..() + icon_state = panel_open ? "[base_icon_state]-open" : base_icon_state + /obj/machinery/botpad/screwdriver_act(mob/user, obj/item/tool) - return default_deconstruction_screwdriver(user, "botpad-open", "botpad", tool) + return default_deconstruction_screwdriver(user, tool) + /obj/machinery/botpad/crowbar_act(mob/user, obj/item/tool) - return default_deconstruction_crowbar(tool) + return default_deconstruction_crowbar(user, tool) /obj/machinery/botpad/multitool_act(mob/living/user, obj/item/multitool/tool) if(!panel_open) diff --git a/code/game/machinery/buttons.dm b/code/game/machinery/buttons.dm index c0a7ef8278c..c50f81bbb2e 100644 --- a/code/game/machinery/buttons.dm +++ b/code/game/machinery/buttons.dm @@ -176,9 +176,7 @@ /obj/machinery/button/screwdriver_act(mob/living/user, obj/item/tool) if(panel_open || allowed(user)) - default_deconstruction_screwdriver(user, "[base_icon_state][skin]-open", "[base_icon_state][skin]", tool) - update_appearance() - return ITEM_INTERACT_SUCCESS + return default_deconstruction_screwdriver(user, tool) balloon_alert(user, "access denied") flick_overlay_view("[base_icon_state]-overlay-error", 1 SECONDS) diff --git a/code/game/machinery/cell_charger.dm b/code/game/machinery/cell_charger.dm index 1149c819148..f27ff854b6f 100644 --- a/code/game/machinery/cell_charger.dm +++ b/code/game/machinery/cell_charger.dm @@ -34,47 +34,54 @@ . += span_notice("The status display reads: Charging power: [display_power(charge_rate, convert = FALSE)].") /obj/machinery/cell_charger/wrench_act(mob/living/user, obj/item/tool) - . = ..() if(charging) - return FALSE + return NONE if(default_unfasten_wrench(user, tool)) update_appearance() return ITEM_INTERACT_SUCCESS -/obj/machinery/cell_charger/attackby(obj/item/W, mob/user, list/modifiers, list/attack_modifiers) - if(istype(W, /obj/item/stock_parts/power_store/cell) && !panel_open) - if(machine_stat & BROKEN) - to_chat(user, span_warning("[src] is broken!")) - return - if(!anchored) - to_chat(user, span_warning("[src] isn't attached to the ground!")) - return - if(charging) - to_chat(user, span_warning("There is already a cell in the charger!")) - return - else - var/area/a = loc.loc // Gets our locations location, like a dream within a dream - if(!isarea(a)) - return - if(a.power_equip == 0) // There's no APC in this area, don't try to cheat power! - to_chat(user, span_warning("[src] blinks red as you try to insert the cell!")) - return - if(!user.transferItemToLoc(W,src)) - return +/obj/machinery/cell_charger/screwdriver_act(mob/living/user, obj/item/tool) + return charging ? NONE : default_deconstruction_screwdriver(user, tool) - charging = W - user.visible_message(span_notice("[user] inserts a cell into [src]."), span_notice("You insert a cell into [src].")) - update_appearance() - else - if(!charging && default_deconstruction_screwdriver(user, icon_state, icon_state, W)) - return - if(default_deconstruction_crowbar(W)) - return - return ..() +/obj/machinery/cell_charger/crowbar_act(mob/living/user, obj/item/tool) + return default_deconstruction_crowbar(user, tool) + +/obj/machinery/cell_charger/can_crowbar_deconstruct() + return ..() && !charging + +/obj/machinery/cell_charger/item_interaction(mob/living/user, obj/item/tool, list/modifiers) + if(!istype(tool, /obj/item/stock_parts/power_store/cell) || panel_open) + return NONE + + if(machine_stat & BROKEN) + to_chat(user, span_warning("[src] is broken!")) + return ITEM_INTERACT_BLOCKING + if(!anchored) + to_chat(user, span_warning("[src] isn't attached to the ground!")) + return ITEM_INTERACT_BLOCKING + if(charging) + to_chat(user, span_warning("There is already a cell in the charger!")) + return ITEM_INTERACT_BLOCKING + + var/area/charge_area = get_area(src) + if(!isarea(charge_area)) + return ITEM_INTERACT_BLOCKING + if(!charge_area.power_equip) // There's no APC in this area, don't try to cheat power! + to_chat(user, span_warning("[src] blinks red as you try to insert the cell!")) + return ITEM_INTERACT_BLOCKING + if(!user.transferItemToLoc(tool, src)) + return ITEM_INTERACT_BLOCKING + + charging = tool + user.visible_message( + span_notice("[user] inserts a cell into [src]."), + span_notice("You insert a cell into [src]."), + ) + update_appearance() + return ITEM_INTERACT_SUCCESS /obj/machinery/cell_charger/on_deconstruction(disassembled) - if(charging) - charging.forceMove(drop_location()) + charging?.forceMove(drop_location()) /obj/machinery/cell_charger/Exited(atom/movable/gone, direction) . = ..() diff --git a/code/game/machinery/civilian_bounty/bounty_machinery.dm b/code/game/machinery/civilian_bounty/bounty_machinery.dm index 96cae89c8d1..9ceeeed84aa 100644 --- a/code/game/machinery/civilian_bounty/bounty_machinery.dm +++ b/code/game/machinery/civilian_bounty/bounty_machinery.dm @@ -174,8 +174,7 @@ update_global_bounty_list(round(CIV_BOUNTY_BASELINE + (SSeconomy.civ_bounty_tracker / 3)), FALSE) pad.visible_message(span_notice("[pad] activates!")) - flick(pad.sending_state,pad) - pad.icon_state = pad.idle_state + pad.finish_sending() playsound(loc, 'sound/machines/synth/synth_yes.ogg', 30 , TRUE) sending = FALSE return TRUE diff --git a/code/game/machinery/dish_drive.dm b/code/game/machinery/dish_drive.dm index 00021f72484..840ab7a9a6e 100644 --- a/code/game/machinery/dish_drive.dm +++ b/code/game/machinery/dish_drive.dm @@ -5,6 +5,7 @@ Or you can just drop your plates on the floor, like civilized folk." icon = 'icons/obj/machines/kitchen.dmi' icon_state = "synthesizer" + base_icon_state = "synthesizer" active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION * 0.04 density = FALSE circuit = /obj/item/circuitboard/machine/dish_drive @@ -79,20 +80,27 @@ default_unfasten_wrench(user, tool) return ITEM_INTERACT_SUCCESS -/obj/machinery/dish_drive/attackby(obj/item/dish, mob/living/user, list/modifiers, list/attack_modifiers) - if(is_type_in_list(dish, collectable_items) && !user.combat_mode) - if(!user.transferItemToLoc(dish, src)) - return - LAZYADD(dish_drive_contents, dish) - balloon_alert(user, "[dish] placed in drive") +/obj/machinery/dish_drive/screwdriver_act(mob/living/user, obj/item/tool) + return default_deconstruction_screwdriver(user, tool) + +/obj/machinery/dish_drive/crowbar_act(mob/living/user, obj/item/tool) + return default_deconstruction_crowbar(user, tool) + +/obj/machinery/dish_drive/item_interaction(mob/living/user, obj/item/tool, list/modifiers) + if(is_type_in_list(tool, collectable_items) && !user.combat_mode) + if(!user.transferItemToLoc(tool, src)) + return ITEM_INTERACT_BLOCKING + LAZYADD(dish_drive_contents, tool) + balloon_alert(user, "[tool] placed in drive") playsound(src, 'sound/items/pshoom/pshoom.ogg', 50, TRUE) flick("synthesizer_beam", src) - return - else if(default_deconstruction_screwdriver(user, "[initial(icon_state)]-o", initial(icon_state), dish)) - return - else if(default_deconstruction_crowbar(dish, FALSE)) - return - ..() + return ITEM_INTERACT_SUCCESS + + return NONE + +/obj/machinery/dish_drive/update_icon_state() + . = ..() + icon_state = panel_open ? "[base_icon_state]-o" : base_icon_state /obj/machinery/dish_drive/RefreshParts() . = ..() diff --git a/code/game/machinery/dna_infuser/dna_infuser.dm b/code/game/machinery/dna_infuser/dna_infuser.dm index 8c8c0512bc3..50fe6869ca9 100644 --- a/code/game/machinery/dna_infuser/dna_infuser.dm +++ b/code/game/machinery/dna_infuser/dna_infuser.dm @@ -161,19 +161,23 @@ //we set drop to false to manually call it with an allowlist dump_inventory_contents(list(occupant)) -/obj/machinery/dna_infuser/attackby(obj/item/used, mob/user, list/modifiers, list/attack_modifiers) - if(infusing) - return - if(!occupant && default_deconstruction_screwdriver(user, icon_state, icon_state, used))//sent icon_state is irrelevant... - update_appearance()//..since we're updating the icon here, since the scanner can be unpowered when opened/closed - return - if(default_pry_open(used)) - return - if(default_deconstruction_crowbar(used)) - return - if(ismovable(used)) - add_infusion_item(used, user) - return ..() +/obj/machinery/dna_infuser/screwdriver_act(mob/living/user, obj/item/tool) + return infusing ? NONE : default_deconstruction_screwdriver(user, tool) + +/obj/machinery/dna_infuser/crowbar_act(mob/living/user, obj/item/tool) + return infusing ? NONE : default_pry_open(user, tool, deconstruct_on_fail = TRUE) + +/obj/machinery/dna_infuser/item_interaction(mob/living/user, obj/item/tool, list/modifiers) + if(user.combat_mode) + return NONE + // if the machine already has a infusion target, or the target is not valid then no adding. + if(!is_valid_infusion(tool, user)) + return ITEM_INTERACT_BLOCKING + if(!user.transferItemToLoc(tool, src)) + to_chat(user, span_warning("[tool] is stuck to your hand!")) + return ITEM_INTERACT_BLOCKING + infusing_from = tool + return ITEM_INTERACT_SUCCESS /obj/machinery/dna_infuser/relaymove(mob/living/user, direction) if(user.stat) @@ -190,16 +194,6 @@ //we set drop to false to manually call it with an allowlist dump_inventory_contents(list(occupant)) -// mostly good for dead mobs that turn into items like dead mice (smack to add). -/obj/machinery/dna_infuser/proc/add_infusion_item(obj/item/target, mob/user) - // if the machine already has a infusion target, or the target is not valid then no adding. - if(!is_valid_infusion(target, user)) - return - if(!user.transferItemToLoc(target, src)) - to_chat(user, span_warning("[target] is stuck to your hand!")) - return - infusing_from = target - // mostly good for dead mobs like corpses (drag to add). /obj/machinery/dna_infuser/mouse_drop_receive(atom/target, mob/user, params) // if the machine is closed, already has a infusion target, or the target is not valid then no mouse drop. diff --git a/code/game/machinery/dna_scanner.dm b/code/game/machinery/dna_scanner.dm index fe710418608..9dff3a3a1e0 100644 --- a/code/game/machinery/dna_scanner.dm +++ b/code/game/machinery/dna_scanner.dm @@ -125,19 +125,11 @@ return open_machine() -/obj/machinery/dna_scannernew/attackby(obj/item/item, mob/user, list/modifiers, list/attack_modifiers) +/obj/machinery/dna_scannernew/screwdriver_act(mob/living/user, obj/item/tool) + return occupant ? NONE : default_deconstruction_screwdriver(user, tool) - if(!occupant && default_deconstruction_screwdriver(user, icon_state, icon_state, item))//sent icon_state is irrelevant... - update_appearance()//..since we're updating the icon here, since the scanner can be unpowered when opened/closed - return - - if(default_pry_open(item, close_after_pry = FALSE, open_density = FALSE, closed_density = TRUE)) - return - - if(default_deconstruction_crowbar(item)) - return - - return ..() +/obj/machinery/dna_scannernew/crowbar_act(mob/living/user, obj/item/tool) + return default_pry_open(user, tool, close_after_pry = FALSE, open_density = FALSE, closed_density = TRUE, deconstruct_on_fail = TRUE) /obj/machinery/dna_scannernew/interact(mob/user) toggle_open(user) diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index 48c7b78fbc8..31ea8791848 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -436,9 +436,6 @@ return ITEM_INTERACT_SUCCESS /obj/machinery/door/crowbar_act(mob/living/user, obj/item/tool) - if(user.combat_mode) - return - var/forced_open = FALSE if(istype(tool, /obj/item/crowbar)) var/obj/item/crowbar/crowbar = tool diff --git a/code/game/machinery/doors/poddoor.dm b/code/game/machinery/doors/poddoor.dm index cfd1f99ba9b..ac2ef03abe7 100644 --- a/code/game/machinery/doors/poddoor.dm +++ b/code/game/machinery/doors/poddoor.dm @@ -146,26 +146,24 @@ return NONE /obj/machinery/door/poddoor/screwdriver_act(mob/living/user, obj/item/tool) - . = ..() if (density) balloon_alert(user, "open the door first!") return ITEM_INTERACT_SUCCESS - else if (default_deconstruction_screwdriver(user, icon_state, icon_state, tool)) - return ITEM_INTERACT_SUCCESS + + return default_deconstruction_screwdriver(user, tool) /obj/machinery/door/poddoor/crowbar_act(mob/living/user, obj/item/tool) - . = ..() if(machine_stat & NOPOWER) open(TRUE) return ITEM_INTERACT_SUCCESS if (density) balloon_alert(user, "open the door first!") - return ITEM_INTERACT_SUCCESS + return ITEM_INTERACT_BLOCKING if (!panel_open) balloon_alert(user, "open the panel first!") - return ITEM_INTERACT_SUCCESS + return ITEM_INTERACT_BLOCKING if (deconstruction != BLASTDOOR_FINISHED) - return + return ITEM_INTERACT_BLOCKING balloon_alert(user, "removing airlock electronics...") if(tool.use_tool(src, user, 10 SECONDS, volume = 50)) new /obj/item/electronics/airlock(loc) @@ -176,15 +174,14 @@ return ITEM_INTERACT_SUCCESS /obj/machinery/door/poddoor/wirecutter_act(mob/living/user, obj/item/tool) - . = ..() if (density) balloon_alert(user, "open the door first!") - return ITEM_INTERACT_SUCCESS + return ITEM_INTERACT_BLOCKING if (!panel_open) balloon_alert(user, "open the panel first!") - return ITEM_INTERACT_SUCCESS + return ITEM_INTERACT_BLOCKING if (deconstruction != BLASTDOOR_NEEDS_ELECTRONICS) - return + return ITEM_INTERACT_BLOCKING balloon_alert(user, "removing internal cables...") if(tool.use_tool(src, user, 10 SECONDS, volume = 50)) var/datum/crafting_recipe/recipe = locate(recipe_type) in GLOB.crafting_recipes diff --git a/code/game/machinery/ecto_sniffer.dm b/code/game/machinery/ecto_sniffer.dm index 6c7de7e5097..ba6f73c9a16 100644 --- a/code/game/machinery/ecto_sniffer.dm +++ b/code/game/machinery/ecto_sniffer.dm @@ -3,6 +3,7 @@ desc = "A highly sensitive parascientific instrument calibrated to detect the slightest whiff of ectoplasm." icon = 'icons/obj/machines/research.dmi' icon_state = "ecto_sniffer" + base_icon_state = "ecto_sniffer" density = FALSE anchored = FALSE pass_flags = PASSTABLE @@ -48,14 +49,14 @@ /obj/machinery/ecto_sniffer/update_icon_state() . = ..() if(panel_open) - icon_state = "[initial(icon_state)]_open" + icon_state = "[base_icon_state]_open" else - icon_state = "[initial(icon_state)][(is_operational && on) ? null : "-p"]" + icon_state = "[base_icon_state][(is_operational && on) ? null : "-p"]" /obj/machinery/ecto_sniffer/update_overlays() . = ..() if(is_operational && on) - . += emissive_appearance(icon, "[initial(icon_state)]-light-mask", src, alpha = src.alpha) + . += emissive_appearance(icon, "[base_icon_state]-light-mask", src, alpha = src.alpha) /obj/machinery/ecto_sniffer/wrench_act(mob/living/user, obj/item/tool) tool.play_tool_sound(src, 15) @@ -64,15 +65,10 @@ return ITEM_INTERACT_SUCCESS /obj/machinery/ecto_sniffer/screwdriver_act(mob/living/user, obj/item/screwdrivertool) - if(default_deconstruction_screwdriver(user, "ecto_sniffer_open", "ecto_sniffer", screwdrivertool)) - return ITEM_INTERACT_SUCCESS - return ITEM_INTERACT_BLOCKING - + return default_deconstruction_screwdriver(user, screwdrivertool) /obj/machinery/ecto_sniffer/crowbar_act(mob/living/user, obj/item/tool) - if(default_deconstruction_crowbar(tool)) - return ITEM_INTERACT_SUCCESS - return ITEM_INTERACT_BLOCKING + return default_deconstruction_crowbar(user, tool) /obj/machinery/ecto_sniffer/Destroy() ectoplasmic_residues = null diff --git a/code/game/machinery/fat_sucker.dm b/code/game/machinery/fat_sucker.dm index 0301aef0bf3..d9806ba6f2b 100644 --- a/code/game/machinery/fat_sucker.dm +++ b/code/game/machinery/fat_sucker.dm @@ -191,23 +191,16 @@ nutrients = 0 /obj/machinery/fat_sucker/screwdriver_act(mob/living/user, obj/item/I) - . = TRUE - if(..()) - return if(occupant) to_chat(user, span_warning("[src] is currently occupied!")) - return + return ITEM_INTERACT_BLOCKING if(state_open) to_chat(user, span_warning("[src] must be closed to [panel_open ? "close" : "open"] its maintenance hatch!")) - return - if(default_deconstruction_screwdriver(user, icon_state, icon_state, I)) - update_appearance() - return - return FALSE + return ITEM_INTERACT_BLOCKING + return default_deconstruction_screwdriver(user, I) /obj/machinery/fat_sucker/crowbar_act(mob/living/user, obj/item/I) - if(default_deconstruction_crowbar(I)) - return TRUE + return default_deconstruction_crowbar(user, I) /obj/machinery/fat_sucker/emag_act(mob/user, obj/item/card/emag/emag_card) if(obj_flags & EMAGGED) diff --git a/code/game/machinery/flatpacker.dm b/code/game/machinery/flatpacker.dm index 50490abef60..ad8c3f9a96e 100644 --- a/code/game/machinery/flatpacker.dm +++ b/code/game/machinery/flatpacker.dm @@ -261,15 +261,15 @@ return ..() +/obj/machinery/flatpacker/update_icon_state() + . = ..() + icon_state = panel_open ? "[base_icon_state]_o" : base_icon_state + /obj/machinery/flatpacker/screwdriver_act(mob/living/user, obj/item/tool) - . = ITEM_INTERACT_BLOCKING - if(default_deconstruction_screwdriver(user, "[base_icon_state]_o", base_icon_state, tool)) - return ITEM_INTERACT_SUCCESS + return default_deconstruction_screwdriver(user, tool) /obj/machinery/flatpacker/crowbar_act(mob/living/user, obj/item/tool) - . = ITEM_INTERACT_BLOCKING - if(default_deconstruction_crowbar(tool)) - return ITEM_INTERACT_SUCCESS + return default_deconstruction_crowbar(user, tool) /obj/machinery/flatpacker/ui_interact(mob/user, datum/tgui/ui) ui = SStgui.try_update_ui(user, src, ui) diff --git a/code/game/machinery/gulag_teleporter.dm b/code/game/machinery/gulag_teleporter.dm index c47cf1ea9d5..e4e6fc24291 100644 --- a/code/game/machinery/gulag_teleporter.dm +++ b/code/game/machinery/gulag_teleporter.dm @@ -53,18 +53,11 @@ The console is located at computer/gulag_teleporter.dm return toggle_open() -/obj/machinery/gulag_teleporter/attackby(obj/item/I, mob/user) - if(!occupant && default_deconstruction_screwdriver(user, "[icon_state]", "[icon_state]",I)) - update_appearance() - return +/obj/machinery/gulag_teleporter/screwdriver_act(mob/living/user, obj/item/tool) + return isnull(occupant) ? default_deconstruction_screwdriver(user, tool) : NONE - if(default_deconstruction_crowbar(I)) - return - - if(default_pry_open(I)) - return - - return ..() +/obj/machinery/gulag_teleporter/crowbar_act(mob/living/user, obj/item/tool) + return default_pry_open(user, tool, deconstruct_on_fail = TRUE) /obj/machinery/gulag_teleporter/update_icon_state() icon_state = "[base_icon_state][state_open ? "_open" : null]" diff --git a/code/game/machinery/harvester.dm b/code/game/machinery/harvester.dm index 0af6c9933a4..c2b5bd6c071 100644 --- a/code/game/machinery/harvester.dm +++ b/code/game/machinery/harvester.dm @@ -31,6 +31,9 @@ interval = max(max_time,1) /obj/machinery/harvester/update_icon_state() + if(panel_open) + icon_state = "[base_icon_state]-o" + return ..() if(state_open) icon_state = "[base_icon_state]-open" return ..() @@ -147,31 +150,19 @@ playsound(src, 'sound/machines/microwave/microwave-end.ogg', 100, FALSE) /obj/machinery/harvester/screwdriver_act(mob/living/user, obj/item/tool) - . = TRUE - if(..()) - return if(occupant) to_chat(user, span_warning("[src] is currently occupied!")) - return + return ITEM_INTERACT_BLOCKING if(state_open) to_chat(user, span_warning("[src] must be closed to [panel_open ? "close" : "open"] its maintenance hatch!")) - return - if(default_deconstruction_screwdriver(user, "[initial(icon_state)]-o", initial(icon_state), tool)) - return - return FALSE + return ITEM_INTERACT_BLOCKING + return default_deconstruction_screwdriver(user, tool) /obj/machinery/harvester/crowbar_act(mob/living/user, obj/item/tool) - if(default_pry_open(tool)) - return TRUE - if(default_deconstruction_crowbar(tool)) - return TRUE + return default_pry_open(user, tool, deconstruct_on_fail = TRUE) -/obj/machinery/harvester/default_pry_open(obj/item/tool) //wew - . = !(state_open || panel_open) && tool.tool_behaviour == TOOL_CROWBAR //We removed is_operational here - if(.) - tool.play_tool_sound(src, 50) - visible_message(span_notice("[usr] pries open \the [src]."), span_notice("You pry open [src].")) - open_machine() +/obj/machinery/harvester/can_crowbar_pry_open() + return !state_open && !panel_open /obj/machinery/harvester/emag_act(mob/user, obj/item/card/emag/emag_card) if(obj_flags & EMAGGED) diff --git a/code/game/machinery/hologram.dm b/code/game/machinery/hologram.dm index aa67a92a30c..881caa03028 100644 --- a/code/game/machinery/hologram.dm +++ b/code/game/machinery/hologram.dm @@ -141,11 +141,8 @@ Possible to do for anyone motivated enough: new_disk.forceMove(src) disk = new_disk -/obj/machinery/holopad/tutorial/default_deconstruction_screwdriver(mob/user, icon_state_open, icon_state_closed, obj/item/screwdriver) - return NONE - -/obj/machinery/holopad/tutorial/default_deconstruction_crowbar(obj/item/crowbar, ignore_panel, custom_deconstruct) - return NONE + AddElement(/datum/element/tool_blocker, TOOL_SCREWDRIVER) + AddElement(/datum/element/tool_blocker, TOOL_CROWBAR) /obj/machinery/holopad/Moved(atom/old_loc, movement_dir, forced, list/old_locs, momentum_change = TRUE) . = ..() @@ -219,7 +216,6 @@ Possible to do for anyone motivated enough: /obj/machinery/holopad/on_deconstruction(dissassembled) disk?.forceMove(drop_location()) - disk = null return ..() /obj/machinery/holopad/RefreshParts() @@ -263,27 +259,28 @@ Possible to do for anyone motivated enough: if(record_mode) record_stop() -/obj/machinery/holopad/attackby(obj/item/item, mob/user, list/modifiers, list/attack_modifiers) - if(default_deconstruction_screwdriver(user, "holopad_open", "holopad0", item)) - return +/obj/machinery/holopad/screwdriver_act(mob/living/user, obj/item/tool) + return default_deconstruction_screwdriver(user, tool) - if(default_pry_open(item, close_after_pry = TRUE, closed_density = FALSE)) - return +/obj/machinery/holopad/crowbar_act(mob/living/user, obj/item/tool) + return default_pry_open(user, tool, close_after_pry = TRUE, closed_density = FALSE, deconstruct_on_fail = TRUE) - if(default_deconstruction_crowbar(item)) - return - - if(istype(item, /obj/item/disk/holodisk)) +/obj/machinery/holopad/item_interaction(mob/living/user, obj/item/tool, list/modifiers) + if(istype(tool, /obj/item/disk/holodisk)) if(disk) to_chat(user,span_warning("There's already a disk inside [src]!")) return - if (!user.transferItemToLoc(item, src)) + if (!user.transferItemToLoc(tool, src)) return - to_chat(user,span_notice("You insert [item] into [src].")) - disk = item - return + to_chat(user,span_notice("You insert [tool] into [src].")) + disk = tool + return ITEM_INTERACT_SUCCESS + return NONE - return ..() +/obj/machinery/holopad/Exited(atom/movable/gone, direction) + . = ..() + if(gone == disk) + disk = null /obj/machinery/holopad/ui_status(mob/user, datum/ui_state/state) if(!is_operational) @@ -388,7 +385,6 @@ Possible to do for anyone motivated enough: if("disk_eject") if(disk && !replay_mode) disk.forceMove(drop_location()) - disk = null return TRUE if("replay_mode") if(replay_mode) @@ -611,6 +607,9 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/ update_appearance() /obj/machinery/holopad/update_icon_state() + if(panel_open) + icon_state = "[base_icon_state]_open" + return ..() var/total_users = LAZYLEN(masters) + LAZYLEN(holo_calls) if(ringing) icon_state = "[base_icon_state]_ringing" diff --git a/code/game/machinery/hypnochair.dm b/code/game/machinery/hypnochair.dm index 80f0fb2778d..09b18eda780 100644 --- a/code/game/machinery/hypnochair.dm +++ b/code/game/machinery/hypnochair.dm @@ -27,15 +27,11 @@ open_machine() update_appearance() -/obj/machinery/hypnochair/attackby(obj/item/item, mob/user, list/modifiers, list/attack_modifiers) - if(!occupant && default_deconstruction_screwdriver(user, icon_state, icon_state, item)) - update_appearance() - return - if(default_pry_open(item)) - return - if(default_deconstruction_crowbar(item)) - return - return ..() +/obj/machinery/hypnochair/screwdriver_act(mob/living/user, obj/item/tool) + return isnull(occupant) ? default_deconstruction_screwdriver(user, tool) : NONE + +/obj/machinery/hypnochair/crowbar_act(mob/living/user, obj/item/tool) + return default_pry_open(user, tool, deconstruct_on_fail = TRUE) /obj/machinery/hypnochair/ui_state(mob/user) return GLOB.notcontained_state diff --git a/code/game/machinery/launch_pad.dm b/code/game/machinery/launch_pad.dm index 646d5288c51..34a52615623 100644 --- a/code/game/machinery/launch_pad.dm +++ b/code/game/machinery/launch_pad.dm @@ -5,13 +5,12 @@ desc = "A bluespace pad able to thrust matter through bluespace, teleporting it to or from nearby locations." icon = 'icons/obj/machines/telepad.dmi' icon_state = "lpad-idle" + base_icon_state = "lpad" active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION * 2.5 hud_possible = list(DIAG_LAUNCHPAD_HUD) interaction_flags_mouse_drop = NEED_DEXTERITY | NEED_HANDS circuit = /obj/item/circuitboard/machine/launchpad - /// The beam icon - var/icon_teleport = "lpad-beam" /// To prevent briefcase pad deconstruction and such var/stationary = TRUE /// What to name the launchpad in the console @@ -75,16 +74,24 @@ balloon_alert(user, "saved to buffer") return ITEM_INTERACT_SUCCESS -/obj/machinery/launchpad/attackby(obj/item/weapon, mob/user, list/modifiers, list/attack_modifiers) - if(!stationary) - return ..() +/obj/machinery/launchpad/screwdriver_act(mob/living/user, obj/item/tool) + return stationary ? default_deconstruction_screwdriver(user, tool) : NONE - if(default_deconstruction_screwdriver(user, "lpad-idle-open", "lpad-idle", weapon)) - update_indicator() - return +/obj/machinery/launchpad/crowbar_act(mob/living/user, obj/item/tool) + return default_deconstruction_crowbar(user, tool) - if(default_deconstruction_crowbar(weapon)) - return +/obj/machinery/launchpad/can_crowbar_deconstruct() + return ..() && stationary + +/obj/machinery/launchpad/on_set_is_operational(old_value) + update_indicator() + +/obj/machinery/launchpad/on_set_panel_open(old_value) + update_indicator() + +/obj/machinery/launchpad/update_icon_state() + . = ..() + icon_state = panel_open ? "[base_icon_state]-open" : base_icon_state /obj/machinery/launchpad/attack_ghost(mob/dead/observer/ghost) . = ..() @@ -170,7 +177,7 @@ var/turf/target = locate(target_x, target_y, z) var/area/A = get_area(target) - flick(icon_teleport, src) + flick("[base_icon_state]-beam", src) //Change the indicator's icon to show that we're teleporting if(sending) @@ -266,7 +273,7 @@ name = "briefcase launchpad" desc = "A portable bluespace pad able to thrust matter through bluespace, teleporting it to or from nearby locations. Controlled via remote." icon_state = "blpad-idle" - icon_teleport = "blpad-beam" + base_icon_state = "blpad" anchored = FALSE use_power = NO_POWER_USE active_power_usage = 0 diff --git a/code/game/machinery/limbgrower.dm b/code/game/machinery/limbgrower.dm index d8a7109bbca..c4d95d8514b 100644 --- a/code/game/machinery/limbgrower.dm +++ b/code/game/machinery/limbgrower.dm @@ -5,6 +5,7 @@ desc = "It grows new limbs using Synthflesh." icon = 'icons/obj/machines/limbgrower.dmi' icon_state = "limbgrower_idleoff" + base_icon_state = "limbgrower" density = TRUE circuit = /obj/item/circuitboard/machine/limbgrower interaction_flags_atom = parent_type::interaction_flags_atom | INTERACT_ATOM_REQUIRES_ANCHORED @@ -162,20 +163,16 @@ return ITEM_INTERACT_SUCCESS /obj/machinery/limbgrower/screwdriver_act(mob/living/user, obj/item/tool) - . = ..() if(check_busy(user)) return ITEM_INTERACT_BLOCKING - . = default_deconstruction_screwdriver(user, "limbgrower_panelopen", "limbgrower_idleoff", tool) - if(.) - ui_close(user) + return default_deconstruction_screwdriver(user, tool) /obj/machinery/limbgrower/crowbar_act(mob/living/user, obj/item/tool) - . = ..() if(check_busy(user)) return ITEM_INTERACT_BLOCKING - return default_deconstruction_crowbar(tool) + return default_deconstruction_crowbar(user, tool) /obj/machinery/limbgrower/wrench_act(mob/living/user, obj/item/tool) . = ..() @@ -185,6 +182,15 @@ if(default_unfasten_wrench(user, tool)) return ITEM_INTERACT_SUCCESS +/obj/machinery/limbgrower/update_icon_state() + . = ..() + if(busy) + icon_state = "[base_icon_state]_idleon" + else if(panel_open) + icon_state = "[base_icon_state]_panelopen" + else + icon_state = "[base_icon_state]_idleoff" + /obj/machinery/limbgrower/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state) . = ..() if(.) @@ -225,8 +231,8 @@ busy = TRUE use_energy(power) + update_appearance() flick("limbgrower_fill", src) - icon_state = "limbgrower_idleon" selected_category = temp_category addtimer(CALLBACK(src, PROC_REF(build_item), consumed_reagents_list), production_speed * production_coefficient) return TRUE @@ -257,8 +263,8 @@ new built_typepath(loc) busy = FALSE + update_appearance() flick("limbgrower_unfill", src) - icon_state = "limbgrower_idleoff" /* * The process of putting together a limb. diff --git a/code/game/machinery/mass_driver.dm b/code/game/machinery/mass_driver.dm index 43dfb9ee79c..988152d9b65 100644 --- a/code/game/machinery/mass_driver.dm +++ b/code/game/machinery/mass_driver.dm @@ -3,6 +3,7 @@ desc = "The finest in spring-loaded piston toy technology, now on a space station near you." icon = 'icons/obj/machines/floor.dmi' icon_state = "mass_driver" + base_icon_state = "mass_driver" circuit = /obj/item/circuitboard/machine/mass_driver var/power = 1 var/code = 1 @@ -52,21 +53,27 @@ break use_energy(power_per_obj) O.throw_at(target, drive_range * power, power) - flick("mass_driver1", src) + flick("[base_icon_state]1", src) -/obj/machinery/mass_driver/attackby(obj/item/item, mob/living/user, list/modifiers, list/attack_modifiers) +/obj/machinery/mass_driver/update_icon_state() + . = ..() + icon_state = panel_open ? "[base_icon_state]_o" : base_icon_state - if(is_wire_tool(item) && panel_open) +/obj/machinery/mass_driver/item_interaction(mob/living/user, obj/item/tool, list/modifiers) + if(is_wire_tool(tool) && panel_open) wires.interact(user) - return - if(default_deconstruction_screwdriver(user, "mass_driver_o", "mass_driver", item)) - return - if(default_change_direction_wrench(user, item)) - return - if(default_deconstruction_crowbar(item)) - return + return ITEM_INTERACT_SUCCESS - return ..() + return NONE + +/obj/machinery/mass_driver/screwdriver_act(mob/living/user, obj/item/tool) + return default_deconstruction_screwdriver(user, tool) + +/obj/machinery/mass_driver/wrench_act(mob/living/user, obj/item/tool) + return default_change_direction_wrench(user, tool) + +/obj/machinery/mass_driver/crowbar_act(mob/living/user, obj/item/tool) + return default_deconstruction_crowbar(user, tool) /obj/machinery/mass_driver/RefreshParts() . = ..() diff --git a/code/game/machinery/mechlaunchpad.dm b/code/game/machinery/mechlaunchpad.dm index 70d075a5510..43733236b7e 100644 --- a/code/game/machinery/mechlaunchpad.dm +++ b/code/game/machinery/mechlaunchpad.dm @@ -3,6 +3,7 @@ desc = "A slab of heavy plating designed to withstand orbital-drop impacts. Through some sort of advanced bluespace tech, this one seems able to send and receive Mechs. Requires linking to a console to function." icon = 'icons/obj/machines/telepad.dmi' icon_state = "mechpad" + base_icon_state = "mechpad" circuit = /obj/item/circuitboard/machine/mechpad ///ID of the console, used for linking up var/id = "roboticsmining" @@ -20,20 +21,19 @@ . += span_notice("Use a multitool with the panel open to save id to buffer.") . += span_notice("Use wirecutters with the panel open to [mech_only ? "cut" : "mend"] the lifeform restriction wire.") -/obj/machinery/mechpad/screwdriver_act(mob/user, obj/item/tool) +/obj/machinery/mechpad/update_icon_state() . = ..() - if(!.) - return default_deconstruction_screwdriver(user, "mechpad-open", "mechpad", tool) + icon_state = panel_open ? "[base_icon_state]-open" : base_icon_state + +/obj/machinery/mechpad/screwdriver_act(mob/user, obj/item/tool) + return default_deconstruction_screwdriver(user, tool) /obj/machinery/mechpad/crowbar_act(mob/user, obj/item/tool) - ..() - if(default_deconstruction_crowbar(tool)) - return TRUE + return default_deconstruction_crowbar(user, tool) /obj/machinery/mechpad/multitool_act(mob/living/user, obj/item/multitool/multitool) - . = NONE if(!panel_open) - return + return NONE multitool.set_buffer(src) balloon_alert(user, "saved to multitool buffer") @@ -41,10 +41,10 @@ /obj/machinery/mechpad/wirecutter_act(mob/living/user, obj/item/tool) if(!panel_open) - return + return NONE mech_only = !mech_only to_chat(user, span_notice("You [mech_only ? "mend" : "cut"] the lifeform restriction wire.")) - return TRUE + return ITEM_INTERACT_SUCCESS /** * Spawns a special supply pod whitelisted to only accept mechs and have its drop off location be another mechpad diff --git a/code/game/machinery/medical_kiosk.dm b/code/game/machinery/medical_kiosk.dm index 3b8ef7cd22f..43e19e3248e 100644 --- a/code/game/machinery/medical_kiosk.dm +++ b/code/game/machinery/medical_kiosk.dm @@ -113,14 +113,10 @@ return board.custom_cost /obj/machinery/medical_kiosk/screwdriver_act(mob/living/user, obj/item/tool) - if(default_deconstruction_screwdriver(user, "[base_icon_state]_open", "[base_icon_state]_off", tool)) - return ITEM_INTERACT_SUCCESS - return ITEM_INTERACT_BLOCKING + return default_deconstruction_screwdriver(user, tool) /obj/machinery/medical_kiosk/crowbar_act(mob/living/user, obj/item/tool) - if(default_deconstruction_crowbar(tool)) - return ITEM_INTERACT_SUCCESS - return ITEM_INTERACT_BLOCKING + return default_deconstruction_crowbar(user, tool) /obj/machinery/medical_kiosk/item_interaction(mob/living/user, obj/item/tool, list/modifiers) if(!istype(tool, /obj/item/scanner_wand)) diff --git a/code/game/machinery/medipen_refiller.dm b/code/game/machinery/medipen_refiller.dm index 336554771f5..bdeb8227cac 100644 --- a/code/game/machinery/medipen_refiller.dm +++ b/code/game/machinery/medipen_refiller.dm @@ -3,6 +3,7 @@ desc = "A machine that refills used medipens with chemicals." icon = 'icons/obj/machines/medipen_refiller.dmi' icon_state = "medipen_refiller" + base_icon_state = "medipen_refiller" density = TRUE circuit = /obj/item/circuitboard/machine/medipen_refiller @@ -126,4 +127,8 @@ return ITEM_INTERACT_SUCCESS /obj/machinery/medipen_refiller/screwdriver_act(mob/living/user, obj/item/tool) - return default_deconstruction_screwdriver(user, "[initial(icon_state)]_open", initial(icon_state), tool) + return default_deconstruction_screwdriver(user, tool) + +/obj/machinery/medipen_refiller/update_icon_state() + . = ..() + icon_state = panel_open ? "[base_icon_state]_open" : base_icon_state diff --git a/code/game/machinery/modular_shield.dm b/code/game/machinery/modular_shield.dm index 99517fd0631..6873c29afb2 100644 --- a/code/game/machinery/modular_shield.dm +++ b/code/game/machinery/modular_shield.dm @@ -139,17 +139,10 @@ calculate_regeneration() /obj/machinery/modular_shield_generator/screwdriver_act(mob/living/user, obj/item/tool) - . = ..() - - if(default_deconstruction_screwdriver(user,"[icon_type]_[!(machine_stat & NOPOWER) ? "[recovering ? "recovering_" : "ready_"]" : "no_power_"]open", - "[icon_type]_[!(machine_stat & NOPOWER) ? "[recovering ? "recovering_" : "ready_"]" : "no_power_"]closed", tool)) - return TRUE + return default_deconstruction_screwdriver(user, tool) /obj/machinery/modular_shield_generator/crowbar_act(mob/living/user, obj/item/tool) - . = ..() - - if(default_deconstruction_crowbar(tool)) - return TRUE + return default_deconstruction_crowbar(user, tool) /obj/machinery/modular_shield_generator/attackby(obj/item/W, mob/user, list/modifiers) @@ -543,10 +536,7 @@ return TRUE /obj/machinery/modular_shield/module/crowbar_act(mob/living/user, obj/item/tool) - . = ..() - - if(default_deconstruction_crowbar(tool)) - return TRUE + return default_deconstruction_crowbar(user, tool) /obj/machinery/modular_shield/module/setDir(new_dir) . = ..() diff --git a/code/game/machinery/navbeacon.dm b/code/game/machinery/navbeacon.dm index a1e6726b129..0350799c6a8 100644 --- a/code/game/machinery/navbeacon.dm +++ b/code/game/machinery/navbeacon.dm @@ -5,6 +5,7 @@ icon = 'icons/obj/machines/floor.dmi' icon_state = "navbeacon0" + base_icon_state = "navbeacon" name = "navigation beacon" desc = "A radio beacon used for bot navigation." layer = LOW_OBJ_LAYER @@ -106,14 +107,17 @@ GLOB.deliverybeacontags += location /obj/machinery/navbeacon/crowbar_act(mob/living/user, obj/item/I) - if(default_deconstruction_crowbar(I)) - return TRUE + return default_deconstruction_crowbar(user, I) /obj/machinery/navbeacon/screwdriver_act(mob/living/user, obj/item/tool) if(!panel_open && cover_locked) balloon_alert(user, "hatch locked!") - return TRUE - return default_deconstruction_screwdriver(user, "navbeacon1","navbeacon0",tool) + return ITEM_INTERACT_BLOCKING + return default_deconstruction_screwdriver(user, tool) + +/obj/machinery/navbeacon/update_icon_state() + . = ..() + icon_state = "[base_icon_state][panel_open]" /obj/machinery/navbeacon/attackby(obj/item/attacking_item, mob/user, list/modifiers, list/attack_modifiers) var/turf/our_turf = loc diff --git a/code/game/machinery/nebula_shielding.dm b/code/game/machinery/nebula_shielding.dm index 8cf41265df4..ff59c7760b9 100644 --- a/code/game/machinery/nebula_shielding.dm +++ b/code/game/machinery/nebula_shielding.dm @@ -14,10 +14,6 @@ var/nebula_type ///How much power we use every time we block the nebula's effects var/power_use_per_block = BASE_MACHINE_ACTIVE_CONSUMPTION * 2 - ///State we use when actively blocking a nebula - var/active_icon_state - /// State for when we're broken and wont work anymore. Make sure to also set integrity_failure for this to work - var/broken_icon_state /obj/machinery/nebula_shielding/Initialize(mapload) . = ..() @@ -46,12 +42,14 @@ /obj/machinery/nebula_shielding/update_icon_state() . = ..() - if((machine_stat & BROKEN) && broken_icon_state) - icon_state = broken_icon_state - else if(!powered()) - icon_state = initial(icon_state) + if((machine_stat & BROKEN)) + icon_state = "[base_icon_state]_broken" + else if(panel_open) + icon_state = "[base_icon_state]_open" + else if(powered()) + icon_state = "[base_icon_state]_on" else - icon_state = active_icon_state + icon_state = base_icon_state ///Short-lived nebula shielding sent by centcom in-case there hasn't been shielding for a while /obj/machinery/nebula_shielding/emergency @@ -89,8 +87,7 @@ desc = "Generates a field around the station, protecting it from a radioactive nebula." icon_state = "radioactive_shielding" - active_icon_state = "radioactive_shielding_on" - broken_icon_state = "radioactive_shielding_broken" + base_icon_state = "radioactive_shielding" circuit = /obj/item/circuitboard/machine/radioactive_nebula_shielding @@ -109,14 +106,11 @@ if(isopenturf(turf)) turf.atmos_spawn_air("[GAS_TRITIUM]=1;[TURF_TEMPERATURE(T20C)]") -/obj/machinery/nebula_shielding/radiation/attackby(obj/item/item, mob/user, list/modifiers, list/attack_modifiers) - if(default_deconstruction_screwdriver(user, initial(icon_state) + "_open", initial(icon_state), item)) - return +/obj/machinery/nebula_shielding/radiation/screwdriver_act(mob/living/user, obj/item/tool) + return default_deconstruction_screwdriver(user, tool) - if(default_deconstruction_crowbar(item)) - return - - return ..() +/obj/machinery/nebula_shielding/radiation/crowbar_act(mob/living/user, obj/item/tool) + return default_deconstruction_crowbar(user, tool) ///Emergency shielding so people aren't permanently in a radstorm if shit goes very wrong in engineering /obj/machinery/nebula_shielding/emergency/radiation @@ -129,6 +123,10 @@ nebula_type = /datum/station_trait/nebula/hostile/radiation +/obj/machinery/nebula_shielding/emergency/radiation/Initialize(mapload) + . = ..() + AddElement(/datum/element/update_icon_blocker) + /obj/machinery/nebula_shielding/emergency/radiation/self_destruct() var/turf/open/turf = get_turf(src) if(isopenturf(turf)) diff --git a/code/game/machinery/photobooth.dm b/code/game/machinery/photobooth.dm index 917e28947d1..bd347e38db6 100644 --- a/code/game/machinery/photobooth.dm +++ b/code/game/machinery/photobooth.dm @@ -102,15 +102,10 @@ . += "[base_icon_state]_panel" /obj/machinery/photobooth/screwdriver_act(mob/living/user, obj/item/tool) - if(!has_buckled_mobs() && default_deconstruction_screwdriver(user, icon_state, icon_state, tool)) - update_appearance(UPDATE_ICON) - return ITEM_INTERACT_SUCCESS - return ..() + return has_buckled_mobs() ? NONE : default_deconstruction_screwdriver(user, tool) /obj/machinery/photobooth/crowbar_act(mob/living/user, obj/item/tool) - if(default_deconstruction_crowbar(tool)) - return ITEM_INTERACT_SUCCESS - return ..() + return default_deconstruction_crowbar(user, tool) /obj/machinery/photobooth/emag_act(mob/user, obj/item/card/emag/emag_card) if(obj_flags & EMAGGED) diff --git a/code/game/machinery/portagrav.dm b/code/game/machinery/portagrav.dm index 9edbe568021..27cf859f8d7 100644 --- a/code/game/machinery/portagrav.dm +++ b/code/game/machinery/portagrav.dm @@ -86,20 +86,19 @@ max_range = new_range update_field() +/obj/machinery/power/portagrav/update_icon_state() + . = ..() + icon_state = panel_open ? "[base_icon_state]-o" : base_icon_state + /obj/machinery/power/portagrav/screwdriver_act(mob/living/user, obj/item/tool) - . = NONE - if(default_deconstruction_screwdriver(user, "[base_icon_state]_o", base_icon_state, tool)) - return ITEM_INTERACT_SUCCESS + return default_deconstruction_screwdriver(user, tool) /obj/machinery/power/portagrav/crowbar_act(mob/living/user, obj/item/tool) - . = NONE - if(default_deconstruction_crowbar(tool)) - return ITEM_INTERACT_SUCCESS + return default_deconstruction_crowbar(user, tool) /obj/machinery/power/portagrav/item_interaction(mob/living/user, obj/item/tool, list/modifiers) - . = NONE if(!istype(tool, /obj/item/stock_parts/power_store/cell)) - return + return NONE if(!panel_open) balloon_alert(user, "must open panel!") return ITEM_INTERACT_BLOCKING diff --git a/code/game/machinery/quantum_pad.dm b/code/game/machinery/quantum_pad.dm index 841f2099ca4..1bdeb615f4b 100644 --- a/code/game/machinery/quantum_pad.dm +++ b/code/game/machinery/quantum_pad.dm @@ -3,6 +3,7 @@ desc = "A bluespace quantum-linked telepad used for teleporting objects to other quantum pads." icon = 'icons/obj/machines/telepad.dmi' icon_state = "qpad-idle" + base_icon_state = "qpad" active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION * 10 obj_flags = CAN_BE_HIT | UNIQUE_RENAME circuit = /obj/item/circuitboard/machine/quantumpad @@ -69,25 +70,31 @@ balloon_alert(user, "no quantum pad data found!") return NONE -/obj/machinery/quantumpad/attackby(obj/item/weapon, mob/user, list/modifiers, list/attack_modifiers) - if(default_deconstruction_screwdriver(user, "qpad-idle-open", "qpad-idle", weapon)) - return +/obj/machinery/quantumpad/screwdriver_act(mob/living/user, obj/item/tool) + return default_deconstruction_screwdriver(user, tool) - if(istype(weapon, /obj/item/quantum_keycard)) - var/obj/item/quantum_keycard/K = weapon - if(K.qpad) - to_chat(user, span_notice("You insert [K] into [src]'s card slot, activating it.")) - interact(user, K.qpad) - else - to_chat(user, span_notice("You insert [K] into [src]'s card slot, initiating the link procedure.")) - if(do_after(user, 4 SECONDS, target = src)) - to_chat(user, span_notice("You complete the link between [K] and [src].")) - K.set_pad(src) +/obj/machinery/quantumpad/crowbar_act(mob/living/user, obj/item/tool) + return default_deconstruction_crowbar(user, tool) - if(default_deconstruction_crowbar(weapon)) - return +/obj/machinery/quantumpad/item_interaction(mob/living/user, obj/item/tool, list/modifiers) + if(istype(tool, /obj/item/quantum_keycard)) + var/obj/item/quantum_keycard/card = tool + if(card.qpad) + to_chat(user, span_notice("You insert [card] into [src]'s card slot, activating it.")) + interact(user, card.qpad) + return ITEM_INTERACT_SUCCESS + to_chat(user, span_notice("You insert [card] into [src]'s card slot, initiating the link procedure.")) + if(!do_after(user, 4 SECONDS, target = src)) + return ITEM_INTERACT_BLOCKING + to_chat(user, span_notice("You complete the link between [card] and [src].")) + card.set_pad(src) + return ITEM_INTERACT_SUCCESS - return ..() + return NONE + +/obj/machinery/quantumpad/update_icon_state() + . = ..() + icon_state = panel_open ? "[base_icon_state]-idle-open" : "[base_icon_state]-idle" /obj/machinery/quantumpad/interact(mob/user, obj/machinery/quantumpad/target_pad = linked_pad) if(QDELETED(target_pad)) @@ -153,9 +160,9 @@ sparks() target_pad.sparks() - flick("qpad-beam", src) + flick("[base_icon_state]-beam", src) playsound(get_turf(src), 'sound/items/weapons/emitter2.ogg', 25, TRUE) - flick("qpad-beam", target_pad) + flick("[target_pad.base_icon_state]-beam", target_pad) playsound(get_turf(target_pad), 'sound/items/weapons/emitter2.ogg', 25, TRUE) for(var/atom/movable/ROI in get_turf(src)) if(QDELETED(ROI)) diff --git a/code/game/machinery/recharger.dm b/code/game/machinery/recharger.dm index 86945f36ce8..aba3524917e 100644 --- a/code/game/machinery/recharger.dm +++ b/code/game/machinery/recharger.dm @@ -117,14 +117,13 @@ return ITEM_INTERACT_SUCCESS /obj/machinery/recharger/screwdriver_act(mob/living/user, obj/item/tool) - if(!anchored || charging) - return ITEM_INTERACT_BLOCKING - . = default_deconstruction_screwdriver(user, base_icon_state, base_icon_state, tool) - if(.) - update_appearance() + return (!anchored || charging) ? ITEM_INTERACT_BLOCKING : default_deconstruction_screwdriver(user, tool) /obj/machinery/recharger/crowbar_act(mob/living/user, obj/item/tool) - return (!anchored || charging) ? ITEM_INTERACT_BLOCKING : default_deconstruction_crowbar(tool) + return default_deconstruction_crowbar(user, tool) + +/obj/machinery/recharger/can_crowbar_deconstruct() + return ..() && anchored && !charging /obj/machinery/recharger/attack_hand(mob/user, list/modifiers) . = ..() diff --git a/code/game/machinery/rechargestation.dm b/code/game/machinery/rechargestation.dm index 466f37726bc..f1b527c23cc 100644 --- a/code/game/machinery/rechargestation.dm +++ b/code/game/machinery/rechargestation.dm @@ -3,6 +3,7 @@ desc = "This device recharges energy-dependent lifeforms, like cyborgs, ethereals, and MODsuit users." icon = 'icons/obj/machines/borg_charger.dmi' icon_state = "borgcharger0" + base_icon_state = "borgcharger" active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION * 0.1 density = FALSE req_access = list(ACCESS_ROBOTICS) @@ -106,17 +107,11 @@ if (!(. & EMP_PROTECT_SELF)) open_machine() -/obj/machinery/recharge_station/attackby(obj/item/P, mob/user, list/modifiers, list/attack_modifiers) - if(state_open) - if(default_deconstruction_screwdriver(user, "borgdecon2", "borgcharger0", P)) - return +/obj/machinery/recharge_station/screwdriver_act(mob/living/user, obj/item/tool) + return state_open ? NONE : default_deconstruction_screwdriver(user, tool) - if(default_pry_open(P, close_after_pry = FALSE, open_density = FALSE, closed_density = TRUE)) - return - - if(default_deconstruction_crowbar(P)) - return - return ..() +/obj/machinery/recharge_station/crowbar_act(mob/living/user, obj/item/tool) + return default_pry_open(user, tool, close_after_pry = FALSE, open_density = FALSE, closed_density = TRUE, deconstruct_on_fail = TRUE) /obj/machinery/recharge_station/attack_ai_secondary(mob/user, list/modifiers) toggle_restock(user) @@ -167,10 +162,13 @@ add_fingerprint(occupant) /obj/machinery/recharge_station/update_icon_state() - if(!is_operational) - icon_state = "borgcharger-u[state_open ? 0 : 1]" + if(panel_open) + icon_state = "borgdecon2" return ..() - icon_state = "borgcharger[state_open ? 0 : (occupant ? 1 : 2)]" + if(!is_operational) + icon_state = "[base_icon_state]-u[state_open ? 0 : 1]" + return ..() + icon_state = "[base_icon_state][state_open ? 0 : (occupant ? 1 : 2)]" return ..() /obj/machinery/recharge_station/process(seconds_per_tick) diff --git a/code/game/machinery/recycler.dm b/code/game/machinery/recycler.dm index de28621888b..5564e489d7a 100644 --- a/code/game/machinery/recycler.dm +++ b/code/game/machinery/recycler.dm @@ -5,12 +5,12 @@ desc = "A large crushing machine used to recycle small items inefficiently. There are lights on the side." icon = 'icons/obj/machines/recycling.dmi' icon_state = "grinder-o0" + base_icon_state = "grinder-o" layer = ABOVE_ALL_MOB_LAYER // Overhead plane = ABOVE_GAME_PLANE density = TRUE circuit = /obj/item/circuitboard/machine/recycler var/safety_mode = FALSE // Temporarily stops machine if it detects a mob - var/icon_name = "grinder-o" var/bloody = FALSE var/amount_produced = 50 var/crush_damage = 1000 @@ -37,7 +37,7 @@ /obj/machinery/recycler/post_machine_initialize() . = ..() - update_appearance(UPDATE_ICON) + update_appearance() req_one_access = SSid_access.get_region_access_list(list(REGION_ALL_STATION, REGION_CENTCOM)) var/static/list/loc_connections = list( COMSIG_ATOM_ENTERED = PROC_REF(on_entered), @@ -76,14 +76,10 @@ return SUCCESSFUL_UNFASTEN /obj/machinery/recycler/crowbar_act(mob/living/user, obj/item/tool) - if(default_deconstruction_crowbar(tool)) - return ITEM_INTERACT_SUCCESS - return ITEM_INTERACT_BLOCKING + return default_deconstruction_crowbar(user, tool) /obj/machinery/recycler/screwdriver_act(mob/living/user, obj/item/tool) - if(default_deconstruction_screwdriver(user, "grinder-oOpen", "grinder-o0", tool)) - return ITEM_INTERACT_SUCCESS - return ITEM_INTERACT_BLOCKING + return default_deconstruction_screwdriver(user, tool) /obj/machinery/recycler/emag_act(mob/user, obj/item/card/emag/emag_card) if(obj_flags & EMAGGED) @@ -97,12 +93,15 @@ return FALSE /obj/machinery/recycler/update_icon_state() - var/is_powered = !(machine_stat & (BROKEN|NOPOWER)) - if(safety_mode) - is_powered = FALSE - icon_state = icon_name + "[is_powered]" + if(panel_open) + icon_state = base_icon_state + "Open" + else + icon_state = base_icon_state + "[is_operational && !safety_mode]" return ..() +/obj/machinery/recycler/on_set_is_operational(old_value) + update_appearance() + /obj/machinery/recycler/update_overlays() . = ..() if(!bloody || !GET_ATOM_BLOOD_DECAL_LENGTH(src)) @@ -301,11 +300,10 @@ obj_flags = CAN_BE_HIT | EMAGGED crush_damage = 120 -/obj/machinery/recycler/deathtrap/default_deconstruction_screwdriver(mob/user, icon_state_open, icon_state_closed, obj/item/screwdriver) - return NONE - -/obj/machinery/recycler/deathtrap/default_deconstruction_crowbar(obj/item/crowbar, ignore_panel, custom_deconstruct) - return NONE +/obj/machinery/recycler/deathtrap/Initialize(mapload) + . = ..() + AddElement(/datum/element/tool_blocker, TOOL_SCREWDRIVER) + AddElement(/datum/element/tool_blocker, TOOL_CROWBAR) /obj/item/paper/guides/recycler name = "paper - 'garbage duty instructions'" diff --git a/code/game/machinery/scanner_gate.dm b/code/game/machinery/scanner_gate.dm index 27271f3c4b1..95592b16386 100644 --- a/code/game/machinery/scanner_gate.dm +++ b/code/game/machinery/scanner_gate.dm @@ -11,6 +11,7 @@ desc = "A gate able to perform mid-depth scans on any organisms who pass under it." icon = 'icons/obj/machines/scangate.dmi' icon_state = "scangate" + base_icon_state = "scangate" layer = ABOVE_MOB_LAYER circuit = /obj/item/circuitboard/machine/scanner_gate COOLDOWN_DECLARE(next_beep) @@ -145,27 +146,39 @@ return set_scanline("passive") -/obj/machinery/scanner_gate/attackby(obj/item/attacking_item, mob/user, list/modifiers, list/attack_modifiers) - var/obj/item/card/id/card = attacking_item.GetID() - if(card) - if(locked) - if(allowed(user)) - locked = FALSE - req_access = list() - to_chat(user, span_notice("You unlock [src].")) - else if(!(obj_flags & EMAGGED)) - to_chat(user, span_notice("You lock [src] with [attacking_item].")) - var/list/access = attacking_item.GetAccess() - req_access = access - locked = TRUE - else - to_chat(user, span_warning("You try to lock [src] with [attacking_item], but nothing happens.")) - else - if(!locked && default_deconstruction_screwdriver(user, "[initial(icon_state)]_open", initial(icon_state), attacking_item)) - return - if(panel_open && is_wire_tool(attacking_item)) - wires.interact(user) - return ..() +/obj/machinery/scanner_gate/item_interaction(mob/living/user, obj/item/tool, list/modifiers) + if(panel_open && is_wire_tool(tool)) + wires.interact(user) + return ITEM_INTERACT_SUCCESS + + var/obj/item/card/id/card = tool.GetID() + if(isnull(card)) + return NONE + + if(locked) + if(!allowed(user)) + return ITEM_INTERACT_BLOCKING + + locked = FALSE + req_access = list() + balloon_alert(user, "unlocked") + return ITEM_INTERACT_SUCCESS + + if(obj_flags & EMAGGED) + balloon_alert(user, "nothing happens!") + return ITEM_INTERACT_BLOCKING + + balloon_alert(user, "locked") + req_access = tool.GetAccess() // returns a copy so this is chill + locked = TRUE + return ITEM_INTERACT_SUCCESS + +/obj/machinery/scanner_gate/screwdriver_act(mob/living/user, obj/item/tool) + return locked ? NONE : default_deconstruction_screwdriver(user, tool) + +/obj/machinery/scanner_gate/update_icon_state() + . = ..() + icon_state = panel_open ? "[base_icon_state]_open" : base_icon_state /obj/machinery/scanner_gate/emag_act(mob/user, obj/item/card/emag/emag_card) if(obj_flags & EMAGGED) diff --git a/code/game/machinery/sheetifier.dm b/code/game/machinery/sheetifier.dm index c689318ddc4..ae17eda2860 100644 --- a/code/game/machinery/sheetifier.dm +++ b/code/game/machinery/sheetifier.dm @@ -64,12 +64,7 @@ return ITEM_INTERACT_SUCCESS /obj/machinery/sheetifier/screwdriver_act(mob/living/user, obj/item/tool) - if(default_deconstruction_screwdriver(user, initial(icon_state), initial(icon_state), tool)) - update_appearance() - return ITEM_INTERACT_SUCCESS - return ITEM_INTERACT_FAILURE + return default_deconstruction_screwdriver(user, tool) /obj/machinery/sheetifier/crowbar_act(mob/living/user, obj/item/tool) - if(default_deconstruction_crowbar(tool)) - return ITEM_INTERACT_SUCCESS - return ITEM_INTERACT_BLOCKING + return default_deconstruction_crowbar(user, tool) diff --git a/code/game/machinery/shieldgen.dm b/code/game/machinery/shieldgen.dm index 99daee75df8..e3d42f2bfb4 100644 --- a/code/game/machinery/shieldgen.dm +++ b/code/game/machinery/shieldgen.dm @@ -454,14 +454,15 @@ /obj/machinery/power/shieldwallgen/screwdriver_act(mob/user, obj/item/tool) if(!panel_open && locked) balloon_alert(user, "unlock first!") - return - update_appearance(UPDATE_OVERLAYS) - return default_deconstruction_screwdriver(user, icon_state, icon_state, tool) + return ITEM_INTERACT_BLOCKING + + return default_deconstruction_screwdriver(user, tool) /obj/machinery/power/shieldwallgen/crowbar_act(mob/user, obj/item/tool) if(active) - return - return default_deconstruction_crowbar(tool) + return ITEM_INTERACT_BLOCKING + + return default_deconstruction_crowbar(user, tool) /obj/machinery/power/shieldwallgen/attackby(obj/item/W, mob/user, list/modifiers, list/attack_modifiers) . = ..() diff --git a/code/game/machinery/sleepers.dm b/code/game/machinery/sleepers.dm index eeae1f93f72..e73d2d9716c 100644 --- a/code/game/machinery/sleepers.dm +++ b/code/game/machinery/sleepers.dm @@ -78,7 +78,7 @@ reset_chem_buttons() /obj/machinery/sleeper/update_icon_state() - icon_state = "[base_icon_state][state_open ? "-open" : null]" + icon_state = "[base_icon_state][state_open ? "-open" : panel_open ? "-o" : ""]" return ..() /obj/machinery/sleeper/container_resist_act(mob/living/user) @@ -121,37 +121,22 @@ close_machine(target) /obj/machinery/sleeper/screwdriver_act(mob/living/user, obj/item/I) - . = ..() if(occupant) to_chat(user, span_warning("[src] is currently occupied!")) - return TRUE + return ITEM_INTERACT_BLOCKING if(state_open) to_chat(user, span_warning("[src] must be closed to [panel_open ? "close" : "open"] its maintenance hatch!")) - return TRUE - if(default_deconstruction_screwdriver(user, "[initial(icon_state)]-o", initial(icon_state), I)) - return TRUE - return FALSE + return ITEM_INTERACT_BLOCKING + return default_deconstruction_screwdriver(user, I) /obj/machinery/sleeper/wrench_act(mob/living/user, obj/item/I) - . = ..() - if(default_change_direction_wrench(user, I)) - return TRUE - return FALSE + return default_change_direction_wrench(user, I) /obj/machinery/sleeper/crowbar_act(mob/living/user, obj/item/I) - . = ..() - if(default_pry_open(I)) - return TRUE - if(default_deconstruction_crowbar(I)) - return TRUE - return FALSE + return default_pry_open(user, I, deconstruct_on_fail = TRUE) -/obj/machinery/sleeper/default_pry_open(obj/item/I) //wew - . = !(state_open || panel_open) && I.tool_behaviour == TOOL_CROWBAR - if(.) - I.play_tool_sound(src, 50) - visible_message(span_notice("[usr] pries open [src]."), span_notice("You pry open [src].")) - open_machine() +/obj/machinery/sleeper/can_crowbar_pry_open() + return !state_open && !panel_open /obj/machinery/sleeper/ui_state(mob/user) if(!controls_inside) diff --git a/code/game/machinery/spaceheater.dm b/code/game/machinery/spaceheater.dm index 3010b84b19e..698b7e3afd3 100644 --- a/code/game/machinery/spaceheater.dm +++ b/code/game/machinery/spaceheater.dm @@ -202,36 +202,41 @@ cell.emp_act(severity) /obj/machinery/space_heater/wrench_act(mob/living/user, obj/item/tool) - . = ..() default_unfasten_wrench(user, tool) return ITEM_INTERACT_SUCCESS -/obj/machinery/space_heater/attackby(obj/item/I, mob/user, list/modifiers, list/attack_modifiers) - add_fingerprint(user) +/obj/machinery/space_heater/screwdriver_act(mob/living/user, obj/item/tool) + . = default_deconstruction_screwdriver(user, tool) + user.visible_message( + span_notice("[user] [panel_open ? "opens" : "closes"] the hatch on [src]."), + span_notice("You [panel_open ? "open" : "close"] the hatch on [src]."), + ) + return . - if(default_deconstruction_screwdriver(user, icon_state, icon_state, I)) - user.visible_message(span_notice("\The [user] [panel_open ? "opens" : "closes"] the hatch on \the [src]."), span_notice("You [panel_open ? "open" : "close"] the hatch on \the [src].")) - update_appearance() - return TRUE +/obj/machinery/space_heater/crowbar_act(mob/living/user, obj/item/tool) + return default_deconstruction_crowbar(user, tool) - if(default_deconstruction_crowbar(I)) - return TRUE - - if(istype(I, /obj/item/stock_parts/power_store/cell)) +/obj/machinery/space_heater/item_interaction(mob/living/user, obj/item/tool, list/modifiers) + if(istype(tool, /obj/item/stock_parts/power_store/cell)) + add_fingerprint(user) if(!panel_open) to_chat(user, span_warning("The hatch must be open to insert a power cell!")) - return + return ITEM_INTERACT_BLOCKING if(cell) to_chat(user, span_warning("There is already a power cell inside!")) - return - if(!user.transferItemToLoc(I, src)) - return - cell = I - I.add_fingerprint(usr) - user.visible_message(span_notice("\The [user] inserts a power cell into \the [src]."), span_notice("You insert the power cell into \the [src].")) + return ITEM_INTERACT_BLOCKING + if(!user.transferItemToLoc(tool, src)) + return ITEM_INTERACT_BLOCKING + cell = tool + tool.add_fingerprint(usr) + user.visible_message( + span_notice("[user] inserts [tool] into [src]."), + span_notice("You insert [tool] into [src]."), + ) SStgui.update_uis(src) - return TRUE - return ..() + return ITEM_INTERACT_SUCCESS + + return NONE /obj/machinery/space_heater/attack_hand_secondary(mob/user, list/modifiers) if(!can_interact(user)) @@ -418,7 +423,7 @@ ///Slightly modified to ignore the open_hatch - it's always open, we hacked it. /obj/machinery/space_heater/improvised_chem_heater/attackby(obj/item/item, mob/user, list/modifiers, list/attack_modifiers) add_fingerprint(user) - if(default_deconstruction_crowbar(item)) + if(default_deconstruction_crowbar(user, item)) return if(istype(item, /obj/item/stock_parts/power_store/cell)) if(cell) diff --git a/code/game/machinery/stasis.dm b/code/game/machinery/stasis.dm index fa58b303897..539d3cc0e8d 100644 --- a/code/game/machinery/stasis.dm +++ b/code/game/machinery/stasis.dm @@ -173,12 +173,9 @@ thaw_them(L_occupant) /obj/machinery/stasis/screwdriver_act(mob/living/user, obj/item/I) - . = ..() - . |= default_deconstruction_screwdriver(user, "stasis_maintenance", "stasis", I) - update_appearance() + return default_deconstruction_screwdriver(user, I) /obj/machinery/stasis/crowbar_act(mob/living/user, obj/item/I) - . = ..() - return default_deconstruction_crowbar(I) || . + return default_deconstruction_crowbar(user, I) #undef STASIS_TOGGLE_COOLDOWN diff --git a/code/game/machinery/suit_storage_unit.dm b/code/game/machinery/suit_storage_unit.dm index 15f8ae04144..5b78deb2bc0 100644 --- a/code/game/machinery/suit_storage_unit.dm +++ b/code/game/machinery/suit_storage_unit.dm @@ -735,12 +735,7 @@ default_deconstruction_crowbar(tool) return ITEM_INTERACT_SUCCESS - if(!state_open) - if(default_deconstruction_screwdriver(user, "[base_icon_state]", "[base_icon_state]", tool)) //Set to base_icon_state because the panels for this are overlays - update_appearance() - return ITEM_INTERACT_SUCCESS - - if(default_pry_open(tool)) + if(default_pry_open(user, tool) & ITEM_INTERACT_SUCCESS) dump_inventory_contents() return ITEM_INTERACT_SUCCESS @@ -748,24 +743,20 @@ screwdriving it open while it's running a decontamination sequence without closing the panel prior to finish causes the SSU to break due to state_open being set to TRUE at the end, and the panel becoming inaccessible. */ -/obj/machinery/suit_storage_unit/default_deconstruction_screwdriver(mob/user, icon_state_open, icon_state_closed, obj/item/screwdriver) - if(screwdriver.tool_behaviour == TOOL_SCREWDRIVER && (uv || locked)) +/obj/machinery/suit_storage_unit/screwdriver_act(mob/living/user, obj/item/tool) + if(state_open) + return NONE + if(uv || locked) to_chat(user, span_warning("You can't open the panel while its [locked ? "locked" : "decontaminating"]")) - return TRUE - return ..() + return ITEM_INTERACT_BLOCKING + return default_deconstruction_screwdriver(user, tool) -/obj/machinery/suit_storage_unit/default_pry_open(obj/item/crowbar)//needs to check if the storage is locked. - . = !(state_open || panel_open || is_operational || locked) && crowbar.tool_behaviour == TOOL_CROWBAR - if(.) - crowbar.play_tool_sound(src, 50) - visible_message(span_notice("[usr] pries open \the [src]."), span_notice("You pry open \the [src].")) - open_machine() +/obj/machinery/suit_storage_unit/can_crowbar_pry_open() + return ..() && !locked -/obj/machinery/suit_storage_unit/default_deconstruction_crowbar(obj/item/crowbar, ignore_panel, custom_deconstruct) - . = (!locked && panel_open && crowbar.tool_behaviour == TOOL_CROWBAR) - if(.) - return ..() +/obj/machinery/suit_storage_unit/can_crowbar_deconstruct() + return ..() && !locked /obj/machinery/suit_storage_unit/rename_checks(mob/living/user) . = TRUE diff --git a/code/game/machinery/telecomms/machine_interactions.dm b/code/game/machinery/telecomms/machine_interactions.dm index 9b733931db2..03dc6c60ad5 100644 --- a/code/game/machinery/telecomms/machine_interactions.dm +++ b/code/game/machinery/telecomms/machine_interactions.dm @@ -15,24 +15,15 @@ FREQ_CTF_BLUE, ) -/obj/machinery/telecomms/attackby(obj/item/attacking_item, mob/user, list/modifiers, list/attack_modifiers) +/obj/machinery/telecomms/screwdriver_act(mob/living/user, obj/item/tool) + return default_deconstruction_screwdriver(user, tool) - var/icon_closed = initial(icon_state) - var/icon_open = "[initial(icon_state)]_o" - if(!on) - icon_closed = "[initial(icon_state)]_off" - icon_open = "[initial(icon_state)]_o_off" +/obj/machinery/telecomms/multitool_act(mob/living/user, obj/item/tool) + attack_hand(user) + return ITEM_INTERACT_SUCCESS - if(default_deconstruction_screwdriver(user, icon_open, icon_closed, attacking_item)) - return - // Using a multitool lets you access the receiver's interface - else if(attacking_item.tool_behaviour == TOOL_MULTITOOL) - attack_hand(user) - - else if(default_deconstruction_crowbar(attacking_item)) - return - else - return ..() +/obj/machinery/telecomms/crowbar_act(mob/living/user, obj/item/tool) + return default_deconstruction_crowbar(user, tool) /obj/machinery/telecomms/ui_interact(mob/user, datum/tgui/ui) ui = SStgui.try_update_ui(user, src, ui) diff --git a/code/game/machinery/telecomms/machines/allinone.dm b/code/game/machinery/telecomms/machines/allinone.dm index 63668487de7..544832a0327 100644 --- a/code/game/machinery/telecomms/machines/allinone.dm +++ b/code/game/machinery/telecomms/machines/allinone.dm @@ -64,11 +64,11 @@ /obj/machinery/telecomms/allinone/indestructible resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF -/obj/machinery/telecomms/allinone/indestructible/default_deconstruction_screwdriver(mob/user, icon_state_open, icon_state_closed, obj/item/screwdriver) - return NONE -/obj/machinery/telecomms/allinone/indestructible/default_deconstruction_crowbar(obj/item/crowbar, ignore_panel, custom_deconstruct) - return NONE +/obj/machinery/telecomms/allinone/indestructible/Initialize(mapload) + . = ..() + AddElement(/datum/element/tool_blocker, TOOL_SCREWDRIVER) + AddElement(/datum/element/tool_blocker, TOOL_CROWBAR) /obj/machinery/telecomms/allinone/receive_signal(datum/signal/subspace/signal) if(!istype(signal) || signal.transmission_method != TRANSMISSION_SUBSPACE) // receives on subspace only diff --git a/code/game/machinery/teleporter.dm b/code/game/machinery/teleporter.dm index 3a9b435a70f..837693baec0 100644 --- a/code/game/machinery/teleporter.dm +++ b/code/game/machinery/teleporter.dm @@ -52,15 +52,16 @@ if(is_ready()) teleport(AM) -/obj/machinery/teleport/hub/attackby(obj/item/W, mob/user, list/modifiers, list/attack_modifiers) - if(default_deconstruction_screwdriver(user, "tele-o", "tele0", W)) - if(power_station?.engaged) - power_station.engaged = 0 //hub with panel open is off, so the station must be informed. - update_appearance() - return - if(default_deconstruction_crowbar(W)) - return - return ..() +/obj/machinery/teleport/hub/screwdriver_act(mob/living/user, obj/item/tool) + return default_deconstruction_screwdriver(user, tool) + +/obj/machinery/teleport/hub/crowbar_act(mob/living/user, obj/item/tool) + return default_deconstruction_crowbar(user, tool) + +/obj/machinery/teleport/hub/on_set_panel_open(old_value) + if(panel_open && power_station?.engaged) + power_station.engaged = FALSE + update_appearance() /obj/machinery/teleport/hub/proc/teleport(atom/movable/M as mob|obj, turf/T) var/obj/machinery/computer/teleporter/com = power_station.teleporter_console @@ -178,15 +179,11 @@ balloon_alert(user, "data uploaded from buffer") return ITEM_INTERACT_SUCCESS -/obj/machinery/teleport/station/attackby(obj/item/W, mob/user, list/modifiers, list/attack_modifiers) - if(default_deconstruction_screwdriver(user, "controller-o", "controller", W)) - update_appearance() - return +/obj/machinery/teleport/station/screwdriver_act(mob/living/user, obj/item/tool) + return default_deconstruction_screwdriver(user, tool) - else if(default_deconstruction_crowbar(W)) - return - else - return ..() +/obj/machinery/teleport/station/crowbar_act(mob/living/user, obj/item/tool) + return default_deconstruction_crowbar(user, tool) /obj/machinery/teleport/station/interact(mob/user) toggle(user) diff --git a/code/game/machinery/washing_machine.dm b/code/game/machinery/washing_machine.dm index f251dfb41fc..afd30986d48 100644 --- a/code/game/machinery/washing_machine.dm +++ b/code/game/machinery/washing_machine.dm @@ -356,18 +356,16 @@ GLOBAL_LIST_INIT(dye_registry, list( . += "wm_panel" /obj/machinery/washing_machine/wrench_act(mob/living/user, obj/item/tool) - . = ..() if(!panel_open || busy) - return FALSE + return NONE default_unfasten_wrench(user, tool) return ITEM_INTERACT_SUCCESS /obj/machinery/washing_machine/screwdriver_act(mob/living/user, obj/item/tool) - if (!state_open) - default_deconstruction_screwdriver(user, null, null, tool) - update_appearance() - return ITEM_INTERACT_SUCCESS - return ITEM_INTERACT_BLOCKING + if(state_open) + return NONE + + return default_deconstruction_screwdriver(user, tool) /obj/machinery/washing_machine/item_interaction(mob/living/user, obj/item/item, list/modifiers) if(user.combat_mode) diff --git a/code/modules/antagonists/pirate/pirate_shuttle_equipment.dm b/code/modules/antagonists/pirate/pirate_shuttle_equipment.dm index a5dded9c71f..05187e7f067 100644 --- a/code/modules/antagonists/pirate/pirate_shuttle_equipment.dm +++ b/code/modules/antagonists/pirate/pirate_shuttle_equipment.dm @@ -174,12 +174,10 @@ name = "cargo hold pad" icon = 'icons/obj/machines/telepad.dmi' icon_state = "lpad-idle-off" - ///This is the icon_state that this telepad uses when it's not in use. - var/idle_state = "lpad-idle-off" - ///This is the icon_state that this telepad uses when it's warming up for goods teleportation. - var/warmup_state = "lpad-idle" - ///This is the icon_state to flick when the goods are being sent off by the telepad. - var/sending_state = "lpad-beam" + base_icon_state = "lpad" + /// Determines what icon is being shown + VAR_PRIVATE/is_sending = FALSE + ///This is the cargo hold ID used by the piratepad_control. Match these two to link them together. var/cargo_hold_id @@ -191,24 +189,35 @@ return TRUE /obj/machinery/piratepad/screwdriver_act(mob/living/user, obj/item/tool) - . = ..() - if(!.) - return default_deconstruction_screwdriver(user, "lpad-idle-open", "lpad-idle-off", tool) + return default_deconstruction_screwdriver(user, tool) + +/obj/machinery/piratepad/screwdriver_act_secondary(mob/living/user, obj/item/tool) + return screwdriver_act(user, tool) /obj/machinery/piratepad/crowbar_act(mob/living/user, obj/item/tool) - . = ..() - if(!.) - return default_deconstruction_crowbar(tool) - -/obj/machinery/piratepad/screwdriver_act_secondary(mob/living/user, obj/item/screwdriver/screw) - . = ..() - if(!.) - return default_deconstruction_screwdriver(user, "lpad-idle-open", "lpad-idle-off", screw) + return default_deconstruction_crowbar(user, tool) /obj/machinery/piratepad/crowbar_act_secondary(mob/living/user, obj/item/tool) + return crowbar_act(user, tool) + +/obj/machinery/piratepad/proc/set_is_sending(value) + if(is_sending == value) + return + is_sending = value + update_appearance() + +/obj/machinery/piratepad/proc/finish_sending() + set_is_sending(FALSE) + flick("[base_icon_state]-beam", src) + +/obj/machinery/piratepad/update_icon_state() . = ..() - default_deconstruction_crowbar(tool) - return TRUE + if(panel_open) + icon_state = "[base_icon_state]-idle-open" + else if(is_sending) + icon_state = "[base_icon_state]-idle" + else + icon_state = "[base_icon_state]-idle-off" /obj/machinery/computer/piratepad_control name = "cargo hold control terminal" @@ -347,8 +356,7 @@ status_report += "Nothing" pad.visible_message(span_notice("[pad] activates!")) - flick(pad.sending_state,pad) - pad.icon_state = pad.idle_state + pad.finish_sending() sending = FALSE ///The loop that calculates the value of stuff on a pirate pad, or plain sell them if dry_run is FALSE. @@ -394,7 +402,7 @@ sending = TRUE status_report = "Sending... " pad.visible_message(span_notice("[pad] starts charging up.")) - pad.icon_state = pad.warmup_state + pad.set_is_sending(TRUE) sending_timer = addtimer(CALLBACK(src, PROC_REF(send), check_global, user), warmup_time, TIMER_STOPPABLE) if(load_holding_facility) //We ensure that the holding facility is loaded in time in case we're selling mobs. @@ -409,7 +417,7 @@ if(custom_report) status_report = custom_report var/obj/machinery/piratepad/pad = pad_ref?.resolve() - pad.icon_state = pad.idle_state + pad.set_is_sending(FALSE) deltimer(sending_timer) /datum/export/pirate diff --git a/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm b/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm index 546d2818ebc..3769dedb1ff 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm @@ -153,7 +153,7 @@ return TRUE /obj/machinery/atmospherics/components/binary/circulator/crowbar_act(mob/user, obj/item/I) - if(default_deconstruction_crowbar(I)) + if(default_deconstruction_crowbar(user, I)) return TRUE return ..() diff --git a/code/modules/atmospherics/machinery/components/electrolyzer/electrolyzer.dm b/code/modules/atmospherics/machinery/components/electrolyzer/electrolyzer.dm index 89c4b61971c..a469f4cc2e7 100644 --- a/code/modules/atmospherics/machinery/components/electrolyzer/electrolyzer.dm +++ b/code/modules/atmospherics/machinery/components/electrolyzer/electrolyzer.dm @@ -158,7 +158,7 @@ return ITEM_INTERACT_SUCCESS /obj/machinery/electrolyzer/crowbar_act(mob/living/user, obj/item/tool) - return default_deconstruction_crowbar(tool) + return default_deconstruction_crowbar(user, tool) /obj/machinery/electrolyzer/attackby(obj/item/I, mob/user, list/modifiers, list/attack_modifiers) add_fingerprint(user) diff --git a/code/modules/atmospherics/machinery/components/fusion/hfr_parts.dm b/code/modules/atmospherics/machinery/components/fusion/hfr_parts.dm index d3dc5de9c5b..a1878159900 100644 --- a/code/modules/atmospherics/machinery/components/fusion/hfr_parts.dm +++ b/code/modules/atmospherics/machinery/components/fusion/hfr_parts.dm @@ -31,13 +31,11 @@ . = ..() . += span_notice("[src] can be rotated by first opening the panel with a screwdriver and then using a wrench on it.") -/obj/machinery/atmospherics/components/unary/hypertorus/attackby(obj/item/I, mob/user, list/modifiers, list/attack_modifiers) - if(!fusion_started) - if(default_deconstruction_screwdriver(user, "[base_icon_state]_open", base_icon_state, I)) - return - if(default_change_direction_wrench(user, I)) - return - return ..() +/obj/machinery/atmospherics/components/unary/hypertorus/screwdriver_act(mob/living/user, obj/item/tool) + return fusion_started ? NONE : default_deconstruction_screwdriver(user, tool) + +/obj/machinery/atmospherics/components/unary/hypertorus/wrench_act(mob/living/user, obj/item/I) + return default_change_direction_wrench(user, I) /obj/machinery/atmospherics/components/unary/hypertorus/welder_act(mob/living/user, obj/item/tool) if(!cracked) @@ -114,15 +112,14 @@ . = ..() . += span_notice("[src] can be rotated by first opening the panel with a screwdriver and then using a wrench on it.") -/obj/machinery/hypertorus/attackby(obj/item/I, mob/user, list/modifiers, list/attack_modifiers) - if(!fusion_started) - if(default_deconstruction_screwdriver(user, "[base_icon_state]_open", base_icon_state, I)) - return - if(default_change_direction_wrench(user, I)) - return - if(default_deconstruction_crowbar(I)) - return - return ..() +/obj/machinery/hypertorus/screwdriver_act(mob/living/user, obj/item/tool) + return fusion_started ? NONE : default_deconstruction_screwdriver(user, tool) + +/obj/machinery/hypertorus/wrench_act(mob/living/user, obj/item/tool) + return default_change_direction_wrench(user, tool) + +/obj/machinery/hypertorus/crowbar_act(mob/living/user, obj/item/tool) + return default_deconstruction_crowbar(user, tool) /obj/machinery/hypertorus/update_icon_state() if(panel_open) diff --git a/code/modules/atmospherics/machinery/components/gas_recipe_machines/crystallizer.dm b/code/modules/atmospherics/machinery/components/gas_recipe_machines/crystallizer.dm index a4a63f4ee40..b48dbd53c0c 100644 --- a/code/modules/atmospherics/machinery/components/gas_recipe_machines/crystallizer.dm +++ b/code/modules/atmospherics/machinery/components/gas_recipe_machines/crystallizer.dm @@ -58,13 +58,8 @@ context[SCREENTIP_CONTEXT_RMB] = "Rotate" return CONTEXTUAL_SCREENTIP_SET -/obj/machinery/atmospherics/components/binary/crystallizer/attackby(obj/item/I, mob/user, list/modifiers, list/attack_modifiers) - if(!on) - if(default_deconstruction_screwdriver(user, "[base_icon_state]-open", "[base_icon_state]-off", I)) - return - if(default_change_direction_wrench(user, I)) - return - return ..() +/obj/machinery/atmospherics/components/binary/crystallizer/screwdriver_act(mob/living/user, obj/item/tool) + return on ? NONE : default_deconstruction_screwdriver(user, tool) /obj/machinery/atmospherics/components/binary/crystallizer/crowbar_act(mob/living/user, obj/item/tool) return crowbar_deconstruction_act(user, tool, internal.return_pressure()) diff --git a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm index 8c57f8a9da0..c265073dd2c 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm @@ -249,20 +249,17 @@ . = ITEM_INTERACT_BLOCKING if(on) balloon_alert(user, "turn off!") - return + return ITEM_INTERACT_BLOCKING if(occupant) balloon_alert(user, "occupant inside!") - return + return ITEM_INTERACT_BLOCKING - if(default_deconstruction_screwdriver(user, "pod-off", "pod-off", tool)) - update_appearance(UPDATE_ICON) - return ITEM_INTERACT_SUCCESS + return default_deconstruction_screwdriver(user, tool) /obj/machinery/cryo_cell/crowbar_act(mob/living/user, obj/item/tool) - . = ITEM_INTERACT_BLOCKING if(on) balloon_alert(user, "turn off!") - return + return ITEM_INTERACT_BLOCKING var/can_crowbar = FALSE if(!state_open && !panel_open && !is_operational) //can pry open @@ -270,7 +267,7 @@ else if(panel_open) //can deconstruct can_crowbar = TRUE if(!can_crowbar) - return + return ITEM_INTERACT_BLOCKING var/obj/machinery/atmospherics/node = internal_connector.gas_connector.nodes[1] var/internal_pressure = 0 @@ -289,15 +286,12 @@ if(internal_pressure > 2 * ONE_ATMOSPHERE) to_chat(user, span_warning("As you begin prying \the [src] a gush of air blows in your face... maybe you should reconsider?")) if(!do_after(user, 2 SECONDS, target = src)) - return + return ITEM_INTERACT_BLOCKING unsafe_release = TRUE var/deconstruct = FALSE - if(!default_pry_open(tool)) - if(!default_deconstruction_crowbar(tool, custom_deconstruct = TRUE)) - return - else - deconstruct = TRUE + if(!(default_pry_open(tool) & ITEM_INTERACT_SUCCESS)) + deconstruct = can_crowbar_deconstruct() if(unsafe_release) internal_connector.gas_connector.unsafe_pressure_release(user, internal_pressure) diff --git a/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm b/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm index d2bc055ec58..7fb5364170b 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm @@ -78,7 +78,6 @@ if(check_pipe_on_turf()) set_anchored(FALSE) set_panel_open(TRUE) - icon_state = "thermo-open" balloon_alert(user, "the port is already in use!") /obj/machinery/atmospherics/components/unary/thermomachine/RefreshParts() @@ -203,9 +202,8 @@ if(!anchored) balloon_alert(user, "anchor!") return ITEM_INTERACT_SUCCESS - if(default_deconstruction_screwdriver(user, "thermo-open", "thermo-0", tool)) - update_appearance(UPDATE_ICON) - return ITEM_INTERACT_SUCCESS + + return default_deconstruction_screwdriver(user, tool) /obj/machinery/atmospherics/components/unary/thermomachine/wrench_act(mob/living/user, obj/item/tool) return default_change_direction_wrench(user, tool) diff --git a/code/modules/atmospherics/machinery/portable/canister.dm b/code/modules/atmospherics/machinery/portable/canister.dm index 509370a0307..0ca5fbff785 100644 --- a/code/modules/atmospherics/machinery/portable/canister.dm +++ b/code/modules/atmospherics/machinery/portable/canister.dm @@ -434,9 +434,7 @@ return ..() /obj/machinery/portable_atmospherics/canister/screwdriver_act(mob/living/user, obj/item/screwdriver) - if(default_deconstruction_screwdriver(user, icon_state, icon_state, screwdriver)) - update_appearance() - return ITEM_INTERACT_SUCCESS + return default_deconstruction_screwdriver(user, screwdriver) /obj/machinery/portable_atmospherics/canister/crowbar_act(mob/living/user, obj/item/tool) if(!panel_open || !internal_cell) diff --git a/code/modules/bitrunning/netpod/container.dm b/code/modules/bitrunning/netpod/container.dm index b9c262a9fb1..1ac1cac9771 100644 --- a/code/modules/bitrunning/netpod/container.dm +++ b/code/modules/bitrunning/netpod/container.dm @@ -36,32 +36,32 @@ enter_matrix() -/obj/machinery/netpod/default_pry_open(obj/item/crowbar, mob/living/pryer) - if(isnull(occupant) || !iscarbon(occupant)) +/obj/machinery/netpod/default_pry_open(mob/living/user, obj/item/crowbar, close_after_pry = FALSE, open_density = FALSE, closed_density = TRUE, deconstruct_on_fail = FALSE) + if(!iscarbon(occupant)) if(!state_open) if(panel_open) - return FALSE + return deconstruct_on_fail ? default_deconstruction_crowbar(user, crowbar) : NONE open_machine() else shut_pod() - return TRUE + return ITEM_INTERACT_SUCCESS - pryer.visible_message( - span_danger("[pryer] starts prying open [src]!"), + user.visible_message( + span_danger("[user] starts prying open [src]!"), span_notice("You start to pry open [src]."), span_notice("You hear loud prying on metal.") ) playsound(src, 'sound/machines/airlock/airlock_alien_prying.ogg', 100, TRUE) - SEND_SIGNAL(src, COMSIG_BITRUNNER_CROWBAR_ALERT, pryer) + SEND_SIGNAL(src, COMSIG_BITRUNNER_CROWBAR_ALERT, user) - if(do_after(pryer, 15 SECONDS, src)) + if(crowbar.use_tool(src, user, 15 SECONDS, volume = 50)) if(!state_open) sever_connection() open_machine() - return TRUE + return ITEM_INTERACT_SUCCESS /// Closes the machine without shoving in an occupant diff --git a/code/modules/bitrunning/netpod/tools.dm b/code/modules/bitrunning/netpod/tools.dm index 0d31bdab866..350448286c5 100644 --- a/code/modules/bitrunning/netpod/tools.dm +++ b/code/modules/bitrunning/netpod/tools.dm @@ -3,9 +3,7 @@ attack_hand(user) return ITEM_INTERACT_SUCCESS - if(default_pry_open(tool, user) || default_deconstruction_crowbar(tool)) - return ITEM_INTERACT_SUCCESS - + return default_pry_open(user, tool, deconstruct_on_fail = TRUE) /obj/machinery/netpod/screwdriver_act(mob/living/user, obj/item/tool) if(occupant) @@ -13,10 +11,7 @@ return ITEM_INTERACT_SUCCESS if(state_open) - balloon_alert(user, "close first.") + balloon_alert(user, "close it first!") return ITEM_INTERACT_SUCCESS - if(default_deconstruction_screwdriver(user, "[base_icon_state]_panel", "[base_icon_state]_closed", tool)) - update_appearance() // sometimes icon doesnt properly update during flick() - ui_close(user) - return ITEM_INTERACT_SUCCESS + return default_deconstruction_screwdriver(user, tool) diff --git a/code/modules/bitrunning/netpod/ui.dm b/code/modules/bitrunning/netpod/ui.dm index 919ba1e174b..30f9d2d0de7 100644 --- a/code/modules/bitrunning/netpod/ui.dm +++ b/code/modules/bitrunning/netpod/ui.dm @@ -39,3 +39,7 @@ return TRUE return FALSE + + +/obj/machinery/netpod/ui_status(mob/user, datum/ui_state/state) + return panel_open ? UI_CLOSE : ..() diff --git a/code/modules/bitrunning/objects/byteforge.dm b/code/modules/bitrunning/objects/byteforge.dm index 5fccb167a5c..39ea1d57b26 100644 --- a/code/modules/bitrunning/objects/byteforge.dm +++ b/code/modules/bitrunning/objects/byteforge.dm @@ -47,14 +47,14 @@ setup_particles() /obj/machinery/byteforge/screwdriver_act(mob/living/user, obj/item/screwdriver) - . = ITEM_INTERACT_FAILURE - if(default_deconstruction_screwdriver(user, "[base_icon_state]_panel", base_icon_state, screwdriver)) - return ITEM_INTERACT_SUCCESS + return default_deconstruction_screwdriver(user, screwdriver) /obj/machinery/byteforge/crowbar_act(mob/living/user, obj/item/crowbar) - . = ITEM_INTERACT_FAILURE - if(default_deconstruction_crowbar(crowbar)) - return ITEM_INTERACT_SUCCESS + return default_deconstruction_crowbar(user, crowbar) + +/obj/machinery/byteforge/update_icon_state() + . = ..() + icon_state = panel_open ? "[base_icon_state]_panel" : base_icon_state /// Does some sparks after it's done /obj/machinery/byteforge/proc/flash(atom/movable/thing) @@ -93,4 +93,3 @@ flicker() addtimer(CALLBACK(src, PROC_REF(spawn_cache), cache), 1 SECONDS) - diff --git a/code/modules/bitrunning/server/_parent.dm b/code/modules/bitrunning/server/_parent.dm index b91b6a15d40..89525514e47 100644 --- a/code/modules/bitrunning/server/_parent.dm +++ b/code/modules/bitrunning/server/_parent.dm @@ -140,6 +140,9 @@ if(isnull(generated_domain) || !is_operational) icon_state = base_icon_state return ..() + if(panel_open) + icon_state = "[base_icon_state]_panel" + return ..() icon_state = "[base_icon_state]_[is_ready ? "on" : "off"]" return ..() @@ -157,23 +160,19 @@ return ITEM_INTERACT_SUCCESS /obj/machinery/quantum_server/crowbar_act(mob/living/user, obj/item/crowbar) - . = NONE if(!is_ready) balloon_alert(user, "it's scalding hot!") return ITEM_INTERACT_FAILURE if(length(avatar_connection_refs)) balloon_alert(user, "all clients must disconnect!") return ITEM_INTERACT_FAILURE - if(default_deconstruction_crowbar(crowbar)) - return ITEM_INTERACT_SUCCESS + return default_deconstruction_crowbar(user, crowbar) /obj/machinery/quantum_server/screwdriver_act(mob/living/user, obj/item/screwdriver) - . = NONE if(!is_ready) balloon_alert(user, "it's scalding hot!") return ITEM_INTERACT_FAILURE - if(default_deconstruction_screwdriver(user, "[base_icon_state]_panel", base_icon_state, screwdriver)) - return ITEM_INTERACT_SUCCESS + return default_deconstruction_screwdriver(user, screwdriver) /obj/machinery/quantum_server/RefreshParts() var/capacitor_rating = 1.15 diff --git a/code/modules/cargo/materials_market.dm b/code/modules/cargo/materials_market.dm index 83b047957c9..390ac1d0ee9 100644 --- a/code/modules/cargo/materials_market.dm +++ b/code/modules/cargo/materials_market.dm @@ -36,19 +36,14 @@ return ITEM_INTERACT_SUCCESS /obj/machinery/materials_market/screwdriver_act(mob/living/user, obj/item/tool) - . = ..() - if(default_deconstruction_screwdriver(user, "[base_icon_state]_open", "[base_icon_state]", tool)) - return ITEM_INTERACT_SUCCESS + return default_deconstruction_screwdriver(user, tool) /obj/machinery/materials_market/crowbar_act(mob/living/user, obj/item/tool) - . = ..() - if(default_deconstruction_crowbar(tool)) - return ITEM_INTERACT_SUCCESS + return default_deconstruction_crowbar(user, tool) /obj/machinery/materials_market/item_interaction(mob/living/user, obj/item/stack/exportable, list/modifiers) - . = NONE if(!isstack(exportable)) - return + return NONE if(!is_operational) balloon_alert(user, "no power!") diff --git a/code/modules/experisci/destructive_scanner.dm b/code/modules/experisci/destructive_scanner.dm index 46b5ab01d86..12f12f1723a 100644 --- a/code/modules/experisci/destructive_scanner.dm +++ b/code/modules/experisci/destructive_scanner.dm @@ -104,8 +104,11 @@ . = ..() icon_state = scanning ? "tube_on" : "tube_open" -/obj/machinery/destructive_scanner/attackby(obj/item/object, mob/user, list/modifiers, list/attack_modifiers) - if (!scanning && default_deconstruction_screwdriver(user, "tube_open", "tube_open", object) || default_deconstruction_crowbar(object)) - update_icon() - return - return ..() +/obj/machinery/destructive_scanner/screwdriver_act(mob/living/user, obj/item/tool) + return scanning ? NONE : default_deconstruction_screwdriver(user, tool) + +/obj/machinery/destructive_scanner/crowbar_act(mob/living/user, obj/item/tool) + return default_deconstruction_crowbar(user, tool) + +/obj/machinery/destructive_scanner/can_crowbar_deconstruct() + return ..() && !scanning diff --git a/code/modules/explorer_drone/scanner_array.dm b/code/modules/explorer_drone/scanner_array.dm index 2c52a26f7b1..8a86eed2305 100644 --- a/code/modules/explorer_drone/scanner_array.dm +++ b/code/modules/explorer_drone/scanner_array.dm @@ -193,6 +193,7 @@ GLOBAL_LIST_INIT(scan_conditions,init_scan_conditions()) name = "scanner array" icon = 'icons/obj/exploration.dmi' icon_state = "scanner_off" + base_icon_state = "scanner" desc = "A sophisticated scanning array. Easily influenced by its environment." circuit = /obj/item/circuitboard/machine/exoscanner ///the scan power of this array to supply to scanner_controller @@ -226,15 +227,10 @@ GLOBAL_LIST_INIT(scan_conditions,init_scan_conditions()) update_current_power_usage() /obj/machinery/exoscanner/screwdriver_act(mob/user, obj/item/tool) - . = ..() - if(!.) - . = default_deconstruction_screwdriver(user, "scanner_open", "scanner_off", tool) - update_readiness() + return default_deconstruction_screwdriver(user, tool) /obj/machinery/exoscanner/crowbar_act(mob/user, obj/item/tool) - ..() - if(default_deconstruction_crowbar(tool)) - return TRUE + return default_deconstruction_crowbar(user, tool) /obj/machinery/exoscanner/proc/scan_change() SIGNAL_HANDLER @@ -260,13 +256,15 @@ GLOBAL_LIST_INIT(scan_conditions,init_scan_conditions()) /obj/machinery/exoscanner/update_icon_state() . = ..() - if(is_ready()) + if(panel_open) + icon_state = "[base_icon_state]_open" + else if(is_ready()) if(GLOB.exoscanner_controller.current_scan) - icon_state = "scanner_on" + icon_state = "[base_icon_state]_on" else - icon_state = "scanner_ready" + icon_state = "[base_icon_state]_ready" else - icon_state = "scanner_off" + icon_state = "[base_icon_state]_off" /obj/machinery/exoscanner/wrench_act(mob/living/user, obj/item/tool) . = ..() @@ -281,6 +279,9 @@ GLOBAL_LIST_INIT(scan_conditions,init_scan_conditions()) . = ..() update_readiness() +/obj/machinery/exoscanner/on_set_panel_open(old_value) + update_readiness() + ///Helper datum to calculate and store scanning power and track in progress scans /datum/scanner_controller /// List of dishes in working condition. diff --git a/code/modules/food_and_drinks/machinery/coffeemaker.dm b/code/modules/food_and_drinks/machinery/coffeemaker.dm index 2bfee2504d3..79c25e42583 100644 --- a/code/modules/food_and_drinks/machinery/coffeemaker.dm +++ b/code/modules/food_and_drinks/machinery/coffeemaker.dm @@ -40,6 +40,8 @@ var/static/radial_take_sweetener = image(icon = 'icons/hud/radial_coffee.dmi', icon_state = "radial_take_sweetener") var/static/radial_take_creamer = image(icon = 'icons/hud/radial_coffee.dmi', icon_state = "radial_take_creamer") + var/cup_type = /obj/item/reagent_containers/cup/glass/coffee_cup + /obj/machinery/coffeemaker/Initialize(mapload) . = ..() if(mapload) @@ -194,16 +196,15 @@ default_unfasten_wrench(user, tool) return ITEM_INTERACT_SUCCESS +/obj/machinery/coffeemaker/screwdriver_act(mob/living/user, obj/item/tool) + return isnull(coffeepot) ? default_deconstruction_screwdriver(user, tool) : NONE + +/obj/machinery/coffeemaker/crowbar_act(mob/living/user, obj/item/tool) + return default_deconstruction_crowbar(user, tool) + /obj/machinery/coffeemaker/item_interaction(mob/living/user, obj/item/tool, list/modifiers) - //You can only screw open empty grinder - if(!coffeepot && default_deconstruction_screwdriver(user, icon_state, icon_state, tool)) - return ITEM_INTERACT_SUCCESS - - if(default_deconstruction_crowbar(tool)) - return ITEM_INTERACT_SUCCESS - if(panel_open) //Can't insert objects when its screwed open - return ITEM_INTERACT_BLOCKING + return NONE if (istype(tool, /obj/item/reagent_containers/cup/coffeepot) && !(tool.item_flags & ABSTRACT) && tool.is_open_container()) var/obj/item/reagent_containers/cup/coffeepot/new_pot = tool @@ -214,7 +215,7 @@ update_appearance(UPDATE_OVERLAYS) return ITEM_INTERACT_SUCCESS //no afterattack - if (istype(tool, /obj/item/reagent_containers/cup/glass/coffee_cup) && !(tool.item_flags & ABSTRACT) && tool.is_open_container()) + if (istype(tool, cup_type) && !(tool.item_flags & ABSTRACT) && tool.is_open_container()) var/obj/item/reagent_containers/cup/glass/coffee_cup/new_cup = tool if(new_cup.reagents.total_volume > 0) balloon_alert(user, "the cup must be empty!") @@ -270,7 +271,7 @@ update_appearance(UPDATE_OVERLAYS) return ITEM_INTERACT_SUCCESS //no afterattack - if (istype(tool, /obj/item/coffee_cartridge) && !(tool.item_flags & ABSTRACT)) + if (initial_cartridge && istype(tool, /obj/item/coffee_cartridge) && !(tool.item_flags & ABSTRACT)) var/obj/item/coffee_cartridge/new_cartridge = tool if(!user.transferItemToLoc(new_cartridge, src)) return ITEM_INTERACT_BLOCKING @@ -521,6 +522,8 @@ brew_time = 15 SECONDS //industrial grade, its faster than the regular one density = TRUE pass_flags = PASSTABLE + + cup_type = /obj/item/reagent_containers/cup/glass/coffee /// Current amount of coffee beans stored var/coffee_amount = 0 /// List of coffee bean objects are stored @@ -596,79 +599,8 @@ return TRUE /obj/machinery/coffeemaker/impressa/item_interaction(mob/living/user, obj/item/tool, list/modifiers) - //You can only screw open empty grinder - if(!coffeepot && default_deconstruction_screwdriver(user, icon_state, icon_state, tool)) - return ITEM_INTERACT_SUCCESS - - if(default_deconstruction_crowbar(tool)) - return ITEM_INTERACT_SUCCESS - - if(panel_open) //Can't insert objects when its screwed open - return ITEM_INTERACT_BLOCKING - - if (istype(tool, /obj/item/reagent_containers/cup/coffeepot) && !(tool.item_flags & ABSTRACT) && tool.is_open_container()) - var/obj/item/reagent_containers/cup/coffeepot/new_pot = tool - if(!user.transferItemToLoc(new_pot, src)) - return ITEM_INTERACT_BLOCKING - replace_pot(user, new_pot) - update_appearance(UPDATE_OVERLAYS) - return ITEM_INTERACT_SUCCESS //no afterattack - - if (istype(tool, /obj/item/reagent_containers/cup/glass/coffee) && !(tool.item_flags & ABSTRACT) && tool.is_open_container()) - var/obj/item/reagent_containers/cup/glass/coffee/new_cup = tool //different type of cup - if(new_cup.reagents.total_volume > 0 ) - balloon_alert(user, "the cup must be empty!") - return ITEM_INTERACT_BLOCKING - if(coffee_cups >= max_coffee_cups) - balloon_alert(user, "the cup holder is full!") - return ITEM_INTERACT_BLOCKING - if(!user.transferItemToLoc(tool, src)) - return ITEM_INTERACT_BLOCKING - coffee_cups++ - update_appearance(UPDATE_OVERLAYS) - return ITEM_INTERACT_SUCCESS //no afterattack - - if (istype(tool, /obj/item/reagent_containers/condiment/pack/sugar)) - var/obj/item/reagent_containers/condiment/pack/sugar/new_pack = tool - if(new_pack.reagents.total_volume < new_pack.reagents.maximum_volume) - balloon_alert(user, "the pack must be full!") - return ITEM_INTERACT_BLOCKING - if(sugar_packs >= max_sugar_packs) - balloon_alert(user, "the sugar compartment is full!") - return ITEM_INTERACT_BLOCKING - if(!user.transferItemToLoc(tool, src)) - return ITEM_INTERACT_BLOCKING - sugar_packs++ - update_appearance(UPDATE_OVERLAYS) - return ITEM_INTERACT_SUCCESS //no afterattack - - if (istype(tool, /obj/item/reagent_containers/condiment/creamer)) - var/obj/item/reagent_containers/condiment/creamer/new_pack = tool - if(new_pack.reagents.total_volume < new_pack.reagents.maximum_volume) - balloon_alert(user, "the pack must be full!") - return ITEM_INTERACT_BLOCKING - if(creamer_packs >= max_creamer_packs) - balloon_alert(user, "the creamer compartment is full!") - return ITEM_INTERACT_BLOCKING - if(!user.transferItemToLoc(tool, src)) - return ITEM_INTERACT_BLOCKING - creamer_packs++ - update_appearance(UPDATE_OVERLAYS) - return ITEM_INTERACT_SUCCESS //no afterattack - - if (istype(tool, /obj/item/reagent_containers/condiment/pack/astrotame)) - var/obj/item/reagent_containers/condiment/pack/astrotame/new_pack = tool - if(new_pack.reagents.total_volume < new_pack.reagents.maximum_volume) - balloon_alert(user, "the pack must be full!") - return ITEM_INTERACT_BLOCKING - if(sweetener_packs >= max_sweetener_packs) - balloon_alert(user, "the sweetener compartment is full!") - return ITEM_INTERACT_BLOCKING - if(!user.transferItemToLoc(tool, src)) - return ITEM_INTERACT_BLOCKING - sweetener_packs++ - update_appearance(UPDATE_OVERLAYS) - return ITEM_INTERACT_SUCCESS //no afterattack + if(panel_open) + return NONE if (istype(tool, /obj/item/food/grown/coffee) && !(tool.item_flags & ABSTRACT)) if(coffee_amount >= BEAN_CAPACITY) @@ -686,31 +618,36 @@ update_appearance(UPDATE_OVERLAYS) return ITEM_INTERACT_SUCCESS //no afterattack - if (istype(tool, /obj/item/storage/box/coffeepack)) + if (istype(tool, /obj/item/storage/box/coffeepack) && !(tool.item_flags & ABSTRACT)) if(coffee_amount >= BEAN_CAPACITY) balloon_alert(user, "the coffee container is full!") return ITEM_INTERACT_BLOCKING var/obj/item/storage/box/coffeepack/new_coffee_pack = tool + var/added_any = FALSE + var/had_nondried = FALSE for(var/obj/item/food/grown/coffee/new_coffee in new_coffee_pack.contents) - if(HAS_TRAIT(new_coffee, TRAIT_DRIED)) //the coffee beans inside must be dry - if(coffee_amount < BEAN_CAPACITY) - if(user.transferItemToLoc(new_coffee, src)) - coffee += new_coffee - coffee_amount++ - new_coffee.forceMove(src) - balloon_alert(user, "added coffee") - update_appearance(UPDATE_OVERLAYS) - else - return ITEM_INTERACT_BLOCKING - else - return ITEM_INTERACT_BLOCKING - else - balloon_alert(user, "non-dried beans inside of coffee pack!") + if(!HAS_TRAIT(new_coffee, TRAIT_DRIED)) //the coffee beans inside must be dry + had_nondried = TRUE return ITEM_INTERACT_BLOCKING - update_appearance(UPDATE_OVERLAYS) + if(coffee_amount >= BEAN_CAPACITY) + break + if(!user.transferItemToLoc(new_coffee, src)) + break + coffee += new_coffee + coffee_amount++ + new_coffee.forceMove(src) + added_any = TRUE + + if(added_any) + balloon_alert(user, "added coffee") + update_appearance(UPDATE_OVERLAYS) + else if(had_nondried) + balloon_alert(user, "non-dried beans inside of coffee pack!") + else + balloon_alert(user, "no beans added!") return ITEM_INTERACT_SUCCESS //no afterattack - return NONE // Allow normal attack processing if no special interaction occurred + return ..() /obj/machinery/coffeemaker/impressa/take_cup(mob/user) if(!coffee_cups) //shouldn't happen, but we all know how stuff manages to break diff --git a/code/modules/food_and_drinks/machinery/deep_fryer.dm b/code/modules/food_and_drinks/machinery/deep_fryer.dm index fe3d0355a31..a7834dce7c4 100644 --- a/code/modules/food_and_drinks/machinery/deep_fryer.dm +++ b/code/modules/food_and_drinks/machinery/deep_fryer.dm @@ -16,6 +16,7 @@ GLOBAL_LIST_INIT(oilfry_blacklisted_items, typecacheof(list( desc = "Deep fried everything." icon = 'icons/obj/machines/kitchen.dmi' icon_state = "fryer_off" + base_icon_state = "fryer" density = TRUE pass_flags_self = PASSMACHINE | LETPASSTHROW idle_power_usage = BASE_MACHINE_IDLE_CONSUMPTION * 0.05 @@ -97,48 +98,48 @@ GLOBAL_LIST_INIT(oilfry_blacklisted_items, typecacheof(list( default_unfasten_wrench(user, tool) return ITEM_INTERACT_SUCCESS -/obj/machinery/deepfryer/attackby(obj/item/weapon, mob/user, list/modifiers, list/attack_modifiers) - // Dissolving pills into the frier - if(istype(weapon, /obj/item/reagent_containers/applicator/pill)) +/obj/machinery/deepfryer/screwdriver_act(mob/living/user, obj/item/tool) + return default_deconstruction_screwdriver(user, tool) + +/obj/machinery/deepfryer/update_icon_state() + . = ..() + icon_state = "[base_icon_state]_[frying ? "on" : panel_open ? "open" : "off"]" + +/obj/machinery/deepfryer/item_interaction(mob/living/user, obj/item/tool, list/modifiers) + if(istype(tool, /obj/item/reagent_containers/applicator/pill)) if(!reagents.total_volume) - to_chat(user, span_warning("There's nothing to dissolve [weapon] in!")) - return - user.visible_message(span_notice("[user] drops [weapon] into [src]."), span_notice("You dissolve [weapon] in [src].")) - weapon.reagents.trans_to(src, weapon.reagents.total_volume, transferred_by = user) - qdel(weapon) - return - // Make sure we have cooking oil + to_chat(user, span_warning("There's nothing to dissolve [tool] in!")) + return ITEM_INTERACT_BLOCKING + user.visible_message(span_notice("[user] drops [tool] into [src]."), span_notice("You dissolve [tool] in [src].")) + tool.reagents.trans_to(src, tool.reagents.total_volume, transferred_by = user) + qdel(tool) + return ITEM_INTERACT_SUCCESS + + if(user.combat_mode) + return ITEM_INTERACT_SKIP_TO_ATTACK // allow a thwack + if(!reagents.has_reagent(/datum/reagent/consumable/nutriment/fat, check_subtypes = TRUE)) to_chat(user, span_warning("[src] has no fat or oil to fry with!")) - return - // Don't deep fry indestructible things, for sanity reasons - if(weapon.resistance_flags & INDESTRUCTIBLE) - to_chat(user, span_warning("You don't feel it would be wise to fry [weapon]...")) - return - // No fractal frying - if(HAS_TRAIT(weapon, TRAIT_FOOD_FRIED)) - to_chat(user, span_userdanger("Your cooking skills are not up to the legendary Doublefry technique.")) - return - // Handle opening up the fryer with tools - if(default_deconstruction_screwdriver(user, "fryer_off", "fryer_off", weapon)) //where's the open maint panel icon?! - return - else - // So we skip the attack animation - if(weapon.is_drainable()) - return - // Check for stuff we certainly shouldn't fry - else if(is_type_in_typecache(weapon, deepfry_blacklisted_items) \ - || is_type_in_typecache(weapon, GLOB.oilfry_blacklisted_items) \ - || weapon.atom_storage \ - || HAS_TRAIT(weapon, TRAIT_NODROP) \ - || (weapon.item_flags & (ABSTRACT|DROPDEL|HAND_ITEM))) - return ..() - // Do the frying. - else if(!frying && user.transferItemToLoc(weapon, src)) - start_fry(weapon, user) - return + return ITEM_INTERACT_BLOCKING - return ..() + if(tool.resistance_flags & INDESTRUCTIBLE) + to_chat(user, span_warning("You don't feel it would be wise to fry [tool]...")) + return ITEM_INTERACT_BLOCKING + + if(tool.is_drainable()) + return NONE // pour it in + + var/deepfry_blacklisted = is_type_in_typecache(tool, deepfry_blacklisted_items) || is_type_in_typecache(tool, GLOB.oilfry_blacklisted_items) + var/is_storage = !!tool.atom_storage + var/illegal_item = HAS_TRAIT(tool, TRAIT_NODROP) || (tool.item_flags & (ABSTRACT|DROPDEL|HAND_ITEM)) + if(deepfry_blacklisted || is_storage || illegal_item) + return NONE + + if(!frying && user.transferItemToLoc(tool, src)) + start_fry(tool, user) + return ITEM_INTERACT_SUCCESS + + return NONE /obj/machinery/deepfryer/process(seconds_per_tick) ..() @@ -181,9 +182,8 @@ GLOBAL_LIST_INIT(oilfry_blacklisted_items, typecacheof(list( frying_burnt = FALSE fry_loop.stop() cook_time = 0 + update_appearance() flick("fryer_stop", src) - icon_state = "fryer_off" - update_appearance(UPDATE_OVERLAYS) /obj/machinery/deepfryer/proc/start_fry(obj/item/frying_item, mob/user) to_chat(user, span_notice("You put [frying_item] into [src].")) @@ -202,8 +202,8 @@ GLOBAL_LIST_INIT(oilfry_blacklisted_items, typecacheof(list( ADD_TRAIT(frying, TRAIT_FOOD_CHEF_MADE, REF(user.mind)) SEND_SIGNAL(frying, COMSIG_ITEM_ENTERED_FRYER) + update_appearance() flick("fryer_start", src) - icon_state = "fryer_on" fry_loop.start() /obj/machinery/deepfryer/proc/blow_up() diff --git a/code/modules/food_and_drinks/machinery/gibber.dm b/code/modules/food_and_drinks/machinery/gibber.dm index bbb418892a0..3f75e531d5b 100644 --- a/code/modules/food_and_drinks/machinery/gibber.dm +++ b/code/modules/food_and_drinks/machinery/gibber.dm @@ -3,6 +3,7 @@ desc = "The name isn't descriptive enough?" icon = 'icons/obj/machines/kitchen.dmi' icon_state = "grinder" + base_icon_state = "grinder" density = TRUE circuit = /obj/item/circuitboard/machine/gibber anchored_tabletop_offset = 8 @@ -134,17 +135,15 @@ default_unfasten_wrench(user, tool) return ITEM_INTERACT_SUCCESS -/obj/machinery/gibber/attackby(obj/item/P, mob/user, list/modifiers, list/attack_modifiers) - if(default_deconstruction_screwdriver(user, "grinder_open", "grinder", P)) - return +/obj/machinery/gibber/screwdriver_act(mob/living/user, obj/item/tool) + return default_deconstruction_screwdriver(user, tool) - else if(default_pry_open(P, close_after_pry = TRUE)) - return +/obj/machinery/gibber/crowbar_act(mob/living/user, obj/item/tool) + return default_pry_open(user, tool, close_after_pry = TRUE, deconstruct_on_fail = TRUE) - else if(default_deconstruction_crowbar(P)) - return - else - return ..() +/obj/machinery/gibber/update_icon_state() + . = ..() + icon_state = panel_open ? "[base_icon_state]_open" : base_icon_state /obj/machinery/gibber/verb/eject() set name = "Empty gibber" diff --git a/code/modules/food_and_drinks/machinery/griddle.dm b/code/modules/food_and_drinks/machinery/griddle.dm index 83dcb2ae873..0698174d4a8 100644 --- a/code/modules/food_and_drinks/machinery/griddle.dm +++ b/code/modules/food_and_drinks/machinery/griddle.dm @@ -27,7 +27,8 @@ . = ..() grill_loop = new(src, FALSE) if(isnum(variant)) - variant = rand(1,3) + variant = rand(1, 3) + update_appearance() RegisterSignal(src, COMSIG_ATOM_EXPOSE_REAGENT, PROC_REF(on_expose_reagent)) RegisterSignal(src, COMSIG_STORAGE_DUMP_CONTENT, PROC_REF(on_storage_dump)) @@ -36,10 +37,15 @@ return ..() /obj/machinery/griddle/crowbar_act(mob/living/user, obj/item/I) - . = ..() - if(default_deconstruction_crowbar(I, ignore_panel = TRUE)) + . = default_deconstruction_crowbar(user, I) + if(.) return - variant = rand(1,3) + // this is dead code... default_deconstruction_crowbar will never fail + variant = rand(1, 3) + update_appearance() + +/obj/machinery/griddle/can_crowbar_deconstruct() + return TRUE /obj/machinery/griddle/IsContainedAtomAccessible(atom/contained, atom/movable/user) return ..() || (contained in griddled_objects) diff --git a/code/modules/food_and_drinks/machinery/grill.dm b/code/modules/food_and_drinks/machinery/grill.dm index 72699cbfc1a..d5690ead874 100644 --- a/code/modules/food_and_drinks/machinery/grill.dm +++ b/code/modules/food_and_drinks/machinery/grill.dm @@ -238,24 +238,19 @@ return NONE /obj/machinery/grill/wrench_act(mob/living/user, obj/item/tool) - if(user.combat_mode) - return NONE - . = ITEM_INTERACT_BLOCKING if(default_unfasten_wrench(user, tool) == SUCCESSFUL_UNFASTEN) return ITEM_INTERACT_SUCCESS /obj/machinery/grill/crowbar_act(mob/living/user, obj/item/tool) - if(user.combat_mode) - return NONE - - . = ITEM_INTERACT_BLOCKING if(anchored) balloon_alert(user, "unanchor first!") - return + return ITEM_INTERACT_BLOCKING - if(default_deconstruction_crowbar(tool, ignore_panel = TRUE)) - return ITEM_INTERACT_SUCCESS + return default_deconstruction_crowbar(user, tool) + +/obj/machinery/grill/can_crowbar_deconstruct() + return !anchored /obj/machinery/grill/process(seconds_per_tick) if(!anchored) diff --git a/code/modules/food_and_drinks/machinery/microwave.dm b/code/modules/food_and_drinks/machinery/microwave.dm index a9e82ecc73a..3c74e8c65dd 100644 --- a/code/modules/food_and_drinks/machinery/microwave.dm +++ b/code/modules/food_and_drinks/machinery/microwave.dm @@ -320,14 +320,10 @@ return ITEM_INTERACT_SUCCESS /obj/machinery/microwave/crowbar_act(mob/living/user, obj/item/tool) - if(!default_deconstruction_crowbar(tool)) - return - return ITEM_INTERACT_SUCCESS + return default_deconstruction_crowbar(user, tool) /obj/machinery/microwave/screwdriver_act(mob/living/user, obj/item/tool) - if(default_deconstruction_screwdriver(user, icon_state, icon_state, tool)) - update_appearance() - return ITEM_INTERACT_SUCCESS + return default_deconstruction_screwdriver(user, tool) /obj/machinery/microwave/wirecutter_act(mob/living/user, obj/item/tool) if(broken != REALLY_BROKEN) diff --git a/code/modules/food_and_drinks/machinery/monkeyrecycler.dm b/code/modules/food_and_drinks/machinery/monkeyrecycler.dm index 5c08f946958..83f7a7d0f17 100644 --- a/code/modules/food_and_drinks/machinery/monkeyrecycler.dm +++ b/code/modules/food_and_drinks/machinery/monkeyrecycler.dm @@ -5,6 +5,7 @@ GLOBAL_LIST_EMPTY(monkey_recyclers) desc = "A machine used for recycling dead monkeys into monkey cubes." icon = 'icons/obj/machines/kitchen.dmi' icon_state = "grinder" + base_icon_state = "grinder" layer = BELOW_OBJ_LAYER interaction_flags_mouse_drop = NEED_DEXTERITY density = TRUE @@ -42,20 +43,15 @@ GLOBAL_LIST_EMPTY(monkey_recyclers) power_change() return ITEM_INTERACT_SUCCESS -/obj/machinery/monkey_recycler/attackby(obj/item/O, mob/user, list/modifiers, list/attack_modifiers) - if(default_deconstruction_screwdriver(user, "grinder_open", "grinder", O)) - return +/obj/machinery/monkey_recycler/screwdriver_act(mob/living/user, obj/item/tool) + return default_deconstruction_screwdriver(user, tool) - if(default_pry_open(O, close_after_pry = TRUE)) - return +/obj/machinery/monkey_recycler/crowbar_act(mob/living/user, obj/item/tool) + return default_pry_open(user, tool, close_after_pry = TRUE, deconstruct_on_fail = TRUE) - if(default_deconstruction_crowbar(O)) - return - - if(machine_stat) //NOPOWER etc - return - else - return ..() +/obj/machinery/monkey_recycler/update_icon_state() + . = ..() + icon_state = panel_open ? "[base_icon_state]_open" : base_icon_state /obj/machinery/monkey_recycler/mouse_drop_receive(mob/living/target, mob/living/user, params) if(!istype(target)) diff --git a/code/modules/food_and_drinks/machinery/oven.dm b/code/modules/food_and_drinks/machinery/oven.dm index 60a946c6d47..d388b06fb48 100644 --- a/code/modules/food_and_drinks/machinery/oven.dm +++ b/code/modules/food_and_drinks/machinery/oven.dm @@ -233,7 +233,10 @@ add_shared_particles(particle_type) /obj/machinery/oven/crowbar_act(mob/living/user, obj/item/tool) - return default_deconstruction_crowbar(tool, ignore_panel = TRUE) + return default_deconstruction_crowbar(user, tool) + +/obj/machinery/oven/can_crowbar_deconstruct() + return TRUE /obj/machinery/oven/wrench_act(mob/living/user, obj/item/tool) default_unfasten_wrench(user, tool, time = 2 SECONDS) diff --git a/code/modules/food_and_drinks/machinery/processor.dm b/code/modules/food_and_drinks/machinery/processor.dm index a0b5b6c743e..5ab717dfe9c 100644 --- a/code/modules/food_and_drinks/machinery/processor.dm +++ b/code/modules/food_and_drinks/machinery/processor.dm @@ -84,47 +84,65 @@ LAZYREMOVE(processor_contents, what) /obj/machinery/processor/wrench_act(mob/living/user, obj/item/tool) - . = ..() + if(processing) + to_chat(user, span_warning("[src] is in the process of processing!")) + return ITEM_INTERACT_BLOCKING + default_unfasten_wrench(user, tool) return ITEM_INTERACT_SUCCESS -/obj/machinery/processor/attackby(obj/item/attacking_item, mob/living/user, list/modifiers, list/attack_modifiers) +/obj/machinery/processor/screwdriver_act(mob/living/user, obj/item/tool) if(processing) to_chat(user, span_warning("[src] is in the process of processing!")) - return TRUE - if(default_deconstruction_screwdriver(user, base_icon_state + "_open", base_icon_state, attacking_item) || default_pry_open(attacking_item, close_after_pry = TRUE) || default_deconstruction_crowbar(attacking_item)) - return + return ITEM_INTERACT_BLOCKING - if(istype(attacking_item, /obj/item/storage/bag/tray)) - var/obj/item/storage/attacking_storage = attacking_item + return default_deconstruction_screwdriver(user, tool) + +/obj/machinery/processor/crowbar_act(mob/living/user, obj/item/tool) + if(processing) + to_chat(user, span_warning("[src] is in the process of processing!")) + return ITEM_INTERACT_BLOCKING + + return default_pry_open(user, tool, close_after_pry = TRUE, deconstruct_on_fail = TRUE) + +/obj/machinery/processor/item_interaction(mob/living/user, obj/item/tool, list/modifiers) + if(user.combat_mode) + return ITEM_INTERACT_SKIP_TO_ATTACK + + if(processing) + to_chat(user, span_warning("[src] is in the process of processing!")) + return ITEM_INTERACT_BLOCKING + + if(istype(tool, /obj/item/storage/bag/tray)) + var/obj/item/storage/attacking_storage = tool var/loaded = 0 for(var/obj/content_item in attacking_storage.contents) if(!IS_EDIBLE(content_item)) continue var/datum/food_processor_process/recipe = PROCESSOR_SELECT_RECIPE(content_item) - if(recipe) - if(attacking_storage.atom_storage.attempt_remove(content_item, src)) - LAZYADD(processor_contents, content_item) - loaded++ - + if(recipe && attacking_storage.atom_storage.attempt_remove(content_item, src)) + LAZYADD(processor_contents, content_item) + loaded++ if(loaded) to_chat(user, span_notice("You insert [loaded] items into [src].")) - return + return ITEM_INTERACT_SUCCESS + return ITEM_INTERACT_BLOCKING - var/datum/food_processor_process/recipe = PROCESSOR_SELECT_RECIPE(attacking_item) - if(recipe) + var/datum/food_processor_process/recipe = PROCESSOR_SELECT_RECIPE(tool) + if(recipe && user.transferItemToLoc(tool, src)) user.visible_message( - span_notice("[user] put [attacking_item] into [src]."), - span_notice("You put [attacking_item] into [src]."), + span_notice("[user] put [tool] into [src]."), + span_notice("You put [tool] into [src]."), ) - user.transferItemToLoc(attacking_item, src, TRUE) - LAZYADD(processor_contents, attacking_item) - return TRUE - else if(!user.combat_mode) - to_chat(user, span_warning("That probably won't blend!")) - return TRUE - else - return ..() + LAZYADD(processor_contents, tool) + return ITEM_INTERACT_SUCCESS + + to_chat(user, span_warning("That probably won't blend!")) + return ITEM_INTERACT_BLOCKING + +/obj/machinery/processor/update_icon_state() + . = ..() + icon_state = panel_open ? "[base_icon_state]_open" : base_icon_state /obj/machinery/processor/interact(mob/user) if(processing) diff --git a/code/modules/food_and_drinks/machinery/smartfridge.dm b/code/modules/food_and_drinks/machinery/smartfridge.dm index 8fca291bc1b..3d957821874 100644 --- a/code/modules/food_and_drinks/machinery/smartfridge.dm +++ b/code/modules/food_and_drinks/machinery/smartfridge.dm @@ -119,14 +119,7 @@ return ITEM_INTERACT_SUCCESS /obj/machinery/smartfridge/screwdriver_act(mob/living/user, obj/item/tool) - if(default_deconstruction_screwdriver(user, icon_state, icon_state, tool)) - if(panel_open) - add_overlay("[base_icon_state]-panel") - else - cut_overlay("[base_icon_state]-panel") - SStgui.update_uis(src) - return ITEM_INTERACT_SUCCESS - return ITEM_INTERACT_BLOCKING + return default_deconstruction_screwdriver(user, tool) /obj/machinery/smartfridge/can_be_unfasten_wrench(mob/user, silent) if(welded_down) @@ -146,15 +139,11 @@ power_change() return ITEM_INTERACT_SUCCESS -/obj/machinery/smartfridge/crowbar_act(mob/living/user, obj/item/tool) - if(default_pry_open(tool, close_after_pry = TRUE)) - return ITEM_INTERACT_SUCCESS +/obj/machinery/smartfridge/can_crowbar_deconstruct() + return ..() && !welded_down - if(welded_down) - balloon_alert(user, "unweld first!") - else - default_deconstruction_crowbar(tool) - return ITEM_INTERACT_SUCCESS +/obj/machinery/smartfridge/crowbar_act(mob/living/user, obj/item/tool) + return default_pry_open(user, tool, close_after_pry = TRUE, deconstruct_on_fail = TRUE) /obj/machinery/smartfridge/add_context(atom/source, list/context, obj/item/held_item, mob/living/user) if(isnull(held_item)) @@ -232,6 +221,9 @@ /obj/machinery/smartfridge/update_overlays() . = ..() + if(panel_open) + . += "[base_icon_state]-panel" + var/shown_contents_length = visible_items() if(visible_contents && shown_contents_length) var/content_level = "[base_icon_state]-[contents_overlay_icon]" @@ -556,9 +548,8 @@ . = ..() //so we don't drop any of the parent smart fridge parts upon deconstruction clear_components() - -/obj/machinery/smartfridge/drying/rack/welder_act_secondary(mob/living/user, obj/item/tool) - return NONE // Can't repair wood with welder + AddElement(/datum/element/tool_blocker, TOOL_WELDER) + AddElement(/datum/element/tool_blocker, TOOL_SCREWDRIVER) /obj/machinery/smartfridge/drying/rack/add_context(atom/source, list/context, obj/item/held_item, mob/living/user) if(isnull(held_item)) @@ -578,9 +569,6 @@ . = ..() . += span_info("The whole rack can be [EXAMINE_HINT("pried")] apart.") -/obj/machinery/smartfridge/drying/rack/default_deconstruction_screwdriver() - return NONE - /obj/machinery/smartfridge/drying/rack/exchange_parts() return @@ -588,8 +576,10 @@ new /obj/item/stack/sheet/mineral/wood(drop_location(), 10) /obj/machinery/smartfridge/drying/rack/crowbar_act(mob/living/user, obj/item/tool) - if(default_deconstruction_crowbar(tool, ignore_panel = TRUE)) - return ITEM_INTERACT_SUCCESS + return default_deconstruction_crowbar(user, tool) + +/obj/machinery/smartfridge/drying/rack/can_crowbar_deconstruct() + return TRUE /obj/machinery/smartfridge/drying/rack/update_overlays() . = ..() diff --git a/code/modules/food_and_drinks/restaurant/_venue.dm b/code/modules/food_and_drinks/restaurant/_venue.dm index 4e0d196f71b..e540da3cbf8 100644 --- a/code/modules/food_and_drinks/restaurant/_venue.dm +++ b/code/modules/food_and_drinks/restaurant/_venue.dm @@ -210,6 +210,10 @@ if(!linked_venue?.open) //Any open venues . += mutable_appearance(icon, "portal_door") +/obj/machinery/restaurant_portal/update_icon_state() + . = ..() + icon_state = panel_open ? "[base_icon_state]-open" : base_icon_state + /obj/machinery/restaurant_portal/attack_hand(mob/living/user) var/obj/item/card/id/used_id = user.get_idcard(TRUE) @@ -264,14 +268,10 @@ return ITEM_INTERACT_SUCCESS /obj/machinery/restaurant_portal/screwdriver_act(mob/user, obj/item/tool) - if (default_deconstruction_screwdriver(user, "[base_icon_state]-open", base_icon_state, tool)) - return ITEM_INTERACT_SUCCESS - return ITEM_INTERACT_BLOCKING + return default_deconstruction_screwdriver(user, tool) /obj/machinery/restaurant_portal/crowbar_act(mob/user, obj/item/tool) - if(default_deconstruction_crowbar(tool)) - return ITEM_INTERACT_SUCCESS - return ITEM_INTERACT_BLOCKING + return default_deconstruction_crowbar(user, tool) /obj/machinery/restaurant_portal/wrench_act(mob/living/user, obj/item/tool) if(!panel_open) diff --git a/code/modules/hydroponics/biogenerator.dm b/code/modules/hydroponics/biogenerator.dm index 30eb26c206f..78538b3e8b9 100644 --- a/code/modules/hydroponics/biogenerator.dm +++ b/code/modules/hydroponics/biogenerator.dm @@ -203,9 +203,7 @@ return NONE /obj/machinery/biogenerator/screwdriver_act(mob/living/user, obj/item/tool) - if(!default_deconstruction_screwdriver(user, icon_state, icon_state, tool)) - return ITEM_INTERACT_BLOCKING - + . = default_deconstruction_screwdriver(user, tool) if(processing) stop_process(FALSE) @@ -213,8 +211,7 @@ beaker.forceMove(drop_location()) beaker = null - update_appearance(UPDATE_ICON) - return ITEM_INTERACT_SUCCESS + return . /obj/machinery/biogenerator/crowbar_act(mob/living/user, obj/item/tool) if(!default_deconstruction_crowbar(tool)) diff --git a/code/modules/hydroponics/hydroponics.dm b/code/modules/hydroponics/hydroponics.dm index 0247c27ccd9..97aecdfbf2c 100644 --- a/code/modules/hydroponics/hydroponics.dm +++ b/code/modules/hydroponics/hydroponics.dm @@ -244,16 +244,11 @@ )) QDEL_NULL(our_snail) +/obj/machinery/hydroponics/constructable/screwdriver_act(mob/living/user, obj/item/tool) + return default_deconstruction_screwdriver(user, tool) -/obj/machinery/hydroponics/constructable/attackby(obj/item/I, mob/living/user, list/modifiers, list/attack_modifiers) - if (!user.combat_mode) - // handle opening the panel - if(default_deconstruction_screwdriver(user, icon_state, icon_state, I)) - return - if(default_deconstruction_crowbar(I)) - return - - return ..() +/obj/machinery/hydroponics/constructable/crowbar_act(mob/living/user, obj/item/tool) + return default_deconstruction_crowbar(user, tool) /obj/machinery/hydroponics/bullet_act(obj/projectile/proj) //Works with the Somatoray to modify plant variables. if(!myseed) diff --git a/code/modules/hydroponics/seed_extractor.dm b/code/modules/hydroponics/seed_extractor.dm index 0e8d2936d14..5d29760e4bf 100644 --- a/code/modules/hydroponics/seed_extractor.dm +++ b/code/modules/hydroponics/seed_extractor.dm @@ -46,6 +46,7 @@ desc = "Extracts and bags seeds from produce." icon = 'icons/obj/service/hydroponics/equipment.dmi' icon_state = "sextractor" + base_icon_state = "sextractor" density = TRUE circuit = /obj/item/circuitboard/machine/seed_extractor /// Associated list of seeds, they are all weak refs. We check the len to see how many refs we have for each @@ -88,42 +89,39 @@ if(in_range(user, src) || isobserver(user)) . += span_notice("The status display reads: Extracting [seed_multiplier] to [seed_multiplier * 4] seed(s) per piece of produce.
Machine can store up to [max_seeds] seeds.") +/obj/machinery/seed_extractor/update_icon_state() + . = ..() + icon_state = panel_open ? "[base_icon_state]_open" : base_icon_state + /obj/machinery/seed_extractor/wrench_act(mob/living/user, obj/item/tool) . = ..() default_unfasten_wrench(user, tool) return ITEM_INTERACT_SUCCESS -/obj/machinery/seed_extractor/attackby(obj/item/attacking_item, mob/living/user, list/modifiers, list/attack_modifiers) - if(!isliving(user) || user.combat_mode) - return ..() +/obj/machinery/seed_extractor/screwdriver_act(mob/living/user, obj/item/tool) + return default_deconstruction_screwdriver(user, tool) - if(default_deconstruction_screwdriver(user, "sextractor_open", "sextractor", attacking_item)) - return TRUE +/obj/machinery/seed_extractor/crowbar_act(mob/living/user, obj/item/tool) + return default_pry_open(user, tool, close_after_pry = TRUE, deconstruct_on_fail = TRUE) - if(default_pry_open(attacking_item, close_after_pry = TRUE)) - return TRUE - - if(default_deconstruction_crowbar(attacking_item)) - return TRUE - - if(istype(attacking_item, /obj/item/storage/bag/plants)) +/obj/machinery/seed_extractor/item_interaction(mob/living/user, obj/item/tool, list/modifiers) + if(istype(tool, /obj/item/storage/bag/plants)) var/loaded = 0 - for(var/obj/item/seeds/to_store in attacking_item.contents) + for(var/obj/item/seeds/to_store in tool.contents) if(contents.len >= max_seeds) to_chat(user, span_warning("[src] is full.")) break - if(!add_seed(to_store, attacking_item)) + if(!add_seed(to_store, tool)) continue loaded += 1 if(loaded) - to_chat(user, span_notice("You put as many seeds from [attacking_item] into [src] as you can.")) - else - to_chat(user, span_warning("There are no seeds in [attacking_item].")) + to_chat(user, span_notice("You put as many seeds from [tool] into [src] as you can.")) + return ITEM_INTERACT_SUCCESS + to_chat(user, span_warning("There are no seeds in [tool].")) + return ITEM_INTERACT_BLOCKING - return TRUE - - var/list/generated_seeds = seedify(attacking_item, -1, src, user) + var/list/generated_seeds = seedify(tool, -1, src, user) if(!isnull(generated_seeds)) if(LAZYACCESS(modifiers, RIGHT_CLICK)) //find all seeds lying on the turf and add them to the machine @@ -135,24 +133,25 @@ //add seed to machine. second argument is null which means just force move into the machine add_seed(seed) to_chat(user, span_notice("You extract some seeds.")) - return TRUE + return ITEM_INTERACT_SUCCESS - else if(istype(attacking_item, /obj/item/seeds)) + if(istype(tool, /obj/item/seeds)) if(contents.len >= max_seeds) to_chat(user, span_warning("[src] is full.")) + return ITEM_INTERACT_BLOCKING - else if(add_seed(attacking_item, user)) - to_chat(user, span_notice("You add [attacking_item] to [src].")) + if(add_seed(tool, user)) + to_chat(user, span_notice("You add [tool] to [src].")) + return ITEM_INTERACT_SUCCESS - else - to_chat(user, span_warning("You can't seem to add [attacking_item] to [src].")) - return TRUE + to_chat(user, span_warning("You can't seem to add [tool] to [src].")) + return ITEM_INTERACT_BLOCKING - else if(!attacking_item.tool_behaviour) // Using the wrong tool shouldn't assume you want to turn it into seeds. - to_chat(user, span_warning("You can't extract any seeds from [attacking_item]!")) - return TRUE + if(!tool.tool_behaviour || !user.combat_mode) // Using the wrong tool shouldn't assume you want to turn it into seeds. + to_chat(user, span_warning("You can't extract any seeds from [tool]!")) + return ITEM_INTERACT_BLOCKING - return ..() + return NONE /** * Generate seed string diff --git a/code/modules/hydroponics/soil.dm b/code/modules/hydroponics/soil.dm index afa100cf4a3..315a773ca86 100644 --- a/code/modules/hydroponics/soil.dm +++ b/code/modules/hydroponics/soil.dm @@ -17,11 +17,10 @@ //which type of sack to create when shovled. var/sack_type = /obj/item/soil_sack -/obj/machinery/hydroponics/soil/default_deconstruction_screwdriver(mob/user, icon_state_open, icon_state_closed, obj/item/screwdriver) - return NONE - -/obj/machinery/hydroponics/soil/default_deconstruction_crowbar(obj/item/crowbar, ignore_panel, custom_deconstruct) - return NONE +/obj/machinery/hydroponics/soil/Initialize(mapload) + . = ..() + AddElement(/datum/element/tool_blocker, TOOL_SCREWDRIVER) + AddElement(/datum/element/tool_blocker, TOOL_CROWBAR) /obj/machinery/hydroponics/soil/update_icon(updates=ALL) . = ..() diff --git a/code/modules/library/lib_machines.dm b/code/modules/library/lib_machines.dm index 40a90e27fb7..7d1d6ec1b7d 100644 --- a/code/modules/library/lib_machines.dm +++ b/code/modules/library/lib_machines.dm @@ -691,6 +691,7 @@ GLOBAL_VAR_INIT(library_table_modified, 0) name = "scanner control interface" icon = 'icons/obj/service/library.dmi' icon_state = "bigscanner" + base_icon_state = "bigscanner" desc = "It's an industrial strength book scanner. Perfect!" circuit = /obj/item/circuitboard/machine/libraryscanner density = TRUE @@ -699,14 +700,14 @@ GLOBAL_VAR_INIT(library_table_modified, 0) var/datum/book_info/cache /obj/machinery/libraryscanner/screwdriver_act(mob/living/user, obj/item/tool) - . = ..() - if(default_deconstruction_screwdriver(user, "bigscanner2", "bigscanner", tool)) - return ITEM_INTERACT_SUCCESS + return default_deconstruction_screwdriver(user, tool) /obj/machinery/libraryscanner/crowbar_act(mob/living/user, obj/item/tool) + return default_deconstruction_crowbar(user, tool) + +/obj/machinery/libraryscanner/update_icon_state() . = ..() - if(default_deconstruction_crowbar(tool)) - return ITEM_INTERACT_SUCCESS + icon_state = panel_open ? "[base_icon_state]2" : base_icon_state /obj/machinery/libraryscanner/Destroy() held_book = null @@ -774,6 +775,7 @@ GLOBAL_VAR_INIT(library_table_modified, 0) name = "book binder" icon = 'icons/obj/service/library.dmi' icon_state = "binder" + base_icon_state = "binder" desc = "Only intended for binding paper products." circuit = /obj/item/circuitboard/machine/bookbinder density = TRUE @@ -785,14 +787,14 @@ GLOBAL_VAR_INIT(library_table_modified, 0) var/scanned_name /obj/machinery/bookbinder/screwdriver_act(mob/living/user, obj/item/tool) - . = ..() - if(default_deconstruction_screwdriver(user, "binder2", "binder", tool)) - return ITEM_INTERACT_SUCCESS + return default_deconstruction_screwdriver(user, tool) /obj/machinery/bookbinder/crowbar_act(mob/living/user, obj/item/tool) + return default_deconstruction_crowbar(user, tool) + +/obj/machinery/bookbinder/update_icon_state() . = ..() - if(default_deconstruction_crowbar(tool)) - return ITEM_INTERACT_SUCCESS + icon_state = panel_open ? "[base_icon_state]2" : base_icon_state /obj/machinery/bookbinder/attackby(obj/hitby, mob/user, list/modifiers, list/attack_modifiers) if(istype(hitby, /obj/item/paper)) diff --git a/code/modules/manufactorio/_manufacturing.dm b/code/modules/manufactorio/_manufacturing.dm index 3f5fb1919f4..950f3ad9231 100644 --- a/code/modules/manufactorio/_manufacturing.dm +++ b/code/modules/manufactorio/_manufacturing.dm @@ -54,18 +54,14 @@ return ITEM_INTERACT_SUCCESS /obj/machinery/power/manufacturing/screwdriver_act(mob/living/user, obj/item/tool) - if(default_deconstruction_screwdriver(user, icon_state, icon_state, tool)) - return ITEM_INTERACT_SUCCESS - return ITEM_INTERACT_BLOCKING + return default_deconstruction_screwdriver(user, tool) /obj/machinery/power/manufacturing/setDir(newdir) . = ..() update_appearance(UPDATE_OVERLAYS) /obj/machinery/power/manufacturing/crowbar_act(mob/living/user, obj/item/tool) - . = ITEM_INTERACT_BLOCKING - if(default_deconstruction_crowbar(tool)) - return ITEM_INTERACT_SUCCESS + return default_deconstruction_crowbar(user, tool) /obj/machinery/power/manufacturing/proc/generate_io_overlays(direction, color, offsets_override) var/list/dir_offset diff --git a/code/modules/mining/boulder_processing/_boulder_processing.dm b/code/modules/mining/boulder_processing/_boulder_processing.dm index 5f69edfaf57..86a8679d036 100644 --- a/code/modules/mining/boulder_processing/_boulder_processing.dm +++ b/code/modules/mining/boulder_processing/_boulder_processing.dm @@ -3,6 +3,7 @@ desc = "You shouldn't be seeing this! And bouldertech isn't even a real company!" icon = 'icons/obj/machines/mining_machines.dmi' icon_state = "ore_redemption" + base_icon_state = "ore_redemption" active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION * 0.5 anchored = TRUE density = TRUE @@ -98,7 +99,7 @@ var/suffix = "" if(!anchored || panel_open || !is_operational || (machine_stat & (BROKEN | NOPOWER))) suffix = "-off" - icon_state ="[initial(icon_state)][suffix]" + icon_state ="[base_icon_state][suffix]" /obj/machinery/bouldertech/CanAllowThrough(atom/movable/mover, border_dir) if(!anchored) @@ -290,15 +291,10 @@ return ITEM_INTERACT_SUCCESS /obj/machinery/bouldertech/screwdriver_act(mob/living/user, obj/item/tool) - . = ITEM_INTERACT_BLOCKING - if(default_deconstruction_screwdriver(user, "[initial(icon_state)]-off", initial(icon_state), tool)) - update_appearance(UPDATE_ICON_STATE) - return ITEM_INTERACT_SUCCESS + return default_deconstruction_screwdriver(user, tool) /obj/machinery/bouldertech/crowbar_act(mob/living/user, obj/item/tool) - . = ITEM_INTERACT_BLOCKING - if(default_deconstruction_crowbar(tool)) - return ITEM_INTERACT_SUCCESS + return default_deconstruction_crowbar(user, tool) /obj/machinery/bouldertech/attack_hand_secondary(mob/user, list/modifiers) . = ..() diff --git a/code/modules/mining/boulder_processing/brm.dm b/code/modules/mining/boulder_processing/brm.dm index d41026d771e..94c89ac189a 100644 --- a/code/modules/mining/boulder_processing/brm.dm +++ b/code/modules/mining/boulder_processing/brm.dm @@ -14,6 +14,7 @@ desc = "A teleportation matrix used to retrieve boulders excavated by mining NODEs from ore vents." icon = 'icons/obj/machines/mining_machines.dmi' icon_state = "brm" + base_icon_state = "brm" active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION * 0.5 circuit = /obj/item/circuitboard/machine/brm processing_flags = START_PROCESSING_MANUALLY @@ -72,7 +73,7 @@ . += span_notice("The whole machine can be [EXAMINE_HINT("pried")] apart.") /obj/machinery/brm/update_icon_state() - icon_state = initial(icon_state) + icon_state = base_icon_state if(!anchored || !is_operational || machine_stat & (BROKEN | NOPOWER) || panel_open) icon_state = "[icon_state]-off" @@ -91,15 +92,10 @@ return ITEM_INTERACT_SUCCESS /obj/machinery/brm/screwdriver_act(mob/living/user, obj/item/tool) - . = ITEM_INTERACT_BLOCKING - if(default_deconstruction_screwdriver(user, "[initial(icon_state)]-off", initial(icon_state), tool)) - update_appearance(UPDATE_ICON_STATE) - return ITEM_INTERACT_SUCCESS + return default_deconstruction_screwdriver(user, tool) /obj/machinery/brm/crowbar_act(mob/living/user, obj/item/tool) - . = ITEM_INTERACT_BLOCKING - if(default_deconstruction_crowbar(tool)) - return ITEM_INTERACT_SUCCESS + return default_deconstruction_crowbar(user, tool) ///To allow boulders on a conveyor belt to move unobstructed if multiple machines are made on a single line /obj/machinery/brm/CanAllowThrough(atom/movable/mover, border_dir) diff --git a/code/modules/mining/boulder_processing/refinery.dm b/code/modules/mining/boulder_processing/refinery.dm index 383a4344a7d..861829219e2 100644 --- a/code/modules/mining/boulder_processing/refinery.dm +++ b/code/modules/mining/boulder_processing/refinery.dm @@ -7,6 +7,7 @@ name = "boulder refinery" desc = "BR for short. Accepts boulders and refines non-metallic ores into sheets using internal chemicals." icon_state = "stacker" + base_icon_state = "stacker" circuit = /obj/item/circuitboard/machine/refinery usage_sound = 'sound/machines/mining/refinery.ogg' action = "crushing" @@ -45,6 +46,7 @@ name = "boulder smelter" desc = "BS for short. Accept boulders and refines metallic ores into sheets." icon_state = "smelter" + base_icon_state = "smelter" light_system = OVERLAY_LIGHT light_range = 2 light_power = 3 @@ -55,7 +57,7 @@ /obj/machinery/bouldertech/refinery/smelter/Initialize(mapload) . = ..() - set_light_on(TRUE) + update_light_value() /obj/machinery/bouldertech/refinery/smelter/can_process_material(datum/material/possible_mat) var/static/list/processable_materials @@ -69,21 +71,17 @@ ) return is_type_in_list(possible_mat, processable_materials) -/obj/machinery/bouldertech/refinery/smelter/set_light_on(new_value) - if(panel_open || !anchored || !is_operational || machine_stat & (BROKEN | NOPOWER)) - new_value = FALSE - return ..() +/obj/machinery/bouldertech/refinery/smelter/proc/update_light_value() + set_light_on(!panel_open && anchored && is_operational) -/obj/machinery/bouldertech/refinery/default_deconstruction_screwdriver(mob/user, icon_state_open, icon_state_closed, obj/item/screwdriver) - . = ..() - set_light_on(TRUE) - -/obj/machinery/bouldertech/refinery/default_unfasten_wrench(mob/user, obj/item/wrench, time) - . = ..() - set_light_on(TRUE) +/obj/machinery/bouldertech/refinery/smelter/on_set_anchored(atom/movable/source, anchorvalue) + update_light_value() /obj/machinery/bouldertech/refinery/smelter/on_set_is_operational(old_value) - set_light_on(TRUE) + update_light_value() + +/obj/machinery/bouldertech/refinery/smelter/on_set_panel_open(old_value) + update_light_value() /obj/machinery/bouldertech/refinery/smelter/maim_golem(mob/living/carbon/human/rockman) rockman.visible_message(span_warning("[rockman] is processed by [src]!"), span_userdanger("You get melted into rock by [src]!")) diff --git a/code/modules/mining/machine_redemption.dm b/code/modules/mining/machine_redemption.dm index 6f5d2cfbbca..8091c67ebd3 100644 --- a/code/modules/mining/machine_redemption.dm +++ b/code/modules/mining/machine_redemption.dm @@ -6,6 +6,7 @@ desc = "A machine that accepts ore and instantly transforms it into workable material sheets. Points for ore are generated based on type and can be redeemed at a mining equipment vendor." icon = 'icons/obj/machines/mining_machines.dmi' icon_state = "ore_redemption" + base_icon_state = "ore_redemption" density = TRUE input_dir = NORTH output_dir = SOUTH @@ -217,12 +218,10 @@ unregister_input_turf() // someone just un-wrenched us, unregister the turf /obj/machinery/mineral/ore_redemption/screwdriver_act(mob/living/user, obj/item/tool) - default_deconstruction_screwdriver(user, "ore_redemption-open", "ore_redemption", tool) - return ITEM_INTERACT_SUCCESS + return default_deconstruction_screwdriver(user, tool) /obj/machinery/mineral/ore_redemption/crowbar_act(mob/living/user, obj/item/tool) - default_deconstruction_crowbar(tool) - return ITEM_INTERACT_SUCCESS + return default_deconstruction_crowbar(user, tool) /obj/machinery/mineral/ore_redemption/wrench_act(mob/living/user, obj/item/tool) default_unfasten_wrench(user, tool) @@ -385,7 +384,7 @@ return ..() /obj/machinery/mineral/ore_redemption/update_icon_state() - icon_state = "[initial(icon_state)][powered() ? null : "-off"]" + icon_state = "[base_icon_state][panel_open ? "-open" : powered() ? null : "-off"]" return ..() /obj/machinery/mineral/ore_redemption/update_overlays() diff --git a/code/modules/mining/machine_silo.dm b/code/modules/mining/machine_silo.dm index e551ede4841..d35002d32f5 100644 --- a/code/modules/mining/machine_silo.dm +++ b/code/modules/mining/machine_silo.dm @@ -159,14 +159,10 @@ silo_log(context, "WITHDRAWN", -sheets.amount * SHEET_MATERIAL_AMOUNT, "[sheets.name]", sheets.custom_materials, user_data) /obj/machinery/ore_silo/screwdriver_act(mob/living/user, obj/item/tool) - . = ITEM_INTERACT_BLOCKING - if(default_deconstruction_screwdriver(user, icon_state, icon_state, tool)) - return ITEM_INTERACT_SUCCESS + return default_deconstruction_screwdriver(user, tool) /obj/machinery/ore_silo/crowbar_act(mob/living/user, obj/item/tool) - . = ITEM_INTERACT_BLOCKING - if(default_deconstruction_crowbar(tool)) - return ITEM_INTERACT_SUCCESS + return default_deconstruction_crowbar(user, tool) /obj/machinery/ore_silo/multitool_act(mob/living/user, obj/item/multitool/I) I.set_buffer(src) diff --git a/code/modules/paperwork/fax.dm b/code/modules/paperwork/fax.dm index fdcbd40054a..b82d9549764 100644 --- a/code/modules/paperwork/fax.dm +++ b/code/modules/paperwork/fax.dm @@ -160,10 +160,7 @@ GLOBAL_VAR_INIT(fax_autoprinting, FALSE) * Open and close the wire panel. */ /obj/machinery/fax/screwdriver_act(mob/living/user, obj/item/screwdriver) - . = ..() - default_deconstruction_screwdriver(user, icon_state, icon_state, screwdriver) - update_appearance() - return TRUE + return default_deconstruction_screwdriver(user, screwdriver) /** * Using the multi-tool with the panel closed causes the fax network name to be renamed. diff --git a/code/modules/paperwork/photocopier.dm b/code/modules/paperwork/photocopier.dm index 31262237d9e..b9c6abcab50 100644 --- a/code/modules/paperwork/photocopier.dm +++ b/code/modules/paperwork/photocopier.dm @@ -62,6 +62,7 @@ GLOBAL_LIST_INIT(paper_blanks, init_paper_blanks()) desc = "Used to copy important documents and anatomy studies." icon = 'icons/obj/service/library.dmi' icon_state = "photocopier" + base_icon_state = "photocopier" density = TRUE power_channel = AREA_USAGE_EQUIP max_integrity = 300 @@ -659,15 +660,15 @@ GLOBAL_LIST_INIT(paper_blanks, init_paper_blanks()) to_chat(user, span_notice("You take [object] out of [src]. [busy ? "The [src] comes to a halt." : ""]")) -/obj/machinery/photocopier/screwdriver_act(mob/living/user, obj/item/tool) +/obj/machinery/photocopier/update_icon_state() . = ..() - if(default_deconstruction_screwdriver(user, "photocopier2", "photocopier", tool)) - return ITEM_INTERACT_SUCCESS + icon_state = panel_open ? "[base_icon_state]2" : base_icon_state + +/obj/machinery/photocopier/screwdriver_act(mob/living/user, obj/item/tool) + return default_deconstruction_screwdriver(user, tool) /obj/machinery/photocopier/crowbar_act(mob/living/user, obj/item/tool) - . = ..() - if(default_deconstruction_crowbar(tool)) - return ITEM_INTERACT_SUCCESS + return default_deconstruction_crowbar(user, tool) /obj/machinery/photocopier/wrench_act(mob/living/user, obj/item/tool) . = ..() diff --git a/code/modules/plumbing/plumbers/teleporter.dm b/code/modules/plumbing/plumbers/teleporter.dm index a869c7cb0a1..5cf888b57fb 100644 --- a/code/modules/plumbing/plumbers/teleporter.dm +++ b/code/modules/plumbing/plumbers/teleporter.dm @@ -48,6 +48,7 @@ desc = "Receives chemicals from one or more chemical beacons. Use a multitool on this machine and then all subsequent chemical beacons. Reset by opening the \ panel and cutting the main wire." icon_state = "recipient" + base_icon_state = "recipient" buffer = 150 @@ -98,21 +99,18 @@ senders = list() -/obj/machinery/plumbing/receiver/attackby(obj/item/I, mob/user, list/modifiers, list/attack_modifiers) - if(default_deconstruction_screwdriver(user, icon_state + "_open", initial(icon_state), I)) - update_appearance() - return +/obj/machinery/plumbing/receiver/screwdriver_act(mob/living/user, obj/item/tool) + return default_deconstruction_screwdriver(user, tool) - if(default_pry_open(I)) - return - - if(default_deconstruction_crowbar(I)) - return - - return ..() +/obj/machinery/plumbing/receiver/crowbar_act(mob/living/user, obj/item/tool) + return default_pry_open(user, tool, deconstruct_on_fail = TRUE) /obj/machinery/plumbing/receiver/wirecutter_act(mob/living/user, obj/item/I) - . = ..() + if(!panel_open) + return NONE + lose_senders() + return ITEM_INTERACT_SUCCESS - if(panel_open) - lose_senders() +/obj/machinery/plumbing/receiver/update_icon_state() + . = ..() + icon_state = panel_open ? "[base_icon_state]_open" : base_icon_state diff --git a/code/modules/power/port_gen.dm b/code/modules/power/port_gen.dm index 81c3a78996e..a7f0d3a2c0b 100644 --- a/code/modules/power/port_gen.dm +++ b/code/modules/power/port_gen.dm @@ -205,7 +205,7 @@ else to_chat(user, span_notice("You close the access panel.")) return - else if(default_deconstruction_crowbar(O)) + else if(default_deconstruction_crowbar(user, O)) return return ..() diff --git a/code/modules/power/rtg.dm b/code/modules/power/rtg.dm index dd21c40ae91..40ebc213e16 100644 --- a/code/modules/power/rtg.dm +++ b/code/modules/power/rtg.dm @@ -52,15 +52,15 @@ if(in_range(user, src) || isobserver(user)) . += span_notice("The status display reads: Power generation at [display_power(power_gen, convert = FALSE)].") +/obj/machinery/power/rtg/update_icon_state() + . = ..() + icon_state = panel_open ? "[base_icon_state]-open" : base_icon_state + /obj/machinery/power/rtg/screwdriver_act(mob/living/user, obj/item/tool) - if(default_deconstruction_screwdriver(user, "[base_icon_state]-open", base_icon_state, tool)) - return ITEM_INTERACT_SUCCESS - return ITEM_INTERACT_BLOCKING + return default_deconstruction_screwdriver(user, tool) /obj/machinery/power/rtg/crowbar_act(mob/living/user, obj/item/tool) - if(default_deconstruction_crowbar(tool)) - return ITEM_INTERACT_SUCCESS - return panel_open ? ITEM_INTERACT_BLOCKING : NONE + return default_deconstruction_crowbar(user, tool) /obj/machinery/power/rtg/vv_edit_var(vname, vval) . = ..() @@ -157,16 +157,17 @@ power_gen = 0.75 KILO WATTS anchored = TRUE -/obj/machinery/power/rtg/old_station/default_deconstruction_screwdriver(mob/user, icon_state_open, icon_state_closed, obj/item/screwdriver) +/obj/machinery/power/rtg/old_station/default_deconstruction_screwdriver(mob/user, obj/item/screwdriver) . = ..() - if(.) - to_chat(user, span_warning("You feel it crumbling under your hands!")) + if(. & ITEM_INTERACT_SUCCESS) + to_chat(user, span_warning("You feel [src] crumbling under your hands!")) -/obj/machinery/power/rtg/old_station/default_deconstruction_crowbar(obj/item/crowbar, ignore_panel, custom_deconstruct, mob/user) +/obj/machinery/power/rtg/old_station/default_deconstruction_crowbar(mob/living/user, obj/item/crowbar, ignore_panel, custom_deconstruct) to_chat(user, span_warning("As you pry, [src] starts to fall apart!")) if(!crowbar.use_tool(src, user, 3 SECONDS, volume = 50)) - return FALSE + return ITEM_INTERACT_BLOCKING + to_chat(user, span_warning("You feel like you made a mistake.")) new /obj/effect/decal/cleanable/ash/large(drop_location()) deconstruct(FALSE) - return TRUE + return ITEM_INTERACT_SUCCESS diff --git a/code/modules/power/singularity/emitter.dm b/code/modules/power/singularity/emitter.dm index be1eb91a918..c7d79f1a551 100644 --- a/code/modules/power/singularity/emitter.dm +++ b/code/modules/power/singularity/emitter.dm @@ -329,14 +329,10 @@ return remove_gun(user) if(panel_open && diskie) return remove_disk(user) - default_deconstruction_crowbar(item) - return TRUE + return default_deconstruction_crowbar(user, item) /obj/machinery/power/emitter/screwdriver_act(mob/living/user, obj/item/item) - if(..()) - return TRUE - default_deconstruction_screwdriver(user, "[base_icon_state]_open", base_icon_state, item) - return TRUE + return default_deconstruction_screwdriver(user, item) /// Attempt to toggle the controls lock of the emitter /obj/machinery/power/emitter/proc/togglelock(mob/user) diff --git a/code/modules/power/smes.dm b/code/modules/power/smes.dm index a6fb54edc70..964e148a1ff 100644 --- a/code/modules/power/smes.dm +++ b/code/modules/power/smes.dm @@ -5,6 +5,7 @@ name = "power storage unit" desc = "A high-capacity superconducting magnetic energy storage (SMES) unit." icon_state = "smes" + base_icon_state = "smes" density = TRUE use_power = NO_POWER_USE circuit = /obj/item/circuitboard/machine/smes @@ -285,33 +286,33 @@ set_machine_stat(machine_stat & ~BROKEN) return ITEM_INTERACT_SUCCESS -//opening using screwdriver +/obj/machinery/power/smes/update_icon_state() + . = ..() + icon_state = panel_open ? "[base_icon_state]-o" : base_icon_state + /obj/machinery/power/smes/screwdriver_act(mob/living/user, obj/item/tool) - . = ITEM_INTERACT_BLOCKING - if(default_deconstruction_screwdriver(user, "[initial(icon_state)]-o", initial(icon_state), tool)) - update_appearance(UPDATE_OVERLAYS) - return ITEM_INTERACT_SUCCESS + return default_deconstruction_screwdriver(user, tool) /obj/machinery/power/smes/wirecutter_act(mob/living/user, obj/item/item) - . = ITEM_INTERACT_FAILURE if(terminal && panel_open) terminal.dismantle(user, item) return ITEM_INTERACT_SUCCESS + return ITEM_INTERACT_BLOCKING -//crowbarring it! /obj/machinery/power/smes/crowbar_act(mob/living/user, obj/item/tool) - . = ITEM_INTERACT_FAILURE if(terminal) balloon_alert(user, "remove the power terminal!") - return + return ITEM_INTERACT_BLOCKING - if(default_deconstruction_crowbar(tool)) + if(default_deconstruction_crowbar(user, tool)) var/turf/ground = get_turf(src) message_admins("[src] has been deconstructed by [ADMIN_LOOKUPFLW(user)] in [ADMIN_VERBOSEJMP(ground)].") user.log_message("deconstructed [src]", LOG_GAME) investigate_log("deconstructed by [key_name(user)] at [AREACOORD(src)].", INVESTIGATE_ENGINE) return ITEM_INTERACT_SUCCESS + return ITEM_INTERACT_BLOCKING + //changing direction using wrench /obj/machinery/power/smes/wrench_act(mob/living/user, obj/item/tool) . = ITEM_INTERACT_FAILURE diff --git a/code/modules/power/smes_portable.dm b/code/modules/power/smes_portable.dm index 27439e1a25a..597372d7c82 100644 --- a/code/modules/power/smes_portable.dm +++ b/code/modules/power/smes_portable.dm @@ -4,6 +4,7 @@ name = "power connector" desc = "A user-safe high-current contact port, used for connecting and interfacing with portable power storage units. Practically useless without one." icon_state = "battery_port" + base_icon_state = "battery_port" circuit = /obj/item/circuitboard/machine/smes/connector density = FALSE input_attempt = FALSE @@ -110,6 +111,7 @@ desc = "A portable, high-capacity superconducting magnetic energy storage (SMES) unit. Requires a separate power connector port to actually interface with power networks." icon = 'icons/obj/machines/engine/other.dmi' icon_state = "port_smes" + base_icon_state = "port_smes" circuit = /obj/item/circuitboard/machine/smesbank use_power = NO_POWER_USE // well, technically density = TRUE @@ -228,19 +230,19 @@ investigate_log("was connected to [possible_connector] by [key_name(user)].", INVESTIGATE_ENGINE) return ITEM_INTERACT_SUCCESS +/obj/machinery/smesbank/update_icon_state() + . = ..() + icon_state = panel_open ? "[base_icon_state]-o" : base_icon_state + /obj/machinery/smesbank/screwdriver_act(mob/living/user, obj/item/tool) - . = ITEM_INTERACT_FAILURE - if(default_deconstruction_screwdriver(user, "[initial(icon_state)]-o", initial(icon_state), tool)) - update_appearance(UPDATE_OVERLAYS) - return ITEM_INTERACT_SUCCESS + return default_deconstruction_screwdriver(user, tool) /obj/machinery/smesbank/crowbar_act(mob/living/user, obj/item/tool) if(connected_port) balloon_alert(user, "disconnect from [connected_port] first!") return ITEM_INTERACT_FAILURE - if(default_deconstruction_crowbar(tool)) - return ITEM_INTERACT_SUCCESS + return default_deconstruction_crowbar(user, tool) /** * Attempt to connect the portable SMES to a given connector. Adapted from portable atmos connection code. diff --git a/code/modules/power/tesla/coil.dm b/code/modules/power/tesla/coil.dm index 65ee33537a9..296330cf30b 100644 --- a/code/modules/power/tesla/coil.dm +++ b/code/modules/power/tesla/coil.dm @@ -3,6 +3,7 @@ desc = "For the union!" icon = 'icons/obj/machines/engine/tesla_coil.dmi' icon_state = "coil0" + base_icon_state = "coil" // Executing a traitor caught releasing tesla was never this fun! can_buckle = TRUE @@ -60,32 +61,24 @@ "Stored [display_energy(get_stored_joules())].
" + \ "Processing [display_power(processed_energy)].") -/obj/machinery/power/energy_accumulator/tesla_coil/default_unfasten_wrench(mob/user, obj/item/I, time = 20) +/obj/machinery/power/energy_accumulator/tesla_coil/set_anchored(anchorvalue) . = ..() - if(. == SUCCESSFUL_UNFASTEN) - if(panel_open) - icon_state = "coil_open[anchored]" - else - icon_state = "coil[anchored]" - update_cable_icons_on_turf(get_turf(src)) + update_cable_icons_on_turf(get_turf(src)) /obj/machinery/power/energy_accumulator/tesla_coil/wrench_act(mob/living/user, obj/item/tool) . = ..() default_unfasten_wrench(user, tool) return ITEM_INTERACT_SUCCESS -/obj/machinery/power/energy_accumulator/tesla_coil/attackby(obj/item/W, mob/user, list/modifiers, list/attack_modifiers) - if(default_deconstruction_screwdriver(user, "coil_open[anchored]", "coil[anchored]", W)) - return +/obj/machinery/power/energy_accumulator/tesla_coil/update_icon_state() + . = ..() + icon_state = "[base_icon_state][panel_open ? "_open" : ""][anchored]" - if(default_deconstruction_crowbar(W)) - return +/obj/machinery/power/energy_accumulator/tesla_coil/screwdriver_act(mob/living/user, obj/item/tool) + return default_deconstruction_screwdriver(user, tool) - if(is_wire_tool(W) && panel_open) - wires.interact(user) - return - - return ..() +/obj/machinery/power/energy_accumulator/tesla_coil/crowbar_act(mob/living/user, obj/item/tool) + return default_deconstruction_crowbar(user, tool) /obj/machinery/power/energy_accumulator/tesla_coil/process(seconds_per_tick) . = ..() @@ -97,7 +90,7 @@ return ..() ADD_TRAIT(src, TRAIT_BEING_SHOCKED, WAS_SHOCKED) addtimer(TRAIT_CALLBACK_REMOVE(src, TRAIT_BEING_SHOCKED, WAS_SHOCKED), 1 SECONDS) - flick("coilhit", src) + flick("[base_icon_state]hit", src) if(!(zap_flags & ZAP_GENERATES_POWER)) //Prevent infinite recursive power return 0 if(zap_flags & ZAP_LOW_POWER_GEN) @@ -123,6 +116,7 @@ desc = "Keeps an area from being fried by Edison's Bane." icon = 'icons/obj/machines/engine/tesla_coil.dmi' icon_state = "grounding_rod0" + base_icon_state = "grounding_rod" anchored = FALSE density = TRUE wants_powernet = FALSE @@ -143,36 +137,29 @@ "Recently grounded [display_energy(get_stored_joules())].
" + \ "This energy would sustainably release [display_power(calculate_sustainable_power(), convert = FALSE)].") -/obj/machinery/power/energy_accumulator/grounding_rod/default_unfasten_wrench(mob/user, obj/item/I, time = 20) - . = ..() - if(. == SUCCESSFUL_UNFASTEN) - if(panel_open) - icon_state = "grounding_rod_open[anchored]" - else - icon_state = "grounding_rod[anchored]" - /obj/machinery/power/energy_accumulator/grounding_rod/wrench_act(mob/living/user, obj/item/tool) . = ..() default_unfasten_wrench(user, tool) return ITEM_INTERACT_SUCCESS -/obj/machinery/power/energy_accumulator/grounding_rod/attackby(obj/item/W, mob/user, list/modifiers, list/attack_modifiers) - if(default_deconstruction_screwdriver(user, "grounding_rod_open[anchored]", "grounding_rod[anchored]", W)) - return +/obj/machinery/power/energy_accumulator/grounding_rod/update_icon_state() + . = ..() + icon_state = "[base_icon_state][panel_open ? "_open" : ""][anchored]" - if(default_deconstruction_crowbar(W)) - return +/obj/machinery/power/energy_accumulator/grounding_rod/screwdriver_act(mob/living/user, obj/item/tool) + return default_deconstruction_screwdriver(user, tool) - return ..() +/obj/machinery/power/energy_accumulator/grounding_rod/crowbar_act(mob/living/user, obj/item/tool) + return default_deconstruction_crowbar(user, tool) /obj/machinery/power/energy_accumulator/grounding_rod/zap_act(energy, zap_flags) if(anchored && !panel_open) - flick("grounding_rodhit", src) + flick("[base_icon_state]hit", src) zap_buckle_check(energy) stored_energy += energy return 0 - else - . = ..() + return ..() + /obj/machinery/power/energy_accumulator/grounding_rod/release_energy(joules = 0) stored_energy -= joules processed_energy = joules diff --git a/code/modules/power/turbine/turbine.dm b/code/modules/power/turbine/turbine.dm index 65e07267551..882cc650209 100644 --- a/code/modules/power/turbine/turbine.dm +++ b/code/modules/power/turbine/turbine.dm @@ -189,9 +189,7 @@ return ITEM_INTERACT_SUCCESS /obj/machinery/power/turbine/crowbar_act(mob/living/user, obj/item/tool) - . = ITEM_INTERACT_BLOCKING - if(default_deconstruction_crowbar(tool)) - return ITEM_INTERACT_SUCCESS + return default_deconstruction_crowbar(user, tool) /obj/machinery/power/turbine/crowbar_act_secondary(mob/living/user, obj/item/tool) . = ITEM_INTERACT_BLOCKING diff --git a/code/modules/reagents/chemistry/machinery/chem_dispenser.dm b/code/modules/reagents/chemistry/machinery/chem_dispenser.dm index 21687ea36eb..b55a689b313 100644 --- a/code/modules/reagents/chemistry/machinery/chem_dispenser.dm +++ b/code/modules/reagents/chemistry/machinery/chem_dispenser.dm @@ -415,15 +415,10 @@ return ITEM_INTERACT_BLOCKING /obj/machinery/chem_dispenser/screwdriver_act(mob/living/user, obj/item/tool) - if(default_deconstruction_screwdriver(user, icon_state, icon_state, tool)) - update_appearance() - return ITEM_INTERACT_SUCCESS - return ITEM_INTERACT_BLOCKING + return default_deconstruction_screwdriver(user, tool) /obj/machinery/chem_dispenser/crowbar_act(mob/living/user, obj/item/tool) - if(default_deconstruction_crowbar(tool)) - return ITEM_INTERACT_SUCCESS - return ITEM_INTERACT_BLOCKING + return default_deconstruction_crowbar(user, tool) /obj/machinery/chem_dispenser/item_interaction(mob/living/user, obj/item/tool, list/modifiers) if(!tool.can_insert_container(user, src)) diff --git a/code/modules/reagents/chemistry/machinery/chem_heater.dm b/code/modules/reagents/chemistry/machinery/chem_heater.dm index f3432ccb936..d20df1eb505 100644 --- a/code/modules/reagents/chemistry/machinery/chem_heater.dm +++ b/code/modules/reagents/chemistry/machinery/chem_heater.dm @@ -80,7 +80,7 @@ . += span_notice("Its panel can be [EXAMINE_HINT("pried")] open") /obj/machinery/chem_heater/update_icon_state() - icon_state = "[base_icon_state][beaker ? 1 : 0]b" + icon_state = "[base_icon_state][(beaker && !panel_open) ? 1 : 0]b" return ..() /obj/machinery/chem_heater/RefreshParts() @@ -108,28 +108,15 @@ return ITEM_INTERACT_SUCCESS /obj/machinery/chem_heater/wrench_act(mob/living/user, obj/item/tool) - if(user.combat_mode) - return NONE - - . = ITEM_INTERACT_BLOCKING if(default_unfasten_wrench(user, tool) == SUCCESSFUL_UNFASTEN) return ITEM_INTERACT_SUCCESS + return ITEM_INTERACT_BLOCKING /obj/machinery/chem_heater/screwdriver_act(mob/living/user, obj/item/tool) - if(user.combat_mode) - return NONE - - . = ITEM_INTERACT_BLOCKING - if(default_deconstruction_screwdriver(user, "mixer0b", "[base_icon_state][beaker ? 1 : 0]b", tool)) - return ITEM_INTERACT_SUCCESS + return default_deconstruction_screwdriver(user, tool) /obj/machinery/chem_heater/crowbar_act(mob/living/user, obj/item/tool) - if(user.combat_mode) - return NONE - - . = ITEM_INTERACT_BLOCKING - if(default_deconstruction_crowbar(tool)) - return ITEM_INTERACT_SUCCESS + return default_deconstruction_crowbar(user, tool) /obj/machinery/chem_heater/attack_hand_secondary(mob/user, list/modifiers) . = ..() diff --git a/code/modules/reagents/chemistry/machinery/chem_mass_spec.dm b/code/modules/reagents/chemistry/machinery/chem_mass_spec.dm index 517fef87122..5dc7b3a571e 100644 --- a/code/modules/reagents/chemistry/machinery/chem_mass_spec.dm +++ b/code/modules/reagents/chemistry/machinery/chem_mass_spec.dm @@ -173,23 +173,18 @@ return ITEM_INTERACT_SUCCESS /obj/machinery/chem_mass_spec/screwdriver_act(mob/living/user, obj/item/tool) - . = ITEM_INTERACT_BLOCKING if(processing_reagents) balloon_alert(user, "still processing!") - return . + return ITEM_INTERACT_BLOCKING - if(default_deconstruction_screwdriver(user, icon_state, icon_state, tool)) - update_appearance() - return ITEM_INTERACT_SUCCESS + return default_deconstruction_screwdriver(user, tool) /obj/machinery/chem_mass_spec/crowbar_act(mob/living/user, obj/item/tool) - . = ITEM_INTERACT_BLOCKING if(processing_reagents) balloon_alert(user, "still processing!") - return . + return ITEM_INTERACT_BLOCKING - if(default_deconstruction_crowbar(tool)) - return ITEM_INTERACT_SUCCESS + return default_deconstruction_crowbar(user, tool) /** diff --git a/code/modules/reagents/chemistry/machinery/chem_master.dm b/code/modules/reagents/chemistry/machinery/chem_master.dm index 479be15b4a9..a3a33ba7f8e 100644 --- a/code/modules/reagents/chemistry/machinery/chem_master.dm +++ b/code/modules/reagents/chemistry/machinery/chem_master.dm @@ -178,41 +178,27 @@ return ITEM_INTERACT_SUCCESS /obj/machinery/chem_master/wrench_act(mob/living/user, obj/item/tool) - if(user.combat_mode) - return NONE - - . = ITEM_INTERACT_BLOCKING if(is_printing) balloon_alert(user, "still printing!") - return . + return ITEM_INTERACT_BLOCKING if(default_unfasten_wrench(user, tool) == SUCCESSFUL_UNFASTEN) return ITEM_INTERACT_SUCCESS + return ITEM_INTERACT_BLOCKING /obj/machinery/chem_master/screwdriver_act(mob/living/user, obj/item/tool) - if(user.combat_mode) - return NONE - - . = ITEM_INTERACT_BLOCKING if(is_printing) balloon_alert(user, "still printing!") - return . + return ITEM_INTERACT_BLOCKING - if(default_deconstruction_screwdriver(user, icon_state, icon_state, tool)) - update_appearance(UPDATE_OVERLAYS) - return ITEM_INTERACT_SUCCESS + return default_deconstruction_screwdriver(user, tool) /obj/machinery/chem_master/crowbar_act(mob/living/user, obj/item/tool) - if(user.combat_mode) - return NONE - - . = ITEM_INTERACT_BLOCKING if(is_printing) balloon_alert(user, "still printing!") - return . + return ITEM_INTERACT_BLOCKING - if(default_deconstruction_crowbar(tool)) - return ITEM_INTERACT_SUCCESS + return default_deconstruction_crowbar(user, tool) /** * Insert, remove, replace the existig beaker. Returns TRUE on success. diff --git a/code/modules/reagents/chemistry/machinery/reagentgrinder.dm b/code/modules/reagents/chemistry/machinery/reagentgrinder.dm index 51c3a4590bb..edbf252c71d 100644 --- a/code/modules/reagents/chemistry/machinery/reagentgrinder.dm +++ b/code/modules/reagents/chemistry/machinery/reagentgrinder.dm @@ -273,8 +273,6 @@ return NONE /obj/machinery/reagentgrinder/wrench_act(mob/living/user, obj/item/tool) - . = NONE - if(operating) balloon_alert(user, "still operating!") return ITEM_INTERACT_BLOCKING @@ -283,26 +281,21 @@ update_appearance(UPDATE_OVERLAYS) return ITEM_INTERACT_SUCCESS -/obj/machinery/reagentgrinder/screwdriver_act(mob/living/user, obj/item/tool) - . = NONE + return NONE +/obj/machinery/reagentgrinder/screwdriver_act(mob/living/user, obj/item/tool) if(operating) balloon_alert(user, "still operating!") return ITEM_INTERACT_BLOCKING - if(default_deconstruction_screwdriver(user, icon_state, icon_state, tool)) - update_appearance(UPDATE_OVERLAYS) - return ITEM_INTERACT_SUCCESS + return default_deconstruction_screwdriver(user, tool) /obj/machinery/reagentgrinder/crowbar_act(mob/living/user, obj/item/tool) - . = NONE - if(operating) balloon_alert(user, "still operating!") return ITEM_INTERACT_BLOCKING - if(default_deconstruction_crowbar(tool)) - return ITEM_INTERACT_SUCCESS + return default_deconstruction_crowbar(user, tool) /obj/machinery/reagentgrinder/proc/on_storage_dump(datum/source, datum/storage/storage, mob/user) SIGNAL_HANDLER @@ -518,4 +511,3 @@ beaker.reagents.convert_reagent(/datum/reagent/consumable/cream, /datum/reagent/consumable/whipped_cream) //power consumed based on the ratio of total reagents mixed use_energy((active_power_usage * (duration / (1 SECONDS))) * (beaker.reagents.total_volume / beaker.reagents.maximum_volume)) - diff --git a/code/modules/reagents/chemistry/machinery/smoke_machine.dm b/code/modules/reagents/chemistry/machinery/smoke_machine.dm index d1c33fc4a29..5418a6de59a 100644 --- a/code/modules/reagents/chemistry/machinery/smoke_machine.dm +++ b/code/modules/reagents/chemistry/machinery/smoke_machine.dm @@ -121,32 +121,28 @@ return ITEM_INTERACT_BLOCKING /obj/machinery/smoke_machine/wrench_act(mob/living/user, obj/item/tool) - . = ITEM_INTERACT_BLOCKING if(on) balloon_alert(user, "turn off first!") - return + return ITEM_INTERACT_BLOCKING if(default_unfasten_wrench(user, tool, time = 4 SECONDS) == SUCCESSFUL_UNFASTEN) return ITEM_INTERACT_SUCCESS + return ITEM_INTERACT_BLOCKING + /obj/machinery/smoke_machine/screwdriver_act(mob/living/user, obj/item/tool) - . = ITEM_INTERACT_BLOCKING if(on) balloon_alert(user, "turn off first!") - return + return ITEM_INTERACT_BLOCKING - if(default_deconstruction_screwdriver(user, "smoke0-o", "smoke0", tool)) - update_appearance(UPDATE_ICON_STATE) - return ITEM_INTERACT_SUCCESS + return default_deconstruction_screwdriver(user, tool) /obj/machinery/smoke_machine/crowbar_act(mob/living/user, obj/item/tool) - . = ITEM_INTERACT_BLOCKING if(on) balloon_alert(user, "turn off first!") - return + return ITEM_INTERACT_BLOCKING - if(default_deconstruction_crowbar(tool)) - return ITEM_INTERACT_SUCCESS + return default_deconstruction_crowbar(user, tool) /obj/machinery/smoke_machine/process() if(!reagents.total_volume || !anchored || !on || !is_operational) diff --git a/code/modules/research/anomaly/anomaly_refinery.dm b/code/modules/research/anomaly/anomaly_refinery.dm index cfbc9a84011..e8cae496b8a 100644 --- a/code/modules/research/anomaly/anomaly_refinery.dm +++ b/code/modules/research/anomaly/anomaly_refinery.dm @@ -117,21 +117,20 @@ to_chat(user, span_notice("You insert [tool] into [src]")) return ITEM_INTERACT_SUCCESS +/obj/machinery/research/anomaly_refinery/update_icon_state() + . = ..() + icon_state = panel_open ? "[base_icon_state]-off" : base_icon_state + /obj/machinery/research/anomaly_refinery/wrench_act(mob/living/user, obj/item/tool) . = ..() default_unfasten_wrench(user, tool) return ITEM_INTERACT_SUCCESS /obj/machinery/research/anomaly_refinery/screwdriver_act(mob/living/user, obj/item/tool) - if(!default_deconstruction_screwdriver(user, "[base_icon_state]-off", "[base_icon_state]", tool)) - return FALSE - update_appearance() - return TRUE + return default_deconstruction_screwdriver(user, tool) /obj/machinery/research/anomaly_refinery/crowbar_act(mob/living/user, obj/item/tool) - if(!default_deconstruction_crowbar(tool)) - return FALSE - return TRUE + return default_deconstruction_crowbar(user, tool) /obj/machinery/research/anomaly_refinery/emag_act(mob/user, obj/item/card/emag/emag_card) . = ..() diff --git a/code/modules/research/destructive_analyzer.dm b/code/modules/research/destructive_analyzer.dm index 9984970e6d0..0c958e557be 100644 --- a/code/modules/research/destructive_analyzer.dm +++ b/code/modules/research/destructive_analyzer.dm @@ -61,8 +61,11 @@ return CLICK_ACTION_SUCCESS /obj/machinery/rnd/destructive_analyzer/update_icon_state() - icon_state = "[base_icon_state][loaded_item ? "_l" : null]" - return ..() + . = ..() + if(panel_open && !loaded_item) + return // use parent call state + + icon_state = "[base_icon_state][loaded_item ? "_l" : ""]" /obj/machinery/rnd/destructive_analyzer/ui_interact(mob/user, datum/tgui/ui) ui = SStgui.try_update_ui(user, src, ui) @@ -126,11 +129,11 @@ //This allows people to put syndicate screwdrivers in the machine. Secondary act still passes. /obj/machinery/rnd/destructive_analyzer/screwdriver_act(mob/living/user, obj/item/tool) - return FALSE + return NONE //We need to call default_deconstruction_screwdriver here since its parent will call screwdriver_act on this level which will stop us from ever deconstructing. /obj/machinery/rnd/destructive_analyzer/screwdriver_act_secondary(mob/living/user, obj/item/tool) - return default_deconstruction_screwdriver(user, "[initial(icon_state)]_t", initial(icon_state), tool) + return default_deconstruction_screwdriver(user, tool) //We need to let wire cutter in (not block) so we can analyze alien wirecutters. /obj/machinery/rnd/destructive_analyzer/wirecutter_act(mob/living/user, obj/item/tool) diff --git a/code/modules/research/experimentor/experimentor.dm b/code/modules/research/experimentor/experimentor.dm index 438f92c7dfa..1992c71095e 100644 --- a/code/modules/research/experimentor/experimentor.dm +++ b/code/modules/research/experimentor/experimentor.dm @@ -151,9 +151,9 @@ . += span_notice("Malfunction probability reduced by [span_bold("[malfunction_probability_coeff]")].") . += span_notice("Cooldown interval between experiments at [span_bold("[cooldown]")] seconds.") -/obj/machinery/rnd/experimentor/default_deconstruction_crowbar(obj/item/crowbar) +/obj/machinery/rnd/experimentor/on_deconstruction(disassembled) + . = ..() item_eject() - return ..() /obj/machinery/rnd/experimentor/ui_interact(mob/user, datum/tgui/ui) ui = SStgui.try_update_ui(user, src, ui) @@ -362,10 +362,7 @@ return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN /obj/machinery/rnd/experimentor/screwdriver_act_secondary(mob/living/user, obj/item/tool) - if(default_deconstruction_screwdriver(user, icon_state, icon_state, tool)) - update_appearance() - return ITEM_INTERACT_SUCCESS - return NONE + return default_deconstruction_screwdriver(user, tool) /obj/machinery/rnd/experimentor/multitool_act(mob/living/user, obj/item/tool) if(panel_open) diff --git a/code/modules/research/machinery/_production.dm b/code/modules/research/machinery/_production.dm index 646ae764af9..01f3631c77b 100644 --- a/code/modules/research/machinery/_production.dm +++ b/code/modules/research/machinery/_production.dm @@ -58,12 +58,6 @@ QDEL_NULL(materials) return ..() -// Stuff for the stripe on the department machines -/obj/machinery/rnd/production/default_deconstruction_screwdriver(mob/user, icon_state_open, icon_state_closed, obj/item/screwdriver) - . = ..() - - update_icon(UPDATE_OVERLAYS) - /obj/machinery/rnd/production/update_overlays() . = ..() @@ -356,8 +350,7 @@ busy = TRUE SStgui.update_uis(src) print_sound.start() - if(production_animation) - icon_state = production_animation + update_appearance() var/turf/target_location if(drop_direction) target_location = get_step(src, drop_direction) @@ -465,7 +458,7 @@ print_sound.stop() busy = FALSE SStgui.update_uis(src) - icon_state = initial(icon_state) + update_appearance() /obj/machinery/rnd/production/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) if(!can_interact(user) || (!HAS_SILICON_ACCESS(user) && !isAdminGhostAI(user)) && !Adjacent(user)) @@ -488,3 +481,10 @@ balloon_alert(user, "drop direction reset") drop_direction = 0 return CLICK_ACTION_SUCCESS + +/obj/machinery/rnd/production/update_icon_state() + . = ..() + if(busy && production_animation) + icon_state = production_animation + else if(!panel_open) // use what is set by parent if panel is open + icon_state = base_icon_state || initial(icon_state) diff --git a/code/modules/research/machinery/circuit_imprinter.dm b/code/modules/research/machinery/circuit_imprinter.dm index c6d50f13307..aa496bd9f1c 100644 --- a/code/modules/research/machinery/circuit_imprinter.dm +++ b/code/modules/research/machinery/circuit_imprinter.dm @@ -2,6 +2,7 @@ name = "circuit imprinter" desc = "Manufactures circuit boards for the construction of machines." icon_state = "circuit_imprinter" + base_icon_state = "circuit_imprinter" production_animation = "circuit_imprinter_ani" circuit = /obj/item/circuitboard/machine/circuit_imprinter allowed_buildtypes = IMPRINTER diff --git a/code/modules/research/machinery/protolathe.dm b/code/modules/research/machinery/protolathe.dm index 7a81a5cd36f..a5d0c45cb5e 100644 --- a/code/modules/research/machinery/protolathe.dm +++ b/code/modules/research/machinery/protolathe.dm @@ -2,6 +2,7 @@ name = "protolathe" desc = "Converts raw materials into useful objects." icon_state = "protolathe" + base_icon_state = "protolathe" circuit = /obj/item/circuitboard/machine/protolathe production_animation = "protolathe_n" allowed_buildtypes = PROTOLATHE diff --git a/code/modules/research/machinery/techfab.dm b/code/modules/research/machinery/techfab.dm index 7f1428882e7..71d79282d45 100644 --- a/code/modules/research/machinery/techfab.dm +++ b/code/modules/research/machinery/techfab.dm @@ -2,6 +2,7 @@ name = "technology fabricator" desc = "Produces researched prototypes with raw materials and energy." icon_state = "protolathe" + base_icon_state = "protolathe" circuit = /obj/item/circuitboard/machine/techfab production_animation = "protolathe_n" allowed_buildtypes = PROTOLATHE | IMPRINTER diff --git a/code/modules/research/ordnance/doppler_array.dm b/code/modules/research/ordnance/doppler_array.dm index 6fadc0393a5..b39758918ea 100644 --- a/code/modules/research/ordnance/doppler_array.dm +++ b/code/modules/research/ordnance/doppler_array.dm @@ -63,16 +63,12 @@ return ITEM_INTERACT_SUCCESS /obj/machinery/doppler_array/screwdriver_act(mob/living/user, obj/item/tool) - if(!default_deconstruction_screwdriver(user, "[base_icon_state]", "[base_icon_state]", tool)) - return FALSE + . = default_deconstruction_screwdriver(user, tool) power_change() - update_appearance() - return TRUE + return . /obj/machinery/doppler_array/crowbar_act(mob/living/user, obj/item/tool) - if(!default_deconstruction_crowbar(tool)) - return FALSE - return TRUE + return default_deconstruction_crowbar(user, tool) /// Printing of a record into a disk. /obj/machinery/doppler_array/proc/print(mob/user, datum/data/tachyon_record/record) diff --git a/code/modules/research/ordnance/tank_compressor.dm b/code/modules/research/ordnance/tank_compressor.dm index a5403e87161..4887b41849b 100644 --- a/code/modules/research/ordnance/tank_compressor.dm +++ b/code/modules/research/ordnance/tank_compressor.dm @@ -88,19 +88,17 @@ /obj/machinery/atmospherics/components/binary/tank_compressor/screwdriver_act(mob/living/user, obj/item/tool) if(active || inserted_tank) - return FALSE - if(!default_deconstruction_screwdriver(user, "[base_icon_state]-open", "[base_icon_state]-open", tool)) - return FALSE + return NONE + + . = default_deconstruction_screwdriver(user, tool) change_nodes_connection(panel_open) - update_appearance() - return TRUE + return . /obj/machinery/atmospherics/components/binary/tank_compressor/crowbar_act(mob/living/user, obj/item/tool) if(active || inserted_tank) - return FALSE - if(!default_deconstruction_crowbar(tool)) - return FALSE - return TRUE + return NONE + + return default_deconstruction_crowbar(user, tool) /// Glorified volume pump. /obj/machinery/atmospherics/components/binary/tank_compressor/process_atmos() diff --git a/code/modules/research/rdmachines.dm b/code/modules/research/rdmachines.dm index 100c7979c24..1ac508070cd 100644 --- a/code/modules/research/rdmachines.dm +++ b/code/modules/research/rdmachines.dm @@ -93,14 +93,18 @@ /obj/machinery/rnd/proc/reset_busy() busy = FALSE +/obj/machinery/rnd/update_icon_state() + . = ..() + icon_state = panel_open ? "[base_icon_state || initial(icon_state)]_t" : (base_icon_state || initial(icon_state)) + /obj/machinery/rnd/crowbar_act(mob/living/user, obj/item/tool) - return default_deconstruction_crowbar(tool) + return default_deconstruction_crowbar(user, tool) /obj/machinery/rnd/crowbar_act_secondary(mob/living/user, obj/item/tool) return crowbar_act(user, tool) /obj/machinery/rnd/screwdriver_act(mob/living/user, obj/item/tool) - return default_deconstruction_screwdriver(user, "[initial(icon_state)]_t", initial(icon_state), tool) + return default_deconstruction_screwdriver(user, tool) /obj/machinery/rnd/screwdriver_act_secondary(mob/living/user, obj/item/tool) return screwdriver_act(user, tool) diff --git a/code/modules/research/xenobiology/vatgrowing/vatgrower.dm b/code/modules/research/xenobiology/vatgrowing/vatgrower.dm index c78b1298c9c..99537c9cbe5 100644 --- a/code/modules/research/xenobiology/vatgrowing/vatgrower.dm +++ b/code/modules/research/xenobiology/vatgrowing/vatgrower.dm @@ -60,14 +60,10 @@ return deposit_sample(user, tool) /obj/machinery/vatgrower/screwdriver_act(mob/living/user, obj/item/tool) - . = ..() - if(default_deconstruction_screwdriver(user, icon_state, icon_state, tool)) - return ITEM_INTERACT_SUCCESS + return default_deconstruction_screwdriver(user, tool) /obj/machinery/vatgrower/crowbar_act(mob/living/user, obj/item/tool) - . = ..() - if(default_deconstruction_crowbar(tool)) - return ITEM_INTERACT_SUCCESS + return default_deconstruction_crowbar(user, tool) /obj/machinery/vatgrower/wrench_act(mob/living/user, obj/item/tool) . = ..() diff --git a/code/modules/transport/tram/tram_signals.dm b/code/modules/transport/tram/tram_signals.dm index 701d20b740e..91930be7646 100644 --- a/code/modules/transport/tram/tram_signals.dm +++ b/code/modules/transport/tram/tram_signals.dm @@ -118,14 +118,10 @@ . = ..() /obj/machinery/transport/crossing_signal/screwdriver_act(mob/living/user, obj/item/tool) - if(default_deconstruction_screwdriver(user, icon_state, icon_state, tool)) - return ITEM_INTERACT_SUCCESS - return NONE + return default_deconstruction_screwdriver(user, tool) /obj/machinery/transport/crossing_signal/crowbar_act(mob/living/user, obj/item/tool) - if(default_deconstruction_crowbar(tool)) - return ITEM_INTERACT_SUCCESS - return NONE + return default_deconstruction_crowbar(user, tool) /obj/machinery/transport/crossing_signal/add_context(atom/source, list/context, obj/item/held_item, mob/user) . = ..() @@ -517,14 +513,10 @@ . += span_notice("The status display reads: Repair required.") /obj/machinery/transport/guideway_sensor/screwdriver_act(mob/living/user, obj/item/tool) - if(default_deconstruction_screwdriver(user, icon_state, icon_state, tool)) - return ITEM_INTERACT_SUCCESS - return NONE + return default_deconstruction_screwdriver(user, tool) /obj/machinery/transport/guideway_sensor/crowbar_act(mob/living/user, obj/item/tool) - if(default_deconstruction_crowbar(tool)) - return ITEM_INTERACT_SUCCESS - return NONE + return default_deconstruction_crowbar(user, tool) /obj/machinery/transport/guideway_sensor/proc/pair_sensor() set_machine_stat(machine_stat | MAINT) diff --git a/code/modules/vehicles/mecha/mech_bay.dm b/code/modules/vehicles/mecha/mech_bay.dm index 8c6b61546ef..4011b490b85 100644 --- a/code/modules/vehicles/mecha/mech_bay.dm +++ b/code/modules/vehicles/mecha/mech_bay.dm @@ -3,6 +3,7 @@ desc = "This port recharges a mech's internal power cell." icon = 'icons/obj/machines/mech_bay.dmi' icon_state = "recharge_port" + base_icon_state = "recharge_port" density = TRUE dir = EAST active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION * 0.1 @@ -75,22 +76,20 @@ recharging_mech_ref = null recharge_console.update_appearance() +/obj/machinery/mech_bay_recharge_port/update_icon_state() + . = ..() + icon_state = panel_open ? "[base_icon_state]-o" : base_icon_state /obj/machinery/mech_bay_recharge_port/screwdriver_act(mob/living/user, obj/item/tool) - if(default_deconstruction_screwdriver(user, "recharge_port-o", "recharge_port", tool)) - return ITEM_INTERACT_SUCCESS - return NONE - -/obj/machinery/mech_bay_recharge_port/wrench_act(mob/living/user, obj/item/tool) - if(default_change_direction_wrench(user, tool)) - recharging_turf = get_step(loc, dir) - return ITEM_INTERACT_SUCCESS - return NONE + return default_deconstruction_screwdriver(user, tool) /obj/machinery/mech_bay_recharge_port/crowbar_act(mob/living/user, obj/item/tool) - if(default_deconstruction_crowbar(tool)) - return ITEM_INTERACT_SUCCESS - return NONE + return default_deconstruction_crowbar(user, tool) + +/obj/machinery/mech_bay_recharge_port/wrench_act(mob/living/user, obj/item/tool) + . = default_change_direction_wrench(user, tool) + recharging_turf = get_step(loc, dir) + return . /obj/machinery/computer/mech_bay_power_console name = "mech bay power control console" diff --git a/code/modules/vehicles/mecha/mech_fabricator.dm b/code/modules/vehicles/mecha/mech_fabricator.dm index 4e1fbbdc1ea..c3775d45f4b 100644 --- a/code/modules/vehicles/mecha/mech_fabricator.dm +++ b/code/modules/vehicles/mecha/mech_fabricator.dm @@ -1,6 +1,7 @@ /obj/machinery/mecha_part_fabricator icon = 'icons/obj/machines/robotics.dmi' icon_state = "fab-idle" + base_icon_state = "fab" name = "exosuit fabricator" desc = "Nothing is being built." density = TRUE @@ -177,16 +178,17 @@ * Adds the overlay to show the fab working and sets active power usage settings. */ /obj/machinery/mecha_part_fabricator/proc/on_start_printing() - add_overlay("fab-active") + add_overlay("[base_icon_state]-active") update_use_power(ACTIVE_POWER_USE) print_sound.start() + /** * Intended to be called when the exofab has stopped working and is no longer printing items. * * Removes the overlay to show the fab working and sets idle power usage settings. Additionally resets the description and turns off queue processing. */ /obj/machinery/mecha_part_fabricator/proc/on_finish_printing() - cut_overlay("fab-active") + cut_overlay("[base_icon_state]-active") update_use_power(IDLE_POWER_USE) desc = initial(desc) process_queue = FALSE @@ -494,24 +496,26 @@ /obj/machinery/mecha_part_fabricator/proc/AfterMaterialInsert(item_inserted, id_inserted, amount_inserted) var/datum/material/M = id_inserted - add_overlay("fab-load-[M.name]") - addtimer(CALLBACK(src, TYPE_PROC_REF(/atom, cut_overlay), "fab-load-[M.name]"), 1 SECONDS) + add_overlay("[base_icon_state]-load-[M.name]") + addtimer(CALLBACK(src, TYPE_PROC_REF(/atom, cut_overlay), "[base_icon_state]-load-[M.name]"), 1 SECONDS) + +/obj/machinery/mecha_part_fabricator/update_icon_state() + . = ..() + icon_state = panel_open ? "[base_icon_state]-o" : "[base_icon_state]-idle" /obj/machinery/mecha_part_fabricator/screwdriver_act(mob/living/user, obj/item/I) - if(..()) - return TRUE if(being_built) to_chat(user, span_warning("\The [src] is currently processing! Please wait until completion.")) - return FALSE - return default_deconstruction_screwdriver(user, "fab-o", "fab-idle", I) + return NONE + + return default_deconstruction_screwdriver(user, I) /obj/machinery/mecha_part_fabricator/crowbar_act(mob/living/user, obj/item/I) - if(..()) - return TRUE if(being_built) to_chat(user, span_warning("\The [src] is currently processing! Please wait until completion.")) - return FALSE - return default_deconstruction_crowbar(I) + return NONE + + return default_deconstruction_crowbar(user, I) /obj/machinery/mecha_part_fabricator/maint link_on_init = FALSE diff --git a/code/modules/vending/mail.dm b/code/modules/vending/mail.dm index 84ed1585af6..63a7552fdd8 100644 --- a/code/modules/vending/mail.dm +++ b/code/modules/vending/mail.dm @@ -47,14 +47,11 @@ /// Opening the maintenance panel. /obj/machinery/mailsorter/screwdriver_act(mob/living/user, obj/item/tool) - default_deconstruction_screwdriver(user, "[base_icon_state]-off", base_icon_state, tool) - update_appearance(UPDATE_OVERLAYS) - return ITEM_INTERACT_SUCCESS + return default_deconstruction_screwdriver(user, tool) /// Deconstructing the mail sorter. /obj/machinery/mailsorter/crowbar_act(mob/living/user, obj/item/tool) - default_deconstruction_crowbar(tool) - return ITEM_INTERACT_SUCCESS + return default_deconstruction_crowbar(user, tool) /obj/machinery/mailsorter/examine(mob/user) . = ..() @@ -298,7 +295,7 @@ . += emissive_appearance(icon, light_mask, src) /obj/machinery/mailsorter/update_icon_state() - icon_state = "[base_icon_state][powered() ? null : "-off"]" + icon_state = "[base_icon_state][(powered() && !panel_open) ? null : "-off"]" if(machine_stat & BROKEN) icon_state = "[base_icon_state]-broken" return ..() diff --git a/code/modules/vending/vendor/interaction.dm b/code/modules/vending/vendor/interaction.dm index 513fe15f575..0e8c2cfc7b9 100644 --- a/code/modules/vending/vendor/interaction.dm +++ b/code/modules/vending/vendor/interaction.dm @@ -16,8 +16,7 @@ /obj/machinery/vending/crowbar_act(mob/living/user, obj/item/attack_item) if(!component_parts) return ITEM_INTERACT_FAILURE - default_deconstruction_crowbar(attack_item) - return ITEM_INTERACT_SUCCESS + return default_deconstruction_crowbar(user, attack_item) /obj/machinery/vending/wrench_act(mob/living/user, obj/item/tool) . = NONE @@ -29,11 +28,9 @@ /obj/machinery/vending/screwdriver_act(mob/living/user, obj/item/attack_item) if(anchored) - default_deconstruction_screwdriver(user, icon_state, icon_state, attack_item) - return ITEM_INTERACT_SUCCESS - else - to_chat(user, span_warning("You must first secure [src].")) - return ITEM_INTERACT_FAILURE + return default_deconstruction_screwdriver(user, attack_item) + to_chat(user, span_warning("You must first secure [src].")) + return ITEM_INTERACT_FAILURE /obj/machinery/vending/on_set_panel_open(old_value) update_appearance(UPDATE_OVERLAYS) diff --git a/code/modules/wiremod/core/component_printer.dm b/code/modules/wiremod/core/component_printer.dm index 8f7ec81cfb4..529c5af82df 100644 --- a/code/modules/wiremod/core/component_printer.dm +++ b/code/modules/wiremod/core/component_printer.dm @@ -4,6 +4,7 @@ desc = "Produces components for the creation of integrated circuits." icon = 'icons/obj/machines/wiremod_fab.dmi' icon_state = "fab-idle" + base_icon_state = "fab" circuit = /obj/item/circuitboard/machine/component_printer /// The internal material bus @@ -233,14 +234,14 @@ return ITEM_INTERACT_SUCCESS /obj/machinery/component_printer/crowbar_act(mob/living/user, obj/item/tool) - if(..()) - return TRUE - return default_deconstruction_crowbar(tool) + return default_deconstruction_crowbar(user, tool) /obj/machinery/component_printer/screwdriver_act(mob/living/user, obj/item/tool) - if(..()) - return TRUE - return default_deconstruction_screwdriver(user, "fab-o", "fab-idle", tool) + return default_deconstruction_screwdriver(user, tool) + +/obj/machinery/component_printer/update_icon_state() + . = ..() + icon_state = panel_open ? "[base_icon_state]-o" : "[base_icon_state]-idle" /obj/machinery/component_printer/proc/get_material_cost_data(list/materials, efficiency_coeff) var/list/data = list() @@ -339,6 +340,7 @@ desc = "Allows you to duplicate module components so that you don't have to recreate them. Scan a module component over this machine to add it as an entry." icon = 'icons/obj/machines/wiremod_fab.dmi' icon_state = "module-fab-idle" + base_icon_state = "module-fab" circuit = /obj/item/circuitboard/machine/module_duplicator density = TRUE @@ -539,11 +541,11 @@ return data /obj/machinery/module_duplicator/crowbar_act(mob/living/user, obj/item/tool) - if(..()) - return TRUE - return default_deconstruction_crowbar(tool) + return default_deconstruction_crowbar(user, tool) /obj/machinery/module_duplicator/screwdriver_act(mob/living/user, obj/item/tool) - if(..()) - return TRUE - return default_deconstruction_screwdriver(user, "module-fab-o", "module-fab-idle", tool) + return default_deconstruction_screwdriver(user, tool) + +/obj/machinery/module_duplicator/update_icon_state() + . = ..() + icon_state = panel_open ? "[base_icon_state]-o" : "[base_icon_state]-idle" diff --git a/code/modules/wiremod/shell/brain_computer_interface.dm b/code/modules/wiremod/shell/brain_computer_interface.dm index 126764cfa93..d08470d0ac9 100644 --- a/code/modules/wiremod/shell/brain_computer_interface.dm +++ b/code/modules/wiremod/shell/brain_computer_interface.dm @@ -353,18 +353,11 @@ user.put_in_hands(previous_bci_to_implant) return ITEM_INTERACT_SUCCESS -/obj/machinery/bci_implanter/attackby_secondary(obj/item/weapon, mob/user, list/modifiers, list/attack_modifiers) - if (!occupant && default_deconstruction_screwdriver(user, icon_state, icon_state, weapon)) - update_appearance() - return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN +/obj/machinery/bci_implanter/screwdriver_act_secondary(mob/living/user, obj/item/tool) + return isnull(occupant) ? default_deconstruction_screwdriver(user, tool) : NONE - if (default_pry_open(weapon, close_after_pry = FALSE, open_density = FALSE, closed_density = TRUE)) - return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN - - if (default_deconstruction_crowbar(weapon)) - return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN - - return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN +/obj/machinery/bci_implanter/crowbar_act_secondary(mob/living/user, obj/item/tool) + return default_pry_open(user, user, tool, close_after_pry = FALSE, open_density = FALSE, closed_density = TRUE, deconstruct_on_fail = TRUE) /obj/machinery/bci_implanter/proc/start_process() if (machine_stat & (NOPOWER|BROKEN)) diff --git a/tgstation.dme b/tgstation.dme index 76e3fafc18c..e9513189310 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -1704,6 +1704,7 @@ #include "code\datums\elements\table_smash.dm" #include "code\datums\elements\tenacious.dm" #include "code\datums\elements\tiny_mob_hunter.dm" +#include "code\datums\elements\tool_blocker.dm" #include "code\datums\elements\tool_flash.dm" #include "code\datums\elements\tool_renaming.dm" #include "code\datums\elements\toy_talk.dm"