diff --git a/auxmos.dll b/auxmos.dll index fecbcad8d3..3f84be97c2 100644 Binary files a/auxmos.dll and b/auxmos.dll differ diff --git a/auxmos.pdb b/auxmos.pdb index 6120488259..8ff48b20e0 100644 Binary files a/auxmos.pdb and b/auxmos.pdb differ diff --git a/code/__DEFINES/_tick.dm b/code/__DEFINES/_tick.dm index 6fd22affd1..eee7000883 100644 --- a/code/__DEFINES/_tick.dm +++ b/code/__DEFINES/_tick.dm @@ -1,7 +1,7 @@ /// Percentage of tick to leave for master controller to run #define MAPTICK_MC_MIN_RESERVE 70 /// internal_tick_usage is updated every tick by extools -#define MAPTICK_LAST_INTERNAL_TICK_USAGE ((world.map_cpu / world.tick_lag) * 100) +#define MAPTICK_LAST_INTERNAL_TICK_USAGE world.map_cpu /// Tick limit while running normally #define TICK_BYOND_RESERVE 2 #define TICK_LIMIT_RUNNING (max(100 - TICK_BYOND_RESERVE - MAPTICK_LAST_INTERNAL_TICK_USAGE, MAPTICK_MC_MIN_RESERVE)) diff --git a/code/controllers/subsystem/air.dm b/code/controllers/subsystem/air.dm index b844e9dbd9..f7775910b6 100644 --- a/code/controllers/subsystem/air.dm +++ b/code/controllers/subsystem/air.dm @@ -22,6 +22,7 @@ SUBSYSTEM_DEF(air) var/list/networks = list() var/list/pipenets_needing_rebuilt = list() var/list/deferred_airs = list() + var/max_deferred_airs = 0 var/list/obj/machinery/atmos_machinery = list() var/list/obj/machinery/atmos_air_machinery = list() var/list/pipe_init_dirs_cache = list() @@ -70,6 +71,7 @@ SUBSYSTEM_DEF(air) msg += "HS:[hotspots.len]|" msg += "PN:[networks.len]|" msg += "HP:[high_pressure_delta.len]|" + msg += "DF:[max_deferred_airs]" msg += "GA:[get_amt_gas_mixes()]|" msg += "MG:[get_max_gas_mixes()]|" return ..() @@ -80,10 +82,12 @@ SUBSYSTEM_DEF(air) setup_atmos_machinery() setup_pipenets() gas_reactions = init_gas_reactions() + auxtools_update_reactions() return ..() /datum/controller/subsystem/air/proc/extools_update_ssair() -//datum/controller/subsystem/air/proc/extools_update_reactions() + +/datum/controller/subsystem/air/proc/auxtools_update_reactions() /datum/controller/subsystem/air/proc/thread_running() return FALSE @@ -233,6 +237,7 @@ SUBSYSTEM_DEF(air) pipenets_needing_rebuilt += atmos_machine /datum/controller/subsystem/air/proc/process_deferred_airs(resumed = 0) + max_deferred_airs = max(deferred_airs.len,max_deferred_airs) while(deferred_airs.len) var/list/cur_op = deferred_airs[deferred_airs.len] deferred_airs.len-- diff --git a/code/datums/elements/mob_holder.dm b/code/datums/elements/mob_holder.dm index 619f674969..77b71e2efe 100644 --- a/code/datums/elements/mob_holder.dm +++ b/code/datums/elements/mob_holder.dm @@ -182,10 +182,21 @@ /obj/item/clothing/head/mob_holder/remove_air(amount) var/atom/location = loc if(!loc) - return //null + return null var/turf/T = get_turf(loc) while(location != T) location = location.loc if(ismob(location)) return location.loc.remove_air(amount) return location.remove_air(amount) + +/obj/item/clothing/head/mob_holder/remove_air_ratio(ratio) + var/atom/location = loc + if(!loc) + return null + var/turf/T = get_turf(loc) + while(location != T) + location = location.loc + if(ismob(location)) + return location.loc.remove_air_ratio(ratio) + return location.remove_air_ratio(ratio) diff --git a/code/game/atoms.dm b/code/game/atoms.dm index f949b48a87..5c70219e27 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -376,6 +376,9 @@ /atom/proc/remove_air(amount) return null +/atom/proc/remove_air_ratio(ratio) + return null + /atom/proc/return_air() if(loc) return loc.return_air() diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index e325ab96a4..7582a029d2 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -810,6 +810,11 @@ return cabin_air.remove(amount) return ..() +/obj/mecha/remove_air_ratio(ratio) + if(use_internal_tank) + return cabin_air.remove_ratio(ratio) + return ..() + /obj/mecha/return_air() if(use_internal_tank) return cabin_air diff --git a/code/game/objects/items/tanks/tanks.dm b/code/game/objects/items/tanks/tanks.dm index 5d0b3fbe4c..01afa9fd66 100644 --- a/code/game/objects/items/tanks/tanks.dm +++ b/code/game/objects/items/tanks/tanks.dm @@ -234,6 +234,9 @@ /obj/item/tank/remove_air(amount) return air_contents.remove(amount) +/obj/item/tank/remove_air_ratio(ratio) + return air_contents.remove_ratio(ratio) + /obj/item/tank/return_air() return air_contents diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm index dcd67bf1f2..882721ba95 100644 --- a/code/game/objects/objs.dm +++ b/code/game/objects/objs.dm @@ -102,6 +102,12 @@ else return null +/obj/remove_air_ratio(ratio) + if(loc) + return loc.remove_air_ratio(ratio) + else + return null + /obj/return_air() if(loc) return loc.return_air() @@ -116,8 +122,7 @@ if(breath_request>0) var/datum/gas_mixture/environment = return_air() - var/breath_percentage = BREATH_VOLUME / environment.return_volume() - return remove_air(environment.total_moles() * breath_percentage) + return remove_air_ratio(BREATH_VOLUME / environment.return_volume()) else return null diff --git a/code/game/objects/structures/transit_tubes/transit_tube_pod.dm b/code/game/objects/structures/transit_tubes/transit_tube_pod.dm index 89b03a8d78..1de0cdb66c 100644 --- a/code/game/objects/structures/transit_tubes/transit_tube_pod.dm +++ b/code/game/objects/structures/transit_tubes/transit_tube_pod.dm @@ -156,6 +156,9 @@ /obj/structure/transit_tube_pod/remove_air(amount) return air_contents.remove(amount) +/obj/structure/transit_tube_pod/remove_air_ratio(ratio) + return air_contents.remove_ratio(ratio) + /obj/structure/transit_tube_pod/relaymove(mob/mob, direction) if(istype(mob) && mob.client) if(!moving) diff --git a/code/game/turfs/space/space.dm b/code/game/turfs/space/space.dm index dd6bf0e1c8..f325428af9 100644 --- a/code/game/turfs/space/space.dm +++ b/code/game/turfs/space/space.dm @@ -100,6 +100,9 @@ /turf/open/space/remove_air(amount) return null +/turf/open/space/remove_air_ratio(amount) + return null + /turf/open/space/proc/update_starlight() if(CONFIG_GET(flag/starlight)) for(var/t in RANGE_TURFS(1,src)) //RANGE_TURFS is in code\__HELPERS\game.dm diff --git a/code/modules/atmospherics/environmental/LINDA_turf_tile.dm b/code/modules/atmospherics/environmental/LINDA_turf_tile.dm index e25a7ddd30..43884aa3bc 100644 --- a/code/modules/atmospherics/environmental/LINDA_turf_tile.dm +++ b/code/modules/atmospherics/environmental/LINDA_turf_tile.dm @@ -61,6 +61,12 @@ update_visuals() return removed +/turf/open/remove_air_ratio(ratio) + var/datum/gas_mixture/ours = return_air() + var/datum/gas_mixture/removed = ours.remove_ratio(ratio) + update_visuals() + return removed + /turf/open/proc/copy_air_with_tile(turf/open/T) if(istype(T)) air.copy_from(T.air) diff --git a/code/modules/atmospherics/gasmixtures/reactions.dm b/code/modules/atmospherics/gasmixtures/reactions.dm index 5f425d87ff..1765a9ed9d 100644 --- a/code/modules/atmospherics/gasmixtures/reactions.dm +++ b/code/modules/atmospherics/gasmixtures/reactions.dm @@ -15,6 +15,7 @@ if (!reaction_key || initial(reaction_key.rarity) > initial(req_gas.rarity)) reaction_key = req_gas reaction.major_gas = reaction_key + message_admins("\ref[reaction]") . += reaction sortTim(., /proc/cmp_gas_reaction) diff --git a/code/modules/atmospherics/machinery/components/unary_devices/passive_vent.dm b/code/modules/atmospherics/machinery/components/unary_devices/passive_vent.dm index b98cda9349..7cfdb9d63c 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/passive_vent.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/passive_vent.dm @@ -30,23 +30,10 @@ var/pressure_delta = abs(external_pressure - internal_pressure) if(pressure_delta > 0.5) - if(external_pressure < internal_pressure) - var/air_temperature = (external.return_temperature() > 0) ? external.return_temperature() : internal.return_temperature() - var/transfer_moles = (pressure_delta * external.return_volume()) / (air_temperature * R_IDEAL_GAS_EQUATION) - var/datum/gas_mixture/removed = internal.remove(transfer_moles) - external.merge(removed) - else - var/air_temperature = (internal.return_temperature() > 0) ? internal.return_temperature() : external.return_temperature() - var/transfer_moles = (pressure_delta * internal.return_volume()) / (air_temperature * R_IDEAL_GAS_EQUATION) - transfer_moles = min(transfer_moles, external.total_moles() * internal.return_volume() / external.return_volume()) - var/datum/gas_mixture/removed = external.remove(transfer_moles) - if(isnull(removed)) - return - internal.merge(removed) - + equalize_all_gases_in_list(list(internal,external)) active = TRUE - active = internal.temperature_share(external, OPEN_HEAT_TRANSFER_COEFFICIENT) ? TRUE : active + active = internal.temperature_share(external, OPEN_HEAT_TRANSFER_COEFFICIENT) || active if(active) air_update_turf() diff --git a/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm b/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm index a14eb38229..6192c904c4 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm @@ -156,10 +156,8 @@ return FALSE if(scrubbing & SCRUBBING) - var/transfer_moles = min(1, volume_rate/environment.return_volume())*environment.total_moles() - //Take a gas sample - var/datum/gas_mixture/removed = tile.remove_air(transfer_moles) + var/datum/gas_mixture/removed = tile.remove_air_ratio(volume_rate/environment.return_volume()) //Nothing left to remove from the tile if(isnull(removed)) @@ -173,9 +171,7 @@ else //Just siphoning all air - var/transfer_moles = environment.total_moles()*(volume_rate/environment.return_volume()) - - var/datum/gas_mixture/removed = tile.remove_air(transfer_moles) + var/datum/gas_mixture/removed = tile.remove_air_ratio((volume_rate/environment.return_volume())) air_contents.merge(removed) tile.air_update_turf() diff --git a/code/modules/atmospherics/machinery/pipes/pipes.dm b/code/modules/atmospherics/machinery/pipes/pipes.dm index 23fd2292ff..e05502dbad 100644 --- a/code/modules/atmospherics/machinery/pipes/pipes.dm +++ b/code/modules/atmospherics/machinery/pipes/pipes.dm @@ -54,6 +54,9 @@ /obj/machinery/atmospherics/pipe/remove_air(amount) return parent.air.remove(amount) +/obj/machinery/atmospherics/pipe/remove_air_ratio(ratio) + return parent.air.remove_ratio(ratio) + /obj/machinery/atmospherics/pipe/attackby(obj/item/W, mob/user, params) if(istype(W, /obj/item/pipe_meter)) var/obj/item/pipe_meter/meter = W diff --git a/code/modules/mob/living/carbon/life.dm b/code/modules/mob/living/carbon/life.dm index 9885efd7c7..b8fa8aca44 100644 --- a/code/modules/mob/living/carbon/life.dm +++ b/code/modules/mob/living/carbon/life.dm @@ -115,11 +115,11 @@ breath = loc_as_obj.handle_internal_lifeform(src, BREATH_VOLUME) else if(isturf(loc)) //Breathe from loc as turf - var/breath_moles = 0 + var/breath_ratio = 0 if(environment) - breath_moles = environment.total_moles()*BREATH_PERCENTAGE + breath_ratio = BREATH_VOLUME/environment.return_volume() - breath = loc.remove_air(breath_moles) + breath = loc.remove_air_ratio(breath_ratio) else //Breathe from loc as obj again if(istype(loc, /obj/)) var/obj/loc_as_obj = loc diff --git a/code/modules/mob/living/simple_animal/bot/mulebot.dm b/code/modules/mob/living/simple_animal/bot/mulebot.dm index 9176f410c3..b287b854a3 100644 --- a/code/modules/mob/living/simple_animal/bot/mulebot.dm +++ b/code/modules/mob/living/simple_animal/bot/mulebot.dm @@ -753,6 +753,12 @@ else return null +/mob/living/simple_animal/bot/mulebot/remove_air_ratio(ratio) + if(loc) + return loc.remove_air_ratio(ratio) + else + return null + /mob/living/simple_animal/bot/mulebot/do_resist() . = ..() if(load) diff --git a/code/modules/power/turbine.dm b/code/modules/power/turbine.dm index a9acea719c..bb92da2f4f 100644 --- a/code/modules/power/turbine.dm +++ b/code/modules/power/turbine.dm @@ -128,12 +128,10 @@ cut_overlays() rpm = 0.9* rpm + 0.1 * rpmtarget - var/datum/gas_mixture/environment = inturf.return_air() - // It's a simplified version taking only 1/10 of the moles from the turf nearby. It should be later changed into a better version + // above todo 7 years and counting - var/transfer_moles = environment.total_moles()/10 - var/datum/gas_mixture/removed = inturf.remove_air(transfer_moles) + var/datum/gas_mixture/removed = inturf.remove_air_ratio(0.1) gas_contained.merge(removed) // RPM function to include compression friction - be advised that too low/high of a compfriction value can make things screwy