From 495afc5e60a548926ddb9f1b10a2afdf4145f9b0 Mon Sep 17 00:00:00 2001
From: Luc <89928798+lewcc@users.noreply.github.com>
Date: Tue, 30 Jul 2024 08:51:00 -0500
Subject: [PATCH] Moves almost all wrench checks in attackby to wrench_act()
(#25687)
* wrench a bunch of acts
* atmospherics
* some last few things
* last iswrench changes for anything that isn't construction
* Update code/game/machinery/pipe/pipe_construction.dm
Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
Signed-off-by: Luc <89928798+lewcc@users.noreply.github.com>
* Apply suggestions from code review
Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
Signed-off-by: Luc <89928798+lewcc@users.noreply.github.com>
* thank you dgamer
* oopsie daisy
* tests and addresses some introduced bugs
* proper testing
* proper ci
* Update code/game/objects/structures/fluff.dm
Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
Signed-off-by: Luc <89928798+lewcc@users.noreply.github.com>
* Update code/game/objects/structures/fluff.dm
Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
Signed-off-by: Luc <89928798+lewcc@users.noreply.github.com>
* thank you burza :pray:
Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
Signed-off-by: Luc <89928798+lewcc@users.noreply.github.com>
* Apply suggestions from code review
Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
Signed-off-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
* Update code/modules/recycling/disposal-construction.dm
Signed-off-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
---------
Signed-off-by: Luc <89928798+lewcc@users.noreply.github.com>
Signed-off-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
---
code/__HELPERS/tool_helpers.dm | 38 ++---
code/game/machinery/constructable_frame.dm | 4 +-
code/game/machinery/mass_driver.dm | 38 ++---
code/game/machinery/pipe/pipe_construction.dm | 18 +--
code/game/machinery/portable_turret.dm | 134 ++++++++++--------
.../objects/items/mountable_frames/frames.dm | 16 +--
.../items/weapons/grenades/chem_grenade.dm | 2 +-
code/game/objects/structures/electricchair.dm | 21 ++-
code/game/objects/structures/engicart.dm | 41 ++++--
code/game/objects/structures/fluff.dm | 23 +--
code/game/objects/structures/kitchen_spike.dm | 20 +--
.../game/objects/structures/tank_dispenser.dm | 20 +--
code/game/turfs/simulated/floor/plating.dm | 19 ++-
code/modules/assembly/shock_kit.dm | 26 ++--
.../atmospherics/machinery/atmospherics.dm | 121 +++++++++-------
.../components/binary_devices/passive_gate.dm | 9 +-
.../components/binary_devices/pump.dm | 13 +-
.../components/binary_devices/volume_pump.dm | 8 +-
.../unary_devices/outlet_injector.dm | 8 +-
.../unary_devices/portables_connector.dm | 9 +-
.../components/unary_devices/thermomachine.dm | 4 +-
.../components/unary_devices/vent_pump.dm | 5 -
.../components/unary_devices/vent_scrubber.dm | 9 +-
.../atmospherics/machinery/other/meter.dm | 24 ++--
code/modules/mining/equipment/survival_pod.dm | 53 +++----
code/modules/mob/living/silicon/ai/ai_mob.dm | 35 ++---
.../simple_animal/bot/bot_construction.dm | 2 +-
.../power/engines/singularity/collector.dm | 34 ++---
.../engines/singularity/field_generator.dm | 44 +++---
.../power/engines/singularity/singulogen.dm | 28 ++--
.../recycling/disposal-construction.dm | 70 +++++----
code/modules/station_goals/bsa.dm | 61 +++-----
32 files changed, 474 insertions(+), 483 deletions(-)
diff --git a/code/__HELPERS/tool_helpers.dm b/code/__HELPERS/tool_helpers.dm
index c88ee7c6046..b4e3ca5164a 100644
--- a/code/__HELPERS/tool_helpers.dm
+++ b/code/__HELPERS/tool_helpers.dm
@@ -1,35 +1,27 @@
//Quick type checks for some tools
// Why are these not defines?
-/proc/iswrench(O)
- if(istype(O, /obj/item/wrench))
- return TRUE
- return FALSE
-/proc/iswelder(O)
- if(istype(O, /obj/item/weldingtool))
- return TRUE
- return FALSE
+/proc/iswrench(obj/item/O)
+ return istype(O) && O.tool_behaviour == TOOL_WRENCH
-/proc/iswirecutter(O)
- if(istype(O, /obj/item/wirecutters))
- return TRUE
- return FALSE
+/proc/iswelder(obj/item/O)
+ return istype(O) && O.tool_behaviour == TOOL_WELDER
-/proc/isscrewdriver(O)
- if(istype(O, /obj/item/screwdriver))
- return TRUE
- return FALSE
+/proc/iswirecutter(obj/item/O)
+ return istype(O) && O.tool_behaviour == TOOL_WIRECUTTER
-/proc/ismultitool(O)
- if(istype(O, /obj/item/multitool))
- return TRUE
- return FALSE
+/proc/isscrewdriver(obj/item/O)
+ return istype(O) && O.tool_behaviour == TOOL_SCREWDRIVER
+
+/proc/ismultitool(obj/item/O)
+ return istype(O) && O.tool_behaviour == TOOL_MULTITOOL
+
+/proc/iscrowbar(obj/item/O)
+ return istype(O) && O.tool_behaviour == TOOL_CROWBAR
/proc/iscoil(O)
- if(istype(O, /obj/item/stack/cable_coil))
- return TRUE
- return FALSE
+ return istype(O, /obj/item/stack/cable_coil)
/proc/ispowertool(O)//used to check if a tool can force powered doors
if(istype(O, /obj/item/crowbar/power) || istype(O, /obj/item/mecha_parts/mecha_equipment/medical/rescue_jaw))
diff --git a/code/game/machinery/constructable_frame.dm b/code/game/machinery/constructable_frame.dm
index dde8834a2de..8f77132473a 100644
--- a/code/game/machinery/constructable_frame.dm
+++ b/code/game/machinery/constructable_frame.dm
@@ -92,8 +92,8 @@
to_chat(user, "You need five lengths of cable to wire the frame.")
return
- if(istype(P, /obj/item/wrench))
- playsound(src.loc, P.usesound, 75, 1)
+ if(iswrench(P))
+ P.play_tool_sound(src)
to_chat(user, "You dismantle the frame.")
deconstruct(TRUE)
return
diff --git a/code/game/machinery/mass_driver.dm b/code/game/machinery/mass_driver.dm
index 13275d3d61e..377050f7902 100644
--- a/code/game/machinery/mass_driver.dm
+++ b/code/game/machinery/mass_driver.dm
@@ -86,10 +86,10 @@
/obj/machinery/mass_driver_frame/attackby(obj/item/W as obj, mob/user as mob)
switch(build)
if(0) // Loose frame
- if(istype(W, /obj/item/wrench))
- to_chat(user, "You begin to anchor \the [src] on the floor.")
- playsound(get_turf(src), W.usesound, 50, 1)
- if(do_after(user, 10 * W.toolspeed, target = src) && (build == 0))
+ if(iswrench(W))
+ to_chat(user, "You begin to anchor [src] on the floor.")
+ playsound(get_turf(src), W.usesound, 50, TRUE)
+ if(do_after(user, 1 SECONDS * W.toolspeed, target = src) && (build == 0))
to_chat(user, "You anchor \the [src]!")
anchored = TRUE
build++
@@ -97,10 +97,10 @@
return FALSE
if(1) // Fixed to the floor
- if(istype(W, /obj/item/wrench))
- to_chat(user, "You begin to de-anchor \the [src] from the floor.")
- playsound(get_turf(src), W.usesound, 50, 1)
- if(do_after(user, 10 * W.toolspeed, target = src) && (build == 1))
+ if(iswrench(W))
+ to_chat(user, "You begin to de-anchor [src] from the floor.")
+ playsound(get_turf(src), W.usesound, 50, TRUE)
+ if(do_after(user, 1 SECONDS * W.toolspeed, target = src) && (build == 1))
build--
anchored = FALSE
to_chat(user, "You de-anchored \the [src]!")
@@ -108,10 +108,10 @@
return FALSE
if(2) // Welded to the floor
- if(istype(W, /obj/item/stack/cable_coil))
+ if(iscoil(W))
var/obj/item/stack/cable_coil/C = W
- to_chat(user, "You start adding cables to \the [src]...")
- playsound(get_turf(src), C.usesound, 50, 1)
+ to_chat(user, "You start adding cables to [src]...")
+ playsound(get_turf(src), C.usesound, 50, TRUE)
if(do_after(user, 20 * C.toolspeed, target = src) && (C.get_amount() >= 2) && (build == 2))
C.use(2)
to_chat(user, "You've added cables to \the [src].")
@@ -120,10 +120,10 @@
return FALSE
if(3) // Wired
- if(istype(W, /obj/item/wirecutters))
- to_chat(user, "You begin to remove the wiring from \the [src].")
- if(do_after(user, 10 * W.toolspeed, target = src) && (build == 3))
- new /obj/item/stack/cable_coil(loc,2)
+ if(iswirecutter(W))
+ to_chat(user, "You begin to remove the wiring from [src].")
+ if(do_after(user, 1 SECONDS * W.toolspeed, target = src) && (build == 3))
+ new /obj/item/stack/cable_coil(loc, 2)
playsound(get_turf(src), W.usesound, 50, 1)
to_chat(user, "You've removed the cables from \the [src].")
build--
@@ -142,10 +142,10 @@
return FALSE
if(4) // Grille in place
- if(W.tool_behaviour == TOOL_CROWBAR)
- to_chat(user, "You begin to pry off the grille from \the [src]...")
- playsound(get_turf(src), W.usesound, 50, 1)
- if(do_after(user, 30 * W.toolspeed, target = src) && (build == 4))
+ if(iscrowbar(W))
+ to_chat(user, "You begin to pry off the grille from [src]...")
+ playsound(get_turf(src), W.usesound, 50, TRUE)
+ if(do_after(user, 3 SECONDS * W.toolspeed, target = src) && (build == 4))
new /obj/item/stack/rods(loc,2)
build--
return TRUE
diff --git a/code/game/machinery/pipe/pipe_construction.dm b/code/game/machinery/pipe/pipe_construction.dm
index f43e82e8091..e33913c4945 100644
--- a/code/game/machinery/pipe/pipe_construction.dm
+++ b/code/game/machinery/pipe/pipe_construction.dm
@@ -537,18 +537,16 @@
item_state = "buildpipe"
w_class = WEIGHT_CLASS_BULKY
-/obj/item/pipe_meter/attackby(obj/item/W, mob/user, params)
- if(!iswrench(W))
- return ..()
-
+/obj/item/pipe_meter/wrench_act(mob/living/user, obj/item/I)
if(!locate(/obj/machinery/atmospherics/pipe, loc))
- to_chat(user, "You need to fasten it to a pipe")
+ to_chat(user, "You need to fasten it to a pipe.")
return TRUE
new /obj/machinery/atmospherics/meter(loc)
- playsound(loc, W.usesound, 50, 1)
+ I.play_tool_sound(src)
to_chat(user, "You have fastened the meter to the pipe.")
qdel(src)
+ return TRUE
/obj/item/pipe_meter/rpd_act(mob/user, obj/item/rpd/our_rpd)
if(our_rpd.mode == RPD_DELETE_MODE)
@@ -565,15 +563,13 @@
item_state = "buildpipe"
w_class = WEIGHT_CLASS_BULKY
-/obj/item/pipe_gsensor/attackby(obj/item/W, mob/user)
- if(!istype(W, /obj/item/wrench))
- return ..()
-
+/obj/item/pipe_gsensor/wrench_act(mob/living/user, obj/item/I)
var/obj/machinery/atmospherics/air_sensor/AS = new /obj/machinery/atmospherics/air_sensor(loc)
AS.bolts = FALSE
- playsound(get_turf(src), W.usesound, 50, 1)
+ I.play_tool_sound(src, 50)
to_chat(user, "You have fastened the gas sensor.")
qdel(src)
+ return TRUE
/obj/item/pipe_gsensor/rpd_act(mob/user, obj/item/rpd/our_rpd)
if(our_rpd.mode == RPD_DELETE_MODE)
diff --git a/code/game/machinery/portable_turret.dm b/code/game/machinery/portable_turret.dm
index d205332c36a..b186a098125 100644
--- a/code/game/machinery/portable_turret.dm
+++ b/code/game/machinery/portable_turret.dm
@@ -331,52 +331,67 @@ GLOBAL_LIST_EMPTY(turret_icons)
return
update_icon(UPDATE_ICON_STATE)
+/obj/machinery/porta_turret/wrench_act(mob/living/user, obj/item/I)
+ if(enabled || raised)
+ to_chat(user, "You cannot unsecure an active turret!")
+ return
+ if(wrenching)
+ to_chat(user, "Someone is already [anchored ? "un" : ""]securing the turret!")
+ return
+ if(!anchored && isinspace())
+ to_chat(user, "Cannot secure turrets in space!")
+ return
+
+ user.visible_message( \
+ "[user] begins [anchored ? "un" : ""]securing the turret.", \
+ "You begin [anchored ? "un" : ""]securing the turret." \
+ )
+
+ wrenching = TRUE
+ if(I.use_tool(src, user, 2 SECONDS, volume = 50))
+ //This code handles moving the turret around. After all, it's a portable turret!
+ playsound(loc, I.usesound, 100, 1)
+ anchored = !anchored
+ update_icon(UPDATE_ICON_STATE)
+ to_chat(user, "You [anchored ? "" : "un"]secure the exterior bolts on the turret.")
+ wrenching = FALSE
+
+ return TRUE
+
+/obj/machinery/porta_turret/tool_act(mob/living/user, obj/item/I, tool_type)
+ if(user.a_intent != INTENT_HELP)
+ return ..()
+ if(syndicate)
+ to_chat(user, "[src] is sealed tightly, tools won't help here.")
+ return TRUE
+
+ if(!(stat & BROKEN))
+ to_chat(user, "[src] is in fine condition, you'd need to rough it up a bit if you wanted to disassemble it.")
+ return TRUE
+ return ..()
+
+/obj/machinery/porta_turret/crowbar_act(mob/living/user, obj/item/I)
+ . = TRUE
+ to_chat(user, "You begin prying the metal coverings off.")
+ if(!I.use_tool(src, user, 2 SECONDS, 0, 50))
+ return FALSE
+ if(prob(70))
+ to_chat(user, "You remove the turret and salvage some components.")
+ if(installation)
+ var/obj/item/gun/energy/Gun = new installation(loc)
+ Gun.cell.charge = gun_charge
+ Gun.update_icon()
+ if(prob(50))
+ new /obj/item/stack/sheet/metal(loc, rand(1,4))
+ if(prob(50))
+ new /obj/item/assembly/prox_sensor(loc)
+ else
+ to_chat(user, "You remove the turret but did not manage to salvage anything.")
+ qdel(src) // qdel
/obj/machinery/porta_turret/attackby(obj/item/I, mob/user)
if((stat & BROKEN) && !syndicate)
- if(I.tool_behaviour == TOOL_CROWBAR)
- //If the turret is destroyed, you can remove it with a crowbar to
- //try and salvage its components
- to_chat(user, "You begin prying the metal coverings off.")
- if(do_after(user, 20 * I.toolspeed, target = src))
- if(prob(70))
- to_chat(user, "You remove the turret and salvage some components.")
- if(installation)
- var/obj/item/gun/energy/Gun = new installation(loc)
- Gun.cell.charge = gun_charge
- Gun.update_icon()
- if(prob(50))
- new /obj/item/stack/sheet/metal(loc, rand(1,4))
- if(prob(50))
- new /obj/item/assembly/prox_sensor(loc)
- else
- to_chat(user, "You remove the turret but did not manage to salvage anything.")
- qdel(src) // qdel
-
- else if((istype(I, /obj/item/wrench)))
- if(enabled || raised)
- to_chat(user, "You cannot unsecure an active turret!")
- return
- if(wrenching)
- to_chat(user, "Someone is already [anchored ? "un" : ""]securing the turret!")
- return
- if(!anchored && isinspace())
- to_chat(user, "Cannot secure turrets in space!")
- return
-
- user.visible_message( \
- "[user] begins [anchored ? "un" : ""]securing the turret.", \
- "You begin [anchored ? "un" : ""]securing the turret." \
- )
-
- wrenching = TRUE
- if(do_after(user, 50 * I.toolspeed, target = src))
- //This code handles moving the turret around. After all, it's a portable turret!
- playsound(loc, I.usesound, 100, 1)
- anchored = !anchored
- update_icon(UPDATE_ICON_STATE)
- to_chat(user, "You [anchored ? "" : "un"]secure the exterior bolts on the turret.")
- wrenching = FALSE
+ return
else if(istype(I, /obj/item/card/id) || istype(I, /obj/item/pda))
if(HasController())
@@ -388,17 +403,22 @@ GLOBAL_LIST_EMPTY(turret_icons)
else
to_chat(user, "Access denied.")
- else
- //if the turret was attacked with the intention of harming it:
- user.changeNext_move(CLICK_CD_MELEE)
- playsound(src.loc, 'sound/weapons/smash.ogg', 60, 1)
- if(I.force * 0.5 > 1) //if the force of impact dealt at least 1 damage, the turret gets pissed off
- if(!attacked && !emagged)
- attacked = TRUE
- spawn(60)
- attacked = FALSE
+ return TRUE
+
+ if(user.a_intent == INTENT_HELP)
+ return ..()
+ // otherwise, if the turret was attacked with the intention of harming it:
+ user.changeNext_move(CLICK_CD_MELEE)
+ user.do_item_attack_animation()
+ playsound(src.loc, 'sound/weapons/smash.ogg', 60, 1)
+ if(I.force * 0.5 > 1) //if the force of impact dealt at least 1 damage, the turret gets pissed off
+ if(!attacked && !emagged)
+ attacked = TRUE
+ addtimer(VARSET_CALLBACK(src, attacked, FALSE), 6 SECONDS)
+
+ ..()
+
- ..()
/obj/machinery/porta_turret/attack_animal(mob/living/simple_animal/M)
M.changeNext_move(CLICK_CD_MELEE)
@@ -854,7 +874,7 @@ GLOBAL_LIST_EMPTY(turret_icons)
//this is a bit unwieldy but self-explanatory
switch(build_step)
if(0) //first step
- if(istype(I, /obj/item/wrench) && !anchored)
+ if(iswrench(I) && !anchored)
playsound(loc, I.usesound, 100, 1)
to_chat(user, "You secure the external bolts.")
anchored = TRUE
@@ -879,7 +899,7 @@ GLOBAL_LIST_EMPTY(turret_icons)
to_chat(user, "You need two sheets of metal to continue construction.")
return
- else if(istype(I, /obj/item/wrench))
+ else if(iswrench(I))
playsound(loc, I.usesound, 75, 1)
to_chat(user, "You unfasten the external bolts.")
anchored = FALSE
@@ -888,7 +908,7 @@ GLOBAL_LIST_EMPTY(turret_icons)
if(2)
- if(istype(I, /obj/item/wrench))
+ if(iswrench(I))
playsound(loc, I.usesound, 100, 1)
to_chat(user, "You bolt the metal armor into place.")
build_step = 3
@@ -921,7 +941,7 @@ GLOBAL_LIST_EMPTY(turret_icons)
qdel(I) //delete the gun :( qdel
return
- else if(istype(I, /obj/item/wrench))
+ else if(iswrench(I))
playsound(loc, I.usesound, 100, 1)
to_chat(user, "You remove the turret's metal armor bolts.")
build_step = 2
diff --git a/code/game/objects/items/mountable_frames/frames.dm b/code/game/objects/items/mountable_frames/frames.dm
index 6f35d17317c..5823064a91a 100644
--- a/code/game/objects/items/mountable_frames/frames.dm
+++ b/code/game/objects/items/mountable_frames/frames.dm
@@ -12,15 +12,13 @@
///The requirements for this frame to be placed, uses bit flags
var/mount_requirements = 0
-/obj/item/mounted/frame/attackby(obj/item/W, mob/user)
- ..()
- if(istype(W, /obj/item/wrench))
- var/turf/user_turf = get_turf(user)
- if(metal_sheets_refunded)
- new /obj/item/stack/sheet/metal(user_turf, metal_sheets_refunded)
- if(glass_sheets_refunded)
- new /obj/item/stack/sheet/glass(user_turf, glass_sheets_refunded)
- qdel(src)
+/obj/item/mounted/frame/wrench_act(mob/living/user, obj/item/I)
+ var/turf/user_turf = get_turf(user)
+ if(metal_sheets_refunded)
+ new /obj/item/stack/sheet/metal(user_turf, metal_sheets_refunded)
+ if(glass_sheets_refunded)
+ new /obj/item/stack/sheet/glass(user_turf, glass_sheets_refunded)
+ qdel(src)
/obj/item/mounted/frame/try_build(turf/on_wall, mob/user)
if(!..())
diff --git a/code/game/objects/items/weapons/grenades/chem_grenade.dm b/code/game/objects/items/weapons/grenades/chem_grenade.dm
index 2e73d0a6174..62acbe2d863 100644
--- a/code/game/objects/items/weapons/grenades/chem_grenade.dm
+++ b/code/game/objects/items/weapons/grenades/chem_grenade.dm
@@ -175,7 +175,7 @@
stage = WIRED
update_icon(UPDATE_ICON_STATE)
- else if(stage == WIRED && istype(I, /obj/item/wrench))
+ else if(stage == WIRED && iswrench(I))
to_chat(user, "You open the grenade and remove the contents.")
stage = EMPTY
payload_name = null
diff --git a/code/game/objects/structures/electricchair.dm b/code/game/objects/structures/electricchair.dm
index 9eacf37ffb5..3753873db31 100644
--- a/code/game/objects/structures/electricchair.dm
+++ b/code/game/objects/structures/electricchair.dm
@@ -29,17 +29,16 @@
. = ..()
. += "You can Alt-Click [src] to activate it."
-/obj/structure/chair/e_chair/attackby(obj/item/W as obj, mob/user as mob, params)
- if(istype(W, /obj/item/wrench))
- var/obj/structure/chair/C = new /obj/structure/chair(loc)
- playsound(loc, W.usesound, 50, 1)
- C.dir = dir
- part.loc = loc
- part.master = null
- part = null
- qdel(src)
- return
- return ..()
+/obj/structure/chair/e_chair/wrench_act(mob/user, obj/item/I)
+ . = TRUE
+ var/obj/structure/chair/C = new /obj/structure/chair(loc)
+ I.play_tool_sound(src, 50)
+ C.dir = dir
+ part.loc = loc
+ part.master = null
+ part = null
+ visible_message("[user] deconstructs [src].")
+ qdel(src)
/obj/structure/chair/e_chair/AltClick(mob/user)
if(user.stat || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED) || !Adjacent(user))
diff --git a/code/game/objects/structures/engicart.dm b/code/game/objects/structures/engicart.dm
index 7a605c46ff6..37b69f505c1 100644
--- a/code/game/objects/structures/engicart.dm
+++ b/code/game/objects/structures/engicart.dm
@@ -82,24 +82,35 @@
update_icon(UPDATE_OVERLAYS)
else
to_chat(user, fail_msg)
- else if(istype(I, /obj/item/wrench))
- if(!anchored && !isinspace())
- playsound(src.loc, I.usesound, 50, 1)
- user.visible_message( \
- "[user] tightens \the [src]'s casters.", \
- " You have tightened \the [src]'s casters.", \
- "You hear ratchet.")
- anchored = TRUE
- else if(anchored)
- playsound(src.loc, I.usesound, 50, 1)
- user.visible_message( \
- "[user] loosens \the [src]'s casters.", \
- " You have loosened \the [src]'s casters.", \
- "You hear ratchet.")
- anchored = FALSE
else
to_chat(usr, "You cannot interface your modules [src]!")
+/obj/structure/engineeringcart/tool_act(mob/living/user, obj/item/I, tool_type)
+ if(I.is_robot_module())
+ to_chat(user, "You cannot interface your modules [src]!")
+ return FALSE
+ return ..()
+
+/obj/structure/engineeringcart/wrench_act(mob/living/user, obj/item/I)
+ if(!anchored && !isinspace())
+ I.play_tool_sound(src, I.tool_volume)
+ user.visible_message(
+ "[user] tightens [src]'s casters.",
+ "You have tightened [src]'s casters.",
+ "You hear ratchet."
+ )
+ anchored = TRUE
+ else if(anchored)
+ I.play_tool_sound(src, I.tool_volume)
+ user.visible_message(
+ "[user] loosens [src]'s casters.",
+ " You have loosened [src]'s casters.",
+ "You hear ratchet."
+ )
+ anchored = FALSE
+
+ return TRUE
+
/obj/structure/engineeringcart/attack_hand(mob/user)
var/list/engicart_items = list()
diff --git a/code/game/objects/structures/fluff.dm b/code/game/objects/structures/fluff.dm
index f816563f3a9..8dd48277574 100644
--- a/code/game/objects/structures/fluff.dm
+++ b/code/game/objects/structures/fluff.dm
@@ -10,17 +10,18 @@
opacity = FALSE
var/deconstructible = TRUE
-/obj/structure/fluff/attackby(obj/item/I, mob/living/user, params)
- if(istype(I, /obj/item/wrench) && deconstructible)
- user.visible_message("[user] starts disassembling [src]...", "You start disassembling [src]...")
- playsound(loc, I.usesound, 50, 1)
- if(do_after(user, 5 SECONDS * I.toolspeed, target = src))
- user.visible_message("[user] disassembles [src]!", "You break down [src] into scrap metal.")
- playsound(user, 'sound/items/deconstruct.ogg', 50, 1)
- new /obj/item/stack/sheet/metal(drop_location())
- qdel(src)
- return
- return ..()
+/obj/structure/fluff/wrench_act(mob/living/user, obj/item/I)
+ if(!deconstructible)
+ return FALSE
+
+ user.visible_message("[user] starts disassembling [src]...", "You start disassembling [src]...")
+ playsound(loc, I.usesound, 50, TRUE)
+ if(I.use_tool(src, user, 5 SECONDS, 0, 50))
+ user.visible_message("[user] disassembles [src]!", "You break down [src] into scrap metal.")
+ playsound(user, 'sound/items/deconstruct.ogg', 50, TRUE)
+ new /obj/item/stack/sheet/metal(drop_location())
+ qdel(src)
+ return TRUE
/// Empty terrariums are created when a preserved terrarium in a lavaland seed vault is activated.
/obj/structure/fluff/empty_terrarium
diff --git a/code/game/objects/structures/kitchen_spike.dm b/code/game/objects/structures/kitchen_spike.dm
index 6ed12684b0d..e9535513771 100644
--- a/code/game/objects/structures/kitchen_spike.dm
+++ b/code/game/objects/structures/kitchen_spike.dm
@@ -10,17 +10,19 @@
anchored = TRUE
max_integrity = 200
+/obj/structure/kitchenspike_frame/wrench_act(mob/living/user, obj/item/I)
+ if(!I.tool_use_check(user, 0))
+ return FALSE
+ TOOL_ATTEMPT_DISMANTLE_MESSAGE
+ if(!I.use_tool(src, user, 4 SECONDS, volume = I.tool_volume))
+ return TRUE
+ TOOL_DISMANTLE_SUCCESS_MESSAGE
+ deconstruct(TRUE)
+ return TRUE
+
/obj/structure/kitchenspike_frame/attackby(obj/item/I, mob/user, params)
add_fingerprint(user)
- if(istype(I, /obj/item/wrench))
- if(!I.tool_use_check(user, 0))
- return
- TOOL_ATTEMPT_DISMANTLE_MESSAGE
- if(!I.use_tool(src, user, 40, volume = I.tool_volume))
- return
- TOOL_DISMANTLE_SUCCESS_MESSAGE
- deconstruct(TRUE)
- else if(istype(I, /obj/item/stack/rods))
+ if(istype(I, /obj/item/stack/rods))
var/obj/item/stack/rods/R = I
if(R.get_amount() >= 4)
R.use(4)
diff --git a/code/game/objects/structures/tank_dispenser.dm b/code/game/objects/structures/tank_dispenser.dm
index d38485b0c9b..b5e20b076c9 100644
--- a/code/game/objects/structures/tank_dispenser.dm
+++ b/code/game/objects/structures/tank_dispenser.dm
@@ -103,17 +103,19 @@
if(istype(I, /obj/item/tank/internals/plasma))
try_insert_tank(user, stored_plasma_tanks, I)
return
-
- if(istype(I, /obj/item/wrench))
- if(anchored)
- to_chat(user, "You lean down and unwrench [src].")
- anchored = FALSE
- else
- to_chat(user, "You wrench [src] into place.")
- anchored = TRUE
- return
return ..()
+/obj/structure/dispenser/wrench_act(mob/living/user, obj/item/I)
+ I.play_tool_sound(src, 50)
+ if(anchored)
+ to_chat(user, "You lean down and unwrench [src].")
+ anchored = FALSE
+ else
+ to_chat(user, "You wrench [src] into place.")
+ anchored = TRUE
+ return TRUE
+
+
/// Called when the user clicks on the oxygen or plasma tank UI buttons, and tries to withdraw a tank.
/obj/structure/dispenser/proc/try_remove_tank(mob/living/user, list/tank_list)
if(!LAZYLEN(tank_list))
diff --git a/code/game/turfs/simulated/floor/plating.dm b/code/game/turfs/simulated/floor/plating.dm
index 6e34004f1ea..b2c1e360830 100644
--- a/code/game/turfs/simulated/floor/plating.dm
+++ b/code/game/turfs/simulated/floor/plating.dm
@@ -208,17 +208,16 @@
acidpwr = min(acidpwr, 50) //we reduce the power so reinf floor never get melted.
. = ..()
-/turf/simulated/floor/engine/attackby(obj/item/C as obj, mob/user as mob, params)
- if(!C || !user)
+/turf/simulated/floor/engine/wrench_act(mob/living/user, obj/item/wrench/W)
+ if(!user)
return
- if(istype(C, /obj/item/wrench))
- to_chat(user, "You begin removing rods...")
- playsound(src, C.usesound, 80, 1)
- if(do_after(user, 30 * C.toolspeed, target = src))
- if(!istype(src, /turf/simulated/floor/engine))
- return
- new /obj/item/stack/rods(src, 2)
- ChangeTurf(/turf/simulated/floor/plating)
+ . = TRUE
+ to_chat(user, "You begin removing rods...")
+ if(W.use_tool(src, user, 3 SECONDS, 0, 50))
+ if(!istype(src, /turf/simulated/floor/engine))
+ return
+ new /obj/item/stack/rods(src, 2)
+ ChangeTurf(/turf/simulated/floor/plating)
/turf/simulated/floor/engine/ex_act(severity)
switch(severity)
diff --git a/code/modules/assembly/shock_kit.dm b/code/modules/assembly/shock_kit.dm
index d8d0ca7cbc6..02a5f9d9739 100644
--- a/code/modules/assembly/shock_kit.dm
+++ b/code/modules/assembly/shock_kit.dm
@@ -14,18 +14,20 @@
QDEL_NULL(part2)
return ..()
-/obj/item/assembly/shock_kit/attackby(obj/item/W as obj, mob/user as mob, params)
- if(istype(W, /obj/item/wrench) && !status)
- var/turf/T = loc
- if(ismob(T))
- T = T.loc
- part1.loc = T
- part2.loc = T
- part1.master = null
- part2.master = null
- part1 = null
- part2 = null
- qdel(src)
+/obj/item/assembly/shock_kit/wrench_act(mob/living/user, obj/item/I)
+ if(status)
+ return
+ . = TRUE
+ var/turf/T = get_turf(src)
+ part1?.forceMove(T)
+ part2?.forceMove(T)
+ part1?.master = null
+ part2?.master = null
+ part1 = null
+ part2 = null
+ visible_message("[user] disassembles [src].")
+ qdel(src)
+ return TRUE
/obj/item/assembly/shock_kit/screwdriver_act(mob/user, obj/item/I)
status = !status
diff --git a/code/modules/atmospherics/machinery/atmospherics.dm b/code/modules/atmospherics/machinery/atmospherics.dm
index 2ce2e9343d8..a42659c1302 100644
--- a/code/modules/atmospherics/machinery/atmospherics.dm
+++ b/code/modules/atmospherics/machinery/atmospherics.dm
@@ -50,6 +50,9 @@ Pipelines + Other Objects -> Pipe network
/// ID for automatic linkage of stuff. This is used to assist in connections at mapload. Dont try use it for other stuff
var/autolink_id = null
+ /// Whether or not this can be unwrenched while on.
+ var/can_unwrench_while_on = TRUE
+
/obj/machinery/atmospherics/Initialize(mapload)
. = ..()
@@ -189,63 +192,73 @@ Pipelines + Other Objects -> Pipe network
if(P)
P.other_atmosmch -= src
+/obj/machinery/atmospherics/wrench_act(mob/living/user, obj/item/wrench/W)
+ var/turf/T = get_turf(src)
+ if(!can_unwrench_while_on && !(stat & NOPOWER) && on)
+ to_chat(user, "You cannot unwrench this [name], turn it off first.")
+ return TRUE
+ if(!can_unwrench)
+ return FALSE
+ . = TRUE
+ if(level == 1 && T.transparent_floor && istype(src, /obj/machinery/atmospherics/pipe))
+ to_chat(user, "You can't interact with something that's under the floor!")
+ return
+ if(level == 1 && isturf(T) && T.intact)
+ to_chat(user, "You must remove the plating first.")
+ return
+ var/datum/gas_mixture/int_air = return_obj_air()
+ var/datum/gas_mixture/env_air = T.get_readonly_air()
+ add_fingerprint(user)
+
+
+ var/unsafe_wrenching = FALSE
+ var/safefromgusts = FALSE
+ var/I = int_air ? int_air.return_pressure() : 0
+ var/E = env_air ? env_air.return_pressure() : 0
+ var/internal_pressure = I - E
+
+ to_chat(user, "You begin to unfasten [src]...")
+
+ if(HAS_TRAIT(user, TRAIT_MAGPULSE))
+ safefromgusts = TRUE
+
+ if(internal_pressure > 2 * ONE_ATMOSPHERE)
+ unsafe_wrenching = TRUE //Oh dear oh dear
+ if(internal_pressure > 1750 && !safefromgusts) // 1750 is the pressure limit to do 60 damage when thrown
+ to_chat(user, "As you struggle to unwrench [src] a huge gust of gas blows in your face! This seems like a terrible idea!")
+ else
+ to_chat(user, "As you begin unwrenching [src] a gust of air blows in your face... maybe you should reconsider?")
+
+ if(!W.use_tool(src, user, 4 SECONDS, volume = 50) || QDELETED(src))
+ return
+
+ safefromgusts = FALSE
+
+ if(HAS_TRAIT(user, TRAIT_MAGPULSE))
+ safefromgusts = TRUE
+
+ user.visible_message(
+ "[user] unfastens [src].",
+ "You have unfastened [src].",
+ "You hear ratcheting."
+ )
+ investigate_log("was REMOVED by [key_name(usr)]", "atmos")
+
+ //You unwrenched a pipe full of pressure? let's splat you into the wall silly.
+ if(unsafe_wrenching)
+ if(safefromgusts)
+ to_chat(user, "Your magboots cling to the floor as a great burst of wind bellows against you.")
+ else
+ unsafe_pressure_release(user,internal_pressure)
+ deconstruct(TRUE)
+
//(De)construction
/obj/machinery/atmospherics/attackby(obj/item/W, mob/user)
var/turf/T = get_turf(src)
- if(can_unwrench && istype(W, /obj/item/wrench))
- if(level == 1 && T.transparent_floor && istype(src, /obj/machinery/atmospherics/pipe))
- to_chat(user, "You can't interact with something that's under the floor!")
- return
- if(level == 1 && isturf(T) && T.intact)
- to_chat(user, "You must remove the plating first.")
- return
- var/datum/gas_mixture/int_air = return_obj_air()
- var/datum/gas_mixture/env_air = T.get_readonly_air()
- add_fingerprint(user)
-
- var/unsafe_wrenching = FALSE
- var/safefromgusts = FALSE
- var/I = int_air ? int_air.return_pressure() : 0
- var/E = env_air ? env_air.return_pressure() : 0
- var/internal_pressure = I - E
-
- playsound(loc, W.usesound, 50, 1)
- to_chat(user, "You begin to unfasten \the [src]...")
-
- if(HAS_TRAIT(user, TRAIT_MAGPULSE))
- safefromgusts = TRUE
-
- if(internal_pressure > 2 * ONE_ATMOSPHERE)
- unsafe_wrenching = TRUE //Oh dear oh dear
- if(internal_pressure > 1750 && !safefromgusts) // 1750 is the pressure limit to do 60 damage when thrown
- to_chat(user, "As you struggle to unwrench [src] a huge gust of gas blows in your face! This seems like a terrible idea!")
- else
- to_chat(user, "As you begin unwrenching [src] a gust of air blows in your face... maybe you should reconsider?")
-
- if(do_after(user, 40 * W.toolspeed, target = src) && !QDELETED(src))
- safefromgusts = FALSE
-
- if(HAS_TRAIT(user, TRAIT_MAGPULSE))
- safefromgusts = TRUE
-
- user.visible_message( \
- "[user] unfastens [src].", \
- "You have unfastened [src].", \
- "You hear ratcheting.")
- investigate_log("was REMOVED by [key_name(usr)]", "atmos")
-
- //You unwrenched a pipe full of pressure? let's splat you into the wall silly.
- if(unsafe_wrenching)
- if(safefromgusts)
- to_chat(user, "Your magboots cling to the floor as a great burst of wind bellows against you.")
- else
- unsafe_pressure_release(user,internal_pressure)
- deconstruct(TRUE)
- else
- if(T.transparent_floor)
- to_chat(user, "You can't interact with something that's under the floor!")
- return TRUE
- return ..()
+ if(T.transparent_floor)
+ to_chat(user, "You can't interact with something that's under the floor!")
+ return TRUE
+ return ..()
//Called when an atmospherics object is unwrenched while having a large pressure difference
//with it's locs air contents.
diff --git a/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm b/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm
index 8f0b25cbb2e..d372c47af00 100644
--- a/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm
+++ b/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm
@@ -8,6 +8,7 @@
desc = "A one-way air valve that does not require power"
can_unwrench = TRUE
+ can_unwrench_while_on = FALSE
target_pressure = ONE_ATMOSPHERE
@@ -126,11 +127,3 @@
. = TRUE
if(.)
investigate_log("was set to [target_pressure] kPa by [key_name(usr)]", "atmos")
-
-/obj/machinery/atmospherics/binary/passive_gate/attackby(obj/item/W, mob/user, params)
- if(!istype(W, /obj/item/wrench))
- return ..()
- if(on)
- to_chat(user, "You cannot unwrench this [src], turn it off first.")
- return 1
- return ..()
diff --git a/code/modules/atmospherics/machinery/components/binary_devices/pump.dm b/code/modules/atmospherics/machinery/components/binary_devices/pump.dm
index 86f63455d99..25c0758b0ae 100644
--- a/code/modules/atmospherics/machinery/components/binary_devices/pump.dm
+++ b/code/modules/atmospherics/machinery/components/binary_devices/pump.dm
@@ -13,13 +13,13 @@ Thus, the two variables affect pump operation are set in New():
*/
/obj/machinery/atmospherics/binary/pump
+ name = "gas pump"
+ desc = "A pump."
icon = 'icons/atmos/pump.dmi'
icon_state = "map_off"
- name = "gas pump"
- desc = "A pump"
-
can_unwrench = TRUE
+ can_unwrench_while_on = FALSE
target_pressure = ONE_ATMOSPHERE
@@ -160,10 +160,5 @@ Thus, the two variables affect pump operation are set in New():
/obj/machinery/atmospherics/binary/pump/attackby(obj/item/W, mob/user, params)
if(is_pen(W))
rename_interactive(user, W)
- return
- else if(!istype(W, /obj/item/wrench))
- return ..()
- if(!(stat & NOPOWER) && on)
- to_chat(user, "You cannot unwrench this [src], turn it off first.")
- return 1
+ return TRUE
return ..()
diff --git a/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm b/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm
index cce6166a223..cdea20e78b1 100644
--- a/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm
+++ b/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm
@@ -20,6 +20,7 @@ Thus, the two variables affect pump operation are set in New():
desc = "A volumetric pump"
can_unwrench = TRUE
+ can_unwrench_while_on = FALSE
var/transfer_rate = 200
@@ -155,10 +156,5 @@ Thus, the two variables affect pump operation are set in New():
/obj/machinery/atmospherics/binary/volume_pump/attackby(obj/item/W, mob/user, params)
if(is_pen(W))
rename_interactive(user, W)
- return
- else if(!istype(W, /obj/item/wrench))
- return ..()
- if(!(stat & NOPOWER) && on)
- to_chat(user, "You cannot unwrench this [src], turn it off first.")
- return 1
+ return TRUE
return ..()
diff --git a/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm b/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm
index d320f0fb4f5..9329f4a46a0 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm
@@ -10,6 +10,7 @@ GLOBAL_LIST_EMPTY(air_injectors)
resistance_flags = FIRE_PROOF | UNACIDABLE | ACID_PROOF //really helpful in building gas chambers for xenomorphs
can_unwrench = TRUE
+ can_unwrench_while_on = TRUE
name = "air injector"
desc = "Has a valve and pump attached to it."
@@ -78,10 +79,3 @@ GLOBAL_LIST_EMPTY(air_injectors)
var/obj/item/multitool/M = I
M.buffer_uid = UID()
to_chat(user, "You save [src] into [M]'s buffer")
-
-/obj/machinery/atmospherics/unary/outlet_injector/attackby(obj/item/W, mob/user)
- if(iswrench(W))
- if(!(stat & NOPOWER) && on)
- to_chat(user, "You cannot unwrench this [src], turn if off first.")
- return TRUE
- return ..()
diff --git a/code/modules/atmospherics/machinery/components/unary_devices/portables_connector.dm b/code/modules/atmospherics/machinery/components/unary_devices/portables_connector.dm
index c3cfc1990b3..ed2179aef1f 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/portables_connector.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/portables_connector.dm
@@ -32,11 +32,10 @@
return 0
parent.update = 1
-/obj/machinery/atmospherics/unary/portables_connector/attackby(obj/item/W as obj, mob/user as mob, params)
- if(istype(W, /obj/item/wrench))
- if(connected_device)
- to_chat(user, "You cannot unwrench this [src], detach [connected_device] first.")
- return 1
+/obj/machinery/atmospherics/unary/portables_connector/wrench_act(mob/living/user, obj/item/wrench/W)
+ if(connected_device)
+ to_chat(user, "You cannot unwrench this [name], detach [connected_device] first.")
+ return TRUE
return ..()
/obj/machinery/atmospherics/unary/portables_connector/portableConnectorReturnAir()
diff --git a/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm b/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm
index 627f04e8a14..731d9c8ccba 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm
@@ -131,11 +131,11 @@
/obj/machinery/atmospherics/unary/thermomachine/wrench_act(mob/user, obj/item/I)
. = TRUE
- if(!I.use_tool(src, user, 0, volume = I.tool_volume))
- return
if(!panel_open)
to_chat(user, "Open the maintenance panel first.")
return
+ if(!I.use_tool(src, user, 0, volume = I.tool_volume))
+ return
var/list/choices = list("West" = WEST, "East" = EAST, "South" = SOUTH, "North" = NORTH)
var/selected = tgui_input_list(user, "Select a direction for the connector.", "Connector Direction", choices)
if(!selected)
diff --git a/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm b/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm
index bc4eba9414c..6bf7a368259 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm
@@ -195,11 +195,6 @@
to_chat(user, "The vent is welded.")
return TRUE
- if(iswrench(W))
- if(!(stat & NOPOWER) && on)
- to_chat(user, "You cannot unwrench this [src], turn it off first.")
- return TRUE
-
return ..()
/obj/machinery/atmospherics/unary/vent_pump/multitool_act(mob/living/user, obj/item/I)
diff --git a/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm b/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm
index c43ab00ad58..6184c5e4ba0 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm
@@ -9,6 +9,7 @@
power_state = ACTIVE_POWER_USE
idle_power_consumption = 10
active_power_consumption = 60
+ can_unwrench_while_on = FALSE
can_unwrench = TRUE
@@ -215,14 +216,6 @@
pipe_image.plane = ABOVE_HUD_PLANE
playsound(loc, 'sound/weapons/bladeslice.ogg', 100, TRUE)
-/obj/machinery/atmospherics/unary/vent_scrubber/attackby(obj/item/W, mob/user, params)
- if(istype(W, /obj/item/wrench))
- if(!(stat & NOPOWER) && on)
- to_chat(user, "You cannot unwrench this [src], turn it off first.")
- return TRUE
-
- return ..()
-
/obj/machinery/atmospherics/unary/vent_scrubber/welder_act(mob/user, obj/item/I)
. = TRUE
if(!I.tool_use_check(user, 0))
diff --git a/code/modules/atmospherics/machinery/other/meter.dm b/code/modules/atmospherics/machinery/other/meter.dm
index 032ffa60068..0f6deb15046 100644
--- a/code/modules/atmospherics/machinery/other/meter.dm
+++ b/code/modules/atmospherics/machinery/other/meter.dm
@@ -83,17 +83,19 @@ GLOBAL_LIST_EMPTY(gas_meters)
return ..()
-/obj/machinery/atmospherics/meter/attackby(obj/item/W as obj, mob/user as mob, params)
- if(!iswrench(W))
- return ..()
- playsound(loc, W.usesound, 50, 1)
- to_chat(user, "You begin to unfasten \the [src]...")
- if(do_after(user, 40 * W.toolspeed, target = src))
- user.visible_message( \
- "[user] unfastens \the [src].", \
- "You have unfastened \the [src].", \
- "You hear ratchet.")
- deconstruct(TRUE)
+/obj/machinery/atmospherics/meter/wrench_act(mob/living/user, obj/item/wrench/W)
+ // don't call parent here, we're kind of different
+ to_chat(user, "You begin to unfasten [src]...")
+ if(!W.use_tool(src, user, volume = W.tool_volume))
+ return
+
+ user.visible_message(
+ "[user] unfastens [src].",
+ "You have unfastened [src].",
+ "You hear ratchet."
+ )
+ deconstruct(TRUE)
+ return TRUE
/obj/machinery/atmospherics/meter/deconstruct(disassembled = TRUE)
if(!(flags & NODECONSTRUCT))
diff --git a/code/modules/mining/equipment/survival_pod.dm b/code/modules/mining/equipment/survival_pod.dm
index f6ec847f923..2cab7e57907 100644
--- a/code/modules/mining/equipment/survival_pod.dm
+++ b/code/modules/mining/equipment/survival_pod.dm
@@ -201,15 +201,16 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/economy/vending/wallmed/survival_pod,
density = TRUE
pixel_y = -32
-/obj/item/gps/computer/attackby(obj/item/W, mob/user, params)
- if(istype(W, /obj/item/wrench))
- playsound(loc, W.usesound, 50, 1)
- user.visible_message("[user] disassembles the gps.", \
- "You start to disassemble the gps...", "You hear clanking and banging noises.")
- if(do_after(user, 20 * W.toolspeed, target = src))
- new /obj/item/gps(loc)
- qdel(src)
- return ..()
+/obj/item/gps/computer/wrench_act(mob/living/user, obj/item/I)
+ . = TRUE
+ user.visible_message("[user] starts to disassemble [src].", \
+ "You start to disassemble [src]...", "You hear clanking and banging noises.")
+ if(!I.use_tool(src, user, 2 SECONDS, 0, 50))
+ return
+ user.visible_message("[user] disassembles [src].", \
+ "You disassemble [src].", "You hear clanking and banging noises.")
+ new /obj/item/gps(loc)
+ qdel(src)
/obj/item/gps/computer/attack_hand(mob/user)
attack_self(user)
@@ -296,14 +297,15 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/economy/vending/wallmed/survival_pod,
new buildstacktype(loc, buildstackamount)
qdel(src)
-/obj/structure/fans/attackby(obj/item/W, mob/user, params)
- if(istype(W, /obj/item/wrench))
- playsound(loc, W.usesound, 50, 1)
- user.visible_message("[user] disassembles the fan.", \
- "You start to disassemble the fan...", "You hear clanking and banging noises.")
- if(do_after(user, 20 * W.toolspeed, target = src))
- deconstruct()
- return ..()
+/obj/structure/fans/wrench_act(mob/living/user, obj/item/I)
+ . = TRUE
+ user.visible_message("[user] starts to disassemble [src].", \
+ "You start to disassemble [src]...", "You hear clanking and banging noises.")
+ if(!I.use_tool(src, user, 2 SECONDS, volume = 50))
+ return
+ user.visible_message("[user] disassembles [src].", \
+ "You disassemble [src].", "You hear something fall on the floor.")
+ deconstruct()
/obj/structure/fans/tiny
name = "tiny fan"
@@ -343,15 +345,14 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/economy/vending/wallmed/survival_pod,
layer = MOB_LAYER - 0.2
density = FALSE
-/obj/structure/tubes/attackby(obj/item/W, mob/user, params)
- if(istype(W, /obj/item/wrench))
- playsound(loc, W.usesound, 50, 1)
- user.visible_message("[user] disassembles [src].", \
- "You start to disassemble [src]...", "You hear clanking and banging noises.")
- if(do_after(user, 20 * W.toolspeed, target = src))
- new /obj/item/stack/rods(loc)
- qdel(src)
- return ..()
+/obj/structure/tubes/wrench_act(mob/living/user, obj/item/W)
+ . = TRUE
+ user.visible_message("[user] disassembles [src].", \
+ "You start to disassemble [src]...", "You hear clanking and banging noises.")
+ if(!W.use_tool(src, user, 2 SECONDS, volume = 50))
+ return
+ new /obj/item/stack/rods(loc)
+ qdel(src)
/obj/item/fakeartefact
name = "expensive forgery"
diff --git a/code/modules/mob/living/silicon/ai/ai_mob.dm b/code/modules/mob/living/silicon/ai/ai_mob.dm
index adae84a87e0..d607ee11484 100644
--- a/code/modules/mob/living/silicon/ai/ai_mob.dm
+++ b/code/modules/mob/living/silicon/ai/ai_mob.dm
@@ -1247,27 +1247,22 @@ GLOBAL_LIST_INIT(ai_verbs_default, list(
C.Togglelight(1)
lit_cameras |= C
-
-/mob/living/silicon/ai/attackby(obj/item/W, mob/user, params)
- if(istype(W, /obj/item/wrench))
- if(anchored)
- user.visible_message("\The [user] starts to unbolt \the [src] from the plating...")
- if(!do_after(user, 40 * W.toolspeed, target = src))
- user.visible_message("\The [user] decides not to unbolt \the [src].")
- return
- user.visible_message("\The [user] finishes unfastening \the [src]!")
- anchored = FALSE
+/mob/living/silicon/ai/wrench_act(mob/living/user, obj/item/I)
+ . = TRUE
+ if(anchored)
+ user.visible_message("[user] starts to unbolt [src] from the plating...")
+ if(I.use_tool(src, user, 4 SECONDS, 0, 50))
+ user.visible_message("[user] decides not to unbolt [src].")
return
- else
- user.visible_message("\The [user] starts to bolt \the [src] to the plating...")
- if(!do_after(user, 40 * W.toolspeed, target = src))
- user.visible_message("\The [user] decides not to bolt \the [src].")
- return
- user.visible_message("\The [user] finishes fastening down \the [src]!")
- anchored = TRUE
- return
- else
- return ..()
+ user.visible_message("[user] finishes unfastening [src]!")
+ anchored = FALSE
+ return
+ user.visible_message("[user] starts to bolt [src] to the plating...")
+ if(!I.use_tool(src, user, 4 SECONDS, 0, 50))
+ user.visible_message("[user] decides not to bolt [src].")
+ return FALSE
+ user.visible_message("[user] finishes fastening down [src]!")
+ anchored = TRUE
/mob/living/silicon/ai/welder_act()
return
diff --git a/code/modules/mob/living/simple_animal/bot/bot_construction.dm b/code/modules/mob/living/simple_animal/bot/bot_construction.dm
index 79cd8ab61e7..d73819b6475 100644
--- a/code/modules/mob/living/simple_animal/bot/bot_construction.dm
+++ b/code/modules/mob/living/simple_animal/bot/bot_construction.dm
@@ -505,7 +505,7 @@
//General Griefsky
- else if(istype(I, /obj/item/wrench) && build_step == 3)
+ else if(iswrench(I) && build_step == 3)
var/obj/item/griefsky_assembly/A = new /obj/item/griefsky_assembly(get_turf(src))
user.put_in_hands(A)
to_chat(user, "You adjust the arm slots for extra weapons!")
diff --git a/code/modules/power/engines/singularity/collector.dm b/code/modules/power/engines/singularity/collector.dm
index 15561f2e4de..4631406508c 100644
--- a/code/modules/power/engines/singularity/collector.dm
+++ b/code/modules/power/engines/singularity/collector.dm
@@ -47,6 +47,24 @@
else
to_chat(user, "The controls are locked!")
+/obj/machinery/power/rad_collector/wrench_act(mob/living/user, obj/item/I)
+ . = TRUE
+ if(loaded_tank)
+ to_chat(user, "Remove the plasma tank first.")
+ return TRUE
+ var/turf/T = get_turf(src)
+ for(var/obj/machinery/power/rad_collector/can_wrench in T.contents)
+ if(can_wrench.anchored && !anchored)
+ to_chat(user, "You can't wrench down [src] here!")
+ return
+ I.play_tool_sound(src)
+ anchored = !anchored
+ user.visible_message("[user.name] [anchored ? "secures" : "unsecures"] the [name].", "You [anchored ? "secure" : "undo"] the external bolts.", "You hear a ratchet")
+ if(anchored)
+ connect_to_network()
+ else
+ disconnect_from_network()
+
/obj/machinery/power/rad_collector/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/tank/internals/plasma))
@@ -64,22 +82,6 @@
if(loaded_tank && !locked)
eject()
return TRUE
- else if(iswrench(I))
- if(loaded_tank)
- to_chat(user, "Remove the plasma tank first.")
- return TRUE
- var/turf/T = get_turf(src)
- for(var/obj/machinery/power/rad_collector/can_wrench in T.contents)
- if(can_wrench.anchored && !anchored)
- to_chat(user, "You can't wrench down [src] here!")
- return
- playsound(loc, I.usesound, 75, TRUE)
- anchored = !anchored
- user.visible_message("[user.name] [anchored ? "secures" : "unsecures"] the [name].", "You [anchored ? "secure" : "undo"] the external bolts.", "You hear a ratchet")
- if(anchored)
- connect_to_network()
- else
- disconnect_from_network()
else if(istype(I, /obj/item/card/id) || istype(I, /obj/item/pda))
if(allowed(user))
if(active)
diff --git a/code/modules/power/engines/singularity/field_generator.dm b/code/modules/power/engines/singularity/field_generator.dm
index 5e27ef46dc6..c7238b8bdda 100644
--- a/code/modules/power/engines/singularity/field_generator.dm
+++ b/code/modules/power/engines/singularity/field_generator.dm
@@ -77,33 +77,29 @@ GLOBAL_LIST_EMPTY(field_generator_fields)
else
to_chat(user, "[src] needs to be firmly secured to the floor first!")
-
-/obj/machinery/field/generator/attackby(obj/item/W, mob/user, params)
+/obj/machinery/field/generator/wrench_act(mob/living/user, obj/item/W)
+ . = TRUE
if(active)
to_chat(user, "[src] needs to be off!")
return
- else if(istype(W, /obj/item/wrench))
- switch(state)
- if(FG_UNSECURED)
- if(isinspace()) return
- state = FG_SECURED
- playsound(loc, W.usesound, 75, 1)
- user.visible_message("[user.name] secures [name] to the floor.", \
- "You secure the external reinforcing bolts to the floor.", \
- "You hear ratchet.")
- anchored = TRUE
- if(FG_SECURED)
- state = FG_UNSECURED
- playsound(loc, W.usesound, 75, 1)
- user.visible_message("[user.name] unsecures [name] reinforcing bolts from the floor.", \
- "You undo the external reinforcing bolts.", \
- "You hear ratchet.")
- anchored = FALSE
- if(FG_WELDED)
- to_chat(user, "[src] needs to be unwelded from the floor!")
- else
- return ..()
-
+ switch(state)
+ if(FG_UNSECURED)
+ if(isinspace()) return
+ state = FG_SECURED
+ W.play_tool_sound(W, 75)
+ user.visible_message("[user.name] secures [name] to the floor.", \
+ "You secure the external reinforcing bolts to the floor.", \
+ "You hear ratchet.")
+ anchored = TRUE
+ if(FG_SECURED)
+ state = FG_UNSECURED
+ W.play_tool_sound(W, 75)
+ user.visible_message("[user.name] unsecures [name] reinforcing bolts from the floor.", \
+ "You undo the external reinforcing bolts.", \
+ "You hear ratchet.")
+ anchored = FALSE
+ if(FG_WELDED)
+ to_chat(user, "[src] needs to be unwelded from the floor!")
/obj/machinery/field/generator/welder_act(mob/user, obj/item/I)
. = TRUE
diff --git a/code/modules/power/engines/singularity/singulogen.dm b/code/modules/power/engines/singularity/singulogen.dm
index e0d5cf2737d..1449f374bd4 100644
--- a/code/modules/power/engines/singularity/singulogen.dm
+++ b/code/modules/power/engines/singularity/singulogen.dm
@@ -21,18 +21,18 @@
transfer_fingerprints_to(S)
if(src) qdel(src)
-/obj/machinery/the_singularitygen/attackby(obj/item/W, mob/user, params)
- if(istype(W, /obj/item/wrench))
- anchored = !anchored
- playsound(src.loc, W.usesound, 75, 1)
- if(anchored)
- user.visible_message("[user.name] secures [src] to the floor.", \
- "You secure [src] to the floor.", \
- "You hear a ratchet")
- src.add_hiddenprint(user)
- else
- user.visible_message("[user.name] unsecures [src] from the floor.", \
- "You unsecure [src.name] from the floor.", \
- "You hear a ratchet")
+/obj/machinery/the_singularitygen/wrench_act(mob/living/user, obj/item/wrench/W)
+ . = TRUE
+ anchored = !anchored
+ if(!W.use_tool(src, user, 2 SECONDS, 0, 50))
return
- return ..()
+ if(anchored)
+ user.visible_message("[user.name] secures [src] to the floor.", \
+ "You secure [src] to the floor.", \
+ "You hear a ratchet.")
+ src.add_hiddenprint(user)
+ else
+ user.visible_message("[user.name] unsecures [src] from the floor.", \
+ "You unsecure [src.name] from the floor.", \
+ "You hear a ratchet.")
+
diff --git a/code/modules/recycling/disposal-construction.dm b/code/modules/recycling/disposal-construction.dm
index 7594ae4b283..7900fe0fb20 100644
--- a/code/modules/recycling/disposal-construction.dm
+++ b/code/modules/recycling/disposal-construction.dm
@@ -137,10 +137,41 @@
// wrench: (un)anchor
// weldingtool: convert to real pipe
-/obj/structure/disposalconstruct/attackby(obj/item/I, mob/user, params)
+/obj/structure/disposalconstruct/wrench_act(mob/living/user, obj/item/I)
+ var/ispipe = is_pipe()
+ var/nicetype = get_nice_name()
+ if(anchored)
+ anchored = FALSE
+ if(ispipe)
+ level = 2
+ density = FALSE
+ else
+ density = TRUE
+ to_chat(user, "You detach the [nicetype] from the underfloor.")
+ else
+ anchored = TRUE
+ if(ispipe)
+ level = 1 // We don't want disposal bins to disappear under the floors
+ density = FALSE
+ else
+ density = TRUE // We don't want disposal bins or outlets to go density 0
+ to_chat(user, "You attach the [nicetype] to the underfloor.")
+ I.play_tool_sound(src, I.tool_volume)
+ update()
+ return TRUE
+
+/obj/structure/disposalconstruct/proc/is_pipe()
+ switch(ptype)
+ // lewtodo: this sucks
+ if(PIPE_DISPOSALS_BIN, PIPE_DISPOSALS_OUTLET, PIPE_DISPOSALS_CHUTE)
+ return FALSE
+ if(PIPE_DISPOSALS_SORT_RIGHT, PIPE_DISPOSALS_SORT_LEFT)
+ return TRUE
+ else
+ return TRUE
+
+/obj/structure/disposalconstruct/proc/get_nice_name()
var/nicetype = "pipe"
- var/ispipe = 0 // Indicates if we should change the level of this pipe
- src.add_fingerprint(user)
switch(ptype)
if(PIPE_DISPOSALS_BIN)
nicetype = "disposal bin"
@@ -150,38 +181,19 @@
nicetype = "delivery chute"
if(PIPE_DISPOSALS_SORT_RIGHT, PIPE_DISPOSALS_SORT_LEFT)
nicetype = "sorting pipe"
- ispipe = 1
- else
- nicetype = "pipe"
- ispipe = 1
+ return nicetype
+
+/obj/structure/disposalconstruct/attackby(obj/item/I, mob/user, params)
+ var/nicetype = get_nice_name()
+ var/ispipe = is_pipe() // Indicates if we should change the level of this pipe
+ add_fingerprint(user)
+
var/turf/T = src.loc
if(T.intact)
to_chat(user, "You can only attach the [nicetype] if the floor plating is removed.")
return
- if(istype(I, /obj/item/wrench))
- if(anchored)
- anchored = FALSE
- if(ispipe)
- level = 2
- density = FALSE
- else
- density = TRUE
- to_chat(user, "You detach the [nicetype] from the underfloor.")
- else
- anchored = TRUE
- if(ispipe)
- level = 1 // We don't want disposal bins to disappear under the floors
- density = FALSE
- else
- density = TRUE // We don't want disposal bins or outlets to go density 0
- to_chat(user, "You attach the [nicetype] to the underfloor.")
- playsound(src.loc, I.usesound, 100, 1)
- update()
- return
-
-
if(ptype in list(PIPE_DISPOSALS_BIN, PIPE_DISPOSALS_OUTLET, PIPE_DISPOSALS_CHUTE)) // Disposal or outlet
var/obj/structure/disposalpipe/trunk/CP = locate() in T
if(!CP) // There's no trunk
diff --git a/code/modules/station_goals/bsa.dm b/code/modules/station_goals/bsa.dm
index 569f121d9a8..3c9ce4f80eb 100644
--- a/code/modules/station_goals/bsa.dm
+++ b/code/modules/station_goals/bsa.dm
@@ -32,38 +32,25 @@
density = TRUE
anchored = TRUE
+/obj/machinery/bsa/wrench_act(mob/living/user, obj/item/I)
+ default_unfasten_wrench(user, I, 1 SECONDS)
+ return TRUE
+
+/obj/machinery/bsa/multitool_act(mob/living/user, obj/item/multitool/M)
+ M.buffer = src
+ to_chat(user, "You store linkage information in [M]'s buffer.")
+ return TRUE
+
/obj/machinery/bsa/back
name = "Bluespace Artillery Generator"
desc = "Generates cannon pulse. Needs to be linked with a fusor. "
icon_state = "power_box"
-/obj/machinery/bsa/back/attackby(obj/item/W, mob/user, params)
- if(istype(W, /obj/item/multitool))
- var/obj/item/multitool/M = W
- M.buffer = src
- to_chat(user, "You store linkage information in [W]'s buffer.")
- else if(istype(W, /obj/item/wrench))
- default_unfasten_wrench(user, W, 10)
- return TRUE
- else
- return ..()
-
/obj/machinery/bsa/front
name = "Bluespace Artillery Bore"
desc = "Do not stand in front of cannon during operation. Needs to be linked with a fusor."
icon_state = "emitter_center"
-/obj/machinery/bsa/front/attackby(obj/item/W, mob/user, params)
- if(istype(W, /obj/item/multitool))
- var/obj/item/multitool/M = W
- M.buffer = src
- to_chat(user, "You store linkage information in [W]'s buffer.")
- else if(istype(W, /obj/item/wrench))
- default_unfasten_wrench(user, W, 10)
- return TRUE
- else
- return ..()
-
/obj/machinery/bsa/middle
name = "Bluespace Artillery Fusor"
desc = "Contents classifed by Nanotrasen Naval Command. Needs to be linked with the other BSA parts using multitool."
@@ -71,23 +58,19 @@
var/obj/machinery/bsa/back/back
var/obj/machinery/bsa/front/front
-/obj/machinery/bsa/middle/attackby(obj/item/W, mob/user, params)
- if(istype(W, /obj/item/multitool))
- var/obj/item/multitool/M = W
- if(M.buffer)
- if(istype(M.buffer,/obj/machinery/bsa/back))
- back = M.buffer
- M.buffer = null
- to_chat(user, "You link [src] with [back].")
- else if(istype(M.buffer,/obj/machinery/bsa/front))
- front = M.buffer
- M.buffer = null
- to_chat(user, "You link [src] with [front].")
- else if(istype(W, /obj/item/wrench))
- default_unfasten_wrench(user, W, 10)
- return TRUE
- else
- return ..()
+/obj/machinery/bsa/middle/multitool_act(mob/living/user, obj/item/multitool/M)
+ . = TRUE
+ if(!M.buffer)
+ to_chat(user, "[M]'s buffer is empty!")
+ return
+ if(istype(M.buffer,/obj/machinery/bsa/back))
+ back = M.buffer
+ M.buffer = null
+ to_chat(user, "You link [src] with [back].")
+ else if(istype(M.buffer,/obj/machinery/bsa/front))
+ front = M.buffer
+ M.buffer = null
+ to_chat(user, "You link [src] with [front].")
/obj/machinery/bsa/middle/proc/check_completion()
if(!front || !back)