Huge optimizations+some fixes

This commit is contained in:
Putnam
2021-01-19 17:48:20 -08:00
parent a6a91347ff
commit f05df1c7de
21 changed files with 128 additions and 75 deletions
@@ -58,10 +58,11 @@
if (T.atmos_adjacent_turfs)
T.atmos_adjacent_turfs -= src
UNSETEMPTY(T.atmos_adjacent_turfs)
T.set_sleeping(!length(T.atmos_adjacent_turfs))
T.__update_auxtools_turf_adjacency_info(isspaceturf(T.get_z_base_turf()), -1)
UNSETEMPTY(atmos_adjacent_turfs)
src.atmos_adjacent_turfs = atmos_adjacent_turfs
set_sleeping(!(canpass || canvpass))
set_sleeping(!length(atmos_adjacent_turfs))
__update_auxtools_turf_adjacency_info(isspaceturf(get_z_base_turf()))
/turf/proc/set_sleeping(should_sleep)
@@ -218,6 +218,18 @@ GLOBAL_LIST_INIT(auxtools_atmos_initialized,FALSE)
//Performs various reactions such as combustion or fusion (LOL)
//Returns: 1 if any reaction took place; 0 otherwise
/datum/gas_mixture/proc/adjust_heat(amt)
//Adjusts the thermal energy of the gas mixture, rather than having to do the full calculation.
//Returns: null
/datum/gas_mixture/proc/equalize_with(datum/gas_mixture/giver)
//Makes this mix have the same temperature and gas ratios as the giver, but with the same pressure, accounting for volume.
//Returns: null
/proc/equalize_all_gases_in_list(list/L)
//Makes every gas in the given list have the same pressure, temperature and gas proportions.
//Returns: null
/datum/gas_mixture/proc/__remove()
/datum/gas_mixture/remove(amount)
var/datum/gas_mixture/removed = new type
@@ -39,6 +39,7 @@
var/construction_type
var/pipe_state //icon_state as a pipe item
var/on = FALSE
var/interacts_with_air = FALSE
/obj/machinery/atmospherics/examine(mob/user)
. = ..()
@@ -57,7 +58,10 @@
armor = list("melee" = 25, "bullet" = 10, "laser" = 10, "energy" = 100, "bomb" = 0, "bio" = 100, "rad" = 100, "fire" = 100, "acid" = 70)
..()
if(process)
SSair.atmos_machinery += src
if(interacts_with_air)
SSair.atmos_air_machinery += src
else
SSair.atmos_machinery += src
SetInitDirections()
/obj/machinery/atmospherics/Destroy()
@@ -65,6 +69,7 @@
nullifyNode(i)
SSair.atmos_machinery -= src
SSair.atmos_air_machinery -= src
SSair.pipenets_needing_rebuilt -= src
dropContents()
@@ -15,6 +15,9 @@
desc = "Has a valve and pump attached to it. There are two ports."
level = 1
interacts_with_air = TRUE
var/frequency = 0
var/id = null
var/datum/radio_frequency/radio_connection
@@ -16,6 +16,7 @@
var/datum/radio_frequency/radio_connection
level = 1
interacts_with_air = TRUE
layer = GAS_SCRUBBER_LAYER
pipe_state = "injector"
@@ -6,6 +6,7 @@
can_unwrench = TRUE
level = 1
interacts_with_air = TRUE
layer = GAS_SCRUBBER_LAYER
pipe_state = "pvent"
@@ -5,6 +5,7 @@
icon_state = "relief_valve-e-map"
can_unwrench = TRUE
interaction_flags_machine = INTERACT_MACHINE_OFFLINE | INTERACT_MACHINE_WIRES_IF_OPEN | INTERACT_MACHINE_ALLOW_SILICON | INTERACT_MACHINE_OPEN_SILICON | INTERACT_MACHINE_SET_MACHINE
interacts_with_air = TRUE
var/opened = FALSE
var/open_pressure = ONE_ATMOSPHERE * 3
var/close_pressure = ONE_ATMOSPHERE
@@ -15,6 +15,8 @@
level = 1
layer = GAS_SCRUBBER_LAYER
interacts_with_air = TRUE
var/id_tag = null
var/pump_direction = RELEASING
@@ -13,6 +13,8 @@
level = 1
layer = GAS_SCRUBBER_LAYER
interacts_with_air = TRUE
var/id_tag = null
var/scrubbing = SCRUBBING //0 = siphoning, 1 = scrubbing
@@ -241,26 +241,4 @@
/datum/pipeline/proc/reconcile_air()
var/list/datum/gas_mixture/GL = get_all_connected_airs()
var/total_thermal_energy = 0
var/total_heat_capacity = 0
var/datum/gas_mixture/total_gas_mixture = new(0)
for(var/i in GL)
var/datum/gas_mixture/G = i
total_gas_mixture.set_volume(total_gas_mixture.return_volume() + G.return_volume())
total_gas_mixture.merge(G)
total_thermal_energy += G.thermal_energy()
total_heat_capacity += G.heat_capacity()
if(total_heat_capacity)
total_gas_mixture.set_temperature(total_thermal_energy/total_heat_capacity)
if(total_gas_mixture.return_volume() > 0)
//Update individual gas_mixtures by volume ratio
for(var/i in GL)
var/datum/gas_mixture/G = i
G.copy_from(total_gas_mixture)
G.multiply(G.return_volume()/total_gas_mixture.return_volume())
equalize_all_gases_in_list(GL)
@@ -12,6 +12,7 @@
icon_state = "miner"
density = FALSE
resistance_flags = INDESTRUCTIBLE|ACID_PROOF|FIRE_PROOF
interacts_with_air = TRUE
var/spawn_id = null
var/spawn_temp = T20C
var/spawn_mol = MOLES_CELLSTANDARD * 10
@@ -6,6 +6,7 @@
buckle_lying = 1
var/icon_temperature = T20C //stop small changes in temperature causing icon refresh
resistance_flags = LAVA_PROOF | FIRE_PROOF
interacts_with_air = TRUE
/obj/machinery/atmospherics/pipe/heat_exchanging/Initialize()
. = ..()
@@ -16,7 +16,7 @@
/obj/machinery/portable_atmospherics/New()
..()
SSair.atmos_machinery += src
SSair.atmos_air_machinery += src
air_contents = new(volume)
air_contents.set_temperature(T20C)
@@ -24,7 +24,7 @@
return 1
/obj/machinery/portable_atmospherics/Destroy()
SSair.atmos_machinery -= src
SSair.atmos_air_machinery -= src
disconnect()
qdel(air_contents)
@@ -283,7 +283,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
/obj/machinery/power/supermatter_crystal/Initialize()
. = ..()
uid = gl_uid++
SSair.atmos_machinery += src
SSair.atmos_air_machinery += src
countdown = new(src)
countdown.start()
GLOB.poi_list |= src
@@ -302,7 +302,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
/obj/machinery/power/supermatter_crystal/Destroy()
investigate_log("has been destroyed.", INVESTIGATE_SUPERMATTER)
SSair.atmos_machinery -= src
SSair.atmos_air_machinery -= src
QDEL_NULL(radio)
GLOB.poi_list -= src
QDEL_NULL(countdown)
+6
View File
@@ -205,3 +205,9 @@
var/turf/oldT = moved_atoms[moved_object]
moved_object.lateShuttleMove(oldT, movement_force, movement_direction)
/obj/docking_port/mobile/proc/reset_air()
var/list/turfs = return_ordered_turfs(x, y, z, dir)
for(var/i in 1 to length(turfs))
var/turf/open/T = turfs[i]
if(istype(T))
T.air.copy_from_turf(T)