LUA code to transform pollution in energy.

Place to get help with not working mods / modding interface.
Post Reply
User avatar
Grandirus
Burner Inserter
Burner Inserter
Posts: 14
Joined: Fri Jun 12, 2015 7:21 pm
Contact:

LUA code to transform pollution in energy.

Post 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.

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12888
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: LUA code to transform pollution in energy.

Post by ssilk »

Moved topic from mod-rules to modding help.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

luan
Manual Inserter
Manual Inserter
Posts: 4
Joined: Wed Dec 23, 2015 4:11 pm
Contact:

Re: LUA code to transform pollution in energy.

Post 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
}

User avatar
Grandirus
Burner Inserter
Burner Inserter
Posts: 14
Joined: Fri Jun 12, 2015 7:21 pm
Contact:

Re: LUA code to transform pollution in energy.

Post 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?

User avatar
Grandirus
Burner Inserter
Burner Inserter
Posts: 14
Joined: Fri Jun 12, 2015 7:21 pm
Contact:

Re: LUA code to transform pollution in energy.

Post 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.

User avatar
Grandirus
Burner Inserter
Burner Inserter
Posts: 14
Joined: Fri Jun 12, 2015 7:21 pm
Contact:

Re: LUA code to transform pollution in energy.

Post by Grandirus »

No ideas?
Nobody?
:|

matjojo
Filter Inserter
Filter Inserter
Posts: 337
Joined: Wed Jun 17, 2015 6:08 pm
Contact:

Re: LUA code to transform pollution in energy.

Post 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?

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5153
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: LUA code to transform pollution in energy.

Post 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

User avatar
Grandirus
Burner Inserter
Burner Inserter
Posts: 14
Joined: Fri Jun 12, 2015 7:21 pm
Contact:

Re: LUA code to transform pollution in energy.

Post by Grandirus »

Thanks for all the replys. I will try and tell if I succeed.

DoctorWho?
Long Handed Inserter
Long Handed Inserter
Posts: 80
Joined: Sat Jan 10, 2015 3:42 am
Contact:

Re: LUA code to transform pollution in energy.

Post 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!

User avatar
Grandirus
Burner Inserter
Burner Inserter
Posts: 14
Joined: Fri Jun 12, 2015 7:21 pm
Contact:

Re: LUA code to transform pollution in energy.

Post 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.

User avatar
Grandirus
Burner Inserter
Burner Inserter
Posts: 14
Joined: Fri Jun 12, 2015 7:21 pm
Contact:

Re: LUA code to transform pollution in energy.

Post 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.

Post Reply

Return to “Modding help”