From 28656d334783cf9dc72ae278f10b8d6b3890bce2 Mon Sep 17 00:00:00 2001 From: Leo Date: Tue, 17 Oct 2017 22:20:42 -0200 Subject: [PATCH 1/2] Merge pull request #31809 from ShizCalev/helper-cleanup Cleans up some istypes not using helpers --- code/__DEFINES/is_helpers.dm | 2 ++ code/controllers/subsystem/persistence.dm | 4 ++-- code/datums/helper_datums/teleport.dm | 2 +- code/datums/riding.dm | 2 +- .../miniantags/revenant/revenant_abilities.dm | 2 +- code/game/mecha/equipment/tools/work_tools.dm | 2 +- code/game/objects/effects/decals/decal.dm | 2 +- code/game/objects/items/storage/backpack.dm | 2 +- .../machinery/pipes/heat_exchange/he_pipes.dm | 2 +- code/modules/mob/living/simple_animal/bot/floorbot.dm | 10 +++++----- .../hostile/megafauna/blood_drunk_miner.dm | 4 ++-- .../living/simple_animal/hostile/megafauna/swarmer.dm | 4 ++-- code/modules/projectiles/guns/beam_rifle.dm | 2 +- code/modules/projectiles/projectile.dm | 2 +- code/modules/projectiles/projectile/magic.dm | 2 +- .../reagents/chemistry/reagents/other_reagents.dm | 2 +- .../chemistry/reagents/pyrotechnic_reagents.dm | 2 +- code/modules/ruins/objects_and_mobs/necropolis_gate.dm | 2 +- 18 files changed, 26 insertions(+), 24 deletions(-) diff --git a/code/__DEFINES/is_helpers.dm b/code/__DEFINES/is_helpers.dm index 5f1ae13336..fbd15e1ef6 100644 --- a/code/__DEFINES/is_helpers.dm +++ b/code/__DEFINES/is_helpers.dm @@ -31,6 +31,8 @@ #define islava(A) (istype(A, /turf/open/lava)) +#define ischasm(A) (istype(A, /turf/open/chasm)) + #define isplatingturf(A) (istype(A, /turf/open/floor/plating)) //Mobs diff --git a/code/controllers/subsystem/persistence.dm b/code/controllers/subsystem/persistence.dm index 22d0315487..6230bd2b3d 100644 --- a/code/controllers/subsystem/persistence.dm +++ b/code/controllers/subsystem/persistence.dm @@ -59,14 +59,14 @@ SUBSYSTEM_DEF(persistence) path = text2path(old_secret_satchels[pos]["saved_obj"]) if(F) - if(isfloorturf(F.loc) && !istype(F.loc, /turf/open/floor/plating/)) + if(isfloorturf(F.loc) && !isplatingturf(F.loc)) F.hide(1) if(ispath(path)) new path(F) placed_satchel++ var/free_satchels = 0 for(var/turf/T in shuffle(block(locate(TRANSITIONEDGE,TRANSITIONEDGE,ZLEVEL_STATION_PRIMARY), locate(world.maxx-TRANSITIONEDGE,world.maxy-TRANSITIONEDGE,ZLEVEL_STATION_PRIMARY)))) //Nontrivially expensive but it's roundstart only - if(isfloorturf(T) && !istype(T, /turf/open/floor/plating/)) + if(isfloorturf(T) && !isplatingturf(T)) new /obj/item/storage/backpack/satchel/flat/secret(T) free_satchels++ if((free_satchels + placed_satchel) == 10) //ten tiles, more than enough to kill anything that moves diff --git a/code/datums/helper_datums/teleport.dm b/code/datums/helper_datums/teleport.dm index b5436f0313..300417b6d0 100644 --- a/code/datums/helper_datums/teleport.dm +++ b/code/datums/helper_datums/teleport.dm @@ -206,7 +206,7 @@ continue if(extended_safety_checks) - if(istype(F, /turf/open/lava)) //chasms aren't /floor, and so are pre-filtered + if(islava(F)) //chasms aren't /floor, and so are pre-filtered var/turf/open/lava/L = F if(!L.is_safe()) continue diff --git a/code/datums/riding.dm b/code/datums/riding.dm index 6734221773..7cd12ae6c8 100644 --- a/code/datums/riding.dm +++ b/code/datums/riding.dm @@ -261,7 +261,7 @@ var/turf/next = get_step(ridden, direction) var/turf/current = get_turf(ridden) - if(istype(next, /turf/open/lava) || istype(current, /turf/open/lava)) //We can move from land to lava, or lava to land, but not from land to land + if(islava(next) || islava(current)) //We can move from land to lava, or lava to land, but not from land to land ..() else to_chat(user, "Boats don't go on land!") diff --git a/code/game/gamemodes/miniantags/revenant/revenant_abilities.dm b/code/game/gamemodes/miniantags/revenant/revenant_abilities.dm index 7bf3535032..c7a09bb387 100644 --- a/code/game/gamemodes/miniantags/revenant/revenant_abilities.dm +++ b/code/game/gamemodes/miniantags/revenant/revenant_abilities.dm @@ -241,7 +241,7 @@ if(T.flags_1 & NOJAUNT_1) T.flags_1 &= ~NOJAUNT_1 new /obj/effect/temp_visual/revenant(T) - if(!istype(T, /turf/open/floor/plating) && !istype(T, /turf/open/floor/engine/cult) && isfloorturf(T) && prob(15)) + if(!isplatingturf(T) && !istype(T, /turf/open/floor/engine/cult) && isfloorturf(T) && prob(15)) var/turf/open/floor/floor = T if(floor.intact && floor.floor_tile) new floor.floor_tile(floor) diff --git a/code/game/mecha/equipment/tools/work_tools.dm b/code/game/mecha/equipment/tools/work_tools.dm index 1fcc54ac2a..8abab12baf 100644 --- a/code/game/mecha/equipment/tools/work_tools.dm +++ b/code/game/mecha/equipment/tools/work_tools.dm @@ -391,7 +391,7 @@ /obj/item/mecha_parts/mecha_equipment/cable_layer/proc/dismantleFloor(var/turf/new_turf) if(isfloorturf(new_turf)) var/turf/open/floor/T = new_turf - if(!istype(T, /turf/open/floor/plating)) + if(!isplatingturf(T)) if(!T.broken && !T.burnt) new T.floor_tile(T) T.make_plating() diff --git a/code/game/objects/effects/decals/decal.dm b/code/game/objects/effects/decals/decal.dm index 06333277cd..520e4e10b7 100644 --- a/code/game/objects/effects/decals/decal.dm +++ b/code/game/objects/effects/decals/decal.dm @@ -12,7 +12,7 @@ /obj/effect/decal/HandleTurfChange(turf/T) ..() - if(T == loc && (isspaceturf(T) || isclosedturf(T) || islava(T) || istype(T, /turf/open/water) || istype(T, /turf/open/chasm))) + if(T == loc && (isspaceturf(T) || isclosedturf(T) || islava(T) || istype(T, /turf/open/water) || ischasm(T))) qdel(src) /obj/effect/turf_decal diff --git a/code/game/objects/items/storage/backpack.dm b/code/game/objects/items/storage/backpack.dm index 2428524383..a821fd1a08 100644 --- a/code/game/objects/items/storage/backpack.dm +++ b/code/game/objects/items/storage/backpack.dm @@ -309,7 +309,7 @@ /obj/item/storage/backpack/satchel/flat/secret/Initialize() . = ..() - if(isfloorturf(loc) && !istype(loc, /turf/open/floor/plating/)) + if(isfloorturf(loc) && !isplatingturf(loc)) hide(1) /obj/item/storage/backpack/satchel/flat/secret/hide(intact) diff --git a/code/modules/atmospherics/machinery/pipes/heat_exchange/he_pipes.dm b/code/modules/atmospherics/machinery/pipes/heat_exchange/he_pipes.dm index 46146a16f6..c50ccc942b 100644 --- a/code/modules/atmospherics/machinery/pipes/heat_exchange/he_pipes.dm +++ b/code/modules/atmospherics/machinery/pipes/heat_exchange/he_pipes.dm @@ -31,7 +31,7 @@ var/turf/T = loc if(istype(T)) - if(istype(T, /turf/open/lava)) + if(islava(T)) environment_temperature = 5000 else if(T.blocks_air) environment_temperature = T.temperature diff --git a/code/modules/mob/living/simple_animal/bot/floorbot.dm b/code/modules/mob/living/simple_animal/bot/floorbot.dm index 9f86737717..1c3adb1dfe 100644 --- a/code/modules/mob/living/simple_animal/bot/floorbot.dm +++ b/code/modules/mob/living/simple_animal/bot/floorbot.dm @@ -287,11 +287,11 @@ anchored = TRUE if(PLACE_TILE) F = scan_target - if(istype(F, /turf/open/floor/plating)) //The floor must not already have a tile. + if(isplatingturf(F)) //The floor must not already have a tile. result = F if(REPLACE_TILE) F = scan_target - if(isfloorturf(F) && !istype(F, /turf/open/floor/plating)) //The floor must already have a tile. + if(isfloorturf(F) && !isplatingturf(F)) //The floor must already have a tile. result = F if(FIX_TILE) //Selects only damaged floors. F = scan_target @@ -299,7 +299,7 @@ result = F if(TILE_EMAG) //Emag mode! Rip up the floor and cause breaches to space! F = scan_target - if(!istype(F, /turf/open/floor/plating)) + if(!isplatingturf(F)) result = F else //If no special processing is needed, simply return the result. result = scan_target @@ -329,7 +329,7 @@ else var/turf/open/floor/F = target_turf - if(F.type != initial(tiletype.turf_type) && (F.broken || F.burnt || istype(F, /turf/open/floor/plating)) || F.type == (initial(tiletype.turf_type) && (F.broken || F.burnt))) + if(F.type != initial(tiletype.turf_type) && (F.broken || F.burnt || isplatingturf(F)) || F.type == (initial(tiletype.turf_type) && (F.broken || F.burnt))) anchored = TRUE icon_state = "floorbot-c" mode = BOT_REPAIRING @@ -340,7 +340,7 @@ F.burnt = 0 F.ChangeTurf(/turf/open/floor/plasteel) - if(replacetiles && F.type != initial(tiletype.turf_type) && specialtiles && !istype(F, /turf/open/floor/plating)) + if(replacetiles && F.type != initial(tiletype.turf_type) && specialtiles && !isplatingturf(F)) anchored = TRUE icon_state = "floorbot-c" mode = BOT_REPAIRING diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/blood_drunk_miner.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/blood_drunk_miner.dm index 1980e57dbe..14b313d815 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/blood_drunk_miner.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/blood_drunk_miner.dm @@ -93,7 +93,7 @@ Difficulty: Medium return ..() /mob/living/simple_animal/hostile/megafauna/blood_drunk_miner/Move(atom/newloc) - if(dashing || (newloc && newloc.z == z && (istype(newloc, /turf/open/lava) || istype(newloc, /turf/open/chasm)))) //we're not stupid! + if(dashing || (newloc && newloc.z == z && (islava(newloc) || ischasm(newloc)))) //we're not stupid! return FALSE return ..() @@ -186,7 +186,7 @@ Difficulty: Medium var/turf_dist_to_target = 0 if(!QDELETED(dash_target)) turf_dist_to_target += get_dist(dash_target, O) - if(get_dist(src, O) >= MINER_DASH_RANGE && turf_dist_to_target <= self_dist_to_target && !istype(O, /turf/open/lava) && !istype(O, /turf/open/chasm)) + if(get_dist(src, O) >= MINER_DASH_RANGE && turf_dist_to_target <= self_dist_to_target && !islava(O) && !ischasm(O)) var/valid = TRUE for(var/turf/T in getline(own_turf, O)) if(is_blocked_turf(T, TRUE)) diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/swarmer.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/swarmer.dm index 0630c9cc2c..363b5a460d 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/swarmer.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/swarmer.dm @@ -137,14 +137,14 @@ GLOBAL_LIST_INIT(AISwarmerCapsByType, list(/mob/living/simple_animal/hostile/swa /mob/living/simple_animal/hostile/swarmer/ai/Move(atom/newloc) if(newloc) if(newloc.z == z) //so these actions are Z-specific - if(istype(newloc, /turf/open/lava)) + if(islava(newloc)) var/turf/open/lava/L = newloc if(!L.is_safe()) StartAction(20) new /obj/structure/lattice/catwalk/swarmer_catwalk(newloc) return FALSE - if(istype(newloc, /turf/open/chasm) && !throwing) + if(ischasm(newloc) && !throwing) throw_at(get_edge_target_turf(src, get_dir(src, newloc)), 7 , 3, spin = FALSE) //my planet needs me return FALSE diff --git a/code/modules/projectiles/guns/beam_rifle.dm b/code/modules/projectiles/guns/beam_rifle.dm index c36a3c7d69..f2d99bc849 100644 --- a/code/modules/projectiles/guns/beam_rifle.dm +++ b/code/modules/projectiles/guns/beam_rifle.dm @@ -509,7 +509,7 @@ if(wall_pierce++ < wall_pierce_amount) loc = target if(prob(wall_devastate)) - if(istype(target, /turf/closed/wall)) + if(iswallturf(target)) var/turf/closed/wall/W = target W.dismantle_wall(TRUE, TRUE) else diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index aaa3a3e637..24844d6deb 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -101,7 +101,7 @@ /obj/item/projectile/proc/on_hit(atom/target, blocked = FALSE) var/turf/target_loca = get_turf(target) - if(!nodamage && (damage_type == BRUTE || damage_type == BURN) && istype(target_loca, /turf/closed/wall) && prob(75)) + if(!nodamage && (damage_type == BRUTE || damage_type == BURN) && iswallturf(target_loca) && prob(75)) var/turf/closed/wall/W = target_loca var/mutable_appearance/decal = mutable_appearance('icons/effects/effects.dmi', "bullet_hole", TURF_DECAL_LAYER) if(target == original) diff --git a/code/modules/projectiles/projectile/magic.dm b/code/modules/projectiles/projectile/magic.dm index 5665b365a1..f3bc7ab9e0 100644 --- a/code/modules/projectiles/projectile/magic.dm +++ b/code/modules/projectiles/projectile/magic.dm @@ -76,7 +76,7 @@ OpenDoor(target) else var/turf/T = get_turf(target) - if(isclosedturf(T) && !istype(T, /turf/closed/indestructible)) + if(isclosedturf(T) && !isindestructiblewall(T)) CreateDoor(T) /obj/item/projectile/magic/door/proc/CreateDoor(turf/T) diff --git a/code/modules/reagents/chemistry/reagents/other_reagents.dm b/code/modules/reagents/chemistry/reagents/other_reagents.dm index b4ff0e870b..7c10bc3fe1 100644 --- a/code/modules/reagents/chemistry/reagents/other_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/other_reagents.dm @@ -1330,7 +1330,7 @@ taste_description = "carpet" // Your tounge feels furry. /datum/reagent/carpet/reaction_turf(turf/T, reac_volume) - if(istype(T, /turf/open/floor/plating) || istype(T, /turf/open/floor/plasteel)) + if(isplatingturf(T) || istype(T, /turf/open/floor/plasteel)) var/turf/open/floor/F = T F.ChangeTurf(/turf/open/floor/carpet) ..() diff --git a/code/modules/reagents/chemistry/reagents/pyrotechnic_reagents.dm b/code/modules/reagents/chemistry/reagents/pyrotechnic_reagents.dm index 4c1965058c..bec3df0bdd 100644 --- a/code/modules/reagents/chemistry/reagents/pyrotechnic_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/pyrotechnic_reagents.dm @@ -54,7 +54,7 @@ . = 1 /datum/reagent/clf3/reaction_turf(turf/T, reac_volume) - if(istype(T, /turf/open/floor/plating)) + if(isplatingturf(T)) var/turf/open/floor/plating/F = T if(prob(10 + F.burnt + 5*F.broken)) //broken or burnt plating is more susceptible to being destroyed F.ChangeTurf(F.baseturf) diff --git a/code/modules/ruins/objects_and_mobs/necropolis_gate.dm b/code/modules/ruins/objects_and_mobs/necropolis_gate.dm index c18f2c3174..ce467a1181 100644 --- a/code/modules/ruins/objects_and_mobs/necropolis_gate.dm +++ b/code/modules/ruins/objects_and_mobs/necropolis_gate.dm @@ -263,7 +263,7 @@ GLOBAL_DATUM(necropolis_gate, /obj/structure/necropolis_gate/legion_gate) if(falling || fallen) return var/turf/T = get_turf(src) - if(!istype(T, /turf/open/lava) && !istype(T, /turf/open/chasm)) //nothing to sink or fall into + if(!islava(T) && !ischasm(T)) //nothing to sink or fall into return var/obj/item/I if(istype(AM, /obj/item))