mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-29 16:10:02 +01:00
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:
@@ -27,7 +27,7 @@
|
||||
src.update_icon()
|
||||
|
||||
/obj/structure/banner/attackby(obj/item/W, mob/user)
|
||||
if(istype(W, /obj/item/weapon/wrench))
|
||||
if(iswrench(W))
|
||||
switch(anchored)
|
||||
if(0)
|
||||
anchored = 1
|
||||
|
||||
@@ -220,7 +220,7 @@
|
||||
return 0
|
||||
if(istype(W,/obj/item/tk_grab))
|
||||
return 0
|
||||
if(istype(W, /obj/item/weapon/weldingtool))
|
||||
if(iswelder(W))
|
||||
var/obj/item/weapon/weldingtool/WT = W
|
||||
if(!WT.remove_fuel(0,user))
|
||||
if(WT.isOn())
|
||||
@@ -248,7 +248,7 @@
|
||||
W.forceMove(src.loc)
|
||||
else if(istype(W, /obj/item/weapon/packageWrap))
|
||||
return
|
||||
else if(istype(W, /obj/item/weapon/weldingtool))
|
||||
else if(iswelder(W))
|
||||
var/obj/item/weapon/weldingtool/WT = W
|
||||
if(!WT.remove_fuel(0,user))
|
||||
if(!WT.isOn())
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
return ..()
|
||||
else if(istype(W, /obj/item/weapon/packageWrap))
|
||||
return
|
||||
else if(istype(W, /obj/item/stack/cable_coil))
|
||||
else if(iscoil(W))
|
||||
var/obj/item/stack/cable_coil/C = W
|
||||
if(rigged)
|
||||
user << "<span class='notice'>[src] is already rigged!</span>"
|
||||
@@ -103,7 +103,7 @@
|
||||
user.drop_item()
|
||||
W.forceMove(src)
|
||||
return
|
||||
else if(istype(W, /obj/item/weapon/wirecutters))
|
||||
else if(iswirecutter(W))
|
||||
if(rigged)
|
||||
user << "<span class='notice'>You cut away the wiring.</span>"
|
||||
playsound(loc, 'sound/items/Wirecutter.ogg', 100, 1)
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
return
|
||||
|
||||
/obj/structure/largecrate/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
if(istype(W, /obj/item/weapon/crowbar))
|
||||
if(iscrowbar(W))
|
||||
new /obj/item/stack/material/wood(src)
|
||||
var/turf/T = get_turf(src)
|
||||
for(var/atom/movable/AM in contents)
|
||||
@@ -34,7 +34,7 @@
|
||||
icon_state = "mulecrate"
|
||||
|
||||
/obj/structure/largecrate/hoverpod/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
if(istype(W, /obj/item/weapon/crowbar))
|
||||
if(iscrowbar(W))
|
||||
var/obj/item/mecha_parts/mecha_equipment/ME
|
||||
var/obj/mecha/working/hoverpod/H = new (loc)
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@
|
||||
created_name = t
|
||||
return
|
||||
|
||||
if(istype(W, /obj/item/weapon/weldingtool) && ( (istext(glass)) || (glass == 1) || (!anchored) ))
|
||||
if(iswelder(W) && ( (istext(glass)) || (glass == 1) || (!anchored) ))
|
||||
var/obj/item/weapon/weldingtool/WT = W
|
||||
if (WT.remove_fuel(0, user))
|
||||
playsound(src.loc, 'sound/items/Welder2.ogg', 50, 1)
|
||||
@@ -178,7 +178,7 @@
|
||||
user << "<span class='notice'>You need more welding fuel.</span>"
|
||||
return
|
||||
|
||||
else if(istype(W, /obj/item/weapon/wrench) && state == 0)
|
||||
else if(iswrench(W) && state == 0)
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 100, 1)
|
||||
if(anchored)
|
||||
user.visible_message("[user] begins unsecuring the airlock assembly from the floor.", "You starts unsecuring the airlock assembly from the floor.")
|
||||
@@ -190,7 +190,7 @@
|
||||
user << "<span class='notice'>You [anchored? "un" : ""]secured the airlock assembly!</span>"
|
||||
anchored = !anchored
|
||||
|
||||
else if(istype(W, /obj/item/stack/cable_coil) && state == 0 && anchored)
|
||||
else if(iscoil(W) && state == 0 && anchored)
|
||||
var/obj/item/stack/cable_coil/C = W
|
||||
if (C.get_amount() < 1)
|
||||
user << "<span class='warning'>You need one length of coil to wire the airlock assembly.</span>"
|
||||
@@ -201,7 +201,7 @@
|
||||
src.state = 1
|
||||
user << "<span class='notice'>You wire the airlock.</span>"
|
||||
|
||||
else if(istype(W, /obj/item/weapon/wirecutters) && state == 1 )
|
||||
else if(iswirecutter(W) && state == 1 )
|
||||
playsound(src.loc, 'sound/items/Wirecutter.ogg', 100, 1)
|
||||
user.visible_message("[user] cuts the wires from the airlock assembly.", "You start to cut the wires from airlock assembly.")
|
||||
|
||||
@@ -229,7 +229,7 @@
|
||||
else
|
||||
EL.inuse = 0
|
||||
|
||||
else if(istype(W, /obj/item/weapon/crowbar) && state == 2 )
|
||||
else if(iscrowbar(W) && state == 2 )
|
||||
//This should never happen, but just in case I guess
|
||||
if (!electronics)
|
||||
user << "<span class='notice'>There was nothing to remove.</span>"
|
||||
@@ -272,7 +272,7 @@
|
||||
user << "<span class='notice'>You installed [material_display_name(material_name)] plating into the airlock assembly.</span>"
|
||||
glass = material_name
|
||||
|
||||
else if(istype(W, /obj/item/weapon/screwdriver) && state == 2 )
|
||||
else if(isscrewdriver(W) && state == 2 )
|
||||
playsound(src.loc, 'sound/items/Screwdriver.ogg', 100, 1)
|
||||
user << "<span class='notice'>Now finishing the airlock.</span>"
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
return
|
||||
|
||||
/obj/structure/bed/chair/e_chair/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
if(istype(W, /obj/item/weapon/wrench))
|
||||
if(iswrench(W))
|
||||
var/obj/structure/bed/chair/C = new /obj/structure/bed/chair(loc)
|
||||
playsound(loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
C.set_dir(dir)
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
|
||||
/obj/structure/fireaxecabinet/attackby(var/obj/item/O, var/mob/user)
|
||||
|
||||
if(istype(O, /obj/item/device/multitool))
|
||||
if(ismultitool(O))
|
||||
toggle_lock(user)
|
||||
return
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
reinforce_girder()
|
||||
|
||||
/obj/structure/girder/attackby(obj/item/W as obj, mob/user as mob)
|
||||
if(istype(W, /obj/item/weapon/wrench) && state == 0)
|
||||
if(iswrench(W) && state == 0)
|
||||
if(anchored && !reinf_material)
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 100, 1)
|
||||
user << "<span class='notice'>Now disassembling the girder...</span>"
|
||||
@@ -111,7 +111,7 @@
|
||||
user << "<span class='notice'>You drill through the girder!</span>"
|
||||
dismantle()
|
||||
|
||||
else if(istype(W, /obj/item/weapon/screwdriver))
|
||||
else if(isscrewdriver(W))
|
||||
if(state == 2)
|
||||
playsound(src.loc, 'sound/items/Screwdriver.ogg', 100, 1)
|
||||
user << "<span class='notice'>Now unsecuring support struts...</span>"
|
||||
@@ -124,7 +124,7 @@
|
||||
reinforcing = !reinforcing
|
||||
user << "<span class='notice'>\The [src] can now be [reinforcing? "reinforced" : "constructed"]!</span>"
|
||||
|
||||
else if(istype(W, /obj/item/weapon/wirecutters) && state == 1)
|
||||
else if(iswirecutter(W) && state == 1)
|
||||
playsound(src.loc, 'sound/items/Wirecutter.ogg', 100, 1)
|
||||
user << "<span class='notice'>Now removing support struts...</span>"
|
||||
if(do_after(user,40))
|
||||
@@ -134,7 +134,7 @@
|
||||
reinf_material = null
|
||||
reset_girder()
|
||||
|
||||
else if(istype(W, /obj/item/weapon/crowbar) && state == 0 && anchored)
|
||||
else if(iscrowbar(W) && state == 0 && anchored)
|
||||
playsound(src.loc, 'sound/items/Crowbar.ogg', 100, 1)
|
||||
user << "<span class='notice'>Now dislodging the girder...</span>"
|
||||
if(do_after(user, 40))
|
||||
@@ -271,7 +271,7 @@
|
||||
qdel(src)
|
||||
|
||||
/obj/structure/girder/cult/attackby(obj/item/W as obj, mob/user as mob)
|
||||
if(istype(W, /obj/item/weapon/wrench))
|
||||
if(iswrench(W))
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 100, 1)
|
||||
user << "<span class='notice'>Now disassembling the girder...</span>"
|
||||
if(do_after(user,40))
|
||||
|
||||
@@ -143,7 +143,7 @@
|
||||
//This return will prevent afterattack from executing if the object goes into the trashbag,
|
||||
//This prevents dumb stuff like splashing the cart with the contents of a container, after putting said container into trash
|
||||
|
||||
else if (!has_items && (istype(I, /obj/item/weapon/wrench) || istype(I, /obj/item/weapon/weldingtool) || istype(I, /obj/item/weapon/gun/energy/plasmacutter)))
|
||||
else if (!has_items && (iswrench(I) || iswelder(I) || istype(I, /obj/item/weapon/gun/energy/plasmacutter)))
|
||||
dismantle(user)
|
||||
return
|
||||
..()
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
var/turf/T = get_turf(src)
|
||||
T.attackby(C, user) //BubbleWrap - hand this off to the underlying turf instead
|
||||
return
|
||||
if (istype(C, /obj/item/weapon/weldingtool))
|
||||
if (iswelder(C))
|
||||
var/obj/item/weapon/weldingtool/WT = C
|
||||
if(WT.remove_fuel(0, user))
|
||||
user << "<span class='notice'>Slicing lattice joints ...</span>"
|
||||
|
||||
@@ -414,7 +414,7 @@
|
||||
return
|
||||
|
||||
/obj/structure/device/piano/attackby(obj/item/O as obj, mob/user as mob)
|
||||
if (istype(O, /obj/item/weapon/wrench))
|
||||
if (iswrench(O))
|
||||
if (anchored)
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
user << "<span class='notice'>You begin to loosen \the [src]'s casters...</span>"
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
return
|
||||
|
||||
/obj/structure/sign/attackby(obj/item/tool as obj, mob/user as mob) //deconstruction
|
||||
if(istype(tool, /obj/item/weapon/screwdriver) && !istype(src, /obj/structure/sign/double))
|
||||
if(isscrewdriver(tool) && !istype(src, /obj/structure/sign/double))
|
||||
user << "You unfasten the sign with your [tool]."
|
||||
unfasten()
|
||||
else ..()
|
||||
@@ -44,7 +44,7 @@
|
||||
var/sign_state = ""
|
||||
|
||||
/obj/item/sign/attackby(obj/item/tool as obj, mob/user as mob) //construction
|
||||
if(istype(tool, /obj/item/weapon/screwdriver) && isturf(user.loc))
|
||||
if(isscrewdriver(tool) && isturf(user.loc))
|
||||
var/direction = input("In which direction?", "Select direction.") in list("North", "East", "South", "West", "Cancel")
|
||||
if(direction == "Cancel") return
|
||||
var/obj/structure/sign/S = new(user.loc)
|
||||
|
||||
@@ -134,7 +134,7 @@
|
||||
hardness -= W.force/100
|
||||
user << "You hit the [name] with your [W.name]!"
|
||||
CheckHardness()
|
||||
else if(istype(W,/obj/item/weapon/weldingtool))
|
||||
else if(iswelder(W))
|
||||
var/obj/item/weapon/weldingtool/WT = W
|
||||
if(material.ignition_point && WT.remove_fuel(0, user))
|
||||
TemperatureAct(150)
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
return
|
||||
|
||||
/obj/structure/bed/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
if(istype(W, /obj/item/weapon/wrench))
|
||||
if(iswrench(W))
|
||||
if(can_dismantle)
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
dismantle()
|
||||
@@ -121,7 +121,7 @@
|
||||
add_padding(padding_type)
|
||||
return
|
||||
|
||||
else if (istype(W, /obj/item/weapon/wirecutters))
|
||||
else if (iswirecutter(W))
|
||||
if(!padding_material)
|
||||
user << "\The [src] has no padding to remove."
|
||||
return
|
||||
@@ -192,7 +192,7 @@
|
||||
return // Doesn't care about material or anything else.
|
||||
|
||||
/obj/structure/bed/roller/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
if(istype(W, /obj/item/weapon/wrench) || istype(W,/obj/item/stack) || istype(W, /obj/item/weapon/wirecutters))
|
||||
if(iswrench(W) || istype(W,/obj/item/stack) || iswirecutter(W))
|
||||
return
|
||||
else if(istype(W,/obj/item/roller_holder))
|
||||
if(buckled_mob)
|
||||
|
||||
@@ -129,7 +129,7 @@
|
||||
return
|
||||
|
||||
/obj/structure/bed/chair/office/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
if(istype(W,/obj/item/stack) || istype(W, /obj/item/weapon/wirecutters))
|
||||
if(istype(W,/obj/item/stack) || iswirecutter(W))
|
||||
return
|
||||
..()
|
||||
|
||||
@@ -201,7 +201,7 @@
|
||||
return
|
||||
|
||||
/obj/structure/bed/chair/wood/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
if(istype(W,/obj/item/stack) || istype(W, /obj/item/weapon/wirecutters))
|
||||
if(istype(W,/obj/item/stack) || iswirecutter(W))
|
||||
return
|
||||
..()
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@
|
||||
qdel(src)
|
||||
|
||||
/obj/item/weapon/stool/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
if(istype(W, /obj/item/weapon/wrench))
|
||||
if(iswrench(W))
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
dismantle()
|
||||
qdel(src)
|
||||
@@ -142,7 +142,7 @@
|
||||
user << "You add padding to \the [src]."
|
||||
add_padding(padding_type)
|
||||
return
|
||||
else if (istype(W, /obj/item/weapon/wirecutters))
|
||||
else if (iswirecutter(W))
|
||||
if(!padding_material)
|
||||
user << "\The [src] has no padding to remove."
|
||||
return
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
buckled_mob.set_dir(dir)
|
||||
|
||||
/obj/structure/bed/chair/wheelchair/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
if(istype(W, /obj/item/weapon/wrench) || istype(W,/obj/item/stack) || istype(W, /obj/item/weapon/wirecutters))
|
||||
if(iswrench(W) || istype(W,/obj/item/stack) || iswirecutter(W))
|
||||
return
|
||||
..()
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
user << "<span class='notice'>[src] is full.</span>"
|
||||
updateUsrDialog()
|
||||
return
|
||||
if(istype(I, /obj/item/weapon/wrench))
|
||||
if(iswrench(I))
|
||||
if(anchored)
|
||||
user << "<span class='notice'>You lean down and unwrench [src].</span>"
|
||||
anchored = 0
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
icon_state = "toilet[open][cistern]"
|
||||
|
||||
/obj/structure/toilet/attackby(obj/item/I as obj, mob/living/user as mob)
|
||||
if(istype(I, /obj/item/weapon/crowbar))
|
||||
if(iscrowbar(I))
|
||||
user << "<span class='notice'>You start to [cistern ? "replace the lid on the cistern" : "lift the lid off the cistern"].</span>"
|
||||
playsound(loc, 'sound/effects/stonedoor_openclose.ogg', 50, 1)
|
||||
if(do_after(user, 30))
|
||||
@@ -168,7 +168,7 @@
|
||||
/obj/machinery/shower/attackby(obj/item/I as obj, mob/user as mob)
|
||||
if(I.type == /obj/item/device/analyzer)
|
||||
user << "<span class='notice'>The water temperature seems to be [watertemp].</span>"
|
||||
if(istype(I, /obj/item/weapon/wrench))
|
||||
if(iswrench(I))
|
||||
var/newtemp = input(user, "What setting would you like to set the temperature valve to?", "Water Temperature Valve") in temperature_settings
|
||||
user << "<span class='notice'>You begin to adjust the temperature valve with \the [I].</span>"
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
|
||||
@@ -69,7 +69,7 @@ obj/structure/windoor_assembly/Destroy()
|
||||
//I really should have spread this out across more states but thin little windoors are hard to sprite.
|
||||
switch(state)
|
||||
if("01")
|
||||
if(istype(W, /obj/item/weapon/weldingtool) && !anchored )
|
||||
if(iswelder(W) && !anchored )
|
||||
var/obj/item/weapon/weldingtool/WT = W
|
||||
if (WT.remove_fuel(0,user))
|
||||
user.visible_message("[user] dissassembles the windoor assembly.", "You start to dissassemble the windoor assembly.")
|
||||
@@ -87,7 +87,7 @@ obj/structure/windoor_assembly/Destroy()
|
||||
return
|
||||
|
||||
//Wrenching an unsecure assembly anchors it in place. Step 4 complete
|
||||
if(istype(W, /obj/item/weapon/wrench) && !anchored)
|
||||
if(iswrench(W) && !anchored)
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 100, 1)
|
||||
user.visible_message("[user] secures the windoor assembly to the floor.", "You start to secure the windoor assembly to the floor.")
|
||||
|
||||
@@ -101,7 +101,7 @@ obj/structure/windoor_assembly/Destroy()
|
||||
src.name = "Anchored Windoor Assembly"
|
||||
|
||||
//Unwrenching an unsecure assembly un-anchors it. Step 4 undone
|
||||
else if(istype(W, /obj/item/weapon/wrench) && anchored)
|
||||
else if(iswrench(W) && anchored)
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 100, 1)
|
||||
user.visible_message("[user] unsecures the windoor assembly to the floor.", "You start to unsecure the windoor assembly to the floor.")
|
||||
|
||||
@@ -132,7 +132,7 @@ obj/structure/windoor_assembly/Destroy()
|
||||
src.name = "Secure Windoor Assembly"
|
||||
|
||||
//Adding cable to the assembly. Step 5 complete.
|
||||
else if(istype(W, /obj/item/stack/cable_coil) && anchored)
|
||||
else if(iscoil(W) && anchored)
|
||||
user.visible_message("[user] wires the windoor assembly.", "You start to wire the windoor assembly.")
|
||||
|
||||
var/obj/item/stack/cable_coil/CC = W
|
||||
@@ -150,7 +150,7 @@ obj/structure/windoor_assembly/Destroy()
|
||||
if("02")
|
||||
|
||||
//Removing wire from the assembly. Step 5 undone.
|
||||
if(istype(W, /obj/item/weapon/wirecutters) && !src.electronics)
|
||||
if(iswirecutter(W) && !src.electronics)
|
||||
playsound(src.loc, 'sound/items/Wirecutter.ogg', 100, 1)
|
||||
user.visible_message("[user] cuts the wires from the airlock assembly.", "You start to cut the wires from airlock assembly.")
|
||||
|
||||
@@ -184,7 +184,7 @@ obj/structure/windoor_assembly/Destroy()
|
||||
EL.inuse = 0
|
||||
|
||||
//Screwdriver to remove airlock electronics. Step 6 undone.
|
||||
else if(istype(W, /obj/item/weapon/screwdriver) && src.electronics)
|
||||
else if(isscrewdriver(W) && src.electronics)
|
||||
playsound(src.loc, 'sound/items/Screwdriver.ogg', 100, 1)
|
||||
user.visible_message("[user] removes the electronics from the airlock assembly.", "You start to uninstall electronics from the airlock assembly.")
|
||||
|
||||
@@ -200,7 +200,7 @@ obj/structure/windoor_assembly/Destroy()
|
||||
ae.loc = src.loc
|
||||
|
||||
//Crowbar to complete the assembly, Step 7 complete.
|
||||
else if(istype(W, /obj/item/weapon/crowbar))
|
||||
else if(iscrowbar(W))
|
||||
if(!src.electronics)
|
||||
usr << "<span class='warning'>The assembly is missing electronics.</span>"
|
||||
return
|
||||
|
||||
@@ -222,7 +222,7 @@
|
||||
|
||||
if(W.flags & NOBLUDGEON) return
|
||||
|
||||
if(istype(W, /obj/item/weapon/screwdriver))
|
||||
if(isscrewdriver(W))
|
||||
if(reinf && state >= 1)
|
||||
state = 3 - state
|
||||
update_nearby_icons()
|
||||
@@ -238,11 +238,11 @@
|
||||
update_nearby_icons()
|
||||
playsound(loc, 'sound/items/Screwdriver.ogg', 75, 1)
|
||||
user << (anchored ? "<span class='notice'>You have fastened the window to the floor.</span>" : "<span class='notice'>You have unfastened the window.</span>")
|
||||
else if(istype(W, /obj/item/weapon/crowbar) && reinf && state <= 1)
|
||||
else if(iscrowbar(W) && reinf && state <= 1)
|
||||
state = 1 - state
|
||||
playsound(loc, 'sound/items/Crowbar.ogg', 75, 1)
|
||||
user << (state ? "<span class='notice'>You have pried the window into the frame.</span>" : "<span class='notice'>You have pried the window out of the frame.</span>")
|
||||
else if(istype(W, /obj/item/weapon/wrench) && !anchored && (!state || !reinf))
|
||||
else if(iswrench(W) && !anchored && (!state || !reinf))
|
||||
if(!glasstype)
|
||||
user << "<span class='notice'>You're not sure how to dismantle \the [src] properly.</span>"
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user