Skip to content

Commit

Permalink
Makes the station Z level into a list instead of a single define (#30297
Browse files Browse the repository at this point in the history
)

* Makes Station Z Levels a global list

* Things didnt get committed

* Define

* Removes files

* Fix mind.dm

* Wrong list name

* (

* Fixes rev checks and signpost

* Makes it actually compile

* Signpost fix

* I hate these sign posts

* Never use the web editor
  • Loading branch information
KorPhaeron authored and Cyberboss committed Sep 11, 2017
1 parent cd07135 commit 10a3238
Show file tree
Hide file tree
Showing 86 changed files with 134 additions and 130 deletions.
2 changes: 1 addition & 1 deletion code/__DEFINES/maps.dm
Expand Up @@ -35,7 +35,7 @@ Last space-z level = empty

//zlevel defines, can be overridden for different maps in the appropriate _maps file.
#define ZLEVEL_CENTCOM 1
#define ZLEVEL_STATION 2
#define ZLEVEL_STATION_PRIMARY 2
#define ZLEVEL_MINING 5
#define ZLEVEL_LAVALAND 5
#define ZLEVEL_EMPTY_SPACE 12
Expand Down
2 changes: 1 addition & 1 deletion code/__HELPERS/priority_announce.dm
Expand Up @@ -39,7 +39,7 @@
priority_announce("A report has been downloaded and printed out at all communications consoles.", "Incoming Classified Message", 'sound/ai/commandreport.ogg')

for(var/obj/machinery/computer/communications/C in GLOB.machines)
if(!(C.stat & (BROKEN|NOPOWER)) && C.z == ZLEVEL_STATION)
if(!(C.stat & (BROKEN|NOPOWER)) && (C.z in GLOB.station_z_levels))
var/obj/item/paper/P = new /obj/item/paper(C.loc)
P.name = "paper - '[title]'"
P.info = text
Expand Down
4 changes: 3 additions & 1 deletion code/_globalvars/lists/mapping.dm
Expand Up @@ -14,6 +14,8 @@ GLOBAL_LIST_INIT(diagonals, list(NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST))
//Go away Urist, I'm restoring this to the longer list. ~Errorage
GLOBAL_LIST_INIT(accessable_z_levels, list(1,3,4,5,6,7)) //Keep this to six maps, repeating z-levels is ok if needed

GLOBAL_LIST_INIT(station_z_levels, list(ZLEVEL_STATION_PRIMARY))

GLOBAL_LIST(global_map)
//list/global_map = list(list(1,5),list(4,3))//an array of map Z levels.
//Resulting sector map looks like
Expand Down Expand Up @@ -52,4 +54,4 @@ GLOBAL_LIST_EMPTY(awaydestinations) //a list of landmarks that the warpgate can
//used by jump-to-area etc. Updated by area/updateName()
GLOBAL_LIST_EMPTY(sortedAreas)

GLOBAL_LIST_EMPTY(all_abstract_markers)
GLOBAL_LIST_EMPTY(all_abstract_markers)
2 changes: 1 addition & 1 deletion code/controllers/subsystem/mapping.dm
Expand Up @@ -117,7 +117,7 @@ SUBSYSTEM_DEF(mapping)
var/start_time = REALTIMEOFDAY

INIT_ANNOUNCE("Loading [config.map_name]...")
TryLoadZ(config.GetFullMapPath(), FailedZs, ZLEVEL_STATION)
TryLoadZ(config.GetFullMapPath(), FailedZs, ZLEVEL_STATION_PRIMARY)
INIT_ANNOUNCE("Loaded station in [(REALTIMEOFDAY - start_time)/10]s!")
if(SSdbcore.Connect())
var/datum/DBQuery/query_round_map_name = SSdbcore.NewQuery("UPDATE [format_table_name("round")] SET map_name = '[config.map_name]' WHERE id = [GLOB.round_id]")
Expand Down
2 changes: 1 addition & 1 deletion code/controllers/subsystem/minimap.dm
Expand Up @@ -5,7 +5,7 @@ SUBSYSTEM_DEF(minimap)
var/const/MINIMAP_SIZE = 2048
var/const/TILE_SIZE = 8

var/list/z_levels = list(ZLEVEL_STATION)
var/list/z_levels = list(ZLEVEL_STATION_PRIMARY)

/datum/controller/subsystem/minimap/Initialize(timeofday)
var/hash = md5(SSmapping.config.GetFullMapPath())
Expand Down
8 changes: 4 additions & 4 deletions code/controllers/subsystem/persistence.dm
Expand Up @@ -35,7 +35,7 @@ SUBSYSTEM_DEF(persistence)
if(chosen_satchel.len == 3)
F.x = text2num(chosen_satchel[1])
F.y = text2num(chosen_satchel[2])
F.z = ZLEVEL_STATION
F.z = ZLEVEL_STATION_PRIMARY
path = text2path(chosen_satchel[3])
else
var/json_file = file("data/npc_saves/SecretSatchels[SSmapping.config.map_name].json")
Expand All @@ -50,7 +50,7 @@ SUBSYSTEM_DEF(persistence)
old_secret_satchels.Cut(pos, pos+1)
F.x = old_secret_satchels[pos]["x"]
F.y = old_secret_satchels[pos]["y"]
F.z = ZLEVEL_STATION
F.z = ZLEVEL_STATION_PRIMARY
path = text2path(old_secret_satchels[pos]["saved_obj"])
if(!ispath(path))
return
Expand All @@ -59,7 +59,7 @@ SUBSYSTEM_DEF(persistence)
new path(F)
placed_satchel++
var/list/free_satchels = list()
for(var/turf/T in shuffle(block(locate(TRANSITIONEDGE,TRANSITIONEDGE,ZLEVEL_STATION), locate(world.maxx-TRANSITIONEDGE,world.maxy-TRANSITIONEDGE,ZLEVEL_STATION)))) //Nontrivially expensive but it's roundstart only
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/))
free_satchels += new /obj/item/storage/backpack/satchel/flat/secret(T)
if(!isemptylist(free_satchels) && ((free_satchels.len + placed_satchel) >= (50 - old_secret_satchels.len) * 0.1)) //up to six tiles, more than enough to kill anything that moves
Expand Down Expand Up @@ -171,7 +171,7 @@ SUBSYSTEM_DEF(persistence)
satchel_blacklist = typecacheof(list(/obj/item/stack/tile/plasteel, /obj/item/crowbar))
for(var/A in new_secret_satchels)
var/obj/item/storage/backpack/satchel/flat/F = A
if(QDELETED(F) || F.z != ZLEVEL_STATION || F.invisibility != INVISIBILITY_MAXIMUM)
if(QDELETED(F) || F.z != ZLEVEL_STATION_PRIMARY || F.invisibility != INVISIBILITY_MAXIMUM)
continue
var/list/savable_obj = list()
for(var/obj/O in F)
Expand Down
2 changes: 1 addition & 1 deletion code/controllers/subsystem/shuttle.dm
Expand Up @@ -288,7 +288,7 @@ SUBSYSTEM_DEF(shuttle)
continue

var/turf/T = get_turf(thing)
if(T && T.z == ZLEVEL_STATION)
if(T && (T.z in GLOB.station_z_levels))
callShuttle = 0
break

Expand Down
2 changes: 1 addition & 1 deletion code/controllers/subsystem/ticker.dm
Expand Up @@ -383,7 +383,7 @@ SUBSYSTEM_DEF(ticker)
if(bomb && bomb.loc)
bombloc = bomb.z
else if(!station_missed)
bombloc = ZLEVEL_STATION
bombloc = ZLEVEL_STATION_PRIMARY

if(mode)
mode.explosion_in_progress = 0
Expand Down
2 changes: 1 addition & 1 deletion code/datums/antagonists/datum_cult.dm
Expand Up @@ -40,7 +40,7 @@
if(!GLOB.summon_spots.len)
while(GLOB.summon_spots.len < SUMMON_POSSIBILITIES)
var/area/summon = pick(GLOB.sortedAreas - GLOB.summon_spots)
if(summon && (summon.z == ZLEVEL_STATION) && summon.valid_territory)
if(summon && (summon.z in GLOB.station_z_levels) && summon.valid_territory)
GLOB.summon_spots += summon
SSticker.mode.cult_objectives += "eldergod"

Expand Down
2 changes: 1 addition & 1 deletion code/datums/diseases/advance/advance.dm
Expand Up @@ -413,7 +413,7 @@
AD.Refresh()

for(var/mob/living/carbon/human/H in shuffle(GLOB.living_mob_list))
if(H.z != ZLEVEL_STATION)
if(!(H.z in GLOB.station_z_levels))
continue
if(!H.HasDisease(D))
H.ForceContractDisease(D)
Expand Down
2 changes: 1 addition & 1 deletion code/datums/helper_datums/teleport.dm
Expand Up @@ -162,7 +162,7 @@

// Safe location finder

/proc/find_safe_turf(zlevel = ZLEVEL_STATION, list/zlevels, extended_safety_checks = FALSE)
/proc/find_safe_turf(zlevel = ZLEVEL_STATION_PRIMARY, list/zlevels, extended_safety_checks = FALSE)
if(!zlevels)
zlevels = list(zlevel)
var/cycles = 1000
Expand Down
2 changes: 1 addition & 1 deletion code/datums/mind.dm
Expand Up @@ -519,7 +519,7 @@
if(I == src)
continue
var/mob/M = I
if(M.z == ZLEVEL_STATION && !M.stat)
if((M.z in GLOB.station_z_levels) && !M.stat)
last_healthy_headrev = FALSE
break
text += "head | not mindshielded | <a href='?src=\ref[src];revolution=clear'>employee</a> | <b>[last_healthy_headrev ? "<font color='red'>LAST </font> " : ""]HEADREV</b> | <a href='?src=\ref[src];revolution=rev'>rev</a>"
Expand Down
2 changes: 1 addition & 1 deletion code/datums/weather/weather.dm
Expand Up @@ -30,7 +30,7 @@
var/area_type = /area/space //Types of area to affect
var/list/impacted_areas = list() //Areas to be affected by the weather, calculated when the weather begins
var/list/protected_areas = list()//Areas that are protected and excluded from the affected areas.
var/target_z = ZLEVEL_STATION //The z-level to affect
var/target_z = ZLEVEL_STATION_PRIMARY //The z-level to affect

var/overlay_layer = AREA_LAYER //Since it's above everything else, this is the layer used by default. TURF_LAYER is below mobs and walls if you need to use that.
var/aesthetic = FALSE //If the weather has no purpose other than looks
Expand Down
6 changes: 3 additions & 3 deletions code/datums/weather/weather_types.dm
Expand Up @@ -17,7 +17,7 @@

area_type = /area
protected_areas = list(/area/space)
target_z = ZLEVEL_STATION
target_z = ZLEVEL_STATION_PRIMARY

overlay_layer = ABOVE_OPEN_TURF_LAYER //Covers floors only
immunity_type = "lava"
Expand Down Expand Up @@ -48,7 +48,7 @@
end_duration = 0

area_type = /area
target_z = ZLEVEL_STATION
target_z = ZLEVEL_STATION_PRIMARY

/datum/weather/advanced_darkness/update_areas()
for(var/V in impacted_areas)
Expand Down Expand Up @@ -142,7 +142,7 @@
area_type = /area
protected_areas = list(/area/maintenance, /area/ai_monitored/turret_protected/ai_upload, /area/ai_monitored/turret_protected/ai_upload_foyer,
/area/ai_monitored/turret_protected/ai, /area/storage/emergency/starboard, /area/storage/emergency/port, /area/shuttle)
target_z = ZLEVEL_STATION
target_z = ZLEVEL_STATION_PRIMARY

immunity_type = "rad"

Expand Down
2 changes: 1 addition & 1 deletion code/game/area/areas.dm
Expand Up @@ -75,7 +75,7 @@ GLOBAL_LIST_EMPTY(teleportlocs)
if(GLOB.teleportlocs[AR.name])
continue
var/turf/picked = safepick(get_area_turfs(AR.type))
if (picked && (picked.z == ZLEVEL_STATION))
if (picked && (picked.z in GLOB.station_z_levels))
GLOB.teleportlocs[AR.name] = AR

sortTim(GLOB.teleportlocs, /proc/cmp_text_dsc)
Expand Down
4 changes: 2 additions & 2 deletions code/game/atoms_movable.dm
Expand Up @@ -559,7 +559,7 @@
flags_2 |= STATIONLOVING_2

/atom/movable/proc/relocate()
var/targetturf = find_safe_turf(ZLEVEL_STATION)
var/targetturf = find_safe_turf(ZLEVEL_STATION_PRIMARY)
if(!targetturf)
if(GLOB.blobstart.len > 0)
targetturf = get_turf(pick(GLOB.blobstart))
Expand Down Expand Up @@ -591,7 +591,7 @@
/atom/movable/proc/in_bounds()
. = FALSE
var/turf/currentturf = get_turf(src)
if(currentturf && (currentturf.z == ZLEVEL_CENTCOM || currentturf.z == ZLEVEL_STATION || currentturf.z == ZLEVEL_TRANSIT))
if(currentturf && (currentturf.z == ZLEVEL_CENTCOM || (currentturf.z in GLOB.station_z_levels) || currentturf.z == ZLEVEL_TRANSIT))
. = TRUE


Expand Down
2 changes: 1 addition & 1 deletion code/game/gamemodes/antag_spawner.dm
Expand Up @@ -238,7 +238,7 @@


/obj/item/antag_spawner/slaughter_demon/attack_self(mob/user)
if(user.z != ZLEVEL_STATION)
if(!(user.z in GLOB.station_z_levels))
to_chat(user, "<span class='notice'>You should probably wait until you reach the station.</span>")
return
if(used)
Expand Down
4 changes: 2 additions & 2 deletions code/game/gamemodes/blob/blob_report.dm
Expand Up @@ -19,7 +19,7 @@
var/nukecode = random_nukecode()
for(var/obj/machinery/nuclearbomb/bomb in GLOB.machines)
if(bomb && bomb.r_code)
if(bomb.z == ZLEVEL_STATION)
if(bomb.z in GLOB.station_z_levels)
bomb.r_code = nukecode

intercepttext += "<FONT size = 3><b>Nanotrasen Update</b>: Biohazard Alert.</FONT><HR>"
Expand Down Expand Up @@ -91,7 +91,7 @@
if(count_territories)
var/list/valid_territories = list()
for(var/area/A in world) //First, collect all area types on the station zlevel
if(A.z == ZLEVEL_STATION)
if(A.z in GLOB.station_z_levels)
if(!(A.type in valid_territories) && A.valid_territory)
valid_territories |= A.type
if(valid_territories.len)
Expand Down
Expand Up @@ -31,7 +31,7 @@
var/mob/living/silicon/ai/AI = ai
if(AI.deployed_shell && is_servant_of_ratvar(AI.deployed_shell))
continue
if(is_servant_of_ratvar(AI) || !isturf(AI.loc) || AI.z != ZLEVEL_STATION || AI.stat == DEAD)
if(is_servant_of_ratvar(AI) || !isturf(AI.loc) || !(AI.z in GLOB.station_z_levels) || AI.stat == DEAD)
continue
.++

Expand Down
Expand Up @@ -196,7 +196,7 @@
fabrication_values["power_cost"] = 0

var/turf/Y = get_turf(user)
if(!Y || (Y.z != ZLEVEL_STATION && Y.z != ZLEVEL_CENTCOM && Y.z != ZLEVEL_MINING && Y.z != ZLEVEL_LAVALAND))
if(!Y || (!(Y.z in GLOB.station_z_levels) && Y.z != ZLEVEL_CENTCOM && Y.z != ZLEVEL_MINING && Y.z != ZLEVEL_LAVALAND))
fabrication_values["operation_time"] *= 2
if(fabrication_values["power_cost"] > 0)
fabrication_values["power_cost"] *= 2
Expand Down
2 changes: 1 addition & 1 deletion code/game/gamemodes/clock_cult/clock_scripture.dm
Expand Up @@ -158,7 +158,7 @@ Judgement: 12 servants, 5 caches, 300 CV, and any existing AIs are converted or

/datum/clockwork_scripture/proc/check_offstation_penalty()
var/turf/T = get_turf(invoker)
if(!T || (T.z != ZLEVEL_STATION && T.z != ZLEVEL_CENTCOM && T.z != ZLEVEL_MINING && T.z != ZLEVEL_LAVALAND))
if(!T || (!(T.z in GLOB.station_z_levels) && T.z != ZLEVEL_CENTCOM && T.z != ZLEVEL_MINING && T.z != ZLEVEL_LAVALAND))
channel_time *= 2
for(var/i in consumed_components)
if(consumed_components[i])
Expand Down
Expand Up @@ -175,7 +175,7 @@
to_chat(invoker, "<span class='inathneq'>\"It is too late to construct one of these, champion.\"</span>")
return FALSE
var/turf/T = get_turf(invoker)
if(!T || T.z != ZLEVEL_STATION)
if(!T || !(T.z in GLOB.station_z_levels))
to_chat(invoker, "<span class='inathneq'>\"You must be on the station to construct one of these, champion.\"</span>")
return FALSE
return ..()
Expand Down
Expand Up @@ -33,7 +33,7 @@
return FALSE
var/area/A = get_area(invoker)
var/turf/T = get_turf(invoker)
if(!T || T.z != ZLEVEL_STATION || istype(A, /area/shuttle) || !A.blob_allowed)
if(!T || !(T.z in GLOB.station_z_levels) || istype(A, /area/shuttle) || !A.blob_allowed)
to_chat(invoker, "<span class='warning'>You must be on the station to activate the Ark!</span>")
return FALSE
if(GLOB.clockwork_gateway_activated)
Expand Down
Expand Up @@ -48,7 +48,7 @@
if(active)
return 0
var/turf/T = get_turf(src)
if(!T || T.z != ZLEVEL_STATION)
if(!T || !(T.z in GLOB.station_z_levels))
to_chat(user, "<span class='warning'>[src] must be on the station to function!</span>")
return 0
if(SSshuttle.emergency.mode != SHUTTLE_CALL)
Expand All @@ -63,7 +63,7 @@

/obj/structure/destructible/clockwork/powered/prolonging_prism/process()
var/turf/own_turf = get_turf(src)
if(SSshuttle.emergency.mode != SHUTTLE_CALL || delay_remaining <= 0 || !own_turf || own_turf.z != ZLEVEL_STATION)
if(SSshuttle.emergency.mode != SHUTTLE_CALL || delay_remaining <= 0 || !own_turf || !(own_turf.z in GLOB.station_z_levels))
forced_disable(FALSE)
return
. = ..()
Expand Down Expand Up @@ -97,7 +97,7 @@
mean_x = Ceiling(mean_x)
else
mean_x = Floor(mean_x)
var/turf/semi_random_center_turf = locate(mean_x, mean_y, ZLEVEL_STATION)
var/turf/semi_random_center_turf = locate(mean_x, mean_y, ZLEVEL_STATION_PRIMARY)
for(var/t in getline(src, semi_random_center_turf))
prism_turfs[t] = TRUE
var/placement_style = prob(50)
Expand Down
2 changes: 1 addition & 1 deletion code/game/gamemodes/cult/cult.dm
Expand Up @@ -104,7 +104,7 @@
if(!GLOB.summon_spots.len)
while(GLOB.summon_spots.len < SUMMON_POSSIBILITIES)
var/area/summon = pick(GLOB.sortedAreas - GLOB.summon_spots)
if((summon.z == ZLEVEL_STATION) && summon.valid_territory)
if((summon.z in GLOB.station_z_levels) && summon.valid_territory)
GLOB.summon_spots += summon
cult_objectives += "eldergod"

Expand Down
4 changes: 3 additions & 1 deletion code/game/gamemodes/cult/ritual.dm
Expand Up @@ -257,8 +257,10 @@ This file contains the arcane tome files.
to_chat(user, "<span class='cult'>There is already a rune here.</span>")
return FALSE

if(T.z != ZLEVEL_STATION && T.z != ZLEVEL_MINING)

if(!(T.z in GLOB.station_z_levels) && T.z != ZLEVEL_MINING)
to_chat(user, "<span class='warning'>The veil is not weak enough here.</span>")

return FALSE

return TRUE
2 changes: 1 addition & 1 deletion code/game/gamemodes/cult/runes.dm
Expand Up @@ -465,7 +465,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 != ZLEVEL_STATION)
if(!(z in GLOB.station_z_levels))
return

if(locate(/obj/singularity/narsie) in GLOB.poi_list)
Expand Down
12 changes: 6 additions & 6 deletions code/game/gamemodes/events.dm
@@ -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 != ZLEVEL_STATION)
if(istype(get_area(S), /area/ai_monitored/turret_protected) || !(S.z in GLOB.station_z_levels))
continue
S.charge = 0
S.output_level = 0
Expand All @@ -22,7 +22,7 @@
break
if(A.contents)
for(var/atom/AT in A.contents)
if(AT.z != ZLEVEL_STATION) //Only check one, it's enough.
if(!(AT.z in GLOB.station_z_levels)) //Only check one, it's enough.
skip = 1
break
if(skip) continue
Expand All @@ -32,7 +32,7 @@
A.power_change()

for(var/obj/machinery/power/apc/C in GLOB.apcs_list)
if(C.cell && C.z == ZLEVEL_STATION)
if(C.cell && (C.z in GLOB.station_z_levels))
var/area/A = C.area

var/skip = 0
Expand All @@ -48,11 +48,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 == ZLEVEL_STATION)
if(C.cell && (C.z in GLOB.station_z_levels))
C.cell.charge = C.cell.maxcharge
C.failure_timer = 0
for(var/obj/machinery/power/smes/S in GLOB.machines)
if(S.z != ZLEVEL_STATION)
if(!(S.z in GLOB.station_z_levels))
continue
S.charge = S.capacity
S.output_level = S.output_level_max
Expand All @@ -70,7 +70,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 != ZLEVEL_STATION)
if(!(S.z in GLOB.station_z_levels))
continue
S.charge = S.capacity
S.output_level = S.output_level_max
Expand Down
2 changes: 1 addition & 1 deletion code/game/gamemodes/game_mode.dm
Expand Up @@ -488,7 +488,7 @@
text += " <span class='boldannounce'>died</span>"
else
text += " <span class='greenannounce'>survived</span>"
if(fleecheck && ply.current.z > ZLEVEL_STATION)
if(fleecheck && (!(ply.current.z in GLOB.station_z_levels)))
text += " while <span class='boldannounce'>fleeing the station</span>"
if(ply.current.real_name != ply.name)
text += " as <b>[ply.current.real_name]</b>"
Expand Down

0 comments on commit 10a3238

Please sign in to comment.