Replaces istypes with the proper tool_behaviour checks. (#40414)

This commit is contained in:
ShizCalev
2018-09-30 20:10:31 -04:00
committed by vuonojenmustaturska
parent 2dfa05a848
commit 2fa1ac1349
179 changed files with 489 additions and 464 deletions

View File

@@ -385,7 +385,7 @@
if(install_component(W, user))
return
if(istype(W, /obj/item/wrench))
if(W.tool_behaviour == TOOL_WRENCH)
if(all_components.len)
to_chat(user, "<span class='warning'>Remove all components from \the [src] before disassembling it.</span>")
return
@@ -395,7 +395,7 @@
qdel(src)
return
if(istype(W, /obj/item/weldingtool))
if(W.tool_behaviour == TOOL_WELDER)
if(obj_integrity == max_integrity)
to_chat(user, "<span class='warning'>\The [src] does not require repairs.</span>")
return
@@ -409,7 +409,7 @@
to_chat(user, "<span class='notice'>You repair \the [src].</span>")
return
if(istype(W, /obj/item/screwdriver))
if(W.tool_behaviour == TOOL_SCREWDRIVER)
if(!all_components.len)
to_chat(user, "<span class='warning'>This device doesn't have any components installed.</span>")
return

View File

@@ -32,13 +32,6 @@
/obj/item/computer_hardware/attackby(obj/item/I, mob/living/user)
// Multitool. Runs diagnostics
if(istype(I, /obj/item/multitool))
to_chat(user, "***** DIAGNOSTICS REPORT *****")
diagnostics(user)
to_chat(user, "******************************")
return 1
// Cable coil. Works as repair method, but will probably require multiple applications and more cable.
if(istype(I, /obj/item/stack/cable_coil))
var/obj/item/stack/S = I
@@ -51,10 +44,16 @@
return 1
if(try_insert(I, user))
return 1
return TRUE
return ..()
/obj/item/computer_hardware/multitool_act(mob/living/user, obj/item/I)
to_chat(user, "***** DIAGNOSTICS REPORT *****")
diagnostics(user)
to_chat(user, "******************************")
return TRUE
// Called on multitool click, prints diagnostic information to the user.
/obj/item/computer_hardware/proc/diagnostics(var/mob/user)
to_chat(user, "Hardware Integrity Test... (Corruption: [damage]/[max_damage]) [damage > damage_failure ? "FAIL" : damage > damage_malfunction ? "WARN" : "PASS"]")

View File

@@ -62,7 +62,7 @@
/obj/item/computer_hardware/ai_slot/attackby(obj/item/I, mob/living/user)
if(..())
return
if(istype(I, /obj/item/screwdriver))
if(I.tool_behaviour == TOOL_SCREWDRIVER)
to_chat(user, "<span class='notice'>You press down on the manual eject button with \the [I].</span>")
try_eject(,user,1)
return

View File

@@ -100,7 +100,7 @@
/obj/item/computer_hardware/card_slot/attackby(obj/item/I, mob/living/user)
if(..())
return
if(istype(I, /obj/item/screwdriver))
if(I.tool_behaviour == TOOL_SCREWDRIVER)
to_chat(user, "<span class='notice'>You press down on the manual eject button with \the [I].</span>")
try_eject(0,user)
return