diff --git a/code/game/machinery/constructable_frame.dm b/code/game/machinery/constructable_frame.dm
index 7aab26dc63..59bf9f86fd 100644
--- a/code/game/machinery/constructable_frame.dm
+++ b/code/game/machinery/constructable_frame.dm
@@ -4,7 +4,7 @@
icon_state = "box_0"
density = TRUE
max_integrity = 250
- var/obj/item/circuitboard/circuit = null
+ var/obj/item/circuitboard/machine/circuit = null
var/state = 1
/obj/structure/frame/examine(user)
@@ -165,6 +165,13 @@
icon_state = "box_1"
return
+ if(istype(P, /obj/item/wrench) && !circuit.needs_anchored)
+ to_chat(user, "You start [anchored ? "un" : ""]securing [name]...")
+ if(P.use_tool(src, user, 40, volume=75))
+ to_chat(user, "You [anchored ? "un" : ""]secure [name].")
+ anchored = !anchored
+ return
+
if(istype(P, /obj/item/screwdriver))
var/component_check = 1
for(var/R in req_components)
diff --git a/code/modules/hydroponics/hydroponics.dm b/code/modules/hydroponics/hydroponics.dm
index 3890c8e317..fb6915aef9 100644
--- a/code/modules/hydroponics/hydroponics.dm
+++ b/code/modules/hydroponics/hydroponics.dm
@@ -56,22 +56,19 @@
return ..()
/obj/machinery/hydroponics/constructable/attackby(obj/item/I, mob/user, params)
- if(default_deconstruction_screwdriver(user, "hydrotray3", "hydrotray3", I))
- return
-
- if(default_pry_open(I))
- return
-
- if(default_unfasten_wrench(user, I))
- return
-
- if(istype(I, /obj/item/crowbar))
- if(using_irrigation)
- to_chat(user, "Disconnect the hoses first!")
- else if(default_deconstruction_crowbar(I, 1))
+ if (user.a_intent != INTENT_HARM)
+ // handle opening the panel
+ if(default_deconstruction_screwdriver(user, icon_state, icon_state, I))
return
- else
- return ..()
+
+ // handle deconstructing the machine, if permissible
+ if (I.tool_behaviour == TOOL_CROWBAR && using_irrigation)
+ to_chat(user, "Disconnect the hoses first!")
+ return
+ else if(default_deconstruction_crowbar(I))
+ return
+
+ return ..()
/obj/machinery/hydroponics/proc/FindConnected()
var/list/connected = list()
@@ -787,31 +784,13 @@
for(var/obj/item/reagent_containers/food/snacks/grown/G in locate(user.x,user.y,user.z))
O.SendSignal(COMSIG_TRY_STORAGE_INSERT, G, user, TRUE)
- else if(istype(O, /obj/item/wrench) && unwrenchable)
- if(using_irrigation)
- to_chat(user, "Disconnect the hoses first!")
- return
-
- if(!anchored && !isinspace())
- user.visible_message("[user] begins to wrench [src] into place.", \
- "You begin to wrench [src] in place...")
- if (O.use_tool(src, user, 20, volume=50))
- if(anchored)
- return
- anchored = TRUE
- user.visible_message("[user] wrenches [src] into place.", \
- "You wrench [src] in place.")
- else if(anchored)
- user.visible_message("[user] begins to unwrench [src].", \
- "You begin to unwrench [src]...")
- if (O.use_tool(src, user, 20, volume=50))
- if(!anchored)
- return
- anchored = FALSE
- user.visible_message("[user] unwrenches [src].", \
- "You unwrench [src].")
+ else if(default_unfasten_wrench(user, O))
+ return
else if(istype(O, /obj/item/wirecutters) && unwrenchable)
+ if (!anchored)
+ to_chat(user, "Anchor the tray first!")
+ return
using_irrigation = !using_irrigation
O.play_tool_sound(src)
user.visible_message("[user] [using_irrigation ? "" : "dis"]connects [src]'s irrigation hoses.", \
@@ -840,6 +819,17 @@
else
return ..()
+/obj/machinery/hydroponics/can_be_unfasten_wrench(mob/user, silent)
+ if (!unwrenchable) // case also covered by NODECONSTRUCT checks in default_unfasten_wrench
+ return CANT_UNFASTEN
+
+ if (using_irrigation)
+ if (!silent)
+ to_chat(user, "Disconnect the hoses first!")
+ return FAILED_UNFASTEN
+
+ return ..()
+
/obj/machinery/hydroponics/attack_hand(mob/user)
. = ..()
if(.)