diff --git a/code/game/objects/items/weapons/tools/_tools.dm b/code/game/objects/items/weapons/tools/_tools.dm index 6bf12c618eca3..6a80635ac390f 100644 --- a/code/game/objects/items/weapons/tools/_tools.dm +++ b/code/game/objects/items/weapons/tools/_tools.dm @@ -13,6 +13,7 @@ var/use_power_cost = 0 //For tool system, determinze how much power tool will drain from cells, 0 means no cell needed var/obj/item/weapon/cell/cell = null + var/passive_power_cost = 0 var/suitable_cell = null //Dont forget to edit this for a tool, if you want in to consume cells var/use_fuel_cost = 0 //Same, only for fuel. And for the sake of God, DONT USE CELLS AND FUEL SIMULTANEOUSLY. @@ -110,6 +111,11 @@ if(!consume_fuel(passive_fuel_cost)) turn_off() + if (passive_power_cost) + if(cell.charge <= passive_power_cost) + turn_off()//this can be overridden elsewhere + if (!cell.checked_use(passive_power_cost)) //sir this doesnt work + turn_off() //Cell reload /obj/item/weapon/tool/MouseDrop(over_object) @@ -204,13 +210,15 @@ //Simple form ideal for basic use. That proc will return TRUE only when everything was done right, and FALSE if something went wrong, ot user was unlucky. //Editionaly, handle_failure proc will be called for a critical failure roll. -/obj/proc/use_tool(var/mob/living/user, var/atom/target, var/base_time, var/required_quality, var/fail_chance, var/required_stat, var/instant_finish_tier = 110, forced_sound = null, var/sound_repeat = 2.5) +/obj/proc/use_tool(var/mob/living/user, var/atom/target, var/base_time, var/required_quality, var/fail_chance, var/required_stat, var/instant_finish_tier = 110, forced_sound = null, var/sound_repeat = 2.5 SECONDS) var/obj/item/weapon/tool/T if (istool(src)) T = src + if (T.tool_in_use) + return FALSE T.tool_in_use = TRUE - var/result = use_tool_extended(user, target, base_time, required_quality, fail_chance, required_stat, instant_finish_tier, forced_sound) + var/result = use_tool_extended(user, target, base_time, required_quality, fail_chance, required_stat, instant_finish_tier, forced_sound, sound_repeat) if (T) T.tool_in_use = FALSE @@ -259,7 +267,7 @@ //Precalculate worktime here var/time_to_finish = 0 if (base_time) - time_to_finish = base_time - get_tool_quality(required_quality) - 30//TODO: Factor in bay skills here user.stats.getStat(required_stat) + time_to_finish = base_time / (1 + (get_tool_quality(required_quality)/100))//TODO: Factor in bay skills here user.stats.getStat(required_stat) //Workspeed var, can be improved by upgrades if (T && T.workspeed > 0) @@ -291,7 +299,7 @@ if (sound_repeat && time_to_finish) //It will repeat roughly every 2.5 seconds until our tool finishes - toolsound = new/datum/repeating_sound(sound_repeat,time_to_finish,0.15, src, soundfile, volume, 1, extrarange) + toolsound = new/datum/repeating_sound(sound_repeat,time_to_finish,0.15, src, soundfile, volume, TRUE, extrarange) else playsound(src.loc, soundfile, volume, 1, extrarange) @@ -332,6 +340,7 @@ var/stat_modifer = 0 if(required_stat) stat_modifer = 30//TODO: Factor in bay skills here //user.stats.getStat(required_stat) + fail_chance = fail_chance - get_tool_quality(required_quality) - stat_modifer //Unreliability increases failure rates, and precision reduces it @@ -542,6 +551,20 @@ /obj/proc/has_quality(quality_id) return quality_id in tool_qualities +//Takes a list of qualities, +//Returns a assoc list which contains quality = value for the qualities we do have, and the ones we don't have removed +/obj/proc/has_qualities(var/list/qualities) + if (tool_qualities && tool_qualities.len) + for (var/quality in qualities) + var/value = tool_qualities[quality] + if (value) + qualities[quality] = value + else + qualities -= quality + return qualities + else + return list() + /obj/proc/ever_has_quality(quality_id) return has_quality(quality_id) @@ -596,7 +619,7 @@ if(glow_color) set_light(1, 1, 3, l_color = glow_color) update_icon() - //update_wear_icon() //Too tied into eris' inventory system, need to find a better path to do this + update_wear_icon() //Too tied into eris' inventory system, need to find a better path to do this /obj/item/weapon/tool/proc/turn_off(mob/user) switched_on = FALSE @@ -606,7 +629,7 @@ if(glow_color) set_light(0,0, 0) update_icon() - //update_wear_icon() //Too tied into eris' inventory system, need to find a better path to do this + update_wear_icon() //Too tied into eris' inventory system, need to find a better path to do this @@ -618,6 +641,9 @@ /********************* Resource Consumption **********************/ + + + /obj/proc/consume_resources(var/timespent, var/user) return @@ -701,7 +727,7 @@ ****************************/ /obj/item/weapon/tool/proc/refresh_upgrades() //First of all, lets reset any var that could possibly be altered by an upgrade - degradation = initial(degradation) * 1.05 ** repair_frequency //Degradation gets slightly worse each time the tool is repaired + degradation = initial(degradation) * 1.10 ** repair_frequency //Degradation gets slightly worse each time the tool is repaired workspeed = initial(workspeed) precision = initial(precision) suitable_cell = initial(suitable_cell) @@ -963,3 +989,8 @@ QUALITY_CUTTING = 100) + +//Tools take heavy damage from being soaked in acid +/obj/item/weapon/tool/acid_act(var/datum/reagent/acid/acid, var/volume) + var/acid_damage = acid.power * volume + unreliability += rand_between(0, degradation*acid_damage) diff --git a/code/game/objects/items/weapons/tools/saws.dm b/code/game/objects/items/weapons/tools/saws.dm index 528ac9d09dbfa..a05cf64351321 100644 --- a/code/game/objects/items/weapons/tools/saws.dm +++ b/code/game/objects/items/weapons/tools/saws.dm @@ -19,7 +19,7 @@ name = "choppa" desc = "A wicked serrated blade made of whatever nasty sharp things you could find. It would make a pretty decent weapon" icon_state = "impro_saw" - force = WEAPON_FORCE_PAINFULL + force = WEAPON_FORCE_PAINFUL tool_qualities = list(QUALITY_SAWING = 15, QUALITY_CUTTING = 10, QUALITY_WIRE_CUTTING = 10) degradation = 0.7 @@ -29,7 +29,7 @@ icon_state = "saw" hitsound = WORKSOUND_CIRCULAR_SAW worksound = WORKSOUND_CIRCULAR_SAW - force = WEAPON_FORCE_ROBUST + force = WEAPON_FORCE_PAINFUL matter = list(MATERIAL_STEEL = 1000, MATERIAL_PLASTIC = 600) tool_qualities = list(QUALITY_SAWING = 40, QUALITY_CUTTING = 30, QUALITY_WIRE_CUTTING = 30) @@ -56,9 +56,54 @@ icon_state = "chainsaw" hitsound = WORKSOUND_CHAINSAW worksound = WORKSOUND_CHAINSAW - force = WEAPON_FORCE_ROBUST + force = WEAPON_FORCE_DANGEROUS matter = list(MATERIAL_STEEL = 3000, MATERIAL_PLASTIC = 3000) tool_qualities = list(QUALITY_SAWING = 60, QUALITY_CUTTING = 50, QUALITY_WIRE_CUTTING = 20) max_upgrades = 4 use_fuel_cost = 0.1 max_fuel = 80 + +/obj/item/weapon/tool/saw/plasma + name = "SH-B1 Plasma Saw" + desc = "The SH-B1 Plasma Saw is designed for dissection of heavy duty materials in both on and off-site locations. Users are advised to always wear protective clothing when the saw is in use." + icon_state = "plasma_saw_off" + item_state = "plasma_saw_off" + hitsound = WORKSOUND_CIRCULAR_SAW + worksound = WORKSOUND_CIRCULAR_SAW + force = WEAPON_FORCE_HARMLESS + switched_on_force = WEAPON_FORCE_DANGEROUS * 1.15 + matter = list(MATERIAL_STEEL = 3000, MATERIAL_PLASTIC = 3000) + tool_qualities = list() + switched_on_qualities = list(QUALITY_SAWING = 60, QUALITY_CUTTING = 50, QUALITY_WIRE_CUTTING = 20, QUALITY_DIGGING = 35) + max_upgrades = 4 + degradation = 0.1 + use_power_cost = 0.44 + passive_power_cost = 0.04 + suitable_cell = /obj/item/weapon/cell + toggleable = TRUE + atom_flags = ATOM_FLAG_NO_BLOOD + item_flags = ITEM_FLAG_NO_EMBED + + +/obj/item/weapon/tool/saw/plasma/update_icon() + if (switched_on) + icon_state = "plasma_saw_on" + item_state = "plasma_saw_on" + else + icon_state = "plasma_saw_off" + item_state = "plasma_saw_off" + + +/obj/item/weapon/tool/saw/plasma/turn_on() + if(!cell || cell.charge <= 100) // ideally, this should be handled globally, but may require a tools refactor. + visible_message(SPAN_NOTICE("\The Plasma sheath fails to ignite on [src]")) + return FALSE + else + .=..() + flick("plasma_saw_ignite", src) + playsound(get_turf(src), 'sound/weapons/saberon.ogg', 20, 1, -2) + + +/obj/item/weapon/tool/saw/plasma/turn_off() // no need to check cell charge here. + .=..() + playsound(get_turf(src), 'sound/weapons/saberoff.ogg', 20, 1, -2)