Skip to content

Commit

Permalink
Merge pull request #11 from 800maximum123/pyro-orb
Browse files Browse the repository at this point in the history
Welder fix
  • Loading branch information
VoiceInYourHead authored Jun 4, 2024
2 parents 360070b + 6493e41 commit 37741b3
Show file tree
Hide file tree
Showing 57 changed files with 313 additions and 298 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
machine.anchored = TRUE
if(isWelder(I))
var/obj/item/weldingtool/WT = I
if(!WT.can_use(3, user))
if(!WT.can_use(3, user) && (istype(I, /obj/item/weldingtool)))
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.remove_fuel(3, user))
if (!WT.remove_fuel(3, user) && (istype(I, /obj/item/weldingtool)))
return TRUE
TRANSFER_STATE(/singleton/machine_construction/default/deconstructed)
to_chat(user, SPAN_NOTICE("You deconstruct \the [machine]."))
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/barrier.dm
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
return TRUE
if (isWelder(I))
var/obj/item/weldingtool/W = I
if (!W.can_use(1, user))
if (!W.can_use(1, user) && (istype(I, /obj/item/weldingtool)))
return TRUE
if (!emagged)
to_chat(user, SPAN_WARNING("\The [src]'s locking clamps are not damaged."))
Expand Down
18 changes: 9 additions & 9 deletions code/game/machinery/camera/camera.dm
Original file line number Diff line number Diff line change
Expand Up @@ -378,19 +378,19 @@

return null

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

if(busy)
return 0

if(WT.can_use(1, user))
to_chat(user, SPAN_NOTICE("You start to weld \the [src].."))
var/obj/item/weldingtool/WT = I
if(!WT.can_use(1, user) && (istype(I, /obj/item/weldingtool))) return TRUE
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.remove_fuel(1, user))
playsound(src.loc, 'sound/items/Welder.ogg', 50, 1)
busy = 1
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
busy = 0
return 1

busy = 0
return 0
Expand Down
17 changes: 9 additions & 8 deletions code/game/machinery/camera/camera_assembly.dm
Original file line number Diff line number Diff line change
Expand Up @@ -152,19 +152,20 @@
if(!anchored)
..()

/obj/item/camera_assembly/proc/weld(obj/item/weldingtool/WT, mob/user)
/obj/item/camera_assembly/proc/weld(obj/item/I, mob/user)

if(busy)
return 0

if(WT.can_use(1, user))
to_chat(user, SPAN_NOTICE("You start to weld \the [src].."))
var/obj/item/weldingtool/WT = I
if(!WT.can_use(1, user) && (istype(I, /obj/item/weldingtool))) return TRUE
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.remove_fuel(1, user))
playsound(src.loc, 'sound/items/Welder.ogg', 50, 1)
busy = 1
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
busy = 0
return 1

busy = 0
return 0
4 changes: 2 additions & 2 deletions code/game/machinery/computer/ai_core.dm
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ var/global/list/empty_playable_ai_cores = list()
USE_FEEDBACK_FAILURE("\The [src] needs to be unanchored from the floor before you can dismantle it with \the [tool].")
return TRUE
var/obj/item/weldingtool/welder = tool
if (!welder.can_use(1, user, "to deconstruct \the [src]"))
if (!welder.can_use(1, user, "to deconstruct \the [src]") && (istype(tool, /obj/item/weldingtool)))
return TRUE
user.visible_message(
SPAN_NOTICE("\The [user] starst dismantling \the [src] with \a [tool]."),
Expand All @@ -365,7 +365,7 @@ var/global/list/empty_playable_ai_cores = list()
playsound(src, 'sound/items/Welder.ogg', 50, TRUE)
if (!user.do_skilled(SKILL_CONSTRUCTION, 2 SECONDS, src, do_flags = DO_REPAIR_CONSTRUCT) || !user.use_sanity_check(src, tool))
return TRUE
if (!welder.remove_fuel(1, user))
if (!welder.remove_fuel(1, user) && (istype(tool, /obj/item/weldingtool)))
return TRUE
new /obj/item/stack/material/plasteel(loc, 4)
user.visible_message(
Expand Down
4 changes: 2 additions & 2 deletions code/game/machinery/doors/airlock.dm
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,7 @@ About the new airlock wires panel:

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

if (!repairing && isWelder(C) && operating != DOOR_OPERATING_YES && density)
var/obj/item/weldingtool/W = C
if(!W.can_use(1, user))
if(!W.can_use(1, user) && (istype(C, /obj/item/weldingtool)))
return TRUE
playsound(src, 'sound/items/Welder.ogg', 50, 1)
user.visible_message(SPAN_WARNING("\The [user] begins welding \the [src] [welded ? "open" : "closed"]!"),
Expand Down
21 changes: 10 additions & 11 deletions code/game/machinery/doors/braces.dm
Original file line number Diff line number Diff line change
Expand Up @@ -114,19 +114,18 @@
to_chat(user, SPAN_NOTICE("\The [src] does not require repairs."))
return TRUE
var/obj/item/weldingtool/welder = item
if (welder.can_use(1, user))
playsound(src, 'sound/items/Welder.ogg', 100, 1)
if (!welder.can_use(1, user) && (istype(item, /obj/item/weldingtool))) return TRUE
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) && welder.remove_fuel(1, user))
user.visible_message(
SPAN_ITALIC("\The [user] begins repairing damage on \a [src]."),
SPAN_ITALIC("You begin repairing damage on the [src].")
SPAN_ITALIC("\The [user] repairs damage on \a [src]."),
SPAN_ITALIC("You repair damage on the [src].")
)
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].")
)
restore_health(rand(75, 150))
return TRUE
restore_health(rand(75, 150))
return ..()


Expand Down
24 changes: 12 additions & 12 deletions code/game/machinery/doors/door.dm
Original file line number Diff line number Diff line change
Expand Up @@ -227,18 +227,18 @@
return TRUE

var/obj/item/weldingtool/welder = I
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.remove_fuel(2, user))
if (!repairing)
return TRUE//the materials in the door have been removed before welding was finished.

to_chat(user, SPAN_NOTICE("You finish repairing the damage to \the [src]."))
restore_health(repairing.amount * DOOR_REPAIR_AMOUNT)
update_icon()
qdel(repairing)
repairing = null
if(!welder.can_use(2, user) && (istype(I, /obj/item/weldingtool))) return TRUE
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.remove_fuel(2, user))
if (!repairing)
return TRUE//the materials in the door have been removed before welding was finished.

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

if(repairing && isCrowbar(I))
Expand Down
31 changes: 15 additions & 16 deletions code/game/machinery/doors/firedoor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -200,25 +200,24 @@

if(isWelder(C) && !repairing)
var/obj/item/weldingtool/W = C
if(W.can_use(2, user))
if(!W.can_use(2, user) && (istype(C, /obj/item/weldingtool))) return TRUE
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.remove_fuel(2, user))
return TRUE
blocked = !blocked
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_DANGER("\The [user] [blocked ? "welds \the [src] shut" : "cuts open \the [src]"]."),
SPAN_DANGER("You [blocked ? "weld shut" : "undo the welds on"] \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.remove_fuel(2, user))
return TRUE
blocked = !blocked
user.visible_message(
SPAN_DANGER("\The [user] [blocked ? "welds \the [src] shut" : "cuts open \the [src]"]."),
SPAN_DANGER("You [blocked ? "weld shut" : "undo the welds on"] \the [src]."),
SPAN_ITALIC("You hear welding.")
)
playsound(loc, 'sound/items/Welder2.ogg', 50, TRUE)
update_icon()
return TRUE
playsound(loc, 'sound/items/Welder2.ogg', 50, TRUE)
update_icon()

if(density && isScrewdriver(C))
hatch_open = !hatch_open
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/doors/firedoor_assembly.dm
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
USE_FEEDBACK_FAILURE("\The [src] needs to be unanchored before you can dismantle it.")
return TRUE
var/obj/item/weldingtool/welder = tool
if (!welder.can_use(1, user, "to dismantle \the [src]."))
if (!welder.can_use(1, user, "to dismantle \the [src].") && (istype(tool, /obj/item/weldingtool)))
return TRUE
user.visible_message(
SPAN_NOTICE("\The [user] starts dismantling \the [src] with \a [tool]."),
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/floor_light.dm
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var/global/list/floor_light_cache = list()

if (isWelder(W) && (health_damaged() || MACHINE_IS_BROKEN(src)))
var/obj/item/weldingtool/WT = W
if(!WT.can_use(1, user))
if(!WT.can_use(1, user) && (istype(W, /obj/item/weldingtool)))
return TRUE
playsound(src.loc, 'sound/items/Welder.ogg', 50, 1)
if(!do_after(user, (W.toolspeed * 2) SECONDS, src, DO_REPAIR_CONSTRUCT))
Expand Down
8 changes: 4 additions & 4 deletions code/game/machinery/nuclear_bomb.dm
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ var/global/bomb_set
if(0)
if(isWelder(O))
var/obj/item/weldingtool/WT = O
if(!WT.can_use(5, user))
if(!WT.can_use(5, user) && (istype(O, /obj/item/weldingtool)))
return TRUE

user.visible_message(
Expand All @@ -93,7 +93,7 @@ var/global/bomb_set
)

if(do_after(user, (O.toolspeed * 4) SECONDS, src, DO_REPAIR_CONSTRUCT))
if(!src || !user || !WT.remove_fuel(5, user)) return TRUE
if(!src || !user || (!WT.remove_fuel(5, user) && (istype(O, /obj/item/weldingtool)))) return TRUE
user.visible_message(
SPAN_NOTICE("\The [user] cuts through the bolt covers on \the [src]."),
SPAN_NOTICE("You cut through the bolt covers on \the [src].")
Expand All @@ -120,7 +120,7 @@ var/global/bomb_set
if(2)
if(isWelder(O))
var/obj/item/weldingtool/WT = O
if(!WT.can_use(5, user))
if(!WT.can_use(5, user) && (istype(O, /obj/item/weldingtool)))
return TRUE

user.visible_message(
Expand All @@ -129,7 +129,7 @@ var/global/bomb_set
)

if(do_after(user, (O.toolspeed * 4) SECONDS, src, DO_REPAIR_CONSTRUCT))
if(!src || !user || !WT.remove_fuel(5, user)) return TRUE
if(!src || !user || (!WT.remove_fuel(5, user) && (istype(O, /obj/item/weldingtool)))) return TRUE
user.visible_message(
SPAN_NOTICE("\The [user] cuts apart the anchoring system sealant on \the [src]."),
SPAN_NOTICE("You cut apart the anchoring system's sealant.")
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/self_destruct.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
/obj/machinery/self_destruct/use_tool(obj/item/W, mob/living/user, list/click_params)
if(isWelder(W))
var/obj/item/weldingtool/WT = W
if(damaged && WT.can_use(5, user))
if(damaged && (WT.can_use(5, user) && (istype(W, /obj/item/weldingtool)) ))
user.visible_message(
SPAN_NOTICE("\The [user] begins to repair \the [src]."),
SPAN_NOTICE("You begin repairing [src].")
Expand Down
28 changes: 14 additions & 14 deletions code/game/objects/items/stacks/rods.dm
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,20 @@
to_chat(user, SPAN_WARNING("You need at least two rods to do this."))
return TRUE

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(
SPAN_NOTICE("\The [user] welds \the [src] into \a [material.sheet_singular_name]."),
SPAN_NOTICE("You weld \the [src] into \a [material.sheet_singular_name].")
)
var/obj/item/stack/material/rods/R = src
src = null
var/replace = (user.get_inactive_hand()==R)
R.use(2)
if (!R && replace)
user.put_in_hands(new_item)
return TRUE
if(!WT.remove_fuel(1,user) && (istype(W, /obj/item/weldingtool))) return TRUE
var/obj/item/stack/material/new_item = material.place_sheet(usr.loc)
new_item.add_to_stacks(usr)
user.visible_message(
SPAN_NOTICE("\The [user] welds \the [src] into \a [material.sheet_singular_name]."),
SPAN_NOTICE("You weld \the [src] into \a [material.sheet_singular_name].")
)
var/obj/item/stack/material/rods/R = src
src = null
var/replace = (user.get_inactive_hand()==R)
R.use(2)
if (!R && replace)
user.put_in_hands(new_item)
return TRUE

return ..()

Expand Down
8 changes: 4 additions & 4 deletions code/game/objects/items/weapons/material/shards.dm
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@
/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(1, user))
material.place_sheet(get_turf(src))
qdel(src)
return
if(!WT.remove_fuel(1, user) && (istype(W, /obj/item/weldingtool))) return
material.place_sheet(get_turf(src))
qdel(src)
return
return ..()

/obj/item/material/shard/Crossed(AM as mob|obj)
Expand Down
35 changes: 18 additions & 17 deletions code/game/objects/items/weapons/tanks/tanks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -210,24 +210,25 @@ 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.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) && 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)
else
GLOB.bombers += "[key_name(user)] attempted to weld a [src]. [air_contents.temperature-T0C]"
log_and_message_admins("attempted to weld a [src]. [air_contents.temperature-T0C]", user)
if(WT.welding)
to_chat(user, SPAN_DANGER("You accidentally rake \the [W] across \the [src]!"))
maxintegrity -= rand(2,6)
integrity = min(integrity,maxintegrity)
air_contents.add_thermal_energy(rand(2000,50000))
if(!WT.can_use(1,user) && (istype(W, /obj/item/weldingtool))) return
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(!WT.remove_fuel(1, user) && istype(W, /obj/item/weldingtool)) return
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)
else
to_chat(user, SPAN_NOTICE("The emergency pressure relief valve has already been welded."))
GLOB.bombers += "[key_name(user)] attempted to weld a [src]. [air_contents.temperature-T0C]"
log_and_message_admins("attempted to weld a [src]. [air_contents.temperature-T0C]", user)
if(!WT.welding && (istype(W, /obj/item/weldingtool))) return
to_chat(user, SPAN_DANGER("You accidentally rake \the [W] across \the [src]!"))
maxintegrity -= rand(2,6)
integrity = min(integrity,maxintegrity)
air_contents.add_thermal_energy(rand(2000,50000))
else
to_chat(user, SPAN_NOTICE("The emergency pressure relief valve has already been welded."))

/obj/item/tank/attack_self(mob/user as mob)
add_fingerprint(user)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/structures/catwalk.dm
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
// Welding Tool - Deconstruct
if (isWelder(tool))
var/obj/item/weldingtool/welder = tool
if (!welder.remove_fuel(1, user))
if (!welder.remove_fuel(1, user) && (istype(tool, /obj/item/weldingtool)))
return TRUE
deconstruct(user)
return TRUE
Expand Down
Loading

0 comments on commit 37741b3

Please sign in to comment.