Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix underwater volume scaling #5

Merged
merged 1 commit into from
Oct 10, 2023

Conversation

stanleyqubit
Copy link
Contributor

Previously, underwaterCheck() would stop running once the player went underwater. registerModify() would unregister it and never re-register it. So, once underwater, modifyVolume() would run in an infinite loop in simulate, even when on land, continuously setting original volumes, and causing some weird sound glitches when the weather was changing.

This PR fixes this issue and also introduces playerHeight when calculating the new modified volume, for more accurate scaling. Now volume scaling will begin only when the player's head (playerPosZ + playerHeight) is below water level.

Also disabling sliders for rain/extreme weather in our volume adjuster menu while underwater volume scaling is in effect, and informing the player of current scaled volume when the menu is being toggled on.

Aaaaaand some minor fixes/refactors. Tested, all ok, but lemme know if completely off rails here lel

@tewlwolow
Copy link
Owner

Brilliant, the weather sound glitches were giving me headache!

@tewlwolow tewlwolow merged commit 2aeeaca into tewlwolow:main Oct 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
  翻译: