diff --git a/_maps/__MAP_DEFINES.dm b/_maps/__MAP_DEFINES.dm
new file mode 100644
index 00000000000..be9889b91e7
--- /dev/null
+++ b/_maps/__MAP_DEFINES.dm
@@ -0,0 +1,13 @@
+ #define CROSSLINKED 2
+ #define SELFLOOPING 1
+ #define UNAFFECTED 0
+ #define MAIN_STATION "Main Station"
+ #define CENTCOMM "CentComm"
+ #define TELECOMMS "Telecomms Satellite"
+ #define DERELICT "Derelicted Station"
+ #define MINING "Mining Asteroid"
+ #define CONSTRUCTION "Construction Area"
+ #define EMPTY_AREA "Empty Area"
+ #define EMPTY_AREA_2 "Empty Area 2"
+ #define AWAY_MISSION "Away Mission"
+ #define AWAY_MISSION_LIST list(AWAY_MISSION = UNAFFECTED)
diff --git a/_maps/cyberiad.dm b/_maps/cyberiad.dm
index 98ba7cf21f2..a2f78f9d26c 100644
--- a/_maps/cyberiad.dm
+++ b/_maps/cyberiad.dm
@@ -24,9 +24,10 @@ z7 = empty
#define MAP_FILE "cyberiad.dmm"
#define MAP_NAME "NSS Cyberiad"
+ #define MAP_TRANSITION_CONFIG list(MAIN_STATION = CROSSLINKED, CENTCOMM = SELFLOOPING, TELECOMMS = CROSSLINKED, CONSTRUCTION = CROSSLINKED, MINING = CROSSLINKED, DERELICT = CROSSLINKED, EMPTY_AREA = CROSSLINKED)
#elif !defined(MAP_OVERRIDE)
#warn a map has already been included, ignoring Cyberiad.
-#endif
\ No newline at end of file
+#endif
diff --git a/_maps/metastation.dm b/_maps/metastation.dm
index 3cbc8cdc16d..2010b25d501 100644
--- a/_maps/metastation.dm
+++ b/_maps/metastation.dm
@@ -25,9 +25,10 @@ z7 = empty space
#define MAP_FILE "MetaStation.v41A.II.dmm"
#define MAP_NAME "MetaStation"
+ #define MAP_TRANSITION_CONFIG list(MAIN_STATION = CROSSLINKED, CENTCOMM = SELFLOOPING, TELECOMMS = CROSSLINKED, DERELICT = CROSSLINKED, MINING = CROSSLINKED, EMPTY_AREA = CROSSLINKED, EMPTY_AREA_2 = CROSSLINKED)
#elif !defined(MAP_OVERRIDE)
#warn a map has already been included, ignoring MetaStation.
-#endif
\ No newline at end of file
+#endif
diff --git a/_maps/test_away_missions.dm b/_maps/test_away_missions.dm
index 59ca6167d68..e5c1f0d192e 100644
--- a/_maps/test_away_missions.dm
+++ b/_maps/test_away_missions.dm
@@ -10,12 +10,13 @@
#include "map_files\RandomZLevels\spacehotel.dmm"
#include "map_files\RandomZLevels\stationCollision.dmm"
#include "map_files\RandomZLevels\wildwest.dmm"
-
+
#include "map_files\RandomZLevels\evil_santa.dmm"
#define MAP_FILE "beach.dmm"
#define MAP_NAME "Away Missions Test"
+ #define MAP_TRANSITION_CONFIG list(AWAY_MISSION = UNAFFECTED, AWAY_MISSION = UNAFFECTED, AWAY_MISSION = UNAFFECTED, AWAY_MISSION = UNAFFECTED, AWAY_MISSION = UNAFFECTED, AWAY_MISSION = UNAFFECTED, AWAY_MISSION = UNAFFECTED, AWAY_MISSION = UNAFFECTED, AWAY_MISSION = UNAFFECTED, AWAY_MISSION = UNAFFECTED)
#elif !defined(MAP_OVERRIDE)
#warn a map has already been included.
-#endif
\ No newline at end of file
+#endif
diff --git a/code/__DEFINES/zlevel.dm b/code/__DEFINES/zlevel.dm
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/code/_globalvars/mapping.dm b/code/_globalvars/mapping.dm
index 891dbc05b24..2324bf85077 100644
--- a/code/_globalvars/mapping.dm
+++ b/code/_globalvars/mapping.dm
@@ -12,7 +12,8 @@ var/list/diagonals = list(NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST)
//Was list("3" = 30, "4" = 70).
//Spacing should be a reliable method of getting rid of a body -- Urist.
//Go away Urist, I'm restoring this to the longer list. ~Errorage
-var/list/accessable_z_levels = list(1,3,4,5,6,7) //Keep this to six maps, repeating z-levels is okay if needed
+// TODO: Tie into space manager
+var/list/accessable_z_levels = list(ZLEVEL_STATION,ZLEVEL_TELECOMMS,ZLEVEL_ENGI,ZLEVEL_ASTEROID,ZLEVEL_DERELICT,ZLEVEL_EMPTY) //Keep this to six maps, repeating z-levels is okay if needed
var/global/list/global_map = null
//list/global_map = list(list(1,5),list(4,3))//an array of map Z levels.
@@ -25,7 +26,8 @@ var/global/list/global_map = null
//3 - AI satellite
//5 - empty space
-var/shuttle_z = 2 //default
+// TODO: Tie into space manager
+var/shuttle_z = ZLEVEL_CENTCOMM //default
var/list/monkeystart = list()
var/list/wizardstart = list()
diff --git a/code/controllers/Processes/shuttles.dm b/code/controllers/Processes/shuttles.dm
index e92def92224..9c20d612247 100644
--- a/code/controllers/Processes/shuttles.dm
+++ b/code/controllers/Processes/shuttles.dm
@@ -164,6 +164,7 @@ var/const/CALL_SHUTTLE_REASON_LENGTH = 12
continue
var/turf/T = get_turf(thing)
+ // TODO: Tie into space manager
if(T && T.z == ZLEVEL_STATION)
callShuttle = 0
break
@@ -209,6 +210,7 @@ var/const/CALL_SHUTTLE_REASON_LENGTH = 12
if(!M.roundstart_move)
continue
for(var/obj/docking_port/stationary/S in stationary)
+ // TODO: Tie into space manager
if(S.z != ZLEVEL_STATION && findtext(S.id, M.id))
S.width = M.width
S.height = M.height
diff --git a/code/controllers/Processes/weather.dm b/code/controllers/Processes/weather.dm
index 999c6c51dc5..df9ee95369b 100644
--- a/code/controllers/Processes/weather.dm
+++ b/code/controllers/Processes/weather.dm
@@ -1,3 +1,4 @@
+// TODO: Tie into space manager
//Used for all kinds of weather, ex. lavaland ash storms.
var/global/datum/controller/process/weather/weather_master
diff --git a/code/controllers/master_controller.dm b/code/controllers/master_controller.dm
index c3c0ea77ddb..6ebb4d36340 100644
--- a/code/controllers/master_controller.dm
+++ b/code/controllers/master_controller.dm
@@ -41,13 +41,25 @@ var/global/pipe_processing_killed = 0
/datum/controller/game_controller/proc/setup()
world.tick_lag = config.Ticklag
- zlevels.initialize()
-
preloadTemplates()
if(!config.disable_away_missions)
createRandomZlevel()
+ // Create 6 extra space levels to put space ruins on
if(!config.disable_space_ruins)
- seedRuins(7, rand(0, 3), /area/space, space_ruins_templates)
+ var/timer = start_watch()
+ log_startup_progress("Creating random space levels...")
+ seedRuins(ZLEVEL_EMPTY, rand(0, 3), /area/space, space_ruins_templates)
+ log_startup_progress("Loaded random space levels in [stop_watch(timer)]s.")
+
+ // We'll keep this around for the time when we finally expunge all
+ // code that checks on hard-defined z positions
+
+ // var/num_extra_space = 6
+ // for(var/i = 1, i <= num_extra_space, i++)
+ // var/zlev = space_manager.add_new_zlevel("[EMPTY_AREA] #[i]", linkage = CROSSLINKED)
+ // seedRuins(zlev, rand(0, 3), /area/space, space_ruins_templates)
+
+ space_manager.do_transition_setup()
setup_objects()
setupgenetics()
diff --git a/code/datums/cache/air_alarm.dm b/code/datums/cache/air_alarm.dm
index 83b2e8246e5..67de7f95f21 100644
--- a/code/datums/cache/air_alarm.dm
+++ b/code/datums/cache/air_alarm.dm
@@ -2,7 +2,7 @@ var/global/datum/repository/air_alarm/air_alarm_repository = new()
/datum/repository/air_alarm/proc/air_alarm_data(var/list/monitored_alarms, var/refresh = 0, var/obj/machinery/alarm/passed_alarm)
var/alarms[0]
-
+
var/datum/cache_entry/cache_entry = cache_data
if(!cache_entry)
cache_entry = new/datum/cache_entry
@@ -15,13 +15,14 @@ var/global/datum/repository/air_alarm/air_alarm_repository = new()
alarms[++alarms.len] = passed_alarm.get_nano_data_console()
else
for(var/obj/machinery/alarm/alarm in (monitored_alarms ? monitored_alarms : air_alarms))
+ // TODO: Tie into space manager
if(!monitored_alarms && alarm.z != ZLEVEL_STATION && alarm.z != ZLEVEL_ASTEROID)
continue
alarms[++alarms.len] = alarm.get_nano_data_console()
-
+
cache_entry.timestamp = world.time //+ 10 SECONDS
- cache_entry.data = alarms
+ cache_entry.data = alarms
return alarms
/datum/repository/air_alarm/proc/update_cache(var/obj/machinery/alarm/alarm)
- return air_alarm_data(refresh = 1, passed_alarm = alarm)
\ No newline at end of file
+ return air_alarm_data(refresh = 1, passed_alarm = alarm)
diff --git a/code/datums/diseases/advance/advance.dm b/code/datums/diseases/advance/advance.dm
index 4bef4896cc8..b97ce1f5c7f 100644
--- a/code/datums/diseases/advance/advance.dm
+++ b/code/datums/diseases/advance/advance.dm
@@ -406,7 +406,8 @@ var/list/advance_cures = list(
AD.Refresh()
for(var/mob/living/carbon/human/H in shuffle(living_mob_list))
- if(H.z != 1)
+ // TODO: Tie into space manager
+ if(H.z != ZLEVEL_STATION)
continue
if(!H.HasDisease(D))
H.ForceContractDisease(D)
diff --git a/code/datums/helper_datums/map_template.dm b/code/datums/helper_datums/map_template.dm
index 03fe8602281..8b61be7d12b 100644
--- a/code/datums/helper_datums/map_template.dm
+++ b/code/datums/helper_datums/map_template.dm
@@ -48,7 +48,7 @@
// This system will metaphorically snap in half (not postpone init everywhere)
// if given a multi-z template
// it might need to be adapted for that when that time comes
- zlevels.add_dirt(placement.z)
+ space_manager.add_dirt(placement.z)
var/list/bounds = maploader.load_map(get_file(), min_x, min_y, placement.z, cropMap = 1)
if(!bounds)
return 0
@@ -65,7 +65,7 @@
late_setup_level(
block(bot_left, top_right),
block(ST_bot_left, ST_top_right))
- zlevels.remove_dirt(placement.z)
+ space_manager.remove_dirt(placement.z)
log_game("[name] loaded at [min_x],[min_y],[placement.z]")
return 1
diff --git a/code/datums/spell.dm b/code/datums/spell.dm
index c7aa3dfd9a0..63b9405f73e 100644
--- a/code/datums/spell.dm
+++ b/code/datums/spell.dm
@@ -67,6 +67,7 @@ var/list/spells = typesof(/obj/effect/proc_holder/spell) //needed for the badmin
caster.reset_view(0)
return 0
+ // TODO: Tie into space manager
if(user.z == ZLEVEL_CENTCOMM && !centcom_cancast) //Certain spells are not allowed on the centcom zlevel
return 0
if(user.z == ZLEVEL_CENTCOMM && ticker.mode.name == "ragin' mages")
@@ -363,6 +364,7 @@ var/list/spells = typesof(/obj/effect/proc_holder/spell) //needed for the badmin
if(((!user.mind) || !(src in user.mind.spell_list)) && !(src in user.mob_spell_list))
return 0
+ // TODO: Tie into space manager
if(user.z == ZLEVEL_CENTCOMM && !centcom_cancast) //Certain spells are not allowed on the centcom zlevel
return 0
if(user.z == ZLEVEL_CENTCOMM && ticker.mode.name == "ragin' mages")
@@ -400,4 +402,4 @@ var/list/spells = typesof(/obj/effect/proc_holder/spell) //needed for the badmin
return 0
if(isbrain(user) || ispAI(user))
return 0
- return 1
\ No newline at end of file
+ return 1
diff --git a/code/datums/weather/weather_types.dm b/code/datums/weather/weather_types.dm
index 07735e85968..bf942b7ceba 100644
--- a/code/datums/weather/weather_types.dm
+++ b/code/datums/weather/weather_types.dm
@@ -1,4 +1,5 @@
//Different types of weather.
+// TODO: Tie into space manager
/datum/weather/floor_is_lava //The Floor is Lava: Makes all turfs damage anyone on them unless they're standing on a solid object.
name = "the floor is lava"
diff --git a/code/defines/procs/radio.dm b/code/defines/procs/radio.dm
index b13cfe9ca05..b78345b0638 100644
--- a/code/defines/procs/radio.dm
+++ b/code/defines/procs/radio.dm
@@ -47,6 +47,7 @@
/proc/get_receiver_reception(var/receiver, var/datum/signal/signal)
if(receiver && check_signal(signal))
var/turf/pos = get_turf(receiver)
+ // Maybe should get tie-in to the space manager?
if(pos && (pos.z in signal.data["level"]))
return TELECOMMS_RECEPTION_RECEIVER
return TELECOMMS_RECEPTION_NONE
diff --git a/code/game/area/Space Station 13 areas.dm b/code/game/area/Space Station 13 areas.dm
index 3992f97fd0b..07ad5956002 100644
--- a/code/game/area/Space Station 13 areas.dm
+++ b/code/game/area/Space Station 13 areas.dm
@@ -67,6 +67,7 @@ var/list/teleportlocs = list()
if(AR.no_teleportlocs) continue
if(teleportlocs.Find(AR.name)) continue
var/turf/picked = safepick(get_area_turfs(AR.type))
+ // TODO: Tie into space manager
if(picked && (picked.z == ZLEVEL_STATION))
teleportlocs += AR.name
teleportlocs[AR.name] = AR
@@ -2632,4 +2633,3 @@ var/list/the_station_areas = list (
/area/turret_protected/ai_upload_foyer,
/area/turret_protected/ai,
)
-
diff --git a/code/game/area/areas.dm b/code/game/area/areas.dm
index 43540f347de..5963d461daf 100644
--- a/code/game/area/areas.dm
+++ b/code/game/area/areas.dm
@@ -376,6 +376,7 @@
return 1
else
// There's a gravity generator on our z level
+ // This would do well when integrated with the z level manager
if(T && gravity_generators["[T.z]"] && length(gravity_generators["[T.z]"]))
return 1
return 0
diff --git a/code/game/atoms.dm b/code/game/atoms.dm
index 7e5c26b52e5..e4332ac78c0 100644
--- a/code/game/atoms.dm
+++ b/code/game/atoms.dm
@@ -41,6 +41,7 @@
if(!T)
return 0
+ // TODO: Tie into space manager
if(T.z != ZLEVEL_CENTCOMM)//if not, don't bother
return 0
@@ -58,6 +59,7 @@
if(!T)
return 0
+ // TODO: Tie into space manager
if(T.z != ZLEVEL_CENTCOMM)//if not, don't bother
return 0
diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm
index cb612eec455..a903e4ea8ed 100644
--- a/code/game/atoms_movable.dm
+++ b/code/game/atoms_movable.dm
@@ -44,8 +44,8 @@
// at which point object creations are a fair toss more seldom
/atom/movable/proc/attempt_init()
var/turf/T = get_turf(src)
- if(T && zlevels.is_zlevel_dirty(T.z))
- zlevels.postpone_init(T.z, src)
+ if(T && space_manager.is_zlevel_dirty(T.z))
+ space_manager.postpone_init(T.z, src)
else if(auto_init)
initialize()
diff --git a/code/game/gamemodes/antag_spawner.dm b/code/game/gamemodes/antag_spawner.dm
index 1dc7985d648..7d9aed3d442 100644
--- a/code/game/gamemodes/antag_spawner.dm
+++ b/code/game/gamemodes/antag_spawner.dm
@@ -80,6 +80,7 @@
var/mob/living/demon_type = /mob/living/simple_animal/slaughter
/obj/item/weapon/antag_spawner/slaughter_demon/attack_self(mob/user as mob)
+ // TODO: Tie into space manager
if(user.z == ZLEVEL_CENTCOMM)//this is to make sure the wizard does NOT summon a demon from the Den..
to_chat(user, "You should probably wait until you reach the station.")
return
@@ -135,4 +136,4 @@
veil_msg = "You sense an adorable presence \
lurking just beyond the veil..."
objective_verb = "Hug and Tickle"
- demon_type = /mob/living/simple_animal/slaughter/laughter
\ No newline at end of file
+ demon_type = /mob/living/simple_animal/slaughter/laughter
diff --git a/code/game/gamemodes/blob/blob.dm b/code/game/gamemodes/blob/blob.dm
index 35b469258ef..ebab12dc0f2 100644
--- a/code/game/gamemodes/blob/blob.dm
+++ b/code/game/gamemodes/blob/blob.dm
@@ -118,6 +118,7 @@ var/list/blob_nodes = list()
if(directory[ckey(blob.key)])
blob_client = directory[ckey(blob.key)]
location = get_turf(C)
+ // TODO: Tie into space manager
if(location.z != ZLEVEL_STATION || istype(location, /turf/space))
if(!warned)
to_chat(C, "You feel ready to burst, but this isn't an appropriate place! You must return to the station!")
diff --git a/code/game/gamemodes/blob/blob_report.dm b/code/game/gamemodes/blob/blob_report.dm
index c6d3bd13e0f..e74a0677942 100644
--- a/code/game/gamemodes/blob/blob_report.dm
+++ b/code/game/gamemodes/blob/blob_report.dm
@@ -23,6 +23,7 @@
var/nukecode = rand(10000, 99999)
for(var/obj/machinery/nuclearbomb/bomb in world)
if(bomb && bomb.r_code)
+ // TODO: Tie into space manager
if(bomb.z == ZLEVEL_STATION)
bomb.r_code = nukecode
diff --git a/code/game/gamemodes/cult/runes.dm b/code/game/gamemodes/cult/runes.dm
index 7ad1e33b747..dc12c64fbed 100644
--- a/code/game/gamemodes/cult/runes.dm
+++ b/code/game/gamemodes/cult/runes.dm
@@ -14,7 +14,8 @@ var/list/sacrificed = list()
for(var/obj/effect/rune/R in world)
if(R == src)
continue
- if(R.word1 == cultwords["travel"] && R.word2 == cultwords["self"] && R.word3 == key && R.z != 2)
+ // TODO: Tie into space manager
+ if(R.word1 == cultwords["travel"] && R.word2 == cultwords["self"] && R.word3 == key && R.z != ZLEVEL_CENTCOMM)
index++
allrunesloc.len = index
allrunesloc[index] = R.loc
diff --git a/code/game/gamemodes/events.dm b/code/game/gamemodes/events.dm
index fd384e61d1f..123ca75a78a 100644
--- a/code/game/gamemodes/events.dm
+++ b/code/game/gamemodes/events.dm
@@ -2,6 +2,7 @@
//command_announcement.Announce("Unidentified lifesigns detected coming aboard [station_name()]. Secure any exterior access, including ducting and ventilation.", "Lifesign Alert", new_sound = 'sound/AI/aliens.ogg')
var/list/vents = list()
for(var/obj/machinery/atmospherics/unary/vent_pump/temp_vent in machines)
+ // TODO: Tie into space manager
if((temp_vent.loc.z in config.station_levels) && !temp_vent.welded)
if(temp_vent.parent.other_atmosmch.len > 50) // Stops Aliens getting stuck in small networks. See: Security, Virology
vents += temp_vent
diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm
index 7d2ae88fe2a..77f503a1db2 100644
--- a/code/game/gamemodes/game_mode.dm
+++ b/code/game/gamemodes/game_mode.dm
@@ -427,6 +427,7 @@ proc/get_nt_opposed()
/proc/get_nuke_code()
var/nukecode = "ERROR"
for(var/obj/machinery/nuclearbomb/bomb in world)
+ // TODO: Tie into space manager
if(bomb && bomb.r_code && bomb.z == ZLEVEL_STATION)
nukecode = bomb.r_code
return nukecode
@@ -452,6 +453,7 @@ proc/get_nt_opposed()
else
text += " survived"
if(fleecheck && ply.current.z > ZLEVEL_STATION)
+ // TODO: Tie into space manager
text += " while fleeing the station"
if(ply.current.real_name != ply.name)
text += " as [ply.current.real_name]"
@@ -468,4 +470,4 @@ proc/get_nt_opposed()
else
text += "
Objective #[count]: [objective.explanation_text] Fail."
count++
- return text
\ No newline at end of file
+ return text
diff --git a/code/game/gamemodes/gameticker.dm b/code/game/gamemodes/gameticker.dm
index 7d6ea9b4e7d..4fd8c5a452b 100644
--- a/code/game/gamemodes/gameticker.dm
+++ b/code/game/gamemodes/gameticker.dm
@@ -266,7 +266,8 @@ var/round_start_time = 0
M.client.screen += cinematic
if(M.stat != DEAD)
var/turf/T = get_turf(M)
- if(T && T.z == 1)
+ // TODO: Tie into space manager
+ if(T && T.z == ZLEVEL_STATION)
M.death(0) //no mercy
//Now animate the cinematic
diff --git a/code/game/gamemodes/malfunction/Malf_Modules.dm b/code/game/gamemodes/malfunction/Malf_Modules.dm
index c6b65472c2e..40d78c131ae 100644
--- a/code/game/gamemodes/malfunction/Malf_Modules.dm
+++ b/code/game/gamemodes/malfunction/Malf_Modules.dm
@@ -69,6 +69,7 @@ rcd light flash thingy on matter drain
src.verbs -= /mob/living/silicon/ai/proc/upgrade_turrets
for(var/obj/machinery/porta_turret/turret in machines)
var/turf/T = get_turf(turret)
+ // TODO: Tie into space manager
if(T.z in config.station_levels)
// Increase health by 37.5% of original max, decrease delays between shots to 66%
turret.health += initial(turret.health) * 3 / 8
diff --git a/code/game/gamemodes/malfunction/malfunction.dm b/code/game/gamemodes/malfunction/malfunction.dm
index 77c45956eb4..fb85a0a1606 100644
--- a/code/game/gamemodes/malfunction/malfunction.dm
+++ b/code/game/gamemodes/malfunction/malfunction.dm
@@ -141,6 +141,7 @@
/datum/game_mode/proc/check_ai_loc()
for(var/datum/mind/AI_mind in malf_ai)
var/turf/ai_location = get_turf(AI_mind.current)
+ // TODO: Tie into space manager
if(ai_location && (ai_location.z == ZLEVEL_STATION))
return 1
return 0
@@ -343,4 +344,4 @@
text += module_text_temp
to_chat(world, text)
- return 1
\ No newline at end of file
+ return 1
diff --git a/code/game/gamemodes/meteor/meteors.dm b/code/game/gamemodes/meteor/meteors.dm
index 2f7af290229..a2ff0f4e1d8 100644
--- a/code/game/gamemodes/meteor/meteors.dm
+++ b/code/game/gamemodes/meteor/meteors.dm
@@ -36,7 +36,8 @@
var/Me = pickweight(meteortypes)
var/obj/effect/meteor/M = new Me(pickedstart)
M.dest = pickedgoal
- M.z_original = 1
+ // TODO: Tie into space manager
+ M.z_original = ZLEVEL_STATION
spawn(0)
walk_towards(M, M.dest, 1)
return
@@ -102,6 +103,7 @@
var/dropamt = 2
/obj/effect/meteor/Move()
+ // TODO: Tie into space manager
if(z != z_original || loc == dest)
qdel(src)
return
@@ -309,5 +311,3 @@
/obj/effect/meteor/goreops/Bump(atom/A)
A.ex_act(hitpwr)
get_hit()
-
-
diff --git a/code/game/gamemodes/miniantags/borer/borer_event.dm b/code/game/gamemodes/miniantags/borer/borer_event.dm
index ed096526d10..28a0282487d 100644
--- a/code/game/gamemodes/miniantags/borer/borer_event.dm
+++ b/code/game/gamemodes/miniantags/borer/borer_event.dm
@@ -17,6 +17,7 @@
/datum/event/borer_infestation/start()
var/list/vents = list()
for(var/obj/machinery/atmospherics/unary/vent_pump/temp_vent in world)
+ // TODO: Tie into space manager
if((temp_vent.loc.z in config.station_levels) && !temp_vent.welded)
//Stops cortical borers getting stuck in small networks. See: Security, Virology
if(temp_vent.parent.other_atmosmch.len > 50)
@@ -33,4 +34,3 @@
spawncount--
successSpawn = 1
-
diff --git a/code/game/gamemodes/miniantags/bot_swarm/swarmer.dm b/code/game/gamemodes/miniantags/bot_swarm/swarmer.dm
index d5541f70e0d..ed84f211e53 100644
--- a/code/game/gamemodes/miniantags/bot_swarm/swarmer.dm
+++ b/code/game/gamemodes/miniantags/bot_swarm/swarmer.dm
@@ -290,6 +290,7 @@
/mob/living/simple_animal/hostile/swarmer/proc/DisperseTarget(var/mob/living/target)
if(target != src)
to_chat(src, "Attempting to remove this being from our presence.")
+ // TODO: Tie into space manager
if(src.z != ZLEVEL_STATION)
to_chat(src, "Our bluespace transceiver cannot locate a viable bluespace link, our teleportation abilities are useless in this area.")
return
@@ -512,4 +513,3 @@
for(var/mob/M in mob_list)
if(isswarmer(M) || (M in dead_mob_list))
to_chat(M, "Swarm communication - [src] states: [message]")
-
diff --git a/code/game/gamemodes/nations/nations.dm b/code/game/gamemodes/nations/nations.dm
index ca867028585..5f729e4484e 100644
--- a/code/game/gamemodes/nations/nations.dm
+++ b/code/game/gamemodes/nations/nations.dm
@@ -142,6 +142,7 @@ datum/game_mode/nations
/datum/game_mode/nations/proc/remove_access()
for(var/obj/machinery/door/airlock/W in airlocks)
+ // TODO: Tie into space manager
if(W.z in config.station_levels)
W.req_access = list()
@@ -253,4 +254,4 @@ datum/game_mode/nations
/datum/game_mode/proc/update_nations_icons_removed(datum/mind/nations_mind)
var/datum/atom_hud/antag/nations_hud = huds[GAME_HUD_NATIONS]
nations_hud.leave_hud(nations_mind)
- set_nations_hud(nations_mind, null)
\ No newline at end of file
+ set_nations_hud(nations_mind, null)
diff --git a/code/game/gamemodes/newobjective.dm b/code/game/gamemodes/newobjective.dm
index a70074a919e..ef0edffd5f8 100644
--- a/code/game/gamemodes/newobjective.dm
+++ b/code/game/gamemodes/newobjective.dm
@@ -651,7 +651,7 @@ datum
return 10
else
return 20
-
+
/*burger
steal_target = /obj/item/weapon/reagent_containers/food/snacks/human/burger
@@ -1358,6 +1358,7 @@ datum
var/turf/T = get_turf(target.current)
if(target.current.stat == 2)
return 1
+ // TODO: Tie into space manager
else if((T) && !(T.z in config.station_levels))//If they leave the station they count as dead for this
return 2
else
@@ -1413,4 +1414,4 @@ datum/objective/silence
#undef LENIENT
#undef NORMAL
#undef HARD
-#undef IMPOSSIBLE
\ No newline at end of file
+#undef IMPOSSIBLE
diff --git a/code/game/gamemodes/nuclear/nuclear_challenge.dm b/code/game/gamemodes/nuclear/nuclear_challenge.dm
index c11b43f81ec..15a4c8ec246 100644
--- a/code/game/gamemodes/nuclear/nuclear_challenge.dm
+++ b/code/game/gamemodes/nuclear/nuclear_challenge.dm
@@ -19,6 +19,7 @@
if(player_list.len < MIN_CHALLENGE_PLAYERS)
to_chat(user, "The enemy crew is too small to be worth declaring war on.")
return
+ // TODO: Tie into space manager
if(user.z != ZLEVEL_CENTCOMM)
to_chat(user, "You have to be at your base to use this.")
return
diff --git a/code/game/gamemodes/nuclear/nuclearbomb.dm b/code/game/gamemodes/nuclear/nuclearbomb.dm
index 18791cd15f0..ae22e0ec458 100644
--- a/code/game/gamemodes/nuclear/nuclearbomb.dm
+++ b/code/game/gamemodes/nuclear/nuclearbomb.dm
@@ -353,6 +353,7 @@ var/bomb_set
var/off_station = 0
var/turf/bomb_location = get_turf(src)
+ // TODO: Tie into space manager
if( bomb_location && (bomb_location.z in config.station_levels) )
if( (bomb_location.x < (128-NUKERANGE)) || (bomb_location.x > (128+NUKERANGE)) || (bomb_location.y < (128-NUKERANGE)) || (bomb_location.y > (128+NUKERANGE)) )
off_station = 1
@@ -363,7 +364,8 @@ var/bomb_set
if(ticker.mode && ticker.mode.name == "nuclear emergency")
var/obj/docking_port/mobile/syndie_shuttle = shuttle_master.getShuttle("syndicate")
if(syndie_shuttle)
- ticker.mode:syndies_didnt_escape = (syndie_shuttle.z > 1 ? 0 : 1) //muskets will make me change this, but it will do for now
+ // TODO: Tie into space manager
+ ticker.mode:syndies_didnt_escape = (syndie_shuttle.z > ZLEVEL_STATION ? 0 : 1) //muskets will make me change this, but it will do for now
ticker.mode:nuke_off_station = off_station
ticker.station_explosion_cinematic(off_station,null)
if(ticker.mode)
@@ -401,6 +403,7 @@ var/bomb_set
/obj/item/weapon/disk/nuclear/process()
var/turf/disk_loc = get_turf(src)
+ // TODO: Tie into space manager
if(disk_loc.z != ZLEVEL_STATION && disk_loc.z != ZLEVEL_CENTCOMM)
var/holder = get(src, /mob)
if(holder)
diff --git a/code/game/gamemodes/objective.dm b/code/game/gamemodes/objective.dm
index 825e1183529..b6b1094b103 100644
--- a/code/game/gamemodes/objective.dm
+++ b/code/game/gamemodes/objective.dm
@@ -77,7 +77,8 @@ var/list/potential_theft_objectives=subtypesof(/datum/theft_objective) \
check_completion()
if(target && target.current)
- if(target.current.stat == DEAD || issilicon(target.current) || isbrain(target.current) || target.current.z > 6 || !target.current.ckey) //Borgs/brains/AIs count as dead for traitor objectives. --NeoFite
+ // TODO: Tie into space manager
+ if(target.current.stat == DEAD || issilicon(target.current) || isbrain(target.current) || target.current.z > ZLEVEL_DERELICT || !target.current.ckey) //Borgs/brains/AIs count as dead for traitor objectives. --NeoFite
return 1
return 0
return 1
@@ -109,6 +110,7 @@ var/list/potential_theft_objectives=subtypesof(/datum/theft_objective) \
if(target.current.stat == DEAD || !ishuman(target.current) || !target.current.ckey || !target.current.client)
return 1
var/turf/T = get_turf(target.current)
+ // TODO: Tie into space manager
if(T && !(T.z in config.station_levels)) //If they leave the station they count as dead for this
return 2
return 0
@@ -144,6 +146,7 @@ var/list/potential_theft_objectives=subtypesof(/datum/theft_objective) \
if(target in ticker.mode:head_revolutionaries)
return 1
var/turf/T = get_turf(target.current)
+ // TODO: Tie into space manager
if(T && !(T.z in config.station_levels)) //If they leave the station they count as dead for this
rval = 2
return 0
@@ -170,8 +173,10 @@ var/list/potential_theft_objectives=subtypesof(/datum/theft_objective) \
check_completion()
if(target && target.current)
- if(target.current.stat == DEAD || issilicon(target.current) || isbrain(target.current) || target.current.z > 6 || !target.current.ckey) //Borgs/brains/AIs count as dead for traitor objectives. --NeoFite
+ // TODO: Tie into space manager
+ if(target.current.stat == DEAD || issilicon(target.current) || isbrain(target.current) || target.current.z > ZLEVEL_DERELICT || !target.current.ckey) //Borgs/brains/AIs count as dead for traitor objectives. --NeoFite
return 1
+ // TODO: Tie into space manager
if((target.current.z in config.admin_levels))
return 0
return 1
@@ -572,7 +577,8 @@ var/list/potential_theft_objectives=subtypesof(/datum/theft_objective) \
check_completion()
if(target && target.current)
- if(target.current.stat == DEAD || target.current.z > 6 || !target.current.ckey)
+ // TODO: Tie into space manager
+ if(target.current.stat == DEAD || target.current.z > ZLEVEL_DERELICT || !target.current.ckey)
return 1
return 0
return 1
@@ -861,4 +867,4 @@ var/list/potential_theft_objectives=subtypesof(/datum/theft_objective) \
/datum/objective/wizchaos
explanation_text = "Wreak havoc upon the station as much you can. Send those wandless Nanotrasen scum a message!"
- completed = 1
\ No newline at end of file
+ completed = 1
diff --git a/code/game/gamemodes/revolution/revolution.dm b/code/game/gamemodes/revolution/revolution.dm
index b3f889377c8..9e74459dadd 100644
--- a/code/game/gamemodes/revolution/revolution.dm
+++ b/code/game/gamemodes/revolution/revolution.dm
@@ -314,6 +314,7 @@
/datum/game_mode/revolution/proc/check_heads_victory()
for(var/datum/mind/rev_mind in head_revolutionaries)
var/turf/T = get_turf(rev_mind.current)
+ // TODO: Tie into space manager
if((rev_mind) && (rev_mind.current) && (rev_mind.current.stat != 2) && rev_mind.current.client && T && (T.z == ZLEVEL_STATION))
if(ishuman(rev_mind.current))
return 0
@@ -448,4 +449,4 @@
dat += "Revolution Successful: [score_traitorswon ? "Yes" : "No"] (-[score_traitorswon * 10000] Points)
"
dat += "
"}
dat += text("New Record
", src)
diff --git a/code/game/machinery/computer/skills.dm b/code/game/machinery/computer/skills.dm
index 2f039841cc3..7c0680f26d3 100644
--- a/code/game/machinery/computer/skills.dm
+++ b/code/game/machinery/computer/skills.dm
@@ -40,7 +40,9 @@
/obj/machinery/computer/skills/attack_hand(mob/user as mob)
if(..())
return
- if(src.z > 6)
+
+ // TODO: Tie into space manager
+ if(src.z > ZLEVEL_DERELICT)
to_chat(user, "Unable to establish a connection: You're too far away from the station!")
return
var/dat
diff --git a/code/game/machinery/firealarm.dm b/code/game/machinery/firealarm.dm
index 45b515734f7..9b2e0bdf957 100644
--- a/code/game/machinery/firealarm.dm
+++ b/code/game/machinery/firealarm.dm
@@ -293,6 +293,8 @@ FIRE ALARM
pixel_x = (dir & 3)? 0 : (dir == 4 ? -24 : 24)
pixel_y = (dir & 3)? (dir ==1 ? -24 : 24) : 0
+ // TODO: Tie into space manager
+ // also hwat
if(z == ZLEVEL_STATION || ZLEVEL_ASTEROID == 5)
if(security_level)
src.overlays += image('icons/obj/monitors.dmi', "overlay_[get_security_level()]")
diff --git a/code/game/machinery/supply_display.dm b/code/game/machinery/supply_display.dm
index 3b55d8423f7..caf0c9c67d9 100644
--- a/code/game/machinery/supply_display.dm
+++ b/code/game/machinery/supply_display.dm
@@ -5,6 +5,7 @@
/obj/machinery/status_display/supply_display/update()
if(!..() && mode == STATUS_DISPLAY_CUSTOM)
if(shuttle_master.supply.mode == SHUTTLE_IDLE)
+ // TODO: Tie into space manager
if(shuttle_master.supply.z == ZLEVEL_STATION)
message1 = "CARGO"
message2 = "Docked"
diff --git a/code/game/machinery/telecomms/broadcaster.dm b/code/game/machinery/telecomms/broadcaster.dm
index 4d90971f003..7ddb0f4b963 100644
--- a/code/game/machinery/telecomms/broadcaster.dm
+++ b/code/game/machinery/telecomms/broadcaster.dm
@@ -439,6 +439,7 @@ var/message_delay = 0 // To make sure restarting the recentmessages list is kept
if(data == 1)
for(var/obj/item/device/radio/intercom/R in connection.devices["[RADIO_CHAT]"])
var/turf/position = get_turf(R)
+ // TODO: Tie into space manager
if(position && position.z == level)
receive |= R.send_hear(display_freq, level)
@@ -451,6 +452,7 @@ var/message_delay = 0 // To make sure restarting the recentmessages list is kept
if(istype(R, /obj/item/device/radio/headset))
continue
var/turf/position = get_turf(R)
+ // TODO: Tie into space manager
if(position && position.z == level)
receive |= R.send_hear(display_freq)
@@ -462,6 +464,7 @@ var/message_delay = 0 // To make sure restarting the recentmessages list is kept
var/datum/radio_frequency/antag_connection = radio_controller.return_frequency(freq)
for(var/obj/item/device/radio/R in antag_connection.devices["[RADIO_CHAT]"])
var/turf/position = get_turf(R)
+ // TODO: Tie into space manager
if(position && position.z == level)
receive |= R.send_hear(freq)
@@ -471,6 +474,7 @@ var/message_delay = 0 // To make sure restarting the recentmessages list is kept
else
for(var/obj/item/device/radio/R in connection.devices["[RADIO_CHAT]"])
var/turf/position = get_turf(R)
+ // TODO: Tie into space manager
if(position && position.z == level)
receive |= R.send_hear(display_freq)
@@ -597,6 +601,7 @@ var/message_delay = 0 // To make sure restarting the recentmessages list is kept
/atom/proc/test_telecomms()
var/datum/signal/signal = src.telecomms_process()
var/turf/position = get_turf(src)
+ // TODO: Tie into space manager
return (position.z in signal.data["level"]) && signal.data["done"]
/atom/proc/telecomms_process(var/do_sleep = 1)
@@ -615,6 +620,7 @@ var/message_delay = 0 // To make sure restarting the recentmessages list is kept
"type" = 4, // determines what type of radio input it is: test broadcast
"reject" = 0,
"done" = 0,
+ // TODO: Tie into space manager
"level" = pos.z // The level it is being broadcasted at.
)
signal.frequency = PUB_FREQ// Common channel
@@ -630,4 +636,3 @@ var/message_delay = 0 // To make sure restarting the recentmessages list is kept
//log_to_dd("Level: [signal.data["level"]] - Done: [signal.data["done"]]")
return signal
-
diff --git a/code/game/machinery/telecomms/machine_interactions.dm b/code/game/machinery/telecomms/machine_interactions.dm
index da9fe5a046e..0c0dfd178fe 100644
--- a/code/game/machinery/telecomms/machine_interactions.dm
+++ b/code/game/machinery/telecomms/machine_interactions.dm
@@ -180,6 +180,7 @@
var/turf/position = get_turf(src)
// Toggle on/off getting signals from the station or the current Z level
+ // TODO: Tie into space manager
if(src.listening_level == ZLEVEL_STATION) // equals the station
src.listening_level = position.z
return 1
@@ -393,4 +394,3 @@
if(issilicon(user) || in_range(user, src))
return 1
return 0
-
diff --git a/code/game/machinery/telecomms/telecomunications.dm b/code/game/machinery/telecomms/telecomunications.dm
index 787483ac45d..f4c2d973f7d 100644
--- a/code/game/machinery/telecomms/telecomunications.dm
+++ b/code/game/machinery/telecomms/telecomunications.dm
@@ -56,6 +56,7 @@ var/global/list/obj/machinery/telecomms/telecomms_list = list()
continue
if(amount && send_count >= amount)
break
+ // TODO: Tie into space manager
if(machine.loc.z != listening_level)
if(long_range_link == 0 && machine.long_range_link == 0)
continue
@@ -142,6 +143,7 @@ var/global/list/obj/machinery/telecomms/telecomms_list = list()
if(!listening_level)
//Defaults to our Z level!
var/turf/position = get_turf(src)
+ // TODO: Tie into space manager
listening_level = position.z
/obj/machinery/telecomms/initialize()
@@ -167,6 +169,7 @@ var/global/list/obj/machinery/telecomms/telecomms_list = list()
/obj/machinery/telecomms/proc/add_link(var/obj/machinery/telecomms/T)
var/turf/position = get_turf(src)
var/turf/T_position = get_turf(T)
+ // TODO: Tie into space manager
if((position.z == T_position.z) || (src.long_range_link && T.long_range_link))
for(var/x in autolinkers)
if(T.autolinkers.Find(x))
diff --git a/code/game/machinery/teleporter.dm b/code/game/machinery/teleporter.dm
index 63aeb4e25ee..6ecc675fdef 100644
--- a/code/game/machinery/teleporter.dm
+++ b/code/game/machinery/teleporter.dm
@@ -182,7 +182,8 @@
var/turf/T = get_turf(R)
if(!T)
continue
- if((T.z in config.admin_levels) || T.z > 7)
+ // TODO: Tie into space manager
+ if((T.z in config.admin_levels) || T.z > ZLEVEL_EMPTY)
continue
if(R.syndicate == 1 && emagged == 0)
continue
@@ -203,6 +204,7 @@
continue
var/turf/T = get_turf(M)
if(!T) continue
+ // TODO: Tie into space manager
if((T.z in config.admin_levels)) continue
var/tmpname = M.real_name
if(areaindex[tmpname])
@@ -225,7 +227,8 @@
var/turf/T = get_turf(R)
if(!T || !R.teleporter_hub || !R.teleporter_console)
continue
- if((T.z in config.admin_levels) || T.z > 7)
+ // TODO: Tie into space manager
+ if((T.z in config.admin_levels) || T.z > ZLEVEL_EMPTY)
continue
var/tmpname = T.loc.name
if(areaindex[tmpname])
diff --git a/code/game/mecha/equipment/tools/tools.dm b/code/game/mecha/equipment/tools/tools.dm
index bef015cb7fa..cb55c783005 100644
--- a/code/game/mecha/equipment/tools/tools.dm
+++ b/code/game/mecha/equipment/tools/tools.dm
@@ -382,6 +382,7 @@
range = RANGED
action(atom/target)
+ // TODO: Tie into space manager
if(!action_checks(target) || (src.loc.z in config.admin_levels)) return
var/turf/T = get_turf(target)
if(T)
@@ -403,6 +404,7 @@
action(atom/target)
+ // TODO: Tie into space manager
if(!action_checks(target) || (src.loc.z in config.admin_levels)) return
var/list/theareas = list()
for(var/area/AR in orange(100, chassis))
@@ -1144,4 +1146,4 @@
if(do_after_cooldown(target))
new /obj/structure/barricade/mime/mrcd(target)
chassis.spark_system.start()
- chassis.use_power(energy_drain*2)
\ No newline at end of file
+ chassis.use_power(energy_drain*2)
diff --git a/code/game/objects/items/devices/camera_bug.dm b/code/game/objects/items/devices/camera_bug.dm
index 974835b6a2d..dec4f4c75fb 100644
--- a/code/game/objects/items/devices/camera_bug.dm
+++ b/code/game/objects/items/devices/camera_bug.dm
@@ -61,6 +61,7 @@
return null
var/turf/T = get_turf(user.loc)
+ // TODO: Tie into space manager
if(T.z != current.z || !current.can_use())
to_chat(user, "[src] has lost the signal.")
current = null
@@ -225,6 +226,7 @@
to_chat(usr, "Something's wrong with that camera. You can't get a feed.")
return
var/turf/T = get_turf(loc)
+ // TODO: Tie into space manager
if(!T || C.z != T.z)
to_chat(usr, "You can't get a signal.")
return
@@ -284,4 +286,4 @@
#undef BUGMODE_LIST
#undef BUGMODE_MONITOR
-#undef BUGMODE_TRACK
\ No newline at end of file
+#undef BUGMODE_TRACK
diff --git a/code/game/objects/items/devices/radio/intercom.dm b/code/game/objects/items/devices/radio/intercom.dm
index 455a0f7098c..a8623b17f56 100644
--- a/code/game/objects/items/devices/radio/intercom.dm
+++ b/code/game/objects/items/devices/radio/intercom.dm
@@ -124,6 +124,7 @@
return -1
if(!(0 in level))
var/turf/position = get_turf(src)
+ // TODO: Tie into space manager
if(isnull(position) || !(position.z in level))
return -1
if(!src.listening)
diff --git a/code/game/objects/items/weapons/bee_briefcase.dm b/code/game/objects/items/weapons/bee_briefcase.dm
index 665ad549bd2..98f3fc1709b 100644
--- a/code/game/objects/items/weapons/bee_briefcase.dm
+++ b/code/game/objects/items/weapons/bee_briefcase.dm
@@ -64,6 +64,7 @@
//Play sound through the station intercomms, so everyone knows the doom you have wrought.
for(var/O in global_intercoms)
var/obj/item/device/radio/intercom/I = O
+ // TODO: Tie into space manager
if(I.z != ZLEVEL_STATION) //Only broadcast to the station intercoms
continue
if(!I.on) //Only broadcast to active intercoms (powered, switched on)
@@ -75,4 +76,4 @@
var/mob/living/simple_animal/hostile/poison/bees/syndi/B = new /mob/living/simple_animal/hostile/poison/bees/syndi(null)
B.master_and_friends = blood_list //Doesn't automatically add the person who opens the case, so the bees will attack the user unless they gave their blood
B.forceMove(get_turf(user)) //RELEASE THE BEES!
- bees_left -= 5
\ No newline at end of file
+ bees_left -= 5
diff --git a/code/game/objects/items/weapons/teleportation.dm b/code/game/objects/items/weapons/teleportation.dm
index 4728e8c730e..decfa424872 100644
--- a/code/game/objects/items/weapons/teleportation.dm
+++ b/code/game/objects/items/weapons/teleportation.dm
@@ -48,6 +48,7 @@ Frequency:
return 1
var/turf/current_location = get_turf(usr)//What turf is the user on?
+ // TODO: Tie into space manager
if(!current_location ||( current_location.z in config.admin_levels))//If turf was not found or they're on z level 2.
to_chat(usr, "\The [src] is malfunctioning.")
return 1
@@ -61,6 +62,7 @@ Frequency:
for(var/obj/item/device/radio/beacon/W in beacons)
if(W.frequency == frequency && !W.syndicate)
+ // TODO: Tie into space manager
if(W && W.z == z)
var/turf/TB = get_turf(W)
temp += "[W.code]: [TB.x], [TB.y], [TB.z]
"
@@ -107,7 +109,8 @@ Frequency:
/obj/item/weapon/hand_tele/attack_self(mob/user as mob)
var/turf/current_location = get_turf(user)//What turf is the user on?
- if(!current_location||(current_location.z in config.admin_levels)||current_location.z>=7)//If turf was not found or they're on z level 2 or >7 which does not currently exist.
+ // TODO: Tie into space manager
+ if(!current_location||(current_location.z in config.admin_levels)||current_location.z>=ZLEVEL_EMPTY)//If turf was not found or they're on z level 2 or >7 which does not currently exist.
to_chat(user, "\The [src] is malfunctioning.")
return
var/list/L = list( )
diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm
index de0ef28d255..4fe639160d4 100644
--- a/code/game/objects/structures/crates_lockers/closets.dm
+++ b/code/game/objects/structures/crates_lockers/closets.dm
@@ -192,6 +192,7 @@
return
var/obj/item/weapon/rcs/E = W
if(E.rcell && (E.rcell.charge >= E.chargecost))
+ // TODO: Tie into space manager
if(!(src.z in config.contact_levels))
to_chat(user, "The rapid-crate-sender can't locate any telepads!")
return
diff --git a/code/game/objects/structures/crates_lockers/crates.dm b/code/game/objects/structures/crates_lockers/crates.dm
index c4178baec15..f9b32b071f7 100644
--- a/code/game/objects/structures/crates_lockers/crates.dm
+++ b/code/game/objects/structures/crates_lockers/crates.dm
@@ -84,6 +84,7 @@
if(istype(W, /obj/item/weapon/rcs) && !src.opened)
var/obj/item/weapon/rcs/E = W
if(E.rcell && (E.rcell.charge >= E.chargecost))
+ // TODO: Tie into space manager
if(!(src.z in config.player_levels))
to_chat(user, "The rapid-crate-sender can't locate any telepads!")
return
diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm
index 6dacca13d12..8a9e8dea103 100644
--- a/code/modules/admin/topic.dm
+++ b/code/modules/admin/topic.dm
@@ -1979,6 +1979,7 @@
return
else
for(var/obj/machinery/photocopier/faxmachine/F in allfaxes)
+ // TODO: Tie into space manager
if((F.z in config.station_levels))
spawn(0)
if(!F.receivefax(P))
@@ -2326,6 +2327,7 @@
for(var/mob/living/carbon/human/H in mob_list)
var/turf/loc = find_loc(H)
var/security = 0
+ // TODO: Tie into space manager
if(!(loc.z in config.station_levels) || prisonwarped.Find(H))
//don't warp them if they aren't ready or are already there
@@ -2563,6 +2565,7 @@
feedback_inc("admin_secrets_fun_used",1)
feedback_add_details("admin_secrets_fun_used","EgL")
for(var/obj/machinery/door/airlock/W in world)
+ // TODO: Tie into space manager
if((W.z in config.station_levels) && !istype(get_area(W), /area/bridge) && !istype(get_area(W), /area/crew_quarters) && !istype(get_area(W), /area/security/prison))
W.req_access = list()
message_admins("[key_name_admin(usr)] activated Egalitarian Station mode")
diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm
index 01f6736e5ca..dd685a37a0b 100644
--- a/code/modules/admin/verbs/debug.dm
+++ b/code/modules/admin/verbs/debug.dm
@@ -373,6 +373,7 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
for(var/I in singularities)
var/obj/singularity/S = I
+ // TODO: Tie into space manager
if(S.z == ZLEVEL_CENTCOMM || S.z >= MAX_Z)
continue
qdel(S)
diff --git a/code/modules/admin/verbs/mapping.dm b/code/modules/admin/verbs/mapping.dm
index 6578898a0bd..d58e51971dd 100644
--- a/code/modules/admin/verbs/mapping.dm
+++ b/code/modules/admin/verbs/mapping.dm
@@ -139,7 +139,9 @@ var/list/admin_verbs_show_debug_verbs = list(
/client/proc/print_jobban_old_filter,
/client/proc/forceEvent,
/client/proc/nanomapgen_DumpImage,
- /client/proc/reload_nanoui_resources
+ /client/proc/reload_nanoui_resources,
+ /client/proc/admin_redo_space_transitions,
+ /client/proc/make_turf_space_map
)
/client/proc/enable_debug_verbs()
diff --git a/code/modules/admin/verbs/playsound.dm b/code/modules/admin/verbs/playsound.dm
index 47c7da15724..660a1c8f199 100644
--- a/code/modules/admin/verbs/playsound.dm
+++ b/code/modules/admin/verbs/playsound.dm
@@ -81,6 +81,7 @@ var/list/sounds_cache = list()
for(var/O in global_intercoms)
var/obj/item/device/radio/intercom/I = O
+ // TODO: Tie into space manager
if(I.z != ZLEVEL_STATION && !ignore_z)
continue
if(!I.on && !ignore_power)
diff --git a/code/modules/admin/verbs/space_transitions.dm b/code/modules/admin/verbs/space_transitions.dm
new file mode 100644
index 00000000000..eda17996c65
--- /dev/null
+++ b/code/modules/admin/verbs/space_transitions.dm
@@ -0,0 +1,41 @@
+/client/proc/admin_redo_space_transitions()
+ set name = "Remake Space Transitions"
+ set desc = "Re-assigns all space transitions"
+ set category = "Debug"
+
+ if(!check_rights(R_ADMIN|R_DEBUG))
+ return
+
+ var/choice = alert("Do you want to rebuild space transitions?",,"Yes", "No")
+
+ if(choice == "No")
+ return
+
+
+ message_admins("[key_name_admin(usr)] re-assigned all space transitions")
+ space_manager.do_transition_setup()
+ log_admin("[key_name(usr)] re-assigned all space transitions")
+
+ feedback_add_details("admin_verb","SPCRST") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
+
+
+
+
+/client/proc/make_turf_space_map()
+ set name = "Make Space Map"
+ set desc = "Create a map of the space levels as turfs at your feet"
+ set category = "Debug"
+
+ if(!check_rights(R_ADMIN|R_DEBUG))
+ return
+
+ var/choice = alert("Are you sure you want to make a space map out of turfs?",,"Yes","No")
+
+ if(choice == "No")
+ return
+
+ message_admins("[key_name_admin(usr)] made a space map")
+
+
+ space_manager.map_as_turfs(get_turf(usr))
+ log_admin("[key_name(usr)] made a space map")
diff --git a/code/modules/awaymissions/maploader/reader.dm b/code/modules/awaymissions/maploader/reader.dm
index fcfd8d2e600..ea59dd1d518 100644
--- a/code/modules/awaymissions/maploader/reader.dm
+++ b/code/modules/awaymissions/maploader/reader.dm
@@ -96,7 +96,7 @@ var/global/dmm_suite/preloader/_preloader = new
if(cropMap)
continue
else
- zlevels.increase_max_zlevel_to(zcrd) //create a new z_level if needed
+ space_manager.increase_max_zlevel_to(zcrd) //create a new z_level if needed
bounds[MAP_MINX] = min(bounds[MAP_MINX], xcrdStart)
bounds[MAP_MINZ] = min(bounds[MAP_MINZ], zcrd)
diff --git a/code/modules/awaymissions/maploader/swapmaps.dm b/code/modules/awaymissions/maploader/swapmaps.dm
index 7115cfcbf13..fab504b150d 100644
--- a/code/modules/awaymissions/maploader/swapmaps.dm
+++ b/code/modules/awaymissions/maploader/swapmaps.dm
@@ -326,7 +326,7 @@ swapmap
x2+=x1-1
y2+=y1-1
z2+=z1-1
- zlevels.increase_max_zlevel_to(z2) // stretch z if necessary
+ space_manager.increase_max_zlevel_to(z2) // stretch z if necessary
if(!ischunk)
swapmaps_loaded[src]=null
swapmaps_byname[id]=src
@@ -373,7 +373,7 @@ swapmap
mz=max(mz,M.z2)
world.maxx=mx
world.maxy=my
- zlevels.cut_levels_downto(mz)
+ space_manager.cut_levels_downto(mz)
// save and delete
proc/Unload()
diff --git a/code/modules/awaymissions/zlevel.dm b/code/modules/awaymissions/zlevel.dm
index 7fff68cf031..da6515a591d 100644
--- a/code/modules/awaymissions/zlevel.dm
+++ b/code/modules/awaymissions/zlevel.dm
@@ -59,15 +59,13 @@ var/global/list/potentialRandomZlevels = generateMapList(filename = "config/away
var/map = pick(potentialRandomZlevels)
var/file = file(map)
if(isfile(file))
- var/zlev = zlevels.add_new_zlevel()
- zlevels.add_dirt(zlev)
+ var/zlev = space_manager.add_new_zlevel(AWAY_MISSION, linkage = UNAFFECTED)
+ space_manager.add_dirt(zlev)
maploader.load_map(file, z_offset = zlev)
late_setup_level(block(locate(1, 1, zlev), locate(world.maxx, world.maxy, zlev)))
- zlevels.remove_dirt(zlev)
+ space_manager.remove_dirt(zlev)
log_to_dd(" Away mission loaded: [map]")
- //map_transition_config.Add(AWAY_MISSION_LIST)
-
for(var/obj/effect/landmark/L in landmarks_list)
if(L.name != "awaystart")
continue
@@ -91,11 +89,11 @@ var/global/list/potentialRandomZlevels = generateMapList(filename = "config/away
var/file = file(map)
if(isfile(file))
log_startup_progress("Loading away mission: [map]")
- var/zlev = zlevels.add_new_zlevel()
- zlevels.add_dirt(zlev)
+ var/zlev = space_manager.add_new_zlevel()
+ space_manager.add_dirt(zlev)
maploader.load_map(file, z_offset = zlev)
late_setup_level(block(locate(1, 1, zlev), locate(world.maxx, world.maxy, zlev)))
- zlevels.remove_dirt(zlev)
+ space_manager.remove_dirt(zlev)
log_to_dd(" Away mission loaded: [map]")
//map_transition_config.Add(AWAY_MISSION_LIST)
@@ -151,8 +149,6 @@ var/global/list/potentialRandomZlevels = generateMapList(filename = "config/away
var/initialbudget = budget
var/watch = start_watch()
- log_startup_progress("Loading ruins...")
-
while(budget > 0 && overall_sanity > 0)
// Pick a ruin
var/datum/map_template/ruin/ruin = ruins[pick(ruins)]
@@ -187,7 +183,6 @@ var/global/list/potentialRandomZlevels = generateMapList(filename = "config/away
ruins -= ruin.name
break
- to_chat(world, " Loaded ruins. Or not.") //So the players don't know if we loaded ruins, but we do have a message
if(initialbudget == budget) //Kill me
log_to_dd(" No ruins loaded.")
diff --git a/code/modules/clothing/spacesuits/rig/modules/ninja.dm b/code/modules/clothing/spacesuits/rig/modules/ninja.dm
index 40e64add719..c50e9b1c6d3 100644
--- a/code/modules/clothing/spacesuits/rig/modules/ninja.dm
+++ b/code/modules/clothing/spacesuits/rig/modules/ninja.dm
@@ -115,6 +115,7 @@
to_chat(H, "You cannot teleport into solid walls.")
return 0*///Who the fuck cares? Ninjas in walls are cool.
+ // TODO: Tie into space manager
if(T.z in config.admin_levels)
to_chat(H, "You cannot use your teleporter on this Z-level.")
return 0
diff --git a/code/modules/computer3/computers/camera.dm b/code/modules/computer3/computers/camera.dm
index cb31379a59f..070015f4dc4 100644
--- a/code/modules/computer3/computers/camera.dm
+++ b/code/modules/computer3/computers/camera.dm
@@ -181,7 +181,8 @@
//proc/camera_list(var/datum/file/camnet_key/key)
get_machines(var/datum/file/camnet_key/key)
- if(!computer || computer.z > 6)
+ // TODO: Tie into space manager
+ if(!computer || computer.z > ZLEVEL_DERELICT)
return null
var/list/L = list()
diff --git a/code/modules/computer3/computers/communications.dm b/code/modules/computer3/computers/communications.dm
index 2f02bdcfdb3..d6575d3c143 100644
--- a/code/modules/computer3/computers/communications.dm
+++ b/code/modules/computer3/computers/communications.dm
@@ -59,6 +59,7 @@
Topic(var/href, var/list/href_list)
if(!interactable() || !computer.radio || ..(href,href_list) )
return
+ // TODO: Tie into space manager
if(!(computer.z in config.station_levels))
to_chat(usr, "Unable to establish a connection: You're too far away from the station!")
return
diff --git a/code/modules/computer3/computers/law.dm b/code/modules/computer3/computers/law.dm
index d75a016f680..7534aa65932 100644
--- a/code/modules/computer3/computers/law.dm
+++ b/code/modules/computer3/computers/law.dm
@@ -24,7 +24,8 @@
attackby(obj/item/weapon/aiModule/module as obj, mob/user as mob, params)
- if(user.z > 6)
+ // TODO: Tie into space manager
+ if(user.z > ZLEVEL_DERELICT)
to_chat(user, "Unable to establish a connection: You're too far away from the station!")
return
if(istype(module, /obj/item/weapon/aiModule))
diff --git a/code/modules/computer3/computers/medical.dm b/code/modules/computer3/computers/medical.dm
index 27002c264c2..6e96b6728e7 100644
--- a/code/modules/computer3/computers/medical.dm
+++ b/code/modules/computer3/computers/medical.dm
@@ -49,7 +49,8 @@
scan = computer.cardslot.reader
if(!interactable())
return
- if(computer.z > 6)
+ // TODO: Tie into space manager
+ if(computer.z > ZLEVEL_DERELICT)
to_chat(usr, "Unable to establish a connection: You're too far away from the station!")
return
var/dat
diff --git a/code/modules/computer3/computers/prisoner.dm b/code/modules/computer3/computers/prisoner.dm
index b38b376abf5..75b2302991f 100644
--- a/code/modules/computer3/computers/prisoner.dm
+++ b/code/modules/computer3/computers/prisoner.dm
@@ -43,6 +43,7 @@
if(!T.implanted) continue
var/loc_display = "Unknown"
var/mob/living/carbon/M = T.imp_in
+ // TODO: Tie into space manager
if(M.z == ZLEVEL_STATION && !istype(M.loc, /turf/space))
var/turf/mob_loc = get_turf(M)
loc_display = mob_loc.loc
@@ -98,5 +99,3 @@
interact()
return
-
-
diff --git a/code/modules/computer3/computers/robot.dm b/code/modules/computer3/computers/robot.dm
index 9e9e4b29fac..a728c8993bf 100644
--- a/code/modules/computer3/computers/robot.dm
+++ b/code/modules/computer3/computers/robot.dm
@@ -31,7 +31,8 @@
interact()
- if(!interactable() || computer.z > 6)
+ // TODO: Tie into space manager
+ if(!interactable() || computer.z > ZLEVEL_DERELICT)
return
var/dat
if(src.temp)
@@ -206,6 +207,3 @@
interact()
return
-
-
-
diff --git a/code/modules/computer3/computers/security.dm b/code/modules/computer3/computers/security.dm
index ce6184178bf..d974101b33f 100644
--- a/code/modules/computer3/computers/security.dm
+++ b/code/modules/computer3/computers/security.dm
@@ -57,7 +57,8 @@
if(!interactable())
return
- if(computer.z > 6)
+ // TODO: Tie into space manager
+ if(computer.z > ZLEVEL_DERELICT)
to_chat(usr, "Unable to establish a connection: You're too far away from the station!")
return
var/dat
diff --git a/code/modules/computer3/networking.dm b/code/modules/computer3/networking.dm
index f31f4516c2c..0fc1c966d1c 100644
--- a/code/modules/computer3/networking.dm
+++ b/code/modules/computer3/networking.dm
@@ -105,6 +105,7 @@
for(var/obj/O in radio_connection.devices)
if(istype(O,typekey))
T = get_turf(O)
+ // TODO: Tie into space manager
if(istype(O) && (subspace || (O.z == z_level))) // radio does not work across z-levels
result |= O
return result
@@ -232,4 +233,3 @@
if(C.d1 == 0 && (C.powernet == P))
return 1
return 0
-
diff --git a/code/modules/events/alien_infestation.dm b/code/modules/events/alien_infestation.dm
index 927db3c3668..b6313a77a40 100644
--- a/code/modules/events/alien_infestation.dm
+++ b/code/modules/events/alien_infestation.dm
@@ -17,6 +17,7 @@
/datum/event/alien_infestation/start()
var/list/vents = list()
for(var/obj/machinery/atmospherics/unary/vent_pump/temp_vent in world)
+ // TODO: Tie into space manager
if((temp_vent.loc.z in config.station_levels) && !temp_vent.welded)
if(temp_vent.parent.other_atmosmch.len > 50) //Stops Aliens getting stuck in small networks. See: Security, Virology
vents += temp_vent
@@ -34,4 +35,3 @@
spawncount--
successSpawn = 1
-
diff --git a/code/modules/events/anomaly_bluespace.dm b/code/modules/events/anomaly_bluespace.dm
index 13d7478aab3..f7db50694d6 100644
--- a/code/modules/events/anomaly_bluespace.dm
+++ b/code/modules/events/anomaly_bluespace.dm
@@ -19,6 +19,7 @@
var/obj/item/device/radio/beacon/chosen
var/list/possible = list()
for(var/obj/item/device/radio/beacon/W in world)
+ // TODO: Tie into space manager
if(!(W.z in config.station_levels))
continue
possible += W
diff --git a/code/modules/events/brand_intelligence.dm b/code/modules/events/brand_intelligence.dm
index 05110a7f0ce..e51ad46f61a 100644
--- a/code/modules/events/brand_intelligence.dm
+++ b/code/modules/events/brand_intelligence.dm
@@ -18,7 +18,8 @@
/datum/event/brand_intelligence/start()
for(var/obj/machinery/vending/V in machines)
- if(V.z != 1) continue
+ // TODO: Tie into space manager
+ if(V.z != ZLEVEL_STATION) continue
vendingMachines.Add(V)
if(!vendingMachines.len)
@@ -62,4 +63,4 @@
rebel.shoot_inventory = 1
if(IsMultiple(activeFor, 8))
- originMachine.speak(pick(rampant_speeches))
\ No newline at end of file
+ originMachine.speak(pick(rampant_speeches))
diff --git a/code/modules/events/disease_outbreak.dm b/code/modules/events/disease_outbreak.dm
index ce6e214053d..0f44bf586ee 100644
--- a/code/modules/events/disease_outbreak.dm
+++ b/code/modules/events/disease_outbreak.dm
@@ -21,7 +21,8 @@
var/turf/T = get_turf(H)
if(!T)
continue
- if(T.z != 1)
+ // TODO: Tie into space manager
+ if(T.z != ZLEVEL_STATION)
continue
var/foundAlready = 0 // don't infect someone that already has the virus
for(var/datum/disease/D in H.viruses)
@@ -34,4 +35,4 @@
D = new virus_type()
D.carrier = 1
H.AddDisease(D)
- break
\ No newline at end of file
+ break
diff --git a/code/modules/events/dust.dm b/code/modules/events/dust.dm
index 20f7f9955eb..17b529f9bda 100644
--- a/code/modules/events/dust.dm
+++ b/code/modules/events/dust.dm
@@ -62,7 +62,7 @@
goal = locate(endx, endy, 1)
src.x = startx
src.y = starty
- src.z = 1
+ src.z = ZLEVEL_STATION
spawn(0)
walk_towards(src, goal, 1)
return
diff --git a/code/modules/events/grid_check.dm b/code/modules/events/grid_check.dm
index ca675306ffa..282c8daab9e 100644
--- a/code/modules/events/grid_check.dm
+++ b/code/modules/events/grid_check.dm
@@ -22,6 +22,7 @@
for(var/obj/machinery/power/smes/S in machines)
var/area/current_area = get_area(S)
+ // TODO: Tie into space manager
if(current_area.type in skipped_areas || !(S.z in config.station_levels))
continue
S.last_charge = S.charge
@@ -35,6 +36,7 @@
for(var/obj/machinery/power/apc/C in world)
var/area/current_area = get_area(C)
+ // TODO: Tie into space manager
if(current_area.type in skipped_areas_apc || !(C.z in config.station_levels))
continue
if(C.cell)
@@ -48,12 +50,14 @@
command_announcement.Announce("Power has been restored to [station_name()]. We apologize for the inconvenience.", "Power Systems Nominal", new_sound = 'sound/AI/poweron.ogg')
for(var/obj/machinery/power/apc/C in machines)
var/area/current_area = get_area(C)
+ // TODO: Tie into space manager
if(current_area.type in skipped_areas_apc || !(C.z in config.station_levels))
continue
if(C.cell)
C.cell.charge = C.cell.maxcharge
for(var/obj/machinery/power/smes/S in machines)
var/area/current_area = get_area(S)
+ // TODO: Tie into space manager
if(current_area.type in skipped_areas || !(S.z in config.station_levels))
continue
S.charge = S.last_charge
@@ -66,7 +70,8 @@
if(announce)
command_announcement.Announce("All SMESs on [station_name()] have been recharged. We apologize for the inconvenience.", "Power Systems Nominal", new_sound = 'sound/AI/poweron.ogg')
for(var/obj/machinery/power/smes/S in machines)
- if(S.z != 1)
+ // TODO: Tie into space manager
+ if(S.z != ZLEVEL_STATION)
continue
S.charge = S.capacity
S.output_level = S.output_level_max
@@ -74,4 +79,3 @@
S.input_attempt = 1
S.update_icon()
S.power_change()
-
\ No newline at end of file
diff --git a/code/modules/events/holidays/Christmas.dm b/code/modules/events/holidays/Christmas.dm
index 10a46b0cf51..b9e23d406ef 100644
--- a/code/modules/events/holidays/Christmas.dm
+++ b/code/modules/events/holidays/Christmas.dm
@@ -1,5 +1,6 @@
/proc/Christmas_Game_Start()
for(var/obj/structure/flora/tree/pine/xmas in world)
+ // TODO: Tie into space manager
if(!(xmas.z in config.station_levels)) continue
for(var/turf/simulated/floor/T in orange(1,xmas))
for(var/i=1,i<=rand(1,5),i++)
@@ -40,7 +41,7 @@
"What do you get from eating tree decorations?\n\nTinsilitis!",
"What do snowmen wear on their heads?\n\nIce caps!",
"Why is Christmas just like life on ss13?\n\nYou do all the work and the fat guy gets all the credit.",
- "Why doesn’t Santa have any children?\n\nBecause he only comes down the chimney.")
+ "Why doesn�t Santa have any children?\n\nBecause he only comes down the chimney.")
new /obj/item/clothing/head/festive(target.loc)
user.update_icons()
cracked = 1
@@ -59,4 +60,3 @@
desc = "A crappy paper hat that you are REQUIRED to wear."
flags_inv = 0
armor = list(melee = 0, bullet = 0, laser = 0,energy = 0, bomb = 0, bio = 0, rad = 0)
-
diff --git a/code/modules/events/radiation_storm.dm b/code/modules/events/radiation_storm.dm
index 5afddd49d23..54a2bb41bb9 100644
--- a/code/modules/events/radiation_storm.dm
+++ b/code/modules/events/radiation_storm.dm
@@ -24,6 +24,7 @@
command_announcement.Announce("High levels of radiation detected near the station. Please evacuate into one of the shielded maintenance tunnels.", "Anomaly Alert", new_sound = 'sound/AI/radiation.ogg')
for(var/area/A in world)
+ // TODO: Tie into space manager
if(!(A.z in config.station_levels) || is_safe_zone(A))
continue
A.radiation_alert()
@@ -42,6 +43,7 @@
var/turf/T = get_turf(H)
if(!T)
continue
+ // TODO: Tie into space manager
if(!(T.z in config.station_levels) || is_safe_zone(T.loc))
continue
@@ -61,6 +63,7 @@
command_announcement.Announce("The station has passed the radiation belt. Please report to medbay if you experience any unusual symptoms. Maintenance will lose all access again shortly.", "Anomaly Alert")
for(var/area/A in world)
+ // TODO: Tie into space manager
if(!(A.z in config.station_levels) || is_safe_zone(A))
continue
A.reset_radiation_alert()
diff --git a/code/modules/events/rogue_drones.dm b/code/modules/events/rogue_drones.dm
index 7837bd61d7c..455312baa99 100644
--- a/code/modules/events/rogue_drones.dm
+++ b/code/modules/events/rogue_drones.dm
@@ -41,7 +41,7 @@
var/datum/effect/system/spark_spread/sparks = new /datum/effect/system/spark_spread()
sparks.set_up(3, 0, D.loc)
sparks.start()
- D.z = 2
+ D.z = ZLEVEL_CENTCOMM
D.has_loot = 0
qdel(D)
diff --git a/code/modules/events/spider_infestation.dm b/code/modules/events/spider_infestation.dm
index a628e3130ed..2c46fc8dffa 100644
--- a/code/modules/events/spider_infestation.dm
+++ b/code/modules/events/spider_infestation.dm
@@ -16,6 +16,7 @@
var/list/vents = list()
for(var/obj/machinery/atmospherics/unary/vent_pump/temp_vent in world)
+ // TODO: Tie into space manager
if((temp_vent.loc.z in config.station_levels) && !temp_vent.welded)
if(temp_vent.parent.other_atmosmch.len > 50)
vents += temp_vent
@@ -26,4 +27,4 @@
if(prob(66))
S.grow_as = /mob/living/simple_animal/hostile/poison/giant_spider/nurse
vents -= vent
- spawncount--
\ No newline at end of file
+ spawncount--
diff --git a/code/modules/events/undead.dm b/code/modules/events/undead.dm
index 2ff8d05c20a..3399c69c979 100644
--- a/code/modules/events/undead.dm
+++ b/code/modules/events/undead.dm
@@ -2,13 +2,14 @@
var/spawn_prob = 10
startWhen = 2
announceWhen = 3
-
+
/datum/event/undead/start()
var/datum/event/electrical_storm/RS = new
RS.lightsoutAmount = pick(2,2,3)
RS.start()
RS.kill()
for(var/area/A)
+ // TODO: Tie into space manager
if(!(A.z in config.station_levels)) continue //Spook on main station only.
if(A.luminosity) continue
// if(A.lighting_space) continue
@@ -34,7 +35,7 @@
80;/mob/living/simple_animal/hostile/retaliate/zombie,
60;/mob/living/simple_animal/hostile/retaliate/ghost)
new undeadtype(T)
-
+
/datum/event/undead/announce()
for(var/mob/living/M in player_list)
to_chat(M, "You feel [pick("a chill","a deathly chill","the undead","dirty", "creeped out","afraid","fear")]!")
diff --git a/code/modules/events/vent_clog.dm b/code/modules/events/vent_clog.dm
index fae640a73cb..de4e62215a8 100644
--- a/code/modules/events/vent_clog.dm
+++ b/code/modules/events/vent_clog.dm
@@ -11,6 +11,7 @@
/datum/event/vent_clog/setup()
endWhen = rand(25, 100)
for(var/obj/machinery/atmospherics/unary/vent_scrubber/temp_vent in machines)
+ // TODO: Tie into space manager
if((temp_vent.loc.z in config.station_levels))
if(temp_vent.parent.other_atmosmch.len > 50)
vents += temp_vent
diff --git a/code/modules/events/wormholes.dm b/code/modules/events/wormholes.dm
index 16daa8fe7c9..b022527094d 100644
--- a/code/modules/events/wormholes.dm
+++ b/code/modules/events/wormholes.dm
@@ -13,6 +13,7 @@
/datum/event/wormholes/start()
for(var/turf/simulated/floor/T in world)
+ // TODO: Tie into space manager
if((T.z in config.station_levels))
pick_turfs += T
@@ -62,4 +63,4 @@
if(P && isturf(P.loc))
target = P.loc
if(!target) return
- do_teleport(M, target, 1, 1, 0, 0) ///You will appear adjacent to the beacon
\ No newline at end of file
+ do_teleport(M, target, 1, 1, 0, 0) ///You will appear adjacent to the beacon
diff --git a/code/modules/holiday/christmas.dm b/code/modules/holiday/christmas.dm
index 7dccff585d8..c90e97d60c1 100644
--- a/code/modules/holiday/christmas.dm
+++ b/code/modules/holiday/christmas.dm
@@ -1,5 +1,6 @@
/datum/holiday/xmas/celebrate()
for(var/obj/structure/flora/tree/pine/xmas in world)
+ // TODO: Tie into space manager
if(!(xmas.z in config.station_levels)) continue
for(var/turf/simulated/floor/T in orange(1,xmas))
for(var/i=1,i<=rand(1,5),i++)
@@ -43,7 +44,7 @@
"What do you get from eating tree decorations?\n\nTinsilitis!",
"What do snowmen wear on their heads?\n\nIce caps!",
"Why is Christmas just like life on ss13?\n\nYou do all the work and the fat guy gets all the credit.",
- "Why doesn’t Santa have any children?\n\nBecause he only comes down the chimney.")
+ "Why doesn�t Santa have any children?\n\nBecause he only comes down the chimney.")
new /obj/item/clothing/head/festive(target.loc)
user.update_icons()
cracked = 1
@@ -62,4 +63,3 @@
desc = "A crappy paper hat that you are REQUIRED to wear."
flags_inv = 0
armor = list(melee = 0, bullet = 0, laser = 0, energy = 0, bomb = 0, bio = 0, rad = 0)
-
diff --git a/code/modules/hydroponics/seed.dm b/code/modules/hydroponics/seed.dm
index 57ad87ecbbe..ec7a5aca25f 100644
--- a/code/modules/hydroponics/seed.dm
+++ b/code/modules/hydroponics/seed.dm
@@ -376,6 +376,7 @@
// Bluespace tomato code copied over from grown.dm.
if(get_trait(TRAIT_TELEPORTING))
+ // TODO: Tie into space manager
if(target.z in config.admin_levels)
return 1
@@ -828,4 +829,4 @@
display_name = "modified [base_name]"
if(2) //Enhanced
seed_name = "enhanced [base_name]"
- display_name = "enhanced [base_name]"
\ No newline at end of file
+ display_name = "enhanced [base_name]"
diff --git a/code/modules/mining/equipment_locker.dm b/code/modules/mining/equipment_locker.dm
index d3a65e3c0bf..211914afcbb 100644
--- a/code/modules/mining/equipment_locker.dm
+++ b/code/modules/mining/equipment_locker.dm
@@ -528,7 +528,8 @@
/obj/item/device/wormhole_jaunter/attack_self(mob/user as mob)
var/turf/device_turf = get_turf(user)
- if(!device_turf||device_turf.z==2||device_turf.z>=7)
+ // TODO: Tie into space manager
+ if(!device_turf||device_turf.z==ZLEVEL_CENTCOMM||device_turf.z>=ZLEVEL_EMPTY)
to_chat(user, "You're having difficulties getting the [src.name] to work.")
return
else
@@ -536,6 +537,7 @@
var/list/L = list()
for(var/obj/item/device/radio/beacon/B in world)
var/turf/T = get_turf(B)
+ // TODO: Tie into space manager
if(T.z == ZLEVEL_STATION)
L += B
if(!L.len)
diff --git a/code/modules/mining/ore.dm b/code/modules/mining/ore.dm
index f5e0f2349be..2a6f5555555 100644
--- a/code/modules/mining/ore.dm
+++ b/code/modules/mining/ore.dm
@@ -240,6 +240,7 @@
/obj/item/weapon/ore/New()
pixel_x = rand(0,16)-8
pixel_y = rand(0,8)-8
+ // TODO: Tie into space manager
if(src.z == ZLEVEL_ASTEROID)
score_oremined++ //When ore spawns, increment score. Only include ore spawned on mining asteroid (No Clown Planet)
diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm
index 69a32f2c285..c67879f0457 100644
--- a/code/modules/mob/living/living.dm
+++ b/code/modules/mob/living/living.dm
@@ -18,6 +18,7 @@
var/turf/T = get_turf(src)
if(!T)
return 0
+ // TODO: Tie into space manager
if(T.z == ZLEVEL_CENTCOMM) //dont detect mobs on centcomm
return 0
if(T.z >= MAX_Z)
diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm
index 842b03c4bbd..7870e3a91fc 100644
--- a/code/modules/mob/living/silicon/ai/ai.dm
+++ b/code/modules/mob/living/silicon/ai/ai.dm
@@ -640,13 +640,14 @@ var/list/ai_verbs_default = list(
if(check_unable(AI_CHECK_WIRELESS | AI_CHECK_RADIO))
return
- var/ai_allowed_Zlevel = list(1,3,5)
+ var/ai_allowed_Zlevel = list(ZLEVEL_STATION,ZLEVEL_TELECOMMS,ZLEVEL_ASTEROID)
var/d
var/area/bot_area
d += "Query network status
"
d += "
Name | Status | Location | Control |
| [Bot.hacked ? "(!) [Bot.name]" : Bot.name] ([Bot.model]) | " diff --git a/code/modules/mob/living/silicon/pai/software_modules.dm b/code/modules/mob/living/silicon/pai/software_modules.dm index 3e15e7118d9..6d4c3a45150 100644 --- a/code/modules/mob/living/silicon/pai/software_modules.dm +++ b/code/modules/mob/living/silicon/pai/software_modules.dm @@ -499,6 +499,7 @@ /mob/living/silicon/pai/proc/hackloop() var/turf/T = get_turf_or_move(src.loc) for(var/mob/living/silicon/ai/AI in player_list) + // TODO: Tie into space manager if(!T || !(T.z in config.contact_levels)) break if(T.loc) diff --git a/code/modules/nano/interaction/default.dm b/code/modules/nano/interaction/default.dm index a97c693ec94..50c2bd79143 100644 --- a/code/modules/nano/interaction/default.dm +++ b/code/modules/nano/interaction/default.dm @@ -41,6 +41,7 @@ // Prevents the AI from using Topic on admin levels (by for example viewing through the court/thunderdome cameras) // unless it's on the same level as the object it's interacting with. var/turf/T = get_turf(src_object) + // TODO: Tie into space manager if(!T || !(z == T.z || (T.z in config.player_levels))) return STATUS_CLOSE @@ -102,4 +103,4 @@ . = shared_nano_interaction(src_object) if(. != STATUS_CLOSE) if(!(src_object in contents)) - . = STATUS_CLOSE \ No newline at end of file + . = STATUS_CLOSE diff --git a/code/modules/nano/modules/crew_monitor.dm b/code/modules/nano/modules/crew_monitor.dm index a587295b582..65f5a9299ee 100644 --- a/code/modules/nano/modules/crew_monitor.dm +++ b/code/modules/nano/modules/crew_monitor.dm @@ -2,9 +2,10 @@ name = "Crew monitor" /datum/nano_module/crew_monitor/Topic(href, href_list) - if(..()) + if(..()) return 1 var/turf/T = get_turf(nano_host()) + // TODO: Tie into space manager if(!T || !(T.z in config.player_levels)) to_chat(usr, "Unable to establish a connection: You're too far away from the station!") return 0 @@ -38,4 +39,3 @@ // should make the UI auto-update; doesn't seem to? ui.set_auto_update(1) - \ No newline at end of file diff --git a/code/modules/pda/cart_apps.dm b/code/modules/pda/cart_apps.dm index 55acf9b70eb..1c407bd223c 100644 --- a/code/modules/pda/cart_apps.dm +++ b/code/modules/pda/cart_apps.dm @@ -316,6 +316,7 @@ if(shuttle_master.supply.mode == SHUTTLE_CALL) supplyData["shuttle_moving"] = 1 + // TODO: Tie into space manager if(shuttle_master.supply.z != ZLEVEL_STATION) supplyData["shuttle_loc"] = "station" else @@ -418,4 +419,4 @@ JaniData["buckets"] = BucketData JaniData["cleanbots"] = CbotData JaniData["carts"] = CartData - data["janitor"] = JaniData \ No newline at end of file + data["janitor"] = JaniData diff --git a/code/modules/pda/messenger.dm b/code/modules/pda/messenger.dm index 88d6024ba1b..2a8ca83b218 100644 --- a/code/modules/pda/messenger.dm +++ b/code/modules/pda/messenger.dm @@ -158,6 +158,7 @@ if(signal.data["done"]) useTC = 1 var/turf/pos = get_turf(P) + // TODO: Tie into space manager if(pos.z in signal.data["level"]) useTC = 2 //Let's make this barely readable @@ -211,4 +212,4 @@ return plist /datum/data/pda/app/messenger/proc/can_receive() - return pda.owner && !toff && !hidden \ No newline at end of file + return pda.owner && !toff && !hidden diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index 87ce338afd1..5cbb8837c68 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -170,6 +170,7 @@ apcs -= src if(malfai && operating) if(ticker.mode.config_tag == "malfunction") + // TODO: Tie into space manager if(src.z == ZLEVEL_STATION) ticker.mode:apcs-- area.power_light = 0 @@ -995,6 +996,7 @@ malfai.malfhacking = 0 locked = 1 if(ticker.mode.config_tag == "malfunction") + // TODO: Tie into space manager if((src.z in config.station_levels)) //if(is_type_in_list(get_area(src), the_station_areas)) ticker.mode:apcs++ if(usr:parent) @@ -1027,6 +1029,7 @@ if(malfai) if(ticker.mode.config_tag == "malfunction") + // TODO: Tie into space manager if((src.z in config.station_levels)) //if(is_type_in_list(get_area(src), the_station_areas)) operating ? ticker.mode:apcs++ : ticker.mode:apcs-- @@ -1042,6 +1045,7 @@ if(!malf.can_shunt) to_chat(malf, "You cannot shunt.") return + // TODO: Tie into space manager if(!(src.z in config.station_levels)) return src.occupier = new /mob/living/silicon/ai(src,malf.laws,null,1) @@ -1091,6 +1095,7 @@ /obj/machinery/power/apc/proc/ion_act() //intended to be exactly the same as an AI malf attack + // TODO: Tie into space manager if(!src.malfhack && (src.z in config.station_levels)) if(prob(3)) src.locked = 1 @@ -1366,6 +1371,7 @@ /obj/machinery/power/apc/proc/set_broken() if(malfai && operating) if(ticker.mode.config_tag == "malfunction") + // TODO: Tie into space manager if((src.z in config.station_levels)) //if(is_type_in_list(get_area(src), the_station_areas)) ticker.mode:apcs-- stat |= BROKEN diff --git a/code/modules/power/gravitygenerator.dm b/code/modules/power/gravitygenerator.dm index 8833e047a7e..ea633c7e78f 100644 --- a/code/modules/power/gravitygenerator.dm +++ b/code/modules/power/gravitygenerator.dm @@ -124,6 +124,7 @@ var/const/GRAV_NEEDS_WRENCH = 3 O.main_part = null qdel(O) for(var/area/A in world) + // TODO: Tie into space manager if(!(A.z in config.station_levels)) continue A.gravitychange(0,A) shake_everyone() @@ -301,6 +302,7 @@ var/const/GRAV_NEEDS_WRENCH = 3 investigate_log("was brought online and is now producing gravity for this level.", "gravity") message_admins("The gravity generator was brought online. ([area.name])") for(var/area/A in world) + // TODO: Tie into space manager if(!(A.z in config.station_levels)) continue A.gravitychange(1,A) else @@ -309,6 +311,7 @@ var/const/GRAV_NEEDS_WRENCH = 3 investigate_log("was brought offline and there is now no gravity for this level.", "gravity") message_admins("The gravity generator was brought offline with no backup generator. ([area.name])") for(var/area/A in world) + // TODO: Tie into space manager if(!(A.z in config.station_levels)) continue A.gravitychange(0,A) @@ -377,6 +380,7 @@ var/const/GRAV_NEEDS_WRENCH = 3 shake_camera(M, 15, 1) M.playsound_local(our_turf, 'sound/effects/alert.ogg', 100, 1, 0.5) +// TODO: Tie into space manager /obj/machinery/gravity_generator/main/proc/gravity_in_level() var/turf/T = get_turf(src) if(!T) @@ -385,6 +389,7 @@ var/const/GRAV_NEEDS_WRENCH = 3 return length(gravity_generators["[T.z]"]) return 0 +// TODO: Tie into space manager /obj/machinery/gravity_generator/main/proc/update_list() var/turf/T = get_turf(src.loc) if(T) diff --git a/code/modules/power/smes.dm b/code/modules/power/smes.dm index 66e2e5d68b4..75f88f9b751 100644 --- a/code/modules/power/smes.dm +++ b/code/modules/power/smes.dm @@ -433,6 +433,7 @@ return 1 /obj/machinery/power/smes/proc/ion_act() + // TODO: Tie into space manager if(src.z in config.station_levels) if(prob(1)) //explosion for(var/mob/M in viewers(src)) diff --git a/code/modules/projectiles/guns/energy/telegun.dm b/code/modules/projectiles/guns/energy/telegun.dm index 2155a1cf0a1..c280fe59903 100644 --- a/code/modules/projectiles/guns/energy/telegun.dm +++ b/code/modules/projectiles/guns/energy/telegun.dm @@ -23,7 +23,8 @@ var/turf/T = get_turf(R) if(!T) continue - if((T.z in config.admin_levels) || T.z > 7) + // TODO: Tie into space manager + if((T.z in config.admin_levels) || T.z > ZLEVEL_EMPTY) continue if(R.syndicate == 1) continue diff --git a/code/modules/security_levels/security levels.dm b/code/modules/security_levels/security levels.dm index 61b0d3ce0dc..b340e14d356 100644 --- a/code/modules/security_levels/security levels.dm +++ b/code/modules/security_levels/security levels.dm @@ -37,6 +37,7 @@ CC.post_status("alert", "outline") for(var/obj/machinery/firealarm/FA in world) + // TODO: Tie into space manager if((FA.z in config.contact_levels)) FA.overlays = list() FA.overlays += image('icons/obj/monitors.dmi', "overlay_green") @@ -53,6 +54,7 @@ CC.post_status("alert", "outline") for(var/obj/machinery/firealarm/FA in world) + // TODO: Tie into space manager if((FA.z in config.contact_levels)) FA.overlays = list() FA.overlays += image('icons/obj/monitors.dmi', "overlay_blue") @@ -65,6 +67,7 @@ security_level = SEC_LEVEL_RED var/obj/machinery/door/airlock/highsecurity/red/R = locate(/obj/machinery/door/airlock/highsecurity/red) in world + // TODO: Tie into space manager if(R && (R.z in config.station_levels)) R.locked = 0 R.update_icon() @@ -74,6 +77,7 @@ CC.post_status("alert", "redalert") for(var/obj/machinery/firealarm/FA in world) + // TODO: Tie into space manager if((FA.z in config.contact_levels)) FA.overlays = list() FA.overlays += image('icons/obj/monitors.dmi', "overlay_red") @@ -86,11 +90,13 @@ if(security_level < SEC_LEVEL_RED) for(var/obj/machinery/door/airlock/highsecurity/red/R in world) + // TODO: Tie into space manager if((R.z in config.station_levels)) R.locked = 0 R.update_icon() for(var/obj/machinery/door/airlock/hatch/gamma/H in world) + // TODO: Tie into space manager if((H.z in config.station_levels)) H.locked = 0 H.update_icon() @@ -100,6 +106,7 @@ CC.post_status("alert", "gammaalert") for(var/obj/machinery/firealarm/FA in world) + // TODO: Tie into space manager if((FA.z in config.contact_levels)) FA.overlays = list() FA.overlays += image('icons/obj/monitors.dmi', "overlay_gamma") @@ -114,6 +121,7 @@ CC.post_status("alert", "epsilonalert") for(var/obj/machinery/firealarm/FA in world) + // TODO: Tie into space manager if((FA.z in config.contact_levels)) FA.overlays = list() FA.overlays += image('icons/obj/monitors.dmi', "overlay_epsilon") @@ -127,6 +135,7 @@ CC.post_status("alert", "deltaalert") for(var/obj/machinery/firealarm/FA in world) + // TODO: Tie into space manager if((FA.z in config.contact_levels)) FA.overlays = list() FA.overlays += image('icons/obj/monitors.dmi', "overlay_delta") @@ -189,4 +198,4 @@ set_security_level(2) /mob/verb/set_thing3() set_security_level(3) -*/ \ No newline at end of file +*/ diff --git a/code/modules/shuttle/assault_pod.dm b/code/modules/shuttle/assault_pod.dm index fe3d059a08a..40e7aa05aa0 100644 --- a/code/modules/shuttle/assault_pod.dm +++ b/code/modules/shuttle/assault_pod.dm @@ -6,6 +6,7 @@ height = 7 /obj/docking_port/mobile/assault_pod/request() + // TODO: Tie into space manager if(z == initial(src.z)) //No launching pods that have already launched return ..() diff --git a/code/modules/shuttle/emergency.dm b/code/modules/shuttle/emergency.dm index 8516d3e1dec..1224f5719b9 100644 --- a/code/modules/shuttle/emergency.dm +++ b/code/modules/shuttle/emergency.dm @@ -202,6 +202,7 @@ if(time_left <= 0 && !shuttle_master.emergencyNoEscape) //move each escape pod to its corresponding transit dock for(var/obj/docking_port/mobile/pod/M in shuttle_master.mobile) + // TODO: Tie into space manager if(M.z == ZLEVEL_STATION) //Will not launch from the mine/planet M.enterTransit() //now move the actual emergency shuttle to its transit dock diff --git a/code/modules/space_management/heap_space_level.dm b/code/modules/space_management/heap_space_level.dm new file mode 100644 index 00000000000..8d5a3971ba1 --- /dev/null +++ b/code/modules/space_management/heap_space_level.dm @@ -0,0 +1,15 @@ +// This represents a level we can carve up as we please, and hand out +// chunks of to whatever requests it +/datum/space_level/heap + var/datum/space_chunk/top + linkage = UNAFFECTED + +/datum/space_level/heap/New() + ..() + top = new + +/datum/space_level/heap/proc/request(width, height) + return 1 // All are welcome! At least until I add code for this + +/datum/zlevel/heap/proc/allocate(width, height) + return diff --git a/code/modules/space_management/space_chunk.dm b/code/modules/space_management/space_chunk.dm new file mode 100644 index 00000000000..b7764e5673e --- /dev/null +++ b/code/modules/space_management/space_chunk.dm @@ -0,0 +1,24 @@ +/datum/space_chunk + var/x + var/y + var/width + var/height + var/zpos + +/datum/space_chunk/New(w, h, z, new_x, new_y) + x = new_x + y = new_y + zpos = z + width = w + height = h + +/datum/space_chunk/proc/check_sanity() + var/i_am_sane = 1 + i_am_sane |= (x > 0) + i_am_sane |= (y > 0) + i_am_sane |= (x <= world.maxx) + i_am_sane |= (y <= world.maxy) + return i_am_sane + +/datum/space_chunk/proc/return_turfs() + return diff --git a/code/modules/space_management/space_level.dm b/code/modules/space_management/space_level.dm new file mode 100644 index 00000000000..6b7654cd504 --- /dev/null +++ b/code/modules/space_management/space_level.dm @@ -0,0 +1,125 @@ +/datum/space_level + var/name = "Your config settings failed, you need to fix this for the datum space levels to work" + var/zpos = 1 + var/flags = 0 // We'll use this to keep track of whether you can teleport/etc + + // Map transition stuff + var/list/neighbors = list() + // # How this level connects with others. See __MAP_DEFINES.dm for defines + var/linkage = SELFLOOPING + // # imaginary placements on the grid - these reflect the point it is linked to + var/xi + var/yi + var/list/transit_north = list() + var/list/transit_south = list() + var/list/transit_east = list() + var/list/transit_west = list() + + // Init deferral stuff + var/dirt_count = 0 + var/list/init_list = list() + +/datum/space_level/New(z, name, transition_type = SELFLOOPING) + zpos = z + set_linkage(transition_type) + build_space_destination_arrays() + +/datum/space_level/proc/build_space_destination_arrays() + var/timer = start_watch() + log_debug("Starting to build space destination arrays for z level '[zpos]'...") + for(var/turf/space/S in get_turfs()) + + // Bottom border + if(S.y <= TRANSITIONEDGE) + transit_south |= S + continue + + // Top border + if(S.y >= (world.maxy - TRANSITIONEDGE - 1)) + transit_north |= S + continue + + // Left border + if(S.x <= TRANSITIONEDGE) + transit_west |= S + continue + + // Right border + if(S.x >= (world.maxx - TRANSITIONEDGE - 1)) + transit_east |= S + continue + log_debug("Building space destination arrays complete, took [stop_watch(timer)]s.") + +/datum/space_level/proc/get_turfs() + return block(locate(1, 1, zpos), locate(world.maxx, world.maxy, zpos)) + +/datum/space_level/proc/set_linkage(transition_type) + linkage = transition_type + if(transition_type == SELFLOOPING) + link_to_self() // `link_to_self` is defined in space_transitions.dm + + +/datum/space_level/proc/resume_init() + if(dirt_count > 0) + throw EXCEPTION("Init told to resume when z-level still dirty. Z level: '[zpos]'") + log_debug("Releasing freeze on z-level '[zpos]'!") + log_debug("Beginning initialization!") + var/list/our_atoms = init_list // OURS NOW!!! (Keeping this list to ourselves will prevent hijack) + init_list = list() + var/list/late_maps = list() + var/list/pipes = list() + var/list/cables = list() + var/watch = start_watch() + for(var/schmoo in our_atoms) + var/atom/movable/AM = schmoo + if(AM) // to catch stuff like the nuke disk that no longer exists + + // This can mess with our state - we leave these for last + if(istype(AM, /obj/effect/landmark/map_loader)) + late_maps.Add(AM) + continue + AM.initialize() + if(istype(AM, /obj/machinery/atmospherics)) + pipes.Add(AM) + else if(istype(AM, /obj/structure/cable)) + cables.Add(AM) + log_debug("Primary initialization finished in [stop_watch(watch)]s.") + our_atoms.Cut() + if(pipes.len) + do_pipes(pipes) + if(cables.len) + do_cables(cables) + if(late_maps.len) + do_late_maps(late_maps) + +/datum/space_level/proc/do_pipes(list/pipes) + var/watch = start_watch() + log_debug("Building pipenets on z-level '[zpos]'!") + for(var/schmoo in pipes) + var/obj/machinery/atmospherics/machine = schmoo + if(machine) + machine.build_network() + pipes.Cut() + log_debug("Took [stop_watch(watch)]s") + +/datum/space_level/proc/do_cables(list/cables) + var/watch = start_watch() + log_debug("Building powernets on z-level '[zpos]'!") + for(var/schmoo in cables) + var/obj/structure/cable/C = schmoo + if(C) + makepowernet_for(C) + cables.Cut() + log_debug("Took [stop_watch(watch)]s") + +/datum/space_level/proc/do_late_maps(list/late_maps) + var/watch = start_watch() + log_debug("Loading map templates on z-level '[zpos]'!") + space_manager.add_dirt(zpos) // Let's not repeatedly resume init for each template + for(var/schmoo in late_maps) + var/obj/effect/landmark/map_loader/ML = schmoo + if(ML) + ML.initialize() + late_maps.Cut() + space_manager.remove_dirt(zpos) + log_debug("Took [stop_watch(watch)]s") diff --git a/code/modules/space_management/space_transition.dm b/code/modules/space_management/space_transition.dm new file mode 100644 index 00000000000..469365e4023 --- /dev/null +++ b/code/modules/space_management/space_transition.dm @@ -0,0 +1,412 @@ +//This is realisation of the working torus-looping randomized-per-round space map, this kills the cube + +#define Z_LEVEL_NORTH "1" +#define Z_LEVEL_SOUTH "2" +#define Z_LEVEL_EAST "4" +#define Z_LEVEL_WEST "8" + +/proc/get_opposite_direction(direction) + switch(direction) + if(Z_LEVEL_NORTH) + return Z_LEVEL_SOUTH + if(Z_LEVEL_SOUTH) + return Z_LEVEL_NORTH + if(Z_LEVEL_EAST) + return Z_LEVEL_WEST + if(Z_LEVEL_WEST) + return Z_LEVEL_EAST + +/datum/space_level + var/list/direction_cache = list() + +/datum/space_level/proc/link_to_self() + neighbors = list() + var/list/L = list(Z_LEVEL_NORTH,Z_LEVEL_SOUTH,Z_LEVEL_EAST,Z_LEVEL_WEST) + for(var/A in L) + neighbors[A] = src + +// This proc takes another space level, and establishes a connection between the +// two depending on how the `xi` and the `yi` values compare +/datum/space_level/proc/link_levels(datum/space_level/S) + if(S.xi == xi) + if(S.yi == yi+1) + add_connection(S, Z_LEVEL_NORTH) + else if(S.yi == yi-1) + add_connection(S, Z_LEVEL_SOUTH) + else if(S.yi == yi) + if(S.xi == xi+1) + add_connection(S, Z_LEVEL_EAST) + else if(S.xi == xi-1) + add_connection(S, Z_LEVEL_WEST) + else // yell about evil wizards, this shouldn't happen + log_debug("Two z levels attempted to link, but were not adjacent! Our z:([xi],[yi]). Other z:([S.xi],[S.yi])") + +// Do this before setting up new connections, or the old ones will haunt you +/datum/space_level/proc/reset_connections() + neighbors.Cut() + direction_cache.Cut() + +// `direction` here is the direction from `src` to `S` +/datum/space_level/proc/add_connection(datum/space_level/S, direction) + var/oppose = get_opposite_direction(direction) + neighbors[direction] = S + S.neighbors[oppose] = src + + +// The "direction cache" will need updating if a +/datum/space_level/proc/get_connection(direction) + if(direction in neighbors) + return neighbors[direction] + var/use_direction_cache = 0 + if(use_direction_cache) + if(direction in direction_cache) + return direction_cache[direction] + + // It's in a direction that loops - so we step as far in the opposite direction to get where to wrap to + var/datum/space_level/S = src + var/oppose = get_opposite_direction(direction) + // Loop all the way in the other direction that we can + while(S.neighbors[oppose]) + if(S.neighbors[oppose] == src) // we've got a tesseract, boys + CRASH("Tesseract formed when routing connections between z levels. Culprit: z level '[S.zpos]' to '[src.zpos]', direction [oppose]") + S = S.neighbors[oppose] + + if(use_direction_cache) + direction_cache[direction] = S + return S + + +/datum/point //this is explicitly utilitarian datum type made specially for the space map generation and are absolutely unusable for anything else + var/list/neighbors = list() + var/x + var/y + var/datum/space_level/spl + +/datum/point/New(nx, ny) + x = nx + y = ny + +/datum/point/proc/hash() + return "([x],[y])" + +// This is called only on `filled_nodes` - meaning we have a guarantee that +// it is already surrounded on all sides +/datum/point/proc/set_neighbors(datum/spacewalk_grid/SW) + neighbors.Cut() + neighbors |= SW.get(x+1, y, allow_empty = 1) + neighbors |= SW.get(x-1, y, allow_empty = 1) + neighbors |= SW.get(x, y+1, allow_empty = 1) + neighbors |= SW.get(x, y-1, allow_empty = 1) + +// Updates variables of the space level +/datum/point/proc/set_space_level(datum/space_level/S) + spl = S + S.xi = x + S.yi = y + for(var/datum/point/P in neighbors) + if(istype(P.spl)) + // Since each time this proc is called, it is the first time + // that the z level is added to the grid, we know for certain + // that no other z level has this as its neighbor + spl.link_levels(P.spl) + +// Returns a list of all neighbors that don't have a space level yet +// If a node doesn't exist yet, it will create it +// This is only called for nodes within the `available_nodes` list +/datum/point/proc/get_empty_neighbors(datum/spacewalk_grid/SW) + var/list/result + var/datum/point/up = SW.get(x, y+1, allow_empty = 1) + var/datum/point/down = SW.get(x, y-1, allow_empty = 1) + var/datum/point/left = SW.get(x-1, y, allow_empty = 1) + var/datum/point/right = SW.get(x+1, y, allow_empty = 1) + if(isnull(up)) + up = new(x, y+1) + SW.add_available_node(up) + + if(isnull(down)) + down = new(x, y-1) + SW.add_available_node(down) + + if(isnull(left)) + left = new(x-1, y) + SW.add_available_node(left) + + if(isnull(right)) + right = new(x+1, y) + SW.add_available_node(right) + + // Nodes with a space datum are not empty + result = list(up, down, left, right) + for(var/datum/point/thing in result) + if(!isnull(thing.spl)) + result -= thing + return result + +// This looks around itself to see if it has any active nodes within the cardinal directions +/datum/point/proc/has_no_neighbors(datum/spacewalk_grid/SW) + var/result = 1 + if(spl) + return 1 + if(!isnull(SW.get(x+1,y))) + result = 0 + if(!isnull(SW.get(x-1,y))) + result = 0 + if(!isnull(SW.get(x,y+1))) + result = 0 + if(!isnull(SW.get(x,y-1))) + result = 0 + return result + + +/datum/point/proc/deactivate() + if(!spl) + throw EXCEPTION("Attempted to deactivate inactive point") + for(var/direction in spl.neighbors) + var/datum/space_level/S = spl.neighbors[direction] + var/oppose = get_opposite_direction(direction) + S.neighbors.Remove(oppose) + spl.reset_connections() + spl = initial(spl) + +// This is like the old algorithm, except this one +// can expand indefinitely and add new points on the fly + +// The algorithm is: Start in the center, and add all adjacent points to a list of things to select +// Then repeatedly do the cycle of choosing a node next to any previously-selected node, then +// add all points next to your chosen node to the list of things to select +/datum/spacewalk_grid + // This is a list of fully initialized nodes - these have their neighbors + // assigned, and are surrounded + var/list/filled_nodes = list() + // These nodes are not fully initialized - their neighbors field is empty, + // and they do not correspond to a space level + var/list/available_nodes = list() + var/list/all_nodes = list() // filled_nodes | available_nodes + var/min_x = 0 + var/min_y = 0 + var/max_x = 0 + var/max_y = 0 + +/datum/spacewalk_grid/New() + var/datum/point/P = new(0,0) + add_available_node(P) + +/datum/spacewalk_grid/proc/add_available_node(datum/point/P) + var/hash = P.hash() + if(hash in all_nodes) + log_debug("Hash overlap! [hash]") + all_nodes[P.hash()] = P + available_nodes |= P + +// We call this to flag a node as in use - all required variables will be +// ready after this is called +/datum/spacewalk_grid/proc/consume_node(datum/point/P) + filled_nodes |= P + available_nodes -= P + // This proc adds any new neighbors to the list of available nodes + P.get_empty_neighbors(src) + if(min_x > P.x) + min_x = P.x + else if(max_x < P.x) + max_x = P.x + if(min_y > P.y) + min_y = P.y + else if(max_y < P.y) + max_y = P.y + P.set_neighbors(src) + +// You can call this with an active point, to remove it from the grid - +// this is important if you want to separate a z level from the network +/datum/spacewalk_grid/proc/release_node(datum/point/P) + filled_nodes -= P + available_nodes |= P + // Go through each neighbor node, and delete it if it's not + // next to any other active nodes + for(var/datum/point/P2 in P.neighbors) + var/isolated = P2.has_no_neighbors(src) + if(isolated) + available_nodes -= P2 + all_nodes -= P2.hash() + qdel(P) + P.deactivate() + P.neighbors.Cut() + + // Now that we've cleaned out inactive nodes, we will update the bounds + var/datum/point/outer_bound + if(P.x == max_x) + for(var/i = min_y, i <= max_y, i++) + outer_bound = get(P.x, i) + if(!isnull(outer_bound)) // There is still an active node in this column + break + if(isnull(outer_bound)) + max_x-- + + if(P.x == min_x) + for(var/i = min_y, i <= max_y, i++) + outer_bound = get(P.x, i) + if(!isnull(outer_bound)) // There is still an active node in this column + break + if(isnull(outer_bound)) + min_x++ + + if(P.y == max_y) + for(var/i = min_x, i <= max_x, i++) + outer_bound = get(i, P.y) + if(!isnull(outer_bound)) // There is still an active node in this column + break + if(isnull(outer_bound)) + max_y-- + + if(P.y == min_y) + for(var/i = min_x, i <= max_x, i++) + outer_bound = get(i, P.y) + if(!isnull(outer_bound)) // There is still an active node in this column + break + if(isnull(outer_bound)) + min_y++ + + +// If the node isn't in the grid, this will return null +/datum/spacewalk_grid/proc/get(x,y, allow_empty = 0) + var/datum/point/P = all_nodes["([x],[y])"] + if(!allow_empty && !(P in filled_nodes)) + P = null // active nodes only + return P + +/datum/spacewalk_grid/proc/get_width() + return 1 + max_x - min_x + +/datum/spacewalk_grid/proc/get_height() + return 1 + max_y - min_y + +// This function is called repeatedly to build the map +/datum/spacewalk_grid/proc/get_empty_node() + var/datum/point/P = pick(available_nodes) + if(isnull(P)) + throw EXCEPTION("The `available_nodes` list was either empty or contained a null entry") + consume_node(P) + return P + +// This proc substantiates the grid of points used to determine routes between levels +// Separating this from initialization gives us time in which we can add more crosslink z levels +// before we bake in all our connections +/datum/zlev_manager/proc/route_linkage() + var/list/crosslinks = list() + var/datum/space_level/D + for(var/A in z_list) + D = z_list[A] + if(D.linkage == CROSSLINKED) + crosslinks.Add(D) + D.reset_connections() + + // We create an imaginary, square, grid, with dimensions that are + // twice the number of z levels, plus one, per side + + // This is big enough to hold a straight line from the center to any side + // `point_grid` is indexed as a 2 way matrix of these points + // `grid` is a flat list of these same above points + + // Each point represents a possible z level position + var/datum/spacewalk_grid/point_grid = new + // We do this so we can display the way the levels connect later + linkage_map = point_grid + var/datum/point/P + + // Now, we pop entries in a random order from our list of space levels + // and assign its connections based on the grid + while(crosslinks.len) + D = pick(crosslinks) + crosslinks.Remove(D) + // We now choose a point in our imaginary grid adjacent to our current location + P = point_grid.get_empty_node() + // Let our z level know where in the imaginary grid it is + // This will also handle establishing neighborship with other z levels + P.set_space_level(D) + +// A heavy proc - loops through all space turfs and sets its destination +// based on its space level's linkage +// Takes 0.6 seconds per call on my machine - could have each z level +// have its own space turf cache, but I don't want to complicate this more +// than is necessary +/datum/zlev_manager/proc/setup_space_destinations() + var/timer = start_watch() + log_debug("Assigning space turf destinations...") + var/datum/space_level/D + var/datum/space_level/E + var/turf/space/S + for(var/A in z_list) //Define the transistions of the z levels + D = z_list[A] + if(!D.neighbors.len) + continue + // Left border + for(var/B in D.transit_west) + S = B + E = D.get_connection(Z_LEVEL_WEST) + S.destination_z = E.zpos + S.destination_x = world.maxx - TRANSITIONEDGE - 2 + S.destination_y = S.y + + // Right border + for(var/B in D.transit_east) + S = B + E = D.get_connection(Z_LEVEL_EAST) + S.destination_x = TRANSITIONEDGE + 2 + S.destination_y = S.y + S.destination_z = E.zpos + + // Bottom border + for(var/B in D.transit_south) + S = B + E = D.get_connection(Z_LEVEL_SOUTH) + S.destination_x = S.x + S.destination_y = world.maxy - TRANSITIONEDGE - 2 + S.destination_z = E.zpos + + // Top border + for(var/B in D.transit_north) + S = B + E = D.get_connection(Z_LEVEL_NORTH) + S.destination_x = S.x + S.destination_y = TRANSITIONEDGE + 2 + S.destination_z = E.zpos + + log_debug("Assigning space turf destinations complete. Took [stop_watch(timer)]s.") + +// Nothing fancy, just does it all at once +/datum/zlev_manager/proc/do_transition_setup() + route_linkage() + setup_space_destinations() + +// A debugging proc that expresses the map's shape as a bunch of turfs +/datum/zlev_manager/proc/map_as_turfs(turf/center) + // size is odd + // -1, /2 to get distance from the center + // center - radius = bottom left coordinate + var/datum/point/P + var/turf/our_spot + var/grid_desc = "" + for(var/i = linkage_map.min_x, i <= linkage_map.max_x, i++) + for(var/j = linkage_map.min_y, j <= linkage_map.max_y, j++) + P = linkage_map.get(i, j) + our_spot = locate(center.x + i, center.y + j, center.z) + grid_desc = "([i],[j])" + if(!isnull(P)) + our_spot = our_spot.ChangeTurf(/turf/simulated/floor/plating/snow) + grid_desc += ": Z level [P.spl.zpos]. " + var/datum/space_level/up = P.spl.get_connection(Z_LEVEL_NORTH) + var/datum/space_level/down = P.spl.get_connection(Z_LEVEL_SOUTH) + var/datum/space_level/right = P.spl.get_connection(Z_LEVEL_EAST) + var/datum/space_level/left = P.spl.get_connection(Z_LEVEL_WEST) + grid_desc += "Up: [up.zpos], " + grid_desc += "Down: [down.zpos], " + grid_desc += "Right: [right.zpos], " + grid_desc += "Left: [left.zpos]" + else + our_spot = our_spot.ChangeTurf(/turf/simulated/floor/fakespace) + our_spot.desc = grid_desc + + +#undef Z_LEVEL_NORTH +#undef Z_LEVEL_SOUTH +#undef Z_LEVEL_EAST +#undef Z_LEVEL_WEST diff --git a/code/modules/space_management/zlevel_manager.dm b/code/modules/space_management/zlevel_manager.dm new file mode 100644 index 00000000000..8f83c0ab5e4 --- /dev/null +++ b/code/modules/space_management/zlevel_manager.dm @@ -0,0 +1,131 @@ +var/global/datum/zlev_manager/space_manager = new + +/datum/zlev_manager + // A list of z-levels + var/list/z_list = list() + var/list/heaps = list() + + var/datum/spacewalk_grid/linkage_map + +// Populate our space level list +// and prepare space transitions +/datum/zlev_manager/proc/initialize() + var/num_official_z_levels = map_transition_config.len + var/k = 1 + + // First take care of "Official" z levels, without visiting levels outside of the list + for(var/A in map_transition_config) + // `A` is the name + // `map_transition_config[A]` is the transition type + z_list["[k]"] = new /datum/space_level(k, A, transition_type = map_transition_config[A]) + if(k > world.maxz) + CRASH("More map transitions defined than existent z levels - [num_official_z_levels]") + k++ + + // Then, we take care of unmanaged z levels + // They get the default linkage of SELFLOOPING + for(var/i = k, i <= world.maxz, i++) + z_list["[i]"] = new /datum/space_level(i) + + +/datum/zlev_manager/proc/get_zlev(z) + if(!("[z]" in z_list)) + throw EXCEPTION("Unmanaged z level: '[z]'") + else + return z_list["[z]"] + +/* +* "Dirt" management +* "Dirt" is used to keep track of whether a z level should automatically have +* stuff on it initialize or not - If you're loading a map, place +* a freeze on the z levels it touches so as to prevent atmos from exploding, +* among other things +*/ + + +// Returns whether the given z level has a freeze on initialization +/datum/zlev_manager/proc/is_zlevel_dirty(z) + var/datum/space_level/our_z = get_zlev(z) + return (our_z.dirt_count > 0) + + +// Increases the dirt count on a z level +/datum/zlev_manager/proc/add_dirt(z) + var/datum/space_level/our_z = get_zlev(z) + if(our_z.dirt_count == 0) + log_debug("Placing an init freeze on z-level '[our_z.zpos]'!") + our_z.dirt_count++ + + +// Decreases the dirt count on a z level +/datum/zlev_manager/proc/remove_dirt(z) + var/datum/space_level/our_z = get_zlev(z) + our_z.dirt_count-- + if(our_z.dirt_count == 0) + our_z.resume_init() + if(our_z.dirt_count < 0) + log_debug("WARNING: Imbalanced dirt removal") + our_z.dirt_count = 0 + +/datum/zlev_manager/proc/postpone_init(z, thing) + var/datum/space_level/our_z = get_zlev(z) + our_z.init_list.Add(thing) + + +/** +* +* SPACE ALLOCATION +* +*/ + + +// For when you need the z-level to be at a certain point +/datum/zlev_manager/proc/increase_max_zlevel_to(new_maxz) + if(world.maxz>=new_maxz) + return + while(world.maxz