mirror of
https://github.com/mrSkortch/MissionScriptingTools.git
synced 2025-08-15 10:47:23 +00:00
Messages hotfix 2
FIXED: But related to sound files not playing if there was no text message updates. FIXED: typo in getUnitsByAttribute FIXED: typo in getGroupsByAttribute
This commit is contained in:
parent
17726628ec
commit
eb0d16b556
48
mist.lua
48
mist.lua
@ -35,7 +35,7 @@ mist = {}
|
|||||||
-- don't change these
|
-- don't change these
|
||||||
mist.majorVersion = 4
|
mist.majorVersion = 4
|
||||||
mist.minorVersion = 5
|
mist.minorVersion = 5
|
||||||
mist.build = 107
|
mist.build = 108
|
||||||
|
|
||||||
-- forward declaration of log shorthand
|
-- forward declaration of log shorthand
|
||||||
local log
|
local log
|
||||||
@ -2831,7 +2831,7 @@ function mist.getUnitsByAttribute(att, rnum, id)
|
|||||||
cEntry.country = att.country
|
cEntry.country = att.country
|
||||||
cEntry.coalition = att.coalition
|
cEntry.coalition = att.coalition
|
||||||
cEntry.skill = att.skill
|
cEntry.skill = att.skill
|
||||||
cEntry.categry = att.category
|
cEntry.category = att.category
|
||||||
|
|
||||||
local num = rnum or 1
|
local num = rnum or 1
|
||||||
|
|
||||||
@ -2881,7 +2881,7 @@ function mist.getGroupsByAttribute(att, rnum, id)
|
|||||||
cEntry.country = att.country
|
cEntry.country = att.country
|
||||||
cEntry.coalition = att.coalition
|
cEntry.coalition = att.coalition
|
||||||
cEntry.skill = att.skill
|
cEntry.skill = att.skill
|
||||||
cEntry.categry = att.category
|
cEntry.category = att.category
|
||||||
|
|
||||||
local num = rnum or 1
|
local num = rnum or 1
|
||||||
|
|
||||||
@ -6368,6 +6368,7 @@ do -- mist.msg scope
|
|||||||
local caSlots = false
|
local caSlots = false
|
||||||
local caMSGtoGroup = false
|
local caMSGtoGroup = false
|
||||||
local anyUpdate = false
|
local anyUpdate = false
|
||||||
|
local anySound = false
|
||||||
local lastMessageTime = nil
|
local lastMessageTime = nil
|
||||||
|
|
||||||
if env.mission.groundControl then -- just to be sure?
|
if env.mission.groundControl then -- just to be sure?
|
||||||
@ -6395,7 +6396,7 @@ do -- mist.msg scope
|
|||||||
local clearView = true
|
local clearView = true
|
||||||
if #messageList > 0 then
|
if #messageList > 0 then
|
||||||
--log:warn('Updates: $1', anyUpdate)
|
--log:warn('Updates: $1', anyUpdate)
|
||||||
if anyUpdate == true then
|
if anyUpdate == true or anySound == true then
|
||||||
local activeClients = {}
|
local activeClients = {}
|
||||||
|
|
||||||
for clientId, clientData in pairs(mist.DBs.humansById) do
|
for clientId, clientData in pairs(mist.DBs.humansById) do
|
||||||
@ -6403,7 +6404,7 @@ do -- mist.msg scope
|
|||||||
activeClients[clientData.groupId] = clientData.groupName
|
activeClients[clientData.groupId] = clientData.groupName
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
anyUpdate = false
|
|
||||||
if displayActive == false then
|
if displayActive == false then
|
||||||
displayActive = true
|
displayActive = true
|
||||||
end
|
end
|
||||||
@ -6419,14 +6420,16 @@ do -- mist.msg scope
|
|||||||
if messageData.displayedFor then
|
if messageData.displayedFor then
|
||||||
messageData.displayedFor = curTime - messageData.addedAt
|
messageData.displayedFor = curTime - messageData.addedAt
|
||||||
end
|
end
|
||||||
local nextSound = 1000
|
|
||||||
local soundIndex = 0
|
|
||||||
|
|
||||||
|
local soundIndex = 0
|
||||||
|
local refSound = 100000
|
||||||
if messageData.multSound and #messageData.multSound > 0 then
|
if messageData.multSound and #messageData.multSound > 0 then
|
||||||
|
anySound = true
|
||||||
for index, sData in pairs(messageData.multSound) do
|
for index, sData in pairs(messageData.multSound) do
|
||||||
if sData.time <= messageData.displayedFor and sData.played == false and sData.time < nextSound then -- find index of the next sound to be played
|
if sData.time <= messageData.displayedFor and sData.played == false and sData.time < refSound then -- find index of the next sound to be played
|
||||||
nextSound = sData.time
|
refSound = sData.time
|
||||||
soundIndex = index
|
soundIndex = index
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if soundIndex ~= 0 then
|
if soundIndex ~= 0 then
|
||||||
@ -6471,20 +6474,21 @@ do -- mist.msg scope
|
|||||||
|
|
||||||
end
|
end
|
||||||
------- new display
|
------- new display
|
||||||
|
if anyUpdate == true then
|
||||||
|
if caSlots == true and caMSGtoGroup == false then
|
||||||
|
if msgTableText.RED then
|
||||||
|
trigger.action.outTextForCoalition(coalition.side.RED, table.concat(msgTableText.RED.text), msgTableText.RED.displayTime, clearView)
|
||||||
|
|
||||||
if caSlots == true and caMSGtoGroup == false then
|
end
|
||||||
if msgTableText.RED then
|
if msgTableText.BLUE then
|
||||||
trigger.action.outTextForCoalition(coalition.side.RED, table.concat(msgTableText.RED.text), msgTableText.RED.displayTime, clearView)
|
trigger.action.outTextForCoalition(coalition.side.BLUE, table.concat(msgTableText.BLUE.text), msgTableText.BLUE.displayTime, clearView)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
if msgTableText.BLUE then
|
|
||||||
trigger.action.outTextForCoalition(coalition.side.BLUE, table.concat(msgTableText.BLUE.text), msgTableText.BLUE.displayTime, clearView)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
for index, msgData in pairs(msgTableText) do
|
for index, msgData in pairs(msgTableText) do
|
||||||
if type(index) == 'number' then -- its a groupNumber
|
if type(index) == 'number' then -- its a groupNumber
|
||||||
trigger.action.outTextForGroup(index, table.concat(msgData.text), msgData.displayTime, clearView)
|
trigger.action.outTextForGroup(index, table.concat(msgData.text), msgData.displayTime, clearView)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
--- new audio
|
--- new audio
|
||||||
@ -6504,6 +6508,9 @@ do -- mist.msg scope
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
anyUpdate = false
|
||||||
|
anySound = false
|
||||||
|
|
||||||
else
|
else
|
||||||
mist.removeFunction(displayFuncId)
|
mist.removeFunction(displayFuncId)
|
||||||
displayActive = false
|
displayActive = false
|
||||||
@ -6764,7 +6771,6 @@ end]]
|
|||||||
messageList[i].displayTill = timer.getTime() + messageList[i].displayTime
|
messageList[i].displayTill = timer.getTime() + messageList[i].displayTime
|
||||||
messageList[i].displayedFor = 0
|
messageList[i].displayedFor = 0
|
||||||
messageList[i].addedAt = timer.getTime()
|
messageList[i].addedAt = timer.getTime()
|
||||||
messageList[i].sound = new.sound
|
|
||||||
messageList[i].text = new.text
|
messageList[i].text = new.text
|
||||||
messageList[i].msgFor = new.msgFor
|
messageList[i].msgFor = new.msgFor
|
||||||
messageList[i].multSound = new.multSound
|
messageList[i].multSound = new.multSound
|
||||||
|
|||||||
@ -35,7 +35,7 @@ mist = {}
|
|||||||
-- don't change these
|
-- don't change these
|
||||||
mist.majorVersion = 4
|
mist.majorVersion = 4
|
||||||
mist.minorVersion = 5
|
mist.minorVersion = 5
|
||||||
mist.build = 107
|
mist.build = 108
|
||||||
|
|
||||||
-- forward declaration of log shorthand
|
-- forward declaration of log shorthand
|
||||||
local log
|
local log
|
||||||
@ -2831,7 +2831,7 @@ function mist.getUnitsByAttribute(att, rnum, id)
|
|||||||
cEntry.country = att.country
|
cEntry.country = att.country
|
||||||
cEntry.coalition = att.coalition
|
cEntry.coalition = att.coalition
|
||||||
cEntry.skill = att.skill
|
cEntry.skill = att.skill
|
||||||
cEntry.categry = att.category
|
cEntry.category = att.category
|
||||||
|
|
||||||
local num = rnum or 1
|
local num = rnum or 1
|
||||||
|
|
||||||
@ -2881,7 +2881,7 @@ function mist.getGroupsByAttribute(att, rnum, id)
|
|||||||
cEntry.country = att.country
|
cEntry.country = att.country
|
||||||
cEntry.coalition = att.coalition
|
cEntry.coalition = att.coalition
|
||||||
cEntry.skill = att.skill
|
cEntry.skill = att.skill
|
||||||
cEntry.categry = att.category
|
cEntry.category = att.category
|
||||||
|
|
||||||
local num = rnum or 1
|
local num = rnum or 1
|
||||||
|
|
||||||
@ -6368,6 +6368,7 @@ do -- mist.msg scope
|
|||||||
local caSlots = false
|
local caSlots = false
|
||||||
local caMSGtoGroup = false
|
local caMSGtoGroup = false
|
||||||
local anyUpdate = false
|
local anyUpdate = false
|
||||||
|
local anySound = false
|
||||||
local lastMessageTime = nil
|
local lastMessageTime = nil
|
||||||
|
|
||||||
if env.mission.groundControl then -- just to be sure?
|
if env.mission.groundControl then -- just to be sure?
|
||||||
@ -6395,7 +6396,7 @@ do -- mist.msg scope
|
|||||||
local clearView = true
|
local clearView = true
|
||||||
if #messageList > 0 then
|
if #messageList > 0 then
|
||||||
--log:warn('Updates: $1', anyUpdate)
|
--log:warn('Updates: $1', anyUpdate)
|
||||||
if anyUpdate == true then
|
if anyUpdate == true or anySound == true then
|
||||||
local activeClients = {}
|
local activeClients = {}
|
||||||
|
|
||||||
for clientId, clientData in pairs(mist.DBs.humansById) do
|
for clientId, clientData in pairs(mist.DBs.humansById) do
|
||||||
@ -6403,7 +6404,7 @@ do -- mist.msg scope
|
|||||||
activeClients[clientData.groupId] = clientData.groupName
|
activeClients[clientData.groupId] = clientData.groupName
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
anyUpdate = false
|
|
||||||
if displayActive == false then
|
if displayActive == false then
|
||||||
displayActive = true
|
displayActive = true
|
||||||
end
|
end
|
||||||
@ -6419,14 +6420,16 @@ do -- mist.msg scope
|
|||||||
if messageData.displayedFor then
|
if messageData.displayedFor then
|
||||||
messageData.displayedFor = curTime - messageData.addedAt
|
messageData.displayedFor = curTime - messageData.addedAt
|
||||||
end
|
end
|
||||||
local nextSound = 1000
|
|
||||||
local soundIndex = 0
|
|
||||||
|
|
||||||
|
local soundIndex = 0
|
||||||
|
local refSound = 100000
|
||||||
if messageData.multSound and #messageData.multSound > 0 then
|
if messageData.multSound and #messageData.multSound > 0 then
|
||||||
|
anySound = true
|
||||||
for index, sData in pairs(messageData.multSound) do
|
for index, sData in pairs(messageData.multSound) do
|
||||||
if sData.time <= messageData.displayedFor and sData.played == false and sData.time < nextSound then -- find index of the next sound to be played
|
if sData.time <= messageData.displayedFor and sData.played == false and sData.time < refSound then -- find index of the next sound to be played
|
||||||
nextSound = sData.time
|
refSound = sData.time
|
||||||
soundIndex = index
|
soundIndex = index
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if soundIndex ~= 0 then
|
if soundIndex ~= 0 then
|
||||||
@ -6471,20 +6474,21 @@ do -- mist.msg scope
|
|||||||
|
|
||||||
end
|
end
|
||||||
------- new display
|
------- new display
|
||||||
|
if anyUpdate == true then
|
||||||
|
if caSlots == true and caMSGtoGroup == false then
|
||||||
|
if msgTableText.RED then
|
||||||
|
trigger.action.outTextForCoalition(coalition.side.RED, table.concat(msgTableText.RED.text), msgTableText.RED.displayTime, clearView)
|
||||||
|
|
||||||
if caSlots == true and caMSGtoGroup == false then
|
end
|
||||||
if msgTableText.RED then
|
if msgTableText.BLUE then
|
||||||
trigger.action.outTextForCoalition(coalition.side.RED, table.concat(msgTableText.RED.text), msgTableText.RED.displayTime, clearView)
|
trigger.action.outTextForCoalition(coalition.side.BLUE, table.concat(msgTableText.BLUE.text), msgTableText.BLUE.displayTime, clearView)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
if msgTableText.BLUE then
|
|
||||||
trigger.action.outTextForCoalition(coalition.side.BLUE, table.concat(msgTableText.BLUE.text), msgTableText.BLUE.displayTime, clearView)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
for index, msgData in pairs(msgTableText) do
|
for index, msgData in pairs(msgTableText) do
|
||||||
if type(index) == 'number' then -- its a groupNumber
|
if type(index) == 'number' then -- its a groupNumber
|
||||||
trigger.action.outTextForGroup(index, table.concat(msgData.text), msgData.displayTime, clearView)
|
trigger.action.outTextForGroup(index, table.concat(msgData.text), msgData.displayTime, clearView)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
--- new audio
|
--- new audio
|
||||||
@ -6504,6 +6508,9 @@ do -- mist.msg scope
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
anyUpdate = false
|
||||||
|
anySound = false
|
||||||
|
|
||||||
else
|
else
|
||||||
mist.removeFunction(displayFuncId)
|
mist.removeFunction(displayFuncId)
|
||||||
displayActive = false
|
displayActive = false
|
||||||
@ -6764,7 +6771,6 @@ end]]
|
|||||||
messageList[i].displayTill = timer.getTime() + messageList[i].displayTime
|
messageList[i].displayTill = timer.getTime() + messageList[i].displayTime
|
||||||
messageList[i].displayedFor = 0
|
messageList[i].displayedFor = 0
|
||||||
messageList[i].addedAt = timer.getTime()
|
messageList[i].addedAt = timer.getTime()
|
||||||
messageList[i].sound = new.sound
|
|
||||||
messageList[i].text = new.text
|
messageList[i].text = new.text
|
||||||
messageList[i].msgFor = new.msgFor
|
messageList[i].msgFor = new.msgFor
|
||||||
messageList[i].multSound = new.multSound
|
messageList[i].multSound = new.multSound
|
||||||
Loading…
x
Reference in New Issue
Block a user