mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-07-18 19:39:42 +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:
@@ -398,7 +398,7 @@
|
||||
custom_name = sanitize(input("Enter a custom name for your [name]", "Set Name") as text|null)
|
||||
to_chat(user,"You label \the [name] as \"[custom_name]\"")
|
||||
update_icon()
|
||||
else if(istype(I,/obj/item/weapon/wrench))
|
||||
else if(I.iswrench())
|
||||
if(installed_upgrade_chip)
|
||||
playsound(src,I.usesound, 50, 0)
|
||||
to_chat(user,"You remove \the [installed_upgrade_chip].")
|
||||
|
||||
@@ -263,7 +263,7 @@
|
||||
update_icon()
|
||||
return TRUE
|
||||
|
||||
else if(istype(I, /obj/item/device/integrated_electronics/wirer) || istype(I, /obj/item/device/integrated_electronics/debugger) || istype(I, /obj/item/weapon/screwdriver))
|
||||
else if(istype(I, /obj/item/device/integrated_electronics/wirer) || istype(I, /obj/item/device/integrated_electronics/debugger) || I.isscrewdriver())
|
||||
if(opened)
|
||||
interact(user)
|
||||
else
|
||||
|
||||
@@ -211,14 +211,14 @@ a creative player the means to solve many problems. Circuits are held inside an
|
||||
ea.interact(usr)
|
||||
|
||||
if(href_list["pin_name"])
|
||||
if (!istype(held_item, /obj/item/device/multitool) || !allow_multitool)
|
||||
if (!held_item.ismultitool() || !allow_multitool)
|
||||
href_list["wire"] = 1
|
||||
else
|
||||
var/obj/item/device/multitool/M = held_item
|
||||
M.wire(pin,usr)
|
||||
|
||||
if(href_list["pin_data"])
|
||||
if (!istype(held_item, /obj/item/device/multitool) || !allow_multitool)
|
||||
if (!held_item.ismultitool() || !allow_multitool)
|
||||
href_list["wire"] = 1
|
||||
|
||||
else
|
||||
@@ -226,7 +226,7 @@ a creative player the means to solve many problems. Circuits are held inside an
|
||||
io.ask_for_pin_data(usr) // The pins themselves will determine how to ask for data, and will validate the data.
|
||||
|
||||
if(href_list["pin_unwire"])
|
||||
if (!istype(held_item, /obj/item/device/multitool) || !allow_multitool)
|
||||
if (!held_item.ismultitool() || !allow_multitool)
|
||||
href_list["wire"] = 1
|
||||
else
|
||||
var/obj/item/device/multitool/M = held_item
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
if(istype(O, /obj/item/weapon/book))
|
||||
user.drop_from_inventory(O,src)
|
||||
update_icon()
|
||||
else if(istype(O, /obj/item/weapon/pen))
|
||||
else if(O.ispen())
|
||||
var/newname = sanitizeSafe(input("What would you like to title this bookshelf?"), MAX_NAME_LEN)
|
||||
if(!newname)
|
||||
return
|
||||
@@ -235,7 +235,7 @@
|
||||
else
|
||||
to_chat(user, "<span class='notice'>There's already something in [title]!</span>")
|
||||
return
|
||||
if(istype(W, /obj/item/weapon/pen))
|
||||
if(W.ispen())
|
||||
if(unique)
|
||||
to_chat(user, "These pages don't seem to take the ink well. Looks like you can't modify it.")
|
||||
return
|
||||
|
||||
@@ -387,7 +387,7 @@ var/list/cleanbot_types // Going to use this to generate a list of types once th
|
||||
to_chat(user, "<span class='notice'>You add the robot arm to the bucket and sensor assembly. Beep boop!</span>")
|
||||
qdel(src)
|
||||
|
||||
else if(istype(O, /obj/item/weapon/pen))
|
||||
else if(O.ispen())
|
||||
var/t = sanitizeSafe(input(user, "Enter new robot name", name, created_name), MAX_NAME_LEN)
|
||||
if(!t)
|
||||
return
|
||||
|
||||
@@ -296,7 +296,7 @@
|
||||
/obj/item/weapon/secbot_assembly/ed209_assembly/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
|
||||
..()
|
||||
|
||||
if(istype(W, /obj/item/weapon/pen))
|
||||
if(W.ispen())
|
||||
var/t = sanitizeSafe(input(user, "Enter new robot name", name, created_name), MAX_NAME_LEN)
|
||||
if(!t)
|
||||
return
|
||||
|
||||
@@ -380,7 +380,7 @@
|
||||
qdel(src)
|
||||
return 1
|
||||
|
||||
else if(istype(W, /obj/item/weapon/pen))
|
||||
else if(W.ispen())
|
||||
var/t = input(user, "Enter new robot name", name, created_name) as text
|
||||
t = sanitize(t, MAX_NAME_LEN)
|
||||
if(!t)
|
||||
|
||||
@@ -341,7 +341,7 @@
|
||||
to_chat(user, "<span class='notice'>You add the sensor to the toolbox and tiles!</span>")
|
||||
qdel(src)
|
||||
return 1
|
||||
else if (istype(W, /obj/item/weapon/pen))
|
||||
else if (W.ispen())
|
||||
var/t = sanitizeSafe(input(user, "Enter new robot name", name, created_name), MAX_NAME_LEN)
|
||||
if(!t)
|
||||
return
|
||||
@@ -371,7 +371,7 @@
|
||||
to_chat(user, "<span class='notice'>You add the robot arm to the odd looking toolbox assembly! Boop beep!</span>")
|
||||
qdel(src)
|
||||
return 1
|
||||
else if(istype(W, /obj/item/weapon/pen))
|
||||
else if(W.ispen())
|
||||
var/t = sanitizeSafe(input(user, "Enter new robot name", name, created_name), MAX_NAME_LEN)
|
||||
if(!t)
|
||||
return
|
||||
|
||||
@@ -347,7 +347,7 @@
|
||||
|
||||
/obj/item/weapon/firstaid_arm_assembly/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
..()
|
||||
if(istype(W, /obj/item/weapon/pen))
|
||||
if(W.ispen())
|
||||
var/t = sanitizeSafe(input(user, "Enter new robot name", name, created_name), MAX_NAME_LEN)
|
||||
if(!t)
|
||||
return
|
||||
|
||||
@@ -597,7 +597,7 @@
|
||||
|
||||
/mob/living/bot/secbot/attackby(var/obj/item/O, var/mob/user)
|
||||
..()
|
||||
if(istype(O, /obj/item/weapon/card/id) || istype(O, /obj/item/weapon/pen) || istype(O, /obj/item/device/pda))
|
||||
if(istype(O, /obj/item/weapon/card/id) || O.ispen() || istype(O, /obj/item/device/pda))
|
||||
return
|
||||
|
||||
target = user
|
||||
@@ -708,7 +708,7 @@
|
||||
qdel(src)
|
||||
return 1
|
||||
|
||||
else if(istype(O, /obj/item/weapon/pen))
|
||||
else if(O.ispen())
|
||||
var/t = sanitizeSafe(input(user, "Enter new robot name", name, created_name), MAX_NAME_LEN)
|
||||
if(!t)
|
||||
return
|
||||
|
||||
@@ -356,7 +356,7 @@ var/global/list/robot_modules = list(
|
||||
/obj/item/weapon/robot_module/engineering/construction/New()
|
||||
..()
|
||||
src.modules += new /obj/item/device/flash(src)
|
||||
src.modules += new /obj/item/powerdrill(src)
|
||||
src.modules += new /obj/item/weapon/powerdrill(src)
|
||||
src.modules += new /obj/item/borg/sight/meson(src)
|
||||
src.modules += new /obj/item/weapon/extinguisher(src)
|
||||
src.modules += new /obj/item/weapon/rfd/construction/borg(src)
|
||||
|
||||
@@ -1207,8 +1207,8 @@ proc/is_blind(A)
|
||||
|
||||
#undef SAFE_PERP
|
||||
|
||||
/mob/proc/get_multitool(var/obj/item/device/multitool/P)
|
||||
if(istype(P))
|
||||
/mob/proc/get_multitool(var/obj/P)
|
||||
if(P.ismultitool())
|
||||
return P
|
||||
|
||||
/mob/abstract/observer/get_multitool()
|
||||
|
||||
@@ -291,7 +291,7 @@
|
||||
/obj/item/organ/external/hand/right/autakh/tool
|
||||
name = "engineering grasper"
|
||||
action_button_name = "Deploy Mechanical Combitool"
|
||||
var/augment_type = /obj/item/combitool/robotic
|
||||
var/augment_type = /obj/item/weapon/combitool/robotic
|
||||
|
||||
/obj/item/organ/external/hand/right/autakh/tool/refresh_action_button()
|
||||
. = ..()
|
||||
@@ -329,15 +329,15 @@
|
||||
owner.put_in_active_hand(M)
|
||||
owner.visible_message("<span class='notice'>\The [M] slides out of \the [owner]'s [src].</span>","<span class='notice'>You deploy \the [M]!</span>")
|
||||
|
||||
/obj/item/combitool/robotic
|
||||
/obj/item/weapon/combitool/robotic
|
||||
name = "robotic combitool"
|
||||
desc = "An integrated combitool module."
|
||||
icon_state = "digitool"
|
||||
|
||||
/obj/item/combitool/robotic/throw_at()
|
||||
/obj/item/weapon/combitool/robotic/throw_at()
|
||||
usr.drop_from_inventory(src)
|
||||
|
||||
/obj/item/combitool/robotic/dropped()
|
||||
/obj/item/weapon/combitool/robotic/dropped()
|
||||
loc = null
|
||||
qdel(src)
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)]"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -79,14 +79,14 @@
|
||||
|
||||
/obj/item/weapon/reagent_containers/blood/attackby(obj/item/weapon/P as obj, mob/user as mob)
|
||||
..()
|
||||
if (istype(P, /obj/item/weapon/pen))
|
||||
if (P.ispen())
|
||||
if (reagents.get_reagent_amount("blood") && name != "empty blood pack") //Stops people mucking with bloodpacks that are filled
|
||||
to_chat(usr, "<span class='notice'>You can't relabel [name] until it is empty!</span>")
|
||||
return
|
||||
var/blood_name = input(usr, "What blood type would you like to label it as?", "Blood Types") in list("A+", "A-", "B+", "B-", "O+", "O-", "AB+", "AB-", "Cancel")
|
||||
if (blood_name == "Cancel") return
|
||||
var/obj/item/i = usr.get_active_hand()
|
||||
if (!istype(i, /obj/item/weapon/pen) || !in_range(user, src)) return //Checks to see if pen is still held or bloodback is in range
|
||||
if (!i.ispen() || !in_range(user, src)) return //Checks to see if pen is still held or bloodback is in range
|
||||
name = "blood pack [blood_name]"
|
||||
desc = "Contains blood used for transfusion."
|
||||
to_chat(usr, "<span class='notice'>You label the blood pack as [blood_name].</span>")
|
||||
|
||||
@@ -3955,7 +3955,7 @@
|
||||
to_chat(user, "<span class='warning'>You try to push \the [I] through the lid but it doesn't work!</span>")
|
||||
return
|
||||
|
||||
if( istype(I, /obj/item/weapon/pen/) )
|
||||
if( I.ispen() )
|
||||
|
||||
if( src.open )
|
||||
return
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
if(istype(W,/obj/item/weapon/storage/part_replacer))
|
||||
if(!reagents || !reagents.total_volume)
|
||||
return ..()
|
||||
if(istype(W, /obj/item/weapon/pen) || istype(W, /obj/item/device/flashlight/pen))
|
||||
if(W.ispen() || istype(W, /obj/item/device/flashlight/pen))
|
||||
var/tmp_label = sanitizeSafe(input(user, "Enter a label for [name]", "Label", label_text), MAX_NAME_LEN)
|
||||
if(length(tmp_label) > 15)
|
||||
to_chat(user, "<span class='notice'>The label can be at most 15 characters long.</span>")
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You need to set a destination first!</span>")
|
||||
|
||||
else if(istype(W, /obj/item/weapon/pen))
|
||||
else if(W.ispen())
|
||||
switch(alert("What would you like to alter?",,"Title","Description", "Cancel"))
|
||||
if("Title")
|
||||
var/str = sanitizeSafe(input(usr,"Label text?","Set label",""), MAX_NAME_LEN)
|
||||
@@ -153,7 +153,7 @@
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You need to set a destination first!</span>")
|
||||
|
||||
else if(istype(W, /obj/item/weapon/pen))
|
||||
else if(W.ispen())
|
||||
switch(alert("What would you like to alter?",,"Title","Description", "Cancel"))
|
||||
if("Title")
|
||||
var/str = sanitizeSafe(input(usr,"Label text?","Set label",""), MAX_NAME_LEN)
|
||||
|
||||
@@ -132,7 +132,7 @@ other types of metals and chemistry for reagents).
|
||||
id = "powerdrill"
|
||||
req_tech = list(TECH_MAGNET = 3, TECH_ENGINEERING = 3)
|
||||
materials = list(DEFAULT_WALL_MATERIAL = 60, "glass" = 50)
|
||||
build_path = /obj/item/powerdrill
|
||||
build_path = /obj/item/weapon/powerdrill
|
||||
sort_string = "GAAAD"
|
||||
|
||||
///////////////////////////////////
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
flags = OPENCONTAINER
|
||||
|
||||
obj/item/weapon/reagent_containers/glass/solution_tray/attackby(obj/item/weapon/W as obj, mob/living/user as mob)
|
||||
if(istype(W, /obj/item/weapon/pen))
|
||||
if(W.ispen())
|
||||
var/new_label = sanitizeSafe(input("What should the new label be?","Label solution tray"), MAX_NAME_LEN)
|
||||
if(new_label)
|
||||
name = "solution tray ([new_label])"
|
||||
|
||||
Reference in New Issue
Block a user