Skip to content

Commit

Permalink
Merge pull request #26 from TheNexusCity/footsteps-vehicle-metabot-25
Browse files Browse the repository at this point in the history
Disable Footsteps sound while on vehicle #25
  • Loading branch information
lalalune committed Apr 18, 2022
2 parents 7239341 + 3236db4 commit 40dbea0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
6 changes: 4 additions & 2 deletions character-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -1091,8 +1091,10 @@ class LocalPlayer extends UninterpolatedPlayer {
updateAvatar(timestamp, timeDiff) {
if (this.avatar) {
const timeDiffS = timeDiff / 1000;
this.characterSfx?.update(timestamp, timeDiffS);
this.characterFx?.update(timestamp, timeDiffS);

const actions = this.getActionsState()
this.characterSfx.update(timestamp, timeDiffS, actions);
this.characterFx.update(timestamp, timeDiffS);

this.updateInterpolation(timeDiff);

Expand Down
15 changes: 13 additions & 2 deletions character-sfx.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,19 @@ class CharacterSfx {

this.oldNarutoRunSound = null;
}
update(timestamp, timeDiffS) {
update(timestamp, timeDiffS, actions = []) {
if (!this.player.avatar) {
return;
}

//check current actions has sit action
let hasSitAction = false
for (const action of actions) {
if (action.type === 'sit') {
hasSitAction = true
}
}

const timeSeconds = timestamp/1000;
const currentSpeed = localVector.set(this.player.avatar.velocity.x, 0, this.player.avatar.velocity.z).length();

Expand Down Expand Up @@ -190,7 +198,10 @@ class CharacterSfx {
this.lastWalkTime = timeSeconds;
}
};
_handleStep();

if (!hasSitAction) {
_handleStep();
}

const _handleNarutoRun = () => {

Expand Down

0 comments on commit 40dbea0

Please sign in to comment.