diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index 1f4666027..5eecde684 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -13,9 +13,13 @@ [esx_property\locales\en.lua & it.lua]: corrected typos @bitpredator [esx_property\server\main.lua]: correction of lint errors @bitpredator [esx_property\config.lua]: correction of lint errors @bitpredator -3. [esx_license\server\main.lua]: Replaced print in esx_license:addLicense - [esx_license\fxmanifest.lua]: Update fxmanifest.lua to version 1.0.0 - [esx_license\README.md]: update reference links in README.md - [esx_license\LICENSE]: updates the copyright reference year - - \ No newline at end of file +3. [esx_license\server\main.lua]: Replaced print in esx_license:addLicense @bitpredator + [esx_license\fxmanifest.lua]: Update fxmanifest.lua to version 1.0.0 @bitpredator + [esx_license\README.md]: update reference links in README.md @bitpredator + [esx_license\LICENSE]: updates the copyright reference year @bitpredator +4. [pma-voice/voice-ui/pnpm-lock.yaml]: chore: (deps-dev) bump url-parse + bump minimatch + bump terser @bitpredator + [pma-voice/client/module/phone.lua]: fix(phone): fix getting re-added to radios if perfectly hit + [pma-voice/client/init/main.lua]: fix(radio): fix oversight with function call + [pma-voice/workflows/dependency-review.yml]: chore(deps): bump actions/checkout from 3 to 4 @bitpredator + [pma-voice/voice-ui/pnpm-lock.yaml]: chore(deps-dev): bump follow-redirects in /voice-ui @bitpredator +5. [.github\PULL_REQUEST_TEMPLATE.md]: fix: corrected pull request form template @bitpredator \ No newline at end of file diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 5351d116e..3415b9acb 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -4,21 +4,21 @@ Fixes #[issue_no] ### All Submissions: -* []Have you followed the guidelines in our Contributing document? -* []Have you checked to ensure there aren't other open [Pull Requests](../../../pulls) for the same update/change? +* [ ]Have you followed the guidelines in our Contributing document? +* [ ]Have you checked to ensure there aren't other open [Pull Requests](../../../pulls) for the same update/change? ### New Feature Submissions: -1. []Does your submission pass tests? -2. []Have you lint your code locally prior to submission? +1. [ ]Does your submission pass tests? +2. [ ]Have you lint your code locally prior to submission? ### Changes to Core Features: -* []Have you added an explanation of what your changes do and why you'd like us to include them? -* []Have you written new tests for your core changes, as applicable? -* []Have you successfully ran tests with your changes locally? +* [ ]Have you added an explanation of what your changes do and why you'd like us to include them? +* [ ]Have you written new tests for your core changes, as applicable? +* [ ]Have you successfully ran tests with your changes locally? Discord username (if different from GitHub): \ No newline at end of file diff --git a/server-data/resources/[phone]/pma-voice/client/init/main.lua b/server-data/resources/[phone]/pma-voice/client/init/main.lua index 96faf2d5a..e17d09c10 100644 --- a/server-data/resources/[phone]/pma-voice/client/init/main.lua +++ b/server-data/resources/[phone]/pma-voice/client/init/main.lua @@ -306,7 +306,6 @@ if gameVersion == 'redm' then end) end - --- handles initializiation for whenever radio or call data changes --- calls should always be last because they're assumed to always be enabled so --- theres no delay in talking. diff --git a/server-data/resources/[phone]/pma-voice/client/module/phone.lua b/server-data/resources/[phone]/pma-voice/client/module/phone.lua index d768251aa..97f3a51f3 100644 --- a/server-data/resources/[phone]/pma-voice/client/module/phone.lua +++ b/server-data/resources/[phone]/pma-voice/client/module/phone.lua @@ -19,15 +19,13 @@ RegisterNetEvent('pma-voice:removePlayerFromCall', function(plySource) end callData = {} MumbleClearVoiceTargetPlayers(voiceTarget) - addVoiceTargets(radioPressed and radioData or {}, callData) + addVoiceTargets((radioPressed and isRadioEnabled()) and radioData or {}, callData) else callData[plySource] = nil - if not radioData[plySource] then - toggleVoice(plySource, false, 'call') - end + toggleVoice(plySource, radioData[plySource], 'call') if MumbleIsPlayerTalking(PlayerId()) then MumbleClearVoiceTargetPlayers(voiceTarget) - addVoiceTargets(radioPressed and radioData or {}, callData) + addVoiceTargets((radioPressed and isRadioEnabled()) and radioData or {}, callData) end end end) diff --git a/server-data/resources/[phone]/pma-voice/client/module/radio.lua b/server-data/resources/[phone]/pma-voice/client/module/radio.lua index 6d2f911cd..25f076cc4 100644 --- a/server-data/resources/[phone]/pma-voice/client/module/radio.lua +++ b/server-data/resources/[phone]/pma-voice/client/module/radio.lua @@ -2,6 +2,11 @@ local radioChannel = 0 local radioNames = {} local disableRadioAnim = false +---@return boolean isEnabled if radioEnabled is true and LocalPlayer.state.disableRadio is 0 (no bits set) +function isRadioEnabled() + return radioEnabled and LocalPlayer.state.disableRadio == 0 +end + --- event syncRadioData --- syncs the current players on the radio to the client ---@param radioTable table the table of the current players on the radio @@ -15,14 +20,15 @@ function syncRadioData(radioTable, localPlyRadioName) print('-----------------------------') end - local isRadioEnabled = radioEnabled and LocalPlayer.state.disableRadio == 0 - if isRadioEnabled then + local isEnabled = isRadioEnabled() + + if isEnabled then handleRadioAndCallInit() end sendUIMessage({ radioChannel = radioChannel, - radioEnabled = isRadioEnabled + radioEnabled = isEnabled }) if GetConvarInt("voice_syncPlayerNames", 0) == 1 then radioNames[playerServerId] = localPlyRadioName @@ -37,15 +43,13 @@ RegisterNetEvent('pma-voice:syncRadioData', syncRadioData) ---@param enabled boolean whether the player is talking or not. function setTalkingOnRadio(plySource, enabled) radioData[plySource] = enabled - -- if we don't have radioEnabled don't actually set them as talking (we still want the state to enable people talking later) - if not radioEnabled or LocalPlayer.state.disableRadio ~= 0 then return logger.info("[radio] Ignoring setTalkingOnRadio. radioEnabled: %s disableRadio: %s", radioEnabled, LocalPlayer.state.disableRadio) end + + if not isRadioEnabled() then return logger.info("[radio] Ignoring setTalkingOnRadio. radioEnabled: %s disableRadio: %s", radioEnabled, LocalPlayer.state.disableRadio) end -- If we're on a call we don't want to toggle their voice disabled this will break calls. - if not callData[plySource] then - toggleVoice(plySource, enabled, 'radio') - end + local enabled = enabled or callData[plySource] + toggleVoice(plySource, enabled, 'radio') playMicClicks(enabled) end - RegisterNetEvent('pma-voice:setTalkingOnRadio', setTalkingOnRadio) --- event addPlayerToRadio @@ -62,7 +66,6 @@ function addPlayerToRadio(plySource, plyRadioName) addVoiceTargets(radioData, callData) end end - RegisterNetEvent('pma-voice:addPlayerToRadio', addPlayerToRadio) --- event removePlayerFromRadio @@ -181,8 +184,9 @@ end RegisterCommand('+radiotalk', function() if GetConvarInt('voice_enableRadios', 1) ~= 1 then return end - if isDead() or LocalPlayer.state.disableRadio ~= 0 then return end - if not radioPressed and radioEnabled then + if isDead() then return end + if not isRadioEnabled() then return end + if not radioPressed then if radioChannel > 0 then logger.info('[radio] Start broadcasting, update targets and notify server.') addVoiceTargets(radioData, callData) @@ -198,7 +202,7 @@ RegisterCommand('+radiotalk', function() LocalPlayer.state:set("radioActive", true, true); local checkFailed = false while radioPressed do - if radioChannel < 0 or not radioEnabled or isDead() or LocalPlayer.state.disableRadio ~= 0 then + if radioChannel < 0 or isDead() or not isRadioEnabled() then checkFailed = true break end @@ -231,7 +235,7 @@ RegisterCommand('+radiotalk', function() end, false) RegisterCommand('-radiotalk', function() - if (radioChannel > 0 or radioEnabled) and radioPressed then + if radioChannel > 0 and radioPressed then radioPressed = false MumbleClearVoiceTargetPlayers(voiceTarget) addVoiceTargets(callData) @@ -256,7 +260,6 @@ function syncRadio(_radioChannel) logger.info('[radio] radio set serverside update to radio %s', radioChannel) radioChannel = _radioChannel end - RegisterNetEvent('pma-voice:clSetPlayerRadio', syncRadio) diff --git a/server-data/resources/[phone]/pma-voice/voice-ui/pnpm-lock.yaml b/server-data/resources/[phone]/pma-voice/voice-ui/pnpm-lock.yaml index e89a066e4..2bbf9ef13 100644 --- a/server-data/resources/[phone]/pma-voice/voice-ui/pnpm-lock.yaml +++ b/server-data/resources/[phone]/pma-voice/voice-ui/pnpm-lock.yaml @@ -2896,8 +2896,8 @@ packages: readable-stream: 2.3.7 dev: true - /follow-redirects@1.14.7(debug@4.3.3): - resolution: {integrity: sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ==} + /follow-redirects@1.15.3(debug@4.3.3): + resolution: {integrity: sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==} engines: {node: '>=4.0'} peerDependencies: debug: '*' @@ -3382,7 +3382,7 @@ packages: engines: {node: '>=8.0.0'} dependencies: eventemitter3: 4.0.7 - follow-redirects: 1.14.7(debug@4.3.3) + follow-redirects: 1.15.3(debug@4.3.3) requires-port: 1.0.0 transitivePeerDependencies: - debug