Seasons based on a calendar
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
// blocks, entities, players and the world tell scripts their biome's season, see docs/modding/worldgen/biomes.md
|
||||
import { assertEquals } from "@std/assert";
|
||||
import type { ServerContext } from "$/common/mod_api/server.ts";
|
||||
import { get_biome } from "$/common/worldgen/biomes.ts";
|
||||
import { copy_dir, test_game } from "./helpers.ts";
|
||||
|
||||
const SCRIPT = `
|
||||
@@ -16,7 +17,7 @@ export function setup(ctx: ServerContext) {
|
||||
}
|
||||
`;
|
||||
|
||||
// bworld's biomes, with every one but the oceans in winter. oceans keep spring by leaving it out
|
||||
// bworld's biomes, with every one but the oceans in winter. oceans follow the calendar, spring on day 1
|
||||
function season_mods() {
|
||||
const dir = Deno.makeTempDirSync({ prefix: "bworld_seasons_" });
|
||||
copy_dir("mods/bworld", `${dir}/bworld`);
|
||||
@@ -64,7 +65,8 @@ Deno.test("blocks, entities, players and the world know their biome's season", a
|
||||
const { ctx, created } = (globalThis as unknown as {
|
||||
season_test: { ctx: ServerContext; created: { biome: string; season: string }[] };
|
||||
}).season_test;
|
||||
const season_of = (biome: string) => biome.includes("ocean") ? "spring" : "winter";
|
||||
// it's day 1, so oceans without their own season are in spring
|
||||
const season_of = (biome: string) => get_biome(biome)?.season ?? "spring";
|
||||
|
||||
// spawn is on dry land
|
||||
const biome = ctx.world.biome_at(0, 0);
|
||||
|
||||
Reference in New Issue
Block a user