surface.set_tiles() and ungenerated chunks?
-
- Filter Inserter
- Posts: 530
- Joined: Mon Feb 05, 2018 10:01 am
- Contact:
surface.set_tiles() and ungenerated chunks?
Can anyone confirm the behaviour of using surface.set_tiles() to set tiles in chunks that aren't generated yet?
Re: surface.set_tiles() and ungenerated chunks?
It will work, no problem there
They will be overwritten by map generation, unless you also set chunk generated status:
https://lua-api.factorio.com/latest/Lua ... ted_status
They will be overwritten by map generation, unless you also set chunk generated status:
https://lua-api.factorio.com/latest/Lua ... ted_status
-
- Filter Inserter
- Posts: 530
- Joined: Mon Feb 05, 2018 10:01 am
- Contact:
Re: surface.set_tiles() and ungenerated chunks?
Cheers.
Follow-up question:
Is there an easy way to set a default tile? I'm having trouble navigating the docs about autoplace settings.
Follow-up question:
Is there an easy way to set a default tile? I'm having trouble navigating the docs about autoplace settings.
Re: surface.set_tiles() and ungenerated chunks?
The main default tile is "not-on-map", if I can right understand what you call "default tile".
-
- Filter Inserter
- Posts: 530
- Joined: Mon Feb 05, 2018 10:01 am
- Contact:
Re: surface.set_tiles() and ungenerated chunks?
What I mean is if you remove all autoplace settings, the map is filled with "grass-1".
I'd like to know if there's an easy way to change that to "deepwater" without using OnChunkGenerated(), because the autoplace documentation is really unclear, and I can't undertand how to do something that simple with it.
I'd like to know if there's an easy way to change that to "deepwater" without using OnChunkGenerated(), because the autoplace documentation is really unclear, and I can't undertand how to do something that simple with it.
- Deadlock989
- Smart Inserter
- Posts: 2529
- Joined: Fri Nov 06, 2015 7:41 pm
Re: surface.set_tiles() and ungenerated chunks?
For a surface filled with a specific ground tile you can remove all autoplace settings and then set the probability of the desired tile super-high and the probability of every other tile (loop through them) super-low using map_gen_settings.property_expression_names.Illiander42 wrote: Wed Oct 28, 2020 10:21 am What I mean is if you remove all autoplace settings, the map is filled with "grass-1".
I'd like to know if there's an easy way to change that to "deepwater" without using OnChunkGenerated(), because the autoplace documentation is really unclear, and I can't undertand how to do something that simple with it.
For water tiles I'm less certain. Those are tied to elevation and are treated differently in the starting area. You might have success just fiddling with the "water" property of the settings. If not then I suspect you would probably have to open the Pandora's box of NamedNoiseExpression and create a new expression that produces zero or negative elevation ( = water) everywhere.
Yes, this stuff is brain-curdling.
Re: surface.set_tiles() and ungenerated chunks?
Illiander42 wrote: Wed Oct 28, 2020 7:17 am Is there an easy way to set a default tile? I'm having trouble navigating the docs about autoplace settings.
/c game.create_surface("test", {property_expression_names = {["tile:deepwater:probability"] = 100}})Illiander42 wrote: Wed Oct 28, 2020 10:21 am What I mean is if you remove all autoplace settings, the map is filled with "grass-1".
I'd like to know if there's an easy way to change that to "deepwater" without using OnChunkGenerated(), because the autoplace documentation is really unclear, and I can't undertand how to do something that simple with it.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
-
- Filter Inserter
- Posts: 530
- Joined: Mon Feb 05, 2018 10:01 am
- Contact:
Re: surface.set_tiles() and ungenerated chunks?
So I looked a bit more into that, and found some notes that imply that this code should do what I want:
But it's not doing what I expect it to do.
---
(And is there a better place to run this than in on_tick()?)
Code: Select all
local surface = game.get_surface("nauvis")
local mgs = surface.map_gen_settings
mgs.property_expression_names = {["tile:deepwater:probability"] = 100}
surface.map_gen_settings = mgs
---
(And is there a better place to run this than in on_tick()?)