The 0.18.0 changelog said:
But entity.prototype.emissions_per_second always seems to return 0 no matter what. At the energy source prototype level, the API docs for ElectricEnergySourcePrototype and BurnerPrototype don't have any entries for emissions_per_minute, it's still emissions. Quickly testing in game, I get illegal index for entity.prototype.electric_energy_source.emissions_per_minute. Plain ol' emissions still works, but it returns some tiny number that's too small even to be emissions per tick, so it must be emissions per watt per tick or something.Removed EntityPrototype::emissions_per_tick, it is replaced by emissions_per_second.
Removed EnergySourcePrototype::emissions_per_second_per_watt and emissions, they are replaced by emissions_per_minute.
Fortunately all I want is to detect an entity with negative emissions, so this currently works for that in 0.18.3:
Code: Select all
local function get_emissions(entity)
local p = entity.prototype
if p.electric_energy_source_prototype then
return p.electric_energy_source_prototype.emissions
elseif p.burner_prototype then
return p.burner_prototype.emissions
end
return 0
end