Remove collision from water
This commit is contained in:
@@ -829,7 +829,7 @@ export class GameServer {
|
||||
if (this.#entities.size === 0) {
|
||||
return;
|
||||
}
|
||||
const is_solid = (x: number, y: number, z: number) => this.world.get_block_nid(x, y, z) !== AIR;
|
||||
const is_solid = (x: number, y: number, z: number) => this.world.has_collision(x, y, z);
|
||||
|
||||
const active = [...this.#entities.values()].filter((entity) => this.#near_any_player(entity.x, entity.z));
|
||||
for (const entity of active) {
|
||||
|
||||
@@ -113,6 +113,11 @@ export class ServerWorld {
|
||||
return this.#get_chunk(chunk_x, chunk_z)[index_in_chunk(x, y, z, chunk_x, chunk_z)];
|
||||
}
|
||||
|
||||
// whether entities bump into the block there, water and other blocks with "collision": false don't
|
||||
has_collision(x: number, y: number, z: number) {
|
||||
return this.get_block_info(x, y, z)?.has_collision ?? false;
|
||||
}
|
||||
|
||||
get_block_info(x: number, y: number, z: number): BlockRegistry | undefined {
|
||||
const nid = this.get_block_nid(x, y, z);
|
||||
return nid === AIR ? undefined : EverythingRegistry.get_by_id<BlockRegistry>("blocks", nid);
|
||||
|
||||
Reference in New Issue
Block a user