Ports use_tool proc from /tg/ (#13411)

This commit is contained in:
Wowzewow (Wezzy)
2022-05-23 14:39:00 +02:00
committed by GitHub
parent 8b8df9e309
commit eafa547b5c
140 changed files with 519 additions and 466 deletions
+1 -2
View File
@@ -51,9 +51,8 @@
*/
/obj/item/canvas/attackby(obj/item/I, mob/user, params)
if(I.iswrench())
playsound(src.loc, I.usesound, 100, 1)
to_chat(user, SPAN_NOTICE("You begin to [anchored ? "loosen" : "tighten"] \the [src]..."))
if(do_after(user, 40 / I.toolspeed))
if(I.use_tool(src, user, 40, volume = 50))
user.visible_message("<b>[user]</b> [anchored ? "loosens" : "tightens"] \the [src].", SPAN_NOTICE("You [anchored ? "loosen" : "tighten"] \the [src]."), SPAN_NOTICE("You hear a ratchet."))
anchored = !anchored
return TRUE
@@ -165,11 +165,11 @@
if (I.iswelder())
var/obj/item/weldingtool/WT = I
if (WT.remove_fuel(2, user))
if (WT.use(2, user))
user.visible_message(SPAN_NOTICE("[user] starts welding the metal shell of [src]."), SPAN_NOTICE("You start [hacked ? "repairing" : "welding open"] the metal covering of [src]."))
playsound(loc, 'sound/items/welder.ogg', 50, 1)
add_overlay("overlay_welding")
if (do_after(user, 25/I.toolspeed))
if(WT.use_tool(src, user, 25, volume = 50))
to_chat(user, SPAN_NOTICE("You are able to [hacked ? "repair" : "weld through"] the metal shell of [src]."))
if (hacked) locked = 1
else locked = 0
+1 -1
View File
@@ -11,7 +11,7 @@
..()
to_chat(usr, "It has [uses] use\s left.")
/obj/item/device/kit/proc/use(var/amt, var/mob/user)
/obj/item/device/kit/use(var/amt, var/mob/user)
uses -= amt
playsound(get_turf(user), 'sound/items/screwdriver.ogg', 50, 1)
if(uses<1)
+1 -1
View File
@@ -23,7 +23,7 @@
to_chat(user, SPAN_NOTICE("\The [src] is fully repaired."))
return TRUE
var/obj/item/weldingtool/WT = W
if(WT.remove_fuel(0, user))
if(WT.use(0, user))
cut_overlays()
LAZYCLEARLIST(bullet_holes)
icon = initial(icon)
+1 -1
View File
@@ -72,7 +72,7 @@ var/global/list/datum/stack_recipe/rod_recipes = list(
to_chat(user, "<span class='warning'>You need at least two rods to do this.</span>")
return
if(WT.remove_fuel(0,user))
if(WT.use(0,user))
var/obj/item/stack/material/steel/new_item = new(usr.loc)
new_item.add_to_stacks(usr)
for (var/mob/M in viewers(src))
@@ -161,7 +161,7 @@
user.visible_message(SPAN_NOTICE("\The [user] starts drying \the [src] with \the [WT]."), SPAN_NOTICE("You start drying the wet leather with \the [WT]..."))
being_dried = TRUE
while(do_after(user, 20, act_target = src) && wetness > 0)
if(!WT.remove_fuel(1) || !WT.isOn())
if(!WT.use(1) || !WT.isOn())
break
if(prob(5))
var/msg = pick("You run the tool over \the [src]...", "The leather is drying nicely...", "You spread the heat out evenly...", "You continue to dry out \the [src].")
@@ -173,7 +173,7 @@
if(!amount || QDELETED(src)) //Safety
break
being_dried = FALSE
else
to_chat(user, SPAN_NOTICE("\The [WT] dries better when it's lit."))
return
@@ -194,4 +194,4 @@
else
new /obj/item/stack/material/leather/fine(get_turf(src))
use(1)
wetness = initial(wetness)
wetness = initial(wetness)
+1 -1
View File
@@ -201,7 +201,7 @@
return 0
return 1
/obj/item/stack/proc/use(var/used)
/obj/item/stack/use(var/used)
if (!can_use(used))
return 0
if(!uses_charge)
+1 -1
View File
@@ -101,7 +101,7 @@
var/obj/item/wirecutters/W = I
user.visible_message(SPAN_WARNING("\The [user] starts snipping some wires in \the [src] with \the [W]..."), \
SPAN_NOTICE("You start snipping some wires in \the [src] with \the [W]..."))
if(do_after(user, 150, TRUE, src))
if(I.use_tool(src, user, 150, volume = 50))
if(prob(W.bomb_defusal_chance))
to_chat(user, SPAN_NOTICE("You successfully defuse \the [src], though it's missing some essential wiring now."))
deactivated = TRUE
@@ -51,7 +51,7 @@
/obj/item/material/shard/attackby(obj/item/W as obj, mob/user as mob)
if(W.iswelder() && material.shard_can_repair)
var/obj/item/weldingtool/WT = W
if(WT.remove_fuel(0, user))
if(WT.use(0, user))
material.place_sheet(user.loc)
qdel(src)
return
@@ -969,7 +969,7 @@
else if(O.isscrewdriver())
if(length(contents) == 0)
to_chat(user, SPAN_NOTICE("You begin poking holes in \the [src]."))
if (do_after(user, 10/O.toolspeed, act_target = src))
if(O.use_tool(src, user, 30))
if(choice == "SmileyFace")
var/obj/item/clothing/head/papersack/smiley/S = new()
user.put_in_hands(S)
@@ -42,23 +42,23 @@
return
if (W.isscrewdriver())
if (do_after(user, 20/W.toolspeed))
if(W.use_tool(src, user, 20, volume = 50))
src.open =! src.open
user.show_message(text("<span class='notice'>You [] the service panel.</span>", (src.open ? "open" : "close")))
to_chat(user, SPAN_NOTICE("You [src.open ? "open" : "close"] the service panel."))
return
if ((W.ismultitool()) && (src.open == 1)&& (!src.l_hacking))
user.show_message("<span class='notice'>Now attempting to reset internal memory, please hold.</span>", 1)
to_chat(user, SPAN_NOTICE("Now attempting to reset internal memory, please hold."))
src.l_hacking = 1
if (do_after(usr, 100))
if (prob(40))
src.l_setshort = 1
src.l_set = 0
user.show_message("<span class='notice'>Internal memory reset. Please give it a few seconds to reinitialize.</span>", 1)
to_chat(user, SPAN_NOTICE("Internal memory reset. Please give it a few seconds to reinitialize."))
sleep(80)
src.l_setshort = 0
src.l_hacking = 0
else
user.show_message("<span class='warning'>Unable to reset internal memory.</span>", 1)
to_chat(user, SPAN_WARNING("Unable to reset internal memory."))
src.l_hacking = 0
else src.l_hacking = 0
return
+2 -2
View File
@@ -138,7 +138,7 @@
user.visible_message("<b>[user]</b> appears out of thin air!", SPAN_NOTICE("You successfully step into your destination."))
use()
/obj/item/syndie/teleporter/proc/use()
/obj/item/syndie/teleporter/use()
addtimer(CALLBACK(src, .proc/recharge), recharge_time)
ready_to_use = FALSE
check_maptext(SMALL_FONTS(6, "Charge"))
@@ -146,4 +146,4 @@
/obj/item/syndie/teleporter/proc/recharge()
ready_to_use = TRUE
check_maptext(SMALL_FONTS(7, "Ready"))
check_maptext(SMALL_FONTS(7, "Ready"))
+10 -10
View File
@@ -237,7 +237,7 @@
//Welding tool specific stuff
var/welding = 0 //Whether or not the welding tool is off(0), on(1) or currently welding(2)
var/status = 1 //Whether the welder is secured or unsecured (able to attach rods to it to make a flamethrower)
var/status = TRUE //Whether the welder is secured or unsecured (able to attach rods to it to make a flamethrower)
var/max_fuel = 20 //The max amount of fuel the welder can hold
var/change_icons = TRUE
@@ -362,7 +362,7 @@
/obj/item/weldingtool/process()
if(welding)
if(prob(5))
remove_fuel(1, null, colourChange = FALSE)
use(1, null, colourChange = FALSE)
if(get_fuel() < 1)
setWelding(0)
@@ -414,7 +414,7 @@
return
if(do_mob(user, target, 30))
if(remove_fuel(0))
if(use(0))
var/static/list/repair_messages = list(
"patches some dents",
"mends some tears",
@@ -422,7 +422,7 @@
)
affecting.heal_damage(brute = 15, robo_repair = TRUE)
user.visible_message(SPAN_WARNING("\The [user] [pick(repair_messages)] on [target]'s [affecting.name] with \the [src]."))
playsound(target, 'sound/items/welder_pry.ogg', 15)
playsound(target, usesound, 15)
repair_organ(user, target, affecting)
/obj/item/weldingtool/afterattack(obj/O, mob/user, proximity)
@@ -467,7 +467,7 @@
return
return
if (welding)
remove_fuel(1)
use(1)
var/turf/location = get_turf(user)
if(isliving(O))
var/mob/living/L = O
@@ -483,12 +483,11 @@
/obj/item/weldingtool/proc/get_fuel()
return REAGENT_VOLUME(reagents, /decl/reagent/fuel)
//Removes fuel from the welding tool. If a mob is passed, it will perform an eyecheck on the mob. This should probably be renamed to use()
/obj/item/weldingtool/proc/remove_fuel(var/amount = 1, var/mob/M = null, var/colourChange = TRUE)
//Removes fuel from the welding tool. If a mob is passed, it will perform an eyecheck on the mob.
/obj/item/weldingtool/use(var/amount = 1, var/mob/M = null, var/colourChange = TRUE)
if(!welding)
return 0
else if(welding > 0 && colourChange)
set_light(0.7, 2, l_color = LIGHT_COLOR_CYAN)
addtimer(CALLBACK(src, /atom/proc/update_icon), 5)
if(get_fuel() >= amount)
reagents.remove_reagent(/decl/reagent/fuel, amount)
@@ -530,6 +529,7 @@
damtype = BURN
w_class = ITEMSIZE_LARGE
welding = TRUE
hitsound = SOUNDS_LASER_MEAT
attack_verb = list("scorched", "burned", "blasted", "blazed")
update_icon()
set_processing(TRUE)
@@ -679,7 +679,7 @@
return
return ..()
/obj/item/weldingtool/experimental/remove_fuel(amount, mob/M, colourChange)
/obj/item/weldingtool/experimental/use(amount, mob/M, colourChange)
. = ..(overcap ? amount * 3 : amount, M, colourChange)
if(!. && welding && overcap) // to ensure that the fuel gets used even if the amount is high
reagents.remove_reagent(/decl/reagent/fuel, get_fuel())
@@ -979,7 +979,7 @@
attack_verb = list("smashed", "hammered")
drop_sound = 'sound/items/drop/crowbar.ogg'
pickup_sound = 'sound/items/pickup/crowbar.ogg'
usesound = /decl/sound_category/crowbar_sound
usesound = /decl/sound_category/hammer_sound
/obj/item/hammer/Initialize()
. = ..()
+7 -8
View File
@@ -378,14 +378,14 @@
else if(W.iswelder())
var/obj/item/weldingtool/WT = W
if(!WT.welding)
to_chat(user, SPAN_WARNING("Your \the [W] is off!"))
if(!WT.isOn())
to_chat(user, SPAN_WARNING("\The [WT] is off!"))
return
user.visible_message("<span class='notice'>[user] is trying to slice \the [src] open!</span>",
"<span class='notice'>You are trying to slice \the [src] open!</span>")
if (do_after(user, 30/W.toolspeed, act_target = src))
if(WT.remove_fuel(2, user))
if(WT.use_tool(src, user, 60, volume = 50))
if(WT.use(2, user))
user.visible_message("<span class='notice'>[user] slices \the [src] open!</span>",
"<span class='notice'>You slice \the [src] open!</span>")
new /obj/item/stack/rods(src.loc, resources["rods"])
@@ -404,7 +404,7 @@
"<span class='notice'>You are trying to [anchored ? "un" : "" ]secure \the [src]!</span>")
playsound(src.loc, "sound/items/[pick("Screwdriver", "Screwdriver2")].ogg", 50, 1)
if (do_after(user, 30/W.toolspeed, act_target = src))
if(W.use_tool(src, user, 30, volume = 50))
density = !density
anchored = !anchored
user.visible_message("<span class='notice'>[user] [anchored ? "" : "un" ]secures \the [src]!</span>",
@@ -573,9 +573,8 @@
user.visible_message("<span class='notice'>[user] begins [anchored ? "un" : "" ]securing \the [src]!</span>",
"<span class='notice'>You begin [anchored ? "un" : "" ]securing \the [src]!</span>")
playsound(src.loc, W.usesound, 50, 1)
if(do_after(user, 30/W.toolspeed, act_target = src))
if(W.use_tool(src, user, 30, volume = 50))
anchored = !anchored
user.visible_message("<span class='notice'>[user] [anchored ? "" : "un" ]secures \the [src]!</span>",
"<span class='notice'>You [anchored ? "" : "un" ]secure \the [src]!</span>")
@@ -689,4 +688,4 @@
if(!L.lying && (L.m_intent == M_RUN) || prob(5))
L.visible_message(SPAN_DANGER("\The [L] trips over \the [src]!"), FONT_LARGE(SPAN_DANGER("You trip over \the [src]!")))
L.Weaken(3)
L.Weaken(3)