[EXPERIMENTAL] Let's give active turf processing it's own bloody subsystem. With blackjack! And hookers! (#7509)
* HOW ABOUT WE TAKE THE AIR PROCESSING AND MOVE IT OVER THERE!!!! * makes gas reactions happen in the original atmos subsystem so gas reactions run at the original atmos speed
This commit is contained in:
@@ -67,6 +67,7 @@
|
||||
#define INIT_ORDER_TIMER 1
|
||||
#define INIT_ORDER_DEFAULT 0
|
||||
#define INIT_ORDER_AIR -1
|
||||
#define INIT_ORDER_AIR_TURFS -2
|
||||
#define INIT_ORDER_MINIMAP -3
|
||||
#define INIT_ORDER_ASSETS -4
|
||||
#define INIT_ORDER_ICON_SMOOTHING -5
|
||||
@@ -100,6 +101,7 @@
|
||||
#define FIRE_PRIORITY_OBJ 40
|
||||
#define FIRE_PRIORITY_ACID 40
|
||||
#define FIRE_PRIOTITY_BURNING 40
|
||||
#define FIRE_PRIORITY_AIR_TURFS 40
|
||||
#define FIRE_PRIORITY_DEFAULT 50
|
||||
#define FIRE_PRIORITY_PARALLAX 65
|
||||
#define FIRE_PRIORITY_FLIGHTPACKS 80
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#define SSAIR_PIPENETS 1
|
||||
#define SSAIR_ATMOSMACHINERY 2
|
||||
#define SSAIR_ACTIVETURFS 3
|
||||
#define SSAIR_REACTQUEUE 3
|
||||
#define SSAIR_EXCITEDGROUPS 4
|
||||
#define SSAIR_HIGHPRESSURE 5
|
||||
#define SSAIR_HOTSPOTS 6
|
||||
@@ -14,7 +14,7 @@ SUBSYSTEM_DEF(air)
|
||||
flags = SS_BACKGROUND
|
||||
runlevels = RUNLEVEL_GAME | RUNLEVEL_POSTGAME
|
||||
|
||||
var/cost_turfs = 0
|
||||
var/cost_turf_reactions = 0
|
||||
var/cost_groups = 0
|
||||
var/cost_highpressure = 0
|
||||
var/cost_hotspots = 0
|
||||
@@ -24,6 +24,7 @@ SUBSYSTEM_DEF(air)
|
||||
|
||||
var/list/excited_groups = list()
|
||||
var/list/active_turfs = list()
|
||||
var/list/turf_react_queue = list()
|
||||
var/list/hotspots = list()
|
||||
var/list/networks = list()
|
||||
var/list/obj/machinery/atmos_machinery = list()
|
||||
@@ -45,7 +46,7 @@ SUBSYSTEM_DEF(air)
|
||||
|
||||
/datum/controller/subsystem/air/stat_entry(msg)
|
||||
msg += "C:{"
|
||||
msg += "AT:[round(cost_turfs,1)]|"
|
||||
msg += "RQ:[round(cost_turf_reactions,1)]|"
|
||||
msg += "EG:[round(cost_groups,1)]|"
|
||||
msg += "HP:[round(cost_highpressure,1)]|"
|
||||
msg += "HS:[round(cost_hotspots,1)]|"
|
||||
@@ -54,6 +55,7 @@ SUBSYSTEM_DEF(air)
|
||||
msg += "AM:[round(cost_atmos_machinery,1)]"
|
||||
msg += "} "
|
||||
msg += "AT:[active_turfs.len]|"
|
||||
msg += "RQ:[turf_react_queue.len]|"
|
||||
msg += "EG:[excited_groups.len]|"
|
||||
msg += "HS:[hotspots.len]|"
|
||||
msg += "PN:[networks.len]|"
|
||||
@@ -90,12 +92,12 @@ SUBSYSTEM_DEF(air)
|
||||
if(state != SS_RUNNING)
|
||||
return
|
||||
resumed = 0
|
||||
currentpart = SSAIR_ACTIVETURFS
|
||||
currentpart = SSAIR_REACTQUEUE
|
||||
|
||||
if(currentpart == SSAIR_ACTIVETURFS)
|
||||
if(currentpart == SSAIR_REACTQUEUE)
|
||||
timer = TICK_USAGE_REAL
|
||||
process_active_turfs(resumed)
|
||||
cost_turfs = MC_AVERAGE(cost_turfs, TICK_DELTA_TO_MS(TICK_USAGE_REAL - timer))
|
||||
process_react_queue(resumed)
|
||||
cost_turf_reactions = MC_AVERAGE(cost_turf_reactions, TICK_DELTA_TO_MS(TICK_USAGE_REAL - timer))
|
||||
if(state != SS_RUNNING)
|
||||
return
|
||||
resumed = 0
|
||||
@@ -170,6 +172,19 @@ SUBSYSTEM_DEF(air)
|
||||
return
|
||||
|
||||
|
||||
/datum/controller/subsystem/air/proc/process_react_queue(resumed = 0)
|
||||
if(!resumed)
|
||||
src.currentrun = turf_react_queue.Copy()
|
||||
var/list/currentrun = src.currentrun
|
||||
while(currentrun.len)
|
||||
var/turf/open/T = currentrun[currentrun.len]
|
||||
currentrun.len--
|
||||
if(T)
|
||||
T.process_cell_reaction()
|
||||
if(MC_TICK_CHECK)
|
||||
return
|
||||
|
||||
|
||||
/datum/controller/subsystem/air/proc/process_super_conductivity(resumed = 0)
|
||||
if (!resumed)
|
||||
src.currentrun = active_super_conductivity.Copy()
|
||||
@@ -207,21 +222,6 @@ SUBSYSTEM_DEF(air)
|
||||
if(MC_TICK_CHECK)
|
||||
return
|
||||
|
||||
/datum/controller/subsystem/air/proc/process_active_turfs(resumed = 0)
|
||||
//cache for sanic speed
|
||||
var/fire_count = times_fired
|
||||
if (!resumed)
|
||||
src.currentrun = active_turfs.Copy()
|
||||
//cache for sanic speed (lists are references anyways)
|
||||
var/list/currentrun = src.currentrun
|
||||
while(currentrun.len)
|
||||
var/turf/open/T = currentrun[currentrun.len]
|
||||
currentrun.len--
|
||||
if (T)
|
||||
T.process_cell(fire_count)
|
||||
if (MC_TICK_CHECK)
|
||||
return
|
||||
|
||||
/datum/controller/subsystem/air/proc/process_excited_groups(resumed = 0)
|
||||
if (!resumed)
|
||||
src.currentrun = excited_groups.Copy()
|
||||
@@ -242,8 +242,7 @@ SUBSYSTEM_DEF(air)
|
||||
|
||||
/datum/controller/subsystem/air/proc/remove_from_active(turf/open/T)
|
||||
active_turfs -= T
|
||||
if(currentpart == SSAIR_ACTIVETURFS)
|
||||
currentrun -= T
|
||||
SSair_turfs.currentrun -= T
|
||||
#ifdef VISUALIZE_ACTIVE_TURFS
|
||||
T.remove_atom_colour(TEMPORARY_COLOUR_PRIORITY, "#00ff00")
|
||||
#endif
|
||||
@@ -251,6 +250,7 @@ SUBSYSTEM_DEF(air)
|
||||
T.excited = 0
|
||||
if(T.excited_group)
|
||||
T.excited_group.garbage_collect()
|
||||
remove_from_react_queue(T)
|
||||
|
||||
/datum/controller/subsystem/air/proc/add_to_active(turf/open/T, blockchanges = 1)
|
||||
if(istype(T) && T.air)
|
||||
@@ -259,10 +259,10 @@ SUBSYSTEM_DEF(air)
|
||||
#endif
|
||||
T.excited = 1
|
||||
active_turfs |= T
|
||||
if(currentpart == SSAIR_ACTIVETURFS)
|
||||
currentrun |= T
|
||||
SSair_turfs.currentrun |= T
|
||||
if(blockchanges && T.excited_group)
|
||||
T.excited_group.garbage_collect()
|
||||
add_to_react_queue(T)
|
||||
else if(T.flags_1 & INITIALIZED_1)
|
||||
for(var/turf/S in T.atmos_adjacent_turfs)
|
||||
add_to_active(S)
|
||||
@@ -273,6 +273,18 @@ SUBSYSTEM_DEF(air)
|
||||
else
|
||||
T.requires_activation = TRUE
|
||||
|
||||
/datum/controller/subsystem/air/proc/add_to_react_queue(turf/open/T)
|
||||
if(istype(T) && T.air)
|
||||
turf_react_queue |= T
|
||||
if(currentpart == SSAIR_REACTQUEUE)
|
||||
currentrun |= T
|
||||
return
|
||||
|
||||
/datum/controller/subsystem/air/proc/remove_from_react_queue(turf/open/T)
|
||||
turf_react_queue -= T
|
||||
if(currentpart == SSAIR_REACTQUEUE)
|
||||
currentrun -= T
|
||||
|
||||
/datum/controller/subsystem/air/StartLoadingMap()
|
||||
LAZYINITLIST(queued_for_activation)
|
||||
map_loading = TRUE
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
//WHAT IF WE TAKE THE ACTIVE TURF PROCESSING AND PUSH IT SOMEWHERE ELSE!!!
|
||||
|
||||
SUBSYSTEM_DEF(air_turfs)
|
||||
name = "Atmospherics - Turfs"
|
||||
init_order = INIT_ORDER_AIR_TURFS
|
||||
priority = FIRE_PRIORITY_AIR_TURFS
|
||||
wait = 1
|
||||
flags = SS_BACKGROUND
|
||||
runlevels = RUNLEVEL_GAME | RUNLEVEL_POSTGAME
|
||||
var/list/currentrun = list()
|
||||
|
||||
/datum/controller/subsystem/air_turfs/fire(resumed = 0)
|
||||
var/fire_count = times_fired
|
||||
//cache for sanic speed
|
||||
if (!resumed)
|
||||
src.currentrun = SSair.active_turfs.Copy()
|
||||
//cache for sanic speed (lists are references anyways)
|
||||
var/list/currentrun = src.currentrun
|
||||
while(currentrun.len)
|
||||
var/turf/open/T = currentrun[currentrun.len]
|
||||
currentrun.len--
|
||||
if (T)
|
||||
T.process_cell(fire_count)
|
||||
if (MC_TICK_CHECK)
|
||||
return
|
||||
resumed = 0
|
||||
return
|
||||
@@ -223,9 +223,7 @@
|
||||
our_air.share(G, adjacent_turfs_length)
|
||||
LAST_SHARE_CHECK
|
||||
|
||||
our_air.react(src)
|
||||
|
||||
update_visuals()
|
||||
SSair.add_to_react_queue(src)
|
||||
|
||||
if((!our_excited_group && !(our_air.temperature > MINIMUM_TEMPERATURE_START_SUPERCONDUCTION && consider_superconductivity(starting = TRUE))) \
|
||||
|| (cached_atmos_cooldown > (EXCITED_GROUP_DISMANTLE_CYCLES * 2)))
|
||||
@@ -233,6 +231,15 @@
|
||||
|
||||
atmos_cooldown = cached_atmos_cooldown
|
||||
|
||||
/turf/proc/process_cell_reaction()
|
||||
SSair.remove_from_react_queue(src)
|
||||
|
||||
/turf/open/process_cell_reaction()
|
||||
air.react(src)
|
||||
update_visuals()
|
||||
SSair.remove_from_react_queue(src)
|
||||
return
|
||||
|
||||
//////////////////////////SPACEWIND/////////////////////////////
|
||||
|
||||
/turf/open/proc/consider_pressure_difference(turf/T, difference)
|
||||
|
||||
Reference in New Issue
Block a user