Skip to content

Commit

Permalink
Merge pull request #546 from bitpredator/dev
Browse files Browse the repository at this point in the history
fix: corrected pull request form template + chore: updates for the pma_voice resource
  • Loading branch information
bitpredator authored Oct 23, 2023
2 parents e82ddeb + 2eda9d8 commit 462150e
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 37 deletions.
16 changes: 10 additions & 6 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

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
14 changes: 7 additions & 7 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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?

<!-- You can erase any parts of this template not applicable to your Pull Request. -->

### 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?

<!-- You may optionally provide your discord username, so that we may contact you directly about the issue. -->
Discord username (if different from GitHub):
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
33 changes: 18 additions & 15 deletions server-data/resources/[phone]/pma-voice/client/module/radio.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -62,7 +66,6 @@ function addPlayerToRadio(plySource, plyRadioName)
addVoiceTargets(radioData, callData)
end
end

RegisterNetEvent('pma-voice:addPlayerToRadio', addPlayerToRadio)

--- event removePlayerFromRadio
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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)


Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 462150e

Please sign in to comment.