From a6d1b48315300152413ef9605505e45765903202 Mon Sep 17 00:00:00 2001 From: Avarian Knight Date: Sat, 15 Jan 2022 02:38:29 -0600 Subject: [PATCH 1/2] fix(ui): fix clicks not registering properly --- client/init/init.lua | 4 +++- client/module/phone.lua | 2 +- client/module/radio.lua | 2 +- client/utils/Nui.lua | 3 +-- ui/js/app.js | 2 +- ui/js/app.js.map | 2 +- voice-ui/src/App.vue | 7 ++++++- 7 files changed, 14 insertions(+), 8 deletions(-) diff --git a/client/init/init.lua b/client/init/init.lua index 3b6805e..600428b 100644 --- a/client/init/init.lua +++ b/client/init/init.lua @@ -25,8 +25,10 @@ AddEventHandler('onClientResourceStart', function(resource) micClicks = 'true' end sendUIMessage({ + uiEnabled = GetConvarInt("voice_enableUi", 1) == 1, voiceModes = json.encode(Cfg.voiceModes), voiceMode = mode - 1 - }, true) + }) + print('Script initialization finished.') end) \ No newline at end of file diff --git a/client/module/phone.lua b/client/module/phone.lua index efd3667..35a3b52 100644 --- a/client/module/phone.lua +++ b/client/module/phone.lua @@ -67,7 +67,7 @@ function setCallChannel(channel) callChannel = channel sendUIMessage({ callInfo = channel - }, true) + }) createPhoneThread() end diff --git a/client/module/radio.lua b/client/module/radio.lua index e7de510..4ae7e6f 100644 --- a/client/module/radio.lua +++ b/client/module/radio.lua @@ -93,7 +93,7 @@ function setRadioChannel(channel) sendUIMessage({ radioChannel = channel, radioEnabled = radioEnabled - }, true) + }) end --- exports setRadioChannel diff --git a/client/utils/Nui.lua b/client/utils/Nui.lua index 15c62e9..871e91a 100644 --- a/client/utils/Nui.lua +++ b/client/utils/Nui.lua @@ -1,7 +1,6 @@ local uiReady = promise.new() -function sendUIMessage(message, respectConvar) +function sendUIMessage(message) Citizen.Await(uiReady) - if respectConvar and GetConvarInt('voice_enableUi', 1) ~= 1 then return end SendNUIMessage(message) end diff --git a/ui/js/app.js b/ui/js/app.js index 9e10c33..d63d431 100644 --- a/ui/js/app.js +++ b/ui/js/app.js @@ -1,2 +1,2 @@ -(function(e){function o(o){for(var t,a,r=o[0],d=o[1],l=o[2],s=0,f=[];s{})}})),fetch(`https://${GetParentResourceName()}/uiReady`,{method:"POST"}),{voice:e}}},l=(n("62f8"),n("85dd")),u=n.n(l);const s=u()(d,[["render",r]]);var f=s;Object(t["a"])(f).mount("#app")},"62f8":function(e,o,n){"use strict";n("3a32")}}); +(function(e){function o(o){for(var t,a,r=o[0],d=o[1],l=o[2],s=0,b=[];s{})}})),fetch(`https://${GetParentResourceName()}/uiReady`,{method:"POST"}),{voice:e}}},l=(n("9253"),n("85dd")),u=n.n(l);const s=u()(d,[["render",r]]);var b=s;Object(t["a"])(b).mount("#app")},9253:function(e,o,n){"use strict";n("0154")}}); //# sourceMappingURL=app.js.map \ No newline at end of file diff --git a/ui/js/app.js.map b/ui/js/app.js.map index 0e754d0..3f07945 100644 --- a/ui/js/app.js.map +++ b/ui/js/app.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/App.vue","webpack:///./src/App.vue?52ba","webpack:///./src/main.js","webpack:///./src/App.vue?ec5c"],"names":["webpackJsonpCallback","data","moduleId","chunkId","chunkIds","moreModules","executeModules","i","resolves","length","Object","prototype","hasOwnProperty","call","installedChunks","push","modules","parentJsonpFunction","shift","deferredModules","apply","checkDeferredModules","result","deferredModule","fulfilled","j","depId","splice","__webpack_require__","s","installedModules","exports","module","l","m","c","d","name","getter","o","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","p","jsonpArray","window","oldJsonpFunction","slice","id","src","class","voice","callInfo","talking","radioEnabled","radioChannel","usingRadio","voiceModes","voiceMode","addEventListener","event","undefined","JSON","parse","sound","click","document","getElementById","load","volume","play","catch","e","fetch","GetParentResourceName","method","__exports__","render","App","mount"],"mappings":"aACE,SAASA,EAAqBC,GAQ7B,IAPA,IAMIC,EAAUC,EANVC,EAAWH,EAAK,GAChBI,EAAcJ,EAAK,GACnBK,EAAiBL,EAAK,G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L,EAAMK,WAAarE,EAAKqE,iBAGHK,IAAjB1E,EAAKkE,SAA2BF,EAAMK,aAC1CL,EAAME,QAAUlE,EAAKkE,SAGlBlE,EAAK6E,OAASb,EAAMG,cAAuC,IAAvBH,EAAMI,aAAoB,CACjE,IAAIU,EAAQC,SAASC,eAAehF,EAAK6E,OAEzCC,EAAMG,OACNH,EAAMI,OAASlF,EAAKkF,OACpBJ,EAAMK,OAAOC,MAAOC,WAItBC,MAAM,WAAWC,kCAAmC,CAAEC,OAAQ,SAEvD,CAAExB,W,iCCzEX,MAAMyB,EAA2B,IAAgB,EAAQ,CAAC,CAAC,SAASC,KAErD,QCNf,eAAUC,GAAKC,MAAM,S,oCCHrB","file":"js/app.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tfunction webpackJsonpCallback(data) {\n \t\tvar chunkIds = data[0];\n \t\tvar moreModules = data[1];\n \t\tvar executeModules = data[2];\n\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, resolves = [];\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(Object.prototype.hasOwnProperty.call(installedChunks, chunkId) && installedChunks[chunkId]) {\n \t\t\t\tresolves.push(installedChunks[chunkId][0]);\n \t\t\t}\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tif(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {\n \t\t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t\t}\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(data);\n\n \t\twhile(resolves.length) {\n \t\t\tresolves.shift()();\n \t\t}\n\n \t\t// add entry modules from loaded chunk to deferred list\n \t\tdeferredModules.push.apply(deferredModules, executeModules || []);\n\n \t\t// run deferred modules when all chunks ready\n \t\treturn checkDeferredModules();\n \t};\n \tfunction checkDeferredModules() {\n \t\tvar result;\n \t\tfor(var i = 0; i < deferredModules.length; i++) {\n \t\t\tvar deferredModule = deferredModules[i];\n \t\t\tvar fulfilled = true;\n \t\t\tfor(var j = 1; j < deferredModule.length; j++) {\n \t\t\t\tvar depId = deferredModule[j];\n \t\t\t\tif(installedChunks[depId] !== 0) fulfilled = false;\n \t\t\t}\n \t\t\tif(fulfilled) {\n \t\t\t\tdeferredModules.splice(i--, 1);\n \t\t\t\tresult = __webpack_require__(__webpack_require__.s = deferredModule[0]);\n \t\t\t}\n \t\t}\n\n \t\treturn result;\n \t}\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// object to store loaded and loading chunks\n \t// undefined = chunk not loaded, null = chunk preloaded/prefetched\n \t// Promise = chunk loading, 0 = chunk loaded\n \tvar installedChunks = {\n \t\t\"app\": 0\n \t};\n\n \tvar deferredModules = [];\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \tvar jsonpArray = window[\"webpackJsonp\"] = window[\"webpackJsonp\"] || [];\n \tvar oldJsonpFunction = jsonpArray.push.bind(jsonpArray);\n \tjsonpArray.push = webpackJsonpCallback;\n \tjsonpArray = jsonpArray.slice();\n \tfor(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]);\n \tvar parentJsonpFunction = oldJsonpFunction;\n\n\n \t// add entry module to deferred list\n \tdeferredModules.push([0,\"chunk-vendors\"]);\n \t// run deferred modules when ready\n \treturn checkDeferredModules();\n","\r\n\r\n\r\n\r\n\r\n","import { render } from \"./App.vue?vue&type=template&id=31f5733e\"\nimport script from \"./App.vue?vue&type=script&lang=js\"\nexport * from \"./App.vue?vue&type=script&lang=js\"\n\nimport \"./App.vue?vue&type=style&index=0&id=31f5733e&lang=css\"\n\nimport exportComponent from \"C:\\\\FXServer\\\\server-data\\\\resources\\\\pma-voice\\\\voice-ui\\\\node_modules\\\\.pnpm\\\\vue-loader@16.8.3_webpack@4.46.0\\\\node_modules\\\\vue-loader\\\\dist\\\\exportHelper.js\"\nconst __exports__ = /*#__PURE__*/exportComponent(script, [['render',render]])\n\nexport default __exports__","import { createApp } from 'vue'\r\nimport App from './App.vue'\r\n\r\ncreateApp(App).mount('#app')\r\n","export * from \"-!../node_modules/.pnpm/mini-css-extract-plugin@0.9.0_webpack@4.46.0/node_modules/mini-css-extract-plugin/dist/loader.js??ref--7-oneOf-1-0!../node_modules/.pnpm/css-loader@3.6.0_webpack@4.46.0/node_modules/css-loader/dist/cjs.js??ref--7-oneOf-1-1!../node_modules/.pnpm/vue-loader@16.8.3_webpack@4.46.0/node_modules/vue-loader/dist/stylePostLoader.js!../node_modules/.pnpm/postcss-loader@3.0.0/node_modules/postcss-loader/src/index.js??ref--7-oneOf-1-2!../node_modules/.pnpm/cache-loader@4.1.0_webpack@4.46.0/node_modules/cache-loader/dist/cjs.js??ref--1-0!../node_modules/.pnpm/vue-loader@16.8.3_webpack@4.46.0/node_modules/vue-loader/dist/index.js??ref--1-1!./App.vue?vue&type=style&index=0&id=31f5733e&lang=css\""],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/App.vue","webpack:///./src/App.vue?52ba","webpack:///./src/main.js","webpack:///./src/App.vue?02b4"],"names":["webpackJsonpCallback","data","moduleId","chunkId","chunkIds","moreModules","executeModules","i","resolves","length","Object","prototype","hasOwnProperty","call","installedChunks","push","modules","parentJsonpFunction","shift","deferredModules","apply","checkDeferredModules","result","deferredModule","fulfilled","j","depId","splice","__webpack_require__","s","installedModules","exports","module","l","m","c","d","name","getter","o","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","p","jsonpArray","window","oldJsonpFunction","slice","id","src","class","voice","callInfo","talking","radioEnabled","radioChannel","usingRadio","voiceModes","voiceMode","uiEnabled","addEventListener","event","undefined","JSON","parse","sound","click","document","getElementById","load","volume","play","catch","e","fetch","GetParentResourceName","method","__exports__","render","App","mount"],"mappings":"aACE,SAASA,EAAqBC,GAQ7B,IAPA,IAMIC,EAAUC,EANVC,EAAWH,EAAK,GAChBI,EAAcJ,EAAK,GACnBK,EAAiBL,EAAK,GAIHM,EAAI,EAAGC,EAAW,GACpCD,EAAIH,EAASK,OAAQF,IACzBJ,EAAUC,EAASG,GAChBG,OAAOC,UAAUC,eAAeC,KAAKC,EAAiBX,IAAYW,EAAgBX,IACpFK,EAASO,KAAKD,EAAgBX,GAAS,IAExCW,EAAgBX,GAAW,EAE5B,IAAID,KAAYG,EACZK,OAAOC,UAAUC,eAAeC,KAAKR,EAAaH,KACpDc,EAAQd,GAAYG,EAAYH,IAG/Be,GAAqBA,EAAoBhB,GAE5C,MAAMO,EAASC,OACdD,EAASU,OAATV,GAOD,OAHAW,EAAgBJ,KAAKK,MAAMD,EAAiBb,GAAkB,IAGvDe,IAER,SAASA,IAER,IADA,IAAIC,EACIf,EAAI,EAAGA,EAAIY,EAAgBV,OAAQF,IAAK,CAG/C,IAFA,IAAIgB,EAAiBJ,EAAgBZ,GACjCiB,GAAY,EACRC,EAAI,EAAGA,EAAIF,EAAed,OAAQgB,IAAK,CAC9C,IAAIC,EAAQH,EAAeE,GACG,IAA3BX,EAAgBY,KAAcF,GAAY,GAE3CA,IACFL,EAAgBQ,OAAOpB,IAAK,GAC5Be,EAASM,EAAoBA,EAAoBC,EAAIN,EAAe,KAItE,OAAOD,EAIR,IAAIQ,EAAmB,GAKnBhB,EAAkB,CACrB,IAAO,GAGJK,EAAkB,GAGtB,SAASS,EAAoB1B,GAG5B,GAAG4B,EAAiB5B,GACnB,OAAO4B,EAAiB5B,GAAU6B,QAGnC,IAAIC,EAASF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,KAAKC,MAAM7E,EAAKsE,YAEnC,IAAIA,EAAa,IAAIN,EAAMM,YAC3BA,EAAWxD,KAAK,CAAC,EAAK,WACtBkD,EAAMM,WAAaA,EA2BpB,QAxBuBK,IAAnB3E,EAAKuE,YACRP,EAAMO,UAAYvE,EAAKuE,gBAGEI,IAAtB3E,EAAKoE,eACRJ,EAAMI,aAAepE,EAAKoE,mBAGDO,IAAtB3E,EAAKmE,eACRH,EAAMG,aAAenE,EAAKmE,mBAGLQ,IAAlB3E,EAAKiE,WACRD,EAAMC,SAAWjE,EAAKiE,eAGCU,IAApB3E,EAAKqE,YAA4BrE,EAAKqE,aAAeL,EAAMK,aAC9DL,EAAMK,WAAarE,EAAKqE,iBAGHM,IAAjB3E,EAAKkE,SAA2BF,EAAMK,aAC1CL,EAAME,QAAUlE,EAAKkE,SAGlBlE,EAAK8E,OAASd,EAAMG,cAAuC,IAAvBH,EAAMI,aAAoB,CACjE,IAAIW,EAAQC,SAASC,eAAejF,EAAK8E,OAEzCC,EAAMG,OACNH,EAAMI,OAASnF,EAAKmF,OACpBJ,EAAMK,OAAOC,MAAOC,WAItBC,MAAM,WAAWC,kCAAmC,CAAEC,OAAQ,SAEvD,CAAEzB,W,iCC9EX,MAAM0B,EAA2B,IAAgB,EAAQ,CAAC,CAAC,SAASC,KAErD,QCNf,eAAUC,GAAKC,MAAM,S,kCCHrB","file":"js/app.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tfunction webpackJsonpCallback(data) {\n \t\tvar chunkIds = data[0];\n \t\tvar moreModules = data[1];\n \t\tvar executeModules = data[2];\n\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, resolves = [];\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(Object.prototype.hasOwnProperty.call(installedChunks, chunkId) && installedChunks[chunkId]) {\n \t\t\t\tresolves.push(installedChunks[chunkId][0]);\n \t\t\t}\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tif(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {\n \t\t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t\t}\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(data);\n\n \t\twhile(resolves.length) {\n \t\t\tresolves.shift()();\n \t\t}\n\n \t\t// add entry modules from loaded chunk to deferred list\n \t\tdeferredModules.push.apply(deferredModules, executeModules || []);\n\n \t\t// run deferred modules when all chunks ready\n \t\treturn checkDeferredModules();\n \t};\n \tfunction checkDeferredModules() {\n \t\tvar result;\n \t\tfor(var i = 0; i < deferredModules.length; i++) {\n \t\t\tvar deferredModule = deferredModules[i];\n \t\t\tvar fulfilled = true;\n \t\t\tfor(var j = 1; j < deferredModule.length; j++) {\n \t\t\t\tvar depId = deferredModule[j];\n \t\t\t\tif(installedChunks[depId] !== 0) fulfilled = false;\n \t\t\t}\n \t\t\tif(fulfilled) {\n \t\t\t\tdeferredModules.splice(i--, 1);\n \t\t\t\tresult = __webpack_require__(__webpack_require__.s = deferredModule[0]);\n \t\t\t}\n \t\t}\n\n \t\treturn result;\n \t}\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// object to store loaded and loading chunks\n \t// undefined = chunk not loaded, null = chunk preloaded/prefetched\n \t// Promise = chunk loading, 0 = chunk loaded\n \tvar installedChunks = {\n \t\t\"app\": 0\n \t};\n\n \tvar deferredModules = [];\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \tvar jsonpArray = window[\"webpackJsonp\"] = window[\"webpackJsonp\"] || [];\n \tvar oldJsonpFunction = jsonpArray.push.bind(jsonpArray);\n \tjsonpArray.push = webpackJsonpCallback;\n \tjsonpArray = jsonpArray.slice();\n \tfor(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]);\n \tvar parentJsonpFunction = oldJsonpFunction;\n\n\n \t// add entry module to deferred list\n \tdeferredModules.push([0,\"chunk-vendors\"]);\n \t// run deferred modules when ready\n \treturn checkDeferredModules();\n","\r\n\r\n\r\n\r\n\r\n","import { render } from \"./App.vue?vue&type=template&id=0cf90768\"\nimport script from \"./App.vue?vue&type=script&lang=js\"\nexport * from \"./App.vue?vue&type=script&lang=js\"\n\nimport \"./App.vue?vue&type=style&index=0&id=0cf90768&lang=css\"\n\nimport exportComponent from \"C:\\\\FXServer\\\\server-data\\\\resources\\\\pma-voice\\\\voice-ui\\\\node_modules\\\\.pnpm\\\\vue-loader@16.8.3_webpack@4.46.0\\\\node_modules\\\\vue-loader\\\\dist\\\\exportHelper.js\"\nconst __exports__ = /*#__PURE__*/exportComponent(script, [['render',render]])\n\nexport default __exports__","import { createApp } from 'vue'\r\nimport App from './App.vue'\r\n\r\ncreateApp(App).mount('#app')\r\n","export * from \"-!../node_modules/.pnpm/mini-css-extract-plugin@0.9.0_webpack@4.46.0/node_modules/mini-css-extract-plugin/dist/loader.js??ref--7-oneOf-1-0!../node_modules/.pnpm/css-loader@3.6.0_webpack@4.46.0/node_modules/css-loader/dist/cjs.js??ref--7-oneOf-1-1!../node_modules/.pnpm/vue-loader@16.8.3_webpack@4.46.0/node_modules/vue-loader/dist/stylePostLoader.js!../node_modules/.pnpm/postcss-loader@3.0.0/node_modules/postcss-loader/src/index.js??ref--7-oneOf-1-2!../node_modules/.pnpm/cache-loader@4.1.0_webpack@4.46.0/node_modules/cache-loader/dist/cjs.js??ref--1-0!../node_modules/.pnpm/vue-loader@16.8.3_webpack@4.46.0/node_modules/vue-loader/dist/index.js??ref--1-1!./App.vue?vue&type=style&index=0&id=0cf90768&lang=css\""],"sourceRoot":""} \ No newline at end of file diff --git a/voice-ui/src/App.vue b/voice-ui/src/App.vue index 3db82dd..78c26d5 100644 --- a/voice-ui/src/App.vue +++ b/voice-ui/src/App.vue @@ -2,7 +2,7 @@ -
+

[Call]

@@ -22,6 +22,7 @@ export default { name: "App", setup() { const voice = reactive({ + uiEnabled: true, voiceModes: [], voiceMode: 0, radioChannel: 0, @@ -35,6 +36,10 @@ export default { window.addEventListener("message", function(event) { const data = event.data; + if (data.uiEnabled !== undefined) { + voice.uiEnabled = data.uiEnabled + } + if (data.voiceModes !== undefined) { voice.voiceModes = JSON.parse(data.voiceModes); // Push our own custom type for modes that have their range changed From 63dbdf69a3f8b2d55cf2e29f2046d55941ebbccd Mon Sep 17 00:00:00 2001 From: Avarian Knight Date: Sat, 15 Jan 2022 02:39:06 -0600 Subject: [PATCH 2/2] feat(voice): reinitalize radio channel/call channel if the state bag is set --- client/init/init.lua | 8 ++++++++ server/main.lua | 16 ++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/client/init/init.lua b/client/init/init.lua index 600428b..a05fe88 100644 --- a/client/init/init.lua +++ b/client/init/init.lua @@ -30,5 +30,13 @@ AddEventHandler('onClientResourceStart', function(resource) voiceMode = mode - 1 }) + -- Reinitialize channels if they're set. + if LocalPlayer.state.radioChannel ~= 0 then + setRadioChannel(LocalPlayer.state.radioChannel) + end + + if LocalPlayer.state.callChannel ~= 0 then + setCallChannel(LocalPlayer.state.callChannel) + end print('Script initialization finished.') end) \ No newline at end of file diff --git a/server/main.lua b/server/main.lua index 9a9cbbe..e6098dc 100644 --- a/server/main.lua +++ b/server/main.lua @@ -14,12 +14,16 @@ end function handleStateBagInitilization(source) local plyState = Player(source).state - plyState:set('radio', tonumber(GetConvar('voice_defaultRadioVolume', '0.3')), true) - plyState:set('phone', tonumber(GetConvar('voice_defaultPhoneVolume', '0.6')), true) - plyState:set('proximity', {}, true) - plyState:set('callChannel', 0, true) - plyState:set('radioChannel', 0, true) - plyState:set('voiceIntent', 'speech', true) + if not plyState.pmaVoiceInit then + plyState:set('radio', tonumber(GetConvar('voice_defaultRadioVolume', '0.3')), true) + plyState:set('phone', tonumber(GetConvar('voice_defaultPhoneVolume', '0.6')), true) + plyState:set('proximity', {}, true) + plyState:set('callChannel', 0, true) + plyState:set('radioChannel', 0, true) + plyState:set('voiceIntent', 'speech', true) + -- We want to save voice inits because we'll automatically reinitalize calls and channels + plyState:set('pmaVoiceInit', true, false) + end end -- temp fix before an actual fix is added