Z-Level Compatibility

Now possible to configure 3 different kind of Z-levels.
Station levels: Which Z-levels the station exists on.
Contact levels: Which Z-levels are typically affected by, for example, Code Red which alters the visual state of fire alarms.
Player levels: Which Z-levels a character can typically reach.
This commit is contained in:
PsiOmega
2014-10-30 14:24:59 +01:00
parent 67fbe9a66e
commit bf1e6af508
27 changed files with 77 additions and 48 deletions

View File

@@ -43,7 +43,7 @@
if(!T.implanted) continue
var/loc_display = "Unknown"
var/mob/living/carbon/M = T.imp_in
if(M.z == 1 && !istype(M.loc, /turf/space))
if(M.z in config.station_levels && !istype(M.loc, /turf/space))
var/turf/mob_loc = get_turf(M)
loc_display = mob_loc.loc
if(T.malfunction)

View File

@@ -192,6 +192,12 @@ proc/tg_list2text(list/list, glue=",")
. += copytext(text, last_found, found)
last_found = found + delim_len
while(found)
/proc/text2numlist(text, delimiter="\n")
var/list/num_list = list()
for(var/x in text2list(text, delimiter))
num_list += text2num(x)
return num_list
//Case Sensitive!
/proc/text2listEx(text, delimiter="\n")

View File

@@ -69,7 +69,7 @@
var/cult_ghostwriter = 1 //Allows ghosts to write in blood in cult rounds...
var/cult_ghostwriter_req_cultists = 10 //...so long as this many cultists are active.
var/character_slots = 10 // The number of available character slots
var/max_maint_drones = 5 //This many drones can spawn,
@@ -151,6 +151,10 @@
var/use_lib_nudge = 0 //Use the C library nudge instead of the python nudge.
var/use_overmap = 0
var/list/station_levels = list(1) // Defines which Z-levels the station exists on.
var/list/contact_levels = list(1, 5) // Defines which Z-levels which, for example, a Code Red announcement may affect
var/list/player_levels = list(1, 3, 4, 5, 6) // Defines all Z-levels a character can typically reach
/datum/configuration/New()
var/list/L = typesof(/datum/game_mode) - /datum/game_mode
for (var/T in L)
@@ -495,7 +499,7 @@
if("req_cult_ghostwriter")
config.cult_ghostwriter_req_cultists = text2num(value)
if("character_slots")
config.character_slots = text2num(value)
@@ -511,6 +515,15 @@
if("use_overmap")
config.use_overmap = 1
if("station_levels")
config.station_levels = text2numlist(value, ";")
if("contact_levels")
config.contact_levels = text2numlist(value, ";")
if("player_levels")
config.player_levels = text2numlist(value, ";")
else
log_misc("Unknown setting in configuration: '[name]'")

View File

@@ -66,7 +66,7 @@ var/list/teleportlocs = list()
if(istype(AR, /area/shuttle) || istype(AR, /area/syndicate_station) || istype(AR, /area/wizard_station)) continue
if(teleportlocs.Find(AR.name)) continue
var/turf/picked = pick(get_area_turfs(AR.type))
if (picked.z == 1)
if (picked.z in config.station_levels)
teleportlocs += AR.name
teleportlocs[AR.name] = AR
@@ -83,7 +83,7 @@ var/list/ghostteleportlocs = list()
ghostteleportlocs += AR.name
ghostteleportlocs[AR.name] = AR
var/turf/picked = pick(get_area_turfs(AR.type))
if (picked.z == 1 || picked.z == 3 || picked.z == 4 || picked.z == 5)
if (picked.z in config.player_levels)
ghostteleportlocs += AR.name
ghostteleportlocs[AR.name] = AR

View File

@@ -21,7 +21,7 @@
var/nukecode = "ERROR"
for(var/obj/machinery/nuclearbomb/bomb in machines)
if(bomb && bomb.r_code)
if(bomb.z == 1)
if(bomb.z in station_levels)
nukecode = bomb.r_code
interceptname = "Directive 7-12"
intercepttext += "<FONT size = 3><B>NanoTrasen Update</B>: Biohazard Alert.</FONT><HR>"

View File

@@ -57,7 +57,7 @@
var/list/turfs = new
var/turf/picked
for(var/turf/simulated/floor/T in world)
if(T.z == 1)
if(T.z in station_levels)
turfs += T
for(var/turf/simulated/floor/T in turfs)
if(prob(20))
@@ -185,7 +185,7 @@
//world << sound('sound/AI/aliens.ogg')
var/list/vents = list()
for(var/obj/machinery/atmospherics/unary/vent_pump/temp_vent in machines)
if(temp_vent.loc.z == 1 && !temp_vent.welded && temp_vent.network)
if(!temp_vent.welded && temp_vent.network && temp_vent.loc.z in config.station_levels)
if(temp_vent.network.normal_members.len > 50) // Stops Aliens getting stuck in small networks. See: Security, Virology
vents += temp_vent
@@ -444,21 +444,21 @@ Would like to add a law like "Law x is _______" where x = a number, and _____ is
spawn(0)
world << "Started processing APCs"
for (var/obj/machinery/power/apc/APC in world)
if(APC.z == 1)
if(APC.z in station_levels)
APC.ion_act()
apcnum++
world << "Finished processing APCs. Processed: [apcnum]"
spawn(0)
world << "Started processing SMES"
for (var/obj/machinery/power/smes/SMES in world)
if(SMES.z == 1)
if(SMES.z in station_levels)
SMES.ion_act()
smesnum++
world << "Finished processing SMES. Processed: [smesnum]"
spawn(0)
world << "Started processing AIRLOCKS"
for (var/obj/machinery/door/airlock/D in world)
if(D.z == 1)
if(D.z in station_levels)
//if(length(D.req_access) > 0 && !(12 in D.req_access)) //not counting general access and maintenance airlocks
airlocknum++
spawn(0)
@@ -467,7 +467,7 @@ Would like to add a law like "Law x is _______" where x = a number, and _____ is
spawn(0)
world << "Started processing FIREDOORS"
for (var/obj/machinery/door/firedoor/D in world)
if(D.z == 1)
if(D.z in station_levels)
firedoornum++;
spawn(0)
D.ion_act()

View File

@@ -7,7 +7,7 @@
for(var/obj/machinery/power/smes/S in world)
var/area/current_area = get_area(S)
if(current_area.type in skipped_areas || S.z != 1)
if(current_area.type in skipped_areas || !(S.z in config.station_levels))
continue
S.last_charge = S.charge
S.last_output = S.output
@@ -20,7 +20,7 @@
for(var/obj/machinery/power/apc/C in world)
if(C.cell && C.z == 1)
if(C.cell && C.z in config.station_levels)
C.cell.charge = 0
/proc/power_restore(var/announce = 1)
@@ -29,7 +29,7 @@
if(announce)
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 world)
if(C.cell && C.z == 1)
if(C.cell && C.z in config.station_levels)
C.cell.charge = C.cell.maxcharge
for(var/obj/machinery/power/smes/S in world)
var/area/current_area = get_area(S)

View File

@@ -2,7 +2,7 @@
spawn()
var/list/pick_turfs = list()
for(var/turf/simulated/floor/T in world)
if(T.z == 1)
if(T.z in config.station_levels)
pick_turfs += T
if(pick_turfs.len)

View File

@@ -201,7 +201,7 @@ var/global/datum/controller/gameticker/ticker
switch(M.z)
if(0) //inside a crate or something
var/turf/T = get_turf(M)
if(T && T.z==1) //we don't use M.death(0) because it calls a for(/mob) loop and
if(T && T.z in config.station_levels) //we don't use M.death(0) because it calls a for(/mob) loop and
M.health = 0
M.stat = DEAD
if(1) //on a z-level 1 turf.
@@ -261,7 +261,7 @@ var/global/datum/controller/gameticker/ticker
world << sound('sound/effects/explosionfar.ogg')
cinematic.icon_state = "summary_selfdes"
for(var/mob/living/M in living_mob_list)
if(M.loc.z == 1)
if(M.loc.z in config.station_levels)
M.death()//No mercy
//If its actually the end of the round, wait for it to end.
//Otherwise if its a verb it will continue on afterwards.

View File

@@ -396,7 +396,7 @@ obj/machinery/nuclearbomb/proc/nukehack_win(mob/user as mob)
var/off_station = 0
var/turf/bomb_location = get_turf(src)
if( bomb_location && (bomb_location.z == 1) )
if(bomb_location && (bomb_location.z in config.station_levels))
if( (bomb_location.x < (128-NUKERANGE)) || (bomb_location.x > (128+NUKERANGE)) || (bomb_location.y < (128-NUKERANGE)) || (bomb_location.y > (128+NUKERANGE)) )
off_station = 1
else

View File

@@ -134,7 +134,7 @@
/datum/game_mode/anti_revolution/proc/check_crew_victory()
for(var/datum/mind/head_mind in heads)
var/turf/T = get_turf(head_mind.current)
if((head_mind) && (head_mind.current) && (head_mind.current.stat != 2) && T && (T.z == 1) && !head_mind.is_brigged(600))
if((head_mind) && (head_mind.current) && (head_mind.current.stat != 2) && T && (T.z in station_levels) && !head_mind.is_brigged(600))
if(ishuman(head_mind.current))
return 0
return 1

View File

@@ -337,7 +337,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)
if((rev_mind) && (rev_mind.current) && (rev_mind.current.stat != 2) && T && (T.z == 1))
if((rev_mind) && (rev_mind.current) && (rev_mind.current.stat != 2) && T && (T.z in config.station_levels))
if(ishuman(rev_mind.current))
return 0
return 1

View File

@@ -123,7 +123,7 @@
// probably wanna export this stuff into a separate function for use by both
// revs and heads
//assume that only carbon mobs can become rev heads for now
if(!rev_mind.current:handcuffed && T && T.z == 1)
if(!rev_mind.current:handcuffed && T && T.z in config.station_levels)
return 0
return 1

View File

@@ -1488,8 +1488,9 @@ FIRE ALARM
wiresexposed = 1
pixel_x = (dir & 3)? 0 : (dir == 4 ? -24 : 24)
pixel_y = (dir & 3)? (dir ==1 ? -24 : 24) : 0
if(z == 1 || z == 5)
/obj/machinery/firealarm/initialize()
if(z in config.contact_levels)
if(security_level)
src.overlays += image('icons/obj/monitors.dmi', "overlay_[get_security_level()]")
else

View File

@@ -49,7 +49,7 @@
if(!T.implanted) continue
var/loc_display = "Unknown"
var/mob/living/carbon/M = T.imp_in
if(M.z == 1 && !istype(M.loc, /turf/space))
if(M.z in config.station_levels && !istype(M.loc, /turf/space))
var/turf/mob_loc = get_turf(M)
loc_display = mob_loc.loc
if(T.malfunction)

View File

@@ -973,7 +973,7 @@ var/global/floorIsLava = 0
if(3)
var/count = 0
for(var/mob/living/carbon/monkey/Monkey in world)
if(Monkey.z == 1)
if(Monkey.z in station_levels)
count++
return "Kill all [count] of the monkeys on the station"
if(4)

View File

@@ -2295,7 +2295,7 @@
message_admins("[key_name_admin(usr)] made the floor LAVA! It'll last [length] seconds and it will deal [damage] damage to everyone.", 1)
for(var/turf/simulated/floor/F in world)
if(F.z == 1)
if(F.z in config.station_levels)
F.name = "lava"
F.desc = "The floor is LAVA!"
F.overlays += "lava"
@@ -2320,7 +2320,7 @@
sleep(10)
for(var/turf/simulated/floor/F in world) // Reset everything.
if(F.z == 1)
if(F.z in config.station_levels)
F.name = initial(F.name)
F.desc = initial(F.desc)
F.overlays.Cut()
@@ -2368,7 +2368,7 @@
feedback_inc("admin_secrets_fun_used",1)
feedback_add_details("admin_secrets_fun_used","EgL")
for(var/obj/machinery/door/airlock/W in world)
if(W.z == 1 && !istype(get_area(W), /area/bridge) && !istype(get_area(W), /area/crew_quarters) && !istype(get_area(W), /area/security/prison))
if(W.z in config.station_levels && !istype(get_area(W), /area/bridge) && !istype(get_area(W), /area/crew_quarters) && !istype(get_area(W), /area/security/prison))
W.req_access = list()
message_admins("[key_name_admin(usr)] activated Egalitarian Station mode")
command_announcement.Announce("Centcomm airlock control override activated. Please take this time to get acquainted with your coworkers.", new_sound = 'sound/AI/commandreport.ogg')

View File

@@ -17,7 +17,7 @@
var/inactive_on_main_station = 0
for(var/zone/zone in air_master.zones)
var/turf/simulated/turf = locate() in zone.contents
if(turf && turf.z == 1)
if(turf && turf.z in config.station_levels)
if(zone.needs_update)
active_on_main_station++
else

View File

@@ -21,7 +21,7 @@
/datum/event/alien_infestation/start()
var/list/vents = list()
for(var/obj/machinery/atmospherics/unary/vent_pump/temp_vent in machines)
if(temp_vent.loc.z == 1 && !temp_vent.welded && temp_vent.network)
if(!temp_vent.welded && temp_vent.network && temp_vent.loc.z in config.station_levels)
if(temp_vent.network.normal_members.len > 50) //Stops Aliens getting stuck in small networks. See: Security, Virology
vents += temp_vent

View File

@@ -20,7 +20,7 @@
/datum/event/borer_infestation/start()
var/list/vents = list()
for(var/obj/machinery/atmospherics/unary/vent_pump/temp_vent in world)
if(temp_vent.loc.z == 1 && !temp_vent.welded && temp_vent.network)
if(!temp_vent.welded && temp_vent.network && temp_vent.loc.z in config.station_levels)
//Stops cortical borers getting stuck in small networks. See: Security, Virology
if(temp_vent.network.normal_members.len > 50)
vents += temp_vent

View File

@@ -221,21 +221,21 @@ Would like to add a law like "Law x is _______" where x = a number, and _____ is
spawn(0)
world << "Started processing APCs"
for (var/obj/machinery/power/apc/APC in world)
if(APC.z == 1)
if(APC.z in station_levels)
APC.ion_act()
apcnum++
world << "Finished processing APCs. Processed: [apcnum]"
spawn(0)
world << "Started processing SMES"
for (var/obj/machinery/power/smes/SMES in world)
if(SMES.z == 1)
if(SMES.z in station_levels)
SMES.ion_act()
smesnum++
world << "Finished processing SMES. Processed: [smesnum]"
spawn(0)
world << "Started processing AIRLOCKS"
for (var/obj/machinery/door/airlock/D in world)
if(D.z == 1)
if(D.z in station_levels)
//if(length(D.req_access) > 0 && !(12 in D.req_access)) //not counting general access and maintenance airlocks
airlocknum++
spawn(0)
@@ -244,7 +244,7 @@ Would like to add a law like "Law x is _______" where x = a number, and _____ is
spawn(0)
world << "Started processing FIREDOORS"
for (var/obj/machinery/door/firedoor/D in world)
if(D.z == 1)
if(D.z in station_levels)
firedoornum++;
spawn(0)
D.ion_act()

View File

@@ -19,7 +19,7 @@
/datum/event/spider_infestation/start()
var/list/vents = list()
for(var/obj/machinery/atmospherics/unary/vent_pump/temp_vent in world)
if(temp_vent.loc.z == 1 && !temp_vent.welded && temp_vent.network)
if(!temp_vent.welded && temp_vent.network && temp_vent.loc.z in config.station_levels)
if(temp_vent.network.normal_members.len > 50)
vents += temp_vent

View File

@@ -153,7 +153,7 @@
/obj/machinery/power/apc/Del()
if(malfai && operating)
if (ticker.mode.config_tag == "malfunction")
if (src.z == 1) //if (is_type_in_list(get_area(src), the_station_areas))
if (src.z in config.station_levels) //if (is_type_in_list(get_area(src), the_station_areas))
ticker.mode:apcs--
area.power_light = 0
area.power_equip = 0
@@ -919,7 +919,7 @@
malfai.malfhacking = 0
locked = 1
if (ticker.mode.config_tag == "malfunction")
if (src.z == 1) //if (is_type_in_list(get_area(src), the_station_areas))
if (src.z in config.station_levels) //if (is_type_in_list(get_area(src), the_station_areas))
ticker.mode:apcs++
if(usr:parent)
src.malfai = usr:parent
@@ -951,7 +951,7 @@
if(malfai)
if (ticker.mode.config_tag == "malfunction")
if (src.z == 1) //if (is_type_in_list(get_area(src), the_station_areas))
if (src.z in config.station_levels) //if (is_type_in_list(get_area(src), the_station_areas))
operating ? ticker.mode:apcs++ : ticker.mode:apcs--
src.update()
@@ -1017,7 +1017,7 @@
/obj/machinery/power/apc/proc/ion_act()
//intended to be exactly the same as an AI malf attack
if(!src.malfhack && src.z == 1)
if(!src.malfhack && src.z in config.station_levels)
if(prob(3))
src.locked = 1
if (src.cell.charge > 0)
@@ -1300,7 +1300,7 @@ obj/machinery/power/apc/proc/autoset(var/val, var/on)
/obj/machinery/power/apc/proc/set_broken()
if(malfai && operating)
if (ticker.mode.config_tag == "malfunction")
if (src.z == 1) //if (is_type_in_list(get_area(src), the_station_areas))
if (src.z in config.station_levels) //if (is_type_in_list(get_area(src), the_station_areas))
ticker.mode:apcs--
// Aesthetically much better!
src.visible_message("<span class='notice'>[src]'s screen flickers with warnings briefly!</span>")

View File

@@ -333,7 +333,7 @@
/obj/machinery/power/smes/proc/ion_act()
if(src.z == 1)
if(src.z in config.station_levels)
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)

View File

@@ -26,7 +26,7 @@
security_announcement_down.Announce("[config.alert_desc_green]", "Attention! Security level lowered to green")
security_level = SEC_LEVEL_GREEN
for(var/obj/machinery/firealarm/FA in machines)
if(FA.z == 1 || FA.z == 5)
if(FA.z in config.contact_levels)
FA.overlays = list()
FA.overlays += image('icons/obj/monitors.dmi', "overlay_green")
if(SEC_LEVEL_BLUE)
@@ -36,7 +36,7 @@
security_announcement_down.Announce("[config.alert_desc_blue_downto]", "Attention! Security level lowered to blue")
security_level = SEC_LEVEL_BLUE
for(var/obj/machinery/firealarm/FA in machines)
if(FA.z == 1 || FA.z == 5)
if(FA.z in config.contact_levels)
FA.overlays = list()
FA.overlays += image('icons/obj/monitors.dmi', "overlay_blue")
if(SEC_LEVEL_RED)
@@ -52,7 +52,7 @@
CC.post_status("alert", "redalert")*/
for(var/obj/machinery/firealarm/FA in machines)
if(FA.z == 1 || FA.z == 5)
if(FA.z in config.contact_levels)
FA.overlays = list()
FA.overlays += image('icons/obj/monitors.dmi', "overlay_red")
@@ -60,7 +60,7 @@
security_announcement_up.Announce("[config.alert_desc_delta]", "Attention! Delta security level reached!")
security_level = SEC_LEVEL_DELTA
for(var/obj/machinery/firealarm/FA in machines)
if(FA.z == 1 || FA.z == 5)
if(FA.z in config.contact_levels)
FA.overlays = list()
FA.overlays += image('icons/obj/monitors.dmi', "overlay_delta")
else

View File

@@ -528,7 +528,7 @@ Doing this because FindTurfs() isn't even used
src << "Only administrators may use this command."
return
for(var/turf/T in world)
if(prob(4) && T.z == 1 && istype(T,/turf/station/floor))
if(prob(4) && T.z in station_levels && istype(T,/turf/station/floor))
spawn(50+rand(0,3000))
var/obj/item/weapon/tank/plasmatank/pt = new /obj/item/weapon/tank/plasmatank( T )
pt.gas.temperature = 400+T0C

View File

@@ -263,3 +263,12 @@ CHARACTER_SLOTS 10
## Uncomment to use overmap system for zlevel travel
#USE_OVERMAP
## Defines which Z-levels the station exists on.
STATION_LEVELS 1
## 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