diff --git a/byond-extools.dll b/byond-extools.dll index ea5491a741..c404bf1be5 100644 Binary files a/byond-extools.dll and b/byond-extools.dll differ diff --git a/byond-extools.pdb b/byond-extools.pdb new file mode 100644 index 0000000000..f89dc06441 Binary files /dev/null and b/byond-extools.pdb differ diff --git a/code/controllers/subsystem/air.dm b/code/controllers/subsystem/air.dm index dfd8d4c873..e207fe838a 100644 --- a/code/controllers/subsystem/air.dm +++ b/code/controllers/subsystem/air.dm @@ -16,7 +16,6 @@ SUBSYSTEM_DEF(air) var/cost_atmos_machinery = 0 var/cost_equalize = 0 - var/list/active_turfs = list() var/list/hotspots = list() var/list/networks = list() var/list/pipenets_needing_rebuilt = list() @@ -54,13 +53,16 @@ SUBSYSTEM_DEF(air) msg += "PN:[round(cost_pipenets,1)]|" msg += "AM:[round(cost_atmos_machinery,1)]" msg += "} " - msg += "AT:[active_turfs.len]|" + var/active_turfs_len = get_amt_active_turfs() + msg += "AT:[active_turfs_len]|" msg += "EG:[get_amt_excited_groups()]|" msg += "HS:[hotspots.len]|" msg += "PN:[networks.len]|" msg += "HP:[high_pressure_delta.len]|" msg += "AS:[active_super_conductivity.len]|" - msg += "AT/MS:[round((cost ? active_turfs.len/cost : 0),0.1)]" + msg += "GA:[get_amt_gas_mixes()]|" + msg += "MG:[get_max_gas_mixes()]|" + msg += "AT/MS:[round((cost ? active_turfs_len/cost : 0),0.1)]" return ..() /datum/controller/subsystem/air/Initialize(timeofday) @@ -70,9 +72,11 @@ SUBSYSTEM_DEF(air) setup_atmos_machinery() setup_pipenets() gas_reactions = init_gas_reactions() + extools_update_reactions() return ..() /datum/controller/subsystem/air/proc/extools_update_ssair() +/datum/controller/subsystem/air/proc/extools_update_reactions() /datum/controller/subsystem/air/fire(resumed = 0) var/timer = TICK_USAGE_REAL @@ -237,6 +241,8 @@ SUBSYSTEM_DEF(air) return /datum/controller/subsystem/air/proc/process_turf_equalize(resumed = 0) + return process_turf_equalize_extools(resumed, (Master.current_ticklimit - TICK_USAGE) * 0.01 * world.tick_lag) + /* //cache for sanic speed var/fire_count = times_fired if (!resumed) @@ -251,8 +257,11 @@ SUBSYSTEM_DEF(air) //equalize_pressure_in_zone(T, fire_count) if (MC_TICK_CHECK) return + */ /datum/controller/subsystem/air/proc/process_active_turfs(resumed = 0) + return process_active_turfs_extools(resumed, (Master.current_ticklimit - TICK_USAGE) * 0.01 * world.tick_lag) + /* //cache for sanic speed var/fire_count = times_fired if (!resumed) @@ -266,10 +275,10 @@ SUBSYSTEM_DEF(air) T.process_cell(fire_count) if (MC_TICK_CHECK) return + */ /datum/controller/subsystem/air/proc/process_excited_groups(resumed = 0) - if(process_excited_groups_extools(resumed, (Master.current_ticklimit - TICK_USAGE) * 0.01 * world.tick_lag)) - sleep() + return process_excited_groups_extools(resumed, (Master.current_ticklimit - TICK_USAGE) * 0.01 * world.tick_lag) /* if (!resumed) src.currentrun = excited_groups.Copy() @@ -288,13 +297,20 @@ SUBSYSTEM_DEF(air) return */ +/datum/controller/subsystem/air/proc/process_active_turfs_extools() +/datum/controller/subsystem/air/proc/process_turf_equalize_extools() /datum/controller/subsystem/air/proc/process_excited_groups_extools() /datum/controller/subsystem/air/proc/get_amt_excited_groups() +/datum/controller/subsystem/air/proc/get_amt_active_turfs() +/datum/controller/subsystem/air/proc/get_amt_gas_mixes() +/datum/controller/subsystem/air/proc/get_max_gas_mixes() +/datum/controller/subsystem/air/proc/add_to_active_extools() +/datum/controller/subsystem/air/proc/remove_from_active_extools() +/datum/controller/subsystem/air/proc/get_active_turfs() +/datum/controller/subsystem/air/proc/clear_active_turfs() /datum/controller/subsystem/air/proc/remove_from_active(turf/open/T) - active_turfs -= T - if(currentpart == SSAIR_ACTIVETURFS) - currentrun -= T + remove_from_active_extools(T) #ifdef VISUALIZE_ACTIVE_TURFS T.remove_atom_colour(TEMPORARY_COLOUR_PRIORITY, "#00ff00") #endif @@ -308,9 +324,7 @@ SUBSYSTEM_DEF(air) T.add_atom_colour("#00ff00", TEMPORARY_COLOUR_PRIORITY) #endif T.set_excited(TRUE) - active_turfs |= T - if(currentpart == SSAIR_ACTIVETURFS) - currentrun |= T + add_to_active_extools(T) if(blockchanges) T.eg_garbage_collect() else if(T.flags_1 & INITIALIZED_1) @@ -335,12 +349,11 @@ SUBSYSTEM_DEF(air) /datum/controller/subsystem/air/proc/setup_allturfs() var/list/turfs_to_init = block(locate(1, 1, 1), locate(world.maxx, world.maxy, world.maxz)) - var/list/active_turfs = src.active_turfs var/times_fired = ++src.times_fired // Clear active turfs - faster than removing every single turf in the world // one-by-one, and Initalize_Atmos only ever adds `src` back in. - active_turfs.Cut() + clear_active_turfs() for(var/thing in turfs_to_init) var/turf/T = thing @@ -348,28 +361,27 @@ SUBSYSTEM_DEF(air) continue T.Initalize_Atmos(times_fired) CHECK_TICK - - if(active_turfs.len) - var/starting_ats = active_turfs.len + var/starting_ats = get_amt_active_turfs() + if(starting_ats) sleep(world.tick_lag) var/timer = world.timeofday log_mapping("There are [starting_ats] active turfs at roundstart caused by a difference of the air between the adjacent turfs. You can see its coordinates using \"Mapping -> Show roundstart AT list\" verb (debug verbs required).") - for(var/turf/T in active_turfs) + var/list/turfs_to_check = get_amt_active_turfs() + for(var/T in turfs_to_check) GLOB.active_turfs_startlist += T //now lets clear out these active turfs - var/list/turfs_to_check = active_turfs.Copy() do var/list/new_turfs_to_check = list() for(var/turf/open/T in turfs_to_check) new_turfs_to_check += T.resolve_active_graph() CHECK_TICK - - active_turfs += new_turfs_to_check + for(var/T in new_turfs_to_check) + add_to_active_extools(T) turfs_to_check = new_turfs_to_check while (turfs_to_check.len) - var/ending_ats = active_turfs.len + var/ending_ats = get_amt_active_turfs() /*for(var/thing in excited_groups) var/datum/excited_group/EG = thing //EG.self_breakdown(space_is_all_consuming = 1) @@ -445,6 +457,8 @@ SUBSYSTEM_DEF(air) return pipe_init_dirs_cache[type]["[dir]"] +/proc/get_extools_benchmarks() + #undef SSAIR_PIPENETS #undef SSAIR_ATMOSMACHINERY #undef SSAIR_ACTIVETURFS diff --git a/code/game/objects/items/devices/scanners.dm b/code/game/objects/items/devices/scanners.dm index 8fdeaa0f9f..db29614f20 100644 --- a/code/game/objects/items/devices/scanners.dm +++ b/code/game/objects/items/devices/scanners.dm @@ -718,8 +718,9 @@ GENETICS SCANNER to_chat(user, "Pressure: [round(pressure,0.01)] kPa") for(var/id in air_contents.get_gases()) - var/gas_concentration = air_contents.get_moles(id)/total_moles - to_chat(user, "[GLOB.meta_gas_names[id]]: [round(gas_concentration*100, 0.01)] % ([round(air_contents.get_moles(id), 0.01)] mol)") + if(air_contents.get_moles(id) >= 0.005) + var/gas_concentration = air_contents.get_moles(id)/total_moles + to_chat(user, "[GLOB.meta_gas_names[id]]: [round(gas_concentration*100, 0.01)] % ([round(air_contents.get_moles(id), 0.01)] mol)") to_chat(user, "Temperature: [round(temperature - T0C,0.01)] °C ([round(temperature, 0.01)] K)") else diff --git a/code/game/turfs/open.dm b/code/game/turfs/open.dm index 6552e29246..1ff056c572 100644 --- a/code/game/turfs/open.dm +++ b/code/game/turfs/open.dm @@ -210,7 +210,7 @@ if(!get_excited() && air.compare(enemy_air)) //testing("Active turf found. Return value of compare(): [is_active]") set_excited(TRUE) - SSair.active_turfs |= src + SSair.add_to_active_extools(src) /turf/open/proc/GetHeatCapacity() . = air.heat_capacity() diff --git a/code/game/world.dm b/code/game/world.dm index 121d51136d..42c90d8be1 100644 --- a/code/game/world.dm +++ b/code/game/world.dm @@ -273,12 +273,6 @@ GLOBAL_LIST(topic_status_cache) ..() /world/Del() - // memory leaks bad - var/num_deleted = 0 - for(var/datum/gas_mixture/GM) - GM.__gasmixture_unregister() - num_deleted++ - log_world("Deallocated [num_deleted] gas mixtures") shutdown_logging() // makes sure the thread is closed before end, else we terminate ..() diff --git a/code/modules/atmospherics/gasmixtures/gas_mixture.dm b/code/modules/atmospherics/gasmixtures/gas_mixture.dm index e498ff05c9..3cc597ec31 100644 --- a/code/modules/atmospherics/gasmixtures/gas_mixture.dm +++ b/code/modules/atmospherics/gasmixtures/gas_mixture.dm @@ -196,7 +196,7 @@ GLOBAL_LIST_INIT(meta_gas_fusions, meta_gas_fusion_list()) //Compares sample to self to see if within acceptable ranges that group processing may be enabled //Returns: a string indicating what check failed, or "" if check passes -/datum/gas_mixture/proc/react(turf/open/dump_location) +/datum/gas_mixture/proc/react(datum/holder) //Performs various reactions such as combustion or fusion (LOL) //Returns: 1 if any reaction took place; 0 otherwise @@ -243,7 +243,7 @@ GLOBAL_LIST_INIT(meta_gas_fusions, meta_gas_fusion_list()) set_moles(path, text2num(gas[id])) archive() return 1 - +/* /datum/gas_mixture/react(datum/holder) . = NO_REACTION if(!total_moles()) @@ -291,7 +291,7 @@ GLOBAL_LIST_INIT(meta_gas_fusions, meta_gas_fusion_list()) . |= reaction.react(src, holder) if (. & STOP_REACTIONS) break - +*/ //Takes the amount of the gas you want to PP as an argument //So I don't have to do some hacky switches/defines/magic strings //eg: diff --git a/code/modules/atmospherics/gasmixtures/reactions.dm b/code/modules/atmospherics/gasmixtures/reactions.dm index bb65bdcaa4..7f073567c5 100644 --- a/code/modules/atmospherics/gasmixtures/reactions.dm +++ b/code/modules/atmospherics/gasmixtures/reactions.dm @@ -275,7 +275,7 @@ for (var/gas_id in air.get_gases()) gas_power += (gas_fusion_powers[gas_id]*air.get_moles(gas_id)) var/instability = MODULUS((gas_power*INSTABILITY_GAS_POWER_FACTOR)**2,toroidal_size) //Instability effects how chaotic the behavior of the reaction is - cached_scan_results[id] = instability//used for analyzer feedback + cached_scan_results["fusion"] = instability//used for analyzer feedback var/plasma = (initial_plasma-FUSION_MOLE_THRESHOLD)/(scale_factor) //We have to scale the amounts of carbon and plasma down a significant amount in order to show the chaotic dynamics we want var/carbon = (initial_carbon-FUSION_MOLE_THRESHOLD)/(scale_factor) //We also subtract out the threshold amount to make it harder for fusion to burn itself out. diff --git a/libbyond-extools.so b/libbyond-extools.so index 052a8cb037..bdae36893f 100644 Binary files a/libbyond-extools.so and b/libbyond-extools.so differ