Skip to content

Commit

Permalink
feat(tools): welding tool sounds, cool effects and more
Browse files Browse the repository at this point in the history
  • Loading branch information
Filatelele authored Mar 15, 2024
1 parent 596f352 commit 8f36c54
Show file tree
Hide file tree
Showing 84 changed files with 992 additions and 954 deletions.
1 change: 1 addition & 0 deletions baystation12.dme
Original file line number Diff line number Diff line change
Expand Up @@ -1239,6 +1239,7 @@
#include "code\game\objects\items\tools\crowbar.dm"
#include "code\game\objects\items\tools\screwdriver.dm"
#include "code\game\objects\items\tools\surgery.dm"
#include "code\game\objects\items\tools\tools.dm"
#include "code\game\objects\items\tools\welding.dm"
#include "code\game\objects\items\tools\wirecutters.dm"
#include "code\game\objects\items\tools\wrench.dm"
Expand Down
3 changes: 3 additions & 0 deletions code/__defines/sound.dm
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,9 @@
#define SFX_GEIGER_MODERATE "geiger_moderate"
#define SFX_GEIGER_HIGH "geiger_high"
#define SFX_GEIGER_VERY_HIGH "geiger_very_high"
#define SFX_WELDING "welding_sound"
#define SFX_WELDER_ACTIVATE "welder_activate"
#define SFX_WELDER_DEACTIVATE "welder_deactivate"

// MISC
#define SFX_VENT "vent"
Expand Down
4 changes: 4 additions & 0 deletions code/__defines/tools.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@
#define TOOL_SCREWDRIVER "screwdriver"
#define TOOL_MULTITOOL "multitool"
#define TOOL_CROWBAR "crowbar"

/// Minimal duration of tool's use_tool(). If less than MIN_TOOL_SOUND_DELAY, then
/// tool_sound is played only when use_tool() is started. If more, then it is played twice.
#define MIN_TOOL_SOUND_DELAY 2 SECONDS
10 changes: 10 additions & 0 deletions code/_global_vars/sfx.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1655,6 +1655,16 @@ GLOBAL_LIST_INIT(sfx_list, list(
'sound/effects/geiger/geiger_very_high_1.ogg',
'sound/effects/geiger/geiger_very_high_2.ogg'
),
SFX_WELDING = list(
'sound/items/Welder.ogg',
'sound/items/Welder2.ogg'
),
SFX_WELDER_ACTIVATE = list(
'sound/effects/welderactivate.ogg'
),
SFX_WELDER_DEACTIVATE = list(
'sound/effects/welderdeactivate.ogg'
),
// FOOTSTEPS
SFX_DISTANT_MOVEMENT = list(
'sound/effects/footstep/distant/distant1.ogg',
Expand Down
12 changes: 10 additions & 2 deletions code/_helpers/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
/proc/get_exposed_defense_zone(atom/movable/target)
return pick(BP_HEAD, BP_L_HAND, BP_R_HAND, BP_L_FOOT, BP_R_FOOT, BP_L_ARM, BP_R_ARM, BP_L_LEG, BP_R_LEG, BP_CHEST, BP_GROIN)

/proc/do_mob(atom/movable/affecter, mob/target, time = 30, target_zone = 0, uninterruptible = 0, progress = 1, incapacitation_flags = INCAPACITATION_DEFAULT, can_multitask = FALSE)
/proc/do_mob(atom/movable/affecter, mob/target, time = 30, target_zone = 0, uninterruptible = 0, progress = 1, incapacitation_flags = INCAPACITATION_DEFAULT, can_multitask = FALSE, datum/callback/extra_checks)
if(!affecter || !target)
return FALSE

Expand Down Expand Up @@ -189,13 +189,17 @@
. = 0
break

if(extra_checks && !extra_checks.Invoke(user, target))
. = FALSE
break

if(progbar)
qdel(progbar)

if(!can_multitask)
LAZYREMOVE(GLOB.domobs, uniqueid)

/proc/do_after(mob/user, delay, atom/target = null, needhand = TRUE, progress = TRUE, incapacitation_flags = INCAPACITATION_DEFAULT, same_direction = FALSE, can_move = FALSE)
/proc/do_after(mob/user, delay, atom/target = null, needhand = TRUE, progress = TRUE, incapacitation_flags = INCAPACITATION_DEFAULT, same_direction = FALSE, can_move = FALSE, datum/callback/extra_checks)
if(!user)
return FALSE

Expand Down Expand Up @@ -248,6 +252,10 @@
. = 0
break

if(extra_checks && !extra_checks.Invoke(user, target))
. = FALSE
break

if(progbar)
qdel(progbar)

Expand Down
4 changes: 2 additions & 2 deletions code/datums/surgery/steps/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
return FALSE

if(isWelder(tool))
var/obj/item/weldingtool/W = tool
if(!W.isOn() || !W.remove_fuel(1, user))
var/obj/item/weldingtool/WT = tool
if(!WT.use_tool(target, user, amount = 1))
return FALSE

return !(target.back.canremove)
Expand Down
4 changes: 2 additions & 2 deletions code/datums/surgery/steps/robotic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@
return

if(isWelder(tool))
var/obj/item/weldingtool/W = tool
if(!W.isOn() || !W.remove_fuel(1, user))
var/obj/item/weldingtool/WT = tool
if(!WT.use_tool(target, user, amount = 1))
return FALSE

if(parent_organ.hatch_state != HATCH_OPENED)
Expand Down
21 changes: 4 additions & 17 deletions code/game/machinery/camera/camera.dm
Original file line number Diff line number Diff line change
Expand Up @@ -401,24 +401,11 @@
return null

/obj/machinery/camera/proc/weld(obj/item/weldingtool/WT, mob/user)

if(busy)
return 0
if(!WT.isOn())
return 0

// Do after stuff here
to_chat(user, "<span class='notice'>You start to weld the [src]..</span>")
playsound(src.loc, 'sound/items/Welder.ogg', 50, 1)
WT.eyecheck(user)
busy = 1
if(do_after(user, 100, src))
busy = 0
if(!WT.isOn())
return 0
return 1
busy = 0
return 0
if(WT.use_tool(src, user, delay = 10 SECONDS, amount = 5))
return FALSE

return TRUE

/obj/machinery/camera/interact(mob/living/user as mob)
if(!panel_open || istype(user, /mob/living/silicon/ai))
Expand Down
24 changes: 8 additions & 16 deletions code/game/machinery/camera/camera_assembly.dm
Original file line number Diff line number Diff line change
Expand Up @@ -152,20 +152,12 @@
..()

/obj/item/camera_assembly/proc/weld(obj/item/weldingtool/WT, mob/user)
to_chat(user, SPAN_NOTICE("You start to weld \the [src]."))

if(busy)
return 0
if(!WT.isOn())
return 0

to_chat(user, "<span class='notice'>You start to weld \the [src]..</span>")
playsound(src.loc, 'sound/items/Welder.ogg', 50, 1)
WT.eyecheck(user)
busy = 1
if(do_after(user, 20, src))
busy = 0
if(!WT.isOn())
return 0
return 1
busy = 0
return 0
if(!WT.use_tool(src, user, delay = 2 SECONDS, amount = 1))
return FALSE

if(QDELETED(src) || !user)
return FALSE

return TRUE
16 changes: 8 additions & 8 deletions code/game/machinery/computer/ai_core.dm
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@
state = AI_STAGE_CIRCUIT
if(isWelder(P))
var/obj/item/weldingtool/WT = P
if(!WT.isOn())
to_chat(user, "The welder must be on for this task.")
if(!WT.use_tool(src, user, delay = 4 SECONDS, amount = 5))
return
playsound(loc, 'sound/items/Welder.ogg', 50, 1)
if(do_after(user, 20, src))
if(!src || !WT.remove_fuel(0, user)) return
to_chat(user, SPAN("notice", "You deconstruct the frame."))
new /obj/item/stack/material/plasteel(loc, 4)
qdel(src)

if(QDELETED(src) || !user)
return

to_chat(user, SPAN("notice", "You deconstruct the frame."))
new /obj/item/stack/material/plasteel(loc, 4)
qdel(src)
return
if(AI_STAGE_CIRCUIT)
if(isWrench(P))
playsound(loc, 'sound/items/Ratchet.ogg', 50, 1)
Expand Down
16 changes: 8 additions & 8 deletions code/game/machinery/computer/buildandrepair.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@
src.state = 1
if(isWelder(P))
var/obj/item/weldingtool/WT = P
if(!WT.remove_fuel(0, user))
to_chat(user, "The welding tool must be on to complete this task.")
if(!WT.use_tool(src, user, delay = 4 SECONDS, amount = 5))
return
playsound(src.loc, 'sound/items/Welder.ogg', 50, 1)
if(do_after(user, 20, src))
if(!src || !WT.isOn()) return
to_chat(user, "<span class='notice'>You deconstruct the frame.</span>")
new /obj/item/stack/material/steel( src.loc, 5 )
qdel(src)

if(QDELETED(src) || !user)
return

to_chat(user, SPAN_NOTICE("You deconstruct the frame."))
new /obj/item/stack/material/steel( src.loc, 5 )
qdel_self()
if(1)
if(isWrench(P))
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
Expand Down
17 changes: 8 additions & 9 deletions code/game/machinery/constructable_frame.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,15 @@
var/state = STAGE_CABLE

/obj/machinery/constructable_frame/proc/deconstruct_frame(obj/item/weldingtool/WT, mob/user, amount=1)
if(!WT.remove_fuel(0, user))
to_chat(user, "\The [WT] must be on to complete this task.")
if(!WT.use_tool(src, user, delay = 2 SECONDS, amount = 5))
return
playsound(loc, 'sound/items/Welder.ogg', 50, 1)
if(do_after(user, 20, src))
if(!src || !WT.isOn())
return
to_chat(user, SPAN("notice", "You deconstruct \the [src]"))
new /obj/item/stack/material/steel(loc, amount)
qdel(src)

if(QDELETED(src) || !user)
return

to_chat(user, SPAN("notice", "You deconstruct \the [src]"))
new /obj/item/stack/material/steel(loc, amount)
qdel(src)

/obj/machinery/constructable_frame/proc/wrench_frame(mob/user)
playsound(loc, 'sound/items/Ratchet.ogg', 50, 1)
Expand Down
22 changes: 9 additions & 13 deletions code/game/machinery/doors/airlock.dm
Original file line number Diff line number Diff line change
Expand Up @@ -524,11 +524,9 @@ About the new airlock wires panel:

if(isWelder(item))
var/obj/item/weldingtool/WT = item
if(!WT.isOn())
return 0
if(!WT.remove_fuel(0,user))
to_chat(user, "<span class='notice'>You need more welding fuel to complete this task.</span>")
return 0
if(!WT.use_tool(src, user, delay = 2 SECONDS, amount = 5))
return

cut_verb = "cutting"
cut_sound = 'sound/items/Welder.ogg'

Expand Down Expand Up @@ -635,16 +633,14 @@ About the new airlock wires panel:

if(!repairing && isWelder(C) && !(operating > 0) && density)
var/obj/item/weldingtool/W = C
if(W.remove_fuel(0, user))
if(!welded)
welded = TRUE
else
src.welded = null
playsound(src, 'sound/items/Welder.ogg', 100, 1)
update_icon()
if(!W.use_tool(src, user, amount = 1))
return

if(!welded)
welded = TRUE
else
return
welded = null
update_icon()

else if(isScrewdriver(C))
if(p_open)
Expand Down
19 changes: 11 additions & 8 deletions code/game/machinery/doors/braces.dm
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,20 @@
return

if(isWelder(W))
var/obj/item/weldingtool/C = W
if(cur_health == max_health)
to_chat(user, "\The [src] does not require repairs.")
return
if(C.remove_fuel(0,user))
playsound(src, 'sound/items/Welder.ogg', 100, 1)
cur_health = min(cur_health + rand(80,120), max_health)
if(cur_health == max_health)
to_chat(user, "You repair some dents on \the [src]. It is in perfect condition now.")
else
to_chat(user, "You repair some dents on \the [src].")

var/obj/item/weldingtool/WT = W

if(!WT.use_tool(src, user, amount = 1))
return FALSE

cur_health = min(cur_health + rand(80,120), max_health)
if(cur_health == max_health)
to_chat(user, "You repair some dents on \the [src]. It is in perfect condition now.")
else
to_chat(user, "You repair some dents on \the [src].")


/obj/item/airlock_brace/proc/take_damage(amount)
Expand Down
24 changes: 14 additions & 10 deletions code/game/machinery/doors/door.dm
Original file line number Diff line number Diff line change
Expand Up @@ -244,16 +244,20 @@
to_chat(user, "<span class='warning'>\The [src] must be closed before you can repair it.</span>")
return

var/obj/item/weldingtool/welder = I
if(welder.remove_fuel(0,user))
to_chat(user, "<span class='notice'>You start to fix dents and weld \the [repairing] into place.</span>")
playsound(src, 'sound/items/Welder.ogg', 100, 1)
if(do_after(user, 5 * repairing.amount, src) && welder && welder.isOn())
to_chat(user, "<span class='notice'>You finish repairing the damage to \the [src].</span>")
health = between(health, health + repairing.amount*DOOR_REPAIR_AMOUNT, maxhealth)
update_icon()
qdel(repairing)
repairing = null
var/obj/item/weldingtool/WT = I

to_chat(user, SPAN_NOTICE("You start to fix dents and weld \the [repairing] into place."))
if(!WT.use_tool(src, user, delay = 5 * repairing.amount, amount = 5))
return

if(QDELETED(src) || !user)
return

to_chat(user, SPAN_NOTICE("You finish repairing the damage to \the [src]."))
health = between(health, health + repairing.amount*DOOR_REPAIR_AMOUNT, maxhealth)
update_icon()
qdel(repairing)
repairing = null
return

if(repairing && isCrowbar(I))
Expand Down
19 changes: 10 additions & 9 deletions code/game/machinery/doors/firedoor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -202,15 +202,16 @@
if(operating)
return//Already doing something.
if(isWelder(C) && !repairing)
var/obj/item/weldingtool/W = C
if(W.remove_fuel(0, user))
blocked = !blocked
user.visible_message("<span class='danger'>\The [user] [blocked ? "welds" : "unwelds"] \the [src] with \a [W].</span>",\
"You [blocked ? "weld" : "unweld"] \the [src] with \the [W].",\
"You hear something being welded.")
playsound(src, 'sound/items/Welder.ogg', 100, 1)
update_icon()
return
var/obj/item/weldingtool/WT = C
if(!WT.use_tool(src, user, amount = 1))
return FALSE

blocked = !blocked
user.visible_message(SPAN_DANGER("\The [user] [blocked ? "welds" : "unwelds"] \the [src] with \a [WT]."),\
"You [blocked ? "weld" : "unweld"] \the [src] with \the [WT].",\
"You hear something being welded.")
update_icon()
return

if(density && isScrewdriver(C))
hatch_open = !hatch_open
Expand Down
21 changes: 11 additions & 10 deletions code/game/machinery/doors/firedoor_assembly.dm
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,18 @@
update_icon()
else if(!anchored && isWelder(C))
var/obj/item/weldingtool/WT = C
if(WT.remove_fuel(0, user))
user.visible_message("<span class='warning'>[user] dissassembles \the [src].</span>",
user.visible_message("<span class='warning'>[user] dissassembles \the [src].</span>",
"You start to dissassemble \the [src].")
if(do_after(user, 40, src))
if(!src || !WT.isOn()) return
user.visible_message("<span class='warning'>[user] has dissassembled \the [src].</span>",
"You have dissassembled \the [src].")
new /obj/item/stack/material/steel(src.loc, 2)
qdel(src)
else
to_chat(user, "<span class='notice'>You need more welding fuel.</span>")
if(!WT.use_tool(src, user, delay = 4 SECONDS, amount = 1))
return

if(QDELETED(src) || !user)
return

user.visible_message("<span class='warning'>[user] has dissassembled \the [src].</span>",
"You have dissassembled \the [src].")
new /obj/item/stack/material/steel(src.loc, 2)
qdel(src)
else
..(C, user)

Expand Down
Loading

0 comments on commit 8f36c54

Please sign in to comment.