Replace explicit z-level checks with defines

This commit is contained in:
Tad Hardesty
2017-12-29 11:40:06 -08:00
committed by CitadelStationBot
parent 48e0c47410
commit 0418ee4df6
96 changed files with 268 additions and 145 deletions
+16 -6
View File
@@ -37,7 +37,7 @@ interface with the mining shuttle at the landing site if a mobile beacon is also
var/list/options = params2list(possible_destinations)
var/obj/docking_port/mobile/M = SSshuttle.getShuttle(shuttleId)
var/dat = "[(z in GLOB.station_z_levels) ? "Docking clamps engaged. Standing by." : "Mining Shuttle Uplink: [M ? M.getStatusText() : "*OFFLINE*"]"]<br>"
var/dat = "[is_station_level(z) ? "Docking clamps engaged. Standing by." : "Mining Shuttle Uplink: [M ? M.getStatusText() : "*OFFLINE*"]"]<br>"
if(M)
var/destination_found
for(var/obj/docking_port/stationary/S in SSshuttle.stationary)
@@ -47,7 +47,7 @@ interface with the mining shuttle at the landing site if a mobile beacon is also
continue
destination_found = 1
dat += "<A href='?src=[REF(src)];move=[S.id]'>Send to [S.name]</A><br>"
if(!destination_found && (z in GLOB.station_z_levels)) //Only available if miners are lazy and did not set an LZ using the remote.
if(!destination_found && is_station_level(z)) //Only available if miners are lazy and did not set an LZ using the remote.
dat += "<A href='?src=[REF(src)];random=1'>Prepare for blind drop? (Dangerous)</A><br>"
if(LAZYLEN(turrets))
dat += "<br><b>Perimeter Defense System:</b> <A href='?src=[REF(src)];turrets_power=on'>Enable All</A> / <A href='?src=[REF(src)];turrets_power=off'>Disable All</A><br> \
@@ -86,7 +86,7 @@ interface with the mining shuttle at the landing site if a mobile beacon is also
return
if(href_list["move"])
if(!(z in GLOB.station_z_levels) && shuttleId == "colony_drop")
if(!is_station_level(z) && shuttleId == "colony_drop")
to_chat(usr, "<span class='warning'>You can't move the base again!</span>")
return
var/shuttle_error = SSshuttle.moveShuttle(shuttleId, href_list["move"], 1)
@@ -128,7 +128,7 @@ interface with the mining shuttle at the landing site if a mobile beacon is also
updateUsrDialog()
/obj/machinery/computer/auxillary_base/proc/set_mining_mode()
if(z == ZLEVEL_MINING) //The console switches to controlling the mining shuttle once landed.
if(is_mining_level(z)) //The console switches to controlling the mining shuttle once landed.
req_one_access = list()
shuttleId = "mining" //The base can only be dropped once, so this gives the console a new purpose.
possible_destinations = "mining_home;mining_away;landing_zone_dock;mining_public"
@@ -140,7 +140,17 @@ interface with the mining shuttle at the landing site if a mobile beacon is also
to_chat(user, "<span class='warning'>This station is not equipped with an auxillary base. Please contact your Nanotrasen contractor.</span>")
return
if(!no_restrictions)
<<<<<<< HEAD
if(T.z != ZLEVEL_MINING)
=======
var/static/list/disallowed_turf_types = typecacheof(list(
/turf/open/lava,
/turf/closed/indestructible,
/turf/open/indestructible,
))
if(!is_mining_level(T.z))
>>>>>>> f2dbe5c... Replace explicit z-level checks with defines (#33829)
return BAD_ZLEVEL
var/colony_radius = max(base_dock.width, base_dock.height)*0.5
if(T.x - colony_radius < 1 || T.x + colony_radius >= world.maxx || T.y - colony_radius < 1 || T.y + colony_radius >= world.maxx)
@@ -200,7 +210,7 @@ interface with the mining shuttle at the landing site if a mobile beacon is also
var/obj/machinery/computer/auxillary_base/AB
for (var/obj/machinery/computer/auxillary_base/A in GLOB.machines)
if(A.z in GLOB.station_z_levels)
if(is_station_level(A.z))
AB = A
break
if(!AB)
@@ -267,7 +277,7 @@ obj/docking_port/stationary/public_mining_dock
var/turf/landing_spot = get_turf(src)
if(landing_spot.z != ZLEVEL_MINING)
if(!is_mining_level(landing_spot.z))
to_chat(user, "<span class='warning'>This device is only to be used in a mining zone.</span>")
return
var/obj/machinery/computer/auxillary_base/aux_base_console
+1 -1
View File
@@ -151,7 +151,7 @@
to_chat(owner, "<span class='warning'>You can only build within the mining base!</span>")
return FALSE
if(!(build_target.z in GLOB.station_z_levels))
if(!is_station_level(build_target.z))
to_chat(owner, "<span class='warning'>The mining base has launched and can no longer be modified.</span>")
return FALSE
@@ -60,7 +60,7 @@
playsound(get_turf(src), 'sound/effects/phasein.ogg', 100, 1)
var/turf/T = deploy_location
if(T.z != ZLEVEL_MINING && T.z != ZLEVEL_LAVALAND)//only report capsules away from the mining/lavaland level
if(!is_mining_level(T.z)) //only report capsules away from the mining/lavaland level
message_admins("[ADMIN_LOOKUPFLW(usr)] activated a bluespace capsule away from the mining level! [ADMIN_JMP(T)]")
log_admin("[key_name(usr)] activated a bluespace capsule away from the mining level at [get_area(T)][COORD(T)]")
template.load(deploy_location, centered = TRUE)
@@ -20,7 +20,7 @@
/obj/item/device/wormhole_jaunter/proc/turf_check(mob/user)
var/turf/device_turf = get_turf(user)
if(!device_turf || device_turf.z == ZLEVEL_CENTCOM || device_turf.z == ZLEVEL_TRANSIT)
if(!device_turf || is_centcom_level(device_turf.z) || is_transit_level(device_turf.z))
to_chat(user, "<span class='notice'>You're having difficulties getting the [src.name] to work.</span>")
return FALSE
return TRUE
@@ -40,7 +40,7 @@
for(var/obj/item/device/radio/beacon/B in GLOB.teleportbeacons)
var/turf/T = get_turf(B)
if(T.z in GLOB.station_z_levels)
if(is_station_level(T.z))
destinations += B
return destinations
@@ -586,7 +586,7 @@
to_chat(user, "<span class='notice'>You unfold the ladder. It extends much farther than you were expecting.</span>")
var/last_ladder = null
for(var/i in 1 to world.maxz)
if(i == ZLEVEL_CENTCOM || i == ZLEVEL_TRANSIT || i == ZLEVEL_CITYOFCOGS)
if(is_centcom_level(i) || is_transit_level(i) || is_reebe(i))
continue
var/turf/T2 = locate(ladder_x, ladder_y, i)
last_ladder = new /obj/structure/ladder/unbreakable/jacob(T2, null, last_ladder)
+1 -1
View File
@@ -102,7 +102,7 @@
smelt_ore(ore)
/obj/machinery/mineral/ore_redemption/proc/send_console_message()
if(!(z in GLOB.station_z_levels))
if(!is_station_level(z))
return
message_sent = TRUE
var/area/A = get_area(src)
+1 -1
View File
@@ -76,7 +76,7 @@
req_access = list(ACCESS_MINING) // should slow the ashwalkers down.
/obj/machinery/computer/shuttle/mining/attack_hand(mob/user)
if((user.z in GLOB.station_z_levels) && user.mind && is_head_revolutionary(user) && !(user.mind in dumb_rev_heads))
if(is_station_level(user.z) && user.mind && is_head_revolutionary(user) && !(user.mind in dumb_rev_heads))
to_chat(user, "<span class='warning'>You get a feeling that leaving the station might be a REALLY dumb idea...</span>")
dumb_rev_heads += user.mind
return