[Testmerge ready] Ports tool behaviours; refactors all tools; adds functionality for self-filling reagent containers (#11700)

* Adds support for self-filling reagent containers

* Sets tool_behaviour on the default set of tools

* Fixing merge conflicts

* Refactors welder to use tool behaviour

* The refactor: part I

* The refactor: part II

* Tool Refactor Part III: Revenge of the Maint

* Tool Refactor Part IV: A New Hope

* Tool Refactor Part V: The Oldcoder Strikes Back

* Tool Refactor Part VI: Return of the Coder

* VII

* Holy shit, it compiles?!

* Nannek I completed your TODO, you owe me ice cream

* Tool helpers; telepad is compliant

* Bugtest, Round 1: Fight

Fuck refactoring disposals

* Buggfixing, Round 2: Electric Boogaloo

* Personal crafting uses tool behaviours now

* Construction datums use new tool behaviours; better way of handling fueltank refuelling; more bugfixing

* multitool_check_buffer change; removes some useless things in tool_helpers

* proc name change

* TRUE/FALSE changes

* Bugfixing, Round 3: A Good Day To Bugfix Hard

Fixes multiple issues raised by the testmerge

* Minor style changes
This commit is contained in:
Citinited
2020-02-15 13:31:08 -07:00
committed by GitHub
parent 5b1941e784
commit fddff1049b
238 changed files with 6681 additions and 5544 deletions
+21 -17
View File
@@ -36,26 +36,30 @@
return
update_icon()
to_chat(user, "<span class='notice'>You add the cables to the [src]. It now contains [loaded.amount].</span>")
else if(isscrewdriver(W))
if(!loaded)
return
to_chat(user, "<span class='notice'>You loosen the securing screws on the side, allowing you to lower the guiding edge and retrieve the wires.</span>")
while(loaded.amount > 30) //There are only two kinds of situations: "nodiff" (60,90), or "diff" (31-59, 61-89)
var/diff = loaded.amount % 30
if(diff)
loaded.use(diff)
new /obj/item/stack/cable_coil(user.loc, diff)
else
loaded.use(30)
new /obj/item/stack/cable_coil(user.loc, 30)
loaded.max_amount = initial(loaded.max_amount)
loaded.forceMove(user.loc)
user.put_in_hands(loaded)
loaded = null
update_icon()
else
..()
/obj/item/twohanded/rcl/screwdriver_act(mob/user, obj/item/I)
if(!loaded)
return
. = TRUE
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
return
to_chat(user, "<span class='notice'>You loosen the securing screws on the side, allowing you to lower the guiding edge and retrieve the wires.</span>")
while(loaded.amount > 30) //There are only two kinds of situations: "nodiff" (60,90), or "diff" (31-59, 61-89)
var/diff = loaded.amount % 30
if(diff)
loaded.use(diff)
new /obj/item/stack/cable_coil(user.loc, diff)
else
loaded.use(30)
new /obj/item/stack/cable_coil(user.loc, 30)
loaded.max_amount = initial(loaded.max_amount)
loaded.forceMove(user.loc)
user.put_in_hands(loaded)
loaded = null
update_icon()
/obj/item/twohanded/rcl/examine(mob/user)
. = ..()
if(loaded)
+6 -6
View File
@@ -64,14 +64,14 @@ LIGHTERS ARE IN LIGHTERS.DM
..()
light()
/obj/item/clothing/mask/cigarette/welder_act(mob/user, obj/item/I)
. = TRUE
if(I.tool_use_check(user, 0)) //Don't need to flash eyes because you are a badass
light("<span class='notice'>[user] casually lights the [name] with [I], what a badass.</span>")
/obj/item/clothing/mask/cigarette/attackby(obj/item/W as obj, mob/user as mob, params)
..()
if(istype(W, /obj/item/weldingtool))
var/obj/item/weldingtool/WT = W
if(WT.isOn())//Badasses dont get blinded while lighting their cig with a welding tool
light("<span class='notice'>[user] casually lights the [name] with [W], what a badass.</span>")
else if(istype(W, /obj/item/lighter/zippo))
if(istype(W, /obj/item/lighter/zippo))
var/obj/item/lighter/zippo/Z = W
if(Z.lit)
light("<span class='rose'>With a single flick of [user.p_their()] wrist, [user] smoothly lights [user.p_their()] [name] with [user.p_their()] [W]. Damn [user.p_theyre()] cool.</span>")
@@ -0,0 +1,21 @@
// Conversion kit
/obj/item/conversion_kit
name = "\improper Revolver Conversion Kit"
desc = "A professional conversion kit used to convert any knock off revolver into the real deal capable of shooting lethal .357 rounds without the possibility of catastrophic failure."
icon_state = "kit"
flags = CONDUCT
w_class = WEIGHT_CLASS_SMALL
origin_tech = "combat=2"
var/open = 0
/obj/item/conversion_kit/New()
..()
update_icon()
/obj/item/conversion_kit/update_icon()
icon_state = "[initial(icon_state)]_[open]"
/obj/item/conversion_kit/attack_self(mob/user)
open = !open
to_chat(user, "<span class='notice'>You [open ? "open" : "close"] the conversion kit.</span>")
update_icon()
+2 -2
View File
@@ -7,7 +7,7 @@ obj/item/firework
obj/item/firework/attackby(obj/item/W,mob/user, params)
if(litzor)
return
if(istype(W, /obj/item/weldingtool) && W:welding || istype(W,/obj/item/lighter) && W:lit)
if(is_hot(W))
for(var/mob/M in viewers(user))
to_chat(M, "[user] lits \the [src]")
litzor = 1
@@ -29,7 +29,7 @@ obj/item/sparkler
obj/item/sparkler/attackby(obj/item/W,mob/user, params)
if(litzor)
return
if(istype(W, /obj/item/weldingtool) && W:welding || istype(W,/obj/item/lighter) && W:lit)
if(is_hot(W))
for(var/mob/M in viewers(user))
to_chat(M, "[user] lits \the [src]")
litzor = 1
+29 -24
View File
@@ -76,28 +76,7 @@
flame_turf(turflist)
/obj/item/flamethrower/attackby(obj/item/I, mob/user, params)
if(iswrench(I) && !status)//Taking this apart
var/turf/T = get_turf(src)
if(weldtool)
weldtool.forceMove(T)
weldtool = null
if(igniter)
igniter.forceMove(T)
igniter = null
if(ptank)
ptank.forceMove(T)
ptank = null
new /obj/item/stack/rods(T)
qdel(src)
return
else if(isscrewdriver(I) && igniter && !lit)
status = !status
to_chat(user, "<span class='notice'>[igniter] is now [status ? "secured" : "unsecured"]!</span>")
update_icon()
return
else if(isigniter(I))
if(isigniter(I))
var/obj/item/assembly/igniter/IG = I
if(IG.secured)
return
@@ -130,6 +109,34 @@
else
return ..()
/obj/item/flamethrower/wrench_act(mob/user, obj/item/I)
if(status)
return
. = TRUE
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
return
var/turf/T = get_turf(src)
if(weldtool)
weldtool.forceMove(T)
weldtool = null
if(igniter)
igniter.forceMove(T)
igniter = null
if(ptank)
ptank.forceMove(T)
ptank = null
new /obj/item/stack/rods(T)
qdel(src)
/obj/item/flamethrower/screwdriver_act(mob/user, obj/item/I)
if(!igniter || lit)
return
. = TRUE
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
return
status = !status
to_chat(user, "<span class='notice'>[igniter] is now [status ? "secured" : "unsecured"]!</span>")
update_icon()
/obj/item/flamethrower/attack_self(mob/user)
toggle_igniter(user)
@@ -168,7 +175,6 @@
..()
weldtool = locate(/obj/item/weldingtool) in contents
igniter = locate(/obj/item/assembly/igniter) in contents
weldtool.status = FALSE
igniter.secured = FALSE
status = TRUE
update_icon()
@@ -216,7 +222,6 @@
if(create_full)
if(!weldtool)
weldtool = new /obj/item/weldingtool(src)
weldtool.status = FALSE
if(!igniter)
igniter = new igniter_type(src)
igniter.secured = FALSE
@@ -387,18 +387,18 @@
origin_tech = "combat=3;engineering=4"
var/unit_spread = 10 // Amount of units per repeat. Can be altered with a multitool.
/obj/item/grenade/chem_grenade/adv_release/attackby(obj/item/I, mob/user, params)
if(ismultitool(I))
switch(unit_spread)
if(0 to 24)
unit_spread += 5
if(25 to 99)
unit_spread += 25
else
unit_spread = 5
to_chat(user, "<span class='notice'> You set the time release to [unit_spread] units per detonation.</span>")
/obj/item/grenade/chem_grenade/adv_release/multitool_act(mob/user, obj/item/I)
. = TRUE
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
return
..()
switch(unit_spread)
if(0 to 24)
unit_spread += 5
if(25 to 99)
unit_spread += 25
else
unit_spread = 5
to_chat(user, "<span class='notice'> You set the time release to [unit_spread] units per detonation.</span>")
/obj/item/grenade/chem_grenade/adv_release/prime()
if(stage != READY)
@@ -138,8 +138,7 @@
/datum/crafting_recipe/improvised_pneumatic_cannon //Pretty easy to obtain but
name = "Pneumatic Cannon"
result = /obj/item/pneumatic_cannon/ghetto
tools = list(/obj/item/weldingtool,
/obj/item/wrench)
tools = list(TOOL_WELDER, TOOL_WRENCH)
reqs = list(/obj/item/stack/sheet/metal = 4,
/obj/item/stack/packageWrap = 8,
/obj/item/pipe = 2)
+22 -13
View File
@@ -37,20 +37,29 @@
to_chat(user, "<span class='warning'>[IT] is too small for [src].</span>")
return
updateTank(W, 0, user)
else if(iswrench(W))
switch(fisto_setting)
if(1)
fisto_setting = 2
if(2)
fisto_setting = 3
if(3)
fisto_setting = 1
playsound(loc, W.usesound, 50, 1)
to_chat(user, "<span class='notice'>You tweak [src]'s piston valve to [fisto_setting].</span>")
else if(isscrewdriver(W))
if(tank)
updateTank(tank, 1, user)
return
return ..()
/obj/item/melee/powerfist/wrench_act(mob/user, obj/item/I)
. = TRUE
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
return
switch(fisto_setting)
if(1)
fisto_setting = 2
if(2)
fisto_setting = 3
if(3)
fisto_setting = 1
to_chat(user, "<span class='notice'>You tweak [src]'s piston valve to [fisto_setting].</span>")
/obj/item/melee/powerfist/screwdriver_act(mob/user, obj/item/I)
if(!tank)
return
. = TRUE
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
return
updateTank(tank, 1, user)
/obj/item/melee/powerfist/proc/updateTank(obj/item/tank/thetank, removing = 0, mob/living/carbon/human/user)
if(removing)
+17 -16
View File
@@ -60,26 +60,27 @@
H.UpdateDamageIcon()
/obj/item/shard/attackby(obj/item/I, mob/user, params)
if(iswelder(I))
var/obj/item/weldingtool/WT = I
if(WT.remove_fuel(0, user))
var/obj/item/stack/sheet/NG = new welded_type(user.loc)
for(var/obj/item/stack/sheet/G in user.loc)
if(!istype(G, welded_type))
continue
if(G == NG)
continue
if(G.amount >= G.max_amount)
continue
G.attackby(NG, user)
to_chat(user, "<span class='notice'>You add the newly-formed glass to the stack. It now contains [NG.amount] sheet\s.</span>")
qdel(src)
return
if(istype(I, /obj/item/lightreplacer))
I.attackby(src, user)
return
return ..()
/obj/item/shard/welder_act(mob/user, obj/item/I)
. = TRUE
if(!I.use_tool(src, user, volume = I.tool_volume))
return
var/obj/item/stack/sheet/NG = new welded_type(user.loc)
for(var/obj/item/stack/sheet/G in user.loc)
if(!istype(G, welded_type))
continue
if(G == NG)
continue
if(G.amount >= G.max_amount)
continue
G.attackby(NG, user)
to_chat(user, "<span class='notice'>You add the newly-formed glass to the stack. It now contains [NG.amount] sheet\s.</span>")
qdel(src)
/obj/item/shard/Crossed(mob/living/L, oldloc)
if(istype(L) && has_gravity(loc))
if(L.incorporeal_move || L.flying)
@@ -95,4 +96,4 @@
icon_state = "plasmalarge"
materials = list(MAT_PLASMA = MINERAL_MATERIAL_AMOUNT * 0.5, MAT_GLASS = MINERAL_MATERIAL_AMOUNT)
icon_prefix = "plasma"
welded_type = /obj/item/stack/sheet/plasmaglass
welded_type = /obj/item/stack/sheet/plasmaglass
@@ -48,19 +48,7 @@
stored_gun.afterattack(A, user, flag, params)
/obj/item/storage/briefcase/false_bottomed/attackby(var/obj/item/I, mob/user)
if(isscrewdriver(I))
if(!bottom_open && !busy_hunting)
to_chat(user, "You begin to hunt around the rim of the [src]...")
busy_hunting = TRUE
if(do_after(user, 20, target = src))
if(user)
to_chat(user, "You pry open the false bottom!")
bottom_open = TRUE
busy_hunting = FALSE
else if(bottom_open)
to_chat(user, "You push the false bottom down and close it with a click[stored_item ? ", with the [stored_item] snugly inside." : "."]")
bottom_open = FALSE
else if(bottom_open)
if(bottom_open)
if(stored_item)
to_chat(user, "<span class='warning'>There's already something in the false bottom!</span>")
return
@@ -78,6 +66,24 @@
else
return ..()
/obj/item/storage/briefcase/false_bottomed/screwdriver_act(mob/user, obj/item/I)
if(!bottom_open && busy_hunting)
return
. = TRUE
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
return
if(!bottom_open)
to_chat(user, "You begin to hunt around the rim of the [src]...")
busy_hunting = TRUE
if(do_after(user, 20, target = src))
if(user)
to_chat(user, "You pry open the false bottom!")
bottom_open = TRUE
busy_hunting = FALSE
else
to_chat(user, "You push the false bottom down and close it with a click[stored_item ? ", with the [stored_item] snugly inside." : "."]")
bottom_open = FALSE
/obj/item/storage/briefcase/false_bottomed/attack_hand(mob/user)
if(bottom_open && stored_item)
user.put_in_hands(stored_item)
+10 -10
View File
@@ -311,17 +311,17 @@
hitsound = 'sound/weapons/blade1.ogg'
w_class = w_class_on
/obj/item/twohanded/dualsaber/attackby(obj/item/W, mob/user, params)
if(ismultitool(W))
if(!hacked)
hacked = TRUE
to_chat(user, "<span class='warning'>2XRNBW_ENGAGE</span>")
blade_color = "rainbow"
update_icon()
else
to_chat(user, "<span class='warning'>It's starting to look like a triple rainbow - no, nevermind.</span>")
/obj/item/twohanded/dualsaber/multitool_act(mob/user, obj/item/I)
. = TRUE
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
return
if(!hacked)
hacked = TRUE
to_chat(user, "<span class='warning'>2XRNBW_ENGAGE</span>")
blade_color = "rainbow"
update_icon()
else
return ..()
to_chat(user, "<span class='warning'>It's starting to look like a triple rainbow - no, nevermind.</span>")
//spears
/obj/item/twohanded/spear