mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-21 20:11:04 +01:00
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:
@@ -392,7 +392,7 @@
|
||||
to_chat(usr, "<span class='warning'>[src] has no power cell.</span>")
|
||||
|
||||
// Handle most of things: restraining, cutting restrains, attaching tank.
|
||||
/obj/structure/closet/airbubble/attackby(W as obj, mob/user as mob)
|
||||
/obj/structure/closet/airbubble/attackby(obj/W, mob/user as mob)
|
||||
if(istype(W, /obj/item/weapon/tank))
|
||||
if(!isnull(use_internal_tank))
|
||||
user.visible_message(
|
||||
@@ -442,7 +442,7 @@
|
||||
|
||||
qdel(W)
|
||||
update_icon()
|
||||
else if(istype(W, /obj/item/weapon/wirecutters))
|
||||
else if(W.iswirecutter())
|
||||
if(!zipped)
|
||||
to_chat(user, "<span class='warning'>[src] has no cables to cut.</span>")
|
||||
attack_hand(user)
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
var/contains_body = 0
|
||||
|
||||
/obj/structure/closet/body_bag/attackby(var/obj/item/W, mob/user as mob)
|
||||
if (istype(W, /obj/item/weapon/pen))
|
||||
if (W.ispen())
|
||||
var/t = input(user, "What would you like the label to be?", text("[]", src.name), null) as text
|
||||
if (user.get_active_hand() != W)
|
||||
return
|
||||
|
||||
@@ -1283,7 +1283,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
|
||||
pai.update_location()//This notifies the pAI that they've been slotted into a PDA
|
||||
to_chat(user, "<span class='notice'>You slot \the [C] into [src].</span>")
|
||||
SSnanoui.update_uis(src) // update all UIs attached to src
|
||||
else if(istype(C, /obj/item/weapon/pen))
|
||||
else if(C.ispen())
|
||||
if(pen)
|
||||
to_chat(user, "<span class='notice'>There is already a pen in \the [src].</span>")
|
||||
else
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
else
|
||||
to_chat(user, "<span class='notice'>[src] already has a laser diode.</span>")
|
||||
|
||||
else if(istype(W, /obj/item/weapon/screwdriver))
|
||||
else if(W.isscrewdriver())
|
||||
if(diode)
|
||||
to_chat(user, "<span class='notice'>You remove the [diode.name] from the [src].</span>")
|
||||
diode.forceMove(get_turf(user))
|
||||
|
||||
@@ -255,7 +255,7 @@
|
||||
else
|
||||
to_chat(user, "<span class='warning'>The MMI must go in after everything else!</span>")
|
||||
|
||||
if (istype(W, /obj/item/weapon/pen))
|
||||
if (W.ispen())
|
||||
var/t = sanitizeSafe(input(user, "Enter new robot name", src.name, src.created_name), MAX_NAME_LEN)
|
||||
if (!t)
|
||||
return
|
||||
|
||||
@@ -132,7 +132,7 @@
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You need one metal sheet to finish the light tile!</span>")
|
||||
|
||||
else if(istype(O, /obj/item/weapon/wirecutters))
|
||||
else if(O.iswirecutter())
|
||||
user.drop_from_inventory(O,get_turf(src))
|
||||
to_chat(user, "<span class='notice'>You detach the wire from the [name].</span>")
|
||||
playsound(src.loc, 'sound/items/Wirecutter.ogg', 100, 1)
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
state = 0 //fine
|
||||
|
||||
/obj/item/stack/tile/light/attackby(var/obj/item/O, var/mob/user)
|
||||
if(istype(O, /obj/item/weapon/crowbar))
|
||||
if(O.iscrowbar())
|
||||
amount--
|
||||
to_chat(user, "<span class='notice'>You pry off the steel sheet from the [name].</span>")
|
||||
playsound(src.loc, 'sound/items/Crowbar.ogg', 100, 1)
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
/obj/item/weapon/implantcase/attackby(obj/item/weapon/I as obj, mob/user as mob)
|
||||
..()
|
||||
if (istype(I, /obj/item/weapon/pen))
|
||||
if (I.ispen())
|
||||
var/t = input(user, "What would you like the label to be?", text("[]", src.name), null) as text
|
||||
if (user.get_active_hand() != I)
|
||||
return
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
IC.examine(user)
|
||||
|
||||
/obj/item/weapon/implant/integrated_circuit/attackby(var/obj/item/O, var/mob/user)
|
||||
if(istype(O, /obj/item/weapon/crowbar) || istype(O, /obj/item/device/integrated_electronics) || istype(O, /obj/item/integrated_circuit) || istype(O, /obj/item/weapon/screwdriver) || istype(O, /obj/item/weapon/cell/device) )
|
||||
if(O.iscrowbar() || istype(O, /obj/item/device/integrated_electronics) || istype(O, /obj/item/integrated_circuit) || O.isscrewdriver() || istype(O, /obj/item/weapon/cell/device) )
|
||||
IC.attackby(O, user)
|
||||
else
|
||||
..()
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
/obj/item/device/analyzer/plant_analyzer,
|
||||
/obj/item/weapon/extinguisher/mini,
|
||||
/obj/item/weapon/pipewrench,
|
||||
/obj/item/powerdrill
|
||||
/obj/item/weapon/powerdrill
|
||||
)
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
/obj/item/weapon/crowbar = 1,
|
||||
/obj/item/weapon/wirecutters = 1,
|
||||
/obj/item/stack/cable_coil/random = 1,
|
||||
/obj/item/powerdrill = 1
|
||||
/obj/item/weapon/powerdrill = 1
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -578,7 +578,7 @@
|
||||
|
||||
//combitool
|
||||
|
||||
/obj/item/combitool
|
||||
/obj/item/weapon/combitool
|
||||
name = "combi-tool"
|
||||
desc = "It even has one of those nubbins for doing the thingy."
|
||||
icon = 'icons/obj/tools.dmi'
|
||||
@@ -595,36 +595,36 @@
|
||||
)
|
||||
var/current_tool = 1
|
||||
|
||||
/obj/item/combitool/Initialize()
|
||||
/obj/item/weapon/combitool/Initialize()
|
||||
desc = "[initial(desc)] ([tools.len]. [tools.len] possibilit[tools.len == 1 ? "y" : "ies"])"
|
||||
. = ..()
|
||||
|
||||
/obj/item/combitool/examine(var/mob/user)
|
||||
/obj/item/weapon/combitool/examine(var/mob/user)
|
||||
. = ..()
|
||||
if(. && tools.len)
|
||||
to_chat(user, "It has the following fittings:")
|
||||
for(var/tool in tools)
|
||||
to_chat(user, "- [tool][tools[current_tool] == tool ? " (selected)" : ""]")
|
||||
|
||||
/obj/item/combitool/iswrench()
|
||||
/obj/item/weapon/combitool/iswrench()
|
||||
return tools[current_tool] == "wrench"
|
||||
|
||||
/obj/item/combitool/isscrewdriver()
|
||||
/obj/item/weapon/combitool/isscrewdriver()
|
||||
return tools[current_tool] == "screwdriver"
|
||||
|
||||
/obj/item/combitool/iswirecutter()
|
||||
/obj/item/weapon/combitool/iswirecutter()
|
||||
return tools[current_tool] == "wirecutters"
|
||||
|
||||
/obj/item/combitool/iscrowbar()
|
||||
/obj/item/weapon/combitool/iscrowbar()
|
||||
return tools[current_tool] == "crowbar"
|
||||
|
||||
/obj/item/combitool/ismultitool()
|
||||
/obj/item/weapon/combitool/ismultitool()
|
||||
return tools[current_tool] == "multitool"
|
||||
|
||||
/obj/item/combitool/proc/update_tool()
|
||||
/obj/item/weapon/combitool/proc/update_tool()
|
||||
icon_state = "[initial(icon_state)]-[tools[current_tool]]"
|
||||
|
||||
/obj/item/combitool/attack_self(var/mob/user)
|
||||
/obj/item/weapon/combitool/attack_self(var/mob/user)
|
||||
if(++current_tool > tools.len)
|
||||
current_tool = 1
|
||||
var/tool = tools[current_tool]
|
||||
@@ -636,7 +636,7 @@
|
||||
return 1
|
||||
|
||||
|
||||
/obj/item/powerdrill
|
||||
/obj/item/weapon/powerdrill
|
||||
name = "impact wrench"
|
||||
desc = " The screwdriver's big brother."
|
||||
icon = 'icons/obj/tools.dmi'
|
||||
@@ -653,7 +653,7 @@
|
||||
)
|
||||
var/current_tool = 1
|
||||
|
||||
/obj/item/powerdrill/Initialize()
|
||||
/obj/item/weapon/powerdrill/Initialize()
|
||||
. = ..()
|
||||
|
||||
switch(pick("red","blue","yellow","green"))
|
||||
@@ -667,23 +667,23 @@
|
||||
drillcolor = "yellow"
|
||||
icon_state = "powerdrill[drillcolor]"
|
||||
|
||||
/obj/item/powerdrill/examine(var/mob/user)
|
||||
/obj/item/weapon/powerdrill/examine(var/mob/user)
|
||||
. = ..()
|
||||
if(. && tools.len)
|
||||
to_chat(user, "It has the following fittings:")
|
||||
for(var/tool in tools)
|
||||
to_chat(user, "- [tool][tools[current_tool] == tool ? " (selected)" : ""]")
|
||||
|
||||
/obj/item/powerdrill/iswrench()
|
||||
/obj/item/weapon/powerdrill/iswrench()
|
||||
usesound = 'sound/items/air_wrench.ogg'
|
||||
return tools[current_tool] == "wrenchbit"
|
||||
|
||||
/obj/item/powerdrill/isscrewdriver()
|
||||
/obj/item/weapon/powerdrill/isscrewdriver()
|
||||
usesound = 'sound/items/drill_use.ogg'
|
||||
|
||||
return tools[current_tool] == "screwdriverbit"
|
||||
|
||||
/obj/item/powerdrill/proc/update_tool()
|
||||
/obj/item/weapon/powerdrill/proc/update_tool()
|
||||
if(isscrewdriver())
|
||||
cut_overlays()
|
||||
add_overlay("screwdriverbit")
|
||||
@@ -691,7 +691,7 @@
|
||||
cut_overlays()
|
||||
add_overlay("wrenchbit")
|
||||
|
||||
/obj/item/powerdrill/attack_self(var/mob/user)
|
||||
/obj/item/weapon/powerdrill/attack_self(var/mob/user)
|
||||
if(++current_tool > tools.len)
|
||||
current_tool = 1
|
||||
var/tool = tools[current_tool]
|
||||
|
||||
Reference in New Issue
Block a user