mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-22 06:45:20 +00:00
xxx
This commit is contained in:
@@ -177,40 +177,22 @@ end
|
|||||||
--
|
--
|
||||||
-- -- Send the 2 messages created with the @{New} method to the Client Group.
|
-- -- Send the 2 messages created with the @{New} method to the Client Group.
|
||||||
-- -- Note that the Message of MessageClient2 is overwriting the Message of MessageClient1.
|
-- -- Note that the Message of MessageClient2 is overwriting the Message of MessageClient1.
|
||||||
-- ClientGroup = Group.getByName( "ClientGroup" )
|
-- Client = CLIENT:FindByName("NameOfClientUnit")
|
||||||
--
|
--
|
||||||
-- MessageClient1 = MESSAGE:New( "Congratulations, you've just hit a target", "Score", 25, "Score" ):ToClient( ClientGroup )
|
-- MessageClient1 = MESSAGE:New( "Congratulations, you've just hit a target", "Score", 25, "Score" ):ToClient( Client )
|
||||||
-- MessageClient2 = MESSAGE:New( "Congratulations, you've just killed a target", "Score", 25, "Score" ):ToClient( ClientGroup )
|
-- MessageClient2 = MESSAGE:New( "Congratulations, you've just killed a target", "Score", 25, "Score" ):ToClient( Client )
|
||||||
-- or
|
-- or
|
||||||
-- MESSAGE:New( "Congratulations, you've just hit a target", "Score", 25 ):ToClient( ClientGroup )
|
-- MESSAGE:New( "Congratulations, you've just hit a target", "Score", 25 ):ToClient( Client )
|
||||||
-- MESSAGE:New( "Congratulations, you've just killed a target", "Score", 25 ):ToClient( ClientGroup )
|
-- MESSAGE:New( "Congratulations, you've just killed a target", "Score", 25 ):ToClient( Client )
|
||||||
-- or
|
-- or
|
||||||
-- MessageClient1 = MESSAGE:New( "Congratulations, you've just hit a target", "Score", 25 )
|
-- MessageClient1 = MESSAGE:New( "Congratulations, you've just hit a target", "Score", 25 )
|
||||||
-- MessageClient2 = MESSAGE:New( "Congratulations, you've just killed a target", "Score", 25 )
|
-- MessageClient2 = MESSAGE:New( "Congratulations, you've just killed a target", "Score", 25 )
|
||||||
-- MessageClient1:ToClient( ClientGroup )
|
-- MessageClient1:ToClient( Client )
|
||||||
-- MessageClient2:ToClient( ClientGroup )
|
-- MessageClient2:ToClient( Client )
|
||||||
--
|
--
|
||||||
function MESSAGE:ToClient( Client, Settings )
|
function MESSAGE:ToClient( Client, Settings )
|
||||||
self:F( Client )
|
self:F( Client )
|
||||||
|
self:ToUnit(Client,Settings)
|
||||||
if Client and Client:GetClientGroupID() then
|
|
||||||
|
|
||||||
if self.MessageType then
|
|
||||||
local Settings = Settings or ( Client and _DATABASE:GetPlayerSettings( Client:GetPlayerName() ) ) or _SETTINGS -- Core.Settings#SETTINGS
|
|
||||||
self.MessageDuration = Settings:GetMessageTime( self.MessageType )
|
|
||||||
self.MessageCategory = "" -- self.MessageType .. ": "
|
|
||||||
end
|
|
||||||
|
|
||||||
local Unit = Client:GetClient()
|
|
||||||
|
|
||||||
if self.MessageDuration ~= 0 then
|
|
||||||
local ClientGroupID = Client:GetClientGroupID()
|
|
||||||
self:T( self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$","") .. " / " .. self.MessageDuration )
|
|
||||||
--trigger.action.outTextForGroup( ClientGroupID, self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$",""), self.MessageDuration , self.ClearScreen)
|
|
||||||
trigger.action.outTextForUnit( Unit:GetID(), self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$",""), self.MessageDuration , self.ClearScreen)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -257,6 +239,7 @@ function MESSAGE:ToUnit( Unit, Settings )
|
|||||||
|
|
||||||
if self.MessageDuration ~= 0 then
|
if self.MessageDuration ~= 0 then
|
||||||
self:T( self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$","") .. " / " .. self.MessageDuration )
|
self:T( self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$","") .. " / " .. self.MessageDuration )
|
||||||
|
local ID = Unit:GetID()
|
||||||
trigger.action.outTextForUnit( Unit:GetID(), self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$",""), self.MessageDuration, self.ClearScreen )
|
trigger.action.outTextForUnit( Unit:GetID(), self.MessageCategory .. self.MessageText:gsub("\n$",""):gsub("\n$",""), self.MessageDuration, self.ClearScreen )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2916,7 +2916,7 @@ function ATIS:onafterReport( From, Event, To, Text )
|
|||||||
self:T( "SRS TTS: " .. text )
|
self:T( "SRS TTS: " .. text )
|
||||||
|
|
||||||
-- Play text-to-speech report.
|
-- Play text-to-speech report.
|
||||||
local duration = STTS.getSpeechTime(text,0.95)
|
local duration = MSRS.getSpeechTime(text,0.95)
|
||||||
self.msrsQ:NewTransmission(text,duration,self.msrs,nil,2)
|
self.msrsQ:NewTransmission(text,duration,self.msrs,nil,2)
|
||||||
--self.msrs:PlayText( text )
|
--self.msrs:PlayText( text )
|
||||||
self.SRSText = text
|
self.SRSText = text
|
||||||
|
|||||||
@@ -1626,7 +1626,7 @@ function AWACS:_NewRadioEntry(TextTTS, TextScreen,GID,IsGroup,ToScreen,IsNew,Fro
|
|||||||
RadioEntry.TextScreen = TextScreen or TextTTS
|
RadioEntry.TextScreen = TextScreen or TextTTS
|
||||||
RadioEntry.GroupID = GID
|
RadioEntry.GroupID = GID
|
||||||
RadioEntry.ToScreen = ToScreen
|
RadioEntry.ToScreen = ToScreen
|
||||||
RadioEntry.Duration = STTS.getSpeechTime(TextTTS,0.95,false) or 8
|
RadioEntry.Duration = MSRS.getSpeechTime(TextTTS,0.95,false) or 8
|
||||||
RadioEntry.FromAI = FromAI
|
RadioEntry.FromAI = FromAI
|
||||||
RadioEntry.IsGroup = IsGroup
|
RadioEntry.IsGroup = IsGroup
|
||||||
if Tactical then
|
if Tactical then
|
||||||
|
|||||||
@@ -356,7 +356,7 @@ do -- Text-To-Speech
|
|||||||
local self=BASE:Inherit(self, BASE:New()) -- #SOUNDTEXT
|
local self=BASE:Inherit(self, BASE:New()) -- #SOUNDTEXT
|
||||||
|
|
||||||
self:SetText(Text)
|
self:SetText(Text)
|
||||||
self:SetDuration(Duration or STTS.getSpeechTime(Text))
|
self:SetDuration(Duration or MSRS.getSpeechTime(Text))
|
||||||
--self:SetGender()
|
--self:SetGender()
|
||||||
--self:SetCulture()
|
--self:SetCulture()
|
||||||
|
|
||||||
|
|||||||
@@ -482,6 +482,15 @@ UTILS.BasicSerialize = function(s)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Counts the number of elements in a table.
|
||||||
|
-- @param #table T Table to count
|
||||||
|
-- @return #int Number of elements in the table
|
||||||
|
function UTILS.TableLength(T)
|
||||||
|
local count = 0
|
||||||
|
for _ in pairs(T or {}) do count = count + 1 end
|
||||||
|
return count
|
||||||
|
end
|
||||||
|
|
||||||
--- Print a table to log in a nice format
|
--- Print a table to log in a nice format
|
||||||
-- @param #table table The table to print
|
-- @param #table table The table to print
|
||||||
-- @param #number indent Number of indents
|
-- @param #number indent Number of indents
|
||||||
@@ -496,7 +505,7 @@ function UTILS.PrintTableToLog(table, indent, noprint)
|
|||||||
if not indent then indent = 0 end
|
if not indent then indent = 0 end
|
||||||
for k, v in pairs(table) do
|
for k, v in pairs(table) do
|
||||||
if string.find(k," ") then k='"'..k..'"'end
|
if string.find(k," ") then k='"'..k..'"'end
|
||||||
if type(v) == "table" then
|
if type(v) == "table" and UTILS.TableLength(v) > 0 then
|
||||||
if not noprint then
|
if not noprint then
|
||||||
env.info(string.rep(" ", indent) .. tostring(k) .. " = {")
|
env.info(string.rep(" ", indent) .. tostring(k) .. " = {")
|
||||||
end
|
end
|
||||||
@@ -3676,14 +3685,6 @@ function table.index_of(table, element)
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Counts the number of elements in a table.
|
|
||||||
-- @param #table T Table to count
|
|
||||||
-- @return #int Number of elements in the table
|
|
||||||
function table.length(T)
|
|
||||||
local count = 0
|
|
||||||
for _ in pairs(T) do count = count + 1 end
|
|
||||||
return count
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Slices a table between two indices, much like Python's my_list[2:-1]
|
--- Slices a table between two indices, much like Python's my_list[2:-1]
|
||||||
-- @param #table tbl Table to slice
|
-- @param #table tbl Table to slice
|
||||||
|
|||||||
Reference in New Issue
Block a user