makes vent scrubbers only activate if a gas they filter is on their tile, again! alive edition (#65591)

Alsonce scrubbers only wake up if something they can filter is on the tile an existing bug where scrubbers dont filter very small but non garbage collectable amounts of a gas becomes a big issue, as in without changing scrubbing rates you can breathe once on a tile with a scrubber set to scrub co2 and that co2 wont go away barring any other factors and the scrubber wont go to sleep. so now with the idea of rohesie and permission of lemon i changed how scrubbers removed small molar amounts of gas from their turf. now scrubbers will look through 100% of the turfs air mix for filtering, but will only remove up to
gas moles * (scrubber volume / turf volume) * (gas moles / total filterable moles) moles from each filterable gas in the turfs mix unless that amount is less than either MOLAR_ACCURACY * 100 or the number of moles of that filterable gas, in which case all of the moles of that gas are subtracted from the mix. this is to make it easier for the scrubber to remove very small amounts of gas with filters without changing how fast they scrub large amounts of gas, thus making scrubbers able to go to sleep faster only after a gas has been reduced to near zero

scrubbers are the biggest proportion of SSair's machine processing cost which is a non trivial amount of SSair's total cost. now they will only do most of their work if they can actually scrub anything on the tile which is a minority of the time.
This commit is contained in:
Kylerace
2022-03-29 22:47:15 -07:00
committed by GitHub
parent d14eac752b
commit cd515971a1
7 changed files with 216 additions and 87 deletions
+12 -8
View File
@@ -123,20 +123,24 @@
* Internal proc to handle behaviour when being removed from a parent
*/
/datum/component/proc/_RemoveFromParent()
var/datum/P = parent
var/list/dc = P.datum_components
var/datum/parent = src.parent
var/list/parents_components = parent.datum_components
for(var/I in _GetInverseTypeList())
var/list/components_of_type = dc[I]
var/list/components_of_type = parents_components[I]
if(length(components_of_type)) //
var/list/subtracted = components_of_type - src
if(subtracted.len == 1) //only 1 guy left
dc[I] = subtracted[1] //make him special
parents_components[I] = subtracted[1] //make him special
else
dc[I] = subtracted
parents_components[I] = subtracted
else //just us
dc -= I
if(!dc.len)
P.datum_components = null
parents_components -= I
if(!parents_components.len)
parent.datum_components = null
UnregisterFromParent()