Seasons based on a calendar

This commit is contained in:
2026-10-09 22:09:21 -03:00
parent 4d5700f0bf
commit 7fe9c15b67
12 changed files with 88 additions and 33 deletions
+3 -3
View File
@@ -10,7 +10,7 @@ import { AIR_ID, BlockChange } from "$/common/protocol.ts";
import { block_value, chunk_key, default_block_value } from "$/common/utils.ts";
import { LruMap } from "./lru.ts";
import { collision_shape_at, EMPTY_SHAPE, type Shape } from "$/common/block_shapes.ts";
import { CYCLE_TICKS } from "$/common/time.ts";
import { farming_day } from "$/common/time.ts";
import { encode_level_chunk } from "$/common/chunk_streaming.ts";
import type { ItemData } from "$/common/inventory.ts";
import { CHUNK_VOLUME, ChunkBlocks, decode_chunk, encode_chunk, is_changed, SavedChunk } from "./saves.ts";
@@ -74,9 +74,9 @@ export class ServerWorld {
// ticks since 06:00 of day 1, see common/time.ts
time = 0;
// days since the world started, going up at 06:00. the farming day, unlike the clock's day that starts at midnight
// days since the world started, see farming_day in common/time.ts
get day() {
return Math.floor(this.time / CYCLE_TICKS);
return farming_day(this.time);
}
// set when anything that gets saved changes