Tool Resprite (#11756)

This commit is contained in:
Geeves
2021-04-30 19:32:31 +02:00
committed by GitHub
parent d1bb154c00
commit 1a932a285f
32 changed files with 184 additions and 140 deletions
+3
View File
@@ -944,3 +944,6 @@ modules/mob/living/carbon/human/life.dm if you die, you will be zoomed out.
if(SP.current_slide == src && (SP.projection in view(world.view, user)))
return TRUE
return FALSE
/obj/item/proc/get_belt_overlay() //Returns the icon used for overlaying the object on a belt
return mutable_appearance('icons/obj/clothing/belt_overlays.dmi', icon_state)
+71 -5
View File
@@ -1,6 +1,5 @@
/**
* Multitool -- A multitool is used for hacking electronic devices.
* TO-DO -- Using it as a power measurement tool for cables etc. Nannek.
*
*/
@@ -8,12 +7,11 @@
name = "multitool"
desc = "Used for pulsing wires to test which to cut. Not recommended by doctors."
desc_info = "You can use this on airlocks or APCs to try to hack them without cutting wires."
icon = 'icons/obj/contained_items/tools/multitool.dmi'
icon_state = "multitool"
item_state = "multitool"
item_icons = list(
slot_l_hand_str = 'icons/mob/items/lefthand_tools.dmi',
slot_r_hand_str = 'icons/mob/items/righthand_tools.dmi',
)
item_icons = null
contained_sprite = TRUE
flags = CONDUCT
force = 5.0
w_class = ITEMSIZE_SMALL
@@ -32,6 +30,9 @@
var/buffer_name
var/atom/buffer_object
var/datum/integrated_io/selected_io = null
var/mode = 0
/obj/item/device/multitool/Destroy()
unregister_buffer(buffer_object)
return ..()
@@ -81,3 +82,68 @@
user.AddTopicPrint(src)
MT.interact(src, user)
return 1
/obj/item/device/multitool/attack_self(mob/user)
if(selected_io)
selected_io = null
to_chat(user, "<span class='notice'>You clear the wired connection from the multitool.</span>")
else
..()
update_icon()
/obj/item/device/multitool/update_icon()
if(selected_io)
if(buffer || connecting || buffer_object)
icon_state = "multitool_tracking"
else
icon_state = "multitool_red"
else
if(buffer || connecting || buffer_object)
icon_state = "multitool_tracking_fail"
else
icon_state = "multitool"
/obj/item/device/multitool/proc/wire(datum/integrated_io/io, mob/user)
if(!io.holder.assembly)
to_chat(user, "<span class='warning'>\The [io.holder] needs to be secured inside an assembly first.</span>")
return
if(selected_io)
if(io == selected_io)
to_chat(user, "<span class='warning'>Wiring \the [selected_io.holder]'s '[selected_io.name]' pin into itself is rather pointless.</span>")
return
if(io.io_type != selected_io.io_type)
to_chat(user, "<span class='warning'>Those two types of channels are incompatable. The first is a [selected_io.io_type], \
while the second is a [io.io_type].</span>")
return
if(io.holder.assembly && io.holder.assembly != selected_io.holder.assembly)
to_chat(user, "<span class='warning'>Both \the [io.holder] and \the [selected_io.holder] need to be inside the same assembly.</span>")
return
selected_io.linked |= io
io.linked |= selected_io
to_chat(user, "<span class='notice'>You connect \the [selected_io.holder]'s '[selected_io.name]' pin to \the [io.holder]'s '[io.name]' pin.</span>")
selected_io.holder.interact(user) // This is to update the UI.
selected_io = null
else
selected_io = io
to_chat(user, "<span class='notice'>You link \the multitool to \the [selected_io.holder]'s [selected_io.name] data channel.</span>")
update_icon()
/obj/item/device/multitool/proc/unwire(datum/integrated_io/io1, datum/integrated_io/io2, mob/user)
if(!io1.linked.len || !io2.linked.len)
to_chat(user, "<span class='warning'>There is nothing connected to the data channel.</span>")
return
if(!(io1 in io2.linked) || !(io2 in io1.linked) )
to_chat(user, "<span class='warning'>These data pins aren't connected!</span>")
return
else
io1.linked.Remove(io2)
io2.linked.Remove(io1)
to_chat(user, "<span class='notice'>You clip the data connection between the [io1.holder.displayed_name]'s \
'[io1.name]' pin and the [io2.holder.displayed_name]'s '[io2.name]' pin.</span>")
io1.holder.interact(user) // This is to update the UI.
update_icon()
+3 -1
View File
@@ -322,8 +322,10 @@ BREATH ANALYZER
/obj/item/device/analyzer
name = "analyzer"
desc = "A hand-held environmental scanner which reports current gas levels."
icon_state = "atmos"
icon = 'icons/obj/contained_items/tools/air_analyzer.dmi'
icon_state = "analyzer"
item_state = "analyzer"
contained_sprite = TRUE
w_class = ITEMSIZE_SMALL
flags = CONDUCT
slot_flags = SLOT_BELT
+3 -1
View File
@@ -3,10 +3,12 @@
/obj/item/device/t_scanner
name = "\improper T-ray scanner"
desc = "A terahertz-ray emitter and scanner used to detect underfloor objects such as cables and pipes."
icon = 'icons/obj/contained_items/tools/t_scanner.dmi'
icon_state = "t-ray0"
item_state = "t-ray"
contained_sprite = TRUE
slot_flags = SLOT_BELT
w_class = ITEMSIZE_SMALL
item_state = "electronic"
matter = list(DEFAULT_WALL_MATERIAL = 150)
origin_tech = list(TECH_MAGNET = 1, TECH_ENGINEERING = 1)
action_button_name = "Toggle T-Ray scanner"
+28 -25
View File
@@ -1,9 +1,10 @@
/obj/item/flamethrower
name = "flamethrower"
desc = "A flamethrower created by modifying a welding tool to fit an external gas tank."
icon = 'icons/obj/flamethrower.dmi'
icon_state = "flamethrowerbase"
icon = 'icons/obj/contained_items/weapons/flamethrower.dmi'
icon_state = "flamethrower"
item_state = "flamethrower_0"
contained_sprite = TRUE
var/fire_sound = 'sound/weapons/flamethrower.ogg'
flags = CONDUCT
force = 3.0
@@ -20,13 +21,13 @@
var/turf/previousturf = null
var/obj/item/weldingtool/weldtool = null
var/obj/item/device/assembly/igniter/igniter = null
var/obj/item/tank/phoron/ptank = null
var/obj/item/tank/gas_tank = null
/obj/item/flamethrower/examine(mob/user)
..()
if(Adjacent(user))
if(ptank)
to_chat(user, SPAN_NOTICE("Release pressure is set to [throw_amount] kPa. The tank has about [round(ptank.air_contents.return_pressure(), 10)] kPa left in it."))
if(gas_tank)
to_chat(user, SPAN_NOTICE("Release pressure is set to [throw_amount] kPa. The tank has about [round(gas_tank.air_contents.return_pressure(), 10)] kPa left in it."))
else
to_chat(user, SPAN_WARNING("It has no gas tank installed."))
if(igniter)
@@ -39,8 +40,8 @@
qdel(weldtool)
if(igniter)
qdel(igniter)
if(ptank)
qdel(ptank)
if(gas_tank)
qdel(gas_tank)
return ..()
@@ -61,8 +62,10 @@
cut_overlays()
if(igniter)
add_overlay("+igniter[secured]")
if(ptank)
add_overlay("+ptank")
if(istype(gas_tank, /obj/item/tank/phoron))
add_overlay("+phoron_tank")
else if(istype(gas_tank, /obj/item/tank/hydrogen))
add_overlay("+hydro_tank")
if(lit)
add_overlay("+lit")
item_state = "flamethrower_1"
@@ -75,9 +78,9 @@
/obj/item/flamethrower/afterattack(atom/target, mob/user, proximity)
if(proximity)
return
if(!ptank)
if(!gas_tank)
return
if(ptank.air_contents.get_by_flag(XGM_GAS_FUEL) < 1)
if(gas_tank.air_contents.get_by_flag(XGM_GAS_FUEL) < 1)
to_chat(user, SPAN_WARNING("\The [src] doesn't have enough fuel left to throw!"))
return
// Make sure our user is still holding us
@@ -99,9 +102,9 @@
if(igniter)
igniter.forceMove(T)
igniter = null
if(ptank)
ptank.forceMove(T)
ptank = null
if(gas_tank)
gas_tank.forceMove(T)
gas_tank = null
new /obj/item/stack/rods(T)
qdel(src)
return
@@ -125,12 +128,12 @@
update_icon()
return
else if(istype(W, /obj/item/tank/phoron))
if(ptank)
else if(istype(W, /obj/item/tank/phoron) || istype(W, /obj/item/tank/hydrogen))
if(gas_tank)
to_chat(user, SPAN_WARNING("There appears to already be a tank loaded in \the [src]!"))
return
user.drop_from_inventory(W, src)
ptank = W
gas_tank = W
update_icon()
return
@@ -149,7 +152,7 @@
/obj/item/flamethrower/attack_self(mob/user)
if(use_check_and_message(user))
return
if(!ptank)
if(!gas_tank)
to_chat(user, SPAN_WARNING("Attach a phoron tank first!"))
return
var/list/options = list(
@@ -163,10 +166,10 @@
return
switch(handle)
if("Eject Tank")
if(!ptank)
if(!gas_tank)
return
user.put_in_hands(ptank)
ptank = null
user.put_in_hands(gas_tank)
gas_tank = null
lit = FALSE
if("Light")
attempt_lighting(user)
@@ -194,10 +197,10 @@
if(lit)
to_chat(user, SPAN_WARNING("\The [src] is already lit."))
return
if(!ptank)
if(!gas_tank)
to_chat(user, SPAN_WARNING("\The [src] doesn't have a tank installed."))
return
if(ptank.air_contents.get_by_flag(XGM_GAS_FUEL) < 1)
if(gas_tank.air_contents.get_by_flag(XGM_GAS_FUEL) < 1)
to_chat(user, SPAN_WARNING("\The [src] doesn't have any flammable fuel to light!"))
return
lit = TRUE
@@ -233,13 +236,13 @@
/obj/item/flamethrower/proc/ignite_turf(turf/target)
var/datum/gas_mixture/air_transfer = ptank.air_contents.remove_ratio(0.02 * (throw_amount / 100))
var/datum/gas_mixture/air_transfer = gas_tank.air_contents.remove_ratio(0.02 * (throw_amount / 100))
new /obj/effect/decal/cleanable/liquid_fuel/flamethrower_fuel(target, air_transfer.get_by_flag(XGM_GAS_FUEL) * 15, get_dir(loc, target))
for(var/g in air_transfer.gas)
if(gas_data.flags[g] & XGM_GAS_FUEL)
air_transfer.gas[g] = 0
target.assume_air(air_transfer)
target.hotspot_expose((ptank.air_contents.temperature*2) + 400, 500)
target.hotspot_expose((gas_tank.air_contents.temperature*2) + 400, 500)
/obj/item/flamethrower/full/Initialize()
. = ..()
@@ -14,12 +14,20 @@
pickup_sound = 'sound/items/pickup/toolbelt.ogg'
var/flipped = FALSE
var/show_above_suit = FALSE
var/content_overlays = FALSE //If this is true, the belt will gain overlays based on what it's holding
/obj/item/storage/belt/proc/update_clothing_icon()
if(ismob(src.loc))
var/mob/M = src.loc
M.update_inv_belt()
/obj/item/storage/belt/update_icon()
cut_overlays()
if(content_overlays)
for(var/obj/item/I in contents)
add_overlay(I.get_belt_overlay())
..()
/obj/item/storage/belt/verb/toggle_layer()
set name = "Switch Belt Layer"
set category = "Object"
@@ -34,6 +42,10 @@
. = ..()
update_flip_verb()
/obj/item/storage/belt/fill()
. = ..()
update_icon()
/obj/item/storage/belt/proc/update_flip_verb()
if(("[initial(icon_state)]_flip") in icon_states(icon)) // Check for whether it has a flipped icon. Prevents invisible sprites.
verbs += /obj/item/storage/belt/proc/flipbelt
@@ -86,7 +98,11 @@
/obj/item/device/debugger,
/obj/item/device/eftpos
)
content_overlays = TRUE
/obj/item/storage/belt/utility/ce
icon_state = "utilitybelt_ce"
item_state = "utility_ce"
/obj/item/storage/belt/utility/full
starts_with = list(
@@ -258,6 +274,7 @@
/obj/item/device/holowarrant,
/obj/item/device/radio
)
content_overlays = TRUE
/obj/item/storage/belt/soulstone
name = "soul stone belt"
@@ -90,9 +90,9 @@
if (istype(W, /obj/item/flamethrower))
var/obj/item/flamethrower/F = W
if ((!F.secured)||(F.ptank)) return
if ((!F.secured)||(F.gas_tank)) return
src.master = F
F.ptank = src
F.gas_tank = src
user.remove_from_mob(src)
src.forceMove(F)
return
+48 -35
View File
@@ -82,6 +82,13 @@
tf.Translate(-3,0) //Could do this with pixel_x but let's just update the appearance once.
transform = tf
/obj/item/screwdriver/get_belt_overlay()
var/mutable_appearance/body = mutable_appearance('icons/obj/clothing/belt_overlays.dmi', "screwdriver")
var/mutable_appearance/head = mutable_appearance('icons/obj/clothing/belt_overlays.dmi', "screwdriver_head")
body.color = color
head.add_overlay(body)
return head
/obj/item/screwdriver/pickup(mob/user)
..()
update_icon()
@@ -150,6 +157,13 @@
tf.Translate(-1,0) //Could do this with pixel_x but let's just update the appearance once.
transform = tf
/obj/item/wirecutters/get_belt_overlay()
var/mutable_appearance/body = mutable_appearance('icons/obj/clothing/belt_overlays.dmi', "wirecutters")
var/mutable_appearance/head = mutable_appearance('icons/obj/clothing/belt_overlays.dmi', "wirecutters_head")
body.color = color
head.add_overlay(body)
return head
/obj/item/wirecutters/pickup(mob/user)
..()
update_icon()
@@ -191,20 +205,15 @@
/obj/item/weldingtool
name = "welding tool"
desc = "A welding tool with a built-in fuel tank, designed for welding and cutting metal."
icon = 'icons/obj/tools.dmi'
item_icons = list(
slot_l_hand_str = 'icons/mob/items/lefthand_tools.dmi',
slot_r_hand_str = 'icons/mob/items/righthand_tools.dmi',
)
icon_state = "welder_off"
item_state = "welder_off"
icon = 'icons/obj/contained_items/tools/welding_tools.dmi'
icon_state = "welder"
item_state = "welder"
contained_sprite = TRUE
flags = CONDUCT
slot_flags = SLOT_BELT
drop_sound = 'sound/items/drop/weldingtool.ogg'
pickup_sound = 'sound/items/pickup/weldingtool.ogg'
usesound = 'sound/items/welder.ogg'
var/base_iconstate = "welder"//These are given an _on/_off suffix before being used
var/base_itemstate = "welder"
//Amount of OUCH when it's thrown
force = 3
@@ -224,14 +233,16 @@
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/change_icons = TRUE
/obj/item/weldingtool/iswelder()
return TRUE
/obj/item/weldingtool/largetank
name = "industrial welding tool"
desc = "A welding tool with an extended-capacity built-in fuel tank, standard issue for engineers."
base_iconstate = "ind_welder"
base_itemstate = "ind_welder"
icon_state = "indwelder"
item_state = "welder"
max_fuel = 40
matter = list(DEFAULT_WALL_MATERIAL = 100, MATERIAL_GLASS = 60)
origin_tech = list(TECH_ENGINEERING = 2)
@@ -239,8 +250,8 @@
/obj/item/weldingtool/hugetank
name = "advanced welding tool"
desc = "A rare and powerful welding tool with a super-extended fuel tank."
base_iconstate = "adv_welder"
base_itemstate = "adv_welder"
icon_state = "advwelder"
item_state = "advwelder"
max_fuel = 80
matter = list(DEFAULT_WALL_MATERIAL = 200, MATERIAL_GLASS = 120)
origin_tech = list(TECH_ENGINEERING = 3)
@@ -249,16 +260,16 @@
/obj/item/weldingtool/experimental
name = "experimental welding tool"
desc = "A scientifically-enhanced welding tool that uses fuel-producing microbes to gradually replenish its fuel supply."
base_iconstate = "exp_welder"
base_itemstate = "exp_welder"
icon_state = "expwelder"
item_state = "expwelder"
max_fuel = 40
matter = list(DEFAULT_WALL_MATERIAL = 100, MATERIAL_GLASS = 120)
origin_tech = list(TECH_ENGINEERING = 4, TECH_BIO = 4)
var/last_gen = 0
var/fuelgen_delay = 400 //The time, in deciseconds, required to regenerate one unit of fuel
//400 = 1 unit per 40 seconds
change_icons = FALSE
//Welding tool functionality here
/obj/item/weldingtool/Initialize()
@@ -270,17 +281,27 @@
R.add_reagent(/decl/reagent/fuel, max_fuel)
update_icon()
/obj/item/weldingtool/update_icon()
..()
var/add = welding ? "_on" : "_off"
icon_state = base_iconstate + add //These are given an _on/_off suffix before being used
item_state = base_itemstate + add
/obj/item/weldingtool/proc/update_torch()
if(welding)
add_overlay("[initial(icon_state)]-on")
item_state = "[initial(item_state)]1"
else
item_state = "[initial(item_state)]"
if(welding == 2)
set_light(0.7, 2, l_color = LIGHT_COLOR_CYAN)
else if (welding == 1)
set_light(0.6, 1.5, l_color = LIGHT_COLOR_LAVA)
else
set_light(0)
/obj/item/weldingtool/update_icon()
cut_overlays()
if(change_icons)
var/ratio = get_fuel() / max_fuel
ratio = CEILING(ratio*4, 1) * 25
add_overlay("[initial(icon_state)][ratio]")
update_torch()
var/mob/M = loc
if(istype(M))
M.update_inv_l_hand()
@@ -712,13 +733,10 @@
/obj/item/powerdrill
name = "impact wrench"
desc = "The screwdriver's big brother."
icon = 'icons/obj/tools.dmi'
item_icons = list(
slot_l_hand_str = 'icons/mob/items/lefthand_tools.dmi',
slot_r_hand_str = 'icons/mob/items/righthand_tools.dmi',
)
icon_state = "powerdrillyellow"
item_state = "powerdrillyellow"
icon = 'icons/obj/contained_items/tools/impact_wrench.dmi'
icon_state = "impact_wrench-screw"
item_state = "impact_wrench"
contained_sprite = TRUE
force = 8
attack_verb = list("gored", "drilled", "screwed", "punctured")
w_class = ITEMSIZE_SMALL
@@ -730,12 +748,8 @@
"wrenchbit"
)
/obj/item/powerdrill/Initialize()
. = ..()
var/drillcolor = pick("red", "blue", "yellow", "green")
icon_state = "powerdrill[drillcolor]"
item_state = icon_state
update_tool()
/obj/item/powerdrill/examine(var/mob/user)
@@ -763,13 +777,12 @@
return tools[current_tool] == "screwdriverbit"
/obj/item/powerdrill/proc/update_tool()
cut_overlays()
if(isscrewdriver())
usesound = 'sound/items/air_wrench.ogg'
add_overlay("screwdriverbit")
icon_state = "impact_wrench-screw"
else if(iswrench())
usesound = 'sound/items/drill_use.ogg'
add_overlay("wrenchbit")
icon_state = "impact_wrench-wrench"
/obj/item/powerdrill/attack_self(var/mob/user)
if(++current_tool > tools.len)