Skip to content

Commit

Permalink
[MIRROR] Standardizes welding checks/values
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanuelbassil authored and SuhEugene committed Nov 16, 2023
1 parent 76ad5fb commit cdb889e
Show file tree
Hide file tree
Showing 33 changed files with 87 additions and 118 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@
machine.anchored = TRUE
if(isWelder(I))
var/obj/item/weldingtool/WT = I
if(!WT.remove_fuel(0, user))
to_chat(user, "The welding tool must be on to complete this task.")
if(!WT.can_use(3, user))
return TRUE
playsound(machine.loc, 'sound/items/Welder.ogg', 50, 1)
if(do_after(user, (I.toolspeed * 2) SECONDS, machine, DO_REPAIR_CONSTRUCT))
if(!WT.isOn())
if (!WT.remove_fuel(3, user))
return TRUE
TRANSFER_STATE(/singleton/machine_construction/default/deconstructed)
to_chat(user, SPAN_NOTICE("You deconstruct \the [machine]."))
Expand Down
4 changes: 2 additions & 2 deletions code/game/machinery/camera/camera.dm
Original file line number Diff line number Diff line change
Expand Up @@ -384,11 +384,11 @@
if(busy)
return 0

if(WT.remove_fuel(0, user))
if(WT.can_use(1, user))
to_chat(user, SPAN_NOTICE("You start to weld \the [src].."))
playsound(src.loc, 'sound/items/Welder.ogg', 50, 1)
busy = 1
if(do_after(user, 10 SECONDS, src, DO_REPAIR_CONSTRUCT) && WT.isOn())
if(do_after(user, 10 SECONDS, src, DO_REPAIR_CONSTRUCT) && WT.remove_fuel(1, user))
playsound(src.loc, 'sound/items/Welder.ogg', 50, 1)
busy = 0
return 1
Expand Down
4 changes: 2 additions & 2 deletions code/game/machinery/camera/camera_assembly.dm
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,11 @@
if(busy)
return 0

if(WT.remove_fuel(0, user))
if(WT.can_use(1, user))
to_chat(user, SPAN_NOTICE("You start to weld \the [src].."))
playsound(src.loc, 'sound/items/Welder.ogg', 50, 1)
busy = 1
if(do_after(user, 2 SECONDS, src, DO_REPAIR_CONSTRUCT) && WT.isOn())
if(do_after(user, 2 SECONDS, src, DO_REPAIR_CONSTRUCT) && WT.remove_fuel(1, user))
playsound(src.loc, 'sound/items/Welder.ogg', 50, 1)
busy = 0
return 1
Expand Down
7 changes: 3 additions & 4 deletions code/game/machinery/doors/airlock.dm
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,7 @@ About the new airlock wires panel:

if(isWelder(item))
var/obj/item/weldingtool/WT = item
if(!WT.remove_fuel(0,user))
if(!WT.remove_fuel(3,user))
return 0
cut_verb = "cutting"
cut_sound = 'sound/items/Welder.ogg'
Expand Down Expand Up @@ -995,14 +995,13 @@ About the new airlock wires panel:

if (!repairing && isWelder(C) && operating != DOOR_OPERATING_YES && density)
var/obj/item/weldingtool/W = C
if(!W.remove_fuel(0,user))
to_chat(user, SPAN_NOTICE("Your [W.name] doesn't have enough fuel."))
if(!W.can_use(1, user))
return
playsound(src, 'sound/items/Welder.ogg', 50, 1)
user.visible_message(SPAN_WARNING("\The [user] begins welding \the [src] [welded ? "open" : "closed"]!"),
SPAN_NOTICE("You begin welding \the [src] [welded ? "open" : "closed"]."))
if(do_after(user, (rand(3,5)) SECONDS, src, DO_REPAIR_CONSTRUCT))
if (density && operating != DOOR_OPERATING_YES && !repairing)
if (density && operating != DOOR_OPERATING_YES && !repairing && W.remove_fuel(1, user))
playsound(src, 'sound/items/Welder2.ogg', 50, 1)
welded = !welded
update_icon()
Expand Down
4 changes: 2 additions & 2 deletions code/game/machinery/doors/braces.dm
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,13 @@
to_chat(user, SPAN_NOTICE("\The [src] does not require repairs."))
return TRUE
var/obj/item/weldingtool/welder = item
if (welder.remove_fuel(1, user))
if (welder.can_use(1, user))
playsound(src, 'sound/items/Welder.ogg', 100, 1)
user.visible_message(
SPAN_ITALIC("\The [user] begins repairing damage on \a [src]."),
SPAN_ITALIC("You begin repairing damage on the [src].")
)
if (do_after(user, (item.toolspeed * 3) SECONDS, airlock, DO_DEFAULT | DO_USER_UNIQUE_ACT | DO_PUBLIC_PROGRESS))
if (do_after(user, (item.toolspeed * 3) SECONDS, airlock, DO_DEFAULT | DO_USER_UNIQUE_ACT | DO_PUBLIC_PROGRESS) && welder.remove_fuel(1, user))
user.visible_message(
SPAN_ITALIC("\The [user] repairs damage on \a [src]."),
SPAN_ITALIC("You repair damage on the [src].")
Expand Down
4 changes: 2 additions & 2 deletions code/game/machinery/doors/door.dm
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,10 @@
return

var/obj/item/weldingtool/welder = I
if(welder.remove_fuel(0,user))
if(welder.can_use(2, user))
to_chat(user, SPAN_NOTICE("You start to fix dents and weld \the [repairing] into place."))
playsound(src, 'sound/items/Welder.ogg', 100, 1)
if(do_after(user, (0.5 * repairing.amount) SECONDS, src, DO_REPAIR_CONSTRUCT) && welder && welder.isOn())
if(do_after(user, (0.5 * repairing.amount) SECONDS, src, DO_REPAIR_CONSTRUCT) && welder.remove_fuel(2, user))
if (!repairing)
return //the materials in the door have been removed before welding was finished.

Expand Down
4 changes: 2 additions & 2 deletions code/game/machinery/doors/firedoor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -199,15 +199,15 @@

if(isWelder(C) && !repairing)
var/obj/item/weldingtool/W = C
if(W.remove_fuel(0, user))
if(W.can_use(2, user))
user.visible_message(
SPAN_WARNING("\The [user] starts [!blocked ? "welding \the [src] shut" : "cutting open \the [src]"]."),
SPAN_DANGER("You start [!blocked ? "welding \the [src] closed" : "cutting open \the [src]"]."),
SPAN_ITALIC("You hear welding.")
)
playsound(loc, 'sound/items/Welder.ogg', 50, TRUE)
if(do_after(user, (C.toolspeed * 2) SECONDS, src, DO_REPAIR_CONSTRUCT))
if(!W.isOn())
if(!W.remove_fuel(2, user))
return
blocked = !blocked
user.visible_message(
Expand Down
5 changes: 2 additions & 3 deletions code/game/machinery/floor_light.dm
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,12 @@ var/global/list/floor_light_cache = list()
visible_message(SPAN_NOTICE("\The [user] has [anchored ? "attached" : "detached"] \the [src]."))
else if(isWelder(W) && (damaged || MACHINE_IS_BROKEN(src)))
var/obj/item/weldingtool/WT = W
if(!WT.remove_fuel(0, user))
to_chat(user, SPAN_WARNING("\The [src] must be on to complete this task."))
if(!WT.can_use(1, user))
return
playsound(src.loc, 'sound/items/Welder.ogg', 50, 1)
if(!do_after(user, (W.toolspeed * 2) SECONDS, src, DO_REPAIR_CONSTRUCT))
return
if(!src || !WT.isOn())
if(!src || !WT.remove_fuel(1, user))
return
visible_message(SPAN_NOTICE("\The [user] has repaired \the [src]."))
set_broken(FALSE)
Expand Down
10 changes: 2 additions & 8 deletions code/game/machinery/nuclear_bomb.dm
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,10 @@ var/global/bomb_set
if(0)
if(isWelder(O))
var/obj/item/weldingtool/WT = O
if(!WT.isOn()) return
if(WT.get_fuel() < 5) // uses up 5 fuel.
to_chat(user, SPAN_WARNING("You need more fuel to complete this task."))
if(!WT.can_use(5, user))
return

user.visible_message("[user] starts cutting loose the anchoring bolt covers on [src].", "You start cutting loose the anchoring bolt covers with [O]...")

if(do_after(user, (O.toolspeed * 4) SECONDS, src, DO_REPAIR_CONSTRUCT))
if(!src || !user || !WT.remove_fuel(5, user)) return
user.visible_message("\The [user] cuts through the bolt covers on \the [src].", "You cut through the bolt cover.")
Expand All @@ -112,13 +109,10 @@ var/global/bomb_set
if(2)
if(isWelder(O))
var/obj/item/weldingtool/WT = O
if(!WT.isOn()) return
if (WT.get_fuel() < 5) // uses up 5 fuel.
to_chat(user, SPAN_WARNING("You need more fuel to complete this task."))
if(!WT.can_use(5, user))
return

user.visible_message("[user] starts cutting apart the anchoring system sealant on [src].", "You start cutting apart the anchoring system's sealant with [O]...")

if(do_after(user, (O.toolspeed * 4) SECONDS, src, DO_REPAIR_CONSTRUCT))
if(!src || !user || !WT.remove_fuel(5, user)) return
user.visible_message("\The [user] cuts apart the anchoring system sealant on \the [src].", "You cut apart the anchoring system's sealant.")
Expand Down
10 changes: 3 additions & 7 deletions code/game/machinery/portable_turret.dm
Original file line number Diff line number Diff line change
Expand Up @@ -692,10 +692,7 @@ var/global/list/turret_icons

else if(isWelder(I))
var/obj/item/weldingtool/WT = I
if(!WT.isOn())
return
if(WT.get_fuel() < 5) //uses up 5 fuel.
to_chat(user, SPAN_NOTICE("You need more fuel to complete this task."))
if(!WT.can_use(5, user))
return

playsound(loc, pick('sound/items/Welder.ogg', 'sound/items/Welder2.ogg'), 50, 1)
Expand Down Expand Up @@ -771,9 +768,8 @@ var/global/list/turret_icons
if(7)
if(isWelder(I))
var/obj/item/weldingtool/WT = I
if(!WT.isOn()) return
if(WT.get_fuel() < 5)
to_chat(user, SPAN_NOTICE("You need more fuel to complete this task."))
if(!WT.can_use(5, user))
return

playsound(loc, pick('sound/items/Welder.ogg', 'sound/items/Welder2.ogg'), 50, 1)
if(do_after(user, (I.toolspeed * 3) SECONDS, src, DO_REPAIR_CONSTRUCT))
Expand Down
18 changes: 9 additions & 9 deletions code/game/machinery/self_destruct.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@

/obj/machinery/self_destruct/attackby(obj/item/W as obj, mob/user as mob)
if(isWelder(W))
if(damaged)
user.visible_message("[user] begins to repair [src].", "You begin repairing [src].")
if(do_after(usr, (W.toolspeed * 10) SECONDS, src, DO_REPAIR_CONSTRUCT))
var/obj/item/weldingtool/w
if(w.burn_fuel(10))
damaged = 0
user.visible_message("[user] repairs [src].", "You repair [src].")
else
to_chat(user, SPAN_WARNING("There is not enough fuel to repair [src]."))
var/obj/item/weldingtool/WT = W
if(damaged && WT.can_use(5, user))
user.visible_message(
SPAN_NOTICE("\The [user] begins to repair \the [src]."),
SPAN_NOTICE("You begin repairing [src].")
)
if(do_after(usr, (W.toolspeed * 10) SECONDS, src, DO_REPAIR_CONSTRUCT) && WT.remove_fuel(10, user))
damaged = 0
user.visible_message("[user] repairs [src].", "You repair [src].")
return
if(istype(W, /obj/item/nuclear_cylinder))
if(damaged)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/stacks/rods.dm
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
to_chat(user, SPAN_WARNING("You need at least two rods to do this."))
return TRUE

if(WT.remove_fuel(0,user))
if(WT.remove_fuel(1,user))
var/obj/item/stack/material/new_item = material.place_sheet(usr.loc)
new_item.add_to_stacks(usr)
user.visible_message(
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/weapons/material/shards.dm
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
/obj/item/material/shard/attackby(obj/item/W as obj, mob/user as mob)
if(isWelder(W) && material.shard_can_repair)
var/obj/item/weldingtool/WT = W
if(WT.remove_fuel(0, user))
if(WT.remove_fuel(1, user))
material.place_sheet(get_turf(src))
qdel(src)
return
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/items/weapons/tanks/tanks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,11 @@ var/global/list/tank_gauge_cache = list()
if (GET_FLAGS(tank_flags, TANK_FLAG_FORCED))
to_chat(user, SPAN_WARNING("\The [src]'s emergency relief valve must be closed before you can weld it shut!"))
return
if(WT.remove_fuel(1,user))
if(WT.can_use(1,user))
add_fingerprint(user)
if(!GET_FLAGS(tank_flags, TANK_FLAG_WELDED))
to_chat(user, SPAN_NOTICE("You begin welding the \the [src] emergency pressure relief valve."))
if(do_after(user, (W.toolspeed * 4) SECONDS, src, DO_PUBLIC_UNIQUE))
if(do_after(user, (W.toolspeed * 4) SECONDS, src, DO_PUBLIC_UNIQUE) && WT.remove_fuel(1, user))
to_chat(user, "[SPAN_NOTICE("You carefully weld \the [src] emergency pressure relief valve shut.")][SPAN_WARNING(" \The [src] may now rupture under pressure!")]")
SET_FLAGS(tank_flags, TANK_FLAG_WELDED)
CLEAR_FLAGS(tank_flags, TANK_FLAG_LEAKING)
Expand Down
6 changes: 2 additions & 4 deletions code/game/objects/items/weapons/tools/weldingtool.dm
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@
return

if(welding)
remove_fuel(1)
var/turf/location = get_turf(user)
if(isliving(O))
var/mob/living/L = O
Expand Down Expand Up @@ -292,12 +291,11 @@
to_chat(user, SPAN_WARNING("\The [M]'s [S.name] is hard and brittle - \the [src] cannot repair it."))
return TRUE

if (!welding)
to_chat(user, SPAN_WARNING("You'll need to turn [src] on to patch the damage on [M]'s [S.name]!"))
if (!can_use(2, user, "to patch the damage on [M]'s [S.name]"))
return TRUE

if (S.robo_repair(15, DAMAGE_BRUTE, "some dents", src, user))
remove_fuel(1, user)
remove_fuel(2, user)
return TRUE
else return FALSE

Expand Down
6 changes: 3 additions & 3 deletions code/game/turfs/simulated/floor_attackby.dm
Original file line number Diff line number Diff line change
Expand Up @@ -160,17 +160,17 @@
return
else if(isWelder(C))
var/obj/item/weldingtool/welder = C
if(welder.isOn() && (is_plating()))
if(welder.can_use(2, user) && (is_plating()))
if(broken || burnt)
if(welder.remove_fuel(0, user))
if(welder.remove_fuel(2, user))
to_chat(user, SPAN_NOTICE("You fix some dents on the broken plating."))
playsound(src, 'sound/items/Welder.ogg', 80, 1)
icon_state = "plating"
burnt = null
broken = null
return
else
if(welder.remove_fuel(0, user))
if(welder.remove_fuel(2, user))
playsound(src, 'sound/items/Welder.ogg', 80, 1)
visible_message(SPAN_NOTICE("[user] has started melting the plating's reinforcements!"))
if(do_after(user, (C.toolspeed * 5) SECONDS, src, DO_REPAIR_CONSTRUCT) && welder.isOn() && welder_melt())
Expand Down
14 changes: 7 additions & 7 deletions code/game/turfs/simulated/wall_attacks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@
if(locate(/obj/overlay/wallrot) in src)
if(isWelder(W))
var/obj/item/weldingtool/WT = W
if( WT.remove_fuel(0,user) )
if( WT.remove_fuel(1,user) )
to_chat(user, SPAN_NOTICE("You burn away the fungi with \the [WT]."))
playsound(src, 'sound/items/Welder.ogg', 10, 1)
for(var/obj/overlay/wallrot/WR in src)
Expand All @@ -193,7 +193,7 @@
if(thermite)
if(isWelder(W))
var/obj/item/weldingtool/WT = W
if( WT.remove_fuel(0,user) )
if( WT.remove_fuel(1,user) )
thermitemelt(user)
return

Expand All @@ -219,10 +219,10 @@

var/obj/item/weldingtool/WT = W

if(WT.remove_fuel(0,user))
if(WT.can_use(2, user))
to_chat(user, SPAN_NOTICE("You start repairing the damage to [src]."))
playsound(src, 'sound/items/Welder.ogg', 100, 1)
if(do_after(user, max(5, damage / 5), src, DO_REPAIR_CONSTRUCT) && WT && WT.isOn())
if(do_after(user, max(5, damage / 5), src, DO_REPAIR_CONSTRUCT) && WT.remove_fuel(2, user))
to_chat(user, SPAN_NOTICE("You finish repairing the damage to [src]."))
restore_health(damage)
return
Expand All @@ -237,7 +237,7 @@

if(istype(W,/obj/item/weldingtool))
var/obj/item/weldingtool/WT = W
if(!WT.remove_fuel(0,user))
if(!WT.remove_fuel(1,user))
return
dismantle_verb = "cutting"
dismantle_sound = 'sound/items/Welder.ogg'
Expand Down Expand Up @@ -322,7 +322,7 @@
var/strict_timer_flags = FALSE
if(istype(W,/obj/item/weldingtool))
var/obj/item/weldingtool/WT = W
if(WT.remove_fuel(0,user))
if(WT.remove_fuel(1,user))
cut_cover=1
else
return
Expand Down Expand Up @@ -367,7 +367,7 @@
var/strict_timer_flags = FALSE
if(istype(W, /obj/item/weldingtool))
var/obj/item/weldingtool/WT = W
if( WT.remove_fuel(0,user) )
if(WT.remove_fuel(1,user))
cut_cover=1
else
return
Expand Down
5 changes: 2 additions & 3 deletions code/modules/atmospherics/components/unary/vent_pump.dm
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@
to_chat(user, SPAN_NOTICE("The welding tool needs to be on to start this task."))
return 1

if(!WT.remove_fuel(0,user))
if(!WT.can_use(1,user))
to_chat(user, SPAN_WARNING("You need more welding fuel to complete this task."))
return 1

Expand All @@ -285,8 +285,7 @@
if(!src)
return 1

if(!WT.isOn())
to_chat(user, SPAN_NOTICE("The welding tool needs to be on to finish this task."))
if(!WT.remove_fuel(1, user))
return 1

welded = !welded
Expand Down
5 changes: 2 additions & 3 deletions code/modules/atmospherics/components/unary/vent_scrubber.dm
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@
to_chat(user, SPAN_NOTICE("The welding tool needs to be on to start this task."))
return 1

if(!WT.remove_fuel(0,user))
if(!WT.can_use(1,user))
to_chat(user, SPAN_WARNING("You need more welding fuel to complete this task."))
return 1

Expand All @@ -226,8 +226,7 @@
if(!src)
return 1

if(!WT.isOn())
to_chat(user, SPAN_NOTICE("The welding tool needs to be on to finish this task."))
if(!WT.remove_fuel(1, user))
return 1

welded = !welded
Expand Down
1 change: 0 additions & 1 deletion code/modules/clothing/spacesuits/breaches.dm
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@

var/obj/item/weldingtool/WT = W
if(!WT.remove_fuel(5))
to_chat(user, SPAN_WARNING("You need more welding fuel to repair this suit."))
return

repair_breaches(DAMAGE_BRUTE, 3, user)
Expand Down
Loading

0 comments on commit cdb889e

Please sign in to comment.