Updated Client Message Bugs

This commit is contained in:
svenvandevelde 2015-11-01 16:20:55 +01:00
parent 0b04561a33
commit 0894d4ee40
5 changed files with 39 additions and 14 deletions

View File

@ -68,10 +68,12 @@ end
-- @treturn Group -- @treturn Group
function CLIENT:ClientGroup() function CLIENT:ClientGroup()
--trace.f(self.ClassName) --trace.f(self.ClassName)
local ReturnGroup = Group.getByName( self.ClientName ) local ClientData = Group.getByName( self.ClientName )
if ReturnGroup and ReturnGroup:isExist() then if ClientData and ClientData:isExist() then
return ReturnGroup trace.i( self.ClassName, self.ClientName .. " : group found!" )
return ClientData
else else
-- trace.x( self.ClassName, self.ClientName .. " : no group found!" )
return nil return nil
end end
end end
@ -218,14 +220,14 @@ trace.f( self.ClassName, { Message, MessageDuration, MessageId, MessageCategory,
self.Messages[MessageId].MessageTime = timer.getTime() self.Messages[MessageId].MessageTime = timer.getTime()
self.Messages[MessageId].MessageDuration = MessageDuration self.Messages[MessageId].MessageDuration = MessageDuration
if MessageInterval == nil then if MessageInterval == nil then
self.Messages[MessageId].MessageInterval = 300 self.Messages[MessageId].MessageInterval = 600
else else
self.Messages[MessageId].MessageInterval = MessageInterval self.Messages[MessageId].MessageInterval = MessageInterval
end end
MESSAGE:New( Message, MessageCategory, MessageDuration, MessageId ):ToClient( self ) MESSAGE:New( Message, MessageCategory, MessageDuration, MessageId ):ToClient( self )
else else
if self:ClientGroup() and self:ClientGroup():getUnits() and self:ClientGroup():getUnits()[1] and not self:ClientGroup():getUnits()[1]:inAir() then if self:ClientGroup() and self:ClientGroup():getUnits() and self:ClientGroup():getUnits()[1] and not self:ClientGroup():getUnits()[1]:inAir() then
if timer.getTime() - self.Messages[MessageId].MessageTime >= self.Messages[MessageId].MessageDuration - 1 then if timer.getTime() - self.Messages[MessageId].MessageTime >= self.Messages[MessageId].MessageDuration + 10 then
MESSAGE:New( Message, MessageCategory, MessageDuration, MessageId ):ToClient( self ) MESSAGE:New( Message, MessageCategory, MessageDuration, MessageId ):ToClient( self )
self.Messages[MessageId].MessageTime = timer.getTime() self.Messages[MessageId].MessageTime = timer.getTime()
end end

View File

@ -26,7 +26,7 @@ trace.f(self.ClassName)
if Valid then if Valid then
Child.Name = 'Deploy Cargo' Child.Name = 'Deploy Cargo'
Child.TaskBriefing = "Task: Fly to one of the indicated landing zones and deploy " .. CargoType.TEXT .. ". Your co-pilot will provide you with the directions (required flight angle in degrees) and the distance (in km) to the deployment zone." Child.TaskBriefing = "Fly to one of the indicated landing zones and deploy " .. CargoType.TEXT .. ". Your co-pilot will provide you with the directions (required flight angle in degrees) and the distance (in km) to the deployment zone."
if type( LandingZones ) == "table" then if type( LandingZones ) == "table" then
Child.LandingZones = LandingZones Child.LandingZones = LandingZones
else else

View File

@ -76,8 +76,9 @@ trace.f(self.ClassName )
if Client and Client:ClientGroup() then if Client and Client:ClientGroup() then
local ClientGroupName = Client:ClientGroup():getName() local ClientGroup = Client:ClientGroup()
trigger.action.outTextForGroup( Group.getByName(ClientGroupName):getID(), self.MessageCategory .. '\n' .. self.MessageText:gsub("\n$",""):gsub("\n$",""), self.MessageDuration ) trace.i( self.ClassName, self.MessageCategory .. '\n' .. self.MessageText:gsub("\n$",""):gsub("\n$","") .. " / " .. self.MessageDuration )
trigger.action.outTextForGroup( ClientGroup:getID(), self.MessageCategory .. '\n' .. self.MessageText:gsub("\n$",""):gsub("\n$",""), self.MessageDuration )
end end
return self return self
@ -98,6 +99,7 @@ function MESSAGE:ToCoalition( CoalitionSide )
trace.f(self.ClassName ) trace.f(self.ClassName )
if CoalitionSide then if CoalitionSide then
trace.i(self.ClassName, self.MessageCategory .. '\n' .. self.MessageText:gsub("\n$",""):gsub("\n$","") .. " / " .. self.MessageDuration )
trigger.action.outTextForCoalition( CoalitionSide, self.MessageCategory .. '\n' .. self.MessageText:gsub("\n$",""):gsub("\n$",""), self.MessageDuration ) trigger.action.outTextForCoalition( CoalitionSide, self.MessageCategory .. '\n' .. self.MessageText:gsub("\n$",""):gsub("\n$",""), self.MessageDuration )
end end

View File

@ -59,7 +59,7 @@ STAGEBRIEF = {
MSG = { ID = "Brief", TIME = 30 }, MSG = { ID = "Brief", TIME = 30 },
Name = "Brief", Name = "Brief",
StageBriefingTime = 0, StageBriefingTime = 0,
StageBriefingDuration = 10 StageBriefingDuration = 30
} }
function STAGEBRIEF:New() function STAGEBRIEF:New()
@ -97,7 +97,7 @@ STAGESTART = {
MSG = { ID = "Start", TIME = 30 }, MSG = { ID = "Start", TIME = 30 },
Name = "Start", Name = "Start",
StageStartTime = 0, StageStartTime = 0,
StageStartDuration = 10 StageStartDuration = 30
} }
function STAGESTART:New() function STAGESTART:New()
@ -137,7 +137,7 @@ end
STAGEROUTE = { STAGEROUTE = {
ClassName = "STAGEROUTE", ClassName = "STAGEROUTE",
MSG = { ID = "Route", TIME = 5 }, MSG = { ID = "Route", TIME = 1 },
Frequency = STAGE.FREQUENCY.REPEAT, Frequency = STAGE.FREQUENCY.REPEAT,
Name = "Route" Name = "Route"
} }
@ -163,7 +163,7 @@ trace.f(self.ClassName)
end end
Client:Message( RouteMessage, self.MSG.TIME, Mission.Name .. "/StageRoute", "Co-Pilot: Route", 10 ) Client:Message( RouteMessage, self.MSG.TIME, Mission.Name .. "/StageRoute", "Co-Pilot: Route", 10 )
else else
Client:Message( "Fly to " .. Task.LandingZones .. ' at ' .. routines.getBRStringZone( { zone = Task.LandingZones, ref = Client:ClientGroup():getUnit(1):getPoint(), true, true } ) .. ' km. ', self.MSG.TIME, Mission.Name .. "/StageRoute", "Co-Pilot: Route", 10 ) Client:Message( "Fly to " .. Task.LandingZones .. ' at ' .. routines.getBRStringZone( { zone = Task.LandingZones, ref = Client:ClientGroup():getUnit(1):getPoint(), true, true } ) .. ' km. ', self.MSG.TIME, Mission.Name .. "/StageRoute", "Co-Pilot: Route", 1 )
end end
if Client:IsTransport() then if Client:IsTransport() then
Client:ShowCargo() Client:ShowCargo()

View File

@ -6,10 +6,14 @@ trace = {}
trace.names = {} trace.names = {}
trace.scheduledfunction = "" trace.scheduledfunction = ""
trace.names.all = true trace.names.all = false
trace.names.New = false trace.names.New = false
trace.names.Inherit = false trace.names.Inherit = false
trace.names.do_scheduled_functions = false --trace.names.ClientGroup = true
trace.names.Scheduler = true
trace.names.ToCoalition = true
trace.names.ToClient = true
trace.names.do_scheduled_functions = true
trace.names.main = false trace.names.main = false
trace.names.Meta = false trace.names.Meta = false
trace.names.mistdisplayV3 = false trace.names.mistdisplayV3 = false
@ -259,3 +263,20 @@ trace.i = function(object, variable)
end end
end end
trace.x = function( object, variable )
local info = debug.getinfo( 2, "nl" )
trace.nametrace = info.name
local objecttrace = ""
if object then
objecttrace = object
end
local variabletrace = ""
if variable then
variabletrace = "( " .. routines.utils.oneLineSerialize( variable ) .. " )"
end
env.info( string.format( "%6d/%1s:%20s.%s" , info.currentline, "I", objecttrace, trace.nametrace .. variabletrace) )
end