Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the air currents system. (faster atmospheric spread) #3214

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions code/LINDA/LINDA_system.dm
Expand Up @@ -128,6 +128,7 @@ turf/CanPass(atom/movable/mover, turf/target, height=1.5,air_group=0)
CalculateAdjacentTurfs()
if(air_master)
air_master.add_to_active(src,command)
InvalidateAtmoPassCache()

/atom/movable/proc/move_update_air(var/turf/T)
if(istype(T,/turf))
Expand Down
1 change: 1 addition & 0 deletions code/LINDA/LINDA_turf_tile.dm
Expand Up @@ -281,6 +281,7 @@
/turf/simulated/proc/share_air(var/turf/simulated/T)
if(T.current_cycle < current_cycle)
var/difference
air_currents_master.onGasExchange(src, air.return_pressure(),T.air.return_pressure())
difference = air.share(T.air, atmos_adjacent_turfs_amount)
if(difference)
if(difference > 0)
Expand Down
31 changes: 26 additions & 5 deletions code/controllers/Processes/air.dm
@@ -1,16 +1,19 @@
var/kill_air = 0

var/global/datum/controller/process/air_system/air_master

/turf/var/activeturf_airmastercycle = 0
/datum/excited_group/var/excitedturf_airmastercycle = 0
/datum/controller/process/air_system
var/list/excited_groups = list()
var/list/active_turfs = list()
var/list/hotspots = list()


//Special functions lists
var/list/turf/simulated/active_super_conductivity = list()
var/list/turf/simulated/high_pressure_delta = list()

var/sub_cycle = 0
var/current_cycle = 0
var/failed_ticks = 0
var/tick_progress = 0
Expand All @@ -24,7 +27,7 @@ var/global/datum/controller/process/air_system/air_master

/datum/controller/process/air_system/setup()
name = "air"
schedule_interval = 20 // every 2 seconds
schedule_interval = 5 // every 2 seconds
start_delay = 4
air_master = src

Expand All @@ -37,7 +40,10 @@ var/global/datum/controller/process/air_system/air_master
/datum/controller/process/air_system/doWork()
if(kill_air)
return 1
current_cycle++
if (sub_cycle >= 4)
current_cycle++
sub_cycle = 0
sub_cycle++
process_active_turfs()
process_excited_groups()
process_high_pressure_delta()
Expand All @@ -52,13 +58,13 @@ var/global/datum/controller/process/air_system/air_master

/datum/controller/process/air_system/proc/process_hotspots()
last_hotspots = hotspots.len
for(var/obj/effect/hotspot/H in hotspots)
for(var/obj/effect/hotspot/H in hotspots) //we could split it as well, but at the same time it never represented much load in any profile i saw, so maybe we could just let it be faster
H.process()
SCHECK

/datum/controller/process/air_system/proc/process_super_conductivity()
last_asc = active_super_conductivity.len
for(var/turf/simulated/T in active_super_conductivity)
for(var/turf/simulated/T in active_super_conductivity) //we could split it as well, but at the same time it never represented much load in any profile i saw, so maybe we could just let it be faster
T.super_conduct()
SCHECK

Expand All @@ -72,8 +78,16 @@ var/global/datum/controller/process/air_system/air_master

/datum/controller/process/air_system/proc/process_active_turfs()
last_active = active_turfs.len
var/count = 0
for(var/turf/simulated/T in active_turfs)
if (T.activeturf_airmastercycle == current_cycle)
continue
if (count > last_active/4 && sub_cycle < 4) //do at most 1/4 every subcycle, unless its the last one, then do whatever is left (to cover those added etc)
break
count++
T.activeturf_airmastercycle = current_cycle
T.process_cell()

SCHECK

/datum/controller/process/air_system/proc/remove_from_active(var/turf/simulated/T)
Expand Down Expand Up @@ -119,7 +133,14 @@ var/global/datum/controller/process/air_system/air_master

/datum/controller/process/air_system/proc/process_excited_groups()
last_excited = excited_groups.len
var/count = 0
for(var/datum/excited_group/EG in excited_groups)
if (EG.excitedturf_airmastercycle == current_cycle)
continue
if (count > last_excited/4 && sub_cycle < 4) //do at most 1/4 every subcycle, unless its the last one, then do whatever is left (to cover those added etc)
break
count++
EG.excitedturf_airmastercycle = current_cycle
EG.breakdown_cooldown++
if(EG.breakdown_cooldown == 10)
EG.self_breakdown()
Expand Down