Replaces yet more istypes with helpers (#20806)

* uses more istype helpers

* oranges is inefficient
This commit is contained in:
Joan Lung
2016-10-10 17:48:35 +13:00
committed by oranges
parent add37bea48
commit ce13143d9d
58 changed files with 104 additions and 109 deletions
@@ -144,7 +144,7 @@
return ..()
/datum/effect_system/foam_spread/set_up(amt=5, loca, datum/reagents/carry = null)
if(istype(loca, /turf/))
if(isturf(loca))
location = loca
else
location = get_turf(loca)
@@ -266,7 +266,7 @@
return ..()
/datum/effect_system/smoke_spread/chem/set_up(datum/reagents/carry = null, radius = 1, loca, silent = 0)
if(istype(loca, /turf/))
if(isturf(loca))
location = loca
else
location = get_turf(loca)
@@ -15,20 +15,20 @@
..()
flick("sparks", src) // replay the animation
playsound(src.loc, "sparks", 100, 1)
var/turf/T = src.loc
if (istype(T, /turf))
var/turf/T = loc
if(isturf(T))
T.hotspot_expose(1000,100)
QDEL_IN(src, 20)
/obj/effect/particle_effect/sparks/Destroy()
var/turf/T = src.loc
if (istype(T, /turf))
var/turf/T = loc
if(isturf(T))
T.hotspot_expose(1000,100)
return ..()
/obj/effect/particle_effect/sparks/Move()
..()
var/turf/T = src.loc
var/turf/T = loc
if(isturf(T))
T.hotspot_expose(1000,100)
+1 -1
View File
@@ -103,7 +103,7 @@
/obj/structure/spider/spiderling/process()
if(travelling_in_vent)
if(istype(src.loc, /turf))
if(isturf(loc))
travelling_in_vent = 0
entry_vent = null
else if(entry_vent)
+1 -1
View File
@@ -1,7 +1,7 @@
/proc/empulse(turf/epicenter, heavy_range, light_range, log=0)
if(!epicenter) return
if(!istype(epicenter, /turf))
if(!isturf(epicenter))
epicenter = get_turf(epicenter.loc)
if(log)
+3 -3
View File
@@ -99,7 +99,7 @@ var/global/image/fire_overlay = image("icon" = 'icons/effects/fire.dmi', "icon_s
/obj/item/proc/check_allowed_items(atom/target, not_inside, target_self)
if(((src in target) && !target_self) || (!istype(target.loc, /turf) && !istype(target, /turf) && not_inside))
if(((src in target) && !target_self) || (!isturf(target.loc) && !isturf(target) && not_inside))
return 0
else
return 1
@@ -139,7 +139,7 @@ var/global/image/fire_overlay = image("icon" = 'icons/effects/fire.dmi', "icon_s
set category = "Object"
set src in oview(1)
if(!istype(src.loc, /turf) || usr.stat || usr.restrained() || !usr.canmove)
if(!isturf(loc) || usr.stat || usr.restrained() || !usr.canmove)
return
var/turf/T = src.loc
@@ -596,4 +596,4 @@ obj/item/proc/item_action_slot_check(slot, mob/user)
MO.pixel_x = rand(-16,16)
MO.pixel_y = rand(-16,16)
MO.desc = "Looks like this was \an [src] some time ago."
..()
..()
+1 -1
View File
@@ -762,7 +762,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
user << "<span class='notice'>Card scanned.</span>"
else
//Basic safety check. If either both objects are held by user or PDA is on ground and card is in hand.
if(((src in user.contents) && (C in user.contents)) || (istype(loc, /turf) && in_range(src, user) && (C in user.contents)) )
if(((src in user.contents) || (isturf(loc) && in_range(src, user))) && (C in user.contents))
if(!id_check(user, 2))
return
user << "<span class='notice'>You put the ID into \the [src]'s slot.</span>"
+1 -1
View File
@@ -154,7 +154,7 @@
else if(istype(W, /obj/item/device/mmi))
var/obj/item/device/mmi/M = W
if(check_completion())
if(!istype(loc,/turf))
if(!isturf(loc))
user << "<span class='warning'>You can't put the MMI in, the frame has to be standing on the ground to be perfectly precise!</span>"
return
if(!M.brainmob)
@@ -62,7 +62,7 @@
/obj/item/stack/sheet/glass/proc/construct_window(mob/user)
if(!user || !src)
return 0
if(!istype(user.loc,/turf))
if(!isturf(user.loc))
return 0
if(!user.IsAdvancedToolUser())
user << "<span class='warning'>You don't have the dexterity to do this!</span>"
@@ -168,7 +168,7 @@
/obj/item/stack/sheet/rglass/proc/construct_window(mob/user)
if(!user || !src)
return 0
if(!istype(user.loc,/turf))
if(!isturf(user.loc))
return 0
if(!user.IsAdvancedToolUser())
user << "<span class='warning'>You don't have the dexterity to do this!</span>"
+1 -1
View File
@@ -304,7 +304,7 @@ RCD
if(!proximity) return 0
if(istype(A,/area/shuttle)||istype(A,/turf/open/space/transit))
return 0
if(!(istype(A, /turf) || istype(A, /obj/machinery/door/airlock) || istype(A, /obj/structure/grille) || istype(A, /obj/structure/window)))
if(!(isturf(A) || istype(A, /obj/machinery/door/airlock) || istype(A, /obj/structure/grille) || istype(A, /obj/structure/window)))
return 0
switch(mode)
+2 -2
View File
@@ -564,7 +564,7 @@ var/global/list/RPD_recipes=list(
user << "<span class='warning'>The [src]'s error light flickers! Perhaps you need to only use it on pipes and pipe meters?</span>"
return 0
if(ATMOS_MODE)
if(!(istype(A, /turf)))
if(!isturf(A))
user << "<span class='warning'>The [src]'s error light flickers!</span>"
return 0
user << "<span class='notice'>You start building pipes...</span>"
@@ -579,7 +579,7 @@ var/global/list/RPD_recipes=list(
return 0
if(METER_MODE)
if(!(istype(A, /turf)))
if(!isturf(A))
user << "<span class='warning'>The [src]'s error light flickers!</span>"
return 0
user << "<span class='notice'>You start building meter...</span>"
@@ -62,7 +62,7 @@
..()
if(usr.stat)
return
if((usr.contents.Find(src)) || ((in_range(src, usr) && istype(loc, /turf))))
if(usr.contents.Find(src) || (in_range(src, usr) && isturf(loc)))
usr.set_machine(src)
if(istype(loc, /mob))
+2 -2
View File
@@ -37,7 +37,7 @@
if (!ishuman(usr))
return 1
var/mob/living/carbon/human/H = usr
if ((H == src.loc || (in_range(src, H) && istype(src.loc, /turf))))
if(H == src.loc || (in_range(src, H) && isturf(loc)))
H.set_machine(src)
if (href_list["spell_teleport"])
if (src.uses >= 1)
@@ -57,7 +57,7 @@
if (!user || user.stat || user.restrained() || uses <= 0)
return
if(!((user == loc || (in_range(src, user) && istype(src.loc, /turf)))))
if(!(user == loc || (in_range(src, user) && isturf(loc))))
return
var/datum/effect_system/smoke_spread/smoke = new
@@ -295,7 +295,7 @@
nanofrost_cooldown = 0
return
if(nozzle_mode == METAL_FOAM)
if(!Adj|| !istype(target, /turf))
if(!Adj|| !isturf(target))
return
if(metal_synthesis_cooldown < 5)
var/obj/effect/particle_effect/foam/metal/F = PoolOrNew(/obj/effect/particle_effect/foam/metal, get_turf(target))
@@ -51,7 +51,7 @@ Frequency:
if(!current_location||current_location.z==2)//If turf was not found or they're on z level 2.
usr << "The [src] is malfunctioning."
return
if ((usr.contents.Find(src) || (in_range(src, usr) && istype(src.loc, /turf))))
if(usr.contents.Find(src) || (in_range(src, usr) && isturf(loc)))
usr.set_machine(src)
if (href_list["refresh"])
src.temp = "<B>Persistent Signal Locator</B><HR>"
@@ -141,7 +141,7 @@ Frequency:
/obj/item/weapon/hand_tele/attack_self(mob/user)
var/turf/current_location = get_turf(user)//What turf is the user on?
var/area/current_area = current_location.loc
if(!current_location||current_area.noteleport||current_location.z>=7 || !istype(user.loc, /turf))//If turf was not found or they're on z level 2 or >7 which does not currently exist. or if user is not located on a turf
if(!current_location || current_area.noteleport || current_location.z > ZLEVEL_SPACEMAX || !isturf(user.loc))//If turf was not found or they're on z level 2 or >7 which does not currently exist. or if user is not located on a turf
user << "<span class='notice'>\The [src] is malfunctioning.</span>"
return
var/list/L = list( )
+1 -1
View File
@@ -1,7 +1,7 @@
/proc/radiation_pulse(turf/epicenter, heavy_range, light_range, severity, log=0)
if(!epicenter || !severity) return
if(!istype(epicenter, /turf))
if(!isturf(epicenter))
epicenter = get_turf(epicenter.loc)
if(heavy_range > light_range)
+1 -1
View File
@@ -82,7 +82,7 @@
if(!shock(user, 100))
playsound(loc, 'sound/items/Wirecutter.ogg', 100, 1)
deconstruct()
else if((istype(W, /obj/item/weapon/screwdriver)) && (istype(loc, /turf) || anchored))
else if((istype(W, /obj/item/weapon/screwdriver)) && (isturf(loc) || anchored))
if(!shock(user, 90))
playsound(loc, 'sound/items/Screwdriver.ogg', 100, 1)
anchored = !anchored