diff --git a/server/game/natural_spawner.ts b/server/game/natural_spawner.ts index d12a452..4505b0e 100644 --- a/server/game/natural_spawner.ts +++ b/server/game/natural_spawner.ts @@ -3,7 +3,6 @@ // SpawnJson), the way undergarden's biomes list its rotspawn import { CHUNK_SIZE } from "$/common/constants.ts"; import type { SpawnJson } from "$/common/mod_data.ts"; -import { daylight } from "$/common/time.ts"; import { chunk_key } from "$/common/utils.ts"; import type { EntityManager } from "./entity/entity_manager.ts"; import { create_entity } from "./entity/entity_types.ts"; @@ -26,10 +25,6 @@ const GROUP_SPOTS = 4; const CLUSTER_SIZE = 4; // how far each spot in a group is from the one before, at most, in x and in z const WANDER = 6; -// how much darker the sky is at midnight, minecraft's skyDarken -const NIGHT_DARKEN = 11; -// the light monsters spawn in is at most a random level up to this, and there's no block light at all -const MONSTER_LIGHT = 7; // how far light comes from, see ServerWorld.light_at const LIGHT_REACH = 15; @@ -150,14 +145,10 @@ export class NaturalSpawner { return spawned; } - // like minecraft's Monster.isDarkEnoughToSpawn: less likely the more sky light, never with block light, and - // darker than a random level. the sky's light counts for less at night + // underground only: no sky light reaches it, so never on the surface even at night, and no block light either #dark_enough(world: ServerWorld, x: number, y: number, z: number) { const { sky, block } = world.light_at(x, y, z); - if (sky > this.#int(32)) return false; - if (block > 0) return false; - const darken = Math.floor((1 - daylight(world.time)) * NIGHT_DARKEN); - return Math.max(sky - darken, block) <= this.#int(MONSTER_LIGHT + 1); + return sky === 0 && block === 0; } // by weight, from the spawns of the biome