[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
@@ -40,21 +40,24 @@
. += "<span class='notice'>It has \a [T] attached, which causes [T.effect_desc()].</span>"
/obj/item/twohanded/kinetic_crusher/attackby(obj/item/I, mob/living/user)
if(iscrowbar(I))
if(LAZYLEN(trophies))
to_chat(user, "<span class='notice'>You remove [src]'s trophies.</span>")
playsound(loc, I.usesound, 100, 1)
for(var/t in trophies)
var/obj/item/crusher_trophy/T = t
T.remove_from(src, user)
else
to_chat(user, "<span class='warning'>There are no trophies on [src].</span>")
else if(istype(I, /obj/item/crusher_trophy))
if(istype(I, /obj/item/crusher_trophy))
var/obj/item/crusher_trophy/T = I
T.add_to(src, user)
else
return ..()
/obj/item/twohanded/kinetic_crusher/crowbar_act(mob/user, obj/item/I)
. = TRUE
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
return
if(LAZYLEN(trophies))
to_chat(user, "<span class='notice'>You remove [src]'s trophies.</span>")
for(var/t in trophies)
var/obj/item/crusher_trophy/T = t
T.remove_from(src, user)
else
to_chat(user, "<span class='warning'>There are no trophies on [src].</span>")
/obj/item/twohanded/kinetic_crusher/attack(mob/living/target, mob/living/carbon/user)
if(!wielded)
to_chat(user, "<span class='warning'>[src] is too heavy to use with one hand. You fumble and drop everything.")
+26 -13
View File
@@ -188,13 +188,6 @@
/obj/machinery/mineral/ore_redemption/attackby(obj/item/W, mob/user, params)
if(exchange_parts(user, W))
return
if(default_unfasten_wrench(user, W))
return
if(default_deconstruction_screwdriver(user, "ore_redemption-open", "ore_redemption", W))
updateUsrDialog()
return
if(default_deconstruction_crowbar(W))
return
if(!powered())
return
@@ -208,12 +201,6 @@
interact(user)
return
if(ismultitool(W) && panel_open)
input_dir = turn(input_dir, -90)
output_dir = turn(output_dir, -90)
to_chat(user, "<span class='notice'>You change [src]'s I/O settings, setting the input to [dir2text(input_dir)] and the output to [dir2text(output_dir)].</span>")
return
if(istype(W, /obj/item/disk/design_disk))
if(user.drop_item())
W.forceMove(src)
@@ -223,6 +210,32 @@
return ..()
/obj/machinery/mineral/ore_redemption/crowbar_act(mob/user, obj/item/I)
if(default_deconstruction_crowbar(user, I))
return TRUE
/obj/machinery/mineral/ore_redemption/multitool_act(mob/user, obj/item/I)
if(!panel_open)
return
. = TRUE
if(!powered())
return
if(!I.tool_start_check(user, 0))
return
input_dir = turn(input_dir, -90)
output_dir = turn(output_dir, -90)
to_chat(user, "<span class='notice'>You change [src]'s I/O settings, setting the input to [dir2text(input_dir)] and the output to [dir2text(output_dir)].</span>")
/obj/machinery/mineral/ore_redemption/screwdriver_act(mob/user, obj/item/I)
if(default_deconstruction_screwdriver(user, "ore_redemption-open", "ore_redemption", I))
updateUsrDialog()
return TRUE
/obj/machinery/mineral/ore_redemption/wrench_act(mob/user, obj/item/I)
if(default_unfasten_wrench(user, I))
return TRUE
/obj/machinery/mineral/ore_redemption/attack_hand(mob/user)
if(..())
return
+1 -1
View File
@@ -187,7 +187,7 @@
if(istype(I, /obj/item/crowbar))
if(inserted_id)
inserted_id.forceMove(loc) //Prevents deconstructing the ORM from deleting whatever ID was inside it.
default_deconstruction_crowbar(I)
default_deconstruction_crowbar(user, I)
return 1
if(istype(I, /obj/item/mining_voucher))
if(!powered())
+27 -14
View File
@@ -88,28 +88,41 @@
/mob/living/simple_animal/hostile/mining_drone/attackby(obj/item/I, mob/user, params)
if(iswelder(I) && user.a_intent == INTENT_HELP)
var/obj/item/weldingtool/W = I
if(W.welding && !stat)
if(AIStatus != AI_OFF && AIStatus != AI_IDLE)
to_chat(user, "<span class='info'>[src] is moving around too much to repair!</span>")
return
if(do_after_once(user, 15, target = src))
if(maxHealth == health)
to_chat(user, "<span class='info'>[src] is at full integrity.</span>")
else
adjustBruteLoss(-20)
to_chat(user, "<span class='info'>You repair some of the armor on [src].</span>")
return
if(istype(I, /obj/item/mining_scanner) || istype(I, /obj/item/t_scanner/adv_mining_scanner))
to_chat(user, "<span class='info'>You instruct [src] to drop any collected ore.</span>")
DropOre()
return
if(iscrowbar(I) || istype(I, /obj/item/borg/upgrade/modkit))
if(istype(I, /obj/item/borg/upgrade/modkit))
I.melee_attack_chain(user, stored_gun, params)
return
..()
/mob/living/simple_animal/hostile/mining_drone/crowbar_act(mob/user, obj/item/I)
if(user.a_intent != INTENT_HELP)
return
. = TRUE
if(!I.tool_start_check(user, 0))
return
I.melee_attack_chain(user, stored_gun)
/mob/living/simple_animal/hostile/mining_drone/welder_act(mob/user, obj/item/I)
if(user.a_intent != INTENT_HELP)
return
. = TRUE
if(health == maxHealth)
to_chat(user, "<span class='notice'>[src] doesn't need repairing!</span>")
return
if(!I.tool_use_check(user, 1))
return
if(AIStatus != AI_OFF && AIStatus != AI_IDLE)
to_chat(user, "<span class='info'>[src] is moving around too much to repair!</span>")
return
WELDER_ATTEMPT_REPAIR_MESSAGE
if(I.use_tool(src, user, 15, 1, volume = I.tool_volume) && health != maxHealth)
adjustBruteLoss(-20)
WELDER_REPAIR_SUCCESS_MESSAGE
return
/mob/living/simple_animal/hostile/mining_drone/death()
DropOre(0)
if(stored_gun)
+26 -30
View File
@@ -21,15 +21,16 @@
if(is_mining_level(z))
score_oremined++ //When ore spawns, increment score. Only include ore spawned on mining level (No Clown Planet)
/obj/item/stack/ore/attackby(obj/item/I, mob/user, params)
..()
if(istype(I, /obj/item/weldingtool))
var/obj/item/weldingtool/W = I
if(W.remove_fuel(15) && refined_type)
new refined_type(get_turf(src.loc), amount)
qdel(src)
else if(W.isOn())
to_chat(user, "<span class='info'>Not enough fuel to smelt [src].</span>")
/obj/item/stack/ore/welder_act(mob/user, obj/item/I)
. = TRUE
if(!refined_type)
to_chat(user, "<span class='notice'>You can't smelt [src] into anything useful!</span>")
return
if(!I.use_tool(src, user, 0, 15, volume = I.tool_volume))
return
new refined_type(drop_location(), amount)
to_chat(user, "<span class='notice'>You smelt [src] into its refined form!</span>")
qdel(src)
/obj/item/stack/ore/Crossed(atom/movable/AM, oldloc)
var/obj/item/storage/bag/ore/OB
@@ -144,14 +145,6 @@ GLOBAL_LIST_INIT(sand_recipes, list(\
refined_type = /obj/item/stack/sheet/mineral/plasma
materials = list(MAT_PLASMA=MINERAL_MATERIAL_AMOUNT)
/obj/item/stack/ore/plasma/attackby(obj/item/I as obj, mob/user as mob, params)
if(istype(I, /obj/item/weldingtool))
var/obj/item/weldingtool/W = I
if(W.welding)
to_chat(user, "<span class='warning'>You can't hit a high enough temperature to smelt [src] properly!</span>")
else
..()
/obj/item/stack/ore/silver
name = "silver ore"
icon_state = "Silver ore"
@@ -443,21 +436,24 @@ GLOBAL_LIST_INIT(sand_recipes, list(\
overlays = list()
string_attached = null
to_chat(user, "<span class='notice'>You detach the string from the coin.</span>")
else if(istype(W,/obj/item/weldingtool))
var/obj/item/weldingtool/WT = W
if(WT.welding && WT.remove_fuel(0, user))
var/typelist = list("iron" = /obj/item/clothing/gloves/ring,
"silver" = /obj/item/clothing/gloves/ring/silver,
"gold" = /obj/item/clothing/gloves/ring/gold,
"plasma" = /obj/item/clothing/gloves/ring/plasma,
"uranium" = /obj/item/clothing/gloves/ring/uranium)
var/typekey = typelist[cmineral]
if(ispath(typekey))
to_chat(user, "<span class='notice'>You make [src] into a ring.</span>")
new typekey(get_turf(loc))
qdel(src)
else ..()
/obj/item/coin/welder_act(mob/user, obj/item/I)
. = TRUE
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
return
var/typelist = list("iron" = /obj/item/clothing/gloves/ring,
"silver" = /obj/item/clothing/gloves/ring/silver,
"gold" = /obj/item/clothing/gloves/ring/gold,
"plasma" = /obj/item/clothing/gloves/ring/plasma,
"uranium" = /obj/item/clothing/gloves/ring/uranium)
var/typekey = typelist[cmineral]
if(ispath(typekey))
to_chat(user, "<span class='notice'>You make [src] into a ring.</span>")
new typekey(get_turf(loc))
qdel(src)
/obj/item/coin/attack_self(mob/user as mob)
if(cooldown < world.time - 15)
var/coinflip = pick(sideslist)