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

View File

@ -26,7 +26,7 @@ trace.f(self.ClassName)
if Valid then
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
Child.LandingZones = LandingZones
else

View File

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

View File

@ -59,7 +59,7 @@ STAGEBRIEF = {
MSG = { ID = "Brief", TIME = 30 },
Name = "Brief",
StageBriefingTime = 0,
StageBriefingDuration = 10
StageBriefingDuration = 30
}
function STAGEBRIEF:New()
@ -97,7 +97,7 @@ STAGESTART = {
MSG = { ID = "Start", TIME = 30 },
Name = "Start",
StageStartTime = 0,
StageStartDuration = 10
StageStartDuration = 30
}
function STAGESTART:New()
@ -137,7 +137,7 @@ end
STAGEROUTE = {
ClassName = "STAGEROUTE",
MSG = { ID = "Route", TIME = 5 },
MSG = { ID = "Route", TIME = 1 },
Frequency = STAGE.FREQUENCY.REPEAT,
Name = "Route"
}
@ -163,7 +163,7 @@ trace.f(self.ClassName)
end
Client:Message( RouteMessage, self.MSG.TIME, Mission.Name .. "/StageRoute", "Co-Pilot: Route", 10 )
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
if Client:IsTransport() then
Client:ShowCargo()

View File

@ -6,10 +6,14 @@ trace = {}
trace.names = {}
trace.scheduledfunction = ""
trace.names.all = true
trace.names.all = false
trace.names.New = 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.Meta = false
trace.names.mistdisplayV3 = false
@ -259,3 +263,20 @@ trace.i = function(object, variable)
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