Replace explicit z-level checks with defines

This commit is contained in:
Tad Hardesty
2017-12-29 13:41:10 -06:00
committed by CitadelStationBot
parent 48e0c47410
commit 0418ee4df6
96 changed files with 268 additions and 145 deletions
+2 -2
View File
@@ -108,7 +108,7 @@
if(!user.mind.has_antag_datum(/datum/antagonist/nukeop,TRUE))
to_chat(user, "<span class='danger'>AUTHENTICATION FAILURE. ACCESS DENIED.</span>")
return FALSE
if(user.z != ZLEVEL_CENTCOM)
if(!user.onSyndieBase())
to_chat(user, "<span class='warning'>[src] is out of range! It can only be used at your base!</span>")
return FALSE
return TRUE
@@ -208,7 +208,7 @@
/obj/item/antag_spawner/slaughter_demon/attack_self(mob/user)
if(!(user.z in GLOB.station_z_levels))
if(!is_station_level(user.z))
to_chat(user, "<span class='notice'>You should probably wait until you reach the station.</span>")
return
if(used)
+18 -1
View File
@@ -53,7 +53,18 @@ GLOBAL_LIST_EMPTY(blob_nodes)
SSshuttle.registerHostileEnvironment(src)
<<<<<<< HEAD
.= ..()
=======
/mob/camera/blob/proc/validate_location()
var/turf/T = get_turf(src)
var/area/A = get_area(T)
if(((A && !A.blob_allowed) || !T || !is_station_level(T.z)) && LAZYLEN(GLOB.blobstart))
T = get_turf(pick(GLOB.blobstart))
if(!T)
CRASH("No blobspawnpoints and blob spawned in nullspace.")
forceMove(T)
>>>>>>> f2dbe5c... Replace explicit z-level checks with defines (#33829)
/mob/camera/blob/Life()
if(!blob_core)
@@ -73,6 +84,12 @@ GLOBAL_LIST_EMPTY(blob_nodes)
max_blob_points = INFINITY
blob_points = INFINITY
addtimer(CALLBACK(src, .proc/victory), 450)
<<<<<<< HEAD
=======
if(!victory_in_progress && max_count < blobs_legit.len)
max_count = blobs_legit.len
>>>>>>> f2dbe5c... Replace explicit z-level checks with defines (#33829)
..()
@@ -82,7 +99,7 @@ GLOBAL_LIST_EMPTY(blob_nodes)
for(var/i in GLOB.mob_living_list)
var/mob/living/L = i
var/turf/T = get_turf(L)
if(!T || !(T.z in GLOB.station_z_levels))
if(!T || !is_station_level(T.z))
continue
if(L in GLOB.overminds || (L.pass_flags & PASSBLOB))
@@ -165,13 +165,13 @@
var/list/teleportnames = list()
for(var/obj/structure/destructible/clockwork/powered/clockwork_obelisk/O in GLOB.all_clockwork_objects)
if(!O.Adjacent(invoker) && O != src && (O.z <= ZLEVEL_SPACEMAX) && O.anchored) //don't list obelisks that we're next to
if(!O.Adjacent(invoker) && O != src && !is_away_level(O.z) && O.anchored) //don't list obelisks that we're next to
var/area/A = get_area(O)
var/locname = initial(A.name)
possible_targets[avoid_assoc_duplicate_keys("[locname] [O.name]", teleportnames)] = O
for(var/mob/living/L in GLOB.alive_mob_list)
if(!L.stat && is_servant_of_ratvar(L) && !L.Adjacent(invoker) && (L.z <= ZLEVEL_SPACEMAX)) //People right next to the invoker can't be portaled to, for obvious reasons
if(!L.stat && is_servant_of_ratvar(L) && !L.Adjacent(invoker) && !is_away_level(L.z)) //People right next to the invoker can't be portaled to, for obvious reasons
possible_targets[avoid_assoc_duplicate_keys("[L.name] ([L.real_name])", teleportnames)] = L
if(!possible_targets.len)
@@ -94,7 +94,7 @@
fabrication_values["power_cost"] = 0
var/turf/Y = get_turf(user)
if(!Y || (!(Y.z in GLOB.station_z_levels) && Y.z != ZLEVEL_CENTCOM && Y.z != ZLEVEL_MINING && Y.z != ZLEVEL_LAVALAND))
if(!Y || (!is_centcom_level(Y.z) && !is_station_level(Y.z) && !is_mining_level(Y.z)))
fabrication_values["operation_time"] *= 2
if(fabrication_values["power_cost"] > 0)
fabrication_values["power_cost"] *= 2
@@ -63,7 +63,7 @@
hierophant_message("<span class='large_brass'><b>The Eminence:</b> \"[message]\"</span>")
/mob/camera/eminence/Hear(message, atom/movable/speaker, datum/language/message_language, raw_message, radio_freq, list/spans, message_mode)
if(z == ZLEVEL_CITYOFCOGS || is_servant_of_ratvar(speaker) || GLOB.ratvar_approaches || GLOB.ratvar_awakens) //Away from Reebe, the Eminence can't hear anything
if(is_reebe(z) || is_servant_of_ratvar(speaker) || GLOB.ratvar_approaches || GLOB.ratvar_awakens) //Away from Reebe, the Eminence can't hear anything
to_chat(src, message)
return
to_chat(src, "<i>[speaker] says something, but you can't understand any of it...</i>")
@@ -233,7 +233,7 @@
button_icon_state = "warp_down"
/datum/action/innate/eminence/station_jump/Activate()
if(owner.z == ZLEVEL_CITYOFCOGS)
if(is_reebe(owner.z))
owner.forceMove(get_turf(pick(GLOB.generic_event_spawns)))
owner.playsound_local(owner, 'sound/magic/magic_missile.ogg', 50, TRUE)
flash_color(owner, flash_color = "#AF0AAF", flash_time = 25)
@@ -126,7 +126,7 @@ Applications: 8 servants, 3 caches, and 100 CV
/datum/clockwork_scripture/proc/check_offstation_penalty()
var/turf/T = get_turf(invoker)
if(!T || (!(T.z in GLOB.station_z_levels) && T.z != ZLEVEL_CENTCOM && T.z != ZLEVEL_MINING && T.z != ZLEVEL_LAVALAND && T.z != ZLEVEL_CITYOFCOGS))
if(!T || (!is_centcom_level(T.z) && !is_station_level(T.z) && !is_mining_level(T.z) && !is_reebe(T.z)))
channel_time *= 2
power_cost *= 2
return TRUE
@@ -262,7 +262,7 @@ Applications: 8 servants, 3 caches, and 100 CV
to_chat(invoker, "<span class='warning'>There are too many constructs of this type ([constructs])! You may only have [round(construct_limit)] at once.</span>")
return
var/obj/structure/destructible/clockwork/massive/celestial_gateway/G = GLOB.ark_of_the_clockwork_justiciar
if(G && !G.active && combat_construct && invoker.z == ZLEVEL_CITYOFCOGS && !confirmed) //Putting marauders on the base during the prep phase is a bad idea mmkay
if(G && !G.active && combat_construct && is_reebe(invoker.z) && !confirmed) //Putting marauders on the base during the prep phase is a bad idea mmkay
if(alert(invoker, "This is a combat construct, and you cannot easily get it to the station. Are you sure you want to make one here?", "Construct Alert", "Yes", "Cancel") == "Cancel")
return
if(!is_servant_of_ratvar(invoker) || !invoker.canUseTopic(slab))
@@ -209,7 +209,7 @@
quickbind_desc = "Returns you to Reebe."
/datum/clockwork_scripture/abscond/check_special_requirements()
if(invoker.z == ZLEVEL_CITYOFCOGS)
if(is_reebe(invoker.z))
to_chat(invoker, "<span class='danger'>You're already at Reebe.</span>")
return
return TRUE
+5 -1
View File
@@ -203,7 +203,7 @@ This file contains the arcane tome files.
A = get_area(src)
if(!src || QDELETED(src) || !Adjacent(user) || user.incapacitated() || !check_rune_turf(Turf, user))
return
//AAAAAAAAAAAAAAAH, i'm rewriting enough for now so TODO: remove this shit
if(ispath(rune_to_scribe, /obj/effect/rune/narsie))
if(!summon_objective)
@@ -266,7 +266,11 @@ This file contains the arcane tome files.
to_chat(user, "<span class='cult'>There is already a rune here.</span>")
return FALSE
<<<<<<< HEAD
if(!(T.z in GLOB.station_z_levels) && T.z != ZLEVEL_MINING)
=======
if(!is_station_level(T.z) && !is_mining_level(T.z))
>>>>>>> f2dbe5c... Replace explicit z-level checks with defines (#33829)
to_chat(user, "<span class='warning'>The veil is not weak enough here.</span>")
return FALSE
+13 -3
View File
@@ -268,7 +268,7 @@ structure_check() searches for nearby cultist structures required for the invoca
var/list/teleportnames = list()
for(var/R in GLOB.teleport_runes)
var/obj/effect/rune/teleport/T = R
if(T != src && (T.z <= ZLEVEL_SPACEMAX))
if(T != src && !is_away_level(T.z))
potential_runes[avoid_assoc_duplicate_keys(T.listkey, teleportnames)] = T
if(!potential_runes.len)
@@ -277,8 +277,14 @@ structure_check() searches for nearby cultist structures required for the invoca
fail_invoke()
return
<<<<<<< HEAD
if(user.z > ZLEVEL_SPACEMAX)
to_chat(user, "<span class='cultitalic'>You are not in the right dimension!</span>")
=======
var/turf/T = get_turf(src)
if(is_away_level(T.z))
to_chat(user, "<span class='cult italic'>You are not in the right dimension!</span>")
>>>>>>> f2dbe5c... Replace explicit z-level checks with defines (#33829)
log_game("Teleport rune failed - user in away mission")
fail_invoke()
return
@@ -289,7 +295,6 @@ structure_check() searches for nearby cultist structures required for the invoca
fail_invoke()
return
var/turf/T = get_turf(src)
var/turf/target = get_turf(actual_selected_rune)
if(is_blocked_turf(target, TRUE))
to_chat(user, "<span class='warning'>The target rune is blocked. Attempting to teleport to it would be massively unwise.</span>")
@@ -479,7 +484,7 @@ structure_check() searches for nearby cultist structures required for the invoca
/obj/effect/rune/narsie/invoke(var/list/invokers)
if(used)
return
if(!(z in GLOB.station_z_levels))
if(!is_station_level(z))
return
if(locate(/obj/singularity/narsie) in GLOB.poi_list)
@@ -815,8 +820,13 @@ structure_check() searches for nearby cultist structures required for the invoca
fail_invoke()
log_game("Summon Cultist rune failed - target was deconverted")
return
<<<<<<< HEAD
if(cultist_to_summon.z > ZLEVEL_SPACEMAX)
to_chat(user, "<span class='cultitalic'>[cultist_to_summon] is not in our dimension!</span>")
=======
if(is_away_level(cultist_to_summon.z))
to_chat(user, "<span class='cult italic'>[cultist_to_summon] is not in our dimension!</span>")
>>>>>>> f2dbe5c... Replace explicit z-level checks with defines (#33829)
fail_invoke()
log_game("Summon Cultist rune failed - target in away mission")
return
+5
View File
@@ -65,8 +65,13 @@
log_game("Teleport talisman failed - no other teleport runes")
return ..(user, 0)
<<<<<<< HEAD
if(user.z > ZLEVEL_SPACEMAX)
to_chat(user, "<span class='cultitalic'>You are not in the right dimension!</span>")
=======
if(is_away_level(user.z))
to_chat(user, "<span class='cult italic'>You are not in the right dimension!</span>")
>>>>>>> f2dbe5c... Replace explicit z-level checks with defines (#33829)
log_game("Teleport talisman failed - user in away mission")
return ..(user, 0)
+6 -6
View File
@@ -1,7 +1,7 @@
/proc/power_failure()
priority_announce("Abnormal activity detected in [station_name()]'s powernet. As a precautionary measure, the station's power will be shut off for an indeterminate duration.", "Critical Power Failure", 'sound/ai/poweroff.ogg')
for(var/obj/machinery/power/smes/S in GLOB.machines)
if(istype(get_area(S), /area/ai_monitored/turret_protected) || !(S.z in GLOB.station_z_levels))
if(istype(get_area(S), /area/ai_monitored/turret_protected) || !is_station_level(S.z))
continue
S.charge = 0
S.output_level = 0
@@ -22,7 +22,7 @@
break
if(A.contents)
for(var/atom/AT in A.contents)
if(!(AT.z in GLOB.station_z_levels)) //Only check one, it's enough.
if(!is_station_level(AT.z)) //Only check one, it's enough.
skip = 1
break
if(skip)
@@ -33,7 +33,7 @@
A.power_change()
for(var/obj/machinery/power/apc/C in GLOB.apcs_list)
if(C.cell && (C.z in GLOB.station_z_levels))
if(C.cell && is_station_level(C.z))
var/area/A = C.area
var/skip = 0
@@ -50,11 +50,11 @@
priority_announce("Power has been restored to [station_name()]. We apologize for the inconvenience.", "Power Systems Nominal", 'sound/ai/poweron.ogg')
for(var/obj/machinery/power/apc/C in GLOB.machines)
if(C.cell && (C.z in GLOB.station_z_levels))
if(C.cell && is_station_level(C.z))
C.cell.charge = C.cell.maxcharge
C.failure_timer = 0
for(var/obj/machinery/power/smes/S in GLOB.machines)
if(!(S.z in GLOB.station_z_levels))
if(!is_station_level(S.z))
continue
S.charge = S.capacity
S.output_level = S.output_level_max
@@ -72,7 +72,7 @@
priority_announce("All SMESs on [station_name()] have been recharged. We apologize for the inconvenience.", "Power Systems Nominal", 'sound/ai/poweron.ogg')
for(var/obj/machinery/power/smes/S in GLOB.machines)
if(!(S.z in GLOB.station_z_levels))
if(!is_station_level(S.z))
continue
S.charge = S.capacity
S.output_level = S.output_level_max
@@ -233,7 +233,7 @@ GLOBAL_LIST_INIT(blacklisted_malf_machines, typecacheof(list(
/datum/action/innate/ai/nuke_station/Activate()
var/turf/T = get_turf(owner)
if(!istype(T) || !(T.z in GLOB.station_z_levels))
if(!istype(T) || !is_station_level(T.z))
to_chat(owner, "<span class='warning'>You cannot activate the doomsday device while off-station!</span>")
return
if(alert(owner, "Send arming signal? (true = arm, false = cancel)", "purge_all_life()", "confirm = TRUE;", "confirm = FALSE;") != "confirm = TRUE;")
@@ -356,7 +356,7 @@ GLOBAL_LIST_INIT(blacklisted_malf_machines, typecacheof(list(
/obj/machinery/doomsday_device/process()
var/turf/T = get_turf(src)
if(!T || !(T.z in GLOB.station_z_levels))
if(!T || !is_station_level(T.z))
minor_announce("DOOMSDAY DEVICE OUT OF STATION RANGE, ABORTING", "ERROR ER0RR $R0RRO$!R41.%%!!(%$^^__+ @#F0E4", TRUE)
SSshuttle.clearHostileEnvironment(src)
qdel(src)
@@ -378,7 +378,7 @@ GLOBAL_LIST_INIT(blacklisted_malf_machines, typecacheof(list(
for(var/i in GLOB.mob_living_list)
var/mob/living/L = i
var/turf/T = get_turf(L)
if(!T || !(T.z in GLOB.station_z_levels))
if(!T || !is_station_level(T.z))
continue
if(issilicon(L))
continue
@@ -425,7 +425,7 @@ GLOBAL_LIST_INIT(blacklisted_malf_machines, typecacheof(list(
/datum/action/innate/ai/lockdown/Activate()
for(var/obj/machinery/door/D in GLOB.airlocks)
if(!(D.z in GLOB.station_z_levels))
if(!is_station_level(D.z))
continue
INVOKE_ASYNC(D, /obj/machinery/door.proc/hostile_lockdown, owner)
addtimer(CALLBACK(D, /obj/machinery/door.proc/disable_lockdown), 900)
@@ -503,7 +503,7 @@ GLOBAL_LIST_INIT(blacklisted_malf_machines, typecacheof(list(
/datum/action/innate/ai/break_fire_alarms/Activate()
for(var/obj/machinery/firealarm/F in GLOB.machines)
if(!(F.z in GLOB.station_z_levels))
if(!is_station_level(F.z))
continue
F.emagged = TRUE
to_chat(owner, "<span class='notice'>All thermal sensors on the station have been disabled. Fire alerts will no longer be recognized.</span>")
@@ -530,7 +530,7 @@ GLOBAL_LIST_INIT(blacklisted_malf_machines, typecacheof(list(
/datum/action/innate/ai/break_air_alarms/Activate()
for(var/obj/machinery/airalarm/AA in GLOB.machines)
if(!(AA.z in GLOB.station_z_levels))
if(!is_station_level(AA.z))
continue
AA.emagged = TRUE
to_chat(owner, "<span class='notice'>All air alarm safeties on the station have been overriden. Air alarms may now use the Flood environmental mode.</span>")
@@ -753,7 +753,7 @@ GLOBAL_LIST_INIT(blacklisted_malf_machines, typecacheof(list(
/datum/action/innate/ai/emergency_lights/Activate()
for(var/obj/machinery/light/L in GLOB.machines)
if(L.z in GLOB.station_z_levels)
if(is_station_level(L.z))
L.no_emergency = TRUE
INVOKE_ASYNC(L, /obj/machinery/light/.proc/update, FALSE)
CHECK_TICK
@@ -454,7 +454,7 @@
if(target == src)
return
if(!(z in GLOB.station_z_levels) && z != ZLEVEL_LAVALAND)
if(!is_station_level(z) && !is_mining_level(z))
to_chat(src, "<span class='warning'>Our bluespace transceiver cannot locate a viable bluespace link, our teleportation abilities are useless in this area.</span>")
return
@@ -67,7 +67,7 @@
var/datum/disease/D = new /datum/disease/transformation/jungle_fever() //ugly but unfortunately needed
for(var/mob/living/carbon/human/H in GLOB.alive_mob_list)
if(!(H.z in GLOB.station_z_levels))
if(!is_station_level(H.z))
continue
if(H.mind && H.client && H.stat != DEAD)
if(H.HasDisease(D))
@@ -67,7 +67,7 @@
if(GLOB.player_list.len < CHALLENGE_MIN_PLAYERS)
to_chat(user, "The enemy crew is too small to be worth declaring war on.")
return FALSE
if(user.z != ZLEVEL_CENTCOM)
if(!user.onSyndieBase())
to_chat(user, "You have to be at your base to use this.")
return FALSE
if(world.time-SSticker.round_start_time > CHALLENGE_TIME_LIMIT)
+3 -3
View File
@@ -451,12 +451,12 @@
var/off_station = 0
var/turf/bomb_location = get_turf(src)
var/area/A = get_area(bomb_location)
if(bomb_location && (bomb_location.z in GLOB.station_z_levels))
if(bomb_location && is_station_level(bomb_location.z))
if(istype(A, /area/space))
off_station = NUKE_NEAR_MISS
if((bomb_location.x < (128-NUKERANGE)) || (bomb_location.x > (128+NUKERANGE)) || (bomb_location.y < (128-NUKERANGE)) || (bomb_location.y > (128+NUKERANGE)))
off_station = NUKE_NEAR_MISS
else if((istype(A, /area/syndicate_mothership) || (istype(A, /area/shuttle/syndicate)) && bomb_location.z == ZLEVEL_CENTCOM))
else if(bomb_location.onSyndieBase())
off_station = NUKE_SYNDICATE_BASE
else
off_station = NUKE_MISS_STATION
@@ -556,7 +556,7 @@ This is here to make the tiles around the station mininuke change when it's arme
addtimer(CALLBACK(user, /atom/proc/add_atom_colour, (i % 2)? "#00FF00" : "#FF0000", ADMIN_COLOUR_PRIORITY), i)
addtimer(CALLBACK(src, .proc/manual_suicide, user), 101)
return MANUAL_SUICIDE
/obj/item/disk/proc/manual_suicide(mob/living/user)
user.remove_atom_colour(ADMIN_COLOUR_PRIORITY)
user.visible_message("<span class='suicide'>[user] was destroyed by the nuclear blast!</span>")
+1 -1
View File
@@ -154,7 +154,7 @@
if(!target || !considered_alive(target) || considered_afk(target))
return TRUE
var/turf/T = get_turf(target.current)
return T && !(T.z in GLOB.station_z_levels)
return T && !is_station_level(T.z)
/datum/objective/mutiny/update_explanation_text()
..()
+1 -1
View File
@@ -164,7 +164,7 @@
/datum/game_mode/revolution/proc/check_heads_victory()
for(var/datum/mind/rev_mind in revolution.head_revolutionaries())
var/turf/T = get_turf(rev_mind.current)
if(!considered_afk(rev_mind) && considered_alive(rev_mind) && (T.z in GLOB.station_z_levels))
if(!considered_afk(rev_mind) && considered_alive(rev_mind) && is_station_level(T.z))
if(ishuman(rev_mind.current))
return FALSE
return TRUE