Paranoid updates to maybe fix air duplication
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user