-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(deps-dev): bump elliptic from 6.5.4 to 6.5.7 in /voice-ui
- Loading branch information
1 parent
30de5cd
commit 5cbb938
Showing
8 changed files
with
4,913 additions
and
3,968 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
## TODO | ||
- [ ] Ability to display radio members on the client. | ||
- [ ] Use commands to define voiceModes in shared.lua and only leave debug logs in shared.lua. | ||
- [ ] Convert the UI to React. | ||
- [ ] Multiple radio channels. | ||
|
||
## DONE | ||
- [ x ] Implement a easy way to get the players current radio channel on the server. | ||
- [ x ] Add the ability to override proximity with exports. | ||
- [ x ] Rename everything that uses 'phone' to 'call' for consistency. |
122 changes: 59 additions & 63 deletions
122
server-data/resources/[phone]/pma-voice/client/commands.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,87 +1,83 @@ | ||
local wasProximityDisabledFromOverride = false | ||
disableProximityCycle = false | ||
RegisterCommand("setvoiceintent", function(source, args) | ||
if GetConvarInt("voice_allowSetIntent", 1) == 1 then | ||
local intent = args[1] | ||
if intent == "speech" then | ||
MumbleSetAudioInputIntent(`speech`) | ||
elseif intent == "music" then | ||
MumbleSetAudioInputIntent(`music`) | ||
end | ||
LocalPlayer.state:set("voiceIntent", intent, true) | ||
end | ||
RegisterCommand('setvoiceintent', function(source, args) | ||
if GetConvarInt('voice_allowSetIntent', 1) == 1 then | ||
local intent = args[1] | ||
if intent == 'speech' then | ||
MumbleSetAudioInputIntent(`speech`) | ||
elseif intent == 'music' then | ||
MumbleSetAudioInputIntent(`music`) | ||
end | ||
LocalPlayer.state:set('voiceIntent', intent, true) | ||
end | ||
end) | ||
TriggerEvent("chat:addSuggestion", "/setvoiceintent", "Sets the players voice intent", { | ||
{ | ||
name = "intent", | ||
help = "speech is default and enables noise suppression & high pass filter, music disables both of these.", | ||
}, | ||
TriggerEvent('chat:addSuggestion', '/setvoiceintent', 'Sets the players voice intent', { | ||
{ | ||
name = "intent", | ||
help = "speech is default and enables noise suppression & high pass filter, music disables both of these." | ||
}, | ||
}) | ||
|
||
-- TODO: Better implementation of this? | ||
RegisterCommand("vol", function(_, args) | ||
if not args[1] then | ||
return | ||
end | ||
setVolume(tonumber(args[1])) | ||
RegisterCommand('vol', function(_, args) | ||
if not args[1] then return end | ||
setVolume(tonumber(args[1])) | ||
end) | ||
TriggerEvent("chat:addSuggestion", "/vol", "Sets the radio/phone volume", { | ||
{ name = "volume", help = "A range between 1-100 on how loud you want them to be" }, | ||
TriggerEvent('chat:addSuggestion', '/vol', 'Sets the radio/phone volume', { | ||
{ name = "volume", help = "A range between 1-100 on how loud you want them to be" }, | ||
}) | ||
|
||
exports("setAllowProximityCycleState", function(state) | ||
type_check({ state, "boolean" }) | ||
disableProximityCycle = state | ||
exports('setAllowProximityCycleState', function(state) | ||
type_check({ state, "boolean" }) | ||
disableProximityCycle = state | ||
end) | ||
|
||
function setProximityState(proximityRange, isCustom) | ||
local voiceModeData = Cfg.voiceModes[mode] | ||
MumbleSetTalkerProximity(proximityRange + 0.0) | ||
LocalPlayer.state:set("proximity", { | ||
index = mode, | ||
distance = proximityRange, | ||
mode = isCustom and "Custom" or voiceModeData[2], | ||
}, true) | ||
sendUIMessage({ | ||
-- JS expects this value to be - 1, "custom" voice is on the last index | ||
voiceMode = isCustom and #Cfg.voiceModes or mode - 1, | ||
}) | ||
local voiceModeData = Cfg.voiceModes[mode] | ||
MumbleSetTalkerProximity(proximityRange + 0.0) | ||
LocalPlayer.state:set('proximity', { | ||
index = mode, | ||
distance = proximityRange, | ||
mode = isCustom and "Custom" or voiceModeData[2], | ||
}, true) | ||
sendUIMessage({ | ||
-- JS expects this value to be - 1, "custom" voice is on the last index | ||
voiceMode = isCustom and #Cfg.voiceModes or mode - 1 | ||
}) | ||
end | ||
|
||
exports("overrideProximityRange", function(range, disableCycle) | ||
type_check({ range, "number" }) | ||
setProximityState(range, true) | ||
if disableCycle then | ||
disableProximityCycle = true | ||
wasProximityDisabledFromOverride = true | ||
end | ||
type_check({ range, "number" }) | ||
setProximityState(range, true) | ||
if disableCycle then | ||
disableProximityCycle = true | ||
wasProximityDisabledFromOverride = true | ||
end | ||
end) | ||
|
||
exports("clearProximityOverride", function() | ||
local voiceModeData = Cfg.voiceModes[mode] | ||
setProximityState(voiceModeData[1], false) | ||
if wasProximityDisabledFromOverride then | ||
disableProximityCycle = false | ||
end | ||
local voiceModeData = Cfg.voiceModes[mode] | ||
setProximityState(voiceModeData[1], false) | ||
if wasProximityDisabledFromOverride then | ||
disableProximityCycle = false | ||
end | ||
end) | ||
|
||
RegisterCommand("cycleproximity", function() | ||
-- Proximity is either disabled, or manually overwritten. | ||
if GetConvarInt("voice_enableProximityCycle", 1) ~= 1 or disableProximityCycle then | ||
return | ||
end | ||
local newMode = mode + 1 | ||
RegisterCommand('cycleproximity', function() | ||
-- Proximity is either disabled, or manually overwritten. | ||
if GetConvarInt('voice_enableProximityCycle', 1) ~= 1 or disableProximityCycle then return end | ||
local newMode = mode + 1 | ||
|
||
-- If we're within the range of our voice modes, allow the increase, otherwise reset to the first state | ||
if newMode <= #Cfg.voiceModes then | ||
mode = newMode | ||
else | ||
mode = 1 | ||
end | ||
-- If we're within the range of our voice modes, allow the increase, otherwise reset to the first state | ||
if newMode <= #Cfg.voiceModes then | ||
mode = newMode | ||
else | ||
mode = 1 | ||
end | ||
|
||
setProximityState(Cfg.voiceModes[mode][1], false) | ||
TriggerEvent("pma-voice:setTalkingMode", mode) | ||
setProximityState(Cfg.voiceModes[mode][1], false) | ||
TriggerEvent('pma-voice:setTalkingMode', mode) | ||
end, false) | ||
if gameVersion == "fivem" then | ||
RegisterKeyMapping("cycleproximity", "Cycle Proximity", "keyboard", GetConvar("voice_defaultCycle", "F11")) | ||
if gameVersion == 'fivem' then | ||
RegisterKeyMapping('cycleproximity', 'Cycle Proximity', 'keyboard', GetConvar('voice_defaultCycle', 'F11')) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
server-data/resources/[phone]/pma-voice/voice-ui/babel.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
module.exports = { | ||
presets: [ | ||
'@vue/cli-plugin-babel/preset', | ||
], | ||
}; | ||
presets: [ | ||
'@vue/cli-plugin-babel/preset' | ||
] | ||
} |
Oops, something went wrong.