Jester stomp sounds, not step !

This commit is contained in:
2026-11-22 11:08:36 -03:00
parent 8add5f852e
commit dfb110e0f8
11 changed files with 50 additions and 12 deletions
+5 -4
View File
@@ -91,9 +91,9 @@ export abstract class Entity {
this.walk_position += this.walk_speed;
}
// after moving each tick: a step every STEP_DISTANCE it walks with a block under its feet, own when it has its own
// step sound (see ENTITY_SOUNDS), the block's otherwise
play_steps(own: string | undefined) {
// after moving each tick: a step every STEP_DISTANCE it walks with a block under its feet, what own gives when it
// has its own step sound (see ENTITY_SOUNDS), the block's otherwise
play_steps(own?: () => string | undefined) {
const [x, y, z] = [Math.floor(this.x), Math.floor(this.y - 0.2), Math.floor(this.z)];
const nid = this.level.get_block(x, y, z);
const below = nid === AIR ? undefined : EverythingRegistry.get_by_id<BlockRegistry>("blocks", nid);
@@ -102,7 +102,8 @@ export abstract class Entity {
if (this.#walked < STEP_DISTANCE) return;
this.#walked %= STEP_DISTANCE;
const at = { x: this.x, y: this.y, z: this.z };
if (own) sounds.play(own, { at });
const sound = own?.();
if (sound) sounds.play(sound, { at });
else sounds.play_of(below.sounds, "step", { at, volume: BLOCK_STEP_VOLUME });
}