Page 1 of 1
Emissions per tick in control.lua
Posted: Fri Nov 15, 2013 10:45 pm
by Dysoch
Devs, got a question
Is it possible to add an event to control.lua that checks if there is an specific item in an entity and if so, it adds emissions per tick to that entity (thus creating pollution)
If this isnt possible, i would like the add it to modding interface request

Re: Emissions per tick in control.lua
Posted: Sat Nov 16, 2013 6:24 am
by n9103
Dysoch wrote:Devs, got a question
Is it possible to add an event to control.lua that checks if there is an specific item in an entity and if so, it adds emissions per tick to that entity (thus creating pollution)
If this isnt possible, i would like the add it to modding interface request

Possible hack-around would be to give the building a
negative emissions per power, and just use productivity/speed modules to increase the effect.
Or, make a new module that only increases power use, but does it VERY well, but it's at the price point you're interested in using.
If you're interested in this being cheaper than regular module use, then a moderate multiplier and a moderate negative E/P will work.
If you're interested in it being higher priced, then a High multiplier and a very low negative E/P will do the trick.
(Disclaimer: it's been a few months since I messed with modding, not sure if anything's changed the way E/P works. Haven't noticed it in the dev logs I've read, but I've missed a few.)
Re: Emissions per tick in control.lua
Posted: Sat Nov 16, 2013 8:11 am
by Dysoch
n9103 wrote:Dysoch wrote:Devs, got a question
Is it possible to add an event to control.lua that checks if there is an specific item in an entity and if so, it adds emissions per tick to that entity (thus creating pollution)
If this isnt possible, i would like the add it to modding interface request

Possible hack-around would be to give the building a
negative emissions per power, and just use productivity/speed modules to increase the effect.
Or, make a new module that only increases power use, but does it VERY well, but it's at the price point you're interested in using.
If you're interested in this being cheaper than regular module use, then a moderate multiplier and a moderate negative E/P will work.
If you're interested in it being higher priced, then a High multiplier and a very low negative E/P will do the trick.
(Disclaimer: it's been a few months since I messed with modding, not sure if anything's changed the way E/P works. Haven't noticed it in the dev logs I've read, but I've missed a few.)
First off all, negative emissions is cleaning pollution.
Second, i want it this way, so that 1 machine can both clean and create pollution (and other effects in the future).
To do that, i need to add it via an event, because otherwise it would cancel each other out.
Re: Emissions per tick in control.lua
Posted: Sat Nov 16, 2013 7:05 pm
by n9103
Sorry, missed the adding part.
I don't know if it's possible, but can a power multiplier ever create energy? (even at very low initial energy use values?)
If so, then just take my idea and make both it and the reverse. The module in the machine would determine create or subtract.
Re: Emissions per tick in control.lua
Posted: Sat Nov 16, 2013 10:06 pm
by Dysoch
n9103 wrote:Sorry, missed the adding part.
I don't know if it's possible, but can a power multiplier ever create energy? (even at very low initial energy use values?)
If so, then just take my idea and make both it and the reverse. The module in the machine would determine create or subtract.
Nono, the module is just a placeholder. The module does nothing. Its the event that does it. Power usage will be added in the data definitions. Just need something like this (this code is sloppy, and wont work)
Code: Select all
if iteminventory=(pollution-module) then
Entity.add "emission_per_tick= "100",
Thats all i want, not that the module does something.
Re: Emissions per tick in control.lua
Posted: Sun Nov 17, 2013 6:25 am
by n9103
I understood that part, but was trying to give you a work around until/unless it became possible.
Re: Emissions per tick in control.lua
Posted: Sun Nov 17, 2013 10:48 am
by Dysoch
n9103 wrote:I understood that part, but was trying to give you a work around until/unless it became possible.
Already have a workaround. I added 2 entities, 1 with positive and 1 with negative emissions.
But its crude, and i am hoping for this interface.
Re: Emissions per tick in control.lua
Posted: Mon Nov 25, 2013 7:17 pm
by slpwnd
This is tricky, because the emissions_per_tick is a property of the prototype not the entity. What that means is that this is shared by all the entities defined by that prototype. Even if it would be possible to change that value from the script (which is not now, but most probably will be in the future) it wouldn't help, because it would affect all the entities of that entity type.
Re: Emissions per tick in control.lua
Posted: Mon Nov 25, 2013 9:28 pm
by Dysoch
slpwnd wrote:This is tricky, because the emissions_per_tick is a property of the prototype not the entity. What that means is that this is shared by all the entities defined by that prototype. Even if it would be possible to change that value from the script (which is not now, but most probably will be in the future) it wouldn't help, because it would affect all the entities of that entity type.
i see, but it would be awesome when we can also create custom entity types.
then it would solve everything.