What was supposed to be another straightforward major system overhaul that once again spiraled out of control (#8220)

* get_tool_quality has numerical meaning

* Basic tools set tool quality

* Toolspeed is replaced by tool quality checks

* Addresses assorted results from live test

* Extra cleanup
This commit is contained in:
Atermonera
2022-01-16 15:52:55 -08:00
committed by GitHub
parent 0232be9531
commit 4d8c43f106
312 changed files with 1902 additions and 2271 deletions

View File

@@ -0,0 +1,40 @@
/obj/item
var/list/tool_qualities = list()
/obj/item/examine(mob/user)
. = ..()
for(var/qual in tool_qualities)
var/msg
switch(tool_qualities[qual])
if(TOOL_QUALITY_WORST)
msg += "very poor "
if(TOOL_QUALITY_POOR)
msg += "poor "
if(TOOL_QUALITY_MEDIOCRE)
msg += "mediocre "
if(TOOL_QUALITY_STANDARD)
msg += ""
if(TOOL_QUALITY_DECENT)
msg += "decent "
if(TOOL_QUALITY_GOOD)
msg += "pretty good "
if(TOOL_QUALITY_BEST)
msg += "very good "
. += "It looks like it can be used as a [msg][qual]."
/atom/proc/get_tool_quality(tool_quality)
return TOOL_QUALITY_NONE
/// Used to check for a specific tool quality on an item.
/// Returns the value of `tool_quality` if it is found, else 0.
/obj/item/get_tool_quality(quality)
return LAZYFIND(tool_qualities, quality)
/obj/item/proc/set_tool_quality(tool, quality)
tool_qualities[tool] = quality
/obj/item/proc/get_tool_speed(quality)
return LAZYFIND(tool_qualities, quality)
/obj/item/proc/get_use_time(quality, base_time)
return LAZYFIND(tool_qualities, quality) ? base_time / tool_qualities[quality] : -1

View File

@@ -0,0 +1,65 @@
// File is unticked because this is entirely untested old code
/*
* Combitool
*/
/obj/item/weapon/combitool
name = "combi-tool"
desc = "It even has one of those nubbins for doing the thingy."
icon = 'icons/obj/items.dmi'
icon_state = "combitool"
w_class = ITEMSIZE_SMALL
drop_sound = 'sound/items/drop/multitool.ogg'
pickup_sound = 'sound/items/pickup/multitool.ogg'
var/list/spawn_tools = list(
/obj/item/weapon/tool/screwdriver,
/obj/item/weapon/tool/wrench,
/obj/item/weapon/tool/wirecutters,
/obj/item/weapon/material/knife,
/obj/item/weapon/material/kitchen/utensil/fork,
/obj/item/weapon/material/knife/machete/hatchet
)
var/list/tools = list()
var/current_tool = 1
/obj/item/weapon/combitool/examine(mob/user)
. = ..()
if(loc == user && tools.len)
. += "It has the following fittings:"
for(var/obj/item/tool in tools)
. += "[bicon(tool)] - [tool.name][tools[current_tool]==tool?" (selected)":""]"
/obj/item/weapon/combitool/Initialize()
. = ..()
for(var/type in spawn_tools)
tools |= new type(src)
/obj/item/weapon/combitool/attack_self(mob/user as mob)
if(++current_tool > tools.len) current_tool = 1
var/obj/item/tool = tools[current_tool]
if(!tool)
to_chat(user, "You can't seem to find any fittings in \the [src].")
else
to_chat(user, "You switch \the [src] to the [tool.name] fitting.")
return 1
/obj/item/weapon/combitool/attack(mob/living/carbon/M as mob, mob/living/carbon/user as mob)
if(!M.Adjacent(user))
return 0
var/obj/item/tool = tools[current_tool]
if(!tool) return 0
return (tool ? tool.attack(M,user) : 0)
/obj/item/weapon/combitool/afterattack(var/atom/target, var/mob/living/user, proximity, params)
if(!proximity)
return 0
var/obj/item/tool = tools[current_tool]
if(!tool) return 0
tool.loc = user
var/resolved = target.attackby(tool,user)
if(!resolved && tool && target)
tool.afterattack(target,user,1)
if(tool)
tool.loc = src

View File

@@ -0,0 +1,86 @@
/*
* Crowbar
*/
/obj/item/weapon/tool/crowbar
name = "crowbar"
desc = "Used to remove floors and to pry open doors."
icon = 'icons/obj/tools.dmi'
icon_state = "crowbar"
slot_flags = SLOT_BELT
force = 6
throwforce = 7
item_state = "crowbar"
w_class = ITEMSIZE_SMALL
origin_tech = list(TECH_ENGINEERING = 1)
matter = list(MAT_STEEL = 50)
attack_verb = list("attacked", "bashed", "battered", "bludgeoned", "whacked")
usesound = 'sound/items/crowbar.ogg'
drop_sound = 'sound/items/drop/crowbar.ogg'
pickup_sound = 'sound/items/pickup/crowbar.ogg'
tool_qualities = list(TOOL_CROWBAR = TOOL_QUALITY_STANDARD)
/obj/item/weapon/tool/crowbar/red
icon = 'icons/obj/tools.dmi'
icon_state = "red_crowbar"
item_state = "crowbar_red"
/datum/category_item/catalogue/anomalous/precursor_a/alien_crowbar
name = "Precursor Alpha Object - Hard Light Pry Tool"
desc = "An object which bears striking resemblence to the common crowbar. \
It appears to also serve a similar purpose, being used for prying. Unlike \
a crowbar, however, this object is made of some form of 'hard light'.\
<br><br>\
There is a visible switch on the base of the tool, which controls the \
hard light side of the tool. When the switch is used, the shape of \
the tool changes, with the hard light moving and making a prying motion. \
This allows the user to pry something with no physical effort beyond keeping \
the tool aligned while in use."
value = CATALOGUER_REWARD_EASY
/obj/item/weapon/tool/crowbar/alien
name = "alien crowbar"
desc = "A hard-light crowbar. It appears to pry by itself, without any effort required."
catalogue_data = list(/datum/category_item/catalogue/anomalous/precursor_a/alien_crowbar)
icon = 'icons/obj/abductor.dmi'
usesound = 'sound/weapons/sonic_jackhammer.ogg'
icon_state = "crowbar"
tool_qualities = list(TOOL_CROWBAR = TOOL_QUALITY_BEST)
origin_tech = list(TECH_COMBAT = 4, TECH_ENGINEERING = 4)
/obj/item/weapon/tool/crowbar/hybrid
name = "strange crowbar"
desc = "A crowbar whose head seems to phase in and out of view."
catalogue_data = list(/datum/category_item/catalogue/anomalous/precursor_a/alien_crowbar)
icon_state = "hybcrowbar"
usesound = 'sound/weapons/sonic_jackhammer.ogg'
tool_qualities = list(TOOL_CROWBAR = TOOL_QUALITY_DECENT)
origin_tech = list(TECH_COMBAT = 4, TECH_ENGINEERING = 3)
reach = 2
/obj/item/weapon/tool/crowbar/cyborg
name = "hydraulic crowbar"
desc = "A hydraulic prying tool, compact but powerful. Designed to replace crowbars in industrial synthetics."
usesound = 'sound/items/jaws_pry.ogg'
force = 10
tool_qualities = list(TOOL_CROWBAR = TOOL_QUALITY_DECENT)
/obj/item/weapon/tool/hydraulic_cutter
name = "jaws of life"
desc = "A set of jaws of life, compressed through the magic of science."
icon_state = "jaws_pry"
item_state = "jawsoflife"
matter = list(MAT_METAL=150, MAT_SILVER=50)
origin_tech = list(TECH_MATERIAL = 2, TECH_ENGINEERING = 2)
usesound = 'sound/items/jaws_pry.ogg'
force = 15
var/state = 0 // Technically boolean, but really a state machine
tool_qualities = list(TOOL_CROWBAR = TOOL_QUALITY_GOOD)
/obj/item/weapon/tool/hydraulic_cutter/attack_self(mob/user)
playsound(src, 'sound/items/change_jaws.ogg', 50, 1)
set_tool_quality(TOOL_CROWBAR, state ? TOOL_QUALITY_GOOD : TOOL_QUALITY_NONE)
set_tool_quality(TOOL_WIRECUTTER, state ? TOOL_QUALITY_NONE : TOOL_QUALITY_GOOD)
state = !state
to_chat(user, "<span class='notice'>You attach the cutting jaws to [src].</span>")

View File

@@ -0,0 +1,130 @@
/*
* Screwdriver
*/
/obj/item/weapon/tool/screwdriver
name = "screwdriver"
desc = "You can be totally screwwy with this."
icon = 'icons/obj/tools.dmi'
icon_state = "screwdriver"
center_of_mass = list("x" = 13,"y" = 7)
slot_flags = SLOT_BELT | SLOT_EARS
force = 6
w_class = ITEMSIZE_TINY
throwforce = 5
throw_speed = 3
throw_range = 5
hitsound = 'sound/weapons/bladeslice.ogg'
usesound = 'sound/items/screwdriver.ogg'
drop_sound = 'sound/items/drop/screwdriver.ogg'
pickup_sound = 'sound/items/pickup/screwdriver.ogg'
matter = list(MAT_STEEL = 75)
attack_verb = list("stabbed")
sharp = 1
tool_qualities = list(TOOL_SCREWDRIVER = TOOL_QUALITY_STANDARD)
var/random_color = TRUE
/obj/item/weapon/tool/screwdriver/Initialize()
if(random_color)
switch(pick("red","blue","purple","brown","green","cyan","yellow"))
if ("red")
icon_state = "screwdriver2"
item_state = "screwdriver"
if ("blue")
icon_state = "screwdriver"
item_state = "screwdriver_blue"
if ("purple")
icon_state = "screwdriver3"
item_state = "screwdriver_purple"
if ("brown")
icon_state = "screwdriver4"
item_state = "screwdriver_brown"
if ("green")
icon_state = "screwdriver5"
item_state = "screwdriver_green"
if ("cyan")
icon_state = "screwdriver6"
item_state = "screwdriver_cyan"
if ("yellow")
icon_state = "screwdriver7"
item_state = "screwdriver_yellow"
if (prob(75))
src.pixel_y = rand(0, 16)
. = ..()
/obj/item/weapon/tool/screwdriver/attack(mob/living/carbon/M as mob, mob/living/carbon/user as mob)
if(!istype(M) || user.a_intent == "help")
return ..()
if(user.zone_sel.selecting != O_EYES && user.zone_sel.selecting != BP_HEAD)
return ..()
if((CLUMSY in user.mutations) && prob(50))
M = user
return eyestab(M,user)
/datum/category_item/catalogue/anomalous/precursor_a/alien_screwdriver
name = "Precursor Alpha Object - Hard Light Torgue Tool"
desc = "This appears to be a tool, with a solid handle, and a thin hard light \
shaft, with a tip at the end. On the handle appears to be two mechanisms that \
causes the hard light section to spin at a high speed while held down, in a \
similar fashion as an electric drill. One makes it spin clockwise, the other \
counter-clockwise.\
<br><br>\
The hard light tip is able to shift its shape to a degree when pressed into \
a solid receptacle. This allows it to be able to function on many kinds of \
fastener, which includes the screws."
value = CATALOGUER_REWARD_EASY
/obj/item/weapon/tool/screwdriver/alien
name = "alien screwdriver"
desc = "An ultrasonic screwdriver."
catalogue_data = list(/datum/category_item/catalogue/anomalous/precursor_a/alien_screwdriver)
icon = 'icons/obj/abductor.dmi'
icon_state = "screwdriver_a"
item_state = "screwdriver_black"
usesound = 'sound/items/pshoom.ogg'
tool_qualities = list(TOOL_SCREWDRIVER = TOOL_QUALITY_BEST)
random_color = FALSE
/obj/item/weapon/tool/screwdriver/hybrid
name = "strange screwdriver"
desc = "A strange conglomerate of a screwdriver."
icon_state = "hybscrewdriver"
item_state = "screwdriver_black"
origin_tech = list(TECH_MATERIAL = 3, TECH_ENGINEERING = 3)
w_class = ITEMSIZE_NORMAL
usesound = 'sound/effects/uncloak.ogg'
tool_qualities = list(TOOL_SCREWDRIVER = TOOL_QUALITY_DECENT)
random_color = FALSE
reach = 2
/obj/item/weapon/tool/screwdriver/cyborg
name = "powered screwdriver"
desc = "An electrical screwdriver, designed to be both precise and quick."
usesound = 'sound/items/drill_use.ogg'
tool_qualities = list(TOOL_SCREWDRIVER = TOOL_QUALITY_DECENT)
/obj/item/weapon/tool/powerdrill
name = "hand drill"
desc = "A simple powered hand drill."
icon_state = "drill_screw"
item_state = "drill"
matter = list(MAT_STEEL = 150, MAT_SILVER = 50)
origin_tech = list(TECH_MATERIAL = 2, TECH_ENGINEERING = 2)
slot_flags = SLOT_BELT
force = 8
w_class = ITEMSIZE_SMALL
throwforce = 8
throw_speed = 2
throw_range = 3//it's heavier than a screw driver/wrench, so it does more damage, but can't be thrown as far
attack_verb = list("drilled", "screwed", "jabbed", "whacked")
hitsound = 'sound/items/drill_hit.ogg'
usesound = 'sound/items/drill_use.ogg'
var/state = 0 // Technically boolean, but really a state machine
tool_qualities = list(TOOL_SCREWDRIVER = TOOL_QUALITY_GOOD)
/obj/item/weapon/tool/powerdrill/attack_self(mob/user)
playsound(src,'sound/items/change_drill.ogg',50,1)
set_tool_quality(TOOL_SCREWDRIVER, state ? TOOL_QUALITY_GOOD : TOOL_QUALITY_NONE)
set_tool_quality(TOOL_WRENCH, state ? TOOL_QUALITY_NONE : TOOL_QUALITY_GOOD)
state = !state
to_chat(user, "<span class='notice'>You attach the bolt driver bit to [src].</span>")

View File

@@ -0,0 +1,684 @@
#define WELDER_FUEL_BURN_INTERVAL 13
/*
* Welding Tool
*/
/obj/item/weapon/weldingtool
name = "\improper welding tool"
icon = 'icons/obj/tools.dmi'
icon_state = "welder"
item_state = "welder"
slot_flags = SLOT_BELT
//Amount of OUCH when it's thrown
force = 3.0
throwforce = 5.0
throw_speed = 1
throw_range = 5
w_class = ITEMSIZE_SMALL
//Cost to make in the autolathe
matter = list(MAT_STEEL = 70, "glass" = 30)
//R&D tech level
origin_tech = list(TECH_ENGINEERING = 1)
tool_qualities = list(TOOL_WELDER = TOOL_QUALITY_STANDARD)
//Welding tool specific stuff
var/welding = 0 //Whether or not the welding tool is off(0), on(1) or currently welding(2)
var/status = 1 //Whether the welder is secured or unsecured (able to attach rods to it to make a flamethrower)
var/max_fuel = 20 //The max amount of fuel the welder can hold
var/acti_sound = 'sound/items/welderactivate.ogg'
var/deac_sound = 'sound/items/welderdeactivate.ogg'
usesound = 'sound/items/Welder2.ogg'
var/change_icons = TRUE
var/flame_intensity = 2 //how powerful the emitted light is when used.
var/flame_color = "#FF9933" // What color the welder light emits when its on. Default is an orange-ish color.
var/eye_safety_modifier = 0 // Increasing this will make less eye protection needed to stop eye damage. IE at 1, sunglasses will fully protect.
var/burned_fuel_for = 0 // Keeps track of how long the welder's been on, used to gradually empty the welder if left one, without RNG.
var/always_process = FALSE // If true, keeps the welder on the process list even if it's off. Used for when it needs to regenerate fuel.
drop_sound = 'sound/items/drop/weldingtool.ogg'
pickup_sound = 'sound/items/pickup/weldingtool.ogg'
/obj/item/weapon/weldingtool/Initialize()
. = ..()
// var/random_fuel = min(rand(10,20),max_fuel)
var/datum/reagents/R = new/datum/reagents(max_fuel)
reagents = R
R.my_atom = src
R.add_reagent("fuel", max_fuel)
update_icon()
if(always_process)
START_PROCESSING(SSobj, src)
/obj/item/weapon/weldingtool/Destroy()
if(welding || always_process)
STOP_PROCESSING(SSobj, src)
return ..()
/obj/item/weapon/weldingtool/examine(mob/user)
. = ..()
if(max_fuel && loc == user)
. += "It contains [get_fuel()]/[src.max_fuel] units of fuel!"
/obj/item/weapon/weldingtool/attack(atom/A, mob/living/user, def_zone)
if(ishuman(A) && user.a_intent == I_HELP)
var/mob/living/carbon/human/H = A
var/obj/item/organ/external/S = H.organs_by_name[user.zone_sel.selecting]
if(!S || S.robotic < ORGAN_ROBOT || S.open == 3)
return ..()
if(S.organ_tag == BP_HEAD)
if(H.head && istype(H.head,/obj/item/clothing/head/helmet/space))
to_chat(user, "<span class='warning'>You can't apply [src] through [H.head]!</span>")
return 1
else
if(H.wear_suit && istype(H.wear_suit,/obj/item/clothing/suit/space))
to_chat(user, "<span class='warning'>You can't apply [src] through [H.wear_suit]!</span>")
return 1
if(!welding)
to_chat(user, "<span class='warning'>You'll need to turn [src] on to patch the damage on [H]'s [S.name]!</span>")
return 1
if(S.robo_repair(15, BRUTE, "some dents", src, user))
remove_fuel(1, user)
return 1
return ..()
/obj/item/weapon/weldingtool/attackby(obj/item/W as obj, mob/living/user as mob)
if(istype(W,/obj/item/weapon/tool/screwdriver))
if(welding)
to_chat(user, "<span class='danger'>Stop welding first!</span>")
return
status = !status
if(status)
to_chat(user, "<span class='notice'>You secure the welder.</span>")
else
to_chat(user, "<span class='notice'>The welder can now be attached and modified.</span>")
src.add_fingerprint(user)
return
if((!status) && (istype(W,/obj/item/stack/rods)))
var/obj/item/stack/rods/R = W
R.use(1)
var/obj/item/weapon/flamethrower/F = new/obj/item/weapon/flamethrower(user.loc)
src.loc = F
F.weldtool = src
if (user.client)
user.client.screen -= src
if (user.r_hand == src)
user.remove_from_mob(src)
else
user.remove_from_mob(src)
src.master = F
src.layer = initial(src.layer)
user.remove_from_mob(src)
if (user.client)
user.client.screen -= src
src.loc = F
src.add_fingerprint(user)
return
..()
return
/obj/item/weapon/weldingtool/process()
if(welding)
++burned_fuel_for
if(burned_fuel_for >= WELDER_FUEL_BURN_INTERVAL)
remove_fuel(1)
if(get_fuel() < 1)
setWelding(0)
else //Only start fires when its on and has enough fuel to actually keep working
var/turf/location = src.loc
if(istype(location, /mob/living))
var/mob/living/M = location
if(M.item_is_in_hands(src))
location = get_turf(M)
if (istype(location, /turf))
location.hotspot_expose(700, 5)
/obj/item/weapon/weldingtool/afterattack(obj/O as obj, mob/user as mob, proximity)
if(!proximity) return
if (istype(O, /obj/structure/reagent_dispensers/fueltank) && get_dist(src,O) <= 1)
if(!welding && max_fuel)
O.reagents.trans_to_obj(src, max_fuel)
to_chat(user, "<span class='notice'>Welder refueled</span>")
playsound(src, 'sound/effects/refill.ogg', 50, 1, -6)
return
else if(!welding)
to_chat(user, "<span class='notice'>[src] doesn't use fuel.</span>")
return
else
message_admins("[key_name_admin(user)] triggered a fueltank explosion with a welding tool.")
log_game("[key_name(user)] triggered a fueltank explosion with a welding tool.")
to_chat(user, "<span class='danger'>You begin welding on the fueltank and with a moment of lucidity you realize, this might not have been the smartest thing you've ever done.</span>")
var/obj/structure/reagent_dispensers/fueltank/tank = O
tank.explode()
return
if (src.welding)
remove_fuel(1)
var/turf/location = get_turf(user)
if(isliving(O))
var/mob/living/L = O
L.IgniteMob()
if (istype(location, /turf))
location.hotspot_expose(700, 50, 1)
/obj/item/weapon/weldingtool/attack_self(mob/user)
setWelding(!welding, user)
//Returns the amount of fuel in the welder
/obj/item/weapon/weldingtool/proc/get_fuel()
return reagents.get_reagent_amount("fuel")
/obj/item/weapon/weldingtool/proc/get_max_fuel()
return max_fuel
//Removes fuel from the welding tool. If a mob is passed, it will perform an eyecheck on the mob. This should probably be renamed to use()
/obj/item/weapon/weldingtool/proc/remove_fuel(var/amount = 1, var/mob/M = null)
if(!welding)
return 0
if(amount)
burned_fuel_for = 0 // Reset the counter since we're removing fuel.
if(get_fuel() >= amount)
reagents.remove_reagent("fuel", amount)
if(M)
eyecheck(M)
update_icon()
return 1
else
if(M)
to_chat(M, "<span class='notice'>You need more welding fuel to complete this task.</span>")
update_icon()
return 0
//Returns whether or not the welding tool is currently on.
/obj/item/weapon/weldingtool/proc/isOn()
return welding
/obj/item/weapon/weldingtool/update_icon()
..()
overlays.Cut()
// Welding overlay.
if(welding)
var/image/I = image(icon, src, "[icon_state]-on")
overlays.Add(I)
item_state = "[initial(item_state)]1"
else
item_state = initial(item_state)
// Fuel counter overlay.
if(change_icons && get_max_fuel())
var/ratio = get_fuel() / get_max_fuel()
ratio = CEILING(ratio * 4, 1) * 25
var/image/I = image(icon, src, "[icon_state][ratio]")
overlays.Add(I)
// Lights
if(welding && flame_intensity)
set_light(flame_intensity, flame_intensity, flame_color)
else
set_light(0)
// icon_state = welding ? "[icon_state]1" : "[initial(icon_state)]"
var/mob/M = loc
if(istype(M))
M.update_inv_l_hand()
M.update_inv_r_hand()
/obj/item/weapon/weldingtool/MouseDrop(obj/over_object as obj)
if(!canremove)
return
if (ishuman(usr) || issmall(usr)) //so monkeys can take off their backpacks -- Urist
if (istype(usr.loc,/obj/mecha)) // stops inventory actions in a mech. why?
return
if (!( istype(over_object, /obj/screen) ))
return ..()
//makes sure that the thing is equipped, so that we can't drag it into our hand from miles away.
//there's got to be a better way of doing this.
if (!(src.loc == usr) || (src.loc && src.loc.loc == usr))
return
if (( usr.restrained() ) || ( usr.stat ))
return
if ((src.loc == usr) && !(istype(over_object, /obj/screen)) && !usr.unEquip(src))
return
switch(over_object.name)
if("r_hand")
usr.u_equip(src)
usr.put_in_r_hand(src)
if("l_hand")
usr.u_equip(src)
usr.put_in_l_hand(src)
src.add_fingerprint(usr)
//Sets the welding state of the welding tool. If you see W.welding = 1 anywhere, please change it to W.setWelding(1)
//so that the welding tool updates accordingly
/obj/item/weapon/weldingtool/proc/setWelding(var/set_welding, var/mob/M)
if(!status) return
var/turf/T = get_turf(src)
//If we're turning it on
if(set_welding && !welding)
if (get_fuel() > 0)
if(M)
to_chat(M, "<span class='notice'>You switch the [src] on.</span>")
else if(T)
T.visible_message("<span class='danger'>\The [src] turns on.</span>")
playsound(src, acti_sound, 50, 1)
set_tool_quality(TOOL_WELDER, initial(tool_qualities[TOOL_WELDER]))
src.force = 15
src.damtype = "fire"
src.w_class = ITEMSIZE_LARGE
src.hitsound = 'sound/items/welder.ogg'
welding = 1
update_icon()
if(!always_process)
START_PROCESSING(SSobj, src)
else
if(M)
var/msg = max_fuel ? "welding fuel" : "charge"
to_chat(M, "<span class='notice'>You need more [msg] to complete this task.</span>")
return
//Otherwise
else if(!set_welding && welding)
if(!always_process)
STOP_PROCESSING(SSobj, src)
if(M)
to_chat(M, "<span class='notice'>You switch \the [src] off.</span>")
else if(T)
T.visible_message("<span class='warning'>\The [src] turns off.</span>")
playsound(src, deac_sound, 50, 1)
set_tool_quality(TOOL_WELDER, TOOL_QUALITY_NONE)
src.force = 3
src.damtype = "brute"
src.w_class = initial(src.w_class)
src.welding = 0
src.hitsound = initial(src.hitsound)
update_icon()
//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/living/carbon/user)
if(!istype(user))
return 1
var/safety = user.eyecheck()
safety = between(-1, safety + eye_safety_modifier, 2)
if(istype(user, /mob/living/carbon/human))
var/mob/living/carbon/human/H = user
var/obj/item/organ/internal/eyes/E = H.internal_organs_by_name[O_EYES]
if(!E)
return
switch(safety)
if(1)
to_chat(usr, "<span class='warning'>Your eyes sting a little.</span>")
E.damage += rand(1, 2)
if(E.damage > 12)
user.eye_blurry += rand(3,6)
if(0)
to_chat(usr, "<span class='warning'>Your eyes burn.</span>")
E.damage += rand(2, 4)
if(E.damage > 10)
E.damage += rand(4,10)
if(-1)
to_chat(usr, "<span class='danger'>Your thermals intensify the welder's glow. Your eyes itch and burn severely.</span>")
user.eye_blurry += rand(12,20)
E.damage += rand(12, 16)
if(safety<2)
if(E.damage > 10)
to_chat(user, "<span class='warning'>Your eyes are really starting to hurt. This can't be good for you!</span>")
if (E.damage >= E.min_broken_damage)
to_chat(user, "<span class='danger'>You go blind!</span>")
user.sdisabilities |= BLIND
else if (E.damage >= E.min_bruised_damage)
to_chat(user, "<span class='danger'>You go blind!</span>")
user.Blind(5)
user.eye_blurry = 5
// Don't cure being nearsighted
if(!(H.disabilities & NEARSIGHTED))
user.disabilities |= NEARSIGHTED
spawn(100)
user.disabilities &= ~NEARSIGHTED
return
/obj/item/weapon/weldingtool/is_hot()
return isOn()
/obj/item/weapon/weldingtool/largetank
name = "industrial welding tool"
desc = "A slightly larger welder with a larger tank."
icon_state = "indwelder"
max_fuel = 40
origin_tech = list(TECH_ENGINEERING = 2, TECH_PHORON = 2)
matter = list(MAT_STEEL = 70, "glass" = 60)
/obj/item/weapon/weldingtool/largetank/cyborg
name = "integrated welding tool"
desc = "An advanced welder designed to be used in robotic systems."
tool_qualities = list(TOOL_WELDER = TOOL_QUALITY_DECENT)
/obj/item/weapon/weldingtool/hugetank
name = "upgraded welding tool"
desc = "A much larger welder with a huge tank."
icon_state = "indwelder"
max_fuel = 80
w_class = ITEMSIZE_NORMAL
origin_tech = list(TECH_ENGINEERING = 3)
matter = list(MAT_STEEL = 70, "glass" = 120)
/obj/item/weapon/weldingtool/mini
name = "emergency welding tool"
desc = "A miniature welder used during emergencies."
icon_state = "miniwelder"
max_fuel = 10
w_class = ITEMSIZE_SMALL
matter = list(MAT_METAL = 30, MAT_GLASS = 10)
change_icons = 0
tool_qualities = list(TOOL_WELDER = TOOL_QUALITY_MEDIOCRE)
eye_safety_modifier = 1 // Safer on eyes.
/datum/category_item/catalogue/anomalous/precursor_a/alien_welder
name = "Precursor Alpha Object - Self Refueling Exothermic Tool"
desc = "An unwieldly tool which somewhat resembles a weapon, due to \
having a prominent trigger attached to the part which would presumably \
have been held by whatever had created this object. When the trigger is \
held down, a small but very high temperature flame shoots out from the \
tip of the tool. The grip is able to be held by human hands, however the \
shape makes it somewhat awkward to hold.\
<br><br>\
The tool appears to utilize an unknown fuel to light and maintain the \
flame. What is more unusual, is that the fuel appears to replenish itself. \
How it does this is not known presently, however experimental human-made \
welders have been known to have a similar quality.\
<br><br>\
Interestingly, the flame is able to cut through a wide array of materials, \
such as iron, steel, stone, lead, plasteel, and even durasteel. Yet, it is unable \
to cut the unknown material that itself and many other objects made by this \
precursor civilization have made. This raises questions on the properties of \
that material, and how difficult it would have been to work with. This tool \
does demonstrate, however, that the alien fuel cannot melt precursor beams, walls, \
or other structual elements, making it rather limited for their \
deconstruction purposes."
value = CATALOGUER_REWARD_EASY
/obj/item/weapon/weldingtool/alien
name = "alien welding tool"
desc = "An alien welding tool. Whatever fuel it uses, it never runs out."
catalogue_data = list(/datum/category_item/catalogue/anomalous/precursor_a/alien_welder)
icon = 'icons/obj/abductor.dmi'
icon_state = "welder"
tool_qualities = list(TOOL_WELDER = TOOL_QUALITY_BEST)
flame_color = "#6699FF" // Light bluish.
eye_safety_modifier = 2
change_icons = 0
origin_tech = list(TECH_PHORON = 5 ,TECH_ENGINEERING = 5)
always_process = TRUE
/obj/item/weapon/weldingtool/alien/process()
if(get_fuel() <= get_max_fuel())
reagents.add_reagent("fuel", 1)
..()
/obj/item/weapon/weldingtool/experimental
name = "experimental welding tool"
desc = "An experimental welder capable of synthesizing its own fuel from waste compounds. It can output a flame hotter than regular welders."
icon_state = "exwelder"
max_fuel = 40
w_class = ITEMSIZE_NORMAL
origin_tech = list(TECH_ENGINEERING = 4, TECH_PHORON = 3)
matter = list(MAT_STEEL = 70, "glass" = 120)
tool_qualities = list(TOOL_WELDER = TOOL_QUALITY_DECENT)
change_icons = 0
flame_intensity = 3
always_process = TRUE
var/nextrefueltick = 0
/obj/item/weapon/weldingtool/experimental/process()
..()
if(get_fuel() < get_max_fuel() && nextrefueltick < world.time)
nextrefueltick = world.time + 10
reagents.add_reagent("fuel", 1)
/obj/item/weapon/weldingtool/experimental/hybrid
name = "strange welding tool"
desc = "An experimental welder capable of synthesizing its own fuel from spatial waveforms. It's like welding with a star!"
icon_state = "hybwelder"
max_fuel = 80 //more max fuel is better! Even if it doesn't actually use fuel.
eye_safety_modifier = -2 // Brighter than the sun. Literally, you can look at the sun with a welding mask of proper grade, this will burn through that.
tool_qualities = list(TOOL_WELDER = TOOL_QUALITY_GOOD)
w_class = ITEMSIZE_NORMAL
flame_intensity = 5
origin_tech = list(TECH_ENGINEERING = 5, TECH_PHORON = 4, TECH_PRECURSOR = 1)
reach = 2
/*
* Backpack Welder.
*/
/obj/item/weapon/weldingtool/tubefed
name = "tube-fed welding tool"
desc = "A bulky, cooler-burning welding tool that draws from a worn welding tank."
icon_state = "tubewelder"
max_fuel = 10
w_class = ITEMSIZE_NO_CONTAINER
matter = null
tool_qualities = list(TOOL_WELDER = TOOL_QUALITY_MEDIOCRE)
change_icons = 0
flame_intensity = 1
eye_safety_modifier = 1
always_process = TRUE
var/obj/item/weapon/weldpack/mounted_pack = null
/obj/item/weapon/weldingtool/tubefed/Initialize(var/ml)
. = ..()
if(istype(loc, /obj/item/weapon/weldpack))
mounted_pack = loc
else
return INITIALIZE_HINT_QDEL
/obj/item/weapon/weldingtool/tubefed/Destroy()
mounted_pack.nozzle = null
mounted_pack = null
return ..()
/obj/item/weapon/weldingtool/tubefed/process()
if(mounted_pack)
if(!istype(mounted_pack.loc,/mob/living/carbon/human))
mounted_pack.return_nozzle()
else
var/mob/living/carbon/human/H = mounted_pack.loc
if(H.back != mounted_pack)
mounted_pack.return_nozzle()
if(mounted_pack.loc != src.loc && src.loc != mounted_pack)
mounted_pack.return_nozzle()
visible_message("<span class='notice'>\The [src] retracts to its fueltank.</span>")
if(get_fuel() <= get_max_fuel())
mounted_pack.reagents.trans_to_obj(src, 1)
..()
/obj/item/weapon/weldingtool/tubefed/dropped(mob/user)
..()
if(src.loc != user)
mounted_pack.return_nozzle()
to_chat(user, "<span class='notice'>\The [src] retracts to its fueltank.</span>")
/obj/item/weapon/weldingtool/tubefed/survival
name = "tube-fed emergency welding tool"
desc = "A bulky, cooler-burning welding tool that draws from a worn welding tank."
icon_state = "tubewelder"
max_fuel = 5
tool_qualities = list(TOOL_WELDER = TOOL_QUALITY_POOR)
eye_safety_modifier = 2
/*
* Electric/Arc Welder
*/
/obj/item/weapon/weldingtool/electric //AND HIS WELDING WAS ELECTRIC
name = "electric welding tool"
desc = "A welder which runs off of electricity."
icon_state = "arcwelder"
max_fuel = 0 //We'll handle the consumption later.
item_state = "ewelder"
var/obj/item/weapon/cell/power_supply //What type of power cell this uses
var/charge_cost = 24 //The rough equivalent of 1 unit of fuel, based on us wanting 10 welds per battery
var/cell_type = /obj/item/weapon/cell/device
var/use_external_power = 0 //If in a borg or hardsuit, this needs to = 1
flame_color = "#00CCFF" // Blue-ish, to set it apart from the gas flames.
acti_sound = 'sound/effects/sparks4.ogg'
deac_sound = 'sound/effects/sparks4.ogg'
/obj/item/weapon/weldingtool/electric/unloaded
cell_type = null
/obj/item/weapon/weldingtool/electric/Initialize()
. = ..()
if(cell_type == null)
update_icon()
else if(cell_type)
power_supply = new cell_type(src)
else
power_supply = new /obj/item/weapon/cell/device(src)
update_icon()
/obj/item/weapon/weldingtool/electric/get_cell()
return power_supply
/obj/item/weapon/weldingtool/electric/examine(mob/user)
. = ..()
if(Adjacent(user))
if(power_supply)
. += "It [src.name] has [get_fuel()] charge left."
else
. += "It [src.name] has no power cell!"
/obj/item/weapon/weldingtool/electric/get_fuel()
if(use_external_power)
var/obj/item/weapon/cell/external = get_external_power_supply()
if(external)
return external.charge
else if(power_supply)
return power_supply.charge
else
return 0
/obj/item/weapon/weldingtool/electric/get_max_fuel()
if(use_external_power)
var/obj/item/weapon/cell/external = get_external_power_supply()
if(external)
return external.maxcharge
else if(power_supply)
return power_supply.maxcharge
return 0
/obj/item/weapon/weldingtool/electric/remove_fuel(var/amount = 1, var/mob/M = null)
if(!welding)
return 0
if(get_fuel() >= amount)
power_supply.checked_use(charge_cost)
if(use_external_power)
var/obj/item/weapon/cell/external = get_external_power_supply()
if(!external || !external.use(charge_cost)) //Take power from the borg...
power_supply.give(charge_cost) //Give it back to the cell.
if(M)
eyecheck(M)
update_icon()
return 1
else
if(M)
to_chat(M, "<span class='notice'>You need more energy to complete this task.</span>")
update_icon()
return 0
/obj/item/weapon/weldingtool/electric/attack_hand(mob/user as mob)
if(user.get_inactive_hand() == src)
if(power_supply)
power_supply.update_icon()
user.put_in_hands(power_supply)
power_supply = null
to_chat(user, "<span class='notice'>You remove the cell from the [src].</span>")
setWelding(0)
update_icon()
return
..()
else
return ..()
/obj/item/weapon/weldingtool/electric/attackby(obj/item/weapon/W, mob/user as mob)
if(istype(W, /obj/item/weapon/cell))
if(istype(W, /obj/item/weapon/cell/device))
if(!power_supply)
user.drop_item()
W.loc = src
power_supply = W
to_chat(user, "<span class='notice'>You install a cell in \the [src].</span>")
update_icon()
else
to_chat(user, "<span class='notice'>\The [src] already has a cell.</span>")
else
to_chat(user, "<span class='notice'>\The [src] cannot use that type of cell.</span>")
else
..()
/obj/item/weapon/weldingtool/electric/proc/get_external_power_supply()
if(isrobot(src.loc))
var/mob/living/silicon/robot/R = src.loc
return R.cell
if(istype(src.loc, /obj/item/rig_module))
var/obj/item/rig_module/module = src.loc
if(module.holder && module.holder.wearer)
var/mob/living/carbon/human/H = module.holder.wearer
if(istype(H) && H.back)
var/obj/item/weapon/rig/suit = H.back
if(istype(suit))
return suit.cell
if(istype(src.loc, /obj/item/mecha_parts/mecha_equipment))
var/obj/item/mecha_parts/mecha_equipment/mounting = src.loc
if(mounting.chassis && mounting.chassis.cell)
return mounting.chassis.cell
return null
/obj/item/weapon/weldingtool/electric/mounted
use_external_power = 1
/obj/item/weapon/weldingtool/electric/mounted/cyborg
tool_qualities = list(TOOL_WELDER = TOOL_QUALITY_DECENT)
/obj/item/weapon/weldingtool/electric/mounted/exosuit
var/obj/item/mecha_parts/mecha_equipment/equip_mount = null
flame_intensity = 1
eye_safety_modifier = 2
always_process = TRUE
/obj/item/weapon/weldingtool/electric/mounted/exosuit/Initialize()
. = ..()
if(istype(loc, /obj/item/mecha_parts/mecha_equipment))
equip_mount = loc
/obj/item/weapon/weldingtool/electric/mounted/exosuit/process()
..()
if(equip_mount && equip_mount.chassis)
var/obj/mecha/M = equip_mount.chassis
if(M.selected == equip_mount && get_fuel())
setWelding(TRUE, M.occupant)
else
setWelding(FALSE, M.occupant)
#undef WELDER_FUEL_BURN_INTERVAL

View File

@@ -0,0 +1,85 @@
/*
* Wirecutters
*/
/obj/item/weapon/tool/wirecutters
name = "wirecutters"
desc = "This cuts wires."
icon = 'icons/obj/tools.dmi'
icon_state = "cutters"
center_of_mass = list("x" = 18,"y" = 10)
slot_flags = SLOT_BELT
force = 6
throw_speed = 2
throw_range = 9
w_class = ITEMSIZE_SMALL
origin_tech = list(TECH_MATERIAL = 1, TECH_ENGINEERING = 1)
matter = list(MAT_STEEL = 80)
attack_verb = list("pinched", "nipped")
hitsound = 'sound/items/wirecutter.ogg'
usesound = 'sound/items/wirecutter.ogg'
drop_sound = 'sound/items/drop/wirecutter.ogg'
pickup_sound = 'sound/items/pickup/wirecutter.ogg'
sharp = 1
edge = 1
tool_qualities = list(TOOL_WIRECUTTER = TOOL_QUALITY_STANDARD)
var/random_color = TRUE
/obj/item/weapon/tool/wirecutters/Initialize()
if(random_color && prob(50))
icon_state = "cutters-y"
item_state = "cutters_yellow"
. = ..()
/obj/item/weapon/tool/wirecutters/attack(mob/living/carbon/C as mob, mob/user as mob)
if(istype(C) && user.a_intent == I_HELP && (C.handcuffed) && (istype(C.handcuffed, /obj/item/weapon/handcuffs/cable)))
usr.visible_message("\The [usr] cuts \the [C]'s restraints with \the [src]!",\
"You cut \the [C]'s restraints with \the [src]!",\
"You hear cable being cut.")
C.handcuffed = null
if(C.buckled && C.buckled.buckle_require_restraints)
C.buckled.unbuckle_mob()
C.update_handcuffed()
return
else
..()
/datum/category_item/catalogue/anomalous/precursor_a/alien_wirecutters
name = "Precursor Alpha Object - Wire Seperator"
desc = "An object appearing to have a tool shape. It has two handles, and two \
sides which are attached to each other in the center. At the end on each side \
is a sharp cutting edge, made from a seperate material than the rest of the \
tool.\
<br><br>\
This tool appears to serve the same purpose as conventional wirecutters, due \
to how similar the shapes are. If so, this implies that the creators of this \
object also may utilize flexible cylindrical strands of metal to transmit \
energy and signals, just as humans do."
value = CATALOGUER_REWARD_EASY
/obj/item/weapon/tool/wirecutters/alien
name = "alien wirecutters"
desc = "Extremely sharp wirecutters, made out of a silvery-green metal."
catalogue_data = list(/datum/category_item/catalogue/anomalous/precursor_a/alien_wirecutters)
icon = 'icons/obj/abductor.dmi'
icon_state = "cutters"
tool_qualities = list(TOOL_WIRECUTTER = TOOL_QUALITY_BEST)
origin_tech = list(TECH_MATERIAL = 5, TECH_ENGINEERING = 4)
random_color = FALSE
/obj/item/weapon/tool/wirecutters/cyborg
name = "wirecutters"
desc = "This cuts wires. With science."
usesound = 'sound/items/jaws_cut.ogg'
tool_qualities = list(TOOL_WIRECUTTER = TOOL_QUALITY_GOOD)
/obj/item/weapon/tool/wirecutters/hybrid
name = "strange wirecutters"
desc = "This cuts wires. With <span class='alien'>Science!</span>"
icon_state = "hybcutters"
w_class = ITEMSIZE_NORMAL
origin_tech = list(TECH_MATERIAL = 3, TECH_ENGINEERING = 3, TECH_PHORON = 2)
attack_verb = list("pinched", "nipped", "warped", "blasted")
usesound = 'sound/effects/stealthoff.ogg'
tool_qualities = list(TOOL_WIRECUTTER = TOOL_QUALITY_GOOD)
reach = 2

View File

@@ -0,0 +1,67 @@
/*
* Wrench
*/
/obj/item/weapon/tool/wrench
name = "wrench"
desc = "A wrench with many common uses. Can be usually found in your hand."
icon = 'icons/obj/tools.dmi'
icon_state = "wrench"
slot_flags = SLOT_BELT
force = 6
throwforce = 7
w_class = ITEMSIZE_SMALL
origin_tech = list(TECH_MATERIAL = 1, TECH_ENGINEERING = 1)
matter = list(MAT_STEEL = 150)
attack_verb = list("bashed", "battered", "bludgeoned", "whacked")
usesound = 'sound/items/ratchet.ogg'
drop_sound = 'sound/items/drop/wrench.ogg'
pickup_sound = 'sound/items/pickup/wrench.ogg'
tool_qualities = list(TOOL_WRENCH = TOOL_QUALITY_STANDARD)
/obj/item/weapon/tool/wrench/cyborg
name = "automatic wrench"
desc = "An advanced robotic wrench. Can be found in industrial synthetic shells."
usesound = 'sound/items/drill_use.ogg'
tool_qualities = list(TOOL_WRENCH = TOOL_QUALITY_DECENT)
/obj/item/weapon/tool/wrench/hybrid // Slower and bulkier than normal power tools, but it has the power of reach. If reach even worked half the time.
name = "strange wrench"
desc = "A wrench with many common uses. Can be usually found in your hand."
icon = 'icons/obj/tools.dmi'
icon_state = "hybwrench"
slot_flags = SLOT_BELT
force = 8
throwforce = 10
w_class = ITEMSIZE_NORMAL
origin_tech = list(TECH_MATERIAL = 3, TECH_ENGINEERING = 3, TECH_PHORON = 2)
attack_verb = list("bashed", "battered", "bludgeoned", "whacked", "warped", "blasted")
usesound = 'sound/effects/stealthoff.ogg'
tool_qualities = list(TOOL_WRENCH = TOOL_QUALITY_DECENT)
reach = 2
/datum/category_item/catalogue/anomalous/precursor_a/alien_wrench
name = "Precursor Alpha Object - Fastener Torque Tool"
desc = "This is an object that has a distinctive tool shape. \
It has a handle on one end, with a simple mechanism attached to it. \
On the other end is the head of the tool, with two sides each glowing \
a different color. The head opens up towards the top, in a similar shape \
as a conventional wrench.\
<br><br>\
When an object is placed into the head section of the tool, the tool appears \
to force the object to be turned in a specific direction. The direction can be \
inverted by pressing down on the mechanism on the handle. It is not known if \
this tool was intended by its creators to tighten fasteners or if it has a less obvious \
purpose, however it is very well suited to act in a wrench's capacity regardless."
value = CATALOGUER_REWARD_EASY
/obj/item/weapon/tool/wrench/alien
name = "alien wrench"
desc = "A polarized wrench. It causes anything placed between the jaws to turn."
catalogue_data = list(/datum/category_item/catalogue/anomalous/precursor_a/alien_wrench)
icon = 'icons/obj/abductor.dmi'
icon_state = "wrench"
usesound = 'sound/effects/empulse.ogg'
tool_qualities = list(TOOL_WRENCH = TOOL_QUALITY_BEST)
origin_tech = list(TECH_MATERIAL = 5, TECH_ENGINEERING = 5)