Custom Terrain Generation


Changes how land and water are generated. Highly customizable.

4 months ago
0.16 - 1.1
994
Environment

b Fish in the water

5 years ago

Could you fix having fish in the water please? (Including Angel's fish)

Angels Bio kinda likes having the fish be there.

5 years ago

Can you explain what is wrong? What happens when using this mod, and what is supposed to happen? A screenshot may be helpful. I have not used Angels (or at least, the fish aspect of it) so if it is specific to that you may have to explain how Angels fish are different from vanilla fish.

5 years ago

It's not anything specific to Angels fish other than that it adds more (different) fish types, and it's easy to grab the entity fish, instead of the category fish.

What's happening is there are barely any fish in the water (as in I have seen a grand total of 2 (I've looked through at least 50 pure-water chunks, and that's 2 total)), when I expect a normal quantity of fish in the water (5-10 per 10x10 pond area). If I'm not clear I can get you some screenshots and stuff.

I think what's actually happening is that there are only fish where the underlying terrain-gen puts water and this puts water, so I could possibly get more fish by setting the mapgen to a waterworld (but that will make resource patches rare, so just moves the problem).

I fixed this for Ribbon Maze by simply spawning in more fish manually when water was called for, I'm happy to hand you the "find fish list" and "spawn fish" code if you want to do it that way.

5 years ago

I see, I am surprised that Factorio spawns fish on chunk generation, and not during play like when biters are spawned. (So does that imply fish are a non-renewable resource?) I'll have to look into it later, but I would appreciate a link to the code you mentioned in case that turns out to be the best solution. Thanks for bringing this to my attention.

4 years ago
(updated 4 years ago)

It's buried in Ribbon Maze, but it's an MIT license, so here are the relevant bits:

==== this goes somewhere in config-initialisation ====
local fish = {}
for name,prototype in pairs(game.entity_prototypes) do
if prototype.type=="fish" then
table.insert(fish, name)
end
end
==== Ribbon Maze then saves "fish" as "config.fishList" ====

==== this generates fish ====
local function generateFish(config, surface, chunkPosition, rng)
if rng then
for i = 0, config.fishPerChunk do
local fishName = config.fishList[Cmwc.randRange(rng, 1, #(config.fishList))]
local tileX = chunkPosition.x + Cmwc.randRange(rng, 1, 31)
local tileY = chunkPosition.y + Cmwc.randRange(rng, 1, 31)
surface.create_entity{name=fishName, position={tileX,tileY}}
end
end
end
==== Ribbon Maze is chunk-aligned, so you may want to do things differently ====


Edit:

And of course it loses all the formatting <grumble>

4 years ago

Thanks.

New response