From 36d251574f8a47b4c44c43cfc72c340994cc4b3e Mon Sep 17 00:00:00 2001 From: Mark van Alphen Date: Sat, 27 Apr 2019 18:52:50 +0200 Subject: [PATCH] Add planetary atmos --- code/LINDA/LINDA_turf_tile.dm | 17 ++++++++++++++++- code/datums/gas_mixture.dm | 17 +++++++++++++++++ code/game/turfs/simulated/floor/asteroid.dm | 2 ++ code/game/turfs/simulated/floor/chasm.dm | 1 + .../turfs/simulated/floor/indestructible.dm | 3 +++ code/game/turfs/simulated/floor/lava.dm | 3 ++- code/game/turfs/simulated/minerals.dm | 15 +++++++++++++++ 7 files changed, 56 insertions(+), 2 deletions(-) diff --git a/code/LINDA/LINDA_turf_tile.dm b/code/LINDA/LINDA_turf_tile.dm index d5f0e09487a..b7a71e68bff 100644 --- a/code/LINDA/LINDA_turf_tile.dm +++ b/code/LINDA/LINDA_turf_tile.dm @@ -49,6 +49,7 @@ var/icy = 0 var/icyoverlay var/obj/effect/hotspot/active_hotspot + var/planetary_atmos = FALSE //air will revert to its initial mix over time var/temperature_archived //USED ONLY FOR SOLIDS @@ -138,13 +139,16 @@ /turf/simulated/proc/process_cell() - if(archived_cycle < SSair.times_fired) //archive self if not already done archive() current_cycle = SSair.times_fired var/remove = 1 //set by non simulated turfs who are sharing with this turf + var/planet_atmos = planetary_atmos + if (planet_atmos) + atmos_adjacent_turfs_amount++ + for(var/direction in cardinal) if(!(atmos_adjacent_turfs & direction)) continue @@ -205,6 +209,17 @@ if(excited_group) last_share_check() + if(planet_atmos) //share our air with the "atmosphere" "above" the turf + var/datum/gas_mixture/G = new + G.copy_from_turf(src) + G.archive() + if(air.compare(G)) + if(!excited_group) + var/datum/excited_group/EG = new + EG.add_turf(src) + air.share(G, atmos_adjacent_turfs_amount) + last_share_check() + air.react() update_visuals() diff --git a/code/datums/gas_mixture.dm b/code/datums/gas_mixture.dm index 7a7571999cf..35cc970aa67 100644 --- a/code/datums/gas_mixture.dm +++ b/code/datums/gas_mixture.dm @@ -203,6 +203,10 @@ What are the archived variables for? /datum/gas_mixture/proc/copy_from(datum/gas_mixture/sample) //Copies variables from sample +/datum/gas_mixture/proc/copy_from_turf(turf/model) + //Copies all gas info from the turf into the gas list along with temperature + //Returns: 1 if we are mutable, 0 otherwise + /datum/gas_mixture/proc/share(datum/gas_mixture/sharer) //Performs air sharing calculations between two gas_mixtures assuming only 1 boundary length //Return: amount of gas exchanged (+ if sharer received) @@ -343,6 +347,19 @@ What are the archived variables for? return 1 +/datum/gas_mixture/copy_from_turf(turf/model) + oxygen = model.oxygen + carbon_dioxide = model.carbon_dioxide + nitrogen = model.nitrogen + toxins = model.toxins + + //acounts for changes in temperature + var/turf/model_parent = model.parent_type + if(model.temperature != initial(model.temperature) || model.temperature != initial(model_parent.temperature)) + temperature = model.temperature + + return 1 + /datum/gas_mixture/check_turf(turf/model, atmos_adjacent_turfs = 4) var/delta_oxygen = (oxygen_archived - model.oxygen)/(atmos_adjacent_turfs+1) var/delta_carbon_dioxide = (carbon_dioxide_archived - model.carbon_dioxide)/(atmos_adjacent_turfs+1) diff --git a/code/game/turfs/simulated/floor/asteroid.dm b/code/game/turfs/simulated/floor/asteroid.dm index de033fab0a6..1a8522ba9be 100644 --- a/code/game/turfs/simulated/floor/asteroid.dm +++ b/code/game/turfs/simulated/floor/asteroid.dm @@ -134,6 +134,7 @@ oxygen = 14 nitrogen = 23 temperature = 300 + planetary_atmos = TRUE baseturf = /turf/simulated/floor/plating/lava/smooth/lava_land_surface /turf/simulated/floor/plating/asteroid/airless @@ -173,6 +174,7 @@ GLOBAL_LIST_INIT(megafauna_spawn_list, list(/mob/living/simple_animal/hostile/me oxygen = 14 nitrogen = 23 temperature = 300 + planetary_atmos = TRUE /turf/simulated/floor/plating/asteroid/airless/cave/volcanic/has_data //subtype for producing a tunnel with given data has_data = TRUE diff --git a/code/game/turfs/simulated/floor/chasm.dm b/code/game/turfs/simulated/floor/chasm.dm index 94446d2d615..c49c56fe312 100644 --- a/code/game/turfs/simulated/floor/chasm.dm +++ b/code/game/turfs/simulated/floor/chasm.dm @@ -122,6 +122,7 @@ oxygen = 14 nitrogen = 23 temperature = 300 + planetary_atmos = TRUE baseturf = /turf/simulated/floor/chasm/straight_down/lava_land_surface light_range = 1.9 //slightly less range than lava light_power = 0.65 //less bright, too diff --git a/code/game/turfs/simulated/floor/indestructible.dm b/code/game/turfs/simulated/floor/indestructible.dm index 3ac88ff3da1..6c1679776e6 100644 --- a/code/game/turfs/simulated/floor/indestructible.dm +++ b/code/game/turfs/simulated/floor/indestructible.dm @@ -46,6 +46,7 @@ oxygen = 14 nitrogen = 23 temperature = 300 + planetary_atmos = TRUE /turf/simulated/floor/indestructible/necropolis/Initialize() . = ..() @@ -65,6 +66,7 @@ oxygen = 14 nitrogen = 23 temperature = 300 + planetary_atmos = TRUE /turf/simulated/floor/indestructible/boss/air oxygen = MOLES_O2STANDARD @@ -76,6 +78,7 @@ oxygen = 14 nitrogen = 23 temperature = 300 + planetary_atmos = TRUE desc = "A floor with a square pattern. It's faintly cool to the touch." /turf/simulated/floor/indestructible/hierophant/two diff --git a/code/game/turfs/simulated/floor/lava.dm b/code/game/turfs/simulated/floor/lava.dm index a512a4b0334..7ecfd007e53 100644 --- a/code/game/turfs/simulated/floor/lava.dm +++ b/code/game/turfs/simulated/floor/lava.dm @@ -115,7 +115,8 @@ temperature = 300 oxygen = 14 nitrogen = 23 - //baseturf = /turf/simulated/chasm/straight_down/lava_land_surface TODO: Uncomment + planetary_atmos = TRUE + baseturf = /turf/simulated/floor/chasm/straight_down/lava_land_surface /turf/simulated/floor/plating/lava/smooth/airless temperature = TCMB \ No newline at end of file diff --git a/code/game/turfs/simulated/minerals.dm b/code/game/turfs/simulated/minerals.dm index 81d0abca79e..ad3e981154d 100644 --- a/code/game/turfs/simulated/minerals.dm +++ b/code/game/turfs/simulated/minerals.dm @@ -181,6 +181,7 @@ oxygen = 14 nitrogen = 23 temperature = 300 + planetary_atmos = TRUE defer_change = 1 mineralSpawnChanceList = list( /turf/simulated/mineral/uranium/volcanic = 35, /turf/simulated/mineral/diamond/volcanic = 30, /turf/simulated/mineral/gold/volcanic = 45, /turf/simulated/mineral/titanium/volcanic = 45, @@ -201,6 +202,7 @@ oxygen = 14 nitrogen = 23 temperature = 300 + planetary_atmos = TRUE defer_change = 1 mineralChance = 10 @@ -223,6 +225,7 @@ oxygen = 14 nitrogen = 23 temperature = 300 + planetary_atmos = TRUE defer_change = 1 mineralSpawnChanceList = list( /turf/simulated/mineral/uranium/volcanic = 2, /turf/simulated/mineral/diamond/volcanic = 1, /turf/simulated/mineral/gold/volcanic = 3, /turf/simulated/mineral/titanium/volcanic = 4, @@ -243,6 +246,7 @@ oxygen = 14 nitrogen = 23 temperature = 300 + planetary_atmos = TRUE defer_change = 1 /turf/simulated/mineral/uranium @@ -258,6 +262,7 @@ oxygen = 14 nitrogen = 23 temperature = 300 + planetary_atmos = TRUE defer_change = 1 /turf/simulated/mineral/diamond @@ -273,6 +278,7 @@ oxygen = 14 nitrogen = 23 temperature = 300 + planetary_atmos = TRUE defer_change = 1 /turf/simulated/mineral/gold @@ -288,6 +294,7 @@ oxygen = 14 nitrogen = 23 temperature = 300 + planetary_atmos = TRUE defer_change = 1 /turf/simulated/mineral/silver @@ -303,6 +310,7 @@ oxygen = 14 nitrogen = 23 temperature = 300 + planetary_atmos = TRUE defer_change = 1 /turf/simulated/mineral/titanium @@ -318,6 +326,7 @@ oxygen = 14 nitrogen = 23 temperature = 300 + planetary_atmos = TRUE defer_change = 1 /turf/simulated/mineral/plasma @@ -333,6 +342,7 @@ oxygen = 14 nitrogen = 23 temperature = 300 + planetary_atmos = TRUE defer_change = 1 /turf/simulated/mineral/clown @@ -349,6 +359,7 @@ oxygen = 14 nitrogen = 23 temperature = 300 + planetary_atmos = TRUE defer_change = 1 /turf/simulated/mineral/mime @@ -364,6 +375,7 @@ oxygen = 14 nitrogen = 23 temperature = 300 + planetary_atmos = TRUE defer_change = 1 /turf/simulated/mineral/bscrystal @@ -380,6 +392,7 @@ oxygen = 14 nitrogen = 23 temperature = 300 + planetary_atmos = TRUE defer_change = 1 /turf/simulated/mineral/volcanic @@ -389,6 +402,7 @@ oxygen = 14 nitrogen = 23 temperature = 300 + planetary_atmos = TRUE /turf/simulated/mineral/volcanic/lava_land_surface environment_type = "basalt" @@ -415,6 +429,7 @@ oxygen = 14 nitrogen = 23 temperature = 300 + planetary_atmos = TRUE defer_change = 1 /turf/simulated/mineral/gibtonite/New()