Removes some boiler plate from working with atmos code (#58885)

Everything that called turf.assume_air and turf.remove_air was already updating turfs, and all that not tying

the two together did was add more boiler plate, and break things when people forgot about it.

This shouldn't add any overhead outside of hotspots, but I think that's trivial
This commit is contained in:
LemonInTheDark
2021-05-04 22:31:30 -07:00
committed by GitHub
parent a66fd3b43a
commit 4e53d8c4bc
26 changed files with 6 additions and 38 deletions

View File

@@ -91,7 +91,7 @@
return return
var/datum/gas_mixture/env = L.return_air() //get air from the turf var/datum/gas_mixture/env = L.return_air() //get air from the turf
var/datum/gas_mixture/removed = env.remove(0.1 * env.total_moles()) var/datum/gas_mixture/removed = env.remove_ratio(0.1)
if(!removed) if(!removed)
return return

View File

@@ -224,7 +224,6 @@
//Burn it based on transfered gas //Burn it based on transfered gas
target.hotspot_expose((tank_mix.temperature*2) + 380,500) target.hotspot_expose((tank_mix.temperature*2) + 380,500)
//location.hotspot_expose(1000,500,1) //location.hotspot_expose(1000,500,1)
SSair.add_to_active(target)
/obj/item/flamethrower/Initialize(mapload) /obj/item/flamethrower/Initialize(mapload)
. = ..() . = ..()

View File

@@ -82,7 +82,6 @@
if(!T) if(!T)
return return
T.assume_air(gasused) T.assume_air(gasused)
T.air_update_turf(FALSE, FALSE)
if(!gasused) if(!gasused)
to_chat(user, "<span class='warning'>\The [src]'s tank is empty!</span>") to_chat(user, "<span class='warning'>\The [src]'s tank is empty!</span>")
target.apply_damage((force / 5), BRUTE) target.apply_damage((force / 5), BRUTE)

View File

@@ -131,7 +131,6 @@
var/atom/location = loc var/atom/location = loc
if(location) if(location)
location.assume_air(air_contents) location.assume_air(air_contents)
location.air_update_turf(FALSE, FALSE)
playsound(location, 'sound/effects/spray.ogg', 10, TRUE, -3) playsound(location, 'sound/effects/spray.ogg', 10, TRUE, -3)
return ..() return ..()
@@ -267,7 +266,6 @@
return return
var/datum/gas_mixture/leaked_gas = air_contents.remove_ratio(0.25) var/datum/gas_mixture/leaked_gas = air_contents.remove_ratio(0.25)
location.assume_air(leaked_gas) location.assume_air(leaked_gas)
location.air_update_turf(FALSE, FALSE)
/** /**
* Handles the minimum and maximum pressure tolerances of the tank. * Handles the minimum and maximum pressure tolerances of the tank.

View File

@@ -200,8 +200,6 @@
ground_zero.assume_air(bomb_mixture) ground_zero.assume_air(bomb_mixture)
ground_zero.hotspot_expose(1000, 125) ground_zero.hotspot_expose(1000, 125)
ground_zero.air_update_turf(FALSE, FALSE)
/obj/item/tank/proc/release() //This happens when the bomb is not welded. Tank contents are just spat out. /obj/item/tank/proc/release() //This happens when the bomb is not welded. Tank contents are just spat out.
var/datum/gas_mixture/our_mix = return_air() var/datum/gas_mixture/our_mix = return_air()
var/datum/gas_mixture/removed = remove_air(our_mix.total_moles()) var/datum/gas_mixture/removed = remove_air(our_mix.total_moles())
@@ -209,7 +207,6 @@
if(!T) if(!T)
return return
T.assume_air(removed) T.assume_air(removed)
air_update_turf(FALSE, FALSE)
/obj/item/onetankbomb/return_analyzable_air() /obj/item/onetankbomb/return_analyzable_air()
if(bombtank) if(bombtank)

View File

@@ -63,12 +63,14 @@
return FALSE return FALSE
air.merge(giver) air.merge(giver)
update_visuals() update_visuals()
air_update_turf(FALSE, FALSE)
return TRUE return TRUE
/turf/open/remove_air(amount) /turf/open/remove_air(amount)
var/datum/gas_mixture/ours = return_air() var/datum/gas_mixture/ours = return_air()
var/datum/gas_mixture/removed = ours.remove(amount) var/datum/gas_mixture/removed = ours.remove(amount)
update_visuals() update_visuals()
air_update_turf(FALSE, FALSE)
return removed return removed
/turf/open/proc/copy_air_with_tile(turf/open/T) /turf/open/proc/copy_air_with_tile(turf/open/T)

View File

@@ -82,7 +82,6 @@
return return
loc.assume_air(removed) loc.assume_air(removed)
air_update_turf(FALSE, FALSE)
var/datum/pipeline/parent1 = parents[1] var/datum/pipeline/parent1 = parents[1]
parent1.update = TRUE parent1.update = TRUE
@@ -107,7 +106,6 @@
return return
air2.merge(removed) air2.merge(removed)
air_update_turf(FALSE, FALSE)
var/datum/pipeline/parent2 = parents[2] var/datum/pipeline/parent2 = parents[2]
parent2.update = TRUE parent2.update = TRUE

View File

@@ -383,7 +383,6 @@
loc.assume_air(main_port.remove_ratio(1)) loc.assume_air(main_port.remove_ratio(1))
if(thermal_exchange_port) if(thermal_exchange_port)
loc.assume_air(thermal_exchange_port.remove_ratio(1)) loc.assume_air(thermal_exchange_port.remove_ratio(1))
air_update_turf(FALSE, FALSE)
qdel(src) qdel(src)
/obj/machinery/atmospherics/components/binary/thermomachine/ui_status(mob/user) /obj/machinery/atmospherics/components/binary/thermomachine/ui_status(mob/user)

View File

@@ -83,7 +83,6 @@
if(istype(T)) if(istype(T))
var/datum/gas_mixture/leaked = removed.remove_ratio(VOLUME_PUMP_LEAK_AMOUNT) var/datum/gas_mixture/leaked = removed.remove_ratio(VOLUME_PUMP_LEAK_AMOUNT)
T.assume_air(leaked) T.assume_air(leaked)
T.air_update_turf(FALSE, FALSE)
air2.merge(removed) air2.merge(removed)

View File

@@ -184,7 +184,6 @@
continue continue
to_release.merge(air.remove(shared_loss)) to_release.merge(air.remove(shared_loss))
T.assume_air(to_release) T.assume_air(to_release)
air_update_turf(FALSE, FALSE)
// Helpers // Helpers

View File

@@ -325,7 +325,6 @@
remove = remove_fusion.remove_ratio(0.1) remove = remove_fusion.remove_ratio(0.1)
var/turf/local = pick(around_turfs) var/turf/local = pick(around_turfs)
local.assume_air(remove) local.assume_air(remove)
local.air_update_turf(FALSE, FALSE)
loc.assume_air(internal_fusion) loc.assume_air(internal_fusion)
var/datum/gas_mixture/remove_moderator var/datum/gas_mixture/remove_moderator
if(moderator_internal.total_moles() > 0) if(moderator_internal.total_moles() > 0)
@@ -335,7 +334,5 @@
remove = remove_moderator.remove_ratio(0.1) remove = remove_moderator.remove_ratio(0.1)
var/turf/local = pick(around_turfs) var/turf/local = pick(around_turfs)
local.assume_air(remove) local.assume_air(remove)
local.air_update_turf(FALSE, FALSE)
loc.assume_air(moderator_internal) loc.assume_air(moderator_internal)
air_update_turf(FALSE, FALSE)
qdel(src) qdel(src)

View File

@@ -40,7 +40,6 @@
if(bluespace_network.total_moles()) if(bluespace_network.total_moles())
var/turf/local_turf = get_turf(src) var/turf/local_turf = get_turf(src)
local_turf.assume_air(bluespace_network) local_turf.assume_air(bluespace_network)
local_turf.air_update_turf(FALSE, FALSE)
return ..() return ..()
/obj/machinery/atmospherics/components/unary/bluespace_sender/update_icon_state() /obj/machinery/atmospherics/components/unary/bluespace_sender/update_icon_state()

View File

@@ -153,12 +153,9 @@
///Take the turf the cryotube is on ///Take the turf the cryotube is on
var/turf/T = get_turf(src) var/turf/T = get_turf(src)
if(T) if(T)
///Take the air composition of the turf
var/datum/gas_mixture/env = T.return_air()
///Take the air composition inside the cryotube ///Take the air composition inside the cryotube
var/datum/gas_mixture/air1 = airs[1] var/datum/gas_mixture/air1 = airs[1]
env.merge(air1) T.assume_air(air1)
T.air_update_turf(FALSE, FALSE)
return ..() return ..()

View File

@@ -76,7 +76,6 @@
var/datum/gas_mixture/removed = air_contents.remove(transfer_moles) var/datum/gas_mixture/removed = air_contents.remove(transfer_moles)
location.assume_air(removed) location.assume_air(removed)
air_update_turf(FALSE, FALSE)
update_parents() update_parents()

View File

@@ -118,7 +118,6 @@
return return
loc.assume_air(removed) loc.assume_air(removed)
air_update_turf(FALSE, FALSE)
update_parents() update_parents()
else // external -> internal else // external -> internal
@@ -137,7 +136,6 @@
return return
air_contents.merge(removed) air_contents.merge(removed)
air_update_turf(FALSE, FALSE)
update_parents() update_parents()
//Radio remote control //Radio remote control

View File

@@ -190,7 +190,6 @@
//Remix the resulting gases //Remix the resulting gases
air_contents.merge(filtered_out) air_contents.merge(filtered_out)
tile.assume_air(removed) tile.assume_air(removed)
tile.air_update_turf(FALSE, FALSE)
update_parents() update_parents()
else //Just siphoning all air else //Just siphoning all air
@@ -200,7 +199,6 @@
var/datum/gas_mixture/removed = tile.remove_air(transfer_moles) var/datum/gas_mixture/removed = tile.remove_air(transfer_moles)
air_contents.merge(removed) air_contents.merge(removed)
tile.air_update_turf(FALSE, FALSE)
update_parents() update_parents()
return TRUE return TRUE

View File

@@ -138,7 +138,6 @@
merger.gases[spawn_id][MOLES] = spawn_mol * delta_time merger.gases[spawn_id][MOLES] = spawn_mol * delta_time
merger.temperature = spawn_temp merger.temperature = spawn_temp
O.assume_air(merger) O.assume_air(merger)
O.air_update_turf(FALSE, FALSE)
/obj/machinery/atmospherics/miner/attack_ai(mob/living/silicon/user) /obj/machinery/atmospherics/miner/attack_ai(mob/living/silicon/user)
if(broken) if(broken)

View File

@@ -45,7 +45,6 @@
if(air_temporary) if(air_temporary)
var/turf/T = loc var/turf/T = loc
T.assume_air(air_temporary) T.assume_air(air_temporary)
air_update_turf(FALSE, FALSE)
/obj/machinery/atmospherics/pipe/return_air() /obj/machinery/atmospherics/pipe/return_air()
if(air_temporary) if(air_temporary)

View File

@@ -521,7 +521,7 @@ GLOBAL_LIST_INIT(gas_id_to_canister, init_gas_id_to_canister())
var/expelled_pressure = expelled_gas?.return_pressure() var/expelled_pressure = expelled_gas?.return_pressure()
var/turf/T = get_turf(src) var/turf/T = get_turf(src)
T.assume_air(expelled_gas) T.assume_air(expelled_gas)
air_update_turf(FALSE, FALSE)
obj_break() obj_break()
if(expelled_pressure > pressure_limit) if(expelled_pressure > pressure_limit)

View File

@@ -40,7 +40,6 @@
//This explosion will destroy the can, release its air. //This explosion will destroy the can, release its air.
var/turf/T = get_turf(src) var/turf/T = get_turf(src)
T.assume_air(air_contents) T.assume_air(air_contents)
T.air_update_turf(FALSE, FALSE)
return ..() return ..()

View File

@@ -30,7 +30,6 @@
/obj/machinery/portable_atmospherics/pump/Destroy() /obj/machinery/portable_atmospherics/pump/Destroy()
var/turf/T = get_turf(src) var/turf/T = get_turf(src)
T.assume_air(air_contents) T.assume_air(air_contents)
air_update_turf(FALSE, FALSE)
return ..() return ..()
/obj/machinery/portable_atmospherics/pump/update_icon_state() /obj/machinery/portable_atmospherics/pump/update_icon_state()

View File

@@ -38,7 +38,6 @@
/obj/machinery/portable_atmospherics/scrubber/Destroy() /obj/machinery/portable_atmospherics/scrubber/Destroy()
var/turf/T = get_turf(src) var/turf/T = get_turf(src)
T.assume_air(air_contents) T.assume_air(air_contents)
air_update_turf(FALSE, FALSE)
return ..() return ..()
/obj/machinery/portable_atmospherics/scrubber/update_icon_state() /obj/machinery/portable_atmospherics/scrubber/update_icon_state()

View File

@@ -63,7 +63,6 @@
stank.gases[/datum/gas/miasma][MOLES] = (yield + 6)*3.5*MIASMA_CORPSE_MOLES*delta_time // this process is only being called about 2/7 as much as corpses so this is 12-32 times a corpses stank.gases[/datum/gas/miasma][MOLES] = (yield + 6)*3.5*MIASMA_CORPSE_MOLES*delta_time // this process is only being called about 2/7 as much as corpses so this is 12-32 times a corpses
stank.temperature = T20C // without this the room would eventually freeze and miasma mining would be easier stank.temperature = T20C // without this the room would eventually freeze and miasma mining would be easier
T.assume_air(stank) T.assume_air(stank)
T.air_update_turf(FALSE, FALSE)
//Galaxy Thistle //Galaxy Thistle
/obj/item/seeds/galaxythistle /obj/item/seeds/galaxythistle

View File

@@ -125,7 +125,6 @@
if(breath) if(breath)
loc.assume_air(breath) loc.assume_air(breath)
air_update_turf(FALSE, FALSE)
/mob/living/carbon/proc/has_smoke_protection() /mob/living/carbon/proc/has_smoke_protection()
if(HAS_TRAIT(src, TRAIT_NOBREATH)) if(HAS_TRAIT(src, TRAIT_NOBREATH))

View File

@@ -132,7 +132,6 @@
// called to vent all gas in holder to a location // called to vent all gas in holder to a location
/obj/structure/disposalholder/proc/vent_gas(turf/T) /obj/structure/disposalholder/proc/vent_gas(turf/T)
T.assume_air(gas) T.assume_air(gas)
T.air_update_turf(FALSE, FALSE)
/obj/structure/disposalholder/AllowDrop() /obj/structure/disposalholder/AllowDrop()
return TRUE return TRUE

View File

@@ -242,7 +242,6 @@
/obj/vehicle/sealed/mecha/obj_destruction() /obj/vehicle/sealed/mecha/obj_destruction()
loc.assume_air(cabin_air) loc.assume_air(cabin_air)
air_update_turf(FALSE, FALSE)
for(var/mob/living/occupant as anything in occupants) for(var/mob/living/occupant as anything in occupants)
if(isAI(occupant)) if(isAI(occupant))
occupant.gib() //No wreck, no AI to recover occupant.gib() //No wreck, no AI to recover
@@ -399,7 +398,6 @@
var/datum/gas_mixture/leaked_gas = int_tank_air.remove_ratio(DT_PROB_RATE(0.05, delta_time)) var/datum/gas_mixture/leaked_gas = int_tank_air.remove_ratio(DT_PROB_RATE(0.05, delta_time))
if(loc) if(loc)
loc.assume_air(leaked_gas) loc.assume_air(leaked_gas)
air_update_turf(FALSE, FALSE)
else else
qdel(leaked_gas) qdel(leaked_gas)