diff --git a/code/datums/wires/syndicatebomb_wires.dm b/code/datums/wires/syndicatebomb_wires.dm index 5f585bf64f0..a7ecf28fc03 100644 --- a/code/datums/wires/syndicatebomb_wires.dm +++ b/code/datums/wires/syndicatebomb_wires.dm @@ -10,7 +10,7 @@ /datum/wires/syndicatebomb/interactable(mob/user) var/obj/machinery/syndicatebomb/P = holder - if(P.open_panel) + if(P.panel_open) return TRUE return FALSE diff --git a/code/datums/wires/wires.dm b/code/datums/wires/wires.dm index e1af67766f2..31387cb5d35 100644 --- a/code/datums/wires/wires.dm +++ b/code/datums/wires/wires.dm @@ -377,6 +377,16 @@ /datum/wires/proc/cut_random() cut(wires[rand(1, length(wires))]) +/** +* Cuts a random uncut wire. +*/ +/datum/wires/proc/cut_random_uncut_wire() + var/list/uncut_list = wires - cut_wires + if(!length(uncut_list)) + return + var/random_wire = pick(uncut_list) + cut(random_wire) + /** * Cuts all wires. */ diff --git a/code/game/machinery/autolathe.dm b/code/game/machinery/autolathe.dm index 612061df3cc..2e8853964b4 100644 --- a/code/game/machinery/autolathe.dm +++ b/code/game/machinery/autolathe.dm @@ -524,6 +524,9 @@ if(!wires.is_cut(WIRE_AUTOLATHE_DISABLE)) disabled = FALSE +/obj/machinery/autolathe/get_internal_wires() + return wires + /obj/machinery/autolathe/syndicate name = "syndicate autolathe" diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm index 2c9f71bef98..abde9774c12 100644 --- a/code/game/machinery/camera/camera.dm +++ b/code/game/machinery/camera/camera.dm @@ -428,6 +428,9 @@ ..() return TRUE +/obj/machinery/camera/get_internal_wires() + return wires + /// Cameras which are placed inside of things, such as helmets. /obj/machinery/camera/portable start_active = TRUE // theres no real way to reactivate these, so never break them when they init diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index 1399013f6db..104acefda2a 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -184,6 +184,9 @@ GLOBAL_LIST_EMPTY(airlock_emissive_underlays) return new snowflake_path(src) return source_area?.airlock_wires ? new source_area.airlock_wires(src) : new /datum/wires/airlock(src) +/obj/machinery/door/airlock/get_internal_wires() + return wires + /obj/machinery/door/airlock/proc/update_other_id() for(var/obj/machinery/door/airlock/A in GLOB.airlocks) if(A.closeOtherId == closeOtherId && A != src) @@ -1012,6 +1015,9 @@ GLOBAL_LIST_EMPTY(airlock_emissive_underlays) if(!headbutt_shock_check(user)) return ITEM_INTERACT_COMPLETE if(panel_open) + if(istype(used, /obj/item/kitchen/utensil/fork)) + return NONE + switch(security_level) if(AIRLOCK_SECURITY_NONE) if(istype(used, /obj/item/stack/sheet/metal)) diff --git a/code/game/machinery/floodlight.dm b/code/game/machinery/floodlight.dm index 4390e187872..29ff7dddf11 100644 --- a/code/game/machinery/floodlight.dm +++ b/code/game/machinery/floodlight.dm @@ -11,7 +11,6 @@ var/obj/item/stock_parts/cell/high/cell = null var/use = 30 var/unlocked = FALSE - var/open = FALSE var/brightness_on = 14 /obj/machinery/floodlight/get_cell() @@ -27,7 +26,7 @@ return ..() /obj/machinery/floodlight/update_icon_state() - icon_state = "flood[open ? "o" : ""][open && cell ? "b" : ""]0[on]" + icon_state = "flood[panel_open ? "o" : ""][panel_open && cell ? "b" : ""]0[on]" /obj/machinery/floodlight/process() if(on) @@ -41,7 +40,7 @@ return /obj/machinery/floodlight/attack_hand(mob/user as mob) - if(open && cell) + if(panel_open && cell) if(ishuman(user)) if(!user.get_active_hand()) user.put_in_hands(cell) @@ -91,7 +90,7 @@ /obj/machinery/floodlight/item_interaction(mob/living/user, obj/item/used, list/modifiers) if(istype(used, /obj/item/stock_parts/cell)) - if(open) + if(panel_open) if(cell) to_chat(user, SPAN_WARNING("There is a power cell already installed.")) else @@ -107,14 +106,14 @@ return ..() /obj/machinery/floodlight/screwdriver_act(mob/living/user, obj/item/I) - if(open) + if(panel_open) to_chat(user, SPAN_WARNING("The screws can't reach while its open.")) return TRUE if(!I.use_tool(src, user, volume = I.tool_volume)) return - if(open) + if(panel_open) return if(unlocked) @@ -133,11 +132,11 @@ if(!I.use_tool(src, user, volume = I.tool_volume)) return - if(open) + if(panel_open) to_chat(user, SPAN_NOTICE("You pry the panel closed.")) else to_chat(user, SPAN_NOTICE("You pry the panel open.")) - open = !open + panel_open = !panel_open update_icon(UPDATE_ICON_STATE) return TRUE @@ -159,7 +158,7 @@ if(!unlocked) . +=SPAN_NOTICE("The panel is screwed shut.") else - if(open) + if(panel_open) . +=SPAN_NOTICE("The panel is pried open, looks like you could fit a cell in there.") else . +=SPAN_NOTICE("The panel looks like it could be pried open, or screwed shut.") diff --git a/code/game/machinery/machinery.dm b/code/game/machinery/machinery.dm index 38521e2fe35..afff20d4b0a 100644 --- a/code/game/machinery/machinery.dm +++ b/code/game/machinery/machinery.dm @@ -547,6 +547,15 @@ /obj/machinery/proc/on_deconstruction() return +/** +* Returns the wires of the machine, or null if not declared. +* +* Note: `/obj/machinery/` does not contain a `/datum/wires/` variable, +* and needs to be implemented on any child object with this function overwritten. +*/ +/obj/machinery/proc/get_internal_wires() + return + /obj/machinery/emp_act(severity) if(power_state && !stat) use_power(7500/severity) diff --git a/code/game/machinery/suit_storage_unit.dm b/code/game/machinery/suit_storage_unit.dm index 2f4008bb755..309ccc8cec8 100644 --- a/code/game/machinery/suit_storage_unit.dm +++ b/code/game/machinery/suit_storage_unit.dm @@ -321,6 +321,9 @@ . += "[base_icon_state]_[occupant ? "body" : "ready"]" /obj/machinery/suit_storage_unit/item_interaction(mob/living/user, obj/item/used, list/modifiers) + if(istype(used, /obj/item/kitchen/utensil/fork)) + return NONE + if(shocked) if(shock(user, 100)) return ITEM_INTERACT_COMPLETE @@ -774,3 +777,7 @@ if(!uv_super) toggleUV(TRUE) secure = FALSE + + +/obj/machinery/suit_storage_unit/get_internal_wires() + return wires diff --git a/code/game/machinery/syndicatebomb.dm b/code/game/machinery/syndicatebomb.dm index f04aae68a48..783d0758b6d 100644 --- a/code/game/machinery/syndicatebomb.dm +++ b/code/game/machinery/syndicatebomb.dm @@ -18,7 +18,6 @@ var/can_unanchor = TRUE - var/open_panel = FALSE //are the wires exposed? var/active = FALSE //is the bomb counting down? var/defused = FALSE //is the bomb capable of exploding? var/obj/item/bombcore/payload = /obj/item/bombcore @@ -104,7 +103,7 @@ . += "A digital display on it reads \"[seconds_remaining()]\"." /obj/machinery/syndicatebomb/update_icon_state() - icon_state = "[initial(icon_state)][active ? "-active" : "-inactive"][open_panel ? "-wires" : ""]" + icon_state = "[initial(icon_state)][active ? "-active" : "-inactive"][panel_open ? "-wires" : ""]" /obj/machinery/syndicatebomb/proc/seconds_remaining() if(active) @@ -114,7 +113,7 @@ /obj/machinery/syndicatebomb/item_interaction(mob/living/user, obj/item/used, list/modifiers) if(istype(used, /obj/item/assembly/signaler)) - if(open_panel) + if(panel_open) wires.Interact(user) return ITEM_INTERACT_COMPLETE @@ -156,12 +155,12 @@ . = TRUE if(!I.use_tool(src, user, 0, volume = I.tool_volume)) return - open_panel = !open_panel + panel_open = !panel_open update_icon(UPDATE_ICON_STATE) - to_chat(user, SPAN_NOTICE("You [open_panel ? "open" : "close"] the wire panel.")) + to_chat(user, SPAN_NOTICE("You [panel_open ? "open" : "close"] the wire panel.")) /obj/machinery/syndicatebomb/wirecutter_act(mob/user, obj/item/I) - if(!open_panel) + if(!panel_open) return . = TRUE if(!I.use_tool(src, user, 0, volume = I.tool_volume)) @@ -169,7 +168,7 @@ wires.Interact(user) /obj/machinery/syndicatebomb/multitool_act(mob/user, obj/item/I) - if(!open_panel) + if(!panel_open) return . = TRUE if(!I.use_tool(src, user, 0, volume = I.tool_volume)) @@ -180,21 +179,21 @@ . = TRUE if(!I.use_tool(src, user, 0, volume = I.tool_volume)) return - if(open_panel && wires.is_all_cut()) + if(panel_open && wires.is_all_cut()) if(payload) to_chat(user, SPAN_NOTICE("You carefully pry out [payload].")) payload.loc = user.loc payload = null else to_chat(user, SPAN_WARNING("There isn't anything in here to remove!")) - else if(open_panel) + else if(panel_open) to_chat(user, SPAN_WARNING("The wires connecting the shell to the explosives are holding it down!")) else to_chat(user, SPAN_WARNING("The cover is screwed on, it won't pry off!")) /obj/machinery/syndicatebomb/welder_act(mob/user, obj/item/I) . = TRUE - if(payload || !wires.is_all_cut() || !open_panel) + if(payload || !wires.is_all_cut() || !panel_open) return if(!I.tool_use_check(user, 0)) return @@ -214,9 +213,9 @@ return /obj/machinery/syndicatebomb/interact(mob/user) - if(wires && open_panel) + if(wires && panel_open) wires.Interact(user) - if(!open_panel && can_interact(user)) + if(!panel_open && can_interact(user)) if(!active) spawn() settings(user) @@ -270,6 +269,9 @@ add_attack_logs(user, src, "has primed a [name] ([payload]) for detonation", ATKLOG_FEW) payload.adminlog = "\The [src] that [key_name(user)] had primed detonated!" +/obj/machinery/syndicatebomb/get_internal_wires() + return wires + ///Bomb Subtypes/// /obj/machinery/syndicatebomb/training @@ -301,7 +303,7 @@ icon_state = "base-bomb" desc = "An ominous looking device designed to detonate an explosive payload. Can be bolted down using a wrench." payload = null - open_panel = TRUE + panel_open = TRUE timer_set = 120 /obj/machinery/syndicatebomb/empty/Initialize(mapload) @@ -383,7 +385,7 @@ if(holder.wires) holder.wires.shuffle_wires() holder.defused = 0 - holder.open_panel = 0 + holder.panel_open = 0 holder.delayedbig = FALSE holder.delayedlittle = FALSE holder.explode_now = FALSE diff --git a/code/game/machinery/vendors/vending.dm b/code/game/machinery/vendors/vending.dm index 4bc22b8c748..cef446187eb 100644 --- a/code/game/machinery/vendors/vending.dm +++ b/code/game/machinery/vendors/vending.dm @@ -1089,6 +1089,8 @@ /obj/machinery/economy/vending/proc/get_vendor_account() return GLOB.station_money_database.vendor_account +/obj/machinery/economy/vending/get_internal_wires() + return wires /* * Vending machine types */ diff --git a/code/game/objects/items/weapons/kitchen.dm b/code/game/objects/items/weapons/kitchen.dm index 3b963be0bf4..d8d8c16c8f1 100644 --- a/code/game/objects/items/weapons/kitchen.dm +++ b/code/game/objects/items/weapons/kitchen.dm @@ -36,40 +36,105 @@ armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 0, BOMB = 0, RAD = 0, FIRE = 50, ACID = 30) materials = list(MAT_METAL = 100) var/max_contents = 1 + new_attack_chain = TRUE /obj/item/kitchen/utensil/Initialize(mapload) + //Initialize(mapload) . = ..() if(prob(60)) src.pixel_y = rand(0, 4) create_reagents(5) + RegisterSignal(src, COMSIG_ATTACK, PROC_REF(on_attack)) -/obj/item/kitchen/utensil/attack__legacy__attackchain(mob/living/carbon/C, mob/living/carbon/user) - if(!istype(C)) - return ..() - +/obj/item/kitchen/utensil/interact_with_atom(atom/target, mob/living/user, list/modifiers) if(user.a_intent != INTENT_HELP) - if(user.zone_selected == "head" || user.zone_selected == "eyes") - if(HAS_TRAIT(user, TRAIT_CLUMSY) && prob(50)) - C = user - return eyestab(C, user) - else - return ..() + return + if(!istype(target, /mob/living/carbon)) + return + + var/mob/living/carbon/feed_target = target if(length(contents)) var/obj/item/food/toEat = contents[1] if(istype(toEat)) - if(C.eat(toEat, user)) - toEat.On_Consume(C, user) + if(feed_target.eat(toEat, user)) + toEat.On_Consume(feed_target, user) overlays.Cut() - return + return ITEM_INTERACT_COMPLETE + return ..() + +/obj/item/kitchen/utensil/proc/on_attack(datum/source, mob/living/carbon/target, mob/living/user) + if(!istype(target) || user.a_intent == INTENT_HELP) + return + if(user.zone_selected != "head" && user.zone_selected != "eyes") + return + if(HAS_TRAIT(user, TRAIT_CLUMSY) && prob(50)) + target = user + + eyestab(target, user) + + return COMPONENT_SKIP_ATTACK /obj/item/kitchen/utensil/fork name = "fork" - desc = "It's a fork. Sure is pointy." + desc = "It's a fork. Sure is pointy. Keep away from outlets. " icon_state = "fork" +/obj/item/kitchen/utensil/fork/interact_with_atom(atom/target, mob/living/user, list/modifiers) + if(!istype(target, /obj/machinery)) + return ..() + + if(istype(target, /obj/machinery/nuclearbomb)) // we're trying to be a little silly, not very silly + return ..() + + var/obj/machinery/machine = target + var/wiresexposed = FALSE + + if(istype(machine, /obj/machinery/door/airlock)) + var/obj/machinery/door/airlock/air_lock = machine + if(air_lock.security_level) //the door has a plating protecting the wires + to_chat(user, SPAN_NOTICE("You scrape at the shielding of \the [target] with \the [src], to no effect.")) + return ITEM_INTERACT_COMPLETE + + //these have different variable names for if the panel is open or not. For some reason. + if(istype(machine, /obj/machinery/alarm)) + var/obj/machinery/alarm/air_alarm = machine + wiresexposed = air_alarm.wiresexposed + + if(istype(machine, /obj/machinery/firealarm)) + var/obj/machinery/firealarm/fire_alarm = machine + wiresexposed = fire_alarm.wiresexposed + + // if we cant access the wires + if(!machine.panel_open && !wiresexposed) + return ITEM_INTERACT_COMPLETE + + var/datum/wires/internal_wires = machine.get_internal_wires() + var/uncut_wire_count = 0 + if(internal_wires) + uncut_wire_count = length(internal_wires.wires - internal_wires.cut_wires) + + if(prob(50)) + // if the machine isn't powered or we're using a non-conductive fork, we waste our attempt at getting shocked + if(!machine.has_power() || !(flags & CONDUCT)) + to_chat(user, SPAN_NOTICE("You clumsily stick [src] into the open panel of [target].")) + return ITEM_INTERACT_COMPLETE + + to_chat(user, SPAN_DANGER("You stick [src] into the open panel of [target].")) + do_sparks(3, TRUE, machine) + //electrocute the mob, we're not checking distance because some machines are bigger than 1x1 + electrocute_mob(user, get_area(machine), machine, machine.siemens_strength, FALSE) + else if(prob(50) && uncut_wire_count) // 50% of 50% = 25% + to_chat(user, SPAN_NOTICE("You stick [src] into the open panel of [target] and tear one of the wires.")) + internal_wires.cut_random_uncut_wire() + else + to_chat(user, SPAN_NOTICE("You stick [src] into the open panel of [target]. That was fun!")) + + return ITEM_INTERACT_COMPLETE + + /obj/item/kitchen/utensil/pfork name = "plastic fork" desc = "Yay, no washing up to do." diff --git a/code/modules/atmospherics/machinery/airalarm.dm b/code/modules/atmospherics/machinery/airalarm.dm index 963d7e8f57e..4dba80e7957 100644 --- a/code/modules/atmospherics/machinery/airalarm.dm +++ b/code/modules/atmospherics/machinery/airalarm.dm @@ -577,6 +577,9 @@ GLOBAL_LIST_INIT(aalarm_modes, list( update_icon(UPDATE_ICON_STATE) +/obj/machinery/alarm/get_internal_wires() + return wires + /////////////// //END HACKING// /////////////// diff --git a/code/modules/cooking/machines/cooking_machine.dm b/code/modules/cooking/machines/cooking_machine.dm index 3efbe6152d2..c91d814e027 100644 --- a/code/modules/cooking/machines/cooking_machine.dm +++ b/code/modules/cooking/machines/cooking_machine.dm @@ -88,6 +88,9 @@ RESTRICT_TYPE(/obj/machinery/cooking) return /obj/machinery/cooking/item_interaction(mob/living/user, obj/item/used, list/modifiers) + if(istype(used, /obj/item/kitchen/utensil/fork) && panel_open) + return NONE + if(istype(used, /obj/item/storage/part_replacer) || istype(used, /obj/item/autochef_remote)) return ..() diff --git a/code/modules/food_and_drinks/kitchen_machinery/kitchen_machine.dm b/code/modules/food_and_drinks/kitchen_machinery/kitchen_machine.dm index 17df6929e2d..c6e17efb709 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/kitchen_machine.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/kitchen_machine.dm @@ -71,6 +71,9 @@ ********************/ /obj/machinery/kitchen_machine/item_interaction(mob/living/user, obj/item/used, list/modifiers) + if(istype(used, /obj/item/kitchen/utensil/fork)) + return NONE + if(operating) return ITEM_INTERACT_COMPLETE diff --git a/code/modules/food_and_drinks/kitchen_machinery/processor.dm b/code/modules/food_and_drinks/kitchen_machinery/processor.dm index 3a8e410fe85..9bda1301cec 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/processor.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/processor.dm @@ -187,6 +187,9 @@ return 0 /obj/machinery/processor/item_interaction(mob/living/user, obj/item/used, list/modifiers) + if(istype(used, /obj/item/kitchen/utensil/fork)) + return NONE + if(processing) to_chat(user, SPAN_WARNING("\the [src] is already processing something!")) return ITEM_INTERACT_COMPLETE diff --git a/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm b/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm index da075c1cad6..824cefa6392 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm @@ -177,6 +177,9 @@ return ..() /obj/machinery/smartfridge/item_interaction(mob/living/user, obj/item/used, list/modifiers) + if(istype(used, /obj/item/kitchen/utensil/fork)) + return NONE + if(istype(used, /obj/item/storage/part_replacer)) . = ..() SStgui.update_uis(src) diff --git a/code/modules/power/apc/apc.dm b/code/modules/power/apc/apc.dm index 460c2faee89..3e1c1627d14 100644 --- a/code/modules/power/apc/apc.dm +++ b/code/modules/power/apc/apc.dm @@ -1165,6 +1165,9 @@ obj_integrity -= 35 return +/obj/machinery/power/apc/get_internal_wires() + return wires + MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc, 24, 24) MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc/syndicate, 24, 24) MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc/syndicate/off, 24, 24) diff --git a/code/modules/reagents/chemistry/machinery/chem_master.dm b/code/modules/reagents/chemistry/machinery/chem_master.dm index 178b2830602..417063a8325 100644 --- a/code/modules/reagents/chemistry/machinery/chem_master.dm +++ b/code/modules/reagents/chemistry/machinery/chem_master.dm @@ -142,6 +142,9 @@ update_icon() /obj/machinery/chem_master/item_interaction(mob/living/user, obj/item/used, list/modifiers) + if(istype(used, /obj/item/kitchen/utensil/fork)) + return NONE + if(istype(used, /obj/item/storage/part_replacer)) return ..() diff --git a/code/modules/reagents/chemistry/machinery/reagentgrinder.dm b/code/modules/reagents/chemistry/machinery/reagentgrinder.dm index b4054043a84..69acd1025ba 100644 --- a/code/modules/reagents/chemistry/machinery/reagentgrinder.dm +++ b/code/modules/reagents/chemistry/machinery/reagentgrinder.dm @@ -166,6 +166,9 @@ default_unfasten_wrench(user, I) /obj/machinery/reagentgrinder/item_interaction(mob/living/user, obj/item/used, list/modifiers) + if(istype(used, /obj/item/kitchen/utensil/fork)) + return NONE + if(istype(used, /obj/item/storage/part_replacer)) . = ..() SStgui.update_uis(src) diff --git a/code/modules/research/xenobiology/organ_analyzer.dm b/code/modules/research/xenobiology/organ_analyzer.dm index 2cc086985a4..7af123e2778 100644 --- a/code/modules/research/xenobiology/organ_analyzer.dm +++ b/code/modules/research/xenobiology/organ_analyzer.dm @@ -94,6 +94,8 @@ update_appearance(UPDATE_OVERLAYS) /obj/machinery/organ_analyzer/item_interaction(mob/living/user, obj/item/used, list/modifiers) + if(istype(used, /obj/item/kitchen/utensil/fork)) + return NONE if(istype(used, /obj/item/storage/part_replacer)) return ..() if(!istype(used, /obj/item/organ/internal)) diff --git a/code/modules/smithing/machinery/kinetic_assembler.dm b/code/modules/smithing/machinery/kinetic_assembler.dm index 182f84b4503..d5fcfa17342 100644 --- a/code/modules/smithing/machinery/kinetic_assembler.dm +++ b/code/modules/smithing/machinery/kinetic_assembler.dm @@ -141,6 +141,9 @@ return /obj/machinery/smithing/kinetic_assembler/item_interaction(mob/living/user, obj/item/used, list/modifiers) + if(istype(used, /obj/item/kitchen/utensil/fork)) + return NONE + if(istype(used, /obj/item/storage/part_replacer)) return ..() @@ -365,6 +368,9 @@ icon_state = "assembler_wires" /obj/machinery/smithing/scientific_assembler/item_interaction(mob/living/user, obj/item/used, list/modifiers) + if(istype(used, /obj/item/kitchen/utensil/fork)) + return NONE + if(istype(used, /obj/item/storage/part_replacer)) return ..() diff --git a/code/modules/smithing/smith_machinery.dm b/code/modules/smithing/smith_machinery.dm index 5a231f6ba29..0f291605ea5 100644 --- a/code/modules/smithing/smith_machinery.dm +++ b/code/modules/smithing/smith_machinery.dm @@ -46,6 +46,9 @@ . = ..() /obj/machinery/smithing/item_interaction(mob/living/user, obj/item/used, list/modifiers) + if(istype(used, /obj/item/kitchen/utensil/fork)) + return NONE + if(istype(used, /obj/item/grab)) var/obj/item/grab/G = used if(HAS_TRAIT(user, TRAIT_PACIFISM))