Killing off inconsistencies with impact wrenches / combi-tools (#7269)

Part 1 in the "why my impact wrench no wrench bolt" saga

tl;dr for end users: combitools / impact wrenches now work on everything their non-powered versions do (except mechs and RIGs, tune in next time on dragon ball Z for that)

essentially all this PR does is murder every istype() check possible that could use a helper function instead, most notably many pen checks with ispen(). it also repaths combitools and powerdrills to /obj/item/weapon so they aren't instantly taken out of contention by half of the known attackby() prompts

I already squashed a couple runtimes here and there from the pen changes and it's possible I missed another because pencode is another scourge upon our lives
This commit is contained in:
JohnWildkins
2019-10-26 22:20:40 +03:00
committed by Erki
parent 751f77550a
commit 9c335f6c00
47 changed files with 141 additions and 119 deletions
+4 -4
View File
@@ -57,10 +57,10 @@
r_contents = reverselist(contents)
to_chat(user, "<span class='notice'>You clip the [W] onto \the [src].</span>")
else if(istype(toppaper) && istype(W, /obj/item/weapon/pen))
else if(istype(toppaper) && W.ispen())
toppaper.attackby(W, user)
else if(istype(W, /obj/item/weapon/pen))
else if(W.ispen())
add_pen(user)
if(ui_open)
@@ -101,7 +101,7 @@
/obj/item/weapon/clipboard/proc/add_pen(mob/user)
if(!haspen)
var/obj/item/weapon/pen/W = user.get_active_hand()
if(istype(W, /obj/item/weapon/pen))
if(W.ispen())
user.drop_from_inventory(W,src)
haspen = W
to_chat(user, "<span class='notice'>You slot the pen into \the [src].</span>")
@@ -131,7 +131,7 @@
var/obj/item/I = usr.get_active_hand()
if(istype(I, /obj/item/weapon/pen))
if(I.ispen())
P.attackby(I, usr)
else if (haspen)
P.attackby(haspen, usr)
+1 -1
View File
@@ -41,7 +41,7 @@
user.drop_from_inventory(W,src)
to_chat(user, "<span class='notice'>You put the [W] into \the [src].</span>")
update_icon()
else if(istype(W, /obj/item/weapon/pen))
else if(W.ispen())
var/n_name = sanitizeSafe(input(usr, "What would you like to label the folder?", "Folder Labelling", null) as text, MAX_NAME_LEN)
if((loc == usr && usr.stat == 0))
name = "folder[(n_name ? text("- '[n_name]'") : null)]"
+3 -3
View File
@@ -245,7 +245,7 @@
update_icon()
/obj/item/weapon/paper/proc/get_signature(var/obj/item/weapon/pen/P, mob/user as mob)
if(P && istype(P, /obj/item/weapon/pen))
if(P && P.ispen())
return P.get_signature(user)
if (user)
@@ -363,7 +363,7 @@
var/obj/item/i = usr.get_active_hand() // Check to see if he still got that darn pen, also check if he's using a crayon or pen.
var/obj/item/weapon/clipboard/c
var/iscrayon = 0
if(!istype(i, /obj/item/weapon/pen))
if(!i.ispen())
if(usr.back && istype(usr.back,/obj/item/weapon/rig))
var/obj/item/weapon/rig/r = usr.back
var/obj/item/rig_module/device/pen/m = locate(/obj/item/rig_module/device/pen) in r.installed_modules
@@ -474,7 +474,7 @@
B.amount = 2
B.update_icon()
else if(istype(P, /obj/item/weapon/pen))
else if(P.ispen())
if(icon_state == "scrap")
to_chat(user, span("warning", "The [src] is too crumpled to write on."))
return
+1 -1
View File
@@ -42,7 +42,7 @@ var/global/photo_count = 0
user.examinate(src)
/obj/item/weapon/photo/attackby(obj/item/weapon/P as obj, mob/user as mob)
if(istype(P, /obj/item/weapon/pen))
if(P.ispen())
var/txt = sanitize(input(user, "What would you like to write on the back?", "Photo Writing", null) as text, 128)
if(loc == user && user.stat == 0)
scribble = txt