Property request: force.pollution_production_statistics

Things that already exist in the current mod API
Post Reply
zOldBulldog
Smart Inserter
Smart Inserter
Posts: 1161
Joined: Sat Mar 17, 2018 1:20 pm
Contact:

Property request: force.pollution_production_statistics

Post by zOldBulldog »

It would be nice if functions were added to the Lua modding API so that modders could create a mod that allows for true ecological game play.

The basic concept is to provide LUA functions that allow a mod to create an evolution model where evolution is caused only by pollution that does not get scrubbed from the air before it reaches the enemy.

Then the mod could enable the creation of pollution scrubbing mechanisms like mechanical scrubbers and planting trees... so that a player that makes an effort to go fully green could literally stop alien evolution and maybe even stop aggressiveness simply by building in an eco-friendly way.

I am sure that is more needed, but these would be an absolute minimum set of new eco functions:
EDIT: Apparently several of these already exist although their names are so cryptic that I confess not understanding which ones do what. This list below explains it in "English", not by function name.

- Allow controlling/disabling evolution due to time.
(apparently already exists as function)

- Allow controlling/disabling evolution due to total pollution produced.
(apparently already exists as a function)

- Allow controlling/enabling evolution due to pollution reaching a nest.
(THIS might be the only piece missing - the ability to measure the pollution reaching a nest because the cloud touched it - and to cause evolution due to it)

- Allow the creation of pollution scrubbing entities (already possible).

- Allow the creation of non-polluting entities (already possible).


NOTE:
- I am NOT a LUA programmer nor do I foresee becoming one. My hope is that someone will someday create a mod that allows "true ecological gameplay" in Factorio... but to do that they need to have the basic API calls to enable creating the mod.
- So I tried to identify the functional behaviors needed (in plain English) in order to enable the creation of such a mod. As a pleasant surprise (see the discussion below) it turns out that almost all of the API functions needed already exist, you just have to know which is which and Qon kindly identified them in terms that a LUA programmer (not me) can understand :D
Last edited by zOldBulldog on Mon May 13, 2019 10:50 am, edited 2 times in total.

Qon
Smart Inserter
Smart Inserter
Posts: 2091
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: Friday Facts #294 - Blog thoughts & Lua documentation improvements

Post by Qon »

zOldBulldog wrote:
Mon May 13, 2019 9:06 am
It would be nice if functions were added to the Lua modding API so that modders could create a mod that allows for true ecological game play.
You could make a thread in viewforum.php?f=28
Title it: "Property request: force.pollution_production_statistics"
zOldBulldog in the future wrote: LuaForce has these:

Code: Select all

item_production_statistics :: LuaFlowStatistics [Read-only]
fluid_production_statistics :: LuaFlowStatistics [Read-only]
kill_count_statistics :: LuaFlowStatistics [Read-only]
entity_build_count_statistics :: LuaFlowStatistics [Read-only]
But the production view also has a pollution tab. Expose it to modders as pollution_production_statistics, please?

It would make requested mods like evolution influenced by pollution absorbed by nests possible.
_____________________________________________________
zOldBulldog wrote:
Mon May 13, 2019 9:06 am
- Allow controlling/disabling evolution due to time.
- Allow controlling/disabling evolution due to total pollution produced.
I just told you these are available in the map settings. And they are readable and writable by mods too.

zOldBulldog
Smart Inserter
Smart Inserter
Posts: 1161
Joined: Sat Mar 17, 2018 1:20 pm
Contact:

Re: Friday Facts #294 - Blog thoughts & Lua documentation improvements

Post by zOldBulldog »

Qon wrote:
Mon May 13, 2019 9:45 am
zOldBulldog wrote:
Mon May 13, 2019 9:06 am
It would be nice if functions were added to the Lua modding API so that modders could create a mod that allows for true ecological game play.
You could make a thread in viewforum.php?f=28
Title it: "Property request: force.pollution_production_statistics"
zOldBulldog in the future wrote: LuaForce has these:

Code: Select all

item_production_statistics :: LuaFlowStatistics [Read-only]
fluid_production_statistics :: LuaFlowStatistics [Read-only]
kill_count_statistics :: LuaFlowStatistics [Read-only]
entity_build_count_statistics :: LuaFlowStatistics [Read-only]
But the production view also has a pollution tab. Expose it to modders as pollution_production_statistics, please?

It would make requested mods like evolution influenced by pollution absorbed by nests possible.
_____________________________________________________
zOldBulldog wrote:
Mon May 13, 2019 9:06 am
- Allow controlling/disabling evolution due to time.
- Allow controlling/disabling evolution due to total pollution produced.
I just told you these are available in the map settings. And they are readable and writable by mods too.


Sorry if I did not understand you in the other post when you said these two functions are already available. I thought you were saying exactly the opposite. That is why I posted here once I noticed they had made a thread for the LUA functions. But an actual subforum for Lua requests is even better.

So, to do what I describe, is the only function still missing the one to enable/control evolution based on unscrubbed pollution that *reaches* a nest? (since you can already disable Evo through time and "generally produced")

And with this confusion I suspect I just demonstrated how bad/confusing are the Lua function names and importance of docunentation. Even with you pointing to these Lua methods their names are cryptic and different enough from the behaviors I describe that I still struggle to decipher which does what and how. Good thing that they are working to improve documentation.

Qon
Smart Inserter
Smart Inserter
Posts: 2091
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: Friday Facts #294 - Blog thoughts & Lua documentation improvements

Post by Qon »

zOldBulldog wrote:
Mon May 13, 2019 10:14 am
Sorry if I did not understand you in the other post when you said these two functions are already available. I thought you were saying exactly the opposite. That is why I posted here once I noticed they had made a thread for the LUA functions. But an actual subforum for Lua requests is even better.
Yes, because it will allow the devs that actually implement the requests to see the request instead of someone unrelated to mod interface requests :)
zOldBulldog wrote:
Mon May 13, 2019 10:14 am
So, to do what I describe, is the only function still missing the one to enable/control evolution based on unscrubbed pollution that *reaches* a nest? (since you can already disable Evo through time and "generally produced")
Yes. Or technically, it is the function that allows you to read pollution absorbed by nests that is the only thing missing. Setting the evolution factor is already possible and linking them together would be possible for a mod once they can read the necessary data.

But I already wrote a technically correct and easily understandable (for the mod interface devs) suggestion title and post that you can just copy and paste to request the correct thing.

zOldBulldog
Smart Inserter
Smart Inserter
Posts: 1161
Joined: Sat Mar 17, 2018 1:20 pm
Contact:

Re: Friday Facts #294 - Blog thoughts & Lua documentation improvements

Post by zOldBulldog »

Qon wrote:
Mon May 13, 2019 10:23 am
zOldBulldog wrote:
Mon May 13, 2019 10:14 am
Sorry if I did not understand you in the other post when you said these two functions are already available. I thought you were saying exactly the opposite. That is why I posted here once I noticed they had made a thread for the LUA functions. But an actual subforum for Lua requests is even better.
Yes, because it will allow the devs that actually implement the requests to see the request instead of someone unrelated to mod interface requests :)
zOldBulldog wrote:
Mon May 13, 2019 10:14 am
So, to do what I describe, is the only function still missing the one to enable/control evolution based on unscrubbed pollution that *reaches* a nest? (since you can already disable Evo through time and "generally produced")
Yes. Or technically, it is the function that allows you to read pollution absorbed by nests that is the only thing missing. Setting the evolution factor is already possible and linking them together would be possible for a mod once they can read the necessary data.

But I already wrote a technically correct and easily understandable (for the mod interface devs) suggestion title and post that you can just copy and paste to request the correct thing.
Ty, I will copy paste into that forum as soon as I get to my computer (hard to do on a phone :D )

Bilka
Factorio Staff
Factorio Staff
Posts: 3123
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Property request: force.pollution_production_statistics

Post by Bilka »

I split your posts off from the FFF thread to make things a bit easier and copied the title from the "title it" quote in one of the posts.

Your posts are a bit confusing, what exactly is still missing? Is it what I put in the title? Because that already exists: https://lua-api.factorio.com/latest/Lua ... statistics
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

zOldBulldog
Smart Inserter
Smart Inserter
Posts: 1161
Joined: Sat Mar 17, 2018 1:20 pm
Contact:

Re: Property request: force.pollution_production_statistics

Post by zOldBulldog »

Bilka wrote:
Mon May 13, 2019 10:28 am
I split your posts off from the FFF thread to make things a bit easier and copied the title from the "title it" quote in one of the posts.

Your posts are a bit confusing, what exactly is still missing? Is it what I put in the title? Because that already exists: https://lua-api.factorio.com/latest/Lua ... statistics
Thank you Bilka. Yes, I realize there is much confusion, mostly from my lack of understanding of the various LUA functions that exist and what they do.

Even after Qon listed them... I am still having trouble seeing how functions by the names he listed relate to the behaviors I described. But that is OK, I am not the one that needs to understand it, it is the devs and mod developers that need to understand how to translate the behaviors I describe to function calls.

I edited the original post to try to make things clearer, although I am not certain I understand the existing functions well enough so I might have still failed to be 100% clear.

I *think* that based on what you all said, the only piece missing for 100% ecological gameplay might be the ability to measure pollution (cloud) that reaches a nest - unscrubbed - and based on it to create evolution.

Bilka
Factorio Staff
Factorio Staff
Posts: 3123
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Property request: force.pollution_production_statistics

Post by Bilka »

zOldBulldog wrote: (THIS might be the only piece missing - the ability to measure the pollution reaching a nest because the cloud touched it - and to cause evolution due to it)
Okay, that is solved with the pollution statistics access in LuaGameScript. You can read the pollution consumption by biter nests from it which is exactly what you describe. I will move this thread to "already exists" for now, but please do let me know if something requested here does not exist.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

zOldBulldog
Smart Inserter
Smart Inserter
Posts: 1161
Joined: Sat Mar 17, 2018 1:20 pm
Contact:

Re: Property request: force.pollution_production_statistics

Post by zOldBulldog »

Bilka wrote:
Mon May 13, 2019 11:02 am
zOldBulldog wrote: (THIS might be the only piece missing - the ability to measure the pollution reaching a nest because the cloud touched it - and to cause evolution due to it)
Okay, that is solved with the pollution statistics access in LuaGameScript. You can read the pollution consumption by biter nests from it which is exactly what you describe. I will move this thread to "already exists" for now, but please do let me know if something requested here does not exist.
Excellent. If all the pieces exist then I am going to make a post in the Mod Requests/Ideas subforum, giving this thread as a reference for the details as to how to achieve it.

Qon
Smart Inserter
Smart Inserter
Posts: 2091
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: Property request: force.pollution_production_statistics

Post by Qon »

Bilka wrote:
Mon May 13, 2019 10:28 am
I split your posts off from the FFF thread to make things a bit easier and copied the title from the "title it" quote in one of the posts.

Your posts are a bit confusing, what exactly is still missing? Is it what I put in the title? Because that already exists: https://lua-api.factorio.com/latest/Lua ... statistics
I had assumed it would be in force. But the game doesn't differentiate between my pollution and pollution from other forces I guess. That makes sense. I searched LuaSurface and some other places for that pollution stat but couldn't find it. Apparently I missed searching LuaGameScript, doh!
zOldBulldog wrote:
Mon May 13, 2019 11:04 am
Excellent. If all the pieces exist then I am going to make a post in the Mod Requests/Ideas subforum, giving this thread as a reference for the details as to how to achieve it.
Yes, everything needed exists.

zOldBulldog
Smart Inserter
Smart Inserter
Posts: 1161
Joined: Sat Mar 17, 2018 1:20 pm
Contact:

Re: Property request: force.pollution_production_statistics

Post by zOldBulldog »

The mod request has been created in the (I hope) correct forum: viewtopic.php?f=88&t=70786

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Property request: force.pollution_production_statistics

Post by darkfrei »

disabling parts of evolution in control.lua:

Code: Select all

    game.map_settings.enemy_evolution.time_factor = 0
    game.map_settings.enemy_evolution.destroy_factor = 0 
    game.map_settings.enemy_evolution.pollution_factor = 0
Must be here
LuaGameScript.html#LuaGameScript.map_settings
Concepts.html#MapSettings
but it was not added

Bilka
Factorio Staff
Factorio Staff
Posts: 3123
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Property request: force.pollution_production_statistics

Post by Bilka »

What? You can disable the different parts of evo, your code is just broken if the above doesn't work. Please dont post unrelated stuff in this topic.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Property request: force.pollution_production_statistics

Post by darkfrei »

Bilka wrote:
Wed Jun 12, 2019 8:20 am
What? You can disable the different parts of evo, your code is just broken. Please dont post unrelated stuff in this topic.
Sorry.
The main question of the topic was "(how to) Allow controlling/enabling evolution due to pollution reaching a nest." Is it somewhere documented? I cannot find any information about it, please help.

Bilka
Factorio Staff
Factorio Staff
Posts: 3123
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Property request: force.pollution_production_statistics

Post by Bilka »

darkfrei wrote:
Wed Jun 12, 2019 10:17 am
The main question of the topic was "(how to) Allow controlling/enabling evolution due to pollution reaching a nest." Is it somewhere documented? I cannot find any information about it, please help.
That's basically asking to program a mod. Luckily for you there is a mod that does that already: https://mods.factorio.com/mod/NextGenEvolution
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Property request: force.pollution_production_statistics

Post by darkfrei »

Bilka wrote:
Wed Jun 12, 2019 12:28 pm
darkfrei wrote:
Wed Jun 12, 2019 10:17 am
The main question of the topic was "(how to) Allow controlling/enabling evolution due to pollution reaching a nest." Is it somewhere documented? I cannot find any information about it, please help.
That's basically asking to program a mod. Luckily for you there is a mod that does that already: https://mods.factorio.com/mod/NextGenEvolution
Nice mod, he is just overwrite evolution factor every minute.

For example by the data stage I have this definition:

Code: Select all

data.raw["map-settings"]["map-settings"].enemy_evolution = 
  {
    enabled = true,
    time_factor = 0,
    destroy_factor = 0,
    pollution_factor = 0
  }
1. How can I overwrite this values in the control stage?

2. Where on the lua-api.factorio.com/latest/ I can find information about it?

Post Reply

Return to “Already exists”