Page 1 of 1
Map Generation - Is this possible?
Posted: Mon Apr 04, 2016 12:59 pm
by Targa
Hi all. I have particular tastes when it comes to the biomes. I only like playing in the green biome with lush, green trees. I dislike the desert, the brown grass, the biome with weird-looking red trees, the one with brown reeds growing everywhere, etc... Is there any file I can modify so that when I generate a map it's always only one particular biome? Thanks in advance!
Re: Map Generation - Is this possible?
Posted: Mon Apr 04, 2016 1:20 pm
by prg
Try this in a data-updates.lua:
Code: Select all
for _, name in pairs({"dirt", "dirt-dark", "sand", "sand-dark", "grass-dry"}) do
data.raw.tile[name] = nil
end
Re: Map Generation - Is this possible?
Posted: Mon Apr 04, 2016 2:22 pm
by Targa
That appears to give me green grass all the time, but doesn't change the biome itself. I still get the "lots of dead trees" biome, "weird twisty trees with red leaves" biome, etc... So basically left each biome vanilla, but changed the ground covering to green grass.
Re: Map Generation - Is this possible?
Posted: Mon Apr 04, 2016 2:44 pm
by prg
Try adding
Code: Select all
data.raw.decorative = nil
for _, tree in pairs(data.raw.tree) do
for _, badword in pairs({"dead", "dry", "red", "brown", "tree%-03", "tree%-07"}) do
if string.match(tree.name, badword) then
data.raw.tree[tree.name] = nil
end
end
end
Re: Map Generation - Is this possible?
Posted: Tue Apr 05, 2016 2:38 pm
by Targa
Unfortunately all that does is delete everything, so I end up with an empty map. I was wondering if there was a way to control which biome the map generator produces.
On a side note, I like the code for being able to delete objects! I can't figure out the correct command for "stone-rock" though. If anyone knows it, please post it. "stone-rock" (the rocks you have to shoot) is in \prototypes\entity\demo-doodads.lua.
Code: Select all
type = "simple-entity",
name = "stone-rock",
Re: Map Generation - Is this possible?
Posted: Tue Apr 05, 2016 4:07 pm
by prg
This shouldn't remove everything, just all the decorations and a lot of types of trees so there might not be any in your starting area. If you want to keep some of the decorations, go through data/base/prototypes/entity/demo-doodads.lua to find the ones you don't like and only remove those instead of setting data.raw.decorative = nil. You could fiddle with the tree's autoplace settings to make the green ones spawn more often, but figuring out how that works would require some effort. So just regenerate the map till you're next to some trees. Don't have a better idea how to do this, sorry.
As for the stone-rock, you remove that with data.raw[type][name] like the other entities:
Code: Select all
data.raw["simple-entity"]["stone-rock"] = nil
Re: Map Generation - Is this possible?
Posted: Tue Apr 05, 2016 7:26 pm
by Targa
Code: Select all
data.raw["simple-entity"]["stone-rock"] = nil
I figured that one out after your previous instructions, but when I tried it in a mod I got something like "Error: Attempt to index "simple-entity" nil" or something along those lines. I must have made a typo in the mod, because copy/pasting your code works. Thanks a million for that, I hate rocks!
As for my original question. I found this in data\prototypes\entity\demo-trees.lua:
Code: Select all
local biomes = autoplace_utils.biomes
From that snippet, I was hoping there was some file that contained the literal biomes (desert, grassland, temperate, etc) that could easily be manipulated. In the end it appears that "biomes" is referring to something in the game engine that can't be accessed by end-users.
With all the previous info given here, I will eventually be able to modify the game's starting maps to my liking. I think I may take your advice and mod demo-trees.lua's placement probabilities to prevent ugly trees from being spawned. Thanks again for all the help!
Re: Map Generation - Is this possible?
Posted: Tue Apr 05, 2016 7:48 pm
by prg
There's no mention of biomes in autoplace_utils.lua (or anywhere else in all of data/) and the biomes variable isn't actually used anywhere in demo-trees.lua. I have no idea what that line is supposed to accomplish. I almost think it simply does nothing.