Improve crops system

This commit is contained in:
2026-09-26 18:32:38 -03:00
parent e22f12c0b6
commit 0fa6ec4ed3
15 changed files with 394 additions and 31 deletions
+6
View File
@@ -4,6 +4,7 @@ import { generate_raw_chunk, RawChunk, WorldgenSetup } from "$/common/generation
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 { CYCLE_TICKS } from "$/common/time.ts";
// generation only, rebuilt when needed. 256 KB each
const RAW_CACHE_SIZE = 128;
@@ -44,6 +45,11 @@ 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
get day() {
return Math.floor(this.time / CYCLE_TICKS);
}
// set when anything that gets saved changes
dirty = false;