Page 2 of 3
Re: [MOD 0.13.X] Pollution detector
Posted: Tue Jul 05, 2016 4:53 pm
by Schorty
Mod has been updated. Just download it from here or via mod portal.
Re: [MOD 0.13.X] Pollution detector
Posted: Sun Jul 17, 2016 1:12 pm
by Pagan_PL
I' ve got an error about pollution detector entity: Error while loading pollution detector(constant combinator) No such node(sprite). Can anyone help me with this? I'm using newest STABLE release downloaded from here...
Re: [MOD 0.14.X] Pollution detector
Posted: Mon Aug 29, 2016 8:05 am
by Schorty
Updated to work with Version 0.14.
Pagan_PL wrote:I' ve got an error about pollution detector entity: Error while loading pollution detector(constant combinator) No such node(sprite). Can anyone help me with this? I'm using newest STABLE release downloaded from here...
It's working fine for me. Could you upload the savegame, so I can check if it's something wrong there?
Re: [MOD 0.15.X] Pollution detector
Posted: Tue Apr 25, 2017 8:43 am
by Schorty
Mod has been updated for Factorio 0.15.X. Just download it from here or via mod portal.
Re: [MOD 0.15.X] Pollution detector
Posted: Sun Nov 19, 2017 1:32 am
by Veden
Cool mod. I updated your control file to scale better with more detectors
The biggest change is only a set amount of detectors are processed each pass.
Code: Select all
local DETECTORS_TO_PROCESS = 30
local pollutionDetectors
local pollutionRuntime
local function onConfigChange()
if not pollutionRuntime then
if not global.pollutionRuntime then
global.pollutionRuntime = {}
end
pollutionRuntime = global.pollutionRuntime
end
if (pollutionRuntime.version ~= 1) then
pollutionRuntime.processEvent = (math.ceil(game.tick / 60) + 1) * 60
print(pollutionRuntime.processEvent)
pollutionRuntime.queueIndex = 1
pollutionRuntime.virtualSignalParam = {
parameters={
{
index=1,
signal={
type="item",
name="pollution"
},
count=-1
}
}
}
pollutionRuntime.version = 1
end
end
local function onInit()
global.pollutionDetectors = {}
global.pollutionRuntime = {}
pollutionDetectors = global.pollutionDetectors
pollutionRuntime = global.pollutionRuntime
onConfigChange()
end
local function onLoad()
pollutionDetectors = global.pollutionDetectors
pollutionRuntime = global.pollutionRuntime
end
-- Logic
local function addPDToTable(event)
local entity = event.created_entity
if (entity.name == "pollution-detector") then
entity.operable = false
pollutionDetectors[#pollutionDetectors+1] = entity
end
end
local function removePollutionDetector(event)
local entity = event.entity
if (entity.name == "pollution-detector") then
for i = #pollutionDetectors,1,-1 do
local pd = pollutionDetectors[i]
if pd.valid then
if (entity == pd) then
table.remove(pollutionDetectors, i)
break
end
else
table.remove(pollutionDetectors, i)
end
end
end
end
local function setPollutionValue(entity)
if (entity.valid) then
local pollutionSignal = pollutionRuntime.virtualSignalParam
pollutionSignal.parameters[1].count = math.floor(entity.surface.get_pollution(entity.position))
entity.get_control_behavior().parameters = pollutionSignal
end
end
local function onTick(event)
local tick = event.tick
if (pollutionRuntime.processEvent == tick) then
pollutionRuntime.processEvent = pollutionRuntime.processEvent + 60
local startIndex = pollutionRuntime.queueIndex
local endIndex = math.min(#pollutionDetectors, startIndex + DETECTORS_TO_PROCESS)
for i = startIndex, endIndex do
setPollutionValue(pollutionDetectors[i])
end
if (endIndex == #pollutionDetectors) then
pollutionRuntime.queueIndex = 1
else
pollutionRuntime.queueIndex = endIndex
end
end
end
-- Events
script.on_init(onInit)
script.on_load(onLoad)
script.on_configuration_changed(onConfigChange)
script.on_event({defines.events.on_built_entity,
defines.events.on_robot_built_entity}, addPDToTable)
script.on_event({defines.events.on_player_mined_entity,
defines.events.on_robot_mined_entity,
defines.events.on_entity_died}, removePollutionDetector)
script.on_event(defines.events.on_tick, onTick)
Re: [MOD 0.15.X] Pollution detector
Posted: Sat Nov 25, 2017 2:18 pm
by Optera
My megabase heavily relies on this to control the air filters.
Sadly its performance wasn't up to the task, so i rewrote it from scratch.
Update:
added version for Factorio 0.16 with hr graphics
Re: [MOD 0.15.X] Pollution detector
Posted: Wed Dec 27, 2017 3:45 pm
by Schorty
Thank you, Optera,
I'll take 0.4.0 as the current version. I'll give you credit aswell
Greetings,
Schorty
Re: [MOD 0.15.X] Pollution detector
Posted: Wed Dec 27, 2017 5:05 pm
by Optera
Good to see you still around Schorty.
Sidenote to my forks:
I replaced the pollution icon with a pollution signal a while ago and never bothered adding a migration script, so all circuit logic using the pollution item will have to be reset.
Re: [MOD 0.15.X] Pollution detector
Posted: Sat Mar 03, 2018 6:58 am
by foodfactorio
i like the air filter mod
usually i go around the base manually adding the building where EvoGui shows lots of pollution (for fine tuning) plus the main map. but now that my base gets low on power, i can try using the detector to let me know when somewhere reaches a certain pollution level, and hopefully to be able to switch on (and off) the filters to save power.
(im almost ready to set up the reactor - but i made a silly mistake here)
viewtopic.php?f=208&t=56192#p347182 (picture below this post)
also Optera greetings to you
i like your Deep Mine, as it gave me a way to get new madclown ores that did not appear on the map, after adding it to a widely-explored existing game. i couldnt find a forum page for your mod so hi here.
a possible fix for the above issue could be here though,
https://mods.factorio.com/mod/DeleteEmp ... 1024d77364 but still waiting to see.
Re: [MOD 0.17.X] Pollution detector
Posted: Wed Feb 27, 2019 5:39 pm
by Schorty
Updated the mod to work with 0.17
Re: [MOD 0.17.X] Pollution detector
Posted: Fri Mar 15, 2019 4:37 pm
by Optera
With 0.17.12 you will have to multiply pollution by 60 to get appropriate values.
Re: [MOD 0.17.X] Pollution detector
Posted: Fri Mar 15, 2019 4:52 pm
by Schorty
Thanks for the heads up. Will update the mod soon.
edit: Technically it outputs the appropriate pollution amount. It may or may not break previous designs, because the ratio changed, but it reads the correct numbers. I guess I'll keep the mod as it is.
Re: [MOD 0.17.X] Pollution detector
Posted: Fri Mar 15, 2019 7:39 pm
by Optera
Schorty wrote: ↑Fri Mar 15, 2019 4:52 pm
edit: Technically it outputs the appropriate pollution amount. It may or may not break previous designs, because the ratio changed, but it reads the correct numbers. I guess I'll keep the mod as it is.
I think we loose too much granularity moving the value range where air filters should be turned on to keep pollution in check from 200-300 down to 2-5.
Re: [MOD 0.17.X] Pollution detector
Posted: Fri Mar 15, 2019 8:30 pm
by Schorty
This is a fair point. Pollution is given as a floating point value, so multiplying might actually be a helpful change, because combinators wont accept floating point values..
I'll get to changing the mod right away
Re: [MOD 0.17.X] Pollution detector
Posted: Fri Mar 15, 2019 9:31 pm
by Schorty
Mod has been updated. As stated befor, I multiplied the returned value by 60, because values have been divided by 60 as of 0.17.13 (See
https://www.factorio.com/blog/post/fff-286).
Re: [MOD 0.18.X] Pollution detector
Posted: Fri Jan 24, 2020 11:37 am
by Schorty
Updated for Version 0.18
Re: [MOD 0.18.X] Pollution detector
Posted: Fri Jan 22, 2021 5:18 am
by WildBraas
Maybe 1.1 please?
Krastorio 2 need your mod!
I got some updates for 1.1 support + NanoBots support. Please upload new version or upgrade me as contributor in mod portal please (
I am).
Re: [MOD 0.18.X] Pollution detector
Posted: Sun Feb 21, 2021 12:07 pm
by Schorty
Sorry, I don't have the time at the moment. If someone else updates the mod, I'll place it in the mod portal. Sorry guys! =(
Re: [MOD 0.18.X] Pollution detector
Posted: Sun Feb 21, 2021 2:51 pm
by WildBraas
Mr Shorty, I posted upper updated version. Or you may set me as contributor in mod portal
Re: [MOD 0.18.X] Pollution detector
Posted: Fri Feb 26, 2021 12:47 pm
by Zarnoo
That mod crashes as it's not named properly in the json file.
The file should be called pollution-detector_0.1.0.zip, and the directory inside it should be named the same (without .zip). Could you not post this as a mod on the mod portal, with a note to deprecate if the original author updates ?