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
+3 -3
View File
@@ -356,11 +356,11 @@
for(var/obj/item/weapon/disk/nuclear/N in poi_list)
dat += "<tr><td>[N.name], "
var/atom/disk_loc = N.loc
while(!istype(disk_loc, /turf))
if(istype(disk_loc, /mob))
while(!isturf(disk_loc))
if(ismob(disk_loc))
var/mob/M = disk_loc
dat += "carried by <a href='?_src_=holder;adminplayeropts=\ref[M]'>[M.real_name]</a> "
if(istype(disk_loc, /obj))
if(isobj(disk_loc))
var/obj/O = disk_loc
dat += "in \a [O.name] "
disk_loc = disk_loc.loc
+1 -1
View File
@@ -134,7 +134,7 @@
vals += v
vals[v] = SDQL_expression(d, set_list[v])
if(istype(d, /turf))
if(isturf(d))
for(var/v in vals)
if(v == "x" || v == "y" || v == "z")
continue
+3 -3
View File
@@ -242,7 +242,7 @@
. = 1
switch(mode)
if(BASIC_BUILDMODE)
if(istype(object,/turf) && left_click && !alt_click && !ctrl_click)
if(isturf(object) && left_click && !alt_click && !ctrl_click)
var/turf/T = object
if(isspaceturf(object))
T.ChangeTurf(/turf/open/floor/plasteel)
@@ -266,10 +266,10 @@
else if(isobj(object))
qdel(object)
return
else if(istype(object,/turf) && alt_click && left_click)
else if(isturf(object) && alt_click && left_click)
log_admin("Build Mode: [key_name(user)] built an airlock at ([object.x],[object.y],[object.z])")
new/obj/machinery/door/airlock(get_turf(object))
else if(istype(object,/turf) && ctrl_click && left_click)
else if(isturf(object) && ctrl_click && left_click)
switch(build_dir)
if(NORTH)
var/obj/structure/window/reinforced/WIN = new/obj/structure/window/reinforced(get_turf(object))
+1 -1
View File
@@ -220,7 +220,7 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
return
var/turf/T = mob.loc
if (!( istype(T, /turf) ))
if(!isturf(T))
return
var/datum/gas_mixture/env = T.return_air()
+22 -22
View File
@@ -141,7 +141,7 @@
if("restore to default")
O.vars[variable] = initial(O.vars[variable])
if(method)
if(istype(O, /mob))
if(ismob(O))
for(var/mob/M in mob_list)
if ( istype(M , O.type) )
M.vars[variable] = O.vars[variable]
@@ -212,7 +212,7 @@
//Convert the string vars for anything that's not O
if(method)
if(istype(O, /mob))
if(ismob(O))
for(var/mob/M in mob_list)
if ( istype(M , O.type) )
new_value = pre_processing //reset new_value, ready to convert it uniquely for the next iteration
@@ -242,7 +242,7 @@
A.vars[variable] = new_value
CHECK_TICK
else if(istype(O, /turf))
else if(isturf(O))
for(var/turf/A in world)
if ( istype(A , O.type) )
new_value = pre_processing
@@ -257,7 +257,7 @@
A.vars[variable] = new_value
CHECK_TICK
else
if(istype(O, /mob))
if(ismob(O))
for(var/mob/M in mob_list)
if (M.type == O.type)
new_value = pre_processing
@@ -287,7 +287,7 @@
A.vars[variable] = new_value
CHECK_TICK
else if(istype(O, /turf))
else if(isturf(O))
for(var/turf/A in world)
if (A.type == O.type)
new_value = pre_processing
@@ -313,7 +313,7 @@
O.vars[variable] = new_value
if(method)
if(istype(O, /mob))
if(ismob(O))
for(var/mob/M in mob_list)
if ( istype(M , O.type) )
if(variable=="luminosity")
@@ -331,7 +331,7 @@
A.vars[variable] = O.vars[variable]
CHECK_TICK
else if(istype(O, /turf))
else if(isturf(O))
for(var/turf/A in world)
if ( istype(A , O.type) )
if(variable=="luminosity")
@@ -341,7 +341,7 @@
CHECK_TICK
else
if(istype(O, /mob))
if(ismob(O))
for(var/mob/M in mob_list)
if (M.type == O.type)
if(variable=="luminosity")
@@ -359,7 +359,7 @@
A.vars[variable] = O.vars[variable]
CHECK_TICK
else if(istype(O, /turf))
else if(isturf(O))
for(var/turf/A in world)
if (A.type == O.type)
if(variable=="luminosity")
@@ -374,7 +374,7 @@
if(new_value == null) return
O.vars[variable] = new_value
if(method)
if(istype(O, /mob))
if(ismob(O))
for(var/mob/M in mob_list)
if ( istype(M , O.type) )
M.vars[variable] = O.vars[variable]
@@ -386,14 +386,14 @@
A.vars[variable] = O.vars[variable]
CHECK_TICK
else if(istype(O, /turf))
else if(isturf(O))
for(var/turf/A in world)
if ( istype(A , O.type) )
A.vars[variable] = O.vars[variable]
CHECK_TICK
else
if(istype(O, /mob))
if(ismob(O))
for(var/mob/M in mob_list)
if (M.type == O.type)
M.vars[variable] = O.vars[variable]
@@ -405,7 +405,7 @@
A.vars[variable] = O.vars[variable]
CHECK_TICK
else if(istype(O, /turf))
else if(isturf(O))
for(var/turf/A in world)
if (A.type == O.type)
A.vars[variable] = O.vars[variable]
@@ -417,25 +417,25 @@
O.vars[variable] = new_value
if(method)
if(istype(O, /mob))
if(ismob(O))
for(var/mob/M in mob_list)
if ( istype(M , O.type) )
M.vars[variable] = O.vars[variable]
CHECK_TICK
else if(isobj(O.type))
else if(isobj(O))
for(var/obj/A in world)
if ( istype(A , O.type) )
A.vars[variable] = O.vars[variable]
CHECK_TICK
else if(istype(O.type, /turf))
else if(isturf(O))
for(var/turf/A in world)
if ( istype(A , O.type) )
A.vars[variable] = O.vars[variable]
CHECK_TICK
else
if(istype(O, /mob))
if(ismob(O))
for(var/mob/M in mob_list)
if (M.type == O.type)
M.vars[variable] = O.vars[variable]
@@ -447,7 +447,7 @@
A.vars[variable] = O.vars[variable]
CHECK_TICK
else if(istype(O, /turf))
else if(isturf(O))
for(var/turf/A in world)
if (A.type == O.type)
A.vars[variable] = O.vars[variable]
@@ -458,7 +458,7 @@
if(new_value == null) return
O.vars[variable] = new_value
if(method)
if(istype(O, /mob))
if(ismob(O))
for(var/mob/M in mob_list)
if ( istype(M , O.type) )
M.vars[variable] = O.vars[variable]
@@ -470,14 +470,14 @@
A.vars[variable] = O.vars[variable]
CHECK_TICK
else if(istype(O, /turf))
else if(isturf(O))
for(var/turf/A in world)
if ( istype(A , O.type) )
A.vars[variable] = O.vars[variable]
CHECK_TICK
else
if(istype(O, /mob))
if(ismob(O))
for(var/mob/M in mob_list)
if (M.type == O.type)
M.vars[variable] = O.vars[variable]
@@ -489,7 +489,7 @@
A.vars[variable] = O.vars[variable]
CHECK_TICK
else if(istype(O, /turf))
else if(isturf(O))
for(var/turf/A in world)
if (A.type == O.type)
A.vars[variable] = O.vars[variable]
@@ -150,7 +150,7 @@
SetLuminosity(0)
SSair.hotspots -= src
DestroyTurf()
if(istype(loc, /turf))
if(isturf(loc))
var/turf/open/T = loc
if(T.active_hotspot == src)
T.active_hotspot = null
@@ -159,8 +159,7 @@
return QDEL_HINT_PUTINPOOL
/obj/effect/hotspot/proc/DestroyTurf()
if(istype(loc, /turf))
if(isturf(loc))
var/turf/T = loc
if(T.to_be_destroyed)
var/chance_of_deletion
@@ -92,7 +92,7 @@
return adjacent_turfs
/atom/proc/air_update_turf(command = 0)
if(!istype(loc,/turf) && command)
if(!isturf(loc) && command)
return
var/turf/T = get_turf(loc)
T.air_update_turf(command)
@@ -103,7 +103,7 @@
SSair.add_to_active(src,command)
/atom/movable/proc/move_update_air(turf/T)
if(istype(T,/turf))
if(isturf(T))
T.air_update_turf(1)
air_update_turf(1)
@@ -20,7 +20,7 @@
/obj/machinery/zvent/process_atmos()
//all this object does, is make its turf share air with the ones above and below it, if they have a vent too.
if (istype(loc,/turf)) //if we're not on a valid turf, forget it
if(isturf(loc)) //if we're not on a valid turf, forget it
for (var/new_z in list(-1,1)) //change this list if a fancier system of z-levels gets implemented
var/turf/open/zturf_conn = locate(x,y,z+new_z)
if (istype(zturf_conn))
@@ -38,7 +38,7 @@
..()
/obj/machinery/atmospherics/pipe/hide(i)
if(level == 1 && istype(loc, /turf))
if(level == 1 && isturf(loc))
invisibility = i ? INVISIBILITY_MAXIMUM : 0
update_icon()
@@ -102,4 +102,4 @@
/obj/machinery/atmospherics/pipe/run_obj_armor(damage_amount, damage_type, damage_flag = 0, attack_dir)
if(damage_flag == "melee" && damage_amount < 12)
return 0
. = ..()
. = ..()
+1 -1
View File
@@ -63,7 +63,7 @@
if(M.is_holding(src) || M.head == src)
location = M.loc
if (istype(location, /turf))
if(isturf(location))
location.hotspot_expose(700, 1)
/obj/item/clothing/head/hardhat/cakehat/turn_on()
+1 -1
View File
@@ -62,7 +62,7 @@
. = list()
for(var/obj/item/I in user.held_items)
. += I
if(!istype(user.loc, /turf))
if(!isturf(user.loc))
return
var/list/L = block(get_step(user, SOUTHWEST), get_step(user, NORTHEAST))
for(var/A in L)
+1 -1
View File
@@ -531,7 +531,7 @@
/obj/item/weapon/twohanded/required/mining_hammer/afterattack(atom/target, mob/user, proximity_flag)
if(!proximity_flag && charged)//Mark a target, or mine a tile.
var/turf/proj_turf = get_turf(src)
if(!istype(proj_turf, /turf))
if(!isturf(proj_turf))
return
var/datum/gas_mixture/environment = proj_turf.return_air()
var/pressure = environment.return_pressure()
+2 -2
View File
@@ -394,7 +394,7 @@
if (istype(P, /obj/item/weapon/pickaxe))
var/turf/T = user.loc
if (!( istype(T, /turf) ))
if (!isturf(T))
return
if(last_act+P.digspeed > world.time)//prevents message spam
@@ -553,7 +553,7 @@
digging_speed = P.digspeed
if (digging_speed)
var/turf/T = user.loc
if (!( istype(T, /turf) ))
if(!isturf(T))
return
if (dug)
@@ -18,7 +18,7 @@ In all, this is a lot like the monkey code. /N
M << "You cannot attack people before the game has started."
return
if (istype(loc, /turf) && istype(loc.loc, /area/start))
if(isturf(loc) && istype(loc.loc, /area/start))
M << "No attacking people at spawn, you jackass."
return
@@ -125,4 +125,4 @@ In all, this is a lot like the monkey code. /N
return 0
/mob/living/carbon/alien/acid_act(acidpwr, acid_volume)
return 0//aliens are immune to acid.
return 0//aliens are immune to acid.
+2 -2
View File
@@ -208,7 +208,7 @@
M << "You cannot attack people before the game has started."
return 0
if (istype(loc, /turf) && istype(loc.loc, /area/start))
if(isturf(loc) && istype(loc.loc, /area/start))
M << "No attacking people at spawn, you jackass."
return 0
@@ -252,7 +252,7 @@
M << "You cannot attack people before the game has started."
return 0
if (istype(loc, /turf) && istype(loc.loc, /area/start))
if(isturf(loc) && istype(loc.loc, /area/start))
M << "No attacking people at spawn, you jackass."
return 0
+1 -1
View File
@@ -110,7 +110,7 @@ var/list/ai_list = list()
radio = new /obj/item/device/radio/headset/ai(src)
aicamera = new/obj/item/device/camera/siliconcam/ai_camera(src)
if (istype(loc, /turf))
if(isturf(loc))
verbs.Add(/mob/living/silicon/ai/proc/ai_network_change, \
/mob/living/silicon/ai/proc/ai_statuschange, /mob/living/silicon/ai/proc/ai_hologram_change, \
/mob/living/silicon/ai/proc/toggle_camera_light, /mob/living/silicon/ai/proc/botcall,\
@@ -499,7 +499,7 @@
var/mob/living/M = card.loc
if(!isliving(M))
while(!isliving(M))
if(istype(M, /turf))
if(isturf(M))
src.temp = "Error: No biological host found. <br>"
src.subscreen = 0
return dat
@@ -418,19 +418,15 @@ Auto Patrol[]"},
return
lastfired = world.time
var/turf/T = loc
var/atom/U = (istype(target, /atom/movable) ? target.loc : target)
if((!( U ) || !( T )))
var/turf/U = get_turf(target)
if(!U)
return
while(!(istype(U, /turf)))
U = U.loc
if(!(istype(T, /turf)))
if(!isturf(T))
return
if(!projectile)
return
if(!(istype(U, /turf)))
return
var/obj/item/projectile/A = new projectile (loc)
playsound(loc, shoot_sound, 50, 1)
A.current = U
@@ -225,7 +225,7 @@
if(target)
if(path.len == 0)
if(!istype(target, /turf/))
if(!isturf(target))
var/turf/TL = get_turf(target)
path = get_path_to(src, TL, /turf/proc/Distance_cardinal, 0, 30, id=access_card,simulated_only = 0)
else
@@ -248,7 +248,7 @@
target = null
path = list()
return
if(istype(target, /turf/) && emagged < 2)
if(isturf(target) && emagged < 2)
repair(target)
else if(emagged == 2 && isfloorturf(target))
var/turf/open/floor/F = target
@@ -474,7 +474,7 @@ var/global/mulebot_count = 0
if(next == loc)
path -= next
return
if(istype( next, /turf))
if(isturf(next))
//world << "at ([x],[y]) moving to ([next.x],[next.y])"
if(bloodiness)
@@ -214,7 +214,7 @@
walk(src,0)
if(do_after(src, 50, target = src))
if(busy == SPINNING_COCOON)
if(cocoon_target && istype(cocoon_target.loc, /turf) && get_dist(src,cocoon_target) <= 1)
if(cocoon_target && isturf(cocoon_target.loc) && get_dist(src,cocoon_target) <= 1)
var/obj/structure/spider/cocoon/C = new(cocoon_target.loc)
var/large_cocoon = 0
C.pixel_x = cocoon_target.pixel_x
@@ -459,7 +459,7 @@
/mob/living/simple_animal/hostile/asteroid/goliath/OpenFire()
var/tturf = get_turf(target)
if(!(istype(tturf, /turf)))
if(!isturf(tturf))
return
if(get_dist(src, target) <= 7)//Screen range check, so you can't get tentacle'd offscreen
visible_message("<span class='warning'>The [src.name] digs its tentacles under [target.name]!</span>")
+1 -1
View File
@@ -116,7 +116,7 @@ By design, d1 is the smallest direction and d2 is the highest
//If underfloor, hide the cable
/obj/structure/cable/hide(i)
if(level == 1 && istype(loc, /turf))
if(level == 1 && isturf(loc))
invisibility = i ? INVISIBILITY_MAXIMUM : 0
updateicon()
+1 -1
View File
@@ -48,7 +48,7 @@
/obj/machinery/power/terminal/proc/dismantle(mob/living/user)
if(istype(loc, /turf))
if(isturf(loc))
var/turf/T = loc
if(T.intact)
user << "<span class='warning'>You must first expose the power terminal!</span>"
@@ -147,7 +147,7 @@
KA.modify_projectile(BB)
var/turf/proj_turf = get_turf(BB)
if(!istype(proj_turf, /turf))
if(!isturf(proj_turf))
return
var/datum/gas_mixture/environment = proj_turf.return_air()
var/pressure = environment.return_pressure()
+1 -1
View File
@@ -66,7 +66,7 @@
/obj/item/projectile/beam/pulse/on_hit(atom/target, blocked = 0)
. = ..()
if(istype(target,/turf/)||istype(target,/obj/structure/))
if(isturf(target) || istype(target,/obj/structure/))
target.ex_act(2)
/obj/item/projectile/beam/pulse/shot
@@ -171,7 +171,7 @@
/obj/item/projectile/plasma/New()
var/turf/proj_turf = get_turf(src)
if(!istype(proj_turf, /turf))
if(!isturf(proj_turf))
return
var/datum/gas_mixture/environment = proj_turf.return_air()
if(environment)
+1 -1
View File
@@ -6,7 +6,7 @@
proc/chem_splash(turf/epicenter, affected_range = 3, list/datum/reagents/reactants = list(), extra_heat = 0, threatscale = 1, adminlog = 1)
if(!istype(epicenter, /turf) || !reactants.len || threatscale <= 0)
if(!isturf(epicenter) || !reactants.len || threatscale <= 0)
return
var/has_reagents
var/total_reagents
+1 -1
View File
@@ -121,7 +121,7 @@
/obj/machinery/disposal/proc/stuff_mob_in(mob/living/target, mob/living/user)
if(!iscarbon(user) && !user.ventcrawler) //only carbon and ventcrawlers can climb into disposal by themselves.
return
if(!istype(user.loc, /turf/)) //No magically doing it from inside closets
if(!isturf(user.loc)) //No magically doing it from inside closets
return
if(target.buckled || target.has_buckled_mobs())
return
+2 -2
View File
@@ -251,7 +251,7 @@ var/list/spells = typesof(/obj/effect/proc_holder/spell) //needed for the badmin
var/location
if(isliving(target))
location = target.loc
else if(istype(target,/turf))
else if(isturf(target))
location = target
var/obj/effect/overlay/spell = new /obj/effect/overlay(location)
spell.icon = overlay_icon
@@ -265,7 +265,7 @@ var/list/spells = typesof(/obj/effect/proc_holder/spell) //needed for the badmin
var/location
if(isliving(target))
location = target.loc
else if(istype(target,/turf))
else if(isturf(target))
location = target
if(isliving(target) && message)
target << text("[message]")