-
-
Notifications
You must be signed in to change notification settings - Fork 218
Add cave layers #2826
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add cave layers #2826
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| .{ | ||
| .isCave = true, | ||
| .tags = .{.cave_layer}, | ||
| .maxHeight = -512, | ||
| .minHeight = -48250, | ||
|
|
||
| .fogDensity = 2, | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,5 @@ | ||
| .{ | ||
| .maxHeight = -200, | ||
| .minHeight = -48250, | ||
| .chance = 0.05, | ||
| .structures = .{ | ||
| .{ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,4 @@ | ||
| .{ | ||
| .maxHeight = -64, | ||
| .minHeight = -1000, | ||
| .chance = 0.3, | ||
| .structures = .{ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| .{ | ||
| .isCave = true, | ||
| .tags = .{.cave_layer}, | ||
| .fogDensity = 8, | ||
| .fogColor = 0x3b5c8c, | ||
| .chance = 0.01, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| .{ | ||
| .tags = .{.sky_island_fog_layer}, | ||
| .chance = 10, | ||
| .minHeight = 7000, | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| .{ | ||
| .tags = .{.cave_layer}, | ||
| .layerHeight = 48250, | ||
| .depthHint = -1, | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| .{ | ||
| .tags = .{.dropoff_layer}, | ||
| .layerHeight = 250, | ||
| .depthHint = -48250, | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| .{ | ||
| .tags = .{.sky_layer}, | ||
| .layerHeight = 7000, | ||
| .depthHint = 0, | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| .{ | ||
| .tags = .{.sky_island_fog_layer}, | ||
| .layerHeight = 3000, | ||
| .depthHint = 7000, | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| .{ | ||
| .tags = .{.sky_island_layer}, | ||
| .layerHeight = 10000, | ||
| .depthHint = 10000, | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| .{ | ||
| .tags = .{.void_layer}, | ||
| .layerHeight = 1500, | ||
| .depthHint = -48500, | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| .{ | ||
| .tags = .{.root_layer}, | ||
| .layerHeight = 10000, | ||
| .depthHint = -50000, | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -298,6 +298,13 @@ pub const Biome = struct { // MARK: Biome | |
| .maxSubBiomeCount = zon.get(f32, "maxSubBiomeCount", std.math.floatMax(f32)), | ||
| .tags = Tag.loadTagsFromZon(main.worldArena, zon.getChild("tags")), | ||
| }; | ||
| if (self.isCave) { | ||
| for (self.tags) |tag| { | ||
| if (std.mem.endsWith(u8, tag.getName(), "_layer")) break; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, but do we reserve a
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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. |
||
| } else { | ||
| std.log.err("Cave biome {s} is missing a '_layer' tag to assign it to a cave layer.", .{id}); | ||
| } | ||
| } | ||
| if (minRadius > maxRadius) { | ||
| std.log.err("Biome {s} has invalid radius range ({d}, {d})", .{self.id, minRadius, maxRadius}); | ||
| } | ||
|
|
@@ -382,7 +389,7 @@ pub const Biome = struct { // MARK: Biome | |
| return hashGeneric(self.*); | ||
| } | ||
|
|
||
| fn hasTag(self: Biome, tag: Tag) bool { | ||
| pub fn hasTag(self: Biome, tag: Tag) bool { | ||
| return std.mem.containsAtLeastScalar(Tag, self.tags, 1, tag); | ||
| } | ||
| }; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I were to, by mistake, leave
.tagsempty, it would be nice to get an error.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, for that I would say to provide an extra tag
.no_cave_layer_requiredor 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.