Page 1 of 1

LUA code to transform pollution in energy.

Posted: Mon Dec 28, 2015 3:57 am
by Grandirus
I'm have an idea to transform the huge polution we make, in energy. Using some kind of "solar panel", modified.
I will create an "greenhouse" to create leafs, and use it to other things.
But, I have no idea how to convert the pollution into energy (the lua code).
Any help will be welcome.

Re: LUA code to transform pollution in energy.

Posted: Tue Dec 29, 2015 1:22 am
by ssilk
Moved topic from mod-rules to modding help.

Re: LUA code to transform pollution in energy.

Posted: Wed Dec 30, 2015 12:31 am
by luan
You could take a look into this mod: https://forums.factorio.com/forum/vie ... php?t=7548

But from what I could find it basically registered a negative pollution emission (pretty clever hu):

Code: Select all

energy_source = {
      type = "electric",
      usage_priority = "secondary-input",
      emissions = -0.2
}

Re: LUA code to transform pollution in energy.

Posted: Wed Dec 30, 2015 5:36 am
by Grandirus
luan wrote:You could take a look into this mod: https://forums.factorio.com/forum/vie ... php?t=7548

But from what I could find it basically registered a negative pollution emission (pretty clever hu):

Code: Select all

energy_source = {
      type = "electric",
      usage_priority = "secondary-input",
      emissions = -0.2
}
Thanks.
But, how the game identify that the energy is come from pollution?
Maybe there is a formula, that use "X" emissions (depend on the entity) multiplied with a base number, then the result is the amount of energy produced per tick, second, hour, whaterver.
Thats is there I want to get in.
Any idea?

Re: LUA code to transform pollution in energy.

Posted: Thu Jan 07, 2016 8:48 pm
by Grandirus
Something like "emissions * 100", so if emissions are 1.5, then "1.5 * 100" = "150Kw". If the entity is a lvl 2, then it will be "1.5 * 150" = "225Kw". And so on.

Re: LUA code to transform pollution in energy.

Posted: Tue Jan 19, 2016 4:15 pm
by Grandirus
No ideas?
Nobody?
:|

Re: LUA code to transform pollution in energy.

Posted: Tue Jan 19, 2016 5:28 pm
by matjojo
Grandirus wrote:No ideas?
Nobody?
:|
what is it that you want to achieve, when you name the 'solar panel' Pollution reƫnergyefier, it should turn up in the energy view as Pollution reƫnergyefier. What do you wish to happen?

Re: LUA code to transform pollution in energy.

Posted: Tue Jan 19, 2016 6:55 pm
by Klonan
Ok so what you can do,
Power is created by using a generator, and this creates power by consuming a hot liquid,
So you can work out a reasonable conversion of pollurion to energy.

Say you want 1 unit of pollution to equal 1MJ or something,
Write a script to say,
By this entity, remove 1 pollution, and add 1 unit of water at 100 degrees to the generator.

If you look over these two scripts to see some examples to each.
Pollution script in diesel generator
Fluid script in wind turbine
I hope this helps

Re: LUA code to transform pollution in energy.

Posted: Sat Jan 23, 2016 4:41 am
by Grandirus
Thanks for all the replys. I will try and tell if I succeed.

Re: LUA code to transform pollution in energy.

Posted: Sat Feb 13, 2016 7:46 pm
by DoctorWho?
My first thought was an endless loop, where the machine continuously puts out power and removes pollution. But eventually, you would run out of pollution, but still make power.

My next idea is make a machine that turns pollution into some kind of fuel, and just feed the fuel into a specific generator. Done!

Re: LUA code to transform pollution in energy.

Posted: Wed Feb 17, 2016 5:23 am
by Grandirus
DoctorWho? wrote:My first thought was an endless loop, where the machine continuously puts out power and removes pollution. But eventually, you would run out of pollution, but still make power.

My next idea is make a machine that turns pollution into some kind of fuel, and just feed the fuel into a specific generator. Done!
Yeah, but to make the machine stop when there's no pollution, we need a code, just like the on I wrote up here. So, if no pollution, no energy.
But I think the game don't have this codes.

Re: LUA code to transform pollution in energy.

Posted: Wed Feb 17, 2016 5:27 am
by Grandirus
Up until now, I'm stop work in the mod, because of a health issue. I need some little time to be good again.