diff --git a/_maps/__MAP_DEFINES.dm b/_maps/__MAP_DEFINES.dm index be9889b91e7..a3a14443cda 100644 --- a/_maps/__MAP_DEFINES.dm +++ b/_maps/__MAP_DEFINES.dm @@ -1,6 +1,32 @@ + +// Linkage flags #define CROSSLINKED 2 #define SELFLOOPING 1 #define UNAFFECTED 0 +// Attributes (In text for the convenience of those using VV) + #define BLOCK_TELEPORT "Blocks Teleport" + // Impedes with the casting of some spells + #define IMPEDES_MAGIC "Impedes Magic" + // A level the station exists on + #define STATION_LEVEL "Station Level" + // A level affected by Code Red announcements, cargo telepads, or similar + #define STATION_CONTACT "Station Contact" + // A level dedicated to admin use + #define ADMIN_LEVEL "Admin Level" + // A level that can be navigated to through space + #define REACHABLE "Reachable" + // For away missions - used by some consoles + #define AWAY_LEVEL "Away" + // Allows weather + #define HAS_WEATHER "Weather" + // Enhances telecomms signals + #define BOOSTS_SIGNAL "Boosts signals" + // Currently used for determining mining score + #define ORE_LEVEL "Mining" + // Levels the AI can control bots on + #define AI_OK "AI Allowed" + +// Level names #define MAIN_STATION "Main Station" #define CENTCOMM "CentComm" #define TELECOMMS "Telecomms Satellite" @@ -10,4 +36,8 @@ #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) + +// Convenience define + #define DECLARE_LEVEL(NAME,LINKS,TRAITS) list("name" = NAME, "linkage" = LINKS, "attributes" = TRAITS) + + #define AWAY_MISSION_LIST list(DECLARE_LEVEL(AWAY_MISSION,UNAFFECTED,list(BLOCK_TELEPORT, AWAY_LEVEL))) diff --git a/_maps/cyberiad.dm b/_maps/cyberiad.dm index a2f78f9d26c..434cc79eb52 100644 --- a/_maps/cyberiad.dm +++ b/_maps/cyberiad.dm @@ -24,7 +24,14 @@ 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) + #define MAP_TRANSITION_CONFIG list(\ +DECLARE_LEVEL(MAIN_STATION, CROSSLINKED, list(STATION_LEVEL,STATION_CONTACT,REACHABLE,AI_OK)),\ +DECLARE_LEVEL(CENTCOMM, SELFLOOPING, list(ADMIN_LEVEL, BLOCK_TELEPORT, IMPEDES_MAGIC)),\ +DECLARE_LEVEL(TELECOMMS, CROSSLINKED, list(REACHABLE, BOOSTS_SIGNAL, AI_OK)),\ +DECLARE_LEVEL(CONSTRUCTION, CROSSLINKED, list(REACHABLE)),\ +DECLARE_LEVEL(MINING, CROSSLINKED, list(REACHABLE, STATION_CONTACT, HAS_WEATHER, ORE_LEVEL, AI_OK)),\ +DECLARE_LEVEL(DERELICT, CROSSLINKED, list(REACHABLE)),\ +DECLARE_LEVEL(EMPTY_AREA, CROSSLINKED, list(REACHABLE))) #elif !defined(MAP_OVERRIDE) diff --git a/_maps/metastation.dm b/_maps/metastation.dm index 2010b25d501..9240a5e928f 100644 --- a/_maps/metastation.dm +++ b/_maps/metastation.dm @@ -25,7 +25,14 @@ 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) + #define MAP_TRANSITION_CONFIG list(\ +DECLARE_LEVEL(MAIN_STATION, CROSSLINKED, list(STATION_LEVEL, STATION_CONTACT, REACHABLE, AI_OK)),\ +DECLARE_LEVEL(CENTCOMM, SELFLOOPING, list(ADMIN_LEVEL, BLOCK_TELEPORT, IMPEDES_MAGIC)),\ +DECLARE_LEVEL(TELECOMMS, CROSSLINKED, list(REACHABLE, BOOSTS_SIGNAL, AI_OK)),\ +DECLARE_LEVEL(DERELICT, CROSSLINKED, list(REACHABLE)),\ +DECLARE_LEVEL(MINING, CROSSLINKED, list(REACHABLE, STATION_CONTACT, AI_OK, ORE_LEVEL, HAS_WEATHER)),\ +DECLARE_LEVEL(EMPTY_AREA, CROSSLINKED, list(REACHABLE)),\ +DECLARE_LEVEL(EMPTY_AREA_2, CROSSLINKED, list(REACHABLE))) #elif !defined(MAP_OVERRIDE) diff --git a/code/__DEFINES/misc.dm b/code/__DEFINES/misc.dm index cbd39a49a21..37c45ba954d 100644 --- a/code/__DEFINES/misc.dm +++ b/code/__DEFINES/misc.dm @@ -1,20 +1,5 @@ - - - -//zlevel defines, can be overriden for different maps in the appropriate _maps file. -#define ZLEVEL_STATION 1 -#define ZLEVEL_CENTCOMM 2 -#define ZLEVEL_TELECOMMS 3 -#define ZLEVEL_ENGI 4 -#define ZLEVEL_ASTEROID 5 -#define ZLEVEL_DERELICT 6 -#define ZLEVEL_EMPTY 7 -#define MAX_Z 7 // Used in space.dm to defince which Z-levels cannot be exited via space. #define TRANSITIONEDGE 7 //Distance from edge to move to another z-level -/// -#define ENGINE_EJECT_Z 3 - //Object specific defines #define CANDLE_LUM 3 //For how bright candles are diff --git a/code/_globalvars/mapping.dm b/code/_globalvars/mapping.dm index 2324bf85077..abc81f9d52a 100644 --- a/code/_globalvars/mapping.dm +++ b/code/_globalvars/mapping.dm @@ -7,14 +7,6 @@ var/list/cardinal = list( NORTH, SOUTH, EAST, WEST ) var/list/alldirs = list(NORTH, SOUTH, EAST, WEST, NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST) var/list/diagonals = list(NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST) -//This list contains the z-level numbers which can be accessed via space travel and the percentile chances to get there. -//(Exceptions: extended, sandbox and nuke) -Errorage -//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 -// 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. //Resulting sector map looks like @@ -26,9 +18,6 @@ var/global/list/global_map = null //3 - AI satellite //5 - empty space -// TODO: Tie into space manager -var/shuttle_z = ZLEVEL_CENTCOMM //default - var/list/monkeystart = list() var/list/wizardstart = list() var/list/newplayer_start = list() diff --git a/code/controllers/Processes/shuttles.dm b/code/controllers/Processes/shuttles.dm index 9c20d612247..8108fdea027 100644 --- a/code/controllers/Processes/shuttles.dm +++ b/code/controllers/Processes/shuttles.dm @@ -164,8 +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) + if(T && is_station_level(T.z)) callShuttle = 0 break @@ -210,8 +209,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)) + if(!is_station_level(S.z) && findtext(S.id, M.id)) S.width = M.width S.height = M.height S.dwidth = M.dwidth diff --git a/code/controllers/Processes/weather.dm b/code/controllers/Processes/weather.dm index df9ee95369b..6cdcce750b6 100644 --- a/code/controllers/Processes/weather.dm +++ b/code/controllers/Processes/weather.dm @@ -1,5 +1,5 @@ -// TODO: Tie into space manager //Used for all kinds of weather, ex. lavaland ash storms. +// TODO: This could probably be better-integrated with the space manager var/global/datum/controller/process/weather/weather_master /datum/controller/process/weather @@ -33,7 +33,7 @@ var/global/datum/controller/process/weather/weather_master var/list/possible_weather_for_this_z = list() for(var/V in existing_weather) var/datum/weather/WE = V - if(WE.target_z == Z && WE.probability) //Another check so that it doesn't run extra weather + if(WE.target_level == Z && WE.probability) //Another check so that it doesn't run extra weather possible_weather_for_this_z[WE] = WE.probability var/datum/weather/W = pickweight(possible_weather_for_this_z) run_weather(W.name) diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index 09596d4445c..6b1d1d8e19f 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -496,18 +496,6 @@ if("max_maint_drones") config.max_maint_drones = text2num(value) - if("station_levels") - config.station_levels = text2numlist(value, ";") - - if("admin_levels") - config.admin_levels = text2numlist(value, ";") - - if("contact_levels") - config.contact_levels = text2numlist(value, ";") - - if("player_levels") - config.player_levels = text2numlist(value, ";") - if("expected_round_length") config.expected_round_length = MinutesToTicks(text2num(value)) diff --git a/code/controllers/master_controller.dm b/code/controllers/master_controller.dm index ed618d7d72f..f013e4e817c 100644 --- a/code/controllers/master_controller.dm +++ b/code/controllers/master_controller.dm @@ -52,7 +52,7 @@ var/global/pipe_processing_killed = 0 if(!config.disable_space_ruins) var/timer = start_watch() log_startup_progress("Creating random space levels...") - seedRuins(ZLEVEL_EMPTY, rand(0, 3), /area/space, space_ruins_templates) + seedRuins(level_name_to_num(EMPTY_AREA), 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 diff --git a/code/datums/cache/air_alarm.dm b/code/datums/cache/air_alarm.dm index 67de7f95f21..b507c096081 100644 --- a/code/datums/cache/air_alarm.dm +++ b/code/datums/cache/air_alarm.dm @@ -15,8 +15,7 @@ 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) + if(!monitored_alarms && !is_station_contact(alarm.z)) continue alarms[++alarms.len] = alarm.get_nano_data_console() diff --git a/code/datums/diseases/advance/advance.dm b/code/datums/diseases/advance/advance.dm index b97ce1f5c7f..5492a9f9ced 100644 --- a/code/datums/diseases/advance/advance.dm +++ b/code/datums/diseases/advance/advance.dm @@ -406,8 +406,7 @@ var/list/advance_cures = list( AD.Refresh() for(var/mob/living/carbon/human/H in shuffle(living_mob_list)) - // TODO: Tie into space manager - if(H.z != ZLEVEL_STATION) + if(!is_station_level(H.z)) continue if(!H.HasDisease(D)) H.ForceContractDisease(D) diff --git a/code/datums/spell.dm b/code/datums/spell.dm index 99910f039a7..f16e1f6b263 100644 --- a/code/datums/spell.dm +++ b/code/datums/spell.dm @@ -67,10 +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") + if(is_admin_level(user.z) && (!centcom_cancast || ticker.mode.name == "ragin' mages")) //Certain spells are not allowed on the centcom zlevel return 0 if(!skipcharge) @@ -364,10 +361,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") + if(is_admin_level(user.z) && (!centcom_cancast || ticker.mode.name == "ragin' mages")) //Certain spells are not allowed on the centcom zlevel return 0 switch(charge_type) diff --git a/code/datums/weather/weather.dm b/code/datums/weather/weather.dm index 7a073edc902..7002f92061b 100644 --- a/code/datums/weather/weather.dm +++ b/code/datums/weather/weather.dm @@ -28,7 +28,7 @@ var/area_type = /area/space //Types of area to affect var/list/impacted_areas = list() //Areas to be affected by the weather, calculated when the weather begins - var/target_z = ZLEVEL_STATION //The z-level to affect + var/target_level = MAIN_STATION //The z-level to affect var/overlay_layer = 10 //Since it's above everything else, this is the layer used by default. 2 is below mobs and walls if you need to use that. var/aesthetic = FALSE //If the weather has no purpose other than looks @@ -52,13 +52,13 @@ stage = STARTUP_STAGE for(var/V in get_areas(area_type)) var/area/A = V - if(A.z == target_z) + if(is_on_level_name(A,target_level)) impacted_areas |= A weather_duration = rand(weather_duration_lower, weather_duration_upper) update_areas() for(var/V in player_list) var/mob/M = V - if(M.z == target_z) + if(is_on_level_name(M,target_level)) if(telegraph_message) to_chat(M, telegraph_message) if(telegraph_sound) @@ -72,7 +72,7 @@ update_areas() for(var/V in player_list) var/mob/M = V - if(M.z == target_z) + if(is_on_level_name(M,target_level)) if(weather_message) to_chat(M, weather_message) if(weather_sound) @@ -87,7 +87,7 @@ update_areas() for(var/V in player_list) var/mob/M = V - if(M.z == target_z) + if(is_on_level_name(M,target_level)) if(end_message) to_chat(M, end_message) if(end_sound) @@ -102,7 +102,7 @@ update_areas() /datum/weather/proc/can_impact(mob/living/L) //Can this weather impact a mob? - if(L.z != target_z) + if(!is_on_level_name(L,target_level)) return if(immunity_type in L.weather_immunities) return diff --git a/code/datums/weather/weather_types.dm b/code/datums/weather/weather_types.dm index bf942b7ceba..0295d8f36fb 100644 --- a/code/datums/weather/weather_types.dm +++ b/code/datums/weather/weather_types.dm @@ -1,5 +1,4 @@ //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" @@ -17,7 +16,7 @@ end_duration = 0 area_type = /area - target_z = ZLEVEL_STATION + target_level = MAIN_STATION overlay_layer = 2 //Covers floors only immunity_type = "lava" @@ -51,7 +50,7 @@ end_duration = 0 area_type = /area - target_z = ZLEVEL_STATION + target_level = MAIN_STATION /datum/weather/advanced_darkness/update_areas() for(var/V in impacted_areas) @@ -88,7 +87,7 @@ end_overlay = "light_ash" area_type = /area/mine - target_z = ZLEVEL_ASTEROID + target_level = MINING immunity_type = "ash" diff --git a/code/game/area/Space Station 13 areas.dm b/code/game/area/Space Station 13 areas.dm index 07ad5956002..27eaf0490ff 100644 --- a/code/game/area/Space Station 13 areas.dm +++ b/code/game/area/Space Station 13 areas.dm @@ -67,8 +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)) + if(picked && is_station_level(picked.z)) teleportlocs += AR.name teleportlocs[AR.name] = AR diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 0435ead41b2..bc58c346b01 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -42,8 +42,7 @@ if(!T) return 0 - // TODO: Tie into space manager - if(T.z != ZLEVEL_CENTCOMM)//if not, don't bother + if(!is_admin_level(T.z))//if not, don't bother return 0 //check for centcomm shuttles @@ -60,8 +59,7 @@ if(!T) return 0 - // TODO: Tie into space manager - if(T.z != ZLEVEL_CENTCOMM)//if not, don't bother + if(!is_admin_level(T.z))//if not, don't bother return 0 if(istype(T.loc, /area/shuttle/syndicate_elite) || istype(T.loc, /area/syndicate_mothership)) diff --git a/code/game/gamemodes/antag_spawner.dm b/code/game/gamemodes/antag_spawner.dm index 7d9aed3d442..f42fc5a3c46 100644 --- a/code/game/gamemodes/antag_spawner.dm +++ b/code/game/gamemodes/antag_spawner.dm @@ -80,8 +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.. + if(level_blocks_magic(user.z))//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 diff --git a/code/game/gamemodes/blob/blob.dm b/code/game/gamemodes/blob/blob.dm index ebab12dc0f2..8998fffc922 100644 --- a/code/game/gamemodes/blob/blob.dm +++ b/code/game/gamemodes/blob/blob.dm @@ -118,8 +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(!is_station_level(location.z) || 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!") message_admins("[key_name_admin(C)] was in space when the blobs burst, and will die if he doesn't return to the station.") diff --git a/code/game/gamemodes/blob/blob_report.dm b/code/game/gamemodes/blob/blob_report.dm index e74a0677942..198c0264dd1 100644 --- a/code/game/gamemodes/blob/blob_report.dm +++ b/code/game/gamemodes/blob/blob_report.dm @@ -23,8 +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) + if(is_station_level(bomb.z)) bomb.r_code = nukecode intercepttext += "Nanotrasen Update: Biohazard Alert.
" diff --git a/code/game/gamemodes/borer/borer.dm b/code/game/gamemodes/borer/borer.dm index bb5117d4579..6a4b7031cc3 100644 --- a/code/game/gamemodes/borer/borer.dm +++ b/code/game/gamemodes/borer/borer.dm @@ -35,7 +35,7 @@ return 0 // not enough candidates for borer for(var/obj/machinery/atmospherics/unary/vent_pump/v in world) - if(!v.welded && (v.z in config.station_levels)) + if(!v.welded && is_station_level(v.z)) found_vents.Add(v) // for each 2 possible borers, add one borer and one host @@ -156,4 +156,4 @@ greet_borer(borer) - return \ No newline at end of file + return diff --git a/code/game/gamemodes/cult/runes.dm b/code/game/gamemodes/cult/runes.dm index dc12c64fbed..6f18213670f 100644 --- a/code/game/gamemodes/cult/runes.dm +++ b/code/game/gamemodes/cult/runes.dm @@ -14,8 +14,7 @@ var/list/sacrificed = list() for(var/obj/effect/rune/R in world) if(R == src) continue - // TODO: Tie into space manager - if(R.word1 == cultwords["travel"] && R.word2 == cultwords["self"] && R.word3 == key && R.z != ZLEVEL_CENTCOMM) + if(R.word1 == cultwords["travel"] && R.word2 == cultwords["self"] && R.word3 == key && is_teleport_allowed(R.z)) index++ allrunesloc.len = index allrunesloc[index] = R.loc diff --git a/code/game/gamemodes/events.dm b/code/game/gamemodes/events.dm index 54db8374d29..d1fd034e312 100644 --- a/code/game/gamemodes/events.dm +++ b/code/game/gamemodes/events.dm @@ -2,8 +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(is_station_level(temp_vent.loc.z) && !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 77f503a1db2..63fb22bc694 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -427,8 +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) + if(bomb && bomb.r_code && is_station_level(bomb.z)) nukecode = bomb.r_code return nukecode @@ -452,8 +451,7 @@ proc/get_nt_opposed() text += " died" else text += " survived" - if(fleecheck && ply.current.z > ZLEVEL_STATION) - // TODO: Tie into space manager + if(fleecheck && !is_station_level(ply.current.z)) text += " while fleeing the station" if(ply.current.real_name != ply.name) text += " as [ply.current.real_name]" diff --git a/code/game/gamemodes/gameticker.dm b/code/game/gamemodes/gameticker.dm index 4fd8c5a452b..d78652bfa42 100644 --- a/code/game/gamemodes/gameticker.dm +++ b/code/game/gamemodes/gameticker.dm @@ -266,8 +266,7 @@ var/round_start_time = 0 M.client.screen += cinematic if(M.stat != DEAD) var/turf/T = get_turf(M) - // TODO: Tie into space manager - if(T && T.z == ZLEVEL_STATION) + if(T && is_station_level(T.z)) 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 59a731bed47..ba331791650 100644 --- a/code/game/gamemodes/malfunction/Malf_Modules.dm +++ b/code/game/gamemodes/malfunction/Malf_Modules.dm @@ -35,8 +35,7 @@ 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) + if(is_station_level(T.z)) turret.health += 30 turret.eprojectile = /obj/item/projectile/beam/laser/heavylaser //Once you see it, you will know what it means to FEAR. turret.eshot_sound = 'sound/weapons/lasercannonfire.ogg' @@ -60,7 +59,7 @@ return for(var/obj/machinery/door/D in airlocks) - if(D.z != ZLEVEL_STATION) + if(!is_station_level(D.z)) continue spawn(0) D.hostile_lockdown(src) @@ -146,7 +145,7 @@ return for(var/obj/machinery/firealarm/F in machines) - if(F.z != ZLEVEL_STATION) + if(!is_station_level(F.z)) continue F.emagged = 1 to_chat(src, "All thermal sensors on the station have been disabled. Fire alerts will no longer be recognized.") @@ -171,7 +170,7 @@ return for(var/obj/machinery/alarm/AA in machines) - if(AA.z != ZLEVEL_STATION) + if(!is_station_level(AA.z)) continue AA.emagged = 1 to_chat(src, "All air alarm safeties on the station have been overriden. Air alarms may now use the Flood environmental mode.") @@ -525,4 +524,4 @@ if(href_list["showdesc"]) if(AM.mod_pick_name == href_list["showdesc"]) temp = AM.description - use(usr) \ No newline at end of file + use(usr) diff --git a/code/game/gamemodes/malfunction/malfunction.dm b/code/game/gamemodes/malfunction/malfunction.dm index fb85a0a1606..a20acc95a08 100644 --- a/code/game/gamemodes/malfunction/malfunction.dm +++ b/code/game/gamemodes/malfunction/malfunction.dm @@ -141,8 +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)) + if(ai_location && is_station_level(ai_location.z)) return 1 return 0 diff --git a/code/game/gamemodes/meteor/meteors.dm b/code/game/gamemodes/meteor/meteors.dm index a2ff0f4e1d8..890cc4e151c 100644 --- a/code/game/gamemodes/meteor/meteors.dm +++ b/code/game/gamemodes/meteor/meteors.dm @@ -36,8 +36,7 @@ var/Me = pickweight(meteortypes) var/obj/effect/meteor/M = new Me(pickedstart) M.dest = pickedgoal - // TODO: Tie into space manager - M.z_original = ZLEVEL_STATION + M.z_original = level_name_to_num(MAIN_STATION) spawn(0) walk_towards(M, M.dest, 1) return @@ -103,7 +102,6 @@ var/dropamt = 2 /obj/effect/meteor/Move() - // TODO: Tie into space manager if(z != z_original || loc == dest) qdel(src) return diff --git a/code/game/gamemodes/miniantags/borer/borer_event.dm b/code/game/gamemodes/miniantags/borer/borer_event.dm index 28a0282487d..b0df1749403 100644 --- a/code/game/gamemodes/miniantags/borer/borer_event.dm +++ b/code/game/gamemodes/miniantags/borer/borer_event.dm @@ -17,8 +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) + if(is_station_level(temp_vent.loc.z) && !temp_vent.welded) //Stops cortical borers getting stuck in small networks. See: Security, Virology if(temp_vent.parent.other_atmosmch.len > 50) vents += temp_vent diff --git a/code/game/gamemodes/miniantags/bot_swarm/swarmer.dm b/code/game/gamemodes/miniantags/bot_swarm/swarmer.dm index ed84f211e53..1f9f5ff115a 100644 --- a/code/game/gamemodes/miniantags/bot_swarm/swarmer.dm +++ b/code/game/gamemodes/miniantags/bot_swarm/swarmer.dm @@ -290,14 +290,13 @@ /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) + if(!is_station_level(src.z)) to_chat(src, "Our bluespace transceiver cannot locate a viable bluespace link, our teleportation abilities are useless in this area.") return if(do_mob(src, target, 30)) var/cycle for(cycle=0,cycle<100,cycle++) - var/random_location = locate(rand(37,202),rand(75,192),ZLEVEL_STATION)//Drunk dial a turf in the general ballpark of the station + var/random_location = locate(rand(37,202),rand(75,192),level_name_to_num(MAIN_STATION))//Drunk dial a turf in the general ballpark of the station if(istype(random_location, /turf/simulated/floor)) var/turf/simulated/floor/F = random_location if(F.air) diff --git a/code/game/gamemodes/nations/nations.dm b/code/game/gamemodes/nations/nations.dm index 5f729e4484e..adca32ece73 100644 --- a/code/game/gamemodes/nations/nations.dm +++ b/code/game/gamemodes/nations/nations.dm @@ -142,8 +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) + if(is_station_level(W.z)) W.req_access = list() diff --git a/code/game/gamemodes/newobjective.dm b/code/game/gamemodes/newobjective.dm index ef0edffd5f8..7ab6bf5cb23 100644 --- a/code/game/gamemodes/newobjective.dm +++ b/code/game/gamemodes/newobjective.dm @@ -1358,8 +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 + else if((T) && !is_station_level(T.z))//If they leave the station they count as dead for this return 2 else return 0 diff --git a/code/game/gamemodes/nuclear/nuclear_challenge.dm b/code/game/gamemodes/nuclear/nuclear_challenge.dm index 15a4c8ec246..790c6a18e34 100644 --- a/code/game/gamemodes/nuclear/nuclear_challenge.dm +++ b/code/game/gamemodes/nuclear/nuclear_challenge.dm @@ -19,8 +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) + if(!is_admin_level(user.z)) 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 ae22e0ec458..833cb6d99ae 100644 --- a/code/game/gamemodes/nuclear/nuclearbomb.dm +++ b/code/game/gamemodes/nuclear/nuclearbomb.dm @@ -353,8 +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 && is_station_level(bomb_location.z) ) if( (bomb_location.x < (128-NUKERANGE)) || (bomb_location.x > (128+NUKERANGE)) || (bomb_location.y < (128-NUKERANGE)) || (bomb_location.y > (128+NUKERANGE)) ) off_station = 1 else @@ -364,8 +363,7 @@ 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) - // 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:syndies_didnt_escape = is_station_level(syndie_shuttle.z) ticker.mode:nuke_off_station = off_station ticker.station_explosion_cinematic(off_station,null) if(ticker.mode) @@ -403,8 +401,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) + if(!is_secure_level(disk_loc.z)) var/holder = get(src, /mob) if(holder) to_chat(holder, "You can't help but feel that you just lost something back there...") diff --git a/code/game/gamemodes/objective.dm b/code/game/gamemodes/objective.dm index f0a8f8957b2..557f3fe66ab 100644 --- a/code/game/gamemodes/objective.dm +++ b/code/game/gamemodes/objective.dm @@ -77,7 +77,6 @@ var/list/potential_theft_objectives=subtypesof(/datum/theft_objective) \ check_completion() if(target && target.current) - // TODO: Tie into space manager if(target.current.stat == DEAD || issilicon(target.current) || isbrain(target.current) || !target.current.ckey) //Borgs/brains/AIs count as dead for traitor objectives. --NeoFite return 1 return 0 @@ -110,8 +109,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 + if(T && !is_station_level(T.z)) //If they leave the station they count as dead for this return 2 return 0 return 1 @@ -146,8 +144,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 + if(T && !is_station_level(T.z)) //If they leave the station they count as dead for this rval = 2 return 0 return rval @@ -173,12 +170,9 @@ var/list/potential_theft_objectives=subtypesof(/datum/theft_objective) \ check_completion() if(target && target.current) - // TODO: Tie into space manager if(target.current.stat == DEAD || issilicon(target.current) || isbrain(target.current) || !target.current.ckey) //Borgs/brains/AIs count as dead for traitor objectives. --NeoFite return 1 - // TODO: Tie into space manager - var/turf/target_location = get_turf(target.current) - if(target_location.z in config.admin_levels) //No hiding in lockers and cheezing greentext. + if(is_admin_level(target.current.z)) return 0 return 1 @@ -568,8 +562,7 @@ var/list/potential_theft_objectives=subtypesof(/datum/theft_objective) \ check_completion() if(target && target.current) - // TODO: Tie into space manager - if(target.current.stat == DEAD || target.current.z > ZLEVEL_DERELICT || !target.current.ckey) + if(target.current.stat == DEAD || is_away_level(target.current.z) || !target.current.ckey) return 1 return 0 return 1 diff --git a/code/game/gamemodes/revolution/revolution.dm b/code/game/gamemodes/revolution/revolution.dm index 9e74459dadd..97489ab3fdb 100644 --- a/code/game/gamemodes/revolution/revolution.dm +++ b/code/game/gamemodes/revolution/revolution.dm @@ -314,8 +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((rev_mind) && (rev_mind.current) && (rev_mind.current.stat != DEAD) && rev_mind.current.client && T && is_station_level(T.z)) if(ishuman(rev_mind.current)) return 0 return 1 diff --git a/code/game/gamemodes/scoreboard.dm b/code/game/gamemodes/scoreboard.dm index a8091d04727..c4957b3b937 100644 --- a/code/game/gamemodes/scoreboard.dm +++ b/code/game/gamemodes/scoreboard.dm @@ -21,14 +21,12 @@ // Who is alive/dead, who escaped for(var/mob/living/silicon/ai/I in mob_list) - // TODO: Tie into space manager - if(I.stat == DEAD && (I.z in config.station_levels)) + if(I.stat == DEAD && is_station_level(I.z)) score_deadaipenalty++ score_deadcrew++ for(var/mob/living/carbon/human/I in mob_list) - // TODO: Tie into space manager - if(I.stat == DEAD && (I.z in config.station_levels)) + if(I.stat == DEAD && is_station_level(I.z)) score_deadcrew++ if(I && I.mind) @@ -81,9 +79,7 @@ // Check station's power levels for(var/obj/machinery/power/apc/A in apcs) - // TODO: Tie into space manager - if(!(A.z in config.station_levels)) continue - + if(!is_station_level(A.z)) continue for(var/obj/item/weapon/stock_parts/cell/C in A.contents) if(C.charge < 2300) score_powerloss++ //200 charge leeway @@ -91,8 +87,7 @@ // Check how much uncleaned mess is on the station for(var/obj/effect/decal/cleanable/M in world) - // TODO: Tie into space manager - if(!(M.z in config.station_levels)) continue + if(!is_station_level(M.z)) continue if(istype(M, /obj/effect/decal/cleanable/blood/gibs)) score_mess += 3 diff --git a/code/game/gamemodes/xenos/xenos.dm b/code/game/gamemodes/xenos/xenos.dm index 4d3fc5bfae8..14ac0f27b80 100644 --- a/code/game/gamemodes/xenos/xenos.dm +++ b/code/game/gamemodes/xenos/xenos.dm @@ -122,8 +122,7 @@ command_announcement.Announce("The aliens have nearly succeeded in capturing the station and exterminating the crew. Activate the nuclear failsafe to stop the alien threat once and for all. The Nuclear Authentication Code is [get_nuke_code()] ", "Alien Lifeform Alert") set_security_level("gamma") var/obj/machinery/door/airlock/vault/V = locate(/obj/machinery/door/airlock/vault) in world - // TODO: Tie into space manager - if(V && (V.z in config.station_levels)) + if(V && is_station_level(V.z)) V.locked = 0 V.update_icon() return ..() @@ -143,8 +142,7 @@ var/list/livingplayers = list() for(var/mob/M in player_list) var/turf/T = get_turf(M) - // TODO: Tie into space manager - if((M) && (M.stat != 2) && M.client && T && ((T.z in config.station_levels) || shuttle_master.emergency.mode >= SHUTTLE_ESCAPE && ((T.z in config.station_levels) || (T.z in config.admin_levels)))) + if((M) && (M.stat != DEAD) && M.client && T && (is_station_level(T.z) || shuttle_master.emergency.mode >= SHUTTLE_ESCAPE && is_secure_level(T.z))) if(ishuman(M)) livingplayers += 1 return livingplayers.len diff --git a/code/game/machinery/alarm.dm b/code/game/machinery/alarm.dm index 4c7cd096fc3..5515eb7ab3a 100644 --- a/code/game/machinery/alarm.dm +++ b/code/game/machinery/alarm.dm @@ -769,7 +769,6 @@ var/turf/pos = get_turf(src) data["x"] = pos.x data["y"] = pos.y - // TODO: Tie into space manager data["z"] = pos.z return data diff --git a/code/game/machinery/atmoalter/area_atmos_computer.dm b/code/game/machinery/atmoalter/area_atmos_computer.dm index a75c3afac88..36b680f1ebc 100644 --- a/code/game/machinery/atmoalter/area_atmos_computer.dm +++ b/code/game/machinery/atmoalter/area_atmos_computer.dm @@ -113,7 +113,6 @@ scrubber.update_icon() proc/validscrubber( var/obj/machinery/portable_atmospherics/scrubber/huge/scrubber as obj ) - // TODO: Tie into space manager if(!isobj(scrubber) || get_dist(scrubber.loc, src.loc) > src.range || scrubber.loc.z != src.loc.z) return 0 diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm index bcf8ee75b00..0935f8443f6 100644 --- a/code/game/machinery/camera/camera.dm +++ b/code/game/machinery/camera/camera.dm @@ -43,7 +43,7 @@ /obj/machinery/camera/initialize() ..() - if(z == ZLEVEL_STATION && prob(3) && !start_active) + if(is_station_level(z) && prob(3) && !start_active) toggle_cam() /obj/machinery/camera/Destroy() diff --git a/code/game/machinery/camera/tracking.dm b/code/game/machinery/camera/tracking.dm index cccc7e52f91..909d53be265 100644 --- a/code/game/machinery/camera/tracking.dm +++ b/code/game/machinery/camera/tracking.dm @@ -1,10 +1,7 @@ /mob/living/silicon/ai/proc/InvalidTurf(turf/T as turf) if(!T) return 1 - // TODO: Tie into space manager - if((T.z in config.admin_levels)) - return 1 - if(T.z > MAX_Z) + if(!is_level_reachable(T.z)) return 1 return 0 diff --git a/code/game/machinery/computer/camera.dm b/code/game/machinery/computer/camera.dm index a9b1e3ff31c..fd5dc873739 100644 --- a/code/game/machinery/computer/camera.dm +++ b/code/game/machinery/computer/camera.dm @@ -75,8 +75,7 @@ var/list/cameras = list() for(var/obj/machinery/camera/C in cameranet.cameras) - // TODO: Tie into space manager - if((z > MAX_Z || C.z > MAX_Z) && (C.z != z)) //can only recieve away mission cameras on away missions + if((is_away_level(src.z) || is_away_level(C.z)) && !atoms_share_level(C, src)) //can only recieve away mission cameras on away missions continue if(!can_access_camera(C)) continue diff --git a/code/game/machinery/computer/communications.dm b/code/game/machinery/computer/communications.dm index 790c516fc95..5ea7456fd08 100644 --- a/code/game/machinery/computer/communications.dm +++ b/code/game/machinery/computer/communications.dm @@ -54,8 +54,7 @@ if(..(href, href_list)) return 1 - // TODO: Tie into space manager - if((!(src.z in config.station_levels) && !(src.z in config.admin_levels))) + if(!is_secure_level(src.z)) to_chat(usr, "Unable to establish a connection: You're too far away from the station!") return 1 @@ -304,8 +303,7 @@ if(stat & (NOPOWER|BROKEN)) return - // TODO: Tie into space manager - if(!(src.z in list(ZLEVEL_STATION, ZLEVEL_CENTCOMM))) + if(!is_secure_level(src.z)) to_chat(user, "Unable to establish a connection: You're too far away from the station!") return diff --git a/code/game/machinery/computer/honkputer.dm b/code/game/machinery/computer/honkputer.dm index 75880d41975..b20821d24c2 100644 --- a/code/game/machinery/computer/honkputer.dm +++ b/code/game/machinery/computer/honkputer.dm @@ -20,8 +20,7 @@ /obj/machinery/computer/HONKputer/Topic(href, href_list) if(..()) return 1 - // TODO: Tie into space manager - if(!(src.z in config.station_levels)) + if(is_away_level(src.z)) to_chat(usr, "Unable to establish a connection: You're too far away from the station!") return usr.set_machine(src) @@ -69,8 +68,7 @@ /obj/machinery/computer/HONKputer/attack_hand(var/mob/user as mob) if(..()) return - // TODO: Tie into space manager - if(src.z > ZLEVEL_DERELICT) + if(is_away_level(src.z)) to_chat(user, "Unable to establish a connection: You're too far away from the station!") return diff --git a/code/game/machinery/computer/law.dm b/code/game/machinery/computer/law.dm index a6f1a0e6c26..125a5fc06ad 100644 --- a/code/game/machinery/computer/law.dm +++ b/code/game/machinery/computer/law.dm @@ -29,8 +29,7 @@ attackby(obj/item/weapon/O as obj, mob/user as mob, params) - // TODO: Tie into space manager - if(user.z > ZLEVEL_DERELICT) + if(is_away_level(user.z)) to_chat(user, "Unable to establish a connection: You're too far away from the station!") return if(istype(O, /obj/item/weapon/aiModule)) diff --git a/code/game/machinery/computer/pod.dm b/code/game/machinery/computer/pod.dm index 84b467d2072..ee278bd5f7e 100644 --- a/code/game/machinery/computer/pod.dm +++ b/code/game/machinery/computer/pod.dm @@ -208,7 +208,9 @@ id_tags -= ident_tag if(href_list["dstele"]) var/choices = list(0) - choices += accessable_z_levels + var/list/reachable_levels = levels_by_trait(REACHABLE) + for(var/datum/space_level/S in reachable_levels) + choices += S.zpos var/obj/machinery/computer/pod/deathsquad/D = src var/input = input("Enter the destination Z-Level. The mechs will arrive from the East. Leave 0 if you don't want to set a specific ZLevel", "Mass Driver Controls", 0) in choices D.teleporter_dest = input @@ -362,4 +364,4 @@ AM.dir = 8 var/atom/target = get_edge_target_turf(AM, AM.dir) AM.throw_at(target, 50, 1) - return \ No newline at end of file + return diff --git a/code/game/machinery/computer/prisoner.dm b/code/game/machinery/computer/prisoner.dm index e3683361ef2..fa1ba551728 100644 --- a/code/game/machinery/computer/prisoner.dm +++ b/code/game/machinery/computer/prisoner.dm @@ -65,8 +65,7 @@ health_display = "DEAD" else if(total_loss) health_display = "HURT ([total_loss])" - // TODO: Tie into space manager - if((M.z in config.station_levels) && !istype(M.loc, /turf/space)) + if(is_station_level(M.z) && !istype(M.loc, /turf/space)) loc_display = "[get_area(M)]" dat += "ID: [T.id]
Subject: [M]
Location: [loc_display]
Health: [health_display]
" dat += "(Message Holder) |
" diff --git a/code/game/machinery/computer/security.dm b/code/game/machinery/computer/security.dm index c7c23dbc724..c03ce8ee440 100644 --- a/code/game/machinery/computer/security.dm +++ b/code/game/machinery/computer/security.dm @@ -41,8 +41,7 @@ /obj/machinery/computer/secure_data/attack_hand(mob/user as mob) if(..()) return - // TODO: Tie into space manager - if(src.z > ZLEVEL_DERELICT) + if(is_away_level(src.z)) 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/computer/skills.dm b/code/game/machinery/computer/skills.dm index 7c0680f26d3..81aa33109f0 100644 --- a/code/game/machinery/computer/skills.dm +++ b/code/game/machinery/computer/skills.dm @@ -41,8 +41,7 @@ if(..()) return - // TODO: Tie into space manager - if(src.z > ZLEVEL_DERELICT) + if(is_away_level(src.z)) 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 ffa35c963d0..3dffa7dda24 100644 --- a/code/game/machinery/firealarm.dm +++ b/code/game/machinery/firealarm.dm @@ -295,9 +295,7 @@ 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(is_station_contact(src.z)) if(security_level) src.overlays += image('icons/obj/monitors.dmi', "overlay_[get_security_level()]") else diff --git a/code/game/machinery/supply_display.dm b/code/game/machinery/supply_display.dm index caf0c9c67d9..9c945fff989 100644 --- a/code/game/machinery/supply_display.dm +++ b/code/game/machinery/supply_display.dm @@ -5,8 +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) + if(is_station_level(shuttle_master.supply.z)) message1 = "CARGO" message2 = "Docked" else diff --git a/code/game/machinery/telecomms/broadcaster.dm b/code/game/machinery/telecomms/broadcaster.dm index 94390d9c0b6..34be5ed1c67 100644 --- a/code/game/machinery/telecomms/broadcaster.dm +++ b/code/game/machinery/telecomms/broadcaster.dm @@ -440,7 +440,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 + // TODO: Make the radio system cooperate with the space manager if(position && position.z == level) receive |= R.send_hear(display_freq, level) @@ -453,7 +453,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 + // TODO: Make the radio system cooperate with the space manager if(position && position.z == level) receive |= R.send_hear(display_freq) @@ -465,7 +465,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 + // TODO: Make the radio system cooperate with the space manager if(position && position.z == level) receive |= R.send_hear(freq) @@ -475,7 +475,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 + // TODO: Make the radio system cooperate with the space manager if(position && position.z == level) receive |= R.send_hear(display_freq) @@ -605,7 +605,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 + // TODO: Make the radio system cooperate with the space manager return (position.z in signal.data["level"]) && signal.data["done"] /atom/proc/telecomms_process(var/do_sleep = 1) @@ -624,7 +624,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 + // TODO: Make the radio system cooperate with the space manager "level" = pos.z // The level it is being broadcasted at. ) signal.frequency = PUB_FREQ// Common channel diff --git a/code/game/machinery/telecomms/machine_interactions.dm b/code/game/machinery/telecomms/machine_interactions.dm index 0c0dfd178fe..347f4ebc685 100644 --- a/code/game/machinery/telecomms/machine_interactions.dm +++ b/code/game/machinery/telecomms/machine_interactions.dm @@ -180,12 +180,12 @@ 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 + // TODO: Could work with the space manager better + if(is_station_level(src.listening_level)) // equals the station src.listening_level = position.z return 1 - else if(position.z == ZLEVEL_TELECOMMS) - src.listening_level = ZLEVEL_STATION + else if(level_boosts_signal(position.z)) + src.listening_level = level_name_to_num(MAIN_STATION) return 1 return 0 @@ -234,8 +234,8 @@ /obj/machinery/telecomms/relay/Options_Menu() var/dat = "" - if(src.z == ZLEVEL_TELECOMMS) - dat += "
Signal Locked to Station: [listening_level == ZLEVEL_STATION ? "TRUE" : "FALSE"]" + if(level_boosts_signal(src.z)) + dat += "
Signal Locked to Station: [is_station_level(listening_level) ? "TRUE" : "FALSE"]" dat += "
Broadcasting: [broadcasting ? "YES" : "NO"]" dat += "
Receiving: [receiving ? "YES" : "NO"]" return dat diff --git a/code/game/machinery/telecomms/telecomunications.dm b/code/game/machinery/telecomms/telecomunications.dm index 22c7863a3bb..a4e481f430b 100644 --- a/code/game/machinery/telecomms/telecomunications.dm +++ b/code/game/machinery/telecomms/telecomunications.dm @@ -56,7 +56,7 @@ var/global/list/obj/machinery/telecomms/telecomms_list = list() continue if(amount && send_count >= amount) break - // TODO: Tie into space manager + // TODO: Make the radio system cooperate with the space manager if(machine.loc.z != listening_level) if(long_range_link == 0 && machine.long_range_link == 0) continue @@ -115,7 +115,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 + // TODO: Make the radio system cooperate with the space manager listening_level = position.z /obj/machinery/telecomms/initialize() @@ -141,7 +141,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 + // TODO: Make the radio system cooperate with the 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 6ecc675fdef..369cb0fc708 100644 --- a/code/game/machinery/teleporter.dm +++ b/code/game/machinery/teleporter.dm @@ -182,8 +182,7 @@ var/turf/T = get_turf(R) if(!T) continue - // TODO: Tie into space manager - if((T.z in config.admin_levels) || T.z > ZLEVEL_EMPTY) + if(!is_teleport_allowed(T.z)) continue if(R.syndicate == 1 && emagged == 0) continue @@ -199,13 +198,12 @@ continue else var/mob/M = I.loc - if(M.stat == 2) + if(M.stat == DEAD) if(M.timeofdeath + 6000 < world.time) continue var/turf/T = get_turf(M) if(!T) continue - // TODO: Tie into space manager - if((T.z in config.admin_levels)) continue + if(!is_teleport_allowed(T.z)) continue var/tmpname = M.real_name if(areaindex[tmpname]) tmpname = "[tmpname] ([++areaindex[tmpname]])" @@ -227,8 +225,7 @@ var/turf/T = get_turf(R) if(!T || !R.teleporter_hub || !R.teleporter_console) continue - // TODO: Tie into space manager - if((T.z in config.admin_levels) || T.z > ZLEVEL_EMPTY) + if(!is_teleport_allowed(T.z)) continue var/tmpname = T.loc.name if(areaindex[tmpname]) @@ -323,7 +320,7 @@ return power_station /obj/machinery/teleport/hub/Bumped(M as mob|obj) - if(z == ZLEVEL_CENTCOMM && !admin_usage) + if(!is_teleport_allowed(z) && !admin_usage) to_chat(M, "You can't use this here.") return if(power_station && power_station.engaged && !panel_open) @@ -401,7 +398,7 @@ /obj/machinery/teleport/perma/Bumped(M as mob|obj) if(stat & (BROKEN|NOPOWER)) return - if(z == ZLEVEL_CENTCOMM) + if(!is_teleport_allowed(z)) to_chat(M, "You can't use this here.") return if(target && !recalibrating && !panel_open) diff --git a/code/game/mecha/equipment/tools/tools.dm b/code/game/mecha/equipment/tools/tools.dm index cb55c783005..d945e1cbb7f 100644 --- a/code/game/mecha/equipment/tools/tools.dm +++ b/code/game/mecha/equipment/tools/tools.dm @@ -382,8 +382,7 @@ range = RANGED action(atom/target) - // TODO: Tie into space manager - if(!action_checks(target) || (src.loc.z in config.admin_levels)) return + if(!action_checks(target) || !is_teleport_allowed(src.loc.z)) return var/turf/T = get_turf(target) if(T) set_ready_state(0) @@ -404,8 +403,7 @@ action(atom/target) - // TODO: Tie into space manager - if(!action_checks(target) || (src.loc.z in config.admin_levels)) return + if(!action_checks(target) || !is_teleport_allowed(src.loc.z)) return var/list/theareas = list() for(var/area/AR in orange(100, chassis)) if(AR in theareas) continue diff --git a/code/game/objects/effects/landmarks.dm b/code/game/objects/effects/landmarks.dm index 7f109425205..3a567518e42 100644 --- a/code/game/objects/effects/landmarks.dm +++ b/code/game/objects/effects/landmarks.dm @@ -13,7 +13,7 @@ switch(name) //some of these are probably obsolete if("shuttle") - shuttle_z = z + log_debug("Obsolete landmark '[name]' at ([x],[y],[z])") qdel(src) if("airtunnel_stop") diff --git a/code/game/objects/items/devices/camera_bug.dm b/code/game/objects/items/devices/camera_bug.dm index dec4f4c75fb..e50f26bcf4f 100644 --- a/code/game/objects/items/devices/camera_bug.dm +++ b/code/game/objects/items/devices/camera_bug.dm @@ -61,7 +61,6 @@ 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 @@ -226,7 +225,6 @@ 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 diff --git a/code/game/objects/items/devices/radio/intercom.dm b/code/game/objects/items/devices/radio/intercom.dm index a8623b17f56..502a5da02b3 100644 --- a/code/game/objects/items/devices/radio/intercom.dm +++ b/code/game/objects/items/devices/radio/intercom.dm @@ -124,7 +124,7 @@ return -1 if(!(0 in level)) var/turf/position = get_turf(src) - // TODO: Tie into space manager + // TODO: Integrate radio with the 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 98f3fc1709b..8a15bc7f517 100644 --- a/code/game/objects/items/weapons/bee_briefcase.dm +++ b/code/game/objects/items/weapons/bee_briefcase.dm @@ -64,8 +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 + if(!is_station_level(I.z)) //Only broadcast to the station intercoms continue if(!I.on) //Only broadcast to active intercoms (powered, switched on) continue diff --git a/code/game/objects/items/weapons/teleportation.dm b/code/game/objects/items/weapons/teleportation.dm index decfa424872..15650f188d9 100644 --- a/code/game/objects/items/weapons/teleportation.dm +++ b/code/game/objects/items/weapons/teleportation.dm @@ -48,8 +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. + if(!current_location || is_admin_level(current_location.z))//If turf was not found or they're in the admin zone to_chat(usr, "\The [src] is malfunctioning.") return 1 @@ -62,7 +61,6 @@ 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]
" @@ -109,8 +107,7 @@ 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? - // 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. + if(!current_location||!is_teleport_allowed(current_location.z))//If turf was not found or they're somewhere teleproof 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 4fe639160d4..1831b983f2c 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -192,8 +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)) + if(!is_level_reachable(src.z)) to_chat(user, "The rapid-crate-sender can't locate any telepads!") return if(E.mode == 0) diff --git a/code/game/objects/structures/crates_lockers/crates.dm b/code/game/objects/structures/crates_lockers/crates.dm index f9b32b071f7..bf74c11ee84 100644 --- a/code/game/objects/structures/crates_lockers/crates.dm +++ b/code/game/objects/structures/crates_lockers/crates.dm @@ -84,8 +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)) + if(!is_level_reachable(src.z)) // This is inconsistent with the closet sending code to_chat(user, "The rapid-crate-sender can't locate any telepads!") return if(E.mode == 0) diff --git a/code/game/turfs/space/transit.dm b/code/game/turfs/space/transit.dm index 1b7c9343ca2..9feda5d78a7 100644 --- a/code/game/turfs/space/transit.dm +++ b/code/game/turfs/space/transit.dm @@ -93,7 +93,8 @@ var/max = world.maxx-TRANSITIONEDGE var/min = 1+TRANSITIONEDGE - var/_z = rand(ZLEVEL_CENTCOMM+1,MAX_Z) //select a random space zlevel + var/datum/space_level/dest = pick(levels_by_trait(REACHABLE)) + var/_z = dest.zpos //select a random space zlevel //now select coordinates for a border turf var/_x diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index 252636abcda..90b0ec1b309 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -1980,8 +1980,7 @@ return else for(var/obj/machinery/photocopier/faxmachine/F in allfaxes) - // TODO: Tie into space manager - if((F.z in config.station_levels)) + if(is_station_level(F.z)) spawn(0) if(!F.receivefax(P)) to_chat(src.owner, "\red Message transmission to [F.department] failed.") @@ -2328,8 +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)) + if(!is_station_level(loc.z) || prisonwarped.Find(H)) //don't warp them if they aren't ready or are already there continue @@ -2566,8 +2564,7 @@ feedback_inc("admin_secrets_fun_used",1) feedback_add_details("admin_secrets_fun_used","EgL") for(var/obj/machinery/door/airlock/W in airlocks) - // 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)) + if(is_station_level(W.z) && !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") command_announcement.Announce("Centcomm airlock control override activated. Please take this time to get acquainted with your coworkers.", new_sound = 'sound/AI/commandreport.ogg') diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm index 2c930080edc..db5296619c6 100644 --- a/code/modules/admin/verbs/debug.dm +++ b/code/modules/admin/verbs/debug.dm @@ -373,8 +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) + if(!is_level_reachable(S.z)) continue qdel(S) log_admin("[key_name(src)] has deleted all Singularities and Tesla orbs.") diff --git a/code/modules/admin/verbs/playsound.dm b/code/modules/admin/verbs/playsound.dm index 660a1c8f199..957070eae8e 100644 --- a/code/modules/admin/verbs/playsound.dm +++ b/code/modules/admin/verbs/playsound.dm @@ -81,8 +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) + if(!is_station_level(I.z) && !ignore_z) continue if(!I.on && !ignore_power) continue diff --git a/code/modules/awaymissions/zlevel.dm b/code/modules/awaymissions/zlevel.dm index da6515a591d..b12ee063f2d 100644 --- a/code/modules/awaymissions/zlevel.dm +++ b/code/modules/awaymissions/zlevel.dm @@ -59,7 +59,7 @@ var/global/list/potentialRandomZlevels = generateMapList(filename = "config/away var/map = pick(potentialRandomZlevels) var/file = file(map) if(isfile(file)) - var/zlev = space_manager.add_new_zlevel(AWAY_MISSION, linkage = UNAFFECTED) + var/zlev = space_manager.add_new_zlevel(AWAY_MISSION, linkage = UNAFFECTED, traits = list(AWAY_LEVEL,BLOCK_TELEPORT)) 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))) diff --git a/code/modules/clothing/spacesuits/rig/modules/ninja.dm b/code/modules/clothing/spacesuits/rig/modules/ninja.dm index c50e9b1c6d3..6f9b1589e5a 100644 --- a/code/modules/clothing/spacesuits/rig/modules/ninja.dm +++ b/code/modules/clothing/spacesuits/rig/modules/ninja.dm @@ -115,8 +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) + if(!is_teleport_allowed(T.z)) 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 070015f4dc4..52001231647 100644 --- a/code/modules/computer3/computers/camera.dm +++ b/code/modules/computer3/computers/camera.dm @@ -181,8 +181,7 @@ //proc/camera_list(var/datum/file/camnet_key/key) get_machines(var/datum/file/camnet_key/key) - // TODO: Tie into space manager - if(!computer || computer.z > ZLEVEL_DERELICT) + if(!computer || !is_away_level(computer.z)) return null var/list/L = list() diff --git a/code/modules/computer3/computers/communications.dm b/code/modules/computer3/computers/communications.dm index d6575d3c143..5230a2c4953 100644 --- a/code/modules/computer3/computers/communications.dm +++ b/code/modules/computer3/computers/communications.dm @@ -59,8 +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)) + if(!is_station_level(computer.z)) 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 7534aa65932..533a600a4eb 100644 --- a/code/modules/computer3/computers/law.dm +++ b/code/modules/computer3/computers/law.dm @@ -24,8 +24,7 @@ attackby(obj/item/weapon/aiModule/module as obj, mob/user as mob, params) - // TODO: Tie into space manager - if(user.z > ZLEVEL_DERELICT) + if(is_away_level(user.z)) 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 6e96b6728e7..462f031a3f7 100644 --- a/code/modules/computer3/computers/medical.dm +++ b/code/modules/computer3/computers/medical.dm @@ -49,8 +49,7 @@ scan = computer.cardslot.reader if(!interactable()) return - // TODO: Tie into space manager - if(computer.z > ZLEVEL_DERELICT) + if(is_away_level(computer.z)) 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 75b2302991f..9ec6152a9e0 100644 --- a/code/modules/computer3/computers/prisoner.dm +++ b/code/modules/computer3/computers/prisoner.dm @@ -43,8 +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)) + if(is_station_level(M.z) && !istype(M.loc, /turf/space)) var/turf/mob_loc = get_turf(M) loc_display = mob_loc.loc dat += "ID: [T.id] | Location: [loc_display]
" diff --git a/code/modules/computer3/computers/robot.dm b/code/modules/computer3/computers/robot.dm index a728c8993bf..1f6bd0fa054 100644 --- a/code/modules/computer3/computers/robot.dm +++ b/code/modules/computer3/computers/robot.dm @@ -31,8 +31,7 @@ interact() - // TODO: Tie into space manager - if(!interactable() || computer.z > ZLEVEL_DERELICT) + if(!interactable() || is_away_level(computer.z)) return var/dat if(src.temp) diff --git a/code/modules/computer3/computers/security.dm b/code/modules/computer3/computers/security.dm index d974101b33f..9ae324d70ac 100644 --- a/code/modules/computer3/computers/security.dm +++ b/code/modules/computer3/computers/security.dm @@ -57,8 +57,7 @@ if(!interactable()) return - // TODO: Tie into space manager - if(computer.z > ZLEVEL_DERELICT) + if(is_away_level(computer.z)) 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 0fc1c966d1c..f55a63b0718 100644 --- a/code/modules/computer3/networking.dm +++ b/code/modules/computer3/networking.dm @@ -105,7 +105,7 @@ for(var/obj/O in radio_connection.devices) if(istype(O,typekey)) T = get_turf(O) - // TODO: Tie into space manager + // TODO: Make the radio system cooperate with the space manager if(istype(O) && (subspace || (O.z == z_level))) // radio does not work across z-levels result |= O return result diff --git a/code/modules/events/alien_infestation.dm b/code/modules/events/alien_infestation.dm index b6313a77a40..05054f468dd 100644 --- a/code/modules/events/alien_infestation.dm +++ b/code/modules/events/alien_infestation.dm @@ -17,8 +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(is_station_level(temp_vent.loc.z) && !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/modules/events/anomaly_bluespace.dm b/code/modules/events/anomaly_bluespace.dm index f7db50694d6..65b005c2538 100644 --- a/code/modules/events/anomaly_bluespace.dm +++ b/code/modules/events/anomaly_bluespace.dm @@ -19,8 +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)) + if(!is_station_level(W.z)) continue possible += W diff --git a/code/modules/events/brand_intelligence.dm b/code/modules/events/brand_intelligence.dm index e51ad46f61a..d640bca8641 100644 --- a/code/modules/events/brand_intelligence.dm +++ b/code/modules/events/brand_intelligence.dm @@ -18,8 +18,7 @@ /datum/event/brand_intelligence/start() for(var/obj/machinery/vending/V in machines) - // TODO: Tie into space manager - if(V.z != ZLEVEL_STATION) continue + if(!is_station_level(V.z)) continue vendingMachines.Add(V) if(!vendingMachines.len) diff --git a/code/modules/events/disease_outbreak.dm b/code/modules/events/disease_outbreak.dm index 0f44bf586ee..cdcfb6d06e9 100644 --- a/code/modules/events/disease_outbreak.dm +++ b/code/modules/events/disease_outbreak.dm @@ -21,8 +21,7 @@ var/turf/T = get_turf(H) if(!T) continue - // TODO: Tie into space manager - if(T.z != ZLEVEL_STATION) + if(!is_station_level(T.z)) continue var/foundAlready = 0 // don't infect someone that already has the virus for(var/datum/disease/D in H.viruses) diff --git a/code/modules/events/dust.dm b/code/modules/events/dust.dm index 17b529f9bda..5ed631736dd 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 = ZLEVEL_STATION + src.z = level_name_to_num(MAIN_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 479a0ea162e..5a892efb691 100644 --- a/code/modules/events/grid_check.dm +++ b/code/modules/events/grid_check.dm @@ -22,8 +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)) + if(current_area.type in skipped_areas || !is_station_level(S.z)) continue S.last_charge = S.charge S.last_output_attempt = S.output_attempt @@ -36,8 +35,7 @@ for(var/obj/machinery/power/apc/C in apcs) 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)) + if(current_area.type in skipped_areas_apc || !is_station_level(C.z)) continue if(C.cell) C.cell.charge = 0 @@ -50,15 +48,13 @@ 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 apcs) 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)) + if(current_area.type in skipped_areas_apc || !is_station_level(C.z)) 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)) + if(current_area.type in skipped_areas || !is_station_level(S.z)) continue S.charge = S.last_charge S.output_attempt = S.last_output_attempt @@ -70,8 +66,7 @@ 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) - // TODO: Tie into space manager - if(S.z != ZLEVEL_STATION) + if(!is_station_level(S.z)) continue S.charge = S.capacity S.output_level = S.output_level_max diff --git a/code/modules/events/holidays/Christmas.dm b/code/modules/events/holidays/Christmas.dm index 1d5a4d9e659..e3772fa78b5 100644 --- a/code/modules/events/holidays/Christmas.dm +++ b/code/modules/events/holidays/Christmas.dm @@ -1,7 +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 + if(!is_station_level(xmas.z)) continue for(var/turf/simulated/floor/T in orange(1,xmas)) for(var/i=1,i<=rand(1,5),i++) new /obj/item/weapon/a_gift(T) diff --git a/code/modules/events/holidays/Holidays.dm b/code/modules/events/holidays/Holidays.dm index 8b219e77d8a..107767455f6 100644 --- a/code/modules/events/holidays/Holidays.dm +++ b/code/modules/events/holidays/Holidays.dm @@ -171,7 +171,7 @@ var/global/Holiday = null */ /* var/list/obj/containers = list() for(var/obj/item/weapon/storage/S in world) - if(!(S.z in config.station_levels)) continue + if(!is_station_level(S.z)) continue containers += S message_admins("\blue DEBUG: Event: Egg spawned at [Egg.loc] ([Egg.x],[Egg.y],[Egg.z])")*/ diff --git a/code/modules/events/radiation_storm.dm b/code/modules/events/radiation_storm.dm index 54a2bb41bb9..7968e2493cf 100644 --- a/code/modules/events/radiation_storm.dm +++ b/code/modules/events/radiation_storm.dm @@ -24,8 +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)) + if(!is_station_level(A.z) || is_safe_zone(A)) continue A.radiation_alert() @@ -43,8 +42,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)) + if(!is_station_level(T.z) || is_safe_zone(T.loc)) continue if(istype(H,/mob/living/carbon/human)) @@ -63,8 +61,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)) + if(!is_station_level(A.z) || 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 455312baa99..9b7386fe470 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 = ZLEVEL_CENTCOMM + D.z = level_name_to_num(CENTCOMM) D.has_loot = 0 qdel(D) diff --git a/code/modules/events/spider_infestation.dm b/code/modules/events/spider_infestation.dm index 2c46fc8dffa..2b3ffb799df 100644 --- a/code/modules/events/spider_infestation.dm +++ b/code/modules/events/spider_infestation.dm @@ -16,8 +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(is_station_level(temp_vent.loc.z) && !temp_vent.welded) if(temp_vent.parent.other_atmosmch.len > 50) vents += temp_vent diff --git a/code/modules/events/undead.dm b/code/modules/events/undead.dm index 3399c69c979..f705b63611c 100644 --- a/code/modules/events/undead.dm +++ b/code/modules/events/undead.dm @@ -9,8 +9,7 @@ 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(!is_station_level(A.z)) continue //Spook on main station only. if(A.luminosity) continue // if(A.lighting_space) continue if(A.type == /area) continue diff --git a/code/modules/events/vent_clog.dm b/code/modules/events/vent_clog.dm index de4e62215a8..e5679764a39 100644 --- a/code/modules/events/vent_clog.dm +++ b/code/modules/events/vent_clog.dm @@ -11,8 +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(is_station_level(temp_vent.loc.z)) 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 1f3aa1355cd..398994f972d 100644 --- a/code/modules/events/wormholes.dm +++ b/code/modules/events/wormholes.dm @@ -13,8 +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)) + if(is_station_level(T.z)) pick_turfs += T for(var/i in 1 to number_of_wormholes) diff --git a/code/modules/holiday/christmas.dm b/code/modules/holiday/christmas.dm index c90e97d60c1..f9fbaf81b1d 100644 --- a/code/modules/holiday/christmas.dm +++ b/code/modules/holiday/christmas.dm @@ -1,7 +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 + if(!is_station_level(xmas.z)) continue for(var/turf/simulated/floor/T in orange(1,xmas)) for(var/i=1,i<=rand(1,5),i++) new /obj/item/weapon/a_gift(T) diff --git a/code/modules/hydroponics/seed.dm b/code/modules/hydroponics/seed.dm index ec7a5aca25f..994f141d373 100644 --- a/code/modules/hydroponics/seed.dm +++ b/code/modules/hydroponics/seed.dm @@ -376,8 +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) + if(!is_teleport_allowed(target.z)) return 1 //Plant potency determines radius of teleport. diff --git a/code/modules/mining/equipment_locker.dm b/code/modules/mining/equipment_locker.dm index faf11c70825..203af7d7fb1 100644 --- a/code/modules/mining/equipment_locker.dm +++ b/code/modules/mining/equipment_locker.dm @@ -528,8 +528,7 @@ /obj/item/device/wormhole_jaunter/attack_self(mob/user as mob) var/turf/device_turf = get_turf(user) - // TODO: Tie into space manager - if(!device_turf||device_turf.z==ZLEVEL_CENTCOMM||device_turf.z>=ZLEVEL_EMPTY) + if(!device_turf||is_teleport_allowed(device_turf.z)) to_chat(user, "You're having difficulties getting the [src.name] to work.") return else @@ -537,8 +536,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) + if(is_station_level(T.z)) L += B if(!L.len) to_chat(user, "The [src.name] failed to create a wormhole.") diff --git a/code/modules/mining/ore.dm b/code/modules/mining/ore.dm index 2a6f5555555..ec36988cb20 100644 --- a/code/modules/mining/ore.dm +++ b/code/modules/mining/ore.dm @@ -240,8 +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) + if(is_mining_level(src.z)) score_oremined++ //When ore spawns, increment score. Only include ore spawned on mining asteroid (No Clown Planet) /obj/item/weapon/ore/ex_act() diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 60c26dc4a50..7905c8f06fc 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -18,10 +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) + if(!is_level_reachable(T.z)) return 0 if(user != null && src == user) return 0 diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index 9d64f278b4a..36a9bb203f7 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -639,15 +639,13 @@ var/list/ai_verbs_default = list( if(check_unable(AI_CHECK_WIRELESS | AI_CHECK_RADIO)) return - var/ai_allowed_Zlevel = list(ZLEVEL_STATION,ZLEVEL_TELECOMMS,ZLEVEL_ASTEROID) var/d var/area/bot_area d += "Query network status
" d += "" for(var/mob/living/simple_animal/bot/Bot in simple_animal_list) - // TODO: Tie into space manager - if((Bot.z in ai_allowed_Zlevel) && !Bot.remote_disabled) //Only non-emagged bots on the allowed Z-level are detected! + if(is_ai_allowed(Bot.z) && !Bot.remote_disabled) //Only non-emagged bots on the allowed Z-level are detected! bot_area = get_area(Bot) d += "" //If the bot is on, it will display the bot's current mode status. If the bot is not mode, it will just report "Idle". "Inactive if it is not on at all. diff --git a/code/modules/mob/living/silicon/pai/software_modules.dm b/code/modules/mob/living/silicon/pai/software_modules.dm index 49db69025d4..adc0e54e661 100644 --- a/code/modules/mob/living/silicon/pai/software_modules.dm +++ b/code/modules/mob/living/silicon/pai/software_modules.dm @@ -500,8 +500,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)) + if(!T || !is_station_contact(T.z)) break if(T.loc) to_chat(AI, "Network Alert: Brute-force encryption crack in progress in [T.loc].") diff --git a/code/modules/nano/interaction/default.dm b/code/modules/nano/interaction/default.dm index 50c2bd79143..cb00e6a12b3 100644 --- a/code/modules/nano/interaction/default.dm +++ b/code/modules/nano/interaction/default.dm @@ -41,8 +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))) + if(!T || !(atoms_share_level(src,T) || is_level_reachable(T.z))) return STATUS_CLOSE // If an object is in view then we can interact with it diff --git a/code/modules/nano/modules/crew_monitor.dm b/code/modules/nano/modules/crew_monitor.dm index 65f5a9299ee..ce89f59947b 100644 --- a/code/modules/nano/modules/crew_monitor.dm +++ b/code/modules/nano/modules/crew_monitor.dm @@ -5,8 +5,7 @@ if(..()) return 1 var/turf/T = get_turf(nano_host()) - // TODO: Tie into space manager - if(!T || !(T.z in config.player_levels)) + if(!T || !is_level_reachable(T.z)) to_chat(usr, "Unable to establish a connection: You're too far away from the station!") return 0 if(href_list["track"]) diff --git a/code/modules/pda/cart_apps.dm b/code/modules/pda/cart_apps.dm index 1c407bd223c..30f732f48ae 100644 --- a/code/modules/pda/cart_apps.dm +++ b/code/modules/pda/cart_apps.dm @@ -316,8 +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) + if(!is_station_level(shuttle_master.supply.z)) supplyData["shuttle_loc"] = "station" else supplyData["shuttle_loc"] = "centcom" diff --git a/code/modules/pda/messenger.dm b/code/modules/pda/messenger.dm index 2a8ca83b218..6d7bbc90bd3 100644 --- a/code/modules/pda/messenger.dm +++ b/code/modules/pda/messenger.dm @@ -158,7 +158,7 @@ if(signal.data["done"]) useTC = 1 var/turf/pos = get_turf(P) - // TODO: Tie into space manager + // TODO: Make the radio system cooperate with the space manager if(pos.z in signal.data["level"]) useTC = 2 //Let's make this barely readable diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index b6eb99eb958..5800747d367 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -170,8 +170,7 @@ apcs -= src if(malfai && operating) if(ticker.mode.config_tag == "malfunction") - // TODO: Tie into space manager - if(src.z == ZLEVEL_STATION) + if(is_station_level(src.z)) ticker.mode:apcs-- area.power_light = 0 area.power_equip = 0 @@ -996,8 +995,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)) + if(is_station_level(src.z)) //if(is_type_in_list(get_area(src), the_station_areas)) ticker.mode:apcs++ if(usr:parent) src.malfai = usr:parent @@ -1029,8 +1027,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)) + if(is_station_level(src.z)) //if(is_type_in_list(get_area(src), the_station_areas)) operating ? ticker.mode:apcs++ : ticker.mode:apcs-- src.update() @@ -1045,8 +1042,7 @@ if(!malf.can_shunt) to_chat(malf, "You cannot shunt.") return - // TODO: Tie into space manager - if(!(src.z in config.station_levels)) + if(!is_station_level(src.z)) return src.occupier = new /mob/living/silicon/ai(src,malf.laws,null,1) src.occupier.adjustOxyLoss(malf.getOxyLoss()) @@ -1095,8 +1091,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(!src.malfhack && is_station_level(src.z)) if(prob(3)) src.locked = 1 if(src.cell.charge > 0) @@ -1371,8 +1366,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)) + if(is_station_level(src.z)) //if(is_type_in_list(get_area(src), the_station_areas)) ticker.mode:apcs-- stat |= BROKEN operating = 0 diff --git a/code/modules/power/gravitygenerator.dm b/code/modules/power/gravitygenerator.dm index ea633c7e78f..6468f813fa6 100644 --- a/code/modules/power/gravitygenerator.dm +++ b/code/modules/power/gravitygenerator.dm @@ -124,8 +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 + if(!is_station_level(A.z)) continue A.gravitychange(0,A) shake_everyone() return ..() @@ -302,8 +301,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 + if(!is_station_level(A.z)) continue A.gravitychange(1,A) else if(gravity_in_level() == 1) @@ -311,8 +309,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 + if(!is_station_level(A.z)) continue A.gravitychange(0,A) update_icon() @@ -380,7 +377,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 +// TODO: Make the gravity generator cooperate with the space manager /obj/machinery/gravity_generator/main/proc/gravity_in_level() var/turf/T = get_turf(src) if(!T) @@ -389,7 +386,6 @@ 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 75f88f9b751..4af4ccaeee4 100644 --- a/code/modules/power/smes.dm +++ b/code/modules/power/smes.dm @@ -433,8 +433,7 @@ return 1 /obj/machinery/power/smes/proc/ion_act() - // TODO: Tie into space manager - if(src.z in config.station_levels) + if(is_station_level(src.z)) if(prob(1)) //explosion for(var/mob/M in viewers(src)) M.show_message("\red The [src.name] is making strange noises!", 3, "\red You hear sizzling electronics.", 2) diff --git a/code/modules/projectiles/guns/energy/telegun.dm b/code/modules/projectiles/guns/energy/telegun.dm index c280fe59903..7b94698f0e9 100644 --- a/code/modules/projectiles/guns/energy/telegun.dm +++ b/code/modules/projectiles/guns/energy/telegun.dm @@ -23,8 +23,7 @@ var/turf/T = get_turf(R) if(!T) continue - // TODO: Tie into space manager - if((T.z in config.admin_levels) || T.z > ZLEVEL_EMPTY) + if(!is_teleport_allowed(T.z)) continue if(R.syndicate == 1) continue diff --git a/code/modules/projectiles/projectile/special.dm b/code/modules/projectiles/projectile/special.dm index cd562e00a48..0e1b7478cc8 100644 --- a/code/modules/projectiles/projectile/special.dm +++ b/code/modules/projectiles/projectile/special.dm @@ -276,17 +276,9 @@ obj/item/projectile/kinetic/New() /obj/item/projectile/beam/wormhole/on_hit(atom/target) if(ismob(target)) - var/turf/portal_destination = pick(orange(6, src)) - do_teleport(target, portal_destination) - return ..() - if(!gun) - qdel(src) - gun.create_portal(src) - -/obj/item/projectile/beam/wormhole/on_hit(atom/target) - if(ismob(target)) - var/turf/portal_destination = pick(orange(6, src)) - do_teleport(target, portal_destination) + if(is_teleport_allowed(target.z)) + var/turf/portal_destination = pick(orange(6, src)) + do_teleport(target, portal_destination) return ..() if(!gun) qdel(src) diff --git a/code/modules/research/experimentor.dm b/code/modules/research/experimentor.dm index 262820990c2..a0f1aecb520 100644 --- a/code/modules/research/experimentor.dm +++ b/code/modules/research/experimentor.dm @@ -729,7 +729,7 @@ to_chat(user, "The [src] begins to vibrate!") spawn(rand(10,30)) var/turf/userturf = get_turf(user) - if(src.loc == user && userturf.z != ZLEVEL_CENTCOMM) //Because Nuke Ops bringing this back on their shuttle, then looting the ERT area is 2fun4you! + if(src.loc == user && is_teleport_allowed(userturf.z)) //Because Nuke Ops bringing this back on their shuttle, then looting the ERT area is 2fun4you! visible_message("The [src] twists and bends, relocating itself!") throwSmoke(userturf) do_teleport(user, userturf, 8, asoundin = 'sound/effects/phasein.ogg') diff --git a/code/modules/security_levels/security levels.dm b/code/modules/security_levels/security levels.dm index 328a19ac034..a7a5162c231 100644 --- a/code/modules/security_levels/security levels.dm +++ b/code/modules/security_levels/security levels.dm @@ -37,8 +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)) + if(is_station_contact(FA.z)) FA.overlays = list() FA.overlays += image('icons/obj/monitors.dmi', "overlay_green") @@ -54,8 +53,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)) + if(is_station_contact(FA.z)) FA.overlays = list() FA.overlays += image('icons/obj/monitors.dmi', "overlay_blue") @@ -67,8 +65,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)) + if(R && is_station_level(R.z)) R.locked = 0 R.update_icon() @@ -77,8 +74,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)) + if(is_station_contact(FA.z)) FA.overlays = list() FA.overlays += image('icons/obj/monitors.dmi', "overlay_red") @@ -90,14 +86,12 @@ if(security_level < SEC_LEVEL_RED) for(var/obj/machinery/door/airlock/highsecurity/red/R in airlocks) - // TODO: Tie into space manager - if((R.z in config.station_levels)) + if(is_station_level(R.z)) R.locked = 0 R.update_icon() for(var/obj/machinery/door/airlock/hatch/gamma/H in airlocks) - // TODO: Tie into space manager - if((H.z in config.station_levels)) + if(is_station_level(H.z)) H.locked = 0 H.update_icon() @@ -106,8 +100,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)) + if(is_station_contact(FA.z)) FA.overlays = list() FA.overlays += image('icons/obj/monitors.dmi', "overlay_gamma") FA.update_icon() @@ -121,8 +114,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)) + if(is_station_contact(FA.z)) FA.overlays = list() FA.overlays += image('icons/obj/monitors.dmi', "overlay_epsilon") @@ -135,8 +127,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)) + if(is_station_contact(FA.z)) FA.overlays = list() FA.overlays += image('icons/obj/monitors.dmi', "overlay_delta") diff --git a/code/modules/shuttle/assault_pod.dm b/code/modules/shuttle/assault_pod.dm index 40e7aa05aa0..fe3d059a08a 100644 --- a/code/modules/shuttle/assault_pod.dm +++ b/code/modules/shuttle/assault_pod.dm @@ -6,7 +6,6 @@ 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 1224f5719b9..89aeb978cdf 100644 --- a/code/modules/shuttle/emergency.dm +++ b/code/modules/shuttle/emergency.dm @@ -202,8 +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 + if(is_station_level(M.z)) //Will not launch from the mine/planet M.enterTransit() //now move the actual emergency shuttle to its transit dock for(var/area/shuttle/escape/E in world) diff --git a/code/modules/shuttle/supply.dm b/code/modules/shuttle/supply.dm index f076c7ee977..3451f7fbe08 100644 --- a/code/modules/shuttle/supply.dm +++ b/code/modules/shuttle/supply.dm @@ -28,7 +28,7 @@ return 1 /obj/docking_port/mobile/supply/canMove() - if(z == ZLEVEL_STATION) + if(is_station_level(z)) return forbidden_atoms_check(areaInstance) return ..() @@ -45,7 +45,7 @@ sell() /obj/docking_port/mobile/supply/proc/buy() - if(z != ZLEVEL_STATION) //we only buy when we are -at- the station + if(!is_station_level(z)) //we only buy when we are -at- the station return 1 if(!shuttle_master.shoppinglist.len) @@ -93,7 +93,7 @@ shuttle_master.shoppinglist.Cut() /obj/docking_port/mobile/supply/proc/sell() - if(z != ZLEVEL_CENTCOMM) //we only sell when we are -at- centcomm + if(z != level_name_to_num(CENTCOMM)) //we only sell when we are -at- centcomm return 1 var/plasma_count = 0 diff --git a/code/modules/shuttle/syndicate.dm b/code/modules/shuttle/syndicate.dm index b1afd14bcf5..1c03c3f7039 100644 --- a/code/modules/shuttle/syndicate.dm +++ b/code/modules/shuttle/syndicate.dm @@ -30,9 +30,9 @@ /obj/machinery/computer/shuttle/syndicate/drop_pod/Topic(href, href_list) if(href_list["move"]) - if(z != ZLEVEL_CENTCOMM) + if(z != level_name_to_num(CENTCOMM)) to_chat(usr, "Pods are one way!") return 0 ..() -#undef SYNDICATE_CHALLENGE_TIMER \ No newline at end of file +#undef SYNDICATE_CHALLENGE_TIMER diff --git a/code/modules/space_management/level_check.dm b/code/modules/space_management/level_check.dm new file mode 100644 index 00000000000..391f5968c22 --- /dev/null +++ b/code/modules/space_management/level_check.dm @@ -0,0 +1,7 @@ +/proc/is_on_level_name(atom/A,name) + var/datum/space_level/S = space_manager.get_zlev_by_name(name) + return A.z == S.zpos + +// For expansion later +/proc/atoms_share_level(atom/A, atom/B) + return A.z == B.z diff --git a/code/modules/space_management/level_traits.dm b/code/modules/space_management/level_traits.dm new file mode 100644 index 00000000000..83309c3764f --- /dev/null +++ b/code/modules/space_management/level_traits.dm @@ -0,0 +1,62 @@ +/proc/is_level_reachable(z) + return check_level_trait(z, REACHABLE) + +/proc/is_station_level(z) + return check_level_trait(z, STATION_LEVEL) + +/proc/is_station_contact(z) + return check_level_trait(z, STATION_CONTACT) + +/proc/is_teleport_allowed(z) + return !check_level_trait(z, BLOCK_TELEPORT) + +/proc/is_admin_level(z) + return check_level_trait(z, ADMIN_LEVEL) + +/proc/is_away_level(z) + return check_level_trait(z, AWAY_LEVEL) + +/proc/is_mining_level(z) + return check_level_trait(z, ORE_LEVEL) + +/proc/is_ai_allowed(z) + return check_level_trait(z, AI_OK) + +/proc/level_blocks_magic(z) + return check_level_trait(z, IMPEDES_MAGIC) + +/proc/level_boosts_signal(z) + return check_level_trait(z, BOOSTS_SIGNAL) + +// Used for the nuke disk, or for checking if players survived through xenos +/proc/is_secure_level(z) + var/secure = check_level_trait(z, STATION_LEVEL) + if(!secure) + // This is to allow further admin levels later, other than centcomm + secure = (z == level_name_to_num(CENTCOMM)) + return secure + +var/list/default_map_traits = MAP_TRANSITION_CONFIG +/proc/check_level_trait(z, trait) + if(z == 0) + return 0 // If you're nowhere, you have no traits + var/list/trait_list + if(space_manager.initialized) + var/datum/space_level/S = space_manager.get_zlev(z) + trait_list = S.flags + else + trait_list = default_map_traits[z] + trait_list = trait_list["attributes"] + return (trait in trait_list) + +/proc/levels_by_trait(trait) + var/list/result = list() + for(var/A in space_manager.z_list) + var/datum/space_level/S = space_manager.z_list[A] + if(trait in S.flags) + result |= S + return result + +/proc/level_name_to_num(name) + var/datum/space_level/S = space_manager.get_zlev_by_name(name) + return S.zpos diff --git a/code/modules/space_management/space_level.dm b/code/modules/space_management/space_level.dm index 6b7654cd504..085bd89f44b 100644 --- a/code/modules/space_management/space_level.dm +++ b/code/modules/space_management/space_level.dm @@ -1,7 +1,7 @@ /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 + var/flags = list() // We'll use this to keep track of whether you can teleport/etc // Map transition stuff var/list/neighbors = list() @@ -19,8 +19,9 @@ var/dirt_count = 0 var/list/init_list = list() -/datum/space_level/New(z, name, transition_type = SELFLOOPING) +/datum/space_level/New(z, name, transition_type = SELFLOOPING, traits = list(BLOCK_TELEPORT)) zpos = z + flags = traits set_linkage(transition_type) build_space_destination_arrays() @@ -57,7 +58,8 @@ linkage = transition_type if(transition_type == SELFLOOPING) link_to_self() // `link_to_self` is defined in space_transitions.dm - + if(transition_type == UNAFFECTED) + reset_connections() /datum/space_level/proc/resume_init() if(dirt_count > 0) diff --git a/code/modules/space_management/space_transition.dm b/code/modules/space_management/space_transition.dm index 469365e4023..bd254a37b8b 100644 --- a/code/modules/space_management/space_transition.dm +++ b/code/modules/space_management/space_transition.dm @@ -20,6 +20,7 @@ var/list/direction_cache = list() /datum/space_level/proc/link_to_self() + reset_connections() neighbors = list() var/list/L = list(Z_LEVEL_NORTH,Z_LEVEL_SOUTH,Z_LEVEL_EAST,Z_LEVEL_WEST) for(var/A in L) @@ -279,7 +280,7 @@ /datum/spacewalk_grid/proc/get_height() return 1 + max_y - min_y -// This function is called repeatedly to build the map +// This function chooses an available point next to any node in the grid /datum/spacewalk_grid/proc/get_empty_node() var/datum/point/P = pick(available_nodes) if(isnull(P)) @@ -287,6 +288,12 @@ consume_node(P) return P +// This function is called repeatedly to build the map +/datum/spacewalk_grid/proc/add_level(datum/space_level/S) + var/datum/point/P = get_empty_node() + P.set_space_level(S) + + // 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 @@ -310,7 +317,6 @@ 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 @@ -318,16 +324,10 @@ 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) + point_grid.add_level(D) -// A heavy proc - loops through all space turfs and sets its destination +// Loops through border 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...") diff --git a/code/modules/space_management/zlevel_manager.dm b/code/modules/space_management/zlevel_manager.dm index 8f83c0ab5e4..26607380a37 100644 --- a/code/modules/space_management/zlevel_manager.dm +++ b/code/modules/space_management/zlevel_manager.dm @@ -3,9 +3,11 @@ var/global/datum/zlev_manager/space_manager = new /datum/zlev_manager // A list of z-levels var/list/z_list = list() + var/list/levels_by_name = list() var/list/heaps = list() var/datum/spacewalk_grid/linkage_map + var/initialized = 0 // Populate our space level list // and prepare space transitions @@ -14,18 +16,24 @@ var/global/datum/zlev_manager/space_manager = new 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]) + for(var/list/features in map_transition_config) if(k > world.maxz) - CRASH("More map transitions defined than existent z levels - [num_official_z_levels]") + CRASH("More map attributes pre-defined than existent z levels - [num_official_z_levels]") + var/name = features["name"] + var/linking = features["linkage"] + var/list/attributes = features["attributes"] + attributes = attributes.Copy() // Clone the list so it can't be changed on accident + + var/datum/space_level/S = new /datum/space_level(k, name, transition_type = linking, traits = attributes) + z_list["[k]"] = S + levels_by_name[name] = S 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) + initialized = 1 /datum/zlev_manager/proc/get_zlev(z) @@ -34,6 +42,11 @@ var/global/datum/zlev_manager/space_manager = new else return z_list["[z]"] +/datum/zlev_manager/proc/get_zlev_by_name(A) + if(!(A in levels_by_name)) + throw EXCEPTION("Non-existent z level: '[A]'") + return levels_by_name[A] + /* * "Dirt" management * "Dirt" is used to keep track of whether a z level should automatically have @@ -88,10 +101,14 @@ var/global/datum/zlev_manager/space_manager = new // Increments the max z-level by one // For convenience's sake returns the z-level added -/datum/zlev_manager/proc/add_new_zlevel(name, linkage = SELFLOOPING) +/datum/zlev_manager/proc/add_new_zlevel(name, linkage = SELFLOOPING, traits = list(BLOCK_TELEPORT)) + if(name in levels_by_name) + throw EXCEPTION("Name already in use: [name]") world.maxz++ var/our_z = world.maxz - z_list["[our_z]"] = new /datum/space_level(our_z,name, transition_type = linkage) + var/datum/space_level/S = new /datum/space_level(our_z, name, transition_type = linkage, traits = traits) + levels_by_name[name] = S + z_list["[our_z]"] = S return our_z /datum/zlev_manager/proc/cut_levels_downto(new_maxz) diff --git a/code/modules/store/store.dm b/code/modules/store/store.dm index 7d5fc1e527d..d93d56acc41 100644 --- a/code/modules/store/store.dm +++ b/code/modules/store/store.dm @@ -48,8 +48,7 @@ var/global/datum/store/centcomm_store=new /datum/store/proc/reconnect_database() for(var/obj/machinery/computer/account_database/DB in world) - // TODO: Tie into space manager - if((DB.z in config.station_levels)) + if(is_station_level(DB.z)) linked_db = DB break diff --git a/code/modules/telesci/bscrystal.dm b/code/modules/telesci/bscrystal.dm index 8b86a3082d8..a2ee8cc85ca 100644 --- a/code/modules/telesci/bscrystal.dm +++ b/code/modules/telesci/bscrystal.dm @@ -22,8 +22,7 @@ qdel(src) /obj/item/weapon/ore/bluespace_crystal/proc/blink_mob(var/mob/living/L) - // TODO: Tie into space manager - if(L.z in config.admin_levels) + if(!is_teleport_allowed(L.z)) src.visible_message("[src]'s fragments begin rapidly vibrating and blink out of existence.") qdel(src) return diff --git a/config/example/config.txt b/config/example/config.txt index eb44c6d828a..97c979b77f7 100644 --- a/config/example/config.txt +++ b/config/example/config.txt @@ -260,18 +260,6 @@ GHOST_INTERACTION ## Default is "python" on Windows, "/usr/bin/env python2" on UNIX. #PYTHON_PATH pythonw -## Defines which Z-levels the station exists on. -STATION_LEVELS 1 - -## Defines which Z-levels are used for admin functionality, such as Central Command and the Syndicate Shuttle -ADMIN_LEVELS 2 - -## Defines which Z-levels which, for example, a Code Red announcement may affect -CONTACT_LEVELS 1;5 - -## Defines all Z-levels a character can typically reach -PLAYER_LEVELS 1;3;4;5;6;7 - ## Expected round length in minutes EXPECTED_ROUND_LENGTH 120 diff --git a/config/example/space_levels.txt b/config/example/space_levels.txt deleted file mode 100644 index d40624bb64d..00000000000 --- a/config/example/space_levels.txt +++ /dev/null @@ -1,13 +0,0 @@ -Main Station;1;linked - -Central Command;2;unlinked - -Telecommunications Satellite;3;linked - -Engineering Outpost;4;linked - -Mining Asteroid;5;linked - -Derelicted Station;6;linked - -Empty Area;7;linked \ No newline at end of file diff --git a/paradise.dme b/paradise.dme index c346f801178..e757fd288d3 100644 --- a/paradise.dme +++ b/paradise.dme @@ -2000,6 +2000,8 @@ #include "code\modules\shuttle\supply.dm" #include "code\modules\shuttle\syndicate.dm" #include "code\modules\space_management\heap_space_level.dm" +#include "code\modules\space_management\level_check.dm" +#include "code\modules\space_management\level_traits.dm" #include "code\modules\space_management\space_chunk.dm" #include "code\modules\space_management\space_level.dm" #include "code\modules\space_management\space_transition.dm"

Name

Status

Location

Control

[Bot.hacked ? "(!) [Bot.name]" : Bot.name] ([Bot.model])