Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Commit aa9f2f7

Browse files
hacking
1 parent 053cef0 commit aa9f2f7

File tree

1 file changed

+28
-25
lines changed

1 file changed

+28
-25
lines changed

code/datums/wires/_wires.dm

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -303,45 +303,48 @@
303303
/datum/wires/ui_act(action, params)
304304
if(..() || !interactable(usr))
305305
return
306+
if(!holder) // wires with no holder makes no sense to exist and probably breaks things, so catch any instances of that
307+
CRASH("[type] has no holder!")
306308
var/target_wire = params["wire"]
307-
var/mob/living/L = usr
308-
var/obj/item/I
309+
var/mob/living/user = usr
310+
var/obj/item/tool
311+
var/tool_delay = max((0.5**user.get_skill(SKILL_TECHNICAL)) SECONDS, 0)
312+
if(tool_delay < 0.2 SECONDS) // effectively already instant
313+
tool_delay = 0
309314
switch(action)
310315
if("cut")
311-
I = (L.is_holding_tool_quality(TOOL_WIRECUTTER) || (L.is_holding_tool_quality(TOOL_WIRING) && is_cut(target_wire)))
312-
if(I || IsAdminGhost(usr))
313-
if(I && holder)
314-
I.play_tool_sound(holder, 20)
316+
tool = user.is_holding_tool_quality(TOOL_WIRECUTTER)
317+
if(tool?.use_tool(holder, user, tool_delay) || IsAdminGhost(usr))
318+
tool.play_tool_sound(holder, 20)
315319
cut_color(target_wire)
316320
. = TRUE
317-
else
318-
to_chat(L, span_warning("You need wirecutters!"))
321+
else if(!tool)
322+
to_chat(user, span_warning("You need wirecutters!"))
319323
if("pulse")
320-
I = L.is_holding_tool_quality(TOOL_MULTITOOL)
321-
if(I || IsAdminGhost(usr))
322-
if(I && holder)
323-
I.play_tool_sound(holder, 20)
324-
pulse_color(target_wire, L)
324+
tool = user.is_holding_tool_quality(TOOL_MULTITOOL)
325+
if(tool?.use_tool(holder, user, tool_delay) || IsAdminGhost(usr))
326+
tool.play_tool_sound(holder, 20)
327+
pulse_color(target_wire, user)
325328
. = TRUE
326-
else
327-
to_chat(L, span_warning("You need a multitool!"))
329+
else if(!tool)
330+
to_chat(user, span_warning("You need a multitool!"))
328331
if("attach")
329332
if(is_attached(target_wire))
330-
I = detach_assembly(target_wire)
331-
if(I)
332-
L.put_in_hands(I)
333-
. = TRUE
333+
if(!do_after(user, tool_delay, holder))
334+
return
335+
user.put_in_hands(detach_assembly(target_wire))
336+
. = TRUE
334337
else
335-
I = L.get_active_held_item()
336-
if(istype(I, /obj/item/assembly))
337-
var/obj/item/assembly/A = I
338+
tool = user.get_active_held_item()
339+
if(istype(tool, /obj/item/assembly) && tool?.use_tool(holder, user, tool_delay))
340+
var/obj/item/assembly/A = tool
338341
if(A.attachable)
339-
if(!L.temporarilyRemoveItemFromInventory(A))
342+
if(!user.temporarilyRemoveItemFromInventory(A))
340343
return
341344
if(!attach_assembly(target_wire, A))
342-
A.forceMove(L.drop_location())
345+
A.forceMove(user.drop_location())
343346
. = TRUE
344347
else
345-
to_chat(L, span_warning("You need an attachable assembly!"))
348+
to_chat(user, span_warning("You need an attachable assembly!"))
346349

347350
#undef MAXIMUM_EMP_WIRES

0 commit comments

Comments
 (0)