12-18-2019, 08:19 PM
so this is basically just a proc that makes it easier to do all the welder stuff in a smaller amount of code. right now welder stuff is like 2 separate checks, and another line of code to use fuel, which makes code take up more space and look a bit uglier.
the proc has 3 arguments: welder object, fuel needed, fuel to use
EXAMPLE:
(before proc)
(after proc)
compare link:
the proc has 3 arguments: welder object, fuel needed, fuel to use
- welder object is just the welder that youre seeing if it can weld
- fuel needed is a number that is compared against the welders current fuel (default value of 2)
- fuel to use is how much fuel should be consumed per operation (default value of 1)
EXAMPLE:
(before proc)
Code:
if (src.open)
if (!src.is_short && istype(W, /obj/item/weldingtool))
var/obj/item/weldingtool/welder = W
if (welder.welding && !src.legholes)
if (welder.get_fuel() < 2)
user.show_text("Need more fuel!", "red")
return
welder.use_fuel(1)
src.legholes = 1
src.visible_message("<span style=\"color:red\">[user] adds some holes to the bottom of [src] with [welder].</span>")
return
(after proc)
Code:
if (src.open)
if (!src.is_short && istype(W, /obj/item/weldingtool))
var/obj/item/weldingtool/welder = W
if (can_weld(W) && !src.legholes)
src.legholes = 1
src.visible_message("<span style=\"color:red\">[user] adds some holes to the bottom of [src] with [welder].</span>")
return
compare link: