From 74d0e6523b14bc1ac78917c59a1b2184d9206f74 Mon Sep 17 00:00:00 2001 From: SteelSlayer <42044220+SteelSlayer@users.noreply.github.com> Date: Fri, 26 Jun 2020 02:18:13 -0500 Subject: [PATCH] Fixes welders blinding you when you repair robo-limbs and cyborgs (#12988) * Fixes welders blinding you while repairing your own robo-limbs * gives tool_start_check() a target argument * flash be gone * CRLF to LF * adds trailing newlines because travis wants them I guess Co-authored-by: SteelSlayer --- code/game/machinery/OpTable.dm | 2 +- code/game/machinery/alarm.dm | 2 +- code/game/machinery/computer/computer.dm | 2 +- code/game/machinery/doors/airlock.dm | 2 +- code/game/machinery/doors/firedoor.dm | 4 ++-- code/game/objects/items/tools/tool_behaviour.dm | 4 ++-- code/game/objects/items/tools/welder.dm | 4 ++-- code/game/objects/structures/curtains.dm | 4 ++-- code/game/objects/structures/dresser.dm | 2 +- code/modules/crafting/craft.dm | 2 +- code/modules/hydroponics/hydroponics.dm | 2 +- code/modules/mining/machine_redemption.dm | 2 +- code/modules/mining/minebot.dm | 2 +- code/modules/power/apc.dm | 2 +- 14 files changed, 18 insertions(+), 18 deletions(-) diff --git a/code/game/machinery/OpTable.dm b/code/game/machinery/OpTable.dm index 7317099b8dc..3bcb9675c50 100644 --- a/code/game/machinery/OpTable.dm +++ b/code/game/machinery/OpTable.dm @@ -136,7 +136,7 @@ /obj/machinery/optable/wrench_act(mob/user, obj/item/I) . = TRUE - if(!I.tool_start_check(user, 0)) + if(!I.tool_start_check(src, user, 0)) return if(I.use_tool(src, user, 20, volume = I.tool_volume)) to_chat(user, "You deconstruct the table.") diff --git a/code/game/machinery/alarm.dm b/code/game/machinery/alarm.dm index a1ae5e974c4..d71c4e7674d 100644 --- a/code/game/machinery/alarm.dm +++ b/code/game/machinery/alarm.dm @@ -991,7 +991,7 @@ if(buildstage != AIR_ALARM_BUILDING) return . = TRUE - if(!I.tool_start_check(user, 0)) + if(!I.tool_start_check(src, user, 0)) return to_chat(user, "You start prying out the circuit.") if(!I.use_tool(src, user, 20, volume = I.tool_volume)) diff --git a/code/game/machinery/computer/computer.dm b/code/game/machinery/computer/computer.dm index aec41c80be3..2ec8611f420 100644 --- a/code/game/machinery/computer/computer.dm +++ b/code/game/machinery/computer/computer.dm @@ -135,7 +135,7 @@ /obj/machinery/computer/screwdriver_act(mob/user, obj/item/I) . = TRUE - if(!I.tool_start_check(user, 0)) + if(!I.tool_start_check(src, user, 0)) return if(circuit && !(flags & NODECONSTRUCT)) if(I.use_tool(src, user, 20, volume = I.tool_volume)) diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index 5aa86873902..1c5668edd7d 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -935,7 +935,7 @@ About the new airlock wires panel: if(!panel_open || user.a_intent == INTENT_HARM) return . = TRUE - if(!I.tool_start_check(user, 0)) + if(!I.tool_start_check(src, user, 0)) return if(security_level == AIRLOCK_SECURITY_PLASTEEL) if(arePowerSystemsOn() && shock(user, 60)) // Protective grille of wiring is electrified diff --git a/code/game/machinery/doors/firedoor.dm b/code/game/machinery/doors/firedoor.dm index 448c410c1c8..37dbdb6c9c0 100644 --- a/code/game/machinery/doors/firedoor.dm +++ b/code/game/machinery/doors/firedoor.dm @@ -419,7 +419,7 @@ if(constructionStep != CONSTRUCTION_WIRES_EXPOSED) return . = TRUE - if(!I.tool_start_check(user, 0)) + if(!I.tool_start_check(src, user, 0)) return user.visible_message("[user] starts cutting the wires from [src]...", \ @@ -442,7 +442,7 @@ if(locate(/obj/machinery/door/firedoor) in get_turf(src)) to_chat(user, "There's already a firelock there.") return - if(!I.tool_start_check(user, 0)) + if(!I.tool_start_check(src, user, 0)) return user.visible_message("[user] starts bolting down [src]...", \ "You begin bolting [src]...") diff --git a/code/game/objects/items/tools/tool_behaviour.dm b/code/game/objects/items/tools/tool_behaviour.dm index 986e3a981b2..136bea77e6a 100644 --- a/code/game/objects/items/tools/tool_behaviour.dm +++ b/code/game/objects/items/tools/tool_behaviour.dm @@ -4,7 +4,7 @@ // No delay means there is no start message, and no reason to call tool_start_check before use_tool. // Run the start check here so we wouldn't have to call it manually. target.add_fingerprint(user) - if(!tool_start_check(user, amount) && !delay) + if(!tool_start_check(target, user, amount) && !delay) return delay *= toolspeed @@ -39,7 +39,7 @@ // Called before use_tool if there is a delay, or by use_tool if there isn't. // Only ever used by welding tools and stacks, so it's not added on any other use_tool checks. -/obj/item/proc/tool_start_check(mob/living/user, amount=0) +/obj/item/proc/tool_start_check(atom/target, mob/living/user, amount=0) return tool_use_check(user, amount) // A check called by tool_start_check once, and by use_tool on every tick of delay. diff --git a/code/game/objects/items/tools/welder.dm b/code/game/objects/items/tools/welder.dm index 54dc1e9aff8..4ac934462a0 100644 --- a/code/game/objects/items/tools/welder.dm +++ b/code/game/objects/items/tools/welder.dm @@ -108,9 +108,9 @@ return FALSE // When welding is about to start, run a normal tool_use_check, then flash a mob if it succeeds. -/obj/item/weldingtool/tool_start_check(mob/living/user, amount=0) +/obj/item/weldingtool/tool_start_check(atom/target, mob/living/user, amount=0) . = tool_use_check(user, amount) - if(. && user) + if(. && user && !ismob(target)) // Don't flash the user if they're repairing robo limbs or repairing a borg etc. Only flash them if the target is an object user.flash_eyes(light_intensity) /obj/item/weldingtool/use(amount) diff --git a/code/game/objects/structures/curtains.dm b/code/game/objects/structures/curtains.dm index e2ab534923d..029b0a761ad 100644 --- a/code/game/objects/structures/curtains.dm +++ b/code/game/objects/structures/curtains.dm @@ -46,7 +46,7 @@ /obj/structure/curtain/screwdriver_act(mob/user, obj/item/I) . = TRUE - if(!I.tool_start_check(user, 0)) + if(!I.tool_start_check(src, user, 0)) return if(anchored) user.visible_message("[user] unscrews [src] from the floor.", "You start to unscrew [src] from the floor...", "You hear rustling noises.") @@ -65,7 +65,7 @@ if(anchored) return . = TRUE - if(!I.tool_start_check(user, 0)) + if(!I.tool_start_check(src, user, 0)) return WIRECUTTER_ATTEMPT_DISMANTLE_MESSAGE if(I.use_tool(src, user, 50, volume = I.tool_volume)) diff --git a/code/game/objects/structures/dresser.dm b/code/game/objects/structures/dresser.dm index 878b03436ff..4531613610e 100644 --- a/code/game/objects/structures/dresser.dm +++ b/code/game/objects/structures/dresser.dm @@ -56,7 +56,7 @@ /obj/structure/dresser/crowbar_act(mob/user, obj/item/I) . = TRUE - if(!I.tool_start_check(user, 0)) + if(!I.tool_start_check(src, user, 0)) return TOOL_ATTEMPT_DISMANTLE_MESSAGE if(I.use_tool(src, user, 50, volume = I.tool_volume)) diff --git a/code/modules/crafting/craft.dm b/code/modules/crafting/craft.dm index a9c47e760e7..a0d6823fe80 100644 --- a/code/modules/crafting/craft.dm +++ b/code/modules/crafting/craft.dm @@ -128,7 +128,7 @@ continue main_loop return FALSE for(var/obj/item/T in tools_used) - if(!T.tool_start_check(user, 0)) //Check if all our tools are valid for their use + if(!T.tool_start_check(null, user, 0)) //Check if all our tools are valid for their use return FALSE return TRUE diff --git a/code/modules/hydroponics/hydroponics.dm b/code/modules/hydroponics/hydroponics.dm index ebccb0611f0..5bc63d4bace 100644 --- a/code/modules/hydroponics/hydroponics.dm +++ b/code/modules/hydroponics/hydroponics.dm @@ -888,7 +888,7 @@ /obj/machinery/hydroponics/wrench_act(mob/user, obj/item/I) . = TRUE - if(!I.tool_start_check(user, 0)) + if(!I.tool_start_check(src, user, 0)) return if(wrenchable) if(using_irrigation) diff --git a/code/modules/mining/machine_redemption.dm b/code/modules/mining/machine_redemption.dm index 7f1b520e7f8..9630395e0cd 100644 --- a/code/modules/mining/machine_redemption.dm +++ b/code/modules/mining/machine_redemption.dm @@ -221,7 +221,7 @@ . = TRUE if(!powered()) return - if(!I.tool_start_check(user, 0)) + if(!I.tool_start_check(src, user, 0)) return input_dir = turn(input_dir, -90) output_dir = turn(output_dir, -90) diff --git a/code/modules/mining/minebot.dm b/code/modules/mining/minebot.dm index 1198e2fb9d3..dbaa24fef34 100644 --- a/code/modules/mining/minebot.dm +++ b/code/modules/mining/minebot.dm @@ -101,7 +101,7 @@ if(user.a_intent != INTENT_HELP) return . = TRUE - if(!I.tool_start_check(user, 0)) + if(!I.tool_start_check(src, user, 0)) return I.melee_attack_chain(user, stored_gun) diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index 2947ab3f5f9..4b8e3bd8c21 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -545,7 +545,7 @@ /obj/machinery/power/apc/crowbar_act(mob/living/user, obj/item/I) . = TRUE - if(!I.tool_start_check(user, 0)) + if(!I.tool_start_check(src, user, 0)) return if(opened) // a) on open apc if(has_electronics==1)