diff --git a/code/__DEFINES/maps.dm b/code/__DEFINES/maps.dm
index d3835631ff..73f6a7b4dd 100644
--- a/code/__DEFINES/maps.dm
+++ b/code/__DEFINES/maps.dm
@@ -77,6 +77,7 @@ Last space-z level = empty
#define CAMERA_LOCK_CENTCOM 4
#define CAMERA_LOCK_REEBE 8
+
//Ruin Generation
#define PLACEMENT_TRIES 100 //How many times we try to fit the ruin somewhere until giving up (really should just swap to some packing algo)
diff --git a/code/__DEFINES/tools.dm b/code/__DEFINES/tools.dm
index e4eaf09347..b332766517 100644
--- a/code/__DEFINES/tools.dm
+++ b/code/__DEFINES/tools.dm
@@ -5,3 +5,8 @@
#define TOOL_WIRECUTTER "wirecutter"
#define TOOL_WRENCH "wrench"
#define TOOL_WELDER "welder"
+
+
+// If delay between the start and the end of tool operation is less than MIN_TOOL_SOUND_DELAY,
+// tool sound is only played when op is started. If not, it's played twice.
+#define MIN_TOOL_SOUND_DELAY 20
diff --git a/code/__DEFINES/traits.dm b/code/__DEFINES/traits.dm
index b180a32674..49c2b2f8be 100644
--- a/code/__DEFINES/traits.dm
+++ b/code/__DEFINES/traits.dm
@@ -21,6 +21,7 @@
#define TRAIT_PUSHIMMUNE "push_immunity"
#define TRAIT_SHOCKIMMUNE "shock_immunity"
+
// common trait sources
#define TRAIT_GENERIC "generic"
#define EYE_DAMAGE "eye_damage"
diff --git a/code/__HELPERS/game.dm b/code/__HELPERS/game.dm
index db51e76232..26b5ac65cc 100644
--- a/code/__HELPERS/game.dm
+++ b/code/__HELPERS/game.dm
@@ -319,9 +319,10 @@
break
/proc/get_mob_by_key(key)
+ var/ckey = ckey(key)
for(var/i in GLOB.player_list)
var/mob/M = i
- if(M.ckey == lowertext(key))
+ if(M.ckey == ckey)
return M
return null
diff --git a/code/__HELPERS/heap.dm b/code/__HELPERS/heap.dm
index c34d5a2b9e..ce03b482e5 100644
--- a/code/__HELPERS/heap.dm
+++ b/code/__HELPERS/heap.dm
@@ -38,7 +38,6 @@
while(parent > 0 && (call(cmp)(L[index],L[parent]) > 0))
L.Swap(index,parent)
-
index = parent
parent = round(index * 0.5)
@@ -68,6 +67,7 @@
//Replaces a given node so it verify the heap condition
/datum/Heap/proc/ReSort(atom/A)
var/index = L.Find(A)
+
Swim(index)
Sink(index)
diff --git a/code/_globalvars/genetics.dm b/code/_globalvars/genetics.dm
index 930b5080b7..a0557e8e1b 100644
--- a/code/_globalvars/genetics.dm
+++ b/code/_globalvars/genetics.dm
@@ -25,4 +25,4 @@ GLOBAL_LIST_EMPTY(global_mutations) // list of hidden mutation things
GLOBAL_LIST_EMPTY(bad_mutations)
GLOBAL_LIST_EMPTY(good_mutations)
-GLOBAL_LIST_EMPTY(not_good_mutations)
+GLOBAL_LIST_EMPTY(not_good_mutations)
\ No newline at end of file
diff --git a/code/datums/components/decals/blood.dm b/code/datums/components/decals/blood.dm
index 760c61f4e1..5a14aecd52 100644
--- a/code/datums/components/decals/blood.dm
+++ b/code/datums/components/decals/blood.dm
@@ -24,6 +24,7 @@
//try to find a pre-processed blood-splatter. otherwise, make a new one
var/index = "[REF(icon)]-[icon_state]"
pic = blood_splatter_appearances[index]
+
if(!pic)
var/icon/blood_splatter_icon = icon(initial(I.icon), initial(I.icon_state), , 1) //we only want to apply blood-splatters to the initial icon_state for each object
blood_splatter_icon.Blend("#fff", ICON_ADD) //fills the icon_state with white (except where it's transparent)
diff --git a/code/datums/helper_datums/construction_datum.dm b/code/datums/helper_datums/construction_datum.dm
index 313a93943c..95d2b612d0 100644
--- a/code/datums/helper_datums/construction_datum.dm
+++ b/code/datums/helper_datums/construction_datum.dm
@@ -23,33 +23,46 @@
set_desc(steps.len)
return
-/datum/construction/proc/action(atom/used_atom,mob/user)
+/datum/construction/proc/action(obj/item/I, mob/user)
return
-/datum/construction/proc/check_step(atom/used_atom,mob/user) //check last step only
- var/valid_step = is_right_key(used_atom)
+/datum/construction/proc/check_step(obj/item/I, mob/user) //check last step only
+ var/valid_step = is_right_key(I)
if(valid_step)
- if(custom_action(valid_step, used_atom, user))
+ if(custom_action(valid_step, I, user))
next_step()
return 1
return 0
-/datum/construction/proc/is_right_key(atom/used_atom) // returns current step num if used_atom is of the right type.
+/datum/construction/proc/is_right_key(obj/item/I) // returns current step num if I is of the right type.
var/list/L = steps[steps.len]
- if(istype(used_atom, L["key"]))
+ if(check_used_item(I, L["key"]))
return steps.len
return 0
-/datum/construction/proc/custom_action(step, used_atom, user)
+/datum/construction/proc/check_used_item(obj/item/I, key)
+ if(!key)
+ return FALSE
+
+ if(ispath(key) && istype(I, key))
+ return TRUE
+
+ else if(I.tool_behaviour == key)
+ return TRUE
+
+ return FALSE
+
+
+/datum/construction/proc/custom_action(step, obj/item/I, user)
return 1
-/datum/construction/proc/check_all_steps(atom/used_atom,mob/user) //check all steps, remove matching one.
+/datum/construction/proc/check_all_steps(obj/item/I, mob/user) //check all steps, remove matching one.
for(var/i=1;i<=steps.len;i++)
- var/list/L = steps[i];
- if(istype(used_atom, L["key"]))
- if(custom_action(i, used_atom, user))
- steps[i]=null;//stupid byond list from list removal...
- listclearnulls(steps);
+ var/list/L = steps[i]
+ if(check_used_item(I, L["key"]))
+ if(custom_action(i, I, user))
+ steps[i] = null//stupid byond list from list removal...
+ listclearnulls(steps)
if(!steps.len)
spawn_result()
return 1
@@ -76,6 +89,9 @@
holder.desc = step["desc"]
return
+/datum/construction/proc/drop_location()
+ return holder.drop_location()
+
/datum/construction/reversible
var/index
@@ -92,21 +108,21 @@
set_desc(index)
return
-/datum/construction/reversible/is_right_key(atom/used_atom) // returns index step
+/datum/construction/reversible/is_right_key(obj/item/I) // returns index step
var/list/L = steps[index]
- if(istype(used_atom, L["key"]))
+ if(check_used_item(I, L["key"]))
return FORWARD //to the first step -> forward
- else if(L["backkey"] && istype(used_atom, L["backkey"]))
+ else if(check_used_item(I, L["backkey"]))
return BACKWARD //to the last step -> backwards
- return 0
+ return FALSE
-/datum/construction/reversible/check_step(atom/used_atom,mob/user)
- var/diff = is_right_key(used_atom)
+/datum/construction/reversible/check_step(obj/item/I, mob/user)
+ var/diff = is_right_key(I)
if(diff)
- if(custom_action(index, diff, used_atom, user))
+ if(custom_action(index, diff, I, user))
update_index(diff)
return 1
return 0
-/datum/construction/reversible/custom_action(index, diff, used_atom, user)
+/datum/construction/reversible/custom_action(index, diff, obj/item/I, user)
return 1
diff --git a/code/datums/shuttles.dm b/code/datums/shuttles.dm
index b5775f5874..404c584fd4 100644
--- a/code/datums/shuttles.dm
+++ b/code/datums/shuttles.dm
@@ -87,7 +87,6 @@
description = "A respectable mid-sized shuttle that first saw service shuttling Nanotrasen crew to and from their asteroid belt embedded facilities."
credit_cost = 3000
-
/datum/map_template/shuttle/emergency/bar
suffix = "bar"
name = "The Emergency Escape Bar"
@@ -110,18 +109,6 @@
admin_notes = "This shuttle will likely crush escape, killing anyone there."
credit_cost = -5000
-/datum/map_template/shuttle/emergency/saltmine
- suffix = "saltmine"
- name = "The Saltmine"
- description = "Contains everything that upsets you."
- admin_notes = "Don't forget: You're here forever."
- credit_cost = 5000
-
-/datum/map_template/shuttle/emergency/saltmine/prerequisites_met()
- if("revenant" in SSshuttle.shuttle_purchase_requirements_met)
- return TRUE
- return FALSE
-
/datum/map_template/shuttle/emergency/luxury
suffix = "luxury"
name = "Luxury Shuttle"
diff --git a/code/datums/wires/wires.dm b/code/datums/wires/wires.dm
index fd9c60c013..308f02a27e 100644
--- a/code/datums/wires/wires.dm
+++ b/code/datums/wires/wires.dm
@@ -1,15 +1,15 @@
#define MAXIMUM_EMP_WIRES 3
/proc/is_wire_tool(obj/item/I)
- if(istype(I, /obj/item/device/multitool))
- return TRUE
- if(istype(I, /obj/item/wirecutters))
+ if(!I)
+ return
+
+ if(I.tool_behaviour == TOOL_WIRECUTTER || I.tool_behaviour == TOOL_MULTITOOL)
return TRUE
if(istype(I, /obj/item/device/assembly))
var/obj/item/device/assembly/A = I
if(A.attachable)
return TRUE
- return
/atom
var/datum/wires/wires = null
@@ -244,29 +244,34 @@
return
var/target_wire = params["wire"]
var/mob/living/L = usr
- var/obj/item/I = L.get_active_held_item()
+ var/obj/item/I
switch(action)
if("cut")
- if(istype(I, /obj/item/wirecutters) || IsAdminGhost(usr))
- playsound(holder, I.usesound, 20, 1)
+ I = L.is_holding_tool_quality(TOOL_WIRECUTTER)
+ if(I || IsAdminGhost(usr))
+ if(I)
+ I.play_tool_sound(src, 20)
cut_color(target_wire)
. = TRUE
else
to_chat(L, "You need wirecutters!")
if("pulse")
- if(istype(I, /obj/item/device/multitool) || IsAdminGhost(usr))
- playsound(holder, 'sound/weapons/empty.ogg', 20, 1)
+ I = L.is_holding_tool_quality(TOOL_MULTITOOL)
+ if(I || IsAdminGhost(usr))
+ if(I)
+ I.play_tool_sound(src, 20)
pulse_color(target_wire, L)
. = TRUE
else
to_chat(L, "You need a multitool!")
if("attach")
if(is_attached(target_wire))
- var/obj/item/O = detach_assembly(target_wire)
- if(O)
- L.put_in_hands(O)
+ I = detach_assembly(target_wire)
+ if(I)
+ L.put_in_hands(I)
. = TRUE
else
+ I = L.get_active_held_item()
if(istype(I, /obj/item/device/assembly))
var/obj/item/device/assembly/A = I
if(A.attachable)
diff --git a/code/game/atoms.dm b/code/game/atoms.dm
index 217b994c7f..b966fe2905 100644
--- a/code/game/atoms.dm
+++ b/code/game/atoms.dm
@@ -534,38 +534,38 @@
// Tool behavior procedure. Redirects to tool-specific procs by default.
// You can override it to catch all tool interactions, for use in complex deconstruction procs.
// Just don't forget to return ..() in the end.
-/atom/proc/tool_act(mob/living/user, obj/item/tool, tool_type)
+/atom/proc/tool_act(mob/living/user, obj/item/I, tool_type)
switch(tool_type)
if(TOOL_CROWBAR)
- return crowbar_act(user, tool)
+ return crowbar_act(user, I)
if(TOOL_MULTITOOL)
- return multitool_act(user, tool)
+ return multitool_act(user, I)
if(TOOL_SCREWDRIVER)
- return screwdriver_act(user, tool)
+ return screwdriver_act(user, I)
if(TOOL_WRENCH)
- return wrench_act(user, tool)
+ return wrench_act(user, I)
if(TOOL_WIRECUTTER)
- return wirecutter_act(user, tool)
+ return wirecutter_act(user, I)
if(TOOL_WELDER)
- return welder_act(user, tool)
+ return welder_act(user, I)
// Tool-specific behavior procs. To be overridden in subtypes.
-/atom/proc/crowbar_act(mob/living/user, obj/item/tool)
+/atom/proc/crowbar_act(mob/living/user, obj/item/I)
return
-/atom/proc/multitool_act(mob/living/user, obj/item/tool)
+/atom/proc/multitool_act(mob/living/user, obj/item/I)
return
-/atom/proc/screwdriver_act(mob/living/user, obj/item/tool)
+/atom/proc/screwdriver_act(mob/living/user, obj/item/I)
return
-/atom/proc/wrench_act(mob/living/user, obj/item/tool)
+/atom/proc/wrench_act(mob/living/user, obj/item/I)
return
-/atom/proc/wirecutter_act(mob/living/user, obj/item/tool)
+/atom/proc/wirecutter_act(mob/living/user, obj/item/I)
return
-/atom/proc/welder_act(mob/living/user, obj/item/tool)
+/atom/proc/welder_act(mob/living/user, obj/item/I)
return
/atom/proc/GenerateTag()
diff --git a/code/game/machinery/PDApainter.dm b/code/game/machinery/PDApainter.dm
index ba8be95065..a2d2e30bea 100644
--- a/code/game/machinery/PDApainter.dm
+++ b/code/game/machinery/PDApainter.dm
@@ -80,21 +80,19 @@
update_icon()
else if(istype(O, /obj/item/weldingtool) && user.a_intent != INTENT_HARM)
- var/obj/item/weldingtool/WT = O
if(stat & BROKEN)
- if(WT.remove_fuel(0,user))
- user.visible_message("[user] is repairing [src].", \
- "You begin repairing [src]...", \
- "You hear welding.")
- playsound(loc, WT.usesound, 40, 1)
- if(do_after(user,40*WT.toolspeed, 1, target = src))
- if(!WT.isOn() || !(stat & BROKEN))
- return
- to_chat(user, "You repair [src].")
- playsound(loc, 'sound/items/welder2.ogg', 50, 1)
- stat &= ~BROKEN
- obj_integrity = max_integrity
- update_icon()
+ if(!O.tool_start_check(user, amount=0))
+ return
+ user.visible_message("[user] is repairing [src].", \
+ "You begin repairing [src]...", \
+ "You hear welding.")
+ if(O.use_tool(src, user, 40, volume=50))
+ if(!(stat & BROKEN))
+ return
+ to_chat(user, "You repair [src].")
+ stat &= ~BROKEN
+ obj_integrity = max_integrity
+ update_icon()
else
to_chat(user, "[src] does not need repairs.")
else
diff --git a/code/game/machinery/_machinery.dm b/code/game/machinery/_machinery.dm
index 9517e0bc65..22978e9ea2 100644
--- a/code/game/machinery/_machinery.dm
+++ b/code/game/machinery/_machinery.dm
@@ -290,18 +290,17 @@ Class Procs:
/obj/machinery/proc/RefreshParts() //Placeholder proc for machines that are built using frames.
return
-/obj/machinery/proc/default_pry_open(obj/item/crowbar/C)
- . = !(state_open || panel_open || is_operational() || (flags_1 & NODECONSTRUCT_1)) && istype(C)
+/obj/machinery/proc/default_pry_open(obj/item/I)
+ . = !(state_open || panel_open || is_operational() || (flags_1 & NODECONSTRUCT_1)) && I.tool_behaviour == TOOL_CROWBAR
if(.)
- playsound(loc, C.usesound, 50, 1)
+ I.play_tool_sound(src, 50)
visible_message("[usr] pries open \the [src].", "You pry open \the [src].")
open_machine()
- return 1
-/obj/machinery/proc/default_deconstruction_crowbar(obj/item/crowbar/C, ignore_panel = 0)
- . = istype(C) && (panel_open || ignore_panel) && !(flags_1 & NODECONSTRUCT_1)
+/obj/machinery/proc/default_deconstruction_crowbar(obj/item/I, ignore_panel = 0)
+ . = (panel_open || ignore_panel) && !(flags_1 & NODECONSTRUCT_1) && I.tool_behaviour == TOOL_CROWBAR
if(.)
- playsound(loc, C.usesound, 50, 1)
+ I.play_tool_sound(src, 50)
deconstruct(TRUE)
/obj/machinery/deconstruct(disassembled = TRUE)
@@ -337,9 +336,9 @@ Class Procs:
update_icon()
updateUsrDialog()
-/obj/machinery/proc/default_deconstruction_screwdriver(mob/user, icon_state_open, icon_state_closed, obj/item/screwdriver/S)
- if(istype(S) && !(flags_1 & NODECONSTRUCT_1))
- playsound(loc, S.usesound, 50, 1)
+/obj/machinery/proc/default_deconstruction_screwdriver(mob/user, icon_state_open, icon_state_closed, obj/item/I)
+ if(!(flags_1 & NODECONSTRUCT_1) && I.tool_behaviour == TOOL_SCREWDRIVER)
+ I.play_tool_sound(src, 50)
if(!panel_open)
panel_open = TRUE
icon_state = icon_state_open
@@ -351,9 +350,9 @@ Class Procs:
return 1
return 0
-/obj/machinery/proc/default_change_direction_wrench(mob/user, obj/item/wrench/W)
- if(panel_open && istype(W))
- playsound(loc, W.usesound, 50, 1)
+/obj/machinery/proc/default_change_direction_wrench(mob/user, obj/item/I)
+ if(panel_open && I.tool_behaviour == TOOL_WRENCH)
+ I.play_tool_sound(src, 50)
setDir(turn(dir,-90))
to_chat(user, "You rotate [src].")
return 1
@@ -365,20 +364,20 @@ Class Procs:
return FAILED_UNFASTEN
return SUCCESSFUL_UNFASTEN
-/obj/proc/default_unfasten_wrench(mob/user, obj/item/wrench/W, time = 20) //try to unwrench an object in a WONDERFUL DYNAMIC WAY
- if(istype(W) && !(flags_1 & NODECONSTRUCT_1))
+/obj/proc/default_unfasten_wrench(mob/user, obj/item/I, time = 20) //try to unwrench an object in a WONDERFUL DYNAMIC WAY
+ if(!(flags_1 & NODECONSTRUCT_1) && I.tool_behaviour == TOOL_WRENCH)
var/can_be_unfasten = can_be_unfasten_wrench(user)
if(!can_be_unfasten || can_be_unfasten == FAILED_UNFASTEN)
return can_be_unfasten
if(time)
to_chat(user, "You begin [anchored ? "un" : ""]securing [src]...")
- playsound(loc, W.usesound, 50, 1)
+ I.play_tool_sound(src, 50)
var/prev_anchored = anchored
//as long as we're the same anchored state and we're either on a floor or are anchored, toggle our anchored state
- if(!time || do_after(user, time*W.toolspeed, target = src, extra_checks = CALLBACK(src, .proc/unfasten_wrench_check, prev_anchored, user)))
+ if(I.use_tool(src, user, time, extra_checks = CALLBACK(src, .proc/unfasten_wrench_check, prev_anchored, user)))
to_chat(user, "You [anchored ? "un" : ""]secure [src].")
anchored = !anchored
- playsound(loc, 'sound/items/deconstruct.ogg', 50, 1)
+ playsound(src, 'sound/items/deconstruct.ogg', 50, 1)
return SUCCESSFUL_UNFASTEN
return FAILED_UNFASTEN
return CANT_UNFASTEN
diff --git a/code/game/machinery/announcement_system.dm b/code/game/machinery/announcement_system.dm
index 5226084b96..102c21904e 100644
--- a/code/game/machinery/announcement_system.dm
+++ b/code/game/machinery/announcement_system.dm
@@ -61,7 +61,7 @@ GLOBAL_LIST_EMPTY(announcement_systems)
/obj/machinery/announcement_system/attackby(obj/item/P, mob/user, params)
if(istype(P, /obj/item/screwdriver))
- playsound(src.loc, P.usesound, 50, 1)
+ P.play_tool_sound(src)
panel_open = !panel_open
to_chat(user, "You [panel_open ? "open" : "close"] the maintenance hatch of [src].")
update_icon()
diff --git a/code/game/machinery/aug_manipulator.dm b/code/game/machinery/aug_manipulator.dm
index 299b0500ce..53b5277abd 100644
--- a/code/game/machinery/aug_manipulator.dm
+++ b/code/game/machinery/aug_manipulator.dm
@@ -74,21 +74,21 @@
update_icon()
else if(istype(O, /obj/item/weldingtool) && user.a_intent != INTENT_HARM)
- var/obj/item/weldingtool/WT = O
if(obj_integrity < max_integrity)
- if(WT.remove_fuel(0,user))
- user.visible_message("[user] begins repairing [src].", \
- "You begin repairing [src]...", \
- "You hear welding.")
- playsound(src, WT.usesound, 40, 1)
- if(do_after(user,40*WT.toolspeed, TRUE, target = src))
- if(!WT.isOn() || !(stat & BROKEN))
- return
- to_chat(user, "You repair [src].")
- playsound(src, 'sound/items/welder2.ogg', 50, 1)
- stat &= ~BROKEN
- obj_integrity = max(obj_integrity, max_integrity)
- update_icon()
+ if(!O.tool_start_check(user, amount=0))
+ return
+
+ user.visible_message("[user] begins repairing [src].", \
+ "You begin repairing [src]...", \
+ "You hear welding.")
+
+ if(O.use_tool(src, user, 40, volume=50))
+ if(!(stat & BROKEN))
+ return
+ to_chat(user, "You repair [src].")
+ stat &= ~BROKEN
+ obj_integrity = max(obj_integrity, max_integrity)
+ update_icon()
else
to_chat(user, "[src] does not need repairs.")
else
diff --git a/code/game/machinery/buttons.dm b/code/game/machinery/buttons.dm
index b98976d83c..7379185505 100644
--- a/code/game/machinery/buttons.dm
+++ b/code/game/machinery/buttons.dm
@@ -87,8 +87,8 @@
if(!device && !board && istype(W, /obj/item/wrench))
to_chat(user, "You start unsecuring the button frame...")
- playsound(loc, W.usesound, 50, 1)
- if(do_after(user, 40*W.toolspeed, target = src))
+ W.play_tool_sound(src)
+ if(W.use_tool(src, user, 40))
to_chat(user, "You unsecure the button frame.")
transfer_fingerprints_to(new /obj/item/wallframe/button(get_turf(src)))
playsound(loc, 'sound/items/deconstruct.ogg', 50, 1)
diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm
index 14502b9e46..2127eb095b 100644
--- a/code/game/machinery/camera/camera.dm
+++ b/code/game/machinery/camera/camera.dm
@@ -139,7 +139,7 @@
if(istype(W, /obj/item/screwdriver))
panel_open = !panel_open
to_chat(user, "You screw the camera's panel [panel_open ? "open" : "closed"].")
- playsound(src.loc, W.usesound, 50, 1)
+ W.play_tool_sound(src)
return
if(panel_open)
@@ -367,19 +367,16 @@
return null
-/obj/machinery/camera/proc/weld(obj/item/weldingtool/WT, mob/living/user)
+/obj/machinery/camera/proc/weld(obj/item/weldingtool/W, mob/living/user)
if(busy)
return FALSE
- if(!WT.remove_fuel(0, user))
+ if(!W.tool_start_check(user, amount=0))
return FALSE
to_chat(user, "You start to weld [src]...")
- playsound(src.loc, WT.usesound, 50, 1)
busy = TRUE
- if(do_after(user, 100*WT.toolspeed, target = src))
+ if(W.use_tool(src, user, 100, volume=50))
busy = FALSE
- if(!WT.isOn())
- return FALSE
return TRUE
busy = FALSE
return FALSE
diff --git a/code/game/machinery/camera/camera_assembly.dm b/code/game/machinery/camera/camera_assembly.dm
index b6cec23110..807ffbbe9a 100644
--- a/code/game/machinery/camera/camera_assembly.dm
+++ b/code/game/machinery/camera/camera_assembly.dm
@@ -81,7 +81,7 @@
var/obj/U = locate(/obj) in upgrades
if(U)
to_chat(user, "You unattach an upgrade from the assembly.")
- playsound(src, tool.usesound, 50, 1)
+ tool.play_tool_sound(src)
U.forceMove(drop_location())
upgrades -= U
return TRUE
@@ -90,7 +90,7 @@
if(state != 3)
return FALSE
- playsound(src, tool.usesound, 50, 1)
+ tool.play_tool_sound(src)
var/input = stripped_input(user, "Which networks would you like to connect this camera to? Separate networks with a comma. No Spaces!\nFor example: SS13,Security,Secret ", "Set Network", "SS13")
if(!input)
to_chat(user, "No input found, please hang up and try your call again!")
@@ -109,35 +109,32 @@
C.c_tag = "[A.name] ([rand(1, 999)])"
return TRUE
-/obj/structure/camera_assembly/wirecutter_act(mob/user, obj/item/tool)
+/obj/structure/camera_assembly/wirecutter_act(mob/user, obj/item/I)
if(state != 3)
return FALSE
- new /obj/item/stack/cable_coil(get_turf(src), 2)
- playsound(src, tool.usesound, 50, 1)
+ new /obj/item/stack/cable_coil(drop_location(), 2)
+ I.play_tool_sound(src)
to_chat(user, "You cut the wires from the circuits.")
state = 2
return TRUE
-/obj/structure/camera_assembly/wrench_act(mob/user, obj/item/tool)
+/obj/structure/camera_assembly/wrench_act(mob/user, obj/item/I)
if(state != 1)
return FALSE
- playsound(src, tool.usesound, 50, 1)
+ I.play_tool_sound(src)
to_chat(user, "You unattach the assembly from its place.")
- new /obj/item/wallframe/camera(get_turf(src))
+ new /obj/item/wallframe/camera(drop_location())
qdel(src)
return TRUE
-/obj/structure/camera_assembly/proc/weld(obj/item/weldingtool/WT, mob/living/user)
- if(!WT.remove_fuel(0, user))
- return 0
+/obj/structure/camera_assembly/proc/weld(obj/item/weldingtool/W, mob/living/user)
+ if(!W.tool_start_check(user, amount=0))
+ return FALSE
to_chat(user, "You start to weld \the [src]...")
- playsound(src.loc, WT.usesound, 50, 1)
- if(do_after(user, 20*WT.toolspeed, target = src))
- if(WT.isOn())
- playsound(loc, 'sound/items/welder2.ogg', 50, 1)
- return 1
- return 0
+ if(W.use_tool(src, user, 20, volume=50))
+ return TRUE
+ return FALSE
/obj/structure/camera_assembly/deconstruct(disassembled = TRUE)
if(!(flags_1 & NODECONSTRUCT_1))
diff --git a/code/game/machinery/cell_charger.dm b/code/game/machinery/cell_charger.dm
index 169d7f822b..6bcbf1e994 100644
--- a/code/game/machinery/cell_charger.dm
+++ b/code/game/machinery/cell_charger.dm
@@ -125,4 +125,4 @@
charging.give(charge_rate) //this is 2558, efficient batteries exist
updateicon()
-
+
\ No newline at end of file
diff --git a/code/game/machinery/computer/_computer.dm b/code/game/machinery/computer/_computer.dm
index 44c39d8096..2bae3b30bd 100644
--- a/code/game/machinery/computer/_computer.dm
+++ b/code/game/machinery/computer/_computer.dm
@@ -69,14 +69,13 @@
update_icon()
return
-/obj/machinery/computer/attackby(obj/item/I, mob/user, params)
- if(istype(I, /obj/item/screwdriver) && circuit && !(flags_1&NODECONSTRUCT_1))
- playsound(src.loc, I.usesound, 50, 1)
- to_chat(user, " You start to disconnect the monitor...")
- if(do_after(user, 20*I.toolspeed, target = src))
+/obj/machinery/computer/screwdriver_act(mob/living/user, obj/item/I)
+ if(circuit && !(flags_1&NODECONSTRUCT_1))
+ to_chat(user, "You start to disconnect the monitor...")
+ if(I.use_tool(src, user, 20, volume=50))
deconstruct(TRUE, user)
- else
- return ..()
+ return TRUE
+
/obj/machinery/computer/play_attack_sound(damage_amount, damage_type = BRUTE, damage_flag = 0)
switch(damage_type)
diff --git a/code/game/machinery/computer/apc_control.dm b/code/game/machinery/computer/apc_control.dm
index 03da8e2891..a5d7296ce6 100644
--- a/code/game/machinery/computer/apc_control.dm
+++ b/code/game/machinery/computer/apc_control.dm
@@ -105,12 +105,6 @@
authenticated = TRUE
auth_id = "[ID.registered_name] ([ID.assignment])"
log_activity("logged in")
- if(!authenticated) //Check for emags
- var/obj/item/card/emag/E = usr.get_active_held_item()
- if(E && istype(E) && usr.Adjacent(src))
- to_chat(usr, "You bypass [src]'s access requirements using your emag.")
- authenticated = TRUE
- log_activity("logged in") //Auth ID doesn't change, hinting that it was illicit
if(href_list["log_out"])
log_activity("logged out")
authenticated = FALSE
@@ -193,12 +187,15 @@
interact(usr) //Refresh the UI after a filter changes
/obj/machinery/computer/apc_control/emag_act(mob/user)
- if(obj_flags & EMAGGED)
- return
- user.visible_message("You emag [src], disabling precise logging and allowing you to clear logs.")
- log_game("[key_name(user)] emagged [src] at [get_area(src)], disabling operator tracking.")
+ if(!authenticated)
+ to_chat(user, "You bypass [src]'s access requirements using your emag.")
+ authenticated = TRUE
+ log_activity("logged in")
+ else if(!(obj_flags & EMAGGED))
+ user.visible_message("You emag [src], disabling precise logging and allowing you to clear logs.")
+ log_game("[key_name(user)] emagged [src] at [get_area(src)], disabling operator tracking.")
+ obj_flags |= EMAGGED
playsound(src, "sparks", 50, 1)
- obj_flags |= EMAGGED
/obj/machinery/computer/apc_control/proc/log_activity(log_text)
var/op_string = operator && !(obj_flags & EMAGGED) ? operator : "\[NULL OPERATOR\]"
diff --git a/code/game/machinery/computer/arcade.dm b/code/game/machinery/computer/arcade.dm
index 33a74256ed..17fea3cbfb 100644
--- a/code/game/machinery/computer/arcade.dm
+++ b/code/game/machinery/computer/arcade.dm
@@ -47,7 +47,9 @@
/obj/item/toy/windupToolbox = 2,
/obj/item/toy/clockwork_watch = 2,
/obj/item/toy/toy_dagger = 2,
- /obj/item/extendohand/acme = 1)
+ /obj/item/extendohand/acme = 1,
+ /obj/item/hot_potato/harmless/toy = 1,
+ /obj/item/card/emagfake = 1)
light_color = LIGHT_COLOR_GREEN
diff --git a/code/game/machinery/computer/buildandrepair.dm b/code/game/machinery/computer/buildandrepair.dm
index e32114340f..5c9cf8b8a4 100644
--- a/code/game/machinery/computer/buildandrepair.dm
+++ b/code/game/machinery/computer/buildandrepair.dm
@@ -8,24 +8,18 @@
switch(state)
if(0)
if(istype(P, /obj/item/wrench))
- playsound(src, P.usesound, 50, 1)
to_chat(user, "You start wrenching the frame into place...")
- if(do_after(user, 20*P.toolspeed, target = src))
+ if(P.use_tool(src, user, 20, volume=50))
to_chat(user, "You wrench the frame into place.")
anchored = TRUE
state = 1
return
if(istype(P, /obj/item/weldingtool))
- var/obj/item/weldingtool/WT = P
- if(!WT.remove_fuel(0, user))
- if(!WT.isOn())
- to_chat(user, "[WT] must be on to complete this task!")
+ if(!P.tool_start_check(user, amount=0))
return
- playsound(src, P.usesound, 50, 1)
+
to_chat(user, "You start deconstructing the frame...")
- if(do_after(user, 20*P.toolspeed, target = src))
- if(!src || !WT.isOn())
- return
+ if(P.use_tool(src, user, 20, volume=50))
to_chat(user, "You deconstruct the frame.")
var/obj/item/stack/sheet/metal/M = new (drop_location(), 5)
M.add_fingerprint(user)
@@ -33,9 +27,8 @@
return
if(1)
if(istype(P, /obj/item/wrench))
- playsound(src, P.usesound, 50, 1)
to_chat(user, "You start to unfasten the frame...")
- if(do_after(user, 20*P.toolspeed, target = src))
+ if(P.use_tool(src, user, 20, volume=50))
to_chat(user, "You unfasten the frame.")
anchored = FALSE
state = 0
@@ -54,13 +47,13 @@
to_chat(user, "This frame does not accept circuit boards of this type!")
return
if(istype(P, /obj/item/screwdriver) && circuit)
- playsound(src, P.usesound, 50, 1)
+ P.play_tool_sound(src)
to_chat(user, "You screw [circuit] into place.")
state = 2
icon_state = "2"
return
if(istype(P, /obj/item/crowbar) && circuit)
- playsound(src, P.usesound, 50, 1)
+ P.play_tool_sound(src)
to_chat(user, "You remove [circuit].")
state = 1
icon_state = "0"
@@ -70,54 +63,47 @@
return
if(2)
if(istype(P, /obj/item/screwdriver) && circuit)
- playsound(src, P.usesound, 50, 1)
+ P.play_tool_sound(src)
to_chat(user, "You unfasten the circuit board.")
state = 1
icon_state = "1"
return
if(istype(P, /obj/item/stack/cable_coil))
- var/obj/item/stack/cable_coil/C = P
- if(C.get_amount() >= 5)
- playsound(src, 'sound/items/deconstruct.ogg', 50, 1)
- to_chat(user, "You start adding cables to the frame...")
- if(do_after(user, 20*P.toolspeed, target = src))
- if(C.get_amount() >= 5 && state == 2)
- C.use(5)
- to_chat(user, "You add cables to the frame.")
- state = 3
- icon_state = "3"
- else
- to_chat(user, "You need five lengths of cable to wire the frame!")
+ if(!P.tool_start_check(user, amount=5))
+ return
+ to_chat(user, "You start adding cables to the frame...")
+ if(P.use_tool(src, user, 20, volume=50, amount=5))
+ if(state != 2)
+ return
+ to_chat(user, "You add cables to the frame.")
+ state = 3
+ icon_state = "3"
return
if(3)
if(istype(P, /obj/item/wirecutters))
- playsound(src, P.usesound, 50, 1)
+ P.play_tool_sound(src)
to_chat(user, "You remove the cables.")
state = 2
icon_state = "2"
- var/obj/item/stack/cable_coil/A = new (drop_location())
- A.amount = 5
+ var/obj/item/stack/cable_coil/A = new (drop_location(), 5)
A.add_fingerprint(user)
return
if(istype(P, /obj/item/stack/sheet/glass))
- var/obj/item/stack/sheet/glass/G = P
- if(G.get_amount() < 2)
- to_chat(user, "You need two glass sheets to continue construction!")
+ if(!P.tool_start_check(user, amount=2))
return
- else
- playsound(src, 'sound/items/deconstruct.ogg', 50, 1)
- to_chat(user, "You start to put in the glass panel...")
- if(do_after(user, 20, target = src))
- if(G.get_amount() >= 2 && state == 3)
- G.use(2)
- to_chat(user, "You put in the glass panel.")
- state = 4
- src.icon_state = "4"
+ playsound(src, 'sound/items/deconstruct.ogg', 50, 1)
+ to_chat(user, "You start to put in the glass panel...")
+ if(P.use_tool(src, user, 20, amount=2))
+ if(state != 3)
+ return
+ to_chat(user, "You put in the glass panel.")
+ state = 4
+ src.icon_state = "4"
return
if(4)
if(istype(P, /obj/item/crowbar))
- playsound(src, P.usesound, 50, 1)
+ P.play_tool_sound(src)
to_chat(user, "You remove the glass panel.")
state = 3
icon_state = "3"
@@ -125,7 +111,7 @@
G.add_fingerprint(user)
return
if(istype(P, /obj/item/screwdriver))
- playsound(src, P.usesound, 50, 1)
+ P.play_tool_sound(src)
to_chat(user, "You connect the monitor.")
var/obj/B = new circuit.build_path (loc, circuit)
B.dir = dir
diff --git a/code/game/machinery/constructable_frame.dm b/code/game/machinery/constructable_frame.dm
index 97830393bd..6c9b8e3a0d 100644
--- a/code/game/machinery/constructable_frame.dm
+++ b/code/game/machinery/constructable_frame.dm
@@ -81,24 +81,20 @@
to_chat(user, "This frame does not accept circuit boards of this type!")
return
if(istype(P, /obj/item/stack/cable_coil))
- var/obj/item/stack/cable_coil/C = P
- if(C.get_amount() >= 5)
- playsound(src.loc, 'sound/items/deconstruct.ogg', 50, 1)
- to_chat(user, "You start to add cables to the frame...")
- if(do_after(user, 20*P.toolspeed, target = src))
- if(C.get_amount() >= 5 && state == 1)
- C.use(5)
- to_chat(user, "You add cables to the frame.")
- state = 2
- icon_state = "box_1"
- else
- to_chat(user, "You need five length of cable to wire the frame!")
+ if(!P.tool_start_check(user, amount=5))
+ return
+
+ to_chat(user, "You start to add cables to the frame...")
+ if(P.use_tool(src, user, 20, volume=50, amount=5))
+ to_chat(user, "You add cables to the frame.")
+ state = 2
+ icon_state = "box_1"
+
return
if(istype(P, /obj/item/screwdriver) && !anchored)
- playsound(src.loc, P.usesound, 50, 1)
user.visible_message("[user] disassembles the frame.", \
"You start to disassemble the frame...", "You hear banging and clanking.")
- if(do_after(user, 40*P.toolspeed, target = src))
+ if(P.use_tool(src, user, 40, volume=50))
if(state == 1)
to_chat(user, "You disassemble the frame.")
var/obj/item/stack/sheet/metal/M = new (loc, 5)
@@ -107,8 +103,7 @@
return
if(istype(P, /obj/item/wrench))
to_chat(user, "You start [anchored ? "un" : ""]securing [name]...")
- playsound(src.loc, P.usesound, 75, 1)
- if(do_after(user, 40*P.toolspeed, target = src))
+ if(P.use_tool(src, user, 40, volume=75))
if(state == 1)
to_chat(user, "You [anchored ? "un" : ""]secure [name].")
anchored = !anchored
@@ -117,8 +112,7 @@
if(2)
if(istype(P, /obj/item/wrench))
to_chat(user, "You start [anchored ? "un" : ""]securing [name]...")
- playsound(src.loc, P.usesound, 75, 1)
- if(do_after(user, 40*P.toolspeed, target = src))
+ if(P.use_tool(src, user, 40, volume=75))
to_chat(user, "You [anchored ? "un" : ""]secure [name].")
anchored = !anchored
return
@@ -145,17 +139,16 @@
return
if(istype(P, /obj/item/wirecutters))
- playsound(src.loc, P.usesound, 50, 1)
+ P.play_tool_sound(src)
to_chat(user, "You remove the cables.")
state = 1
icon_state = "box_0"
- var/obj/item/stack/cable_coil/A = new /obj/item/stack/cable_coil( src.loc )
- A.amount = 5
+ new /obj/item/stack/cable_coil(drop_location(), 5)
return
if(3)
if(istype(P, /obj/item/crowbar))
- playsound(src.loc, P.usesound, 50, 1)
+ P.play_tool_sound(src)
state = 2
circuit.forceMove(drop_location())
components.Remove(circuit)
@@ -179,7 +172,7 @@
component_check = 0
break
if(component_check)
- playsound(src.loc, P.usesound, 50, 1)
+ P.play_tool_sound(src)
var/obj/machinery/new_machine = new src.circuit.build_path(src.loc, 1)
new_machine.on_construction()
for(var/obj/O in new_machine.component_parts)
diff --git a/code/game/machinery/deployable.dm b/code/game/machinery/deployable.dm
index 007ef8e986..130d276184 100644
--- a/code/game/machinery/deployable.dm
+++ b/code/game/machinery/deployable.dm
@@ -27,13 +27,13 @@
/obj/structure/barricade/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/weldingtool) && user.a_intent != INTENT_HARM && material == METAL)
- var/obj/item/weldingtool/WT = I
if(obj_integrity < max_integrity)
- if(WT.remove_fuel(0,user))
- to_chat(user, "You begin repairing [src]...")
- playsound(loc, WT.usesound, 40, 1)
- if(do_after(user, 40*I.toolspeed, target = src))
- obj_integrity = CLAMP(obj_integrity + 20, 0, max_integrity)
+ if(!I.tool_start_check(user, amount=0))
+ return
+
+ to_chat(user, "You begin repairing [src]...")
+ if(I.use_tool(src, user, 40, volume=40))
+ obj_integrity = CLAMP(obj_integrity + 20, 0, max_integrity)
else
return ..()
diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm
index 325adb30b7..6bdca31c68 100644
--- a/code/game/machinery/doors/airlock.dm
+++ b/code/game/machinery/doors/airlock.dm
@@ -782,15 +782,12 @@
return
if(AIRLOCK_SECURITY_METAL)
if(istype(C, /obj/item/weldingtool))
- var/obj/item/weldingtool/WT = C
- if(!WT.remove_fuel(2, user))
+ if(!C.tool_start_check(user, amount=2))
return
to_chat(user, "You begin cutting the panel's shielding...")
- playsound(loc, WT.usesound, 40, 1)
- if(do_after(user, 40*WT.toolspeed, 1, target = src))
- if(!panel_open || !WT.isOn())
+ if(C.use_tool(src, user, 40, volume=50, amount = 2))
+ if(!panel_open)
return
- playsound(loc, WT.usesound, 50, 1)
user.visible_message("[user] cuts through \the [src]'s shielding.",
"You cut through \the [src]'s shielding.",
"You hear welding.")
@@ -802,8 +799,7 @@
if(istype(C, /obj/item/crowbar))
var/obj/item/crowbar/W = C
to_chat(user, "You start removing the inner layer of shielding...")
- playsound(src, W.usesound, 100, 1)
- if(do_after(user, 40*W.toolspeed, 1, target = src))
+ if(W.use_tool(src, user, 40, volume=100))
if(!panel_open)
return
if(security_level != AIRLOCK_SECURITY_PLASTEEL_I_S)
@@ -818,15 +814,12 @@
return
if(AIRLOCK_SECURITY_PLASTEEL_I)
if(istype(C, /obj/item/weldingtool))
- var/obj/item/weldingtool/WT = C
- if(!WT.remove_fuel(2, user))
+ if(!C.tool_start_check(user, amount=2))
return
to_chat(user, "You begin cutting the inner layer of shielding...")
- playsound(loc, WT.usesound, 40, 1)
- if(do_after(user, 40*WT.toolspeed, 1, target = src))
- if(!panel_open || !WT.isOn())
+ if(C.use_tool(src, user, 40, volume=50, amount=2))
+ if(!panel_open)
return
- playsound(loc, WT.usesound, 50, 1)
user.visible_message("[user] cuts through \the [src]'s shielding.",
"You cut through \the [src]'s shielding.",
"You hear welding.")
@@ -834,10 +827,8 @@
return
if(AIRLOCK_SECURITY_PLASTEEL_O_S)
if(istype(C, /obj/item/crowbar))
- var/obj/item/crowbar/W = C
to_chat(user, "You start removing outer layer of shielding...")
- playsound(src, W.usesound, 100, 1)
- if(do_after(user, 40*W.toolspeed, 1, target = src))
+ if(C.use_tool(src, user, 40, volume=100))
if(!panel_open)
return
if(security_level != AIRLOCK_SECURITY_PLASTEEL_O_S)
@@ -849,15 +840,12 @@
return
if(AIRLOCK_SECURITY_PLASTEEL_O)
if(istype(C, /obj/item/weldingtool))
- var/obj/item/weldingtool/WT = C
- if(!WT.remove_fuel(2, user))
+ if(!C.tool_start_check(user, amount=2))
return
to_chat(user, "You begin cutting the outer layer of shielding...")
- playsound(loc, WT.usesound, 40, 1)
- if(do_after(user, 40*WT.toolspeed, 1, target = src))
- if(!panel_open || !WT.isOn())
+ if(C.use_tool(src, user, 40, volume=50, amount=2))
+ if(!panel_open)
return
- playsound(loc, WT.usesound, 50, 1)
user.visible_message("[user] cuts through \the [src]'s shielding.",
"You cut through \the [src]'s shielding.",
"You hear welding.")
@@ -865,12 +853,10 @@
return
if(AIRLOCK_SECURITY_PLASTEEL)
if(istype(C, /obj/item/wirecutters))
- var/obj/item/wirecutters/W = C
if(src.hasPower() && src.shock(user, 60)) // Protective grille of wiring is electrified
return
to_chat(user, "You start cutting through the outer grille.")
- playsound(src, W.usesound, 100, 1)
- if(do_after(user, 10*W.toolspeed, 1, target = src))
+ if(C.use_tool(src, user, 10, volume=100))
if(!panel_open)
return
user.visible_message("[user] cut through \the [src]'s outer grille.",
@@ -883,11 +869,11 @@
return
panel_open = !panel_open
to_chat(user, "You [panel_open ? "open":"close"] the maintenance panel of the airlock.")
- playsound(src.loc, C.usesound, 50, 1)
+ C.play_tool_sound(src)
src.update_icon()
else if(istype(C, /obj/item/wirecutters) && note)
user.visible_message("[user] cuts down [note] from [src].", "You remove [note] from [src].")
- playsound(src, 'sound/items/Wirecutter.ogg', 50, 1)
+ C.play_tool_sound(src)
note.forceMove(get_turf(user))
note = null
update_icon()
@@ -932,36 +918,34 @@
/obj/machinery/door/airlock/try_to_weld(obj/item/weldingtool/W, mob/user)
if(!operating && density)
if(user.a_intent != INTENT_HELP)
- if(W.remove_fuel(0,user))
- user.visible_message("[user] is [welded ? "unwelding":"welding"] the airlock.", \
- "You begin [welded ? "unwelding":"welding"] the airlock...", \
- "You hear welding.")
- playsound(loc, W.usesound, 40, 1)
- if(do_after(user,40*W.toolspeed, 1, target = src, extra_checks = CALLBACK(src, .proc/weld_checks, W, user)))
- playsound(loc, 'sound/items/welder2.ogg', 50, 1)
- welded = !welded
- user.visible_message("[user.name] has [welded? "welded shut":"unwelded"] [src].", \
- "You [welded ? "weld the airlock shut":"unweld the airlock"].")
- update_icon()
+ if(!W.tool_start_check(user, amount=0))
+ return
+ user.visible_message("[user] is [welded ? "unwelding":"welding"] the airlock.", \
+ "You begin [welded ? "unwelding":"welding"] the airlock...", \
+ "You hear welding.")
+ if(W.use_tool(src, user, 40, volume=50, extra_checks = CALLBACK(src, .proc/weld_checks, W, user)))
+ welded = !welded
+ user.visible_message("[user.name] has [welded? "welded shut":"unwelded"] [src].", \
+ "You [welded ? "weld the airlock shut":"unweld the airlock"].")
+ update_icon()
else
if(obj_integrity < max_integrity)
- if(W.remove_fuel(0,user))
- user.visible_message("[user] is welding the airlock.", \
- "You begin repairing the airlock...", \
- "You hear welding.")
- playsound(loc, W.usesound, 40, 1)
- if(do_after(user,40*W.toolspeed, 1, target = src, extra_checks = CALLBACK(src, .proc/weld_checks, W, user)))
- playsound(loc, 'sound/items/welder2.ogg', 50, 1)
- obj_integrity = max_integrity
- stat &= ~BROKEN
- user.visible_message("[user.name] has repaired [src].", \
- "You finish repairing the airlock.")
- update_icon()
+ if(!W.tool_start_check(user, amount=0))
+ return
+ user.visible_message("[user] is welding the airlock.", \
+ "You begin repairing the airlock...", \
+ "You hear welding.")
+ if(W.use_tool(src, user, 40, volume=50, extra_checks = CALLBACK(src, .proc/weld_checks, W, user)))
+ obj_integrity = max_integrity
+ stat &= ~BROKEN
+ user.visible_message("[user.name] has repaired [src].", \
+ "You finish repairing the airlock.")
+ update_icon()
else
to_chat(user, "The airlock doesn't need repairing.")
/obj/machinery/door/airlock/proc/weld_checks(obj/item/weldingtool/W, mob/user)
- return !operating && density && user && W && W.isOn() && user.loc
+ return !operating && density
/obj/machinery/door/airlock/try_to_crowbar(obj/item/I, mob/living/user)
var/beingcrowbarred = null
@@ -971,8 +955,7 @@
beingcrowbarred = 0
if(panel_open && charge)
to_chat(user, "You carefully start removing [charge] from [src]...")
- playsound(get_turf(src), I.usesound, 50, 1)
- if(!do_after(user, 150*I.toolspeed, target = src))
+ if(!I.use_tool(src, user, 150, volume=50))
to_chat(user, "You slip and [charge] detonates!")
charge.ex_act(EXPLODE_DEVASTATE)
user.Knockdown(60)
@@ -983,13 +966,11 @@
charge = null
return
if(beingcrowbarred && panel_open && ((obj_flags & EMAGGED) || (density && welded && !operating && !hasPower() && !locked)))
- playsound(src.loc, I.usesound, 100, 1)
user.visible_message("[user] removes the electronics from the airlock assembly.", \
"You start to remove electronics from the airlock assembly...")
- if(do_after(user,40*I.toolspeed, target = src))
- if(src.loc)
- deconstruct(TRUE, user)
- return
+ if(I.use_tool(src, user, 40, volume=100))
+ deconstruct(TRUE, user)
+ return
else if(hasPower())
to_chat(user, "The airlock's motors resist your efforts to force it!")
else if(locked)
diff --git a/code/game/machinery/doors/airlock_types.dm b/code/game/machinery/doors/airlock_types.dm
index feb1cfc22a..dc734b387d 100644
--- a/code/game/machinery/doors/airlock_types.dm
+++ b/code/game/machinery/doors/airlock_types.dm
@@ -576,16 +576,14 @@
else if(istype(I, /obj/item/wrench))
if(construction_state == GEAR_SECURE)
user.visible_message("[user] begins loosening [src]'s cogwheel...", "You begin loosening [src]'s cogwheel...")
- playsound(src, I.usesound, 50, 1)
- if(!do_after(user, 75*I.toolspeed, target = src) || construction_state != GEAR_SECURE)
+ if(!I.use_tool(src, user, 75, volume=50) || construction_state != GEAR_SECURE)
return 1
user.visible_message("[user] loosens [src]'s cogwheel!", "[src]'s cogwheel pops off and dangles loosely.")
playsound(src, 'sound/items/deconstruct.ogg', 50, 1)
construction_state = GEAR_LOOSE
else if(construction_state == GEAR_LOOSE)
user.visible_message("[user] begins tightening [src]'s cogwheel...", "You begin tightening [src]'s cogwheel into place...")
- playsound(src, I.usesound, 50, 1)
- if(!do_after(user, 75*I.toolspeed, target = src) || construction_state != GEAR_LOOSE)
+ if(!I.use_tool(src, user, 75, volume=50) || construction_state != GEAR_LOOSE)
return 1
user.visible_message("[user] tightens [src]'s cogwheel!", "You firmly tighten [src]'s cogwheel into place.")
playsound(src, 'sound/items/deconstruct.ogg', 50, 1)
@@ -597,8 +595,7 @@
return 1
else if(construction_state == GEAR_LOOSE)
user.visible_message("[user] begins slowly lifting off [src]'s cogwheel...", "You slowly begin lifting off [src]'s cogwheel...")
- playsound(src, I.usesound, 50, 1)
- if(!do_after(user, 75*I.toolspeed, target = src) || construction_state != GEAR_LOOSE)
+ if(!I.use_tool(src, user, 75, volume=50) || construction_state != GEAR_LOOSE)
return 1
user.visible_message("[user] lifts off [src]'s cogwheel, causing it to fall apart!", \
"You lift off [src]'s cogwheel, causing it to fall apart!")
diff --git a/code/game/machinery/doors/firedoor.dm b/code/game/machinery/doors/firedoor.dm
index c2ce9d5ee5..4b7d86443b 100644
--- a/code/game/machinery/doors/firedoor.dm
+++ b/code/game/machinery/doors/firedoor.dm
@@ -100,10 +100,10 @@
if(boltslocked)
to_chat(user, "There are screws locking the bolts in place!")
return
- playsound(get_turf(src), C.usesound, 50, 1)
+ C.play_tool_sound(src)
user.visible_message("[user] starts undoing [src]'s bolts...", \
"You start unfastening [src]'s floor bolts...")
- if(!do_after(user, 50*C.toolspeed, target = src))
+ if(!C.use_tool(src, user, 50))
return
playsound(get_turf(src), 'sound/items/deconstruct.ogg', 50, 1)
user.visible_message("[user] unfastens [src]'s bolts.", \
@@ -113,7 +113,7 @@
if(istype(C, /obj/item/screwdriver))
user.visible_message("[user] [boltslocked ? "unlocks" : "locks"] [src]'s bolts.", \
"You [boltslocked ? "unlock" : "lock"] [src]'s floor bolts.")
- playsound(get_turf(src), C.usesound, 50, 1)
+ C.play_tool_sound(src)
boltslocked = !boltslocked
return
@@ -123,14 +123,13 @@
return
/obj/machinery/door/firedoor/try_to_weld(obj/item/weldingtool/W, mob/user)
- if(W.remove_fuel(0, user))
- playsound(get_turf(src), W.usesound, 50, 1)
- user.visible_message("[user] starts [welded ? "unwelding" : "welding"] [src].", "You start welding [src].")
- if(do_after(user, 40*W.toolspeed, 1, target=src))
- playsound(get_turf(src), W.usesound, 50, 1)
- welded = !welded
- to_chat(user, "[user] [welded?"welds":"unwelds"] [src].", "You [welded ? "weld" : "unweld"] [src].")
- update_icon()
+ if(!W.tool_start_check(user, amount=0))
+ return
+ user.visible_message("[user] starts [welded ? "unwelding" : "welding"] [src].", "You start welding [src].")
+ if(W.use_tool(src, user, 40, volume=50))
+ welded = !welded
+ to_chat(user, "[user] [welded?"welds":"unwelds"] [src].", "You [welded ? "weld" : "unweld"] [src].")
+ update_icon()
/obj/machinery/door/firedoor/try_to_crowbar(obj/item/I, mob/user)
if(welded || operating)
@@ -284,10 +283,10 @@
switch(constructionStep)
if(CONSTRUCTION_PANEL_OPEN)
if(istype(C, /obj/item/crowbar))
- playsound(get_turf(src), C.usesound, 50, 1)
+ C.play_tool_sound(src)
user.visible_message("[user] starts prying something out from [src]...", \
"You begin prying out the wire cover...")
- if(!do_after(user, 50*C.toolspeed, target = src))
+ if(!C.use_tool(src, user, 50))
return
if(constructionStep != CONSTRUCTION_PANEL_OPEN)
return
@@ -301,10 +300,10 @@
if(locate(/obj/machinery/door/firedoor) in get_turf(src))
to_chat(user, "There's already a firelock there.")
return
- playsound(get_turf(src), C.usesound, 50, 1)
+ C.play_tool_sound(src)
user.visible_message("[user] starts bolting down [src]...", \
"You begin bolting [src]...")
- if(!do_after(user, 30*C.toolspeed, target = src))
+ if(!C.use_tool(src, user, 30))
return
if(locate(/obj/machinery/door/firedoor) in get_turf(src))
return
@@ -340,10 +339,10 @@
if(CONSTRUCTION_WIRES_EXPOSED)
if(istype(C, /obj/item/wirecutters))
- playsound(get_turf(src), C.usesound, 50, 1)
+ C.play_tool_sound(src)
user.visible_message("[user] starts cutting the wires from [src]...", \
"You begin removing [src]'s wires...")
- if(!do_after(user, 60*C.toolspeed, target = src))
+ if(!C.use_tool(src, user, 60))
return
if(constructionStep != CONSTRUCTION_WIRES_EXPOSED)
return
@@ -355,10 +354,10 @@
update_icon()
return
if(istype(C, /obj/item/crowbar))
- playsound(get_turf(src), C.usesound, 50, 1)
+ C.play_tool_sound(src)
user.visible_message("[user] starts prying a metal plate into [src]...", \
"You begin prying the cover plate back onto [src]...")
- if(!do_after(user, 80*C.toolspeed, target = src))
+ if(!C.use_tool(src, user, 80))
return
if(constructionStep != CONSTRUCTION_WIRES_EXPOSED)
return
@@ -372,15 +371,13 @@
if(istype(C, /obj/item/crowbar))
user.visible_message("[user] begins removing the circuit board from [src]...", \
"You begin prying out the circuit board from [src]...")
- playsound(get_turf(src), C.usesound, 50, 1)
- if(!do_after(user, 50*C.toolspeed, target = src))
+ if(!C.use_tool(src, user, 50, volume=50))
return
if(constructionStep != CONSTRUCTION_GUTTED)
return
user.visible_message("[user] removes [src]'s circuit board.", \
"You remove the circuit board from [src].")
- new /obj/item/electronics/firelock(get_turf(src))
- playsound(get_turf(src), C.usesound, 50, 1)
+ new /obj/item/electronics/firelock(drop_location())
constructionStep = CONSTRUCTION_NOCIRCUIT
update_icon()
return
@@ -404,18 +401,17 @@
return
if(CONSTRUCTION_NOCIRCUIT)
if(istype(C, /obj/item/weldingtool))
- var/obj/item/weldingtool/W = C
- if(W.remove_fuel(1,user))
- playsound(get_turf(src), W.usesound, 50, 1)
- user.visible_message("[user] begins cutting apart [src]'s frame...", \
- "You begin slicing [src] apart...")
- if(!do_after(user, 80*C.toolspeed, target = src))
- return
+ if(!C.tool_start_check(user, amount=1))
+ return
+ user.visible_message("[user] begins cutting apart [src]'s frame...", \
+ "You begin slicing [src] apart...")
+
+ if(C.use_tool(src, user, 40, volume=50, amount=1))
+ return
if(constructionStep != CONSTRUCTION_NOCIRCUIT)
return
user.visible_message("[user] cuts apart [src]!", \
"You cut [src] into metal.")
- playsound(get_turf(src), 'sound/items/welder2.ogg', 50, 1)
var/turf/T = get_turf(src)
new /obj/item/stack/sheet/metal(T, 3)
if(reinforced)
diff --git a/code/game/machinery/doors/windowdoor.dm b/code/game/machinery/doors/windowdoor.dm
index 1969b1cb16..3c646265f7 100644
--- a/code/game/machinery/doors/windowdoor.dm
+++ b/code/game/machinery/doors/windowdoor.dm
@@ -227,17 +227,16 @@
if(density || operating)
to_chat(user, "You need to open the door to access the maintenance panel!")
return
- playsound(src.loc, I.usesound, 50, 1)
+ I.play_tool_sound(src)
panel_open = !panel_open
to_chat(user, "You [panel_open ? "open":"close"] the maintenance panel of the [src.name].")
return
if(istype(I, /obj/item/crowbar))
if(panel_open && !density && !operating)
- playsound(src.loc, I.usesound, 100, 1)
user.visible_message("[user] removes the electronics from the [src.name].", \
"You start to remove electronics from the [src.name]...")
- if(do_after(user,40*I.toolspeed, target = src))
+ if(I.use_tool(src, user, 40, volume=50))
if(panel_open && !density && !operating && src.loc)
var/obj/structure/windoor_assembly/WA = new /obj/structure/windoor_assembly(src.loc)
switch(base_state)
diff --git a/code/game/machinery/doppler_array.dm b/code/game/machinery/doppler_array.dm
index 084bb29591..1b4d495f88 100644
--- a/code/game/machinery/doppler_array.dm
+++ b/code/game/machinery/doppler_array.dm
@@ -29,8 +29,8 @@ GLOBAL_LIST_EMPTY(doppler_arrays)
/obj/machinery/doppler_array/process()
return PROCESS_KILL
-/obj/machinery/doppler_array/attackby(obj/item/O, mob/user, params)
- if(istype(O, /obj/item/wrench))
+/obj/machinery/doppler_array/attackby(obj/item/I, mob/user, params)
+ if(istype(I, /obj/item/wrench))
if(!anchored && !isinspace())
anchored = TRUE
power_change()
@@ -39,7 +39,7 @@ GLOBAL_LIST_EMPTY(doppler_arrays)
anchored = FALSE
power_change()
to_chat(user, "You unfasten [src].")
- playsound(loc, O.usesound, 50, 1)
+ I.play_tool_sound(src)
else
return ..()
@@ -109,14 +109,14 @@ GLOBAL_LIST_EMPTY(doppler_arrays)
. = ..()
if(!istype(linked_techweb))
say("Warning: No linked research system!")
- return
+ return
var/adjusted = orig_light - 10 - linked_techweb.max_bomb_value
if(adjusted <= 0)
say("Explosion not large enough for research calculations.")
return
var/point_gain = techweb_scale_bomb(adjusted)
if(point_gain <= 0)
- say("Explosion not large enough for research calculations.")
+ say("Explosion not large enough for research calculations.")
return
linked_techweb.max_bomb_value = orig_light - 10
linked_techweb.research_points += point_gain
diff --git a/code/game/machinery/droneDispenser.dm b/code/game/machinery/droneDispenser.dm
index 54183c155e..cf2eed6f53 100644
--- a/code/game/machinery/droneDispenser.dm
+++ b/code/game/machinery/droneDispenser.dm
@@ -210,35 +210,26 @@
else
icon_state = icon_on
-/obj/machinery/droneDispenser/attackby(obj/item/O, mob/living/user)
- if(istype(O, /obj/item/crowbar))
+/obj/machinery/droneDispenser/attackby(obj/item/I, mob/living/user)
+ if(istype(I, /obj/item/crowbar))
GET_COMPONENT(materials, /datum/component/material_container)
materials.retrieve_all()
- playsound(loc, O.usesound, 50, 1)
+ I.play_tool_sound(src)
to_chat(user, "You retrieve the materials from [src].")
- else if(istype(O, /obj/item/weldingtool))
+ else if(istype(I, /obj/item/weldingtool))
if(!(stat & BROKEN))
to_chat(user, "[src] doesn't need repairs.")
return
- var/obj/item/weldingtool/WT = O
-
- if(!WT.isOn())
+ if(!I.tool_start_check(user, amount=1))
return
- if(WT.get_fuel() < 1)
- to_chat(user, "You need more fuel to complete this task!")
- return
-
- playsound(src, WT.usesound, 50, 1)
user.visible_message(
- "[user] begins patching up [src] with [WT].",
+ "[user] begins patching up [src] with [I].",
"You begin restoring the damage to [src]...")
- if(!do_after(user, 40*O.toolspeed, target = src))
- return
- if(!src || !WT.remove_fuel(1, user))
+ if(!I.use_tool(src, user, 40, volume=50, amount=1))
return
user.visible_message(
diff --git a/code/game/machinery/firealarm.dm b/code/game/machinery/firealarm.dm
index 583a229937..bf3255385c 100644
--- a/code/game/machinery/firealarm.dm
+++ b/code/game/machinery/firealarm.dm
@@ -149,7 +149,7 @@
add_fingerprint(user)
if(istype(W, /obj/item/screwdriver) && buildstage == 2)
- playsound(src.loc, W.usesound, 50, 1)
+ W.play_tool_sound(src)
panel_open = !panel_open
to_chat(user, "The wires have been [panel_open ? "exposed" : "unexposed"].")
update_icon()
@@ -158,15 +158,14 @@
if(panel_open)
if(istype(W, /obj/item/weldingtool) && user.a_intent == INTENT_HELP)
- var/obj/item/weldingtool/WT = W
if(obj_integrity < max_integrity)
- if(WT.remove_fuel(0,user))
- to_chat(user, "You begin repairing [src]...")
- playsound(loc, WT.usesound, 40, 1)
- if(do_after(user, 40*WT.toolspeed, target = src))
- obj_integrity = max_integrity
- playsound(loc, 'sound/items/welder2.ogg', 50, 1)
- to_chat(user, "You repair [src].")
+ if(!W.tool_start_check(user, amount=0))
+ return
+
+ to_chat(user, "You begin repairing [src]...")
+ if(W.use_tool(src, user, 40, volume=50))
+ obj_integrity = max_integrity
+ to_chat(user, "You repair [src].")
else
to_chat(user, "[src] is already in good condition!")
return
@@ -183,7 +182,7 @@
else if (istype(W, /obj/item/wirecutters))
buildstage = 1
- playsound(src.loc, W.usesound, 50, 1)
+ W.play_tool_sound(src)
new /obj/item/stack/cable_coil(user.loc, 5)
to_chat(user, "You cut the wires from \the [src].")
update_icon()
@@ -201,10 +200,9 @@
return
else if(istype(W, /obj/item/crowbar))
- playsound(src.loc, W.usesound, 50, 1)
user.visible_message("[user.name] removes the electronics from [src.name].", \
"You start prying out the circuit...")
- if(do_after(user, 20*W.toolspeed, target = src))
+ if(W.use_tool(src, user, 20, volume=50))
if(buildstage == 1)
if(stat & BROKEN)
to_chat(user, "You remove the destroyed circuit.")
@@ -238,7 +236,7 @@
"You remove the fire alarm assembly from the wall.")
var/obj/item/wallframe/firealarm/frame = new /obj/item/wallframe/firealarm()
frame.forceMove(user.drop_location())
- playsound(src.loc, W.usesound, 50, 1)
+ W.play_tool_sound(src)
qdel(src)
return
return ..()
diff --git a/code/game/machinery/flasher.dm b/code/game/machinery/flasher.dm
index 9bf40542a7..9bed526992 100644
--- a/code/game/machinery/flasher.dm
+++ b/code/game/machinery/flasher.dm
@@ -54,8 +54,7 @@
if (istype(W, /obj/item/wirecutters))
if (bulb)
user.visible_message("[user] begins to disconnect [src]'s flashbulb.", "You begin to disconnect [src]'s flashbulb...")
- playsound(src.loc, W.usesound, 100, 1)
- if(do_after(user, 30*W.toolspeed, target = src) && bulb)
+ if(W.use_tool(src, user, 30, volume=50) && bulb)
user.visible_message("[user] has disconnected [src]'s flashbulb!", "You disconnect [src]'s flashbulb.")
bulb.forceMove(loc)
bulb = null
@@ -74,8 +73,7 @@
else if (istype(W, /obj/item/wrench))
if(!bulb)
to_chat(user, "You start unsecuring the flasher frame...")
- playsound(loc, W.usesound, 50, 1)
- if(do_after(user, 40*W.toolspeed, target = src))
+ if(W.use_tool(src, user, 40, volume=50))
to_chat(user, "You unsecure the flasher frame.")
deconstruct(TRUE)
else
@@ -165,7 +163,7 @@
/obj/machinery/flasher/portable/attackby(obj/item/W, mob/user, params)
if (istype(W, /obj/item/wrench))
- playsound(src.loc, W.usesound, 100, 1)
+ W.play_tool_sound(src, 100)
if (!anchored && !isinspace())
to_chat(user, "[src] is now secured.")
diff --git a/code/game/machinery/hologram.dm b/code/game/machinery/hologram.dm
index 594394ea8a..d1f1774c8b 100644
--- a/code/game/machinery/hologram.dm
+++ b/code/game/machinery/hologram.dm
@@ -630,4 +630,4 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/
alpha = 100
#undef HOLOPAD_PASSIVE_POWER_USAGE
-#undef HOLOGRAM_POWER_USAGE
\ No newline at end of file
+#undef HOLOGRAM_POWER_USAGE
diff --git a/code/game/machinery/newscaster.dm b/code/game/machinery/newscaster.dm
index 08ace17373..c15e26a5cf 100644
--- a/code/game/machinery/newscaster.dm
+++ b/code/game/machinery/newscaster.dm
@@ -724,8 +724,8 @@ GLOBAL_LIST_EMPTY(allCasters)
/obj/machinery/newscaster/attackby(obj/item/I, mob/living/user, params)
if(istype(I, /obj/item/wrench))
to_chat(user, "You start [anchored ? "un" : ""]securing [name]...")
- playsound(loc, I.usesound, 50, 1)
- if(do_after(user, 60*I.toolspeed, target = src))
+ I.play_tool_sound(src)
+ if(I.use_tool(src, user, 60))
playsound(loc, 'sound/items/deconstruct.ogg', 50, 1)
if(stat & BROKEN)
to_chat(user, "The broken remains of [src] fall on the ground.")
@@ -737,21 +737,19 @@ GLOBAL_LIST_EMPTY(allCasters)
new /obj/item/wallframe/newscaster(loc)
qdel(src)
else if(istype(I, /obj/item/weldingtool) && user.a_intent != INTENT_HARM)
- var/obj/item/weldingtool/WT = I
if(stat & BROKEN)
- if(WT.remove_fuel(0,user))
- user.visible_message("[user] is repairing [src].", \
- "You begin repairing [src]...", \
- "You hear welding.")
- playsound(loc, WT.usesound, 40, 1)
- if(do_after(user,40*WT.toolspeed, 1, target = src))
- if(!WT.isOn() || !(stat & BROKEN))
- return
- to_chat(user, "You repair [src].")
- playsound(loc, 'sound/items/welder2.ogg', 50, 1)
- obj_integrity = max_integrity
- stat &= ~BROKEN
- update_icon()
+ if(!I.tool_start_check(user, amount=0))
+ return
+ user.visible_message("[user] is repairing [src].", \
+ "You begin repairing [src]...", \
+ "You hear welding.")
+ if(I.use_tool(src, user, 40, volume=50))
+ if(!(stat & BROKEN))
+ return
+ to_chat(user, "You repair [src].")
+ obj_integrity = max_integrity
+ stat &= ~BROKEN
+ update_icon()
else
to_chat(user, "[src] does not need repairs.")
else
diff --git a/code/game/machinery/pipe/construction.dm b/code/game/machinery/pipe/construction.dm
index 63189ddfbc..bc192a05de 100644
--- a/code/game/machinery/pipe/construction.dm
+++ b/code/game/machinery/pipe/construction.dm
@@ -151,7 +151,7 @@ Buildable meters
A.on_construction(color, piping_layer)
transfer_fingerprints_to(A)
- playsound(src, W.usesound, 50, 1)
+ W.play_tool_sound(src)
user.visible_message( \
"[user] fastens \the [src].", \
"You fasten \the [src].", \
@@ -205,7 +205,7 @@ Buildable meters
to_chat(user, "You need to fasten it to a pipe!")
return TRUE
new /obj/machinery/meter(loc, piping_layer)
- playsound(src, I.usesound, 50, 1)
+ I.play_tool_sound(src)
to_chat(user, "You fasten the meter to the pipe.")
qdel(src)
diff --git a/code/game/machinery/pipe/pipe_dispenser.dm b/code/game/machinery/pipe/pipe_dispenser.dm
index f3d3933428..f6e1e2549d 100644
--- a/code/game/machinery/pipe/pipe_dispenser.dm
+++ b/code/game/machinery/pipe/pipe_dispenser.dm
@@ -64,35 +64,15 @@
to_chat(usr, "You put [W] back into [src].")
qdel(W)
return
- else if (istype(W, /obj/item/wrench))
- if (!anchored && !isinspace())
- playsound(src, W.usesound, 50, 1)
- to_chat(user, "You begin to fasten \the [src] to the floor...")
- if (do_after(user, 40*W.toolspeed, target = src))
- add_fingerprint(user)
- user.visible_message( \
- "[user] fastens \the [src].", \
- "You fasten \the [src]. Now it can dispense pipes.", \
- "You hear ratchet.")
- anchored = TRUE
- stat &= MAINT
- if (usr.machine==src)
- usr << browse(null, "window=pipedispenser")
- else if(anchored)
- playsound(src, W.usesound, 50, 1)
- to_chat(user, "You begin to unfasten \the [src] from the floor...")
- if (do_after(user, 20*W.toolspeed, target = src))
- add_fingerprint(user)
- user.visible_message( \
- "[user] unfastens \the [src].", \
- "You unfasten \the [src]. Now it can be pulled somewhere else.", \
- "You hear ratchet.")
- anchored = FALSE
- stat |= ~MAINT
- power_change()
else
return ..()
+/obj/machinery/pipedispenser/wrench_act(mob/living/user, obj/item/I)
+ if(default_unfasten_wrench(user, I, 40))
+ user << browse(null, "window=pipedispenser")
+
+ return TRUE
+
/obj/machinery/pipedispenser/disposal
name = "disposal pipe dispenser"
diff --git a/code/game/machinery/porta_turret/portable_turret.dm b/code/game/machinery/porta_turret/portable_turret.dm
index 2a483cdf6e..aa54ae0b4d 100644
--- a/code/game/machinery/porta_turret/portable_turret.dm
+++ b/code/game/machinery/porta_turret/portable_turret.dm
@@ -232,7 +232,7 @@
//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(I.use_tool(src, user, 20))
if(prob(70))
if(stored_gun)
stored_gun.forceMove(loc)
diff --git a/code/game/machinery/porta_turret/portable_turret_construct.dm b/code/game/machinery/porta_turret/portable_turret_construct.dm
index ab16ee67ed..66e441825b 100644
--- a/code/game/machinery/porta_turret/portable_turret_construct.dm
+++ b/code/game/machinery/porta_turret/portable_turret_construct.dm
@@ -23,14 +23,14 @@
switch(build_step)
if(PTURRET_UNSECURED) //first step
if(istype(I, /obj/item/wrench) && !anchored)
- playsound(loc, I.usesound, 100, 1)
+ I.play_tool_sound(src, 100)
to_chat(user, "You secure the external bolts.")
anchored = TRUE
build_step = PTURRET_BOLTED
return
else if(istype(I, /obj/item/crowbar) && !anchored)
- playsound(loc, I.usesound, 75, 1)
+ I.play_tool_sound(src, 75)
to_chat(user, "You dismantle the turret construction.")
new /obj/item/stack/sheet/metal( loc, 5)
qdel(src)
@@ -48,7 +48,7 @@
return
else if(istype(I, /obj/item/wrench))
- playsound(loc, I.usesound, 75, 1)
+ I.play_tool_sound(src, 75)
to_chat(user, "You unfasten the external bolts.")
anchored = FALSE
build_step = PTURRET_UNSECURED
@@ -57,27 +57,21 @@
if(PTURRET_START_INTERNAL_ARMOUR)
if(istype(I, /obj/item/wrench))
- playsound(loc, I.usesound, 100, 1)
+ I.play_tool_sound(src, 100)
to_chat(user, "You bolt the metal armor into place.")
build_step = PTURRET_INTERNAL_ARMOUR_ON
return
else if(istype(I, /obj/item/weldingtool))
- var/obj/item/weldingtool/WT = I
- if(!WT.isOn())
- return
- if(WT.get_fuel() < 5) //uses up 5 fuel.
- to_chat(user, "You need more fuel to complete this task!")
+ if(!I.tool_start_check(user, amount=5)) //uses up 5 fuel
return
- playsound(loc, WT.usesound, 50, 1)
to_chat(user, "You start to remove the turret's interior metal armor...")
- if(do_after(user, 20*I.toolspeed, target = src))
- if(!WT.isOn() || !WT.remove_fuel(5, user))
- return
+
+ if(I.use_tool(src, user, 20, volume=50, amount=5)) //uses up 5 fuel
build_step = PTURRET_BOLTED
to_chat(user, "You remove the turret's interior metal armor.")
- new /obj/item/stack/sheet/metal( loc, 2)
+ new /obj/item/stack/sheet/metal(drop_location(), 2)
return
@@ -92,7 +86,7 @@
return
else if(istype(I, /obj/item/wrench))
- playsound(loc, I.usesound, 100, 1)
+ I.play_tool_sound(src, 100)
to_chat(user, "You remove the turret's metal armor bolts.")
build_step = PTURRET_START_INTERNAL_ARMOUR
return
@@ -109,7 +103,7 @@
if(PTURRET_SENSORS_ON)
if(istype(I, /obj/item/screwdriver))
- playsound(loc, I.usesound, 100, 1)
+ I.play_tool_sound(src, 100)
build_step = PTURRET_CLOSED
to_chat(user, "You close the internal access hatch.")
return
@@ -126,24 +120,18 @@
return
else if(istype(I, /obj/item/screwdriver))
- playsound(loc, I.usesound, 100, 1)
+ I.play_tool_sound(src, 100)
build_step = PTURRET_SENSORS_ON
to_chat(user, "You open the internal access hatch.")
return
if(PTURRET_START_EXTERNAL_ARMOUR)
if(istype(I, /obj/item/weldingtool))
- var/obj/item/weldingtool/WT = I
- if(!WT.isOn())
+ if(!I.tool_start_check(user, amount=5))
return
- if(WT.get_fuel() < 5)
- to_chat(user, "You need more fuel to complete this task!")
- playsound(loc, WT.usesound, 50, 1)
to_chat(user, "You begin to weld the turret's armor down...")
- if(do_after(user, 30*I.toolspeed, target = src))
- if(!WT.isOn() || !WT.remove_fuel(5, user))
- return
+ if(I.use_tool(src, user, 30, volume=50, amount=5))
build_step = PTURRET_EXTERNAL_ARMOUR_ON
to_chat(user, "You weld the turret's armor down.")
@@ -161,7 +149,7 @@
qdel(src)
else if(istype(I, /obj/item/crowbar))
- playsound(loc, I.usesound, 75, 1)
+ I.play_tool_sound(src, 75)
to_chat(user, "You pry off the turret's exterior armor.")
new /obj/item/stack/sheet/metal(loc, 2)
build_step = PTURRET_CLOSED
diff --git a/code/game/machinery/recharger.dm b/code/game/machinery/recharger.dm
index 5a863e85da..2cca8f505c 100755
--- a/code/game/machinery/recharger.dm
+++ b/code/game/machinery/recharger.dm
@@ -29,7 +29,7 @@
anchored = !anchored
power_change()
to_chat(user, "You [anchored ? "attached" : "detached"] [src].")
- playsound(loc, G.usesound, 75, 1)
+ G.play_tool_sound(src)
return
var/allowed = is_type_in_typecache(G, allowed_devices)
diff --git a/code/game/machinery/shieldgen.dm b/code/game/machinery/shieldgen.dm
index dde4bb180c..e2c4eedc72 100644
--- a/code/game/machinery/shieldgen.dm
+++ b/code/game/machinery/shieldgen.dm
@@ -144,7 +144,7 @@
/obj/machinery/shieldgen/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/screwdriver))
- playsound(src.loc, W.usesound, 100, 1)
+ W.play_tool_sound(src, 100)
panel_open = !panel_open
if(panel_open)
to_chat(user, "You open the panel and expose the wiring.")
@@ -170,11 +170,11 @@
to_chat(user, "The bolts are covered! Unlocking this would retract the covers.")
return
if(!anchored && !isinspace())
- playsound(src.loc, W.usesound, 100, 1)
+ W.play_tool_sound(src, 100)
to_chat(user, "You secure \the [src] to the floor!")
anchored = TRUE
else if(anchored)
- playsound(src.loc, W.usesound, 100, 1)
+ W.play_tool_sound(src, 100)
to_chat(user, "You unsecure \the [src] from the floor!")
if(active)
to_chat(user, "\The [src] shuts off!")
diff --git a/code/game/machinery/syndicatebomb.dm b/code/game/machinery/syndicatebomb.dm
index 6b86c48071..0d10a1ecb9 100644
--- a/code/game/machinery/syndicatebomb.dm
+++ b/code/game/machinery/syndicatebomb.dm
@@ -116,14 +116,14 @@
to_chat(user, "The bomb must be placed on solid ground to attach it.")
else
to_chat(user, "You firmly wrench the bomb to the floor.")
- playsound(loc, I.usesound, 50, 1)
+ I.play_tool_sound(src)
anchored = TRUE
if(active)
to_chat(user, "The bolts lock in place.")
else
if(!active)
to_chat(user, "You wrench the bomb from the floor.")
- playsound(loc, I.usesound, 50, 1)
+ I.play_tool_sound(src)
anchored = FALSE
else
to_chat(user, "The bolts are locked down!")
@@ -159,18 +159,12 @@
else if(istype(I, /obj/item/weldingtool))
if(payload || !wires.is_all_cut() || !open_panel)
return
- var/obj/item/weldingtool/WT = I
- if(!WT.isOn())
- return
- if(WT.get_fuel() < 5) //uses up 5 fuel.
- to_chat(user, "You need more fuel to complete this task!")
+
+ if(!I.tool_start_check(user, amount=5)) //uses up 5 fuel
return
- playsound(loc, WT.usesound, 50, 1)
to_chat(user, "You start to cut [src] apart...")
- if(do_after(user, 20*I.toolspeed, target = src))
- if(!WT.isOn() || !WT.remove_fuel(5, user))
- return
+ if(I.use_tool(src, user, 20, volume=50, amount=5)) //uses up 5 fuel
to_chat(user, "You cut [src] apart.")
new /obj/item/stack/sheet/plasteel( loc, 5)
qdel(src)
@@ -448,7 +442,7 @@
/obj/item/bombcore/chemical/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/crowbar) && beakers.len > 0)
- playsound(loc, I.usesound, 50, 1)
+ I.play_tool_sound(src)
for (var/obj/item/B in beakers)
B.forceMove(drop_location())
beakers -= B
diff --git a/code/game/machinery/vending.dm b/code/game/machinery/vending.dm
index b0396b566a..3fa3836143 100644
--- a/code/game/machinery/vending.dm
+++ b/code/game/machinery/vending.dm
@@ -260,7 +260,7 @@
cut_overlays()
if(panel_open)
add_overlay("[initial(icon_state)]-panel")
- playsound(src, W.usesound, 50, 1)
+ W.play_tool_sound(src)
updateUsrDialog()
else
to_chat(user, "You must first secure [src].")
diff --git a/code/game/mecha/mecha_construction_paths.dm b/code/game/mecha/mecha_construction_paths.dm
index fe01877cfd..f691586a1b 100644
--- a/code/game/mecha/mecha_construction_paths.dm
+++ b/code/game/mecha/mecha_construction_paths.dm
@@ -2,77 +2,34 @@
///// Construction datums //////
////////////////////////////////
-/datum/construction/mecha/custom_action(step, atom/used_atom, mob/user)
- if(istype(used_atom, /obj/item/weldingtool))
- var/obj/item/weldingtool/W = used_atom
- if (W.remove_fuel(0, user))
+/datum/construction/mecha/custom_action(step, obj/item/I, mob/user)
+ if(I.tool_behaviour == TOOL_WELDER)
+ if(I.use_tool(holder, user, 0))
playsound(holder, 'sound/items/welder2.ogg', 50, 1)
else
return FALSE
- else if(istype(used_atom, /obj/item/wrench))
- var/obj/item/W = used_atom
- playsound(holder, W.usesound, 50, 1)
- else if(istype(used_atom, /obj/item/screwdriver))
- var/obj/item/W = used_atom
- playsound(holder, W.usesound, 50, 1)
+ else if(I.tool_behaviour)
+ return I.use_tool(holder, user, 0, volume=50)
- else if(istype(used_atom, /obj/item/wirecutters))
- var/obj/item/W = used_atom
- playsound(holder, W.usesound, 50, 1)
+ else if(istype(I, /obj/item/stack))
+ return I.use_tool(holder, user, 0, volume=50, amount=5)
- else if(istype(used_atom, /obj/item/stack/cable_coil))
- var/obj/item/stack/cable_coil/C = used_atom
- if(C.use(4))
- playsound(holder, 'sound/items/deconstruct.ogg', 50, 1)
- else
- to_chat(user, ("There's not enough cable to finish the task!"))
- return FALSE
- else if(istype(used_atom, /obj/item/stack/ore/bluespace_crystal))
- var/obj/item/stack/ore/bluespace_crystal/BSC = used_atom
- BSC.use(1)
- else if(istype(used_atom, /obj/item/stack))
- var/obj/item/stack/S = used_atom
- if(S.get_amount() < 5)
- to_chat(user, ("There's not enough material in this stack!"))
- return FALSE
- else
- S.use(5)
return TRUE
-/datum/construction/reversible/mecha/custom_action(index as num, diff as num, atom/used_atom, mob/user)
- if(istype(used_atom, /obj/item/weldingtool))
- var/obj/item/weldingtool/W = used_atom
- if (W.remove_fuel(0, user))
+/datum/construction/reversible/mecha/custom_action(index as num, diff as num, obj/item/I, mob/user)
+ if(I.tool_behaviour == TOOL_WELDER)
+ if(I.use_tool(holder, user, 0))
playsound(holder, 'sound/items/welder2.ogg', 50, 1)
else
return FALSE
- else if(istype(used_atom, /obj/item/wrench))
- var/obj/item/W = used_atom
- playsound(holder, W.usesound, 50, 1)
- else if(istype(used_atom, /obj/item/screwdriver))
- var/obj/item/W = used_atom
- playsound(holder, W.usesound, 50, 1)
+ else if(I.tool_behaviour)
+ return I.use_tool(holder, user, 0, volume=50)
- else if(istype(used_atom, /obj/item/wirecutters))
- var/obj/item/W = used_atom
- playsound(holder, W.usesound, 50, 1)
+ else if(istype(I, /obj/item/stack))
+ return I.use_tool(holder, user, 0, volume=50, amount=5)
- else if(istype(used_atom, /obj/item/stack/cable_coil))
- var/obj/item/stack/cable_coil/C = used_atom
- if (C.use(4))
- playsound(holder, 'sound/items/deconstruct.ogg', 50, 1)
- else
- to_chat(user, ("There's not enough cable to finish the task!"))
- return FALSE
- else if(istype(used_atom, /obj/item/stack))
- var/obj/item/stack/S = used_atom
- if(S.get_amount() < 5)
- to_chat(user, ("There's not enough material in this stack!"))
- return FALSE
- else
- S.use(5)
return TRUE
diff --git a/code/game/mecha/mecha_defense.dm b/code/game/mecha/mecha_defense.dm
index 065415cba9..bb0eb3c2e7 100644
--- a/code/game/mecha/mecha_defense.dm
+++ b/code/game/mecha/mecha_defense.dm
@@ -240,9 +240,8 @@
else if(istype(W, /obj/item/weldingtool) && user.a_intent != INTENT_HARM)
user.changeNext_move(CLICK_CD_MELEE)
- var/obj/item/weldingtool/WT = W
- if(obj_integrityYou repair the damaged gas tank.")
@@ -251,9 +250,7 @@
obj_integrity += min(10, max_integrity-obj_integrity)
if(obj_integrity == max_integrity)
to_chat(user, "It looks to be fully repaired now.")
- else
- to_chat(user, "[WT] needs to be on for this task!")
- return 1
+ return 1
else
to_chat(user, "The [name] is at full integrity!")
return 1
diff --git a/code/game/mecha/mecha_wreckage.dm b/code/game/mecha/mecha_wreckage.dm
index 21323855eb..dc909d90d1 100644
--- a/code/game/mecha/mecha_wreckage.dm
+++ b/code/game/mecha/mecha_wreckage.dm
@@ -36,23 +36,24 @@
/obj/structure/mecha_wreckage/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/weldingtool))
- if(salvage_num <= 0)
+ if(salvage_num <= 0 || !length(welder_salvage))
to_chat(user, "You don't see anything that can be cut with [I]!")
return
- var/obj/item/weldingtool/WT = I
- if(welder_salvage && welder_salvage.len && WT.remove_fuel(0, user))
- var/type = prob(70) ? pick(welder_salvage) : null
- if(type)
- var/N = new type(get_turf(user))
- user.visible_message("[user] cuts [N] from [src].", "You cut [N] from [src].")
- if(istype(N, /obj/item/mecha_parts/part))
- welder_salvage -= type
- salvage_num--
- else
- to_chat(user, "You fail to salvage anything valuable from [src]!")
- else
+
+ if(!I.use_tool(src, user, 0, volume=50))
return
+ var/type = prob(70) ? pick(welder_salvage) : null
+ if(type)
+ var/N = new type(get_turf(user))
+ user.visible_message("[user] cuts [N] from [src].", "You cut [N] from [src].")
+ if(istype(N, /obj/item/mecha_parts/part))
+ welder_salvage -= type
+ salvage_num--
+ else
+ to_chat(user, "You fail to salvage anything valuable from [src]!")
+ return
+
else if(istype(I, /obj/item/wirecutters))
if(salvage_num <= 0)
to_chat(user, "You don't see anything that can be cut with [I]!")
diff --git a/code/game/objects/effects/contraband.dm b/code/game/objects/effects/contraband.dm
index a337253c59..4499b9b62e 100644
--- a/code/game/objects/effects/contraband.dm
+++ b/code/game/objects/effects/contraband.dm
@@ -88,7 +88,7 @@
/obj/structure/sign/poster/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/wirecutters))
- playsound(loc, I.usesound, 100, 1)
+ I.play_tool_sound(src, 100)
if(ruined)
to_chat(user, "You remove the remnants of the poster.")
qdel(src)
diff --git a/code/game/objects/effects/decals/remains.dm b/code/game/objects/effects/decals/remains.dm
index 75fe78959d..31e0f1c540 100644
--- a/code/game/objects/effects/decals/remains.dm
+++ b/code/game/objects/effects/decals/remains.dm
@@ -30,4 +30,4 @@
/obj/effect/decal/cleanable/robot_debris/old
name = "dusty robot debris"
- desc = "Looks like nobody has touched this in a while."
+ desc = "Looks like nobody has touched this in a while."
\ No newline at end of file
diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm
index 84cd7be2eb..3ddeede1b7 100644
--- a/code/game/objects/items.dm
+++ b/code/game/objects/items.dm
@@ -743,3 +743,72 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE)
/obj/item/MouseExited()
deltimer(tip_timer)//delete any in-progress timer if the mouse is moved off the item before it finishes
closeToolTip(usr)
+
+
+// Called when a mob tries to use the item as a tool.
+// Handles most checks.
+/obj/item/proc/use_tool(atom/target, mob/living/user, delay, amount=0, volume=0, datum/callback/extra_checks)
+ // 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.
+ if(!delay && !tool_start_check(user, amount))
+ return
+
+ delay *= toolspeed
+
+ // Play tool sound at the beginning of tool usage.
+ play_tool_sound(target, volume)
+
+ if(delay)
+ // Create a callback with checks that would be called every tick by do_after.
+ var/datum/callback/tool_check = CALLBACK(src, .proc/tool_check_callback, user, amount, extra_checks)
+
+ if(ismob(target))
+ if(!do_mob(user, target, delay, extra_checks=tool_check))
+ return
+
+ else
+ if(!do_after(user, delay, target=target, extra_checks=tool_check))
+ return
+ else
+ // Invoke the extra checks once, just in case.
+ if(extra_checks && !extra_checks.Invoke())
+ return
+
+ // Use tool's fuel, stack sheets or charges if amount is set.
+ if(amount && !use(amount))
+ return
+
+ // Play tool sound at the end of tool usage,
+ // but only if the delay between the beginning and the end is not too small
+ if(delay >= MIN_TOOL_SOUND_DELAY)
+ play_tool_sound(target, volume)
+
+ return TRUE
+
+// 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)
+ return tool_use_check(user, amount)
+
+// A check called by tool_start_check once, and by use_tool on every tick of delay.
+/obj/item/proc/tool_use_check(mob/living/user, amount)
+ return !amount
+
+// Generic use proc. Depending on the item, it uses up fuel, charges, sheets, etc.
+// Returns TRUE on success, FALSE on failure.
+/obj/item/proc/use(used)
+ return !used
+
+// Plays item's usesound, if any.
+/obj/item/proc/play_tool_sound(atom/target, volume=50)
+ if(target && usesound && volume)
+ var/played_sound = usesound
+
+ if(islist(usesound))
+ played_sound = pick(usesound)
+
+ playsound(target, played_sound, volume, 1)
+
+// Used in a callback that is passed by use_tool into do_after call. Do not override, do not call manually.
+/obj/item/proc/tool_check_callback(mob/living/user, amount, datum/callback/extra_checks)
+ return tool_use_check(user, amount) && (!extra_checks || extra_checks.Invoke())
diff --git a/code/game/objects/items/airlock_painter.dm b/code/game/objects/items/airlock_painter.dm
index 6c2c8e58b4..36d2c068c6 100644
--- a/code/game/objects/items/airlock_painter.dm
+++ b/code/game/objects/items/airlock_painter.dm
@@ -11,6 +11,7 @@
flags_1 = CONDUCT_1 | NOBLUDGEON_1
slot_flags = SLOT_BELT
+ usesound = 'sound/effects/spray2.ogg'
var/obj/item/device/toner/ink = null
@@ -20,7 +21,7 @@
//This proc doesn't just check if the painter can be used, but also uses it.
//Only call this if you are certain that the painter will be used right after this check!
-/obj/item/airlock_painter/proc/use(mob/user)
+/obj/item/airlock_painter/proc/use_paint(mob/user)
if(can_use(user))
ink.charges--
playsound(src.loc, 'sound/effects/spray2.ogg', 50, 1)
diff --git a/code/game/objects/items/cards_ids.dm b/code/game/objects/items/cards_ids.dm
index 8613a0c115..2f506fb419 100644
--- a/code/game/objects/items/cards_ids.dm
+++ b/code/game/objects/items/cards_ids.dm
@@ -78,9 +78,17 @@
return
A.emag_act(user)
-/obj/item/card/emag/fake/afterattack()
- playsound(src.loc, 'sound/items/bikehorn.ogg', 50, 1)
- return
+/obj/item/card/emagfake
+ desc = "It's a card with a magnetic strip attached to some circuitry."
+ name = "cryptographic sequencer"
+ icon_state = "emag"
+ item_state = "card-id"
+ lefthand_file = 'icons/mob/inhands/equipment/idcards_lefthand.dmi'
+ righthand_file = 'icons/mob/inhands/equipment/idcards_righthand.dmi'
+
+/obj/item/card/emagfake/afterattack()
+ . = ..()
+ playsound(src, 'sound/items/bikehorn.ogg', 50, 1)
/obj/item/card/id
name = "identification card"
diff --git a/code/game/objects/items/cigs_lighters.dm b/code/game/objects/items/cigs_lighters.dm
index 9c8e4343a8..e622026d21 100644
--- a/code/game/objects/items/cigs_lighters.dm
+++ b/code/game/objects/items/cigs_lighters.dm
@@ -807,4 +807,4 @@ CIGARETTE PACKETS ARE IN FANCY.DM
return
if(reagents && reagents.total_volume)
- hand_reagents()
\ No newline at end of file
+ hand_reagents()
diff --git a/code/game/objects/items/circuitboards/machine_circuitboards.dm b/code/game/objects/items/circuitboards/machine_circuitboards.dm
index b56b448f0d..7831978cbe 100644
--- a/code/game/objects/items/circuitboards/machine_circuitboards.dm
+++ b/code/game/objects/items/circuitboards/machine_circuitboards.dm
@@ -292,7 +292,7 @@
new_setting = "Freezer"
name = initial(new_type.name)
build_path = initial(new_type.build_path)
- playsound(user, I.usesound, 50, 1)
+ I.play_tool_sound(src)
to_chat(user, "You change the circuitboard setting to \"[new_setting]\".")
else
return ..()
diff --git a/code/game/objects/items/devices/geiger_counter.dm b/code/game/objects/items/devices/geiger_counter.dm
index 481ca2a722..83cec3c258 100644
--- a/code/game/objects/items/devices/geiger_counter.dm
+++ b/code/game/objects/items/devices/geiger_counter.dm
@@ -170,11 +170,9 @@
to_chat(user, "Turn off [src] before you perform this action!")
return 0
user.visible_message("[user] unscrews [src]'s maintenance panel and begins fiddling with its innards...", "You begin resetting [src]...")
- playsound(user, I.usesound, 50, 1)
- if(!do_after(user, 40*I.toolspeed, target = user))
+ if(!I.use_tool(src, user, 40, volume=50))
return 0
user.visible_message("[user] refastens [src]'s maintenance panel!", "You reset [src] to its factory settings!")
- playsound(user, 'sound/items/screwdriver2.ogg', 50, 1)
obj_flags &= ~EMAGGED
radiation_count = 0
update_icon()
diff --git a/code/game/objects/items/devices/multitool.dm b/code/game/objects/items/devices/multitool.dm
index c2deb2666a..69de7025c0 100644
--- a/code/game/objects/items/devices/multitool.dm
+++ b/code/game/objects/items/devices/multitool.dm
@@ -27,6 +27,7 @@
hitsound = 'sound/weapons/tap.ogg'
toolspeed = 1
tool_behaviour = TOOL_MULTITOOL
+ usesound = 'sound/weapons/empty.ogg'
var/datum/integrated_io/selected_io = null //functional for integrated circuits.
var/mode = 0
diff --git a/code/game/objects/items/devices/radio/intercom.dm b/code/game/objects/items/devices/radio/intercom.dm
index 77d1795b6b..bfba8e9838 100644
--- a/code/game/objects/items/devices/radio/intercom.dm
+++ b/code/game/objects/items/devices/radio/intercom.dm
@@ -57,37 +57,28 @@
/obj/item/device/radio/intercom/attackby(obj/item/I, mob/living/user, params)
if(istype(I, /obj/item/screwdriver))
- var/obj/item/screwdriver/S = I
if(unfastened)
user.visible_message("[user] starts tightening [src]'s screws...", "You start screwing in [src]...")
- playsound(src, S.usesound, 50, 1)
- if(!do_after(user, 30 * S.toolspeed, target = src))
- return
- user.visible_message("[user] tightens [src]'s screws!", "You tighten [src]'s screws.")
- playsound(src, 'sound/items/screwdriver2.ogg', 50, 1)
- unfastened = FALSE
+ if(I.use_tool(src, user, 30, volume=50))
+ user.visible_message("[user] tightens [src]'s screws!", "You tighten [src]'s screws.")
+ unfastened = FALSE
else
user.visible_message("[user] starts loosening [src]'s screws...", "You start unscrewing [src]...")
- playsound(src, S.usesound, 50, 1)
- if(!do_after(user, 60 * S.toolspeed, target = src))
- return
- user.visible_message("[user] loosens [src]'s screws!", "You unscrew [src], loosening it from the wall.")
- playsound(src, 'sound/items/screwdriver2.ogg', 50, 1)
- unfastened = TRUE
+ if(I.use_tool(src, user, 40, volume=50))
+ user.visible_message("[user] loosens [src]'s screws!", "You unscrew [src], loosening it from the wall.")
+ unfastened = TRUE
return
else if(istype(I, /obj/item/wrench))
if(!unfastened)
to_chat(user, "You need to unscrew [src] from the wall first!")
return
- var/obj/item/wrench/W = I
user.visible_message("[user] starts unsecuring [src]...", "You start unsecuring [src]...")
- playsound(src, W.usesound, 50, 1)
- if(!do_after(user, 80 * W.toolspeed, target = src))
- return
- user.visible_message("[user] unsecures [src]!", "You detach [src] from the wall.")
- playsound(src, 'sound/items/deconstruct.ogg', 50, 1)
- new/obj/item/wallframe/intercom(get_turf(src))
- qdel(src)
+ I.play_tool_sound(src)
+ if(I.use_tool(src, user, 80))
+ user.visible_message("[user] unsecures [src]!", "You detach [src] from the wall.")
+ playsound(src, 'sound/items/deconstruct.ogg', 50, 1)
+ new/obj/item/wallframe/intercom(get_turf(src))
+ qdel(src)
return
return ..()
diff --git a/code/game/objects/items/devices/taperecorder.dm b/code/game/objects/items/devices/taperecorder.dm
index 69b6e54841..45782f0ee8 100644
--- a/code/game/objects/items/devices/taperecorder.dm
+++ b/code/game/objects/items/devices/taperecorder.dm
@@ -276,17 +276,11 @@
/obj/item/device/tape/attackby(obj/item/I, mob/user, params)
- if(ruined)
- var/delay = -1
- if (istype(I, /obj/item/screwdriver))
- delay = 120*I.toolspeed
- else if(istype(I, /obj/item/pen))
- delay = 120*1.5
- if (delay != -1)
- to_chat(user, "You start winding the tape back in...")
- if(do_after(user, delay, target = src))
- to_chat(user, "You wound the tape back in.")
- fix()
+ if(ruined && istype(I, /obj/item/screwdriver) || istype(I, /obj/item/pen))
+ to_chat(user, "You start winding the tape back in...")
+ if(I.use_tool(src, user, 120))
+ to_chat(user, "You wound the tape back in.")
+ fix()
//Random colour tapes
/obj/item/device/tape/random
diff --git a/code/game/objects/items/grenades/chem_grenade.dm b/code/game/objects/items/grenades/chem_grenade.dm
index 8698594555..8851b3446b 100644
--- a/code/game/objects/items/grenades/chem_grenade.dm
+++ b/code/game/objects/items/grenades/chem_grenade.dm
@@ -55,7 +55,7 @@
if(beakers.len)
stage_change(READY)
to_chat(user, "You lock the [initial(name)] assembly.")
- playsound(loc, I.usesound, 25, -3)
+ I.play_tool_sound(src, 25)
else
to_chat(user, "You need to add at least one beaker before locking the [initial(name)] assembly!")
else if(stage == READY && !nadeassembly)
diff --git a/code/game/objects/items/grenades/plastic.dm b/code/game/objects/items/grenades/plastic.dm
index b8c2344dac..f92042383d 100644
--- a/code/game/objects/items/grenades/plastic.dm
+++ b/code/game/objects/items/grenades/plastic.dm
@@ -43,7 +43,7 @@
update_icon()
return
if(nadeassembly && istype(I, /obj/item/wirecutters))
- playsound(src, I.usesound, 20, 1)
+ I.play_tool_sound(src, 20)
nadeassembly.forceMove(get_turf(src))
nadeassembly.master = null
nadeassembly = null
diff --git a/code/game/objects/items/hot_potato.dm b/code/game/objects/items/hot_potato.dm
new file mode 100644
index 0000000000..3f48849c77
--- /dev/null
+++ b/code/game/objects/items/hot_potato.dm
@@ -0,0 +1,151 @@
+//CREATOR'S NOTE: DO NOT FUCKING GIVE THIS TO BOTANY!
+/obj/item/hot_potato
+ name = "hot potato"
+ desc = "A label on the side of this potato reads \"Product of DonkCo Service Wing. Activate far away from populated areas. Device will only attach to sapient creatures.\" You can attack anyone with it to force it on them instead of yourself!"
+ icon = 'icons/obj/hydroponics/harvest.dmi'
+ icon_state = "potato"
+ flags_1 = NOBLUDGEON_1
+ force = 0
+ var/icon_off = "potato"
+ var/icon_on = "potato_active"
+ var/detonation_timerid
+ var/activation_time = 0
+ var/timer = 600 //deciseconds
+ var/show_timer = FALSE
+ var/reusable = FALSE //absolute madman
+ var/sticky = TRUE
+ var/forceful_attachment = TRUE
+ var/stimulant = TRUE
+ var/detonate_explosion = TRUE
+ var/detonate_dev_range = 0
+ var/detonate_heavy_range = 0
+ var/detonate_light_range = 2
+ var/detonate_flash_range = 5
+ var/detonate_fire_range = 5
+
+ var/color_val = FALSE
+
+/obj/item/hot_potato/proc/detonate()
+ var/atom/location = loc
+ location.visible_message("[src] [detonate_explosion? "explodes" : "activates"]!", "[src] activates! You've ran out of time!")
+ if(detonate_explosion)
+ explosion(src, detonate_dev_range, detonate_heavy_range, detonate_light_range, detonate_flash_range, flame_range = detonate_fire_range)
+ deactivate()
+ if(!reusable)
+ var/mob/M = loc
+ if(istype(M))
+ M.dropItemToGround(src, TRUE)
+ qdel(src)
+
+/obj/item/hot_potato/proc/is_active()
+ return isnull(detonation_timerid)? FALSE : TRUE
+
+/obj/item/hot_potato/attack_self(mob/user)
+ if(activate(timer, user))
+ user.visible_message("[user] squeezes [src], which promptly starts to flash red-hot colors!", "You squeeze [src], activating its countdown and attachment mechanism!",
+ "You hear a mechanical click and a loud beeping!")
+ return
+ return ..()
+
+/obj/item/hot_potato/process()
+ if(stimulant)
+ if(isliving(loc))
+ var/mob/living/L = loc
+ L.SetStun(0)
+ L.SetKnockdown(0)
+ L.SetSleeping(0)
+ L.SetUnconscious(0)
+ L.reagents.add_reagent("muscle_stimulant", CLAMP(5 - L.reagents.get_reagent_amount("muscle_stimulant"), 0, 5)) //If you don't have legs or get bola'd, tough luck!
+ color_val = !color_val
+ L.add_atom_colour(color_val? "#ffff00" : "#00ffff", FIXED_COLOUR_PRIORITY)
+
+/obj/item/hot_potato/examine(mob/user)
+ . = ..()
+ if(is_active())
+ to_chat(user, "[src] is flashing red-hot! You should probably get rid of it!")
+ if(show_timer)
+ to_chat(user, "[src]'s timer looks to be at [(activation_time - world.time) / 10] seconds!")
+
+/obj/item/hot_potato/equipped(mob/user)
+ . = ..()
+ if(is_active())
+ to_chat(user, "You have a really bad feeling about [src]!")
+
+/obj/item/hot_potato/afterattack(atom/target, mob/user, adjacent, params)
+ if(!adjacent || !ismob(target))
+ return ..()
+ force_onto(target, user)
+
+/obj/item/hot_potato/proc/force_onto(mob/living/victim, mob/user)
+ if(!istype(victim) || user != loc || victim == user)
+ return FALSE
+ if(!victim.client)
+ to_chat(user, "[src] refuses to attach to a non-sapient creature!")
+ if(victim.stat != CONSCIOUS || !victim.get_num_legs())
+ to_chat(user, "[src] refuses to attach to someone incapable of using it!")
+ user.temporarilyRemoveItemFromInventory(src, TRUE)
+ . = FALSE
+ if(!victim.put_in_hands(src))
+ if(forceful_attachment)
+ victim.dropItemToGround(victim.get_inactive_held_item())
+ if(!victim.put_in_hands(src))
+ victim.dropItemToGround(victim.get_active_held_item())
+ if(victim.put_in_hands(src))
+ . = TRUE
+ else
+ . = TRUE
+ else
+ . = TRUE
+ if(.)
+ add_logs(user, victim, "forced a hot potato with explosive variables ([detonate_explosion]-[detonate_dev_range]/[detonate_heavy_range]/[detonate_light_range]/[detonate_flash_range]/[detonate_fire_range]) onto")
+ user.visible_message("[user] forces [src] onto [victim]!", "You force [src] onto [victim]!", "You hear a mechanical click and a beep.")
+ user.remove_atom_colour(TEMPORARY_COLOUR_PRIORITY)
+ else
+ add_logs(user, victim, "tried to force a hot potato with explosive variables ([detonate_explosion]-[detonate_dev_range]/[detonate_heavy_range]/[detonate_light_range]/[detonate_flash_range]/[detonate_fire_range]) onto")
+ user.visible_message("[user] tried to force [src] onto [victim], but it could not attach!", "You try to force [src] onto [victim], but it is unable to attach!", "You hear a mechanical click and two buzzes.")
+ user.put_in_hands(src)
+
+/obj/item/hot_potato/dropped(mob/user)
+ . = ..()
+ user.remove_atom_colour(TEMPORARY_COLOUR_PRIORITY)
+
+/obj/item/hot_potato/proc/activate(delay, mob/user)
+ if(is_active())
+ return
+ update_icon()
+ if(sticky)
+ flags_1 |= NODROP_1
+ name = "primed [name]"
+ activation_time = timer + world.time
+ detonation_timerid = addtimer(CALLBACK(src, .proc/detonate), delay, TIMER_STOPPABLE)
+ START_PROCESSING(SSfastprocess, src)
+ var/turf/T = get_turf(src)
+ message_admins("[user? "[ADMIN_LOOKUPFLW(user)] has primed [src]" : "A [src] has been primed"] (Timer:[delay],Explosive:[detonate_explosion],Range:[detonate_dev_range]/[detonate_heavy_range]/[detonate_light_range]/[detonate_fire_range]) for detonation at [COORD(T)]([T.loc])")
+ log_game("[user? "[user] has primed [src]" : "A [src] has been primed"] ([detonate_dev_range]/[detonate_heavy_range]/[detonate_light_range]/[detonate_fire_range]) for detonation at [COORD(T)]([T.loc])")
+
+/obj/item/hot_potato/proc/deactivate()
+ update_icon()
+ name = initial(name)
+ flags_1 &= ~NODROP_1
+ deltimer(detonation_timerid)
+ STOP_PROCESSING(SSfastprocess, src)
+ detonation_timerid = null
+ if(ismob(loc))
+ var/mob/user = loc
+ user.remove_atom_colour(TEMPORARY_COLOUR_PRIORITY)
+
+/obj/item/hot_potato/update_icon()
+ icon_state = is_active()? icon_on : icon_off
+
+/obj/item/hot_potato/syndicate
+ detonate_light_range = 4
+ detonate_fire_range = 5
+
+/obj/item/hot_potato/harmless
+ detonate_explosion = FALSE
+
+/obj/item/hot_potato/harmless/toy
+ desc = "A label on the side of this potato reads \"Product of DonkCo Toys and Recreation department.\" You can attack anyone with it to put it on them instead, if they have a free hand to take it!"
+ sticky = FALSE
+ reusable = TRUE
+ forceful_attachment = FALSE
diff --git a/code/game/objects/items/inducer.dm b/code/game/objects/items/inducer.dm
index 578ba28317..e27c6166fe 100644
--- a/code/game/objects/items/inducer.dm
+++ b/code/game/objects/items/inducer.dm
@@ -62,7 +62,7 @@
/obj/item/inducer/attackby(obj/item/W, mob/user)
if(istype(W, /obj/item/screwdriver))
- playsound(src, W.usesound, 50, 1)
+ W.play_tool_sound(src)
if(!opened)
to_chat(user, "You unscrew the battery compartment.")
opened = TRUE
diff --git a/code/game/objects/items/plushes.dm b/code/game/objects/items/plushes.dm
index c63ee01bf4..2b950197a7 100644
--- a/code/game/objects/items/plushes.dm
+++ b/code/game/objects/items/plushes.dm
@@ -122,7 +122,7 @@
to_chat(user, "You already murdered it!")
return
user.visible_message("[user] tears out the stuffing from [src]!", "You rip a bunch of the stuffing from [src]. Murderer.")
- playsound(I, I.usesound, 50, TRUE)
+ I.play_tool_sound(src)
stuffed = FALSE
else
to_chat(user, "You remove the grenade from [src].")
diff --git a/code/game/objects/items/powerfist.dm b/code/game/objects/items/powerfist.dm
index c55c35662d..e5bc6ea715 100644
--- a/code/game/objects/items/powerfist.dm
+++ b/code/game/objects/items/powerfist.dm
@@ -44,7 +44,7 @@
fisto_setting = 3
if(3)
fisto_setting = 1
- playsound(loc, W.usesound, 50, 1)
+ W.play_tool_sound(src)
to_chat(user, "You tweak \the [src]'s piston valve to [fisto_setting].")
else if(istype(W, /obj/item/screwdriver))
if(tank)
diff --git a/code/game/objects/items/shooting_range.dm b/code/game/objects/items/shooting_range.dm
index c0500f5d21..fa7d14d236 100644
--- a/code/game/objects/items/shooting_range.dm
+++ b/code/game/objects/items/shooting_range.dm
@@ -25,14 +25,11 @@
if(pinnedLoc)
pinnedLoc.forceMove(loc)
-/obj/item/target/attackby(obj/item/W, mob/user, params)
- if(istype(W, /obj/item/weldingtool))
- var/obj/item/weldingtool/WT = W
- if(WT.remove_fuel(0, user))
- removeOverlays()
- to_chat(user, "You slice off [src]'s uneven chunks of aluminium and scorch marks.")
- else
- return ..()
+/obj/item/target/welder_act(mob/living/user, obj/item/I)
+ if(I.use_tool(src, user, 0, volume=40))
+ removeOverlays()
+ to_chat(user, "You slice off [src]'s uneven chunks of aluminium and scorch marks.")
+ return TRUE
/obj/item/target/attack_hand(mob/user)
if(pinnedLoc)
diff --git a/code/game/objects/items/stacks/rods.dm b/code/game/objects/items/stacks/rods.dm
index 75e9d1e974..7d2e0c0b43 100644
--- a/code/game/objects/items/stacks/rods.dm
+++ b/code/game/objects/items/stacks/rods.dm
@@ -40,17 +40,15 @@ GLOBAL_LIST_INIT(rod_recipes, list ( \
icon_state = "rods"
/obj/item/stack/rods/attackby(obj/item/W, mob/user, params)
- if (istype(W, /obj/item/weldingtool))
- var/obj/item/weldingtool/WT = W
-
+ if(istype(W, /obj/item/weldingtool))
if(get_amount() < 2)
to_chat(user, "You need at least two rods to do this!")
return
- if(WT.remove_fuel(0,user))
+ if(W.use_tool(src, user, 0, volume=40))
var/obj/item/stack/sheet/metal/new_item = new(usr.loc)
- user.visible_message("[user.name] shaped [src] into metal with the welding tool.", \
- "You shape [src] into metal with the welding tool.", \
+ user.visible_message("[user.name] shaped [src] into metal with [W].", \
+ "You shape [src] into metal with [W].", \
"You hear welding.")
var/obj/item/stack/rods/R = src
src = null
diff --git a/code/game/objects/items/stacks/sheets/glass.dm b/code/game/objects/items/stacks/sheets/glass.dm
index d93f5dd5fd..c0045c721b 100644
--- a/code/game/objects/items/stacks/sheets/glass.dm
+++ b/code/game/objects/items/stacks/sheets/glass.dm
@@ -279,21 +279,22 @@ GLOBAL_LIST_INIT(plastitaniumglass_recipes, list(
/obj/item/shard/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/device/lightreplacer))
I.attackby(src, user)
- else if(istype(I, /obj/item/weldingtool))
- var/obj/item/weldingtool/WT = I
- if(WT.remove_fuel(0, user))
- var/obj/item/stack/sheet/glass/NG = new (user.loc)
- for(var/obj/item/stack/sheet/glass/G in user.loc)
- if(G == NG)
- continue
- if(G.amount >= G.max_amount)
- continue
- G.attackby(NG, user)
- to_chat(user, "You add the newly-formed glass to the stack. It now contains [NG.amount] sheet\s.")
- qdel(src)
else
return ..()
+/obj/item/shard/welder_act(mob/living/user, obj/item/I)
+ if(I.use_tool(src, user, 0, volume=50))
+ var/obj/item/stack/sheet/glass/NG = new (user.loc)
+ for(var/obj/item/stack/sheet/glass/G in user.loc)
+ if(G == NG)
+ continue
+ if(G.amount >= G.max_amount)
+ continue
+ G.attackby(NG, user)
+ to_chat(user, "You add the newly-formed glass to the stack. It now contains [NG.amount] sheet\s.")
+ qdel(src)
+ return TRUE
+
/obj/item/shard/Crossed(mob/living/L)
if(istype(L) && has_gravity(loc))
playsound(loc, 'sound/effects/glass_step.ogg', 50, 1)
diff --git a/code/game/objects/items/stacks/stack.dm b/code/game/objects/items/stacks/stack.dm
index d12f787d7d..0c4e522107 100644
--- a/code/game/objects/items/stacks/stack.dm
+++ b/code/game/objects/items/stacks/stack.dm
@@ -25,7 +25,7 @@
/obj/item/stack/on_grind()
for(var/i in 1 to grind_results.len) //This should only call if it's ground, so no need to check if grind_results exists
- grind_results[grind_results[i]] *= amount //Gets the key at position i, then the reagent amount of that key, then multiplies it by stack size
+ grind_results[grind_results[i]] *= get_amount() //Gets the key at position i, then the reagent amount of that key, then multiplies it by stack size
/obj/item/stack/grind_requirements()
if(is_cyborg)
@@ -247,7 +247,7 @@
return 0
return 1
-/obj/item/stack/proc/use(used, transfer = FALSE) // return 0 = borked; return 1 = had enough
+/obj/item/stack/use(used, transfer = FALSE) // return 0 = borked; return 1 = had enough
if(zero_amount())
return 0
if (is_cyborg)
@@ -260,6 +260,20 @@
update_weight()
return 1
+/obj/item/stack/tool_use_check(mob/living/user, amount)
+ if(get_amount() < amount)
+ if(singular_name)
+ if(amount > 1)
+ to_chat(user, "You need at least [amount] [singular_name]\s to do this!")
+ else
+ to_chat(user, "You need at least [amount] [singular_name] to do this!")
+ else
+ to_chat(user, "You need at least [amount] to do this!")
+
+ return FALSE
+
+ return TRUE
+
/obj/item/stack/proc/zero_amount()
if(is_cyborg)
return source.energy < cost
diff --git a/code/game/objects/items/stacks/tiles/tile_types.dm b/code/game/objects/items/stacks/tiles/tile_types.dm
index d51e01ffcb..4e15cea273 100644
--- a/code/game/objects/items/stacks/tiles/tile_types.dm
+++ b/code/game/objects/items/stacks/tiles/tile_types.dm
@@ -21,18 +21,15 @@
/obj/item/stack/tile/attackby(obj/item/W, mob/user, params)
if (istype(W, /obj/item/weldingtool))
- var/obj/item/weldingtool/WT = W
-
if(get_amount() < 4)
to_chat(user, "You need at least four tiles to do this!")
return
- if(WT.is_hot() && !mineralType)
+ if(!mineralType)
to_chat(user, "You can not reform this!")
return
- if(WT.remove_fuel(0,user))
-
+ if(W.use_tool(src, user, 0, volume=40))
if(mineralType == "plasma")
atmos_spawn_air("plasma=5;TEMP=1000")
user.visible_message("[user.name] sets the plasma tiles on fire!", \
diff --git a/code/game/objects/items/storage/secure.dm b/code/game/objects/items/storage/secure.dm
index 0f7bdd616c..1a0474b94d 100644
--- a/code/game/objects/items/storage/secure.dm
+++ b/code/game/objects/items/storage/secure.dm
@@ -34,17 +34,17 @@
/obj/item/storage/secure/attackby(obj/item/W, mob/user, params)
if(locked)
if (istype(W, /obj/item/screwdriver))
- if (do_after(user, 20*W.toolspeed, target = user))
+ if (W.use_tool(src, user, 20))
open =! open
to_chat(user, "You [open ? "open" : "close"] the service panel.")
return
- if (istype(W, /obj/item/wirecutters) || istype(W, /obj/item/card/emag))
+ if (istype(W, /obj/item/wirecutters))
to_chat(user, "[src] is protected from this sort of tampering, yet it appears the internal memory wires can still be pulsed.")
if ((istype(W, /obj/item/device/multitool)) && (!l_hacking))
if(src.open == 1)
to_chat(user, "Now attempting to reset internal memory, please hold.")
src.l_hacking = 1
- if (do_after(usr, 400*W.toolspeed, target = user))
+ if (W.use_tool(src, user, 400))
to_chat(user, "Internal memory reset - lock has been disengaged.")
src.l_set = 0
src.l_hacking = 0
diff --git a/code/game/objects/items/tools/screwdriver.dm b/code/game/objects/items/tools/screwdriver.dm
index 945b738bd0..ea7a762b1e 100644
--- a/code/game/objects/items/tools/screwdriver.dm
+++ b/code/game/objects/items/tools/screwdriver.dm
@@ -16,7 +16,7 @@
materials = list(MAT_METAL=75)
attack_verb = list("stabbed")
hitsound = 'sound/weapons/bladeslice.ogg'
- usesound = 'sound/items/screwdriver.ogg'
+ usesound = list('sound/items/screwdriver.ogg', 'sound/items/screwdriver2.ogg')
tool_behaviour = TOOL_SCREWDRIVER
toolspeed = 1
armor = list(melee = 0, bullet = 0, laser = 0, energy = 0, bomb = 0, bio = 0, rad = 0, fire = 50, acid = 30)
diff --git a/code/game/objects/items/tools/weldingtool.dm b/code/game/objects/items/tools/weldingtool.dm
index 992c01fc2b..7425835764 100644
--- a/code/game/objects/items/tools/weldingtool.dm
+++ b/code/game/objects/items/tools/weldingtool.dm
@@ -12,7 +12,7 @@
force = 3
throwforce = 5
hitsound = "swing_hit"
- usesound = 'sound/items/welder.ogg'
+ usesound = list('sound/items/welder.ogg', 'sound/items/welder2.ogg')
var/acti_sound = 'sound/items/welderactivate.ogg'
var/deac_sound = 'sound/items/welderdeactivate.ogg'
throw_speed = 3
@@ -73,7 +73,7 @@
damtype = "fire"
++burned_fuel_for
if(burned_fuel_for >= WELDER_FUEL_BURN_INTERVAL)
- remove_fuel(1)
+ use(1)
update_icon()
//This is to start fires. process() is only called if the welder is on.
@@ -107,10 +107,10 @@
var/obj/item/bodypart/affecting = H.get_bodypart(check_zone(user.zone_selected))
if(affecting && affecting.status == BODYPART_ROBOTIC && user.a_intent != INTENT_HARM)
- if(src.remove_fuel(1))
- playsound(loc, usesound, 50, 1)
+ if(src.use_tool(H, user, 0, volume=50, amount=1))
if(user == H)
- user.visible_message("[user] starts to fix some of the dents on [H]'s [affecting.name].", "You start fixing some of the dents on [H]'s [affecting.name].")
+ user.visible_message("[user] starts to fix some of the dents on [H]'s [affecting.name].",
+ "You start fixing some of the dents on [H]'s [affecting.name].")
if(!do_mob(user, H, 50))
return
item_heal_robotic(H, user, 15, 0)
@@ -125,8 +125,8 @@
reagents.trans_to(O, reagents.total_volume)
to_chat(user, "You empty [src]'s fuel tank into [O].")
update_icon()
- if(welding)
- remove_fuel(1)
+ if(isOn())
+ use(1)
var/turf/location = get_turf(user)
location.hotspot_expose(700, 50, 1)
if(get_fuel() <= 0)
@@ -150,26 +150,23 @@
update_icon()
-//Returns the amount of fuel in the welder
+// Returns the amount of fuel in the welder
/obj/item/weldingtool/proc/get_fuel()
return reagents.get_reagent_amount("welding_fuel")
-//Removes fuel from the welding tool. If a mob is passed, it will try to flash the mob's eyes. This should probably be renamed to use()
-/obj/item/weldingtool/proc/remove_fuel(amount = 1, mob/living/M = null)
- if(!welding || !check_fuel())
- return 0
- if(amount)
+// Uses fuel from the welding tool.
+/obj/item/weldingtool/use(used = 0)
+ if(!isOn() || !check_fuel())
+ return FALSE
+
+ if(used)
burned_fuel_for = 0
- if(get_fuel() >= amount)
- reagents.remove_reagent("welding_fuel", amount)
+ if(get_fuel() >= used)
+ reagents.remove_reagent("welding_fuel", used)
check_fuel()
- if(M)
- M.flash_act(light_intensity)
return TRUE
else
- if(M)
- to_chat(M, "You need more welding fuel to complete this task!")
return FALSE
@@ -231,6 +228,24 @@
/obj/item/weldingtool/proc/isOn()
return welding
+// 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)
+ . = tool_use_check(user, amount)
+ if(. && user)
+ user.flash_act(light_intensity)
+
+// If welding tool ran out of fuel during a construction task, construction fails.
+/obj/item/weldingtool/tool_use_check(mob/living/user, amount)
+ if(!isOn() || !check_fuel())
+ to_chat(user, "[src] has to be on to complete this task!")
+ return FALSE
+
+ if(get_fuel() >= amount)
+ return TRUE
+ else
+ to_chat(user, "You need more welding fuel to complete this task!")
+ return FALSE
+
/obj/item/weldingtool/proc/flamethrower_screwdriver(obj/item/I, mob/user)
if(welding)
@@ -260,10 +275,10 @@
to_chat(user, "You need one rod to start building a flamethrower!")
/obj/item/weldingtool/ignition_effect(atom/A, mob/user)
- if(welding && remove_fuel(1, user))
- . = "[user] casually lights [A] with [src], what a badass."
+ if(use_tool(A, user, 0, amount=1))
+ return "[user] casually lights [A] with [src], what a badass."
else
- . = ""
+ return ""
/obj/item/weldingtool/largetank
name = "industrial welding tool"
diff --git a/code/game/objects/items/trash.dm b/code/game/objects/items/trash.dm
index 9e5edcacbb..539a60986a 100644
--- a/code/game/objects/items/trash.dm
+++ b/code/game/objects/items/trash.dm
@@ -66,7 +66,7 @@
name = "crushed can"
icon_state = "cola"
resistance_flags = NONE
- grind_results = list("aluminum" = 10)
+ grind_results = list("aluminium" = 10)
/obj/item/trash/attack(mob/M, mob/living/user)
return
@@ -81,4 +81,4 @@
/obj/item/trash/coal/burn()
visible_message("[src] fuses into a diamond! Someone wasn't so naughty after all...")
new /obj/item/stack/ore/diamond(loc)
- qdel(src)
\ No newline at end of file
+ qdel(src)
diff --git a/code/game/objects/structures/ai_core.dm b/code/game/objects/structures/ai_core.dm
index 5424724d32..4425dcff6c 100644
--- a/code/game/objects/structures/ai_core.dm
+++ b/code/game/objects/structures/ai_core.dm
@@ -32,13 +32,12 @@
if(state != EMPTY_CORE)
to_chat(user, "The core must be empty to deconstruct it!")
return
- var/obj/item/weldingtool/WT = P
- if(!WT.isOn())
- to_chat(user, "The welder must be on for this task!")
+
+ if(!P.tool_start_check(user, amount=0))
return
- playsound(loc, WT.usesound, 50, 1)
+
to_chat(user, "You start to deconstruct the frame...")
- if(do_after(user, 20*P.toolspeed, target = src) && src && state == EMPTY_CORE && WT && WT.remove_fuel(0, user))
+ if(P.use_tool(src, user, 20, volume=50) && state == EMPTY_CORE)
to_chat(user, "You deconstruct the frame.")
deconstruct(TRUE)
return
@@ -56,13 +55,13 @@
return
if(CIRCUIT_CORE)
if(istype(P, /obj/item/screwdriver))
- playsound(loc, P.usesound, 50, 1)
+ P.play_tool_sound(src)
to_chat(user, "You screw the circuit board into place.")
state = SCREWED_CORE
update_icon()
return
if(istype(P, /obj/item/crowbar))
- playsound(loc, P.usesound, 50, 1)
+ P.play_tool_sound(src)
to_chat(user, "You remove the circuit board.")
state = EMPTY_CORE
update_icon()
@@ -71,7 +70,7 @@
return
if(SCREWED_CORE)
if(istype(P, /obj/item/screwdriver) && circuit)
- playsound(loc, P.usesound, 50, 1)
+ P.play_tool_sound(src)
to_chat(user, "You unfasten the circuit board.")
state = CIRCUIT_CORE
update_icon()
@@ -93,7 +92,7 @@
if(brain)
to_chat(user, "Get that [brain.name] out of there first!")
else
- playsound(loc, P.usesound, 50, 1)
+ P.play_tool_sound(src)
to_chat(user, "You remove the cables.")
state = SCREWED_CORE
update_icon()
@@ -152,7 +151,7 @@
return
if(istype(P, /obj/item/crowbar) && brain)
- playsound(loc, P.usesound, 50, 1)
+ P.play_tool_sound(src)
to_chat(user, "You remove the brain.")
brain.forceMove(loc)
brain = null
@@ -161,7 +160,7 @@
if(GLASS_CORE)
if(istype(P, /obj/item/crowbar))
- playsound(loc, P.usesound, 50, 1)
+ P.play_tool_sound(src)
to_chat(user, "You remove the glass panel.")
state = CABLED_CORE
update_icon()
@@ -169,7 +168,7 @@
return
if(istype(P, /obj/item/screwdriver))
- playsound(loc, P.usesound, 50, 1)
+ P.play_tool_sound(src)
to_chat(user, "You connect the monitor.")
if(brain)
SSticker.mode.remove_antag_for_borging(brain.brainmob.mind)
@@ -198,7 +197,7 @@
return
if(istype(P, /obj/item/screwdriver))
- playsound(loc, P.usesound, 50, 1)
+ P.play_tool_sound(src)
to_chat(user, "You disconnect the monitor.")
state = GLASS_CORE
update_icon()
diff --git a/code/game/objects/structures/beds_chairs/bed.dm b/code/game/objects/structures/beds_chairs/bed.dm
index b4b05e20a8..e8f326856a 100644
--- a/code/game/objects/structures/beds_chairs/bed.dm
+++ b/code/game/objects/structures/beds_chairs/bed.dm
@@ -38,7 +38,7 @@
/obj/structure/bed/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/wrench) && !(flags_1&NODECONSTRUCT_1))
- playsound(src.loc, W.usesound, 50, 1)
+ W.play_tool_sound(src)
deconstruct(TRUE)
else
return ..()
diff --git a/code/game/objects/structures/beds_chairs/chair.dm b/code/game/objects/structures/beds_chairs/chair.dm
index 913d22aa74..b60849028a 100644
--- a/code/game/objects/structures/beds_chairs/chair.dm
+++ b/code/game/objects/structures/beds_chairs/chair.dm
@@ -73,7 +73,7 @@
/obj/structure/chair/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/wrench) && !(flags_1&NODECONSTRUCT_1))
- playsound(src.loc, W.usesound, 50, 1)
+ W.play_tool_sound(src)
deconstruct()
else if(istype(W, /obj/item/assembly/shock_kit))
if(!user.temporarilyRemoveItemFromInventory(W))
diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm
index 08700369b9..3ebac6f65f 100644
--- a/code/game/objects/structures/crates_lockers/closets.dm
+++ b/code/game/objects/structures/crates_lockers/closets.dm
@@ -29,7 +29,6 @@
var/cutting_tool = /obj/item/weldingtool
var/open_sound = 'sound/machines/click.ogg'
var/close_sound = 'sound/machines/click.ogg'
- var/cutting_sound = 'sound/items/welder.ogg'
var/material_drop = /obj/item/stack/sheet/metal
var/material_drop_amount = 2
var/delivery_icon = "deliverycloset" //which icon to use when packagewrapped. null to be unwrappable.
@@ -216,19 +215,18 @@
if(opened)
if(istype(W, cutting_tool))
if(istype(W, /obj/item/weldingtool))
- var/obj/item/weldingtool/WT = W
- if(WT.remove_fuel(0, user))
- to_chat(user, "You begin cutting \the [src] apart...")
- playsound(loc, cutting_sound, 40, 1)
- if(do_after(user, 40*WT.toolspeed, 1, target = src))
- if(!opened || !WT.isOn())
- return
- playsound(loc, cutting_sound, 50, 1)
- user.visible_message("[user] slices apart \the [src].",
- "You cut \the [src] apart with \the [WT].",
- "You hear welding.")
- deconstruct(TRUE)
+ if(!W.tool_start_check(user, amount=0))
return
+
+ to_chat(user, "You begin cutting \the [src] apart...")
+ if(W.use_tool(src, user, 40, volume=50))
+ if(!opened)
+ return
+ user.visible_message("[user] slices apart \the [src].",
+ "You cut \the [src] apart with \the [W].",
+ "You hear welding.")
+ deconstruct(TRUE)
+ return
else // for example cardboard box is cut with wirecutters
user.visible_message("[user] cut apart \the [src].", \
"You cut \the [src] apart with \the [W].")
@@ -237,25 +235,23 @@
if(user.transferItemToLoc(W, drop_location())) // so we put in unlit welder too
return
else if(istype(W, /obj/item/weldingtool) && can_weld_shut)
- var/obj/item/weldingtool/WT = W
- if(!WT.remove_fuel(0, user))
+ if(!W.tool_start_check(user, amount=0))
return
+
to_chat(user, "You begin [welded ? "unwelding":"welding"] \the [src]...")
- playsound(loc, 'sound/items/welder2.ogg', 40, 1)
- if(do_after(user, 40*WT.toolspeed, 1, target = src))
- if(opened || !WT.isOn())
+ if(W.use_tool(src, user, 40, volume=50))
+ if(opened)
return
- playsound(loc, WT.usesound, 50, 1)
welded = !welded
user.visible_message("[user] [welded ? "welds shut" : "unweldeds"] \the [src].",
- "You [welded ? "weld" : "unwelded"] \the [src] with \the [WT].",
+ "You [welded ? "weld" : "unwelded"] \the [src] with \the [W].",
"You hear welding.")
update_icon()
else if(istype(W, /obj/item/wrench) && anchorable)
if(isinspace() && !anchored)
return
anchored = !anchored
- playsound(src.loc, W.usesound, 75, 1)
+ W.play_tool_sound(src, 75)
user.visible_message("[user] [anchored ? "anchored" : "unanchored"] \the [src] [anchored ? "to" : "from"] the ground.", \
"You [anchored ? "anchored" : "unanchored"] \the [src] [anchored ? "to" : "from"] the ground.", \
"You hear a ratchet.")
diff --git a/code/game/objects/structures/crates_lockers/closets/cardboardbox.dm b/code/game/objects/structures/crates_lockers/closets/cardboardbox.dm
index 2eff5fe25a..a22ea805ea 100644
--- a/code/game/objects/structures/crates_lockers/closets/cardboardbox.dm
+++ b/code/game/objects/structures/crates_lockers/closets/cardboardbox.dm
@@ -10,7 +10,6 @@
can_weld_shut = 0
cutting_tool = /obj/item/wirecutters
open_sound = "rustle"
- cutting_sound = 'sound/items/poster_ripped.ogg'
material_drop = /obj/item/stack/sheet/cardboard
delivery_icon = "deliverybox"
anchorable = FALSE
@@ -68,6 +67,5 @@
move_speed_multiplier = 2
cutting_tool = /obj/item/weldingtool
open_sound = 'sound/machines/click.ogg'
- cutting_sound = 'sound/items/welder.ogg'
material_drop = /obj/item/stack/sheet/plasteel
#undef SNAKE_SPAM_TICKS
diff --git a/code/game/objects/structures/crates_lockers/closets/job_closets.dm b/code/game/objects/structures/crates_lockers/closets/job_closets.dm
index a41710ea7d..b0d8c89c59 100644
--- a/code/game/objects/structures/crates_lockers/closets/job_closets.dm
+++ b/code/game/objects/structures/crates_lockers/closets/job_closets.dm
@@ -105,6 +105,7 @@
icon_door = "black"
/obj/structure/closet/wardrobe/chaplain_black/PopulateContents()
+ new /obj/item/clothing/accessory/pocketprotector/cosmetology(src)
new /obj/item/clothing/under/rank/chaplain(src)
new /obj/item/clothing/shoes/sneakers/black(src)
new /obj/item/clothing/suit/nun(src)
@@ -177,6 +178,7 @@
icon_door = "atmos_wardrobe"
/obj/structure/closet/wardrobe/atmospherics_yellow/PopulateContents()
+ new /obj/item/clothing/accessory/pocketprotector(src)
new /obj/item/storage/backpack/duffelbag/engineering(src)
new /obj/item/storage/backpack/satchel/eng(src)
new /obj/item/storage/backpack/industrial(src)
@@ -193,6 +195,7 @@
icon_door = "yellow"
/obj/structure/closet/wardrobe/engineering_yellow/PopulateContents()
+ new /obj/item/clothing/accessory/pocketprotector(src)
new /obj/item/storage/backpack/duffelbag/engineering(src)
new /obj/item/storage/backpack/industrial(src)
new /obj/item/storage/backpack/satchel/eng(src)
@@ -211,6 +214,7 @@
name = "medical doctor's wardrobe"
/obj/structure/closet/wardrobe/white/medical/PopulateContents()
+ new /obj/item/clothing/accessory/pocketprotector(src)
new /obj/item/storage/backpack/duffelbag/med(src)
new /obj/item/storage/backpack/medic(src)
new /obj/item/storage/backpack/satchel/med(src)
@@ -318,6 +322,7 @@
icon_door = "white"
/obj/structure/closet/wardrobe/science_white/PopulateContents()
+ new /obj/item/clothing/accessory/pocketprotector(src)
new /obj/item/storage/backpack/science(src)
new /obj/item/storage/backpack/science(src)
new /obj/item/storage/backpack/satchel/tox(src)
diff --git a/code/game/objects/structures/crates_lockers/crates/bins.dm b/code/game/objects/structures/crates_lockers/crates/bins.dm
index 4f385f43a5..4973cb2623 100644
--- a/code/game/objects/structures/crates_lockers/crates/bins.dm
+++ b/code/game/objects/structures/crates_lockers/crates/bins.dm
@@ -33,7 +33,7 @@
do_animate()
else if(istype(W, /obj/item/wrench))
anchored = !anchored
- playsound(src.loc, W.usesound, 75, 1)
+ W.play_tool_sound(src, 75)
else
return ..()
diff --git a/code/game/objects/structures/displaycase.dm b/code/game/objects/structures/displaycase.dm
index 5a506ace06..a4efc89701 100644
--- a/code/game/objects/structures/displaycase.dm
+++ b/code/game/objects/structures/displaycase.dm
@@ -96,13 +96,13 @@
else
to_chat(user, "Access denied.")
else if(istype(W, /obj/item/weldingtool) && user.a_intent == INTENT_HELP && !broken)
- var/obj/item/weldingtool/WT = W
- if(obj_integrity < max_integrity && WT.remove_fuel(5, user))
+ if(obj_integrity < max_integrity)
+ if(!W.tool_start_check(user, amount=5))
+ return
+
to_chat(user, "You begin repairing [src].")
- playsound(loc, WT.usesound, 40, 1)
- if(do_after(user, 40*W.toolspeed, target = src))
+ if(W.use_tool(src, user, 40, amount=5, volume=50))
obj_integrity = max_integrity
- playsound(loc, 'sound/items/welder2.ogg', 50, 1)
update_icon()
to_chat(user, "You repair [src].")
else
@@ -117,7 +117,7 @@
qdel(src)
else
to_chat(user, "You start to [open ? "close":"open"] [src].")
- if(do_after(user, 20*W.toolspeed, target = src))
+ if(W.use_tool(src, user, 20))
to_chat(user, "You [open ? "close":"open"] [src].")
toggle_lock(user)
else if(open && !showpiece)
@@ -177,15 +177,15 @@
/obj/structure/displaycase_chassis/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/wrench)) //The player can only deconstruct the wooden frame
to_chat(user, "You start disassembling [src]...")
- playsound(src.loc, I.usesound, 50, 1)
- if(do_after(user, 30*I.toolspeed, target = src))
+ I.play_tool_sound(src)
+ if(I.use_tool(src, user, 30))
playsound(src.loc, 'sound/items/deconstruct.ogg', 50, 1)
new /obj/item/stack/sheet/mineral/wood(get_turf(src), 5)
qdel(src)
else if(istype(I, /obj/item/electronics/airlock))
to_chat(user, "You start installing the electronics into [src]...")
- playsound(src.loc, I.usesound, 50, 1)
+ I.play_tool_sound(src)
if(do_after(user, 30, target = src) && user.transferItemToLoc(I,src))
electronics = I
to_chat(user, "You install the airlock electronics.")
diff --git a/code/game/objects/structures/door_assembly.dm b/code/game/objects/structures/door_assembly.dm
index 22d00d6cab..dafd7dcd83 100644
--- a/code/game/objects/structures/door_assembly.dm
+++ b/code/game/objects/structures/door_assembly.dm
@@ -59,40 +59,34 @@
created_name = t
else if(istype(W, /obj/item/weldingtool) && (mineral || glass || !anchored ))
- var/obj/item/weldingtool/WT = W
- if(WT.remove_fuel(0,user))
- playsound(src, 'sound/items/welder2.ogg', 50, 1)
- if(mineral)
- var/obj/item/stack/sheet/mineral/mineral_path = text2path("/obj/item/stack/sheet/mineral/[mineral]")
- user.visible_message("[user] welds the [mineral] plating off the airlock assembly.", "You start to weld the [mineral] plating off the airlock assembly...")
- if(do_after(user, 40 * WT.toolspeed, target = src))
- if(!src || !WT.isOn())
- return
- to_chat(user, "You weld the [mineral] plating off.")
- new mineral_path(loc, 2)
- var/obj/structure/door_assembly/PA = new previous_assembly(loc)
- transfer_assembly_vars(src, PA)
+ if(!W.tool_start_check(user, amount=0))
+ return
- else if(glass)
- user.visible_message("[user] welds the glass panel out of the airlock assembly.", "You start to weld the glass panel out of the airlock assembly...")
- if(do_after(user, 40 * WT.toolspeed, target = src))
- if(!src || !WT.isOn())
- return
- to_chat(user, "You weld the glass panel out.")
- if(heat_proof_finished)
- new /obj/item/stack/sheet/rglass(get_turf(src))
- heat_proof_finished = 0
- else
- new /obj/item/stack/sheet/glass(get_turf(src))
- glass = 0
- else if(!anchored)
- user.visible_message("[user] disassembles the airlock assembly.", \
- "You start to disassemble the airlock assembly...")
- if(do_after(user, 40*W.toolspeed, target = src))
- if(!WT.isOn())
- return
- to_chat(user, "You disassemble the airlock assembly.")
- deconstruct(TRUE)
+ if(mineral)
+ var/obj/item/stack/sheet/mineral/mineral_path = text2path("/obj/item/stack/sheet/mineral/[mineral]")
+ user.visible_message("[user] welds the [mineral] plating off the airlock assembly.", "You start to weld the [mineral] plating off the airlock assembly...")
+ if(W.use_tool(src, user, 40, volume=50))
+ to_chat(user, "You weld the [mineral] plating off.")
+ new mineral_path(loc, 2)
+ var/obj/structure/door_assembly/PA = new previous_assembly(loc)
+ transfer_assembly_vars(src, PA)
+
+ else if(glass)
+ user.visible_message("[user] welds the glass panel out of the airlock assembly.", "You start to weld the glass panel out of the airlock assembly...")
+ if(W.use_tool(src, user, 40, volume=50))
+ to_chat(user, "You weld the glass panel out.")
+ if(heat_proof_finished)
+ new /obj/item/stack/sheet/rglass(get_turf(src))
+ heat_proof_finished = 0
+ else
+ new /obj/item/stack/sheet/glass(get_turf(src))
+ glass = 0
+ else if(!anchored)
+ user.visible_message("[user] disassembles the airlock assembly.", \
+ "You start to disassemble the airlock assembly...")
+ if(W.use_tool(src, user, 40, volume=50))
+ to_chat(user, "You disassemble the airlock assembly.")
+ deconstruct(TRUE)
else if(istype(W, /obj/item/wrench))
if(!anchored )
@@ -103,12 +97,11 @@
break
if(door_check)
- playsound(src, W.usesound, 100, 1)
user.visible_message("[user] secures the airlock assembly to the floor.", \
"You start to secure the airlock assembly to the floor...", \
"You hear wrenching.")
- if(do_after(user, 40*W.toolspeed, target = src))
+ if(W.use_tool(src, user, 40, volume=100))
if(anchored)
return
to_chat(user, "You secure the airlock assembly.")
@@ -118,38 +111,34 @@
to_chat(user, "There is another door here!")
else
- playsound(src, W.usesound, 100, 1)
user.visible_message("[user] unsecures the airlock assembly from the floor.", \
"You start to unsecure the airlock assembly from the floor...", \
"You hear wrenching.")
- if(do_after(user, 40*W.toolspeed, target = src))
- if(!anchored )
+ if(W.use_tool(src, user, 40, volume=100))
+ if(!anchored)
return
to_chat(user, "You unsecure the airlock assembly.")
name = "airlock assembly"
anchored = FALSE
else if(istype(W, /obj/item/stack/cable_coil) && state == AIRLOCK_ASSEMBLY_NEEDS_WIRES && anchored )
- var/obj/item/stack/cable_coil/C = W
- if (C.get_amount() < 1)
- to_chat(user, "You need one length of cable to wire the airlock assembly!")
+ if(!W.tool_start_check(user, amount=1))
return
+
user.visible_message("[user] wires the airlock assembly.", \
"You start to wire the airlock assembly...")
- if(do_after(user, 40, target = src))
- if(C.get_amount() < 1 || state != AIRLOCK_ASSEMBLY_NEEDS_WIRES)
+ if(W.use_tool(src, user, 40, amount=1))
+ if(state != AIRLOCK_ASSEMBLY_NEEDS_WIRES)
return
- C.use(1)
state = AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS
to_chat(user, "You wire the airlock assembly.")
name = "wired airlock assembly"
else if(istype(W, /obj/item/wirecutters) && state == AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS )
- playsound(src, W.usesound, 100, 1)
user.visible_message("[user] cuts the wires from the airlock assembly.", \
"You start to cut the wires from the airlock assembly...")
- if(do_after(user, 40*W.toolspeed, target = src))
+ if(W.use_tool(src, user, 40, volume=100))
if(state != AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS)
return
to_chat(user, "You cut the wires from the airlock assembly.")
@@ -158,7 +147,7 @@
name = "secured airlock assembly"
else if(istype(W, /obj/item/electronics/airlock) && state == AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS )
- playsound(src, W.usesound, 100, 1)
+ W.play_tool_sound(src, 100)
user.visible_message("[user] installs the electronics into the airlock assembly.", \
"You start to install electronics into the airlock assembly...")
if(do_after(user, 40, target = src))
@@ -174,11 +163,10 @@
else if(istype(W, /obj/item/crowbar) && state == AIRLOCK_ASSEMBLY_NEEDS_SCREWDRIVER )
- playsound(src, W.usesound, 100, 1)
user.visible_message("[user] removes the electronics from the airlock assembly.", \
"You start to remove electronics from the airlock assembly...")
- if(do_after(user, 40*W.toolspeed, target = src))
+ if(W.use_tool(src, user, 40, volume=100))
if(state != AIRLOCK_ASSEMBLY_NEEDS_SCREWDRIVER)
return
to_chat(user, "You remove the airlock electronics.")
@@ -237,11 +225,10 @@
to_chat(user, "You cannot add [G] to [src]!")
else if(istype(W, /obj/item/screwdriver) && state == AIRLOCK_ASSEMBLY_NEEDS_SCREWDRIVER )
- playsound(src, W.usesound, 100, 1)
user.visible_message("[user] finishes the airlock.", \
"You start finishing the airlock...")
- if(do_after(user, 40*W.toolspeed, target = src))
+ if(W.use_tool(src, user, 40, volume=100))
if(loc && state == AIRLOCK_ASSEMBLY_NEEDS_SCREWDRIVER)
to_chat(user, "You finish the airlock.")
var/obj/machinery/door/airlock/door
diff --git a/code/game/objects/structures/dresser.dm b/code/game/objects/structures/dresser.dm
index 4e891d047f..790e0d1b66 100644
--- a/code/game/objects/structures/dresser.dm
+++ b/code/game/objects/structures/dresser.dm
@@ -6,18 +6,17 @@
density = TRUE
anchored = TRUE
-/obj/structure/dresser/attackby(obj/item/P, mob/user, params)
- if(istype(P, /obj/item/wrench))
+/obj/structure/dresser/attackby(obj/item/I, mob/user, params)
+ if(istype(I, /obj/item/wrench))
to_chat(user, "You begin to [anchored ? "unwrench" : "wrench"] [src].")
- playsound(src, P.usesound, 50, 1)
- if(do_after(user, 20, target = src))
+ if(I.use_tool(src, user, 20, volume=50))
to_chat(user, "You successfully [anchored ? "unwrench" : "wrench"] [src].")
anchored = !anchored
else
return ..()
/obj/structure/dresser/deconstruct(disassembled = TRUE)
- new /obj/item/stack/sheet/mineral/wood (get_turf(src), 10)
+ new /obj/item/stack/sheet/mineral/wood(drop_location(), 10)
qdel(src)
/obj/structure/dresser/attack_hand(mob/user)
diff --git a/code/game/objects/structures/electricchair.dm b/code/game/objects/structures/electricchair.dm
index da99839e92..1e84ec3acf 100644
--- a/code/game/objects/structures/electricchair.dm
+++ b/code/game/objects/structures/electricchair.dm
@@ -13,7 +13,7 @@
/obj/structure/chair/e_chair/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/wrench))
var/obj/structure/chair/C = new /obj/structure/chair(loc)
- playsound(loc, W.usesound, 50, 1)
+ W.play_tool_sound(src)
C.setDir(dir)
part.forceMove(loc)
part.master = null
diff --git a/code/game/objects/structures/extinguisher.dm b/code/game/objects/structures/extinguisher.dm
index bb223b2e04..88ad622351 100644
--- a/code/game/objects/structures/extinguisher.dm
+++ b/code/game/objects/structures/extinguisher.dm
@@ -43,8 +43,8 @@
/obj/structure/extinguisher_cabinet/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/wrench) && !stored_extinguisher)
to_chat(user, "You start unsecuring [name]...")
- playsound(loc, I.usesound, 50, 1)
- if(do_after(user, 60*I.toolspeed, target = src))
+ I.play_tool_sound(src)
+ if(I.use_tool(src, user, 60))
playsound(loc, 'sound/items/deconstruct.ogg', 50, 1)
to_chat(user, "You unsecure [name].")
deconstruct(TRUE)
diff --git a/code/game/objects/structures/false_walls.dm b/code/game/objects/structures/false_walls.dm
index 2f17926a9b..dec4709550 100644
--- a/code/game/objects/structures/false_walls.dm
+++ b/code/game/objects/structures/false_walls.dm
@@ -109,15 +109,11 @@
else
to_chat(user, "You can't reach, close it first!")
- else if(istype(W, /obj/item/weldingtool))
- var/obj/item/weldingtool/WT = W
- if(WT.remove_fuel(0,user))
+ else if(istype(W, /obj/item/weldingtool) || istype(W, /obj/item/gun/energy/plasmacutter))
+ if(W.use_tool(src, user, 0, volume=50))
dismantle(user, TRUE)
- else if(istype(W, /obj/item/gun/energy/plasmacutter))
- dismantle(user, TRUE)
else if(istype(W, /obj/item/pickaxe/drill/jackhammer))
- var/obj/item/pickaxe/drill/jackhammer/D = W
- D.playDigSound()
+ W.play_tool_sound(src)
dismantle(user, TRUE)
else
return ..()
@@ -125,7 +121,7 @@
/obj/structure/falsewall/proc/dismantle(mob/user, disassembled=TRUE, obj/item/tool = null)
user.visible_message("[user] dismantles the false wall.", "You dismantle the false wall.")
if(tool)
- playsound(src, tool.usesound, 100, 1)
+ tool.play_tool_sound(src, 100)
else
playsound(src, 'sound/items/welder.ogg', 100, 1)
deconstruct(disassembled)
diff --git a/code/game/objects/structures/fireaxe.dm b/code/game/objects/structures/fireaxe.dm
index afcd855caf..a75056c31a 100644
--- a/code/game/objects/structures/fireaxe.dm
+++ b/code/game/objects/structures/fireaxe.dm
@@ -25,13 +25,13 @@
if(iscyborg(user) || istype(I, /obj/item/device/multitool))
toggle_lock(user)
else if(istype(I, /obj/item/weldingtool) && user.a_intent == INTENT_HELP && !broken)
- var/obj/item/weldingtool/WT = I
- if(obj_integrity < max_integrity && WT.remove_fuel(2, user))
+ if(obj_integrity < max_integrity)
+ if(!I.tool_start_check(user, amount=2))
+ return
+
to_chat(user, "You begin repairing [src].")
- playsound(loc, WT.usesound, 40, 1)
- if(do_after(user, 40*I.toolspeed, target = src))
+ if(I.use_tool(src, user, 40, volume=50, amount=2))
obj_integrity = max_integrity
- playsound(loc, 'sound/items/welder2.ogg', 50, 1)
update_icon()
to_chat(user, "You repair [src].")
else
diff --git a/code/game/objects/structures/fluff.dm b/code/game/objects/structures/fluff.dm
index 5c119fd3c1..5ac250408f 100644
--- a/code/game/objects/structures/fluff.dm
+++ b/code/game/objects/structures/fluff.dm
@@ -13,13 +13,12 @@
/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(user, I.usesound, 50, 1)
- if(!do_after(user, 50, target = src))
- return 0
- 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(get_turf(src))
- qdel(src)
+ I.play_tool_sound(src)
+ if(I.use_tool(src, user, 50))
+ 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
..()
diff --git a/code/game/objects/structures/girders.dm b/code/game/objects/structures/girders.dm
index 66124f8b6d..05935a6d48 100644
--- a/code/game/objects/structures/girders.dm
+++ b/code/game/objects/structures/girders.dm
@@ -34,18 +34,16 @@
if(istype(W, /obj/item/gun/energy/plasmacutter))
to_chat(user, "You start slicing apart the girder...")
- playsound(src, 'sound/items/welder.ogg', 100, 1)
- if(do_after(user, 40*W.toolspeed, target = src))
+ if(W.use_tool(src, user, 40, volume=100))
to_chat(user, "You slice apart the girder.")
var/obj/item/stack/sheet/metal/M = new (loc, 2)
M.add_fingerprint(user)
qdel(src)
else if(istype(W, /obj/item/pickaxe/drill/jackhammer))
- var/obj/item/pickaxe/drill/jackhammer/D = W
to_chat(user, "You smash through the girder!")
new /obj/item/stack/sheet/metal(get_turf(src))
- D.playDigSound()
+ W.play_tool_sound(src)
qdel(src)
@@ -68,7 +66,7 @@
return
to_chat(user, "You start building a reinforced false wall...")
if(do_after(user, 20, target = src))
- if(!src.loc || !S || S.get_amount() < 2)
+ if(S.get_amount() < 2)
return
S.use(2)
to_chat(user, "You create a false wall. Push on it to open or close the passage.")
@@ -80,8 +78,8 @@
to_chat(user, "You need at least five rods to add plating!")
return
to_chat(user, "You start adding plating...")
- if (do_after(user, 40, target = src))
- if(!src.loc || !S || S.get_amount() < 5)
+ if(do_after(user, 40, target = src))
+ if(S.get_amount() < 5)
return
S.use(5)
to_chat(user, "You add the plating.")
@@ -102,7 +100,7 @@
return
to_chat(user, "You start building a false wall...")
if(do_after(user, 20, target = src))
- if(!src.loc || !S || S.get_amount() < 2)
+ if(S.get_amount() < 2)
return
S.use(2)
to_chat(user, "You create a false wall. Push on it to open or close the passage.")
@@ -115,7 +113,7 @@
return
to_chat(user, "You start adding plating...")
if (do_after(user, 40, target = src))
- if(loc == null || S.get_amount() < 2)
+ if(S.get_amount() < 2)
return
S.use(2)
to_chat(user, "You add the plating.")
@@ -132,7 +130,7 @@
return
to_chat(user, "You start building a reinforced false wall...")
if(do_after(user, 20, target = src))
- if(!src.loc || !S || S.get_amount() < 2)
+ if(S.get_amount() < 2)
return
S.use(2)
to_chat(user, "You create a reinforced false wall. Push on it to open or close the passage.")
@@ -145,7 +143,7 @@
return
to_chat(user, "You start finalizing the reinforced wall...")
if(do_after(user, 50, target = src))
- if(!src.loc || !S || S.get_amount() < 1)
+ if(S.get_amount() < 1)
return
S.use(1)
to_chat(user, "You fully reinforce the wall.")
@@ -158,8 +156,8 @@
if(S.get_amount() < 1)
return
to_chat(user, "You start reinforcing the girder...")
- if (do_after(user, 60, target = src))
- if(!src.loc || !S || S.get_amount() < 1)
+ if(do_after(user, 60, target = src))
+ if(S.get_amount() < 1)
return
S.use(1)
to_chat(user, "You reinforce the girder.")
@@ -175,7 +173,7 @@
to_chat(user, "You need at least two sheets to create a false wall!")
return
if(do_after(user, 20, target = src))
- if(!src.loc || !S || S.get_amount() < 2)
+ if(S.get_amount() < 2)
return
S.use(2)
to_chat(user, "You create a false wall. Push on it to open or close the passage.")
@@ -189,7 +187,7 @@
return
to_chat(user, "You start adding plating...")
if (do_after(user, 40, target = src))
- if(!src.loc || !S || S.get_amount() < 2)
+ if(S.get_amount() < 2)
return
S.use(2)
to_chat(user, "You add the plating.")
@@ -214,11 +212,10 @@
/obj/structure/girder/screwdriver_act(mob/user, obj/item/tool)
. = FALSE
if(state == GIRDER_DISPLACED)
- playsound(src, tool.usesound, 100, 1)
user.visible_message("[user] disassembles the girder.",
"You start to disassemble the girder...",
"You hear clanking and banging noises.")
- if(do_after(user, 40 * tool.toolspeed, target = src))
+ if(tool.use_tool(src, user, 40, volume=100))
if(state != GIRDER_DISPLACED)
return
state = GIRDER_DISASSEMBLED
@@ -226,65 +223,60 @@
var/obj/item/stack/sheet/metal/M = new (loc, 2)
M.add_fingerprint(user)
qdel(src)
- return TRUE
+ return TRUE
else if(state == GIRDER_REINF)
- playsound(src, tool.usesound, 100, 1)
to_chat(user, "You start unsecuring support struts...")
- if(do_after(user, 40 * tool.toolspeed, target = src))
+ if(tool.use_tool(src, user, 40, volume=100))
if(state != GIRDER_REINF)
return
to_chat(user, "You unsecure the support struts.")
state = GIRDER_REINF_STRUTS
- return TRUE
+ return TRUE
else if(state == GIRDER_REINF_STRUTS)
- playsound(src, tool.usesound, 100, 1)
to_chat(user, "You start securing support struts...")
- if(do_after(user, 40 * tool.toolspeed, target = src))
+ if(tool.use_tool(src, user, 40, volume=100))
if(state != GIRDER_REINF_STRUTS)
return
to_chat(user, "You secure the support struts.")
state = GIRDER_REINF
- return TRUE
+ return TRUE
// Wirecutter behavior for girders
/obj/structure/girder/wirecutter_act(mob/user, obj/item/tool)
. = FALSE
if(state == GIRDER_REINF_STRUTS)
- playsound(src.loc, tool.usesound, 100, 1)
to_chat(user, "You start removing the inner grille...")
- if(do_after(user, 40 * tool.toolspeed, target = src))
+ if(tool.use_tool(src, user, 40, volume=100))
to_chat(user, "You remove the inner grille.")
new /obj/item/stack/sheet/plasteel(get_turf(src))
var/obj/structure/girder/G = new (loc)
transfer_fingerprints_to(G)
qdel(src)
- return TRUE
+ return TRUE
/obj/structure/girder/wrench_act(mob/user, obj/item/tool)
. = FALSE
if(state == GIRDER_DISPLACED)
if(!isfloorturf(loc))
to_chat(user, "A floor must be present to secure the girder!")
- return
- playsound(src, tool.usesound, 100, 1)
+
to_chat(user, "You start securing the girder...")
- if(do_after(user, 40 * tool.toolspeed, target = src))
+ if(tool.use_tool(src, user, 40, volume=100))
to_chat(user, "You secure the girder.")
var/obj/structure/girder/G = new (loc)
transfer_fingerprints_to(G)
qdel(src)
- return TRUE
+ return TRUE
else if(state == GIRDER_NORMAL && can_displace)
- playsound(src, tool.usesound, 100, 1)
to_chat(user, "You start unsecuring the girder...")
- if(do_after(user, 40 * tool.toolspeed, target = src))
+ if(tool.use_tool(src, user, 40, volume=100))
to_chat(user, "You unsecure the girder.")
var/obj/structure/girder/displaced/D = new (loc)
transfer_fingerprints_to(D)
qdel(src)
- return TRUE
+ return TRUE
/obj/structure/girder/CanPass(atom/movable/mover, turf/target)
if(istype(mover) && (mover.pass_flags & PASSGRILLE))
@@ -348,41 +340,25 @@
add_fingerprint(user)
if(istype(W, /obj/item/melee/cultblade/dagger) && iscultist(user)) //Cultists can demolish cult girders instantly with their tomes
user.visible_message("[user] strikes [src] with [W]!", "You demolish [src].")
- var/obj/item/stack/sheet/runed_metal/R = new(get_turf(src))
- R.amount = 1
+ new /obj/item/stack/sheet/runed_metal(drop_location(), 1)
qdel(src)
- else if(istype(W, /obj/item/weldingtool))
- var/obj/item/weldingtool/WT = W
- if(WT.remove_fuel(0,user))
- playsound(src.loc, W.usesound, 50, 1)
- to_chat(user, "You start slicing apart the girder...")
- if(do_after(user, 40*W.toolspeed, target = src))
- if( !WT.isOn() )
- return
- to_chat(user, "You slice apart the girder.")
- var/obj/item/stack/sheet/runed_metal/R = new(get_turf(src))
- R.amount = 1
- transfer_fingerprints_to(R)
- qdel(src)
+ else if(istype(W, /obj/item/weldingtool) || istype(W, /obj/item/gun/energy/plasmacutter))
+ if(!W.tool_start_check(user, amount=0))
+ return
- else if(istype(W, /obj/item/gun/energy/plasmacutter))
to_chat(user, "You start slicing apart the girder...")
- playsound(src, 'sound/items/welder.ogg', 100, 1)
- if(do_after(user, 40*W.toolspeed, target = src))
+ if(W.use_tool(src, user, 40, volume=50))
to_chat(user, "You slice apart the girder.")
- var/obj/item/stack/sheet/runed_metal/R = new(get_turf(src))
- R.amount = 1
+ var/obj/item/stack/sheet/runed_metal/R = new(drop_location(), 1)
transfer_fingerprints_to(R)
qdel(src)
else if(istype(W, /obj/item/pickaxe/drill/jackhammer))
- var/obj/item/pickaxe/drill/jackhammer/D = W
to_chat(user, "Your jackhammer smashes through the girder!")
- var/obj/item/stack/sheet/runed_metal/R = new(get_turf(src))
- R.amount = 2
+ var/obj/item/stack/sheet/runed_metal/R = new(drop_location(), 2)
transfer_fingerprints_to(R)
- D.playDigSound()
+ W.play_tool_sound(src)
qdel(src)
else if(istype(W, /obj/item/stack/sheet/runed_metal))
@@ -392,7 +368,7 @@
return 0
user.visible_message("[user] begins laying runed metal on [src]...", "You begin constructing a runed wall...")
if(do_after(user, 50, target = src))
- if(R.get_amount() < 1 || !R)
+ if(R.get_amount() < 1)
return
user.visible_message("[user] plates [src] with runed metal.", "You construct a runed wall.")
R.use(1)
diff --git a/code/game/objects/structures/grille.dm b/code/game/objects/structures/grille.dm
index 270223f9a8..733ec9952b 100644
--- a/code/game/objects/structures/grille.dm
+++ b/code/game/objects/structures/grille.dm
@@ -137,11 +137,11 @@
add_fingerprint(user)
if(istype(W, /obj/item/wirecutters))
if(!shock(user, 100))
- playsound(src, W.usesound, 100, 1)
+ W.play_tool_sound(src, 100)
deconstruct()
else if((istype(W, /obj/item/screwdriver)) && (isturf(loc) || anchored))
if(!shock(user, 90))
- playsound(src, W.usesound, 100, 1)
+ W.play_tool_sound(src, 100)
anchored = !anchored
user.visible_message("[user] [anchored ? "fastens" : "unfastens"] [src].", \
"You [anchored ? "fasten [src] to" : "unfasten [src] from"] the floor.")
diff --git a/code/game/objects/structures/janicart.dm b/code/game/objects/structures/janicart.dm
index 0f12f847d7..a6f9ecb68f 100644
--- a/code/game/objects/structures/janicart.dm
+++ b/code/game/objects/structures/janicart.dm
@@ -82,7 +82,7 @@
mybag.attackby(I, user)
else if(istype(I, /obj/item/crowbar))
user.visible_message("[user] begins to empty the contents of [src].", "You begin to empty the contents of [src]...")
- if(do_after(user, 30*I.toolspeed, target = src))
+ if(I.use_tool(src, user, 30))
to_chat(usr, "You empty the contents of [src]'s bucket onto the floor.")
reagents.reaction(src.loc)
src.reagents.clear_reagents()
diff --git a/code/game/objects/structures/kitchen_spike.dm b/code/game/objects/structures/kitchen_spike.dm
index 415024d2e0..0639ce26ab 100644
--- a/code/game/objects/structures/kitchen_spike.dm
+++ b/code/game/objects/structures/kitchen_spike.dm
@@ -23,18 +23,13 @@
transfer_fingerprints_to(F)
qdel(src)
else if(istype(I, /obj/item/weldingtool))
- var/obj/item/weldingtool/WT = I
- if(!WT.remove_fuel(0, user))
+ if(!I.tool_start_check(user, amount=0))
return
to_chat(user, "You begin cutting \the [src] apart...")
- playsound(src.loc, WT.usesound, 40, 1)
- if(do_after(user, 40*WT.toolspeed, 1, target = src))
- if(!WT.isOn())
- return
- playsound(src.loc, WT.usesound, 50, 1)
+ if(I.use_tool(src, user, 50, volume=50))
visible_message("[user] slices apart \the [src].",
- "You cut \the [src] apart with \the [WT].",
- "You hear welding.")
+ "You cut \the [src] apart with \the [I].",
+ "You hear welding.")
new /obj/item/stack/sheet/metal(src.loc, 4)
qdel(src)
return
@@ -56,18 +51,15 @@
/obj/structure/kitchenspike/attack_paw(mob/user)
return src.attack_hand(usr)
+/obj/structure/kitchenspike/crowbar_act(mob/living/user, obj/item/I)
+ if(has_buckled_mobs())
+ to_chat(user, "You can't do that while something's on the spike!")
+ return TRUE
-/obj/structure/kitchenspike/attackby(obj/item/I, mob/user, params)
- if(istype(I, /obj/item/crowbar))
- if(!has_buckled_mobs())
- playsound(loc, I.usesound, 100, 1)
- if(do_after(user, 20*I.toolspeed, target = src))
- to_chat(user, "You pry the spikes out of the frame.")
- deconstruct(TRUE)
- else
- to_chat(user, "You can't do that while something's on the spike!")
- else
- return ..()
+ if(I.use_tool(src, user, 20, volume=100))
+ to_chat(user, "You pry the spikes out of the frame.")
+ deconstruct(TRUE)
+ return TRUE
/obj/structure/kitchenspike/attack_hand(mob/user)
if(VIABLE_MOB_CHECK(user.pulling) && user.a_intent == INTENT_GRAB && !has_buckled_mobs())
diff --git a/code/game/objects/structures/mirror.dm b/code/game/objects/structures/mirror.dm
index 924ccfb3b2..f0168694f0 100644
--- a/code/game/objects/structures/mirror.dm
+++ b/code/game/objects/structures/mirror.dm
@@ -59,23 +59,24 @@
new /obj/item/shard( src.loc )
qdel(src)
-/obj/structure/mirror/attackby(obj/item/I, mob/living/user, params)
- if(istype(I, /obj/item/weldingtool) && user.a_intent != INTENT_HARM)
- var/obj/item/weldingtool/WT = I
- if(broken)
- user.changeNext_move(CLICK_CD_MELEE)
- if(WT.remove_fuel(0, user))
- to_chat(user, "You begin repairing [src]...")
- playsound(src, 'sound/items/welder.ogg', 100, 1)
- if(do_after(user, 10*I.toolspeed, target = src))
- if(!user || !WT || !WT.isOn())
- return
- to_chat(user, "You repair [src].")
- broken = 0
- icon_state = initial(icon_state)
- desc = initial(desc)
- else
- return ..()
+/obj/structure/mirror/welder_act(mob/living/user, obj/item/I)
+ if(user.a_intent == INTENT_HARM)
+ return FALSE
+
+ if(!broken)
+ return TRUE
+
+ if(!I.tool_start_check(user, amount=0))
+ return TRUE
+
+ to_chat(user, "You begin repairing [src]...")
+ if(I.use_tool(src, user, 10, volume=50))
+ to_chat(user, "You repair [src].")
+ broken = 0
+ icon_state = initial(icon_state)
+ desc = initial(desc)
+
+ return TRUE
/obj/structure/mirror/play_attack_sound(damage_amount, damage_type = BRUTE, damage_flag = 0)
switch(damage_type)
diff --git a/code/game/objects/structures/morgue.dm b/code/game/objects/structures/morgue.dm
index 91c42f41af..e6cc6a15f6 100644
--- a/code/game/objects/structures/morgue.dm
+++ b/code/game/objects/structures/morgue.dm
@@ -359,4 +359,4 @@ GLOBAL_LIST_EMPTY(crematoriums)
. = !density
if(ismovableatom(caller))
var/atom/movable/mover = caller
- . = . || (mover.pass_flags & PASSTABLE)
\ No newline at end of file
+ . = . || (mover.pass_flags & PASSTABLE)
diff --git a/code/game/objects/structures/musician.dm b/code/game/objects/structures/musician.dm
index a73824ca2b..b3b3d55381 100644
--- a/code/game/objects/structures/musician.dm
+++ b/code/game/objects/structures/musician.dm
@@ -370,25 +370,6 @@
user.set_machine(src)
song.interact(user)
-/obj/structure/piano/attackby(obj/item/O, mob/user, params)
- if (istype(O, /obj/item/wrench))
- if (!anchored && !isinspace())
- playsound(src, O.usesound, 50, 1)
- to_chat(user, " You begin to tighten \the [src] to the floor...")
- if (do_after(user, 20*O.toolspeed, target = src))
- user.visible_message( \
- "[user] tightens \the [src]'s casters.", \
- "You tighten \the [src]'s casters. Now it can be played again.", \
- "You hear ratchet.")
- anchored = TRUE
- else if(anchored)
- playsound(src, O.usesound, 50, 1)
- to_chat(user, " You begin to loosen \the [src]'s casters...")
- if (do_after(user, 40*O.toolspeed, target = src))
- user.visible_message( \
- "[user] loosens \the [src]'s casters.", \
- "You loosen \the [src]. Now it can be pulled somewhere else.", \
- "You hear ratchet.")
- anchored = FALSE
- else
- return ..()
+/obj/structure/piano/wrench_act(mob/living/user, obj/item/I)
+ default_unfasten_wrench(user, I, 40)
+ return TRUE
diff --git a/code/game/objects/structures/plasticflaps.dm b/code/game/objects/structures/plasticflaps.dm
index d0d8989e04..99903901bd 100644
--- a/code/game/objects/structures/plasticflaps.dm
+++ b/code/game/objects/structures/plasticflaps.dm
@@ -21,18 +21,16 @@
add_fingerprint(user)
if(istype(W, /obj/item/screwdriver))
if(state == PLASTIC_FLAPS_NORMAL)
- playsound(src.loc, W.usesound, 100, 1)
user.visible_message("[user] unscrews [src] from the floor.", "You start to unscrew [src] from the floor...", "You hear rustling noises.")
- if(do_after(user, 100*W.toolspeed, target = src))
+ if(W.use_tool(src, user, 100, volume=100))
if(state != PLASTIC_FLAPS_NORMAL)
return
state = PLASTIC_FLAPS_DETACHED
anchored = FALSE
to_chat(user, "You unscrew [src] from the floor.")
else if(state == PLASTIC_FLAPS_DETACHED)
- playsound(src.loc, W.usesound, 100, 1)
user.visible_message("[user] screws [src] to the floor.", "You start to screw [src] to the floor...", "You hear rustling noises.")
- if(do_after(user, 40*W.toolspeed, target = src))
+ if(W.use_tool(src, user, 40, volume=100))
if(state != PLASTIC_FLAPS_DETACHED)
return
state = PLASTIC_FLAPS_NORMAL
@@ -40,9 +38,8 @@
to_chat(user, "You screw [src] from the floor.")
else if(istype(W, /obj/item/wirecutters))
if(state == PLASTIC_FLAPS_DETACHED)
- playsound(src.loc, W.usesound, 100, 1)
user.visible_message("[user] cuts apart [src].", "You start to cut apart [src].", "You hear cutting.")
- if(do_after(user, 50*W.toolspeed, target = src))
+ if(W.use_tool(src, user, 50, volume=100))
if(state != PLASTIC_FLAPS_DETACHED)
return
to_chat(user, "You cut apart [src].")
diff --git a/code/game/objects/structures/reflector.dm b/code/game/objects/structures/reflector.dm
index c8ef972a63..3d9789785c 100644
--- a/code/game/objects/structures/reflector.dm
+++ b/code/game/objects/structures/reflector.dm
@@ -81,7 +81,7 @@
if(istype(W, /obj/item/screwdriver))
can_rotate = !can_rotate
to_chat(user, "You [can_rotate ? "unlock" : "lock"] [src]'s rotation.")
- playsound(src, W.usesound, 50, 1)
+ W.play_tool_sound(src)
return
if(istype(W, /obj/item/wrench))
@@ -89,47 +89,46 @@
to_chat(user, "Unweld [src] from the floor first!")
return
user.visible_message("[user] starts to dismantle [src].", "You start to dismantle [src]...")
- if(do_after(user, 80*W.toolspeed, target = src))
- playsound(src, W.usesound, 50, 1)
+ if(W.use_tool(src, user, 80, volume=50))
to_chat(user, "You dismantle [src].")
new framebuildstacktype(drop_location(), framebuildstackamount)
if(buildstackamount)
new buildstacktype(drop_location(), buildstackamount)
qdel(src)
else if(istype(W, /obj/item/weldingtool))
- var/obj/item/weldingtool/WT = W
-
if(obj_integrity < max_integrity)
- if(WT.remove_fuel(0,user))
- user.visible_message("[user] starts to repair [src].",
- "You begin repairing [src]...",
- "You hear welding.")
- playsound(src, W.usesound, 40, 1)
- if(do_after(user,40*WT.toolspeed, target = src))
- obj_integrity = max_integrity
- user.visible_message("[user] has repaired [src].", \
- "You finish repairing [src].")
+ if(!W.tool_start_check(user, amount=0))
+ return
+
+ user.visible_message("[user] starts to repair [src].",
+ "You begin repairing [src]...",
+ "You hear welding.")
+ if(W.use_tool(src, user, 40, volume=40))
+ obj_integrity = max_integrity
+ user.visible_message("[user] has repaired [src].", \
+ "You finish repairing [src].")
else if(!anchored)
- if (WT.remove_fuel(0,user))
- playsound(src, W.usesound, 50, 1)
- user.visible_message("[user] starts to weld [src] to the floor.",
- "You start to weld [src] to the floor...",
- "You hear welding.")
- if (do_after(user,20*W.toolspeed, target = src))
- if(!WT.isOn())
- return
- anchored = TRUE
- to_chat(user, "You weld [src] to the floor.")
+ if(!W.tool_start_check(user, amount=0))
+ return
+
+ user.visible_message("[user] starts to weld [src] to the floor.",
+ "You start to weld [src] to the floor...",
+ "You hear welding.")
+ if (W.use_tool(src, user, 20, volume=50))
+ anchored = TRUE
+ to_chat(user, "You weld [src] to the floor.")
else
- if (WT.remove_fuel(0,user))
- playsound(src, W.usesound, 50, 1)
- user.visible_message("[user] starts to cut [src] free from the floor.", "You start to cut [src] free from the floor...", "You hear welding.")
- if (do_after(user,20*W.toolspeed, target = src))
- if(!WT.isOn())
- return
- anchored = FALSE
- to_chat(user, "You cut [src] free from the floor.")
+ if(!W.tool_start_check(user, amount=0))
+ return
+
+ user.visible_message("[user] starts to cut [src] free from the floor.",
+ "You start to cut [src] free from the floor...",
+ "You hear welding.")
+ if (W.use_tool(src, user, 20, volume=50))
+ anchored = FALSE
+ to_chat(user, "You cut [src] free from the floor.")
+
//Finishing the frame
else if(istype(W, /obj/item/stack/sheet))
if(finished)
diff --git a/code/game/objects/structures/showcase.dm b/code/game/objects/structures/showcase.dm
index 0aa447ca58..a976c2e3fe 100644
--- a/code/game/objects/structures/showcase.dm
+++ b/code/game/objects/structures/showcase.dm
@@ -112,18 +112,17 @@
if(istype(W, /obj/item/screwdriver) && !anchored)
if(deconstruction_state == SHOWCASE_SCREWDRIVERED)
to_chat(user, "You screw the screws back into the showcase.")
- playsound(loc, W.usesound, 100, 1)
+ W.play_tool_sound(src, 100)
deconstruction_state = SHOWCASE_CONSTRUCTED
else if (deconstruction_state == SHOWCASE_CONSTRUCTED)
to_chat(user, "You unscrew the screws.")
- playsound(loc, W.usesound, 100, 1)
+ W.play_tool_sound(src, 100)
deconstruction_state = SHOWCASE_SCREWDRIVERED
if(istype(W, /obj/item/crowbar) && deconstruction_state == SHOWCASE_SCREWDRIVERED)
- if(do_after(user, 20*W.toolspeed, target = src))
- playsound(loc, W.usesound, 100, 1)
+ if(W.use_tool(src, user, 20, volume=100))
to_chat(user, "You start to crowbar the showcase apart...")
- new /obj/item/stack/sheet/metal (get_turf(src), 4)
+ new /obj/item/stack/sheet/metal(drop_location(), 4)
qdel(src)
if(deconstruction_state == SHOWCASE_CONSTRUCTED && default_unfasten_wrench(user, W))
diff --git a/code/game/objects/structures/signs/_signs.dm b/code/game/objects/structures/signs/_signs.dm
index 382858dd53..c3547116fd 100644
--- a/code/game/objects/structures/signs/_signs.dm
+++ b/code/game/objects/structures/signs/_signs.dm
@@ -27,21 +27,21 @@
if(BURN)
playsound(loc, 'sound/items/welder.ogg', 80, 1)
-/obj/structure/sign/attackby(obj/item/O, mob/user, params)
- if(istype(O, /obj/item/wrench) && buildable_sign)
+/obj/structure/sign/attackby(obj/item/I, mob/user, params)
+ if(istype(I, /obj/item/wrench) && buildable_sign)
user.visible_message("[user] starts removing [src]...", \
"You start unfastening [src].")
- playsound(src, O.usesound, 50, 1)
- if(!do_after(user, 30*O.toolspeed, target = src))
- return
- playsound(src, 'sound/items/deconstruct.ogg', 50, 1)
- user.visible_message("[user] unfastens [src].", \
- "You unfasten [src].")
- var/obj/item/sign_backing/SB = new (get_turf(user))
- SB.icon_state = icon_state
- SB.sign_path = type
- qdel(src)
- else if(istype(O, /obj/item/pen) && buildable_sign)
+ I.play_tool_sound(src)
+ if(I.use_tool(src, user, 40))
+ playsound(src, 'sound/items/deconstruct.ogg', 50, 1)
+ user.visible_message("[user] unfastens [src].", \
+ "You unfasten [src].")
+ var/obj/item/sign_backing/SB = new (get_turf(user))
+ SB.icon_state = icon_state
+ SB.sign_path = type
+ qdel(src)
+ return
+ else if(istype(I, /obj/item/pen) && buildable_sign)
var/list/sign_types = list("Secure Area", "Biohazard", "High Voltage", "Radiation", "Hard Vacuum Ahead", "Disposal: Leads To Space", "Danger: Fire", "No Smoking", "Medbay", "Science", "Chemistry", \
"Hydroponics", "Xenobiology")
var/obj/structure/sign/sign_type
diff --git a/code/game/objects/structures/statues.dm b/code/game/objects/structures/statues.dm
index 67b42c128c..9aebbd955b 100644
--- a/code/game/objects/structures/statues.dm
+++ b/code/game/objects/structures/statues.dm
@@ -18,11 +18,10 @@
user.changeNext_move(CLICK_CD_MELEE)
if(istype(W, /obj/item/wrench))
if(anchored)
- playsound(src.loc, W.usesound, 100, 1)
user.visible_message("[user] is loosening the [name]'s bolts.", \
"You are loosening the [name]'s bolts...")
- if(do_after(user,40*W.toolspeed, target = src))
- if(!src.loc || !anchored)
+ if(W.use_tool(src, user, 40, volume=100))
+ if(!anchored)
return
user.visible_message("[user] loosened the [name]'s bolts!", \
"You loosen the [name]'s bolts!")
@@ -31,44 +30,28 @@
if(!isfloorturf(src.loc))
user.visible_message("A floor must be present to secure the [name]!")
return
- playsound(src.loc, W.usesound, 100, 1)
user.visible_message("[user] is securing the [name]'s bolts...", \
"You are securing the [name]'s bolts...")
- if(do_after(user, 40*W.toolspeed, target = src))
- if(!src.loc || anchored)
+ if(W.use_tool(src, user, 40, volume=100))
+ if(anchored)
return
user.visible_message("[user] has secured the [name]'s bolts.", \
"You have secured the [name]'s bolts.")
anchored = TRUE
- else if(istype(W, /obj/item/gun/energy/plasmacutter))
- playsound(src, 'sound/items/welder.ogg', 100, 1)
- user.visible_message("[user] is slicing apart the [name]...", \
- "You are slicing apart the [name]...")
- if(do_after(user,40*W.toolspeed, target = src))
- if(!src.loc)
- return
- user.visible_message("[user] slices apart the [name].", \
- "You slice apart the [name].")
- deconstruct(TRUE)
-
else if(istype(W, /obj/item/pickaxe/drill/jackhammer))
- var/obj/item/pickaxe/drill/jackhammer/D = W
- if(!src.loc)
- return
- user.visible_message("[user] destroys the [name]!", \
+ user.visible_message("[user] destroys the [name]!",
"You destroy the [name].")
- D.playDigSound()
+ W.play_tool_sound(src)
qdel(src)
- else if(istype(W, /obj/item/weldingtool) && !anchored)
- playsound(loc, W.usesound, 40, 1)
+ else if(istype(W, /obj/item/weldingtool) || istype(W, /obj/item/gun/energy/plasmacutter))
+ if(!W.tool_start_check(user, amount=0))
+ return FALSE
+
user.visible_message("[user] is slicing apart the [name].", \
"You are slicing apart the [name]...")
- if(do_after(user, 40*W.toolspeed, target = src))
- if(!src.loc)
- return
- playsound(loc, 'sound/items/welder2.ogg', 50, 1)
+ if(W.use_tool(src, user, 40, volume=50))
user.visible_message("[user] slices apart the [name].", \
"You slice apart the [name]!")
deconstruct(TRUE)
diff --git a/code/game/objects/structures/table_frames.dm b/code/game/objects/structures/table_frames.dm
index 268c30b88d..2b503f4200 100644
--- a/code/game/objects/structures/table_frames.dm
+++ b/code/game/objects/structures/table_frames.dm
@@ -24,8 +24,8 @@
/obj/structure/table_frame/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/wrench))
to_chat(user, "You start disassembling [src]...")
- playsound(src.loc, I.usesound, 50, 1)
- if(do_after(user, 30*I.toolspeed, target = src))
+ I.play_tool_sound(src)
+ if(I.use_tool(src, user, 30))
playsound(src.loc, 'sound/items/deconstruct.ogg', 50, 1)
deconstruct(TRUE)
else if(istype(I, /obj/item/stack/sheet/plasteel))
diff --git a/code/game/objects/structures/tables_racks.dm b/code/game/objects/structures/tables_racks.dm
index e3c88b937b..1a00c90b05 100644
--- a/code/game/objects/structures/tables_racks.dm
+++ b/code/game/objects/structures/tables_racks.dm
@@ -95,23 +95,19 @@
pushed_mob.visible_message("[user] pushes [pushed_mob] onto [src].", \
"[user] pushes [pushed_mob] onto [src].")
add_logs(user, pushed_mob, "pushed")
- var/mob/living/carbon/human/H = pushed_mob
- if(istype(H) && H.ckey == "kevinz000")
- H.forcesay("*moan")
+
/obj/structure/table/attackby(obj/item/I, mob/user, params)
if(!(flags_1 & NODECONSTRUCT_1))
if(istype(I, /obj/item/screwdriver) && deconstruction_ready)
to_chat(user, "You start disassembling [src]...")
- playsound(src.loc, I.usesound, 50, 1)
- if(do_after(user, 20*I.toolspeed, target = src))
+ if(I.use_tool(src, user, 20, volume=50))
deconstruct(TRUE)
return
if(istype(I, /obj/item/wrench) && deconstruction_ready)
to_chat(user, "You start deconstructing [src]...")
- playsound(src.loc, I.usesound, 50, 1)
- if(do_after(user, 40*I.toolspeed, target = src))
+ if(I.use_tool(src, user, 40, volume=50))
playsound(src.loc, 'sound/items/deconstruct.ogg', 50, 1)
deconstruct(TRUE, 1)
return
@@ -309,23 +305,19 @@
/obj/structure/table/reinforced/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/weldingtool))
- var/obj/item/weldingtool/WT = W
- if(WT.remove_fuel(0, user))
- playsound(src.loc, W.usesound, 50, 1)
- if(deconstruction_ready)
- to_chat(user, "You start strengthening the reinforced table...")
- if (do_after(user, 50*W.toolspeed, target = src))
- if(!src || !WT.isOn())
- return
- to_chat(user, "You strengthen the table.")
- deconstruction_ready = 0
- else
- to_chat(user, "You start weakening the reinforced table...")
- if (do_after(user, 50*W.toolspeed, target = src))
- if(!src || !WT.isOn())
- return
- to_chat(user, "You weaken the table.")
- deconstruction_ready = 1
+ if(!W.tool_start_check(user, amount=0))
+ return
+
+ if(deconstruction_ready)
+ to_chat(user, "You start strengthening the reinforced table...")
+ if (W.use_tool(src, user, 50, volume=50))
+ to_chat(user, "You strengthen the table.")
+ deconstruction_ready = 0
+ else
+ to_chat(user, "You start weakening the reinforced table...")
+ if (W.use_tool(src, user, 50, volume=50))
+ to_chat(user, "You weaken the table.")
+ deconstruction_ready = 1
else
. = ..()
@@ -449,7 +441,7 @@
/obj/structure/rack/attackby(obj/item/W, mob/user, params)
if (istype(W, /obj/item/wrench) && !(flags_1&NODECONSTRUCT_1))
- playsound(src.loc, W.usesound, 50, 1)
+ W.play_tool_sound(src)
deconstruct(TRUE)
return
if(user.a_intent == INTENT_HARM)
diff --git a/code/game/objects/structures/transit_tubes/transit_tube.dm b/code/game/objects/structures/transit_tubes/transit_tube.dm
index f701d92360..a958cc2fb6 100644
--- a/code/game/objects/structures/transit_tubes/transit_tube.dm
+++ b/code/game/objects/structures/transit_tubes/transit_tube.dm
@@ -42,8 +42,7 @@
to_chat(user, "Remove the pod first!")
return
user.visible_message("[user] starts to deattach \the [src].", "You start to deattach the [name]...")
- playsound(src.loc, W.usesound, 50, 1)
- if(do_after(user, 35*W.toolspeed, target = src))
+ if(W.use_tool(src, user, 40, volume=50))
to_chat(user, "You deattach the [name].")
var/obj/structure/c_transit_tube/R = new tube_construction(loc)
R.setDir(dir)
diff --git a/code/game/objects/structures/transit_tubes/transit_tube_construction.dm b/code/game/objects/structures/transit_tubes/transit_tube_construction.dm
index 7df9e104a4..883cd8e4bb 100644
--- a/code/game/objects/structures/transit_tubes/transit_tube_construction.dm
+++ b/code/game/objects/structures/transit_tubes/transit_tube_construction.dm
@@ -28,22 +28,17 @@
build_type = flipped_build_type
else
build_type = initial(build_type)
- icon_state = "[base_icon][flipped]"
+ icon_state = "[base_icon][flipped]"
-/obj/structure/c_transit_tube/attackby(obj/item/I, mob/user, params)
- if(istype(I, /obj/item/wrench))
- to_chat(user, "You start attaching the [name]...")
- add_fingerprint(user)
- playsound(src.loc, I.usesound, 50, 1)
- if(do_after(user, 40*I.toolspeed, target = src))
- if(QDELETED(src))
- return
- to_chat(user, "You attach the [name].")
- var/obj/structure/transit_tube/R = new build_type(loc, dir)
- transfer_fingerprints_to(R)
- qdel(src)
- else
- return ..()
+/obj/structure/c_transit_tube/wrench_act(mob/living/user, obj/item/I)
+ to_chat(user, "You start attaching the [name]...")
+ add_fingerprint(user)
+ if(I.use_tool(src, user, 40, volume=50))
+ to_chat(user, "You attach the [name].")
+ var/obj/structure/transit_tube/R = new build_type(loc, dir)
+ transfer_fingerprints_to(R)
+ qdel(src)
+ return TRUE
// transit tube station
/obj/structure/c_transit_tube/station
diff --git a/code/game/objects/structures/transit_tubes/transit_tube_pod.dm b/code/game/objects/structures/transit_tubes/transit_tube_pod.dm
index eabe4499a4..03082cd4ba 100644
--- a/code/game/objects/structures/transit_tubes/transit_tube_pod.dm
+++ b/code/game/objects/structures/transit_tubes/transit_tube_pod.dm
@@ -30,7 +30,7 @@
/obj/structure/transit_tube_pod/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/crowbar))
if(!moving)
- playsound(src.loc, I.usesound, 50, 1)
+ I.play_tool_sound(src)
if(contents.len)
user.visible_message("[user] empties \the [src].", "You empty \the [src].")
empty_pod()
diff --git a/code/game/objects/structures/watercloset.dm b/code/game/objects/structures/watercloset.dm
index d4fbb60b2d..29a98c5554 100644
--- a/code/game/objects/structures/watercloset.dm
+++ b/code/game/objects/structures/watercloset.dm
@@ -75,7 +75,7 @@
if(istype(I, /obj/item/crowbar))
to_chat(user, "You start to [cistern ? "replace the lid on the cistern" : "lift the lid off the cistern"]...")
playsound(loc, 'sound/effects/stonedoor_openclose.ogg', 50, 1)
- if(do_after(user, 30*I.toolspeed, target = src))
+ if(I.use_tool(src, user, 30))
user.visible_message("[user] [cistern ? "replaces the lid on the cistern" : "lifts the lid off the cistern"]!", "You [cistern ? "replace the lid on the cistern" : "lift the lid off the cistern"]!", "You hear grinding porcelain.")
cistern = !cistern
update_icon()
@@ -159,13 +159,7 @@
..()
/obj/structure/urinal/attackby(obj/item/I, mob/living/user, params)
- if(istype(I, /obj/item/screwdriver))
- to_chat(user, "You start to [exposed ? "screw the cap back into place" : "unscrew the cap to the drain protector"]...")
- playsound(loc, 'sound/effects/stonedoor_openclose.ogg', 50, 1)
- if(do_after(user, 20*I.toolspeed, target = src))
- user.visible_message("[user] [exposed ? "screws the cap back into place" : "unscrew the cap to the drain protector"]!", "You [exposed ? "screw the cap back into place" : "unscrew the cap on the drain"]!", "You hear metal and squishing noises.")
- exposed = !exposed
- else if(exposed)
+ if(exposed)
if (hiddenitem)
to_chat(user, "There is already something in the drain enclosure.")
return
@@ -177,6 +171,18 @@
return
hiddenitem = I
to_chat(user, "You place [I] into the drain enclosure.")
+ else
+ return ..()
+
+/obj/structure/urinal/screwdriver_act(mob/living/user, obj/item/I)
+ to_chat(user, "You start to [exposed ? "screw the cap back into place" : "unscrew the cap to the drain protector"]...")
+ playsound(loc, 'sound/effects/stonedoor_openclose.ogg', 50, 1)
+ if(I.use_tool(src, user, 20))
+ user.visible_message("[user] [exposed ? "screws the cap back into place" : "unscrew the cap to the drain protector"]!",
+ "You [exposed ? "screw the cap back into place" : "unscrew the cap on the drain"]!",
+ "You hear metal and squishing noises.")
+ exposed = !exposed
+ return TRUE
/obj/item/reagent_containers/food/urinalcake
@@ -247,19 +253,23 @@
/obj/machinery/shower/attackby(obj/item/I, mob/user, params)
if(I.type == /obj/item/device/analyzer)
to_chat(user, "The water temperature seems to be [watertemp].")
- if(istype(I, /obj/item/wrench))
- to_chat(user, "You begin to adjust the temperature valve with \the [I]...")
- if(do_after(user, 50*I.toolspeed, target = src))
- switch(watertemp)
- if("normal")
- watertemp = "freezing"
- if("freezing")
- watertemp = "boiling"
- if("boiling")
- watertemp = "normal"
- user.visible_message("[user] adjusts the shower with \the [I].", "You adjust the shower with \the [I] to [watertemp] temperature.")
- log_game("[key_name(user)] has wrenched a shower to [watertemp] at ([x],[y],[z])")
- add_hiddenprint(user)
+ else
+ return ..()
+
+/obj/machinery/shower/wrench_act(mob/living/user, obj/item/I)
+ to_chat(user, "You begin to adjust the temperature valve with \the [I]...")
+ if(I.use_tool(src, user, 50))
+ switch(watertemp)
+ if("normal")
+ watertemp = "freezing"
+ if("freezing")
+ watertemp = "boiling"
+ if("boiling")
+ watertemp = "normal"
+ user.visible_message("[user] adjusts the shower with \the [I].", "You adjust the shower with \the [I] to [watertemp] temperature.")
+ log_game("[key_name(user)] has wrenched a shower to [watertemp] at ([x],[y],[z])")
+ add_hiddenprint(user)
+ return TRUE
/obj/machinery/shower/update_icon() //this is terribly unreadable, but basically it makes the shower mist up
@@ -611,34 +621,24 @@
/obj/structure/curtain/attackby(obj/item/W, mob/user)
if (istype(W, /obj/item/toy/crayon))
color = input(user,"","Choose Color",color) as color
- else if(istype(W, /obj/item/screwdriver))
- if(anchored)
- playsound(src.loc, W.usesound, 100, 1)
- user.visible_message("[user] unscrews [src] from the floor.", "You start to unscrew [src] from the floor...", "You hear rustling noises.")
- if(do_after(user, 50*W.toolspeed, target = src))
- if(!anchored)
- return
- anchored = FALSE
- to_chat(user, "You unscrew [src] from the floor.")
- else
- playsound(src.loc, W.usesound, 100, 1)
- user.visible_message("[user] screws [src] to the floor.", "You start to screw [src] to the floor...", "You hear rustling noises.")
- if(do_after(user, 50*W.toolspeed, target = src))
- if(anchored)
- return
- anchored = TRUE
- to_chat(user, "You screw [src] to the floor.")
- else if(istype(W, /obj/item/wirecutters))
- if(!anchored)
- playsound(src.loc, W.usesound, 100, 1)
- user.visible_message("[user] cuts apart [src].", "You start to cut apart [src].", "You hear cutting.")
- if(do_after(user, 50*W.toolspeed, target = src))
- if(anchored)
- return
- to_chat(user, "You cut apart [src].")
- deconstruct()
else
- . = ..()
+ return ..()
+
+/obj/structure/curtain/wrench_act(mob/living/user, obj/item/I)
+ default_unfasten_wrench(user, I, 50)
+ return TRUE
+
+/obj/structure/curtain/wirecutter_act(mob/living/user, obj/item/I)
+ if(anchored)
+ return TRUE
+
+ user.visible_message("[user] cuts apart [src].",
+ "You start to cut apart [src].", "You hear cutting.")
+ if(I.use_tool(src, user, 50, volume=100) && !anchored)
+ to_chat(user, "You cut apart [src].")
+ deconstruct()
+
+ return TRUE
/obj/structure/curtain/attack_hand(mob/user)
diff --git a/code/game/objects/structures/windoor_assembly.dm b/code/game/objects/structures/windoor_assembly.dm
index 23a1113665..c819490a12 100644
--- a/code/game/objects/structures/windoor_assembly.dm
+++ b/code/game/objects/structures/windoor_assembly.dm
@@ -87,36 +87,34 @@
add_fingerprint(user)
switch(state)
if("01")
- if(istype(W, /obj/item/weldingtool) && !anchored )
- var/obj/item/weldingtool/WT = W
- if (WT.remove_fuel(0,user))
- user.visible_message("[user] disassembles the windoor assembly.", "You start to disassemble the windoor assembly...")
- playsound(loc, 'sound/items/welder2.ogg', 50, 1)
-
- if(do_after(user, 40*W.toolspeed, target = src))
- if(!src || !WT.isOn())
- return
- to_chat(user, "You disassemble the windoor assembly.")
- var/obj/item/stack/sheet/rglass/RG = new (get_turf(src), 5)
- RG.add_fingerprint(user)
- if(secure)
- var/obj/item/stack/rods/R = new (get_turf(src), 4)
- R.add_fingerprint(user)
- qdel(src)
- else
+ if(istype(W, /obj/item/weldingtool) && !anchored)
+ if(!W.tool_start_check(user, amount=0))
return
+ user.visible_message("[user] disassembles the windoor assembly.",
+ "You start to disassemble the windoor assembly...")
+
+ if(W.use_tool(src, user, 40, volume=50))
+ to_chat(user, "You disassemble the windoor assembly.")
+ var/obj/item/stack/sheet/rglass/RG = new (get_turf(src), 5)
+ RG.add_fingerprint(user)
+ if(secure)
+ var/obj/item/stack/rods/R = new (get_turf(src), 4)
+ R.add_fingerprint(user)
+ qdel(src)
+ return
+
//Wrenching an unsecure assembly anchors it in place. Step 4 complete
if(istype(W, /obj/item/wrench) && !anchored)
for(var/obj/machinery/door/window/WD in loc)
if(WD.dir == dir)
to_chat(user, "There is already a windoor in that location!")
return
- playsound(loc, W.usesound, 100, 1)
- user.visible_message("[user] secures the windoor assembly to the floor.", "You start to secure the windoor assembly to the floor...")
+ user.visible_message("[user] secures the windoor assembly to the floor.",
+ "You start to secure the windoor assembly to the floor...")
- if(do_after(user, 40*W.toolspeed, target = src))
- if(!src || anchored)
+ if(W.use_tool(src, user, 40, volume=100))
+ if(anchored)
return
for(var/obj/machinery/door/window/WD in loc)
if(WD.dir == dir)
@@ -131,11 +129,11 @@
//Unwrenching an unsecure assembly un-anchors it. Step 4 undone
else if(istype(W, /obj/item/wrench) && anchored)
- playsound(loc, W.usesound, 100, 1)
- user.visible_message("[user] unsecures the windoor assembly to the floor.", "You start to unsecure the windoor assembly to the floor...")
+ user.visible_message("[user] unsecures the windoor assembly to the floor.",
+ "You start to unsecure the windoor assembly to the floor...")
- if(do_after(user, 40*W.toolspeed, target = src))
- if(!src || !anchored)
+ if(W.use_tool(src, user, 40, volume=100))
+ if(!anchored)
return
to_chat(user, "You unsecure the windoor assembly.")
anchored = FALSE
@@ -188,11 +186,10 @@
//Removing wire from the assembly. Step 5 undone.
if(istype(W, /obj/item/wirecutters))
- playsound(loc, W.usesound, 100, 1)
user.visible_message("[user] cuts the wires from the airlock assembly.", "You start to cut the wires from airlock assembly...")
- if(do_after(user, 40*W.toolspeed, target = src))
- if(!src || state != "02")
+ if(W.use_tool(src, user, 40, volume=100))
+ if(state != "02")
return
to_chat(user, "You cut the windoor wires.")
@@ -207,8 +204,9 @@
else if(istype(W, /obj/item/electronics/airlock))
if(!user.transferItemToLoc(W, src))
return
- playsound(loc, W.usesound, 100, 1)
- user.visible_message("[user] installs the electronics into the airlock assembly.", "You start to install electronics into the airlock assembly...")
+ W.play_tool_sound(src, 100)
+ user.visible_message("[user] installs the electronics into the airlock assembly.",
+ "You start to install electronics into the airlock assembly...")
if(do_after(user, 40, target = src))
if(!src || electronics)
@@ -225,12 +223,10 @@
if(!electronics)
return
- playsound(loc, W.usesound, 100, 1)
- user.visible_message("[user] removes the electronics from the airlock assembly.", "You start to uninstall electronics from the airlock assembly...")
+ user.visible_message("[user] removes the electronics from the airlock assembly.",
+ "You start to uninstall electronics from the airlock assembly...")
- if(do_after(user, 40*W.toolspeed, target = src))
- if(!src || !electronics)
- return
+ if(W.use_tool(src, user, 40, volume=100) && electronics)
to_chat(user, "You remove the airlock electronics.")
name = "wired windoor assembly"
var/obj/item/electronics/airlock/ae
@@ -254,58 +250,56 @@
if(!electronics)
to_chat(usr, "The assembly is missing electronics!")
return
- usr << browse(null, "window=windoor_access")
- playsound(loc, W.usesound, 100, 1)
- user.visible_message("[user] pries the windoor into the frame.", "You start prying the windoor into the frame...")
+ user << browse(null, "window=windoor_access")
+ user.visible_message("[user] pries the windoor into the frame.",
+ "You start prying the windoor into the frame...")
- if(do_after(user, 40*W.toolspeed, target = src))
-
- if(loc && electronics)
-
- density = TRUE //Shouldn't matter but just incase
- to_chat(user, "You finish the windoor.")
-
- if(secure)
- var/obj/machinery/door/window/brigdoor/windoor = new /obj/machinery/door/window/brigdoor(loc)
- if(facing == "l")
- windoor.icon_state = "leftsecureopen"
- windoor.base_state = "leftsecure"
- else
- windoor.icon_state = "rightsecureopen"
- windoor.base_state = "rightsecure"
- windoor.setDir(dir)
- windoor.density = FALSE
-
- if(electronics.one_access)
- windoor.req_one_access = electronics.accesses
- else
- windoor.req_access = electronics.accesses
- windoor.electronics = electronics
- electronics.forceMove(windoor)
- if(created_name)
- windoor.name = created_name
- qdel(src)
- windoor.close()
+ if(W.use_tool(src, user, 40, volume=100) && electronics)
+ density = TRUE //Shouldn't matter but just incase
+ to_chat(user, "You finish the windoor.")
+ if(secure)
+ var/obj/machinery/door/window/brigdoor/windoor = new /obj/machinery/door/window/brigdoor(loc)
+ if(facing == "l")
+ windoor.icon_state = "leftsecureopen"
+ windoor.base_state = "leftsecure"
else
- var/obj/machinery/door/window/windoor = new /obj/machinery/door/window(loc)
- if(facing == "l")
- windoor.icon_state = "leftopen"
- windoor.base_state = "left"
- else
- windoor.icon_state = "rightopen"
- windoor.base_state = "right"
- windoor.setDir(dir)
- windoor.density = FALSE
+ windoor.icon_state = "rightsecureopen"
+ windoor.base_state = "rightsecure"
+ windoor.setDir(dir)
+ windoor.density = FALSE
+ if(electronics.one_access)
+ windoor.req_one_access = electronics.accesses
+ else
windoor.req_access = electronics.accesses
- windoor.electronics = electronics
- electronics.loc = windoor
- if(created_name)
- windoor.name = created_name
- qdel(src)
- windoor.close()
+ windoor.electronics = electronics
+ electronics.forceMove(windoor)
+ if(created_name)
+ windoor.name = created_name
+ qdel(src)
+ windoor.close()
+
+
+ else
+ var/obj/machinery/door/window/windoor = new /obj/machinery/door/window(loc)
+ if(facing == "l")
+ windoor.icon_state = "leftopen"
+ windoor.base_state = "left"
+ else
+ windoor.icon_state = "rightopen"
+ windoor.base_state = "right"
+ windoor.setDir(dir)
+ windoor.density = FALSE
+
+ windoor.req_access = electronics.accesses
+ windoor.electronics = electronics
+ electronics.loc = windoor
+ if(created_name)
+ windoor.name = created_name
+ qdel(src)
+ windoor.close()
else
@@ -318,7 +312,13 @@
/obj/structure/windoor_assembly/ComponentInitialize()
. = ..()
- AddComponent(/datum/component/simple_rotation,ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_COUNTERCLOCKWISE | ROTATION_VERBS,null,CALLBACK(src, .proc/can_be_rotated),CALLBACK(src,.proc/after_rotation))
+ AddComponent(
+ /datum/component/simple_rotation,
+ ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_COUNTERCLOCKWISE | ROTATION_VERBS,
+ null,
+ CALLBACK(src, .proc/can_be_rotated),
+ CALLBACK(src,.proc/after_rotation)
+ )
/obj/structure/windoor_assembly/proc/can_be_rotated(mob/user,rotation_type)
if(anchored)
diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm
index e7cd1f4eab..f923453f62 100644
--- a/code/game/objects/structures/window.dm
+++ b/code/game/objects/structures/window.dm
@@ -178,39 +178,39 @@
return 1 //skip the afterattack
add_fingerprint(user)
+
if(istype(I, /obj/item/weldingtool) && user.a_intent == INTENT_HELP)
- var/obj/item/weldingtool/WT = I
if(obj_integrity < max_integrity)
- if(WT.remove_fuel(0,user))
- to_chat(user, "You begin repairing [src]...")
- playsound(src, WT.usesound, 40, 1)
- if(do_after(user, 40*I.toolspeed, target = src))
- obj_integrity = max_integrity
- playsound(src, 'sound/items/Welder2.ogg', 50, 1)
- update_nearby_icons()
- to_chat(user, "You repair [src].")
+ if(!I.tool_start_check(user, amount=0))
+ return
+
+ to_chat(user, "You begin repairing [src]...")
+ if(I.use_tool(src, user, 40, volume=50))
+ obj_integrity = max_integrity
+ update_nearby_icons()
+ to_chat(user, "You repair [src].")
else
to_chat(user, "[src] is already in good condition!")
return
if(!(flags_1&NODECONSTRUCT_1))
if(istype(I, /obj/item/screwdriver))
- playsound(src, I.usesound, 75, 1)
+ I.play_tool_sound(src, 75)
if(reinf)
if(state == WINDOW_SCREWED_TO_FRAME || state == WINDOW_IN_FRAME)
to_chat(user, "You begin to [state == WINDOW_SCREWED_TO_FRAME ? "unscrew the window from":"screw the window to"] the frame...")
- if(do_after(user, decon_speed*I.toolspeed, target = src, extra_checks = CALLBACK(src, .proc/check_state_and_anchored, state, anchored)))
+ if(I.use_tool(src, user, decon_speed, extra_checks = CALLBACK(src, .proc/check_state_and_anchored, state, anchored)))
state = (state == WINDOW_IN_FRAME ? WINDOW_SCREWED_TO_FRAME : WINDOW_IN_FRAME)
to_chat(user, "You [state == WINDOW_IN_FRAME ? "unfasten the window from":"fasten the window to"] the frame.")
else if(state == WINDOW_OUT_OF_FRAME)
to_chat(user, "You begin to [anchored ? "unscrew the frame from":"screw the frame to"] the floor...")
- if(do_after(user, decon_speed*I.toolspeed, target = src, extra_checks = CALLBACK(src, .proc/check_state_and_anchored, state, anchored)))
+ if(I.use_tool(src, user, decon_speed, extra_checks = CALLBACK(src, .proc/check_state_and_anchored, state, anchored)))
anchored = !anchored
update_nearby_icons()
to_chat(user, "You [anchored ? "fasten the frame to":"unfasten the frame from"] the floor.")
else //if we're not reinforced, we don't need to check or update state
to_chat(user, "You begin to [anchored ? "unscrew the window from":"screw the window to"] the floor...")
- if(do_after(user, decon_speed*I.toolspeed, target = src, extra_checks = CALLBACK(src, .proc/check_anchored, anchored)))
+ if(I.use_tool(src, user, decon_speed, extra_checks = CALLBACK(src, .proc/check_anchored, anchored)))
anchored = !anchored
air_update_turf(TRUE)
update_nearby_icons()
@@ -220,16 +220,16 @@
else if (istype(I, /obj/item/crowbar) && reinf && (state == WINDOW_OUT_OF_FRAME || state == WINDOW_IN_FRAME))
to_chat(user, "You begin to lever the window [state == WINDOW_OUT_OF_FRAME ? "into":"out of"] the frame...")
- playsound(src, I.usesound, 75, 1)
- if(do_after(user, decon_speed*I.toolspeed, target = src, extra_checks = CALLBACK(src, .proc/check_state_and_anchored, state, anchored)))
+ I.play_tool_sound(src, 75)
+ if(I.use_tool(src, user, decon_speed, extra_checks = CALLBACK(src, .proc/check_state_and_anchored, state, anchored)))
state = (state == WINDOW_OUT_OF_FRAME ? WINDOW_IN_FRAME : WINDOW_OUT_OF_FRAME)
to_chat(user, "You pry the window [state == WINDOW_IN_FRAME ? "into":"out of"] the frame.")
return
else if(istype(I, /obj/item/wrench) && !anchored)
- playsound(src, I.usesound, 75, 1)
+ I.play_tool_sound(src, 75)
to_chat(user, " You begin to disassemble [src]...")
- if(do_after(user, decon_speed*I.toolspeed, target = src, extra_checks = CALLBACK(src, .proc/check_state_and_anchored, state, anchored)))
+ if(I.use_tool(src, user, decon_speed, extra_checks = CALLBACK(src, .proc/check_state_and_anchored, state, anchored)))
var/obj/item/stack/sheet/G = new glass_type(user.loc, glass_amount)
G.add_fingerprint(user)
playsound(src, 'sound/items/Deconstruct.ogg', 50, 1)
diff --git a/code/game/shuttle_engines.dm b/code/game/shuttle_engines.dm
index 80329f20a1..257ae07a55 100644
--- a/code/game/shuttle_engines.dm
+++ b/code/game/shuttle_engines.dm
@@ -39,30 +39,34 @@
if(default_unfasten_wrench(user, I))
return
else if(istype(I, /obj/item/weldingtool))
- var/obj/item/weldingtool/WT = I
switch(state)
if(ENGINE_UNWRENCHED)
to_chat(user, "The [src.name] needs to be wrenched to the floor!")
if(EM_SECURED)
- if(WT.remove_fuel(0,user))
- playsound(loc, WT.usesound, 50, 1)
- user.visible_message("[user.name] starts to weld the [name] to the floor.", \
- "You start to weld \the [src] to the floor...", \
- "You hear welding.")
- if(do_after(user,ENGINE_WELDTIME*WT.toolspeed, target = src) && WT.isOn())
- state = ENGINE_WELDED
- to_chat(user, "You weld \the [src] to the floor.")
- alter_engine_power(engine_power)
+ if(!I.tool_start_check(user, amount=0))
+ return
+
+ user.visible_message("[user.name] starts to weld the [name] to the floor.", \
+ "You start to weld \the [src] to the floor...", \
+ "You hear welding.")
+
+ if(I.use_tool(src, user, ENGINE_WELDTIME, volume=50))
+ state = ENGINE_WELDED
+ to_chat(user, "You weld \the [src] to the floor.")
+ alter_engine_power(engine_power)
+
if(EM_WELDED)
- if(WT.remove_fuel(0,user))
- playsound(loc, WT.usesound, 50, 1)
- user.visible_message("[user.name] starts to cut the [name] free from the floor.", \
- "You start to cut \the [src] free from the floor...", \
- "You hear welding.")
- if(do_after(user,ENGINE_WELDTIME*WT.toolspeed, target = src) && WT.isOn())
- state = ENGINE_WRENCHED
- to_chat(user, "You cut \the [src] free from the floor.")
- alter_engine_power(-engine_power)
+ if(!I.tool_start_check(user, amount=0))
+ return
+
+ user.visible_message("[user.name] starts to cut the [name] free from the floor.", \
+ "You start to cut \the [src] free from the floor...", \
+ "You hear welding.")
+
+ if(I.use_tool(src, user, ENGINE_WELDTIME, volume=50))
+ state = ENGINE_WRENCHED
+ to_chat(user, "You cut \the [src] free from the floor.")
+ alter_engine_power(-engine_power)
return
else
return ..()
diff --git a/code/game/turfs/simulated/floor.dm b/code/game/turfs/simulated/floor.dm
index ab03b571fc..129a8c119a 100644
--- a/code/game/turfs/simulated/floor.dm
+++ b/code/game/turfs/simulated/floor.dm
@@ -156,8 +156,8 @@
return
P.attackby(T, user, params)
-/turf/open/floor/proc/pry_tile(obj/item/C, mob/user, silent = FALSE)
- playsound(src, C.usesound, 80, 1)
+/turf/open/floor/proc/pry_tile(obj/item/I, mob/user, silent = FALSE)
+ I.play_tool_sound(src, 80)
return remove_tile(user, silent)
/turf/open/floor/proc/remove_tile(mob/user, silent = FALSE, make_tile = TRUE)
diff --git a/code/game/turfs/simulated/floor/fancy_floor.dm b/code/game/turfs/simulated/floor/fancy_floor.dm
index 02b34dd0d2..d3a340965f 100644
--- a/code/game/turfs/simulated/floor/fancy_floor.dm
+++ b/code/game/turfs/simulated/floor/fancy_floor.dm
@@ -39,7 +39,7 @@
/turf/open/floor/wood/pry_tile(obj/item/C, mob/user, silent = FALSE)
var/is_screwdriver = istype(C, /obj/item/screwdriver)
- playsound(src, C.usesound, 80, 1)
+ C.play_tool_sound(src, 80)
return remove_tile(user, silent, make_tile = is_screwdriver)
/turf/open/floor/wood/remove_tile(mob/user, silent = FALSE, make_tile = TRUE)
diff --git a/code/game/turfs/simulated/floor/misc_floor.dm b/code/game/turfs/simulated/floor/misc_floor.dm
index c6a2984fed..721cb12e9d 100644
--- a/code/game/turfs/simulated/floor/misc_floor.dm
+++ b/code/game/turfs/simulated/floor/misc_floor.dm
@@ -196,19 +196,14 @@
flick_overlay(I, viewing, 8)
L.adjustToxLoss(-3, TRUE, TRUE)
-/turf/open/floor/clockwork/attackby(obj/item/I, mob/living/user, params)
+/turf/open/floor/clockwork/crowbar_act(mob/living/user, obj/item/I)
if(baseturfs == type)
- return
- if(istype(I, /obj/item/crowbar))
- user.visible_message("[user] begins slowly prying up [src]...", "You begin painstakingly prying up [src]...")
- playsound(src, I.usesound, 20, 1)
- if(!do_after(user, 70*I.toolspeed, target = src))
- return 0
+ return TRUE
+ user.visible_message("[user] begins slowly prying up [src]...", "You begin painstakingly prying up [src]...")
+ if(I.use_tool(src, user, 70, volume=80))
user.visible_message("[user] pries up [src]!", "You pry up [src]!")
- playsound(src, I.usesound, 80, 1)
make_plating()
- return 1
- return ..()
+ return TRUE
/turf/open/floor/clockwork/make_plating()
new /obj/item/stack/tile/brass(src)
diff --git a/code/game/turfs/simulated/floor/plating.dm b/code/game/turfs/simulated/floor/plating.dm
index e26d2701a8..be55db5408 100644
--- a/code/game/turfs/simulated/floor/plating.dm
+++ b/code/game/turfs/simulated/floor/plating.dm
@@ -78,15 +78,15 @@
playsound(src, 'sound/weapons/genhit.ogg', 50, 1)
else
to_chat(user, "This section is too damaged to support a tile! Use a welder to fix the damage.")
- else if(istype(C, /obj/item/weldingtool))
- var/obj/item/weldingtool/welder = C
- if( welder.isOn() && (broken || burnt) )
- if(welder.remove_fuel(0,user))
- to_chat(user, "You fix some dents on the broken plating.")
- playsound(src, welder.usesound, 80, 1)
- icon_state = icon_plating
- burnt = 0
- broken = 0
+
+/turf/open/floor/plating/welder_act(mob/living/user, obj/item/I)
+ if((broken || burnt) && I.use_tool(src, user, 0, volume=80))
+ to_chat(user, "You fix some dents on the broken plating.")
+ icon_state = icon_plating
+ burnt = FALSE
+ broken = FALSE
+
+ return TRUE
/turf/open/floor/plating/foam
name = "metal foam plating"
diff --git a/code/game/turfs/simulated/floor/reinf_floor.dm b/code/game/turfs/simulated/floor/reinf_floor.dm
index 60382b9052..0bd4572b35 100644
--- a/code/game/turfs/simulated/floor/reinf_floor.dm
+++ b/code/game/turfs/simulated/floor/reinf_floor.dm
@@ -25,18 +25,14 @@
..()
return //unplateable
-/turf/open/floor/engine/attackby(obj/item/C, mob/user, params)
- if(!C || !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/open/floor/engine))
- return
- new /obj/item/stack/rods(src, 2)
- ChangeTurf(/turf/open/floor/plating)
- return
+/turf/open/floor/engine/wrench_act(mob/living/user, obj/item/I)
+ to_chat(user, "You begin removing rods...")
+ if(I.use_tool(src, user, 30, volume=80))
+ if(!istype(src, /turf/open/floor/engine))
+ return TRUE
+ new /obj/item/stack/rods(src, 2)
+ ChangeTurf(/turf/open/floor/plating)
+ return TRUE
/turf/open/floor/engine/acid_act(acidpwr, acid_volume)
acidpwr = min(acidpwr, 50) //we reduce the power so reinf floor never get melted.
diff --git a/code/game/turfs/simulated/lava.dm b/code/game/turfs/simulated/lava.dm
index a40203beba..856537c1d5 100644
--- a/code/game/turfs/simulated/lava.dm
+++ b/code/game/turfs/simulated/lava.dm
@@ -139,7 +139,7 @@
/turf/open/lava/smooth/lava_land_surface
initial_gas_mix = LAVALAND_DEFAULT_ATMOS
planetary_atmos = TRUE
- baseturfs = /turf/open/chasm/lavaland
+ baseturfs = /turf/open/lava/smooth/lava_land_surface
/turf/open/lava/smooth/airless
initial_gas_mix = "TEMP=2.7"
diff --git a/code/game/turfs/simulated/minerals.dm b/code/game/turfs/simulated/minerals.dm
index 8a473cc42a..6e3c1d66f3 100644
--- a/code/game/turfs/simulated/minerals.dm
+++ b/code/game/turfs/simulated/minerals.dm
@@ -60,7 +60,6 @@
return
last_act = world.time
to_chat(user, "You start picking...")
- P.playDigSound()
if(do_after(user,P.digspeed, target = src))
if(ismineralturf(src))
diff --git a/code/game/turfs/simulated/wall/reinf_walls.dm b/code/game/turfs/simulated/wall/reinf_walls.dm
index 4211c83d37..6a68a894cf 100644
--- a/code/game/turfs/simulated/wall/reinf_walls.dm
+++ b/code/game/turfs/simulated/wall/reinf_walls.dm
@@ -50,25 +50,24 @@
playsound(src, 'sound/effects/bang.ogg', 50, 1)
to_chat(M, "This wall is far too strong for you to destroy.")
-/turf/closed/wall/r_wall/try_destroy(obj/item/W, mob/user, turf/T)
- if(istype(W, /obj/item/pickaxe/drill/jackhammer))
- var/obj/item/pickaxe/drill/jackhammer/D = W
- to_chat(user, "You begin to smash though the [name]...")
+/turf/closed/wall/r_wall/try_destroy(obj/item/I, mob/user, turf/T)
+ if(istype(I, /obj/item/pickaxe/drill/jackhammer))
+ to_chat(user, "You begin to smash though [src]...")
if(do_after(user, 50, target = src))
- if(!istype(src, /turf/closed/wall/r_wall) || !W)
- return 1
- D.playDigSound()
- visible_message("[user] smashes through the [name] with the [D.name]!", "You hear the grinding of metal.")
+ if(!istype(src, /turf/closed/wall/r_wall))
+ return TRUE
+ I.play_tool_sound(src)
+ visible_message("[user] smashes through [src] with [I]!", "You hear the grinding of metal.")
dismantle_wall()
- return 1
- return 0
+ return TRUE
+ return FALSE
/turf/closed/wall/r_wall/try_decon(obj/item/W, mob/user, turf/T)
//DECONSTRUCTION
switch(d_state)
if(INTACT)
if(istype(W, /obj/item/wirecutters))
- playsound(src, W.usesound, 100, 1)
+ W.play_tool_sound(src, 100)
d_state = SUPPORT_LINES
update_icon()
to_chat(user, "You cut the outer grille.")
@@ -77,9 +76,8 @@
if(SUPPORT_LINES)
if(istype(W, /obj/item/screwdriver))
to_chat(user, "You begin unsecuring the support lines...")
- playsound(src, W.usesound, 100, 1)
- if(do_after(user, 40*W.toolspeed, target = src))
- if(!istype(src, /turf/closed/wall/r_wall) || !W || d_state != SUPPORT_LINES)
+ if(W.use_tool(src, user, 40, volume=100))
+ if(!istype(src, /turf/closed/wall/r_wall) || d_state != SUPPORT_LINES)
return 1
d_state = COVER
update_icon()
@@ -87,31 +85,19 @@
return 1
else if(istype(W, /obj/item/wirecutters))
- playsound(src, W.usesound, 100, 1)
+ W.play_tool_sound(src, 100)
d_state = INTACT
update_icon()
to_chat(user, "You repair the outer grille.")
return 1
if(COVER)
- if(istype(W, /obj/item/weldingtool))
- var/obj/item/weldingtool/WT = W
- if(WT.remove_fuel(0,user))
- to_chat(user, "You begin slicing through the metal cover...")
- playsound(src, W.usesound, 100, 1)
- if(do_after(user, 60*W.toolspeed, target = src))
- if(!istype(src, /turf/closed/wall/r_wall) || !WT || !WT.isOn() || d_state != COVER)
- return 1
- d_state = CUT_COVER
- update_icon()
- to_chat(user, "You press firmly on the cover, dislodging it.")
- return 1
-
- if(istype(W, /obj/item/gun/energy/plasmacutter))
+ if(istype(W, /obj/item/weldingtool) || istype(W, /obj/item/gun/energy/plasmacutter))
+ if(!W.tool_start_check(user, amount=0))
+ return
to_chat(user, "You begin slicing through the metal cover...")
- playsound(src, 'sound/items/welder.ogg', 100, 1)
- if(do_after(user, 60*W.toolspeed, target = src))
- if(!istype(src, /turf/closed/wall/r_wall) || !W || d_state != COVER)
+ if(W.use_tool(src, user, 60, volume=100))
+ if(!istype(src, /turf/closed/wall/r_wall) || d_state != COVER)
return 1
d_state = CUT_COVER
update_icon()
@@ -120,9 +106,8 @@
if(istype(W, /obj/item/screwdriver))
to_chat(user, "You begin securing the support lines...")
- playsound(src, W.usesound, 100, 1)
- if(do_after(user, 40*W.toolspeed, target = src))
- if(!istype(src, /turf/closed/wall/r_wall) || !W || d_state != COVER)
+ if(W.use_tool(src, user, 40, volume=100))
+ if(!istype(src, /turf/closed/wall/r_wall) || d_state != COVER)
return 1
d_state = SUPPORT_LINES
update_icon()
@@ -132,9 +117,8 @@
if(CUT_COVER)
if(istype(W, /obj/item/crowbar))
to_chat(user, "You struggle to pry off the cover...")
- playsound(src, W.usesound, 100, 1)
- if(do_after(user, 100*W.toolspeed, target = src))
- if(!istype(src, /turf/closed/wall/r_wall) || !W || d_state != CUT_COVER)
+ if(W.use_tool(src, user, 100, volume=100))
+ if(!istype(src, /turf/closed/wall/r_wall) || d_state != CUT_COVER)
return 1
d_state = BOLTS
update_icon()
@@ -142,24 +126,22 @@
return 1
if(istype(W, /obj/item/weldingtool))
- var/obj/item/weldingtool/WT = W
- if(WT.remove_fuel(0,user))
- to_chat(user, "You begin welding the metal cover back to the frame...")
- playsound(src, WT.usesound, 100, 1)
- if(do_after(user, 60*WT.toolspeed, target = src))
- if(!istype(src, /turf/closed/wall/r_wall) || !WT || !WT.isOn() || d_state != CUT_COVER)
- return 1
- d_state = COVER
- update_icon()
- to_chat(user, "The metal cover has been welded securely to the frame.")
+ if(!W.tool_start_check(user, amount=0))
+ return
+ to_chat(user, "You begin welding the metal cover back to the frame...")
+ if(W.use_tool(src, user, 60, volume=100))
+ if(!istype(src, /turf/closed/wall/r_wall) || d_state != CUT_COVER)
+ return TRUE
+ d_state = COVER
+ update_icon()
+ to_chat(user, "The metal cover has been welded securely to the frame.")
return 1
if(BOLTS)
if(istype(W, /obj/item/wrench))
to_chat(user, "You start loosening the anchoring bolts which secure the support rods to their frame...")
- playsound(src, W.usesound, 100, 1)
- if(do_after(user, 40*W.toolspeed, target = src))
- if(!istype(src, /turf/closed/wall/r_wall) || !W || d_state != BOLTS)
+ if(W.use_tool(src, user, 40, volume=100))
+ if(!istype(src, /turf/closed/wall/r_wall) || d_state != BOLTS)
return 1
d_state = SUPPORT_RODS
update_icon()
@@ -168,9 +150,8 @@
if(istype(W, /obj/item/crowbar))
to_chat(user, "You start to pry the cover back into place...")
- playsound(src, W.usesound, 100, 1)
- if(do_after(user, 20*W.toolspeed, target = src))
- if(!istype(src, /turf/closed/wall/r_wall) || !W || d_state != BOLTS)
+ if(W.use_tool(src, user, 20, volume=100))
+ if(!istype(src, /turf/closed/wall/r_wall) || d_state != BOLTS)
return 1
d_state = CUT_COVER
update_icon()
@@ -178,24 +159,12 @@
return 1
if(SUPPORT_RODS)
- if(istype(W, /obj/item/weldingtool))
- var/obj/item/weldingtool/WT = W
- if(WT.remove_fuel(0,user))
- to_chat(user, "You begin slicing through the support rods...")
- playsound(src, W.usesound, 100, 1)
- if(do_after(user, 100*W.toolspeed, target = src))
- if(!istype(src, /turf/closed/wall/r_wall) || !WT || !WT.isOn() || d_state != SUPPORT_RODS)
- return 1
- d_state = SHEATH
- update_icon()
- to_chat(user, "You slice through the support rods.")
- return 1
-
- if(istype(W, /obj/item/gun/energy/plasmacutter))
+ if(istype(W, /obj/item/weldingtool) || istype(W, /obj/item/gun/energy/plasmacutter))
+ if(!W.tool_start_check(user, amount=0))
+ return
to_chat(user, "You begin slicing through the support rods...")
- playsound(src, 'sound/items/welder.ogg', 100, 1)
- if(do_after(user, 100*W.toolspeed, target = src))
- if(!istype(src, /turf/closed/wall/r_wall) || !W || d_state != SUPPORT_RODS)
+ if(W.use_tool(src, user, 100, volume=100))
+ if(!istype(src, /turf/closed/wall/r_wall) || d_state != SUPPORT_RODS)
return 1
d_state = SHEATH
update_icon()
@@ -204,9 +173,9 @@
if(istype(W, /obj/item/wrench))
to_chat(user, "You start tightening the bolts which secure the support rods to their frame...")
- playsound(src, W.usesound, 100, 1)
- if(do_after(user, 40*W.toolspeed, target = src))
- if(!istype(src, /turf/closed/wall/r_wall) || !W || d_state != SUPPORT_RODS)
+ W.play_tool_sound(src, 100)
+ if(W.use_tool(src, user, 40))
+ if(!istype(src, /turf/closed/wall/r_wall) || d_state != SUPPORT_RODS)
return 1
d_state = BOLTS
update_icon()
@@ -216,26 +185,24 @@
if(SHEATH)
if(istype(W, /obj/item/crowbar))
to_chat(user, "You struggle to pry off the outer sheath...")
- playsound(src, W.usesound, 100, 1)
- if(do_after(user, 100*W.toolspeed, target = src))
- if(!istype(src, /turf/closed/wall/r_wall) || !W || d_state != SHEATH)
+ if(W.use_tool(src, user, 100, volume=100))
+ if(!istype(src, /turf/closed/wall/r_wall) || d_state != SHEATH)
return 1
to_chat(user, "You pry off the outer sheath.")
dismantle_wall()
return 1
if(istype(W, /obj/item/weldingtool))
- var/obj/item/weldingtool/WT = W
- if(WT.remove_fuel(0,user))
- to_chat(user, "You begin welding the support rods back together...")
- playsound(src, WT.usesound, 100, 1)
- if(do_after(user, 100*WT.toolspeed, target = src))
- if(!istype(src, /turf/closed/wall/r_wall) || !WT || !WT.isOn() || d_state != SHEATH)
- return 1
- d_state = SUPPORT_RODS
- update_icon()
- to_chat(user, "You weld the support rods back together.")
- return 1
+ if(!W.tool_start_check(user, amount=0))
+ return
+ to_chat(user, "You begin welding the support rods back together...")
+ if(W.use_tool(src, user, 100, volume=100))
+ if(!istype(src, /turf/closed/wall/r_wall) || d_state != SHEATH)
+ return TRUE
+ d_state = SUPPORT_RODS
+ update_icon()
+ to_chat(user, "You weld the support rods back together.")
+ return 1
return 0
/turf/closed/wall/r_wall/proc/update_icon()
diff --git a/code/game/turfs/simulated/walls.dm b/code/game/turfs/simulated/walls.dm
index e95ea32046..ff113f8cd9 100644
--- a/code/game/turfs/simulated/walls.dm
+++ b/code/game/turfs/simulated/walls.dm
@@ -190,18 +190,21 @@
return ..()
/turf/closed/wall/proc/try_clean(obj/item/W, mob/user, turf/T)
- if((user.a_intent != INTENT_HELP) || !LAZYLEN(dent_decals) || !istype(W, /obj/item/weldingtool))
+ if((user.a_intent != INTENT_HELP) || !LAZYLEN(dent_decals))
return FALSE
- var/obj/item/weldingtool/WT = W
- if(WT.remove_fuel(0, user))
+
+ if(istype(W, /obj/item/weldingtool))
+ if(!W.tool_start_check(user, amount=0))
+ return FALSE
+
to_chat(user, "You begin fixing dents on the wall...")
- playsound(src, W.usesound, 100, 1)
- if(do_after(user, slicing_duration * W.toolspeed * 0.1, target = src))
- if(iswallturf(src) && user && !QDELETED(WT) && WT.isOn() && !QDELETED(T) && (user.loc == T) && (user.get_active_held_item() == WT) && LAZYLEN(dent_decals))
+ if(W.use_tool(src, user, slicing_duration, volume=100))
+ if(iswallturf(src) && LAZYLEN(dent_decals))
to_chat(user, "You fix some dents on the wall.")
cut_overlay(dent_decals)
LAZYCLEARLIST(dent_decals)
return TRUE
+
return FALSE
/turf/closed/wall/proc/try_wallmount(obj/item/W, mob/user, turf/T)
@@ -218,40 +221,29 @@
return FALSE
-/turf/closed/wall/proc/try_decon(obj/item/W, mob/user, turf/T)
- if(istype(W, /obj/item/weldingtool))
- var/obj/item/weldingtool/WT = W
- if(WT.remove_fuel(0, user))
- to_chat(user, "You begin slicing through the outer plating...")
- playsound(src, W.usesound, 100, 1)
- if(do_after(user, slicing_duration * W.toolspeed, target = src))
- if(iswallturf(src) && user && !QDELETED(WT) && WT.isOn() && !QDELETED(T) && (user.loc == T) && (user.get_active_held_item() == WT))
- to_chat(user, "You remove the outer plating.")
- dismantle_wall()
- return TRUE
- else if(istype(W, /obj/item/gun/energy/plasmacutter))
+/turf/closed/wall/proc/try_decon(obj/item/I, mob/user, turf/T)
+ if(istype(I, /obj/item/weldingtool) || istype(I, /obj/item/gun/energy/plasmacutter))
+ if(!I.tool_start_check(user, amount=0))
+ return FALSE
+
to_chat(user, "You begin slicing through the outer plating...")
- playsound(src, 'sound/items/welder.ogg', 100, 1)
- if(do_after(user, slicing_duration * W.toolspeed, target = src))
- if(!iswallturf(src) || !user || QDELETED(W) || QDELETED(T))
- return TRUE
- if((user.loc == T) && (user.get_active_held_item() == W))
+ if(I.use_tool(src, user, slicing_duration, volume=100))
+ if(iswallturf(src))
to_chat(user, "You remove the outer plating.")
dismantle_wall()
- visible_message("The wall was sliced apart by [user]!", "You hear metal being sliced apart.")
- return TRUE
+ return TRUE
+
return FALSE
-/turf/closed/wall/proc/try_destroy(obj/item/W, mob/user, turf/T)
- if(istype(W, /obj/item/pickaxe/drill/jackhammer))
- var/obj/item/pickaxe/drill/jackhammer/D = W
- if(!iswallturf(src) || !user || !W || !T)
+/turf/closed/wall/proc/try_destroy(obj/item/I, mob/user, turf/T)
+ if(istype(I, /obj/item/pickaxe/drill/jackhammer))
+ if(!iswallturf(src))
return TRUE
- if( user.loc == T && user.get_active_held_item() == W )
- D.playDigSound()
+ if(user.loc == T)
+ I.play_tool_sound(src)
dismantle_wall()
- visible_message("[user] smashes through the [name] with the [W.name]!", "You hear the grinding of metal.")
+ visible_message("[user] smashes through [src] with [I]!", "You hear the grinding of metal.")
return TRUE
return FALSE
diff --git a/code/modules/antagonists/_common/antag_datum.dm b/code/modules/antagonists/_common/antag_datum.dm
index ee15730278..48e7cf896f 100644
--- a/code/modules/antagonists/_common/antag_datum.dm
+++ b/code/modules/antagonists/_common/antag_datum.dm
@@ -73,19 +73,18 @@ GLOBAL_LIST_EMPTY(antagonists)
/datum/antagonist/proc/is_banned(mob/M)
if(!M)
return FALSE
- . = (jobban_isbanned(M,"Syndicate") || (job_rank && jobban_isbanned(M,job_rank)))
+ . = (jobban_isbanned(M, ROLE_SYNDICATE) || (job_rank && jobban_isbanned(M,job_rank)))
/datum/antagonist/proc/replace_banned_player()
set waitfor = FALSE
var/list/mob/dead/observer/candidates = pollCandidatesForMob("Do you want to play as a [name]?", "[name]", null, job_rank, 50, owner.current)
- var/mob/dead/observer/theghost = null
- if(candidates.len)
- theghost = pick(candidates)
+ if(LAZYLEN(candidates))
+ var/client/C = pick(candidates)
to_chat(owner, "Your mob has been taken over by a ghost! Appeal your job ban if you want to avoid this in the future!")
- message_admins("[key_name_admin(theghost)] has taken control of ([key_name_admin(owner.current)]) to replace a jobbaned player.")
+ message_admins("[key_name_admin(C)] has taken control of ([key_name_admin(owner.current)]) to replace a jobbaned player.")
owner.current.ghostize(0)
- owner.current.key = theghost.key
+ owner.current.key = C.key
/datum/antagonist/proc/on_removal()
remove_innate_effects()
diff --git a/code/modules/antagonists/_common/antag_spawner.dm b/code/modules/antagonists/_common/antag_spawner.dm
index b508151d3b..5695a8c480 100644
--- a/code/modules/antagonists/_common/antag_spawner.dm
+++ b/code/modules/antagonists/_common/antag_spawner.dm
@@ -2,7 +2,7 @@
throw_speed = 1
throw_range = 5
w_class = WEIGHT_CLASS_TINY
- var/used = 0
+ var/used = FALSE
/obj/item/antag_spawner/proc/spawn_antag(client/C, turf/T, kind = "", datum/mind/user)
return
@@ -57,13 +57,13 @@
to_chat(H, "You already used this contract!")
return
var/list/candidates = pollCandidatesForMob("Do you want to play as a wizard's [href_list["school"]] apprentice?", ROLE_WIZARD, null, ROLE_WIZARD, 150, src)
- if(candidates.len)
+ if(LAZYLEN(candidates))
if(used)
to_chat(H, "You already used this contract!")
return
- used = 1
- var/mob/dead/observer/theghost = pick(candidates)
- spawn_antag(theghost.client, get_turf(src), href_list["school"],H.mind)
+ used = TRUE
+ var/client/C = pick(candidates)
+ spawn_antag(C, get_turf(src), href_list["school"],H.mind)
else
to_chat(H, "Unable to reach your apprentice! You can either attack the spellbook with the contract to refund your points, or wait and try again later.")
@@ -120,12 +120,12 @@
to_chat(user, "You activate [src] and wait for confirmation.")
var/list/nuke_candidates = pollGhostCandidates("Do you want to play as a syndicate [borg_to_spawn ? "[lowertext(borg_to_spawn)] cyborg":"operative"]?", ROLE_OPERATIVE, null, ROLE_OPERATIVE, 150, POLL_IGNORE_SYNDICATE)
- if(nuke_candidates.len)
+ if(LAZYLEN(nuke_candidates))
if(!(check_usability(user)))
return
used = TRUE
- var/mob/dead/observer/theghost = pick(nuke_candidates)
- spawn_antag(theghost.client, get_turf(src), "syndieborg", user.mind)
+ var/client/C = pick(nuke_candidates)
+ spawn_antag(C, get_turf(src), "syndieborg", user.mind)
do_sparks(4, TRUE, src)
qdel(src)
else
@@ -213,13 +213,13 @@
return
if(used)
return
- var/list/demon_candidates = pollCandidatesForMob("Do you want to play as a [initial(demon_type.name)]?", null, null, ROLE_ALIEN, 50, src)
- if(demon_candidates.len)
+ var/list/candidates = pollCandidatesForMob("Do you want to play as a [initial(demon_type.name)]?", ROLE_ALIEN, null, ROLE_ALIEN, 50, src)
+ if(LAZYLEN(candidates))
if(used)
return
- used = 1
- var/mob/dead/observer/theghost = pick(demon_candidates)
- spawn_antag(theghost.client, get_turf(src), initial(demon_type.name),user.mind)
+ used = TRUE
+ var/client/C = pick(candidates)
+ spawn_antag(C, get_turf(src), initial(demon_type.name),user.mind)
to_chat(user, shatter_msg)
to_chat(user, veil_msg)
playsound(user.loc, 'sound/effects/glassbr1.ogg', 100, 1)
diff --git a/code/modules/antagonists/abductor/equipment/abduction_gear.dm b/code/modules/antagonists/abductor/equipment/abduction_gear.dm
index 0bcb6f967e..26452e0945 100644
--- a/code/modules/antagonists/abductor/equipment/abduction_gear.dm
+++ b/code/modules/antagonists/abductor/equipment/abduction_gear.dm
@@ -682,8 +682,8 @@ Congratulations! You are now trained for invasive xenobiology research!"}
/obj/structure/table_frame/abductor/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/wrench))
to_chat(user, "You start disassembling [src]...")
- playsound(src.loc, I.usesound, 50, 1)
- if(do_after(user, 30*I.toolspeed, target = src))
+ I.play_tool_sound(src)
+ if(I.use_tool(src, user, 30))
playsound(src.loc, 'sound/items/deconstruct.ogg', 50, 1)
for(var/i = 1, i <= framestackamount, i++)
new framestack(get_turf(src))
diff --git a/code/modules/antagonists/abductor/equipment/gland.dm b/code/modules/antagonists/abductor/equipment/gland.dm
index 9b767a0130..b9114da9ea 100644
--- a/code/modules/antagonists/abductor/equipment/gland.dm
+++ b/code/modules/antagonists/abductor/equipment/gland.dm
@@ -262,10 +262,9 @@
mind_control_duration = 1800
/obj/item/organ/heart/gland/egg/activate()
- to_chat(owner, "You lay an egg!")
- var/obj/item/reagent_containers/food/snacks/egg/egg = new(owner.drop_location())
- egg.reagents.add_reagent(get_random_reagent_id(), 15)
- egg.desc += " It looks weird..."
+ owner.visible_message("[owner] [pick(EGG_LAYING_MESSAGES)]")
+ var/turf/T = owner.drop_location()
+ new /obj/item/reagent_containers/food/snacks/egg/gland(T)
/obj/item/organ/heart/gland/electric
cooldown_low = 800
diff --git a/code/modules/antagonists/brother/brother.dm b/code/modules/antagonists/brother/brother.dm
index f692335ee1..d8371d3751 100644
--- a/code/modules/antagonists/brother/brother.dm
+++ b/code/modules/antagonists/brother/brother.dm
@@ -2,7 +2,7 @@
name = "Brother"
antagpanel_category = "Brother"
job_rank = ROLE_BROTHER
- var/special_role = "blood brother"
+ var/special_role = ROLE_BROTHER
var/datum/team/brother_team/team
/datum/antagonist/brother/create_team(datum/team/brother_team/new_team)
diff --git a/code/modules/antagonists/changeling/changeling.dm b/code/modules/antagonists/changeling/changeling.dm
index c15b655da9..d6afa339d5 100644
--- a/code/modules/antagonists/changeling/changeling.dm
+++ b/code/modules/antagonists/changeling/changeling.dm
@@ -76,6 +76,13 @@
. = ..()
/datum/antagonist/changeling/on_removal()
+ //We'll be using this from now on
+ var/mob/living/carbon/C = owner.current
+ if(istype(C))
+ var/obj/item/organ/brain/B = C.getorganslot(ORGAN_SLOT_BRAIN)
+ if(B && (B.decoy_override != initial(B.decoy_override)))
+ B.vital = TRUE
+ B.decoy_override = FALSE
remove_changeling_powers()
owner.objectives -= objectives
. = ..()
@@ -389,7 +396,7 @@
var/datum/objective/assassinate/kill_objective = new
kill_objective.owner = owner
if(team_mode) //No backstabbing while in a team
- kill_objective.find_target_by_role(role = "Changeling", role_type = 1, invert = 1)
+ kill_objective.find_target_by_role(role = ROLE_CHANGELING, role_type = 1, invert = 1)
else
kill_objective.find_target()
objectives += kill_objective
@@ -397,7 +404,7 @@
var/datum/objective/maroon/maroon_objective = new
maroon_objective.owner = owner
if(team_mode)
- maroon_objective.find_target_by_role(role = "Changeling", role_type = 1, invert = 1)
+ maroon_objective.find_target_by_role(role = ROLE_CHANGELING, role_type = 1, invert = 1)
else
maroon_objective.find_target()
objectives += maroon_objective
@@ -419,7 +426,7 @@
var/datum/objective/escape/escape_with_identity/identity_theft = new
identity_theft.owner = owner
if(team_mode)
- identity_theft.find_target_by_role(role = "Changeling", role_type = 1, invert = 1)
+ identity_theft.find_target_by_role(role = ROLE_CHANGELING, role_type = 1, invert = 1)
else
identity_theft.find_target()
objectives += identity_theft
diff --git a/code/modules/antagonists/clockcult/clock_items/integration_cog.dm b/code/modules/antagonists/clockcult/clock_items/integration_cog.dm
index 0e1e299325..4e4aff5569 100644
--- a/code/modules/antagonists/clockcult/clock_items/integration_cog.dm
+++ b/code/modules/antagonists/clockcult/clock_items/integration_cog.dm
@@ -34,4 +34,4 @@
else
adjust_clockwork_power(1) //Continue generating power when the cell has run dry; 5 W/second
-#undef COG_MAX_SIPHON_THRESHOLD
\ No newline at end of file
+#undef COG_MAX_SIPHON_THRESHOLD
diff --git a/code/modules/antagonists/clockcult/clock_structures/_trap_object.dm b/code/modules/antagonists/clockcult/clock_structures/_trap_object.dm
index 63c0182f7f..00a3406da1 100644
--- a/code/modules/antagonists/clockcult/clock_structures/_trap_object.dm
+++ b/code/modules/antagonists/clockcult/clock_structures/_trap_object.dm
@@ -27,11 +27,11 @@
var/distance = get_dist(src, O)
to_chat(user, "[O] ([distance == 0 ? "same tile" : "[distance] tiles [dir2text(get_dir(src, O))]"])")
-/obj/structure/destructible/clockwork/trap/wrench_act(mob/living/user, obj/item/wrench)
+/obj/structure/destructible/clockwork/trap/wrench_act(mob/living/user, obj/item/I)
if(!is_servant_of_ratvar(user))
return ..()
to_chat(user, "You break down the delicate components of [src] into brass.")
- playsound(src, wrench.usesound, 50, TRUE)
+ I.play_tool_sound(src)
new/obj/item/stack/tile/brass(get_turf(src))
qdel(src)
return TRUE
@@ -56,14 +56,14 @@
return
..()
-/obj/structure/destructible/clockwork/trap/wirecutter_act(mob/living/user, obj/item/wirecutters)
+/obj/structure/destructible/clockwork/trap/wirecutter_act(mob/living/user, obj/item/I)
if(!is_servant_of_ratvar(user))
return
if(!wired_to.len)
to_chat(user, "[src] has no connections!")
return
to_chat(user, "You sever all connections to [src].")
- playsound(src, wirecutters.usesound, 50, TRUE)
+ I.play_tool_sound(src)
for(var/V in wired_to)
var/obj/structure/destructible/clockwork/trap/T = V
T.wired_to -= src
diff --git a/code/modules/antagonists/clockcult/clock_structures/wall_gear.dm b/code/modules/antagonists/clockcult/clock_structures/wall_gear.dm
index b1734b3aef..fb8397eed7 100644
--- a/code/modules/antagonists/clockcult/clock_structures/wall_gear.dm
+++ b/code/modules/antagonists/clockcult/clock_structures/wall_gear.dm
@@ -31,9 +31,8 @@
if(anchored)
to_chat(user, "[src] needs to be unsecured to disassemble it!")
else
- playsound(src, I.usesound, 100, 1)
user.visible_message("[user] starts to disassemble [src].", "You start to disassemble [src]...")
- if(do_after(user, 30*I.toolspeed, target = src) && !anchored)
+ if(I.use_tool(src, user, 30, volume=100) && !anchored)
to_chat(user, "You disassemble [src].")
deconstruct(TRUE)
return 1
diff --git a/code/modules/antagonists/clockcult/clockcult.dm b/code/modules/antagonists/clockcult/clockcult.dm
index 2a05b14d70..067801677b 100644
--- a/code/modules/antagonists/clockcult/clockcult.dm
+++ b/code/modules/antagonists/clockcult/clockcult.dm
@@ -51,7 +51,7 @@
var/mob/living/current = owner.current
SSticker.mode.servants_of_ratvar += owner
SSticker.mode.update_servant_icons_added(owner)
- owner.special_role = "Servant of Ratvar"
+ owner.special_role = ROLE_SERVANT_OF_RATVAR
owner.current.log_message("Has been converted to the cult of Ratvar!", INDIVIDUAL_ATTACK_LOG)
if(issilicon(current))
if(iscyborg(current) && !silent)
diff --git a/code/modules/antagonists/cult/blood_magic.dm b/code/modules/antagonists/cult/blood_magic.dm
new file mode 100644
index 0000000000..e6a78ab1fd
--- /dev/null
+++ b/code/modules/antagonists/cult/blood_magic.dm
@@ -0,0 +1,775 @@
+/datum/action/innate/cult/blood_magic //Blood magic handles the creation of blood spells (formerly talismans)
+ name = "Prepare Blood Magic"
+ button_icon_state = "carve"
+ desc = "Prepare blood magic by carving runes into your flesh. This rite is most effective with an empowering rune"
+ var/list/spells = list()
+ var/channeling = FALSE
+
+/datum/action/innate/cult/blood_magic/Grant()
+ ..()
+ button.screen_loc = "6:-29,4:-2"
+ button.moved = "6:-29,4:-2"
+
+/datum/action/innate/cult/blood_magic/Remove()
+ for(var/X in spells)
+ qdel(X)
+ ..()
+
+/datum/action/innate/cult/blood_magic/IsAvailable()
+ if(!iscultist(owner))
+ return FALSE
+ return ..()
+
+/datum/action/innate/cult/blood_magic/proc/Positioning()
+ var/list/screen_loc_split = splittext(button.screen_loc,",")
+ var/list/screen_loc_X = splittext(screen_loc_split[1],":")
+ var/list/screen_loc_Y = splittext(screen_loc_split[2],":")
+ var/pix_X = text2num(screen_loc_X[2])
+ for(var/datum/action/innate/cult/blood_spell/B in spells)
+ if(B.button.locked)
+ var/order = pix_X+spells.Find(B)*31
+ B.button.screen_loc = "[screen_loc_X[1]]:[order],[screen_loc_Y[1]]:[screen_loc_Y[2]]"
+ B.button.moved = B.button.screen_loc
+
+/datum/action/innate/cult/blood_magic/Activate()
+ var/rune = FALSE
+ var/limit = RUNELESS_MAX_BLOODCHARGE
+ for(var/obj/effect/rune/empower/R in range(1, owner))
+ rune = TRUE
+ break
+ if(rune)
+ limit = MAX_BLOODCHARGE
+ if(spells.len >= limit)
+ if(rune)
+ to_chat(owner, "Your body has reached its limit, you cannot store more than [MAX_BLOODCHARGE] spells at once. Pick a spell to nullify.")
+ else
+ to_chat(owner, "Your body has reached its limit, you cannot have more than [RUNELESS_MAX_BLOODCHARGE] spells at once without an empowering rune! Pick a spell to nullify.")
+ var/nullify_spell = input(owner, "Choose a spell to remove.", "Current Spells") as null|anything in spells
+ if(nullify_spell)
+ qdel(nullify_spell)
+ return
+ var/entered_spell_name
+ var/datum/action/innate/cult/blood_spell/BS
+ var/list/possible_spells = list()
+ for(var/I in subtypesof(/datum/action/innate/cult/blood_spell))
+ var/datum/action/innate/cult/blood_spell/J = I
+ var/cult_name = initial(J.name)
+ possible_spells[cult_name] = J
+ possible_spells += "(REMOVE SPELL)"
+ entered_spell_name = input(owner, "Pick a blood spell to prepare...", "Spell Choices") as null|anything in possible_spells
+ if(entered_spell_name == "(REMOVE SPELL)")
+ var/nullify_spell = input(owner, "Choose a spell to remove.", "Current Spells") as null|anything in spells
+ if(nullify_spell)
+ qdel(nullify_spell)
+ return
+ BS = possible_spells[entered_spell_name]
+ if(QDELETED(src) || owner.incapacitated() || !BS)
+ return
+ to_chat(owner,"You begin to carve unnatural symbols into your flesh!")
+ SEND_SOUND(owner, sound('sound/weapons/slice.ogg',0,1,10))
+ if(!channeling)
+ channeling = TRUE
+ else
+ to_chat(owner, "You are already invoking blood magic!")
+ return
+ if(do_after(owner, 100 - rune*65, target = owner))
+ if(ishuman(owner))
+ var/mob/living/carbon/human/H = owner
+ H.bleed(30 - rune*25)
+ var/datum/action/innate/cult/blood_spell/new_spell = new BS(owner)
+ new_spell.Grant(owner, src)
+ spells += new_spell
+ Positioning()
+ to_chat(owner, "Your wounds glows with power, you have prepared a [new_spell.name] invocation!")
+ channeling = FALSE
+
+/datum/action/innate/cult/blood_spell //The next generation of talismans
+ name = "Blood Magic"
+ button_icon_state = "telerune"
+ desc = "Fear the Old Blood."
+ var/charges = 1
+ var/magic_path = null
+ var/obj/item/melee/blood_magic/hand_magic
+ var/datum/action/innate/cult/blood_magic/all_magic
+ var/base_desc //To allow for updating tooltips
+ var/invocation
+ var/health_cost = 0
+
+/datum/action/innate/cult/blood_spell/Grant(mob/living/owner, datum/action/innate/cult/blood_magic/BM)
+ if(health_cost)
+ desc += "
Deals [health_cost] damage to your arm per use."
+ base_desc = desc
+ desc += "
Has [charges] use\s remaining."
+ all_magic = BM
+ ..()
+ button.locked = TRUE
+
+/datum/action/innate/cult/blood_spell/Remove()
+ if(all_magic)
+ all_magic.spells -= src
+ if(hand_magic)
+ qdel(hand_magic)
+ hand_magic = null
+ ..()
+
+/datum/action/innate/cult/blood_spell/IsAvailable()
+ if(!iscultist(owner) || owner.incapacitated() || !charges)
+ return FALSE
+ return ..()
+
+/datum/action/innate/cult/blood_spell/Activate()
+ if(magic_path) //If this spell flows from the hand
+ if(!hand_magic)
+ hand_magic = new magic_path(owner, src)
+ if(!owner.put_in_hands(hand_magic))
+ qdel(hand_magic)
+ hand_magic = null
+ to_chat(owner, "You have no empty hand for invoking blood magic!")
+ return
+ to_chat(owner, "Your old wounds glow again as you invoke the [name].")
+ return
+ if(hand_magic)
+ qdel(hand_magic)
+ hand_magic = null
+ to_chat(owner, "You snuff out the spell with your hand, saving its power for another time.")
+
+
+//Cult Blood Spells
+/datum/action/innate/cult/blood_spell/stun
+ name = "Stun"
+ desc = "A potent spell that will stun and mute victims upon contact."
+ button_icon_state = "hand"
+ magic_path = "/obj/item/melee/blood_magic/stun"
+ health_cost = 10
+
+/datum/action/innate/cult/blood_spell/teleport
+ name = "Teleport"
+ desc = "A useful spell that teleport cultists to a chosen destination on contact."
+ button_icon_state = "tele"
+ magic_path = "/obj/item/melee/blood_magic/teleport"
+ health_cost = 7
+
+/datum/action/innate/cult/blood_spell/emp
+ name = "Electromagnetic Pulse"
+ desc = "A large spell that immediately disables all electronics in the area."
+ button_icon_state = "emp"
+ health_cost = 10
+ invocation = "Ta'gh fara'qha fel d'amar det!"
+
+/datum/action/innate/cult/blood_spell/emp/Activate()
+ owner.visible_message("[owner]'s hand flashes a bright blue!", \
+ "You speak the cursed words, emitting an EMP blast from your hand.")
+ empulse(owner, 3, 6)
+ owner.whisper(invocation, language = /datum/language/common)
+ charges--
+ if(charges<=0)
+ qdel(src)
+
+/datum/action/innate/cult/blood_spell/shackles
+ name = "Shadow Shackles"
+ desc = "A stealthy spell that will handcuff and temporarily silence your victim."
+ button_icon_state = "cuff"
+ charges = 4
+ magic_path = "/obj/item/melee/blood_magic/shackles"
+
+/datum/action/innate/cult/blood_spell/construction
+ name = "Twisted Construction"
+ desc = "A sinister spell used to convert:
Plasteel into runed metal
25 metal into a construct shell
Cyborgs directly into constructs
Cyborg shells into construct shells
Airlocks into runed airlocks (harm intent)"
+ button_icon_state = "transmute"
+ magic_path = "/obj/item/melee/blood_magic/construction"
+
+/datum/action/innate/cult/blood_spell/equipment
+ name = "Summon Equipment"
+ desc = "A crucial spell that enables you to summon either a ritual dagger or combat gear including armored robes, the nar'sien bola, and an eldritch longsword."
+ button_icon_state = "equip"
+ magic_path = "/obj/item/melee/blood_magic/armor"
+
+/datum/action/innate/cult/blood_spell/equipment/Activate()
+ var/choice = alert(owner,"Choose your equipment type",,"Combat Equipment","Ritual Dagger","Cancel")
+ if(choice == "Ritual Dagger")
+ var/turf/T = get_turf(owner)
+ owner.visible_message("[owner]'s hand glows red for a moment.", \
+ "Red light begins to shimmer and take form within your hand!")
+ var/obj/O = new /obj/item/melee/cultblade/dagger(T)
+ if(owner.put_in_hands(O))
+ to_chat(owner, "A ritual dagger appears in your hand!")
+ else
+ owner.visible_message("A ritual dagger appears at [owner]'s feet!", \
+ "A ritual dagger materializes at your feet.")
+ SEND_SOUND(owner, sound('sound/effects/magic.ogg',0,1,25))
+ charges--
+ desc = base_desc
+ desc += "
Has [charges] use\s remaining."
+ if(charges<=0)
+ qdel(src)
+ else if(choice == "Combat Equipment")
+ ..()
+
+/datum/action/innate/cult/blood_spell/horror
+ name = "Hallucinations"
+ desc = "A ranged yet stealthy spell that will break the mind of the victim with nightmarish hallucinations."
+ button_icon_state = "horror"
+ var/obj/effect/proc_holder/horror/PH
+ charges = 4
+
+/datum/action/innate/cult/blood_spell/horror/New()
+ PH = new()
+ PH.attached_action = src
+ ..()
+
+/datum/action/innate/cult/blood_spell/horror/Destroy()
+ var/obj/effect/proc_holder/horror/destroy = PH
+ . = ..()
+ if(destroy && !QDELETED(destroy))
+ QDEL_NULL(destroy)
+
+/datum/action/innate/cult/blood_spell/horror/Activate()
+ PH.toggle(owner) //the important bit
+ return TRUE
+
+/obj/effect/proc_holder/horror
+ active = FALSE
+ ranged_mousepointer = 'icons/effects/cult_target.dmi'
+ var/datum/action/innate/cult/blood_spell/attached_action
+
+/obj/effect/proc_holder/horror/Destroy()
+ var/datum/action/innate/cult/blood_spell/AA = attached_action
+ . = ..()
+ if(AA && !QDELETED(AA))
+ QDEL_NULL(AA)
+
+/obj/effect/proc_holder/horror/proc/toggle(mob/user)
+ if(active)
+ remove_ranged_ability("You dispel the magic...")
+ else
+ add_ranged_ability(user, "You prepare to horrify a target...")
+
+/obj/effect/proc_holder/horror/InterceptClickOn(mob/living/caller, params, atom/target)
+ if(..())
+ return
+ if(ranged_ability_user.incapacitated() || !iscultist(caller))
+ remove_ranged_ability()
+ return
+ var/turf/T = get_turf(ranged_ability_user)
+ if(!isturf(T))
+ return FALSE
+ if(target in view(7, get_turf(ranged_ability_user)))
+ if(!ishuman(target) || iscultist(target))
+ return
+ var/mob/living/carbon/human/H = target
+ H.hallucination = max(H.hallucination, 240)
+ SEND_SOUND(ranged_ability_user, sound('sound/effects/ghost.ogg',0,1,50))
+ var/image/C = image('icons/effects/cult_effects.dmi',H,"bloodsparkles", ABOVE_MOB_LAYER)
+ add_alt_appearance(/datum/atom_hud/alternate_appearance/basic/cult, "cult_apoc", C, FALSE)
+ addtimer(CALLBACK(H,/atom/.proc/remove_alt_appearance,"cult_apoc",TRUE), 2400, TIMER_OVERRIDE|TIMER_UNIQUE)
+ to_chat(ranged_ability_user,"[H] has been cursed with living nightmares!")
+ attached_action.charges--
+ attached_action.desc = attached_action.base_desc
+ attached_action.desc += "
Has [attached_action.charges] use\s remaining."
+ attached_action.UpdateButtonIcon()
+ if(attached_action.charges <= 0)
+ remove_mousepointer(ranged_ability_user.client)
+ remove_ranged_ability("You have exhausted the spell's power!")
+ qdel(src)
+
+/datum/action/innate/cult/blood_spell/veiling
+ name = "Conceal Presence"
+ desc = "A multi-function spell that alternates between hiding and revealing nearby cult runes, structures, turf, and airlocks."
+ invocation = "Kla'atu barada nikt'o!"
+ button_icon_state = "gone"
+ charges = 10
+ var/revealing = FALSE //if it reveals or not
+
+/datum/action/innate/cult/blood_spell/veiling/Activate()
+ if(!revealing)
+ owner.visible_message("Thin grey dust falls from [owner]'s hand!", \
+ "You invoke the veiling spell, hiding nearby runes.")
+ charges--
+ SEND_SOUND(owner, sound('sound/magic/smoke.ogg',0,1,25))
+ owner.whisper(invocation, language = /datum/language/common)
+ for(var/obj/effect/rune/R in range(5,owner))
+ R.conceal()
+ for(var/obj/structure/destructible/cult/S in range(5,owner))
+ S.conceal()
+ for(var/turf/open/floor/engine/cult/T in range(5,owner))
+ T.realappearance.alpha = 0
+ for(var/obj/machinery/door/airlock/cult/AL in range(5, owner))
+ AL.conceal()
+ revealing = TRUE
+ name = "Reveal Runes"
+ button_icon_state = "back"
+ else
+ owner.visible_message("A flash of light shines from [owner]'s hand!", \
+ "You invoke the counterspell, revealing nearby runes.")
+ charges--
+ owner.whisper(invocation, language = /datum/language/common)
+ SEND_SOUND(owner, sound('sound/magic/enter_blood.ogg',0,1,25))
+ for(var/obj/effect/rune/R in range(7,owner)) //More range in case you weren't standing in exactly the same spot
+ R.reveal()
+ for(var/obj/structure/destructible/cult/S in range(6,owner))
+ S.reveal()
+ for(var/turf/open/floor/engine/cult/T in range(6,owner))
+ T.realappearance.alpha = initial(T.realappearance.alpha)
+ for(var/obj/machinery/door/airlock/cult/AL in range(6, owner))
+ AL.reveal()
+ revealing = FALSE
+ name = "Conceal Runes"
+ button_icon_state = "gone"
+ if(charges<= 0)
+ qdel(src)
+ desc = base_desc
+ desc += "
Has [charges] use\s remaining."
+ UpdateButtonIcon()
+
+/datum/action/innate/cult/blood_spell/manipulation
+ name = "Blood Rites"
+ desc = "A complex spell that allows you to gather blood and use it for healing or other powerful spells."
+ invocation = "Fel'th Dol Ab'orod!"
+ button_icon_state = "manip"
+ charges = 5
+ magic_path = "/obj/item/melee/blood_magic/manipulator"
+
+
+// The "magic hand" items
+/obj/item/melee/blood_magic
+ name = "\improper magical aura"
+ desc = "Sinister looking aura that distorts the flow of reality around it."
+ icon = 'icons/obj/items_and_weapons.dmi'
+ icon_state = "disintegrate"
+ item_state = null
+ flags_1 = ABSTRACT_1 | NODROP_1 | DROPDEL_1
+ w_class = WEIGHT_CLASS_HUGE
+ throwforce = 0
+ throw_range = 0
+ throw_speed = 0
+ var/invocation
+ var/uses = 1
+ var/health_cost = 0 //The amount of health taken from the user when invoking the spell
+ var/datum/action/innate/cult/blood_spell/source
+
+/obj/item/melee/blood_magic/New(loc, spell)
+ source = spell
+ uses = source.charges
+ health_cost = source.health_cost
+ ..()
+
+/obj/item/melee/blood_magic/Destroy()
+ if(!QDELETED(source))
+ if(uses <= 0)
+ source.hand_magic = null
+ qdel(source)
+ source = null
+ else
+ source.hand_magic = null
+ source.charges = uses
+ source.desc = source.base_desc
+ source.desc += "
Has [uses] use\s remaining."
+ source.UpdateButtonIcon()
+ ..()
+
+/obj/item/melee/blood_magic/attack_self(mob/living/user)
+ afterattack(user, user, TRUE)
+
+/obj/item/melee/blood_magic/attack(mob/living/M, mob/living/carbon/user)
+ if(!iscarbon(user) || !iscultist(user))
+ uses = 0
+ qdel(src)
+ return
+ add_logs(user, M, "used a cult spell on", source.name, "")
+ M.lastattacker = user.real_name
+ M.lastattackerckey = user.ckey
+
+/obj/item/melee/blood_magic/afterattack(atom/target, mob/living/carbon/user, proximity)
+ if(invocation)
+ user.whisper(invocation, language = /datum/language/common)
+ if(health_cost)
+ if(user.active_hand_index == 1)
+ user.apply_damage(health_cost, BRUTE, "l_arm")
+ else
+ user.apply_damage(health_cost, BRUTE, "r_arm")
+ if(uses <= 0)
+ qdel(src)
+ else if(source)
+ source.desc = source.base_desc
+ source.desc += "
Has [uses] use\s remaining."
+ source.UpdateButtonIcon()
+
+//Stun
+/obj/item/melee/blood_magic/stun
+ name = "Stunning Aura "
+ color = "#ff0000" // red
+ invocation = "Fuu ma'jin!"
+
+/obj/item/melee/blood_magic/stun/afterattack(atom/target, mob/living/carbon/user, proximity)
+ if(!isliving(target) || !proximity)
+ return
+ var/mob/living/L = target
+ if(iscultist(target))
+ return
+ if(iscultist(user))
+ user.visible_message("[user] holds up their hand, which explodes in a flash of red light!", \
+ "You stun [L] with the spell!")
+ var/obj/item/nullrod/N = locate() in L
+ if(N)
+ target.visible_message("[L]'s holy weapon absorbs the light!", \
+ "Your holy weapon absorbs the blinding light!")
+ else
+ L.Knockdown(180)
+ L.flash_act(1,1)
+ if(issilicon(target))
+ var/mob/living/silicon/S = L
+ S.emp_act(EMP_HEAVY)
+ else if(iscarbon(target))
+ var/mob/living/carbon/C = L
+ C.silent += 6
+ C.stuttering += 15
+ C.cultslurring += 15
+ C.Jitter(15)
+ if(is_servant_of_ratvar(L))
+ L.adjustBruteLoss(15)
+ uses--
+ ..()
+
+//Teleportation
+/obj/item/melee/blood_magic/teleport
+ name = "Shifting Aura"
+ color = RUNE_COLOR_TELEPORT
+ desc = "A potent spell that teleport cultists on contact."
+ invocation = "Sas'so c'arta forbici!"
+
+/obj/item/melee/blood_magic/teleport/afterattack(atom/target, mob/living/carbon/user, proximity)
+ if(!iscultist(target) || !proximity)
+ to_chat(user, "You can only teleport adjacent cultists with this spell!")
+ return
+ if(iscultist(user))
+ var/list/potential_runes = list()
+ var/list/teleportnames = list()
+ for(var/R in GLOB.teleport_runes)
+ var/obj/effect/rune/teleport/T = R
+ potential_runes[avoid_assoc_duplicate_keys(T.listkey, teleportnames)] = T
+
+ if(!potential_runes.len)
+ to_chat(user, "There are no valid runes to teleport to!")
+ log_game("Teleport talisman failed - no other teleport runes")
+ return
+
+ var/turf/T = get_turf(src)
+ if(is_away_level(T.z))
+ to_chat(user, "You are not in the right dimension!")
+ log_game("Teleport spell failed - user in away mission")
+ return
+
+ var/input_rune_key = input(user, "Choose a rune to teleport to.", "Rune to Teleport to") as null|anything in potential_runes //we know what key they picked
+ var/obj/effect/rune/teleport/actual_selected_rune = potential_runes[input_rune_key] //what rune does that key correspond to?
+ if(QDELETED(src) || !user || !user.is_holding(src) || user.incapacitated() || !actual_selected_rune || !proximity)
+ return
+ var/turf/dest = get_turf(actual_selected_rune)
+ if(is_blocked_turf(dest, TRUE))
+ to_chat(user, "The target rune is blocked. Attempting to teleport to it would be massively unwise.")
+ return
+ uses--
+ user.visible_message("Dust flows from [user]'s hand, and [user.p_they()] disappear[user.p_s()] with a sharp crack!", \
+ "You speak the words of the talisman and find yourself somewhere else!", "You hear a sharp crack.")
+ var/mob/living/L = target
+ L.forceMove(dest)
+ dest.visible_message("There is a boom of outrushing air as something appears above the rune!", null, "You hear a boom.")
+ ..()
+
+//Shackles
+/obj/item/melee/blood_magic/shackles
+ name = "Binding Aura"
+ desc = "Allows you to bind a victim and temporarily silence them."
+ invocation = "In'totum Lig'abis!"
+ color = "#000000" // black
+
+/obj/item/melee/blood_magic/shackles/afterattack(atom/target, mob/living/carbon/user, proximity)
+ if(iscultist(user) && iscarbon(target) && proximity)
+ var/mob/living/carbon/C = target
+ if(C.get_num_arms() >= 2 || C.get_arm_ignore())
+ CuffAttack(C, user)
+ else
+ user.visible_message("This victim doesn't have enough arms to complete the restraint!")
+ return
+ ..()
+
+/obj/item/melee/blood_magic/shackles/proc/CuffAttack(mob/living/carbon/C, mob/living/user)
+ if(!C.handcuffed)
+ playsound(loc, 'sound/weapons/cablecuff.ogg', 30, 1, -2)
+ C.visible_message("[user] begins restraining [C] with dark magic!", \
+ "[user] begins shaping a dark magic around your wrists!")
+ if(do_mob(user, C, 30))
+ if(!C.handcuffed)
+ C.handcuffed = new /obj/item/restraints/handcuffs/energy/cult/used(C)
+ C.update_handcuffed()
+ C.silent += 5
+ to_chat(user, "You shackle [C].")
+ add_logs(user, C, "shackled")
+ uses--
+ else
+ to_chat(user, "[C] is already bound.")
+ else
+ to_chat(user, "You fail to shackle [C].")
+ else
+ to_chat(user, "[C] is already bound.")
+
+
+/obj/item/restraints/handcuffs/energy/cult //For the shackling spell
+ name = "shadow shackles"
+ desc = "Shackles that bind the wrists with sinister magic."
+ trashtype = /obj/item/restraints/handcuffs/energy/used
+ flags_1 = DROPDEL_1
+
+/obj/item/restraints/handcuffs/energy/cult/used/dropped(mob/user)
+ user.visible_message("[user]'s shackles shatter in a discharge of dark magic!", \
+ "Your [src] shatters in a discharge of dark magic!")
+ . = ..()
+
+
+//Construction: Creates a construct shell out of 25 metal sheets, or converts plasteel into runed metal
+/obj/item/melee/blood_magic/construction
+ name = "Corrupting Aura"
+ desc = "Corrupts metal and plasteel into more sinister forms."
+ invocation = "Ethra p'ni dedol!"
+ color = "#000000" // black
+
+/obj/item/melee/blood_magic/construction/afterattack(atom/target, mob/user, proximity_flag, click_parameters)
+ if(proximity_flag && iscultist(user))
+ var/turf/T = get_turf(target)
+ if(istype(target, /obj/item/stack/sheet/metal))
+ var/obj/item/stack/sheet/candidate = target
+ if(candidate.use(50))
+ uses--
+ to_chat(user, "A dark cloud eminates from your hand and swirls around the metal, twisting it into a construct shell!")
+ new /obj/structure/constructshell(T)
+ SEND_SOUND(user, sound('sound/effects/magic.ogg',0,1,25))
+ else
+ to_chat(user, "You need 50 metal to produce a construct shell!")
+ else if(istype(target, /obj/item/stack/sheet/plasteel))
+ var/obj/item/stack/sheet/plasteel/candidate = target
+ var/quantity = min(candidate.amount, uses)
+ uses -= quantity
+ new /obj/item/stack/sheet/runed_metal(T,quantity)
+ candidate.use(quantity)
+ to_chat(user, "A dark cloud eminates from you hand and swirls around the plasteel, transforming it into runed metal!")
+ SEND_SOUND(user, sound('sound/effects/magic.ogg',0,1,25))
+ else if(istype(target,/mob/living/silicon/robot))
+ var/mob/living/silicon/robot/candidate = target
+ if(candidate.mmi)
+ user.visible_message("A dark cloud eminates from [user]'s hand and swirls around [candidate]!")
+ playsound(T, 'sound/machines/airlock_alien_prying.ogg', 80, 1)
+ var/prev_color = candidate.color
+ candidate.color = "black"
+ if(do_after(user, 90, target = candidate))
+ candidate.emp_act(EMP_HEAVY)
+ var/construct_class = alert(user, "Please choose which type of construct you wish to create.",,"Juggernaut","Wraith","Artificer")
+ user.visible_message("The dark cloud receedes from what was formerly [candidate], revealing a\n [construct_class]!")
+ switch(construct_class)
+ if("Juggernaut")
+ makeNewConstruct(/mob/living/simple_animal/hostile/construct/armored, candidate, user, 0, T)
+ if("Wraith")
+ makeNewConstruct(/mob/living/simple_animal/hostile/construct/wraith, candidate, user, 0, T)
+ if("Artificer")
+ makeNewConstruct(/mob/living/simple_animal/hostile/construct/builder, candidate, user, 0, T)
+ SEND_SOUND(user, sound('sound/effects/magic.ogg',0,1,25))
+ uses--
+ candidate.mmi = null
+ qdel(candidate)
+ else
+ candidate.color = prev_color
+ else
+ uses--
+ to_chat(user, "A dark cloud eminates from you hand and swirls around [candidate] - twisting it into a construct shell!")
+ new /obj/structure/constructshell(T)
+ SEND_SOUND(user, sound('sound/effects/magic.ogg',0,1,25))
+ else if(istype(target,/obj/machinery/door/airlock))
+ target.narsie_act()
+ uses--
+ user.visible_message("Black ribbons suddenly eminate from [user]'s hand and cling to the airlock - twisting and corrupting it!")
+ SEND_SOUND(user, sound('sound/effects/magic.ogg',0,1,25))
+ else
+ to_chat(user, "The spell will not work on [target]!")
+ ..()
+
+//Armor: Gives the target a basic cultist combat loadout
+/obj/item/melee/blood_magic/armor
+ name = "Bladed Aura"
+ desc = "A spell that will equip the target with cultist equipment if there is a slot to equip it to."
+ color = "#33cc33" // green
+
+/obj/item/melee/blood_magic/armor/afterattack(atom/target, mob/living/carbon/user, proximity)
+ if(iscarbon(target) && proximity)
+ uses--
+ var/mob/living/carbon/C = target
+ C.visible_message("Otherworldly armor suddenly appears on [C]!")
+ C.equip_to_slot_or_del(new /obj/item/clothing/under/color/black,slot_w_uniform)
+ C.equip_to_slot_or_del(new /obj/item/clothing/head/culthood/alt(user), slot_head)
+ C.equip_to_slot_or_del(new /obj/item/clothing/suit/cultrobes/alt(user), slot_wear_suit)
+ C.equip_to_slot_or_del(new /obj/item/clothing/shoes/cult/alt(user), slot_shoes)
+ C.equip_to_slot_or_del(new /obj/item/storage/backpack/cultpack(user), slot_back)
+ if(C == user)
+ qdel(src) //Clears the hands
+ C.put_in_hands(new /obj/item/melee/cultblade(user))
+ C.put_in_hands(new /obj/item/restraints/legcuffs/bola/cult(user))
+ ..()
+
+/obj/item/melee/blood_magic/manipulator
+ name = "Ritual Aura"
+ desc = "A spell that will absorb blood from anything you touch.
Touching cultists and constructs can heal them.
Clicking the hand will potentially let you focus the spell into something stronger."
+ color = "#7D1717"
+
+/obj/item/melee/blood_magic/manipulator/afterattack(atom/target, mob/living/carbon/human/user, proximity)
+ if(proximity)
+ if(ishuman(target))
+ var/mob/living/carbon/human/H = target
+ if(NOBLOOD in H.dna.species.species_traits)
+ to_chat(user,"Blood rites do not work on species with no blood!")
+ return
+ if(iscultist(H))
+ if(H.stat == DEAD)
+ to_chat(user,"Only a revive rune can bring back the dead!")
+ return
+ if(H.blood_volume < BLOOD_VOLUME_SAFE)
+ var/restore_blood = BLOOD_VOLUME_SAFE - H.blood_volume
+ if(uses*2 < restore_blood)
+ H.blood_volume += uses*2
+ to_chat(user,"You use the last of your blood rites to restore what blood you could!")
+ uses = 0
+ return ..()
+ else
+ H.blood_volume = BLOOD_VOLUME_SAFE
+ uses -= round(restore_blood/2)
+ to_chat(user,"Your blood rites have restored [H == user ? "your" : "their"] blood to safe levels!")
+ var/overall_damage = H.getBruteLoss() + H.getFireLoss() + H.getToxLoss() + H.getOxyLoss()
+ if(overall_damage == 0)
+ to_chat(user,"That cultist doesn't require healing!")
+ else
+ var/ratio = uses/overall_damage
+ if(H == user)
+ to_chat(user,"Your blood healing is far less efficient when used on yourself!")
+ ratio *= 0.35 // Healing is half as effective if you can't perform a full heal
+ uses -= round(overall_damage) // Healing is 65% more "expensive" even if you can still perform the full heal
+ if(ratio>1)
+ ratio = 1
+ uses -= round(overall_damage)
+ H.visible_message("[H] is fully healed by [H==user ? "their":"[H]'s"]'s blood magic!")
+ else
+ H.visible_message("[H] is partially healed by [H==user ? "their":"[H]'s"] blood magic.")
+ uses = 0
+ ratio *= -1
+ H.adjustOxyLoss((overall_damage*ratio) * (H.getOxyLoss() / overall_damage), 0)
+ H.adjustToxLoss((overall_damage*ratio) * (H.getToxLoss() / overall_damage), 0)
+ H.adjustFireLoss((overall_damage*ratio) * (H.getFireLoss() / overall_damage), 0)
+ H.adjustBruteLoss((overall_damage*ratio) * (H.getBruteLoss() / overall_damage), 0)
+ H.updatehealth()
+ playsound(get_turf(H), 'sound/magic/staff_healing.ogg', 25)
+ new /obj/effect/temp_visual/cult/sparks(get_turf(H))
+ user.Beam(H,icon_state="sendbeam",time=15)
+ else
+ if(H.stat == DEAD)
+ to_chat(user,"Their blood has stopped flowing, you'll have to find another way to extract it.")
+ return
+ if(H.cultslurring)
+ to_chat(user,"Their blood has been tainted by an even stronger form of blood magic, it's no use to us like this!")
+ return
+ if(H.blood_volume > BLOOD_VOLUME_SAFE)
+ H.blood_volume -= 100
+ uses += 50
+ user.Beam(H,icon_state="drainbeam",time=10)
+ playsound(get_turf(H), 'sound/magic/enter_blood.ogg', 50)
+ H.visible_message("[user] has drained some of [H]'s blood!")
+ to_chat(user,"Your blood rite gains 50 charges from draining [H]'s blood.")
+ new /obj/effect/temp_visual/cult/sparks(get_turf(H))
+ else
+ to_chat(user,"They're missing too much blood - you cannot drain them further!")
+ return
+ if(isconstruct(target))
+ var/mob/living/simple_animal/M = target
+ var/missing = M.maxHealth - M.health
+ if(missing)
+ if(uses > missing)
+ M.adjustHealth(-missing)
+ M.visible_message("[M] is fully healed by [user]'s blood magic!")
+ uses -= missing
+ else
+ M.adjustHealth(-uses)
+ M.visible_message("[M] is partially healed by [user]'s blood magic!")
+ uses = 0
+ playsound(get_turf(M), 'sound/magic/staff_healing.ogg', 25)
+ user.Beam(M,icon_state="sendbeam",time=10)
+ if(istype(target, /obj/effect/decal/cleanable/blood))
+ blood_draw(target, user)
+ ..()
+
+/obj/item/melee/blood_magic/manipulator/proc/blood_draw(atom/target, mob/living/carbon/human/user)
+ var/temp = 0
+ var/turf/T = get_turf(target)
+ if(T)
+ for(var/obj/effect/decal/cleanable/blood/B in view(T, 2))
+ if(B.blood_state == "blood")
+ if(B.bloodiness == 100) //Bonus for "pristine" bloodpools, also to prevent cheese with footprint spam
+ temp += 30
+ else
+ temp += max((B.bloodiness**2)/800,1)
+ new /obj/effect/temp_visual/cult/turf/floor(get_turf(B))
+ qdel(B)
+ for(var/obj/effect/decal/cleanable/trail_holder/TH in view(T, 2))
+ qdel(TH)
+ var/obj/item/clothing/shoes/shoecheck = user.shoes
+ if(shoecheck && shoecheck.bloody_shoes["blood"])
+ temp += shoecheck.bloody_shoes["blood"]/20
+ shoecheck.bloody_shoes["blood"] = 0
+ if(temp)
+ user.Beam(T,icon_state="drainbeam",time=15)
+ new /obj/effect/temp_visual/cult/sparks(get_turf(user))
+ playsound(T, 'sound/magic/enter_blood.ogg', 50)
+ to_chat(user, "Your blood rite has gained [round(temp)] charge\s from blood sources around you!")
+ uses += max(1, round(temp))
+
+/obj/item/melee/blood_magic/manipulator/attack_self(mob/living/user)
+ if(iscultist(user))
+ var/list/options = list("Blood Spear (200)", "Blood Bolt Barrage (400)", "Blood Beam (600)")
+ var/choice = input(user, "Choose a greater blood rite...", "Greater Blood Rites") as null|anything in options
+ if(!choice)
+ to_chat(user, "You decide against conducting a greater blood rite.")
+ return
+ switch(choice)
+ if("Blood Spear (200)")
+ if(uses < 200)
+ to_chat(user, "You need 200 charges to perform this rite.")
+ else
+ uses -= 200
+ var/turf/T = get_turf(user)
+ qdel(src)
+ var/datum/action/innate/cult/spear/S = new(user)
+ var/obj/item/twohanded/cult_spear/rite = new(T)
+ S.Grant(user, rite)
+ rite.spear_act = S
+ if(user.put_in_hands(rite))
+ to_chat(user, "A [rite.name] appears in your hand!")
+ else
+ user.visible_message("A [rite.name] appears at [user]'s feet!", \
+ "A [rite.name] materializes at your feet.")
+ if("Blood Bolt Barrage (400)")
+ if(uses < 400)
+ to_chat(user, "You need 400 charges to perform this rite.")
+ else
+ var/obj/rite = new /obj/item/gun/ballistic/shotgun/boltaction/enchanted/arcane_barrage/blood()
+ uses -= 400
+ qdel(src)
+ if(user.put_in_hands(rite))
+ to_chat(user, "Your hands glow with power!")
+ else
+ to_chat(user, "You need a free hand for this rite!")
+ qdel(rite)
+ if("Blood Beam (600)")
+ if(uses < 600)
+ to_chat(user, "You need 600 charges to perform this rite.")
+ else
+ var/obj/rite = new /obj/item/blood_beam()
+ uses -= 600
+ qdel(src)
+ if(user.put_in_hands(rite))
+ to_chat(user, "Your hands glow with POWER OVERWHELMING!!!")
+ else
+ to_chat(user, "You need a free hand for this rite!")
+ qdel(rite)
diff --git a/code/modules/antagonists/cult/cult_structures.dm b/code/modules/antagonists/cult/cult_structures.dm
index 84cc26d81a..77f1dd034f 100644
--- a/code/modules/antagonists/cult/cult_structures.dm
+++ b/code/modules/antagonists/cult/cult_structures.dm
@@ -123,9 +123,11 @@
if(cooldowntime > world.time)
to_chat(user, "The magic in [src] is weak, it will be ready to use again in [DisplayTimeText(cooldowntime - world.time)].")
return
- var/choice = alert(user,"You study the schematics etched into the forge...",,"Shielded Robe","Flagellant's Robe","Mirror Shield")
+ var/choice
if(user.mind.has_antag_datum(/datum/antagonist/cult/master))
choice = alert(user,"You study the schematics etched into the forge...",,"Shielded Robe","Flagellant's Robe","Bastard Sword")
+ else
+ choice = alert(user,"You study the schematics etched into the forge...",,"Shielded Robe","Flagellant's Robe","Mirror Shield")
var/list/pickedtype = list()
switch(choice)
if("Shielded Robe")
diff --git a/code/modules/antagonists/cult/runes.dm b/code/modules/antagonists/cult/runes.dm
index 8e6ae30d28..4c95b0a408 100644
--- a/code/modules/antagonists/cult/runes.dm
+++ b/code/modules/antagonists/cult/runes.dm
@@ -125,16 +125,15 @@ structure_check() searches for nearby cultist structures required for the invoca
if(L.stat)
continue
invokers += L
- if(invokers.len >= req_cultists)
- invokers -= user
if(allow_excess_invokers)
chanters += invokers
else
shuffle_inplace(invokers)
for(var/i in 1 to req_cultists)
- var/L = pick_n_take(invokers)
- if(L)
- chanters += L
+ var/C = pick_n_take(invokers)
+ if(!C)
+ break
+ chanters += C
return chanters
/obj/effect/rune/proc/invoke(var/list/invokers)
diff --git a/code/modules/antagonists/ninja/ninja.dm b/code/modules/antagonists/ninja/ninja.dm
index 22f1d96cd3..cb6f8ad6e1 100644
--- a/code/modules/antagonists/ninja/ninja.dm
+++ b/code/modules/antagonists/ninja/ninja.dm
@@ -135,8 +135,8 @@
adj = "objectiveless"
else
return
- new_owner.assigned_role = "Space Ninja"
- new_owner.special_role = "Space Ninja"
+ new_owner.assigned_role = ROLE_NINJA
+ new_owner.special_role = ROLE_NINJA
new_owner.add_antag_datum(src)
message_admins("[key_name_admin(admin)] has [adj] ninja'ed [new_owner.current].")
log_admin("[key_name(admin)] has [adj] ninja'ed [new_owner.current].")
diff --git a/code/modules/antagonists/nukeop/equipment/nuclearbomb.dm b/code/modules/antagonists/nukeop/equipment/nuclearbomb.dm
index b32a8f69e8..910caa7fca 100644
--- a/code/modules/antagonists/nukeop/equipment/nuclearbomb.dm
+++ b/code/modules/antagonists/nukeop/equipment/nuclearbomb.dm
@@ -115,9 +115,8 @@
switch(deconstruction_state)
if(NUKESTATE_INTACT)
if(istype(I, /obj/item/screwdriver/nuke))
- playsound(loc, I.usesound, 100, 1)
to_chat(user, "You start removing [src]'s front panel's screws...")
- if(do_after(user, 60*I.toolspeed,target=src))
+ if(I.use_tool(src, user, 60, volume=100))
deconstruction_state = NUKESTATE_UNSCREWED
to_chat(user, "You remove the screws from [src]'s front panel.")
update_icon()
@@ -125,14 +124,13 @@
if(NUKESTATE_PANEL_REMOVED)
if(istype(I, /obj/item/weldingtool))
- var/obj/item/weldingtool/welder = I
- playsound(loc, I.usesound, 100, 1)
+ if(!I.tool_start_check(user, amount=1))
+ return
to_chat(user, "You start cutting [src]'s inner plate...")
- if(welder.remove_fuel(1,user))
- if(do_after(user,80*I.toolspeed,target=src))
- to_chat(user, "You cut [src]'s inner plate.")
- deconstruction_state = NUKESTATE_WELDED
- update_icon()
+ if(I.use_tool(src, user, 80, volume=100, amount=1))
+ to_chat(user, "You cut [src]'s inner plate.")
+ deconstruction_state = NUKESTATE_WELDED
+ update_icon()
return
if(NUKESTATE_CORE_EXPOSED)
if(istype(I, /obj/item/nuke_core_container))
@@ -148,19 +146,15 @@
to_chat(user, "You fail to load the plutonium core into [core_box]. [core_box] has already been used!")
return
if(istype(I, /obj/item/stack/sheet/metal))
- var/obj/item/stack/sheet/metal/M = I
- if(M.amount >= 20)
- to_chat(user, "You begin repairing [src]'s inner metal plate...")
- if(do_after(user, 100, target=src))
- if(M.use(20))
- to_chat(user, "You repair [src]'s inner metal plate. The radiation is contained.")
- deconstruction_state = NUKESTATE_PANEL_REMOVED
- STOP_PROCESSING(SSobj, core)
- update_icon()
- else
- to_chat(user, "You need more metal to do that!")
- else
- to_chat(user, "You need more metal to do that!")
+ if(!I.tool_start_check(user, amount=20))
+ return
+
+ to_chat(user, "You begin repairing [src]'s inner metal plate...")
+ if(I.use_tool(src, user, 100, amount=20))
+ to_chat(user, "You repair [src]'s inner metal plate. The radiation is contained.")
+ deconstruction_state = NUKESTATE_PANEL_REMOVED
+ STOP_PROCESSING(SSobj, core)
+ update_icon()
return
. = ..()
@@ -169,16 +163,14 @@
switch(deconstruction_state)
if(NUKESTATE_UNSCREWED)
to_chat(user, "You start removing [src]'s front panel...")
- playsound(loc, tool.usesound, 100, 1)
- if(do_after(user, 30 * tool.toolspeed, target = src))
+ if(tool.use_tool(src, user, 30, volume=100))
to_chat(user, "You remove [src]'s front panel.")
deconstruction_state = NUKESTATE_PANEL_REMOVED
update_icon()
return TRUE
if(NUKESTATE_WELDED)
to_chat(user, "You start prying off [src]'s inner plate...")
- playsound(loc, tool.usesound, 100, 1)
- if(do_after(user, 50 * tool.toolspeed, target = src))
+ if(tool.use_tool(src, user, 30, volume=100))
to_chat(user, "You pry off [src]'s inner plate. You can see the core's green glow!")
deconstruction_state = NUKESTATE_CORE_EXPOSED
update_icon()
diff --git a/code/modules/antagonists/nukeop/nukeop.dm b/code/modules/antagonists/nukeop/nukeop.dm
index 8401dc8ced..7b07b762c0 100644
--- a/code/modules/antagonists/nukeop/nukeop.dm
+++ b/code/modules/antagonists/nukeop/nukeop.dm
@@ -112,7 +112,7 @@
nuke_team = new_team
/datum/antagonist/nukeop/admin_add(datum/mind/new_owner,mob/admin)
- new_owner.assigned_role = "Syndicate"
+ new_owner.assigned_role = ROLE_SYNDICATE
new_owner.add_antag_datum(src)
message_admins("[key_name_admin(admin)] has nuke op'ed [new_owner.current].")
log_admin("[key_name(admin)] has nuke op'ed [new_owner.current].")
diff --git a/code/modules/antagonists/revenant/revenant.dm b/code/modules/antagonists/revenant/revenant.dm
index 2c21bd5145..5be923ddcc 100644
--- a/code/modules/antagonists/revenant/revenant.dm
+++ b/code/modules/antagonists/revenant/revenant.dm
@@ -224,7 +224,6 @@
invisibility = INVISIBILITY_ABSTRACT
revealed = FALSE
ghostize(0)//Don't re-enter invisible corpse
- SSshuttle.shuttle_purchase_requirements_met |= "revenant"
//reveal, stun, icon updates, cast checks, and essence changing
diff --git a/code/modules/antagonists/revolution/revolution.dm b/code/modules/antagonists/revolution/revolution.dm
index 5c89fe24cf..e708cb9254 100644
--- a/code/modules/antagonists/revolution/revolution.dm
+++ b/code/modules/antagonists/revolution/revolution.dm
@@ -184,7 +184,7 @@
carbon_mob.flash_act(1, 1)
rev_mind.current.Stun(100)
rev_mind.add_antag_datum(/datum/antagonist/rev,rev_team)
- rev_mind.special_role = "Revolutionary"
+ rev_mind.special_role = ROLE_REV
return TRUE
/datum/antagonist/rev/head/proc/demote()
diff --git a/code/modules/antagonists/traitor/datum_traitor.dm b/code/modules/antagonists/traitor/datum_traitor.dm
index 6c55563810..da34debf95 100644
--- a/code/modules/antagonists/traitor/datum_traitor.dm
+++ b/code/modules/antagonists/traitor/datum_traitor.dm
@@ -6,7 +6,7 @@
var/should_specialise = TRUE //do we split into AI and human, set to true on inital assignment only
var/ai_datum = /datum/antagonist/traitor/AI
var/human_datum = /datum/antagonist/traitor/human
- var/special_role = "traitor"
+ var/special_role = ROLE_TRAITOR
var/employer = "The Syndicate"
var/give_objectives = TRUE
var/should_give_codewords = TRUE
@@ -85,7 +85,9 @@
return
/datum/antagonist/traitor/human/forge_traitor_objectives()
- var/is_hijacker = prob(10)
+ var/is_hijacker = FALSE
+ if (GLOB.joined_player_list.len >= 30) // Less murderboning on lowpop thanks
+ is_hijacker = prob(10)
var/martyr_chance = prob(20)
var/objective_count = is_hijacker //Hijacking counts towards number of objectives
if(!SSticker.mode.exchange_blue && SSticker.mode.traitors.len >= 8) //Set up an exchange if there are enough traitors
diff --git a/code/modules/antagonists/wizard/equipment/artefact.dm b/code/modules/antagonists/wizard/equipment/artefact.dm
index d1f1ff3f87..8f82b2737b 100644
--- a/code/modules/antagonists/wizard/equipment/artefact.dm
+++ b/code/modules/antagonists/wizard/equipment/artefact.dm
@@ -1,3 +1,4 @@
+
//Apprenticeship contract - moved to antag_spawner.dm
///////////////////////////Veil Render//////////////////////
diff --git a/code/modules/antagonists/wizard/wizard.dm b/code/modules/antagonists/wizard/wizard.dm
index e447fc46aa..c23d7fe5a5 100644
--- a/code/modules/antagonists/wizard/wizard.dm
+++ b/code/modules/antagonists/wizard/wizard.dm
@@ -156,12 +156,12 @@
/datum/antagonist/wizard/apply_innate_effects(mob/living/mob_override)
var/mob/living/M = mob_override || owner.current
update_wiz_icons_added(M, wiz_team ? TRUE : FALSE) //Don't bother showing the icon if you're solo wizard
- M.faction |= "wizard"
+ M.faction |= ROLE_WIZARD
/datum/antagonist/wizard/remove_innate_effects(mob/living/mob_override)
var/mob/living/M = mob_override || owner.current
update_wiz_icons_removed(M)
- M.faction -= "wizard"
+ M.faction -= ROLE_WIZARD
/datum/antagonist/wizard/get_admin_commands()
diff --git a/code/modules/atmospherics/machinery/airalarm.dm b/code/modules/atmospherics/machinery/airalarm.dm
index 7925d586e7..bb8f89812a 100644
--- a/code/modules/atmospherics/machinery/airalarm.dm
+++ b/code/modules/atmospherics/machinery/airalarm.dm
@@ -653,14 +653,14 @@
switch(buildstage)
if(2)
if(istype(W, /obj/item/wirecutters) && panel_open && wires.is_all_cut())
- playsound(src.loc, W.usesound, 50, 1)
+ W.play_tool_sound(src)
to_chat(user, "You cut the final wires.")
new /obj/item/stack/cable_coil(loc, 5)
buildstage = 1
update_icon()
return
else if(istype(W, /obj/item/screwdriver)) // Opening that Air Alarm up.
- playsound(src.loc, W.usesound, 50, 1)
+ W.play_tool_sound(src)
panel_open = !panel_open
to_chat(user, "The wires have been [panel_open ? "exposed" : "unexposed"].")
update_icon()
@@ -674,8 +674,8 @@
if(istype(W, /obj/item/crowbar))
user.visible_message("[user.name] removes the electronics from [src.name].",\
"You start prying out the circuit...")
- playsound(src.loc, W.usesound, 50, 1)
- if (do_after(user, 20*W.toolspeed, target = src))
+ W.play_tool_sound(src)
+ if (W.use_tool(src, user, 20))
if (buildstage == 1)
to_chat(user, "You remove the air alarm electronics.")
new /obj/item/electronics/airalarm( src.loc )
@@ -725,7 +725,7 @@
if(istype(W, /obj/item/wrench))
to_chat(user, "You detach \the [src] from the wall.")
- playsound(src.loc, W.usesound, 50, 1)
+ W.play_tool_sound(src)
new /obj/item/wallframe/airalarm( user.loc )
qdel(src)
return
diff --git a/code/modules/atmospherics/machinery/atmosmachinery.dm b/code/modules/atmospherics/machinery/atmosmachinery.dm
index ef62c00f86..0f57bd85e9 100644
--- a/code/modules/atmospherics/machinery/atmosmachinery.dm
+++ b/code/modules/atmospherics/machinery/atmosmachinery.dm
@@ -183,39 +183,44 @@ Pipelines + Other Objects -> Pipe network
if(user.dropItemToGround(pipe))
pipe.setPipingLayer(piping_layer) //align it with us
return TRUE
- if(istype(W, /obj/item/wrench))
- if(can_unwrench(user))
- var/turf/T = get_turf(src)
- if (level==1 && isturf(T) && T.intact)
- to_chat(user, "You must remove the plating first!")
- return TRUE
- var/datum/gas_mixture/int_air = return_air()
- var/datum/gas_mixture/env_air = loc.return_air()
- add_fingerprint(user)
-
- var/unsafe_wrenching = FALSE
- var/internal_pressure = int_air.return_pressure()-env_air.return_pressure()
-
- playsound(src, W.usesound, 50, 1)
- to_chat(user, "You begin to unfasten \the [src]...")
- if (internal_pressure > 2*ONE_ATMOSPHERE)
- to_chat(user, "As you begin unwrenching \the [src] a gush of air blows in your face... maybe you should reconsider?")
- unsafe_wrenching = TRUE //Oh dear oh dear
-
- if (do_after(user, 20*W.toolspeed, target = src) && !QDELETED(src))
- user.visible_message( \
- "[user] unfastens \the [src].", \
- "You unfasten \the [src].", \
- "You hear ratchet.")
- investigate_log("was REMOVED by [key_name(usr)]", INVESTIGATE_ATMOS)
-
- //You unwrenched a pipe full of pressure? Let's splat you into the wall, silly.
- if(unsafe_wrenching)
- unsafe_pressure_release(user, internal_pressure)
- deconstruct(TRUE)
else
return ..()
+/obj/machinery/atmospherics/wrench_act(mob/living/user, obj/item/I)
+ if(!can_unwrench(user))
+ return TRUE
+
+ var/turf/T = get_turf(src)
+ if (level==1 && isturf(T) && T.intact)
+ to_chat(user, "You must remove the plating first!")
+ return TRUE
+
+ var/datum/gas_mixture/int_air = return_air()
+ var/datum/gas_mixture/env_air = loc.return_air()
+ add_fingerprint(user)
+
+ var/unsafe_wrenching = FALSE
+ var/internal_pressure = int_air.return_pressure()-env_air.return_pressure()
+
+ to_chat(user, "You begin to unfasten \the [src]...")
+
+ if (internal_pressure > 2*ONE_ATMOSPHERE)
+ to_chat(user, "As you begin unwrenching \the [src] a gush of air blows in your face... maybe you should reconsider?")
+ unsafe_wrenching = TRUE //Oh dear oh dear
+
+ if(I.use_tool(src, user, 20, volume=50))
+ user.visible_message( \
+ "[user] unfastens \the [src].", \
+ "You unfasten \the [src].", \
+ "You hear ratchet.")
+ investigate_log("was REMOVED by [key_name(usr)]", INVESTIGATE_ATMOS)
+
+ //You unwrenched a pipe full of pressure? Let's splat you into the wall, silly.
+ if(unsafe_wrenching)
+ unsafe_pressure_release(user, internal_pressure)
+ deconstruct(TRUE)
+ return TRUE
+
/obj/machinery/atmospherics/proc/can_unwrench(mob/user)
return can_unwrench
@@ -345,8 +350,6 @@ Pipelines + Other Objects -> Pipe network
return list()
/obj/machinery/atmospherics/update_remote_sight(mob/user)
-// if(isborer(user))
-// user.sight |= (SEE_PIXELS)
user.sight |= (SEE_TURFS|BLIND)
//Used for certain children of obj/machinery/atmospherics to not show pipe vision when mob is inside it.
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 3acc12114f..eca0a6797a 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm
@@ -269,28 +269,21 @@
broadcast_status()
update_icon()
-/obj/machinery/atmospherics/components/unary/vent_pump/attackby(obj/item/W, mob/user, params)
- if(istype(W, /obj/item/weldingtool))
- var/obj/item/weldingtool/WT = W
- if (WT.remove_fuel(0, user))
- playsound(loc, WT.usesound, 40, 1)
- to_chat(user, "You begin welding the vent...")
- if(do_after(user, W.toolspeed * 20, target = src))
- if(!src || !WT.isOn())
- return
- playsound(src.loc, 'sound/items/welder2.ogg', 50, 1)
- if(!welded)
- user.visible_message("[user] welds the vent shut.", "You weld the vent shut.", "You hear welding.")
- welded = TRUE
- else
- user.visible_message("[user] unwelds the vent.", "You unweld the vent.", "You hear welding.")
- welded = FALSE
- update_icon()
- pipe_vision_img = image(src, loc, layer = ABOVE_HUD_LAYER, dir = dir)
- pipe_vision_img.plane = ABOVE_HUD_PLANE
- return 0
- else
- return ..()
+/obj/machinery/atmospherics/components/unary/vent_pump/welder_act(mob/living/user, obj/item/I)
+ if(!I.tool_start_check(user, amount=0))
+ return TRUE
+ to_chat(user, "You begin welding the vent...")
+ if(I.use_tool(src, user, 20, volume=50))
+ if(!welded)
+ user.visible_message("[user] welds the vent shut.", "You weld the vent shut.", "You hear welding.")
+ welded = TRUE
+ else
+ user.visible_message("[user] unwelds the vent.", "You unweld the vent.", "You hear welding.")
+ welded = FALSE
+ update_icon()
+ pipe_vision_img = image(src, loc, layer = ABOVE_HUD_LAYER, dir = dir)
+ pipe_vision_img.plane = ABOVE_HUD_PLANE
+ return TRUE
/obj/machinery/atmospherics/components/unary/vent_pump/can_unwrench(mob/user)
. = ..()
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 2437b85dde..4672114227 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm
@@ -263,28 +263,21 @@
..()
update_icon_nopipes()
-/obj/machinery/atmospherics/components/unary/vent_scrubber/attackby(obj/item/W, mob/user, params)
- if(istype(W, /obj/item/weldingtool))
- var/obj/item/weldingtool/WT = W
- if(WT.remove_fuel(0,user))
- playsound(loc, WT.usesound, 40, 1)
- to_chat(user, "Now welding the scrubber.")
- if(do_after(user, 20*W.toolspeed, target = src))
- if(!src || !WT.isOn())
- return
- playsound(src.loc, 'sound/items/welder2.ogg', 50, 1)
- if(!welded)
- user.visible_message("[user] welds the scrubber shut.","You weld the scrubber shut.", "You hear welding.")
- welded = TRUE
- else
- user.visible_message("[user] unwelds the scrubber.", "You unweld the scrubber.", "You hear welding.")
- welded = FALSE
- update_icon()
- pipe_vision_img = image(src, loc, layer = ABOVE_HUD_LAYER, dir = dir)
- pipe_vision_img.plane = ABOVE_HUD_PLANE
- return 0
- else
- return ..()
+/obj/machinery/atmospherics/components/unary/vent_scrubber/welder_act(mob/living/user, obj/item/I)
+ if(!I.tool_start_check(user, amount=0))
+ return TRUE
+ to_chat(user, "Now welding the scrubber.")
+ if(I.use_tool(src, user, 20, volume=50))
+ if(!welded)
+ user.visible_message("[user] welds the scrubber shut.","You weld the scrubber shut.", "You hear welding.")
+ welded = TRUE
+ else
+ user.visible_message("[user] unwelds the scrubber.", "You unweld the scrubber.", "You hear welding.")
+ welded = FALSE
+ update_icon()
+ pipe_vision_img = image(src, loc, layer = ABOVE_HUD_LAYER, dir = dir)
+ pipe_vision_img.plane = ABOVE_HUD_PLANE
+ return TRUE
/obj/machinery/atmospherics/components/unary/vent_scrubber/can_unwrench(mob/user)
. = ..()
diff --git a/code/modules/atmospherics/machinery/other/meter.dm b/code/modules/atmospherics/machinery/other/meter.dm
index ccddc8f8ac..6582dad6df 100644
--- a/code/modules/atmospherics/machinery/other/meter.dm
+++ b/code/modules/atmospherics/machinery/other/meter.dm
@@ -100,19 +100,20 @@
to_chat(user, status())
-/obj/machinery/meter/attackby(obj/item/W, mob/user, params)
- if (istype(W, /obj/item/wrench))
- playsound(src, 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 unfasten \the [src].", \
- "You hear ratchet.")
- new /obj/item/pipe_meter(loc)
- qdel(src)
- else
- return ..()
+/obj/machinery/meter/wrench_act(mob/user, obj/item/I)
+ to_chat(user, "You begin to unfasten \the [src]...")
+ if (I.use_tool(src, user, 40, volume=50))
+ user.visible_message(
+ "[user] unfastens \the [src].",
+ "You unfasten \the [src].",
+ "You hear ratchet.")
+ deconstruct()
+ return TRUE
+
+/obj/machinery/meter/deconstruct(disassembled = TRUE)
+ if(!(flags_1 & NODECONSTRUCT_1))
+ new /obj/item/pipe_meter(loc)
+ qdel(src)
/obj/machinery/meter/attack_ai(mob/user)
return attack_hand(user)
@@ -131,8 +132,7 @@
/obj/machinery/meter/singularity_pull(S, current_size)
..()
if(current_size >= STAGE_FIVE)
- new /obj/item/pipe_meter(loc)
- qdel(src)
+ deconstruct()
// TURF METER - REPORTS A TILE'S AIR CONTENTS
// why are you yelling?
diff --git a/code/modules/atmospherics/machinery/portable/canister.dm b/code/modules/atmospherics/machinery/portable/canister.dm
index 13bef3ba1b..13649a742a 100644
--- a/code/modules/atmospherics/machinery/portable/canister.dm
+++ b/code/modules/atmospherics/machinery/portable/canister.dm
@@ -278,21 +278,20 @@
new /obj/item/stack/sheet/metal (loc, 5)
qdel(src)
-/obj/machinery/portable_atmospherics/canister/attackby(obj/item/W, mob/user, params)
- if(user.a_intent != INTENT_HARM && istype(W, /obj/item/weldingtool))
- var/obj/item/weldingtool/WT = W
- if(stat & BROKEN)
- if(!WT.remove_fuel(0, user))
- return
- playsound(loc, WT.usesound, 40, 1)
- to_chat(user, "You begin cutting [src] apart...")
- if(do_after(user, 30, target = src))
- deconstruct(TRUE)
- else
- to_chat(user, "You cannot slice [src] apart when it isn't broken.")
- return 1
+/obj/machinery/portable_atmospherics/canister/welder_act(mob/living/user, obj/item/I)
+ if(user.a_intent == INTENT_HARM)
+ return FALSE
+
+ if(stat & BROKEN)
+ if(!I.tool_start_check(user, amount=0))
+ return TRUE
+ to_chat(user, "You begin cutting [src] apart...")
+ if(I.use_tool(src, user, 30, volume=50))
+ deconstruct(TRUE)
else
- return ..()
+ to_chat(user, "You cannot slice [src] apart when it isn't broken.")
+
+ return TRUE
/obj/machinery/portable_atmospherics/canister/obj_break(damage_flag)
if((stat & BROKEN) || (flags_1 & NODECONSTRUCT_1))
diff --git a/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm b/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm
index 6cf9cec361..f21e005b9a 100644
--- a/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm
+++ b/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm
@@ -92,7 +92,7 @@
if(!(stat & BROKEN))
if(connected_port)
disconnect()
- playsound(src.loc, W.usesound, 50, 1)
+ W.play_tool_sound(src)
user.visible_message( \
"[user] disconnects [src].", \
"You unfasten [src] from the port.", \
@@ -107,7 +107,7 @@
if(!connect(possible_port))
to_chat(user, "[name] failed to connect to the port.")
return
- playsound(src.loc, W.usesound, 50, 1)
+ W.play_tool_sound(src)
user.visible_message( \
"[user] connects [src].", \
"You fasten [src] to the port.", \
diff --git a/code/modules/clothing/gloves/color.dm b/code/modules/clothing/gloves/color.dm
index 614a2c194b..171310add9 100644
--- a/code/modules/clothing/gloves/color.dm
+++ b/code/modules/clothing/gloves/color.dm
@@ -49,12 +49,12 @@
/obj/item/clothing/gloves/color/black/ce
item_color = "chief" //Exists for washing machines. Is not different from black gloves in any way.
-/obj/item/clothing/gloves/color/black/attackby(obj/item/W as obj, mob/user as mob, params)
- if(istype(W, /obj/item/wirecutters))
+/obj/item/clothing/gloves/color/black/attackby(obj/item/I, mob/user, params)
+ if(istype(I, /obj/item/wirecutters))
if(can_be_cut && icon_state == initial(icon_state))//only if not dyed
to_chat(user, "You snip the fingertips off of [src].")
- playsound(user.loc, W.usesound, rand(10,50), 1)
- new /obj/item/clothing/gloves/fingerless(user.loc)
+ I.play_tool_sound(src)
+ new /obj/item/clothing/gloves/fingerless(drop_location())
qdel(src)
..()
diff --git a/code/modules/crafting/craft.dm b/code/modules/crafting/craft.dm
index 85ae7c3b18..d0cbabb052 100644
--- a/code/modules/crafting/craft.dm
+++ b/code/modules/crafting/craft.dm
@@ -105,22 +105,33 @@
/datum/personal_crafting/proc/check_tools(mob/user, datum/crafting_recipe/R, list/contents)
if(!R.tools.len)
- return 1
+ return TRUE
var/list/possible_tools = list()
+ var/list/present_qualities = list()
for(var/obj/item/I in user.contents)
if(istype(I, /obj/item/storage))
for(var/obj/item/SI in I.contents)
possible_tools += SI.type
+ if(SI.tool_behaviour)
+ present_qualities.Add(SI.tool_behaviour)
+
possible_tools += I.type
+
+ if(I.tool_behaviour)
+ present_qualities.Add(I.tool_behaviour)
+
possible_tools += contents
main_loop:
for(var/A in R.tools)
- for(var/I in possible_tools)
- if(ispath(I,A))
- continue main_loop
- return 0
- return 1
+ if(A in present_qualities)
+ continue
+ else
+ for(var/I in possible_tools)
+ if(ispath(I, A))
+ continue main_loop
+ return FALSE
+ return TRUE
/datum/personal_crafting/proc/construct_item(mob/user, datum/crafting_recipe/R)
var/list/contents = get_surroundings(user)
@@ -401,8 +412,7 @@
data["catalyst_text"] = catalyst_text
for(var/a in R.tools)
- var/atom/A = a //cheat-typecast
- tool_text += " [R.tools[A]] [initial(A.name)],"
+ tool_text += " [a],"
tool_text = replacetext(tool_text,",","",-1)
data["tool_text"] = tool_text
diff --git a/code/modules/crafting/recipes.dm b/code/modules/crafting/recipes.dm
index fa63da1ef1..28a8d779ec 100644
--- a/code/modules/crafting/recipes.dm
+++ b/code/modules/crafting/recipes.dm
@@ -16,7 +16,7 @@
result = /obj/item/gun
reqs = list(/obj/item/gun = 1)
parts = list(/obj/item/gun = 1)
- tools = list(/obj/item/weldingtool, /obj/item/screwdriver, /obj/item/wirecutters)
+ tools = list(TOOL_WELDER, TOOL_SCREWDRIVER, TOOL_WIRECUTTER)
time = 50
category = CAT_WEAPONRY
subcategory = CAT_WEAPON
@@ -134,7 +134,7 @@
/obj/item/gun/energy/e_gun/advtaser = 1,
/obj/item/stock_parts/cell = 1,
/obj/item/device/assembly/prox_sensor = 1)
- tools = list(/obj/item/weldingtool, /obj/item/screwdriver)
+ tools = list(TOOL_WELDER, TOOL_SCREWDRIVER)
time = 60
category = CAT_ROBOT
@@ -146,7 +146,7 @@
/obj/item/melee/baton = 1,
/obj/item/device/assembly/prox_sensor = 1,
/obj/item/bodypart/r_arm/robot = 1)
- tools = list(/obj/item/weldingtool)
+ tools = list(TOOL_WELDER)
time = 60
category = CAT_ROBOT
@@ -192,8 +192,7 @@
/datum/crafting_recipe/improvised_pneumatic_cannon //Pretty easy to obtain but
name = "Pneumatic Cannon"
result = /obj/item/pneumatic_cannon/ghetto
- tools = list(/obj/item/weldingtool,
- /obj/item/wrench)
+ tools = list(TOOL_WELDER, TOOL_WRENCH)
reqs = list(/obj/item/stack/sheet/metal = 4,
/obj/item/stack/packageWrap = 8,
/obj/item/pipe = 2)
@@ -209,7 +208,7 @@
/obj/item/stack/rods = 1)
parts = list(/obj/item/device/assembly/igniter = 1,
/obj/item/weldingtool = 1)
- tools = list(/obj/item/screwdriver)
+ tools = list(TOOL_SCREWDRIVER)
time = 10
category = CAT_WEAPONRY
subcategory = CAT_WEAPON
@@ -220,7 +219,7 @@
reqs = list(/obj/item/ammo_casing/shotgun/techshell = 1,
/obj/item/rcd_ammo = 1,
/obj/item/stock_parts/manipulator = 2)
- tools = list(/obj/item/screwdriver)
+ tools = list(TOOL_SCREWDRIVER)
time = 5
category = CAT_WEAPONRY
subcategory = CAT_AMMO
@@ -231,7 +230,7 @@
reqs = list(/obj/item/ammo_casing/shotgun/techshell = 1,
/obj/item/stock_parts/capacitor/adv = 2,
/obj/item/stock_parts/micro_laser/ultra = 1)
- tools = list(/obj/item/screwdriver)
+ tools = list(TOOL_SCREWDRIVER)
time = 5
category = CAT_WEAPONRY
subcategory = CAT_AMMO
@@ -240,7 +239,7 @@
name = "Dragonsbreath Shell"
result = /obj/item/ammo_casing/shotgun/dragonsbreath
reqs = list(/obj/item/ammo_casing/shotgun/techshell = 1, /datum/reagent/phosphorus = 5)
- tools = list(/obj/item/screwdriver)
+ tools = list(TOOL_SCREWDRIVER)
time = 5
category = CAT_WEAPONRY
subcategory = CAT_AMMO
@@ -252,7 +251,7 @@
/datum/reagent/glycerol = 5,
/datum/reagent/toxin/acid = 5,
/datum/reagent/toxin/acid/fluacid = 5)
- tools = list(/obj/item/screwdriver)
+ tools = list(TOOL_SCREWDRIVER)
time = 5
category = CAT_WEAPONRY
subcategory = CAT_AMMO
@@ -263,7 +262,7 @@
reqs = list(/obj/item/ammo_casing/shotgun/techshell = 1,
/obj/item/stock_parts/micro_laser/ultra = 1,
/obj/item/stock_parts/subspace/crystal = 1)
- tools = list(/obj/item/screwdriver)
+ tools = list(TOOL_SCREWDRIVER)
time = 5
category = CAT_WEAPONRY
subcategory = CAT_AMMO
@@ -275,7 +274,7 @@
/obj/item/stack/sheet/metal = 1,
/obj/item/stack/cable_coil = 1,
/datum/reagent/fuel = 10)
- tools = list(/obj/item/screwdriver)
+ tools = list(TOOL_SCREWDRIVER)
time = 5
category = CAT_WEAPONRY
subcategory = CAT_AMMO
@@ -286,7 +285,7 @@
reqs = list(/obj/item/ammo_casing/shotgun/techshell = 1,
/obj/item/stock_parts/capacitor/adv = 1,
/obj/item/stock_parts/micro_laser/high = 1)
- tools = list(/obj/item/screwdriver)
+ tools = list(TOOL_SCREWDRIVER)
time = 5
category = CAT_WEAPONRY
subcategory = CAT_AMMO
@@ -298,7 +297,7 @@
/obj/item/pipe = 1,
/obj/item/weaponcrafting/stock = 1,
/obj/item/stack/packageWrap = 5)
- tools = list(/obj/item/screwdriver)
+ tools = list(TOOL_SCREWDRIVER)
time = 100
category = CAT_WEAPONRY
subcategory = CAT_WEAPON
@@ -309,7 +308,7 @@
reqs = list(/obj/item/circular_saw = 1,
/obj/item/stack/cable_coil = 3,
/obj/item/stack/sheet/plasteel = 5)
- tools = list(/obj/item/weldingtool)
+ tools = list(TOOL_WELDER)
time = 50
category = CAT_WEAPONRY
subcategory = CAT_WEAPON
@@ -590,7 +589,7 @@
name = "Makeshift Rapid Cable Layer"
result = /obj/item/twohanded/rcl/ghetto
time = 40
- tools = list(/obj/item/weldingtool, /obj/item/screwdriver, /obj/item/wrench)
+ tools = list(TOOL_WELDER, TOOL_SCREWDRIVER, TOOL_WRENCH)
reqs = list(/obj/item/stack/sheet/metal = 15)
category = CAT_MISC
diff --git a/code/modules/food_and_drinks/food/snacks_egg.dm b/code/modules/food_and_drinks/food/snacks_egg.dm
index 10039f7a8b..3e5ecb6f45 100644
--- a/code/modules/food_and_drinks/food/snacks_egg.dm
+++ b/code/modules/food_and_drinks/food/snacks_egg.dm
@@ -15,12 +15,21 @@
name = "egg"
desc = "An egg!"
icon_state = "egg"
- list_reagents = list("nutriment" = 1)
+ list_reagents = list("eggyolk" = 5)
cooked_type = /obj/item/reagent_containers/food/snacks/boiledegg
filling_color = "#F0E68C"
- tastes = list("egg" = 1)
foodtype = MEAT
- grind_results = list("eggyolk" = 5)
+ grind_results = list()
+
+/obj/item/reagent_containers/food/snacks/egg/gland
+ desc = "An egg! It looks weird..."
+
+/obj/item/reagent_containers/food/snacks/egg/gland/Initialize()
+ . = ..()
+ reagents.add_reagent(get_random_reagent_id(), 15)
+
+ var/color = mix_color_from_reagents(reagents.reagent_list)
+ add_atom_colour(color, FIXED_COLOUR_PRIORITY)
/obj/item/reagent_containers/food/snacks/egg/throw_impact(atom/hit_atom)
if(!..()) //was it caught by a mob?
@@ -30,7 +39,7 @@
qdel(src)
/obj/item/reagent_containers/food/snacks/egg/attackby(obj/item/W, mob/user, params)
- if(istype( W, /obj/item/toy/crayon ))
+ if(istype(W, /obj/item/toy/crayon))
var/obj/item/toy/crayon/C = W
var/clr = C.item_color
@@ -38,7 +47,7 @@
to_chat(usr, "[src] refuses to take on this colour!")
return
- to_chat(usr, "You colour [src] [clr].")
+ to_chat(usr, "You colour [src] with [W].")
icon_state = "egg-[clr]"
item_color = clr
else
@@ -47,42 +56,34 @@
/obj/item/reagent_containers/food/snacks/egg/blue
icon_state = "egg-blue"
item_color = "blue"
- tastes = list("egg" = 4, "the back of class" = 1)
/obj/item/reagent_containers/food/snacks/egg/green
icon_state = "egg-green"
item_color = "green"
- tastes = list("egg" = 4, "the back of class" = 1)
/obj/item/reagent_containers/food/snacks/egg/mime
icon_state = "egg-mime"
item_color = "mime"
- tastes = list("egg" = 4, "the back of class" = 1)
/obj/item/reagent_containers/food/snacks/egg/orange
icon_state = "egg-orange"
item_color = "orange"
- tastes = list("egg" = 4, "the back of class" = 1)
/obj/item/reagent_containers/food/snacks/egg/purple
icon_state = "egg-purple"
item_color = "purple"
- tastes = list("egg" = 4, "the back of class" = 1)
/obj/item/reagent_containers/food/snacks/egg/rainbow
icon_state = "egg-rainbow"
item_color = "rainbow"
- tastes = list("egg" = 4, "the back of class" = 1)
/obj/item/reagent_containers/food/snacks/egg/red
icon_state = "egg-red"
item_color = "red"
- tastes = list("egg" = 4, "the back of class" = 1)
/obj/item/reagent_containers/food/snacks/egg/yellow
icon_state = "egg-yellow"
item_color = "yellow"
- tastes = list("egg" = 4, "the back of class" = 1)
/obj/item/reagent_containers/food/snacks/friedegg
name = "fried egg"
diff --git a/code/modules/food_and_drinks/kitchen_machinery/microwave.dm b/code/modules/food_and_drinks/kitchen_machinery/microwave.dm
index 5bc2be78ce..b91a848421 100644
--- a/code/modules/food_and_drinks/kitchen_machinery/microwave.dm
+++ b/code/modules/food_and_drinks/kitchen_machinery/microwave.dm
@@ -62,7 +62,7 @@
"[user] starts to fix part of the microwave.", \
"You start to fix part of the microwave..." \
)
- if (do_after(user,20*O.toolspeed, target = src))
+ if (O.use_tool(src, user, 20))
user.visible_message( \
"[user] fixes part of the microwave.", \
"You fix part of the microwave." \
@@ -73,7 +73,7 @@
"[user] starts to fix part of the microwave.", \
"You start to fix part of the microwave..." \
)
- if (do_after(user,20*O.toolspeed, target = src))
+ if (O.use_tool(src, user, 20))
user.visible_message( \
"[user] fixes the microwave.", \
"You fix the microwave." \
diff --git a/code/modules/hydroponics/hydroponics.dm b/code/modules/hydroponics/hydroponics.dm
index 8fc5c43bcc..5277a25991 100644
--- a/code/modules/hydroponics/hydroponics.dm
+++ b/code/modules/hydroponics/hydroponics.dm
@@ -801,8 +801,7 @@
if(!anchored && !isinspace())
user.visible_message("[user] begins to wrench [src] into place.", \
"You begin to wrench [src] in place...")
- playsound(loc, O.usesound, 50, 1)
- if (do_after(user, 20*O.toolspeed, target = src))
+ if (O.use_tool(src, user, 20, volume=50))
if(anchored)
return
anchored = TRUE
@@ -811,8 +810,7 @@
else if(anchored)
user.visible_message("[user] begins to unwrench [src].", \
"You begin to unwrench [src]...")
- playsound(loc, O.usesound, 50, 1)
- if (do_after(user, 20*O.toolspeed, target = src))
+ if (O.use_tool(src, user, 20, volume=50))
if(!anchored)
return
anchored = FALSE
@@ -821,7 +819,7 @@
else if(istype(O, /obj/item/wirecutters) && unwrenchable)
using_irrigation = !using_irrigation
- playsound(src, O.usesound, 50, 1)
+ O.play_tool_sound(src)
user.visible_message("[user] [using_irrigation ? "" : "dis"]connects [src]'s irrigation hoses.", \
"You [using_irrigation ? "" : "dis"]connect [src]'s irrigation hoses.")
for(var/obj/machinery/hydroponics/h in range(1,src))
@@ -832,11 +830,11 @@
to_chat(user, "[src] doesn't have any plants or weeds!")
return
user.visible_message("[user] starts digging out [src]'s plants...", "You start digging out [src]'s plants...")
- playsound(src, 'sound/effects/shovel_dig.ogg', 50, 1)
+ O.play_tool_sound(src)
if(!do_after(user, 50, target = src) || (!myseed && !weedlevel))
return
user.visible_message("[user] digs out the plants in [src]!", "You dig out all of [src]'s plants!")
- playsound(src, 'sound/effects/shovel_dig.ogg', 50, 1)
+ O.play_tool_sound(src)
if(myseed) //Could be that they're just using it as a de-weeder
age = 0
plant_health = 0
diff --git a/code/modules/integrated_electronics/core/assemblies.dm b/code/modules/integrated_electronics/core/assemblies.dm
index b039c1e968..fcb566fcd8 100644
--- a/code/modules/integrated_electronics/core/assemblies.dm
+++ b/code/modules/integrated_electronics/core/assemblies.dm
@@ -279,8 +279,8 @@
visible_message(" [user] waves [src] around [target].")
-/obj/item/device/electronic_assembly/screwdriver_act(mob/living/user, obj/item/S)
- playsound(src, S.usesound, 50, 1)
+/obj/item/device/electronic_assembly/screwdriver_act(mob/living/user, obj/item/I)
+ I.play_tool_sound(src)
opened = !opened
to_chat(user, "You [opened ? "open" : "close"] the maintenance hatch of [src].")
update_icon()
diff --git a/code/modules/jobs/job_exp.dm b/code/modules/jobs/job_exp.dm
index 91aa958ae9..d9369091e8 100644
--- a/code/modules/jobs/job_exp.dm
+++ b/code/modules/jobs/job_exp.dm
@@ -194,20 +194,10 @@ GLOBAL_PROTECT(exp_to_update)
return -1
if(!SSdbcore.Connect())
return -1
- var/datum/DBQuery/exp_read = SSdbcore.NewQuery("SELECT job, minutes FROM [format_table_name("role_time")] WHERE ckey = '[sanitizeSQL(ckey)]'")
- if(!exp_read.Execute())
+ if (!isnum(minutes))
return -1
var/list/play_records = list()
- while(exp_read.NextRow())
- play_records[exp_read.item[1]] = text2num(exp_read.item[2])
- for(var/rtype in SSjob.name_occupations)
- if(!play_records[rtype])
- play_records[rtype] = 0
- for(var/rtype in GLOB.exp_specialmap)
- if(!play_records[rtype])
- play_records[rtype] = 0
- var/list/old_records = play_records.Copy()
if(isliving(mob))
if(mob.stat != DEAD)
var/rolefound = FALSE
@@ -245,15 +235,19 @@ GLOBAL_PROTECT(exp_to_update)
to_chat(src,"You got: [minutes] Ghost EXP!")
else if(minutes) //Let "refresh" checks go through
return
- prefs.exp = play_records
for(var/jtype in play_records)
- if(play_records[jtype] != old_records[jtype])
- LAZYINITLIST(GLOB.exp_to_update)
- GLOB.exp_to_update.Add(list(list(
- "job" = "'[sanitizeSQL(jtype)]'",
- "ckey" = "'[sanitizeSQL(ckey)]'",
- "minutes" = play_records[jtype])))
+ var/jvalue = play_records[jtype]
+ if (!jvalue)
+ continue
+ if (!isnum(jvalue))
+ CRASH("invalid job value [jtype]:[jvalue]")
+ LAZYINITLIST(GLOB.exp_to_update)
+ GLOB.exp_to_update.Add(list(list(
+ "job" = "'[sanitizeSQL(jtype)]'",
+ "ckey" = "'[sanitizeSQL(ckey)]'",
+ "minutes" = jvalue)))
+ prefs.exp[jtype] += jvalue
addtimer(CALLBACK(SSblackbox,/datum/controller/subsystem/blackbox/proc/update_exp_db),20,TIMER_OVERRIDE|TIMER_UNIQUE)
diff --git a/code/modules/jobs/job_types/civilian_chaplain.dm b/code/modules/jobs/job_types/civilian_chaplain.dm
index 7f7fdca900..d6f07df931 100644
--- a/code/modules/jobs/job_types/civilian_chaplain.dm
+++ b/code/modules/jobs/job_types/civilian_chaplain.dm
@@ -90,6 +90,5 @@ Chaplain
belt = /obj/item/device/pda/chaplain
uniform = /obj/item/clothing/under/rank/chaplain
backpack_contents = list(/obj/item/device/camera/spooky = 1)
- accessory = /obj/item/clothing/accessory/pocketprotector/cosmetology
backpack = /obj/item/storage/backpack/cultpack
satchel = /obj/item/storage/backpack/cultpack
diff --git a/code/modules/jobs/job_types/engineering.dm b/code/modules/jobs/job_types/engineering.dm
index b61c61f6c8..1b1619cc24 100644
--- a/code/modules/jobs/job_types/engineering.dm
+++ b/code/modules/jobs/job_types/engineering.dm
@@ -41,7 +41,6 @@ Chief Engineer
shoes = /obj/item/clothing/shoes/sneakers/brown
head = /obj/item/clothing/head/hardhat/white
gloves = /obj/item/clothing/gloves/color/black/ce
- accessory = /obj/item/clothing/accessory/pocketprotector/full
backpack_contents = list(/obj/item/melee/classic_baton/telescopic=1, /obj/item/device/modular_computer/tablet/preset/advanced=1)
backpack = /obj/item/storage/backpack/industrial
@@ -96,7 +95,6 @@ Station Engineer
shoes = /obj/item/clothing/shoes/workboots
head = /obj/item/clothing/head/hardhat
r_pocket = /obj/item/device/t_scanner
- accessory = /obj/item/clothing/accessory/pocketprotector/full
backpack = /obj/item/storage/backpack/industrial
satchel = /obj/item/storage/backpack/satchel/eng
@@ -150,7 +148,6 @@ Atmospheric Technician
ears = /obj/item/device/radio/headset/headset_eng
uniform = /obj/item/clothing/under/rank/atmospheric_technician
r_pocket = /obj/item/device/analyzer
- accessory = /obj/item/clothing/accessory/pocketprotector/full
backpack = /obj/item/storage/backpack/industrial
satchel = /obj/item/storage/backpack/satchel/eng
diff --git a/code/modules/jobs/job_types/medical.dm b/code/modules/jobs/job_types/medical.dm
index 151ed213f8..1f2df19f64 100644
--- a/code/modules/jobs/job_types/medical.dm
+++ b/code/modules/jobs/job_types/medical.dm
@@ -112,7 +112,6 @@ Chemist
uniform = /obj/item/clothing/under/rank/chemist
shoes = /obj/item/clothing/shoes/sneakers/white
suit = /obj/item/clothing/suit/toggle/labcoat/chemist
- accessory = /obj/item/clothing/accessory/pocketprotector/full
backpack = /obj/item/storage/backpack/chemistry
satchel = /obj/item/storage/backpack/satchel/chem
duffelbag = /obj/item/storage/backpack/duffelbag/med
diff --git a/code/modules/jobs/job_types/science.dm b/code/modules/jobs/job_types/science.dm
index 7fc1dada77..d8579a37b0 100644
--- a/code/modules/jobs/job_types/science.dm
+++ b/code/modules/jobs/job_types/science.dm
@@ -43,7 +43,6 @@ Research Director
suit = /obj/item/clothing/suit/toggle/labcoat
l_hand = /obj/item/clipboard
l_pocket = /obj/item/device/laser_pointer
- accessory = /obj/item/clothing/accessory/pocketprotector/full
backpack_contents = list(/obj/item/melee/classic_baton/telescopic=1, /obj/item/device/modular_computer/tablet/preset/advanced=1)
backpack = /obj/item/storage/backpack/science
@@ -91,7 +90,6 @@ Scientist
backpack = /obj/item/storage/backpack/science
satchel = /obj/item/storage/backpack/satchel/tox
- accessory = /obj/item/clothing/accessory/pocketprotector/full
/*
Roboticist
diff --git a/code/modules/keybindings/setup.dm b/code/modules/keybindings/setup.dm
index 7d3127a6b4..54df252f5d 100644
--- a/code/modules/keybindings/setup.dm
+++ b/code/modules/keybindings/setup.dm
@@ -12,6 +12,7 @@
/datum/proc/key_up(key, client/user) // Called when a key is released
return
/datum/proc/keyLoop(client/user) // Called once every frame
+ set waitfor = FALSE
return
// removes all the existing macros
@@ -46,4 +47,4 @@
if(prefs.hotkeys)
winset(src, null, "input.focus=true input.background-color=[COLOR_INPUT_ENABLED] mainwindow.macro=default")
else
- winset(src, null, "input.focus=true input.background-color=[COLOR_INPUT_ENABLED] mainwindow.macro=old_default")
\ No newline at end of file
+ winset(src, null, "input.focus=true input.background-color=[COLOR_INPUT_ENABLED] mainwindow.macro=old_default")
diff --git a/code/modules/library/lib_items.dm b/code/modules/library/lib_items.dm
index b7673a9640..2b9ed28842 100644
--- a/code/modules/library/lib_items.dm
+++ b/code/modules/library/lib_items.dm
@@ -57,14 +57,12 @@
switch(state)
if(0)
if(istype(I, /obj/item/wrench))
- playsound(loc, I.usesound, 100, 1)
- if(do_after(user, 20*I.toolspeed, target = src))
+ if(I.use_tool(src, user, 20, volume=50))
to_chat(user, "You wrench the frame into place.")
anchored = TRUE
state = 1
if(istype(I, /obj/item/crowbar))
- playsound(loc, I.usesound, 100, 1)
- if(do_after(user, 20*I.toolspeed, target = src))
+ if(I.use_tool(src, user, 20, volume=50))
to_chat(user, "You pry the frame apart.")
deconstruct(TRUE)
@@ -77,7 +75,7 @@
state = 2
icon_state = "book-0"
if(istype(I, /obj/item/wrench))
- playsound(loc, I.usesound, 100, 1)
+ I.play_tool_sound(src, 100)
to_chat(user, "You unwrench the frame.")
anchored = FALSE
state = 0
@@ -99,14 +97,14 @@
if(!newname)
return
else
- name = ("bookcase ([sanitize(newname)])")
+ name = "bookcase ([sanitize(newname)])"
else if(istype(I, /obj/item/crowbar))
if(contents.len)
to_chat(user, "You need to remove the books first!")
else
- playsound(loc, I.usesound, 100, 1)
+ I.play_tool_sound(src, 100)
to_chat(user, "You pry the shelf out.")
- new /obj/item/stack/sheet/mineral/wood(loc, 2)
+ new /obj/item/stack/sheet/mineral/wood(drop_location(), 2)
state = 1
icon_state = "bookempty"
else
diff --git a/code/modules/mining/abandoned_crates.dm b/code/modules/mining/abandoned_crates.dm
index db11737a49..174fada464 100644
--- a/code/modules/mining/abandoned_crates.dm
+++ b/code/modules/mining/abandoned_crates.dm
@@ -186,10 +186,7 @@
/obj/structure/closet/crate/secure/loot/attackby(obj/item/W, mob/user)
if(locked)
- if(istype(W, /obj/item/card/emag))
- boom(user)
- return
- else if(istype(W, /obj/item/device/multitool))
+ if(istype(W, /obj/item/device/multitool))
to_chat(user, "DECA-CODE LOCK REPORT:")
if(attempts == 1)
to_chat(user, "* Anti-Tamper Bomb will activate on next failed access attempt.")
@@ -215,6 +212,10 @@
return
return ..()
+/obj/structure/closet/crate/secure/loot/emag_act(mob/user)
+ if(locked)
+ boom(user)
+
/obj/structure/closet/crate/secure/loot/togglelock(mob/user)
if(locked)
boom(user)
diff --git a/code/modules/mining/equipment/kinetic_crusher.dm b/code/modules/mining/equipment/kinetic_crusher.dm
index 5e65ca675b..b455e55db9 100644
--- a/code/modules/mining/equipment/kinetic_crusher.dm
+++ b/code/modules/mining/equipment/kinetic_crusher.dm
@@ -38,18 +38,18 @@
var/obj/item/crusher_trophy/T = t
to_chat(user, "It has \a [T] attached, which causes [T.effect_desc()].")
-/obj/item/twohanded/required/kinetic_crusher/attackby(obj/item/A, mob/living/user)
- if(istype(A, /obj/item/crowbar))
+/obj/item/twohanded/required/kinetic_crusher/attackby(obj/item/I, mob/living/user)
+ if(istype(I, /obj/item/crowbar))
if(LAZYLEN(trophies))
to_chat(user, "You remove [src]'s trophies.")
- playsound(loc, A.usesound, 100, 1)
+ I.play_tool_sound(src)
for(var/t in trophies)
var/obj/item/crusher_trophy/T = t
T.remove_from(src, user)
else
to_chat(user, "There are no trophies on [src].")
- else if(istype(A, /obj/item/crusher_trophy))
- var/obj/item/crusher_trophy/T = A
+ else if(istype(I, /obj/item/crusher_trophy))
+ var/obj/item/crusher_trophy/T = I
T.add_to(src, user)
else
return ..()
diff --git a/code/modules/mining/equipment/mining_tools.dm b/code/modules/mining/equipment/mining_tools.dm
index b34bb980ee..1038d8c267 100644
--- a/code/modules/mining/equipment/mining_tools.dm
+++ b/code/modules/mining/equipment/mining_tools.dm
@@ -13,13 +13,13 @@
w_class = WEIGHT_CLASS_BULKY
materials = list(MAT_METAL=2000) //one sheet, but where can you make them?
var/digspeed = 40
- var/list/digsound = list('sound/effects/picaxe1.ogg','sound/effects/picaxe2.ogg','sound/effects/picaxe3.ogg')
+ usesound = list('sound/effects/picaxe1.ogg', 'sound/effects/picaxe2.ogg', 'sound/effects/picaxe3.ogg')
attack_verb = list("hit", "pierced", "sliced", "attacked")
/obj/item/pickaxe/suicide_act(mob/living/user)
user.visible_message("[user] begins digging into their chest! It looks like [user.p_theyre()] trying to commit suicide!")
if(do_after(user,30, target = user))
- playDigSound()
+ play_tool_sound(user)
return BRUTELOSS
user.visible_message("[user] couldn't do it!")
return SHAME
@@ -34,9 +34,6 @@
w_class = WEIGHT_CLASS_NORMAL
materials = list(MAT_METAL=1000)
-/obj/item/pickaxe/proc/playDigSound()
- playsound(src, pick(digsound),50,1)
-
/obj/item/pickaxe/silver
name = "silver-plated pickaxe"
icon_state = "spickaxe"
@@ -59,7 +56,7 @@
item_state = "jackhammer"
slot_flags = SLOT_BELT
digspeed = 25 //available from roundstart, faster than a pickaxe.
- digsound = list('sound/weapons/drill.ogg')
+ usesound = 'sound/weapons/drill.ogg'
hitsound = 'sound/weapons/drill.ogg'
desc = "An electric mining drill for the especially scrawny."
@@ -84,7 +81,7 @@
icon_state = "jackhammer"
item_state = "jackhammer"
digspeed = 5 //the epitome of powertools. extremely fast mining, laughs at puny walls
- digsound = list('sound/weapons/sonic_jackhammer.ogg')
+ usesound = 'sound/weapons/sonic_jackhammer.ogg'
hitsound = 'sound/weapons/sonic_jackhammer.ogg'
desc = "Cracks rocks with sonic blasts, and doubles as a demolition power tool for smashing walls."
@@ -99,6 +96,7 @@
slot_flags = SLOT_BELT
force = 8
var/digspeed = 20
+ usesound = 'sound/effects/shovel_dig.ogg'
throwforce = 4
item_state = "shovel"
w_class = WEIGHT_CLASS_NORMAL
@@ -109,7 +107,7 @@
/obj/item/shovel/suicide_act(mob/living/user)
user.visible_message("[user] begins digging their own grave! It looks like [user.p_theyre()] trying to commit suicide!")
if(do_after(user,30, target = user))
- playsound(src, 'sound/effects/shovel_dig.ogg', 50, 1)
+ play_tool_sound(user)
return BRUTELOSS
user.visible_message("[user] couldn't do it!")
return SHAME
diff --git a/code/modules/mining/equipment/survival_pod.dm b/code/modules/mining/equipment/survival_pod.dm
index 573c3dab71..66faa7cb2c 100644
--- a/code/modules/mining/equipment/survival_pod.dm
+++ b/code/modules/mining/equipment/survival_pod.dm
@@ -138,16 +138,16 @@
density = TRUE
pixel_y = -32
-/obj/item/device/gps/computer/attackby(obj/item/W, mob/user, params)
- if(istype(W, /obj/item/wrench) && !(flags_1&NODECONSTRUCT_1))
- playsound(src.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/device/gps(loc)
- qdel(src)
- return
- return ..()
+/obj/item/device/gps/computer/wrench_act(mob/living/user, obj/item/I)
+ if(flags_1 & NODECONSTRUCT_1)
+ return TRUE
+
+ user.visible_message("[user] disassembles [src].",
+ "You start to disassemble [src]...", "You hear clanking and banging noises.")
+ if(I.use_tool(src, user, 20, volume=50))
+ new /obj/item/device/gps(loc)
+ qdel(src)
+ return TRUE
/obj/item/device/gps/computer/attack_hand(mob/user)
attack_self(user)
@@ -214,14 +214,15 @@
new buildstacktype(loc,buildstackamount)
qdel(src)
-/obj/structure/fans/attackby(obj/item/W, mob/user, params)
- if(istype(W, /obj/item/wrench) && !(flags_1&NODECONSTRUCT_1))
- playsound(src.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)
+ if(flags_1 & NODECONSTRUCT_1)
+ return TRUE
+
+ user.visible_message("[user] disassembles [src].",
+ "You start to disassemble [src]...", "You hear clanking and banging noises.")
+ if(I.use_tool(src, user, 20, volume=50))
+ deconstruct()
+ return TRUE
/obj/structure/fans/tiny
name = "tiny fan"
diff --git a/code/modules/mining/machine_vending.dm b/code/modules/mining/machine_vending.dm
index da44a49626..fae8985a73 100644
--- a/code/modules/mining/machine_vending.dm
+++ b/code/modules/mining/machine_vending.dm
@@ -46,9 +46,9 @@
new /datum/data/mining_equipment("Jump Boots", /obj/item/clothing/shoes/bhop, 2500),
new /datum/data/mining_equipment("Luxury Shelter Capsule", /obj/item/survivalcapsule/luxury, 3000),
new /datum/data/mining_equipment("Mining Drone", /mob/living/simple_animal/hostile/mining_drone, 800),
- new /datum/data/mining_equipment("Drone Melee Upgrade", /obj/item/device/mine_bot_ugprade, 400),
- new /datum/data/mining_equipment("Drone Health Upgrade", /obj/item/device/mine_bot_ugprade/health, 400),
- new /datum/data/mining_equipment("Drone Ranged Upgrade", /obj/item/device/mine_bot_ugprade/cooldown, 600),
+ new /datum/data/mining_equipment("Drone Melee Upgrade", /obj/item/device/mine_bot_upgrade, 400),
+ new /datum/data/mining_equipment("Drone Health Upgrade", /obj/item/device/mine_bot_upgrade/health, 400),
+ new /datum/data/mining_equipment("Drone Ranged Upgrade", /obj/item/device/mine_bot_upgrade/cooldown, 600),
new /datum/data/mining_equipment("Drone AI Upgrade", /obj/item/slimepotion/slime/sentience/mining, 1000),
new /datum/data/mining_equipment("KA White Tracer Rounds", /obj/item/borg/upgrade/modkit/tracer, 100),
new /datum/data/mining_equipment("KA Adjustable Tracer Rounds", /obj/item/borg/upgrade/modkit/tracer/adjustable, 150),
diff --git a/code/modules/mining/minebot.dm b/code/modules/mining/minebot.dm
index fe90caf279..3ab7b2dc5c 100644
--- a/code/modules/mining/minebot.dm
+++ b/code/modules/mining/minebot.dm
@@ -64,18 +64,21 @@
/mob/living/simple_animal/hostile/mining_drone/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/weldingtool))
- var/obj/item/weldingtool/W = I
- if(W.welding && !stat)
- if(AIStatus != AI_OFF && AIStatus != AI_IDLE)
- to_chat(user, "[src] is moving around too much to repair!")
- return
- if(maxHealth == health)
- to_chat(user, "[src] is at full integrity.")
- else
- if(W.remove_fuel(0, user))
- adjustBruteLoss(-10)
- to_chat(user, "You repair some of the armor on [src].")
+ if(stat)
return
+ if(AIStatus != AI_OFF && AIStatus != AI_IDLE)
+ to_chat(user, "[src] is moving around too much to repair!")
+ return
+
+ if(maxHealth == health)
+ to_chat(user, "[src] is at full integrity.")
+ return
+
+ if(I.use_tool(src, user, 0, volume=40))
+ adjustBruteLoss(-10)
+ to_chat(user, "You repair some of the armor on [src].")
+ return
+
if(istype(I, /obj/item/device/mining_scanner) || istype(I, /obj/item/device/t_scanner/adv_mining_scanner))
to_chat(user, "You instruct [src] to drop any collected ore.")
DropOre()
@@ -202,18 +205,18 @@
//Melee
-/obj/item/device/mine_bot_ugprade
+/obj/item/device/mine_bot_upgrade
name = "minebot melee upgrade"
desc = "A minebot upgrade."
icon_state = "door_electronics"
icon = 'icons/obj/module.dmi'
-/obj/item/device/mine_bot_ugprade/afterattack(mob/living/simple_animal/hostile/mining_drone/M, mob/user, proximity)
+/obj/item/device/mine_bot_upgrade/afterattack(mob/living/simple_animal/hostile/mining_drone/M, mob/user, proximity)
if(!istype(M) || !proximity)
return
upgrade_bot(M, user)
-/obj/item/device/mine_bot_ugprade/proc/upgrade_bot(mob/living/simple_animal/hostile/mining_drone/M, mob/user)
+/obj/item/device/mine_bot_upgrade/proc/upgrade_bot(mob/living/simple_animal/hostile/mining_drone/M, mob/user)
if(M.melee_damage_upper != initial(M.melee_damage_upper))
to_chat(user, "[src] already has a combat upgrade installed!")
return
@@ -223,10 +226,10 @@
//Health
-/obj/item/device/mine_bot_ugprade/health
+/obj/item/device/mine_bot_upgrade/health
name = "minebot chassis upgrade"
-/obj/item/device/mine_bot_ugprade/health/upgrade_bot(mob/living/simple_animal/hostile/mining_drone/M, mob/user)
+/obj/item/device/mine_bot_upgrade/health/upgrade_bot(mob/living/simple_animal/hostile/mining_drone/M, mob/user)
if(M.maxHealth != initial(M.maxHealth))
to_chat(user, "[src] already has a reinforced chassis!")
return
@@ -236,10 +239,10 @@
//Cooldown
-/obj/item/device/mine_bot_ugprade/cooldown
+/obj/item/device/mine_bot_upgrade/cooldown
name = "minebot cooldown upgrade"
-/obj/item/device/mine_bot_ugprade/cooldown/upgrade_bot(mob/living/simple_animal/hostile/mining_drone/M, mob/user)
+/obj/item/device/mine_bot_upgrade/cooldown/upgrade_bot(mob/living/simple_animal/hostile/mining_drone/M, mob/user)
name = "minebot cooldown upgrade"
if(M.ranged_cooldown_time != initial(M.ranged_cooldown_time))
to_chat(user, "[src] already has a decreased weapon cooldown!")
diff --git a/code/modules/mining/ores_coins.dm b/code/modules/mining/ores_coins.dm
index 163e590ea9..56020b5407 100644
--- a/code/modules/mining/ores_coins.dm
+++ b/code/modules/mining/ores_coins.dm
@@ -39,15 +39,15 @@
. = ..()
add_overlay(stack_overlays)
-/obj/item/stack/ore/attackby(obj/item/I, mob/user, params)
- if(istype(I, /obj/item/weldingtool))
- var/obj/item/weldingtool/W = I
- if(W.remove_fuel(15) && refined_type)
- new refined_type(get_turf(src.loc))
- qdel(src)
- else if(W.isOn())
- to_chat(user, "Not enough fuel to smelt [src].")
- ..()
+/obj/item/stack/ore/welder_act(mob/living/user, obj/item/I)
+ if(!refined_type)
+ return TRUE
+
+ if(I.use_tool(src, user, 0, volume=50, amount=15))
+ new refined_type(drop_location())
+ use(1)
+
+ return TRUE
/obj/item/stack/ore/uranium
name = "uranium ore"
@@ -114,13 +114,9 @@ GLOBAL_LIST_INIT(sand_recipes, list(\
materials = list(MAT_PLASMA=MINERAL_MATERIAL_AMOUNT)
refined_type = /obj/item/stack/sheet/mineral/plasma
-/obj/item/stack/ore/plasma/attackby(obj/item/I, mob/user, params)
- if(istype(I, /obj/item/weldingtool))
- var/obj/item/weldingtool/W = I
- if(W.welding)
- to_chat(user, "You can't hit a high enough temperature to smelt [src] properly!")
- else
- ..()
+/obj/item/stack/ore/plasma/welder_act(mob/living/user, obj/item/I)
+ to_chat(user, "You can't hit a high enough temperature to smelt [src] properly!")
+ return TRUE
/obj/item/stack/ore/silver
@@ -423,21 +419,19 @@ GLOBAL_LIST_INIT(sand_recipes, list(\
else
to_chat(user, "You need one length of cable to attach a string to the coin!")
return
-
- else if(istype(W, /obj/item/wirecutters))
- if(!string_attached)
- ..()
- return
-
- var/obj/item/stack/cable_coil/CC = new/obj/item/stack/cable_coil(user.loc)
- CC.amount = 1
- CC.update_icon()
- overlays = list()
- string_attached = null
- to_chat(user, "You detach the string from the coin.")
else
..()
+/obj/item/coin/wirecutter_act(mob/living/user, obj/item/I)
+ if(!string_attached)
+ return TRUE
+
+ new /obj/item/stack/cable_coil(drop_location(), 1)
+ overlays = list()
+ string_attached = null
+ to_chat(user, "You detach the string from the coin.")
+ return TRUE
+
/obj/item/coin/attack_self(mob/user)
if(cooldown < world.time)
if(string_attached) //does the coin have a wire attached
diff --git a/code/modules/mining/satchel_ore_boxdm.dm b/code/modules/mining/satchel_ore_boxdm.dm
index 6c62b5a365..a9c660e554 100644
--- a/code/modules/mining/satchel_ore_boxdm.dm
+++ b/code/modules/mining/satchel_ore_boxdm.dm
@@ -9,23 +9,25 @@
density = TRUE
pressure_resistance = 5*ONE_ATMOSPHERE
-/obj/structure/ore_box/attackby(obj/item/W, mob/user, params)
- if (istype(W, /obj/item/stack/ore))
- user.transferItemToLoc(W, src)
- else if (istype(W, /obj/item/storage))
- var/obj/item/storage/S = W
+/obj/structure/ore_box/attackby(obj/item/I, mob/user, params)
+ if(istype(I, /obj/item/ore))
+ user.transferItemToLoc(I, src)
+ else if(istype(I, /obj/item/storage))
+ var/obj/item/storage/S = I
for(var/obj/item/stack/ore/O in S.contents)
S.remove_from_storage(O, src) //This will move the item to this item's contents
to_chat(user, "You empty the ore in [S] into \the [src].")
- else if(istype(W, /obj/item/crowbar))
- playsound(src, W.usesound, 50, 1)
- var/obj/item/crowbar/C = W
- if(do_after(user, 50*C.toolspeed, target = src))
- user.visible_message("[user] pries \the [src] apart.", "You pry apart \the [src].", "You hear splitting wood.")
- deconstruct(TRUE, user)
else
return ..()
+/obj/structure/ore_box/crowbar_act(mob/living/user, obj/item/I)
+ if(I.use_tool(src, user, 50, volume=50))
+ user.visible_message("[user] pries \the [src] apart.",
+ "You pry apart \the [src].",
+ "You hear splitting wood.")
+ deconstruct(TRUE, user)
+ return TRUE
+
/obj/structure/ore_box/examine(mob/living/user)
if(Adjacent(user) && istype(user))
show_contents(user)
diff --git a/code/modules/mob/inventory.dm b/code/modules/mob/inventory.dm
index f494f32f6f..ee21d21bb5 100644
--- a/code/modules/mob/inventory.dm
+++ b/code/modules/mob/inventory.dm
@@ -121,6 +121,19 @@
return I
return FALSE
+//Checks if we're holding a tool that has given quality
+//Returns the tool that has the best version of this quality
+/mob/proc/is_holding_tool_quality(quality)
+ var/obj/item/best_item
+ var/best_quality = INFINITY
+
+ for(var/obj/item/I in held_items)
+ if(I.tool_behaviour == quality && I.toolspeed < best_quality)
+ best_item = I
+ best_quality = I.toolspeed
+
+ return best_item
+
//To appropriately fluff things like "they are holding [I] in their [get_held_index_name(get_held_index_of_item(I))]"
//Can be overriden to pass off the fluff to something else (eg: science allowing people to add extra robotic limbs, and having this proc react to that
@@ -286,7 +299,7 @@
return doUnEquip(I, force, null, TRUE, idrop)
//DO NOT CALL THIS PROC
-//use one of the above 2 helper procs
+//use one of the above 3 helper procs
//you may override it, but do not modify the args
/mob/proc/doUnEquip(obj/item/I, force, newloc, no_move, invdrop = TRUE) //Force overrides NODROP_1 for things like wizarditis and admin undress.
//Use no_move if the item is just gonna be immediately moved afterward
diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm
index c2e0abb349..bc170eff68 100644
--- a/code/modules/mob/living/silicon/robot/robot.dm
+++ b/code/modules/mob/living/silicon/robot/robot.dm
@@ -355,24 +355,21 @@
/mob/living/silicon/robot/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/weldingtool) && (user.a_intent != INTENT_HARM || user == src))
user.changeNext_move(CLICK_CD_MELEE)
- var/obj/item/weldingtool/WT = W
if (!getBruteLoss())
to_chat(user, "[src] is already in good condition!")
return
- if (WT.remove_fuel(0, user)) //The welder has 1u of fuel consumed by it's afterattack, so we don't need to worry about taking any away.
- if(src == user)
- to_chat(user, "You start fixing yourself...")
- if(!do_after(user, 50, target = src))
- return
+ if (!W.tool_start_check(user, amount=0)) //The welder has 1u of fuel consumed by it's afterattack, so we don't need to worry about taking any away.
+ return
+ if(src == user)
+ to_chat(user, "You start fixing yourself...")
+ if(!W.use_tool(src, user, 50))
+ return
- adjustBruteLoss(-30)
- updatehealth()
- add_fingerprint(user)
- visible_message("[user] has fixed some of the dents on [src].")
- return
- else
- to_chat(user, "The welder must be on for this task!")
- return
+ adjustBruteLoss(-30)
+ updatehealth()
+ add_fingerprint(user)
+ visible_message("[user] has fixed some of the dents on [src].")
+ return
else if(istype(W, /obj/item/stack/cable_coil) && wiresexposed)
user.changeNext_move(CLICK_CD_MELEE)
@@ -444,9 +441,8 @@
spark_system.start()
return
else
- playsound(src, W.usesound, 50, 1)
to_chat(user, "You start to unfasten [src]'s securing bolts...")
- if(do_after(user, 50*W.toolspeed, target = src) && !cell)
+ if(W.use_tool(src, user, 50, volume=50) && !cell)
user.visible_message("[user] deconstructs [src]!", "You unfasten the securing bolts, and [src] falls to pieces!")
deconstruct()
diff --git a/code/modules/mob/living/simple_animal/bot/bot.dm b/code/modules/mob/living/simple_animal/bot/bot.dm
index 07499b0a1f..ac48f9e6d5 100644
--- a/code/modules/mob/living/simple_animal/bot/bot.dm
+++ b/code/modules/mob/living/simple_animal/bot/bot.dm
@@ -303,12 +303,10 @@
if(!open)
to_chat(user, "Unable to repair with the maintenance panel closed!")
return
- var/obj/item/weldingtool/WT = W
- if(WT.remove_fuel(0, user))
+
+ if(W.use_tool(src, user, 0, volume=40))
adjustHealth(-10)
user.visible_message("[user] repairs [src]!","You repair [src].")
- else
- to_chat(user, "The welder must be on for this task!")
else
if(W.force) //if force is non-zero
do_sparks(5, TRUE, src)
diff --git a/code/modules/mob/living/simple_animal/bot/construction.dm b/code/modules/mob/living/simple_animal/bot/construction.dm
index f2333ef713..274a252cc1 100644
--- a/code/modules/mob/living/simple_animal/bot/construction.dm
+++ b/code/modules/mob/living/simple_animal/bot/construction.dm
@@ -101,8 +101,7 @@
if(ASSEMBLY_FOURTH_STEP)
if(istype(W, /obj/item/weldingtool))
- var/obj/item/weldingtool/WT = W
- if(WT.remove_fuel(0,user))
+ if(W.use_tool(src, user, 0, volume=40))
name = "shielded frame assembly"
to_chat(user, "You weld the vest to [src].")
build_step++
@@ -183,9 +182,8 @@
if(8)
if(istype(W, /obj/item/screwdriver))
- playsound(loc, W.usesound, 100, 1)
to_chat(user, "You start attaching the gun to the frame...")
- if(do_after(user, 40*W.toolspeed, 0, src, 1))
+ if(W.use_tool(src, user, 40, volume=100))
name = "armed [name]"
to_chat(user, "Taser gun attached.")
build_step++
@@ -391,8 +389,7 @@
switch(build_step)
if(ASSEMBLY_FIRST_STEP)
if(istype(I, /obj/item/weldingtool))
- var/obj/item/weldingtool/WT = I
- if(WT.remove_fuel(0, user))
+ if(I.use_tool(src, user, 0, volume=40))
add_overlay("hs_hole")
to_chat(user, "You weld a hole in [src]!")
build_step++
@@ -414,8 +411,7 @@
build_step++
else if(istype(I, /obj/item/weldingtool)) //deconstruct
- var/obj/item/weldingtool/WT = I
- if(WT.remove_fuel(0, user))
+ if(I.use_tool(src, user, 0, volume=40))
cut_overlay("hs_hole")
to_chat(user, "You weld the hole in [src] shut!")
build_step--
diff --git a/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm b/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm
index dc2fb0eb09..ea4bb1d089 100644
--- a/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm
+++ b/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm
@@ -27,7 +27,7 @@
maxHealth = 30
unsuitable_atmos_damage = 0
wander = 0
- speed = -1
+ speed = 0
ventcrawler = VENTCRAWLER_ALWAYS
healable = 0
density = FALSE
diff --git a/code/modules/mob/living/simple_animal/friendly/drone/interaction.dm b/code/modules/mob/living/simple_animal/friendly/drone/interaction.dm
index 1ec3d204c1..2ee268014b 100644
--- a/code/modules/mob/living/simple_animal/friendly/drone/interaction.dm
+++ b/code/modules/mob/living/simple_animal/friendly/drone/interaction.dm
@@ -80,7 +80,7 @@
if(istype(I, /obj/item/screwdriver) && stat != DEAD)
if(health < maxHealth)
to_chat(user, "You start to tighten loose screws on [src]...")
- if(do_after(user,80*I.toolspeed,target=user))
+ if(I.use_tool(src, user, 80))
adjustBruteLoss(-getBruteLoss())
visible_message("[user] tightens [src == user ? "[user.p_their()]" : "[src]'s"] loose screws!", "You tighten [src == user ? "your" : "[src]'s"] loose screws.")
else
@@ -91,12 +91,10 @@
else if(istype(I, /obj/item/wrench) && user != src) //They aren't required to be hacked, because laws can change in other ways (i.e. admins)
user.visible_message("[user] starts resetting [src]...", \
"You press down on [src]'s factory reset control...")
- playsound(src, I.usesound, 50, 1)
- if(!do_after(user, 50*I.toolspeed, target = src))
- return
- user.visible_message("[user] resets [src]!", \
- "You reset [src]'s directives to factory defaults!")
- update_drone_hack(FALSE)
+ if(I.use_tool(src, user, 50, volume=50))
+ user.visible_message("[user] resets [src]!", \
+ "You reset [src]'s directives to factory defaults!")
+ update_drone_hack(FALSE)
return
else
..()
diff --git a/code/modules/mob/living/simple_animal/friendly/farm_animals.dm b/code/modules/mob/living/simple_animal/friendly/farm_animals.dm
index 57ed8720bf..7ebd88d22e 100644
--- a/code/modules/mob/living/simple_animal/friendly/farm_animals.dm
+++ b/code/modules/mob/living/simple_animal/friendly/farm_animals.dm
@@ -253,7 +253,7 @@
pass_flags = PASSTABLE | PASSMOB
mob_size = MOB_SIZE_SMALL
var/list/feedMessages = list("It clucks happily.","It clucks happily.")
- var/list/layMessage = list("lays an egg.","squats down and croons.","begins making a huge racket.","begins clucking raucously.")
+ var/list/layMessage = EGG_LAYING_MESSAGES
var/list/validColors = list("brown","black","white")
gold_core_spawnable = FRIENDLY_SPAWN
var/static/chicken_count = 0
@@ -290,7 +290,7 @@
if(!.)
return
if((!stat && prob(3) && eggsleft > 0) && egg_type)
- visible_message("[src] [pick(layMessage)]")
+ visible_message("[src] [pick(layMessage)]")
eggsleft--
var/obj/item/E = new egg_type(get_turf(src))
E.pixel_x = rand(-6,6)
diff --git a/code/modules/modular_computers/computers/item/computer.dm b/code/modules/modular_computers/computers/item/computer.dm
index 03e57c5ec6..e1cc2f3cb6 100644
--- a/code/modules/modular_computers/computers/item/computer.dm
+++ b/code/modules/modular_computers/computers/item/computer.dm
@@ -393,18 +393,15 @@
return
if(istype(W, /obj/item/weldingtool))
- var/obj/item/weldingtool/WT = W
- if(!WT.isOn())
- to_chat(user, "\The [W] is off.")
- return
-
if(obj_integrity == max_integrity)
to_chat(user, "\The [src] does not require repairs.")
return
+ if(!W.tool_start_check(user, amount=1))
+ return
+
to_chat(user, "You begin repairing damage to \the [src]...")
- var/dmg = round(max_integrity - obj_integrity)
- if(WT.remove_fuel(round(dmg/75)) && do_after(usr, dmg/10))
+ if(W.use_tool(src, user, 20, volume=50, amount=1))
obj_integrity = max_integrity
to_chat(user, "You repair \the [src].")
return
diff --git a/code/modules/paperwork/filingcabinet.dm b/code/modules/paperwork/filingcabinet.dm
index fed93fabd3..6f7c99dac8 100644
--- a/code/modules/paperwork/filingcabinet.dm
+++ b/code/modules/paperwork/filingcabinet.dm
@@ -56,8 +56,7 @@
updateUsrDialog()
else if(istype(P, /obj/item/wrench))
to_chat(user, "You begin to [anchored ? "unwrench" : "wrench"] [src].")
- playsound(loc, P.usesound, 50, 1)
- if(do_after(user, 20, target = src))
+ if(P.use_tool(src, user, 20, volume=50))
to_chat(user, "You successfully [anchored ? "unwrench" : "wrench"] [src].")
anchored = !anchored
else if(user.a_intent != INTENT_HARM)
diff --git a/code/modules/paperwork/paper_cutter.dm b/code/modules/paperwork/paper_cutter.dm
index df69e9548a..92543bad90 100644
--- a/code/modules/paperwork/paper_cutter.dm
+++ b/code/modules/paperwork/paper_cutter.dm
@@ -60,7 +60,7 @@
update_icon()
return
if(istype(P, /obj/item/screwdriver) && storedcutter)
- playsound(src, P.usesound, 50, 1)
+ P.play_tool_sound(src)
to_chat(user, "[storedcutter] has been [cuttersecured ? "unsecured" : "secured"].")
cuttersecured = !cuttersecured
return
diff --git a/code/modules/paperwork/photography.dm b/code/modules/paperwork/photography.dm
index 14aad9c7b7..b28b076812 100644
--- a/code/modules/paperwork/photography.dm
+++ b/code/modules/paperwork/photography.dm
@@ -42,9 +42,9 @@
/obj/item/photo/suicide_act(mob/living/carbon/user)
user.visible_message("[user] is taking one last look at \the [src]! It looks like [user.p_theyre()] giving in to death!")//when you wanna look at photo of waifu one last time before you die...
- if (user.gender == MALE)
+ if (user.gender == MALE)
playsound(user, 'sound/voice/human/manlaugh1.ogg', 50, 1)//EVERY TIME I DO IT MAKES ME LAUGH
- else if (user.gender == FEMALE)
+ else if (user.gender == FEMALE)
playsound(user, 'sound/voice/human/womanlaugh.ogg', 50, 1)
return OXYLOSS
@@ -609,11 +609,10 @@
/obj/structure/sign/picture_frame/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/screwdriver) || istype(I, /obj/item/wrench))
to_chat(user, "You start unsecuring [name]...")
- playsound(loc, I.usesound, 50, 1)
- if(do_after(user, 30*I.toolspeed, target = src))
+ if(I.use_tool(src, user, 30, volume=50))
playsound(loc, 'sound/items/deconstruct.ogg', 50, 1)
to_chat(user, "You unsecure [name].")
- deconstruct()
+ deconstruct()
return
else if(istype(I, /obj/item/photo))
diff --git a/code/modules/power/antimatter/control.dm b/code/modules/power/antimatter/control.dm
index f8b8cae22a..cfbb3d199b 100644
--- a/code/modules/power/antimatter/control.dm
+++ b/code/modules/power/antimatter/control.dm
@@ -159,14 +159,14 @@
/obj/machinery/power/am_control_unit/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/wrench))
if(!anchored)
- playsound(src.loc, W.usesound, 75, 1)
+ W.play_tool_sound(src, 75)
user.visible_message("[user.name] secures the [src.name] to the floor.", \
"You secure the anchor bolts to the floor.", \
"You hear a ratchet.")
src.anchored = TRUE
connect_to_network()
else if(!linked_shielding.len > 0)
- playsound(src.loc, W.usesound, 75, 1)
+ W.play_tool_sound(src, 75)
user.visible_message("[user.name] unsecures the [src.name].", \
"You remove the anchor bolts.", \
"You hear a ratchet.")
diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm
index a99ccd4d14..c68b2bedb0 100644
--- a/code/modules/power/apc.dm
+++ b/code/modules/power/apc.dm
@@ -383,9 +383,9 @@
if (terminal)
to_chat(user, "Disconnect the wires first!")
return
- playsound(src.loc, W.usesound, 50, 1)
+ W.play_tool_sound(src)
to_chat(user, "You are trying to remove the power control board..." )
- if(do_after(user, 50*W.toolspeed, target = src))
+ if(W.use_tool(src, user, 50))
if (has_electronics==1)
has_electronics = 0
if (stat & BROKEN)
@@ -417,13 +417,12 @@
else if(integration_cog)
user.visible_message("[user] starts prying [integration_cog] from [src]...", \
"You painstakingly start tearing [integration_cog] out of [src]'s guts...")
- playsound(src, W.usesound, 50, TRUE)
- if(!do_after(user, 100 * W.toolspeed, target = src))
- return
- user.visible_message("[user] destroys [integration_cog] in [src]!", \
- "[integration_cog] comes free with a clank and snaps in two as the machinery returns to normal!")
- playsound(src, 'sound/items/deconstruct.ogg', 50, TRUE)
- QDEL_NULL(integration_cog)
+ W.play_tool_sound(src)
+ if(W.use_tool(src, user, 100))
+ user.visible_message("[user] destroys [integration_cog] in [src]!", \
+ "[integration_cog] comes free with a clank and snaps in two as the machinery returns to normal!")
+ playsound(src, 'sound/items/deconstruct.ogg', 50, TRUE)
+ QDEL_NULL(integration_cog)
return
else if (opened!=2) //cover isn't removed
opened = 0
@@ -468,12 +467,12 @@
if (has_electronics==1)
has_electronics = 2
stat &= ~MAINT
- playsound(src.loc, W.usesound, 50, 1)
+ W.play_tool_sound(src)
to_chat(user, "You screw the circuit electronics into place.")
else if (has_electronics==2)
has_electronics = 1
stat |= MAINT
- playsound(src.loc, W.usesound, 50, 1)
+ W.play_tool_sound(src)
to_chat(user, "You unfasten the electronics.")
else /* has_electronics==0 */
to_chat(user, "There is nothing to secure!")
@@ -578,17 +577,12 @@
return
else if (istype(W, /obj/item/weldingtool) && opened && has_electronics==0 && !terminal)
- var/obj/item/weldingtool/WT = W
- if (WT.get_fuel() < 3)
- to_chat(user, "You need more welding fuel to complete this task!")
+ if(!W.tool_start_check(user, amount=3))
return
user.visible_message("[user.name] welds [src].", \
"You start welding the APC frame...", \
"You hear welding.")
- playsound(src.loc, WT.usesound, 50, 1)
- if(do_after(user, 50*W.toolspeed, target = src))
- if(!src || !WT.remove_fuel(3, user))
- return
+ if(W.use_tool(src, user, 50, volume=50, amount=3))
if ((stat & BROKEN) || opened==2)
new /obj/item/stack/sheet/metal(loc)
user.visible_message(\
@@ -911,6 +905,8 @@
return 1
/obj/machinery/power/apc/proc/toggle_breaker()
+ if(!is_operational() || failure_timer)
+ return
operating = !operating
update()
update_icon()
diff --git a/code/modules/power/cable.dm b/code/modules/power/cable.dm
index 883df8a6c9..289c78b712 100644
--- a/code/modules/power/cable.dm
+++ b/code/modules/power/cable.dm
@@ -471,6 +471,7 @@ GLOBAL_LIST_INIT(cable_coil_recipes, list (new/datum/stack_recipe("cable restrai
singular_name = "cable piece"
full_w_class = WEIGHT_CLASS_SMALL
grind_results = list("copper" = 2) //2 copper per cable in the coil
+ usesound = 'sound/items/deconstruct.ogg'
/obj/item/stack/cable_coil/cyborg
is_cyborg = 1
diff --git a/code/modules/power/cell.dm b/code/modules/power/cell.dm
index c985302509..da8608ce9f 100644
--- a/code/modules/power/cell.dm
+++ b/code/modules/power/cell.dm
@@ -70,7 +70,7 @@
return 100*charge/maxcharge
// use power from a cell
-/obj/item/stock_parts/cell/proc/use(amount)
+/obj/item/stock_parts/cell/use(amount)
if(rigged && amount > 0)
explode()
return 0
diff --git a/code/modules/power/gravitygenerator.dm b/code/modules/power/gravitygenerator.dm
index 6afb080897..cb7c9b1a69 100644
--- a/code/modules/power/gravitygenerator.dm
+++ b/code/modules/power/gravitygenerator.dm
@@ -188,20 +188,16 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne
if(GRAV_NEEDS_SCREWDRIVER)
if(istype(I, /obj/item/screwdriver))
to_chat(user, "You secure the screws of the framework.")
- playsound(src.loc, I.usesound, 50, 1)
+ I.play_tool_sound(src)
broken_state++
update_icon()
return
if(GRAV_NEEDS_WELDING)
if(istype(I, /obj/item/weldingtool))
- var/obj/item/weldingtool/WT = I
- if(WT.remove_fuel(1, user))
+ if(I.use_tool(src, user, 0, volume=50, amount=1))
to_chat(user, "You mend the damaged framework.")
- playsound(src.loc, 'sound/items/welder2.ogg', 50, 1)
broken_state++
update_icon()
- else if(WT.isOn())
- to_chat(user, "You don't have enough fuel to mend the damaged framework!")
return
if(GRAV_NEEDS_PLASTEEL)
if(istype(I, /obj/item/stack/sheet/plasteel))
@@ -218,7 +214,7 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne
if(GRAV_NEEDS_WRENCH)
if(istype(I, /obj/item/wrench))
to_chat(user, "You secure the plating to the framework.")
- playsound(src.loc, I.usesound, 75, 1)
+ I.play_tool_sound(src)
set_fix()
return
return ..()
diff --git a/code/modules/power/lighting.dm b/code/modules/power/lighting.dm
index 0ee64aa9c1..022b1f7d5b 100644
--- a/code/modules/power/lighting.dm
+++ b/code/modules/power/lighting.dm
@@ -109,25 +109,19 @@
switch(stage)
if(1)
if(istype(W, /obj/item/wrench))
- playsound(src.loc, W.usesound, 75, 1)
to_chat(usr, "You begin deconstructing [src]...")
- if (!do_after(usr, 30*W.toolspeed, target = src))
- return
- new /obj/item/stack/sheet/metal( get_turf(src.loc), sheets_refunded )
- user.visible_message("[user.name] deconstructs [src].", \
- "You deconstruct [src].", "You hear a ratchet.")
- playsound(src.loc, 'sound/items/deconstruct.ogg', 75, 1)
- qdel(src)
+ if (W.use_tool(src, user, 30, volume=50))
+ new /obj/item/stack/sheet/metal(drop_location(), sheets_refunded)
+ user.visible_message("[user.name] deconstructs [src].", \
+ "You deconstruct [src].", "You hear a ratchet.")
+ playsound(src.loc, 'sound/items/deconstruct.ogg', 75, 1)
+ qdel(src)
return
if(istype(W, /obj/item/stack/cable_coil))
var/obj/item/stack/cable_coil/coil = W
if(coil.use(1))
- switch(fixture_type)
- if ("tube")
- icon_state = "tube-construct-stage2"
- if("bulb")
- icon_state = "bulb-construct-stage2"
+ icon_state = "[fixture_type]-construct-stage2"
stage = 2
user.visible_message("[user.name] adds wires to [src].", \
"You add wires to [src].")
@@ -141,25 +135,21 @@
if(istype(W, /obj/item/wirecutters))
stage = 1
- switch(fixture_type)
- if ("tube")
- icon_state = "tube-construct-stage1"
- if("bulb")
- icon_state = "bulb-construct-stage1"
- new /obj/item/stack/cable_coil(get_turf(loc), 1, "red")
+ icon_state = "[fixture_type]-construct-stage1"
+ new /obj/item/stack/cable_coil(drop_location(), 1, "red")
user.visible_message("[user.name] removes the wiring from [src].", \
"You remove the wiring from [src].", "You hear clicking.")
- playsound(loc, W.usesound, 100, 1)
+ W.play_tool_sound(src, 100)
return
if(istype(W, /obj/item/screwdriver))
user.visible_message("[user.name] closes [src]'s casing.", \
"You close [src]'s casing.", "You hear screwing.")
- playsound(loc, W.usesound, 75, 1)
+ W.play_tool_sound(src, 75)
switch(fixture_type)
if("tube")
newlight = new /obj/machinery/light/built(loc)
- if ("bulb")
+ if("bulb")
newlight = new /obj/machinery/light/small/built(loc)
newlight.setDir(dir)
transfer_fingerprints_to(newlight)
@@ -429,7 +419,7 @@
// attempt to stick weapon into light socket
else if(status == LIGHT_EMPTY)
if(istype(W, /obj/item/screwdriver)) //If it's a screwdriver open it.
- playsound(src.loc, W.usesound, 75, 1)
+ W.play_tool_sound(src, 75)
user.visible_message("[user.name] opens [src]'s casing.", \
"You open [src]'s casing.", "You hear a noise.")
deconstruct()
diff --git a/code/modules/power/port_gen.dm b/code/modules/power/port_gen.dm
index ba3379df45..dc8e6e0793 100644
--- a/code/modules/power/port_gen.dm
+++ b/code/modules/power/port_gen.dm
@@ -195,7 +195,7 @@
return
else if(istype(O, /obj/item/screwdriver))
panel_open = !panel_open
- playsound(src.loc, O.usesound, 50, 1)
+ O.play_tool_sound(src)
if(panel_open)
to_chat(user, "You open the access panel.")
else
diff --git a/code/modules/power/singularity/emitter.dm b/code/modules/power/singularity/emitter.dm
index c7a026dd83..507fdcaa66 100644
--- a/code/modules/power/singularity/emitter.dm
+++ b/code/modules/power/singularity/emitter.dm
@@ -207,10 +207,16 @@
return P
/obj/machinery/power/emitter/can_be_unfasten_wrench(mob/user, silent)
- if(state == EM_WELDED)
+ if(active)
+ if(!silent)
+ to_chat(user, "Turn \the [src] off first!")
+ return FAILED_UNFASTEN
+
+ else if(state == EM_WELDED)
if(!silent)
to_chat(user, "[src] is welded to the floor!")
return FAILED_UNFASTEN
+
return ..()
/obj/machinery/power/emitter/default_unfasten_wrench(mob/user, obj/item/wrench/W, time = 20)
@@ -221,45 +227,52 @@
else
state = EM_UNSECURED
-/obj/machinery/power/emitter/attackby(obj/item/W, mob/user, params)
- if(istype(W, /obj/item/wrench))
- if(active)
- to_chat(user, "Turn \the [src] off first!")
- return
- default_unfasten_wrench(user, W, 0)
- return
+/obj/machinery/power/emitter/wrench_act(mob/living/user, obj/item/I)
+ default_unfasten_wrench(user, I, 0)
+ return TRUE
- if(istype(W, /obj/item/weldingtool))
- var/obj/item/weldingtool/WT = W
- if(active)
- to_chat(user, "Turn \the [src] off first.")
- return
- switch(state)
- if(EM_UNSECURED)
- to_chat(user, "The [src.name] needs to be wrenched to the floor!")
- if(EM_SECURED)
- if(WT.remove_fuel(0,user))
- playsound(loc, WT.usesound, 50, 1)
- user.visible_message("[user.name] starts to weld the [name] to the floor.", \
- "You start to weld \the [src] to the floor...", \
- "You hear welding.")
- if(do_after(user,20*W.toolspeed, target = src) && WT.isOn())
- state = EM_WELDED
- to_chat(user, "You weld \the [src] to the floor.")
- connect_to_network()
- if(EM_WELDED)
- if(WT.remove_fuel(0,user))
- playsound(loc, WT.usesound, 50, 1)
- user.visible_message("[user.name] starts to cut the [name] free from the floor.", \
- "You start to cut \the [src] free from the floor...", \
- "You hear welding.")
- if(do_after(user,20*W.toolspeed, target = src) && WT.isOn())
- state = EM_SECURED
- to_chat(user, "You cut \the [src] free from the floor.")
- disconnect_from_network()
- return
+/obj/machinery/power/emitter/welder_act(mob/living/user, obj/item/I)
+ if(active)
+ to_chat(user, "Turn \the [src] off first.")
+ return TRUE
- if(W.GetID())
+ switch(state)
+ if(EM_UNSECURED)
+ to_chat(user, "The [src.name] needs to be wrenched to the floor!")
+ if(EM_SECURED)
+ if(!I.tool_start_check(user, amount=0))
+ return TRUE
+ user.visible_message("[user.name] starts to weld the [name] to the floor.", \
+ "You start to weld \the [src] to the floor...", \
+ "You hear welding.")
+ if(I.use_tool(src, user, 20, volume=50))
+ state = EM_WELDED
+ to_chat(user, "You weld \the [src] to the floor.")
+ connect_to_network()
+ if(EM_WELDED)
+ if(!I.tool_start_check(user, amount=0))
+ return TRUE
+ user.visible_message("[user.name] starts to cut the [name] free from the floor.", \
+ "You start to cut \the [src] free from the floor...", \
+ "You hear welding.")
+ if(I.use_tool(src, user, 20, volume=50))
+ state = EM_SECURED
+ to_chat(user, "You cut \the [src] free from the floor.")
+ disconnect_from_network()
+
+ return TRUE
+
+/obj/machinery/power/emitter/crowbar_act(mob/living/user, obj/item/I)
+ default_deconstruction_crowbar(I)
+ return TRUE
+
+/obj/machinery/power/emitter/screwdriver_act(mob/living/user, obj/item/I)
+ default_deconstruction_screwdriver(user, "emitter_open", "emitter", I)
+ return TRUE
+
+
+/obj/machinery/power/emitter/attackby(obj/item/I, mob/user, params)
+ if(I.GetID())
if(obj_flags & EMAGGED)
to_chat(user, "The lock seems to be broken!")
return
@@ -273,20 +286,11 @@
to_chat(user, "Access denied.")
return
- if(is_wire_tool(W) && panel_open)
+ else if(is_wire_tool(I) && panel_open)
wires.interact(user)
return
- if(default_deconstruction_screwdriver(user, "emitter_open", "emitter", W))
- return
-
- if(exchange_parts(user, W))
- return
-
- if(default_pry_open(W))
- return
-
- if(default_deconstruction_crowbar(W))
+ else if(exchange_parts(user, I))
return
return ..()
diff --git a/code/modules/power/singularity/field_generator.dm b/code/modules/power/singularity/field_generator.dm
index cdfbb35b34..4f39d34954 100644
--- a/code/modules/power/singularity/field_generator.dm
+++ b/code/modules/power/singularity/field_generator.dm
@@ -77,10 +77,16 @@ field_generator power level display
to_chat(user, "[src] needs to be firmly secured to the floor first!")
/obj/machinery/field/generator/can_be_unfasten_wrench(mob/user, silent)
- if(state == FG_WELDED)
+ if(active)
+ if(!silent)
+ to_chat(user, "Turn \the [src] off first!")
+ return FAILED_UNFASTEN
+
+ else if(state == FG_WELDED)
if(!silent)
to_chat(user, "[src] is welded to the floor!")
return FAILED_UNFASTEN
+
return ..()
/obj/machinery/field/generator/default_unfasten_wrench(mob/user, obj/item/wrench/W, time = 20)
@@ -91,41 +97,41 @@ field_generator power level display
else
state = FG_UNSECURED
-/obj/machinery/field/generator/attackby(obj/item/W, mob/user, params)
+/obj/machinery/field/generator/wrench_act(mob/living/user, obj/item/I)
+ default_unfasten_wrench(user, I, 0)
+ return TRUE
+
+/obj/machinery/field/generator/welder_act(mob/living/user, obj/item/I)
if(active)
to_chat(user, "[src] needs to be off!")
- return
- else if(istype(W, /obj/item/wrench))
- default_unfasten_wrench(user, W, 0)
+ return TRUE
- else if(istype(W, /obj/item/weldingtool))
- var/obj/item/weldingtool/WT = W
- switch(state)
- if(FG_UNSECURED)
- to_chat(user, "[src] needs to be wrenched to the floor!")
+ switch(state)
+ if(FG_UNSECURED)
+ to_chat(user, "[src] needs to be wrenched to the floor!")
- if(FG_SECURED)
- if (WT.remove_fuel(0,user))
- playsound(loc, WT.usesound, 50, 1)
- user.visible_message("[user] starts to weld [src] to the floor.", \
- "You start to weld \the [src] to the floor...", \
- "You hear welding.")
- if(do_after(user,20*W.toolspeed, target = src) && state == FG_SECURED && WT.isOn())
- state = FG_WELDED
- to_chat(user, "You weld the field generator to the floor.")
+ if(FG_SECURED)
+ if(!I.tool_start_check(user, amount=0))
+ return TRUE
+ user.visible_message("[user] starts to weld [src] to the floor.", \
+ "You start to weld \the [src] to the floor...", \
+ "You hear welding.")
+ if(I.use_tool(src, user, 20, volume=50) && state == FG_SECURED)
+ state = FG_WELDED
+ to_chat(user, "You weld the field generator to the floor.")
- if(FG_WELDED)
- if (WT.remove_fuel(0,user))
- playsound(loc, WT.usesound, 50, 1)
- user.visible_message("[user] starts to cut [src] free from the floor.", \
- "You start to cut \the [src] free from the floor...", \
- "You hear welding.")
- if(do_after(user,20*W.toolspeed, target = src) && state == FG_WELDED && WT.isOn())
- state = FG_SECURED
- to_chat(user, "You cut \the [src] free from the floor.")
+ if(FG_WELDED)
+ if(!I.tool_start_check(user, amount=0))
+ return TRUE
+ user.visible_message("[user] starts to cut [src] free from the floor.", \
+ "You start to cut \the [src] free from the floor...", \
+ "You hear welding.")
+ if(I.use_tool(src, user, 20, volume=50) && state == FG_WELDED)
+ state = FG_SECURED
+ to_chat(user, "You cut \the [src] free from the floor.")
+
+ return TRUE
- else
- return ..()
/obj/machinery/field/generator/attack_animal(mob/living/simple_animal/M)
if(M.environment_smash & ENVIRONMENT_SMASH_RWALLS && active == FG_OFFLINE && state != FG_UNSECURED)
diff --git a/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm b/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm
index 3658be4522..b7808abc1f 100644
--- a/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm
+++ b/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm
@@ -65,7 +65,7 @@
switch(construction_state)
if(PA_CONSTRUCTION_UNSECURED)
if(istype(W, /obj/item/wrench) && !isinspace())
- playsound(loc, W.usesound, 75, 1)
+ W.play_tool_sound(src, 75)
anchored = TRUE
user.visible_message("[user.name] secures the [name] to the floor.", \
"You secure the external bolts.")
@@ -73,7 +73,7 @@
did_something = TRUE
if(PA_CONSTRUCTION_UNWIRED)
if(istype(W, /obj/item/wrench))
- playsound(loc, W.usesound, 75, 1)
+ W.play_tool_sound(src, 75)
anchored = FALSE
user.visible_message("[user.name] detaches the [name] from the floor.", \
"You remove the external bolts.")
diff --git a/code/modules/power/singularity/particle_accelerator/particle_control.dm b/code/modules/power/singularity/particle_accelerator/particle_control.dm
index c1ba907ada..9d5ff2dd81 100644
--- a/code/modules/power/singularity/particle_accelerator/particle_control.dm
+++ b/code/modules/power/singularity/particle_accelerator/particle_control.dm
@@ -270,7 +270,7 @@
switch(construction_state)
if(PA_CONSTRUCTION_UNSECURED)
if(istype(W, /obj/item/wrench) && !isinspace())
- playsound(loc, W.usesound, 75, 1)
+ W.play_tool_sound(src, 75)
anchored = TRUE
user.visible_message("[user.name] secures the [name] to the floor.", \
"You secure the external bolts.")
@@ -278,7 +278,7 @@
did_something = TRUE
if(PA_CONSTRUCTION_UNWIRED)
if(istype(W, /obj/item/wrench))
- playsound(loc, W.usesound, 75, 1)
+ W.play_tool_sound(src, 75)
anchored = FALSE
user.visible_message("[user.name] detaches the [name] from the floor.", \
"You remove the external bolts.")
diff --git a/code/modules/power/solar.dm b/code/modules/power/solar.dm
index 5701ae0ed6..81cf66c26a 100644
--- a/code/modules/power/solar.dm
+++ b/code/modules/power/solar.dm
@@ -56,16 +56,14 @@
obj_integrity = max_integrity
update_icon()
-/obj/machinery/power/solar/attackby(obj/item/W, mob/user, params)
- if(istype(W, /obj/item/crowbar))
- playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
- user.visible_message("[user] begins to take the glass off the solar panel.", "You begin to take the glass off the solar panel...")
- if(do_after(user, 50*W.toolspeed, target = src))
- playsound(src.loc, 'sound/items/deconstruct.ogg', 50, 1)
- user.visible_message("[user] takes the glass off the solar panel.", "You take the glass off the solar panel.")
- deconstruct(TRUE)
- else
- return ..()
+/obj/machinery/power/solar/crowbar_act(mob/user, obj/item/I)
+ playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
+ user.visible_message("[user] begins to take the glass off [src].", "You begin to take the glass off [src]...")
+ if(I.use_tool(src, user, 50))
+ playsound(src.loc, 'sound/items/deconstruct.ogg', 50, 1)
+ user.visible_message("[user] takes the glass off [src].", "You take the glass off [src].")
+ deconstruct(TRUE)
+ return TRUE
/obj/machinery/power/solar/play_attack_sound(damage_amount, damage_type = BRUTE, damage_flag = 0)
switch(damage_type)
@@ -214,10 +212,10 @@
anchored = !anchored
if(anchored)
user.visible_message("[user] wrenches the solar assembly into place.", "You wrench the solar assembly into place.")
- playsound(src.loc, W.usesound, 75, 1)
+ W.play_tool_sound(src, 75)
else
user.visible_message("[user] unwrenches the solar assembly from its place.", "You unwrench the solar assembly from its place.")
- playsound(src.loc, W.usesound, 75, 1)
+ W.play_tool_sound(src, 75)
return 1
if(istype(W, /obj/item/stack/sheet/glass) || istype(W, /obj/item/stack/sheet/rglass))
@@ -407,8 +405,7 @@
/obj/machinery/power/solar_control/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/screwdriver))
- playsound(src.loc, I.usesound, 50, 1)
- if(do_after(user, 20*I.toolspeed, target = src))
+ if(I.use_tool(src, user, 20, volume=50))
if (src.stat & BROKEN)
to_chat(user, "The broken glass falls out.")
var/obj/structure/frame/computer/A = new /obj/structure/frame/computer( src.loc )
diff --git a/code/modules/power/supermatter/supermatter.dm b/code/modules/power/supermatter/supermatter.dm
index ab4cdca105..0123919eb9 100644
--- a/code/modules/power/supermatter/supermatter.dm
+++ b/code/modules/power/supermatter/supermatter.dm
@@ -531,19 +531,11 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_shard)
if(!istype(W) || (W.flags_1 & ABSTRACT_1) || !istype(user))
return
if(istype(W, /obj/item/scalpel/supermatter))
- var/obj/item/scalpel/supermatter/scalpel = W
- playsound(src, W.usesound, 100, 1)
- to_chat(user, "You carefully begin to scrape [src] with [W]...")
- if(do_after(user, 60 * W.toolspeed, TRUE, src))
- if (scalpel.usesLeft)
- to_chat(user, "You extract a sliver from [src]. [src] begins to react violently!")
- new /obj/item/nuke_core/supermatter_sliver(drop_location())
- matter_power += 200
- scalpel.usesLeft--
- if (!scalpel.usesLeft)
- to_chat(user, "A tiny piece of [W] falls off, rendering it useless!")
- else
- to_chat(user, "You fail to extract a sliver from [src]. [W] isn't sharp enough anymore!")
+ to_chat(user, "You carefully begin to scrape \the [src] with \the [W]...")
+ if(W.use_tool(src, user, 60, volume=100))
+ to_chat(user, "You extract a sliver from \the [src]. \The [src] begins to react violently!")
+ new /obj/item/nuke_core/supermatter_sliver(drop_location())
+ matter_power += 200
else if(user.dropItemToGround(W))
user.visible_message("As [user] touches \the [src] with \a [W], silence fills the room...",\
"You touch \the [src] with \the [W], and everything suddenly goes silent.\n\The [W] flashes into dust as you flinch away from \the [src].",\
diff --git a/code/modules/power/terminal.dm b/code/modules/power/terminal.dm
index b6d086f739..837a2b15c7 100644
--- a/code/modules/power/terminal.dm
+++ b/code/modules/power/terminal.dm
@@ -48,26 +48,31 @@
. = 1
-/obj/machinery/power/terminal/proc/dismantle(mob/living/user, obj/item/W)
+/obj/machinery/power/terminal/proc/dismantle(mob/living/user, obj/item/I)
if(isturf(loc))
var/turf/T = loc
if(T.intact)
to_chat(user, "You must first expose the power terminal!")
return
- if(!master || master.can_terminal_dismantle())
- user.visible_message("[user.name] dismantles the power terminal from [master].", \
- "You begin to cut the cables...")
+ if(master && !master.can_terminal_dismantle())
+ return
- playsound(src.loc, 'sound/items/deconstruct.ogg', 50, 1)
- if(do_after(user, 50*W.toolspeed, target = src))
- if(!master || master.can_terminal_dismantle())
- if(prob(50) && electrocute_mob(user, powernet, src, 1, TRUE))
- do_sparks(5, TRUE, master)
- return
- new /obj/item/stack/cable_coil(loc, 10)
- to_chat(user, "You cut the cables and dismantle the power terminal.")
- qdel(src)
+ user.visible_message("[user.name] dismantles the power terminal from [master].",
+ "You begin to cut the cables...")
+
+ playsound(src.loc, 'sound/items/deconstruct.ogg', 50, 1)
+ if(I.use_tool(src, user, 50))
+ if(master && !master.can_terminal_dismantle())
+ return
+
+ if(prob(50) && electrocute_mob(user, powernet, src, 1, TRUE))
+ do_sparks(5, TRUE, master)
+ return
+
+ new /obj/item/stack/cable_coil(drop_location(), 10)
+ to_chat(user, "You cut the cables and dismantle the power terminal.")
+ qdel(src)
/obj/machinery/power/terminal/attackby(obj/item/W, mob/living/user, params)
diff --git a/code/modules/power/tracker.dm b/code/modules/power/tracker.dm
index 3163a72313..c999554d87 100644
--- a/code/modules/power/tracker.dm
+++ b/code/modules/power/tracker.dm
@@ -60,17 +60,14 @@
if(powernet && (powernet == control.powernet)) //update if we're still in the same powernet
control.currentdir = angle
-/obj/machinery/power/tracker/attackby(obj/item/W, mob/user, params)
-
- if(istype(W, /obj/item/crowbar))
- playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
- user.visible_message("[user] begins to take the glass off the solar tracker.", "You begin to take the glass off the solar tracker...")
- if(do_after(user, 50*W.toolspeed, target = src))
- playsound(src.loc, 'sound/items/deconstruct.ogg', 50, 1)
- user.visible_message("[user] takes the glass off the tracker.", "You take the glass off the tracker.")
- deconstruct(TRUE)
- else
- return ..()
+/obj/machinery/power/tracker/crowbar_act(mob/user, obj/item/I)
+ playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
+ user.visible_message("[user] begins to take the glass off [src].", "You begin to take the glass off [src]...")
+ if(I.use_tool(src, user, 50))
+ playsound(src.loc, 'sound/items/deconstruct.ogg', 50, 1)
+ user.visible_message("[user] takes the glass off [src].", "You take the glass off [src].")
+ deconstruct(TRUE)
+ return TRUE
/obj/machinery/power/tracker/obj_break(damage_flag)
if(!(stat & BROKEN) && !(flags_1 & NODECONSTRUCT_1))
diff --git a/code/modules/projectiles/guns/ballistic/revolver.dm b/code/modules/projectiles/guns/ballistic/revolver.dm
index 692d9b4733..14e529ba23 100644
--- a/code/modules/projectiles/guns/ballistic/revolver.dm
+++ b/code/modules/projectiles/guns/ballistic/revolver.dm
@@ -107,35 +107,34 @@
return 0
..()
-/obj/item/gun/ballistic/revolver/detective/attackby(obj/item/A, mob/user, params)
- ..()
- if(istype(A, /obj/item/screwdriver))
- if(magazine.caliber == "38")
- to_chat(user, "You begin to reinforce the barrel of [src]...")
+/obj/item/gun/ballistic/revolver/detective/screwdriver_act(mob/living/user, obj/item/I)
+ if(magazine.caliber == "38")
+ to_chat(user, "You begin to reinforce the barrel of [src]...")
+ if(magazine.ammo_count())
+ afterattack(user, user) //you know the drill
+ user.visible_message("[src] goes off!", "[src] goes off in your face!")
+ return TRUE
+ if(I.use_tool(src, user, 30))
if(magazine.ammo_count())
- afterattack(user, user) //you know the drill
- user.visible_message("[src] goes off!", "[src] goes off in your face!")
- return
- if(do_after(user, 30*A.toolspeed, target = src))
- if(magazine.ammo_count())
- to_chat(user, "You can't modify it!")
- return
- magazine.caliber = "357"
- desc = "The barrel and chamber assembly seems to have been modified."
- to_chat(user, "You reinforce the barrel of [src]. Now it will fire .357 rounds.")
- else
- to_chat(user, "You begin to revert the modifications to [src]...")
+ to_chat(user, "You can't modify it!")
+ return TRUE
+ magazine.caliber = "357"
+ desc = "The barrel and chamber assembly seems to have been modified."
+ to_chat(user, "You reinforce the barrel of [src]. Now it will fire .357 rounds.")
+ else
+ to_chat(user, "You begin to revert the modifications to [src]...")
+ if(magazine.ammo_count())
+ afterattack(user, user) //and again
+ user.visible_message("[src] goes off!", "[src] goes off in your face!")
+ return TRUE
+ if(I.use_tool(src, user, 30))
if(magazine.ammo_count())
- afterattack(user, user) //and again
- user.visible_message("[src] goes off!", "[src] goes off in your face!")
+ to_chat(user, "You can't modify it!")
return
- if(do_after(user, 30*A.toolspeed, target = src))
- if(magazine.ammo_count())
- to_chat(user, "You can't modify it!")
- return
- magazine.caliber = "38"
- desc = initial(desc)
- to_chat(user, "You remove the modifications on [src]. Now it will fire .38 rounds.")
+ magazine.caliber = "38"
+ desc = initial(desc)
+ to_chat(user, "You remove the modifications on [src]. Now it will fire .38 rounds.")
+ return TRUE
/obj/item/gun/ballistic/revolver/mateba
diff --git a/code/modules/projectiles/guns/energy/kinetic_accelerator.dm b/code/modules/projectiles/guns/energy/kinetic_accelerator.dm
index f3ff4e965d..e3fc09f270 100644
--- a/code/modules/projectiles/guns/energy/kinetic_accelerator.dm
+++ b/code/modules/projectiles/guns/energy/kinetic_accelerator.dm
@@ -33,17 +33,17 @@
var/obj/item/borg/upgrade/modkit/M = A
to_chat(user, "There is \a [M] installed, using [M.cost]% capacity.")
-/obj/item/gun/energy/kinetic_accelerator/attackby(obj/item/A, mob/user)
- if(istype(A, /obj/item/crowbar))
+/obj/item/gun/energy/kinetic_accelerator/attackby(obj/item/I, mob/user)
+ if(istype(I, /obj/item/crowbar))
if(modkits.len)
to_chat(user, "You pry the modifications out.")
- playsound(loc, A.usesound, 100, 1)
+ I.play_tool_sound(src, 100)
for(var/obj/item/borg/upgrade/modkit/M in modkits)
M.uninstall(src)
else
to_chat(user, "There are no modifications currently installed.")
- else if(istype(A, /obj/item/borg/upgrade/modkit))
- var/obj/item/borg/upgrade/modkit/MK = A
+ else if(istype(I, /obj/item/borg/upgrade/modkit))
+ var/obj/item/borg/upgrade/modkit/MK = I
MK.install(src, user)
else
..()
diff --git a/code/modules/projectiles/guns/energy/special.dm b/code/modules/projectiles/guns/energy/special.dm
index b79ed02d86..19308c812f 100644
--- a/code/modules/projectiles/guns/energy/special.dm
+++ b/code/modules/projectiles/guns/energy/special.dm
@@ -127,7 +127,7 @@
can_charge = 0
heat = 3800
- usesound = 'sound/items/welder.ogg'
+ usesound = list('sound/items/welder.ogg', 'sound/items/welder2.ogg')
tool_behaviour = TOOL_WELDER
toolspeed = 0.7 //plasmacutters can be used as welders, and are faster than standard welders
@@ -136,20 +136,29 @@
if(cell)
to_chat(user, "[src] is [round(cell.percent())]% charged.")
-/obj/item/gun/energy/plasmacutter/attackby(obj/item/A, mob/user)
- if(istype(A, /obj/item/stack/sheet/mineral/plasma))
- var/obj/item/stack/sheet/S = A
- S.use(1)
+/obj/item/gun/energy/plasmacutter/attackby(obj/item/I, mob/user)
+ if(istype(I, /obj/item/stack/sheet/mineral/plasma))
+ I.use(1)
cell.give(1000)
- to_chat(user, "You insert [A] in [src], recharging it.")
- else if(istype(A, /obj/item/stack/ore/plasma))
- var/obj/item/stack/ore/S = A
- S.use(1)
+ to_chat(user, "You insert [I] in [src], recharging it.")
+ else if(istype(I, /obj/item/stack/ore/plasma))
+ I.use(1)
cell.give(500)
- to_chat(user, "You insert [A] in [src], recharging it.")
+ to_chat(user, "You insert [I] in [src], recharging it.")
else
..()
+// Tool procs, in case plasma cutter is used as welder
+/obj/item/gun/energy/plasmacutter/tool_use_check(mob/living/user, amount)
+ if(cell.charge >= amount * 100)
+ return TRUE
+
+ to_chat(user, "You need more charge to complete this task!")
+ return FALSE
+
+/obj/item/gun/energy/plasmacutter/use(amount)
+ return cell.use(amount * 100)
+
/obj/item/gun/energy/plasmacutter/update_icon()
return
diff --git a/code/modules/reagents/chemistry/reagents/food_reagents.dm b/code/modules/reagents/chemistry/reagents/food_reagents.dm
index a25d8938b6..2888f3acca 100644
--- a/code/modules/reagents/chemistry/reagents/food_reagents.dm
+++ b/code/modules/reagents/chemistry/reagents/food_reagents.dm
@@ -530,6 +530,7 @@
name = "Egg Yolk"
id = "eggyolk"
description = "It's full of protein."
+ nutriment_factor = 3 * REAGENTS_METABOLISM
color = "#FFB500"
taste_description = "egg"
diff --git a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm
index d24720b42d..789b92a9b9 100644
--- a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm
+++ b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm
@@ -1193,4 +1193,17 @@
name = "Corazone"
id = "corazone"
description = "A medication used to treat pain, fever, and inflammation, along with heart attacks."
- color = "#F5F5F5"
\ No newline at end of file
+ color = "#F5F5F5"
+
+/datum/reagent/medicine/muscle_stimulant
+ name = "Muscle Stimulant"
+ id = "muscle_stimulant"
+ description = "A potent chemical that allows someone under its influence to be at full physical ability even when under massive amounts of pain."
+
+/datum/reagent/medicine/muscle_stimulant/on_mob_add(mob/living/M)
+ . = ..()
+ M.add_trait(TRAIT_IGNORESLOWDOWN, id)
+
+/datum/reagent/medicine/muscle_stimulant/on_mob_delete(mob/living/M)
+ . = ..()
+ M.remove_trait(TRAIT_IGNORESLOWDOWN, id)
diff --git a/code/modules/reagents/reagent_containers/glass.dm b/code/modules/reagents/reagent_containers/glass.dm
index 9ce8135757..9d26b65151 100644
--- a/code/modules/reagents/reagent_containers/glass.dm
+++ b/code/modules/reagents/reagent_containers/glass.dm
@@ -100,7 +100,7 @@
to_chat(user, "[src] is full.")
else
to_chat(user, "You break [E] in [src].")
- reagents.add_reagent("eggyolk", 5)
+ E.reagents.trans_to(src, E.reagents.total_volume)
qdel(E)
return
..()
@@ -397,4 +397,4 @@
/obj/item/reagent_containers/glass/beaker/large/bromine
name = "bromine beaker"
- list_reagents = list("bromine" = 50)
\ No newline at end of file
+ list_reagents = list("bromine" = 50)
diff --git a/code/modules/recycling/conveyor2.dm b/code/modules/recycling/conveyor2.dm
index c8a7b9744f..89d859d36d 100644
--- a/code/modules/recycling/conveyor2.dm
+++ b/code/modules/recycling/conveyor2.dm
@@ -118,9 +118,7 @@
if(istype(I, /obj/item/crowbar))
user.visible_message("[user] struggles to pry up \the [src] with \the [I].", \
"You struggle to pry up \the [src] with \the [I].")
- if(do_after(user, 40*I.toolspeed, target = src))
- if(QDELETED(src))
- return //prevent multiple decontructs
+ if(I.use_tool(src, user, 40, volume=40))
if(!(stat & BROKEN))
var/obj/item/conveyor_construct/C = new/obj/item/conveyor_construct(src.loc)
C.id = id
@@ -130,7 +128,7 @@
else if(istype(I, /obj/item/wrench))
if(!(stat & BROKEN))
- playsound(loc, I.usesound, 50, 1)
+ I.play_tool_sound(src)
setDir(turn(dir,-45))
update_move_direction()
to_chat(user, "You rotate [src].")
diff --git a/code/modules/recycling/disposal/bin.dm b/code/modules/recycling/disposal/bin.dm
index 2af691679c..71235045f3 100644
--- a/code/modules/recycling/disposal/bin.dm
+++ b/code/modules/recycling/disposal/bin.dm
@@ -82,19 +82,17 @@
if(!pressure_charging && !full_pressure && !flush)
if(istype(I, /obj/item/screwdriver))
panel_open = !panel_open
- playsound(get_turf(src), I.usesound, 50, 1)
+ I.play_tool_sound(src)
to_chat(user, "You [panel_open ? "remove":"attach"] the screws around the power connection.")
return
else if(istype(I, /obj/item/weldingtool) && panel_open)
- var/obj/item/weldingtool/W = I
- if(W.remove_fuel(0,user))
- playsound(src.loc, 'sound/items/welder2.ogg', 100, 1)
- to_chat(user, "You start slicing the floorweld off \the [src]...")
- if(do_after(user,20*I.toolspeed, target = src) && panel_open)
- if(!W.isOn())
- return
- to_chat(user, "You slice the floorweld off \the [src].")
- deconstruct()
+ if(!I.tool_start_check(user, amount=0))
+ return
+
+ to_chat(user, "You start slicing the floorweld off \the [src]...")
+ if(I.use_tool(src, user, 20, volume=100) && panel_open)
+ to_chat(user, "You slice the floorweld off \the [src].")
+ deconstruct()
return
if(user.a_intent != INTENT_HARM)
diff --git a/code/modules/recycling/disposal/construction.dm b/code/modules/recycling/disposal/construction.dm
index 783e4da714..23d6d5502b 100644
--- a/code/modules/recycling/disposal/construction.dm
+++ b/code/modules/recycling/disposal/construction.dm
@@ -155,24 +155,21 @@
anchored = TRUE
density = initial(pipe_type.density)
to_chat(user, "You attach the [pipename] to the underfloor.")
- playsound(src, I.usesound, 100, 1)
+ I.play_tool_sound(src, 100)
update_icon()
else if(istype(I, /obj/item/weldingtool))
if(anchored)
- var/obj/item/weldingtool/W = I
- if(W.remove_fuel(0,user))
- playsound(src, I.usesound, 50, 1)
- to_chat(user, "You start welding the [pipename] in place...")
- if(do_after(user, 8*I.toolspeed, target = src))
- if(!loc || !W.isOn())
- return
- to_chat(user, "The [pipename] has been welded in place.")
+ if(!I.tool_start_check(user, amount=0))
+ return
- var/obj/O = new pipe_type(loc, src)
- transfer_fingerprints_to(O)
+ to_chat(user, "You start welding the [pipename] in place...")
+ if(I.use_tool(src, user, 8, volume=50))
+ to_chat(user, "The [pipename] has been welded in place.")
+ var/obj/O = new pipe_type(loc, src)
+ transfer_fingerprints_to(O)
- return
+ return
else
to_chat(user, "You need to attach it to the plating first!")
return
diff --git a/code/modules/recycling/disposal/outlet.dm b/code/modules/recycling/disposal/outlet.dm
index 0ef1717969..d7a2d5f820 100644
--- a/code/modules/recycling/disposal/outlet.dm
+++ b/code/modules/recycling/disposal/outlet.dm
@@ -69,21 +69,16 @@
H.vent_gas(T)
qdel(H)
+/obj/structure/disposaloutlet/welder_act(mob/living/user, obj/item/I)
+ if(!I.tool_start_check(user, amount=0))
+ return TRUE
-/obj/structure/disposaloutlet/attackby(obj/item/I, mob/user, params)
- add_fingerprint(user)
- if(istype(I, /obj/item/weldingtool))
- var/obj/item/weldingtool/W = I
- if(W.remove_fuel(0,user))
- playsound(src, 'sound/items/welder2.ogg', 100, 1)
- to_chat(user, "You start slicing the floorweld off [src]...")
- if(do_after(user, 20*I.toolspeed, target = src))
- if(!W.isOn())
- return
- to_chat(user, "You slice the floorweld off [src].")
- stored.forceMove(loc)
- transfer_fingerprints_to(stored)
- stored = null
- qdel(src)
- else
- return ..()
+ playsound(src, 'sound/items/welder2.ogg', 100, 1)
+ to_chat(user, "You start slicing the floorweld off [src]...")
+ if(I.use_tool(src, user, 20))
+ to_chat(user, "You slice the floorweld off [src].")
+ stored.forceMove(loc)
+ transfer_fingerprints_to(stored)
+ stored = null
+ qdel(src)
+ return TRUE
diff --git a/code/modules/recycling/disposal/pipe.dm b/code/modules/recycling/disposal/pipe.dm
index 02ca211cb8..ba089f6fb2 100644
--- a/code/modules/recycling/disposal/pipe.dm
+++ b/code/modules/recycling/disposal/pipe.dm
@@ -141,26 +141,19 @@
return ..()
-//attack by item
-//weldingtool: unfasten and convert to obj/disposalconstruct
-/obj/structure/disposalpipe/attackby(obj/item/I, mob/user, params)
- add_fingerprint(user)
- if(istype(I, /obj/item/weldingtool))
- if(!can_be_deconstructed(user))
- return
+//welding tool: unfasten and convert to obj/disposalconstruct
+/obj/structure/disposalpipe/welder_act(mob/living/user, obj/item/I)
+ if(!can_be_deconstructed(user))
+ return TRUE
- var/obj/item/weldingtool/W = I
- if(W.remove_fuel(0, user))
- playsound(src, I.usesound, 50, 1)
- to_chat(user, "You start slicing [src]...")
- // check if anything changed over 2 seconds
- if(do_after(user, 30*I.toolspeed, target = src))
- if(!W.isOn())
- return
- deconstruct()
- to_chat(user, "You slice [src].")
- else
- return ..()
+ if(!I.tool_start_check(user, amount=0))
+ return TRUE
+
+ to_chat(user, "You start slicing [src]...")
+ if(I.use_tool(src, user, 30, volume=50))
+ deconstruct()
+ to_chat(user, "You slice [src].")
+ return TRUE
//checks if something is blocking the deconstruction (e.g. trunk with a bin still linked to it)
/obj/structure/disposalpipe/proc/can_be_deconstructed()
diff --git a/code/modules/ruins/lavaland_ruin_code.dm b/code/modules/ruins/lavaland_ruin_code.dm
index 3230115eea..377421ca05 100644
--- a/code/modules/ruins/lavaland_ruin_code.dm
+++ b/code/modules/ruins/lavaland_ruin_code.dm
@@ -135,7 +135,7 @@
/datum/outfit/lavaland_syndicate/comms
name = "Lavaland Syndicate Comms Agent"
r_hand = /obj/item/melee/transforming/energy/sword/saber
- mask = /obj/item/clothing/mask/chameleon
+ mask = /obj/item/clothing/mask/chameleon/gps
suit = /obj/item/clothing/suit/armor/vest
/obj/item/clothing/mask/chameleon/gps/Initialize()
diff --git a/code/modules/surgery/bodyparts/robot_bodyparts.dm b/code/modules/surgery/bodyparts/robot_bodyparts.dm
index 8ec0172fad..6921d7e3a2 100644
--- a/code/modules/surgery/bodyparts/robot_bodyparts.dm
+++ b/code/modules/surgery/bodyparts/robot_bodyparts.dm
@@ -126,7 +126,7 @@
to_chat(user, "You insert the flash into the eye socket.")
else if(istype(W, /obj/item/crowbar))
if(flash1 || flash2)
- playsound(src.loc, W.usesound, 50, 1)
+ W.play_tool_sound(src)
to_chat(user, "You remove the flash from [src].")
if(flash1)
flash1.forceMove(user.loc)
diff --git a/code/modules/surgery/brain_surgery.dm b/code/modules/surgery/brain_surgery.dm
index b22b45efce..f2884d1da8 100644
--- a/code/modules/surgery/brain_surgery.dm
+++ b/code/modules/surgery/brain_surgery.dm
@@ -14,7 +14,7 @@
/datum/surgery_step/fix_brain
name = "fix brain"
- implements = list(/obj/item/hemostat = 85, /obj/item/screwdriver = 35, /obj/item/pen = 15) //don't worry, pouring some alcohol on their open brain will get that chance to 100
+ implements = list(/obj/item/hemostat = 85, TOOL_SCREWDRIVER = 35, /obj/item/pen = 15) //don't worry, pouring some alcohol on their open brain will get that chance to 100
time = 120 //long and complicated
/datum/surgery/brain_surgery/can_start(mob/user, mob/living/carbon/target)
diff --git a/code/modules/surgery/core_removal.dm b/code/modules/surgery/core_removal.dm
index 1a1582712a..fe6b9a5b88 100644
--- a/code/modules/surgery/core_removal.dm
+++ b/code/modules/surgery/core_removal.dm
@@ -12,7 +12,7 @@
//extract brain
/datum/surgery_step/extract_core
name = "extract core"
- implements = list(/obj/item/hemostat = 100, /obj/item/crowbar = 100)
+ implements = list(/obj/item/hemostat = 100, TOOL_CROWBAR = 100)
time = 16
/datum/surgery_step/extract_core/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
diff --git a/code/modules/surgery/eye_surgery.dm b/code/modules/surgery/eye_surgery.dm
index 00a9a99bb0..dad5c3551c 100644
--- a/code/modules/surgery/eye_surgery.dm
+++ b/code/modules/surgery/eye_surgery.dm
@@ -8,7 +8,7 @@
//fix eyes
/datum/surgery_step/fix_eyes
name = "fix eyes"
- implements = list(/obj/item/hemostat = 100, /obj/item/screwdriver = 45, /obj/item/pen = 25)
+ implements = list(/obj/item/hemostat = 100, TOOL_SCREWDRIVER = 45, /obj/item/pen = 25)
time = 64
/datum/surgery/eye_surgery/can_start(mob/user, mob/living/carbon/target)
diff --git a/code/modules/surgery/implant_removal.dm b/code/modules/surgery/implant_removal.dm
index cfec06c7ea..7dc2a6afa9 100644
--- a/code/modules/surgery/implant_removal.dm
+++ b/code/modules/surgery/implant_removal.dm
@@ -8,7 +8,7 @@
//extract implant
/datum/surgery_step/extract_implant
name = "extract implant"
- implements = list(/obj/item/hemostat = 100, /obj/item/crowbar = 65)
+ implements = list(/obj/item/hemostat = 100, TOOL_CROWBAR = 65)
time = 64
var/obj/item/implant/I = null
diff --git a/code/modules/surgery/limb_augmentation.dm b/code/modules/surgery/limb_augmentation.dm
index e2316c0e4d..0183b2bba1 100644
--- a/code/modules/surgery/limb_augmentation.dm
+++ b/code/modules/surgery/limb_augmentation.dm
@@ -6,7 +6,7 @@
/datum/surgery_step/replace
name = "sever muscles"
- implements = list(/obj/item/scalpel = 100, /obj/item/wirecutters = 55)
+ implements = list(/obj/item/scalpel = 100, TOOL_WIRECUTTER = 55)
time = 32
diff --git a/code/modules/surgery/lipoplasty.dm b/code/modules/surgery/lipoplasty.dm
index 5a201bfc84..002b68fdf9 100644
--- a/code/modules/surgery/lipoplasty.dm
+++ b/code/modules/surgery/lipoplasty.dm
@@ -25,7 +25,7 @@
//remove fat
/datum/surgery_step/remove_fat
name = "remove loose fat"
- implements = list(/obj/item/retractor = 100, /obj/item/screwdriver = 45, /obj/item/wirecutters = 35)
+ implements = list(/obj/item/retractor = 100, TOOL_SCREWDRIVER = 45, TOOL_WIRECUTTER = 35)
time = 32
/datum/surgery_step/remove_fat/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
diff --git a/code/modules/surgery/mechanic_steps.dm b/code/modules/surgery/mechanic_steps.dm
index 0bdef2aac9..6431770fa9 100644
--- a/code/modules/surgery/mechanic_steps.dm
+++ b/code/modules/surgery/mechanic_steps.dm
@@ -2,7 +2,7 @@
/datum/surgery_step/mechanic_open
name = "unscrew shell"
implements = list(
- /obj/item/screwdriver = 100,
+ TOOL_SCREWDRIVER = 100,
/obj/item/scalpel = 75, // med borgs could try to unskrew shell with scalpel
/obj/item/kitchen/knife = 50,
/obj/item = 10) // 10% success with any sharp item.
@@ -22,7 +22,7 @@
/datum/surgery_step/mechanic_close
name = "screw shell"
implements = list(
- /obj/item/screwdriver = 100,
+ TOOL_SCREWDRIVER = 100,
/obj/item/scalpel = 75,
/obj/item/kitchen/knife = 50,
/obj/item = 10) // 10% success with any sharp item.
@@ -42,7 +42,7 @@
/datum/surgery_step/prepare_electronics
name = "prepare electronics"
implements = list(
- /obj/item/device/multitool = 100,
+ TOOL_MULTITOOL = 100,
/obj/item/hemostat = 10) // try to reboot internal controllers via short circuit with some conductor
time = 24
@@ -54,7 +54,7 @@
/datum/surgery_step/mechanic_unwrench
name = "unwrench bolts"
implements = list(
- /obj/item/wrench = 100,
+ TOOL_WRENCH = 100,
/obj/item/retractor = 10)
time = 24
@@ -66,7 +66,7 @@
/datum/surgery_step/mechanic_wrench
name = "wrench bolts"
implements = list(
- /obj/item/wrench = 100,
+ TOOL_WRENCH = 100,
/obj/item/retractor = 10)
time = 24
diff --git a/code/modules/surgery/organ_manipulation.dm b/code/modules/surgery/organ_manipulation.dm
index 8ce80ec8a0..d8b4bf4229 100644
--- a/code/modules/surgery/organ_manipulation.dm
+++ b/code/modules/surgery/organ_manipulation.dm
@@ -67,7 +67,7 @@
name = "manipulate organs"
repeatable = 1
implements = list(/obj/item/organ = 100, /obj/item/reagent_containers/food/snacks/organ = 0, /obj/item/organ_storage = 100)
- var/implements_extract = list(/obj/item/hemostat = 100, /obj/item/crowbar = 55)
+ var/implements_extract = list(/obj/item/hemostat = 100, TOOL_CROWBAR = 55)
var/current_type
var/obj/item/organ/I = null
@@ -75,25 +75,6 @@
..()
implements = implements + implements_extract
-/datum/surgery_step/manipulate_organs/tool_check(mob/user, obj/item/tool)
- if(istype(tool, /obj/item/weldingtool))
- var/obj/item/weldingtool/WT = tool
- if(!WT.isOn())
- return 0
-
- else if(istype(tool, /obj/item/lighter))
- var/obj/item/lighter/L = tool
- if(!L.lit)
- return 0
-
- else if(istype(tool, /obj/item/match))
- var/obj/item/match/M = tool
- if(!M.lit)
- return 0
-
- return 1
-
-
/datum/surgery_step/manipulate_organs/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
I = null
if(istype(tool, /obj/item/organ_storage))
@@ -118,13 +99,6 @@
else if(implement_type in implements_extract)
current_type = "extract"
var/list/organs = target.getorganszone(target_zone)
-
-/* var/mob/living/simple_animal/borer/B = target.has_brain_worms()
- if(target.has_brain_worms())
- user.visible_message("[user] begins to extract [B] from [target]'s [parse_zone(target_zone)].",
- "You begin to extract [B] from [target]'s [parse_zone(target_zone)]...")
- return TRUE*/
-
if(!organs.len)
to_chat(user, "There are no removable organs in [target]'s [parse_zone(target_zone)]!")
return -1
@@ -164,13 +138,6 @@
"You insert [tool] into [target]'s [parse_zone(target_zone)].")
else if(current_type == "extract")
-/* var/mob/living/simple_animal/borer/B = target.has_brain_worms()
- if(B && B.victim == target)
- user.visible_message("[user] successfully extracts [B] from [target]'s [parse_zone(target_zone)]!",
- "You successfully extract [B] from [target]'s [parse_zone(target_zone)].")
- add_logs(user, target, "surgically removed [B] from", addition="INTENT: [uppertext(user.a_intent)]")
- B.leave_victim()
- return FALSE */
if(I && I.owner == target)
user.visible_message("[user] successfully extracts [I] from [target]'s [parse_zone(target_zone)]!",
"You successfully extract [I] from [target]'s [parse_zone(target_zone)].")
diff --git a/code/modules/surgery/organic_steps.dm b/code/modules/surgery/organic_steps.dm
index 8a4c795c63..beed1cce7f 100644
--- a/code/modules/surgery/organic_steps.dm
+++ b/code/modules/surgery/organic_steps.dm
@@ -19,7 +19,7 @@
//clamp bleeders
/datum/surgery_step/clamp_bleeders
name = "clamp bleeders"
- implements = list(/obj/item/hemostat = 100, /obj/item/wirecutters = 60, /obj/item/stack/packageWrap = 35, /obj/item/stack/cable_coil = 15)
+ implements = list(/obj/item/hemostat = 100, TOOL_WIRECUTTER = 60, /obj/item/stack/packageWrap = 35, /obj/item/stack/cable_coil = 15)
time = 24
/datum/surgery_step/clamp_bleeders/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
@@ -35,7 +35,7 @@
//retract skin
/datum/surgery_step/retract_skin
name = "retract skin"
- implements = list(/obj/item/retractor = 100, /obj/item/screwdriver = 45, /obj/item/wirecutters = 35)
+ implements = list(/obj/item/retractor = 100, TOOL_SCREWDRIVER = 45, TOOL_WIRECUTTER = 35)
time = 24
/datum/surgery_step/retract_skin/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
@@ -47,35 +47,19 @@
//close incision
/datum/surgery_step/close
name = "mend incision"
- implements = list(/obj/item/cautery = 100, /obj/item/gun/energy/laser = 90, /obj/item/weldingtool = 70,
- /obj/item/lighter = 45, /obj/item/match = 20)
+ implements = list(/obj/item/cautery = 100, /obj/item/gun/energy/laser = 90, TOOL_WELDER = 70,
+ /obj/item = 30) // 30% success with any hot item.
time = 24
/datum/surgery_step/close/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
user.visible_message("[user] begins to mend the incision in [target]'s [parse_zone(target_zone)].",
"You begin to mend the incision in [target]'s [parse_zone(target_zone)]...")
-
/datum/surgery_step/close/tool_check(mob/user, obj/item/tool)
- if(istype(tool, /obj/item/cautery))
- return 1
+ if(implement_type == TOOL_WELDER || implement_type == /obj/item)
+ return tool.is_hot()
- if(istype(tool, /obj/item/weldingtool))
- var/obj/item/weldingtool/WT = tool
- if(WT.isOn())
- return 1
-
- else if(istype(tool, /obj/item/lighter))
- var/obj/item/lighter/L = tool
- if(L.lit)
- return 1
-
- else if(istype(tool, /obj/item/match))
- var/obj/item/match/M = tool
- if(M.lit)
- return 1
-
- return 0
+ return TRUE
/datum/surgery_step/close/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
if(locate(/datum/surgery_step/saw) in surgery.steps)
@@ -105,7 +89,7 @@
//drill bone
/datum/surgery_step/drill
name = "drill bone"
- implements = list(/obj/item/surgicaldrill = 100, /obj/item/pickaxe/drill = 60, /obj/item/mecha_parts/mecha_equipment/drill = 60, /obj/item/screwdriver = 20)
+ implements = list(/obj/item/surgicaldrill = 100, /obj/item/pickaxe/drill = 60, /obj/item/mecha_parts/mecha_equipment/drill = 60, TOOL_SCREWDRIVER = 20)
time = 30
/datum/surgery_step/drill/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
diff --git a/code/modules/surgery/organs/augments_arms.dm b/code/modules/surgery/organs/augments_arms.dm
index 8b48989c3f..51449976cc 100644
--- a/code/modules/surgery/organs/augments_arms.dm
+++ b/code/modules/surgery/organs/augments_arms.dm
@@ -51,16 +51,11 @@
SetSlotFromZone()
to_chat(user, "You modify [src] to be installed on the [zone == "r_arm" ? "right" : "left"] arm.")
update_icon()
- else if(istype(W, /obj/item/card/emag))
- emag_act()
/obj/item/organ/cyberimp/arm/Remove(mob/living/carbon/M, special = 0)
Retract()
..()
-/obj/item/organ/cyberimp/arm/emag_act()
- return 0
-
/obj/item/organ/cyberimp/arm/emp_act(severity)
if(prob(15/severity) && owner)
to_chat(owner, "[src] is hit by EMP!")
@@ -126,10 +121,6 @@
to_chat(owner, "The implant doesn't respond. It seems to be broken...")
return
- // You can emag the arm-mounted implant by activating it while holding emag in it's hand.
- if(istype(owner.get_active_held_item(), /obj/item/card/emag) && emag_act())
- return
-
if(!holder || (holder in src))
holder = null
if(contents.len == 1)
@@ -176,7 +167,6 @@
/obj/item/organ/cyberimp/arm/gun/taser/l
zone = "l_arm"
-
/obj/item/organ/cyberimp/arm/toolset
name = "integrated toolset implant"
desc = "A stripped-down version of the engineering cyborg toolset, designed to be installed on subject's arm. Contains all necessary tools."
diff --git a/code/modules/surgery/organs/autosurgeon.dm b/code/modules/surgery/organs/autosurgeon.dm
index 0de1683fbd..b7d4a77f72 100644
--- a/code/modules/surgery/organs/autosurgeon.dm
+++ b/code/modules/surgery/organs/autosurgeon.dm
@@ -60,7 +60,7 @@
var/turf/open/floorloc = get_turf(user)
floorloc.contents += contents
to_chat(user, "You remove the [storedorgan] from [src].")
- playsound(get_turf(user), I.usesound, 50, 1)
+ I.play_tool_sound(src)
storedorgan = null
if(uses != INFINITE)
uses--
diff --git a/code/modules/surgery/plastic_surgery.dm b/code/modules/surgery/plastic_surgery.dm
index f1f2c11a05..7d84a5d107 100644
--- a/code/modules/surgery/plastic_surgery.dm
+++ b/code/modules/surgery/plastic_surgery.dm
@@ -6,7 +6,7 @@
//reshape_face
/datum/surgery_step/reshape_face
name = "reshape face"
- implements = list(/obj/item/scalpel = 100, /obj/item/kitchen/knife = 50, /obj/item/wirecutters = 35)
+ implements = list(/obj/item/scalpel = 100, /obj/item/kitchen/knife = 50, TOOL_WIRECUTTER = 35)
time = 64
/datum/surgery_step/reshape_face/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
diff --git a/code/modules/surgery/surgery_step.dm b/code/modules/surgery/surgery_step.dm
index 445628566e..fa9e45ca4b 100644
--- a/code/modules/surgery/surgery_step.dm
+++ b/code/modules/surgery/surgery_step.dm
@@ -9,19 +9,28 @@
/datum/surgery_step/proc/try_op(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
- var/success = 0
+ var/success = FALSE
if(accept_hand)
if(!tool)
- success = 1
+ success = TRUE
+
if(accept_any_item)
if(tool && tool_check(user, tool))
- success = 1
- else
- for(var/path in implements)
- if(istype(tool, path))
- implement_type = path
+ success = TRUE
+
+ else if(tool)
+ for(var/key in implements)
+ var/match = FALSE
+
+ if(ispath(key) && istype(tool, key))
+ match = TRUE
+ else if(tool.tool_behaviour == key)
+ match = TRUE
+
+ if(match)
+ implement_type = key
if(tool_check(user, tool))
- success = 1
+ success = TRUE
break
if(success)
diff --git a/code/modules/uplink/uplink_items.dm b/code/modules/uplink/uplink_items.dm
index 3e7e026ef4..d02ee0373d 100644
--- a/code/modules/uplink/uplink_items.dm
+++ b/code/modules/uplink/uplink_items.dm
@@ -1236,6 +1236,14 @@ GLOBAL_LIST_EMPTY(uplink_items) // Global list so we only initialize this once.
surplus = 20
restricted_roles = list("Janitor")
+/datum/uplink_item/role_restricted/explosive_hot_potato
+ name = "Exploding Hot Potato"
+ desc = "A potato rigged with explosives. On activation, a special mechanism is activated that prevents it from being dropped. The only way to get rid of it if you are holding it is to attack someone else with it, causing it to latch to that person instead."
+ item = /obj/item/hot_potato/syndicate
+ cost = 4
+ surplus = 0
+ restricted_roles = list("Cook", "Botanist", "Clown", "Mime")
+
/datum/uplink_item/role_restricted/his_grace
name = "His Grace"
desc = "An incredibly dangerous weapon recovered from a station overcome by the grey tide. Once activated, He will thirst for blood and must be used to kill to sate that thirst. \
diff --git a/code/modules/vehicles/scooter.dm b/code/modules/vehicles/scooter.dm
index 66ae84f559..dd43f8fd40 100644
--- a/code/modules/vehicles/scooter.dm
+++ b/code/modules/vehicles/scooter.dm
@@ -12,10 +12,9 @@
/obj/vehicle/ridden/scooter/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/wrench))
to_chat(user, "You begin to remove the handlebars...")
- playsound(get_turf(user), 'sound/items/ratchet.ogg', 50, 1)
- if(do_after(user, 40*I.toolspeed, target = src))
- var/obj/vehicle/ridden/scooter/skateboard/S = new(loc)
- new /obj/item/stack/rods(get_turf(src),2)
+ if(I.use_tool(src, user, 40, volume=50))
+ var/obj/vehicle/ridden/scooter/skateboard/S = new(drop_location())
+ new /obj/item/stack/rods(drop_location(), 2)
to_chat(user, "You remove the handlebars from [src].")
if(has_buckled_mobs())
var/mob/living/carbon/H = buckled_mobs[1]
@@ -102,21 +101,16 @@
/obj/item/scooter_frame/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/wrench))
to_chat(user, "You deconstruct [src].")
- new /obj/item/stack/rods(get_turf(src),10)
- playsound(get_turf(user), 'sound/items/ratchet.ogg', 50, 1)
+ new /obj/item/stack/rods(drop_location(), 10)
+ I.play_tool_sound(src)
qdel(src)
return
else if(istype(I, /obj/item/stack/sheet/metal))
- var/obj/item/stack/sheet/metal/M = I
- if(M.get_amount() < 5)
- to_chat(user, "You need at least five metal sheets to make proper wheels!")
+ if(!I.tool_start_check(user, amount=5))
return
to_chat(user, "You begin to add wheels to [src].")
- if(do_after(user, 80, target = src))
- if(!M || M.get_amount() < 5)
- return
- M.use(5)
+ if(I.use_tool(src, user, 80, volume=50, amount=5))
to_chat(user, "You finish making wheels for [src].")
new /obj/vehicle/ridden/scooter/skateboard(user.loc)
qdel(src)
@@ -124,27 +118,21 @@
/obj/vehicle/ridden/scooter/skateboard/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/screwdriver))
to_chat(user, "You begin to deconstruct and remove the wheels on [src]...")
- playsound(get_turf(user), I.usesound, 50, 1)
- if(do_after(user, 20, target = src))
+ if(I.use_tool(src, user, 20, volume=50))
to_chat(user, "You deconstruct the wheels on [src].")
- new /obj/item/stack/sheet/metal(get_turf(src),5)
- new /obj/item/scooter_frame(get_turf(src))
+ new /obj/item/stack/sheet/metal(drop_location(), 5)
+ new /obj/item/scooter_frame(drop_location())
if(has_buckled_mobs())
var/mob/living/carbon/H = buckled_mobs[1]
unbuckle_mob(H)
qdel(src)
else if(istype(I, /obj/item/stack/rods))
- var/obj/item/stack/rods/C = I
- if(C.get_amount() < 2)
- to_chat(user, "You need at least two rods to make proper handlebars!")
+ if(!I.tool_start_check(user, amount=2))
return
to_chat(user, "You begin making handlebars for [src].")
- if(do_after(user, 25, target = src))
- if(!C || C.get_amount() < 2)
- return
+ if(I.use_tool(src, user, 25, volume=50, amount=2))
to_chat(user, "You add the rods to [src], creating handlebars.")
- C.use(2)
var/obj/vehicle/ridden/scooter/S = new(loc)
if(has_buckled_mobs())
var/mob/living/carbon/H = buckled_mobs[1]