diff --git a/baystation12.dme b/baystation12.dme index 7d0acca9a95..c756b009f71 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -6,235 +6,14 @@ // BEGIN_FILE_DIR #define FILE_DIR . #define FILE_DIR "code" -#define FILE_DIR "code/__HELPERS" -#define FILE_DIR "code/ATMOSPHERICS" -#define FILE_DIR "code/ATMOSPHERICS/components" -#define FILE_DIR "code/ATMOSPHERICS/components/binary_devices" -#define FILE_DIR "code/ATMOSPHERICS/components/trinary_devices" -#define FILE_DIR "code/ATMOSPHERICS/components/unary" -#define FILE_DIR "code/controllers" -#define FILE_DIR "code/datums" -#define FILE_DIR "code/datums/diseases" -#define FILE_DIR "code/datums/diseases/advance" -#define FILE_DIR "code/datums/diseases/advance/symptoms" -#define FILE_DIR "code/datums/helper_datums" -#define FILE_DIR "code/datums/spells" -#define FILE_DIR "code/defines" -#define FILE_DIR "code/defines/obj" -#define FILE_DIR "code/defines/procs" -#define FILE_DIR "code/FEA" -#define FILE_DIR "code/game" -#define FILE_DIR "code/game/area" -#define FILE_DIR "code/game/gamemodes" -#define FILE_DIR "code/game/gamemodes/autotraitor" -#define FILE_DIR "code/game/gamemodes/blob" -#define FILE_DIR "code/game/gamemodes/blob/blobs" -#define FILE_DIR "code/game/gamemodes/changeling" -#define FILE_DIR "code/game/gamemodes/cult" -#define FILE_DIR "code/game/gamemodes/epidemic" -#define FILE_DIR "code/game/gamemodes/events" -#define FILE_DIR "code/game/gamemodes/events/holidays" -#define FILE_DIR "code/game/gamemodes/extended" -#define FILE_DIR "code/game/gamemodes/malfunction" -#define FILE_DIR "code/game/gamemodes/meme" -#define FILE_DIR "code/game/gamemodes/meteor" -#define FILE_DIR "code/game/gamemodes/nuclear" -#define FILE_DIR "code/game/gamemodes/revolution" -#define FILE_DIR "code/game/gamemodes/sandbox" -#define FILE_DIR "code/game/gamemodes/traitor" -#define FILE_DIR "code/game/gamemodes/wizard" -#define FILE_DIR "code/game/jobs" -#define FILE_DIR "code/game/jobs/job" -#define FILE_DIR "code/game/machinery" -#define FILE_DIR "code/game/machinery/atmoalter" -#define FILE_DIR "code/game/machinery/bots" -#define FILE_DIR "code/game/machinery/camera" -#define FILE_DIR "code/game/machinery/computer" -#define FILE_DIR "code/game/machinery/doors" -#define FILE_DIR "code/game/machinery/embedded_controller" -#define FILE_DIR "code/game/machinery/kitchen" -#define FILE_DIR "code/game/machinery/pipe" -#define FILE_DIR "code/game/machinery/telecomms" -#define FILE_DIR "code/game/magic" -#define FILE_DIR "code/game/mecha" -#define FILE_DIR "code/game/mecha/combat" -#define FILE_DIR "code/game/mecha/equipment" -#define FILE_DIR "code/game/mecha/equipment/tools" -#define FILE_DIR "code/game/mecha/equipment/weapons" -#define FILE_DIR "code/game/mecha/medical" -#define FILE_DIR "code/game/mecha/working" -#define FILE_DIR "code/game/objects" -#define FILE_DIR "code/game/objects/closets" -#define FILE_DIR "code/game/objects/closets/secure" -#define FILE_DIR "code/game/objects/effects" -#define FILE_DIR "code/game/objects/effects/decals" -#define FILE_DIR "code/game/objects/effects/decals/Cleanable" -#define FILE_DIR "code/game/objects/effects/spawners" -#define FILE_DIR "code/game/objects/items" -#define FILE_DIR "code/game/objects/items/devices" -#define FILE_DIR "code/game/objects/items/devices/PDA" -#define FILE_DIR "code/game/objects/items/devices/radio" -#define FILE_DIR "code/game/objects/items/robot" -#define FILE_DIR "code/game/objects/items/stacks" -#define FILE_DIR "code/game/objects/items/stacks/sheets" -#define FILE_DIR "code/game/objects/items/stacks/tiles" -#define FILE_DIR "code/game/objects/items/weapons" -#define FILE_DIR "code/game/objects/items/weapons/grenades" -#define FILE_DIR "code/game/objects/items/weapons/implants" -#define FILE_DIR "code/game/objects/items/weapons/melee" -#define FILE_DIR "code/game/objects/items/weapons/storage" -#define FILE_DIR "code/game/objects/items/weapons/tanks" -#define FILE_DIR "code/game/objects/storage" -#define FILE_DIR "code/game/objects/structures" -#define FILE_DIR "code/game/objects/structures/crates_lockers" -#define FILE_DIR "code/game/objects/structures/crates_lockers/closets" -#define FILE_DIR "code/game/objects/structures/crates_lockers/closets/secure" -#define FILE_DIR "code/game/objects/structures/stool_bed_chair_nest" -#define FILE_DIR "code/game/structure" -#define FILE_DIR "code/game/turfs" -#define FILE_DIR "code/game/turfs/simulated" -#define FILE_DIR "code/game/turfs/space" -#define FILE_DIR "code/game/turfs/unsimulated" -#define FILE_DIR "code/game/vehicles" -#define FILE_DIR "code/game/verbs" -#define FILE_DIR "code/js" -#define FILE_DIR "code/modules" -#define FILE_DIR "code/modules/admin" -#define FILE_DIR "code/modules/admin/DB ban" -#define FILE_DIR "code/modules/admin/permissionverbs" -#define FILE_DIR "code/modules/admin/verbs" -#define FILE_DIR "code/modules/assembly" -#define FILE_DIR "code/modules/awaymissions" -#define FILE_DIR "code/modules/awaymissions/maploader" -#define FILE_DIR "code/modules/client" -#define FILE_DIR "code/modules/clothing" -#define FILE_DIR "code/modules/clothing/glasses" -#define FILE_DIR "code/modules/clothing/gloves" -#define FILE_DIR "code/modules/clothing/head" -#define FILE_DIR "code/modules/clothing/masks" -#define FILE_DIR "code/modules/clothing/shoes" -#define FILE_DIR "code/modules/clothing/spacesuits" -#define FILE_DIR "code/modules/clothing/suits" -#define FILE_DIR "code/modules/clothing/under" -#define FILE_DIR "code/modules/clothing/under/jobs" -#define FILE_DIR "code/modules/customitems" -#define FILE_DIR "code/modules/destilery" -#define FILE_DIR "code/modules/DetectiveWork" -#define FILE_DIR "code/modules/events" -#define FILE_DIR "code/modules/flufftext" -#define FILE_DIR "code/modules/food" -#define FILE_DIR "code/modules/genetics" -#define FILE_DIR "code/modules/icon generation" -#define FILE_DIR "code/modules/library" -#define FILE_DIR "code/modules/liquid" -#define FILE_DIR "code/modules/maps" -#define FILE_DIR "code/modules/mining" -#define FILE_DIR "code/modules/mob" -#define FILE_DIR "code/modules/mob/dead" -#define FILE_DIR "code/modules/mob/dead/observer" -#define FILE_DIR "code/modules/mob/living" -#define FILE_DIR "code/modules/mob/living/blob" -#define FILE_DIR "code/modules/mob/living/carbon" -#define FILE_DIR "code/modules/mob/living/carbon/alien" -#define FILE_DIR "code/modules/mob/living/carbon/alien/humanoid" -#define FILE_DIR "code/modules/mob/living/carbon/alien/humanoid/caste" -#define FILE_DIR "code/modules/mob/living/carbon/alien/larva" -#define FILE_DIR "code/modules/mob/living/carbon/alien/special" -#define FILE_DIR "code/modules/mob/living/carbon/brain" -#define FILE_DIR "code/modules/mob/living/carbon/human" -#define FILE_DIR "code/modules/mob/living/carbon/metroid" -#define FILE_DIR "code/modules/mob/living/carbon/monkey" -#define FILE_DIR "code/modules/mob/living/silicon" -#define FILE_DIR "code/modules/mob/living/silicon/ai" -#define FILE_DIR "code/modules/mob/living/silicon/ai/freelook" -#define FILE_DIR "code/modules/mob/living/silicon/decoy" -#define FILE_DIR "code/modules/mob/living/silicon/pai" -#define FILE_DIR "code/modules/mob/living/silicon/robot" -#define FILE_DIR "code/modules/mob/living/simple_animal" -#define FILE_DIR "code/modules/mob/living/simple_animal/friendly" -#define FILE_DIR "code/modules/mob/living/simple_animal/hostile" -#define FILE_DIR "code/modules/mob/living/simple_animal/hostile/retaliate" -#define FILE_DIR "code/modules/mob/new_player" -#define FILE_DIR "code/modules/organs" -#define FILE_DIR "code/modules/paperwork" -#define FILE_DIR "code/modules/power" -#define FILE_DIR "code/modules/power/antimatter" -#define FILE_DIR "code/modules/power/singularity" -#define FILE_DIR "code/modules/power/singularity/particle_accelerator" -#define FILE_DIR "code/modules/projectiles" -#define FILE_DIR "code/modules/projectiles/ammunition" -#define FILE_DIR "code/modules/projectiles/guns" -#define FILE_DIR "code/modules/projectiles/guns/energy" -#define FILE_DIR "code/modules/projectiles/guns/projectile" -#define FILE_DIR "code/modules/projectiles/projectile" -#define FILE_DIR "code/modules/reagents" -#define FILE_DIR "code/modules/reagents/reagent_containers" -#define FILE_DIR "code/modules/reagents/reagent_containers/food" -#define FILE_DIR "code/modules/reagents/reagent_containers/food/drinks" -#define FILE_DIR "code/modules/reagents/reagent_containers/food/drinks/bottle" -#define FILE_DIR "code/modules/reagents/reagent_containers/food/snacks" -#define FILE_DIR "code/modules/reagents/reagent_containers/glass" -#define FILE_DIR "code/modules/reagents/reagent_containers/glass/bottle" -#define FILE_DIR "code/modules/recycling" -#define FILE_DIR "code/modules/research" -#define FILE_DIR "code/modules/research/xenoarchaeology" -#define FILE_DIR "code/modules/research/xenoarchaeology/artifact" -#define FILE_DIR "code/modules/research/xenoarchaeology/artifact/effects" -#define FILE_DIR "code/modules/research/xenoarchaeology/finds" -#define FILE_DIR "code/modules/research/xenoarchaeology/machinery" -#define FILE_DIR "code/modules/research/xenoarchaeology/tools" -#define FILE_DIR "code/modules/scripting" -#define FILE_DIR "code/modules/scripting/AST" -#define FILE_DIR "code/modules/scripting/AST/Operators" -#define FILE_DIR "code/modules/scripting/Implementations" -#define FILE_DIR "code/modules/scripting/Interpreter" -#define FILE_DIR "code/modules/scripting/Parser" -#define FILE_DIR "code/modules/scripting/Scanner" -#define FILE_DIR "code/modules/security levels" -#define FILE_DIR "code/modules/surgery" #define FILE_DIR "code/TriDimension" -#define FILE_DIR "code/unused" -#define FILE_DIR "code/unused/beast" -#define FILE_DIR "code/unused/computer2" -#define FILE_DIR "code/unused/disease2" -#define FILE_DIR "code/unused/gamemodes" -#define FILE_DIR "code/unused/hivebot" -#define FILE_DIR "code/unused/mining" -#define FILE_DIR "code/unused/optics" -#define FILE_DIR "code/unused/pda2" -#define FILE_DIR "code/unused/powerarmor" -#define FILE_DIR "code/unused/spacecraft" #define FILE_DIR "code/WorkInProgress" -#define FILE_DIR "code/WorkInProgress/AI_Visibility" -#define FILE_DIR "code/WorkInProgress/animusstation" -#define FILE_DIR "code/WorkInProgress/Apples" #define FILE_DIR "code/WorkInProgress/Cael_Aislinn" -#define FILE_DIR "code/WorkInProgress/Cael_Aislinn/Economy" #define FILE_DIR "code/WorkInProgress/Cael_Aislinn/Jungle" #define FILE_DIR "code/WorkInProgress/Cael_Aislinn/Rust" #define FILE_DIR "code/WorkInProgress/Cael_Aislinn/ShieldGen" #define FILE_DIR "code/WorkInProgress/Cael_Aislinn/Supermatter" -#define FILE_DIR "code/WorkInProgress/carn" -#define FILE_DIR "code/WorkInProgress/Chinsky" -#define FILE_DIR "code/WorkInProgress/Cib" -#define FILE_DIR "code/WorkInProgress/Cib/amorph" -#define FILE_DIR "code/WorkInProgress/Mini" -#define FILE_DIR "code/WorkInProgress/Mloc" -#define FILE_DIR "code/WorkInProgress/organs" -#define FILE_DIR "code/WorkInProgress/Ported" -#define FILE_DIR "code/WorkInProgress/Ported/Abi79" -#define FILE_DIR "code/WorkInProgress/Ported/Bureaucracy" -#define FILE_DIR "code/WorkInProgress/Ported/Spawners" -#define FILE_DIR "code/WorkInProgress/Sigyn" -#define FILE_DIR "code/WorkInProgress/Sigyn/Department Sec" -#define FILE_DIR "code/WorkInProgress/Sigyn/Softcurity" -#define FILE_DIR "code/WorkInProgress/SkyMarshal" #define FILE_DIR "code/WorkInProgress/Susan" -#define FILE_DIR "code/WorkInProgress/Tastyfish" -#define FILE_DIR "code/WorkInProgress/virus2" -#define FILE_DIR "code/WorkInProgress/virus2/Disease2" -#define FILE_DIR "code/WorkInProgress/Wrongnumber" -#define FILE_DIR "code/ZAS" #define FILE_DIR "html" #define FILE_DIR "icons" #define FILE_DIR "icons/48x48" @@ -257,9 +36,6 @@ #define FILE_DIR "icons/turf" #define FILE_DIR "icons/vending_icons" #define FILE_DIR "icons/xenoarch_icons" -#define FILE_DIR "interface" -#define FILE_DIR "maps" -#define FILE_DIR "maps/RandomZLevels" #define FILE_DIR "sound" #define FILE_DIR "sound/AI" #define FILE_DIR "sound/ambience" @@ -275,9 +51,8 @@ #define FILE_DIR "sound/piano" #define FILE_DIR "sound/violin" #define FILE_DIR "sound/voice" +#define FILE_DIR "sound/voice/Serithi" #define FILE_DIR "sound/weapons" -#define FILE_DIR "tools" -#define FILE_DIR "tools/Redirector" // END_FILE_DIR // BEGIN_PREFERENCES #define DEBUG diff --git a/code/WorkInProgress/Cael_Aislinn/Jungle/jungle.dm b/code/WorkInProgress/Cael_Aislinn/Jungle/jungle.dm index ac09a7c2ce6..c2ae804a5d2 100644 --- a/code/WorkInProgress/Cael_Aislinn/Jungle/jungle.dm +++ b/code/WorkInProgress/Cael_Aislinn/Jungle/jungle.dm @@ -130,207 +130,202 @@ desc = "a mysterious and ancient piece of machinery" var/list/animal_spawners = list() - New() - ..() - Initialise() -/obj/machinery/jungle_controller/proc/Initialise() - set background = 1 - spawn(0) - world << "\red \b Setting up jungle, this may take a moment..." +/obj/machinery/jungle_controller/initialize() + world << "\red \b Setting up jungle, this may take a bleeding eternity..." - //crash dat shuttle - var/area/start_location = locate(/area/jungle/crash_ship_source) - var/area/clean_location = locate(/area/jungle/crash_ship_clean) - var/list/ship_locations = list(/area/jungle/crash_ship_one, /area/jungle/crash_ship_two, /area/jungle/crash_ship_three, /area/jungle/crash_ship_four) - var/area/end_location = locate( pick(ship_locations) ) - ship_locations -= end_location.type + //crash dat shuttle + var/area/start_location = locate(/area/jungle/crash_ship_source) + var/area/clean_location = locate(/area/jungle/crash_ship_clean) + var/list/ship_locations = list(/area/jungle/crash_ship_one, /area/jungle/crash_ship_two, /area/jungle/crash_ship_three, /area/jungle/crash_ship_four) + var/area/end_location = locate( pick(ship_locations) ) + ship_locations -= end_location.type - start_location.move_contents_to(end_location) - for(var/area_type in ship_locations) - var/area/cur_location = locate(area_type) - clean_location.copy_turfs_to(cur_location) + start_location.move_contents_to(end_location) + for(var/area_type in ship_locations) + var/area/cur_location = locate(area_type) + clean_location.copy_turfs_to(cur_location) - //drop some random river nodes - var/list/river_nodes = list() - var/max = rand(1,3) - var/num_spawned = 0 - while(num_spawned < max) - var/turf/unsimulated/jungle/J = locate(rand(RANDOM_LOWER_X, RANDOM_UPPER_X), rand(RANDOM_LOWER_Y, RANDOM_UPPER_Y), src.z) - if(!istype(J)) - continue - if(!J.bushes_spawn) - continue - river_nodes.Add(new /obj/effect/landmark/river_waypoint(J)) - num_spawned++ + //drop some random river nodes + var/list/river_nodes = list() + var/max = rand(1,3) + var/num_spawned = 0 + while(num_spawned < max) + var/turf/unsimulated/jungle/J = locate(rand(RANDOM_LOWER_X, RANDOM_UPPER_X), rand(RANDOM_LOWER_Y, RANDOM_UPPER_Y), src.z) + if(!istype(J)) + continue + if(!J.bushes_spawn) + continue + river_nodes.Add(new /obj/effect/landmark/river_waypoint(J)) + num_spawned++ - //make some randomly pathing rivers - for(var/obj/effect/landmark/river_waypoint/W in world) - if (W.z != src.z || W.connected) - continue + //make some randomly pathing rivers + for(var/obj/effect/landmark/river_waypoint/W in world) + if (W.z != src.z || W.connected) + continue - W.connected = 1 - var/turf/cur_turf = new /turf/unsimulated/jungle/water(get_turf(W)) - var/turf/target_turf = get_turf(pick(river_nodes)) + W.connected = 1 + var/turf/cur_turf = new /turf/unsimulated/jungle/water(get_turf(W)) + var/turf/target_turf = get_turf(pick(river_nodes)) - var/detouring = 0 - var/cur_dir = get_dir(cur_turf, target_turf) - // - while(cur_turf != target_turf) - //randomly snake around a bit - if(detouring) - if(prob(20)) - detouring = 0 - cur_dir = get_dir(cur_turf, target_turf) - else if(prob(20)) - detouring = 1 - if(prob(50)) - cur_dir = turn(cur_dir, 45) - else - cur_dir = turn(cur_dir, -45) - else - cur_dir = get_dir(cur_turf, target_turf) - - cur_turf = get_step(cur_turf, cur_dir) - - var/skip = 0 - if(!istype(cur_turf, /turf/unsimulated/jungle) || istype(cur_turf, /turf/unsimulated/jungle/rock)) + var/detouring = 0 + var/cur_dir = get_dir(cur_turf, target_turf) + // + while(cur_turf != target_turf) + //randomly snake around a bit + if(detouring) + if(prob(20)) detouring = 0 cur_dir = get_dir(cur_turf, target_turf) - cur_turf = get_step(cur_turf, cur_dir) - continue - - if(!skip) - var/turf/unsimulated/jungle/water/water_turf = new(cur_turf) - water_turf.Spread(75, rand(65, 25)) - - var/list/path_nodes = list() - - //place some ladders leading down to pre-generated temples - max = rand(2,5) - num_spawned = 0 - while(num_spawned < max) - var/turf/unsimulated/jungle/J = locate(rand(RANDOM_LOWER_X, RANDOM_UPPER_X), rand(RANDOM_LOWER_Y, RANDOM_UPPER_Y), src.z) - if(!J || !J.bushes_spawn) - continue - new /obj/effect/landmark/temple(J) - path_nodes.Add(new /obj/effect/landmark/path_waypoint(J)) - num_spawned++ - - //put a native tribe somewhere - num_spawned = 0 - while(num_spawned < 1) - var/turf/unsimulated/jungle/J = locate(rand(RANDOM_LOWER_X, RANDOM_UPPER_X), rand(RANDOM_LOWER_Y, RANDOM_UPPER_Y), src.z) - if(!J || !J.bushes_spawn) - continue - new /obj/effect/jungle_tribe_spawn(J) - path_nodes.Add(new /obj/effect/landmark/path_waypoint(J)) - num_spawned++ - - //place some random path waypoints to confuse players - max = rand(1,3) - num_spawned = 0 - while(num_spawned < max) - var/turf/unsimulated/jungle/J = locate(rand(RANDOM_LOWER_X, RANDOM_UPPER_X), rand(RANDOM_LOWER_Y, RANDOM_UPPER_Y), src.z) - if(!J || !J.bushes_spawn) - continue - path_nodes.Add(new /obj/effect/landmark/path_waypoint(J)) - num_spawned++ - - //get any path nodes placed on the map - for(var/obj/effect/landmark/path_waypoint/W in world) - if (W.z == src.z) - path_nodes.Add(W) - - //make random, connecting paths - for(var/obj/effect/landmark/path_waypoint/W in path_nodes) - if (W.connected) - continue - - W.connected = 1 - var/turf/cur_turf = get_turf(W) - path_nodes.Remove(W) - var/turf/target_turf = get_turf(pick(path_nodes)) - path_nodes.Add(W) - // - cur_turf = new /turf/unsimulated/jungle/path(cur_turf) - - var/detouring = 0 - var/cur_dir = get_dir(cur_turf, target_turf) - // - while(cur_turf != target_turf) - //randomly snake around a bit - if(detouring) - if(prob(20) || get_dist(cur_turf, target_turf) < 5) - detouring = 0 - cur_dir = get_dir(cur_turf, target_turf) - else if(prob(20) && get_dist(cur_turf, target_turf) > 5) - detouring = 1 - if(prob(50)) - cur_dir = turn(cur_dir, 45) - else - cur_dir = turn(cur_dir, -45) + else if(prob(20)) + detouring = 1 + if(prob(50)) + cur_dir = turn(cur_dir, 45) else - cur_dir = get_dir(cur_turf, target_turf) + cur_dir = turn(cur_dir, -45) + else + cur_dir = get_dir(cur_turf, target_turf) - //move a step forward + cur_turf = get_step(cur_turf, cur_dir) + + var/skip = 0 + if(!istype(cur_turf, /turf/unsimulated/jungle) || istype(cur_turf, /turf/unsimulated/jungle/rock)) + detouring = 0 + cur_dir = get_dir(cur_turf, target_turf) cur_turf = get_step(cur_turf, cur_dir) + continue - //if we're not a jungle turf, get back to what we were doing - if(!istype(cur_turf, /turf/unsimulated/jungle/)) + if(!skip) + var/turf/unsimulated/jungle/water/water_turf = new(cur_turf) + water_turf.Spread(75, rand(65, 25)) + + var/list/path_nodes = list() + + //place some ladders leading down to pre-generated temples + max = rand(2,5) + num_spawned = 0 + while(num_spawned < max) + var/turf/unsimulated/jungle/J = locate(rand(RANDOM_LOWER_X, RANDOM_UPPER_X), rand(RANDOM_LOWER_Y, RANDOM_UPPER_Y), src.z) + if(!J || !J.bushes_spawn) + continue + new /obj/effect/landmark/temple(J) + path_nodes.Add(new /obj/effect/landmark/path_waypoint(J)) + num_spawned++ + + //put a native tribe somewhere + num_spawned = 0 + while(num_spawned < 1) + var/turf/unsimulated/jungle/J = locate(rand(RANDOM_LOWER_X, RANDOM_UPPER_X), rand(RANDOM_LOWER_Y, RANDOM_UPPER_Y), src.z) + if(!J || !J.bushes_spawn) + continue + new /obj/effect/jungle_tribe_spawn(J) + path_nodes.Add(new /obj/effect/landmark/path_waypoint(J)) + num_spawned++ + + //place some random path waypoints to confuse players + max = rand(1,3) + num_spawned = 0 + while(num_spawned < max) + var/turf/unsimulated/jungle/J = locate(rand(RANDOM_LOWER_X, RANDOM_UPPER_X), rand(RANDOM_LOWER_Y, RANDOM_UPPER_Y), src.z) + if(!J || !J.bushes_spawn) + continue + path_nodes.Add(new /obj/effect/landmark/path_waypoint(J)) + num_spawned++ + + //get any path nodes placed on the map + for(var/obj/effect/landmark/path_waypoint/W in world) + if (W.z == src.z) + path_nodes.Add(W) + + //make random, connecting paths + for(var/obj/effect/landmark/path_waypoint/W in path_nodes) + if (W.connected) + continue + + W.connected = 1 + var/turf/cur_turf = get_turf(W) + path_nodes.Remove(W) + var/turf/target_turf = get_turf(pick(path_nodes)) + path_nodes.Add(W) + // + cur_turf = new /turf/unsimulated/jungle/path(cur_turf) + + var/detouring = 0 + var/cur_dir = get_dir(cur_turf, target_turf) + // + while(cur_turf != target_turf) + //randomly snake around a bit + if(detouring) + if(prob(20) || get_dist(cur_turf, target_turf) < 5) + detouring = 0 cur_dir = get_dir(cur_turf, target_turf) - cur_turf = get_step(cur_turf, cur_dir) - continue + else if(prob(20) && get_dist(cur_turf, target_turf) > 5) + detouring = 1 + if(prob(50)) + cur_dir = turn(cur_dir, 45) + else + cur_dir = turn(cur_dir, -45) + else + cur_dir = get_dir(cur_turf, target_turf) - var/turf/unsimulated/jungle/J = cur_turf - if(istype(J, /turf/unsimulated/jungle/impenetrable) || istype(J, /turf/unsimulated/jungle/water/deep)) - cur_dir = get_dir(cur_turf, target_turf) - cur_turf = get_step(cur_turf, cur_dir) - continue + //move a step forward + cur_turf = get_step(cur_turf, cur_dir) - if(!istype(J, /turf/unsimulated/jungle/water)) - J = new /turf/unsimulated/jungle/path(cur_turf) - J.Spread(PATH_SPREAD_CHANCE_START, rand(PATH_SPREAD_CHANCE_LOSS_UPPER, PATH_SPREAD_CHANCE_LOSS_LOWER)) - - //create monkey spawners - num_spawned = 0 - max = rand(3,6) - while(num_spawned < max) - var/turf/unsimulated/jungle/J = locate(rand(RANDOM_LOWER_X, RANDOM_UPPER_X), rand(RANDOM_LOWER_Y, RANDOM_UPPER_Y), src.z) - if(!J || !J.bushes_spawn) + //if we're not a jungle turf, get back to what we were doing + if(!istype(cur_turf, /turf/unsimulated/jungle/)) + cur_dir = get_dir(cur_turf, target_turf) + cur_turf = get_step(cur_turf, cur_dir) continue - animal_spawners.Add(new /obj/effect/landmark/animal_spawner/monkey(J)) - num_spawned++ - //create panther spawners - num_spawned = 0 - max = rand(6,12) - while(num_spawned < max) - var/turf/unsimulated/jungle/J = locate(rand(RANDOM_LOWER_X, RANDOM_UPPER_X), rand(RANDOM_LOWER_Y, RANDOM_UPPER_Y), src.z) - if(!J || !istype(J) || !J.bushes_spawn) + var/turf/unsimulated/jungle/J = cur_turf + if(istype(J, /turf/unsimulated/jungle/impenetrable) || istype(J, /turf/unsimulated/jungle/water/deep)) + cur_dir = get_dir(cur_turf, target_turf) + cur_turf = get_step(cur_turf, cur_dir) continue - animal_spawners.Add(new /obj/effect/landmark/animal_spawner/panther(J)) - num_spawned++ - //create snake spawners - num_spawned = 0 - max = rand(6,12) - while(num_spawned < max) - var/turf/unsimulated/jungle/J = locate(rand(RANDOM_LOWER_X, RANDOM_UPPER_X), rand(RANDOM_LOWER_Y, RANDOM_UPPER_Y), src.z) - if(!J || !istype(J) || !J.bushes_spawn) - continue - animal_spawners.Add(new /obj/effect/landmark/animal_spawner/snake(J)) - num_spawned++ + if(!istype(J, /turf/unsimulated/jungle/water)) + J = new /turf/unsimulated/jungle/path(cur_turf) + J.Spread(PATH_SPREAD_CHANCE_START, rand(PATH_SPREAD_CHANCE_LOSS_UPPER, PATH_SPREAD_CHANCE_LOSS_LOWER)) - //create parrot spawners - num_spawned = 0 - max = rand(3,6) - while(num_spawned < max) - var/turf/unsimulated/jungle/J = locate(rand(RANDOM_LOWER_X, RANDOM_UPPER_X), rand(RANDOM_LOWER_Y, RANDOM_UPPER_Y), src.z) - if(!J || !istype(J) || !J.bushes_spawn) - continue - animal_spawners.Add(new /obj/effect/landmark/animal_spawner/parrot(J)) - num_spawned++ + //create monkey spawners + num_spawned = 0 + max = rand(3,6) + while(num_spawned < max) + var/turf/unsimulated/jungle/J = locate(rand(RANDOM_LOWER_X, RANDOM_UPPER_X), rand(RANDOM_LOWER_Y, RANDOM_UPPER_Y), src.z) + if(!J || !J.bushes_spawn) + continue + animal_spawners.Add(new /obj/effect/landmark/animal_spawner/monkey(J)) + num_spawned++ + + //create panther spawners + num_spawned = 0 + max = rand(6,12) + while(num_spawned < max) + var/turf/unsimulated/jungle/J = locate(rand(RANDOM_LOWER_X, RANDOM_UPPER_X), rand(RANDOM_LOWER_Y, RANDOM_UPPER_Y), src.z) + if(!J || !istype(J) || !J.bushes_spawn) + continue + animal_spawners.Add(new /obj/effect/landmark/animal_spawner/panther(J)) + num_spawned++ + + //create snake spawners + num_spawned = 0 + max = rand(6,12) + while(num_spawned < max) + var/turf/unsimulated/jungle/J = locate(rand(RANDOM_LOWER_X, RANDOM_UPPER_X), rand(RANDOM_LOWER_Y, RANDOM_UPPER_Y), src.z) + if(!J || !istype(J) || !J.bushes_spawn) + continue + animal_spawners.Add(new /obj/effect/landmark/animal_spawner/snake(J)) + num_spawned++ + + //create parrot spawners + num_spawned = 0 + max = rand(3,6) + while(num_spawned < max) + var/turf/unsimulated/jungle/J = locate(rand(RANDOM_LOWER_X, RANDOM_UPPER_X), rand(RANDOM_LOWER_Y, RANDOM_UPPER_Y), src.z) + if(!J || !istype(J) || !J.bushes_spawn) + continue + animal_spawners.Add(new /obj/effect/landmark/animal_spawner/parrot(J)) + num_spawned++ #undef PATH_SPREAD_CHANCE_START #undef PATH_SPREAD_CHANCE_LOSS_UPPER diff --git a/code/ZAS/Connection.dm b/code/ZAS/Connection.dm index bd8eb43787c..da41edf406b 100644 --- a/code/ZAS/Connection.dm +++ b/code/ZAS/Connection.dm @@ -21,6 +21,7 @@ connection last_updated //The tick at which this was last updated. no_zone_count = 0 + New(turf/T,turf/O) A = T B = O @@ -49,51 +50,23 @@ connection if(A.CanPass(null, B, 0, 0)) - if(!A.zone.connected_zones) - A.zone.connected_zones = list() - if(!B.zone.connected_zones) - B.zone.connected_zones = list() - - if(B.zone in A.zone.connected_zones) - A.zone.connected_zones[B.zone]++ - else - A.zone.connected_zones += B.zone - A.zone.connected_zones[B.zone] = 1 - - if(A.zone in B.zone.connected_zones) - B.zone.connected_zones[A.zone]++ - else - B.zone.connected_zones += A.zone - B.zone.connected_zones[A.zone] = 1 + ConnectZones(A.zone, B.zone, 1) if(A.HasDoor(B) || B.HasDoor(A)) indirect = CONNECTION_INDIRECT else + ConnectZones(A.zone, B.zone) indirect = CONNECTION_CLOSED - if(!A.zone.closed_connection_zones) - A.zone.closed_connection_zones = list() - if(B.zone in A.zone.closed_connection_zones) - A.zone.closed_connection_zones[B.zone]++ - else - A.zone.closed_connection_zones += B.zone - A.zone.closed_connection_zones[B.zone] = 1 - - if(!B.zone.closed_connection_zones) - B.zone.closed_connection_zones = list() - if(A.zone in B.zone.closed_connection_zones) - B.zone.closed_connection_zones[A.zone]++ - else - B.zone.closed_connection_zones += A.zone - B.zone.closed_connection_zones[A.zone] = 1 - else - world.log << "Attempted to create connection object for non-zone tiles: [T] -> [O]" + world.log << "Attempted to create connection object for non-zone tiles: [T] ([T.x],[T.y],[T.z]) -> [O] ([O.x],[O.y],[O.z])" del(src) + Del() + //remove connections from master lists. if(ref_B in air_master.turfs_with_connections) var/list/connections = air_master.turfs_with_connections[ref_B] connections.Remove(src) @@ -102,279 +75,203 @@ connection var/list/connections = air_master.turfs_with_connections[ref_A] connections.Remove(src) + //Ensure we delete the right values by sanity checkign right before deletion. + Sanitize() + + //Remove connection from current zones. if(A) if(A.zone && A.zone.connections) A.zone.connections.Remove(src) if(!A.zone.connections.len) - del A.zone.connections + A.zone.connections = null if(B) if(B.zone && B.zone.connections) B.zone.connections.Remove(src) if(!B.zone.connections.len) - del B.zone.connections - if(zone_A) - if(zone_A && zone_A.connections) - zone_A.connections.Remove(src) - if(!zone_A.connections.len) - del zone_A.connections - if(zone_B) - if(zone_B && zone_B.connections) - zone_B.connections.Remove(src) - if(!zone_B.connections.len) - del zone_B.connections + B.zone.connections = null - if(indirect != CONNECTION_CLOSED) - if(A && A.zone) - if(B && B.zone) - if(B.zone in A.zone.connected_zones) - if(A.zone.connected_zones[B.zone] > 1) - A.zone.connected_zones[B.zone]-- - else - A.zone.connected_zones -= B.zone - if(A.zone.connected_zones && !A.zone.connected_zones.len) - A.zone.connected_zones = null - if( zone_B && (!B.zone || zone_B != B.zone) ) - if(zone_B in A.zone.connected_zones) - if(A.zone.connected_zones[zone_B] > 1) - A.zone.connected_zones[zone_B]-- - else - A.zone.connected_zones -= zone_B - if(A.zone.connected_zones && !A.zone.connected_zones.len) - A.zone.connected_zones = null - if(zone_A && (!A.zone || zone_A != A.zone)) - if(B && B.zone) - if(B.zone in zone_A.connected_zones) - if(zone_A.connected_zones[B.zone] > 1) - zone_A.connected_zones[B.zone]-- - else - zone_A.connected_zones -= B.zone - if(zone_A.connected_zones && !zone_A.connected_zones.len) - zone_A.connected_zones = null - if( zone_B && (!B.zone || zone_B != B.zone) ) - if(zone_B in zone_A.connected_zones) - if(zone_A.connected_zones[zone_B] > 1) - zone_A.connected_zones[zone_B]-- - else - zone_A.connected_zones -= zone_B - if(zone_A.connected_zones && !zone_A.connected_zones.len) - zone_A.connected_zones = null - if(B && B.zone) - if(A && A.zone) - if(A.zone in B.zone.connected_zones) - if(B.zone.connected_zones[A.zone] > 1) - B.zone.connected_zones[A.zone]-- - else - B.zone.connected_zones -= A.zone - if(B.zone.connected_zones && !B.zone.connected_zones.len) - B.zone.connected_zones = null - if( zone_A && (!A.zone || zone_A != A.zone) ) - if(zone_A in B.zone.connected_zones) - if(B.zone.connected_zones[zone_A] > 1) - B.zone.connected_zones[zone_A]-- - else - B.zone.connected_zones -= zone_A - if(B.zone.connected_zones && !B.zone.connected_zones.len) - B.zone.connected_zones = null - if(zone_B && (!B.zone || zone_B != B.zone)) - if(A && A.zone) - if(A.zone in zone_B.connected_zones) - if(zone_B.connected_zones[A.zone] > 1) - zone_B.connected_zones[A.zone]-- - else - zone_B.connected_zones -= A.zone - if(zone_B.connected_zones && !zone_B.connected_zones.len) - zone_B.connected_zones = null - if( zone_A && (!A.zone || zone_A != A.zone) ) - if(zone_A in zone_B.connected_zones) - if(zone_B.connected_zones[zone_A] > 1) - zone_B.connected_zones[zone_A]-- - else - zone_B.connected_zones -= zone_A - if(zone_B.connected_zones && !zone_B.connected_zones.len) - zone_B.connected_zones = null - else - if(A && A.zone) - if(B && B.zone) - if(B.zone in A.zone.closed_connection_zones) - if(A.zone.closed_connection_zones[B.zone] > 1) - A.zone.closed_connection_zones[B.zone]-- - else - A.zone.closed_connection_zones -= B.zone - if(A.zone.closed_connection_zones && !A.zone.closed_connection_zones.len) - A.zone.closed_connection_zones = null - if( zone_B && (!B.zone || zone_B != B.zone) ) - if(zone_B in A.zone.closed_connection_zones) - if(A.zone.closed_connection_zones[zone_B] > 1) - A.zone.closed_connection_zones[zone_B]-- - else - A.zone.closed_connection_zones -= zone_B - if(A.zone.closed_connection_zones && !A.zone.closed_connection_zones.len) - A.zone.closed_connection_zones = null - if(zone_A && (!A.zone || zone_A != A.zone)) - if(B && B.zone) - if(B.zone in zone_A.closed_connection_zones) - if(zone_A.closed_connection_zones[B.zone] > 1) - zone_A.closed_connection_zones[B.zone]-- - else - zone_A.closed_connection_zones -= B.zone - if(zone_A.closed_connection_zones && !zone_A.closed_connection_zones.len) - zone_A.closed_connection_zones = null - if( zone_B && (!B.zone || zone_B != B.zone) ) - if(zone_B in zone_A.closed_connection_zones) - if(zone_A.closed_connection_zones[zone_B] > 1) - zone_A.closed_connection_zones[zone_B]-- - else - zone_A.closed_connection_zones -= zone_B - if(zone_A.closed_connection_zones && !zone_A.closed_connection_zones.len) - zone_A.closed_connection_zones = null - if(B && B.zone) - if(A && A.zone) - if(A.zone in B.zone.closed_connection_zones) - if(B.zone.closed_connection_zones[A.zone] > 1) - B.zone.closed_connection_zones[A.zone]-- - else - B.zone.closed_connection_zones -= A.zone - if(B.zone.closed_connection_zones && !B.zone.closed_connection_zones.len) - B.zone.closed_connection_zones = null - if( zone_A && (!A.zone || zone_A != A.zone) ) - if(zone_A in B.zone.closed_connection_zones) - if(B.zone.closed_connection_zones[zone_A] > 1) - B.zone.closed_connection_zones[zone_A]-- - else - B.zone.closed_connection_zones -= zone_A - if(B.zone.closed_connection_zones && !B.zone.closed_connection_zones.len) - B.zone.closed_connection_zones = null - if(zone_B && (!B.zone || zone_B != B.zone)) - if(A && A.zone) - if(A.zone in zone_B.closed_connection_zones) - if(zone_B.closed_connection_zones[A.zone] > 1) - zone_B.closed_connection_zones[A.zone]-- - else - zone_B.closed_connection_zones -= A.zone - if(zone_B.closed_connection_zones && !zone_B.closed_connection_zones.len) - zone_B.closed_connection_zones = null - if( zone_A && (!A.zone || zone_A != A.zone) ) - if(zone_A in zone_B.closed_connection_zones) - if(zone_B.closed_connection_zones[zone_A] > 1) - zone_B.closed_connection_zones[zone_A]-- - else - zone_B.closed_connection_zones -= zone_A - if(zone_B.closed_connection_zones && !zone_B.closed_connection_zones.len) - zone_B.closed_connection_zones = null + //Disconnect zones while handling unusual conditions. + // e.g. loss of a zone on a turf + if(A && A.zone && B && B.zone) + DisconnectZones(A.zone, B.zone) + + //Finally, preform actual deletion. . = ..() + + proc/ConnectZones(var/zone/zone_1, var/zone/zone_2, open = 0) + + //Sanity checking + if(!istype(zone_1) || !istype(zone_2)) + return + + //Handle zones connecting indirectly/directly. + if(open) + + //Create the lists if necessary. + if(!zone_1.connected_zones) + zone_1.connected_zones = list() + + if(!zone_2.connected_zones) + zone_2.connected_zones = list() + + //Increase the number of connections between zones. + if(zone_2 in zone_1.connected_zones) + zone_1.connected_zones[zone_2]++ + else + zone_1.connected_zones += zone_2 + zone_1.connected_zones[zone_2] = 1 + + if(zone_1 in zone_2.connected_zones) + zone_2.connected_zones[zone_1]++ + else + zone_2.connected_zones += zone_1 + zone_2.connected_zones[zone_1] = 1 + + //Handle closed connections. + else + + //Create the lists + if(!zone_1.closed_connection_zones) + zone_1.closed_connection_zones = list() + + if(!zone_2.closed_connection_zones) + zone_2.closed_connection_zones = list() + + //Increment the connections. + if(zone_2 in zone_1.closed_connection_zones) + zone_1.closed_connection_zones[zone_2]++ + else + zone_1.closed_connection_zones += zone_2 + zone_1.closed_connection_zones[zone_2] = 1 + + if(zone_1 in zone_2.closed_connection_zones) + zone_2.closed_connection_zones[zone_1]++ + else + zone_2.closed_connection_zones += zone_1 + zone_2.closed_connection_zones[zone_1] = 1 + + + proc/DisconnectZones(var/zone/zone_1, var/zone/zone_2) + + //Sanity checking + if(!istype(zone_1) || !istype(zone_2)) + return + + //Handle disconnection of indirectly or directly connected zones. + if( (zone_1 in zone_2.connected_zones) || (zone_2 in zone_1.connected_zones) ) + + //If there are more than one connection, decrement the number of connections + //Otherwise, remove all connections between the zones. + if(zone_1.connected_zones[zone_2] > 1) + zone_1.connected_zones[zone_2]-- + else + zone_1.connected_zones -= zone_2 + //remove the list if it is empty + if(!zone_1.connected_zones.len) + zone_1.connected_zones = null + + //Then do the same for the other zone. + if(zone_2.connected_zones[zone_1] > 1) + zone_2.connected_zones[zone_1]-- + else + zone_2.connected_zones -= zone_1 + if(!zone_2.connected_zones.len) + zone_2.connected_zones = null + + //Handle disconnection of closed zones. + if( (zone_1 in zone_2.closed_connection_zones) || (zone_2 in zone_1.closed_connection_zones) ) + + //If there are more than one connection, decrement the number of connections + //Otherwise, remove all connections between the zones. + if(zone_1.closed_connection_zones[zone_2] > 1) + zone_1.closed_connection_zones[zone_2]-- + else + zone_1.closed_connection_zones -= zone_2 + //remove the list if it is empty + if(!zone_1.closed_connection_zones.len) + zone_1.closed_connection_zones = null + + //Then do the same for the other zone. + if(zone_2.closed_connection_zones[zone_1] > 1) + zone_2.closed_connection_zones[zone_1]-- + else + zone_2.closed_connection_zones -= zone_1 + if(!zone_2.closed_connection_zones.len) + zone_2.closed_connection_zones = null + + proc/Cleanup() + + //Check sanity: existance of turfs if(!A || !B) - //world.log << "Connection removed: [A] or [B] missing entirely." del src + + //Check sanity: zones are different if(A.zone == B.zone) - //world.log << "Connection removed: Zones now merged." del src + + //Check sanity: same turfs as before. if(ref_A != "\ref[A]" || ref_B != "\ref[B]") del src + + //Handle zones changing on a turf. if((A.zone && A.zone != zone_A) || (B.zone && B.zone != zone_B)) Sanitize() + + //Manage sudden loss of a turfs zone. (e.g. a wall being built) if(!A.zone || !B.zone) no_zone_count++ if(no_zone_count >= 5) //world.log << "Connection removed: [A] or [B] missing a zone." del src return 0 + return 1 + proc/CheckPassSanity() + //Sanity check, first. Cleanup() + if(A.zone && B.zone) + + //If no walls are blocking us... if(A.ZAirPass(B)) + //...we check to see if there is a door in the way... var/door_pass = A.CanPass(null,B,1.5,1) + //...and if it is opened. if(door_pass || A.CanPass(null,B,0,0)) + + //Make and remove connections to let air pass. if(indirect == CONNECTION_CLOSED) - //ADJUST FOR CAN CONNECT - if(!A.zone.connected_zones) - A.zone.connected_zones = list() - if(B.zone in A.zone.connected_zones) - A.zone.connected_zones[B.zone]++ - else - A.zone.connected_zones += B.zone - A.zone.connected_zones[B.zone] = 1 - - if(!B.zone.connected_zones) - B.zone.connected_zones = list() - if(A.zone in B.zone.connected_zones) - B.zone.connected_zones[A.zone]++ - else - B.zone.connected_zones += A.zone - B.zone.connected_zones[A.zone] = 1 - - if(A.zone.closed_connection_zones) - if(A.zone.closed_connection_zones[B.zone] > 1) - A.zone.closed_connection_zones[B.zone]-- - else - A.zone.closed_connection_zones.Remove(B.zone) - if(A.zone.closed_connection_zones && !A.zone.closed_connection_zones.len) - A.zone.closed_connection_zones = null - - if(B.zone.closed_connection_zones) - if(B.zone.closed_connection_zones[A.zone] > 1) - B.zone.closed_connection_zones[A.zone]-- - else - B.zone.closed_connection_zones.Remove(A.zone) - - if(B.zone.closed_connection_zones && !B.zone.closed_connection_zones.len) - B.zone.closed_connection_zones = null + DisconnectZones(A.zone, B.zone) + ConnectZones(A.zone, B.zone, 1) if(door_pass) indirect = CONNECTION_DIRECT else if(!door_pass) indirect = CONNECTION_INDIRECT + //The door is instead closed. else if(indirect > CONNECTION_CLOSED) indirect = CONNECTION_CLOSED - //ADJUST FOR CANNOT CONNECT - if(A.zone.connected_zones) - if(A.zone.connected_zones[B.zone] > 1) - A.zone.connected_zones[B.zone]-- - else - A.zone.connected_zones.Remove(B.zone) - if(A.zone.connected_zones && !A.zone.connected_zones.len) - A.zone.connected_zones = null + DisconnectZones(A.zone, B.zone) + ConnectZones(A.zone, B.zone) - if(B.zone.connected_zones) - if(B.zone.connected_zones[A.zone] > 1) - B.zone.connected_zones[A.zone]-- - else - B.zone.connected_zones.Remove(A.zone) - - if(B.zone.connected_zones && !B.zone.connected_zones.len) - B.zone.connected_zones = null - - //Add to the closed connections list(s) - if(!A.zone.closed_connection_zones) - A.zone.closed_connection_zones = list() - if(B.zone in A.zone.closed_connection_zones) - A.zone.closed_connection_zones[B.zone]++ - else - A.zone.closed_connection_zones += B.zone - A.zone.closed_connection_zones[B.zone] = 1 - - if(!B.zone.closed_connection_zones) - B.zone.closed_connection_zones = list() - if(A.zone in B.zone.closed_connection_zones) - B.zone.closed_connection_zones[A.zone]++ - else - B.zone.closed_connection_zones += A.zone - B.zone.closed_connection_zones[A.zone] = 1 - - else //If I can no longer pass air, better delete + //If I can no longer pass air, better delete + else del src proc/Sanitize() //If the zones change on connected turfs, update it. - if(A.zone && A.zone != zone_A && B.zone && B.zone != zone_B) - if(!A.zone || !B.zone) - del src + //Both zones changed (wat) + if(A.zone && A.zone != zone_A && B.zone && B.zone != zone_B) + + //If the zones have gotten swapped + // (do not ask me how, I am just being anal retentive about sanity) if(A.zone == zone_B && B.zone == zone_A) var/turf/temp = B B = A @@ -386,208 +283,101 @@ connection ref_B = temp_ref return - if(zone_A) - if(zone_A.connections) - zone_A.connections.Remove(src) - if(!zone_A.connections.len) - del zone_A.connections + //Handle removal of connections from archived zones. + if(zone_A && zone_A.connections) + zone_A.connections.Remove(src) + if(!zone_A.connections.len) + zone_A.connections = null - if(indirect != CONNECTION_CLOSED) - if(zone_A.connected_zones) - if(zone_A.connected_zones[zone_B] > 1) - zone_A.connected_zones[zone_B]-- - else - zone_A.connected_zones.Remove(zone_B) - if(zone_A.connected_zones && !zone_A.connected_zones.len) - zone_A.connected_zones = null + if(zone_B && zone_B.connections) + zone_B.connections.Remove(src) + if(!zone_B.connections.len) + zone_B.connections = null - else - if(zone_A.closed_connection_zones) - if(zone_A.closed_connection_zones[zone_B] > 1) - zone_A.closed_connection_zones[zone_B]-- - else - zone_A.closed_connection_zones.Remove(zone_B) - if(zone_A.closed_connection_zones && !zone_A.closed_connection_zones.len) - zone_A.closed_connection_zones = null - - - if(zone_B) - if(zone_B.connections) - zone_B.connections.Remove(src) - if(!zone_B.connections.len) - del zone_B.connections - - if(indirect != CONNECTION_CLOSED) - if(zone_B.connected_zones) - if(zone_B.connected_zones[zone_A] > 1) - zone_B.connected_zones[zone_A]-- - else - zone_B.connected_zones.Remove(zone_A) - if(zone_B.connected_zones && !zone_B.connected_zones.len) - zone_B.connected_zones = null - - else - if(zone_B.closed_connection_zones) - if(zone_B.closed_connection_zones[zone_A] > 1) - zone_B.closed_connection_zones[zone_A]-- - else - zone_B.closed_connection_zones.Remove(zone_A) - if(zone_B.closed_connection_zones && !zone_B.closed_connection_zones.len) - zone_B.closed_connection_zones = null - - if(indirect != CONNECTION_CLOSED) + if(A.zone) if(!A.zone.connections) A.zone.connections = list() A.zone.connections |= src + + if(B.zone) if(!B.zone.connections) B.zone.connections = list() B.zone.connections |= src - if(!A.zone.connected_zones) - A.zone.connected_zones = list() - if(B.zone in A.zone.connected_zones) - A.zone.connected_zones[B.zone]++ - else - A.zone.connected_zones += B.zone - A.zone.connected_zones[B.zone] = 1 + //If either zone is null, we disconnect the archived ones after cleaning up the connections. + if(!A.zone || !B.zone) + if(zone_A && zone_B) + DisconnectZones(zone_B, zone_A) - if(!B.zone.connected_zones) - B.zone.connected_zones = list() - if(A.zone in B.zone.connected_zones) - B.zone.connected_zones[A.zone]++ - else - B.zone.connected_zones += A.zone - B.zone.connected_zones[A.zone] = 1 + if(!A.zone) + zone_A = A.zone - else + if(!B.zone) + zone_B = B.zone + return - if(!A.zone.connections) - A.zone.connections = list() - A.zone.connections |= src - if(!B.zone.connections) - B.zone.connections = list() - B.zone.connections |= src - - if(!A.zone.closed_connection_zones) - A.zone.closed_connection_zones = list() - if(B.zone in A.zone.closed_connection_zones) - A.zone.closed_connection_zones[B.zone]++ - else - A.zone.closed_connection_zones += B.zone - A.zone.closed_connection_zones[B.zone] = 1 - - if(!B.zone.closed_connection_zones) - B.zone.closed_connection_zones = list() - if(A.zone in B.zone.closed_connection_zones) - B.zone.closed_connection_zones[A.zone]++ - else - B.zone.closed_connection_zones += A.zone - B.zone.closed_connection_zones[A.zone] = 1 + //Handle diconnection and reconnection of zones. + if(zone_A && zone_B) + DisconnectZones(zone_A, zone_B) + ConnectZones(A.zone, B.zone, indirect) + //resetting values of archived values. zone_B = B.zone - zone_A = A.zone - + //The "A" zone changed. else if(A.zone && A.zone != zone_A) - if(zone_A) + //Handle connection cleanup + if(zone_A) if(zone_A.connections) zone_A.connections.Remove(src) if(!zone_A.connections.len) - del zone_A.connections + zone_A.connections = null + + if(A.zone) if(!A.zone.connections) A.zone.connections = list() A.zone.connections |= src - if(indirect != CONNECTION_CLOSED) - if(zone_A.connected_zones) - if(zone_A.connected_zones[zone_B] > 1) - zone_A.connected_zones[zone_B]-- - else - zone_A.connected_zones.Remove(zone_B) - if(zone_A.connected_zones && !zone_A.connected_zones.len) - zone_A.connected_zones = null - - if(!A.zone.connected_zones) - A.zone.connected_zones = list() - if(!(zone_B in A.zone.connected_zones)) - A.zone.connected_zones += zone_B - A.zone.connected_zones[zone_B] = 1 - else - A.zone.connected_zones[zone_B]++ - - else - if(zone_A.closed_connection_zones) - if(zone_A.closed_connection_zones[zone_B] > 1) - zone_A.closed_connection_zones[zone_B]-- - else - zone_A.closed_connection_zones.Remove(zone_B) - if(zone_A.closed_connection_zones && !zone_A.closed_connection_zones.len) - zone_A.closed_connection_zones = null - - if(!A.zone.closed_connection_zones) - A.zone.closed_connection_zones = list() - if(!(zone_B in A.zone.closed_connection_zones)) - A.zone.closed_connection_zones += zone_B - A.zone.closed_connection_zones[zone_B] = 1 - else - A.zone.closed_connection_zones[zone_B]++ - + //If the "A" zone is null, we disconnect the archived ones after cleaning up the connections. + if(!A.zone) + if(zone_A && zone_B) + DisconnectZones(zone_A, zone_B) zone_A = A.zone + return - else - del src + //Handle diconnection and reconnection of zones. + if(zone_A && zone_B) + DisconnectZones(zone_A, zone_B) + ConnectZones(A.zone, B.zone, indirect) + //The "B" zone changed. else if(B.zone && B.zone != zone_B) - if(zone_B) + //Handle connection cleanup + if(zone_B) if(zone_B.connections) zone_B.connections.Remove(src) if(!zone_B.connections.len) - del zone_B.connections + zone_B.connections = null + + if(B.zone) if(!B.zone.connections) B.zone.connections = list() B.zone.connections |= src - if(indirect != CONNECTION_CLOSED) - if(zone_B.connected_zones) - if(zone_B.connected_zones[zone_A] > 1) - zone_B.connected_zones[zone_A]-- - else - zone_B.connected_zones.Remove(zone_A) - if(zone_B.connected_zones && !zone_B.connected_zones.len) - zone_B.connected_zones = null - - if(!B.zone.connected_zones) - B.zone.connected_zones = list() - if(!(zone_A in B.zone.connected_zones)) - B.zone.connected_zones += zone_A - B.zone.connected_zones[zone_A] = 1 - else - B.zone.connected_zones[zone_A]++ - - else - if(zone_B.closed_connection_zones) - if(zone_B.closed_connection_zones[zone_A] > 1) - zone_B.closed_connection_zones[zone_A]-- - else - zone_B.closed_connection_zones.Remove(zone_A) - if(zone_B.closed_connection_zones && !zone_B.closed_connection_zones.len) - zone_B.closed_connection_zones = null - - if(!B.zone.closed_connection_zones) - B.zone.closed_connection_zones = list() - if(!(zone_A in B.zone.closed_connection_zones)) - B.zone.closed_connection_zones += zone_A - B.zone.closed_connection_zones[zone_A] = 1 - else - B.zone.closed_connection_zones[zone_A]++ - + //If the "B" zone is null, we disconnect the archived ones after cleaning up the connections. + if(!B.zone) + if(zone_A && zone_B) + DisconnectZones(zone_A, zone_B) zone_B = B.zone + return - else - del src + //Handle diconnection and reconnection of zones. + if(zone_A && zone_B) + DisconnectZones(zone_A, zone_B) + ConnectZones(A.zone, B.zone, indirect) #undef CONNECTION_DIRECT diff --git a/code/ZAS/Debug.dm b/code/ZAS/Debug.dm index 9cde83e7e3a..9a7ef43a071 100644 --- a/code/ZAS/Debug.dm +++ b/code/ZAS/Debug.dm @@ -40,7 +40,7 @@ client/proc/Test_ZAS_Connection(var/turf/simulated/T as turf) if(!istype(other_turf)) return - var/pass_directions = T.CanPass(null, other_turf, 0, 0) + 2*other_turf.CanPass(null, T, 0, 0) + var/pass_directions = T.CanPass(null, other_turf, 0, 0) + 2 * other_turf.CanPass(null, T, 0, 0) switch(pass_directions) if(0) @@ -80,12 +80,9 @@ zone/proc M << "Connections: [length(connections)]" for(var/connection/C in connections) - M << "[C.A] --> [C.B] [(C.indirect?"Indirect":"Direct")]" + M << "[C.A] --> [C.B] [(C.indirect?"Open":"Closed")]" C.A.overlays += 'debug_connect.dmi' C.B.overlays += 'debug_connect.dmi' - spawn(50) - C.A.overlays -= 'debug_connect.dmi' - C.B.overlays -= 'debug_connect.dmi' for(var/C in connections) if(!istype(C,/connection)) M << "[C] (Not Connection!)" diff --git a/code/ZAS/FEA_system.dm b/code/ZAS/FEA_system.dm index 1eadd31ed6b..94b7c5cf6d1 100644 --- a/code/ZAS/FEA_system.dm +++ b/code/ZAS/FEA_system.dm @@ -101,12 +101,10 @@ datum //Geometry updates lists var/list/tiles_to_update = list() var/list/connections_to_check = list() - var/list/rebuilds_to_consider = list() var/current_cycle = 0 var/update_delay = 5 //How long between check should it try to process atmos again. var/failed_ticks = 0 //How many ticks have runtimed? - var/next_stat_check = 10 var/tick_progress = 0 @@ -137,7 +135,10 @@ datum var/start_time = world.timeofday + var/simulated_turf_count = 0 + for(var/turf/simulated/S in world) + simulated_turf_count++ if(!S.zone && !S.blocks_air) if(S.CanPass(null, S, 0, 0)) new/zone(S) @@ -145,8 +146,12 @@ datum for(var/turf/simulated/S in world) S.update_air_properties() - world << "\red \b Geometry processed in [time2text(world.timeofday-start_time, "mm:ss")] minutes!" -// spawn start() + world << {"Geometry initialized in [round(0.1*(world.timeofday-start_time),0.1)] seconds. + Total Simulated Turfs: [simulated_turf_count] + Total Zones: [zones.len] + Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_count]"} + /* + spawn start() proc/start() //Purpose: This is kicked off by the master controller, and controls the processing of all atmosphere. @@ -154,7 +159,7 @@ datum //Inputs: None. //Outputs: None. - /* + set background = 1 while(1) @@ -172,55 +177,30 @@ datum proc/tick() . = 1 //Set the default return value, for runtime detection. - tick_progress = "next_stat_check (atmos statistics)" - if(current_cycle >= next_stat_check) - var/zone/z = pick(zones) - var/log_file = file("[time2text(world.timeofday, "statistics/DD-MM-YYYY-air.txt")]") - log_file << "\"\The [get_area(pick(z.contents))]\",[z.air.oxygen],[z.air.nitrogen],[z.air.carbon_dioxide],[z.air.toxins],[z.air.temperature],[z.air.group_multiplier * z.air.volume]" - next_stat_check = current_cycle + (rand(5,7)*60) - tick_progress = "update_air_properties" if(tiles_to_update.len) //If there are tiles to update, do so. for(var/turf/simulated/T in tiles_to_update) - var/output = T.update_air_properties() - if(. && T && !output) + if(. && T && !T.update_air_properties()) . = 0 //If a runtime occured, make sure we can sense it. //message_admins("ZASALERT: Unable run turf/simualted/update_air_properties()") tiles_to_update = list() - tick_progress = "reconsider_zones" - if(rebuilds_to_consider.len) - for(var/turf/T in rebuilds_to_consider) - if(istype(T, /turf/simulated) && T.zone && !T.zone.rebuild) - var/turf/simulated/other_turf = rebuilds_to_consider[T] - if(istype(other_turf)) - ConsiderRebuild(T,other_turf) - else if(istype(other_turf, /list)) - var/list/temp_turfs = other_turf - for(var/turf/NT in temp_turfs) - ConsiderRebuild(T,NT) - else if (istype(T)) - var/turf/simulated/other_turf = rebuilds_to_consider[T] - if(istype(other_turf)) - ConsiderRebuild(other_turf,T) - else if(istype(other_turf, /list)) - var/list/temp_turfs = other_turf - for(var/turf/simulated/NT in temp_turfs) - ConsiderRebuild(NT,T) - rebuilds_to_consider = list() - + //Check sanity on connection objects. tick_progress = "connections_to_check" if(connections_to_check.len) for(var/connection/C in connections_to_check) C.CheckPassSanity() connections_to_check = list() + //Ensure tiles still have zones. tick_progress = "tiles_to_reconsider_zones" if(tiles_to_reconsider_zones.len) for(var/turf/simulated/T in tiles_to_reconsider_zones) if(!T.zone) new /zone(T) + tiles_to_reconsider_zones = list() + //Process zones. tick_progress = "zone/process()" for(var/zone/Z in zones) if(Z.last_update < current_cycle) @@ -229,150 +209,10 @@ datum Z.last_update = current_cycle if(. && Z && !output) . = 0 - log_admin("ZASALERT: unable run zone/process(), [Z.progress]") - message_admins("ZASALERT. ZASALERT: unable run zone/proc/process(), [Z.progress], tell someone about this!") - + //Process fires. tick_progress = "active_hotspots (fire)" for(var/obj/fire/F in active_hotspots) - var/output = F.process() - if(. && F && !output) + if(. && F && !F.process()) . = 0 - //message_admins("ZASALERT: Unable run obj/fire/process()") - tick_progress = "success" - - proc/AddToConsiderRebuild(var/turf/simulated/T, var/turf/NT) - var/turf/existing_test = rebuilds_to_consider[T] - var/turf/existing_test_alternate = rebuilds_to_consider[NT] - - if(existing_test) - if(NT == existing_test) - return - else if(islist(existing_test) && existing_test[NT]) - return - - else if(existing_test_alternate) - if(T == existing_test_alternate) - return - else if(islist(existing_test_alternate) && existing_test_alternate[T]) - return - - if(istype(T)) - if(istype(existing_test)) - var/list/temp_list = list(NT = 1, existing_test = 1) - rebuilds_to_consider[T] = temp_list - else if(istype(existing_test, /list)) - existing_test[NT] = 1 - else - rebuilds_to_consider[T] = NT - - else if(istype(NT, /turf/simulated)) - if(istype(existing_test_alternate)) - var/list/temp_list = list(T = 1, existing_test_alternate = 1) - rebuilds_to_consider[NT] = temp_list - else if(istype(existing_test_alternate, /list)) - existing_test_alternate[T] = 1 - else - rebuilds_to_consider[NT] = T - - proc/ConsiderRebuild(var/turf/simulated/T, var/turf/NT) - - if(!istype(T)) return - //zones should naturally spread to these tiles eventually - if(!T.zone || !NT.zone) - return - - if(istype(NT, /turf/simulated) && NT.zone != T.zone) - T.zone.RemoveTurf(NT) - if(NT.zone) - NT.zone.RemoveTurf(T) - return - if(T.zone.rebuild) - return - - var/zone/zone = T.zone - - var/target_dir = get_dir(T, NT) - if(target_dir in list(NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST)) - T.zone.rebuild = 1 - return - var/test_dir = turn(target_dir, 90) - - var/turf/simulated/current = T - var/turf/simulated/next - var/stepped_back = 0 - - if( !(T.air_check_directions&test_dir || T.air_check_directions&turn(target_dir, 270)) ) - //Step back, then try to connect. - if(!(T.air_check_directions&get_dir(NT, T))) - zone.rebuild = 1 - return - current = get_step(T, get_dir(NT, T)) - if(!istype(current) || !(current.air_check_directions&test_dir || current.air_check_directions&turn(target_dir, 270)) ) - zone.rebuild = 1 - return - stepped_back = 1 - - if ( !(current.air_check_directions&test_dir) && current.air_check_directions&turn(target_dir, 270) ) - //Try to connect to the right hand side. - var/flipped = 0 - test_dir = turn(target_dir, 270) - - for(var/i = 1, i <= 10, i++) - if(get_dir(current, NT) in cardinal) - target_dir = get_dir(current, NT) - - if(!istype(current) || !(current.air_check_directions&target_dir || current.air_check_directions&test_dir)) - if(flipped) - zone.rebuild = 1 - return - current = T - test_dir = turn(target_dir, 180) - i = 0 - target_dir = get_dir(current, NT) - flipped = 1 - continue - - if(current.air_check_directions&target_dir && !stepped_back) - next = get_step(current, target_dir) - if(!next.HasDoor()) - current = next - - if(current.air_check_directions&test_dir && current != next) - next = get_step(current, test_dir) - if(!next.HasDoor()) - current = next - - if(current == NT) - return //We made it, yaaay~ - stepped_back = 0 - zone.rebuild = 1 - - else if ( current.air_check_directions&test_dir ) - //Try to connect to the left hand side. - for(var/i = 1, i <= 10, i++) - if(get_dir(current, NT) in cardinal) - target_dir = get_dir(current, NT) - - if(!istype(current) || !(current.air_check_directions&target_dir || current.air_check_directions&test_dir)) - zone.rebuild = 1 - return - - if(current.air_check_directions&target_dir && !stepped_back) - next = get_step(current, target_dir) - if(!next.HasDoor()) - current = next - - if(current.air_check_directions&test_dir && current != next) - next = get_step(current, test_dir) - if(!next.HasDoor()) - current = next - - if(current == NT) - return //We made it, yaaay~ - stepped_back = 0 - zone.rebuild = 1 - - else - //FUCK IT - zone.rebuild = 1 \ No newline at end of file + tick_progress = "success" \ No newline at end of file diff --git a/code/ZAS/Functions.dm b/code/ZAS/Functions.dm index 0394c6eff79..df250fcb724 100644 --- a/code/ZAS/Functions.dm +++ b/code/ZAS/Functions.dm @@ -1,35 +1,44 @@ //Global Functions //Contents: FloodFill, ZMerge, ZConnect +//Floods outward from an initial turf to fill everywhere it's zone would reach. proc/FloodFill(turf/simulated/start) + if(!istype(start)) return list() - var - list - open = list(start) - closed = list() + //The list of tiles waiting to be evaulated. + var/list/open = list(start) + //The list of tiles which have been evaulated. + var/list/closed = list() + + //Loop through the turfs in the open list in order to find which adjacent turfs should be added to the zone. while(open.len) var/turf/simulated/T = pick(open) + //sanity! if(!istype(T)) open -= T continue + //Check all cardinal directions for(var/d in cardinal) var/turf/simulated/O = get_step(T,d) + //Ensure the turf is of proper type, that it is not in either list, and that air can reach it. if(istype(O) && !(O in open) && !(O in closed) && O.ZCanPass(T)) + //Handle connections from a tile with a door. if(T.HasDoor()) - //If they both have doors, then they are nto able to connect period. + //If they both have doors, then they are not able to connect period. if(O.HasDoor()) continue - //connect first to north and west + //Connect first to north and west if(d == NORTH || d == WEST) open += O + //If that fails, and north/west cannot be connected to, see if west or south can be connected instead. else var/turf/simulated/W = get_step(O, WEST) var/turf/simulated/N = get_step(O, NORTH) @@ -38,9 +47,11 @@ proc/FloodFill(turf/simulated/start) //If it cannot connect either to the north or west, connect it! open += O + //If no doors are involved, add it immediately. else if(!O.HasDoor()) open += O + //Handle connecting to a tile with a door. else if(d == SOUTH || d == EAST) //doors prefer connecting to zones to the north or west @@ -56,23 +67,25 @@ proc/FloodFill(turf/simulated/start) //If it cannot connect either to the north or west, connect it! closed += O + //This tile is now evaluated, and can be moved to the list of evaluated tiles. open -= T closed += T return closed +//Procedure to merge two zones together. proc/ZMerge(zone/A,zone/B) + //Sanity~ if(!istype(A) || !istype(B)) return //Merges two zones so that they are one. - var - a_size = A.air.group_multiplier - b_size = B.air.group_multiplier - c_size = a_size + b_size - new_contents = A.contents + B.contents + var/a_size = A.air.group_multiplier + var/b_size = B.air.group_multiplier + var/c_size = a_size + b_size + var/new_contents = A.contents + B.contents //Set air multipliers to one so air represents gas per tile. A.air.group_multiplier = 1 @@ -86,33 +99,28 @@ proc/ZMerge(zone/A,zone/B) A.air.merge(B.air) A.air.group_multiplier = c_size - //Check for connections to merge into the new zone. - for(var/connection/C in B.connections) - if((C.A in new_contents) && (C.B in new_contents)) - del C - continue - if(!A.connections) A.connections = list() - A.connections += C - - //Add space tiles. - A.unsimulated_tiles += B.unsimulated_tiles - - //Add contents. - A.contents = new_contents - //Set all the zone vars. for(var/turf/simulated/T in B.contents) T.zone = A - for(var/connection/C in A.connections) + //Check for connections to merge into the new zone. + for(var/connection/C in B.connections) + //The Cleanup proc will delete the connection if the zones are the same. + // It will also set the zone variables correctly. C.Cleanup() + //Add space tiles. + A.unsimulated_tiles |= B.unsimulated_tiles + + //Add contents. + A.contents = new_contents + + //Remove the "B" zone, finally. B.SoftDelete() +//Connects two zones by forming a connection object representing turfs A and B. proc/ZConnect(turf/simulated/A,turf/simulated/B) - //Connects two zones by forming a connection object representing turfs A and B. - //Make sure that if it's space, it gets added to unsimulated_tiles instead. if(!istype(B)) @@ -141,83 +149,5 @@ proc/ZConnect(turf/simulated/A,turf/simulated/B) if(C && (C.B == B || C.A == B)) return - new /connection(A,B) - -/* -proc/ZDisconnect(turf/A,turf/B) - //Removes a zone connection. Can split zones in the case of a permanent barrier. - - //If one of them doesn't have a zone, it might be space, so check for that. - if(A.zone && B.zone) - //If the two zones are different, just remove a connection. - if(A.zone != B.zone) - for(var/connection/C in A.zone.connections) - if((C.A == A && C.B == B) || (C.A == B && C.B == A)) - del C - if(C) - C.Cleanup() - //If they're the same, split the zone at this line. - else - //Preliminary checks to prevent stupidity. - if(A == B) return - if(A.CanPass(0,B,0,0)) return - if(A.HasDoor(B) || B.HasDoor(A)) return - - //Do a test fill. If turf B is still in the floodfill, then the zone isn't really split. - var/zone/oldzone = A.zone - var/list/test = FloodFill(A) - if(B in test) return - - else - var/zone/Z = new(test,oldzone.air) //Create a new zone based on the old air and the test fill. - - //Add connections from the old zone. - for(var/connection/C in oldzone.connections) - if((C.A in Z.contents) || (C.B in Z.contents)) - if(!Z.connections) Z.connections = list() - Z.connections += C - C.Cleanup() - - //Check for space. - for(var/turf/T in test) - T.check_for_space() - - //Make a new, identical air mixture for the other zone. - var/datum/gas_mixture/Y_Air = new - Y_Air.copy_from(oldzone.air) - - var/zone/Y = new(B,Y_Air) //Make a new zone starting at B and using Y_Air. - - //Add relevant connections from old zone. - for(var/connection/C in oldzone.connections) - if((C.A in Y.contents) || (C.B in Y.contents)) - if(!Y.connections) Y.connections = list() - Y.connections += C - C.Cleanup() - - //Add the remaining space tiles to this zone. - for(var/turf/space/T in oldzone.unsimulated_tiles) - if(!(T in Z.unsimulated_tiles)) - Y.AddSpace(T) - - oldzone.air = null - del oldzone - else - if(B.zone) - if(istype(A,/turf/space)) - B.zone.RemoveSpace(A) - else - for(var/connection/C in B.zone.connections) - if((C.A == A && C.B == B) || (C.A == B && C.B == A)) - del C - if(C) - C.Cleanup() - if(A.zone) - if(istype(B,/turf/space)) - A.zone.RemoveSpace(B) - else - for(var/connection/C in A.zone.connections) - if((C.A == A && C.B == B) || (C.A == B && C.B == A)) - del C - if(C) - C.Cleanup()*/ \ No newline at end of file + //Make the connection. + new /connection(A,B) \ No newline at end of file diff --git a/code/ZAS/Plasma.dm b/code/ZAS/Plasma.dm index aa444628d9b..3196d93db92 100644 --- a/code/ZAS/Plasma.dm +++ b/code/ZAS/Plasma.dm @@ -68,8 +68,9 @@ obj/item/proc if(!pl_head_protected()) if(prob(1)) suit_contamination() //Plasma can sometimes get through such an open suit. - if(istype(back,/obj/item/weapon/storage/backpack)) - back.contaminate() +//Cannot wash backpacks currently. +// if(istype(back,/obj/item/weapon/storage/backpack)) +// back.contaminate() /mob/proc/pl_effects() diff --git a/code/ZAS/ZAS_Turfs.dm b/code/ZAS/ZAS_Turfs.dm index e058cea3537..c66d77e5f37 100644 --- a/code/ZAS/ZAS_Turfs.dm +++ b/code/ZAS/ZAS_Turfs.dm @@ -165,27 +165,32 @@ turf if(!zone) //Still no zone, the floodfill determined it is not part of a larger zone. Force a zone on it. new/zone(list(src)) - if("\ref[src]" in air_master.turfs_with_connections) //Check pass sanity of the connections. + //Check pass sanity of the connections. + if("\ref[src]" in air_master.turfs_with_connections) for(var/connection/C in air_master.turfs_with_connections["\ref[src]"]) - if(!(C in air_master.connections_to_check)) - air_master.connections_to_check += C + air_master.connections_to_check |= C if(zone && !zone.rebuild) for(var/direction in cardinal) - if(zone.rebuild) - break - var/turf/T = get_step(src,direction) if(!istype(T)) continue - // var/list/zone/adjacent_zones = list() - if(air_check_directions&direction) //I can connect air in this direction - if(!CanPass(null, T, 0, 0)) //If either block air, we must look to see if the adjacent turfs need rebuilt. - if(!T.CanPass(null, T, 0, 0)) //Target blocks air + //I can connect to air in this direction + if(air_check_directions&direction) + + //If either block air, we must look to see if the adjacent turfs need rebuilt. + if(!CanPass(null, T, 0, 0)) + + //Target blocks air + if(!T.CanPass(null, T, 0, 0)) var/turf/NT = get_step(T, direction) + + //If that turf is in my zone still, rebuild. if(istype(NT,/turf/simulated) && NT in zone.contents) - air_master.AddToConsiderRebuild(src,NT) + zone.rebuild = 1 + + //If that is an unsimulated tile in my zone, see if we need to rebuild or just remove. else if(istype(NT) && NT in zone.unsimulated_tiles) var/consider_rebuild = 0 for(var/d in cardinal) @@ -194,17 +199,22 @@ turf consider_rebuild = 1 break if(consider_rebuild) - air_master.AddToConsiderRebuild(src,NT) //Gotta check if we need to rebuild, dammit + zone.rebuild = 1 //Gotta check if we need to rebuild, dammit else zone.RemoveTurf(NT) //Not adjacent to anything, and unsimulated. Goodbye~ //To make a closed connection through closed door. ZConnect(T, src) - if(T.zone && !T.zone.rebuild) //I block air. + //If I block air. + else if(T.zone && !T.zone.rebuild) var/turf/NT = get_step(src, reverse_direction(direction)) + + //If I am splitting a zone, rebuild. if(istype(NT,/turf/simulated) && (NT in T.zone.contents || (NT.zone && T in NT.zone.contents))) - air_master.AddToConsiderRebuild(T,NT) + T.zone.rebuild = 1 + + //If NT is unsimulated, parse if I should remove it or rebuild. else if(istype(NT) && NT in T.zone.unsimulated_tiles) var/consider_rebuild = 0 for(var/d in cardinal) @@ -212,30 +222,48 @@ turf if(istype(UT, /turf/simulated) && UT.zone == T.zone && UT.CanPass(null, NT, 0, 0)) //If we find a neighboring tile that is in the same zone, check if we need to rebuild consider_rebuild = 1 break + + //Needs rebuilt. if(consider_rebuild) - air_master.AddToConsiderRebuild(T,NT) //Gotta check if we need to rebuild, dammit + T.zone.rebuild = 1 + + //Not adjacent to anything, and unsimulated. Goodbye~ else - T.zone.RemoveTurf(NT) //Not adjacent to anything, and unsimulated. Goodbye~ + T.zone.RemoveTurf(NT) else + //Produce connection through open door. ZConnect(src,T) - else if(air_directions_archived&direction) //Something like a wall was built, changing the geometry. + //Something like a wall was built, changing the geometry. + else if(air_directions_archived&direction) var/turf/NT = get_step(T, direction) - if(istype(NT,/turf/simulated) && NT in zone.contents) - air_master.AddToConsiderRebuild(src,NT) - else if(istype(NT) && NT in zone.unsimulated_tiles) //Parse if we need to remove the tile, or rebuild the zone. + //If the tile is in our own zone, and we cannot connect to it, better rebuild. + if(istype(NT,/turf/simulated) && NT in zone.contents) + zone.rebuild = 1 + + //Parse if we need to remove the tile, or rebuild the zone. + else if(istype(NT) && NT in zone.unsimulated_tiles) var/consider_rebuild = 0 + + //Loop through all neighboring turfs to see if we should remove the turf or just rebuild. for(var/d in cardinal) var/turf/UT = get_step(NT,d) - if(istype(UT, /turf/simulated) && UT.zone == zone && UT.CanPass(null, NT, 0, 0)) //If we find a neighboring tile that is in the same zone, check if we need to rebuild + + //If we find a neighboring tile that is in the same zone, rebuild + if(istype(UT, /turf/simulated) && UT.zone == zone && UT.CanPass(null, NT, 0, 0)) consider_rebuild = 1 break + + //The unsimulated turf is adjacent to another one of our zone's turfs, + // better rebuild to be sure we didn't get cut in twain if(consider_rebuild) - air_master.AddToConsiderRebuild(src,NT) //Gotta check if we need to rebuild, dammit + NT.zone.rebuild = 1 + + //Not adjacent to anything, and unsimulated. Goodbye~ else - zone.RemoveTurf(NT) //Not adjacent to anything, and unsimulated. Goodbye~ + zone.RemoveTurf(NT) if(air_check_directions) processing = 1 @@ -254,8 +282,10 @@ turf if(isnum(O) && O) if(!D.density) continue if(istype(D,/obj/machinery/door/window)) - if(!O) continue - if(D.dir == get_dir(D,O)) return 1 + if(!istype(O)) + continue + if(D.dir == get_dir(D,O)) + return 1 else return 1 @@ -271,13 +301,13 @@ turf/proc/ZCanPass(turf/simulated/T, var/include_space = 0) return 0 for(var/obj/obstacle in src) - if(istype(obstacle,/obj/machinery/door) && !istype(obstacle,/obj/machinery/door/window)) + if(istype(obstacle, /obj/machinery/door) && !obstacle:air_properties_vary_with_direction) continue if(!obstacle.CanPass(null, T, 1.5, 1)) return 0 for(var/obj/obstacle in T) - if(istype(obstacle,/obj/machinery/door) && !istype(obstacle,/obj/machinery/door/window)) + if(istype(obstacle, /obj/machinery/door) && !obstacle:air_properties_vary_with_direction) continue if(!obstacle.CanPass(null, src, 1.5, 1)) return 0 @@ -293,13 +323,13 @@ turf/proc/ZAirPass(turf/T) return 0 for(var/obj/obstacle in src) - if(istype(obstacle,/obj/machinery/door) && !istype(obstacle,/obj/machinery/door/window)) + if(istype(obstacle, /obj/machinery/door) && !obstacle:air_properties_vary_with_direction) continue if(!obstacle.CanPass(null, T, 0, 0)) return 0 for(var/obj/obstacle in T) - if(istype(obstacle,/obj/machinery/door) && !istype(obstacle,/obj/machinery/door/window)) + if(istype(obstacle, /obj/machinery/door) && !obstacle:air_properties_vary_with_direction) continue if(!obstacle.CanPass(null, src, 0, 0)) return 0 diff --git a/code/ZAS/ZAS_Zones.dm b/code/ZAS/ZAS_Zones.dm index 213dd9393db..6401a63a9fb 100644 --- a/code/ZAS/ZAS_Zones.dm +++ b/code/ZAS/ZAS_Zones.dm @@ -20,6 +20,7 @@ zone // To make sure you're not spammed to death by airflow sound effects tmp/playsound_cooldown = 0 + //CREATION AND DELETION New(turf/start) . = ..() @@ -53,6 +54,7 @@ zone //Add this zone to the global list. zones.Add(src) + //LEGACY, DO NOT USE. Use the SoftDelete proc. Del() //Ensuring the zone list doesn't get clogged with null values. @@ -68,25 +70,27 @@ zone air = null . = ..() + //Handles deletion via garbage collection. proc/SoftDelete() zones.Remove(src) air = null + //Ensuring the zone list doesn't get clogged with null values. for(var/turf/simulated/T in contents) RemoveTurf(T) air_master.tiles_to_reconsider_zones += T + + //Removing zone connections and scheduling connection cleanup for(var/zone/Z in connected_zones) if(src in Z.connected_zones) Z.connected_zones.Remove(src) for(var/connection/C in connections) - if(C.zone_A == src) - C.zone_A = null - if(C.zone_B == src) - C.zone_B = null air_master.connections_to_check += C + return 1 + //ZONE MANAGEMENT FUNCTIONS proc/AddTurf(turf/T) //Adds the turf to contents, increases the size of the zone, and sets the zone var. @@ -270,7 +274,13 @@ zone/proc/process() if(moles_delta > 0.1 || abs(air.temperature - Z.air.temperature) > 0.1) if(abs(Z.air.return_pressure() - air.return_pressure()) > vsc.airflow_lightest_pressure) Airflow(src,Z) - ShareRatio( air , Z.air , connected_zones[Z] ) + var/unsimulated_boost = 0 + if(unsimulated_tiles) + unsimulated_boost += unsimulated_tiles.len + if(Z.unsimulated_tiles) + unsimulated_boost += Z.unsimulated_tiles.len + unsimulated_boost = min(3, unsimulated_boost) + ShareRatio( air , Z.air , connected_zones[Z] + unsimulated_boost) for(var/zone/Z in closed_connection_zones) if(air && Z.air) diff --git a/code/controllers/master_controller.dm b/code/controllers/master_controller.dm index c618079f684..3633cda3748 100644 --- a/code/controllers/master_controller.dm +++ b/code/controllers/master_controller.dm @@ -133,11 +133,12 @@ datum/controller/game_controller/proc/process() air_master.current_cycle++ var/success = air_master.tick() //Changed so that a runtime does not crash the ticker. if(!success) //Runtimed. - log_adminwarn("ZASALERT: air_system/tick() failed: [air_master.tick_progress]") air_master.failed_ticks++ if(air_master.failed_ticks > 5) world << "RUNTIMES IN ATMOS TICKER. Killing air simulation!" - kill_air = 1 + message_admins("ZASALERT: unable run [air_master.tick_progress], tell someone about this!") + log_admin("ZASALERT: unable run zone/process() -- [air_master.tick_progress]") + air_processing_killed = 1 air_master.failed_ticks = 0 air_cost = (world.timeofday - timer) / 10 diff --git a/code/game/machinery/alarm.dm b/code/game/machinery/alarm.dm index cdfde8afaf2..f31746de802 100644 --- a/code/game/machinery/alarm.dm +++ b/code/game/machinery/alarm.dm @@ -67,7 +67,7 @@ idle_power_usage = 4 active_power_usage = 8 power_channel = ENVIRON - req_access = list(access_atmospherics, access_engine_equip) + req_one_access = list(access_atmospherics, access_engine_equip) var/frequency = 1439 //var/skipprocess = 0 //Experimenting var/alarm_frequency = 1437 diff --git a/code/game/machinery/atmoalter/canister.dm b/code/game/machinery/atmoalter/canister.dm index d43f7657f2c..5fdfc357490 100644 --- a/code/game/machinery/atmoalter/canister.dm +++ b/code/game/machinery/atmoalter/canister.dm @@ -18,6 +18,14 @@ use_power = 0 var/release_log = "" +/obj/machinery/portable_atmospherics/initialize() + . = ..() + spawn() + var/obj/machinery/atmospherics/portables_connector/connector = locate() in loc + if(connector) + connected_port = connector + update_icon() + /obj/machinery/portable_atmospherics/canister/sleeping_agent name = "Canister: \[N2O\]" icon_state = "redws" diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index c09dbfdf682..465af474e69 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -18,6 +18,7 @@ var/glass = 0 var/normalspeed = 1 var/heat_proof = 0 // For glass airlocks/opacity firedoors + var/air_properties_vary_with_direction = 0 /obj/machinery/door/New() ..() diff --git a/code/game/machinery/doors/firedoor.dm b/code/game/machinery/doors/firedoor.dm index 07a3a1b9b83..9566cd6db40 100644 --- a/code/game/machinery/doors/firedoor.dm +++ b/code/game/machinery/doors/firedoor.dm @@ -234,6 +234,7 @@ glass = 1 //There is a glass window so you can see through the door //This is needed due to BYOND limitations in controlling visibility heat_proof = 1 + air_properties_vary_with_direction = 1 CanPass(atom/movable/mover, turf/target, height=0, air_group=0) if(istype(mover) && mover.checkpass(PASSGLASS)) diff --git a/code/game/machinery/doors/windowdoor.dm b/code/game/machinery/doors/windowdoor.dm index 55aef446eaa..45ff776d401 100644 --- a/code/game/machinery/doors/windowdoor.dm +++ b/code/game/machinery/doors/windowdoor.dm @@ -11,6 +11,7 @@ opacity = 0 var/obj/item/weapon/airlock_electronics/electronics = null explosion_resistance = 5 + air_properties_vary_with_direction = 1 /obj/machinery/door/window/update_nearby_tiles(need_rebuild) diff --git a/html/changelog.html b/html/changelog.html index 5b6aa9e5a1f..30d9f62c640 100644 --- a/html/changelog.html +++ b/html/changelog.html @@ -58,6 +58,24 @@ Stuff which is in development and not yet visible to players or just code relate should be listed in the changelog upon commit though. Thanks. -->