Add cave layers#2826
Conversation
|
im not sure i understand could you give a bit more detail on how it works? |
|
DepthHint may not be the best name for the variable |
|
also what happens when layers overlap? |
I wanted to emphasize that it's a hint and does not necessarily reflect the actual height
That can't happen. One of them will be placed first, and the other one will be placed after the first one's layerHeight |
|
Ooooh hell yes this is sick. Can layers overlap, or is that not allowed? |
| .{ | ||
| .isCave = true, | ||
| .minHeight = 10000, | ||
| .tags = .{.sky_island_layer}, |
There was a problem hiding this comment.
If I were to, by mistake, leave .tags empty, it would be nice to get an error.
There was a problem hiding this comment.
Or rather, if I were to not assign a biome to any layer, that might happen even if there are tags
There was a problem hiding this comment.
I think there are valid use-cases for having biomes that are not assigned to any layer. An addon may want to add biomes to layers introduced by other addons, while still allowing you to use it standalone.
There was a problem hiding this comment.
Well, for that I would say to provide an extra tag .no_cave_layer_required or alike, so we make sure this is not done by mistake.
Btw I assume that biomes which are not part of a cave layer do not generate, right?
There was a problem hiding this comment.
Either way good catch. I actually did miss some biomes.
I decided to require cave layers to end with _layer, this makes it easy to detect mistakes even when non-layer tags are present.
…his allows adding an error to detect if a biome is missing them.
| }; | ||
| if (self.isCave) { | ||
| for (self.tags) |tag| { | ||
| if (std.mem.endsWith(u8, tag.getName(), "_layer")) break; |
There was a problem hiding this comment.
Okay, but do we reserve a no_layer or similar tag for marking the biomes explicitly unassigned?
There was a problem hiding this comment.
No, There is currently no reason to have an unassigned cave biome, since it wouldn't spawn under any circumstances. If you want to temporarily disable a biome you can also set the chance to 0.
This moves (most) height restrictions of biomes to layers instead. Biomes are now assigned to layers using tags. This allows having multiple distinct layers of caves broken up by other biomes (→#2464 #1463).
Furthermore this will make cave layers more addon friendly. e.g. an addon could add their own layer between e.g. the caves and the root. The engine would then automatically shift down the layers below by the size of the new layer.
Note: The depth hint only decides the order of the layers and is not representative of the actual depth. The actual depth is computed using the layer heights of all layers above it (or below for sky layers).
Root and sky layers are currently set to 10000 to allow addons to place other things above/below it. However as long as no such layers exist, the root/sky will continue until the integer limit.
To @ikabod-kee and @careeoki I'll put this in requires artistic review for you to look at the new way to specify cave biome height and the new layers.