Hello,
I would like the ability to prevent chunk generation by pollution in certain situations. An event with the chunk position passed where I can return false if necessary would be more than enough.
The current use is to prevent pollution spreading too far from the player base and waking up/generating more chunks than some PCs can handle.
edit to clarify: There currently is an on_chunk_generated event, but it doesn't know the cause and cannot prevent the generation. Thus the necessity of a different event, or additional arguments to the existing event. Perhaps this suggestion should use the "pre" keyword?
on_chunk_generated_by_pollution event
Re: on_chunk_generated_by_pollution event
Won't the chunk instantly respawn if the chunk next it remains polluted?
Re: on_chunk_generated_by_pollution event
Aside from the fact that it would fire constantly, events cannot prevent things from happening. When you get the event, the chunk has already been generated and the best you can do is immediately destroy it again, but as Dave pointed out it'll just regenerate over and over.
Re: on_chunk_generated_by_pollution event
Those are both good points. I guess my issue is, there's no way to prevent pollution from constantly generating more terrain. One could up dissipation rate, but the effect I'm looking for would be closer to truncating how far it can spread instead of just making it dissipate faster.PFQNiet wrote: Wed Jul 21, 2021 9:16 am Aside from the fact that it would fire constantly, events cannot prevent things from happening. When you get the event, the chunk has already been generated and the best you can do is immediately destroy it again, but as Dave pointed out it'll just regenerate over and over.
Re: on_chunk_generated_by_pollution event
Only thing I can think of like that would maybe be to limit the map size via MapGenSettings (width/height) via script and expand it as the player explores/builds out further from the spawn point (up to whatever original limit they set in new game settings). Don't know how well it'd work in practice. Pollution can't cause map gen outside the maps boundaries, but I don't know how well upping the size mid game works - if it'd immediately start generating the chunks needed or what.
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: on_chunk_generated_by_pollution event
[Edit: Oops, interface request not modding help. Welp, having a "reason" in on_chunk_generated wouldn't hurt I guess.]
____
____
Very vague memories say that map size just generates out-of-map tiles instead of land, but doesn't actually stop generating chunks, or pollution spreading. Albeit the generated chunks would be smaller on disk due to not having any actual content. Did that change over the years?Silari wrote: Wed Jul 21, 2021 5:54 pm Only thing I can think of like that would maybe be to limit the map size via MapGenSettings (width/height)
Make an invisible entity that absorbs 10 trillion pollution per tick. Spawn a "ring" of those around the player base, use on_chunk_charted to expand the ring. That would prevent pollution from generating more chunks. But in my experience oversized radars are much worse at generating useless chunks.lyvgbfh wrote: Wed Jul 21, 2021 11:42 am good points. I guess my issue is, there's no way to prevent pollution from constantly generating more terrain. One could up dissipation rate, but the effect I'm looking for would be closer to truncating how far it can spread instead of just making it dissipate faster.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: on_chunk_generated_by_pollution event
I would not have expected that behavior, but from testing it looks like there is a single chunk thick ring around the map (presumably filled with the 'out-of-map'tiles), but beyond which chunks aren't generated and thus pollution can not travel, so it could still work for OPs purpose. You'd just have to make sure to delete the 'void' chunks when expanding the map, and you'd probably want to remove the pollution absorption from the out-of-map prototype - seems to be set to 10, double that of water.Very vague memories say that map size just generates out-of-map tiles instead of land, but doesn't actually stop generating chunks, or pollution spreading. Albeit the generated chunks would be smaller on disk due to not having any actual content. Did that change over the years?
Still pretty hacky, but doable. And pollution would still exist and have to be dealt with eventually - no disappearing from the edges of the map.
- Attachments
-
- Pollution only spreads 1 chunk beyond generated land
- pollution.png (4.74 KiB) Viewed 2588 times
Re: on_chunk_generated_by_pollution event
Your image lacks debug pollution values so you can't conclude anything from that screenshot. There could be unrendered pollution spreading further...Silari wrote: Thu Jul 22, 2021 1:03 am I would not have expected that behavior, but from testing it looks like there is a single chunk thick ring around the map (presumably filled with the 'out-of-map'tiles), but beyond which chunks aren't generated and thus pollution can not travel, so it could still work for OPs purpose.
My mods: Capsule Ammo | HandyHands - Automatic handcrafting | ChunkyChunks - Configurable Gridlines
Some other creations: Combinassembly Language GitHub w instructions and link to run it in your browser | 0~drain Laser
Some other creations: Combinassembly Language GitHub w instructions and link to run it in your browser | 0~drain Laser
Re: on_chunk_generated_by_pollution event
On giving it some thought, the map size solution isn't ideal -- it would require special care so radars could still reveal sectors. Same with say, blind firing artillery.
Re: on_chunk_generated_by_pollution event
Wasn't aware of any situation where pollution wouldn't be rendered on the map if the option was on - I would expect it to show all chunks with pollution. Pollution values don't go off the edge of the map when enabled either. Show Polluted Chunks DOES. Really doesn't make sense since those chunks aren't generated at all per is_chunk_generated, but perhaps the API just lies about chunks beyond the map border.Qon wrote: Thu Jul 22, 2021 12:40 pmYour image lacks debug pollution values so you can't conclude anything from that screenshot. There could be unrendered pollution spreading further...Silari wrote: Thu Jul 22, 2021 1:03 am I would not have expected that behavior, but from testing it looks like there is a single chunk thick ring around the map (presumably filled with the 'out-of-map'tiles), but beyond which chunks aren't generated and thus pollution can not travel, so it could still work for OPs purpose.
Which just leaves deleting pollution from the edges of the map (via script or entity) or lowering/turning off pollution diffusion as possible fixes, both of which means you're getting much fewer biter attacks than you should.