From b6eee04dacdf42c25fbd157819c2071448916740 Mon Sep 17 00:00:00 2001 From: NanakoAC Date: Tue, 5 Jul 2016 20:59:21 +0100 Subject: [PATCH] Welding Tool tweaks (#517) Welding tools can now be used to burn paper The upgraded and experimental welding tools will now fit in a toolbelt. Upgraded renamed to advanced. Fixed and implemented the Experimental Welding Tool, which has a regenerating fuel supply. Can be produced in R&D, requires 4 research in engineering and materials. --- code/game/objects/items/weapons/tools.dm | 66 ++++++++++++++++++++---- code/modules/paperwork/paper.dm | 23 +++++++-- code/modules/research/designs.dm | 21 ++++++++ html/changelogs/Nanako-Weldingtools.yml | 39 ++++++++++++++ 4 files changed, 136 insertions(+), 13 deletions(-) create mode 100644 html/changelogs/Nanako-Weldingtools.yml diff --git a/code/game/objects/items/weapons/tools.dm b/code/game/objects/items/weapons/tools.dm index 6b42af95405..78b7d9ad024 100644 --- a/code/game/objects/items/weapons/tools.dm +++ b/code/game/objects/items/weapons/tools.dm @@ -215,7 +215,7 @@ if(prob(5)) remove_fuel(1) - if(get_fuel() == 0) + if(get_fuel() < 1) setWelding(0) //I'm not sure what this does. I assume it has to do with starting fires... @@ -324,14 +324,13 @@ src.w_class = 4 welding = 1 update_icon() - processing_objects |= src + set_processing(1) else if(M) M << "You need more welding fuel to complete this task." return //Otherwise else if(!set_welding && welding) - processing_objects -= src if(M) M << "You switch \the [src] off." else if(T) @@ -340,8 +339,18 @@ src.damtype = "brute" src.w_class = initial(src.w_class) src.welding = 0 + set_processing(0) update_icon() + +//A wrapper function for the experimental tool to override +/obj/item/weapon/weldingtool/proc/set_processing(var/state = 0) + if (state == 1) + processing_objects.Add(src) + else + processing_objects.Remove(src) + + //Decides whether or not to damage a player's eyes based on what they're wearing as protection //Note: This should probably be moved to mob /obj/item/weapon/weldingtool/proc/eyecheck(mob/user as mob) @@ -396,25 +405,62 @@ /obj/item/weapon/weldingtool/hugetank name = "upgraded welding tool" max_fuel = 80 - w_class = 3.0 + w_class = 2.0 matter = list(DEFAULT_WALL_MATERIAL = 70, "glass" = 120) origin_tech = "engineering=3" + + + +//The Experimental Welding Tool! /obj/item/weapon/weldingtool/experimental name = "experimental welding tool" + desc = "A scientifically-enhanced welding tool that uses fuel-producing microbes to gradually replenish its fuel supply" max_fuel = 40 - w_class = 3.0 + w_class = 2.0 matter = list(DEFAULT_WALL_MATERIAL = 70, "glass" = 120) - origin_tech = "engineering=4;phorontech=3" + origin_tech = "engineering=4;biotech=4" var/last_gen = 0 + var/fuelgen_delay = 800//The time, in deciseconds, required to regenerate one unit of fuel + //800 = 1 unit per 1 minute and 20 seconds, + //This is roughly half the rate that fuel is lost if the welder is left idle, so it you carelessly leave it on it will still run out +/obj/item/weapon/weldingtool/Destroy() + processing_objects.Remove(src)//Stop processing when destroyed regardless of conditions + ..() + + +//Make sure the experimental tool only stops processing when its turned off AND full +/obj/item/weapon/weldingtool/experimental/set_processing(var/state = 0) + if (state == 1) + processing_objects.Add(src) + last_gen = world.time + else if (welding == 0 && get_fuel() >= max_fuel) + processing_objects.Remove(src) + + +/obj/item/weapon/weldingtool/experimental/process() + ..() + fuel_gen() /obj/item/weapon/weldingtool/experimental/proc/fuel_gen()//Proc to make the experimental welder generate fuel, optimized as fuck -Sieve - var/gen_amount = ((world.time-last_gen)/25) - reagents += (gen_amount) - if(reagents > max_fuel) - reagents = max_fuel + + if (get_fuel() < max_fuel) + var/gen_amount = ((world.time-last_gen)/fuelgen_delay) + var/remainder = max_fuel - get_fuel() + gen_amount = min(gen_amount, remainder) + reagents.add_reagent("fuel", gen_amount) + //reagents += (gen_amount) + + if(get_fuel() >= max_fuel) + //reagents = max_fuel + set_processing(0) + else + set_processing(0) + last_gen = world.time + + /* * Crowbar diff --git a/code/modules/paperwork/paper.dm b/code/modules/paperwork/paper.dm index b495bd94cbb..5ba097d6ad3 100644 --- a/code/modules/paperwork/paper.dm +++ b/code/modules/paperwork/paper.dm @@ -281,18 +281,33 @@ return t -/obj/item/weapon/paper/proc/burnpaper(obj/item/weapon/flame/P, mob/user) +/obj/item/weapon/paper/proc/burnpaper(obj/item/weapon/P, mob/user) var/class = "" - if(P.lit && !user.restrained()) + if (!user.restrained()) + if (istype(P, /obj/item/weapon/flame)) + var/obj/item/weapon/flame/F = P + if (!F.lit) + return + else if (istype(P, /obj/item/weapon/weldingtool)) + var/obj/item/weapon/weldingtool/F = P + if (!F.welding)//welding tools are 0 when off + return + if (!F.remove_fuel(1, user))//This function removes the fuel and does the usual eyedamage checks, if it returns 0 then the welder is out of fuel and cant burn paper + return + else + //If we got here somehow, the item is incompatible and can't burn things + return + if(istype(P, /obj/item/weapon/flame/lighter/zippo)) class = "" user.visible_message("[class][user] holds \the [P] up to \the [src], it looks like \he's trying to burn it!", \ "[class]You hold \the [P] up to \the [src], burning it slowly.") + //I was going to add do_after in here, but keeping the current method allows people to burn papers they're holding, while they move. That seems fine to keep -Nanako spawn(20) - if(get_dist(src, user) < 2 && user.get_active_hand() == P && P.lit) + if(get_dist(src, user) < 2 && user.get_active_hand() == P) user.visible_message("[class][user] burns right through \the [src], turning it to ash. It flutters through the air before settling on the floor in a heap.", \ "[class]You burn right through \the [src], turning it to ash. It flutters through the air before settling on the floor in a heap.") @@ -478,6 +493,8 @@ else if(istype(P, /obj/item/weapon/flame)) burnpaper(P, user) + else if(istype(P, /obj/item/weapon/weldingtool)) + burnpaper(P, user) add_fingerprint(user) return diff --git a/code/modules/research/designs.dm b/code/modules/research/designs.dm index f45199692cd..3e2918a40f7 100644 --- a/code/modules/research/designs.dm +++ b/code/modules/research/designs.dm @@ -29,6 +29,19 @@ reliability_mod (starts at 0, gets improved through experimentation). Example: P other types of metals and chemistry for reagents). - Add the AUTOLATHE tag to +Research type IDs, for quick reference + +materials = Materials Research +engineering = Engineering Research +phorontech = Phoron Research +powerstorage = Power Manipulation Technology +bluespace = Blue-Space Research +biotech = Biological Technology +combat = Combat Systems Research +magnets = Electromagnetic Spectrum Research +programming = Data Theory Research +syndicate = Illegal Technologies Research + */ #define IMPRINTER 1 //For circuits. Uses glass/chemicals. @@ -1621,3 +1634,11 @@ datum/design/item/chameleon req_tech = list("syndicate" = 2) materials = list("$metal" = 500) build_path = /obj/item/weapon/storage/box/syndie_kit/chameleon + +datum/design/item/experimental_welder + name = "Experimental Welding Tool" + desc = "A scientifically-enhanced welding tool that uses fuel-producing microbes to gradually replenish its fuel supply" + id = "experimental_welder" + req_tech = list("materials" = 4, "engineering" = 4) + materials = list("$metal" = 500) + build_path =/obj/item/weapon/weldingtool/experimental diff --git a/html/changelogs/Nanako-Weldingtools.yml b/html/changelogs/Nanako-Weldingtools.yml new file mode 100644 index 00000000000..158b8451aa4 --- /dev/null +++ b/html/changelogs/Nanako-Weldingtools.yml @@ -0,0 +1,39 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +################################# + +# Your name. +author: Nanako + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - rscadd: "Welding tools can now be used to burn paper" + - tweak: "The upgraded and experimental welding tools will now fit in a toolbelt. Upgraded renamed to advanced" + - rscadd: "Fixed and implemented the Experimental Welding Tool, which has a regenerating fuel supply. Can be produced in R&D, requires 4 research in engineering and materials" +