Converts some istype's to use helpers (#3224)

Converts various istype's to use helpers. Mainly:
Cable
Wrench
Screwdriver
Multitool
Crowbar
Wirecutter

And makes the helpers defines.
This commit is contained in:
Ron
2017-08-06 15:08:42 -04:00
committed by Erki
parent ad96a34dd8
commit cb5e227320
219 changed files with 546 additions and 572 deletions

View File

@@ -126,12 +126,12 @@
return ..()
/obj/machinery/ntnet_relay/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
if(istype(W, /obj/item/weapon/screwdriver))
if(isscrewdriver(W))
playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1)
panel_open = !panel_open
user << "You [panel_open ? "open" : "close"] the maintenance hatch"
return
if(istype(W, /obj/item/weapon/crowbar))
if(iscrowbar(W))
if(!panel_open)
user << "Open the maintenance panel first."
return

View File

@@ -148,7 +148,7 @@
try_install_component(user, C)
else
to_chat(user, "This component is too large for \the [src].")
if(istype(W, /obj/item/weapon/wrench))
if(iswrench(W))
var/list/components = get_all_components()
if(components.len)
to_chat(user, "Remove all components from \the [src] before disassembling it.")
@@ -162,7 +162,7 @@
"You hear a ratchet.")
qdel(src)
return
if(istype(W, /obj/item/weapon/weldingtool))
if(iswelder(W))
var/obj/item/weapon/weldingtool/WT = W
if(!WT.isOn())
to_chat(user, "\The [W] is off.")
@@ -179,7 +179,7 @@
to_chat(user, "You repair \the [src].")
return
if(istype(W, /obj/item/weapon/screwdriver))
if(isscrewdriver(W))
var/list/all_components = get_all_components()
if(!all_components.len)
to_chat(user, "This device doesn't have any components installed.")

View File

@@ -19,7 +19,7 @@
is_holographic = TRUE
/obj/item/modular_computer/telescreen/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
if(istype(W, /obj/item/weapon/crowbar))
if(iscrowbar(W))
if(anchored)
shutdown_computer()
anchored = FALSE

View File

@@ -28,7 +28,7 @@
stored_card = W
W.forceMove(src)
update_power_usage()
if(istype(W, /obj/item/weapon/screwdriver))
if(isscrewdriver(W))
user << "You manually remove \the [stored_card] from \the [src]."
stored_card.forceMove(get_turf(src))
stored_card = null

View File

@@ -15,7 +15,7 @@
/obj/item/weapon/computer_hardware/attackby(var/obj/item/W as obj, var/mob/living/user as mob)
// Multitool. Runs diagnostics
if(istype(W, /obj/item/device/multitool))
if(ismultitool(W))
to_chat(user, "***** DIAGNOSTICS REPORT *****")
diagnostics(user)
to_chat(user, "******************************")
@@ -31,7 +31,7 @@
damage = 0
return 1
// Cable coil. Works as repair method, but will probably require multiple applications and more cable.
if(istype(S, /obj/item/stack/cable_coil))
if(iscoil(S))
if(!damage)
to_chat(user, "\The [src] doesn't seem to require repairs.")
return 1