Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,12 @@ fn addModFeatures(b: *std.Build, exe: *std.Build.Step.Compile) !void {
exe.step.dependOn(step);

try addModFeatureModule(b, exe, "rotation");
try addModFeatureModule(b, exe, "simple_structures");
}

pub fn makeModFeaturesStep(step: *std.Build.Step, _: std.Build.Step.MakeOptions) anyerror!void {
try makeModFeature(step, "rotation");
try makeModFeature(step, "simple_structures");
}

fn createLaunchConfig() !void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ const Vec3f = vec.Vec3f;
const Vec3i = vec.Vec3i;
const NeverFailingAllocator = main.heap.NeverFailingAllocator;

pub const id = "cubyz:boulder";

pub const generationMode = .floor;

const Boulder = @This();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ const Vec3f = vec.Vec3f;
const Vec3i = vec.Vec3i;
const NeverFailingAllocator = main.heap.NeverFailingAllocator;

pub const id = "cubyz:fallen_tree";

pub const generationMode = .floor;

const FallenTree = @This();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ const Vec3f = vec.Vec3f;
const Vec3i = vec.Vec3i;
const NeverFailingAllocator = main.heap.NeverFailingAllocator;

pub const id = "cubyz:flower_patch";

pub const generationMode = .floor;

const FlowerPatch = @This();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ const Vec3f = vec.Vec3f;
const Vec3i = vec.Vec3i;
const NeverFailingAllocator = main.heap.NeverFailingAllocator;

pub const id = "cubyz:ground_patch";

pub const generationMode = .floor;

const GroundPatch = @This();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const Neighbor = main.chunk.Neighbor;
const ServerChunk = main.chunk.ServerChunk;
const NeverFailingAllocator = main.heap.NeverFailingAllocator;

pub const id = "cubyz:sbb";
pub const generationMode = .floor;

const SbbGen = @This();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ const Vec3f = vec.Vec3f;
const Vec3i = vec.Vec3i;
const NeverFailingAllocator = main.heap.NeverFailingAllocator;

pub const id = "cubyz:simple_tree";

const SimpleTreeModel = @This();

pub const generationMode = .floor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ const Vec3f = vec.Vec3f;
const Vec3i = vec.Vec3i;
const NeverFailingAllocator = main.heap.NeverFailingAllocator;

pub const id = "cubyz:simple_vegetation";

pub const generationMode = .floor;

const SimpleVegetation = @This();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ const Vec3f = vec.Vec3f;
const Vec3i = vec.Vec3i;
const NeverFailingAllocator = main.heap.NeverFailingAllocator;

pub const id = "cubyz:stalagmite";

pub const generationMode = .floor_and_ceiling;

const Stalagmite = @This();
Expand Down
8 changes: 4 additions & 4 deletions src/server/terrain/biomes.zig
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pub const SimpleStructureModel = struct { // MARK: SimpleStructureModel

var modelRegistry: std.StringHashMapUnmanaged(VTable) = .{};

pub fn registerGenerator(comptime Generator: type) void {
pub fn registerGenerator(comptime Generator: type, comptime generatorName: []const u8) void {
var self: VTable = undefined;
self.loadModel = main.utils.castFunctionReturnToAnyopaque(Generator.loadModel);
self.generate = main.utils.castFunctionSelfToAnyopaque(Generator.generate);
Expand All @@ -63,7 +63,7 @@ pub const SimpleStructureModel = struct { // MARK: SimpleStructureModel
}
}.hash);
self.generationMode = Generator.generationMode;
modelRegistry.put(main.globalArena.allocator, Generator.id, self) catch unreachable;
modelRegistry.put(main.globalArena.allocator, generatorName, self) catch unreachable;
}

fn getHash(self: SimpleStructureModel) u64 {
Expand Down Expand Up @@ -623,9 +623,9 @@ const TransitionBiome = struct {
var unfinishedTransitionBiomes: std.StringHashMapUnmanaged([]UnfinishedTransitionBiomeData) = .{};

pub fn init() void {
const list = @import("simple_structures/_list.zig");
const list = @import("simple_structures");
inline for(@typeInfo(list).@"struct".decls) |decl| {
SimpleStructureModel.registerGenerator(@field(list, decl.name));
SimpleStructureModel.registerGenerator(@field(list, decl.name), decl.name);
}
}

Expand Down
8 changes: 0 additions & 8 deletions src/server/terrain/simple_structures/_list.zig

This file was deleted.