From d05fdb0eb09c804a228c25c6b68156f239df8a16 Mon Sep 17 00:00:00 2001 From: KorPhaeron Date: Mon, 11 Sep 2017 12:39:52 -0500 Subject: [PATCH 01/49] Makes the station Z level into a list instead of a single define --- code/__DEFINES/maps.dm | 2 +- code/__HELPERS/priority_announce.dm | 2 +- code/_globalvars/lists/mapping.dm | 56 +- code/controllers/subsystem/mapping.dm | 2 +- code/controllers/subsystem/minimap.dm | 2 +- code/controllers/subsystem/persistence.dm | 41 +- code/controllers/subsystem/shuttle.dm | 2 +- code/controllers/subsystem/ticker.dm | 2 +- code/datums/antagonists/datum_cult.dm | 2 +- code/datums/diseases/advance/advance.dm | 2 +- code/datums/helper_datums/teleport.dm | 211 +++++++ code/datums/mind.dm | 2 +- code/datums/weather/weather.dm | 2 +- code/datums/weather/weather_types.dm | 6 +- code/game/area/areas.dm | 2 +- code/game/atoms_movable.dm | 4 +- code/game/gamemodes/antag_spawner.dm | 2 +- code/game/gamemodes/blob/blob_report.dm | 4 +- .../clock_helpers/scripture_checks.dm | 2 +- .../clock_items/replica_fabricator.dm | 2 +- .../gamemodes/clock_cult/clock_scripture.dm | 2 +- .../scripture_applications.dm | 2 +- .../clock_scriptures/scripture_judgement.dm | 2 +- .../clock_structures/prolonging_prism.dm | 6 +- code/game/gamemodes/cult/cult.dm | 2 +- code/game/gamemodes/cult/ritual.dm | 7 + code/game/gamemodes/cult/runes.dm | 2 +- code/game/gamemodes/events.dm | 82 +++ code/game/gamemodes/game_mode.dm | 563 ++++++++++++++++++ .../gamemodes/malfunction/Malf_Modules.dm | 12 +- code/game/gamemodes/meteor/meteors.dm | 8 +- .../miniantags/abduction/machinery/camera.dm | 2 +- .../gamemodes/miniantags/bot_swarm/swarmer.dm | 6 +- code/game/gamemodes/nuclear/nuclearbomb.dm | 2 +- code/game/gamemodes/objective.dm | 2 +- code/game/gamemodes/revolution/revolution.dm | 2 +- code/game/machinery/camera/camera.dm | 2 +- .../game/machinery/computer/communications.dm | 2 +- code/game/machinery/computer/prisoner.dm | 2 +- code/game/machinery/firealarm.dm | 4 +- code/game/machinery/status_display.dm | 2 +- .../telecomms/machine_interactions.dm | 4 +- code/game/objects/items/devices/PDA/cart.dm | 4 +- code/modules/admin/admin.dm | 2 +- code/modules/admin/secrets.dm | 2 +- code/modules/admin/verbs/debug.dm | 2 +- code/modules/admin/verbs/one_click_antag.dm | 8 +- code/modules/awaymissions/signpost.dm | 3 +- code/modules/events/alien_infestation.dm | 2 +- code/modules/events/brand_intelligence.dm | 2 +- code/modules/events/disease_outbreak.dm | 2 +- code/modules/events/grid_check.dm | 2 +- code/modules/events/holiday/xmas.dm | 2 +- code/modules/events/immovable_rod.dm | 13 + code/modules/events/portal_storm.dm | 2 +- code/modules/events/radiation_storm.dm | 22 + code/modules/events/sentience.dm | 2 +- code/modules/events/spider_infestation.dm | 40 ++ code/modules/events/vent_clog.dm | 52 ++ .../events/wizard/advanced_darkness.dm | 2 +- code/modules/events/wizard/curseditems.dm | 2 +- code/modules/events/wizard/lava.dm | 2 +- code/modules/events/wizard/petsplosion.dm | 4 +- code/modules/events/wizard/shuffle.dm | 2 +- code/modules/events/wormholes.dm | 2 +- code/modules/mining/aux_base.dm | 8 +- code/modules/mining/aux_base_camera.dm | 3 +- .../mining/equipment/wormhole_jaunter.dm | 4 +- code/modules/mining/machine_redemption.dm | 2 +- code/modules/mining/mine_items.dm | 2 +- code/modules/mob/dead/observer/observer.dm | 2 +- code/modules/mob/living/carbon/human/life.dm | 2 +- .../hostile/megafauna/blood_drunk_miner.dm | 2 +- .../hostile/megafauna/megafauna.dm | 2 +- .../file_system/programs/alarm.dm | 2 +- .../file_system/programs/sm_monitor.dm | 2 +- .../hardware/network_card.dm | 2 +- code/modules/power/apc.dm | 2 +- code/modules/power/singularity/narsie.dm | 2 +- .../mapGenerators/repair.dm | 8 +- .../security_levels/security_levels.dm | 131 ++++ code/modules/shuttle/navigation_computer.dm | 2 +- code/modules/shuttle/shuttle.dm | 4 +- code/modules/shuttle/supply.dm | 2 +- code/modules/shuttle/syndicate.dm | 2 +- code/modules/station_goals/shield.dm | 2 +- 86 files changed, 1322 insertions(+), 110 deletions(-) diff --git a/code/__DEFINES/maps.dm b/code/__DEFINES/maps.dm index 084cc7d1ab..5e7ee3a468 100644 --- a/code/__DEFINES/maps.dm +++ b/code/__DEFINES/maps.dm @@ -35,7 +35,7 @@ Last space-z level = empty //zlevel defines, can be overridden for different maps in the appropriate _maps file. #define ZLEVEL_CENTCOM 1 -#define ZLEVEL_STATION 2 +#define ZLEVEL_STATION_PRIMARY 2 #define ZLEVEL_MINING 5 #define ZLEVEL_LAVALAND 5 #define ZLEVEL_EMPTY_SPACE 12 diff --git a/code/__HELPERS/priority_announce.dm b/code/__HELPERS/priority_announce.dm index d3b9580f37..0ffd8d8580 100644 --- a/code/__HELPERS/priority_announce.dm +++ b/code/__HELPERS/priority_announce.dm @@ -39,7 +39,7 @@ priority_announce("A report has been downloaded and printed out at all communications consoles.", "Incoming Classified Message", 'sound/ai/commandreport.ogg') for(var/obj/machinery/computer/communications/C in GLOB.machines) - if(!(C.stat & (BROKEN|NOPOWER)) && C.z == ZLEVEL_STATION) + if(!(C.stat & (BROKEN|NOPOWER)) && (C.z in GLOB.station_z_levels)) var/obj/item/paper/P = new /obj/item/paper(C.loc) P.name = "paper - '[title]'" P.info = text diff --git a/code/_globalvars/lists/mapping.dm b/code/_globalvars/lists/mapping.dm index 1581c904b9..63bbcf927d 100644 --- a/code/_globalvars/lists/mapping.dm +++ b/code/_globalvars/lists/mapping.dm @@ -4,6 +4,7 @@ #define Z_WEST 4 GLOBAL_LIST_INIT(cardinals, list(NORTH, SOUTH, EAST, WEST)) +<<<<<<< HEAD GLOBAL_LIST_INIT(alldirs, list(NORTH, SOUTH, EAST, WEST, NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST)) GLOBAL_LIST_INIT(diagonals, list(NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST)) @@ -52,4 +53,57 @@ GLOBAL_LIST_EMPTY(awaydestinations) //a list of landmarks that the warpgate can //used by jump-to-area etc. Updated by area/updateName() GLOBAL_LIST_EMPTY(sortedAreas) -GLOBAL_LIST_EMPTY(all_abstract_markers) \ No newline at end of file +GLOBAL_LIST_EMPTY(all_abstract_markers) +======= +GLOBAL_LIST_INIT(alldirs, list(NORTH, SOUTH, EAST, WEST, NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST)) +GLOBAL_LIST_INIT(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 +GLOBAL_LIST_INIT(accessable_z_levels, list(1,3,4,5,6,7)) //Keep this to six maps, repeating z-levels is ok if needed + +GLOBAL_LIST_INIT(station_z_levels, list(ZLEVEL_STATION_PRIMARY)) + +GLOBAL_LIST(global_map) + //list/global_map = list(list(1,5),list(4,3))//an array of map Z levels. + //Resulting sector map looks like + //|_1_|_4_| + //|_5_|_3_| + // + //1 - SS13 + //4 - Derelict + //3 - AI satellite + //5 - empty space + +GLOBAL_LIST_EMPTY(landmarks_list) //list of all landmarks created +GLOBAL_LIST_EMPTY(start_landmarks_list) //list of all spawn points created +GLOBAL_LIST_EMPTY(department_security_spawns) //list of all department security spawns +GLOBAL_LIST_EMPTY(generic_event_spawns) //list of all spawns for events + +GLOBAL_LIST_EMPTY(wizardstart) +GLOBAL_LIST_EMPTY(newplayer_start) +GLOBAL_LIST_EMPTY(prisonwarp) //prisoners go to these +GLOBAL_LIST_EMPTY(holdingfacility) //captured people go here +GLOBAL_LIST_EMPTY(xeno_spawn)//Aliens spawn at these. +GLOBAL_LIST_EMPTY(tdome1) +GLOBAL_LIST_EMPTY(tdome2) +GLOBAL_LIST_EMPTY(tdomeobserve) +GLOBAL_LIST_EMPTY(tdomeadmin) +GLOBAL_LIST_EMPTY(prisonwarped) //list of players already warped +GLOBAL_LIST_EMPTY(blobstart) +GLOBAL_LIST_EMPTY(secequipment) +GLOBAL_LIST_EMPTY(deathsquadspawn) +GLOBAL_LIST_EMPTY(emergencyresponseteamspawn) +GLOBAL_LIST_EMPTY(ruin_landmarks) + + //away missions +GLOBAL_LIST_EMPTY(awaydestinations) //a list of landmarks that the warpgate can take you to + + //used by jump-to-area etc. Updated by area/updateName() +GLOBAL_LIST_EMPTY(sortedAreas) + +GLOBAL_LIST_EMPTY(all_abstract_markers) +>>>>>>> 10a3238... Makes the station Z level into a list instead of a single define (#30297) diff --git a/code/controllers/subsystem/mapping.dm b/code/controllers/subsystem/mapping.dm index 2c36e10d31..f2bb300471 100644 --- a/code/controllers/subsystem/mapping.dm +++ b/code/controllers/subsystem/mapping.dm @@ -117,7 +117,7 @@ SUBSYSTEM_DEF(mapping) var/start_time = REALTIMEOFDAY INIT_ANNOUNCE("Loading [config.map_name]...") - TryLoadZ(config.GetFullMapPath(), FailedZs, ZLEVEL_STATION) + TryLoadZ(config.GetFullMapPath(), FailedZs, ZLEVEL_STATION_PRIMARY) INIT_ANNOUNCE("Loaded station in [(REALTIMEOFDAY - start_time)/10]s!") if(SSdbcore.Connect()) var/datum/DBQuery/query_round_map_name = SSdbcore.NewQuery("UPDATE [format_table_name("round")] SET map_name = '[config.map_name]' WHERE id = [GLOB.round_id]") diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 10c6f8e5c4..4e58212b44 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -5,7 +5,7 @@ SUBSYSTEM_DEF(minimap) var/const/MINIMAP_SIZE = 2048 var/const/TILE_SIZE = 8 - var/list/z_levels = list(ZLEVEL_STATION) + var/list/z_levels = list(ZLEVEL_STATION_PRIMARY) /datum/controller/subsystem/minimap/Initialize(timeofday) var/hash = md5(SSmapping.config.GetFullMapPath()) diff --git a/code/controllers/subsystem/persistence.dm b/code/controllers/subsystem/persistence.dm index 8b8bc81ad2..2029100847 100644 --- a/code/controllers/subsystem/persistence.dm +++ b/code/controllers/subsystem/persistence.dm @@ -21,8 +21,45 @@ SUBSYSTEM_DEF(persistence) ..() /datum/controller/subsystem/persistence/proc/LoadSatchels() +<<<<<<< HEAD secret_satchels = file("data/npc_saves/SecretSatchels[SSmapping.config.map_name].json") if(!fexists(secret_satchels)) +======= + var/placed_satchel = 0 + var/path + var/obj/item/storage/backpack/satchel/flat/F = new() + if(fexists("data/npc_saves/SecretSatchels.sav")) //legacy compatability to convert old format to new + var/savefile/secret_satchels = new /savefile("data/npc_saves/SecretSatchels.sav") + var/sav_text + secret_satchels[SSmapping.config.map_name] >> sav_text + fdel("data/npc_saves/SecretSatchels.sav") + if(sav_text) + old_secret_satchels = splittext(sav_text,"#") + if(old_secret_satchels.len >= 20) + var/satchel_string = pick_n_take(old_secret_satchels) + var/list/chosen_satchel = splittext(satchel_string,"|") + if(chosen_satchel.len == 3) + F.x = text2num(chosen_satchel[1]) + F.y = text2num(chosen_satchel[2]) + F.z = ZLEVEL_STATION_PRIMARY + path = text2path(chosen_satchel[3]) + else + var/json_file = file("data/npc_saves/SecretSatchels[SSmapping.config.map_name].json") + if(!fexists(json_file)) + return + var/list/json = list() + json = json_decode(file2text(json_file)) + old_secret_satchels = json["data"] + if(old_secret_satchels.len) + if(old_secret_satchels.len >= 20) //guards against low drop pools assuring that one player cannot reliably find his own gear. + var/pos = rand(1, old_secret_satchels.len) + old_secret_satchels.Cut(pos, pos+1) + F.x = old_secret_satchels[pos]["x"] + F.y = old_secret_satchels[pos]["y"] + F.z = ZLEVEL_STATION_PRIMARY + path = text2path(old_secret_satchels[pos]["saved_obj"]) + if(!ispath(path)) +>>>>>>> 10a3238... Makes the station Z level into a list instead of a single define (#30297) return satchel_blacklist = typecacheof(list(/obj/item/stack/tile/plasteel, /obj/item/crowbar)) var/list/json = list() @@ -46,7 +83,7 @@ SUBSYSTEM_DEF(persistence) placed_satchel++ var/list/free_satchels = list() - for(var/turf/T in shuffle(block(locate(TRANSITIONEDGE,TRANSITIONEDGE,ZLEVEL_STATION), locate(world.maxx-TRANSITIONEDGE,world.maxy-TRANSITIONEDGE,ZLEVEL_STATION)))) //Nontrivially expensive but it's roundstart only + for(var/turf/T in shuffle(block(locate(TRANSITIONEDGE,TRANSITIONEDGE,ZLEVEL_STATION_PRIMARY), locate(world.maxx-TRANSITIONEDGE,world.maxy-TRANSITIONEDGE,ZLEVEL_STATION_PRIMARY)))) //Nontrivially expensive but it's roundstart only if(isfloorturf(T) && !istype(T, /turf/open/floor/plating/)) free_satchels += new /obj/item/storage/backpack/satchel/flat/secret(T) if(!isemptylist(free_satchels) && ((free_satchels.len + placed_satchel) >= (50 - old_secret_satchels.len) * 0.1)) //up to six tiles, more than enough to kill anything that moves @@ -142,7 +179,7 @@ SUBSYSTEM_DEF(persistence) var/list/satchels = list() for(var/A in new_secret_satchels) var/obj/item/storage/backpack/satchel/flat/F = A - if(QDELETED(F) || F.z != ZLEVEL_STATION || F.invisibility != INVISIBILITY_MAXIMUM) + if(QDELETED(F) || F.z != ZLEVEL_STATION_PRIMARY || F.invisibility != INVISIBILITY_MAXIMUM) continue var/list/savable_obj = list() for(var/obj/O in F) diff --git a/code/controllers/subsystem/shuttle.dm b/code/controllers/subsystem/shuttle.dm index f9774f8cb5..9f6f6f5fb3 100644 --- a/code/controllers/subsystem/shuttle.dm +++ b/code/controllers/subsystem/shuttle.dm @@ -290,7 +290,7 @@ SUBSYSTEM_DEF(shuttle) continue var/turf/T = get_turf(thing) - if(T && T.z == ZLEVEL_STATION) + if(T && (T.z in GLOB.station_z_levels)) callShuttle = 0 break diff --git a/code/controllers/subsystem/ticker.dm b/code/controllers/subsystem/ticker.dm index e51ef0c255..62e07f5355 100755 --- a/code/controllers/subsystem/ticker.dm +++ b/code/controllers/subsystem/ticker.dm @@ -392,7 +392,7 @@ SUBSYSTEM_DEF(ticker) if(bomb && bomb.loc) bombloc = bomb.z else if(!station_missed) - bombloc = ZLEVEL_STATION + bombloc = ZLEVEL_STATION_PRIMARY if(mode) mode.explosion_in_progress = 0 diff --git a/code/datums/antagonists/datum_cult.dm b/code/datums/antagonists/datum_cult.dm index d17b799ca2..8c05c54b21 100644 --- a/code/datums/antagonists/datum_cult.dm +++ b/code/datums/antagonists/datum_cult.dm @@ -40,7 +40,7 @@ if(!GLOB.summon_spots.len) while(GLOB.summon_spots.len < SUMMON_POSSIBILITIES) var/area/summon = pick(GLOB.sortedAreas - GLOB.summon_spots) - if(summon && (summon.z == ZLEVEL_STATION) && summon.valid_territory) + if(summon && (summon.z in GLOB.station_z_levels) && summon.valid_territory) GLOB.summon_spots += summon SSticker.mode.cult_objectives += "eldergod" diff --git a/code/datums/diseases/advance/advance.dm b/code/datums/diseases/advance/advance.dm index 7f09ffa48c..9be242a391 100644 --- a/code/datums/diseases/advance/advance.dm +++ b/code/datums/diseases/advance/advance.dm @@ -413,7 +413,7 @@ AD.Refresh() for(var/mob/living/carbon/human/H in shuffle(GLOB.living_mob_list)) - if(H.z != ZLEVEL_STATION) + if(!(H.z in GLOB.station_z_levels)) continue if(!H.HasDisease(D)) H.ForceContractDisease(D) diff --git a/code/datums/helper_datums/teleport.dm b/code/datums/helper_datums/teleport.dm index fc943a8049..9157eebde3 100644 --- a/code/datums/helper_datums/teleport.dm +++ b/code/datums/helper_datums/teleport.dm @@ -1,3 +1,4 @@ +<<<<<<< HEAD //wrapper /proc/do_teleport(ateleatom, adestination, aprecision=0, afteleport=1, aeffectin=null, aeffectout=null, asoundin=null, asoundout=null) var/datum/teleport/instant/science/D = new @@ -206,6 +207,216 @@ continue if(extended_safety_checks) +======= +//wrapper +/proc/do_teleport(ateleatom, adestination, aprecision=0, afteleport=1, aeffectin=null, aeffectout=null, asoundin=null, asoundout=null) + var/datum/teleport/instant/science/D = new + if(D.start(arglist(args))) + return 1 + return 0 + +/datum/teleport + var/atom/movable/teleatom //atom to teleport + var/atom/destination //destination to teleport to + var/precision = 0 //teleport precision + var/datum/effect_system/effectin //effect to show right before teleportation + var/datum/effect_system/effectout //effect to show right after teleportation + var/soundin //soundfile to play before teleportation + var/soundout //soundfile to play after teleportation + var/force_teleport = 1 //if false, teleport will use Move() proc (dense objects will prevent teleportation) + +/datum/teleport/proc/start(ateleatom, adestination, aprecision=0, afteleport=1, aeffectin=null, aeffectout=null, asoundin=null, asoundout=null) + if(!initTeleport(arglist(args))) + return 0 + return 1 + +/datum/teleport/proc/initTeleport(ateleatom,adestination,aprecision,afteleport,aeffectin,aeffectout,asoundin,asoundout) + if(!setTeleatom(ateleatom)) + return 0 + if(!setDestination(adestination)) + return 0 + if(!setPrecision(aprecision)) + return 0 + setEffects(aeffectin,aeffectout) + setForceTeleport(afteleport) + setSounds(asoundin,asoundout) + return 1 + +//must succeed +/datum/teleport/proc/setPrecision(aprecision) + if(isnum(aprecision)) + precision = aprecision + return 1 + return 0 + +//must succeed +/datum/teleport/proc/setDestination(atom/adestination) + if(istype(adestination)) + destination = adestination + return 1 + return 0 + +//must succeed in most cases +/datum/teleport/proc/setTeleatom(atom/movable/ateleatom) + if(istype(ateleatom, /obj/effect) && !istype(ateleatom, /obj/effect/dummy/chameleon)) + qdel(ateleatom) + return 0 + if(istype(ateleatom)) + teleatom = ateleatom + return 1 + return 0 + +//custom effects must be properly set up first for instant-type teleports +//optional +/datum/teleport/proc/setEffects(datum/effect_system/aeffectin=null,datum/effect_system/aeffectout=null) + effectin = istype(aeffectin) ? aeffectin : null + effectout = istype(aeffectout) ? aeffectout : null + return 1 + +//optional +/datum/teleport/proc/setForceTeleport(afteleport) + force_teleport = afteleport + return 1 + +//optional +/datum/teleport/proc/setSounds(asoundin=null,asoundout=null) + soundin = isfile(asoundin) ? asoundin : null + soundout = isfile(asoundout) ? asoundout : null + return 1 + +//placeholder +/datum/teleport/proc/teleportChecks() + return 1 + +/datum/teleport/proc/playSpecials(atom/location,datum/effect_system/effect,sound) + if(location) + if(effect) + INVOKE_ASYNC(src, .proc/do_effect, location, effect) + if(sound) + INVOKE_ASYNC(src, .proc/do_sound, location, sound) + +/datum/teleport/proc/do_effect(atom/location, datum/effect_system/effect) + src = null + effect.attach(location) + effect.start() + +/datum/teleport/proc/do_sound(atom/location, sound) + src = null + playsound(location, sound, 60, 1) + +//do the monkey dance +/datum/teleport/proc/doTeleport() + + var/turf/destturf + var/turf/curturf = get_turf(teleatom) + destturf = get_teleport_turf(get_turf(destination), precision) + + if(!destturf || !curturf || destturf.is_transition_turf()) + return 0 + + var/area/A = get_area(curturf) + if(A.noteleport) + return 0 + + playSpecials(curturf,effectin,soundin) + if(force_teleport) + teleatom.forceMove(destturf) + if(ismegafauna(teleatom)) + message_admins("[teleatom] [ADMIN_FLW(teleatom)] has teleported from [ADMIN_COORDJMP(curturf)] to [ADMIN_COORDJMP(destturf)].") + playSpecials(destturf,effectout,soundout) + else + if(teleatom.Move(destturf)) + playSpecials(destturf,effectout,soundout) + if(ismegafauna(teleatom)) + message_admins("[teleatom] [ADMIN_FLW(teleatom)] has teleported from [ADMIN_COORDJMP(curturf)] to [ADMIN_COORDJMP(destturf)].") + return 1 + +/datum/teleport/proc/teleport() + if(teleportChecks()) + return doTeleport() + return 0 + +/datum/teleport/instant //teleports when datum is created + + start(ateleatom, adestination, aprecision=0, afteleport=1, aeffectin=null, aeffectout=null, asoundin=null, asoundout=null) + if(..()) + if(teleport()) + return 1 + return 0 + + +/datum/teleport/instant/science + +/datum/teleport/instant/science/setEffects(datum/effect_system/aeffectin,datum/effect_system/aeffectout) + if(aeffectin==null || aeffectout==null) + var/datum/effect_system/spark_spread/aeffect = new + aeffect.set_up(5, 1, teleatom) + effectin = effectin || aeffect + effectout = effectout || aeffect + return 1 + else + return ..() + +/datum/teleport/instant/science/setPrecision(aprecision) + ..() + if(istype(teleatom, /obj/item/storage/backpack/holding)) + precision = rand(1,100) + + var/list/bagholding = teleatom.search_contents_for(/obj/item/storage/backpack/holding) + if(bagholding.len) + precision = max(rand(1,100)*bagholding.len,100) + if(isliving(teleatom)) + var/mob/living/MM = teleatom + to_chat(MM, "The bluespace interface on your bag of holding interferes with the teleport!") + return 1 + +// Safe location finder + +/proc/find_safe_turf(zlevel = ZLEVEL_STATION_PRIMARY, list/zlevels, extended_safety_checks = FALSE) + if(!zlevels) + zlevels = list(zlevel) + var/cycles = 1000 + for(var/cycle in 1 to cycles) + // DRUNK DIALLING WOOOOOOOOO + var/x = rand(1, world.maxx) + var/y = rand(1, world.maxy) + var/z = pick(zlevels) + var/random_location = locate(x,y,z) + + if(!isfloorturf(random_location)) + continue + var/turf/open/floor/F = random_location + if(!F.air) + continue + + var/datum/gas_mixture/A = F.air + var/list/A_gases = A.gases + var/trace_gases + for(var/id in A_gases) + if(id in GLOB.hardcoded_gases) + continue + trace_gases = TRUE + break + + // Can most things breathe? + if(trace_gases) + continue + if(!(A_gases["o2"] && A_gases["o2"][MOLES] >= 16)) + continue + if(A_gases["plasma"]) + continue + if(A_gases["co2"] && A_gases["co2"][MOLES] >= 10) + continue + + // Aim for goldilocks temperatures and pressure + if((A.temperature <= 270) || (A.temperature >= 360)) + continue + var/pressure = A.return_pressure() + if((pressure <= 20) || (pressure >= 550)) + continue + + if(extended_safety_checks) +>>>>>>> 10a3238... Makes the station Z level into a list instead of a single define (#30297) if(istype(F, /turf/open/lava)) //chasms aren't /floor, and so are pre-filtered var/turf/open/lava/L = F if(!L.is_safe()) diff --git a/code/datums/mind.dm b/code/datums/mind.dm index 78a402a2dc..9570fac07e 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -535,7 +535,7 @@ if(I == src) continue var/mob/M = I - if(M.z == ZLEVEL_STATION && !M.stat) + if((M.z in GLOB.station_z_levels) && !M.stat) last_healthy_headrev = FALSE break text += "head | not mindshielded | employee | [last_healthy_headrev ? "LAST " : ""]HEADREV | rev" diff --git a/code/datums/weather/weather.dm b/code/datums/weather/weather.dm index f4f2fc089c..a2abdf64a1 100644 --- a/code/datums/weather/weather.dm +++ b/code/datums/weather/weather.dm @@ -30,7 +30,7 @@ var/area_type = /area/space //Types of area to affect var/list/impacted_areas = list() //Areas to be affected by the weather, calculated when the weather begins var/list/protected_areas = list()//Areas that are protected and excluded from the affected areas. - var/target_z = ZLEVEL_STATION //The z-level to affect + var/target_z = ZLEVEL_STATION_PRIMARY //The z-level to affect var/overlay_layer = AREA_LAYER //Since it's above everything else, this is the layer used by default. TURF_LAYER is below mobs and walls if you need to use that. var/aesthetic = FALSE //If the weather has no purpose other than looks diff --git a/code/datums/weather/weather_types.dm b/code/datums/weather/weather_types.dm index d23bf3c8a6..3368dcf1dd 100644 --- a/code/datums/weather/weather_types.dm +++ b/code/datums/weather/weather_types.dm @@ -17,7 +17,7 @@ area_type = /area protected_areas = list(/area/space) - target_z = ZLEVEL_STATION + target_z = ZLEVEL_STATION_PRIMARY overlay_layer = ABOVE_OPEN_TURF_LAYER //Covers floors only immunity_type = "lava" @@ -48,7 +48,7 @@ end_duration = 0 area_type = /area - target_z = ZLEVEL_STATION + target_z = ZLEVEL_STATION_PRIMARY /datum/weather/advanced_darkness/update_areas() for(var/V in impacted_areas) @@ -142,7 +142,7 @@ area_type = /area protected_areas = list(/area/maintenance, /area/ai_monitored/turret_protected/ai_upload, /area/ai_monitored/turret_protected/ai_upload_foyer, /area/ai_monitored/turret_protected/ai, /area/storage/emergency/starboard, /area/storage/emergency/port, /area/shuttle) - target_z = ZLEVEL_STATION + target_z = ZLEVEL_STATION_PRIMARY immunity_type = "rad" diff --git a/code/game/area/areas.dm b/code/game/area/areas.dm index 0baef4ace8..5acc64fbb8 100644 --- a/code/game/area/areas.dm +++ b/code/game/area/areas.dm @@ -75,7 +75,7 @@ GLOBAL_LIST_EMPTY(teleportlocs) if(GLOB.teleportlocs[AR.name]) continue var/turf/picked = safepick(get_area_turfs(AR.type)) - if (picked && (picked.z == ZLEVEL_STATION)) + if (picked && (picked.z in GLOB.station_z_levels)) GLOB.teleportlocs[AR.name] = AR sortTim(GLOB.teleportlocs, /proc/cmp_text_dsc) diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index 38c815ee43..ce1d0b1560 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -560,7 +560,7 @@ flags_2 |= STATIONLOVING_2 /atom/movable/proc/relocate() - var/targetturf = find_safe_turf(ZLEVEL_STATION) + var/targetturf = find_safe_turf(ZLEVEL_STATION_PRIMARY) if(!targetturf) if(GLOB.blobstart.len > 0) targetturf = get_turf(pick(GLOB.blobstart)) @@ -592,7 +592,7 @@ /atom/movable/proc/in_bounds() . = FALSE var/turf/currentturf = get_turf(src) - if(currentturf && (currentturf.z == ZLEVEL_CENTCOM || currentturf.z == ZLEVEL_STATION || currentturf.z == ZLEVEL_TRANSIT)) + if(currentturf && (currentturf.z == ZLEVEL_CENTCOM || (currentturf.z in GLOB.station_z_levels) || currentturf.z == ZLEVEL_TRANSIT)) . = TRUE diff --git a/code/game/gamemodes/antag_spawner.dm b/code/game/gamemodes/antag_spawner.dm index ab9c041efe..15dd4157fe 100644 --- a/code/game/gamemodes/antag_spawner.dm +++ b/code/game/gamemodes/antag_spawner.dm @@ -238,7 +238,7 @@ /obj/item/antag_spawner/slaughter_demon/attack_self(mob/user) - if(user.z != ZLEVEL_STATION) + if(!(user.z in GLOB.station_z_levels)) to_chat(user, "You should probably wait until you reach the station.") return if(used) diff --git a/code/game/gamemodes/blob/blob_report.dm b/code/game/gamemodes/blob/blob_report.dm index ea6bd07c58..e90626485a 100644 --- a/code/game/gamemodes/blob/blob_report.dm +++ b/code/game/gamemodes/blob/blob_report.dm @@ -19,7 +19,7 @@ var/nukecode = random_nukecode() for(var/obj/machinery/nuclearbomb/bomb in GLOB.machines) if(bomb && bomb.r_code) - if(bomb.z == ZLEVEL_STATION) + if(bomb.z in GLOB.station_z_levels) bomb.r_code = nukecode intercepttext += "NanoTrasen Update: Biohazard Alert.
" @@ -91,7 +91,7 @@ if(count_territories) var/list/valid_territories = list() for(var/area/A in world) //First, collect all area types on the station zlevel - if(A.z == ZLEVEL_STATION) + if(A.z in GLOB.station_z_levels) if(!(A.type in valid_territories) && A.valid_territory) valid_territories |= A.type if(valid_territories.len) diff --git a/code/game/gamemodes/clock_cult/clock_helpers/scripture_checks.dm b/code/game/gamemodes/clock_cult/clock_helpers/scripture_checks.dm index d6e56f38d5..d8281242ef 100644 --- a/code/game/gamemodes/clock_cult/clock_helpers/scripture_checks.dm +++ b/code/game/gamemodes/clock_cult/clock_helpers/scripture_checks.dm @@ -31,7 +31,7 @@ var/mob/living/silicon/ai/AI = ai if(AI.deployed_shell && is_servant_of_ratvar(AI.deployed_shell)) continue - if(is_servant_of_ratvar(AI) || !isturf(AI.loc) || AI.z != ZLEVEL_STATION || AI.stat == DEAD) + if(is_servant_of_ratvar(AI) || !isturf(AI.loc) || !(AI.z in GLOB.station_z_levels) || AI.stat == DEAD) continue .++ diff --git a/code/game/gamemodes/clock_cult/clock_items/replica_fabricator.dm b/code/game/gamemodes/clock_cult/clock_items/replica_fabricator.dm index 3f7e826017..a99e74982a 100644 --- a/code/game/gamemodes/clock_cult/clock_items/replica_fabricator.dm +++ b/code/game/gamemodes/clock_cult/clock_items/replica_fabricator.dm @@ -196,7 +196,7 @@ fabrication_values["power_cost"] = 0 var/turf/Y = get_turf(user) - if(!Y || (Y.z != ZLEVEL_STATION && Y.z != ZLEVEL_CENTCOM && Y.z != ZLEVEL_MINING && Y.z != ZLEVEL_LAVALAND)) + if(!Y || (!(Y.z in GLOB.station_z_levels) && Y.z != ZLEVEL_CENTCOM && Y.z != ZLEVEL_MINING && Y.z != ZLEVEL_LAVALAND)) fabrication_values["operation_time"] *= 2 if(fabrication_values["power_cost"] > 0) fabrication_values["power_cost"] *= 2 diff --git a/code/game/gamemodes/clock_cult/clock_scripture.dm b/code/game/gamemodes/clock_cult/clock_scripture.dm index 318d3e243d..806d08dffb 100644 --- a/code/game/gamemodes/clock_cult/clock_scripture.dm +++ b/code/game/gamemodes/clock_cult/clock_scripture.dm @@ -158,7 +158,7 @@ Judgement: 12 servants, 5 caches, 300 CV, and any existing AIs are converted or /datum/clockwork_scripture/proc/check_offstation_penalty() var/turf/T = get_turf(invoker) - if(!T || (T.z != ZLEVEL_STATION && T.z != ZLEVEL_CENTCOM && T.z != ZLEVEL_MINING && T.z != ZLEVEL_LAVALAND)) + if(!T || (!(T.z in GLOB.station_z_levels) && T.z != ZLEVEL_CENTCOM && T.z != ZLEVEL_MINING && T.z != ZLEVEL_LAVALAND)) channel_time *= 2 for(var/i in consumed_components) if(consumed_components[i]) diff --git a/code/game/gamemodes/clock_cult/clock_scriptures/scripture_applications.dm b/code/game/gamemodes/clock_cult/clock_scriptures/scripture_applications.dm index d0b7f11eb4..2930088ca2 100644 --- a/code/game/gamemodes/clock_cult/clock_scriptures/scripture_applications.dm +++ b/code/game/gamemodes/clock_cult/clock_scriptures/scripture_applications.dm @@ -175,7 +175,7 @@ to_chat(invoker, "\"It is too late to construct one of these, champion.\"") return FALSE var/turf/T = get_turf(invoker) - if(!T || T.z != ZLEVEL_STATION) + if(!T || !(T.z in GLOB.station_z_levels)) to_chat(invoker, "\"You must be on the station to construct one of these, champion.\"") return FALSE return ..() diff --git a/code/game/gamemodes/clock_cult/clock_scriptures/scripture_judgement.dm b/code/game/gamemodes/clock_cult/clock_scriptures/scripture_judgement.dm index e7beff846f..c7daef1450 100644 --- a/code/game/gamemodes/clock_cult/clock_scriptures/scripture_judgement.dm +++ b/code/game/gamemodes/clock_cult/clock_scriptures/scripture_judgement.dm @@ -33,7 +33,7 @@ return FALSE var/area/A = get_area(invoker) var/turf/T = get_turf(invoker) - if(!T || T.z != ZLEVEL_STATION || istype(A, /area/shuttle) || !A.blob_allowed) + if(!T || !(T.z in GLOB.station_z_levels) || istype(A, /area/shuttle) || !A.blob_allowed) to_chat(invoker, "You must be on the station to activate the Ark!") return FALSE if(GLOB.clockwork_gateway_activated) diff --git a/code/game/gamemodes/clock_cult/clock_structures/prolonging_prism.dm b/code/game/gamemodes/clock_cult/clock_structures/prolonging_prism.dm index cf730189e3..d416860ea1 100644 --- a/code/game/gamemodes/clock_cult/clock_structures/prolonging_prism.dm +++ b/code/game/gamemodes/clock_cult/clock_structures/prolonging_prism.dm @@ -48,7 +48,7 @@ if(active) return 0 var/turf/T = get_turf(src) - if(!T || T.z != ZLEVEL_STATION) + if(!T || !(T.z in GLOB.station_z_levels)) to_chat(user, "[src] must be on the station to function!") return 0 if(SSshuttle.emergency.mode != SHUTTLE_CALL) @@ -63,7 +63,7 @@ /obj/structure/destructible/clockwork/powered/prolonging_prism/process() var/turf/own_turf = get_turf(src) - if(SSshuttle.emergency.mode != SHUTTLE_CALL || delay_remaining <= 0 || !own_turf || own_turf.z != ZLEVEL_STATION) + if(SSshuttle.emergency.mode != SHUTTLE_CALL || delay_remaining <= 0 || !own_turf || !(own_turf.z in GLOB.station_z_levels)) forced_disable(FALSE) return . = ..() @@ -97,7 +97,7 @@ mean_x = Ceiling(mean_x) else mean_x = Floor(mean_x) - var/turf/semi_random_center_turf = locate(mean_x, mean_y, ZLEVEL_STATION) + var/turf/semi_random_center_turf = locate(mean_x, mean_y, ZLEVEL_STATION_PRIMARY) for(var/t in getline(src, semi_random_center_turf)) prism_turfs[t] = TRUE var/placement_style = prob(50) diff --git a/code/game/gamemodes/cult/cult.dm b/code/game/gamemodes/cult/cult.dm index 06407079ce..f7c871168f 100644 --- a/code/game/gamemodes/cult/cult.dm +++ b/code/game/gamemodes/cult/cult.dm @@ -104,7 +104,7 @@ if(!GLOB.summon_spots.len) while(GLOB.summon_spots.len < SUMMON_POSSIBILITIES) var/area/summon = pick(GLOB.sortedAreas - GLOB.summon_spots) - if((summon.z == ZLEVEL_STATION) && summon.valid_territory) + if((summon.z in GLOB.station_z_levels) && summon.valid_territory) GLOB.summon_spots += summon cult_objectives += "eldergod" diff --git a/code/game/gamemodes/cult/ritual.dm b/code/game/gamemodes/cult/ritual.dm index 06f0910c19..bcf4afb147 100644 --- a/code/game/gamemodes/cult/ritual.dm +++ b/code/game/gamemodes/cult/ritual.dm @@ -257,8 +257,15 @@ This file contains the arcane tome files. to_chat(user, "There is already a rune here.") return FALSE +<<<<<<< HEAD if(T.z != ZLEVEL_STATION && T.z != ZLEVEL_MINING) to_chat(user, "The veil is not weak enough here.") +======= + + if(!(T.z in GLOB.station_z_levels) && T.z != ZLEVEL_MINING) + to_chat(user, "The veil is not weak enough here.") + +>>>>>>> 10a3238... Makes the station Z level into a list instead of a single define (#30297) return FALSE return TRUE diff --git a/code/game/gamemodes/cult/runes.dm b/code/game/gamemodes/cult/runes.dm index 936afe9090..089265d2fb 100644 --- a/code/game/gamemodes/cult/runes.dm +++ b/code/game/gamemodes/cult/runes.dm @@ -465,7 +465,7 @@ structure_check() searches for nearby cultist structures required for the invoca /obj/effect/rune/narsie/invoke(var/list/invokers) if(used) return - if(z != ZLEVEL_STATION) + if(!(z in GLOB.station_z_levels)) return if(locate(/obj/singularity/narsie) in GLOB.poi_list) diff --git a/code/game/gamemodes/events.dm b/code/game/gamemodes/events.dm index a56a2d6647..49eeeb2e6f 100644 --- a/code/game/gamemodes/events.dm +++ b/code/game/gamemodes/events.dm @@ -1,3 +1,4 @@ +<<<<<<< HEAD /proc/power_failure() priority_announce("Abnormal activity detected in [station_name()]'s powernet. As a precautionary measure, the station's power will be shut off for an indeterminate duration.", "Critical Power Failure", 'sound/ai/poweroff.ogg') for(var/obj/machinery/power/smes/S in GLOB.machines) @@ -60,10 +61,75 @@ S.update_icon() S.power_change() for(var/area/A in world) +======= +/proc/power_failure() + priority_announce("Abnormal activity detected in [station_name()]'s powernet. As a precautionary measure, the station's power will be shut off for an indeterminate duration.", "Critical Power Failure", 'sound/ai/poweroff.ogg') + for(var/obj/machinery/power/smes/S in GLOB.machines) + if(istype(get_area(S), /area/ai_monitored/turret_protected) || !(S.z in GLOB.station_z_levels)) + continue + S.charge = 0 + S.output_level = 0 + S.output_attempt = 0 + S.update_icon() + S.power_change() + + var/list/skipped_areas = list(/area/engine/engineering, /area/engine/supermatter, /area/engine/atmospherics_engine, /area/ai_monitored/turret_protected/ai) + + for(var/area/A in world) + if( !A.requires_power || A.always_unpowered ) + continue + + var/skip = 0 + for(var/area_type in skipped_areas) + if(istype(A,area_type)) + skip = 1 + break + if(A.contents) + for(var/atom/AT in A.contents) + if(!(AT.z in GLOB.station_z_levels)) //Only check one, it's enough. + skip = 1 + break + if(skip) continue + A.power_light = FALSE + A.power_equip = FALSE + A.power_environ = FALSE + A.power_change() + + for(var/obj/machinery/power/apc/C in GLOB.apcs_list) + if(C.cell && (C.z in GLOB.station_z_levels)) + var/area/A = C.area + + var/skip = 0 + for(var/area_type in skipped_areas) + if(istype(A,area_type)) + skip = 1 + break + if(skip) continue + + C.cell.charge = 0 + +/proc/power_restore() + + priority_announce("Power has been restored to [station_name()]. We apologize for the inconvenience.", "Power Systems Nominal", 'sound/ai/poweron.ogg') + for(var/obj/machinery/power/apc/C in GLOB.machines) + if(C.cell && (C.z in GLOB.station_z_levels)) + C.cell.charge = C.cell.maxcharge + C.failure_timer = 0 + for(var/obj/machinery/power/smes/S in GLOB.machines) + if(!(S.z in GLOB.station_z_levels)) + continue + S.charge = S.capacity + S.output_level = S.output_level_max + S.output_attempt = 1 + S.update_icon() + S.power_change() + for(var/area/A in world) +>>>>>>> 10a3238... Makes the station Z level into a list instead of a single define (#30297) if(!istype(A, /area/space) && !istype(A, /area/shuttle) && !istype(A, /area/arrival)) A.power_light = TRUE A.power_equip = TRUE A.power_environ = TRUE +<<<<<<< HEAD A.power_change() /proc/power_restore_quick() @@ -78,3 +144,19 @@ S.update_icon() S.power_change() +======= + A.power_change() + +/proc/power_restore_quick() + + priority_announce("All SMESs on [station_name()] have been recharged. We apologize for the inconvenience.", "Power Systems Nominal", 'sound/ai/poweron.ogg') + for(var/obj/machinery/power/smes/S in GLOB.machines) + if(!(S.z in GLOB.station_z_levels)) + continue + S.charge = S.capacity + S.output_level = S.output_level_max + S.output_attempt = 1 + S.update_icon() + S.power_change() + +>>>>>>> 10a3238... Makes the station Z level into a list instead of a single define (#30297) diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index 1aee6ee7d3..3e08bf91f3 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -1,3 +1,4 @@ +<<<<<<< HEAD /* @@ -591,3 +592,565 @@ for(var/V in station_goals) var/datum/station_goal/G = V G.print_result() +======= + + +/* + * GAMEMODES (by Rastaf0) + * + * In the new mode system all special roles are fully supported. + * You can have proper wizards/traitors/changelings/cultists during any mode. + * Only two things really depends on gamemode: + * 1. Starting roles, equipment and preparations + * 2. Conditions of finishing the round. + * + */ + + +/datum/game_mode + var/name = "invalid" + var/config_tag = null + var/votable = 1 + var/probability = 0 + var/station_was_nuked = 0 //see nuclearbomb.dm and malfunction.dm + var/explosion_in_progress = 0 //sit back and relax + var/round_ends_with_antag_death = 0 //flags the "one verse the station" antags as such + var/list/datum/mind/modePlayer = new + var/list/datum/mind/antag_candidates = list() // List of possible starting antags goes here + var/list/restricted_jobs = list() // Jobs it doesn't make sense to be. I.E chaplain or AI cultist + var/list/protected_jobs = list() // Jobs that can't be traitors because + var/required_players = 0 + var/maximum_players = -1 // -1 is no maximum, positive numbers limit the selection of a mode on overstaffed stations + var/required_enemies = 0 + var/recommended_enemies = 0 + var/antag_flag = null //preferences flag such as BE_WIZARD that need to be turned on for players to be antag + var/mob/living/living_antag_player = null + var/list/datum/game_mode/replacementmode = null + var/round_converted = 0 //0: round not converted, 1: round going to convert, 2: round converted + var/reroll_friendly //During mode conversion only these are in the running + var/continuous_sanity_checked //Catches some cases where config options could be used to suggest that modes without antagonists should end when all antagonists die + var/enemy_minimum_age = 7 //How many days must players have been playing before they can play this antagonist + + var/announce_span = "warning" //The gamemode's name will be in this span during announcement. + var/announce_text = "This gamemode forgot to set a descriptive text! Uh oh!" //Used to describe a gamemode when it's announced. + + var/const/waittime_l = 600 + var/const/waittime_h = 1800 // started at 1800 + + var/list/datum/station_goal/station_goals = list() + + var/allow_persistence_save = TRUE + +/datum/game_mode/proc/announce() //Shows the gamemode's name and a fast description. + to_chat(world, "The gamemode is: [name]!") + to_chat(world, "[announce_text]") + + +///Checks to see if the game can be setup and ran with the current number of players or whatnot. +/datum/game_mode/proc/can_start() + var/playerC = 0 + for(var/mob/dead/new_player/player in GLOB.player_list) + if((player.client)&&(player.ready == PLAYER_READY_TO_PLAY)) + playerC++ + if(!GLOB.Debug2) + if(playerC < required_players || (maximum_players >= 0 && playerC > maximum_players)) + return 0 + antag_candidates = get_players_for_role(antag_flag) + if(!GLOB.Debug2) + if(antag_candidates.len < required_enemies) + return 0 + return 1 + else + message_admins("DEBUG: GAME STARTING WITHOUT PLAYER NUMBER CHECKS, THIS WILL PROBABLY BREAK SHIT.") + return 1 + + +///Attempts to select players for special roles the mode might have. +/datum/game_mode/proc/pre_setup() + return 1 + + +///Everyone should now be on the station and have their normal gear. This is the place to give the special roles extra things +/datum/game_mode/proc/post_setup(report) //Gamemodes can override the intercept report. Passing TRUE as the argument will force a report. + if(!report) + report = config.intercept + addtimer(CALLBACK(GLOBAL_PROC, .proc/display_roundstart_logout_report), ROUNDSTART_LOGOUT_REPORT_TIME) + + if(SSdbcore.Connect()) + var/sql + if(SSticker.mode) + sql += "game_mode = '[SSticker.mode]'" + if(GLOB.revdata.originmastercommit) + if(sql) + sql += ", " + sql += "commit_hash = '[GLOB.revdata.originmastercommit]'" + if(sql) + var/datum/DBQuery/query_round_game_mode = SSdbcore.NewQuery("UPDATE [format_table_name("round")] SET [sql] WHERE id = [GLOB.round_id]") + query_round_game_mode.Execute() + if(report) + addtimer(CALLBACK(src, .proc/send_intercept, 0), rand(waittime_l, waittime_h)) + generate_station_goals() + return 1 + + +///Handles late-join antag assignments +/datum/game_mode/proc/make_antag_chance(mob/living/carbon/human/character) + if(replacementmode && round_converted == 2) + replacementmode.make_antag_chance(character) + return + + +///Allows rounds to basically be "rerolled" should the initial premise fall through. Also known as mulligan antags. +/datum/game_mode/proc/convert_roundtype() + set waitfor = FALSE + var/list/living_crew = list() + + for(var/mob/Player in GLOB.mob_list) + if(Player.mind && Player.stat != DEAD && !isnewplayer(Player) && !isbrain(Player) && Player.client) + living_crew += Player + if(living_crew.len / GLOB.joined_player_list.len <= config.midround_antag_life_check) //If a lot of the player base died, we start fresh + message_admins("Convert_roundtype failed due to too many dead people. Limit is [config.midround_antag_life_check * 100]% living crew") + return null + + var/list/datum/game_mode/runnable_modes = config.get_runnable_midround_modes(living_crew.len) + var/list/datum/game_mode/usable_modes = list() + for(var/datum/game_mode/G in runnable_modes) + if(G.reroll_friendly && living_crew >= G.required_players) + usable_modes += G + else + qdel(G) + + if(!usable_modes) + message_admins("Convert_roundtype failed due to no valid modes to convert to. Please report this error to the Coders.") + return null + + replacementmode = pickweight(usable_modes) + + switch(SSshuttle.emergency.mode) //Rounds on the verge of ending don't get new antags, they just run out + if(SHUTTLE_STRANDED, SHUTTLE_ESCAPE) + return 1 + if(SHUTTLE_CALL) + if(SSshuttle.emergency.timeLeft(1) < initial(SSshuttle.emergencyCallTime)*0.5) + return 1 + + if(world.time >= (config.midround_antag_time_check * 600)) + message_admins("Convert_roundtype failed due to round length. Limit is [config.midround_antag_time_check] minutes.") + return null + + var/list/antag_candidates = list() + + for(var/mob/living/carbon/human/H in living_crew) + if(H.client && H.client.prefs.allow_midround_antag) + antag_candidates += H + + if(!antag_candidates) + message_admins("Convert_roundtype failed due to no antag candidates.") + return null + + antag_candidates = shuffle(antag_candidates) + + if(config.protect_roles_from_antagonist) + replacementmode.restricted_jobs += replacementmode.protected_jobs + if(config.protect_assistant_from_antagonist) + replacementmode.restricted_jobs += "Assistant" + + message_admins("The roundtype will be converted. If you have other plans for the station or feel the station is too messed up to inhabit stop the creation of antags or end the round now.") + + . = 1 + sleep(rand(600,1800)) + if(!SSticker.IsRoundInProgress()) + message_admins("Roundtype conversion cancelled, the game appears to have finished!") + round_converted = 0 + return + //somewhere between 1 and 3 minutes from now + if(!config.midround_antag[SSticker.mode.config_tag]) + round_converted = 0 + return 1 + for(var/mob/living/carbon/human/H in antag_candidates) + replacementmode.make_antag_chance(H) + round_converted = 2 + message_admins("-- IMPORTANT: The roundtype has been converted to [replacementmode.name], antagonists may have been created! --") + + +///Called by the gameSSticker +/datum/game_mode/process() + return 0 + + +/datum/game_mode/proc/check_finished(force_ending) //to be called by SSticker + if(replacementmode && round_converted == 2) + return replacementmode.check_finished() + if(SSshuttle.emergency && (SSshuttle.emergency.mode == SHUTTLE_ENDGAME)) + return TRUE + if(station_was_nuked) + return TRUE + if(!round_converted && (!config.continuous[config_tag] || (config.continuous[config_tag] && config.midround_antag[config_tag]))) //Non-continuous or continous with replacement antags + if(!continuous_sanity_checked) //make sure we have antags to be checking in the first place + for(var/mob/Player in GLOB.mob_list) + if(Player.mind) + if(Player.mind.special_role) + continuous_sanity_checked = 1 + return 0 + if(!continuous_sanity_checked) + message_admins("The roundtype ([config_tag]) has no antagonists, continuous round has been defaulted to on and midround_antag has been defaulted to off.") + config.continuous[config_tag] = 1 + config.midround_antag[config_tag] = 0 + SSshuttle.clearHostileEnvironment(src) + return 0 + + + if(living_antag_player && living_antag_player.mind && isliving(living_antag_player) && living_antag_player.stat != DEAD && !isnewplayer(living_antag_player) &&!isbrain(living_antag_player)) + return 0 //A resource saver: once we find someone who has to die for all antags to be dead, we can just keep checking them, cycling over everyone only when we lose our mark. + + for(var/mob/Player in GLOB.living_mob_list) + if(Player.mind && Player.stat != DEAD && !isnewplayer(Player) &&!isbrain(Player) && Player.client) + if(Player.mind.special_role) //Someone's still antaging! + living_antag_player = Player + return 0 + + if(!config.continuous[config_tag] || force_ending) + return 1 + + else + round_converted = convert_roundtype() + if(!round_converted) + if(round_ends_with_antag_death) + return 1 + else + config.midround_antag[config_tag] = 0 + return 0 + + return 0 + + +/datum/game_mode/proc/declare_completion() + var/clients = 0 + var/surviving_humans = 0 + var/surviving_total = 0 + var/ghosts = 0 + var/escaped_humans = 0 + var/escaped_total = 0 + + for(var/mob/M in GLOB.player_list) + if(M.client) + clients++ + if(ishuman(M)) + if(!M.stat) + surviving_humans++ + if(M.z == ZLEVEL_CENTCOM) + escaped_humans++ + if(!M.stat) + surviving_total++ + if(M.z == ZLEVEL_CENTCOM) + escaped_total++ + + + if(isobserver(M)) + ghosts++ + + if(clients > 0) + SSblackbox.set_val("round_end_clients",clients) + if(ghosts > 0) + SSblackbox.set_val("round_end_ghosts",ghosts) + if(surviving_humans > 0) + SSblackbox.set_val("survived_human",surviving_humans) + if(surviving_total > 0) + SSblackbox.set_val("survived_total",surviving_total) + if(escaped_humans > 0) + SSblackbox.set_val("escaped_human",escaped_humans) + if(escaped_total > 0) + SSblackbox.set_val("escaped_total",escaped_total) + send2irc("Server", "Round just ended.") + if(cult.len && !istype(SSticker.mode, /datum/game_mode/cult)) + datum_cult_completion() + + return 0 + + +/datum/game_mode/proc/check_win() //universal trigger to be called at mob death, nuke explosion, etc. To be called from everywhere. + return 0 + + +/datum/game_mode/proc/send_intercept() + var/intercepttext = "Central Command Status Summary
" + intercepttext += "Central Command has intercepted and partially decoded a Syndicate transmission with vital information regarding their movements. The following report outlines the most \ + likely threats to appear in your sector." + var/list/possible_modes = list() + possible_modes.Add("blob", "changeling", "clock_cult", "cult", "extended", "malf", "nuclear", "revolution", "traitor", "wizard") + possible_modes -= name //remove the current gamemode to prevent it from being randomly deleted, it will be readded later + + for(var/i in 1 to 6) //Remove a few modes to leave four + possible_modes -= pick(possible_modes) + + possible_modes |= name //Re-add the actual gamemode - the intercept will thus always have the correct mode in its list + possible_modes = shuffle(possible_modes) //Meta prevention + + var/datum/intercept_text/i_text = new /datum/intercept_text + for(var/V in possible_modes) + intercepttext += i_text.build(V) + + if(station_goals.len) + intercepttext += "
Special Orders for [station_name()]:" + for(var/datum/station_goal/G in station_goals) + G.on_report() + intercepttext += G.get_report() + + print_command_report(intercepttext, "Central Command Status Summary", announce=FALSE) + priority_announce("A summary has been copied and printed to all communications consoles.", "Enemy communication intercepted. Security level elevated.", 'sound/ai/intercept.ogg') + if(GLOB.security_level < SEC_LEVEL_BLUE) + set_security_level(SEC_LEVEL_BLUE) + + +/datum/game_mode/proc/get_players_for_role(role) + var/list/players = list() + var/list/candidates = list() + var/list/drafted = list() + var/datum/mind/applicant = null + + // Ultimate randomizing code right here + for(var/mob/dead/new_player/player in GLOB.player_list) + if(player.client && player.ready == PLAYER_READY_TO_PLAY) + players += player + + // Shuffling, the players list is now ping-independent!!! + // Goodbye antag dante + players = shuffle(players) + + for(var/mob/dead/new_player/player in players) + if(player.client && player.ready == PLAYER_READY_TO_PLAY) + if(role in player.client.prefs.be_special) + if(!jobban_isbanned(player, "Syndicate") && !jobban_isbanned(player, role)) //Nodrak/Carn: Antag Job-bans + if(age_check(player.client)) //Must be older than the minimum age + candidates += player.mind // Get a list of all the people who want to be the antagonist for this round + + if(restricted_jobs) + for(var/datum/mind/player in candidates) + for(var/job in restricted_jobs) // Remove people who want to be antagonist but have a job already that precludes it + if(player.assigned_role == job) + candidates -= player + + if(candidates.len < recommended_enemies) + for(var/mob/dead/new_player/player in players) + if(player.client && player.ready == PLAYER_READY_TO_PLAY) + if(!(role in player.client.prefs.be_special)) // We don't have enough people who want to be antagonist, make a separate list of people who don't want to be one + if(!jobban_isbanned(player, "Syndicate") && !jobban_isbanned(player, role)) //Nodrak/Carn: Antag Job-bans + drafted += player.mind + + if(restricted_jobs) + for(var/datum/mind/player in drafted) // Remove people who can't be an antagonist + for(var/job in restricted_jobs) + if(player.assigned_role == job) + drafted -= player + + drafted = shuffle(drafted) // Will hopefully increase randomness, Donkie + + while(candidates.len < recommended_enemies) // Pick randomlly just the number of people we need and add them to our list of candidates + if(drafted.len > 0) + applicant = pick(drafted) + if(applicant) + candidates += applicant + drafted.Remove(applicant) + + else // Not enough scrubs, ABORT ABORT ABORT + break + + if(restricted_jobs) + for(var/datum/mind/player in drafted) // Remove people who can't be an antagonist + for(var/job in restricted_jobs) + if(player.assigned_role == job) + drafted -= player + + drafted = shuffle(drafted) // Will hopefully increase randomness, Donkie + + while(candidates.len < recommended_enemies) // Pick randomlly just the number of people we need and add them to our list of candidates + if(drafted.len > 0) + applicant = pick(drafted) + if(applicant) + candidates += applicant + drafted.Remove(applicant) + + else // Not enough scrubs, ABORT ABORT ABORT + break + + return candidates // Returns: The number of people who had the antagonist role set to yes, regardless of recomended_enemies, if that number is greater than recommended_enemies + // recommended_enemies if the number of people with that role set to yes is less than recomended_enemies, + // Less if there are not enough valid players in the game entirely to make recommended_enemies. + + + +/datum/game_mode/proc/num_players() + . = 0 + for(var/mob/dead/new_player/P in GLOB.player_list) + if(P.client && P.ready == PLAYER_READY_TO_PLAY) + . ++ + +/////////////////////////////////// +//Keeps track of all living heads// +/////////////////////////////////// +/datum/game_mode/proc/get_living_heads() + . = list() + for(var/mob/living/carbon/human/player in GLOB.mob_list) + if(player.stat != DEAD && player.mind && (player.mind.assigned_role in GLOB.command_positions)) + . |= player.mind + + +//////////////////////////// +//Keeps track of all heads// +//////////////////////////// +/datum/game_mode/proc/get_all_heads() + . = list() + for(var/mob/player in GLOB.mob_list) + if(player.mind && (player.mind.assigned_role in GLOB.command_positions)) + . |= player.mind + +////////////////////////////////////////////// +//Keeps track of all living security members// +////////////////////////////////////////////// +/datum/game_mode/proc/get_living_sec() + . = list() + for(var/mob/living/carbon/human/player in GLOB.mob_list) + if(player.stat != DEAD && player.mind && (player.mind.assigned_role in GLOB.security_positions)) + . |= player.mind + +//////////////////////////////////////// +//Keeps track of all security members// +//////////////////////////////////////// +/datum/game_mode/proc/get_all_sec() + . = list() + for(var/mob/living/carbon/human/player in GLOB.mob_list) + if(player.mind && (player.mind.assigned_role in GLOB.security_positions)) + . |= player.mind + +////////////////////////// +//Reports player logouts// +////////////////////////// +/proc/display_roundstart_logout_report() + var/msg = "Roundstart logout report\n\n" + for(var/mob/living/L in GLOB.mob_list) + + if(L.ckey) + var/found = 0 + for(var/client/C in GLOB.clients) + if(C.ckey == L.ckey) + found = 1 + break + if(!found) + msg += "[L.name] ([L.ckey]), the [L.job] (Disconnected)\n" + + + if(L.ckey && L.client) + if(L.client.inactivity >= (ROUNDSTART_LOGOUT_REPORT_TIME / 2)) //Connected, but inactive (alt+tabbed or something) + msg += "[L.name] ([L.ckey]), the [L.job] (Connected, Inactive)\n" + continue //AFK client + if(L.stat) + if(L.suiciding) //Suicider + msg += "[L.name] ([L.ckey]), the [L.job] (Suicide)\n" + continue //Disconnected client + if(L.stat == UNCONSCIOUS) + msg += "[L.name] ([L.ckey]), the [L.job] (Dying)\n" + continue //Unconscious + if(L.stat == DEAD) + msg += "[L.name] ([L.ckey]), the [L.job] (Dead)\n" + continue //Dead + + continue //Happy connected client + for(var/mob/dead/observer/D in GLOB.mob_list) + if(D.mind && D.mind.current == L) + if(L.stat == DEAD) + if(L.suiciding) //Suicider + msg += "[L.name] ([ckey(D.mind.key)]), the [L.job] (Suicide)\n" + continue //Disconnected client + else + msg += "[L.name] ([ckey(D.mind.key)]), the [L.job] (Dead)\n" + continue //Dead mob, ghost abandoned + else + if(D.can_reenter_corpse) + continue //Adminghost, or cult/wizard ghost + else + msg += "[L.name] ([ckey(D.mind.key)]), the [L.job] (Ghosted)\n" + continue //Ghosted while alive + + + + for(var/mob/M in GLOB.mob_list) + if(M.client && M.client.holder) + to_chat(M, msg) + +/datum/game_mode/proc/printplayer(datum/mind/ply, fleecheck) + var/text = "
[ply.key] was [ply.name] the [ply.assigned_role] and" + if(ply.current) + if(ply.current.stat == DEAD) + text += " died" + else + text += " survived" + if(fleecheck && (!(ply.current.z in GLOB.station_z_levels))) + text += " while fleeing the station" + if(ply.current.real_name != ply.name) + text += " as [ply.current.real_name]" + else + text += " had their body destroyed" + return text + +/datum/game_mode/proc/printobjectives(datum/mind/ply) + var/text = "" + var/count = 1 + for(var/datum/objective/objective in ply.objectives) + if(objective.check_completion()) + text += "
Objective #[count]: [objective.explanation_text] Success!" + else + text += "
Objective #[count]: [objective.explanation_text] Fail." + count++ + return text + +//If the configuration option is set to require players to be logged as old enough to play certain jobs, then this proc checks that they are, otherwise it just returns 1 +/datum/game_mode/proc/age_check(client/C) + if(get_remaining_days(C) == 0) + return 1 //Available in 0 days = available right now = player is old enough to play. + return 0 + + +/datum/game_mode/proc/get_remaining_days(client/C) + if(!C) + return 0 + if(!config.use_age_restriction_for_jobs) + return 0 + if(!isnum(C.player_age)) + return 0 //This is only a number if the db connection is established, otherwise it is text: "Requires database", meaning these restrictions cannot be enforced + if(!isnum(enemy_minimum_age)) + return 0 + + return max(0, enemy_minimum_age - C.player_age) + +/datum/game_mode/proc/replace_jobbaned_player(mob/living/M, role_type, pref) + var/list/mob/dead/observer/candidates = pollCandidatesForMob("Do you want to play as a [role_type]?", "[role_type]", null, pref, 50, M) + var/mob/dead/observer/theghost = null + if(candidates.len) + theghost = pick(candidates) + to_chat(M, "Your mob has been taken over by a ghost! Appeal your job ban if you want to avoid this in the future!") + message_admins("[key_name_admin(theghost)] has taken control of ([key_name_admin(M)]) to replace a jobbaned player.") + M.ghostize(0) + M.key = theghost.key + +/datum/game_mode/proc/remove_antag_for_borging(datum/mind/newborgie) + SSticker.mode.remove_cultist(newborgie, 0, 0) + SSticker.mode.remove_revolutionary(newborgie, 0) + +/datum/game_mode/proc/generate_station_goals() + var/list/possible = list() + for(var/T in subtypesof(/datum/station_goal)) + var/datum/station_goal/G = T + if(config_tag in initial(G.gamemode_blacklist)) + continue + possible += T + var/goal_weights = 0 + while(possible.len && goal_weights < STATION_GOAL_BUDGET) + var/datum/station_goal/picked = pick_n_take(possible) + goal_weights += initial(picked.weight) + station_goals += new picked + + +/datum/game_mode/proc/declare_station_goal_completion() + for(var/V in station_goals) + var/datum/station_goal/G = V + G.print_result() +>>>>>>> 10a3238... Makes the station Z level into a list instead of a single define (#30297) diff --git a/code/game/gamemodes/malfunction/Malf_Modules.dm b/code/game/gamemodes/malfunction/Malf_Modules.dm index 24d5311af3..0425d7ecd0 100644 --- a/code/game/gamemodes/malfunction/Malf_Modules.dm +++ b/code/game/gamemodes/malfunction/Malf_Modules.dm @@ -232,7 +232,7 @@ GLOBAL_LIST_INIT(blacklisted_malf_machines, typecacheof(list( /datum/action/innate/ai/nuke_station/Activate() var/turf/T = get_turf(owner) - if(!istype(T) || T.z != ZLEVEL_STATION) + if(!istype(T) || !(T.z in GLOB.station_z_levels)) to_chat(owner, "You cannot activate the doomsday device while off-station!") return if(alert(owner, "Send arming signal? (true = arm, false = cancel)", "purge_all_life()", "confirm = TRUE;", "confirm = FALSE;") != "confirm = TRUE;") @@ -356,7 +356,7 @@ GLOBAL_LIST_INIT(blacklisted_malf_machines, typecacheof(list( /obj/machinery/doomsday_device/process() var/turf/T = get_turf(src) - if(!T || T.z != ZLEVEL_STATION) + if(!T || !(T.z in GLOB.station_z_levels)) minor_announce("DOOMSDAY DEVICE OUT OF STATION RANGE, ABORTING", "ERROR ER0RR $R0RRO$!R41.%%!!(%$^^__+ @#F0E4", TRUE) SSshuttle.clearHostileEnvironment(src) qdel(src) @@ -374,7 +374,7 @@ GLOBAL_LIST_INIT(blacklisted_malf_machines, typecacheof(list( milestones[key] = TRUE minor_announce("[key] SECONDS UNTIL DOOMSDAY DEVICE ACTIVATION!", "ERROR ER0RR $R0RRO$!R41.%%!!(%$^^__+ @#F0E4", TRUE) -/obj/machinery/doomsday_device/proc/detonate(z_level = ZLEVEL_STATION) +/obj/machinery/doomsday_device/proc/detonate(z_level = ZLEVEL_STATION_PRIMARY) sound_to_playing_players('sound/machines/alarm.ogg') sleep(100) for(var/mob/living/L in GLOB.mob_list) @@ -426,7 +426,7 @@ GLOBAL_LIST_INIT(blacklisted_malf_machines, typecacheof(list( /datum/action/innate/ai/lockdown/Activate() for(var/obj/machinery/door/D in GLOB.airlocks) - if(D.z != ZLEVEL_STATION) + if(!(D.z in GLOB.station_z_levels)) continue INVOKE_ASYNC(D, /obj/machinery/door.proc/hostile_lockdown, src) addtimer(CALLBACK(D, /obj/machinery/door.proc/disable_lockdown), 900) @@ -504,7 +504,7 @@ GLOBAL_LIST_INIT(blacklisted_malf_machines, typecacheof(list( /datum/action/innate/ai/break_fire_alarms/Activate() for(var/obj/machinery/firealarm/F in GLOB.machines) - if(F.z != ZLEVEL_STATION) + if(!(F.z in GLOB.station_z_levels)) continue F.emagged = TRUE to_chat(owner, "All thermal sensors on the station have been disabled. Fire alerts will no longer be recognized.") @@ -531,7 +531,7 @@ GLOBAL_LIST_INIT(blacklisted_malf_machines, typecacheof(list( /datum/action/innate/ai/break_air_alarms/Activate() for(var/obj/machinery/airalarm/AA in GLOB.machines) - if(AA.z != ZLEVEL_STATION) + if(!(AA.z in GLOB.station_z_levels)) continue AA.emagged = TRUE to_chat(owner, "All air alarm safeties on the station have been overriden. Air alarms may now use the Flood environmental mode.") diff --git a/code/game/gamemodes/meteor/meteors.dm b/code/game/gamemodes/meteor/meteors.dm index 0265b37194..3bb3c8b43e 100644 --- a/code/game/gamemodes/meteor/meteors.dm +++ b/code/game/gamemodes/meteor/meteors.dm @@ -31,15 +31,15 @@ GLOBAL_LIST_INIT(meteorsC, list(/obj/effect/meteor/dust)) //for space dust event var/max_i = 10//number of tries to spawn meteor. while(!isspaceturf(pickedstart)) var/startSide = pick(GLOB.cardinals) - pickedstart = spaceDebrisStartLoc(startSide, ZLEVEL_STATION) - pickedgoal = spaceDebrisFinishLoc(startSide, ZLEVEL_STATION) + pickedstart = spaceDebrisStartLoc(startSide, ZLEVEL_STATION_PRIMARY) + pickedgoal = spaceDebrisFinishLoc(startSide, ZLEVEL_STATION_PRIMARY) max_i-- if(max_i<=0) return var/Me = pickweight(meteortypes) var/obj/effect/meteor/M = new Me(pickedstart) M.dest = pickedgoal - M.z_original = ZLEVEL_STATION + M.z_original = ZLEVEL_STATION_PRIMARY spawn(0) walk_towards(M, M.dest, 1) @@ -96,7 +96,7 @@ GLOBAL_LIST_INIT(meteorsC, list(/obj/effect/meteor/dust)) //for space dust event pass_flags = PASSTABLE var/heavy = 0 var/meteorsound = 'sound/effects/meteorimpact.ogg' - var/z_original = ZLEVEL_STATION + var/z_original = ZLEVEL_STATION_PRIMARY var/threat = 0 // used for determining which meteors are most interesting var/lifetime = DEFAULT_METEOR_LIFETIME diff --git a/code/game/gamemodes/miniantags/abduction/machinery/camera.dm b/code/game/gamemodes/miniantags/abduction/machinery/camera.dm index ffd1b88d25..97893d6d2e 100644 --- a/code/game/gamemodes/miniantags/abduction/machinery/camera.dm +++ b/code/game/gamemodes/miniantags/abduction/machinery/camera.dm @@ -9,7 +9,7 @@ var/datum/action/innate/vest_disguise_swap/vest_disguise_action = new var/datum/action/innate/set_droppoint/set_droppoint_action = new var/obj/machinery/abductor/console/console - z_lock = ZLEVEL_STATION + z_lock = ZLEVEL_STATION_PRIMARY icon = 'icons/obj/abductor.dmi' icon_state = "camera" diff --git a/code/game/gamemodes/miniantags/bot_swarm/swarmer.dm b/code/game/gamemodes/miniantags/bot_swarm/swarmer.dm index 50b7c93509..91c9b39989 100644 --- a/code/game/gamemodes/miniantags/bot_swarm/swarmer.dm +++ b/code/game/gamemodes/miniantags/bot_swarm/swarmer.dm @@ -462,7 +462,7 @@ if(target == src) return - if(z != ZLEVEL_STATION && z != ZLEVEL_LAVALAND) + if(!(z in GLOB.station_z_levels) && z != ZLEVEL_LAVALAND) to_chat(src, "Our bluespace transceiver cannot locate a viable bluespace link, our teleportation abilities are useless in this area.") return @@ -473,8 +473,8 @@ var/turf/open/floor/F switch(z) //Only the station/lavaland - if(ZLEVEL_STATION) - F =find_safe_turf(zlevels = ZLEVEL_STATION, extended_safety_checks = TRUE) + if(ZLEVEL_STATION_PRIMARY) + F =find_safe_turf(zlevels = ZLEVEL_STATION_PRIMARY, extended_safety_checks = TRUE) if(ZLEVEL_LAVALAND) F = find_safe_turf(zlevels = ZLEVEL_LAVALAND, extended_safety_checks = TRUE) if(!F) diff --git a/code/game/gamemodes/nuclear/nuclearbomb.dm b/code/game/gamemodes/nuclear/nuclearbomb.dm index ee611349f8..92230fdbfd 100644 --- a/code/game/gamemodes/nuclear/nuclearbomb.dm +++ b/code/game/gamemodes/nuclear/nuclearbomb.dm @@ -435,7 +435,7 @@ var/off_station = 0 var/turf/bomb_location = get_turf(src) var/area/A = get_area(bomb_location) - if(bomb_location && (bomb_location.z == ZLEVEL_STATION)) + if(bomb_location && (bomb_location.z in GLOB.station_z_levels)) if(istype(A, /area/space)) off_station = NUKE_MISS_STATION if((bomb_location.x < (128-NUKERANGE)) || (bomb_location.x > (128+NUKERANGE)) || (bomb_location.y < (128-NUKERANGE)) || (bomb_location.y > (128+NUKERANGE))) diff --git a/code/game/gamemodes/objective.dm b/code/game/gamemodes/objective.dm index 4bc43a6acb..baf0f69ab9 100644 --- a/code/game/gamemodes/objective.dm +++ b/code/game/gamemodes/objective.dm @@ -126,7 +126,7 @@ if(target.current.stat == DEAD || !ishuman(target.current) || !target.current.ckey) return 1 var/turf/T = get_turf(target.current) - if(T && (T.z > ZLEVEL_STATION) || (target.current.client && target.current.client.is_afk())) //If they leave the station or go afk they count as dead for this + if(T && (!(T.z in GLOB.station_z_levels)) || (target.current.client && target.current.client.is_afk())) //If they leave the station or go afk they count as dead for this return 2 return 0 return 1 diff --git a/code/game/gamemodes/revolution/revolution.dm b/code/game/gamemodes/revolution/revolution.dm index f393dc5338..55fc571459 100644 --- a/code/game/gamemodes/revolution/revolution.dm +++ b/code/game/gamemodes/revolution/revolution.dm @@ -335,7 +335,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 != DEAD) && T && (T.z == ZLEVEL_STATION)) + if((rev_mind) && (rev_mind.current) && (rev_mind.current.stat != DEAD) && T && (T.z in GLOB.station_z_levels)) if(ishuman(rev_mind.current)) return 0 return 1 diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm index d56837b9ef..bc6833f84a 100644 --- a/code/game/machinery/camera/camera.dm +++ b/code/game/machinery/camera/camera.dm @@ -47,7 +47,7 @@ GLOB.cameranet.addCamera(src) proximity_monitor = new(src, 1) - if(mapload && z == ZLEVEL_STATION && prob(3) && !start_active) + if(mapload && (z in GLOB.station_z_levels) && prob(3) && !start_active) toggle_cam() /obj/machinery/camera/Destroy() diff --git a/code/game/machinery/computer/communications.dm b/code/game/machinery/computer/communications.dm index bf67e05f11..bd203772cb 100755 --- a/code/game/machinery/computer/communications.dm +++ b/code/game/machinery/computer/communications.dm @@ -54,7 +54,7 @@ /obj/machinery/computer/communications/Topic(href, href_list) if(..()) return - if (z != ZLEVEL_STATION && z != ZLEVEL_CENTCOM) //Can only use on centcom and SS13 + if(!(z in GLOB.station_z_levels) && z != ZLEVEL_CENTCOM) //Can only use on centcom and SS13 to_chat(usr, "Unable to establish a connection: \black You're too far away from the station!") return usr.set_machine(src) diff --git a/code/game/machinery/computer/prisoner.dm b/code/game/machinery/computer/prisoner.dm index 56a6320640..a7626258ae 100644 --- a/code/game/machinery/computer/prisoner.dm +++ b/code/game/machinery/computer/prisoner.dm @@ -56,7 +56,7 @@ var/loc_display = "Unknown" var/mob/living/M = T.imp_in - if(Tr.z == ZLEVEL_STATION && !isspaceturf(M.loc)) + if((Tr.z in GLOB.station_z_levels) && !isspaceturf(M.loc)) var/turf/mob_loc = get_turf(M) loc_display = mob_loc.loc diff --git a/code/game/machinery/firealarm.dm b/code/game/machinery/firealarm.dm index 2b66b23db3..518cd8ab09 100644 --- a/code/game/machinery/firealarm.dm +++ b/code/game/machinery/firealarm.dm @@ -61,7 +61,7 @@ if(stat & NOPOWER) return - if(src.z == ZLEVEL_STATION) + if(src.z in GLOB.station_z_levels) add_overlay("overlay_[GLOB.security_level]") else //var/green = SEC_LEVEL_GREEN @@ -121,7 +121,7 @@ var/list/data = list() data["emagged"] = emagged - if(src.z == ZLEVEL_STATION) + if(src.z in GLOB.station_z_levels) data["seclevel"] = get_security_level() else data["seclevel"] = "green" diff --git a/code/game/machinery/status_display.dm b/code/game/machinery/status_display.dm index 4cfc6809cc..5d6370188b 100644 --- a/code/game/machinery/status_display.dm +++ b/code/game/machinery/status_display.dm @@ -107,7 +107,7 @@ var/line1 var/line2 if(SSshuttle.supply.mode == SHUTTLE_IDLE) - if(SSshuttle.supply.z == ZLEVEL_STATION) + if(SSshuttle.supply.z in GLOB.station_z_levels) line1 = "CARGO" line2 = "Docked" else diff --git a/code/game/machinery/telecomms/machine_interactions.dm b/code/game/machinery/telecomms/machine_interactions.dm index 9077283a68..5638b92b99 100644 --- a/code/game/machinery/telecomms/machine_interactions.dm +++ b/code/game/machinery/telecomms/machine_interactions.dm @@ -106,7 +106,7 @@ // Off-Site Relays // -// You are able to send/receive signals from the station's z level (changeable in the ZLEVEL_STATION #define) if +// You are able to send/receive signals from the station's z level (changeable in the ZLEVEL_STATION_PRIMARY #define) if /obj/machinery/telecomms/relay/proc/toggle_level() @@ -114,7 +114,7 @@ var/turf/position = get_turf(src) // Toggle on/off getting signals from the station or the current Z level - if(listening_level == ZLEVEL_STATION) // equals the station + if(listening_level in GLOB.station_z_levels) // equals the station listening_level = position.z return TRUE return FALSE diff --git a/code/game/objects/items/devices/PDA/cart.dm b/code/game/objects/items/devices/PDA/cart.dm index de9f6ed44b..8e98465598 100644 --- a/code/game/objects/items/devices/PDA/cart.dm +++ b/code/game/objects/items/devices/PDA/cart.dm @@ -437,14 +437,14 @@ Code: switch(SSshuttle.supply.mode) if(SHUTTLE_CALL) menu += "Moving to " - if(SSshuttle.supply.z != ZLEVEL_STATION) + if(!(SSshuttle.supply.z in GLOB.station_z_levels)) menu += "station" else menu += "centcom" menu += " ([SSshuttle.supply.timeLeft(600)] Mins)" else menu += "At " - if(SSshuttle.supply.z != ZLEVEL_STATION) + if(!(SSshuttle.supply.z in GLOB.station_z_levels)) menu += "centcom" else menu += "station" diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index b88451b724..f8b225a105 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -624,7 +624,7 @@ if(3) var/count = 0 for(var/mob/living/carbon/monkey/Monkey in world) - if(Monkey.z == ZLEVEL_STATION) + if(Monkey.z in GLOB.station_z_levels) count++ return "Kill all [count] of the monkeys on the station" if(4) diff --git a/code/modules/admin/secrets.dm b/code/modules/admin/secrets.dm index 70c7346369..b74ba95cde 100644 --- a/code/modules/admin/secrets.dm +++ b/code/modules/admin/secrets.dm @@ -454,7 +454,7 @@ return SSblackbox.add_details("admin_secrets_fun_used","Egalitarian Station") for(var/obj/machinery/door/airlock/W in GLOB.machines) - if(W.z == ZLEVEL_STATION && !istype(get_area(W), /area/bridge) && !istype(get_area(W), /area/crew_quarters) && !istype(get_area(W), /area/security/prison)) + if((W.z in GLOB.station_z_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") priority_announce("CentCom airlock control override activated. Please take this time to get acquainted with your coworkers.", null, 'sound/ai/commandreport.ogg') diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm index 362ce2a1d8..d3bcde7c89 100644 --- a/code/modules/admin/verbs/debug.dm +++ b/code/modules/admin/verbs/debug.dm @@ -509,7 +509,7 @@ GLOBAL_PROTECT(AdminProcCallCount) for(var/area/A in world) if(on_station) var/turf/picked = safepick(get_area_turfs(A.type)) - if(picked && (picked.z == ZLEVEL_STATION)) + if(picked && (picked.z in GLOB.station_z_levels)) if(!(A.type in areas_all) && !is_type_in_typecache(A, station_areas_blacklist)) areas_all.Add(A.type) else if(!(A.type in areas_all)) diff --git a/code/modules/admin/verbs/one_click_antag.dm b/code/modules/admin/verbs/one_click_antag.dm index c8df7f56f1..48705ad854 100644 --- a/code/modules/admin/verbs/one_click_antag.dm +++ b/code/modules/admin/verbs/one_click_antag.dm @@ -80,7 +80,7 @@ for(var/mob/living/carbon/human/applicant in GLOB.player_list) if(ROLE_CHANGELING in applicant.client.prefs.be_special) var/turf/T = get_turf(applicant) - if(applicant.stat == CONSCIOUS && applicant.mind && !applicant.mind.special_role && T.z == ZLEVEL_STATION) + if(applicant.stat == CONSCIOUS && applicant.mind && !applicant.mind.special_role && (T.z in GLOB.station_z_levels)) if(!jobban_isbanned(applicant, ROLE_CHANGELING) && !jobban_isbanned(applicant, "Syndicate")) if(temp.age_check(applicant.client)) if(!(applicant.job in temp.restricted_jobs)) @@ -113,7 +113,7 @@ for(var/mob/living/carbon/human/applicant in GLOB.player_list) if(ROLE_REV in applicant.client.prefs.be_special) var/turf/T = get_turf(applicant) - if(applicant.stat == CONSCIOUS && applicant.mind && !applicant.mind.special_role && T.z == ZLEVEL_STATION) + if(applicant.stat == CONSCIOUS && applicant.mind && !applicant.mind.special_role && (T.z in GLOB.station_z_levels)) if(!jobban_isbanned(applicant, ROLE_REV) && !jobban_isbanned(applicant, "Syndicate")) if(temp.age_check(applicant.client)) if(!(applicant.job in temp.restricted_jobs)) @@ -155,7 +155,7 @@ for(var/mob/living/carbon/human/applicant in GLOB.player_list) if(ROLE_CULTIST in applicant.client.prefs.be_special) var/turf/T = get_turf(applicant) - if(applicant.stat == CONSCIOUS && applicant.mind && !applicant.mind.special_role && T.z == ZLEVEL_STATION) + if(applicant.stat == CONSCIOUS && applicant.mind && !applicant.mind.special_role && (T.z in GLOB.station_z_levels)) if(!jobban_isbanned(applicant, ROLE_CULTIST) && !jobban_isbanned(applicant, "Syndicate")) if(temp.age_check(applicant.client)) if(!(applicant.job in temp.restricted_jobs)) @@ -188,7 +188,7 @@ for(var/mob/living/carbon/human/applicant in GLOB.player_list) if(ROLE_SERVANT_OF_RATVAR in applicant.client.prefs.be_special) var/turf/T = get_turf(applicant) - if(applicant.stat == CONSCIOUS && applicant.mind && !applicant.mind.special_role && T.z == ZLEVEL_STATION) + if(applicant.stat == CONSCIOUS && applicant.mind && !applicant.mind.special_role && (T.z in GLOB.station_z_levels)) if(!jobban_isbanned(applicant, ROLE_SERVANT_OF_RATVAR) && !jobban_isbanned(applicant, "Syndicate")) if(temp.age_check(applicant.client)) if(!(applicant.job in temp.restricted_jobs)) diff --git a/code/modules/awaymissions/signpost.dm b/code/modules/awaymissions/signpost.dm index 00012f8a40..f6fd4d9071 100644 --- a/code/modules/awaymissions/signpost.dm +++ b/code/modules/awaymissions/signpost.dm @@ -5,11 +5,12 @@ anchored = TRUE density = TRUE var/question = "Travel back?" - var/zlevels = list(ZLEVEL_STATION) + var/list/zlevels = list() /obj/structure/signpost/New() . = ..() set_light(2) + zlevels = GLOB.station_z_levels /obj/structure/signpost/attackby(obj/item/W, mob/user, params) return attack_hand(user) diff --git a/code/modules/events/alien_infestation.dm b/code/modules/events/alien_infestation.dm index 161fcd8c16..545b72a1bc 100644 --- a/code/modules/events/alien_infestation.dm +++ b/code/modules/events/alien_infestation.dm @@ -40,7 +40,7 @@ for(var/obj/machinery/atmospherics/components/unary/vent_pump/temp_vent in GLOB.machines) if(QDELETED(temp_vent)) continue - if(temp_vent.loc.z == ZLEVEL_STATION && !temp_vent.welded) + if((temp_vent.loc.z in GLOB.station_z_levels) && !temp_vent.welded) var/datum/pipeline/temp_vent_parent = temp_vent.PARENT1 //Stops Aliens getting stuck in small networks. //See: Security, Virology diff --git a/code/modules/events/brand_intelligence.dm b/code/modules/events/brand_intelligence.dm index d655337ba6..461ffecd3f 100644 --- a/code/modules/events/brand_intelligence.dm +++ b/code/modules/events/brand_intelligence.dm @@ -27,7 +27,7 @@ /datum/round_event/brand_intelligence/start() for(var/obj/machinery/vending/V in GLOB.machines) - if(V.z != ZLEVEL_STATION) + if(!(V.z in GLOB.station_z_levels)) continue vendingMachines.Add(V) if(!vendingMachines.len) diff --git a/code/modules/events/disease_outbreak.dm b/code/modules/events/disease_outbreak.dm index dbac242321..a3ce69e0bd 100644 --- a/code/modules/events/disease_outbreak.dm +++ b/code/modules/events/disease_outbreak.dm @@ -25,7 +25,7 @@ var/turf/T = get_turf(H) if(!T) continue - if(T.z != ZLEVEL_STATION) + if(!(T.z in GLOB.station_z_levels)) continue if(!H.client) continue diff --git a/code/modules/events/grid_check.dm b/code/modules/events/grid_check.dm index c6ba4d1bd0..f1af035a29 100644 --- a/code/modules/events/grid_check.dm +++ b/code/modules/events/grid_check.dm @@ -15,5 +15,5 @@ /datum/round_event/grid_check/start() for(var/P in GLOB.apcs_list) var/obj/machinery/power/apc/C = P - if(C.cell && C.z == ZLEVEL_STATION) + if(C.cell && (C.z in GLOB.station_z_levels)) C.energy_fail(rand(30,120)) \ No newline at end of file diff --git a/code/modules/events/holiday/xmas.dm b/code/modules/events/holiday/xmas.dm index ae58ece0bb..c5a9c1a142 100644 --- a/code/modules/events/holiday/xmas.dm +++ b/code/modules/events/holiday/xmas.dm @@ -25,7 +25,7 @@ /datum/round_event/presents/start() for(var/obj/structure/flora/tree/pine/xmas in world) - if(xmas.z != ZLEVEL_STATION) + if(!(xmas.z in GLOB.station_z_levels)) continue for(var/turf/open/floor/T in orange(1,xmas)) for(var/i=1,i<=rand(1,5),i++) diff --git a/code/modules/events/immovable_rod.dm b/code/modules/events/immovable_rod.dm index f3a21445d3..0fc6a58499 100644 --- a/code/modules/events/immovable_rod.dm +++ b/code/modules/events/immovable_rod.dm @@ -21,6 +21,7 @@ In my current plan for it, 'solid' will be defined as anything with density == 1 /datum/round_event/immovable_rod/start() var/startside = pick(GLOB.cardinals) +<<<<<<< HEAD var/turf/startT = spaceDebrisStartLoc(startside, ZLEVEL_STATION) var/turf/endT = spaceDebrisFinishLoc(startside, ZLEVEL_STATION) new /obj/effect/immovablerod(startT, endT) @@ -31,6 +32,18 @@ In my current plan for it, 'solid' will be defined as anything with density == 1 icon = 'icons/obj/objects.dmi' icon_state = "immrod" throwforce = 100 +======= + var/turf/startT = spaceDebrisStartLoc(startside, ZLEVEL_STATION_PRIMARY) + var/turf/endT = spaceDebrisFinishLoc(startside, ZLEVEL_STATION_PRIMARY) + new /obj/effect/immovablerod(startT, endT) + +/obj/effect/immovablerod + name = "immovable rod" + desc = "What the fuck is that?" + icon = 'icons/obj/objects.dmi' + icon_state = "immrod" + throwforce = 100 +>>>>>>> 10a3238... Makes the station Z level into a list instead of a single define (#30297) density = TRUE anchored = TRUE var/z_original = 0 diff --git a/code/modules/events/portal_storm.dm b/code/modules/events/portal_storm.dm index 9658d8b144..552179343c 100644 --- a/code/modules/events/portal_storm.dm +++ b/code/modules/events/portal_storm.dm @@ -40,7 +40,7 @@ storm = storm = mutable_appearance('icons/obj/tesla_engine/energy_ball.dmi', "energy_ball_fast", FLY_LAYER) storm.color = "#00FF00" - station_areas = get_areas_in_z(ZLEVEL_STATION) + station_areas = get_areas_in_z(ZLEVEL_STATION_PRIMARY) number_of_bosses = 0 for(var/boss in boss_types) diff --git a/code/modules/events/radiation_storm.dm b/code/modules/events/radiation_storm.dm index e4f2b6b1a7..54f7532923 100644 --- a/code/modules/events/radiation_storm.dm +++ b/code/modules/events/radiation_storm.dm @@ -1,3 +1,4 @@ +<<<<<<< HEAD /datum/round_event_control/radiation_storm name = "Radiation Storm" typepath = /datum/round_event/radiation_storm @@ -18,3 +19,24 @@ /datum/round_event/radiation_storm/start() SSweather.run_weather("radiation storm",ZLEVEL_STATION) make_maint_all_access() +======= +/datum/round_event_control/radiation_storm + name = "Radiation Storm" + typepath = /datum/round_event/radiation_storm + max_occurrences = 1 + +/datum/round_event/radiation_storm + + +/datum/round_event/radiation_storm/setup() + startWhen = 3 + endWhen = startWhen + 1 + announceWhen = 1 + +/datum/round_event/radiation_storm/announce() + priority_announce("High levels of radiation detected near the station. Maintenance is best shielded from radiation.", "Anomaly Alert", 'sound/ai/radiation.ogg') + //sound not longer matches the text, but an audible warning is probably good + +/datum/round_event/radiation_storm/start() + SSweather.run_weather("radiation storm",ZLEVEL_STATION_PRIMARY) +>>>>>>> 10a3238... Makes the station Z level into a list instead of a single define (#30297) diff --git a/code/modules/events/sentience.dm b/code/modules/events/sentience.dm index a425c540b3..253ef6a639 100644 --- a/code/modules/events/sentience.dm +++ b/code/modules/events/sentience.dm @@ -31,7 +31,7 @@ var/list/potential = list() for(var/mob/living/simple_animal/L in GLOB.living_mob_list) var/turf/T = get_turf(L) - if(T.z != ZLEVEL_STATION) + if(!(T.z in GLOB.station_z_levels)) continue if(!(L in GLOB.player_list) && !L.mind) potential += L diff --git a/code/modules/events/spider_infestation.dm b/code/modules/events/spider_infestation.dm index a3296ebab6..3469fd8a88 100644 --- a/code/modules/events/spider_infestation.dm +++ b/code/modules/events/spider_infestation.dm @@ -1,3 +1,4 @@ +<<<<<<< HEAD /datum/round_event_control/spider_infestation name = "Spider Infestation" typepath = /datum/round_event/spider_infestation @@ -35,3 +36,42 @@ spawn_atom_to_turf(spawn_type, vent, 1, FALSE) vents -= vent spawncount-- +======= +/datum/round_event_control/spider_infestation + name = "Spider Infestation" + typepath = /datum/round_event/spider_infestation + weight = 5 + max_occurrences = 1 + min_players = 15 + +/datum/round_event/spider_infestation + announceWhen = 400 + + var/spawncount = 1 + + +/datum/round_event/spider_infestation/setup() + announceWhen = rand(announceWhen, announceWhen + 50) + spawncount = rand(5, 8) + +/datum/round_event/spider_infestation/announce() + priority_announce("Unidentified lifesigns detected coming aboard [station_name()]. Secure any exterior access, including ducting and ventilation.", "Lifesign Alert", 'sound/ai/aliens.ogg') + + +/datum/round_event/spider_infestation/start() + var/list/vents = list() + for(var/obj/machinery/atmospherics/components/unary/vent_pump/temp_vent in world) + if((temp_vent.loc.z in GLOB.station_z_levels) && !temp_vent.welded) + var/datum/pipeline/temp_vent_parent = temp_vent.PARENT1 + if(temp_vent_parent.other_atmosmch.len > 20) + vents += temp_vent + + while((spawncount >= 1) && vents.len) + var/obj/vent = pick(vents) + var/spawn_type = /obj/structure/spider/spiderling + if(prob(66)) + spawn_type = /obj/structure/spider/spiderling/nurse + spawn_atom_to_turf(spawn_type, vent, 1, FALSE) + vents -= vent + spawncount-- +>>>>>>> 10a3238... Makes the station Z level into a list instead of a single define (#30297) diff --git a/code/modules/events/vent_clog.dm b/code/modules/events/vent_clog.dm index 2039e58caa..ab7c63cdb0 100644 --- a/code/modules/events/vent_clog.dm +++ b/code/modules/events/vent_clog.dm @@ -1,3 +1,4 @@ +<<<<<<< HEAD /datum/round_event_control/vent_clog name = "Clogged Vents" typepath = /datum/round_event/vent_clog @@ -47,3 +48,54 @@ while(cockroaches) new /mob/living/simple_animal/cockroach(get_turf(vent)) cockroaches-- +======= +/datum/round_event_control/vent_clog + name = "Clogged Vents" + typepath = /datum/round_event/vent_clog + weight = 35 + +/datum/round_event/vent_clog + announceWhen = 1 + startWhen = 5 + endWhen = 35 + var/interval = 2 + var/list/vents = list() + var/list/gunk = list("water","carbon","flour","radium","toxin","cleaner","nutriment","condensedcapsaicin","mushroomhallucinogen","lube", + "plantbgone","banana","charcoal","space_drugs","morphine","holywater","ethanol","hot_coco","sacid") + +/datum/round_event/vent_clog/announce() + priority_announce("The scrubbers network is experiencing a backpressure surge. Some ejection of contents may occur.", "Atmospherics alert") + + +/datum/round_event/vent_clog/setup() + endWhen = rand(25, 100) + for(var/obj/machinery/atmospherics/components/unary/vent_scrubber/temp_vent in GLOB.machines) + if((temp_vent.loc.z in GLOB.station_z_levels) && !temp_vent.welded) + var/datum/pipeline/temp_vent_parent = temp_vent.PARENT1 + if(temp_vent_parent.other_atmosmch.len > 20) + vents += temp_vent + if(!vents.len) + return kill() + +/datum/round_event/vent_clog/tick() + if(activeFor % interval == 0) + var/obj/machinery/atmospherics/components/unary/vent = pick_n_take(vents) + while(vent && vent.welded) + vent = pick_n_take(vents) + + if(vent && vent.loc) + var/datum/reagents/R = new/datum/reagents(50) + R.my_atom = vent + R.add_reagent(pick(gunk), 50) + + var/datum/effect_system/smoke_spread/chem/smoke = new + smoke.set_up(R, 1, vent, silent = 1) + playsound(vent.loc, 'sound/effects/smoke.ogg', 50, 1, -3) + smoke.start() + qdel(R) + + var/cockroaches = prob(33) ? 3 : 0 + while(cockroaches) + new /mob/living/simple_animal/cockroach(get_turf(vent)) + cockroaches-- +>>>>>>> 10a3238... Makes the station Z level into a list instead of a single define (#30297) diff --git a/code/modules/events/wizard/advanced_darkness.dm b/code/modules/events/wizard/advanced_darkness.dm index e6d20ad70d..0f68bb936e 100644 --- a/code/modules/events/wizard/advanced_darkness.dm +++ b/code/modules/events/wizard/advanced_darkness.dm @@ -13,4 +13,4 @@ /datum/round_event/wizard/darkness/start() if(!started) started = TRUE - SSweather.run_weather("advanced darkness", ZLEVEL_STATION) + SSweather.run_weather("advanced darkness", ZLEVEL_STATION_PRIMARY) diff --git a/code/modules/events/wizard/curseditems.dm b/code/modules/events/wizard/curseditems.dm index 1dba06f239..f5b6ae1cc1 100644 --- a/code/modules/events/wizard/curseditems.dm +++ b/code/modules/events/wizard/curseditems.dm @@ -38,7 +38,7 @@ ruins_wizard_loadout = 1 for(var/mob/living/carbon/human/H in GLOB.living_mob_list) - if(ruins_spaceworthiness && (H.z != ZLEVEL_STATION || isspaceturf(H.loc) || isplasmaman(H))) + if(ruins_spaceworthiness && !(H.z in GLOB.station_z_levels) || isspaceturf(H.loc) || isplasmaman(H)) continue //#savetheminers if(ruins_wizard_loadout && H.mind && ((H.mind in SSticker.mode.wizards) || (H.mind in SSticker.mode.apprentices))) continue diff --git a/code/modules/events/wizard/lava.dm b/code/modules/events/wizard/lava.dm index 190752cc68..a4426ce928 100644 --- a/code/modules/events/wizard/lava.dm +++ b/code/modules/events/wizard/lava.dm @@ -12,4 +12,4 @@ /datum/round_event/wizard/lava/start() if(!started) started = TRUE - SSweather.run_weather("the floor is lava", ZLEVEL_STATION) + SSweather.run_weather("the floor is lava", ZLEVEL_STATION_PRIMARY) diff --git a/code/modules/events/wizard/petsplosion.dm b/code/modules/events/wizard/petsplosion.dm index 05582043b9..5654cbfe04 100644 --- a/code/modules/events/wizard/petsplosion.dm +++ b/code/modules/events/wizard/petsplosion.dm @@ -8,7 +8,7 @@ /datum/round_event_control/wizard/petsplosion/preRunEvent() for(var/mob/living/simple_animal/F in GLOB.living_mob_list) - if(!ishostile(F) && F.z == ZLEVEL_STATION) + if(!ishostile(F) && (F.z in GLOB.station_z_levels)) mobs_to_dupe++ if(mobs_to_dupe > 100 || !mobs_to_dupe) return EVENT_CANT_RUN @@ -24,7 +24,7 @@ if(activeFor >= 30 * countdown) // 0 seconds : 2 animals | 30 seconds : 4 animals | 1 minute : 8 animals countdown += 1 for(var/mob/living/simple_animal/F in GLOB.living_mob_list) //If you cull the heard before the next replication, things will be easier for you - if(!ishostile(F) && F.z == ZLEVEL_STATION) + if(!ishostile(F) && (F.z in GLOB.station_z_levels)) new F.type(F.loc) mobs_duped++ if(mobs_duped > 400) diff --git a/code/modules/events/wizard/shuffle.dm b/code/modules/events/wizard/shuffle.dm index e04cb2da2b..568a8fbc72 100644 --- a/code/modules/events/wizard/shuffle.dm +++ b/code/modules/events/wizard/shuffle.dm @@ -13,7 +13,7 @@ var/list/mobs = list() for(var/mob/living/carbon/human/H in GLOB.living_mob_list) - if(H.z != ZLEVEL_STATION) + if(!(H.z in GLOB.station_z_levels)) continue //lets not try to strand people in space or stuck in the wizards den moblocs += H.loc mobs += H diff --git a/code/modules/events/wormholes.dm b/code/modules/events/wormholes.dm index 167eb77cfc..6404307d34 100644 --- a/code/modules/events/wormholes.dm +++ b/code/modules/events/wormholes.dm @@ -21,7 +21,7 @@ /datum/round_event/wormholes/start() for(var/turf/open/floor/T in world) - if(T.z == ZLEVEL_STATION) + if(T.z in GLOB.station_z_levels) pick_turfs += T for(var/i = 1, i <= number_of_wormholes, i++) diff --git a/code/modules/mining/aux_base.dm b/code/modules/mining/aux_base.dm index fbe5a1fb30..a28f450087 100644 --- a/code/modules/mining/aux_base.dm +++ b/code/modules/mining/aux_base.dm @@ -37,7 +37,7 @@ interface with the mining shuttle at the landing site if a mobile beacon is also var/list/options = params2list(possible_destinations) var/obj/docking_port/mobile/M = SSshuttle.getShuttle(shuttleId) - var/dat = "[z == ZLEVEL_STATION ? "Docking clamps engaged. Standing by." : "Mining Shuttle Uplink: [M ? M.getStatusText() : "*OFFLINE*"]"]
" + var/dat = "[(z in GLOB.station_z_levels) ? "Docking clamps engaged. Standing by." : "Mining Shuttle Uplink: [M ? M.getStatusText() : "*OFFLINE*"]"]
" if(M) var/destination_found for(var/obj/docking_port/stationary/S in SSshuttle.stationary) @@ -47,7 +47,7 @@ interface with the mining shuttle at the landing site if a mobile beacon is also continue destination_found = 1 dat += "Send to [S.name]
" - if(!destination_found && z == ZLEVEL_STATION) //Only available if miners are lazy and did not set an LZ using the remote. + if(!destination_found && (z in GLOB.station_z_levels)) //Only available if miners are lazy and did not set an LZ using the remote. dat += "Prepare for blind drop? (Dangerous)
" if(LAZYLEN(turrets)) dat += "
Perimeter Defense System: Enable All / Disable All
\ @@ -86,7 +86,7 @@ interface with the mining shuttle at the landing site if a mobile beacon is also return if(href_list["move"]) - if(z != ZLEVEL_STATION && shuttleId == "colony_drop") + if(!(z in GLOB.station_z_levels && shuttleId == "colony_drop")) to_chat(usr, "You can't move the base again!") return var/shuttle_error = SSshuttle.moveShuttle(shuttleId, href_list["move"], 1) @@ -200,7 +200,7 @@ interface with the mining shuttle at the landing site if a mobile beacon is also var/obj/machinery/computer/auxillary_base/AB for (var/obj/machinery/computer/auxillary_base/A in GLOB.machines) - if(A.z == ZLEVEL_STATION) + if(A.z in GLOB.station_z_levels) AB = A break if(!AB) diff --git a/code/modules/mining/aux_base_camera.dm b/code/modules/mining/aux_base_camera.dm index 56b7fe3175..1b245c209f 100644 --- a/code/modules/mining/aux_base_camera.dm +++ b/code/modules/mining/aux_base_camera.dm @@ -151,8 +151,7 @@ to_chat(owner, "You can only build within the mining base!") return FALSE - - if(build_target.z != ZLEVEL_STATION) + if(!(build_target.z in GLOB.station_z_levels)) to_chat(owner, "The mining base has launched and can no longer be modified.") return FALSE diff --git a/code/modules/mining/equipment/wormhole_jaunter.dm b/code/modules/mining/equipment/wormhole_jaunter.dm index 00fdbfb561..e0197cc4e3 100644 --- a/code/modules/mining/equipment/wormhole_jaunter.dm +++ b/code/modules/mining/equipment/wormhole_jaunter.dm @@ -41,7 +41,7 @@ for(var/obj/item/device/radio/beacon/B in GLOB.teleportbeacons) var/turf/T = get_turf(B) - if(T.z == ZLEVEL_STATION) + if(T.z in GLOB.station_z_levels) destinations += B return destinations @@ -93,7 +93,7 @@ /obj/effect/portal/wormhole/jaunt_tunnel/teleport(atom/movable/M) if(!ismob(M) && !isobj(M)) //No don't teleport lighting and effects! return - + if(M.anchored && (!ismob(M) || (istype(M, /obj/mecha) && !mech_sized))) return diff --git a/code/modules/mining/machine_redemption.dm b/code/modules/mining/machine_redemption.dm index 9726022afc..abead3ab9a 100644 --- a/code/modules/mining/machine_redemption.dm +++ b/code/modules/mining/machine_redemption.dm @@ -102,7 +102,7 @@ smelt_ore(ore) /obj/machinery/mineral/ore_redemption/proc/send_console_message() - if(z != ZLEVEL_STATION) + if(!(z in GLOB.station_z_levels)) return message_sent = TRUE var/area/A = get_area(src) diff --git a/code/modules/mining/mine_items.dm b/code/modules/mining/mine_items.dm index 71010d252e..15d05d37fe 100644 --- a/code/modules/mining/mine_items.dm +++ b/code/modules/mining/mine_items.dm @@ -69,7 +69,7 @@ var/global/list/dumb_rev_heads = list() /obj/machinery/computer/shuttle/mining/attack_hand(mob/user) - if(user.z == ZLEVEL_STATION && user.mind && (user.mind in SSticker.mode.head_revolutionaries) && !(user.mind in dumb_rev_heads)) + if((user.z in GLOB.station_z_levels) && user.mind && (user.mind in SSticker.mode.head_revolutionaries) && !(user.mind in dumb_rev_heads)) to_chat(user, "You get a feeling that leaving the station might be a REALLY dumb idea...") dumb_rev_heads += user.mind return diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 75d7f637cd..2525dcbd78 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -106,7 +106,7 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER) if(turfs.len) T = pick(turfs) else - T = locate(round(world.maxx/2), round(world.maxy/2), ZLEVEL_STATION) //middle of the station + T = locate(round(world.maxx/2), round(world.maxy/2), ZLEVEL_STATION_PRIMARY) //middle of the station loc = T diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 9d8d2b704b..e2a257e0ce 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -422,7 +422,7 @@ All effects don't start immediately, but rather get worse over time; the rate is if(drunkenness >= 91) adjustBrainLoss(0.4) if(prob(20) && !stat) - if(SSshuttle.emergency.mode == SHUTTLE_DOCKED && z == ZLEVEL_STATION) //QoL mainly + if(SSshuttle.emergency.mode == SHUTTLE_DOCKED && (z in GLOB.station_z_levels)) //QoL mainly to_chat(src, "You're so tired... but you can't miss that shuttle...") else to_chat(src, "Just a quick nap...") diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/blood_drunk_miner.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/blood_drunk_miner.dm index a63e4cf89f..815b20c0c5 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/blood_drunk_miner.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/blood_drunk_miner.dm @@ -114,7 +114,7 @@ Difficulty: Medium if(L.stat == DEAD) visible_message("[src] butchers [L]!", "You butcher [L], restoring your health!") - if(z != ZLEVEL_STATION && !client) //NPC monsters won't heal while on station + if(!(z in GLOB.station_z_levels && !client)) //NPC monsters won't heal while on station if(guidance) adjustHealth(-L.maxHealth) else diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/megafauna.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/megafauna.dm index 02ca4a4e26..c4618db620 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/megafauna.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/megafauna.dm @@ -101,7 +101,7 @@ visible_message( "[src] devours [L]!", "You feast on [L], restoring your health!") - if(z != ZLEVEL_STATION && !client) //NPC monsters won't heal while on station + if(!(z in GLOB.station_z_levels && !client)) //NPC monsters won't heal while on station adjustBruteLoss(-L.maxHealth/2) L.gib() diff --git a/code/modules/modular_computers/file_system/programs/alarm.dm b/code/modules/modular_computers/file_system/programs/alarm.dm index fc050545a5..616fd15dd3 100644 --- a/code/modules/modular_computers/file_system/programs/alarm.dm +++ b/code/modules/modular_computers/file_system/programs/alarm.dm @@ -13,7 +13,7 @@ var/has_alert = 0 var/alarms = list("Fire" = list(), "Atmosphere" = list(), "Power" = list()) - var/alarm_z = list(ZLEVEL_STATION,ZLEVEL_LAVALAND) + var/alarm_z = list(ZLEVEL_STATION_PRIMARY,ZLEVEL_LAVALAND) /datum/computer_file/program/alarm_monitor/process_tick() ..() diff --git a/code/modules/modular_computers/file_system/programs/sm_monitor.dm b/code/modules/modular_computers/file_system/programs/sm_monitor.dm index c12c83aaed..f4d0abad6d 100644 --- a/code/modules/modular_computers/file_system/programs/sm_monitor.dm +++ b/code/modules/modular_computers/file_system/programs/sm_monitor.dm @@ -44,7 +44,7 @@ //var/valid_z_levels = (GetConnectedZlevels(T.z) & using_map.station_levels) for(var/obj/machinery/power/supermatter_shard/S in GLOB.machines) // Delaminating, not within coverage, not on a tile. - if(!(S.z == ZLEVEL_STATION || S.z == ZLEVEL_MINING || S.z == T.z) || !istype(S.loc, /turf/)) + if(!(S.z in GLOB.station_z_levels || S.z == ZLEVEL_MINING || S.z == T.z) || !istype(S.loc, /turf/)) continue supermatters.Add(S) diff --git a/code/modules/modular_computers/hardware/network_card.dm b/code/modules/modular_computers/hardware/network_card.dm index 24c1580ea2..8ed67d761b 100644 --- a/code/modules/modular_computers/hardware/network_card.dm +++ b/code/modules/modular_computers/hardware/network_card.dm @@ -48,7 +48,7 @@ if(holder) var/turf/T = get_turf(holder) - if((T && istype(T)) && (T.z == ZLEVEL_STATION || T.z == ZLEVEL_MINING)) + if((T && istype(T)) && ((T.z in GLOB.station_z_levels) || T.z == ZLEVEL_MINING)) // Computer is on station. Low/High signal depending on what type of network card you have if(long_range) return 2 diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index 3b070f1384..63321bae21 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -840,7 +840,7 @@ if(!malf.can_shunt) to_chat(malf, "You cannot shunt!") return - if(src.z != ZLEVEL_STATION) + if(!(src.z in GLOB.station_z_levels)) return occupier = new /mob/living/silicon/ai(src, malf.laws, malf) //DEAR GOD WHY? //IKR???? occupier.adjustOxyLoss(malf.getOxyLoss()) diff --git a/code/modules/power/singularity/narsie.dm b/code/modules/power/singularity/narsie.dm index df969d869e..381dcbaa75 100644 --- a/code/modules/power/singularity/narsie.dm +++ b/code/modules/power/singularity/narsie.dm @@ -54,7 +54,7 @@ var/mob/living/L = cult_mind.current L.narsie_act() for(var/mob/living/player in GLOB.player_list) - if(player.stat != DEAD && player.loc.z == ZLEVEL_STATION && !iscultist(player)) + if(player.stat != DEAD && (player.loc.z in GLOB.station_z_levels) && !iscultist(player)) souls_needed[player] = TRUE soul_goal = round(1 + LAZYLEN(souls_needed) * 0.6) INVOKE_ASYNC(src, .proc/begin_the_end) diff --git a/code/modules/procedural_mapping/mapGenerators/repair.dm b/code/modules/procedural_mapping/mapGenerators/repair.dm index f9b94bba89..9796535df7 100644 --- a/code/modules/procedural_mapping/mapGenerators/repair.dm +++ b/code/modules/procedural_mapping/mapGenerators/repair.dm @@ -20,11 +20,11 @@ if(!istype(mother, /datum/mapGenerator/repair/reload_station_map)) return var/datum/mapGenerator/repair/reload_station_map/mother1 = mother - if(mother1.z != ZLEVEL_STATION) + if(!(mother1.z in GLOB.station_z_levels)) return //This is only for reloading station blocks! GLOB.reloading_map = TRUE var/static/dmm_suite/reloader = new - var/list/bounds = reloader.load_map(file(SSmapping.config.GetFullMapPath()),measureOnly = FALSE, no_changeturf = FALSE,x_offset = 0, y_offset = 0, z_offset = ZLEVEL_STATION, cropMap=TRUE, lower_crop_x = mother1.x_low, lower_crop_y = mother1.y_low, upper_crop_x = mother1.x_high, upper_crop_y = mother1.y_high) + var/list/bounds = reloader.load_map(file(SSmapping.config.GetFullMapPath()),measureOnly = FALSE, no_changeturf = FALSE,x_offset = 0, y_offset = 0, z_offset = ZLEVEL_STATION_PRIMARY, cropMap=TRUE, lower_crop_x = mother1.x_low, lower_crop_y = mother1.y_low, upper_crop_x = mother1.x_high, upper_crop_y = mother1.y_high) var/list/obj/machinery/atmospherics/atmos_machines = list() var/list/obj/structure/cable/cables = list() @@ -87,13 +87,13 @@ /datum/mapGenerator/repair/reload_station_map/defineRegion(turf/start, turf/end) . = ..() - if(start.z != ZLEVEL_STATION || end.z != ZLEVEL_STATION) + if(!(start.z in GLOB.station_z_levels) || !(end.z in GLOB.station_z_levels)) return x_low = min(start.x, end.x) y_low = min(start.y, end.y) x_high = max(start.x, end.x) y_high = max(start.y, end.y) - z = ZLEVEL_STATION + z = ZLEVEL_STATION_PRIMARY GLOBAL_VAR_INIT(reloading_map, FALSE) diff --git a/code/modules/security_levels/security_levels.dm b/code/modules/security_levels/security_levels.dm index a3e190814e..b13a746ab5 100644 --- a/code/modules/security_levels/security_levels.dm +++ b/code/modules/security_levels/security_levels.dm @@ -1,3 +1,4 @@ +<<<<<<< HEAD GLOBAL_VAR_INIT(security_level, 0) //0 = code green //1 = code blue @@ -132,3 +133,133 @@ GLOBAL_VAR_INIT(security_level, 0) /mob/verb/set_thing3() set_security_level(3) */ +======= +GLOBAL_VAR_INIT(security_level, 0) +//0 = code green +//1 = code blue +//2 = code red +//3 = code delta + +//config.alert_desc_blue_downto + +/proc/set_security_level(level) + switch(level) + if("green") + level = SEC_LEVEL_GREEN + if("blue") + level = SEC_LEVEL_BLUE + if("red") + level = SEC_LEVEL_RED + if("delta") + level = SEC_LEVEL_DELTA + + //Will not be announced if you try to set to the same level as it already is + if(level >= SEC_LEVEL_GREEN && level <= SEC_LEVEL_DELTA && level != GLOB.security_level) + switch(level) + if(SEC_LEVEL_GREEN) + minor_announce(config.alert_desc_green, "Attention! Security level lowered to green:") + if(SSshuttle.emergency.mode == SHUTTLE_CALL || SSshuttle.emergency.mode == SHUTTLE_RECALL) + if(GLOB.security_level >= SEC_LEVEL_RED) + SSshuttle.emergency.modTimer(4) + else + SSshuttle.emergency.modTimer(2) + GLOB.security_level = SEC_LEVEL_GREEN + for(var/obj/machinery/firealarm/FA in GLOB.machines) + if(FA.z in GLOB.station_z_levels) + FA.update_icon() + if(SEC_LEVEL_BLUE) + if(GLOB.security_level < SEC_LEVEL_BLUE) + minor_announce(config.alert_desc_blue_upto, "Attention! Security level elevated to blue:",1) + if(SSshuttle.emergency.mode == SHUTTLE_CALL || SSshuttle.emergency.mode == SHUTTLE_RECALL) + SSshuttle.emergency.modTimer(0.5) + else + minor_announce(config.alert_desc_blue_downto, "Attention! Security level lowered to blue:") + if(SSshuttle.emergency.mode == SHUTTLE_CALL || SSshuttle.emergency.mode == SHUTTLE_RECALL) + SSshuttle.emergency.modTimer(2) + GLOB.security_level = SEC_LEVEL_BLUE + for(var/obj/machinery/firealarm/FA in GLOB.machines) + if(FA.z in GLOB.station_z_levels) + FA.update_icon() + if(SEC_LEVEL_RED) + if(GLOB.security_level < SEC_LEVEL_RED) + minor_announce(config.alert_desc_red_upto, "Attention! Code red!",1) + if(SSshuttle.emergency.mode == SHUTTLE_CALL || SSshuttle.emergency.mode == SHUTTLE_RECALL) + if(GLOB.security_level == SEC_LEVEL_GREEN) + SSshuttle.emergency.modTimer(0.25) + else + SSshuttle.emergency.modTimer(0.5) + else + minor_announce(config.alert_desc_red_downto, "Attention! Code red!") + GLOB.security_level = SEC_LEVEL_RED + + /* - At the time of commit, setting status displays didn't work properly + var/obj/machinery/computer/communications/CC = locate(/obj/machinery/computer/communications,world) + if(CC) + CC.post_status("alert", "redalert")*/ + + for(var/obj/machinery/firealarm/FA in GLOB.machines) + if(FA.z in GLOB.station_z_levels) + FA.update_icon() + for(var/obj/machinery/computer/shuttle/pod/pod in GLOB.machines) + pod.admin_controlled = 0 + if(SEC_LEVEL_DELTA) + minor_announce(config.alert_desc_delta, "Attention! Delta security level reached!",1) + if(SSshuttle.emergency.mode == SHUTTLE_CALL || SSshuttle.emergency.mode == SHUTTLE_RECALL) + if(GLOB.security_level == SEC_LEVEL_GREEN) + SSshuttle.emergency.modTimer(0.25) + else if(GLOB.security_level == SEC_LEVEL_BLUE) + SSshuttle.emergency.modTimer(0.5) + GLOB.security_level = SEC_LEVEL_DELTA + for(var/obj/machinery/firealarm/FA in GLOB.machines) + if(FA.z in GLOB.station_z_levels) + FA.update_icon() + for(var/obj/machinery/computer/shuttle/pod/pod in GLOB.machines) + pod.admin_controlled = 0 + else + return + +/proc/get_security_level() + switch(GLOB.security_level) + if(SEC_LEVEL_GREEN) + return "green" + if(SEC_LEVEL_BLUE) + return "blue" + if(SEC_LEVEL_RED) + return "red" + if(SEC_LEVEL_DELTA) + return "delta" + +/proc/num2seclevel(num) + switch(num) + if(SEC_LEVEL_GREEN) + return "green" + if(SEC_LEVEL_BLUE) + return "blue" + if(SEC_LEVEL_RED) + return "red" + if(SEC_LEVEL_DELTA) + return "delta" + +/proc/seclevel2num(seclevel) + switch( lowertext(seclevel) ) + if("green") + return SEC_LEVEL_GREEN + if("blue") + return SEC_LEVEL_BLUE + if("red") + return SEC_LEVEL_RED + if("delta") + return SEC_LEVEL_DELTA + + +/*DEBUG +/mob/verb/set_thing0() + set_security_level(0) +/mob/verb/set_thing1() + set_security_level(1) +/mob/verb/set_thing2() + set_security_level(2) +/mob/verb/set_thing3() + set_security_level(3) +*/ +>>>>>>> 10a3238... Makes the station Z level into a list instead of a single define (#30297) diff --git a/code/modules/shuttle/navigation_computer.dm b/code/modules/shuttle/navigation_computer.dm index 32324ea233..9199e5eb14 100644 --- a/code/modules/shuttle/navigation_computer.dm +++ b/code/modules/shuttle/navigation_computer.dm @@ -1,7 +1,7 @@ /obj/machinery/computer/camera_advanced/shuttle_docker name = "navigation computer" desc = "Used to designate a precise transit location for a spacecraft." - z_lock = ZLEVEL_STATION + z_lock = ZLEVEL_STATION_PRIMARY jump_action = null var/datum/action/innate/shuttledocker_rotate/rotate_action = new var/datum/action/innate/shuttledocker_place/place_action = new diff --git a/code/modules/shuttle/shuttle.dm b/code/modules/shuttle/shuttle.dm index f035777df5..704b598ba1 100644 --- a/code/modules/shuttle/shuttle.dm +++ b/code/modules/shuttle/shuttle.dm @@ -410,7 +410,7 @@ mode = SHUTTLE_RECALL /obj/docking_port/mobile/proc/enterTransit() - if(SSshuttle.lockdown && z == ZLEVEL_STATION) //emp went off, no escape + if(SSshuttle.lockdown && (z in GLOB.station_z_levels)) //emp went off, no escape return previous = null // if(!destination) @@ -574,7 +574,7 @@ if(move_mode & MOVE_AREA) areas_to_move[old_area] = TRUE - + old_turfs[place] = move_mode /*******************************************All onShuttleMove procs******************************************/ diff --git a/code/modules/shuttle/supply.dm b/code/modules/shuttle/supply.dm index 6ef04dcaba..8f208cb3ad 100644 --- a/code/modules/shuttle/supply.dm +++ b/code/modules/shuttle/supply.dm @@ -45,7 +45,7 @@ GLOBAL_LIST_INIT(blacklisted_cargo_types, typecacheof(list( SSshuttle.supply = src /obj/docking_port/mobile/supply/canMove() - if(z == ZLEVEL_STATION) + if(z in GLOB.station_z_levels) return check_blacklist(shuttle_areas) return ..() diff --git a/code/modules/shuttle/syndicate.dm b/code/modules/shuttle/syndicate.dm index f9d90dd342..b21df4000c 100644 --- a/code/modules/shuttle/syndicate.dm +++ b/code/modules/shuttle/syndicate.dm @@ -47,7 +47,7 @@ desc = "Used to designate a precise transit location for the syndicate shuttle." icon_screen = "syndishuttle" icon_keyboard = "syndie_key" - z_lock = ZLEVEL_STATION + z_lock = ZLEVEL_STATION_PRIMARY shuttleId = "syndicate" shuttlePortId = "syndicate_custom" shuttlePortName = "custom location" diff --git a/code/modules/station_goals/shield.dm b/code/modules/station_goals/shield.dm index 94cf2dfe9c..6639297e23 100644 --- a/code/modules/station_goals/shield.dm +++ b/code/modules/station_goals/shield.dm @@ -31,7 +31,7 @@ /datum/station_goal/proc/get_coverage() var/list/coverage = list() for(var/obj/machinery/satellite/meteor_shield/A in GLOB.machines) - if(!A.active || A.z != ZLEVEL_STATION) + if(!A.active || !(A.z in GLOB.station_z_levels)) continue coverage |= view(A.kill_range,A) return coverage.len From 799ae80b8a86a2baa68db23beadd9a85519f9f6c Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Mon, 11 Sep 2017 16:43:24 -0400 Subject: [PATCH 02/49] Missed some parentheses in multi Z --- code/modules/mining/aux_base.dm | 4 ++++ .../modular_computers/file_system/programs/sm_monitor.dm | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/code/modules/mining/aux_base.dm b/code/modules/mining/aux_base.dm index fbe5a1fb30..3d2772b20c 100644 --- a/code/modules/mining/aux_base.dm +++ b/code/modules/mining/aux_base.dm @@ -86,7 +86,11 @@ interface with the mining shuttle at the landing site if a mobile beacon is also return if(href_list["move"]) +<<<<<<< HEAD if(z != ZLEVEL_STATION && shuttleId == "colony_drop") +======= + if(!(z in GLOB.station_z_levels) && shuttleId == "colony_drop") +>>>>>>> 51c03bb... Merge pull request #30633 from KorPhaeron/missing) to_chat(usr, "You can't move the base again!") return var/shuttle_error = SSshuttle.moveShuttle(shuttleId, href_list["move"], 1) diff --git a/code/modules/modular_computers/file_system/programs/sm_monitor.dm b/code/modules/modular_computers/file_system/programs/sm_monitor.dm index c12c83aaed..76c36b1bf4 100644 --- a/code/modules/modular_computers/file_system/programs/sm_monitor.dm +++ b/code/modules/modular_computers/file_system/programs/sm_monitor.dm @@ -44,7 +44,11 @@ //var/valid_z_levels = (GetConnectedZlevels(T.z) & using_map.station_levels) for(var/obj/machinery/power/supermatter_shard/S in GLOB.machines) // Delaminating, not within coverage, not on a tile. +<<<<<<< HEAD if(!(S.z == ZLEVEL_STATION || S.z == ZLEVEL_MINING || S.z == T.z) || !istype(S.loc, /turf/)) +======= + if(!(S.z in GLOB.station_z_levels) || S.z == ZLEVEL_MINING || S.z == T.z || !istype(S.loc, /turf/)) +>>>>>>> 51c03bb... Merge pull request #30633 from KorPhaeron/missing) continue supermatters.Add(S) From 804a59ad49623debe430f7e8294ee6ed16859a6d Mon Sep 17 00:00:00 2001 From: LetterJay Date: Mon, 11 Sep 2017 15:45:11 -0500 Subject: [PATCH 03/49] Update aux_base.dm --- code/modules/mining/aux_base.dm | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/code/modules/mining/aux_base.dm b/code/modules/mining/aux_base.dm index 3d2772b20c..4ecdf25253 100644 --- a/code/modules/mining/aux_base.dm +++ b/code/modules/mining/aux_base.dm @@ -86,11 +86,8 @@ interface with the mining shuttle at the landing site if a mobile beacon is also return if(href_list["move"]) -<<<<<<< HEAD if(z != ZLEVEL_STATION && shuttleId == "colony_drop") -======= if(!(z in GLOB.station_z_levels) && shuttleId == "colony_drop") ->>>>>>> 51c03bb... Merge pull request #30633 from KorPhaeron/missing) to_chat(usr, "You can't move the base again!") return var/shuttle_error = SSshuttle.moveShuttle(shuttleId, href_list["move"], 1) @@ -349,4 +346,4 @@ obj/docking_port/stationary/public_mining_dock #undef BAD_ZLEVEL #undef BAD_AREA #undef BAD_COORDS -#undef ZONE_SET \ No newline at end of file +#undef ZONE_SET From 05efdd9ad3fa81f71c3d8400f8f25f901dfddb7a Mon Sep 17 00:00:00 2001 From: LetterJay Date: Mon, 11 Sep 2017 15:45:34 -0500 Subject: [PATCH 04/49] Update sm_monitor.dm --- .../modular_computers/file_system/programs/sm_monitor.dm | 3 --- 1 file changed, 3 deletions(-) diff --git a/code/modules/modular_computers/file_system/programs/sm_monitor.dm b/code/modules/modular_computers/file_system/programs/sm_monitor.dm index 76c36b1bf4..748d63461b 100644 --- a/code/modules/modular_computers/file_system/programs/sm_monitor.dm +++ b/code/modules/modular_computers/file_system/programs/sm_monitor.dm @@ -44,11 +44,8 @@ //var/valid_z_levels = (GetConnectedZlevels(T.z) & using_map.station_levels) for(var/obj/machinery/power/supermatter_shard/S in GLOB.machines) // Delaminating, not within coverage, not on a tile. -<<<<<<< HEAD if(!(S.z == ZLEVEL_STATION || S.z == ZLEVEL_MINING || S.z == T.z) || !istype(S.loc, /turf/)) -======= if(!(S.z in GLOB.station_z_levels) || S.z == ZLEVEL_MINING || S.z == T.z || !istype(S.loc, /turf/)) ->>>>>>> 51c03bb... Merge pull request #30633 from KorPhaeron/missing) continue supermatters.Add(S) From c6c34b07be811b9fd71c9956af06eb4d4df7c83f Mon Sep 17 00:00:00 2001 From: LetterJay Date: Mon, 11 Sep 2017 15:46:45 -0500 Subject: [PATCH 05/49] Update mapping.dm --- code/_globalvars/lists/mapping.dm | 109 +++++++++++++++--------------- 1 file changed, 53 insertions(+), 56 deletions(-) diff --git a/code/_globalvars/lists/mapping.dm b/code/_globalvars/lists/mapping.dm index 63bbcf927d..5de0407442 100644 --- a/code/_globalvars/lists/mapping.dm +++ b/code/_globalvars/lists/mapping.dm @@ -1,60 +1,58 @@ -#define Z_NORTH 1 -#define Z_EAST 2 -#define Z_SOUTH 3 -#define Z_WEST 4 - +#define Z_NORTH 1 +#define Z_EAST 2 +#define Z_SOUTH 3 +#define Z_WEST 4 + GLOBAL_LIST_INIT(cardinals, list(NORTH, SOUTH, EAST, WEST)) -<<<<<<< HEAD -GLOBAL_LIST_INIT(alldirs, list(NORTH, SOUTH, EAST, WEST, NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST)) -GLOBAL_LIST_INIT(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 -GLOBAL_LIST_INIT(accessable_z_levels, list(1,3,4,5,6,7)) //Keep this to six maps, repeating z-levels is ok if needed - -GLOBAL_LIST(global_map) - //list/global_map = list(list(1,5),list(4,3))//an array of map Z levels. - //Resulting sector map looks like - //|_1_|_4_| - //|_5_|_3_| - // - //1 - SS13 - //4 - Derelict - //3 - AI satellite - //5 - empty space - -GLOBAL_LIST_EMPTY(landmarks_list) //list of all landmarks created -GLOBAL_LIST_EMPTY(start_landmarks_list) //list of all spawn points created -GLOBAL_LIST_EMPTY(department_security_spawns) //list of all department security spawns -GLOBAL_LIST_EMPTY(generic_event_spawns) //list of all spawns for events - -GLOBAL_LIST_EMPTY(wizardstart) -GLOBAL_LIST_EMPTY(newplayer_start) -GLOBAL_LIST_EMPTY(prisonwarp) //prisoners go to these -GLOBAL_LIST_EMPTY(holdingfacility) //captured people go here -GLOBAL_LIST_EMPTY(xeno_spawn)//Aliens spawn at these. -GLOBAL_LIST_EMPTY(tdome1) -GLOBAL_LIST_EMPTY(tdome2) -GLOBAL_LIST_EMPTY(tdomeobserve) -GLOBAL_LIST_EMPTY(tdomeadmin) -GLOBAL_LIST_EMPTY(prisonwarped) //list of players already warped -GLOBAL_LIST_EMPTY(blobstart) -GLOBAL_LIST_EMPTY(secequipment) -GLOBAL_LIST_EMPTY(deathsquadspawn) -GLOBAL_LIST_EMPTY(emergencyresponseteamspawn) -GLOBAL_LIST_EMPTY(ruin_landmarks) - - //away missions -GLOBAL_LIST_EMPTY(awaydestinations) //a list of landmarks that the warpgate can take you to - - //used by jump-to-area etc. Updated by area/updateName() -GLOBAL_LIST_EMPTY(sortedAreas) - +GLOBAL_LIST_INIT(alldirs, list(NORTH, SOUTH, EAST, WEST, NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST)) +GLOBAL_LIST_INIT(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 +GLOBAL_LIST_INIT(accessable_z_levels, list(1,3,4,5,6,7)) //Keep this to six maps, repeating z-levels is ok if needed + +GLOBAL_LIST(global_map) + //list/global_map = list(list(1,5),list(4,3))//an array of map Z levels. + //Resulting sector map looks like + //|_1_|_4_| + //|_5_|_3_| + // + //1 - SS13 + //4 - Derelict + //3 - AI satellite + //5 - empty space + +GLOBAL_LIST_EMPTY(landmarks_list) //list of all landmarks created +GLOBAL_LIST_EMPTY(start_landmarks_list) //list of all spawn points created +GLOBAL_LIST_EMPTY(department_security_spawns) //list of all department security spawns +GLOBAL_LIST_EMPTY(generic_event_spawns) //list of all spawns for events + +GLOBAL_LIST_EMPTY(wizardstart) +GLOBAL_LIST_EMPTY(newplayer_start) +GLOBAL_LIST_EMPTY(prisonwarp) //prisoners go to these +GLOBAL_LIST_EMPTY(holdingfacility) //captured people go here +GLOBAL_LIST_EMPTY(xeno_spawn)//Aliens spawn at these. +GLOBAL_LIST_EMPTY(tdome1) +GLOBAL_LIST_EMPTY(tdome2) +GLOBAL_LIST_EMPTY(tdomeobserve) +GLOBAL_LIST_EMPTY(tdomeadmin) +GLOBAL_LIST_EMPTY(prisonwarped) //list of players already warped +GLOBAL_LIST_EMPTY(blobstart) +GLOBAL_LIST_EMPTY(secequipment) +GLOBAL_LIST_EMPTY(deathsquadspawn) +GLOBAL_LIST_EMPTY(emergencyresponseteamspawn) +GLOBAL_LIST_EMPTY(ruin_landmarks) + + //away missions +GLOBAL_LIST_EMPTY(awaydestinations) //a list of landmarks that the warpgate can take you to + + //used by jump-to-area etc. Updated by area/updateName() +GLOBAL_LIST_EMPTY(sortedAreas) + GLOBAL_LIST_EMPTY(all_abstract_markers) -======= GLOBAL_LIST_INIT(alldirs, list(NORTH, SOUTH, EAST, WEST, NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST)) GLOBAL_LIST_INIT(diagonals, list(NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST)) @@ -106,4 +104,3 @@ GLOBAL_LIST_EMPTY(awaydestinations) //a list of landmarks that the warpgate can GLOBAL_LIST_EMPTY(sortedAreas) GLOBAL_LIST_EMPTY(all_abstract_markers) ->>>>>>> 10a3238... Makes the station Z level into a list instead of a single define (#30297) From e0e552829c28fcaf93f4ad0152715138fbf69e5f Mon Sep 17 00:00:00 2001 From: LetterJay Date: Mon, 11 Sep 2017 15:47:18 -0500 Subject: [PATCH 06/49] Update persistence.dm --- code/controllers/subsystem/persistence.dm | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/code/controllers/subsystem/persistence.dm b/code/controllers/subsystem/persistence.dm index 2029100847..a59ec7e79f 100644 --- a/code/controllers/subsystem/persistence.dm +++ b/code/controllers/subsystem/persistence.dm @@ -21,10 +21,8 @@ SUBSYSTEM_DEF(persistence) ..() /datum/controller/subsystem/persistence/proc/LoadSatchels() -<<<<<<< HEAD secret_satchels = file("data/npc_saves/SecretSatchels[SSmapping.config.map_name].json") if(!fexists(secret_satchels)) -======= var/placed_satchel = 0 var/path var/obj/item/storage/backpack/satchel/flat/F = new() @@ -59,7 +57,6 @@ SUBSYSTEM_DEF(persistence) F.z = ZLEVEL_STATION_PRIMARY path = text2path(old_secret_satchels[pos]["saved_obj"]) if(!ispath(path)) ->>>>>>> 10a3238... Makes the station Z level into a list instead of a single define (#30297) return satchel_blacklist = typecacheof(list(/obj/item/stack/tile/plasteel, /obj/item/crowbar)) var/list/json = list() @@ -229,4 +226,4 @@ SUBSYSTEM_DEF(persistence) data["path"] = T.showpiece.type data["message"] = T.trophy_message data["placer_key"] = T.placer_key - saved_trophies += list(data) \ No newline at end of file + saved_trophies += list(data) From f6f456068ff6bfd09566493915bf8f00b3ea8a9a Mon Sep 17 00:00:00 2001 From: LetterJay Date: Mon, 11 Sep 2017 15:47:48 -0500 Subject: [PATCH 07/49] Update teleport.dm --- code/datums/helper_datums/teleport.dm | 459 +++++++++++++------------- 1 file changed, 228 insertions(+), 231 deletions(-) diff --git a/code/datums/helper_datums/teleport.dm b/code/datums/helper_datums/teleport.dm index 9157eebde3..468b806784 100644 --- a/code/datums/helper_datums/teleport.dm +++ b/code/datums/helper_datums/teleport.dm @@ -1,213 +1,211 @@ -<<<<<<< HEAD -//wrapper -/proc/do_teleport(ateleatom, adestination, aprecision=0, afteleport=1, aeffectin=null, aeffectout=null, asoundin=null, asoundout=null) - var/datum/teleport/instant/science/D = new - if(D.start(arglist(args))) - return 1 - return 0 - -/datum/teleport - var/atom/movable/teleatom //atom to teleport - var/atom/destination //destination to teleport to - var/precision = 0 //teleport precision - var/datum/effect_system/effectin //effect to show right before teleportation - var/datum/effect_system/effectout //effect to show right after teleportation - var/soundin //soundfile to play before teleportation - var/soundout //soundfile to play after teleportation - var/force_teleport = 1 //if false, teleport will use Move() proc (dense objects will prevent teleportation) - -/datum/teleport/proc/start(ateleatom, adestination, aprecision=0, afteleport=1, aeffectin=null, aeffectout=null, asoundin=null, asoundout=null) - if(!initTeleport(arglist(args))) - return 0 - return 1 - -/datum/teleport/proc/initTeleport(ateleatom,adestination,aprecision,afteleport,aeffectin,aeffectout,asoundin,asoundout) - if(!setTeleatom(ateleatom)) - return 0 - if(!setDestination(adestination)) - return 0 - if(!setPrecision(aprecision)) - return 0 - setEffects(aeffectin,aeffectout) - setForceTeleport(afteleport) - setSounds(asoundin,asoundout) - return 1 - -//must succeed -/datum/teleport/proc/setPrecision(aprecision) - if(isnum(aprecision)) - precision = aprecision - return 1 - return 0 - -//must succeed -/datum/teleport/proc/setDestination(atom/adestination) - if(istype(adestination)) - destination = adestination - return 1 - return 0 - -//must succeed in most cases -/datum/teleport/proc/setTeleatom(atom/movable/ateleatom) - if(istype(ateleatom, /obj/effect) && !istype(ateleatom, /obj/effect/dummy/chameleon)) - qdel(ateleatom) - return 0 - if(istype(ateleatom)) - teleatom = ateleatom - return 1 - return 0 - -//custom effects must be properly set up first for instant-type teleports -//optional -/datum/teleport/proc/setEffects(datum/effect_system/aeffectin=null,datum/effect_system/aeffectout=null) - effectin = istype(aeffectin) ? aeffectin : null - effectout = istype(aeffectout) ? aeffectout : null - return 1 - -//optional -/datum/teleport/proc/setForceTeleport(afteleport) - force_teleport = afteleport - return 1 - -//optional -/datum/teleport/proc/setSounds(asoundin=null,asoundout=null) - soundin = isfile(asoundin) ? asoundin : null - soundout = isfile(asoundout) ? asoundout : null - return 1 - -//placeholder -/datum/teleport/proc/teleportChecks() - return 1 - -/datum/teleport/proc/playSpecials(atom/location,datum/effect_system/effect,sound) - if(location) - if(effect) - INVOKE_ASYNC(src, .proc/do_effect, location, effect) - if(sound) - INVOKE_ASYNC(src, .proc/do_sound, location, sound) - -/datum/teleport/proc/do_effect(atom/location, datum/effect_system/effect) - src = null - effect.attach(location) - effect.start() - -/datum/teleport/proc/do_sound(atom/location, sound) - src = null - playsound(location, sound, 60, 1) - -//do the monkey dance -/datum/teleport/proc/doTeleport() - - var/turf/destturf - var/turf/curturf = get_turf(teleatom) - destturf = get_teleport_turf(get_turf(destination), precision) - - if(!destturf || !curturf || destturf.is_transition_turf()) - return 0 - - var/area/A = get_area(curturf) - if(A.noteleport) - return 0 - - playSpecials(curturf,effectin,soundin) - if(force_teleport) - teleatom.forceMove(destturf) - if(ismegafauna(teleatom)) - message_admins("[teleatom] [ADMIN_FLW(teleatom)] has teleported from [ADMIN_COORDJMP(curturf)] to [ADMIN_COORDJMP(destturf)].") - playSpecials(destturf,effectout,soundout) - else - if(teleatom.Move(destturf)) - playSpecials(destturf,effectout,soundout) - if(ismegafauna(teleatom)) - message_admins("[teleatom] [ADMIN_FLW(teleatom)] has teleported from [ADMIN_COORDJMP(curturf)] to [ADMIN_COORDJMP(destturf)].") - return 1 - -/datum/teleport/proc/teleport() - if(teleportChecks()) - return doTeleport() - return 0 - -/datum/teleport/instant //teleports when datum is created - - start(ateleatom, adestination, aprecision=0, afteleport=1, aeffectin=null, aeffectout=null, asoundin=null, asoundout=null) - if(..()) - if(teleport()) - return 1 - return 0 - - -/datum/teleport/instant/science - -/datum/teleport/instant/science/setEffects(datum/effect_system/aeffectin,datum/effect_system/aeffectout) - if(aeffectin==null || aeffectout==null) - var/datum/effect_system/spark_spread/aeffect = new - aeffect.set_up(5, 1, teleatom) - effectin = effectin || aeffect - effectout = effectout || aeffect - return 1 - else - return ..() - -/datum/teleport/instant/science/setPrecision(aprecision) - ..() - if(istype(teleatom, /obj/item/storage/backpack/holding)) - precision = rand(1,100) - - var/list/bagholding = teleatom.search_contents_for(/obj/item/storage/backpack/holding) - if(bagholding.len) - precision = max(rand(1,100)*bagholding.len,100) - if(isliving(teleatom)) - var/mob/living/MM = teleatom - to_chat(MM, "The bluespace interface on your bag of holding interferes with the teleport!") - return 1 - -// Safe location finder - -/proc/find_safe_turf(zlevel = ZLEVEL_STATION, list/zlevels, extended_safety_checks = FALSE) - if(!zlevels) - zlevels = list(zlevel) - var/cycles = 1000 - for(var/cycle in 1 to cycles) - // DRUNK DIALLING WOOOOOOOOO - var/x = rand(1, world.maxx) - var/y = rand(1, world.maxy) - var/z = pick(zlevels) - var/random_location = locate(x,y,z) - - if(!isfloorturf(random_location)) - continue - var/turf/open/floor/F = random_location - if(!F.air) - continue - - var/datum/gas_mixture/A = F.air - var/list/A_gases = A.gases - var/trace_gases - for(var/id in A_gases) - if(id in GLOB.hardcoded_gases) - continue - trace_gases = TRUE - break - - // Can most things breathe? - if(trace_gases) - continue - if(!(A_gases["o2"] && A_gases["o2"][MOLES] >= 16)) - continue - if(A_gases["plasma"]) - continue - if(A_gases["co2"] && A_gases["co2"][MOLES] >= 10) - continue - - // Aim for goldilocks temperatures and pressure - if((A.temperature <= 270) || (A.temperature >= 360)) - continue - var/pressure = A.return_pressure() - if((pressure <= 20) || (pressure >= 550)) - continue - - if(extended_safety_checks) -======= +//wrapper +/proc/do_teleport(ateleatom, adestination, aprecision=0, afteleport=1, aeffectin=null, aeffectout=null, asoundin=null, asoundout=null) + var/datum/teleport/instant/science/D = new + if(D.start(arglist(args))) + return 1 + return 0 + +/datum/teleport + var/atom/movable/teleatom //atom to teleport + var/atom/destination //destination to teleport to + var/precision = 0 //teleport precision + var/datum/effect_system/effectin //effect to show right before teleportation + var/datum/effect_system/effectout //effect to show right after teleportation + var/soundin //soundfile to play before teleportation + var/soundout //soundfile to play after teleportation + var/force_teleport = 1 //if false, teleport will use Move() proc (dense objects will prevent teleportation) + +/datum/teleport/proc/start(ateleatom, adestination, aprecision=0, afteleport=1, aeffectin=null, aeffectout=null, asoundin=null, asoundout=null) + if(!initTeleport(arglist(args))) + return 0 + return 1 + +/datum/teleport/proc/initTeleport(ateleatom,adestination,aprecision,afteleport,aeffectin,aeffectout,asoundin,asoundout) + if(!setTeleatom(ateleatom)) + return 0 + if(!setDestination(adestination)) + return 0 + if(!setPrecision(aprecision)) + return 0 + setEffects(aeffectin,aeffectout) + setForceTeleport(afteleport) + setSounds(asoundin,asoundout) + return 1 + +//must succeed +/datum/teleport/proc/setPrecision(aprecision) + if(isnum(aprecision)) + precision = aprecision + return 1 + return 0 + +//must succeed +/datum/teleport/proc/setDestination(atom/adestination) + if(istype(adestination)) + destination = adestination + return 1 + return 0 + +//must succeed in most cases +/datum/teleport/proc/setTeleatom(atom/movable/ateleatom) + if(istype(ateleatom, /obj/effect) && !istype(ateleatom, /obj/effect/dummy/chameleon)) + qdel(ateleatom) + return 0 + if(istype(ateleatom)) + teleatom = ateleatom + return 1 + return 0 + +//custom effects must be properly set up first for instant-type teleports +//optional +/datum/teleport/proc/setEffects(datum/effect_system/aeffectin=null,datum/effect_system/aeffectout=null) + effectin = istype(aeffectin) ? aeffectin : null + effectout = istype(aeffectout) ? aeffectout : null + return 1 + +//optional +/datum/teleport/proc/setForceTeleport(afteleport) + force_teleport = afteleport + return 1 + +//optional +/datum/teleport/proc/setSounds(asoundin=null,asoundout=null) + soundin = isfile(asoundin) ? asoundin : null + soundout = isfile(asoundout) ? asoundout : null + return 1 + +//placeholder +/datum/teleport/proc/teleportChecks() + return 1 + +/datum/teleport/proc/playSpecials(atom/location,datum/effect_system/effect,sound) + if(location) + if(effect) + INVOKE_ASYNC(src, .proc/do_effect, location, effect) + if(sound) + INVOKE_ASYNC(src, .proc/do_sound, location, sound) + +/datum/teleport/proc/do_effect(atom/location, datum/effect_system/effect) + src = null + effect.attach(location) + effect.start() + +/datum/teleport/proc/do_sound(atom/location, sound) + src = null + playsound(location, sound, 60, 1) + +//do the monkey dance +/datum/teleport/proc/doTeleport() + + var/turf/destturf + var/turf/curturf = get_turf(teleatom) + destturf = get_teleport_turf(get_turf(destination), precision) + + if(!destturf || !curturf || destturf.is_transition_turf()) + return 0 + + var/area/A = get_area(curturf) + if(A.noteleport) + return 0 + + playSpecials(curturf,effectin,soundin) + if(force_teleport) + teleatom.forceMove(destturf) + if(ismegafauna(teleatom)) + message_admins("[teleatom] [ADMIN_FLW(teleatom)] has teleported from [ADMIN_COORDJMP(curturf)] to [ADMIN_COORDJMP(destturf)].") + playSpecials(destturf,effectout,soundout) + else + if(teleatom.Move(destturf)) + playSpecials(destturf,effectout,soundout) + if(ismegafauna(teleatom)) + message_admins("[teleatom] [ADMIN_FLW(teleatom)] has teleported from [ADMIN_COORDJMP(curturf)] to [ADMIN_COORDJMP(destturf)].") + return 1 + +/datum/teleport/proc/teleport() + if(teleportChecks()) + return doTeleport() + return 0 + +/datum/teleport/instant //teleports when datum is created + + start(ateleatom, adestination, aprecision=0, afteleport=1, aeffectin=null, aeffectout=null, asoundin=null, asoundout=null) + if(..()) + if(teleport()) + return 1 + return 0 + + +/datum/teleport/instant/science + +/datum/teleport/instant/science/setEffects(datum/effect_system/aeffectin,datum/effect_system/aeffectout) + if(aeffectin==null || aeffectout==null) + var/datum/effect_system/spark_spread/aeffect = new + aeffect.set_up(5, 1, teleatom) + effectin = effectin || aeffect + effectout = effectout || aeffect + return 1 + else + return ..() + +/datum/teleport/instant/science/setPrecision(aprecision) + ..() + if(istype(teleatom, /obj/item/storage/backpack/holding)) + precision = rand(1,100) + + var/list/bagholding = teleatom.search_contents_for(/obj/item/storage/backpack/holding) + if(bagholding.len) + precision = max(rand(1,100)*bagholding.len,100) + if(isliving(teleatom)) + var/mob/living/MM = teleatom + to_chat(MM, "The bluespace interface on your bag of holding interferes with the teleport!") + return 1 + +// Safe location finder + +/proc/find_safe_turf(zlevel = ZLEVEL_STATION, list/zlevels, extended_safety_checks = FALSE) + if(!zlevels) + zlevels = list(zlevel) + var/cycles = 1000 + for(var/cycle in 1 to cycles) + // DRUNK DIALLING WOOOOOOOOO + var/x = rand(1, world.maxx) + var/y = rand(1, world.maxy) + var/z = pick(zlevels) + var/random_location = locate(x,y,z) + + if(!isfloorturf(random_location)) + continue + var/turf/open/floor/F = random_location + if(!F.air) + continue + + var/datum/gas_mixture/A = F.air + var/list/A_gases = A.gases + var/trace_gases + for(var/id in A_gases) + if(id in GLOB.hardcoded_gases) + continue + trace_gases = TRUE + break + + // Can most things breathe? + if(trace_gases) + continue + if(!(A_gases["o2"] && A_gases["o2"][MOLES] >= 16)) + continue + if(A_gases["plasma"]) + continue + if(A_gases["co2"] && A_gases["co2"][MOLES] >= 10) + continue + + // Aim for goldilocks temperatures and pressure + if((A.temperature <= 270) || (A.temperature >= 360)) + continue + var/pressure = A.return_pressure() + if((pressure <= 20) || (pressure >= 550)) + continue + + if(extended_safety_checks) //wrapper /proc/do_teleport(ateleatom, adestination, aprecision=0, afteleport=1, aeffectin=null, aeffectout=null, asoundin=null, asoundout=null) var/datum/teleport/instant/science/D = new @@ -416,26 +414,25 @@ continue if(extended_safety_checks) ->>>>>>> 10a3238... Makes the station Z level into a list instead of a single define (#30297) if(istype(F, /turf/open/lava)) //chasms aren't /floor, and so are pre-filtered var/turf/open/lava/L = F - if(!L.is_safe()) - continue - - // DING! You have passed the gauntlet, and are "probably" safe. - return F - -/proc/get_teleport_turfs(turf/center, precision = 0) - if(!precision) - return list(center) - var/list/posturfs = list() - for(var/turf/T in range(precision,center)) - if(T.is_transition_turf()) - continue // Avoid picking these. - var/area/A = T.loc - if(!A.noteleport) - posturfs.Add(T) - return posturfs - -/proc/get_teleport_turf(turf/center, precision = 0) - return safepick(get_teleport_turfs(center, precision)) + if(!L.is_safe()) + continue + + // DING! You have passed the gauntlet, and are "probably" safe. + return F + +/proc/get_teleport_turfs(turf/center, precision = 0) + if(!precision) + return list(center) + var/list/posturfs = list() + for(var/turf/T in range(precision,center)) + if(T.is_transition_turf()) + continue // Avoid picking these. + var/area/A = T.loc + if(!A.noteleport) + posturfs.Add(T) + return posturfs + +/proc/get_teleport_turf(turf/center, precision = 0) + return safepick(get_teleport_turfs(center, precision)) From 6b671ffd06e322264396eac9a15e1556ed733098 Mon Sep 17 00:00:00 2001 From: LetterJay Date: Mon, 11 Sep 2017 15:48:24 -0500 Subject: [PATCH 08/49] Update ritual.dm --- code/game/gamemodes/cult/ritual.dm | 4 ---- 1 file changed, 4 deletions(-) diff --git a/code/game/gamemodes/cult/ritual.dm b/code/game/gamemodes/cult/ritual.dm index bcf4afb147..f1d9bd2ab7 100644 --- a/code/game/gamemodes/cult/ritual.dm +++ b/code/game/gamemodes/cult/ritual.dm @@ -257,15 +257,11 @@ This file contains the arcane tome files. to_chat(user, "There is already a rune here.") return FALSE -<<<<<<< HEAD if(T.z != ZLEVEL_STATION && T.z != ZLEVEL_MINING) to_chat(user, "The veil is not weak enough here.") -======= if(!(T.z in GLOB.station_z_levels) && T.z != ZLEVEL_MINING) to_chat(user, "The veil is not weak enough here.") - ->>>>>>> 10a3238... Makes the station Z level into a list instead of a single define (#30297) return FALSE return TRUE From 9bb9aaa17d9618497766f2fccbfcefaaeb887a48 Mon Sep 17 00:00:00 2001 From: LetterJay Date: Mon, 11 Sep 2017 15:48:59 -0500 Subject: [PATCH 09/49] Update events.dm --- code/game/gamemodes/events.dm | 151 ++++++++++++++++------------------ 1 file changed, 72 insertions(+), 79 deletions(-) diff --git a/code/game/gamemodes/events.dm b/code/game/gamemodes/events.dm index 49eeeb2e6f..c2d14c1994 100644 --- a/code/game/gamemodes/events.dm +++ b/code/game/gamemodes/events.dm @@ -1,67 +1,66 @@ -<<<<<<< HEAD -/proc/power_failure() - priority_announce("Abnormal activity detected in [station_name()]'s powernet. As a precautionary measure, the station's power will be shut off for an indeterminate duration.", "Critical Power Failure", 'sound/ai/poweroff.ogg') - for(var/obj/machinery/power/smes/S in GLOB.machines) - if(istype(get_area(S), /area/ai_monitored/turret_protected) || S.z != ZLEVEL_STATION) - continue - S.charge = 0 - S.output_level = 0 - S.output_attempt = 0 - S.update_icon() - S.power_change() - - var/list/skipped_areas = list(/area/engine/engineering, /area/engine/supermatter, /area/engine/atmospherics_engine, /area/ai_monitored/turret_protected/ai) - - for(var/area/A in world) - if( !A.requires_power || A.always_unpowered ) - continue - - var/skip = 0 - for(var/area_type in skipped_areas) - if(istype(A,area_type)) - skip = 1 - break - if(A.contents) - for(var/atom/AT in A.contents) - if(AT.z != ZLEVEL_STATION) //Only check one, it's enough. - skip = 1 - break - if(skip) continue +/proc/power_failure() + priority_announce("Abnormal activity detected in [station_name()]'s powernet. As a precautionary measure, the station's power will be shut off for an indeterminate duration.", "Critical Power Failure", 'sound/ai/poweroff.ogg') + for(var/obj/machinery/power/smes/S in GLOB.machines) + if(istype(get_area(S), /area/ai_monitored/turret_protected) || S.z != ZLEVEL_STATION) + continue + S.charge = 0 + S.output_level = 0 + S.output_attempt = 0 + S.update_icon() + S.power_change() + + var/list/skipped_areas = list(/area/engine/engineering, /area/engine/supermatter, /area/engine/atmospherics_engine, /area/ai_monitored/turret_protected/ai) + + for(var/area/A in world) + if( !A.requires_power || A.always_unpowered ) + continue + + var/skip = 0 + for(var/area_type in skipped_areas) + if(istype(A,area_type)) + skip = 1 + break + if(A.contents) + for(var/atom/AT in A.contents) + if(AT.z != ZLEVEL_STATION) //Only check one, it's enough. + skip = 1 + break + if(skip) continue A.power_light = FALSE A.power_equip = FALSE A.power_environ = FALSE - A.power_change() - - for(var/obj/machinery/power/apc/C in GLOB.apcs_list) - if(C.cell && C.z == ZLEVEL_STATION) + A.power_change() + + for(var/obj/machinery/power/apc/C in GLOB.apcs_list) + if(C.cell && C.z == ZLEVEL_STATION) var/area/A = C.area - - var/skip = 0 - for(var/area_type in skipped_areas) - if(istype(A,area_type)) - skip = 1 - break - if(skip) continue - - C.cell.charge = 0 - -/proc/power_restore() - - priority_announce("Power has been restored to [station_name()]. We apologize for the inconvenience.", "Power Systems Nominal", 'sound/ai/poweron.ogg') - for(var/obj/machinery/power/apc/C in GLOB.machines) - if(C.cell && C.z == ZLEVEL_STATION) - C.cell.charge = C.cell.maxcharge - C.failure_timer = 0 - for(var/obj/machinery/power/smes/S in GLOB.machines) - if(S.z != ZLEVEL_STATION) - continue - S.charge = S.capacity - S.output_level = S.output_level_max - S.output_attempt = 1 - S.update_icon() - S.power_change() - for(var/area/A in world) -======= + + var/skip = 0 + for(var/area_type in skipped_areas) + if(istype(A,area_type)) + skip = 1 + break + if(skip) continue + + C.cell.charge = 0 + +/proc/power_restore() + + priority_announce("Power has been restored to [station_name()]. We apologize for the inconvenience.", "Power Systems Nominal", 'sound/ai/poweron.ogg') + for(var/obj/machinery/power/apc/C in GLOB.machines) + if(C.cell && C.z == ZLEVEL_STATION) + C.cell.charge = C.cell.maxcharge + C.failure_timer = 0 + for(var/obj/machinery/power/smes/S in GLOB.machines) + if(S.z != ZLEVEL_STATION) + continue + S.charge = S.capacity + S.output_level = S.output_level_max + S.output_attempt = 1 + S.update_icon() + S.power_change() + for(var/area/A in world) + /proc/power_failure() priority_announce("Abnormal activity detected in [station_name()]'s powernet. As a precautionary measure, the station's power will be shut off for an indeterminate duration.", "Critical Power Failure", 'sound/ai/poweroff.ogg') for(var/obj/machinery/power/smes/S in GLOB.machines) @@ -124,27 +123,23 @@ S.update_icon() S.power_change() for(var/area/A in world) ->>>>>>> 10a3238... Makes the station Z level into a list instead of a single define (#30297) if(!istype(A, /area/space) && !istype(A, /area/shuttle) && !istype(A, /area/arrival)) A.power_light = TRUE A.power_equip = TRUE A.power_environ = TRUE -<<<<<<< HEAD - A.power_change() - -/proc/power_restore_quick() - - priority_announce("All SMESs on [station_name()] have been recharged. We apologize for the inconvenience.", "Power Systems Nominal", 'sound/ai/poweron.ogg') - for(var/obj/machinery/power/smes/S in GLOB.machines) - if(S.z != ZLEVEL_STATION) - continue - S.charge = S.capacity - S.output_level = S.output_level_max - S.output_attempt = 1 - S.update_icon() - S.power_change() - -======= + A.power_change() + +/proc/power_restore_quick() + + priority_announce("All SMESs on [station_name()] have been recharged. We apologize for the inconvenience.", "Power Systems Nominal", 'sound/ai/poweron.ogg') + for(var/obj/machinery/power/smes/S in GLOB.machines) + if(S.z != ZLEVEL_STATION) + continue + S.charge = S.capacity + S.output_level = S.output_level_max + S.output_attempt = 1 + S.update_icon() + S.power_change() A.power_change() /proc/power_restore_quick() @@ -158,5 +153,3 @@ S.output_attempt = 1 S.update_icon() S.power_change() - ->>>>>>> 10a3238... Makes the station Z level into a list instead of a single define (#30297) From e767e20574c8e97c1b14faa481208e68d93e893f Mon Sep 17 00:00:00 2001 From: LetterJay Date: Mon, 11 Sep 2017 15:49:54 -0500 Subject: [PATCH 10/49] Update game_mode.dm --- code/game/gamemodes/game_mode.dm | 1187 +++++++++++++++--------------- 1 file changed, 591 insertions(+), 596 deletions(-) diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index 3e08bf91f3..9abce952db 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -1,598 +1,594 @@ -<<<<<<< HEAD - - -/* - * GAMEMODES (by Rastaf0) - * - * In the new mode system all special roles are fully supported. - * You can have proper wizards/traitors/changelings/cultists during any mode. - * Only two things really depends on gamemode: - * 1. Starting roles, equipment and preparations - * 2. Conditions of finishing the round. - * - */ - - -/datum/game_mode - var/name = "invalid" - var/config_tag = null - var/votable = 1 - var/probability = 0 - var/station_was_nuked = 0 //see nuclearbomb.dm and malfunction.dm - var/explosion_in_progress = 0 //sit back and relax - var/round_ends_with_antag_death = 0 //flags_1 the "one verse the station" antags as such - var/list/datum/mind/modePlayer = new - var/list/datum/mind/antag_candidates = list() // List of possible starting antags goes here - var/list/restricted_jobs = list() // Jobs it doesn't make sense to be. I.E chaplain or AI cultist - var/list/protected_jobs = list() // Jobs that can't be traitors because - var/required_players = 0 - var/maximum_players = -1 // -1 is no maximum, positive numbers limit the selection of a mode on overstaffed stations - var/required_enemies = 0 - var/recommended_enemies = 0 - var/antag_flag = null //preferences flag such as BE_WIZARD that need to be turned on for players to be antag - var/mob/living/living_antag_player = null - var/list/datum/game_mode/replacementmode = null - var/round_converted = 0 //0: round not converted, 1: round going to convert, 2: round converted - var/reroll_friendly //During mode conversion only these are in the running - var/continuous_sanity_checked //Catches some cases where config options could be used to suggest that modes without antagonists should end when all antagonists die - var/enemy_minimum_age = 7 //How many days must players have been playing before they can play this antagonist - - var/announce_span = "warning" //The gamemode's name will be in this span during announcement. - var/announce_text = "This gamemode forgot to set a descriptive text! Uh oh!" //Used to describe a gamemode when it's announced. - - var/const/waittime_l = 600 - var/const/waittime_h = 1800 // started at 1800 - - var/list/datum/station_goal/station_goals = list() - - var/allow_persistence_save = TRUE - -/datum/game_mode/proc/announce() //Shows the gamemode's name and a fast description. - to_chat(world, "The gamemode is: [name]!") - to_chat(world, "[announce_text]") - - -///Checks to see if the game can be setup and ran with the current number of players or whatnot. -/datum/game_mode/proc/can_start() - var/playerC = 0 - for(var/mob/dead/new_player/player in GLOB.player_list) - if((player.client)&&(player.ready == PLAYER_READY_TO_PLAY)) - playerC++ - if(!GLOB.Debug2) - if(playerC < required_players || (maximum_players >= 0 && playerC > maximum_players)) - return 0 - antag_candidates = get_players_for_role(antag_flag) - if(!GLOB.Debug2) - if(antag_candidates.len < required_enemies) - return 0 - return 1 - else - message_admins("DEBUG: GAME STARTING WITHOUT PLAYER NUMBER CHECKS, THIS WILL PROBABLY BREAK SHIT.") - return 1 - - -///Attempts to select players for special roles the mode might have. -/datum/game_mode/proc/pre_setup() - return 1 - - -///Everyone should now be on the station and have their normal gear. This is the place to give the special roles extra things -/datum/game_mode/proc/post_setup(report) //Gamemodes can override the intercept report. Passing TRUE as the argument will force a report. - if(!report) - report = config.intercept - addtimer(CALLBACK(GLOBAL_PROC, .proc/display_roundstart_logout_report), ROUNDSTART_LOGOUT_REPORT_TIME) - - if(SSdbcore.Connect()) - var/sql - if(SSticker.mode) - sql += "game_mode = '[SSticker.mode]'" - if(GLOB.revdata.originmastercommit) - if(sql) - sql += ", " - sql += "commit_hash = '[GLOB.revdata.originmastercommit]'" - if(sql) - var/datum/DBQuery/query_round_game_mode = SSdbcore.NewQuery("UPDATE [format_table_name("round")] SET [sql] WHERE id = [GLOB.round_id]") - query_round_game_mode.Execute() - if(report) - addtimer(CALLBACK(src, .proc/send_intercept, 0), rand(waittime_l, waittime_h)) - generate_station_goals() - return 1 - - -///Handles late-join antag assignments -/datum/game_mode/proc/make_antag_chance(mob/living/carbon/human/character) - if(replacementmode && round_converted == 2) - replacementmode.make_antag_chance(character) - return - - -///Allows rounds to basically be "rerolled" should the initial premise fall through. Also known as mulligan antags. -/datum/game_mode/proc/convert_roundtype() - set waitfor = FALSE - var/list/living_crew = list() - - for(var/mob/Player in GLOB.mob_list) - if(Player.mind && Player.stat != DEAD && !isnewplayer(Player) && !isbrain(Player) && Player.client) - living_crew += Player - if(living_crew.len / GLOB.joined_player_list.len <= config.midround_antag_life_check) //If a lot of the player base died, we start fresh - message_admins("Convert_roundtype failed due to too many dead people. Limit is [config.midround_antag_life_check * 100]% living crew") - return null - - var/list/datum/game_mode/runnable_modes = config.get_runnable_midround_modes(living_crew.len) - var/list/datum/game_mode/usable_modes = list() - for(var/datum/game_mode/G in runnable_modes) - if(G.reroll_friendly && living_crew >= G.required_players) - usable_modes += G - else - qdel(G) - - if(!usable_modes) - message_admins("Convert_roundtype failed due to no valid modes to convert to. Please report this error to the Coders.") - return null - - replacementmode = pickweight(usable_modes) - - switch(SSshuttle.emergency.mode) //Rounds on the verge of ending don't get new antags, they just run out - if(SHUTTLE_STRANDED, SHUTTLE_ESCAPE) - return 1 - if(SHUTTLE_CALL) - if(SSshuttle.emergency.timeLeft(1) < initial(SSshuttle.emergencyCallTime)*0.5) - return 1 - - if(world.time >= (config.midround_antag_time_check * 600)) - message_admins("Convert_roundtype failed due to round length. Limit is [config.midround_antag_time_check] minutes.") - return null - - var/list/antag_candidates = list() - - for(var/mob/living/carbon/human/H in living_crew) - if(H.client && H.client.prefs.allow_midround_antag) - antag_candidates += H - - if(!antag_candidates) - message_admins("Convert_roundtype failed due to no antag candidates.") - return null - - antag_candidates = shuffle(antag_candidates) - - if(config.protect_roles_from_antagonist) - replacementmode.restricted_jobs += replacementmode.protected_jobs - if(config.protect_assistant_from_antagonist) - replacementmode.restricted_jobs += "Assistant" - - message_admins("The roundtype will be converted. If you have other plans for the station or feel the station is too messed up to inhabit stop the creation of antags or end the round now.") - - . = 1 - sleep(rand(600,1800)) - if(!SSticker.IsRoundInProgress()) - message_admins("Roundtype conversion cancelled, the game appears to have finished!") - round_converted = 0 - return - //somewhere between 1 and 3 minutes from now - if(!config.midround_antag[SSticker.mode.config_tag]) - round_converted = 0 - return 1 - for(var/mob/living/carbon/human/H in antag_candidates) - replacementmode.make_antag_chance(H) - round_converted = 2 - message_admins("-- IMPORTANT: The roundtype has been converted to [replacementmode.name], antagonists may have been created! --") - - -///Called by the gameSSticker -/datum/game_mode/process() - return 0 - - -/datum/game_mode/proc/check_finished(force_ending) //to be called by SSticker - if(replacementmode && round_converted == 2) - return replacementmode.check_finished() - if(SSshuttle.emergency && (SSshuttle.emergency.mode == SHUTTLE_ENDGAME)) - return TRUE - if(station_was_nuked) - return TRUE - if(!round_converted && (!config.continuous[config_tag] || (config.continuous[config_tag] && config.midround_antag[config_tag]))) //Non-continuous or continous with replacement antags - if(!continuous_sanity_checked) //make sure we have antags to be checking in the first place - for(var/mob/Player in GLOB.mob_list) - if(Player.mind) - if(Player.mind.special_role) - continuous_sanity_checked = 1 - return 0 - if(!continuous_sanity_checked) - message_admins("The roundtype ([config_tag]) has no antagonists, continuous round has been defaulted to on and midround_antag has been defaulted to off.") - config.continuous[config_tag] = 1 - config.midround_antag[config_tag] = 0 - SSshuttle.clearHostileEnvironment(src) - return 0 - - - if(living_antag_player && living_antag_player.mind && isliving(living_antag_player) && living_antag_player.stat != DEAD && !isnewplayer(living_antag_player) &&!isbrain(living_antag_player)) - return 0 //A resource saver: once we find someone who has to die for all antags to be dead, we can just keep checking them, cycling over everyone only when we lose our mark. - - for(var/mob/Player in GLOB.living_mob_list) - if(Player.mind && Player.stat != DEAD && !isnewplayer(Player) &&!isbrain(Player) && Player.client) - if(Player.mind.special_role) //Someone's still antaging! - living_antag_player = Player - return 0 - - if(!config.continuous[config_tag] || force_ending) - return 1 - - else - round_converted = convert_roundtype() - if(!round_converted) - if(round_ends_with_antag_death) - return 1 - else - config.midround_antag[config_tag] = 0 - return 0 - - return 0 - - -/datum/game_mode/proc/declare_completion() - var/clients = 0 - var/surviving_humans = 0 - var/surviving_total = 0 - var/ghosts = 0 - var/escaped_humans = 0 - var/escaped_total = 0 - - for(var/mob/M in GLOB.player_list) - if(M.client) - clients++ - if(ishuman(M)) - if(!M.stat) - surviving_humans++ - if(M.z == ZLEVEL_CENTCOM) - escaped_humans++ - if(!M.stat) - surviving_total++ - if(M.z == ZLEVEL_CENTCOM) - escaped_total++ - - - if(isobserver(M)) - ghosts++ - - if(clients > 0) - SSblackbox.set_val("round_end_clients",clients) - if(ghosts > 0) - SSblackbox.set_val("round_end_ghosts",ghosts) - if(surviving_humans > 0) - SSblackbox.set_val("survived_human",surviving_humans) - if(surviving_total > 0) - SSblackbox.set_val("survived_total",surviving_total) - if(escaped_humans > 0) - SSblackbox.set_val("escaped_human",escaped_humans) - if(escaped_total > 0) - SSblackbox.set_val("escaped_total",escaped_total) - send2irc("Server", "Round just ended.") - if(cult.len && !istype(SSticker.mode, /datum/game_mode/cult)) - datum_cult_completion() - - - if(GLOB.borers.len) - var/borertext = "
The borers were:" - for(var/mob/living/simple_animal/borer/B in GLOB.borers) - if((B.key || B.controlling) && B.stat != DEAD) - borertext += "
[B.controlling ? B.victim.key : B.key] was [B.truename]" - var/count = 1 - for(var/datum/objective/objective in B.mind.objectives) - if(objective.check_completion()) - borertext += "
Objective #[count]: [objective.explanation_text] Success!" - else - borertext += "
Objective #[count]: [objective.explanation_text] Fail." - count++ - - - to_chat(world, borertext) - - var/total_borers = 0 - for(var/mob/living/simple_animal/borer/B in GLOB.borers) - if((B.key || B.victim) && B.stat != DEAD) - total_borers++ - if(total_borers) - var/total_borer_hosts = 0 - for(var/mob/living/carbon/C in GLOB.mob_list) - var/mob/living/simple_animal/borer/D = C.has_brain_worms() - var/turf/location = get_turf(C) - if(location.z == ZLEVEL_CENTCOM && D && D.stat != DEAD) - total_borer_hosts++ - to_chat(world, "There were [total_borers] borers alive at round end!") - to_chat(world, "A total of [total_borer_hosts] borers with hosts escaped on the shuttle alive.") - - CHECK_TICK - return 0 - - -/datum/game_mode/proc/check_win() //universal trigger to be called at mob death, nuke explosion, etc. To be called from everywhere. - return 0 - - -/datum/game_mode/proc/send_intercept() - var/intercepttext = "Central Command Status Summary
" - intercepttext += "Central Command has intercepted and partially decoded a Syndicate transmission with vital information regarding their movements. The following report outlines the most \ - likely threats to appear in your sector." - var/list/possible_modes = list() - possible_modes.Add("blob", "changeling", "clock_cult", "cult", "extended", "gang", "malf", "nuclear", "revolution", "traitor", "wizard") - possible_modes -= name //remove the current gamemode to prevent it from being randomly deleted, it will be readded later - - for(var/i in 1 to 6) //Remove a few modes to leave four - possible_modes -= pick(possible_modes) - - possible_modes |= name //Re-add the actual gamemode - the intercept will thus always have the correct mode in its list - possible_modes = shuffle(possible_modes) //Meta prevention - - var/datum/intercept_text/i_text = new /datum/intercept_text - for(var/V in possible_modes) - intercepttext += i_text.build(V) - - if(station_goals.len) - intercepttext += "
Special Orders for [station_name()]:" - for(var/datum/station_goal/G in station_goals) - G.on_report() - intercepttext += G.get_report() - - print_command_report(intercepttext, "Central Command Status Summary", announce=FALSE) - priority_announce("A summary has been copied and printed to all communications consoles.", "Enemy communication intercepted. Security level elevated.", 'sound/ai/intercept.ogg') - if(GLOB.security_level < SEC_LEVEL_BLUE) - set_security_level(SEC_LEVEL_BLUE) - - -/datum/game_mode/proc/get_players_for_role(role) - var/list/players = list() - var/list/candidates = list() - var/list/drafted = list() - var/datum/mind/applicant = null - - // Ultimate randomizing code right here - for(var/mob/dead/new_player/player in GLOB.player_list) - if(player.client && player.ready == PLAYER_READY_TO_PLAY) - players += player - - // Shuffling, the players list is now ping-independent!!! - // Goodbye antag dante - players = shuffle(players) - - for(var/mob/dead/new_player/player in players) - if(player.client && player.ready == PLAYER_READY_TO_PLAY) - if(role in player.client.prefs.be_special) - if(!jobban_isbanned(player, "Syndicate") && !jobban_isbanned(player, role)) //Nodrak/Carn: Antag Job-bans - if(age_check(player.client)) //Must be older than the minimum age - candidates += player.mind // Get a list of all the people who want to be the antagonist for this round - - if(restricted_jobs) - for(var/datum/mind/player in candidates) - for(var/job in restricted_jobs) // Remove people who want to be antagonist but have a job already that precludes it - if(player.assigned_role == job) - candidates -= player - - if(candidates.len < recommended_enemies) - for(var/mob/dead/new_player/player in players) - if(player.client && player.ready == PLAYER_READY_TO_PLAY) - if(!(role in player.client.prefs.be_special)) // We don't have enough people who want to be antagonist, make a separate list of people who don't want to be one - if(!jobban_isbanned(player, "Syndicate") && !jobban_isbanned(player, role)) //Nodrak/Carn: Antag Job-bans - drafted += player.mind - - if(restricted_jobs) - for(var/datum/mind/player in drafted) // Remove people who can't be an antagonist - for(var/job in restricted_jobs) - if(player.assigned_role == job) - drafted -= player - - drafted = shuffle(drafted) // Will hopefully increase randomness, Donkie - - while(candidates.len < recommended_enemies) // Pick randomlly just the number of people we need and add them to our list of candidates - if(drafted.len > 0) - applicant = pick(drafted) - if(applicant) - candidates += applicant - drafted.Remove(applicant) - - else // Not enough scrubs, ABORT ABORT ABORT - break - - if(restricted_jobs) - for(var/datum/mind/player in drafted) // Remove people who can't be an antagonist - for(var/job in restricted_jobs) - if(player.assigned_role == job) - drafted -= player - - drafted = shuffle(drafted) // Will hopefully increase randomness, Donkie - - while(candidates.len < recommended_enemies) // Pick randomlly just the number of people we need and add them to our list of candidates - if(drafted.len > 0) - applicant = pick(drafted) - if(applicant) - candidates += applicant - drafted.Remove(applicant) - - else // Not enough scrubs, ABORT ABORT ABORT - break - - return candidates // Returns: The number of people who had the antagonist role set to yes, regardless of recomended_enemies, if that number is greater than recommended_enemies - // recommended_enemies if the number of people with that role set to yes is less than recomended_enemies, - // Less if there are not enough valid players in the game entirely to make recommended_enemies. - - - -/datum/game_mode/proc/num_players() - . = 0 - for(var/mob/dead/new_player/P in GLOB.player_list) - if(P.client && P.ready == PLAYER_READY_TO_PLAY) - . ++ - -/////////////////////////////////// -//Keeps track of all living heads// -/////////////////////////////////// -/datum/game_mode/proc/get_living_heads() - . = list() - for(var/mob/living/carbon/human/player in GLOB.mob_list) - if(player.stat != DEAD && player.mind && (player.mind.assigned_role in GLOB.command_positions)) - . |= player.mind - - -//////////////////////////// -//Keeps track of all heads// -//////////////////////////// -/datum/game_mode/proc/get_all_heads() - . = list() - for(var/mob/player in GLOB.mob_list) - if(player.mind && (player.mind.assigned_role in GLOB.command_positions)) - . |= player.mind - -////////////////////////////////////////////// -//Keeps track of all living security members// -////////////////////////////////////////////// -/datum/game_mode/proc/get_living_sec() - . = list() - for(var/mob/living/carbon/human/player in GLOB.mob_list) - if(player.stat != DEAD && player.mind && (player.mind.assigned_role in GLOB.security_positions)) - . |= player.mind - -//////////////////////////////////////// -//Keeps track of all security members// -//////////////////////////////////////// -/datum/game_mode/proc/get_all_sec() - . = list() - for(var/mob/living/carbon/human/player in GLOB.mob_list) - if(player.mind && (player.mind.assigned_role in GLOB.security_positions)) - . |= player.mind - -////////////////////////// -//Reports player logouts// -////////////////////////// -/proc/display_roundstart_logout_report() - var/msg = "Roundstart logout report\n\n" - for(var/mob/living/L in GLOB.mob_list) - - if(L.ckey) - var/found = 0 - for(var/client/C in GLOB.clients) - if(C.ckey == L.ckey) - found = 1 - break - if(!found) - msg += "[L.name] ([L.ckey]), the [L.job] (Disconnected)\n" - - - if(L.ckey && L.client) - if(L.client.inactivity >= (ROUNDSTART_LOGOUT_REPORT_TIME / 2)) //Connected, but inactive (alt+tabbed or something) - msg += "[L.name] ([L.ckey]), the [L.job] (Connected, Inactive)\n" - continue //AFK client - if(L.stat) - if(L.suiciding) //Suicider - msg += "[L.name] ([L.ckey]), the [L.job] (Suicide)\n" - continue //Disconnected client - if(L.stat == UNCONSCIOUS) - msg += "[L.name] ([L.ckey]), the [L.job] (Dying)\n" - continue //Unconscious - if(L.stat == DEAD) - msg += "[L.name] ([L.ckey]), the [L.job] (Dead)\n" - continue //Dead - - continue //Happy connected client - for(var/mob/dead/observer/D in GLOB.mob_list) - if(D.mind && D.mind.current == L) - if(L.stat == DEAD) - if(L.suiciding) //Suicider - msg += "[L.name] ([ckey(D.mind.key)]), the [L.job] (Suicide)\n" - continue //Disconnected client - else - msg += "[L.name] ([ckey(D.mind.key)]), the [L.job] (Dead)\n" - continue //Dead mob, ghost abandoned - else - if(D.can_reenter_corpse) - continue //Adminghost, or cult/wizard ghost - else - msg += "[L.name] ([ckey(D.mind.key)]), the [L.job] (Ghosted)\n" - continue //Ghosted while alive - - - - for(var/mob/M in GLOB.mob_list) - if(M.client && M.client.holder) - to_chat(M, msg) - -/datum/game_mode/proc/printplayer(datum/mind/ply, fleecheck) - var/text = "
[ply.key] was [ply.name] the [ply.assigned_role] and" - if(ply.current) - if(ply.current.stat == DEAD) - text += " died" - else - text += " survived" - if(fleecheck && ply.current.z > ZLEVEL_STATION) - text += " while fleeing the station" - if(ply.current.real_name != ply.name) - text += " as [ply.current.real_name]" - else - text += " had their body destroyed" - return text - -/datum/game_mode/proc/printobjectives(datum/mind/ply) - var/text = "" - var/count = 1 - for(var/datum/objective/objective in ply.objectives) - if(objective.check_completion()) - text += "
Objective #[count]: [objective.explanation_text] Success!" - else - text += "
Objective #[count]: [objective.explanation_text] Fail." - count++ - return text - -//If the configuration option is set to require players to be logged as old enough to play certain jobs, then this proc checks that they are, otherwise it just returns 1 -/datum/game_mode/proc/age_check(client/C) - if(get_remaining_days(C) == 0) - return 1 //Available in 0 days = available right now = player is old enough to play. - return 0 - - -/datum/game_mode/proc/get_remaining_days(client/C) - if(!C) - return 0 - if(!config.use_age_restriction_for_jobs) - return 0 - if(!isnum(C.player_age)) - return 0 //This is only a number if the db connection is established, otherwise it is text: "Requires database", meaning these restrictions cannot be enforced - if(!isnum(enemy_minimum_age)) - return 0 - - return max(0, enemy_minimum_age - C.player_age) - -/datum/game_mode/proc/replace_jobbaned_player(mob/living/M, role_type, pref) - var/list/mob/dead/observer/candidates = pollCandidatesForMob("Do you want to play as a [role_type]?", "[role_type]", null, pref, 50, M) - var/mob/dead/observer/theghost = null - if(candidates.len) - theghost = pick(candidates) - to_chat(M, "Your mob has been taken over by a ghost! Appeal your job ban if you want to avoid this in the future!") - message_admins("[key_name_admin(theghost)] has taken control of ([key_name_admin(M)]) to replace a jobbaned player.") - M.ghostize(0) - M.key = theghost.key - -/datum/game_mode/proc/remove_antag_for_borging(datum/mind/newborgie) - SSticker.mode.remove_cultist(newborgie, 0, 0) - SSticker.mode.remove_revolutionary(newborgie, 0) - SSticker.mode.remove_gangster(newborgie, 0, remove_bosses=1) - -/datum/game_mode/proc/generate_station_goals() - var/list/possible = list() - for(var/T in subtypesof(/datum/station_goal)) - var/datum/station_goal/G = T - if(config_tag in initial(G.gamemode_blacklist)) - continue - possible += T - var/goal_weights = 0 - while(possible.len && goal_weights < STATION_GOAL_BUDGET) - var/datum/station_goal/picked = pick_n_take(possible) - goal_weights += initial(picked.weight) - station_goals += new picked - - -/datum/game_mode/proc/declare_station_goal_completion() - for(var/V in station_goals) - var/datum/station_goal/G = V - G.print_result() -======= +/* + * GAMEMODES (by Rastaf0) + * + * In the new mode system all special roles are fully supported. + * You can have proper wizards/traitors/changelings/cultists during any mode. + * Only two things really depends on gamemode: + * 1. Starting roles, equipment and preparations + * 2. Conditions of finishing the round. + * + */ + + +/datum/game_mode + var/name = "invalid" + var/config_tag = null + var/votable = 1 + var/probability = 0 + var/station_was_nuked = 0 //see nuclearbomb.dm and malfunction.dm + var/explosion_in_progress = 0 //sit back and relax + var/round_ends_with_antag_death = 0 //flags_1 the "one verse the station" antags as such + var/list/datum/mind/modePlayer = new + var/list/datum/mind/antag_candidates = list() // List of possible starting antags goes here + var/list/restricted_jobs = list() // Jobs it doesn't make sense to be. I.E chaplain or AI cultist + var/list/protected_jobs = list() // Jobs that can't be traitors because + var/required_players = 0 + var/maximum_players = -1 // -1 is no maximum, positive numbers limit the selection of a mode on overstaffed stations + var/required_enemies = 0 + var/recommended_enemies = 0 + var/antag_flag = null //preferences flag such as BE_WIZARD that need to be turned on for players to be antag + var/mob/living/living_antag_player = null + var/list/datum/game_mode/replacementmode = null + var/round_converted = 0 //0: round not converted, 1: round going to convert, 2: round converted + var/reroll_friendly //During mode conversion only these are in the running + var/continuous_sanity_checked //Catches some cases where config options could be used to suggest that modes without antagonists should end when all antagonists die + var/enemy_minimum_age = 7 //How many days must players have been playing before they can play this antagonist + + var/announce_span = "warning" //The gamemode's name will be in this span during announcement. + var/announce_text = "This gamemode forgot to set a descriptive text! Uh oh!" //Used to describe a gamemode when it's announced. + + var/const/waittime_l = 600 + var/const/waittime_h = 1800 // started at 1800 + + var/list/datum/station_goal/station_goals = list() + + var/allow_persistence_save = TRUE + +/datum/game_mode/proc/announce() //Shows the gamemode's name and a fast description. + to_chat(world, "The gamemode is: [name]!") + to_chat(world, "[announce_text]") + + +///Checks to see if the game can be setup and ran with the current number of players or whatnot. +/datum/game_mode/proc/can_start() + var/playerC = 0 + for(var/mob/dead/new_player/player in GLOB.player_list) + if((player.client)&&(player.ready == PLAYER_READY_TO_PLAY)) + playerC++ + if(!GLOB.Debug2) + if(playerC < required_players || (maximum_players >= 0 && playerC > maximum_players)) + return 0 + antag_candidates = get_players_for_role(antag_flag) + if(!GLOB.Debug2) + if(antag_candidates.len < required_enemies) + return 0 + return 1 + else + message_admins("DEBUG: GAME STARTING WITHOUT PLAYER NUMBER CHECKS, THIS WILL PROBABLY BREAK SHIT.") + return 1 + + +///Attempts to select players for special roles the mode might have. +/datum/game_mode/proc/pre_setup() + return 1 + + +///Everyone should now be on the station and have their normal gear. This is the place to give the special roles extra things +/datum/game_mode/proc/post_setup(report) //Gamemodes can override the intercept report. Passing TRUE as the argument will force a report. + if(!report) + report = config.intercept + addtimer(CALLBACK(GLOBAL_PROC, .proc/display_roundstart_logout_report), ROUNDSTART_LOGOUT_REPORT_TIME) + + if(SSdbcore.Connect()) + var/sql + if(SSticker.mode) + sql += "game_mode = '[SSticker.mode]'" + if(GLOB.revdata.originmastercommit) + if(sql) + sql += ", " + sql += "commit_hash = '[GLOB.revdata.originmastercommit]'" + if(sql) + var/datum/DBQuery/query_round_game_mode = SSdbcore.NewQuery("UPDATE [format_table_name("round")] SET [sql] WHERE id = [GLOB.round_id]") + query_round_game_mode.Execute() + if(report) + addtimer(CALLBACK(src, .proc/send_intercept, 0), rand(waittime_l, waittime_h)) + generate_station_goals() + return 1 + + +///Handles late-join antag assignments +/datum/game_mode/proc/make_antag_chance(mob/living/carbon/human/character) + if(replacementmode && round_converted == 2) + replacementmode.make_antag_chance(character) + return + + +///Allows rounds to basically be "rerolled" should the initial premise fall through. Also known as mulligan antags. +/datum/game_mode/proc/convert_roundtype() + set waitfor = FALSE + var/list/living_crew = list() + + for(var/mob/Player in GLOB.mob_list) + if(Player.mind && Player.stat != DEAD && !isnewplayer(Player) && !isbrain(Player) && Player.client) + living_crew += Player + if(living_crew.len / GLOB.joined_player_list.len <= config.midround_antag_life_check) //If a lot of the player base died, we start fresh + message_admins("Convert_roundtype failed due to too many dead people. Limit is [config.midround_antag_life_check * 100]% living crew") + return null + + var/list/datum/game_mode/runnable_modes = config.get_runnable_midround_modes(living_crew.len) + var/list/datum/game_mode/usable_modes = list() + for(var/datum/game_mode/G in runnable_modes) + if(G.reroll_friendly && living_crew >= G.required_players) + usable_modes += G + else + qdel(G) + + if(!usable_modes) + message_admins("Convert_roundtype failed due to no valid modes to convert to. Please report this error to the Coders.") + return null + + replacementmode = pickweight(usable_modes) + + switch(SSshuttle.emergency.mode) //Rounds on the verge of ending don't get new antags, they just run out + if(SHUTTLE_STRANDED, SHUTTLE_ESCAPE) + return 1 + if(SHUTTLE_CALL) + if(SSshuttle.emergency.timeLeft(1) < initial(SSshuttle.emergencyCallTime)*0.5) + return 1 + + if(world.time >= (config.midround_antag_time_check * 600)) + message_admins("Convert_roundtype failed due to round length. Limit is [config.midround_antag_time_check] minutes.") + return null + + var/list/antag_candidates = list() + + for(var/mob/living/carbon/human/H in living_crew) + if(H.client && H.client.prefs.allow_midround_antag) + antag_candidates += H + + if(!antag_candidates) + message_admins("Convert_roundtype failed due to no antag candidates.") + return null + + antag_candidates = shuffle(antag_candidates) + + if(config.protect_roles_from_antagonist) + replacementmode.restricted_jobs += replacementmode.protected_jobs + if(config.protect_assistant_from_antagonist) + replacementmode.restricted_jobs += "Assistant" + + message_admins("The roundtype will be converted. If you have other plans for the station or feel the station is too messed up to inhabit stop the creation of antags or end the round now.") + + . = 1 + sleep(rand(600,1800)) + if(!SSticker.IsRoundInProgress()) + message_admins("Roundtype conversion cancelled, the game appears to have finished!") + round_converted = 0 + return + //somewhere between 1 and 3 minutes from now + if(!config.midround_antag[SSticker.mode.config_tag]) + round_converted = 0 + return 1 + for(var/mob/living/carbon/human/H in antag_candidates) + replacementmode.make_antag_chance(H) + round_converted = 2 + message_admins("-- IMPORTANT: The roundtype has been converted to [replacementmode.name], antagonists may have been created! --") + + +///Called by the gameSSticker +/datum/game_mode/process() + return 0 + + +/datum/game_mode/proc/check_finished(force_ending) //to be called by SSticker + if(replacementmode && round_converted == 2) + return replacementmode.check_finished() + if(SSshuttle.emergency && (SSshuttle.emergency.mode == SHUTTLE_ENDGAME)) + return TRUE + if(station_was_nuked) + return TRUE + if(!round_converted && (!config.continuous[config_tag] || (config.continuous[config_tag] && config.midround_antag[config_tag]))) //Non-continuous or continous with replacement antags + if(!continuous_sanity_checked) //make sure we have antags to be checking in the first place + for(var/mob/Player in GLOB.mob_list) + if(Player.mind) + if(Player.mind.special_role) + continuous_sanity_checked = 1 + return 0 + if(!continuous_sanity_checked) + message_admins("The roundtype ([config_tag]) has no antagonists, continuous round has been defaulted to on and midround_antag has been defaulted to off.") + config.continuous[config_tag] = 1 + config.midround_antag[config_tag] = 0 + SSshuttle.clearHostileEnvironment(src) + return 0 + + + if(living_antag_player && living_antag_player.mind && isliving(living_antag_player) && living_antag_player.stat != DEAD && !isnewplayer(living_antag_player) &&!isbrain(living_antag_player)) + return 0 //A resource saver: once we find someone who has to die for all antags to be dead, we can just keep checking them, cycling over everyone only when we lose our mark. + + for(var/mob/Player in GLOB.living_mob_list) + if(Player.mind && Player.stat != DEAD && !isnewplayer(Player) &&!isbrain(Player) && Player.client) + if(Player.mind.special_role) //Someone's still antaging! + living_antag_player = Player + return 0 + + if(!config.continuous[config_tag] || force_ending) + return 1 + + else + round_converted = convert_roundtype() + if(!round_converted) + if(round_ends_with_antag_death) + return 1 + else + config.midround_antag[config_tag] = 0 + return 0 + + return 0 + + +/datum/game_mode/proc/declare_completion() + var/clients = 0 + var/surviving_humans = 0 + var/surviving_total = 0 + var/ghosts = 0 + var/escaped_humans = 0 + var/escaped_total = 0 + + for(var/mob/M in GLOB.player_list) + if(M.client) + clients++ + if(ishuman(M)) + if(!M.stat) + surviving_humans++ + if(M.z == ZLEVEL_CENTCOM) + escaped_humans++ + if(!M.stat) + surviving_total++ + if(M.z == ZLEVEL_CENTCOM) + escaped_total++ + + + if(isobserver(M)) + ghosts++ + + if(clients > 0) + SSblackbox.set_val("round_end_clients",clients) + if(ghosts > 0) + SSblackbox.set_val("round_end_ghosts",ghosts) + if(surviving_humans > 0) + SSblackbox.set_val("survived_human",surviving_humans) + if(surviving_total > 0) + SSblackbox.set_val("survived_total",surviving_total) + if(escaped_humans > 0) + SSblackbox.set_val("escaped_human",escaped_humans) + if(escaped_total > 0) + SSblackbox.set_val("escaped_total",escaped_total) + send2irc("Server", "Round just ended.") + if(cult.len && !istype(SSticker.mode, /datum/game_mode/cult)) + datum_cult_completion() + + + if(GLOB.borers.len) + var/borertext = "
The borers were:" + for(var/mob/living/simple_animal/borer/B in GLOB.borers) + if((B.key || B.controlling) && B.stat != DEAD) + borertext += "
[B.controlling ? B.victim.key : B.key] was [B.truename]" + var/count = 1 + for(var/datum/objective/objective in B.mind.objectives) + if(objective.check_completion()) + borertext += "
Objective #[count]: [objective.explanation_text] Success!" + else + borertext += "
Objective #[count]: [objective.explanation_text] Fail." + count++ + + + to_chat(world, borertext) + + var/total_borers = 0 + for(var/mob/living/simple_animal/borer/B in GLOB.borers) + if((B.key || B.victim) && B.stat != DEAD) + total_borers++ + if(total_borers) + var/total_borer_hosts = 0 + for(var/mob/living/carbon/C in GLOB.mob_list) + var/mob/living/simple_animal/borer/D = C.has_brain_worms() + var/turf/location = get_turf(C) + if(location.z == ZLEVEL_CENTCOM && D && D.stat != DEAD) + total_borer_hosts++ + to_chat(world, "There were [total_borers] borers alive at round end!") + to_chat(world, "A total of [total_borer_hosts] borers with hosts escaped on the shuttle alive.") + + CHECK_TICK + return 0 + + +/datum/game_mode/proc/check_win() //universal trigger to be called at mob death, nuke explosion, etc. To be called from everywhere. + return 0 + + +/datum/game_mode/proc/send_intercept() + var/intercepttext = "Central Command Status Summary
" + intercepttext += "Central Command has intercepted and partially decoded a Syndicate transmission with vital information regarding their movements. The following report outlines the most \ + likely threats to appear in your sector." + var/list/possible_modes = list() + possible_modes.Add("blob", "changeling", "clock_cult", "cult", "extended", "gang", "malf", "nuclear", "revolution", "traitor", "wizard") + possible_modes -= name //remove the current gamemode to prevent it from being randomly deleted, it will be readded later + + for(var/i in 1 to 6) //Remove a few modes to leave four + possible_modes -= pick(possible_modes) + + possible_modes |= name //Re-add the actual gamemode - the intercept will thus always have the correct mode in its list + possible_modes = shuffle(possible_modes) //Meta prevention + + var/datum/intercept_text/i_text = new /datum/intercept_text + for(var/V in possible_modes) + intercepttext += i_text.build(V) + + if(station_goals.len) + intercepttext += "
Special Orders for [station_name()]:" + for(var/datum/station_goal/G in station_goals) + G.on_report() + intercepttext += G.get_report() + + print_command_report(intercepttext, "Central Command Status Summary", announce=FALSE) + priority_announce("A summary has been copied and printed to all communications consoles.", "Enemy communication intercepted. Security level elevated.", 'sound/ai/intercept.ogg') + if(GLOB.security_level < SEC_LEVEL_BLUE) + set_security_level(SEC_LEVEL_BLUE) + + +/datum/game_mode/proc/get_players_for_role(role) + var/list/players = list() + var/list/candidates = list() + var/list/drafted = list() + var/datum/mind/applicant = null + + // Ultimate randomizing code right here + for(var/mob/dead/new_player/player in GLOB.player_list) + if(player.client && player.ready == PLAYER_READY_TO_PLAY) + players += player + + // Shuffling, the players list is now ping-independent!!! + // Goodbye antag dante + players = shuffle(players) + + for(var/mob/dead/new_player/player in players) + if(player.client && player.ready == PLAYER_READY_TO_PLAY) + if(role in player.client.prefs.be_special) + if(!jobban_isbanned(player, "Syndicate") && !jobban_isbanned(player, role)) //Nodrak/Carn: Antag Job-bans + if(age_check(player.client)) //Must be older than the minimum age + candidates += player.mind // Get a list of all the people who want to be the antagonist for this round + + if(restricted_jobs) + for(var/datum/mind/player in candidates) + for(var/job in restricted_jobs) // Remove people who want to be antagonist but have a job already that precludes it + if(player.assigned_role == job) + candidates -= player + + if(candidates.len < recommended_enemies) + for(var/mob/dead/new_player/player in players) + if(player.client && player.ready == PLAYER_READY_TO_PLAY) + if(!(role in player.client.prefs.be_special)) // We don't have enough people who want to be antagonist, make a separate list of people who don't want to be one + if(!jobban_isbanned(player, "Syndicate") && !jobban_isbanned(player, role)) //Nodrak/Carn: Antag Job-bans + drafted += player.mind + + if(restricted_jobs) + for(var/datum/mind/player in drafted) // Remove people who can't be an antagonist + for(var/job in restricted_jobs) + if(player.assigned_role == job) + drafted -= player + + drafted = shuffle(drafted) // Will hopefully increase randomness, Donkie + + while(candidates.len < recommended_enemies) // Pick randomlly just the number of people we need and add them to our list of candidates + if(drafted.len > 0) + applicant = pick(drafted) + if(applicant) + candidates += applicant + drafted.Remove(applicant) + + else // Not enough scrubs, ABORT ABORT ABORT + break + + if(restricted_jobs) + for(var/datum/mind/player in drafted) // Remove people who can't be an antagonist + for(var/job in restricted_jobs) + if(player.assigned_role == job) + drafted -= player + + drafted = shuffle(drafted) // Will hopefully increase randomness, Donkie + + while(candidates.len < recommended_enemies) // Pick randomlly just the number of people we need and add them to our list of candidates + if(drafted.len > 0) + applicant = pick(drafted) + if(applicant) + candidates += applicant + drafted.Remove(applicant) + + else // Not enough scrubs, ABORT ABORT ABORT + break + + return candidates // Returns: The number of people who had the antagonist role set to yes, regardless of recomended_enemies, if that number is greater than recommended_enemies + // recommended_enemies if the number of people with that role set to yes is less than recomended_enemies, + // Less if there are not enough valid players in the game entirely to make recommended_enemies. + + + +/datum/game_mode/proc/num_players() + . = 0 + for(var/mob/dead/new_player/P in GLOB.player_list) + if(P.client && P.ready == PLAYER_READY_TO_PLAY) + . ++ + +/////////////////////////////////// +//Keeps track of all living heads// +/////////////////////////////////// +/datum/game_mode/proc/get_living_heads() + . = list() + for(var/mob/living/carbon/human/player in GLOB.mob_list) + if(player.stat != DEAD && player.mind && (player.mind.assigned_role in GLOB.command_positions)) + . |= player.mind + + +//////////////////////////// +//Keeps track of all heads// +//////////////////////////// +/datum/game_mode/proc/get_all_heads() + . = list() + for(var/mob/player in GLOB.mob_list) + if(player.mind && (player.mind.assigned_role in GLOB.command_positions)) + . |= player.mind + +////////////////////////////////////////////// +//Keeps track of all living security members// +////////////////////////////////////////////// +/datum/game_mode/proc/get_living_sec() + . = list() + for(var/mob/living/carbon/human/player in GLOB.mob_list) + if(player.stat != DEAD && player.mind && (player.mind.assigned_role in GLOB.security_positions)) + . |= player.mind + +//////////////////////////////////////// +//Keeps track of all security members// +//////////////////////////////////////// +/datum/game_mode/proc/get_all_sec() + . = list() + for(var/mob/living/carbon/human/player in GLOB.mob_list) + if(player.mind && (player.mind.assigned_role in GLOB.security_positions)) + . |= player.mind + +////////////////////////// +//Reports player logouts// +////////////////////////// +/proc/display_roundstart_logout_report() + var/msg = "Roundstart logout report\n\n" + for(var/mob/living/L in GLOB.mob_list) + + if(L.ckey) + var/found = 0 + for(var/client/C in GLOB.clients) + if(C.ckey == L.ckey) + found = 1 + break + if(!found) + msg += "[L.name] ([L.ckey]), the [L.job] (Disconnected)\n" + + + if(L.ckey && L.client) + if(L.client.inactivity >= (ROUNDSTART_LOGOUT_REPORT_TIME / 2)) //Connected, but inactive (alt+tabbed or something) + msg += "[L.name] ([L.ckey]), the [L.job] (Connected, Inactive)\n" + continue //AFK client + if(L.stat) + if(L.suiciding) //Suicider + msg += "[L.name] ([L.ckey]), the [L.job] (Suicide)\n" + continue //Disconnected client + if(L.stat == UNCONSCIOUS) + msg += "[L.name] ([L.ckey]), the [L.job] (Dying)\n" + continue //Unconscious + if(L.stat == DEAD) + msg += "[L.name] ([L.ckey]), the [L.job] (Dead)\n" + continue //Dead + + continue //Happy connected client + for(var/mob/dead/observer/D in GLOB.mob_list) + if(D.mind && D.mind.current == L) + if(L.stat == DEAD) + if(L.suiciding) //Suicider + msg += "[L.name] ([ckey(D.mind.key)]), the [L.job] (Suicide)\n" + continue //Disconnected client + else + msg += "[L.name] ([ckey(D.mind.key)]), the [L.job] (Dead)\n" + continue //Dead mob, ghost abandoned + else + if(D.can_reenter_corpse) + continue //Adminghost, or cult/wizard ghost + else + msg += "[L.name] ([ckey(D.mind.key)]), the [L.job] (Ghosted)\n" + continue //Ghosted while alive + + + + for(var/mob/M in GLOB.mob_list) + if(M.client && M.client.holder) + to_chat(M, msg) + +/datum/game_mode/proc/printplayer(datum/mind/ply, fleecheck) + var/text = "
[ply.key] was [ply.name] the [ply.assigned_role] and" + if(ply.current) + if(ply.current.stat == DEAD) + text += " died" + else + text += " survived" + if(fleecheck && ply.current.z > ZLEVEL_STATION) + text += " while fleeing the station" + if(ply.current.real_name != ply.name) + text += " as [ply.current.real_name]" + else + text += " had their body destroyed" + return text + +/datum/game_mode/proc/printobjectives(datum/mind/ply) + var/text = "" + var/count = 1 + for(var/datum/objective/objective in ply.objectives) + if(objective.check_completion()) + text += "
Objective #[count]: [objective.explanation_text] Success!" + else + text += "
Objective #[count]: [objective.explanation_text] Fail." + count++ + return text + +//If the configuration option is set to require players to be logged as old enough to play certain jobs, then this proc checks that they are, otherwise it just returns 1 +/datum/game_mode/proc/age_check(client/C) + if(get_remaining_days(C) == 0) + return 1 //Available in 0 days = available right now = player is old enough to play. + return 0 + + +/datum/game_mode/proc/get_remaining_days(client/C) + if(!C) + return 0 + if(!config.use_age_restriction_for_jobs) + return 0 + if(!isnum(C.player_age)) + return 0 //This is only a number if the db connection is established, otherwise it is text: "Requires database", meaning these restrictions cannot be enforced + if(!isnum(enemy_minimum_age)) + return 0 + + return max(0, enemy_minimum_age - C.player_age) + +/datum/game_mode/proc/replace_jobbaned_player(mob/living/M, role_type, pref) + var/list/mob/dead/observer/candidates = pollCandidatesForMob("Do you want to play as a [role_type]?", "[role_type]", null, pref, 50, M) + var/mob/dead/observer/theghost = null + if(candidates.len) + theghost = pick(candidates) + to_chat(M, "Your mob has been taken over by a ghost! Appeal your job ban if you want to avoid this in the future!") + message_admins("[key_name_admin(theghost)] has taken control of ([key_name_admin(M)]) to replace a jobbaned player.") + M.ghostize(0) + M.key = theghost.key + +/datum/game_mode/proc/remove_antag_for_borging(datum/mind/newborgie) + SSticker.mode.remove_cultist(newborgie, 0, 0) + SSticker.mode.remove_revolutionary(newborgie, 0) + SSticker.mode.remove_gangster(newborgie, 0, remove_bosses=1) + +/datum/game_mode/proc/generate_station_goals() + var/list/possible = list() + for(var/T in subtypesof(/datum/station_goal)) + var/datum/station_goal/G = T + if(config_tag in initial(G.gamemode_blacklist)) + continue + possible += T + var/goal_weights = 0 + while(possible.len && goal_weights < STATION_GOAL_BUDGET) + var/datum/station_goal/picked = pick_n_take(possible) + goal_weights += initial(picked.weight) + station_goals += new picked + + +/datum/game_mode/proc/declare_station_goal_completion() + for(var/V in station_goals) + var/datum/station_goal/G = V + G.print_result() /* @@ -1153,4 +1149,3 @@ for(var/V in station_goals) var/datum/station_goal/G = V G.print_result() ->>>>>>> 10a3238... Makes the station Z level into a list instead of a single define (#30297) From 496b5d17c29ac8ee15c36c7a4dcdebc6f3e6196c Mon Sep 17 00:00:00 2001 From: LetterJay Date: Mon, 11 Sep 2017 15:52:58 -0500 Subject: [PATCH 11/49] Update mapping.dm --- code/_globalvars/lists/mapping.dm | 139 +++++++++--------------------- 1 file changed, 40 insertions(+), 99 deletions(-) diff --git a/code/_globalvars/lists/mapping.dm b/code/_globalvars/lists/mapping.dm index 5de0407442..3b6a7fad73 100644 --- a/code/_globalvars/lists/mapping.dm +++ b/code/_globalvars/lists/mapping.dm @@ -1,106 +1,47 @@ -#define Z_NORTH 1 -#define Z_EAST 2 -#define Z_SOUTH 3 -#define Z_WEST 4 +/* +The /tg/ codebase currently requires you to have 11 z-levels of the same size dimensions. +z-level order is important, the order you put them in inside the map config.dm will determine what z level number they are assigned ingame. +Names of z-level do not matter, but order does greatly, for instances such as checking alive status of revheads on z1 -GLOBAL_LIST_INIT(cardinals, list(NORTH, SOUTH, EAST, WEST)) -GLOBAL_LIST_INIT(alldirs, list(NORTH, SOUTH, EAST, WEST, NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST)) -GLOBAL_LIST_INIT(diagonals, list(NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST)) +current as of 2016/6/2 +z1 = station +z2 = centcom +z5 = mining +Everything else = randomized space +Last space-z level = empty +*/ -//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 -GLOBAL_LIST_INIT(accessable_z_levels, list(1,3,4,5,6,7)) //Keep this to six maps, repeating z-levels is ok if needed +#define CROSSLINKED 2 +#define SELFLOOPING 1 +#define UNAFFECTED 0 -GLOBAL_LIST(global_map) - //list/global_map = list(list(1,5),list(4,3))//an array of map Z levels. - //Resulting sector map looks like - //|_1_|_4_| - //|_5_|_3_| - // - //1 - SS13 - //4 - Derelict - //3 - AI satellite - //5 - empty space +#define MAIN_STATION "Main Station" +#define CENTCOM "CentCom" +#define EMPTY_AREA_1 "Empty Area 1" +#define EMPTY_AREA_2 "Empty Area 2" +#define MINING "Mining Asteroid" +#define EMPTY_AREA_3 "Empty Area 3" +#define EMPTY_AREA_4 "Empty Area 4" +#define EMPTY_AREA_5 "Empty Area 5" +#define EMPTY_AREA_6 "Empty Area 6" +#define EMPTY_AREA_7 "Empty Area 7" +#define EMPTY_AREA_8 "Empty Area 8" +#define AWAY_MISSION "Away Mission" -GLOBAL_LIST_EMPTY(landmarks_list) //list of all landmarks created -GLOBAL_LIST_EMPTY(start_landmarks_list) //list of all spawn points created -GLOBAL_LIST_EMPTY(department_security_spawns) //list of all department security spawns -GLOBAL_LIST_EMPTY(generic_event_spawns) //list of all spawns for events +//for modifying jobs +#define MAP_JOB_CHECK if(SSmapping.config.map_name != JOB_MODIFICATION_MAP_NAME) { return; } +#define MAP_JOB_CHECK_BASE if(SSmapping.config.map_name != JOB_MODIFICATION_MAP_NAME) { return ..(); } +#define MAP_REMOVE_JOB(jobpath) /datum/job/##jobpath/map_check() { return (SSmapping.config.map_name != JOB_MODIFICATION_MAP_NAME) && ..() } -GLOBAL_LIST_EMPTY(wizardstart) -GLOBAL_LIST_EMPTY(newplayer_start) -GLOBAL_LIST_EMPTY(prisonwarp) //prisoners go to these -GLOBAL_LIST_EMPTY(holdingfacility) //captured people go here -GLOBAL_LIST_EMPTY(xeno_spawn)//Aliens spawn at these. -GLOBAL_LIST_EMPTY(tdome1) -GLOBAL_LIST_EMPTY(tdome2) -GLOBAL_LIST_EMPTY(tdomeobserve) -GLOBAL_LIST_EMPTY(tdomeadmin) -GLOBAL_LIST_EMPTY(prisonwarped) //list of players already warped -GLOBAL_LIST_EMPTY(blobstart) -GLOBAL_LIST_EMPTY(secequipment) -GLOBAL_LIST_EMPTY(deathsquadspawn) -GLOBAL_LIST_EMPTY(emergencyresponseteamspawn) -GLOBAL_LIST_EMPTY(ruin_landmarks) +//zlevel defines, can be overridden for different maps in the appropriate _maps file. +#define ZLEVEL_CENTCOM 1 +#define ZLEVEL_STATION_PRIMARY 2 +#define ZLEVEL_MINING 5 +#define ZLEVEL_LAVALAND 5 +#define ZLEVEL_EMPTY_SPACE 12 +#define ZLEVEL_TRANSIT 11 - //away missions -GLOBAL_LIST_EMPTY(awaydestinations) //a list of landmarks that the warpgate can take you to +#define ZLEVEL_SPACEMIN 3 +#define ZLEVEL_SPACEMAX 12 - //used by jump-to-area etc. Updated by area/updateName() -GLOBAL_LIST_EMPTY(sortedAreas) - -GLOBAL_LIST_EMPTY(all_abstract_markers) -GLOBAL_LIST_INIT(alldirs, list(NORTH, SOUTH, EAST, WEST, NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST)) -GLOBAL_LIST_INIT(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 -GLOBAL_LIST_INIT(accessable_z_levels, list(1,3,4,5,6,7)) //Keep this to six maps, repeating z-levels is ok if needed - -GLOBAL_LIST_INIT(station_z_levels, list(ZLEVEL_STATION_PRIMARY)) - -GLOBAL_LIST(global_map) - //list/global_map = list(list(1,5),list(4,3))//an array of map Z levels. - //Resulting sector map looks like - //|_1_|_4_| - //|_5_|_3_| - // - //1 - SS13 - //4 - Derelict - //3 - AI satellite - //5 - empty space - -GLOBAL_LIST_EMPTY(landmarks_list) //list of all landmarks created -GLOBAL_LIST_EMPTY(start_landmarks_list) //list of all spawn points created -GLOBAL_LIST_EMPTY(department_security_spawns) //list of all department security spawns -GLOBAL_LIST_EMPTY(generic_event_spawns) //list of all spawns for events - -GLOBAL_LIST_EMPTY(wizardstart) -GLOBAL_LIST_EMPTY(newplayer_start) -GLOBAL_LIST_EMPTY(prisonwarp) //prisoners go to these -GLOBAL_LIST_EMPTY(holdingfacility) //captured people go here -GLOBAL_LIST_EMPTY(xeno_spawn)//Aliens spawn at these. -GLOBAL_LIST_EMPTY(tdome1) -GLOBAL_LIST_EMPTY(tdome2) -GLOBAL_LIST_EMPTY(tdomeobserve) -GLOBAL_LIST_EMPTY(tdomeadmin) -GLOBAL_LIST_EMPTY(prisonwarped) //list of players already warped -GLOBAL_LIST_EMPTY(blobstart) -GLOBAL_LIST_EMPTY(secequipment) -GLOBAL_LIST_EMPTY(deathsquadspawn) -GLOBAL_LIST_EMPTY(emergencyresponseteamspawn) -GLOBAL_LIST_EMPTY(ruin_landmarks) - - //away missions -GLOBAL_LIST_EMPTY(awaydestinations) //a list of landmarks that the warpgate can take you to - - //used by jump-to-area etc. Updated by area/updateName() -GLOBAL_LIST_EMPTY(sortedAreas) - -GLOBAL_LIST_EMPTY(all_abstract_markers) +#define SPACERUIN_MAP_EDGE_PAD 15 From c7ae892e8d494b5729cea22231c9b845542242b8 Mon Sep 17 00:00:00 2001 From: LetterJay Date: Mon, 11 Sep 2017 15:53:35 -0500 Subject: [PATCH 12/49] Update persistence.dm --- code/controllers/subsystem/persistence.dm | 97 +++++++++++------------ 1 file changed, 47 insertions(+), 50 deletions(-) diff --git a/code/controllers/subsystem/persistence.dm b/code/controllers/subsystem/persistence.dm index a59ec7e79f..13762b83f9 100644 --- a/code/controllers/subsystem/persistence.dm +++ b/code/controllers/subsystem/persistence.dm @@ -2,15 +2,13 @@ SUBSYSTEM_DEF(persistence) name = "Persistence" init_order = INIT_ORDER_PERSISTENCE flags = SS_NO_FIRE - var/secret_satchels var/list/satchel_blacklist = list() //this is a typecache var/list/new_secret_satchels = list() //these are objects - var/list/old_secret_satchels = "" + var/list/old_secret_satchels = list() var/list/obj/structure/chisel_message/chisel_messages = list() var/list/saved_messages = list() - var/trophy_sav var/list/saved_trophies = list() /datum/controller/subsystem/persistence/Initialize() @@ -21,8 +19,6 @@ SUBSYSTEM_DEF(persistence) ..() /datum/controller/subsystem/persistence/proc/LoadSatchels() - secret_satchels = file("data/npc_saves/SecretSatchels[SSmapping.config.map_name].json") - if(!fexists(secret_satchels)) var/placed_satchel = 0 var/path var/obj/item/storage/backpack/satchel/flat/F = new() @@ -58,27 +54,10 @@ SUBSYSTEM_DEF(persistence) path = text2path(old_secret_satchels[pos]["saved_obj"]) if(!ispath(path)) return - satchel_blacklist = typecacheof(list(/obj/item/stack/tile/plasteel, /obj/item/crowbar)) - var/list/json = list() - json = json_decode(file2text(secret_satchels)) - old_secret_satchels = json["data"] - var/placed_satchel = 0 - if(old_secret_satchels.len) - if(old_secret_satchels.len >= 20) //guards against low drop pools assuring that one player cannot reliably find his own gear. - var/pos = rand(1, old_secret_satchels.len) - old_secret_satchels.Cut(pos, pos+1) - var/obj/item/storage/backpack/satchel/flat/F = new() - F.x = old_secret_satchels[pos]["x"] - F.y = old_secret_satchels[pos]["y"] - F.z = ZLEVEL_STATION - var/path = text2path(old_secret_satchels[pos]["saved_obj"]) - if(!ispath(path)) - return - if(isfloorturf(F.loc) && !istype(F.loc, /turf/open/floor/plating/)) - F.hide(1) - new path(F) - placed_satchel++ - + if(isfloorturf(F.loc) && !istype(F.loc, /turf/open/floor/plating/)) + F.hide(1) + new path(F) + placed_satchel++ var/list/free_satchels = list() for(var/turf/T in shuffle(block(locate(TRANSITIONEDGE,TRANSITIONEDGE,ZLEVEL_STATION_PRIMARY), locate(world.maxx-TRANSITIONEDGE,world.maxy-TRANSITIONEDGE,ZLEVEL_STATION_PRIMARY)))) //Nontrivially expensive but it's roundstart only if(isfloorturf(T) && !istype(T, /turf/open/floor/plating/)) @@ -92,16 +71,25 @@ SUBSYSTEM_DEF(persistence) break //Who's been duping the bird?! /datum/controller/subsystem/persistence/proc/LoadChiselMessages() - var/json_file = file("data/npc_saves/ChiselMessages[SSmapping.config.map_name].json") - if(!fexists(json_file)) - return - var/list/json - json = json_decode(file2text(json_file)) + var/list/saved_messages = list() + if(fexists("data/npc_saves/ChiselMessages.sav")) //legacy compatability to convert old format to new + var/savefile/chisel_messages_sav = new /savefile("data/npc_saves/ChiselMessages.sav") + var/saved_json + chisel_messages_sav[SSmapping.config.map_name] >> saved_json + if(!saved_json) + return + saved_messages = json_decode(saved_json) + fdel("data/npc_saves/ChiselMessages.sav") + else + var/json_file = file("data/npc_saves/ChiselMessages[SSmapping.config.map_name].json") + if(!fexists(json_file)) + return + var/list/json + json = json_decode(file2text(json_file)) - if(!json) - return - - var/list/saved_messages = json["data"] + if(!json) + return + saved_messages = json["data"] for(var/item in saved_messages) if(!islist(item)) @@ -129,17 +117,23 @@ SUBSYSTEM_DEF(persistence) log_world("Loaded [saved_messages.len] engraved messages on map [SSmapping.config.map_name]") /datum/controller/subsystem/persistence/proc/LoadTrophies() - trophy_sav = file("data/npc_saves/TrophyItems.json") - if(!fexists(trophy_sav)) - return - var/list/json = list() - json = json_decode(file2text(trophy_sav)) - - if(!json) - return - - saved_trophies = json["data"] - + if(fexists("data/npc_saves/TrophyItems.sav")) //legacy compatability to convert old format to new + var/savefile/S = new /savefile("data/npc_saves/TrophyItems.sav") + var/saved_json + S >> saved_json + if(!saved_json) + return + saved_trophies = json_decode(saved_json) + fdel("data/npc_saves/TrophyItems.sav") + else + var/json_file = file("data/npc_saves/TrophyItems.json") + if(!fexists(json_file)) + return + var/list/json = list() + json = json_decode(file2text(json_file)) + if(!json) + return + saved_trophies = json["data"] SetUpTrophies(saved_trophies.Copy()) /datum/controller/subsystem/persistence/proc/SetUpTrophies(list/trophy_items) @@ -174,6 +168,7 @@ SUBSYSTEM_DEF(persistence) /datum/controller/subsystem/persistence/proc/CollectSecretSatchels() var/list/satchels = list() + satchel_blacklist = typecacheof(list(/obj/item/stack/tile/plasteel, /obj/item/crowbar)) for(var/A in new_secret_satchels) var/obj/item/storage/backpack/satchel/flat/F = A if(QDELETED(F) || F.z != ZLEVEL_STATION_PRIMARY || F.invisibility != INVISIBILITY_MAXIMUM) @@ -193,10 +188,11 @@ SUBSYSTEM_DEF(persistence) data["y"] = F.y data["saved_obj"] = pick(savable_obj) satchels += list(data) + var/json_file = file("data/npc_saves/SecretSatchels[SSmapping.config.map_name].json") var/list/file_data = list() file_data["data"] = satchels - fdel(secret_satchels) - WRITE_FILE(secret_satchels, json_encode(file_data)) + fdel(json_file) + WRITE_FILE(json_file, json_encode(file_data)) /datum/controller/subsystem/persistence/proc/CollectChiselMessages() var/json_file = file("data/npc_saves/ChiselMessages[SSmapping.config.map_name].json") @@ -215,10 +211,11 @@ SUBSYSTEM_DEF(persistence) /datum/controller/subsystem/persistence/proc/CollectTrophies() + var/json_file = file("data/npc_saves/TrophyItems.json") var/list/file_data = list() file_data["data"] = saved_trophies - fdel(trophy_sav) - WRITE_FILE(trophy_sav, json_encode(file_data)) + fdel(json_file) + WRITE_FILE(json_file, json_encode(file_data)) /datum/controller/subsystem/persistence/proc/SaveTrophy(obj/structure/displaycase/trophy/T) if(!T.added_roundstart && T.showpiece) From 1f7db947e4cf85e5d05445f24e04313a04f5cbde Mon Sep 17 00:00:00 2001 From: LetterJay Date: Mon, 11 Sep 2017 15:54:01 -0500 Subject: [PATCH 13/49] Update teleport.dm --- code/datums/helper_datums/teleport.dm | 624 +++++++++----------------- 1 file changed, 206 insertions(+), 418 deletions(-) diff --git a/code/datums/helper_datums/teleport.dm b/code/datums/helper_datums/teleport.dm index 468b806784..cc461902ec 100644 --- a/code/datums/helper_datums/teleport.dm +++ b/code/datums/helper_datums/teleport.dm @@ -1,438 +1,226 @@ -//wrapper -/proc/do_teleport(ateleatom, adestination, aprecision=0, afteleport=1, aeffectin=null, aeffectout=null, asoundin=null, asoundout=null) - var/datum/teleport/instant/science/D = new - if(D.start(arglist(args))) - return 1 - return 0 +SUBSYSTEM_DEF(persistence) + name = "Persistence" + init_order = INIT_ORDER_PERSISTENCE + flags = SS_NO_FIRE + var/list/satchel_blacklist = list() //this is a typecache + var/list/new_secret_satchels = list() //these are objects + var/list/old_secret_satchels = list() -/datum/teleport - var/atom/movable/teleatom //atom to teleport - var/atom/destination //destination to teleport to - var/precision = 0 //teleport precision - var/datum/effect_system/effectin //effect to show right before teleportation - var/datum/effect_system/effectout //effect to show right after teleportation - var/soundin //soundfile to play before teleportation - var/soundout //soundfile to play after teleportation - var/force_teleport = 1 //if false, teleport will use Move() proc (dense objects will prevent teleportation) + var/list/obj/structure/chisel_message/chisel_messages = list() + var/list/saved_messages = list() -/datum/teleport/proc/start(ateleatom, adestination, aprecision=0, afteleport=1, aeffectin=null, aeffectout=null, asoundin=null, asoundout=null) - if(!initTeleport(arglist(args))) - return 0 - return 1 + var/list/saved_trophies = list() -/datum/teleport/proc/initTeleport(ateleatom,adestination,aprecision,afteleport,aeffectin,aeffectout,asoundin,asoundout) - if(!setTeleatom(ateleatom)) - return 0 - if(!setDestination(adestination)) - return 0 - if(!setPrecision(aprecision)) - return 0 - setEffects(aeffectin,aeffectout) - setForceTeleport(afteleport) - setSounds(asoundin,asoundout) - return 1 - -//must succeed -/datum/teleport/proc/setPrecision(aprecision) - if(isnum(aprecision)) - precision = aprecision - return 1 - return 0 - -//must succeed -/datum/teleport/proc/setDestination(atom/adestination) - if(istype(adestination)) - destination = adestination - return 1 - return 0 - -//must succeed in most cases -/datum/teleport/proc/setTeleatom(atom/movable/ateleatom) - if(istype(ateleatom, /obj/effect) && !istype(ateleatom, /obj/effect/dummy/chameleon)) - qdel(ateleatom) - return 0 - if(istype(ateleatom)) - teleatom = ateleatom - return 1 - return 0 - -//custom effects must be properly set up first for instant-type teleports -//optional -/datum/teleport/proc/setEffects(datum/effect_system/aeffectin=null,datum/effect_system/aeffectout=null) - effectin = istype(aeffectin) ? aeffectin : null - effectout = istype(aeffectout) ? aeffectout : null - return 1 - -//optional -/datum/teleport/proc/setForceTeleport(afteleport) - force_teleport = afteleport - return 1 - -//optional -/datum/teleport/proc/setSounds(asoundin=null,asoundout=null) - soundin = isfile(asoundin) ? asoundin : null - soundout = isfile(asoundout) ? asoundout : null - return 1 - -//placeholder -/datum/teleport/proc/teleportChecks() - return 1 - -/datum/teleport/proc/playSpecials(atom/location,datum/effect_system/effect,sound) - if(location) - if(effect) - INVOKE_ASYNC(src, .proc/do_effect, location, effect) - if(sound) - INVOKE_ASYNC(src, .proc/do_sound, location, sound) - -/datum/teleport/proc/do_effect(atom/location, datum/effect_system/effect) - src = null - effect.attach(location) - effect.start() - -/datum/teleport/proc/do_sound(atom/location, sound) - src = null - playsound(location, sound, 60, 1) - -//do the monkey dance -/datum/teleport/proc/doTeleport() - - var/turf/destturf - var/turf/curturf = get_turf(teleatom) - destturf = get_teleport_turf(get_turf(destination), precision) - - if(!destturf || !curturf || destturf.is_transition_turf()) - return 0 - - var/area/A = get_area(curturf) - if(A.noteleport) - return 0 - - playSpecials(curturf,effectin,soundin) - if(force_teleport) - teleatom.forceMove(destturf) - if(ismegafauna(teleatom)) - message_admins("[teleatom] [ADMIN_FLW(teleatom)] has teleported from [ADMIN_COORDJMP(curturf)] to [ADMIN_COORDJMP(destturf)].") - playSpecials(destturf,effectout,soundout) - else - if(teleatom.Move(destturf)) - playSpecials(destturf,effectout,soundout) - if(ismegafauna(teleatom)) - message_admins("[teleatom] [ADMIN_FLW(teleatom)] has teleported from [ADMIN_COORDJMP(curturf)] to [ADMIN_COORDJMP(destturf)].") - return 1 - -/datum/teleport/proc/teleport() - if(teleportChecks()) - return doTeleport() - return 0 - -/datum/teleport/instant //teleports when datum is created - - start(ateleatom, adestination, aprecision=0, afteleport=1, aeffectin=null, aeffectout=null, asoundin=null, asoundout=null) - if(..()) - if(teleport()) - return 1 - return 0 - - -/datum/teleport/instant/science - -/datum/teleport/instant/science/setEffects(datum/effect_system/aeffectin,datum/effect_system/aeffectout) - if(aeffectin==null || aeffectout==null) - var/datum/effect_system/spark_spread/aeffect = new - aeffect.set_up(5, 1, teleatom) - effectin = effectin || aeffect - effectout = effectout || aeffect - return 1 - else - return ..() - -/datum/teleport/instant/science/setPrecision(aprecision) +/datum/controller/subsystem/persistence/Initialize() + LoadSatchels() + LoadPoly() + LoadChiselMessages() + LoadTrophies() ..() - if(istype(teleatom, /obj/item/storage/backpack/holding)) - precision = rand(1,100) - var/list/bagholding = teleatom.search_contents_for(/obj/item/storage/backpack/holding) - if(bagholding.len) - precision = max(rand(1,100)*bagholding.len,100) - if(isliving(teleatom)) - var/mob/living/MM = teleatom - to_chat(MM, "The bluespace interface on your bag of holding interferes with the teleport!") - return 1 - -// Safe location finder - -/proc/find_safe_turf(zlevel = ZLEVEL_STATION, list/zlevels, extended_safety_checks = FALSE) - if(!zlevels) - zlevels = list(zlevel) - var/cycles = 1000 - for(var/cycle in 1 to cycles) - // DRUNK DIALLING WOOOOOOOOO - var/x = rand(1, world.maxx) - var/y = rand(1, world.maxy) - var/z = pick(zlevels) - var/random_location = locate(x,y,z) - - if(!isfloorturf(random_location)) - continue - var/turf/open/floor/F = random_location - if(!F.air) - continue - - var/datum/gas_mixture/A = F.air - var/list/A_gases = A.gases - var/trace_gases - for(var/id in A_gases) - if(id in GLOB.hardcoded_gases) - continue - trace_gases = TRUE - break - - // Can most things breathe? - if(trace_gases) - continue - if(!(A_gases["o2"] && A_gases["o2"][MOLES] >= 16)) - continue - if(A_gases["plasma"]) - continue - if(A_gases["co2"] && A_gases["co2"][MOLES] >= 10) - continue - - // Aim for goldilocks temperatures and pressure - if((A.temperature <= 270) || (A.temperature >= 360)) - continue - var/pressure = A.return_pressure() - if((pressure <= 20) || (pressure >= 550)) - continue - - if(extended_safety_checks) -//wrapper -/proc/do_teleport(ateleatom, adestination, aprecision=0, afteleport=1, aeffectin=null, aeffectout=null, asoundin=null, asoundout=null) - var/datum/teleport/instant/science/D = new - if(D.start(arglist(args))) - return 1 - return 0 - -/datum/teleport - var/atom/movable/teleatom //atom to teleport - var/atom/destination //destination to teleport to - var/precision = 0 //teleport precision - var/datum/effect_system/effectin //effect to show right before teleportation - var/datum/effect_system/effectout //effect to show right after teleportation - var/soundin //soundfile to play before teleportation - var/soundout //soundfile to play after teleportation - var/force_teleport = 1 //if false, teleport will use Move() proc (dense objects will prevent teleportation) - -/datum/teleport/proc/start(ateleatom, adestination, aprecision=0, afteleport=1, aeffectin=null, aeffectout=null, asoundin=null, asoundout=null) - if(!initTeleport(arglist(args))) - return 0 - return 1 - -/datum/teleport/proc/initTeleport(ateleatom,adestination,aprecision,afteleport,aeffectin,aeffectout,asoundin,asoundout) - if(!setTeleatom(ateleatom)) - return 0 - if(!setDestination(adestination)) - return 0 - if(!setPrecision(aprecision)) - return 0 - setEffects(aeffectin,aeffectout) - setForceTeleport(afteleport) - setSounds(asoundin,asoundout) - return 1 - -//must succeed -/datum/teleport/proc/setPrecision(aprecision) - if(isnum(aprecision)) - precision = aprecision - return 1 - return 0 - -//must succeed -/datum/teleport/proc/setDestination(atom/adestination) - if(istype(adestination)) - destination = adestination - return 1 - return 0 - -//must succeed in most cases -/datum/teleport/proc/setTeleatom(atom/movable/ateleatom) - if(istype(ateleatom, /obj/effect) && !istype(ateleatom, /obj/effect/dummy/chameleon)) - qdel(ateleatom) - return 0 - if(istype(ateleatom)) - teleatom = ateleatom - return 1 - return 0 - -//custom effects must be properly set up first for instant-type teleports -//optional -/datum/teleport/proc/setEffects(datum/effect_system/aeffectin=null,datum/effect_system/aeffectout=null) - effectin = istype(aeffectin) ? aeffectin : null - effectout = istype(aeffectout) ? aeffectout : null - return 1 - -//optional -/datum/teleport/proc/setForceTeleport(afteleport) - force_teleport = afteleport - return 1 - -//optional -/datum/teleport/proc/setSounds(asoundin=null,asoundout=null) - soundin = isfile(asoundin) ? asoundin : null - soundout = isfile(asoundout) ? asoundout : null - return 1 - -//placeholder -/datum/teleport/proc/teleportChecks() - return 1 - -/datum/teleport/proc/playSpecials(atom/location,datum/effect_system/effect,sound) - if(location) - if(effect) - INVOKE_ASYNC(src, .proc/do_effect, location, effect) - if(sound) - INVOKE_ASYNC(src, .proc/do_sound, location, sound) - -/datum/teleport/proc/do_effect(atom/location, datum/effect_system/effect) - src = null - effect.attach(location) - effect.start() - -/datum/teleport/proc/do_sound(atom/location, sound) - src = null - playsound(location, sound, 60, 1) - -//do the monkey dance -/datum/teleport/proc/doTeleport() - - var/turf/destturf - var/turf/curturf = get_turf(teleatom) - destturf = get_teleport_turf(get_turf(destination), precision) - - if(!destturf || !curturf || destturf.is_transition_turf()) - return 0 - - var/area/A = get_area(curturf) - if(A.noteleport) - return 0 - - playSpecials(curturf,effectin,soundin) - if(force_teleport) - teleatom.forceMove(destturf) - if(ismegafauna(teleatom)) - message_admins("[teleatom] [ADMIN_FLW(teleatom)] has teleported from [ADMIN_COORDJMP(curturf)] to [ADMIN_COORDJMP(destturf)].") - playSpecials(destturf,effectout,soundout) +/datum/controller/subsystem/persistence/proc/LoadSatchels() + var/placed_satchel = 0 + var/path + var/obj/item/storage/backpack/satchel/flat/F = new() + if(fexists("data/npc_saves/SecretSatchels.sav")) //legacy compatability to convert old format to new + var/savefile/secret_satchels = new /savefile("data/npc_saves/SecretSatchels.sav") + var/sav_text + secret_satchels[SSmapping.config.map_name] >> sav_text + fdel("data/npc_saves/SecretSatchels.sav") + if(sav_text) + old_secret_satchels = splittext(sav_text,"#") + if(old_secret_satchels.len >= 20) + var/satchel_string = pick_n_take(old_secret_satchels) + var/list/chosen_satchel = splittext(satchel_string,"|") + if(chosen_satchel.len == 3) + F.x = text2num(chosen_satchel[1]) + F.y = text2num(chosen_satchel[2]) + F.z = ZLEVEL_STATION_PRIMARY + path = text2path(chosen_satchel[3]) else - if(teleatom.Move(destturf)) - playSpecials(destturf,effectout,soundout) - if(ismegafauna(teleatom)) - message_admins("[teleatom] [ADMIN_FLW(teleatom)] has teleported from [ADMIN_COORDJMP(curturf)] to [ADMIN_COORDJMP(destturf)].") - return 1 + var/json_file = file("data/npc_saves/SecretSatchels[SSmapping.config.map_name].json") + if(!fexists(json_file)) + return + var/list/json = list() + json = json_decode(file2text(json_file)) + old_secret_satchels = json["data"] + if(old_secret_satchels.len) + if(old_secret_satchels.len >= 20) //guards against low drop pools assuring that one player cannot reliably find his own gear. + var/pos = rand(1, old_secret_satchels.len) + old_secret_satchels.Cut(pos, pos+1) + F.x = old_secret_satchels[pos]["x"] + F.y = old_secret_satchels[pos]["y"] + F.z = ZLEVEL_STATION_PRIMARY + path = text2path(old_secret_satchels[pos]["saved_obj"]) + if(!ispath(path)) + return + if(isfloorturf(F.loc) && !istype(F.loc, /turf/open/floor/plating/)) + F.hide(1) + new path(F) + placed_satchel++ + var/list/free_satchels = list() + for(var/turf/T in shuffle(block(locate(TRANSITIONEDGE,TRANSITIONEDGE,ZLEVEL_STATION_PRIMARY), locate(world.maxx-TRANSITIONEDGE,world.maxy-TRANSITIONEDGE,ZLEVEL_STATION_PRIMARY)))) //Nontrivially expensive but it's roundstart only + if(isfloorturf(T) && !istype(T, /turf/open/floor/plating/)) + free_satchels += new /obj/item/storage/backpack/satchel/flat/secret(T) + if(!isemptylist(free_satchels) && ((free_satchels.len + placed_satchel) >= (50 - old_secret_satchels.len) * 0.1)) //up to six tiles, more than enough to kill anything that moves + break -/datum/teleport/proc/teleport() - if(teleportChecks()) - return doTeleport() - return 0 +/datum/controller/subsystem/persistence/proc/LoadPoly() + for(var/mob/living/simple_animal/parrot/Poly/P in GLOB.living_mob_list) + twitterize(P.speech_buffer, "polytalk") + break //Who's been duping the bird?! -/datum/teleport/instant //teleports when datum is created - - start(ateleatom, adestination, aprecision=0, afteleport=1, aeffectin=null, aeffectout=null, asoundin=null, asoundout=null) - if(..()) - if(teleport()) - return 1 - return 0 - - -/datum/teleport/instant/science - -/datum/teleport/instant/science/setEffects(datum/effect_system/aeffectin,datum/effect_system/aeffectout) - if(aeffectin==null || aeffectout==null) - var/datum/effect_system/spark_spread/aeffect = new - aeffect.set_up(5, 1, teleatom) - effectin = effectin || aeffect - effectout = effectout || aeffect - return 1 +/datum/controller/subsystem/persistence/proc/LoadChiselMessages() + var/list/saved_messages = list() + if(fexists("data/npc_saves/ChiselMessages.sav")) //legacy compatability to convert old format to new + var/savefile/chisel_messages_sav = new /savefile("data/npc_saves/ChiselMessages.sav") + var/saved_json + chisel_messages_sav[SSmapping.config.map_name] >> saved_json + if(!saved_json) + return + saved_messages = json_decode(saved_json) + fdel("data/npc_saves/ChiselMessages.sav") else - return ..() + var/json_file = file("data/npc_saves/ChiselMessages[SSmapping.config.map_name].json") + if(!fexists(json_file)) + return + var/list/json + json = json_decode(file2text(json_file)) -/datum/teleport/instant/science/setPrecision(aprecision) - ..() - if(istype(teleatom, /obj/item/storage/backpack/holding)) - precision = rand(1,100) + if(!json) + return + saved_messages = json["data"] - var/list/bagholding = teleatom.search_contents_for(/obj/item/storage/backpack/holding) - if(bagholding.len) - precision = max(rand(1,100)*bagholding.len,100) - if(isliving(teleatom)) - var/mob/living/MM = teleatom - to_chat(MM, "The bluespace interface on your bag of holding interferes with the teleport!") - return 1 - -// Safe location finder - -/proc/find_safe_turf(zlevel = ZLEVEL_STATION_PRIMARY, list/zlevels, extended_safety_checks = FALSE) - if(!zlevels) - zlevels = list(zlevel) - var/cycles = 1000 - for(var/cycle in 1 to cycles) - // DRUNK DIALLING WOOOOOOOOO - var/x = rand(1, world.maxx) - var/y = rand(1, world.maxy) - var/z = pick(zlevels) - var/random_location = locate(x,y,z) - - if(!isfloorturf(random_location)) - continue - var/turf/open/floor/F = random_location - if(!F.air) + for(var/item in saved_messages) + if(!islist(item)) continue - var/datum/gas_mixture/A = F.air - var/list/A_gases = A.gases - var/trace_gases - for(var/id in A_gases) - if(id in GLOB.hardcoded_gases) + var/xvar = item["x"] + var/yvar = item["y"] + var/zvar = item["z"] + + if(!xvar || !yvar || !zvar) + continue + + var/turf/T = locate(xvar, yvar, zvar) + if(!isturf(T)) + continue + + if(locate(/obj/structure/chisel_message) in T) + continue + + var/obj/structure/chisel_message/M = new(T) + + if(!QDELETED(M)) + M.unpack(item) + + log_world("Loaded [saved_messages.len] engraved messages on map [SSmapping.config.map_name]") + +/datum/controller/subsystem/persistence/proc/LoadTrophies() + if(fexists("data/npc_saves/TrophyItems.sav")) //legacy compatability to convert old format to new + var/savefile/S = new /savefile("data/npc_saves/TrophyItems.sav") + var/saved_json + S >> saved_json + if(!saved_json) + return + saved_trophies = json_decode(saved_json) + fdel("data/npc_saves/TrophyItems.sav") + else + var/json_file = file("data/npc_saves/TrophyItems.json") + if(!fexists(json_file)) + return + var/list/json = list() + json = json_decode(file2text(json_file)) + if(!json) + return + saved_trophies = json["data"] + SetUpTrophies(saved_trophies.Copy()) + +/datum/controller/subsystem/persistence/proc/SetUpTrophies(list/trophy_items) + for(var/A in GLOB.trophy_cases) + var/obj/structure/displaycase/trophy/T = A + T.added_roundstart = TRUE + + var/trophy_data = pick_n_take(trophy_items) + + if(!islist(trophy_data)) + continue + + var/list/chosen_trophy = trophy_data + + if(!chosen_trophy || isemptylist(chosen_trophy)) //Malformed + continue + + var/path = text2path(chosen_trophy["path"]) //If the item no longer exist, this returns null + if(!path) + continue + + T.showpiece = new /obj/item/showpiece_dummy(T, path) + T.trophy_message = chosen_trophy["message"] + T.placer_key = chosen_trophy["placer_key"] + T.update_icon() + + +/datum/controller/subsystem/persistence/proc/CollectData() + CollectChiselMessages() + CollectSecretSatchels() + CollectTrophies() + +/datum/controller/subsystem/persistence/proc/CollectSecretSatchels() + var/list/satchels = list() + satchel_blacklist = typecacheof(list(/obj/item/stack/tile/plasteel, /obj/item/crowbar)) + for(var/A in new_secret_satchels) + var/obj/item/storage/backpack/satchel/flat/F = A + if(QDELETED(F) || F.z != ZLEVEL_STATION_PRIMARY || F.invisibility != INVISIBILITY_MAXIMUM) + continue + var/list/savable_obj = list() + for(var/obj/O in F) + if(is_type_in_typecache(O, satchel_blacklist) || O.admin_spawned) continue - trace_gases = TRUE - break - - // Can most things breathe? - if(trace_gases) - continue - if(!(A_gases["o2"] && A_gases["o2"][MOLES] >= 16)) - continue - if(A_gases["plasma"]) - continue - if(A_gases["co2"] && A_gases["co2"][MOLES] >= 10) + if(O.persistence_replacement) + savable_obj += O.persistence_replacement + else + savable_obj += O.type + if(isemptylist(savable_obj)) continue + var/list/data = list() + data["x"] = F.x + data["y"] = F.y + data["saved_obj"] = pick(savable_obj) + satchels += list(data) + var/json_file = file("data/npc_saves/SecretSatchels[SSmapping.config.map_name].json") + var/list/file_data = list() + file_data["data"] = satchels + fdel(json_file) + WRITE_FILE(json_file, json_encode(file_data)) - // Aim for goldilocks temperatures and pressure - if((A.temperature <= 270) || (A.temperature >= 360)) - continue - var/pressure = A.return_pressure() - if((pressure <= 20) || (pressure >= 550)) - continue +/datum/controller/subsystem/persistence/proc/CollectChiselMessages() + var/json_file = file("data/npc_saves/ChiselMessages[SSmapping.config.map_name].json") - if(extended_safety_checks) - if(istype(F, /turf/open/lava)) //chasms aren't /floor, and so are pre-filtered - var/turf/open/lava/L = F - if(!L.is_safe()) - continue + for(var/obj/structure/chisel_message/M in chisel_messages) + saved_messages += list(M.pack()) - // DING! You have passed the gauntlet, and are "probably" safe. - return F + log_world("Saved [saved_messages.len] engraved messages on map [SSmapping.config.map_name]") + var/list/file_data = list() + file_data["data"] = saved_messages + fdel(json_file) + WRITE_FILE(json_file, json_encode(file_data)) -/proc/get_teleport_turfs(turf/center, precision = 0) - if(!precision) - return list(center) - var/list/posturfs = list() - for(var/turf/T in range(precision,center)) - if(T.is_transition_turf()) - continue // Avoid picking these. - var/area/A = T.loc - if(!A.noteleport) - posturfs.Add(T) - return posturfs +/datum/controller/subsystem/persistence/proc/SaveChiselMessage(obj/structure/chisel_message/M) + saved_messages += list(M.pack()) // dm eats one list -/proc/get_teleport_turf(turf/center, precision = 0) - return safepick(get_teleport_turfs(center, precision)) + +/datum/controller/subsystem/persistence/proc/CollectTrophies() + var/json_file = file("data/npc_saves/TrophyItems.json") + var/list/file_data = list() + file_data["data"] = saved_trophies + fdel(json_file) + WRITE_FILE(json_file, json_encode(file_data)) + +/datum/controller/subsystem/persistence/proc/SaveTrophy(obj/structure/displaycase/trophy/T) + if(!T.added_roundstart && T.showpiece) + var/list/data = list() + data["path"] = T.showpiece.type + data["message"] = T.trophy_message + data["placer_key"] = T.placer_key + saved_trophies += list(data) From 16912124e50a92327f7fd6a9f63799ce8ae8645f Mon Sep 17 00:00:00 2001 From: LetterJay Date: Mon, 11 Sep 2017 15:54:38 -0500 Subject: [PATCH 14/49] Update ritual.dm --- code/game/gamemodes/cult/ritual.dm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/code/game/gamemodes/cult/ritual.dm b/code/game/gamemodes/cult/ritual.dm index f1d9bd2ab7..b9b1fb4fa0 100644 --- a/code/game/gamemodes/cult/ritual.dm +++ b/code/game/gamemodes/cult/ritual.dm @@ -257,11 +257,10 @@ This file contains the arcane tome files. to_chat(user, "There is already a rune here.") return FALSE - if(T.z != ZLEVEL_STATION && T.z != ZLEVEL_MINING) - to_chat(user, "The veil is not weak enough here.") if(!(T.z in GLOB.station_z_levels) && T.z != ZLEVEL_MINING) to_chat(user, "The veil is not weak enough here.") + return FALSE return TRUE From 59772e2afd8e8fa297317e017c580fe37d761953 Mon Sep 17 00:00:00 2001 From: LetterJay Date: Mon, 11 Sep 2017 15:54:55 -0500 Subject: [PATCH 15/49] Update events.dm --- code/game/gamemodes/events.dm | 77 +---------------------------------- 1 file changed, 1 insertion(+), 76 deletions(-) diff --git a/code/game/gamemodes/events.dm b/code/game/gamemodes/events.dm index c2d14c1994..b405cc935c 100644 --- a/code/game/gamemodes/events.dm +++ b/code/game/gamemodes/events.dm @@ -1,66 +1,3 @@ -/proc/power_failure() - priority_announce("Abnormal activity detected in [station_name()]'s powernet. As a precautionary measure, the station's power will be shut off for an indeterminate duration.", "Critical Power Failure", 'sound/ai/poweroff.ogg') - for(var/obj/machinery/power/smes/S in GLOB.machines) - if(istype(get_area(S), /area/ai_monitored/turret_protected) || S.z != ZLEVEL_STATION) - continue - S.charge = 0 - S.output_level = 0 - S.output_attempt = 0 - S.update_icon() - S.power_change() - - var/list/skipped_areas = list(/area/engine/engineering, /area/engine/supermatter, /area/engine/atmospherics_engine, /area/ai_monitored/turret_protected/ai) - - for(var/area/A in world) - if( !A.requires_power || A.always_unpowered ) - continue - - var/skip = 0 - for(var/area_type in skipped_areas) - if(istype(A,area_type)) - skip = 1 - break - if(A.contents) - for(var/atom/AT in A.contents) - if(AT.z != ZLEVEL_STATION) //Only check one, it's enough. - skip = 1 - break - if(skip) continue - A.power_light = FALSE - A.power_equip = FALSE - A.power_environ = FALSE - A.power_change() - - for(var/obj/machinery/power/apc/C in GLOB.apcs_list) - if(C.cell && C.z == ZLEVEL_STATION) - var/area/A = C.area - - var/skip = 0 - for(var/area_type in skipped_areas) - if(istype(A,area_type)) - skip = 1 - break - if(skip) continue - - C.cell.charge = 0 - -/proc/power_restore() - - priority_announce("Power has been restored to [station_name()]. We apologize for the inconvenience.", "Power Systems Nominal", 'sound/ai/poweron.ogg') - for(var/obj/machinery/power/apc/C in GLOB.machines) - if(C.cell && C.z == ZLEVEL_STATION) - C.cell.charge = C.cell.maxcharge - C.failure_timer = 0 - for(var/obj/machinery/power/smes/S in GLOB.machines) - if(S.z != ZLEVEL_STATION) - continue - S.charge = S.capacity - S.output_level = S.output_level_max - S.output_attempt = 1 - S.update_icon() - S.power_change() - for(var/area/A in world) - /proc/power_failure() priority_announce("Abnormal activity detected in [station_name()]'s powernet. As a precautionary measure, the station's power will be shut off for an indeterminate duration.", "Critical Power Failure", 'sound/ai/poweroff.ogg') for(var/obj/machinery/power/smes/S in GLOB.machines) @@ -129,19 +66,6 @@ A.power_environ = TRUE A.power_change() -/proc/power_restore_quick() - - priority_announce("All SMESs on [station_name()] have been recharged. We apologize for the inconvenience.", "Power Systems Nominal", 'sound/ai/poweron.ogg') - for(var/obj/machinery/power/smes/S in GLOB.machines) - if(S.z != ZLEVEL_STATION) - continue - S.charge = S.capacity - S.output_level = S.output_level_max - S.output_attempt = 1 - S.update_icon() - S.power_change() - A.power_change() - /proc/power_restore_quick() priority_announce("All SMESs on [station_name()] have been recharged. We apologize for the inconvenience.", "Power Systems Nominal", 'sound/ai/poweron.ogg') @@ -153,3 +77,4 @@ S.output_attempt = 1 S.update_icon() S.power_change() + From 240c5bdaadcedbc86e9c94b8b8ce4f1a98433f56 Mon Sep 17 00:00:00 2001 From: LetterJay Date: Mon, 11 Sep 2017 15:55:27 -0500 Subject: [PATCH 16/49] Update game_mode.dm --- code/game/gamemodes/game_mode.dm | 591 ------------------------------- 1 file changed, 591 deletions(-) diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index 9abce952db..311f2e505a 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -1,594 +1,3 @@ -/* - * GAMEMODES (by Rastaf0) - * - * In the new mode system all special roles are fully supported. - * You can have proper wizards/traitors/changelings/cultists during any mode. - * Only two things really depends on gamemode: - * 1. Starting roles, equipment and preparations - * 2. Conditions of finishing the round. - * - */ - - -/datum/game_mode - var/name = "invalid" - var/config_tag = null - var/votable = 1 - var/probability = 0 - var/station_was_nuked = 0 //see nuclearbomb.dm and malfunction.dm - var/explosion_in_progress = 0 //sit back and relax - var/round_ends_with_antag_death = 0 //flags_1 the "one verse the station" antags as such - var/list/datum/mind/modePlayer = new - var/list/datum/mind/antag_candidates = list() // List of possible starting antags goes here - var/list/restricted_jobs = list() // Jobs it doesn't make sense to be. I.E chaplain or AI cultist - var/list/protected_jobs = list() // Jobs that can't be traitors because - var/required_players = 0 - var/maximum_players = -1 // -1 is no maximum, positive numbers limit the selection of a mode on overstaffed stations - var/required_enemies = 0 - var/recommended_enemies = 0 - var/antag_flag = null //preferences flag such as BE_WIZARD that need to be turned on for players to be antag - var/mob/living/living_antag_player = null - var/list/datum/game_mode/replacementmode = null - var/round_converted = 0 //0: round not converted, 1: round going to convert, 2: round converted - var/reroll_friendly //During mode conversion only these are in the running - var/continuous_sanity_checked //Catches some cases where config options could be used to suggest that modes without antagonists should end when all antagonists die - var/enemy_minimum_age = 7 //How many days must players have been playing before they can play this antagonist - - var/announce_span = "warning" //The gamemode's name will be in this span during announcement. - var/announce_text = "This gamemode forgot to set a descriptive text! Uh oh!" //Used to describe a gamemode when it's announced. - - var/const/waittime_l = 600 - var/const/waittime_h = 1800 // started at 1800 - - var/list/datum/station_goal/station_goals = list() - - var/allow_persistence_save = TRUE - -/datum/game_mode/proc/announce() //Shows the gamemode's name and a fast description. - to_chat(world, "The gamemode is: [name]!") - to_chat(world, "[announce_text]") - - -///Checks to see if the game can be setup and ran with the current number of players or whatnot. -/datum/game_mode/proc/can_start() - var/playerC = 0 - for(var/mob/dead/new_player/player in GLOB.player_list) - if((player.client)&&(player.ready == PLAYER_READY_TO_PLAY)) - playerC++ - if(!GLOB.Debug2) - if(playerC < required_players || (maximum_players >= 0 && playerC > maximum_players)) - return 0 - antag_candidates = get_players_for_role(antag_flag) - if(!GLOB.Debug2) - if(antag_candidates.len < required_enemies) - return 0 - return 1 - else - message_admins("DEBUG: GAME STARTING WITHOUT PLAYER NUMBER CHECKS, THIS WILL PROBABLY BREAK SHIT.") - return 1 - - -///Attempts to select players for special roles the mode might have. -/datum/game_mode/proc/pre_setup() - return 1 - - -///Everyone should now be on the station and have their normal gear. This is the place to give the special roles extra things -/datum/game_mode/proc/post_setup(report) //Gamemodes can override the intercept report. Passing TRUE as the argument will force a report. - if(!report) - report = config.intercept - addtimer(CALLBACK(GLOBAL_PROC, .proc/display_roundstart_logout_report), ROUNDSTART_LOGOUT_REPORT_TIME) - - if(SSdbcore.Connect()) - var/sql - if(SSticker.mode) - sql += "game_mode = '[SSticker.mode]'" - if(GLOB.revdata.originmastercommit) - if(sql) - sql += ", " - sql += "commit_hash = '[GLOB.revdata.originmastercommit]'" - if(sql) - var/datum/DBQuery/query_round_game_mode = SSdbcore.NewQuery("UPDATE [format_table_name("round")] SET [sql] WHERE id = [GLOB.round_id]") - query_round_game_mode.Execute() - if(report) - addtimer(CALLBACK(src, .proc/send_intercept, 0), rand(waittime_l, waittime_h)) - generate_station_goals() - return 1 - - -///Handles late-join antag assignments -/datum/game_mode/proc/make_antag_chance(mob/living/carbon/human/character) - if(replacementmode && round_converted == 2) - replacementmode.make_antag_chance(character) - return - - -///Allows rounds to basically be "rerolled" should the initial premise fall through. Also known as mulligan antags. -/datum/game_mode/proc/convert_roundtype() - set waitfor = FALSE - var/list/living_crew = list() - - for(var/mob/Player in GLOB.mob_list) - if(Player.mind && Player.stat != DEAD && !isnewplayer(Player) && !isbrain(Player) && Player.client) - living_crew += Player - if(living_crew.len / GLOB.joined_player_list.len <= config.midround_antag_life_check) //If a lot of the player base died, we start fresh - message_admins("Convert_roundtype failed due to too many dead people. Limit is [config.midround_antag_life_check * 100]% living crew") - return null - - var/list/datum/game_mode/runnable_modes = config.get_runnable_midround_modes(living_crew.len) - var/list/datum/game_mode/usable_modes = list() - for(var/datum/game_mode/G in runnable_modes) - if(G.reroll_friendly && living_crew >= G.required_players) - usable_modes += G - else - qdel(G) - - if(!usable_modes) - message_admins("Convert_roundtype failed due to no valid modes to convert to. Please report this error to the Coders.") - return null - - replacementmode = pickweight(usable_modes) - - switch(SSshuttle.emergency.mode) //Rounds on the verge of ending don't get new antags, they just run out - if(SHUTTLE_STRANDED, SHUTTLE_ESCAPE) - return 1 - if(SHUTTLE_CALL) - if(SSshuttle.emergency.timeLeft(1) < initial(SSshuttle.emergencyCallTime)*0.5) - return 1 - - if(world.time >= (config.midround_antag_time_check * 600)) - message_admins("Convert_roundtype failed due to round length. Limit is [config.midround_antag_time_check] minutes.") - return null - - var/list/antag_candidates = list() - - for(var/mob/living/carbon/human/H in living_crew) - if(H.client && H.client.prefs.allow_midround_antag) - antag_candidates += H - - if(!antag_candidates) - message_admins("Convert_roundtype failed due to no antag candidates.") - return null - - antag_candidates = shuffle(antag_candidates) - - if(config.protect_roles_from_antagonist) - replacementmode.restricted_jobs += replacementmode.protected_jobs - if(config.protect_assistant_from_antagonist) - replacementmode.restricted_jobs += "Assistant" - - message_admins("The roundtype will be converted. If you have other plans for the station or feel the station is too messed up to inhabit stop the creation of antags or end the round now.") - - . = 1 - sleep(rand(600,1800)) - if(!SSticker.IsRoundInProgress()) - message_admins("Roundtype conversion cancelled, the game appears to have finished!") - round_converted = 0 - return - //somewhere between 1 and 3 minutes from now - if(!config.midround_antag[SSticker.mode.config_tag]) - round_converted = 0 - return 1 - for(var/mob/living/carbon/human/H in antag_candidates) - replacementmode.make_antag_chance(H) - round_converted = 2 - message_admins("-- IMPORTANT: The roundtype has been converted to [replacementmode.name], antagonists may have been created! --") - - -///Called by the gameSSticker -/datum/game_mode/process() - return 0 - - -/datum/game_mode/proc/check_finished(force_ending) //to be called by SSticker - if(replacementmode && round_converted == 2) - return replacementmode.check_finished() - if(SSshuttle.emergency && (SSshuttle.emergency.mode == SHUTTLE_ENDGAME)) - return TRUE - if(station_was_nuked) - return TRUE - if(!round_converted && (!config.continuous[config_tag] || (config.continuous[config_tag] && config.midround_antag[config_tag]))) //Non-continuous or continous with replacement antags - if(!continuous_sanity_checked) //make sure we have antags to be checking in the first place - for(var/mob/Player in GLOB.mob_list) - if(Player.mind) - if(Player.mind.special_role) - continuous_sanity_checked = 1 - return 0 - if(!continuous_sanity_checked) - message_admins("The roundtype ([config_tag]) has no antagonists, continuous round has been defaulted to on and midround_antag has been defaulted to off.") - config.continuous[config_tag] = 1 - config.midround_antag[config_tag] = 0 - SSshuttle.clearHostileEnvironment(src) - return 0 - - - if(living_antag_player && living_antag_player.mind && isliving(living_antag_player) && living_antag_player.stat != DEAD && !isnewplayer(living_antag_player) &&!isbrain(living_antag_player)) - return 0 //A resource saver: once we find someone who has to die for all antags to be dead, we can just keep checking them, cycling over everyone only when we lose our mark. - - for(var/mob/Player in GLOB.living_mob_list) - if(Player.mind && Player.stat != DEAD && !isnewplayer(Player) &&!isbrain(Player) && Player.client) - if(Player.mind.special_role) //Someone's still antaging! - living_antag_player = Player - return 0 - - if(!config.continuous[config_tag] || force_ending) - return 1 - - else - round_converted = convert_roundtype() - if(!round_converted) - if(round_ends_with_antag_death) - return 1 - else - config.midround_antag[config_tag] = 0 - return 0 - - return 0 - - -/datum/game_mode/proc/declare_completion() - var/clients = 0 - var/surviving_humans = 0 - var/surviving_total = 0 - var/ghosts = 0 - var/escaped_humans = 0 - var/escaped_total = 0 - - for(var/mob/M in GLOB.player_list) - if(M.client) - clients++ - if(ishuman(M)) - if(!M.stat) - surviving_humans++ - if(M.z == ZLEVEL_CENTCOM) - escaped_humans++ - if(!M.stat) - surviving_total++ - if(M.z == ZLEVEL_CENTCOM) - escaped_total++ - - - if(isobserver(M)) - ghosts++ - - if(clients > 0) - SSblackbox.set_val("round_end_clients",clients) - if(ghosts > 0) - SSblackbox.set_val("round_end_ghosts",ghosts) - if(surviving_humans > 0) - SSblackbox.set_val("survived_human",surviving_humans) - if(surviving_total > 0) - SSblackbox.set_val("survived_total",surviving_total) - if(escaped_humans > 0) - SSblackbox.set_val("escaped_human",escaped_humans) - if(escaped_total > 0) - SSblackbox.set_val("escaped_total",escaped_total) - send2irc("Server", "Round just ended.") - if(cult.len && !istype(SSticker.mode, /datum/game_mode/cult)) - datum_cult_completion() - - - if(GLOB.borers.len) - var/borertext = "
The borers were:" - for(var/mob/living/simple_animal/borer/B in GLOB.borers) - if((B.key || B.controlling) && B.stat != DEAD) - borertext += "
[B.controlling ? B.victim.key : B.key] was [B.truename]" - var/count = 1 - for(var/datum/objective/objective in B.mind.objectives) - if(objective.check_completion()) - borertext += "
Objective #[count]: [objective.explanation_text] Success!" - else - borertext += "
Objective #[count]: [objective.explanation_text] Fail." - count++ - - - to_chat(world, borertext) - - var/total_borers = 0 - for(var/mob/living/simple_animal/borer/B in GLOB.borers) - if((B.key || B.victim) && B.stat != DEAD) - total_borers++ - if(total_borers) - var/total_borer_hosts = 0 - for(var/mob/living/carbon/C in GLOB.mob_list) - var/mob/living/simple_animal/borer/D = C.has_brain_worms() - var/turf/location = get_turf(C) - if(location.z == ZLEVEL_CENTCOM && D && D.stat != DEAD) - total_borer_hosts++ - to_chat(world, "There were [total_borers] borers alive at round end!") - to_chat(world, "A total of [total_borer_hosts] borers with hosts escaped on the shuttle alive.") - - CHECK_TICK - return 0 - - -/datum/game_mode/proc/check_win() //universal trigger to be called at mob death, nuke explosion, etc. To be called from everywhere. - return 0 - - -/datum/game_mode/proc/send_intercept() - var/intercepttext = "Central Command Status Summary
" - intercepttext += "Central Command has intercepted and partially decoded a Syndicate transmission with vital information regarding their movements. The following report outlines the most \ - likely threats to appear in your sector." - var/list/possible_modes = list() - possible_modes.Add("blob", "changeling", "clock_cult", "cult", "extended", "gang", "malf", "nuclear", "revolution", "traitor", "wizard") - possible_modes -= name //remove the current gamemode to prevent it from being randomly deleted, it will be readded later - - for(var/i in 1 to 6) //Remove a few modes to leave four - possible_modes -= pick(possible_modes) - - possible_modes |= name //Re-add the actual gamemode - the intercept will thus always have the correct mode in its list - possible_modes = shuffle(possible_modes) //Meta prevention - - var/datum/intercept_text/i_text = new /datum/intercept_text - for(var/V in possible_modes) - intercepttext += i_text.build(V) - - if(station_goals.len) - intercepttext += "
Special Orders for [station_name()]:" - for(var/datum/station_goal/G in station_goals) - G.on_report() - intercepttext += G.get_report() - - print_command_report(intercepttext, "Central Command Status Summary", announce=FALSE) - priority_announce("A summary has been copied and printed to all communications consoles.", "Enemy communication intercepted. Security level elevated.", 'sound/ai/intercept.ogg') - if(GLOB.security_level < SEC_LEVEL_BLUE) - set_security_level(SEC_LEVEL_BLUE) - - -/datum/game_mode/proc/get_players_for_role(role) - var/list/players = list() - var/list/candidates = list() - var/list/drafted = list() - var/datum/mind/applicant = null - - // Ultimate randomizing code right here - for(var/mob/dead/new_player/player in GLOB.player_list) - if(player.client && player.ready == PLAYER_READY_TO_PLAY) - players += player - - // Shuffling, the players list is now ping-independent!!! - // Goodbye antag dante - players = shuffle(players) - - for(var/mob/dead/new_player/player in players) - if(player.client && player.ready == PLAYER_READY_TO_PLAY) - if(role in player.client.prefs.be_special) - if(!jobban_isbanned(player, "Syndicate") && !jobban_isbanned(player, role)) //Nodrak/Carn: Antag Job-bans - if(age_check(player.client)) //Must be older than the minimum age - candidates += player.mind // Get a list of all the people who want to be the antagonist for this round - - if(restricted_jobs) - for(var/datum/mind/player in candidates) - for(var/job in restricted_jobs) // Remove people who want to be antagonist but have a job already that precludes it - if(player.assigned_role == job) - candidates -= player - - if(candidates.len < recommended_enemies) - for(var/mob/dead/new_player/player in players) - if(player.client && player.ready == PLAYER_READY_TO_PLAY) - if(!(role in player.client.prefs.be_special)) // We don't have enough people who want to be antagonist, make a separate list of people who don't want to be one - if(!jobban_isbanned(player, "Syndicate") && !jobban_isbanned(player, role)) //Nodrak/Carn: Antag Job-bans - drafted += player.mind - - if(restricted_jobs) - for(var/datum/mind/player in drafted) // Remove people who can't be an antagonist - for(var/job in restricted_jobs) - if(player.assigned_role == job) - drafted -= player - - drafted = shuffle(drafted) // Will hopefully increase randomness, Donkie - - while(candidates.len < recommended_enemies) // Pick randomlly just the number of people we need and add them to our list of candidates - if(drafted.len > 0) - applicant = pick(drafted) - if(applicant) - candidates += applicant - drafted.Remove(applicant) - - else // Not enough scrubs, ABORT ABORT ABORT - break - - if(restricted_jobs) - for(var/datum/mind/player in drafted) // Remove people who can't be an antagonist - for(var/job in restricted_jobs) - if(player.assigned_role == job) - drafted -= player - - drafted = shuffle(drafted) // Will hopefully increase randomness, Donkie - - while(candidates.len < recommended_enemies) // Pick randomlly just the number of people we need and add them to our list of candidates - if(drafted.len > 0) - applicant = pick(drafted) - if(applicant) - candidates += applicant - drafted.Remove(applicant) - - else // Not enough scrubs, ABORT ABORT ABORT - break - - return candidates // Returns: The number of people who had the antagonist role set to yes, regardless of recomended_enemies, if that number is greater than recommended_enemies - // recommended_enemies if the number of people with that role set to yes is less than recomended_enemies, - // Less if there are not enough valid players in the game entirely to make recommended_enemies. - - - -/datum/game_mode/proc/num_players() - . = 0 - for(var/mob/dead/new_player/P in GLOB.player_list) - if(P.client && P.ready == PLAYER_READY_TO_PLAY) - . ++ - -/////////////////////////////////// -//Keeps track of all living heads// -/////////////////////////////////// -/datum/game_mode/proc/get_living_heads() - . = list() - for(var/mob/living/carbon/human/player in GLOB.mob_list) - if(player.stat != DEAD && player.mind && (player.mind.assigned_role in GLOB.command_positions)) - . |= player.mind - - -//////////////////////////// -//Keeps track of all heads// -//////////////////////////// -/datum/game_mode/proc/get_all_heads() - . = list() - for(var/mob/player in GLOB.mob_list) - if(player.mind && (player.mind.assigned_role in GLOB.command_positions)) - . |= player.mind - -////////////////////////////////////////////// -//Keeps track of all living security members// -////////////////////////////////////////////// -/datum/game_mode/proc/get_living_sec() - . = list() - for(var/mob/living/carbon/human/player in GLOB.mob_list) - if(player.stat != DEAD && player.mind && (player.mind.assigned_role in GLOB.security_positions)) - . |= player.mind - -//////////////////////////////////////// -//Keeps track of all security members// -//////////////////////////////////////// -/datum/game_mode/proc/get_all_sec() - . = list() - for(var/mob/living/carbon/human/player in GLOB.mob_list) - if(player.mind && (player.mind.assigned_role in GLOB.security_positions)) - . |= player.mind - -////////////////////////// -//Reports player logouts// -////////////////////////// -/proc/display_roundstart_logout_report() - var/msg = "Roundstart logout report\n\n" - for(var/mob/living/L in GLOB.mob_list) - - if(L.ckey) - var/found = 0 - for(var/client/C in GLOB.clients) - if(C.ckey == L.ckey) - found = 1 - break - if(!found) - msg += "[L.name] ([L.ckey]), the [L.job] (Disconnected)\n" - - - if(L.ckey && L.client) - if(L.client.inactivity >= (ROUNDSTART_LOGOUT_REPORT_TIME / 2)) //Connected, but inactive (alt+tabbed or something) - msg += "[L.name] ([L.ckey]), the [L.job] (Connected, Inactive)\n" - continue //AFK client - if(L.stat) - if(L.suiciding) //Suicider - msg += "[L.name] ([L.ckey]), the [L.job] (Suicide)\n" - continue //Disconnected client - if(L.stat == UNCONSCIOUS) - msg += "[L.name] ([L.ckey]), the [L.job] (Dying)\n" - continue //Unconscious - if(L.stat == DEAD) - msg += "[L.name] ([L.ckey]), the [L.job] (Dead)\n" - continue //Dead - - continue //Happy connected client - for(var/mob/dead/observer/D in GLOB.mob_list) - if(D.mind && D.mind.current == L) - if(L.stat == DEAD) - if(L.suiciding) //Suicider - msg += "[L.name] ([ckey(D.mind.key)]), the [L.job] (Suicide)\n" - continue //Disconnected client - else - msg += "[L.name] ([ckey(D.mind.key)]), the [L.job] (Dead)\n" - continue //Dead mob, ghost abandoned - else - if(D.can_reenter_corpse) - continue //Adminghost, or cult/wizard ghost - else - msg += "[L.name] ([ckey(D.mind.key)]), the [L.job] (Ghosted)\n" - continue //Ghosted while alive - - - - for(var/mob/M in GLOB.mob_list) - if(M.client && M.client.holder) - to_chat(M, msg) - -/datum/game_mode/proc/printplayer(datum/mind/ply, fleecheck) - var/text = "
[ply.key] was [ply.name] the [ply.assigned_role] and" - if(ply.current) - if(ply.current.stat == DEAD) - text += " died" - else - text += " survived" - if(fleecheck && ply.current.z > ZLEVEL_STATION) - text += " while fleeing the station" - if(ply.current.real_name != ply.name) - text += " as [ply.current.real_name]" - else - text += " had their body destroyed" - return text - -/datum/game_mode/proc/printobjectives(datum/mind/ply) - var/text = "" - var/count = 1 - for(var/datum/objective/objective in ply.objectives) - if(objective.check_completion()) - text += "
Objective #[count]: [objective.explanation_text] Success!" - else - text += "
Objective #[count]: [objective.explanation_text] Fail." - count++ - return text - -//If the configuration option is set to require players to be logged as old enough to play certain jobs, then this proc checks that they are, otherwise it just returns 1 -/datum/game_mode/proc/age_check(client/C) - if(get_remaining_days(C) == 0) - return 1 //Available in 0 days = available right now = player is old enough to play. - return 0 - - -/datum/game_mode/proc/get_remaining_days(client/C) - if(!C) - return 0 - if(!config.use_age_restriction_for_jobs) - return 0 - if(!isnum(C.player_age)) - return 0 //This is only a number if the db connection is established, otherwise it is text: "Requires database", meaning these restrictions cannot be enforced - if(!isnum(enemy_minimum_age)) - return 0 - - return max(0, enemy_minimum_age - C.player_age) - -/datum/game_mode/proc/replace_jobbaned_player(mob/living/M, role_type, pref) - var/list/mob/dead/observer/candidates = pollCandidatesForMob("Do you want to play as a [role_type]?", "[role_type]", null, pref, 50, M) - var/mob/dead/observer/theghost = null - if(candidates.len) - theghost = pick(candidates) - to_chat(M, "Your mob has been taken over by a ghost! Appeal your job ban if you want to avoid this in the future!") - message_admins("[key_name_admin(theghost)] has taken control of ([key_name_admin(M)]) to replace a jobbaned player.") - M.ghostize(0) - M.key = theghost.key - -/datum/game_mode/proc/remove_antag_for_borging(datum/mind/newborgie) - SSticker.mode.remove_cultist(newborgie, 0, 0) - SSticker.mode.remove_revolutionary(newborgie, 0) - SSticker.mode.remove_gangster(newborgie, 0, remove_bosses=1) - -/datum/game_mode/proc/generate_station_goals() - var/list/possible = list() - for(var/T in subtypesof(/datum/station_goal)) - var/datum/station_goal/G = T - if(config_tag in initial(G.gamemode_blacklist)) - continue - possible += T - var/goal_weights = 0 - while(possible.len && goal_weights < STATION_GOAL_BUDGET) - var/datum/station_goal/picked = pick_n_take(possible) - goal_weights += initial(picked.weight) - station_goals += new picked - - -/datum/game_mode/proc/declare_station_goal_completion() - for(var/V in station_goals) - var/datum/station_goal/G = V - G.print_result() /* From 57343fa7123bfac7cc863b5c0cbf31335c00c938 Mon Sep 17 00:00:00 2001 From: LetterJay Date: Mon, 11 Sep 2017 15:56:25 -0500 Subject: [PATCH 17/49] Update immovable_rod.dm --- code/modules/events/immovable_rod.dm | 183 +++++++++++++-------------- 1 file changed, 85 insertions(+), 98 deletions(-) diff --git a/code/modules/events/immovable_rod.dm b/code/modules/events/immovable_rod.dm index 0fc6a58499..4cd718070b 100644 --- a/code/modules/events/immovable_rod.dm +++ b/code/modules/events/immovable_rod.dm @@ -1,38 +1,26 @@ -/* -Immovable rod random event. -The rod will spawn at some location outside the station, and travel in a straight line to the opposite side of the station -Everything solid in the way will be ex_act()'d -In my current plan for it, 'solid' will be defined as anything with density == 1 - ---NEOFite -*/ - -/datum/round_event_control/immovable_rod - name = "Immovable Rod" - typepath = /datum/round_event/immovable_rod - min_players = 15 - max_occurrences = 5 - -/datum/round_event/immovable_rod - announceWhen = 5 - -/datum/round_event/immovable_rod/announce() - priority_announce("What the fuck was that?!", "General Alert") - -/datum/round_event/immovable_rod/start() +/* +Immovable rod random event. +The rod will spawn at some location outside the station, and travel in a straight line to the opposite side of the station +Everything solid in the way will be ex_act()'d +In my current plan for it, 'solid' will be defined as anything with density == 1 + +--NEOFite +*/ + +/datum/round_event_control/immovable_rod + name = "Immovable Rod" + typepath = /datum/round_event/immovable_rod + min_players = 15 + max_occurrences = 5 + +/datum/round_event/immovable_rod + announceWhen = 5 + +/datum/round_event/immovable_rod/announce() + priority_announce("What the fuck was that?!", "General Alert") + +/datum/round_event/immovable_rod/start() var/startside = pick(GLOB.cardinals) -<<<<<<< HEAD - var/turf/startT = spaceDebrisStartLoc(startside, ZLEVEL_STATION) - var/turf/endT = spaceDebrisFinishLoc(startside, ZLEVEL_STATION) - new /obj/effect/immovablerod(startT, endT) - -/obj/effect/immovablerod - name = "immovable rod" - desc = "What the fuck is that?" - icon = 'icons/obj/objects.dmi' - icon_state = "immrod" - throwforce = 100 -======= var/turf/startT = spaceDebrisStartLoc(startside, ZLEVEL_STATION_PRIMARY) var/turf/endT = spaceDebrisFinishLoc(startside, ZLEVEL_STATION_PRIMARY) new /obj/effect/immovablerod(startT, endT) @@ -43,73 +31,72 @@ In my current plan for it, 'solid' will be defined as anything with density == 1 icon = 'icons/obj/objects.dmi' icon_state = "immrod" throwforce = 100 ->>>>>>> 10a3238... Makes the station Z level into a list instead of a single define (#30297) density = TRUE anchored = TRUE - var/z_original = 0 - var/destination - var/notify = TRUE - -/obj/effect/immovablerod/New(atom/start, atom/end) - ..() + var/z_original = 0 + var/destination + var/notify = TRUE + +/obj/effect/immovablerod/New(atom/start, atom/end) + ..() SSaugury.register_doom(src, 2000) - z_original = z - destination = end - if(notify) - notify_ghosts("\A [src] is inbound!", - enter_link="(Click to orbit)", - source=src, action=NOTIFY_ORBIT) - GLOB.poi_list += src - if(end && end.z==z_original) - walk_towards(src, destination, 1) - -/obj/effect/immovablerod/Topic(href, href_list) - if(href_list["orbit"]) - var/mob/dead/observer/ghost = usr - if(istype(ghost)) - ghost.ManualFollow(src) - -/obj/effect/immovablerod/Destroy() - GLOB.poi_list -= src - . = ..() - -/obj/effect/immovablerod/Move() - if((z != z_original) || (loc == destination)) - qdel(src) - return ..() - -/obj/effect/immovablerod/ex_act(severity, target) - return 0 - + z_original = z + destination = end + if(notify) + notify_ghosts("\A [src] is inbound!", + enter_link="(Click to orbit)", + source=src, action=NOTIFY_ORBIT) + GLOB.poi_list += src + if(end && end.z==z_original) + walk_towards(src, destination, 1) + +/obj/effect/immovablerod/Topic(href, href_list) + if(href_list["orbit"]) + var/mob/dead/observer/ghost = usr + if(istype(ghost)) + ghost.ManualFollow(src) + +/obj/effect/immovablerod/Destroy() + GLOB.poi_list -= src + . = ..() + +/obj/effect/immovablerod/Move() + if((z != z_original) || (loc == destination)) + qdel(src) + return ..() + +/obj/effect/immovablerod/ex_act(severity, target) + return 0 + /obj/effect/immovablerod/Collide(atom/clong) - if(prob(10)) - playsound(src, 'sound/effects/bang.ogg', 50, 1) - audible_message("You hear a CLANG!") - - if(clong && prob(25)) - x = clong.x - y = clong.y - - if(isturf(clong) || isobj(clong)) - if(clong.density) + if(prob(10)) + playsound(src, 'sound/effects/bang.ogg', 50, 1) + audible_message("You hear a CLANG!") + + if(clong && prob(25)) + x = clong.x + y = clong.y + + if(isturf(clong) || isobj(clong)) + if(clong.density) clong.ex_act(EXPLODE_HEAVY) - - else if(isliving(clong)) - penetrate(clong) - else if(istype(clong, type)) - var/obj/effect/immovablerod/other = clong - visible_message("[src] collides with [other]!\ - ") - var/datum/effect_system/smoke_spread/smoke = new - smoke.set_up(2, get_turf(src)) - smoke.start() - qdel(src) - qdel(other) - -/obj/effect/immovablerod/proc/penetrate(mob/living/L) - L.visible_message("[L] is penetrated by an immovable rod!" , "The rod penetrates you!" , "You hear a CLANG!") - if(ishuman(L)) - var/mob/living/carbon/human/H = L - H.adjustBruteLoss(160) - if(L && (L.density || prob(10))) + + else if(isliving(clong)) + penetrate(clong) + else if(istype(clong, type)) + var/obj/effect/immovablerod/other = clong + visible_message("[src] collides with [other]!\ + ") + var/datum/effect_system/smoke_spread/smoke = new + smoke.set_up(2, get_turf(src)) + smoke.start() + qdel(src) + qdel(other) + +/obj/effect/immovablerod/proc/penetrate(mob/living/L) + L.visible_message("[L] is penetrated by an immovable rod!" , "The rod penetrates you!" , "You hear a CLANG!") + if(ishuman(L)) + var/mob/living/carbon/human/H = L + H.adjustBruteLoss(160) + if(L && (L.density || prob(10))) L.ex_act(EXPLODE_HEAVY) From 12f17ecbe7ccb79092df11a9f4e4b0e9f14fb8a0 Mon Sep 17 00:00:00 2001 From: LetterJay Date: Mon, 11 Sep 2017 15:57:15 -0500 Subject: [PATCH 18/49] Update radiation_storm.dm --- code/modules/events/radiation_storm.dm | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/code/modules/events/radiation_storm.dm b/code/modules/events/radiation_storm.dm index 54f7532923..b1b6195f51 100644 --- a/code/modules/events/radiation_storm.dm +++ b/code/modules/events/radiation_storm.dm @@ -1,25 +1,3 @@ -<<<<<<< HEAD -/datum/round_event_control/radiation_storm - name = "Radiation Storm" - typepath = /datum/round_event/radiation_storm - max_occurrences = 1 - -/datum/round_event/radiation_storm - - -/datum/round_event/radiation_storm/setup() - startWhen = 3 - endWhen = startWhen + 1 - announceWhen = 1 - -/datum/round_event/radiation_storm/announce() - priority_announce("High levels of radiation detected near the station. Maintenance is best shielded from radiation.", "Anomaly Alert", 'sound/ai/radiation.ogg') - //sound not longer matches the text, but an audible warning is probably good - -/datum/round_event/radiation_storm/start() - SSweather.run_weather("radiation storm",ZLEVEL_STATION) - make_maint_all_access() -======= /datum/round_event_control/radiation_storm name = "Radiation Storm" typepath = /datum/round_event/radiation_storm @@ -38,5 +16,4 @@ //sound not longer matches the text, but an audible warning is probably good /datum/round_event/radiation_storm/start() - SSweather.run_weather("radiation storm",ZLEVEL_STATION_PRIMARY) ->>>>>>> 10a3238... Makes the station Z level into a list instead of a single define (#30297) + SSweather.run_weather("radiation storm",ZLEVEL_STATION_PRIMARY) From fe3d825596fb25e63fc2ad84b7716df7b89df582 Mon Sep 17 00:00:00 2001 From: LetterJay Date: Mon, 11 Sep 2017 15:57:45 -0500 Subject: [PATCH 19/49] Update spider_infestation.dm --- code/modules/events/spider_infestation.dm | 40 ----------------------- 1 file changed, 40 deletions(-) diff --git a/code/modules/events/spider_infestation.dm b/code/modules/events/spider_infestation.dm index 3469fd8a88..0a4b07a9cb 100644 --- a/code/modules/events/spider_infestation.dm +++ b/code/modules/events/spider_infestation.dm @@ -1,42 +1,3 @@ -<<<<<<< HEAD -/datum/round_event_control/spider_infestation - name = "Spider Infestation" - typepath = /datum/round_event/spider_infestation - weight = 5 - max_occurrences = 1 - min_players = 15 - -/datum/round_event/spider_infestation - announceWhen = 400 - - var/spawncount = 1 - - -/datum/round_event/spider_infestation/setup() - announceWhen = rand(announceWhen, announceWhen + 50) - spawncount = rand(5, 8) - -/datum/round_event/spider_infestation/announce() - priority_announce("Unidentified lifesigns detected coming aboard [station_name()]. Secure any exterior access, including ducting and ventilation.", "Lifesign Alert", 'sound/ai/aliens.ogg') - - -/datum/round_event/spider_infestation/start() - var/list/vents = list() - for(var/obj/machinery/atmospherics/components/unary/vent_pump/temp_vent in world) - if(temp_vent.loc.z == ZLEVEL_STATION && !temp_vent.welded) - var/datum/pipeline/temp_vent_parent = temp_vent.PARENT1 - if(temp_vent_parent.other_atmosmch.len > 20) - vents += temp_vent - - while((spawncount >= 1) && vents.len) - var/obj/vent = pick(vents) - var/spawn_type = /obj/structure/spider/spiderling - if(prob(66)) - spawn_type = /obj/structure/spider/spiderling/nurse - spawn_atom_to_turf(spawn_type, vent, 1, FALSE) - vents -= vent - spawncount-- -======= /datum/round_event_control/spider_infestation name = "Spider Infestation" typepath = /datum/round_event/spider_infestation @@ -74,4 +35,3 @@ spawn_atom_to_turf(spawn_type, vent, 1, FALSE) vents -= vent spawncount-- ->>>>>>> 10a3238... Makes the station Z level into a list instead of a single define (#30297) From 97b25bc59a9f8d2a98bb5c9753f3c89029a473bf Mon Sep 17 00:00:00 2001 From: LetterJay Date: Mon, 11 Sep 2017 15:58:12 -0500 Subject: [PATCH 20/49] Update vent_clog.dm --- code/modules/events/vent_clog.dm | 52 -------------------------------- 1 file changed, 52 deletions(-) diff --git a/code/modules/events/vent_clog.dm b/code/modules/events/vent_clog.dm index ab7c63cdb0..f94d521e8d 100644 --- a/code/modules/events/vent_clog.dm +++ b/code/modules/events/vent_clog.dm @@ -1,54 +1,3 @@ -<<<<<<< HEAD -/datum/round_event_control/vent_clog - name = "Clogged Vents" - typepath = /datum/round_event/vent_clog - weight = 35 - -/datum/round_event/vent_clog - announceWhen = 1 - startWhen = 5 - endWhen = 35 - var/interval = 2 - var/list/vents = list() - var/list/gunk = list("water","carbon","flour","radium","toxin","cleaner","nutriment","condensedcapsaicin","mushroomhallucinogen","lube", - "plantbgone","banana","charcoal","space_drugs","morphine","holywater","ethanol","hot_coco","sacid") - -/datum/round_event/vent_clog/announce() - priority_announce("The scrubbers network is experiencing a backpressure surge. Some ejection of contents may occur.", "Atmospherics alert") - - -/datum/round_event/vent_clog/setup() - endWhen = rand(25, 100) - for(var/obj/machinery/atmospherics/components/unary/vent_scrubber/temp_vent in GLOB.machines) - if(temp_vent.loc.z == ZLEVEL_STATION && !temp_vent.welded) - var/datum/pipeline/temp_vent_parent = temp_vent.PARENT1 - if(temp_vent_parent.other_atmosmch.len > 20) - vents += temp_vent - if(!vents.len) - return kill() - -/datum/round_event/vent_clog/tick() - if(activeFor % interval == 0) - var/obj/machinery/atmospherics/components/unary/vent = pick_n_take(vents) - while(vent && vent.welded) - vent = pick_n_take(vents) - - if(vent && vent.loc) - var/datum/reagents/R = new/datum/reagents(50) - R.my_atom = vent - R.add_reagent(pick(gunk), 50) - - var/datum/effect_system/smoke_spread/chem/smoke = new - smoke.set_up(R, 1, vent, silent = 1) - playsound(vent.loc, 'sound/effects/smoke.ogg', 50, 1, -3) - smoke.start() - qdel(R) - - var/cockroaches = prob(33) ? 3 : 0 - while(cockroaches) - new /mob/living/simple_animal/cockroach(get_turf(vent)) - cockroaches-- -======= /datum/round_event_control/vent_clog name = "Clogged Vents" typepath = /datum/round_event/vent_clog @@ -98,4 +47,3 @@ while(cockroaches) new /mob/living/simple_animal/cockroach(get_turf(vent)) cockroaches-- ->>>>>>> 10a3238... Makes the station Z level into a list instead of a single define (#30297) From 9e73d297cc7051a0aa71b8e0dd5fbfee961bb5ce Mon Sep 17 00:00:00 2001 From: LetterJay Date: Mon, 11 Sep 2017 15:58:47 -0500 Subject: [PATCH 21/49] Update security_levels.dm --- .../security_levels/security_levels.dm | 137 ------------------ 1 file changed, 137 deletions(-) diff --git a/code/modules/security_levels/security_levels.dm b/code/modules/security_levels/security_levels.dm index b13a746ab5..e83061b232 100644 --- a/code/modules/security_levels/security_levels.dm +++ b/code/modules/security_levels/security_levels.dm @@ -1,139 +1,3 @@ -<<<<<<< HEAD -GLOBAL_VAR_INIT(security_level, 0) -//0 = code green -//1 = code blue -//2 = code red -//3 = code delta - -//config.alert_desc_blue_downto - -/proc/set_security_level(level) - switch(level) - if("green") - level = SEC_LEVEL_GREEN - if("blue") - level = SEC_LEVEL_BLUE - if("red") - level = SEC_LEVEL_RED - if("delta") - level = SEC_LEVEL_DELTA - - //Will not be announced if you try to set to the same level as it already is - if(level >= SEC_LEVEL_GREEN && level <= SEC_LEVEL_DELTA && level != GLOB.security_level) - switch(level) - if(SEC_LEVEL_GREEN) - minor_announce(config.alert_desc_green, "Attention! Security level lowered to green:") - if(SSshuttle.emergency.mode == SHUTTLE_CALL || SSshuttle.emergency.mode == SHUTTLE_RECALL) - if(GLOB.security_level >= SEC_LEVEL_RED) - SSshuttle.emergency.modTimer(4) - else - SSshuttle.emergency.modTimer(2) - GLOB.security_level = SEC_LEVEL_GREEN - for(var/obj/machinery/firealarm/FA in GLOB.machines) - if(FA.z == ZLEVEL_STATION) - FA.update_icon() - if(SEC_LEVEL_BLUE) - if(GLOB.security_level < SEC_LEVEL_BLUE) - minor_announce(config.alert_desc_blue_upto, "Attention! Security level elevated to blue:",1) - if(SSshuttle.emergency.mode == SHUTTLE_CALL || SSshuttle.emergency.mode == SHUTTLE_RECALL) - SSshuttle.emergency.modTimer(0.5) - else - minor_announce(config.alert_desc_blue_downto, "Attention! Security level lowered to blue:") - if(SSshuttle.emergency.mode == SHUTTLE_CALL || SSshuttle.emergency.mode == SHUTTLE_RECALL) - SSshuttle.emergency.modTimer(2) - GLOB.security_level = SEC_LEVEL_BLUE - for(var/mob/M in GLOB.player_list) - M << sound('sound/misc/voybluealert.ogg') - for(var/obj/machinery/firealarm/FA in GLOB.machines) - if(FA.z == ZLEVEL_STATION) - FA.update_icon() - if(SEC_LEVEL_RED) - if(GLOB.security_level < SEC_LEVEL_RED) - minor_announce(config.alert_desc_red_upto, "Attention! Code red!",1) - if(SSshuttle.emergency.mode == SHUTTLE_CALL || SSshuttle.emergency.mode == SHUTTLE_RECALL) - if(GLOB.security_level == SEC_LEVEL_GREEN) - SSshuttle.emergency.modTimer(0.25) - else - SSshuttle.emergency.modTimer(0.5) - else - minor_announce(config.alert_desc_red_downto, "Attention! Code red!") - GLOB.security_level = SEC_LEVEL_RED - for(var/mob/M in GLOB.player_list) - M << sound('sound/misc/voyalert.ogg') - - /* - At the time of commit, setting status displays didn't work properly - var/obj/machinery/computer/communications/CC = locate(/obj/machinery/computer/communications,world) - if(CC) - CC.post_status("alert", "redalert")*/ - - for(var/obj/machinery/firealarm/FA in GLOB.machines) - if(FA.z == ZLEVEL_STATION) - FA.update_icon() - for(var/obj/machinery/computer/shuttle/pod/pod in GLOB.machines) - pod.admin_controlled = 0 - if(SEC_LEVEL_DELTA) - minor_announce(config.alert_desc_delta, "Attention! Delta security level reached!",1) - if(SSshuttle.emergency.mode == SHUTTLE_CALL || SSshuttle.emergency.mode == SHUTTLE_RECALL) - if(GLOB.security_level == SEC_LEVEL_GREEN) - SSshuttle.emergency.modTimer(0.25) - else if(GLOB.security_level == SEC_LEVEL_BLUE) - SSshuttle.emergency.modTimer(0.5) - GLOB.security_level = SEC_LEVEL_DELTA - for(var/mob/M in GLOB.player_list) - M << sound('sound/misc/deltakalaxon.ogg') - for(var/obj/machinery/firealarm/FA in GLOB.machines) - if(FA.z == ZLEVEL_STATION) - FA.update_icon() - for(var/obj/machinery/computer/shuttle/pod/pod in GLOB.machines) - pod.admin_controlled = 0 - else - return - -/proc/get_security_level() - switch(GLOB.security_level) - if(SEC_LEVEL_GREEN) - return "green" - if(SEC_LEVEL_BLUE) - return "blue" - if(SEC_LEVEL_RED) - return "red" - if(SEC_LEVEL_DELTA) - return "delta" - -/proc/num2seclevel(num) - switch(num) - if(SEC_LEVEL_GREEN) - return "green" - if(SEC_LEVEL_BLUE) - return "blue" - if(SEC_LEVEL_RED) - return "red" - if(SEC_LEVEL_DELTA) - return "delta" - -/proc/seclevel2num(seclevel) - switch( lowertext(seclevel) ) - if("green") - return SEC_LEVEL_GREEN - if("blue") - return SEC_LEVEL_BLUE - if("red") - return SEC_LEVEL_RED - if("delta") - return SEC_LEVEL_DELTA - - -/*DEBUG -/mob/verb/set_thing0() - set_security_level(0) -/mob/verb/set_thing1() - set_security_level(1) -/mob/verb/set_thing2() - set_security_level(2) -/mob/verb/set_thing3() - set_security_level(3) -*/ -======= GLOBAL_VAR_INIT(security_level, 0) //0 = code green //1 = code blue @@ -262,4 +126,3 @@ GLOBAL_VAR_INIT(security_level, 0) /mob/verb/set_thing3() set_security_level(3) */ ->>>>>>> 10a3238... Makes the station Z level into a list instead of a single define (#30297) From aa09cd4785ab7759beae55c7f2875d1c59fc0e92 Mon Sep 17 00:00:00 2001 From: LetterJay Date: Wed, 13 Sep 2017 00:50:41 -0500 Subject: [PATCH 22/49] Update teleport.dm --- code/datums/helper_datums/teleport.dm | 422 +++++++++++++------------- 1 file changed, 213 insertions(+), 209 deletions(-) diff --git a/code/datums/helper_datums/teleport.dm b/code/datums/helper_datums/teleport.dm index cc461902ec..0eb76388ae 100644 --- a/code/datums/helper_datums/teleport.dm +++ b/code/datums/helper_datums/teleport.dm @@ -1,226 +1,230 @@ -SUBSYSTEM_DEF(persistence) - name = "Persistence" - init_order = INIT_ORDER_PERSISTENCE - flags = SS_NO_FIRE - var/list/satchel_blacklist = list() //this is a typecache - var/list/new_secret_satchels = list() //these are objects - var/list/old_secret_satchels = list() +//wrapper +/proc/do_teleport(ateleatom, adestination, aprecision=0, afteleport=1, aeffectin=null, aeffectout=null, asoundin=null, asoundout=null) + var/datum/teleport/instant/science/D = new + if(D.start(arglist(args))) + return 1 + return 0 - var/list/obj/structure/chisel_message/chisel_messages = list() - var/list/saved_messages = list() +/datum/teleport + var/atom/movable/teleatom //atom to teleport + var/atom/destination //destination to teleport to + var/precision = 0 //teleport precision + var/datum/effect_system/effectin //effect to show right before teleportation + var/datum/effect_system/effectout //effect to show right after teleportation + var/soundin //soundfile to play before teleportation + var/soundout //soundfile to play after teleportation + var/force_teleport = 1 //if false, teleport will use Move() proc (dense objects will prevent teleportation) - var/list/saved_trophies = list() +/datum/teleport/proc/start(ateleatom, adestination, aprecision=0, afteleport=1, aeffectin=null, aeffectout=null, asoundin=null, asoundout=null) + if(!initTeleport(arglist(args))) + return 0 + return 1 -/datum/controller/subsystem/persistence/Initialize() - LoadSatchels() - LoadPoly() - LoadChiselMessages() - LoadTrophies() +/datum/teleport/proc/initTeleport(ateleatom,adestination,aprecision,afteleport,aeffectin,aeffectout,asoundin,asoundout) + if(!setTeleatom(ateleatom)) + return 0 + if(!setDestination(adestination)) + return 0 + if(!setPrecision(aprecision)) + return 0 + setEffects(aeffectin,aeffectout) + setForceTeleport(afteleport) + setSounds(asoundin,asoundout) + return 1 + +//must succeed +/datum/teleport/proc/setPrecision(aprecision) + if(isnum(aprecision)) + precision = aprecision + return 1 + return 0 + +//must succeed +/datum/teleport/proc/setDestination(atom/adestination) + if(istype(adestination)) + destination = adestination + return 1 + return 0 + +//must succeed in most cases +/datum/teleport/proc/setTeleatom(atom/movable/ateleatom) + if(istype(ateleatom, /obj/effect) && !istype(ateleatom, /obj/effect/dummy/chameleon)) + qdel(ateleatom) + return 0 + if(istype(ateleatom)) + teleatom = ateleatom + return 1 + return 0 + +//custom effects must be properly set up first for instant-type teleports +//optional +/datum/teleport/proc/setEffects(datum/effect_system/aeffectin=null,datum/effect_system/aeffectout=null) + effectin = istype(aeffectin) ? aeffectin : null + effectout = istype(aeffectout) ? aeffectout : null + return 1 + +//optional +/datum/teleport/proc/setForceTeleport(afteleport) + force_teleport = afteleport + return 1 + +//optional +/datum/teleport/proc/setSounds(asoundin=null,asoundout=null) + soundin = isfile(asoundin) ? asoundin : null + soundout = isfile(asoundout) ? asoundout : null + return 1 + +//placeholder +/datum/teleport/proc/teleportChecks() + return 1 + +/datum/teleport/proc/playSpecials(atom/location,datum/effect_system/effect,sound) + if(location) + if(effect) + INVOKE_ASYNC(src, .proc/do_effect, location, effect) + if(sound) + INVOKE_ASYNC(src, .proc/do_sound, location, sound) + +/datum/teleport/proc/do_effect(atom/location, datum/effect_system/effect) + src = null + effect.attach(location) + effect.start() + +/datum/teleport/proc/do_sound(atom/location, sound) + src = null + playsound(location, sound, 60, 1) + +//do the monkey dance +/datum/teleport/proc/doTeleport() + + var/turf/destturf + var/turf/curturf = get_turf(teleatom) + destturf = get_teleport_turf(get_turf(destination), precision) + + if(!destturf || !curturf || destturf.is_transition_turf()) + return 0 + + var/area/A = get_area(curturf) + if(A.noteleport) + return 0 + + playSpecials(curturf,effectin,soundin) + if(force_teleport) + teleatom.forceMove(destturf) + if(ismegafauna(teleatom)) + message_admins("[teleatom] [ADMIN_FLW(teleatom)] has teleported from [ADMIN_COORDJMP(curturf)] to [ADMIN_COORDJMP(destturf)].") + playSpecials(destturf,effectout,soundout) + else + if(teleatom.Move(destturf)) + playSpecials(destturf,effectout,soundout) + if(ismegafauna(teleatom)) + message_admins("[teleatom] [ADMIN_FLW(teleatom)] has teleported from [ADMIN_COORDJMP(curturf)] to [ADMIN_COORDJMP(destturf)].") + return 1 + +/datum/teleport/proc/teleport() + if(teleportChecks()) + return doTeleport() + return 0 + +/datum/teleport/instant //teleports when datum is created + + start(ateleatom, adestination, aprecision=0, afteleport=1, aeffectin=null, aeffectout=null, asoundin=null, asoundout=null) + if(..()) + if(teleport()) + return 1 + return 0 + + +/datum/teleport/instant/science + +/datum/teleport/instant/science/setEffects(datum/effect_system/aeffectin,datum/effect_system/aeffectout) + if(aeffectin==null || aeffectout==null) + var/datum/effect_system/spark_spread/aeffect = new + aeffect.set_up(5, 1, teleatom) + effectin = effectin || aeffect + effectout = effectout || aeffect + return 1 + else + return ..() + +/datum/teleport/instant/science/setPrecision(aprecision) ..() + if(istype(teleatom, /obj/item/storage/backpack/holding)) + precision = rand(1,100) -/datum/controller/subsystem/persistence/proc/LoadSatchels() - var/placed_satchel = 0 - var/path - var/obj/item/storage/backpack/satchel/flat/F = new() - if(fexists("data/npc_saves/SecretSatchels.sav")) //legacy compatability to convert old format to new - var/savefile/secret_satchels = new /savefile("data/npc_saves/SecretSatchels.sav") - var/sav_text - secret_satchels[SSmapping.config.map_name] >> sav_text - fdel("data/npc_saves/SecretSatchels.sav") - if(sav_text) - old_secret_satchels = splittext(sav_text,"#") - if(old_secret_satchels.len >= 20) - var/satchel_string = pick_n_take(old_secret_satchels) - var/list/chosen_satchel = splittext(satchel_string,"|") - if(chosen_satchel.len == 3) - F.x = text2num(chosen_satchel[1]) - F.y = text2num(chosen_satchel[2]) - F.z = ZLEVEL_STATION_PRIMARY - path = text2path(chosen_satchel[3]) - else - var/json_file = file("data/npc_saves/SecretSatchels[SSmapping.config.map_name].json") - if(!fexists(json_file)) - return - var/list/json = list() - json = json_decode(file2text(json_file)) - old_secret_satchels = json["data"] - if(old_secret_satchels.len) - if(old_secret_satchels.len >= 20) //guards against low drop pools assuring that one player cannot reliably find his own gear. - var/pos = rand(1, old_secret_satchels.len) - old_secret_satchels.Cut(pos, pos+1) - F.x = old_secret_satchels[pos]["x"] - F.y = old_secret_satchels[pos]["y"] - F.z = ZLEVEL_STATION_PRIMARY - path = text2path(old_secret_satchels[pos]["saved_obj"]) - if(!ispath(path)) - return - if(isfloorturf(F.loc) && !istype(F.loc, /turf/open/floor/plating/)) - F.hide(1) - new path(F) - placed_satchel++ - var/list/free_satchels = list() - for(var/turf/T in shuffle(block(locate(TRANSITIONEDGE,TRANSITIONEDGE,ZLEVEL_STATION_PRIMARY), locate(world.maxx-TRANSITIONEDGE,world.maxy-TRANSITIONEDGE,ZLEVEL_STATION_PRIMARY)))) //Nontrivially expensive but it's roundstart only - if(isfloorturf(T) && !istype(T, /turf/open/floor/plating/)) - free_satchels += new /obj/item/storage/backpack/satchel/flat/secret(T) - if(!isemptylist(free_satchels) && ((free_satchels.len + placed_satchel) >= (50 - old_secret_satchels.len) * 0.1)) //up to six tiles, more than enough to kill anything that moves - break + var/list/bagholding = teleatom.search_contents_for(/obj/item/storage/backpack/holding) + if(bagholding.len) + precision = max(rand(1,100)*bagholding.len,100) + if(isliving(teleatom)) + var/mob/living/MM = teleatom + to_chat(MM, "The bluespace interface on your bag of holding interferes with the teleport!") + return 1 -/datum/controller/subsystem/persistence/proc/LoadPoly() - for(var/mob/living/simple_animal/parrot/Poly/P in GLOB.living_mob_list) - twitterize(P.speech_buffer, "polytalk") - break //Who's been duping the bird?! +// Safe location finder -/datum/controller/subsystem/persistence/proc/LoadChiselMessages() - var/list/saved_messages = list() - if(fexists("data/npc_saves/ChiselMessages.sav")) //legacy compatability to convert old format to new - var/savefile/chisel_messages_sav = new /savefile("data/npc_saves/ChiselMessages.sav") - var/saved_json - chisel_messages_sav[SSmapping.config.map_name] >> saved_json - if(!saved_json) - return - saved_messages = json_decode(saved_json) - fdel("data/npc_saves/ChiselMessages.sav") - else - var/json_file = file("data/npc_saves/ChiselMessages[SSmapping.config.map_name].json") - if(!fexists(json_file)) - return - var/list/json - json = json_decode(file2text(json_file)) +/proc/find_safe_turf(zlevel = ZLEVEL_STATION_PRIMARY, list/zlevels, extended_safety_checks = FALSE) + if(!zlevels) + zlevels = list(zlevel) + var/cycles = 1000 + for(var/cycle in 1 to cycles) + // DRUNK DIALLING WOOOOOOOOO + var/x = rand(1, world.maxx) + var/y = rand(1, world.maxy) + var/z = pick(zlevels) + var/random_location = locate(x,y,z) - if(!json) - return - saved_messages = json["data"] - - for(var/item in saved_messages) - if(!islist(item)) + if(!isfloorturf(random_location)) + continue + var/turf/open/floor/F = random_location + if(!F.air) continue - var/xvar = item["x"] - var/yvar = item["y"] - var/zvar = item["z"] - - if(!xvar || !yvar || !zvar) - continue - - var/turf/T = locate(xvar, yvar, zvar) - if(!isturf(T)) - continue - - if(locate(/obj/structure/chisel_message) in T) - continue - - var/obj/structure/chisel_message/M = new(T) - - if(!QDELETED(M)) - M.unpack(item) - - log_world("Loaded [saved_messages.len] engraved messages on map [SSmapping.config.map_name]") - -/datum/controller/subsystem/persistence/proc/LoadTrophies() - if(fexists("data/npc_saves/TrophyItems.sav")) //legacy compatability to convert old format to new - var/savefile/S = new /savefile("data/npc_saves/TrophyItems.sav") - var/saved_json - S >> saved_json - if(!saved_json) - return - saved_trophies = json_decode(saved_json) - fdel("data/npc_saves/TrophyItems.sav") - else - var/json_file = file("data/npc_saves/TrophyItems.json") - if(!fexists(json_file)) - return - var/list/json = list() - json = json_decode(file2text(json_file)) - if(!json) - return - saved_trophies = json["data"] - SetUpTrophies(saved_trophies.Copy()) - -/datum/controller/subsystem/persistence/proc/SetUpTrophies(list/trophy_items) - for(var/A in GLOB.trophy_cases) - var/obj/structure/displaycase/trophy/T = A - T.added_roundstart = TRUE - - var/trophy_data = pick_n_take(trophy_items) - - if(!islist(trophy_data)) - continue - - var/list/chosen_trophy = trophy_data - - if(!chosen_trophy || isemptylist(chosen_trophy)) //Malformed - continue - - var/path = text2path(chosen_trophy["path"]) //If the item no longer exist, this returns null - if(!path) - continue - - T.showpiece = new /obj/item/showpiece_dummy(T, path) - T.trophy_message = chosen_trophy["message"] - T.placer_key = chosen_trophy["placer_key"] - T.update_icon() - - -/datum/controller/subsystem/persistence/proc/CollectData() - CollectChiselMessages() - CollectSecretSatchels() - CollectTrophies() - -/datum/controller/subsystem/persistence/proc/CollectSecretSatchels() - var/list/satchels = list() - satchel_blacklist = typecacheof(list(/obj/item/stack/tile/plasteel, /obj/item/crowbar)) - for(var/A in new_secret_satchels) - var/obj/item/storage/backpack/satchel/flat/F = A - if(QDELETED(F) || F.z != ZLEVEL_STATION_PRIMARY || F.invisibility != INVISIBILITY_MAXIMUM) - continue - var/list/savable_obj = list() - for(var/obj/O in F) - if(is_type_in_typecache(O, satchel_blacklist) || O.admin_spawned) + var/datum/gas_mixture/A = F.air + var/list/A_gases = A.gases + var/trace_gases + for(var/id in A_gases) + if(id in GLOB.hardcoded_gases) continue - if(O.persistence_replacement) - savable_obj += O.persistence_replacement - else - savable_obj += O.type - if(isemptylist(savable_obj)) + trace_gases = TRUE + break + + // Can most things breathe? + if(trace_gases) + continue + if(!(A_gases["o2"] && A_gases["o2"][MOLES] >= 16)) + continue + if(A_gases["plasma"]) + continue + if(A_gases["co2"] && A_gases["co2"][MOLES] >= 10) continue - var/list/data = list() - data["x"] = F.x - data["y"] = F.y - data["saved_obj"] = pick(savable_obj) - satchels += list(data) - var/json_file = file("data/npc_saves/SecretSatchels[SSmapping.config.map_name].json") - var/list/file_data = list() - file_data["data"] = satchels - fdel(json_file) - WRITE_FILE(json_file, json_encode(file_data)) -/datum/controller/subsystem/persistence/proc/CollectChiselMessages() - var/json_file = file("data/npc_saves/ChiselMessages[SSmapping.config.map_name].json") + // Aim for goldilocks temperatures and pressure + if((A.temperature <= 270) || (A.temperature >= 360)) + continue + var/pressure = A.return_pressure() + if((pressure <= 20) || (pressure >= 550)) + continue - for(var/obj/structure/chisel_message/M in chisel_messages) - saved_messages += list(M.pack()) + if(extended_safety_checks) + if(istype(F, /turf/open/lava)) //chasms aren't /floor, and so are pre-filtered + var/turf/open/lava/L = F + if(!L.is_safe()) + continue - log_world("Saved [saved_messages.len] engraved messages on map [SSmapping.config.map_name]") - var/list/file_data = list() - file_data["data"] = saved_messages - fdel(json_file) - WRITE_FILE(json_file, json_encode(file_data)) + // DING! You have passed the gauntlet, and are "probably" safe. + return F -/datum/controller/subsystem/persistence/proc/SaveChiselMessage(obj/structure/chisel_message/M) - saved_messages += list(M.pack()) // dm eats one list +/proc/get_teleport_turfs(turf/center, precision = 0) + if(!precision) + return list(center) + var/list/posturfs = list() + for(var/turf/T in range(precision,center)) + if(T.is_transition_turf()) + continue // Avoid picking these. + var/area/A = T.loc + if(!A.noteleport) + posturfs.Add(T) + return posturfs - -/datum/controller/subsystem/persistence/proc/CollectTrophies() - var/json_file = file("data/npc_saves/TrophyItems.json") - var/list/file_data = list() - file_data["data"] = saved_trophies - fdel(json_file) - WRITE_FILE(json_file, json_encode(file_data)) - -/datum/controller/subsystem/persistence/proc/SaveTrophy(obj/structure/displaycase/trophy/T) - if(!T.added_roundstart && T.showpiece) - var/list/data = list() - data["path"] = T.showpiece.type - data["message"] = T.trophy_message - data["placer_key"] = T.placer_key - saved_trophies += list(data) +/proc/get_teleport_turf(turf/center, precision = 0) + return safepick(get_teleport_turfs(center, precision)) From 6b5fbc9bcd7833df70f76be73c236ce3cd5b78af Mon Sep 17 00:00:00 2001 From: LetterJay Date: Wed, 13 Sep 2017 03:49:32 -0500 Subject: [PATCH 23/49] Update one_click_antag.dm --- code/modules/admin/verbs/one_click_antag.dm | 37 --------------------- 1 file changed, 37 deletions(-) diff --git a/code/modules/admin/verbs/one_click_antag.dm b/code/modules/admin/verbs/one_click_antag.dm index e612e18fa8..e8ba7c8bab 100644 --- a/code/modules/admin/verbs/one_click_antag.dm +++ b/code/modules/admin/verbs/one_click_antag.dm @@ -357,43 +357,6 @@ return -/datum/admins/proc/makeGangsters() - - var/datum/game_mode/gang/temp = new - if(config.protect_roles_from_antagonist) - temp.restricted_jobs += temp.protected_jobs - - if(config.protect_assistant_from_antagonist) - temp.restricted_jobs += "Assistant" - - var/list/mob/living/carbon/human/candidates = list() - var/mob/living/carbon/human/H = null - - for(var/mob/living/carbon/human/applicant in GLOB.player_list) - if(ROLE_GANG in applicant.client.prefs.be_special) - var/turf/T = get_turf(applicant) - if(applicant.stat == CONSCIOUS && applicant.mind && !applicant.mind.special_role && T.z == ZLEVEL_STATION) - if(!jobban_isbanned(applicant, ROLE_GANG) && !jobban_isbanned(applicant, "Syndicate")) - if(temp.age_check(applicant.client)) - if(!(applicant.job in temp.restricted_jobs)) - candidates += applicant - - if(candidates.len >= 2) - for(var/needs_assigned=2,needs_assigned>0,needs_assigned--) - H = pick(candidates) - if(GLOB.gang_colors_pool.len) - var/datum/gang/newgang = new() - SSticker.mode.gangs += newgang - H.mind.make_Gang(newgang) - candidates.Remove(H) - else if(needs_assigned == 2) - return 0 - return 1 - - return 0 - - - /datum/admins/proc/makeOfficial() var/mission = input("Assign a task for the official", "Assign Task", "Conduct a routine preformance review of [station_name()] and its Captain.") var/list/mob/dead/observer/candidates = pollGhostCandidates("Do you wish to be considered to be a CentCom Official?", "deathsquad") From be15a300987c5a573f465cef3cca044c3f736e06 Mon Sep 17 00:00:00 2001 From: LetterJay Date: Wed, 13 Sep 2017 03:56:06 -0500 Subject: [PATCH 24/49] Update mapping.dm --- code/_globalvars/lists/mapping.dm | 90 +++++++++++++++++-------------- 1 file changed, 50 insertions(+), 40 deletions(-) diff --git a/code/_globalvars/lists/mapping.dm b/code/_globalvars/lists/mapping.dm index 3b6a7fad73..a2d30b1528 100644 --- a/code/_globalvars/lists/mapping.dm +++ b/code/_globalvars/lists/mapping.dm @@ -1,47 +1,57 @@ -/* -The /tg/ codebase currently requires you to have 11 z-levels of the same size dimensions. -z-level order is important, the order you put them in inside the map config.dm will determine what z level number they are assigned ingame. -Names of z-level do not matter, but order does greatly, for instances such as checking alive status of revheads on z1 +#define Z_NORTH 1 +#define Z_EAST 2 +#define Z_SOUTH 3 +#define Z_WEST 4 -current as of 2016/6/2 -z1 = station -z2 = centcom -z5 = mining -Everything else = randomized space -Last space-z level = empty -*/ +GLOBAL_LIST_INIT(cardinals, list(NORTH, SOUTH, EAST, WEST)) +GLOBAL_LIST_INIT(alldirs, list(NORTH, SOUTH, EAST, WEST, NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST)) +GLOBAL_LIST_INIT(diagonals, list(NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST)) -#define CROSSLINKED 2 -#define SELFLOOPING 1 -#define UNAFFECTED 0 +//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 +GLOBAL_LIST_INIT(accessable_z_levels, list(1,3,4,5,6,7)) //Keep this to six maps, repeating z-levels is ok if needed -#define MAIN_STATION "Main Station" -#define CENTCOM "CentCom" -#define EMPTY_AREA_1 "Empty Area 1" -#define EMPTY_AREA_2 "Empty Area 2" -#define MINING "Mining Asteroid" -#define EMPTY_AREA_3 "Empty Area 3" -#define EMPTY_AREA_4 "Empty Area 4" -#define EMPTY_AREA_5 "Empty Area 5" -#define EMPTY_AREA_6 "Empty Area 6" -#define EMPTY_AREA_7 "Empty Area 7" -#define EMPTY_AREA_8 "Empty Area 8" -#define AWAY_MISSION "Away Mission" +GLOBAL_LIST_INIT(station_z_levels, list(ZLEVEL_STATION_PRIMARY)) -//for modifying jobs -#define MAP_JOB_CHECK if(SSmapping.config.map_name != JOB_MODIFICATION_MAP_NAME) { return; } -#define MAP_JOB_CHECK_BASE if(SSmapping.config.map_name != JOB_MODIFICATION_MAP_NAME) { return ..(); } -#define MAP_REMOVE_JOB(jobpath) /datum/job/##jobpath/map_check() { return (SSmapping.config.map_name != JOB_MODIFICATION_MAP_NAME) && ..() } +GLOBAL_LIST(global_map) + //list/global_map = list(list(1,5),list(4,3))//an array of map Z levels. + //Resulting sector map looks like + //|_1_|_4_| + //|_5_|_3_| + // + //1 - SS13 + //4 - Derelict + //3 - AI satellite + //5 - empty space -//zlevel defines, can be overridden for different maps in the appropriate _maps file. -#define ZLEVEL_CENTCOM 1 -#define ZLEVEL_STATION_PRIMARY 2 -#define ZLEVEL_MINING 5 -#define ZLEVEL_LAVALAND 5 -#define ZLEVEL_EMPTY_SPACE 12 -#define ZLEVEL_TRANSIT 11 +GLOBAL_LIST_EMPTY(landmarks_list) //list of all landmarks created +GLOBAL_LIST_EMPTY(start_landmarks_list) //list of all spawn points created +GLOBAL_LIST_EMPTY(department_security_spawns) //list of all department security spawns +GLOBAL_LIST_EMPTY(generic_event_spawns) //list of all spawns for events -#define ZLEVEL_SPACEMIN 3 -#define ZLEVEL_SPACEMAX 12 +GLOBAL_LIST_EMPTY(wizardstart) +GLOBAL_LIST_EMPTY(newplayer_start) +GLOBAL_LIST_EMPTY(prisonwarp) //prisoners go to these +GLOBAL_LIST_EMPTY(holdingfacility) //captured people go here +GLOBAL_LIST_EMPTY(xeno_spawn)//Aliens spawn at these. +GLOBAL_LIST_EMPTY(tdome1) +GLOBAL_LIST_EMPTY(tdome2) +GLOBAL_LIST_EMPTY(tdomeobserve) +GLOBAL_LIST_EMPTY(tdomeadmin) +GLOBAL_LIST_EMPTY(prisonwarped) //list of players already warped +GLOBAL_LIST_EMPTY(blobstart) +GLOBAL_LIST_EMPTY(secequipment) +GLOBAL_LIST_EMPTY(deathsquadspawn) +GLOBAL_LIST_EMPTY(emergencyresponseteamspawn) +GLOBAL_LIST_EMPTY(ruin_landmarks) -#define SPACERUIN_MAP_EDGE_PAD 15 + //away missions +GLOBAL_LIST_EMPTY(awaydestinations) //a list of landmarks that the warpgate can take you to + + //used by jump-to-area etc. Updated by area/updateName() +GLOBAL_LIST_EMPTY(sortedAreas) + +GLOBAL_LIST_EMPTY(all_abstract_markers) From 470d15fa2bd6aef85a06e52e461d5c0ee6f30a49 Mon Sep 17 00:00:00 2001 From: LetterJay Date: Wed, 13 Sep 2017 07:13:45 -0500 Subject: [PATCH 25/49] Update borer_event.dm --- code/game/gamemodes/miniantags/borer/borer_event.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/gamemodes/miniantags/borer/borer_event.dm b/code/game/gamemodes/miniantags/borer/borer_event.dm index 7d74a065aa..6875a97db5 100644 --- a/code/game/gamemodes/miniantags/borer/borer_event.dm +++ b/code/game/gamemodes/miniantags/borer/borer_event.dm @@ -26,7 +26,7 @@ for(var/obj/machinery/atmospherics/components/unary/vent_pump/temp_vent in GLOB.machines) if(QDELETED(temp_vent)) continue - if(temp_vent.loc.z == ZLEVEL_STATION && !temp_vent.welded) + if(temp_vent.loc.z == ZLEVEL_STATION_PRIMARY && !temp_vent.welded) var/datum/pipeline/temp_vent_parent = temp_vent.PARENT1 if(temp_vent_parent.other_atmosmch.len > 20) vents += temp_vent From 4da91bc330c976fe0353cf949b860e87d90302b9 Mon Sep 17 00:00:00 2001 From: CitadelStationBot Date: Wed, 13 Sep 2017 16:53:30 -0500 Subject: [PATCH 26/49] [MIRROR] Fixes Archaeology not working (#2744) * Fixes Archaeology not working (#30547) * gg * fixes that other issue * ok * okie dokie * removes this devil * Fixes Archaeology not working --- code/_onclick/item_attack.dm | 2 +- code/datums/components/archaeology.dm | 4 ++-- code/game/turfs/simulated/floor/plating.dm | 4 +--- code/game/turfs/simulated/floor/plating/asteroid.dm | 6 ++++++ 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/code/_onclick/item_attack.dm b/code/_onclick/item_attack.dm index f1ac1af1af..5265a8e8ea 100644 --- a/code/_onclick/item_attack.dm +++ b/code/_onclick/item_attack.dm @@ -21,7 +21,7 @@ /obj/attackby(obj/item/I, mob/living/user, params) return I.attack_obj(src, user) -/mob/living/attackby(obj/item/I, mob/user, params) +/mob/living/attackby(obj/item/I, mob/living/user, params) user.changeNext_move(CLICK_CD_MELEE) if(user.a_intent == INTENT_HARM && stat == DEAD && butcher_results) //can we butcher it? var/sharpness = I.is_sharp() diff --git a/code/datums/components/archaeology.dm b/code/datums/components/archaeology.dm index 22a6b24bc4..7c61613c41 100644 --- a/code/datums/components/archaeology.dm +++ b/code/datums/components/archaeology.dm @@ -17,7 +17,7 @@ for(var/I in other_archdrops) _archdrops[I] += other_archdrops[I] -/datum/component/archaeology/proc/Dig(mob/user, obj/item/W) +/datum/component/archaeology/proc/Dig(obj/item/W, mob/living/user) if(dug) to_chat(user, "Looks like someone has dug here already.") return FALSE @@ -63,7 +63,7 @@ if(isplatingturf(OT)) var/turf/open/floor/plating/POT = parent POT.icon_plating = "[POT.postdig_icon]" - OT.icon_state = "[OT.postdig_icon]" + POT.icon_state = "[OT.postdig_icon]" if(OT.slowdown) //Things like snow slow you down until you dig them. OT.slowdown = 0 diff --git a/code/game/turfs/simulated/floor/plating.dm b/code/game/turfs/simulated/floor/plating.dm index a03caadd19..3617759e99 100644 --- a/code/game/turfs/simulated/floor/plating.dm +++ b/code/game/turfs/simulated/floor/plating.dm @@ -6,13 +6,11 @@ * Engine floor * Foam plating */ -// note that plating and engine floor do not call their parent attackby, unlike other flooring -// this is done in order to avoid inheriting the crowbar attackby /turf/open/floor/plating name = "plating" icon_state = "plating" - intact = 0 + intact = FALSE /turf/open/floor/plating/Initialize() if (!broken_states) diff --git a/code/game/turfs/simulated/floor/plating/asteroid.dm b/code/game/turfs/simulated/floor/plating/asteroid.dm index 57c64d2350..2649a3a14d 100644 --- a/code/game/turfs/simulated/floor/plating/asteroid.dm +++ b/code/game/turfs/simulated/floor/plating/asteroid.dm @@ -35,6 +35,8 @@ return /turf/open/floor/plating/asteroid/attackby(obj/item/W, mob/user, params) + if(..()) + return TRUE if(istype(W, /obj/item/storage/bag/ore)) var/obj/item/storage/bag/ore/S = W if(S.collection_mode == 1) @@ -62,6 +64,10 @@ return ..() ChangeTurf(/turf/open/space) +/turf/open/floor/plating/asteroid/ex_act(severity, target) + . = SendSignal(COMSIG_ATOM_EX_ACT, severity, target) + contents_explosion(severity, target) + /turf/open/floor/plating/asteroid/basalt name = "volcanic floor" From 1c06a2b2773064474b0ab723ddd0fdfd2c11cbd3 Mon Sep 17 00:00:00 2001 From: CitadelStationBot Date: Wed, 13 Sep 2017 16:53:52 -0500 Subject: [PATCH 27/49] [MIRROR] Fixes goliath tentacles (#2738) * Merge pull request #30646 from ChangelingRain/tentafix Fixes goliath tentacles * Fixes goliath tentacles --- .../mob/living/simple_animal/hostile/mining_mobs/goliath.dm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs/goliath.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs/goliath.dm index 12388807ba..de995f951a 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining_mobs/goliath.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs/goliath.dm @@ -146,8 +146,9 @@ /obj/effect/temp_visual/goliath_tentacle/Initialize(mapload, mob/living/new_spawner) . = ..() - if(locate(/obj/effect/temp_visual/goliath_tentacle) in loc) - return INITIALIZE_HINT_QDEL + for(var/obj/effect/temp_visual/goliath_tentacle/T in loc) + if(T != src) + return INITIALIZE_HINT_QDEL if(!QDELETED(new_spawner)) spawner = new_spawner if(ismineralturf(loc)) From abe52f40a6deb554a325c854032a604fee424113 Mon Sep 17 00:00:00 2001 From: CitadelStationBot Date: Wed, 13 Sep 2017 16:55:00 -0500 Subject: [PATCH 28/49] [MIRROR] Fix transit tube atmos (again) (#2736) * Fix transit tube atmos (again) (#30597) * Fix transit tube atmos * transit tube Initialize() * Fix transit tube atmos (again) --- code/game/objects/structures/transit_tubes/station.dm | 5 ++++- .../objects/structures/transit_tubes/transit_tube_pod.dm | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/code/game/objects/structures/transit_tubes/station.dm b/code/game/objects/structures/transit_tubes/station.dm index 9662f0c0e3..ffc62ac127 100644 --- a/code/game/objects/structures/transit_tubes/station.dm +++ b/code/game/objects/structures/transit_tubes/station.dm @@ -147,8 +147,11 @@ sleep(OPEN_DURATION + 2) pod_moving = 0 if(!QDELETED(pod)) + var/datum/gas_mixture/floor_mixture = loc.return_air() + floor_mixture.archive() pod.air_contents.archive() - pod.air_contents.share(loc.return_air(), 1) //mix the pod's gas mixture with the tile it's on + pod.air_contents.share(floor_mixture, 1) //mix the pod's gas mixture with the tile it's on + air_update_turf() /obj/structure/transit_tube/station/init_tube_dirs() switch(dir) diff --git a/code/game/objects/structures/transit_tubes/transit_tube_pod.dm b/code/game/objects/structures/transit_tubes/transit_tube_pod.dm index 43394f01c9..1cf8e330fe 100644 --- a/code/game/objects/structures/transit_tubes/transit_tube_pod.dm +++ b/code/game/objects/structures/transit_tubes/transit_tube_pod.dm @@ -9,9 +9,9 @@ var/datum/gas_mixture/air_contents = new() -/obj/structure/transit_tube_pod/New(loc) - ..() - air_contents.assert_gases("o2", "n2") +/obj/structure/transit_tube_pod/Initialize() + . = ..() + air_contents.add_gases("o2", "n2") air_contents.gases["o2"][MOLES] = MOLES_O2STANDARD air_contents.gases["n2"][MOLES] = MOLES_N2STANDARD air_contents.temperature = T20C From 63ebf08a0ddb9a15b94975c0c0daef97c8a5a67f Mon Sep 17 00:00:00 2001 From: CitadelStationBot Date: Wed, 13 Sep 2017 16:56:30 -0500 Subject: [PATCH 29/49] [MIRROR] Adds shovels to the golem ship (#2742) * Adds shovels to the golem ship * Adds shovels to the golem ship --- _maps/RandomRuins/LavaRuins/lavaland_surface_golem_ship.dmm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/_maps/RandomRuins/LavaRuins/lavaland_surface_golem_ship.dmm b/_maps/RandomRuins/LavaRuins/lavaland_surface_golem_ship.dmm index eba45a14bf..3b4e4ce09e 100644 --- a/_maps/RandomRuins/LavaRuins/lavaland_surface_golem_ship.dmm +++ b/_maps/RandomRuins/LavaRuins/lavaland_surface_golem_ship.dmm @@ -7,6 +7,9 @@ /area/ruin/powered/golem_ship) "c" = ( /obj/structure/closet/crate, +/obj/item/shovel, +/obj/item/shovel, +/obj/item/shovel, /obj/item/pickaxe, /obj/item/pickaxe, /obj/item/pickaxe, @@ -19,6 +22,8 @@ /area/ruin/powered/golem_ship) "d" = ( /obj/structure/closet/crate, +/obj/item/shovel, +/obj/item/shovel, /obj/item/pickaxe, /obj/item/pickaxe, /obj/item/storage/bag/ore, From f6dfc177f531e4992f4f6906be01f5fe7d1cf58b Mon Sep 17 00:00:00 2001 From: CitadelStationBot Date: Wed, 13 Sep 2017 17:56:54 -0500 Subject: [PATCH 30/49] [MIRROR] It's oranges (#2486) * It's oranges * thanks oranges --- code/modules/hydroponics/grown/citrus.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/hydroponics/grown/citrus.dm b/code/modules/hydroponics/grown/citrus.dm index 76401da535..2abbab0f29 100644 --- a/code/modules/hydroponics/grown/citrus.dm +++ b/code/modules/hydroponics/grown/citrus.dm @@ -53,7 +53,7 @@ /obj/item/reagent_containers/food/snacks/grown/citrus/orange seed = /obj/item/seeds/orange name = "orange" - desc = "It's an tangy fruit." + desc = "It's a tangy fruit." icon_state = "orange" filling_color = "#FFA500" From 083fc1a7b44d86f9e442903d7376bfb1f39e8873 Mon Sep 17 00:00:00 2001 From: CitadelStationBot Date: Wed, 13 Sep 2017 17:57:16 -0500 Subject: [PATCH 31/49] [MIRROR] Standardized power displays (#2539) * Standardized power displays * Update tgui.js * Delete tgui.js.rej --- .../clock_cult/clock_effects/clock_sigils.dm | 6 ++-- .../clock_helpers/fabrication_helpers.dm | 2 +- .../clock_cult/clock_items/clockwork_slab.dm | 2 +- .../clock_items/replica_fabricator.dm | 20 ++++++------- .../gamemodes/clock_cult/clock_structure.dm | 2 +- .../clock_structures/clockwork_obelisk.dm | 2 +- .../clock_structures/mania_motor.dm | 2 +- .../clock_structures/tinkerers_daemon.dm | 4 +-- code/game/machinery/computer/apc_control.dm | 2 +- code/game/objects/items/devices/PDA/cart.dm | 4 +-- code/game/objects/items/inducer.dm | 2 +- .../file_system/programs/powermonitor.dm | 6 ++-- code/modules/power/antimatter/control.dm | 2 +- code/modules/power/apc.dm | 8 +++--- code/modules/power/cable.dm | 2 +- code/modules/power/generator.dm | 18 ++++-------- code/modules/power/monitor.dm | 6 ++-- code/modules/power/port_gen.dm | 2 +- code/modules/power/smes.dm | 6 ++-- code/modules/power/turbine.dm | 4 +-- tgui/assets/tgui.js | 28 +++++++++---------- tgui/src/interfaces/apc.ract | 4 +-- tgui/src/interfaces/ntos_power_monitor.ract | 6 ++-- tgui/src/interfaces/power_monitor.ract | 6 ++-- tgui/src/interfaces/smes.ract | 8 +++--- 25 files changed, 75 insertions(+), 79 deletions(-) diff --git a/code/game/gamemodes/clock_cult/clock_effects/clock_sigils.dm b/code/game/gamemodes/clock_cult/clock_effects/clock_sigils.dm index 507c673921..d607adb37f 100644 --- a/code/game/gamemodes/clock_cult/clock_effects/clock_sigils.dm +++ b/code/game/gamemodes/clock_cult/clock_effects/clock_sigils.dm @@ -193,13 +193,13 @@ var/structure_number = 0 for(var/obj/structure/destructible/clockwork/powered/P in range(SIGIL_ACCESS_RANGE, src)) structure_number++ - to_chat(user, "It is storing [GLOB.ratvar_awakens ? "INFINITY":"[power_charge]"]W of power, \ + to_chat(user, "It is storing [GLOB.ratvar_awakens ? "INFINITE":"[DisplayPower(power_charge)] of"] power, \ and [structure_number] Clockwork Structure[structure_number == 1 ? " is":"s are"] in range.") to_chat(user, "While active, it will gradually drain power from nearby electronics. It is currently [isprocessing ? "active":"disabled"].") if(iscyborg(user)) to_chat(user, "You can recharge from the [sigil_name] by crossing it.") else if(!GLOB.ratvar_awakens) - to_chat(user, "Hitting the [sigil_name] with brass sheets will convert them to power at a rate of 1 brass sheet to [POWER_FLOOR]W power.") + to_chat(user, "Hitting the [sigil_name] with brass sheets will convert them to power at a rate of 1 brass sheet to [DisplayPower(POWER_FLOOR)] power.") if(!GLOB.ratvar_awakens) to_chat(user, "You can recharge Replica Fabricators from the [sigil_name].") @@ -207,7 +207,7 @@ if(is_servant_of_ratvar(user) && istype(I, /obj/item/stack/tile/brass) && !GLOB.ratvar_awakens) var/obj/item/stack/tile/brass/B = I user.visible_message("[user] places [B] on [src], causing it to disintegrate into glowing orange energy!", \ - "You charge the [sigil_name] with [B], providing it with [B.amount * POWER_FLOOR]W of power.") + "You charge the [sigil_name] with [B], providing it with [DisplayPower(B.amount * POWER_FLOOR)] of power.") modify_charge(-(B.amount * POWER_FLOOR)) playsound(src, 'sound/effects/light_flicker.ogg', (B.amount * POWER_FLOOR) * 0.01, 1) qdel(B) diff --git a/code/game/gamemodes/clock_cult/clock_helpers/fabrication_helpers.dm b/code/game/gamemodes/clock_cult/clock_helpers/fabrication_helpers.dm index 18c8103eef..a4409cf22c 100644 --- a/code/game/gamemodes/clock_cult/clock_helpers/fabrication_helpers.dm +++ b/code/game/gamemodes/clock_cult/clock_helpers/fabrication_helpers.dm @@ -269,7 +269,7 @@ fabricator.recharging = null if(user) user.visible_message("[user]'s [fabricator.name] stops draining glowing orange energy from [src].", \ - "You finish recharging your [fabricator.name]. It now contains [fabricator.get_power()]W/[fabricator.get_max_power()]W power.") + "You finish recharging your [fabricator.name]. It now contains [DisplayPower(fabricator.get_power())]/[DisplayPower(fabricator.get_max_power())] power.") //Fabricator mob heal proc, to avoid as much copypaste as possible. /mob/living/proc/fabricator_heal(mob/living/user, obj/item/clockwork/replica_fabricator/fabricator) diff --git a/code/game/gamemodes/clock_cult/clock_items/clockwork_slab.dm b/code/game/gamemodes/clock_cult/clock_items/clockwork_slab.dm index 343f2e70e7..eecfec7780 100644 --- a/code/game/gamemodes/clock_cult/clock_items/clockwork_slab.dm +++ b/code/game/gamemodes/clock_cult/clock_items/clockwork_slab.dm @@ -500,7 +500,7 @@ anything but a last resort. Instead, it is recommended that a Sigil of Transmission is created. This sigil serves as both battery and power generator for nearby clockwork \ structures, and those structures will happily draw power from the sigil before they resort to APCs.

" dat += "Generating power is less easy. The most reliable and efficient way is using brass sheets; attacking a sigil of transmission with brass sheets will convert them \ - to power, at a rate of [POWER_FLOOR]W per sheet. (Brass sheets are created from replica fabricators, which are explained more in detail in the Conversion section.) \ + to power, at a rate of [DisplayPower(POWER_FLOOR)] per sheet. (Brass sheets are created from replica fabricators, which are explained more in detail in the Conversion section.) \ Activating a sigil of transmission will also cause it to drain power from the nearby area, which, while effective, serves as an obvious tell that there is something wrong.

" dat += "Without power, many structures will not function, making a base vulnerable to attack. For this reason, it is critical that you keep an eye on your power reserves and \ ensure that they remain comfortably high.

" diff --git a/code/game/gamemodes/clock_cult/clock_items/replica_fabricator.dm b/code/game/gamemodes/clock_cult/clock_items/replica_fabricator.dm index a99e74982a..bd356982b5 100644 --- a/code/game/gamemodes/clock_cult/clock_items/replica_fabricator.dm +++ b/code/game/gamemodes/clock_cult/clock_items/replica_fabricator.dm @@ -126,22 +126,22 @@ to_chat(user, "Can be used to replace walls, floors, tables, windows, windoors, and airlocks with Clockwork variants.") to_chat(user, "Can construct Clockwork Walls on Clockwork Floors and deconstruct Clockwork Walls to Clockwork Floors.") if(uses_power) - to_chat(user, "It can consume floor tiles, rods, metal, and plasteel for power at rates of 2:[POWER_ROD]W, 1:[POWER_ROD]W, 1:[POWER_METAL]W, \ - and 1:[POWER_PLASTEEL]W, respectively.") - to_chat(user, "It can also consume brass sheets for power at a rate of 1:[POWER_FLOOR]W.") - to_chat(user, "It is storing [get_power()]W/[get_max_power()]W of power[charge_rate ? ", and is gaining [charge_rate*0.5]W of power per second":""].") - to_chat(user, "Use it in-hand to produce 5 brass sheets at a cost of [POWER_WALL_TOTAL]W power.") + to_chat(user, "It can consume floor tiles, rods, metal, and plasteel for power at rates of 2:[DisplayPower(POWER_ROD)], 1:[DisplayPower(POWER_ROD)], 1:[DisplayPower(POWER_METAL)], \ + and 1:[DisplayPower(POWER_PLASTEEL)], respectively.") + to_chat(user, "It can also consume brass sheets for power at a rate of 1:[DisplayPower(POWER_FLOOR)].") + to_chat(user, "It is storing [DisplayPower(get_power())]/[DisplayPower(get_max_power())] of power[charge_rate ? ", and is gaining [DisplayPower(charge_rate*0.5)] of power per second":""].") + to_chat(user, "Use it in-hand to produce 5 brass sheets at a cost of [DisplayPower(POWER_WALL_TOTAL)] power.") /obj/item/clockwork/replica_fabricator/attack_self(mob/living/user) if(is_servant_of_ratvar(user)) if(uses_power) if(!can_use_power(POWER_WALL_TOTAL)) - to_chat(user, "[src] requires [POWER_WALL_TOTAL]W of power to produce brass sheets!") + to_chat(user, "[src] requires [DisplayPower(POWER_WALL_TOTAL)] of power to produce brass sheets!") return modify_stored_power(-POWER_WALL_TOTAL) playsound(src, 'sound/items/deconstruct.ogg', 50, 1) new/obj/item/stack/tile/brass(user.loc, 5) - to_chat(user, "You use [stored_power ? "some":"all"] of [src]'s power to produce 5 brass sheets. It now stores [get_power()]W/[get_max_power()]W of power.") + to_chat(user, "You use [stored_power ? "some":"all"] of [src]'s power to produce 5 brass sheets. It now stores [DisplayPower(get_power())]/[DisplayPower(get_max_power())] of power.") /obj/item/clockwork/replica_fabricator/pre_attackby(atom/target, mob/living/user, params) if(!target || !user || !is_servant_of_ratvar(user) || istype(target, /obj/item/storage)) @@ -276,7 +276,7 @@ if(!silent) var/atom/A = fabrication_values["new_obj_type"] if(A) - to_chat(user, "You need [fabrication_values["power_cost"]]W power to fabricate \a [initial(A.name)] from [target]!") + to_chat(user, "You need [DisplayPower(fabrication_values["power_cost"])] power to fabricate \a [initial(A.name)] from [target]!") else if(stored_power - fabrication_values["power_cost"] > max_power) if(!silent) var/atom/A = fabrication_values["new_obj_type"] @@ -323,8 +323,8 @@ repair_values["power_required"] = round(repair_values["healing_for_cycle"]*MIN_CLOCKCULT_POWER, MIN_CLOCKCULT_POWER) //and get the power cost from that if(!can_use_power(RATVAR_POWER_CHECK) && !can_use_power(repair_values["power_required"])) if(!silent) - to_chat(user, "You need at least [repair_values["power_required"]]W power to start repairin[target == user ? "g yourself" : "g [target]"], and at least \ - [round(repair_values["amount_to_heal"]*MIN_CLOCKCULT_POWER, MIN_CLOCKCULT_POWER)]W to fully repair [target == user ? "yourself" : "[target.p_them()]"]!") + to_chat(user, "You need at least [DisplayPower(repair_values["power_required"])] power to start repairin[target == user ? "g yourself" : "g [target]"], and at least \ + [DisplayPower(repair_values["amount_to_heal"]*MIN_CLOCKCULT_POWER, MIN_CLOCKCULT_POWER)] to fully repair [target == user ? "yourself" : "[target.p_them()]"]!") return FALSE return TRUE diff --git a/code/game/gamemodes/clock_cult/clock_structure.dm b/code/game/gamemodes/clock_cult/clock_structure.dm index 0c29361e59..1da3053605 100644 --- a/code/game/gamemodes/clock_cult/clock_structure.dm +++ b/code/game/gamemodes/clock_cult/clock_structure.dm @@ -160,7 +160,7 @@ if(is_servant_of_ratvar(user) || isobserver(user)) var/powered = total_accessable_power() var/sigil_number = LAZYLEN(check_apc_and_sigils()) - to_chat(user, "It has access to [powered == INFINITY ? "INFINITY":"[powered]"]W of power, \ + to_chat(user, "It has access to [powered == INFINITY ? "INFINITE":"[DisplayPower(powered)] of"] power, \ and [sigil_number] Sigil[sigil_number == 1 ? "":"s"] of Transmission [sigil_number == 1 ? "is":"are"] in range.") /obj/structure/destructible/clockwork/powered/Destroy() diff --git a/code/game/gamemodes/clock_cult/clock_structures/clockwork_obelisk.dm b/code/game/gamemodes/clock_cult/clock_structures/clockwork_obelisk.dm index 4df615450f..de6b058b78 100644 --- a/code/game/gamemodes/clock_cult/clock_structures/clockwork_obelisk.dm +++ b/code/game/gamemodes/clock_cult/clock_structures/clockwork_obelisk.dm @@ -23,7 +23,7 @@ /obj/structure/destructible/clockwork/powered/clockwork_obelisk/examine(mob/user) ..() if(is_servant_of_ratvar(user) || isobserver(user)) - to_chat(user, "It requires [hierophant_cost]W to broadcast over the Hierophant Network, and [gateway_cost]W to open a Spatial Gateway.") + to_chat(user, "It requires [DisplayPower(hierophant_cost)] to broadcast over the Hierophant Network, and [DisplayPower(gateway_cost)] to open a Spatial Gateway.") /obj/structure/destructible/clockwork/powered/clockwork_obelisk/can_be_unfasten_wrench(mob/user, silent) if(active) diff --git a/code/game/gamemodes/clock_cult/clock_structures/mania_motor.dm b/code/game/gamemodes/clock_cult/clock_structures/mania_motor.dm index 732897fda4..23a50fdd4c 100644 --- a/code/game/gamemodes/clock_cult/clock_structures/mania_motor.dm +++ b/code/game/gamemodes/clock_cult/clock_structures/mania_motor.dm @@ -19,7 +19,7 @@ /obj/structure/destructible/clockwork/powered/mania_motor/examine(mob/user) ..() if(is_servant_of_ratvar(user) || isobserver(user)) - to_chat(user, "It requires [mania_cost]W to run.") + to_chat(user, "It requires [DisplayPower(mania_cost)] to run.") /obj/structure/destructible/clockwork/powered/mania_motor/forced_disable(bad_effects) if(active) diff --git a/code/game/gamemodes/clock_cult/clock_structures/tinkerers_daemon.dm b/code/game/gamemodes/clock_cult/clock_structures/tinkerers_daemon.dm index 079fd081fe..4ceb7c3e26 100644 --- a/code/game/gamemodes/clock_cult/clock_structures/tinkerers_daemon.dm +++ b/code/game/gamemodes/clock_cult/clock_structures/tinkerers_daemon.dm @@ -33,7 +33,7 @@ to_chat(user, "It is currently producing random components.") to_chat(user, "It will produce a component every [round((production_cooldown*0.1) * get_efficiency_mod(TRUE), 0.1)] seconds and requires at least the following power for each component type:") for(var/i in GLOB.clockwork_component_cache) - to_chat(user, "[get_component_icon(i)] [get_component_name(i)]: [get_component_cost(i)]W ([GLOB.clockwork_component_cache[i]] exist[GLOB.clockwork_component_cache[i] == 1 ? "s" : ""])") + to_chat(user, "[get_component_icon(i)] [get_component_name(i)]: [DisplayPower(get_component_cost(i))] ([GLOB.clockwork_component_cache[i]] exist[GLOB.clockwork_component_cache[i] == 1 ? "s" : ""])") /obj/structure/destructible/clockwork/powered/tinkerers_daemon/forced_disable(bad_effects) if(active) @@ -80,7 +80,7 @@ if("Specific Component") var/list/components = list() for(var/i in GLOB.clockwork_component_cache) - components["[get_component_name(i)] ([get_component_cost(i)]W)"] = i + components["[get_component_name(i)] ([DisplayPower(get_component_cost(i))])"] = i var/input_component = input(user, "Choose a component type.", name) as null|anything in components component_id_to_produce = components[input_component] servants = 0 diff --git a/code/game/machinery/computer/apc_control.dm b/code/game/machinery/computer/apc_control.dm index 8b3e946501..c93c96429c 100644 --- a/code/game/machinery/computer/apc_control.dm +++ b/code/game/machinery/computer/apc_control.dm @@ -66,7 +66,7 @@ if(filters["Responsive"] && !APC.aidisabled) continue dat += "[A]
\ - Charge: [APC.cell.charge] / [APC.cell.maxcharge] W ([round((APC.cell.charge / APC.cell.maxcharge) * 100)]%)
\ + Charge: [DisplayPower(APC.cell.charge)] / [DisplayPower(APC.cell.maxcharge)] ([round((APC.cell.charge / APC.cell.maxcharge) * 100)]%)
\ Area: [APC.area]
\ [APC.aidisabled || APC.panel_open ? "APC does not respond to interface query." : "APC responds to interface query."]

" dat += "Check Logs
" diff --git a/code/game/objects/items/devices/PDA/cart.dm b/code/game/objects/items/devices/PDA/cart.dm index 3934134663..fe2acd6948 100644 --- a/code/game/objects/items/devices/PDA/cart.dm +++ b/code/game/objects/items/devices/PDA/cart.dm @@ -302,7 +302,7 @@ Code: var/obj/machinery/power/apc/A = term.master L += A - menu += "
Total power: [powmonitor.attached.powernet.viewavail] W
Total load: [num2text(powmonitor.attached.powernet.viewload,10)] W
" + menu += "
Total power: [DisplayPower(powmonitor.attached.powernet.viewavail)]
Total load: [DisplayPower(powmonitor.attached.powernet.viewload)]
" menu += "" @@ -314,7 +314,7 @@ Code: for(var/obj/machinery/power/apc/A in L) menu += copytext(add_tspace(A.area.name, 30), 1, 30) - menu += " [S[A.equipment+1]] [S[A.lighting+1]] [S[A.environ+1]] [add_lspace(A.lastused_total, 6)] [A.cell ? "[add_lspace(round(A.cell.percent()), 3)]% [chg[A.charging+1]]" : " N/C"]
" + menu += " [S[A.equipment+1]] [S[A.lighting+1]] [S[A.environ+1]] [add_lspace(DisplayPower(A.lastused_total), 6)] [A.cell ? "[add_lspace(round(A.cell.percent()), 3)]% [chg[A.charging+1]]" : " N/C"]
" menu += "
" diff --git a/code/game/objects/items/inducer.dm b/code/game/objects/items/inducer.dm index bc97925c00..a0a493530b 100644 --- a/code/game/objects/items/inducer.dm +++ b/code/game/objects/items/inducer.dm @@ -157,7 +157,7 @@ /obj/item/inducer/examine(mob/living/M) ..() if(cell) - to_chat(M, "It's display shows: [cell.charge]W") + to_chat(M, "It's display shows: [DisplayPower(cell.charge)]") else to_chat(M,"It's display is dark.") if(opened) diff --git a/code/modules/modular_computers/file_system/programs/powermonitor.dm b/code/modules/modular_computers/file_system/programs/powermonitor.dm index b334f523f7..37b2b0c151 100644 --- a/code/modules/modular_computers/file_system/programs/powermonitor.dm +++ b/code/modules/modular_computers/file_system/programs/powermonitor.dm @@ -58,8 +58,8 @@ data["interval"] = record_interval / 10 data["attached"] = attached ? TRUE : FALSE if(attached) - data["supply"] = attached.powernet.viewavail - data["demand"] = attached.powernet.viewload + data["supply"] = DisplayPower(attached.powernet.viewavail) + data["demand"] = DisplayPower(attached.powernet.viewload) data["history"] = history data["areas"] = list() @@ -70,7 +70,7 @@ data["areas"] += list(list( "name" = A.area.name, "charge" = A.cell ? A.cell.percent() : 0, - "load" = A.lastused_total, + "load" = DisplayPower(A.lastused_total), "charging" = A.charging, "eqp" = A.equipment, "lgt" = A.lighting, diff --git a/code/modules/power/antimatter/control.dm b/code/modules/power/antimatter/control.dm index 85ae6edf14..7863f6a52f 100644 --- a/code/modules/power/antimatter/control.dm +++ b/code/modules/power/antimatter/control.dm @@ -306,7 +306,7 @@ dat += "Cores: [linked_cores.len]

" dat += "-Current Efficiency: [reported_core_efficiency]
" dat += "-Average Stability: [stored_core_stability] (update)
" - dat += "Last Produced: [stored_power]
" + dat += "Last Produced: [DisplayPower(stored_power)]
" dat += "Fuel: " if(!fueljar) diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index e3288a816d..7ce91ece26 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -665,7 +665,7 @@ "powerCellStatus" = cell ? cell.percent() : null, "chargeMode" = chargemode, "chargingStatus" = charging, - "totalLoad" = lastused_total, + "totalLoad" = DisplayPower(lastused_total), "coverLocked" = coverlocked, "siliconUser" = user.has_unlimited_silicon_privilege || user.using_power_flow_console(), "malfStatus" = get_malf_status(user), @@ -673,7 +673,7 @@ "powerChannels" = list( list( "title" = "Equipment", - "powerLoad" = lastused_equip, + "powerLoad" = DisplayPower(lastused_equip), "status" = equipment, "topicParams" = list( "auto" = list("eqp" = 3), @@ -683,7 +683,7 @@ ), list( "title" = "Lighting", - "powerLoad" = lastused_light, + "powerLoad" = DisplayPower(lastused_light), "status" = lighting, "topicParams" = list( "auto" = list("lgt" = 3), @@ -693,7 +693,7 @@ ), list( "title" = "Environment", - "powerLoad" = lastused_environ, + "powerLoad" = DisplayPower(lastused_environ), "status" = environ, "topicParams" = list( "auto" = list("env" = 3), diff --git a/code/modules/power/cable.dm b/code/modules/power/cable.dm index a24c0d7c57..37ec831462 100644 --- a/code/modules/power/cable.dm +++ b/code/modules/power/cable.dm @@ -143,7 +143,7 @@ By design, d1 is the smallest direction and d2 is the highest else if(istype(W, /obj/item/device/multitool)) if(powernet && (powernet.avail > 0)) // is it powered? - to_chat(user, "[powernet.avail]W in power network.") + to_chat(user, "[DisplayPower(powernet.avail)] in power network.") else to_chat(user, "The cable is not powered.") shock(user, 5, 0.2) diff --git a/code/modules/power/generator.dm b/code/modules/power/generator.dm index 1e43380f2f..b5eef4260e 100644 --- a/code/modules/power/generator.dm +++ b/code/modules/power/generator.dm @@ -55,7 +55,7 @@ stat |= BROKEN update_icon() - + /obj/machinery/power/generator/Destroy() SSair.atmos_machinery -= src return ..() @@ -126,7 +126,7 @@ if(cold_air) var/datum/gas_mixture/cold_circ_air1 = cold_circ.AIR1 cold_circ_air1.merge(cold_air) - + update_icon() var/circ = "[cold_circ && cold_circ.last_pressure_delta > 0 ? "1" : "0"][hot_circ && hot_circ.last_pressure_delta > 0 ? "1" : "0"]" @@ -135,7 +135,7 @@ update_icon() src.updateDialog() - + /obj/machinery/power/generator/process() //Setting this number higher just makes the change in power output slower, it doesnt actualy reduce power output cause **math** var/power_output = round(lastgen / 10) @@ -161,15 +161,9 @@ var/datum/gas_mixture/hot_circ_air2 = hot_circ.AIR2 t += "
" - - var/displaygen = lastgenlev - if(displaygen < 1000000) //less than a MW - displaygen /= 1000 - t += "Output: [round(displaygen,0.01)] kW" - else - displaygen /= 1000000 - t += "Output: [round(displaygen,0.01)] MW" - + + t += "Output: [DisplayPower(lastgenlev)]" + t += "
" t += "Cold loop
" diff --git a/code/modules/power/monitor.dm b/code/modules/power/monitor.dm index 85a85113f6..a3edc99951 100644 --- a/code/modules/power/monitor.dm +++ b/code/modules/power/monitor.dm @@ -66,8 +66,8 @@ data["areas"] = list() if(attached) - data["supply"] = attached.powernet.viewavail - data["demand"] = attached.powernet.viewload + data["supply"] = DisplayPower(attached.powernet.viewavail) + data["demand"] = DisplayPower(attached.powernet.viewload) for(var/obj/machinery/power/terminal/term in attached.powernet.nodes) var/obj/machinery/power/apc/A = term.master if(istype(A)) @@ -79,7 +79,7 @@ data["areas"] += list(list( "name" = A.area.name, "charge" = cell_charge, - "load" = A.lastused_total, + "load" = DisplayPower(A.lastused_total), "charging" = A.charging, "eqp" = A.equipment, "lgt" = A.lighting, diff --git a/code/modules/power/port_gen.dm b/code/modules/power/port_gen.dm index 630d248f25..0f4a58e5ef 100644 --- a/code/modules/power/port_gen.dm +++ b/code/modules/power/port_gen.dm @@ -230,7 +230,7 @@ var/stack_percent = round(sheet_left * 100, 1) dat += text("Current stack: [stack_percent]%
") dat += text("Power output: - [power_gen * power_output] +
") - dat += text("Power current: [(powernet == null ? "Unconnected" : "[avail()]")]
") + dat += text("Power current: [(powernet == null ? "Unconnected" : "[DisplayPower(avail())]")]
") dat += text("Heat: [current_heat]
") dat += "
Close" user << browse(dat, "window=port_gen") diff --git a/code/modules/power/smes.dm b/code/modules/power/smes.dm index 90226d532d..6cbc8f095d 100644 --- a/code/modules/power/smes.dm +++ b/code/modules/power/smes.dm @@ -335,14 +335,16 @@ "inputAttempt" = input_attempt, "inputting" = inputting, "inputLevel" = input_level, + "inputLevel_text" = DisplayPower(input_level), "inputLevelMax" = input_level_max, - "inputAvailable" = input_available, + "inputAvailable" = DisplayPower(input_available), "outputAttempt" = output_attempt, "outputting" = outputting, "outputLevel" = output_level, + "outputLevel_text" = DisplayPower(output_level), "outputLevelMax" = output_level_max, - "outputUsed" = output_used + "outputUsed" = DisplayPower(output_used) ) return data diff --git a/code/modules/power/turbine.dm b/code/modules/power/turbine.dm index c8f8d8bfd0..ee531697aa 100644 --- a/code/modules/power/turbine.dm +++ b/code/modules/power/turbine.dm @@ -272,7 +272,7 @@ var/t = "Gas Turbine Generator
"
 
-	t += "Generated power : [round(lastgen)] W

" + t += "Generated power : [DisplayPower(lastgen)]

" t += "Turbine: [round(compressor.rpm)] RPM
" @@ -337,7 +337,7 @@ dat += {"Turbine status: [ src.compressor.starter ? "Off On" : "Off On"] \n
\nTurbine speed: [src.compressor.rpm]rpm
- \nPower currently being generated: [src.compressor.turbine.lastgen]W
+ \nPower currently being generated: [DisplayPower(src.compressor.turbine.lastgen)]
\nInternal gas temperature: [src.compressor.gas_contained.temperature]K
\n

Close \n
diff --git a/tgui/assets/tgui.js b/tgui/assets/tgui.js index a41d648fe1..ca35db8917 100644 --- a/tgui/assets/tgui.js +++ b/tgui/assets/tgui.js @@ -1,16 +1,16 @@ require=function t(e,n,a){function r(o,s){if(!n[o]){if(!e[o]){var u="function"==typeof require&&require;if(!s&&u)return u(o,!0);if(i)return i(o,!0);var p=Error("Cannot find module '"+o+"'");throw p.code="MODULE_NOT_FOUND",p}var c=n[o]={exports:{}};e[o][0].call(c.exports,function(t){var n=e[o][1][t];return r(n?n:t)},c,c.exports,t,e,n,a)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o2?p[2]:void 0,l=Math.min((void 0===c?o:r(c,o))-u,o-s),f=1;for(s>u&&u+l>s&&(f=-1,u+=l-1,s+=l-1);l-- >0;)u in n?n[s]=n[u]:delete n[s],s+=f,u+=f;return n}},{76:76,79:79,80:80}],6:[function(t,e,n){"use strict";var a=t(80),r=t(76),i=t(79);e.exports=[].fill||function(t){for(var e=a(this),n=i(e.length),o=arguments,s=o.length,u=r(s>1?o[1]:void 0,n),p=s>2?o[2]:void 0,c=void 0===p?n:r(p,n);c>u;)e[u++]=t;return e}},{76:76,79:79,80:80}],7:[function(t,e,n){var a=t(78),r=t(79),i=t(76);e.exports=function(t){return function(e,n,o){var s,u=a(e),p=r(u.length),c=i(o,p);if(t&&n!=n){for(;p>c;)if(s=u[c++],s!=s)return!0}else for(;p>c;c++)if((t||c in u)&&u[c]===n)return t||c;return!t&&-1}}},{76:76,78:78,79:79}],8:[function(t,e,n){var a=t(17),r=t(34),i=t(80),o=t(79),s=t(9);e.exports=function(t){var e=1==t,n=2==t,u=3==t,p=4==t,c=6==t,l=5==t||c;return function(f,d,h){for(var m,v,g=i(f),b=r(g),y=a(d,h,3),x=o(b.length),_=0,w=e?s(f,x):n?s(f,0):void 0;x>_;_++)if((l||_ in b)&&(m=b[_],v=y(m,_,g),t))if(e)w[_]=v;else if(v)switch(t){case 3:return!0;case 5:return m;case 6:return _;case 2:w.push(m)}else if(p)return!1;return c?-1:u||p?p:w}}},{17:17,34:34,79:79,80:80,9:9}],9:[function(t,e,n){var a=t(38),r=t(36),i=t(83)("species");e.exports=function(t,e){var n;return r(t)&&(n=t.constructor,"function"!=typeof n||n!==Array&&!r(n.prototype)||(n=void 0),a(n)&&(n=n[i],null===n&&(n=void 0))),new(void 0===n?Array:n)(e)}},{36:36,38:38,83:83}],10:[function(t,e,n){var a=t(11),r=t(83)("toStringTag"),i="Arguments"==a(function(){return arguments}());e.exports=function(t){var e,n,o;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=(e=Object(t))[r])?n:i?a(e):"Object"==(o=a(e))&&"function"==typeof e.callee?"Arguments":o}},{11:11,83:83}],11:[function(t,e,n){var a={}.toString;e.exports=function(t){return a.call(t).slice(8,-1)}},{}],12:[function(t,e,n){"use strict";var a=t(46),r=t(31),i=t(60),o=t(17),s=t(69),u=t(18),p=t(27),c=t(42),l=t(44),f=t(82)("id"),d=t(30),h=t(38),m=t(65),v=t(19),g=Object.isExtensible||h,b=v?"_s":"size",y=0,x=function(t,e){if(!h(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!d(t,f)){if(!g(t))return"F";if(!e)return"E";r(t,f,++y)}return"O"+t[f]},_=function(t,e){var n,a=x(e);if("F"!==a)return t._i[a];for(n=t._f;n;n=n.n)if(n.k==e)return n};e.exports={getConstructor:function(t,e,n,r){var c=t(function(t,i){s(t,c,e),t._i=a.create(null),t._f=void 0,t._l=void 0,t[b]=0,void 0!=i&&p(i,n,t[r],t)});return i(c.prototype,{clear:function(){for(var t=this,e=t._i,n=t._f;n;n=n.n)n.r=!0,n.p&&(n.p=n.p.n=void 0),delete e[n.i];t._f=t._l=void 0,t[b]=0},"delete":function(t){var e=this,n=_(e,t);if(n){var a=n.n,r=n.p;delete e._i[n.i],n.r=!0,r&&(r.n=a),a&&(a.p=r),e._f==n&&(e._f=a),e._l==n&&(e._l=r),e[b]--}return!!n},forEach:function(t){for(var e,n=o(t,arguments.length>1?arguments[1]:void 0,3);e=e?e.n:this._f;)for(n(e.v,e.k,this);e&&e.r;)e=e.p},has:function(t){return!!_(this,t)}}),v&&a.setDesc(c.prototype,"size",{get:function(){return u(this[b])}}),c},def:function(t,e,n){var a,r,i=_(t,e);return i?i.v=n:(t._l=i={i:r=x(e,!0),k:e,v:n,p:a=t._l,n:void 0,r:!1},t._f||(t._f=i),a&&(a.n=i),t[b]++,"F"!==r&&(t._i[r]=i)),t},getEntry:_,setStrong:function(t,e,n){c(t,e,function(t,e){this._t=t,this._k=e,this._l=void 0},function(){for(var t=this,e=t._k,n=t._l;n&&n.r;)n=n.p;return t._t&&(t._l=n=n?n.n:t._t._f)?"keys"==e?l(0,n.k):"values"==e?l(0,n.v):l(0,[n.k,n.v]):(t._t=void 0,l(1))},n?"entries":"values",!n,!0),m(e)}}},{17:17,18:18,19:19,27:27,30:30,31:31,38:38,42:42,44:44,46:46,60:60,65:65,69:69,82:82}],13:[function(t,e,n){var a=t(27),r=t(10);e.exports=function(t){return function(){if(r(this)!=t)throw TypeError(t+"#toJSON isn't generic");var e=[];return a(this,!1,e.push,e),e}}},{10:10,27:27}],14:[function(t,e,n){"use strict";var a=t(31),r=t(60),i=t(4),o=t(38),s=t(69),u=t(27),p=t(8),c=t(30),l=t(82)("weak"),f=Object.isExtensible||o,d=p(5),h=p(6),m=0,v=function(t){return t._l||(t._l=new g)},g=function(){this.a=[]},b=function(t,e){return d(t.a,function(t){return t[0]===e})};g.prototype={get:function(t){var e=b(this,t);return e?e[1]:void 0},has:function(t){return!!b(this,t)},set:function(t,e){var n=b(this,t);n?n[1]=e:this.a.push([t,e])},"delete":function(t){var e=h(this.a,function(e){return e[0]===t});return~e&&this.a.splice(e,1),!!~e}},e.exports={getConstructor:function(t,e,n,a){var i=t(function(t,r){s(t,i,e),t._i=m++,t._l=void 0,void 0!=r&&u(r,n,t[a],t)});return r(i.prototype,{"delete":function(t){return o(t)?f(t)?c(t,l)&&c(t[l],this._i)&&delete t[l][this._i]:v(this)["delete"](t):!1},has:function(t){return o(t)?f(t)?c(t,l)&&c(t[l],this._i):v(this).has(t):!1}}),i},def:function(t,e,n){return f(i(e))?(c(e,l)||a(e,l,{}),e[l][t._i]=n):v(t).set(e,n),t},frozenStore:v,WEAK:l}},{27:27,30:30,31:31,38:38,4:4,60:60,69:69,8:8,82:82}],15:[function(t,e,n){"use strict";var a=t(29),r=t(22),i=t(61),o=t(60),s=t(27),u=t(69),p=t(38),c=t(24),l=t(43),f=t(66);e.exports=function(t,e,n,d,h,m){var v=a[t],g=v,b=h?"set":"add",y=g&&g.prototype,x={},_=function(t){var e=y[t];i(y,t,"delete"==t?function(t){return m&&!p(t)?!1:e.call(this,0===t?0:t)}:"has"==t?function(t){return m&&!p(t)?!1:e.call(this,0===t?0:t)}:"get"==t?function(t){return m&&!p(t)?void 0:e.call(this,0===t?0:t)}:"add"==t?function(t){return e.call(this,0===t?0:t),this}:function(t,n){return e.call(this,0===t?0:t,n),this})};if("function"==typeof g&&(m||y.forEach&&!c(function(){(new g).entries().next()}))){var w,k=new g,E=k[b](m?{}:-0,1)!=k,S=c(function(){k.has(1)}),C=l(function(t){new g(t)});C||(g=e(function(e,n){u(e,g,t);var a=new v;return void 0!=n&&s(n,h,a[b],a),a}),g.prototype=y,y.constructor=g),m||k.forEach(function(t,e){w=1/e===-(1/0)}),(S||w)&&(_("delete"),_("has"),h&&_("get")),(w||E)&&_(b),m&&y.clear&&delete y.clear}else g=d.getConstructor(e,t,h,b),o(g.prototype,n);return f(g,t),x[t]=g,r(r.G+r.W+r.F*(g!=v),x),m||d.setStrong(g,t,h),g}},{22:22,24:24,27:27,29:29,38:38,43:43,60:60,61:61,66:66,69:69}],16:[function(t,e,n){var a=e.exports={version:"1.2.6"};"number"==typeof __e&&(__e=a)},{}],17:[function(t,e,n){var a=t(2);e.exports=function(t,e,n){if(a(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,a){return t.call(e,n,a)};case 3:return function(n,a,r){return t.call(e,n,a,r)}}return function(){return t.apply(e,arguments)}}},{2:2}],18:[function(t,e,n){e.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},{}],19:[function(t,e,n){e.exports=!t(24)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},{24:24}],20:[function(t,e,n){var a=t(38),r=t(29).document,i=a(r)&&a(r.createElement);e.exports=function(t){return i?r.createElement(t):{}}},{29:29,38:38}],21:[function(t,e,n){var a=t(46);e.exports=function(t){var e=a.getKeys(t),n=a.getSymbols;if(n)for(var r,i=n(t),o=a.isEnum,s=0;i.length>s;)o.call(t,r=i[s++])&&e.push(r);return e}},{46:46}],22:[function(t,e,n){var a=t(29),r=t(16),i=t(31),o=t(61),s=t(17),u="prototype",p=function(t,e,n){var c,l,f,d,h=t&p.F,m=t&p.G,v=t&p.S,g=t&p.P,b=t&p.B,y=m?a:v?a[e]||(a[e]={}):(a[e]||{})[u],x=m?r:r[e]||(r[e]={}),_=x[u]||(x[u]={});m&&(n=e);for(c in n)l=!h&&y&&c in y,f=(l?y:n)[c],d=b&&l?s(f,a):g&&"function"==typeof f?s(Function.call,f):f,y&&!l&&o(y,c,f),x[c]!=f&&i(x,c,d),g&&_[c]!=f&&(_[c]=f)};a.core=r,p.F=1,p.G=2,p.S=4,p.P=8,p.B=16,p.W=32,e.exports=p},{16:16,17:17,29:29,31:31,61:61}],23:[function(t,e,n){var a=t(83)("match");e.exports=function(t){var e=/./;try{"/./"[t](e)}catch(n){try{return e[a]=!1,!"/./"[t](e)}catch(r){}}return!0}},{83:83}],24:[function(t,e,n){e.exports=function(t){try{return!!t()}catch(e){return!0}}},{}],25:[function(t,e,n){"use strict";var a=t(31),r=t(61),i=t(24),o=t(18),s=t(83);e.exports=function(t,e,n){var u=s(t),p=""[t];i(function(){var e={};return e[u]=function(){return 7},7!=""[t](e)})&&(r(String.prototype,t,n(o,u,p)),a(RegExp.prototype,u,2==e?function(t,e){return p.call(t,this,e)}:function(t){return p.call(t,this)}))}},{18:18,24:24,31:31,61:61,83:83}],26:[function(t,e,n){"use strict";var a=t(4);e.exports=function(){var t=a(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e}},{4:4}],27:[function(t,e,n){var a=t(17),r=t(40),i=t(35),o=t(4),s=t(79),u=t(84);e.exports=function(t,e,n,p){var c,l,f,d=u(t),h=a(n,p,e?2:1),m=0;if("function"!=typeof d)throw TypeError(t+" is not iterable!");if(i(d))for(c=s(t.length);c>m;m++)e?h(o(l=t[m])[0],l[1]):h(t[m]);else for(f=d.call(t);!(l=f.next()).done;)r(f,h,l.value,e)}},{17:17,35:35,4:4,40:40,79:79,84:84}],28:[function(t,e,n){var a=t(78),r=t(46).getNames,i={}.toString,o="object"==typeof window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],s=function(t){try{return r(t)}catch(e){return o.slice()}};e.exports.get=function(t){return o&&"[object Window]"==i.call(t)?s(t):r(a(t))}},{46:46,78:78}],29:[function(t,e,n){var a=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=a)},{}],30:[function(t,e,n){var a={}.hasOwnProperty;e.exports=function(t,e){return a.call(t,e)}},{}],31:[function(t,e,n){var a=t(46),r=t(59);e.exports=t(19)?function(t,e,n){return a.setDesc(t,e,r(1,n))}:function(t,e,n){return t[e]=n,t}},{19:19,46:46,59:59}],32:[function(t,e,n){e.exports=t(29).document&&document.documentElement},{29:29}],33:[function(t,e,n){e.exports=function(t,e,n){var a=void 0===n;switch(e.length){case 0:return a?t():t.call(n);case 1:return a?t(e[0]):t.call(n,e[0]);case 2:return a?t(e[0],e[1]):t.call(n,e[0],e[1]);case 3:return a?t(e[0],e[1],e[2]):t.call(n,e[0],e[1],e[2]);case 4:return a?t(e[0],e[1],e[2],e[3]):t.call(n,e[0],e[1],e[2],e[3])}return t.apply(n,e)}},{}],34:[function(t,e,n){var a=t(11);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==a(t)?t.split(""):Object(t)}},{11:11}],35:[function(t,e,n){var a=t(45),r=t(83)("iterator"),i=Array.prototype;e.exports=function(t){return void 0!==t&&(a.Array===t||i[r]===t)}},{45:45,83:83}],36:[function(t,e,n){var a=t(11);e.exports=Array.isArray||function(t){return"Array"==a(t)}},{11:11}],37:[function(t,e,n){var a=t(38),r=Math.floor;e.exports=function(t){return!a(t)&&isFinite(t)&&r(t)===t}},{38:38}],38:[function(t,e,n){e.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},{}],39:[function(t,e,n){var a=t(38),r=t(11),i=t(83)("match");e.exports=function(t){var e;return a(t)&&(void 0!==(e=t[i])?!!e:"RegExp"==r(t))}},{11:11,38:38,83:83}],40:[function(t,e,n){var a=t(4);e.exports=function(t,e,n,r){try{return r?e(a(n)[0],n[1]):e(n)}catch(i){var o=t["return"];throw void 0!==o&&a(o.call(t)),i}}},{4:4}],41:[function(t,e,n){"use strict";var a=t(46),r=t(59),i=t(66),o={};t(31)(o,t(83)("iterator"),function(){return this}),e.exports=function(t,e,n){t.prototype=a.create(o,{next:r(1,n)}),i(t,e+" Iterator")}},{31:31,46:46,59:59,66:66,83:83}],42:[function(t,e,n){"use strict";var a=t(48),r=t(22),i=t(61),o=t(31),s=t(30),u=t(45),p=t(41),c=t(66),l=t(46).getProto,f=t(83)("iterator"),d=!([].keys&&"next"in[].keys()),h="@@iterator",m="keys",v="values",g=function(){return this};e.exports=function(t,e,n,b,y,x,_){p(n,e,b);var w,k,E=function(t){if(!d&&t in A)return A[t];switch(t){case m:return function(){return new n(this,t)};case v:return function(){return new n(this,t)}}return function(){return new n(this,t)}},S=e+" Iterator",C=y==v,P=!1,A=t.prototype,O=A[f]||A[h]||y&&A[y],T=O||E(y);if(O){var R=l(T.call(new t));c(R,S,!0),!a&&s(A,h)&&o(R,f,g),C&&O.name!==v&&(P=!0,T=function(){return O.call(this)})}if(a&&!_||!d&&!P&&A[f]||o(A,f,T),u[e]=T,u[S]=g,y)if(w={values:C?T:E(v),keys:x?T:E(m),entries:C?E("entries"):T},_)for(k in w)k in A||i(A,k,w[k]);else r(r.P+r.F*(d||P),e,w);return w}},{22:22,30:30,31:31,41:41,45:45,46:46,48:48,61:61,66:66,83:83}],43:[function(t,e,n){var a=t(83)("iterator"),r=!1;try{var i=[7][a]();i["return"]=function(){r=!0},Array.from(i,function(){throw 2})}catch(o){}e.exports=function(t,e){if(!e&&!r)return!1;var n=!1;try{var i=[7],o=i[a]();o.next=function(){return{done:n=!0}},i[a]=function(){return o},t(i)}catch(s){}return n}},{83:83}],44:[function(t,e,n){e.exports=function(t,e){return{value:e,done:!!t}}},{}],45:[function(t,e,n){e.exports={}},{}],46:[function(t,e,n){var a=Object;e.exports={create:a.create,getProto:a.getPrototypeOf,isEnum:{}.propertyIsEnumerable,getDesc:a.getOwnPropertyDescriptor,setDesc:a.defineProperty,setDescs:a.defineProperties,getKeys:a.keys,getNames:a.getOwnPropertyNames,getSymbols:a.getOwnPropertySymbols,each:[].forEach}},{}],47:[function(t,e,n){var a=t(46),r=t(78);e.exports=function(t,e){for(var n,i=r(t),o=a.getKeys(i),s=o.length,u=0;s>u;)if(i[n=o[u++]]===e)return n}},{46:46,78:78}],48:[function(t,e,n){e.exports=!1},{}],49:[function(t,e,n){e.exports=Math.expm1||function(t){return 0==(t=+t)?t:t>-1e-6&&1e-6>t?t+t*t/2:Math.exp(t)-1}},{}],50:[function(t,e,n){e.exports=Math.log1p||function(t){return(t=+t)>-1e-8&&1e-8>t?t-t*t/2:Math.log(1+t)}},{}],51:[function(t,e,n){e.exports=Math.sign||function(t){return 0==(t=+t)||t!=t?t:0>t?-1:1}},{}],52:[function(t,e,n){var a,r,i,o=t(29),s=t(75).set,u=o.MutationObserver||o.WebKitMutationObserver,p=o.process,c=o.Promise,l="process"==t(11)(p),f=function(){var t,e,n;for(l&&(t=p.domain)&&(p.domain=null,t.exit());a;)e=a.domain,n=a.fn,e&&e.enter(),n(),e&&e.exit(),a=a.next;r=void 0,t&&t.enter()};if(l)i=function(){p.nextTick(f)};else if(u){var d=1,h=document.createTextNode("");new u(f).observe(h,{characterData:!0}),i=function(){h.data=d=-d}}else i=c&&c.resolve?function(){c.resolve().then(f)}:function(){s.call(o,f)};e.exports=function(t){var e={fn:t,next:void 0,domain:l&&p.domain};r&&(r.next=e),a||(a=e,i()),r=e}},{11:11,29:29,75:75}],53:[function(t,e,n){var a=t(46),r=t(80),i=t(34);e.exports=t(24)(function(){var t=Object.assign,e={},n={},a=Symbol(),r="abcdefghijklmnopqrst";return e[a]=7,r.split("").forEach(function(t){n[t]=t}),7!=t({},e)[a]||Object.keys(t({},n)).join("")!=r})?function(t,e){for(var n=r(t),o=arguments,s=o.length,u=1,p=a.getKeys,c=a.getSymbols,l=a.isEnum;s>u;)for(var f,d=i(o[u++]),h=c?p(d).concat(c(d)):p(d),m=h.length,v=0;m>v;)l.call(d,f=h[v++])&&(n[f]=d[f]);return n}:Object.assign},{24:24,34:34,46:46,80:80}],54:[function(t,e,n){var a=t(22),r=t(16),i=t(24);e.exports=function(t,e){var n=(r.Object||{})[t]||Object[t],o={};o[t]=e(n),a(a.S+a.F*i(function(){n(1)}),"Object",o)}},{16:16,22:22,24:24}],55:[function(t,e,n){var a=t(46),r=t(78),i=a.isEnum;e.exports=function(t){return function(e){for(var n,o=r(e),s=a.getKeys(o),u=s.length,p=0,c=[];u>p;)i.call(o,n=s[p++])&&c.push(t?[n,o[n]]:o[n]);return c}}},{46:46,78:78}],56:[function(t,e,n){var a=t(46),r=t(4),i=t(29).Reflect;e.exports=i&&i.ownKeys||function(t){var e=a.getNames(r(t)),n=a.getSymbols;return n?e.concat(n(t)):e}},{29:29,4:4,46:46}],57:[function(t,e,n){"use strict";var a=t(58),r=t(33),i=t(2);e.exports=function(){for(var t=i(this),e=arguments.length,n=Array(e),o=0,s=a._,u=!1;e>o;)(n[o]=arguments[o++])===s&&(u=!0);return function(){var a,i=this,o=arguments,p=o.length,c=0,l=0;if(!u&&!p)return r(t,n,i);if(a=n.slice(),u)for(;e>c;c++)a[c]===s&&(a[c]=o[l++]);for(;p>l;)a.push(o[l++]);return r(t,a,i)}}},{2:2,33:33,58:58}],58:[function(t,e,n){e.exports=t(29)},{29:29}],59:[function(t,e,n){e.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},{}],60:[function(t,e,n){var a=t(61);e.exports=function(t,e){for(var n in e)a(t,n,e[n]);return t}},{61:61}],61:[function(t,e,n){var a=t(29),r=t(31),i=t(82)("src"),o="toString",s=Function[o],u=(""+s).split(o);t(16).inspectSource=function(t){return s.call(t)},(e.exports=function(t,e,n,o){"function"==typeof n&&(n.hasOwnProperty(i)||r(n,i,t[e]?""+t[e]:u.join(e+"")),n.hasOwnProperty("name")||r(n,"name",e)),t===a?t[e]=n:(o||delete t[e],r(t,e,n))})(Function.prototype,o,function(){return"function"==typeof this&&this[i]||s.call(this)})},{16:16,29:29,31:31,82:82}],62:[function(t,e,n){e.exports=function(t,e){var n=e===Object(e)?function(t){return e[t]}:e;return function(e){return(e+"").replace(t,n)}}},{}],63:[function(t,e,n){e.exports=Object.is||function(t,e){return t===e?0!==t||1/t===1/e:t!=t&&e!=e}},{}],64:[function(t,e,n){var a=t(46).getDesc,r=t(38),i=t(4),o=function(t,e){if(i(t),!r(e)&&null!==e)throw TypeError(e+": can't set as prototype!")};e.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(e,n,r){try{r=t(17)(Function.call,a(Object.prototype,"__proto__").set,2),r(e,[]),n=!(e instanceof Array)}catch(i){n=!0}return function(t,e){return o(t,e),n?t.__proto__=e:r(t,e),t}}({},!1):void 0),check:o}},{17:17,38:38,4:4,46:46}],65:[function(t,e,n){"use strict";var a=t(29),r=t(46),i=t(19),o=t(83)("species");e.exports=function(t){var e=a[t];i&&e&&!e[o]&&r.setDesc(e,o,{configurable:!0,get:function(){return this}})}},{19:19,29:29,46:46,83:83}],66:[function(t,e,n){var a=t(46).setDesc,r=t(30),i=t(83)("toStringTag");e.exports=function(t,e,n){t&&!r(t=n?t:t.prototype,i)&&a(t,i,{configurable:!0,value:e})}},{30:30,46:46,83:83}],67:[function(t,e,n){var a=t(29),r="__core-js_shared__",i=a[r]||(a[r]={});e.exports=function(t){return i[t]||(i[t]={})}},{29:29}],68:[function(t,e,n){var a=t(4),r=t(2),i=t(83)("species");e.exports=function(t,e){var n,o=a(t).constructor;return void 0===o||void 0==(n=a(o)[i])?e:r(n)}},{2:2,4:4,83:83}],69:[function(t,e,n){e.exports=function(t,e,n){if(!(t instanceof e))throw TypeError(n+": use the 'new' operator!");return t}},{}],70:[function(t,e,n){var a=t(77),r=t(18);e.exports=function(t){return function(e,n){var i,o,s=r(e)+"",u=a(n),p=s.length;return 0>u||u>=p?t?"":void 0:(i=s.charCodeAt(u),55296>i||i>56319||u+1===p||(o=s.charCodeAt(u+1))<56320||o>57343?t?s.charAt(u):i:t?s.slice(u,u+2):(i-55296<<10)+(o-56320)+65536)}}},{18:18,77:77}],71:[function(t,e,n){var a=t(39),r=t(18);e.exports=function(t,e,n){if(a(e))throw TypeError("String#"+n+" doesn't accept regex!");return r(t)+""}},{18:18,39:39}],72:[function(t,e,n){var a=t(79),r=t(73),i=t(18);e.exports=function(t,e,n,o){var s=i(t)+"",u=s.length,p=void 0===n?" ":n+"",c=a(e);if(u>=c)return s;""==p&&(p=" ");var l=c-u,f=r.call(p,Math.ceil(l/p.length));return f.length>l&&(f=f.slice(0,l)),o?f+s:s+f}},{18:18,73:73,79:79}],73:[function(t,e,n){"use strict";var a=t(77),r=t(18);e.exports=function(t){var e=r(this)+"",n="",i=a(t);if(0>i||i==1/0)throw RangeError("Count can't be negative");for(;i>0;(i>>>=1)&&(e+=e))1&i&&(n+=e);return n}},{18:18,77:77}],74:[function(t,e,n){var a=t(22),r=t(18),i=t(24),o=" \n\x0B\f\r  ᠎              \u2028\u2029\ufeff",s="["+o+"]",u="​…",p=RegExp("^"+s+s+"*"),c=RegExp(s+s+"*$"),l=function(t,e){var n={};n[t]=e(f),a(a.P+a.F*i(function(){return!!o[t]()||u[t]()!=u}),"String",n)},f=l.trim=function(t,e){return t=r(t)+"",1&e&&(t=t.replace(p,"")),2&e&&(t=t.replace(c,"")),t};e.exports=l},{18:18,22:22,24:24}],75:[function(t,e,n){var a,r,i,o=t(17),s=t(33),u=t(32),p=t(20),c=t(29),l=c.process,f=c.setImmediate,d=c.clearImmediate,h=c.MessageChannel,m=0,v={},g="onreadystatechange",b=function(){var t=+this;if(v.hasOwnProperty(t)){var e=v[t];delete v[t],e()}},y=function(t){b.call(t.data)};f&&d||(f=function(t){for(var e=[],n=1;arguments.length>n;)e.push(arguments[n++]);return v[++m]=function(){s("function"==typeof t?t:Function(t),e)},a(m),m},d=function(t){delete v[t]},"process"==t(11)(l)?a=function(t){l.nextTick(o(b,t,1))}:h?(r=new h,i=r.port2,r.port1.onmessage=y,a=o(i.postMessage,i,1)):c.addEventListener&&"function"==typeof postMessage&&!c.importScripts?(a=function(t){c.postMessage(t+"","*")},c.addEventListener("message",y,!1)):a=g in p("script")?function(t){u.appendChild(p("script"))[g]=function(){u.removeChild(this),b.call(t)}}:function(t){setTimeout(o(b,t,1),0)}),e.exports={set:f,clear:d}},{11:11,17:17,20:20,29:29,32:32,33:33}],76:[function(t,e,n){var a=t(77),r=Math.max,i=Math.min;e.exports=function(t,e){return t=a(t),0>t?r(t+e,0):i(t,e)}},{77:77}],77:[function(t,e,n){var a=Math.ceil,r=Math.floor;e.exports=function(t){return isNaN(t=+t)?0:(t>0?r:a)(t)}},{}],78:[function(t,e,n){var a=t(34),r=t(18);e.exports=function(t){return a(r(t))}},{18:18,34:34}],79:[function(t,e,n){var a=t(77),r=Math.min;e.exports=function(t){return t>0?r(a(t),9007199254740991):0}},{77:77}],80:[function(t,e,n){var a=t(18);e.exports=function(t){return Object(a(t))}},{18:18}],81:[function(t,e,n){var a=t(38);e.exports=function(t,e){if(!a(t))return t;var n,r;if(e&&"function"==typeof(n=t.toString)&&!a(r=n.call(t)))return r;if("function"==typeof(n=t.valueOf)&&!a(r=n.call(t)))return r;if(!e&&"function"==typeof(n=t.toString)&&!a(r=n.call(t)))return r;throw TypeError("Can't convert object to primitive value")}},{38:38}],82:[function(t,e,n){var a=0,r=Math.random();e.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++a+r).toString(36))}},{}],83:[function(t,e,n){var a=t(67)("wks"),r=t(82),i=t(29).Symbol;e.exports=function(t){return a[t]||(a[t]=i&&i[t]||(i||r)("Symbol."+t))}},{29:29,67:67,82:82}],84:[function(t,e,n){var a=t(10),r=t(83)("iterator"),i=t(45);e.exports=t(16).getIteratorMethod=function(t){return void 0!=t?t[r]||t["@@iterator"]||i[a(t)]:void 0}},{10:10,16:16,45:45,83:83}],85:[function(t,e,n){"use strict";var a,r=t(46),i=t(22),o=t(19),s=t(59),u=t(32),p=t(20),c=t(30),l=t(11),f=t(33),d=t(24),h=t(4),m=t(2),v=t(38),g=t(80),b=t(78),y=t(77),x=t(76),_=t(79),w=t(34),k=t(82)("__proto__"),E=t(8),S=t(7)(!1),C=Object.prototype,P=Array.prototype,A=P.slice,O=P.join,T=r.setDesc,R=r.getDesc,j=r.setDescs,M={};o||(a=!d(function(){return 7!=T(p("div"),"a",{get:function(){return 7}}).a}),r.setDesc=function(t,e,n){if(a)try{return T(t,e,n)}catch(r){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(h(t)[e]=n.value),t},r.getDesc=function(t,e){if(a)try{return R(t,e)}catch(n){}return c(t,e)?s(!C.propertyIsEnumerable.call(t,e),t[e]):void 0},r.setDescs=j=function(t,e){h(t);for(var n,a=r.getKeys(e),i=a.length,o=0;i>o;)r.setDesc(t,n=a[o++],e[n]);return t}),i(i.S+i.F*!o,"Object",{getOwnPropertyDescriptor:r.getDesc,defineProperty:r.setDesc,defineProperties:j});var L="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),D=L.concat("length","prototype"),N=L.length,F=function(){var t,e=p("iframe"),n=N,a=">";for(e.style.display="none",u.appendChild(e),e.src="javascript:",t=e.contentWindow.document,t.open(),t.write("