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

Wrap callback object for enabled in tonumber func #10

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

snepderg
Copy link

Proximity voice uses tobool( new ) in the callback, which leads to some interesting behaviour when trying to use incrementvar.

For example: incrementvar proximity_voice_enabled 0 1 1 will return 0.00 instead of 0, which is considered truthy.

To remedy this, I have wrapped the new in a tonumber() so it will handle 0.00 as 0.

I have observed that proximity voice will stay enabled unless you write exactly 0. When using `incrementvar proximity_voice_enabled 0 1 1` for instance, you are left with 0.00 instead of 0, thus it stays enabled.
@snepderg snepderg marked this pull request as draft August 12, 2024 21:34
@wrefgtzweve
Copy link
Member

this will error if an invalid number eg "1a" is set as convar i think.
Check if the return from tobool exists

@NullLikesNothing
Copy link
Contributor

this will error if an invalid number eg "1a" is set as convar i think. Check if the return from tobool exists

tobool will return false for nil

My previous commit was meant for enabled, not transmit only, but both benefit from this change.
@snepderg
Copy link
Author

Thank you for the feedback @NullLikesNothing , I appreciate it.

I have applied tonumber() to both proximity_voice_enabled and proximity_voice_transmit_only.

@snepderg snepderg marked this pull request as ready for review August 12, 2024 22:09
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.

3 participants