mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Changes of loading and cleanup.
Added dynamic and static loading strategies for MOOSE of a mission file.
This commit is contained in:
parent
0fb88e2bab
commit
ecf80e5209
@ -1,22 +1,13 @@
|
|||||||
|
|
||||||
local base = _G
|
local base = _G
|
||||||
|
|
||||||
env.info("Loading MOOSE " .. base.timer.getAbsTime() )
|
env.info("Loading MOOSE " .. base.timer.getAbsTime() )
|
||||||
|
|
||||||
function script_path()
|
|
||||||
local str = debug.getinfo(2, "S").source
|
|
||||||
return str:match("(.*/)"):sub(1,-2)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
Include = {}
|
Include = {}
|
||||||
|
|
||||||
Include.MissionPath = script_path() .. "Mission/"
|
Include.Path = function()
|
||||||
Include.ProgramPath = "Scripts/Moose/Moose/"
|
local str = debug.getinfo(2, "S").source
|
||||||
|
return str:match("(.*/)"):sub(1,-2):gsub("\\","/")
|
||||||
env.info( "Include.MissionPath = " .. Include.MissionPath)
|
end
|
||||||
env.info( "Include.ProgramPath = " .. Include.ProgramPath)
|
|
||||||
Include.Files = {}
|
|
||||||
|
|
||||||
Include.File = function( IncludeFile )
|
Include.File = function( IncludeFile )
|
||||||
if not Include.Files[ IncludeFile ] then
|
if not Include.Files[ IncludeFile ] then
|
||||||
@ -39,6 +30,14 @@ Include.File = function( IncludeFile )
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Include.ProgramPath = "Scripts/Moose/Moose/"
|
||||||
|
Include.MissionPath = Include.Path()
|
||||||
|
|
||||||
|
env.info( "Include.ProgramPath = " .. Include.ProgramPath)
|
||||||
|
env.info( "Include.MissionPath = " .. Include.MissionPath)
|
||||||
|
|
||||||
|
Include.Files = {}
|
||||||
|
|
||||||
Include.File( "Database" )
|
Include.File( "Database" )
|
||||||
|
|
||||||
env.info("Loaded MOOSE Include Engine")
|
env.info("Loaded MOOSE Include Engine")
|
||||||
23
Loaders/Moose_Load_Embedded.lua
Normal file
23
Loaders/Moose_Load_Embedded.lua
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
|
||||||
|
local base = _G
|
||||||
|
env.info("Loading MOOSE " .. base.timer.getAbsTime() )
|
||||||
|
|
||||||
|
Include = {}
|
||||||
|
|
||||||
|
Include.Path = function()
|
||||||
|
local str = debug.getinfo(2, "S").source
|
||||||
|
return str:match("(.*/)"):sub(1,-2):gsub("\\","/")
|
||||||
|
end
|
||||||
|
|
||||||
|
Include.File = function( IncludeFile )
|
||||||
|
end
|
||||||
|
|
||||||
|
Include.ProgramPath = "Scripts/Moose/Moose/"
|
||||||
|
Include.MissionPath = Include.Path()
|
||||||
|
|
||||||
|
env.info( "Include.ProgramPath = " .. Include.ProgramPath)
|
||||||
|
env.info( "Include.MissionPath = " .. Include.MissionPath)
|
||||||
|
|
||||||
|
Include.Files = {}
|
||||||
|
|
||||||
|
env.info("Loaded MOOSE Include Engine")
|
||||||
159
Loaders/Moose_Test.lua
Normal file
159
Loaders/Moose_Test.lua
Normal file
@ -0,0 +1,159 @@
|
|||||||
|
|
||||||
|
local base = _G
|
||||||
|
|
||||||
|
local MOOSE_Version = "0.1.1.1"
|
||||||
|
|
||||||
|
env.info("Loading MOOSE " .. base.timer.getAbsTime() )
|
||||||
|
|
||||||
|
function script_path()
|
||||||
|
local str = debug.getinfo(2, "S").source
|
||||||
|
return str:match("(.*/)"):sub(1,-2):gsub("\\","/")
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
Include = {}
|
||||||
|
|
||||||
|
Include.ProgramPath = "Scripts/Moose/Moose/"
|
||||||
|
Include.MissionPath = script_path()
|
||||||
|
|
||||||
|
env.info( "Include.ProgramPath = " .. Include.ProgramPath)
|
||||||
|
env.info( "Include.MissionPath = " .. Include.MissionPath)
|
||||||
|
Include.Files = {}
|
||||||
|
|
||||||
|
Include.FileIn = function(fileName, table)
|
||||||
|
-- env.info( fileName )
|
||||||
|
local chunk, errMsg = base.loadfile(fileName)
|
||||||
|
if chunk ~= nil then
|
||||||
|
env.info( "chunk assigned " )
|
||||||
|
env.info( Include.oneLineSerialize( chunk ) )
|
||||||
|
base.setfenv(chunk, table)
|
||||||
|
chunk()
|
||||||
|
if table.MOOSE_Version then
|
||||||
|
env.info( table.MOOSE_Version )
|
||||||
|
end
|
||||||
|
return chunk
|
||||||
|
else
|
||||||
|
return nil, errMsg
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
Include.MisFiles = {}
|
||||||
|
|
||||||
|
Include.FileName = function( num )
|
||||||
|
local hexstr = '0123456789ABCDEF'
|
||||||
|
local s = ''
|
||||||
|
while num > 0 do
|
||||||
|
local mod = math.fmod(num, 16)
|
||||||
|
s = string.sub(hexstr, mod+1, mod+1) .. s
|
||||||
|
num = math.floor(num / 16)
|
||||||
|
end
|
||||||
|
if s == '' then s = '0' end
|
||||||
|
-- env.info( string.format( "~mis" .. "%8s", "00000000" .. s ) )
|
||||||
|
return string.format( "~mis" .. "%s", string.sub( "00000000" .. s, -8 ) )
|
||||||
|
end
|
||||||
|
|
||||||
|
Include.ScanFiles = function()
|
||||||
|
|
||||||
|
local i = 0
|
||||||
|
while i <= 32767 do
|
||||||
|
local FileName = Include.FileName( i )
|
||||||
|
local FileChunk = {}
|
||||||
|
local FileChunk = Include.FileIn( Include.MissionPath .. FileName, FileChunk )
|
||||||
|
if FileChunk then
|
||||||
|
end
|
||||||
|
i = i + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
Include.File = function( IncludeFile )
|
||||||
|
if not Include.Files[ IncludeFile ] then
|
||||||
|
Include.Files[IncludeFile] = IncludeFile
|
||||||
|
env.info( "Include:" .. IncludeFile .. " from " .. Include.ProgramPath )
|
||||||
|
local f = base.loadfile( Include.ProgramPath .. IncludeFile .. ".lua" )
|
||||||
|
if f == nil then
|
||||||
|
env.info( "Include:" .. IncludeFile .. " from " .. Include.MissionPath )
|
||||||
|
local f = base.loadfile( Include.MissionPath .. IncludeFile .. ".lua" )
|
||||||
|
if f == nil then
|
||||||
|
error ("Could not load MOOSE file " .. IncludeFile .. ".lua" )
|
||||||
|
else
|
||||||
|
env.info( "Include:" .. IncludeFile .. " loaded from " .. Include.MissionPath )
|
||||||
|
return f()
|
||||||
|
end
|
||||||
|
else
|
||||||
|
env.info( "Include:" .. IncludeFile .. " loaded from " .. Include.ProgramPath )
|
||||||
|
return f()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--porting in Slmod's "safestring" basic serialize
|
||||||
|
Include.basicSerialize = function(s)
|
||||||
|
if s == nil then
|
||||||
|
return "\"\""
|
||||||
|
else
|
||||||
|
if ((type(s) == 'number') or (type(s) == 'boolean') or (type(s) == 'function') or (type(s) == 'table') or (type(s) == 'userdata') ) then
|
||||||
|
return tostring(s)
|
||||||
|
elseif type(s) == 'string' then
|
||||||
|
s = string.format('%q', s)
|
||||||
|
return s
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- porting in Slmod's serialize_slmod2
|
||||||
|
Include.oneLineSerialize = function(tbl) -- serialization of a table all on a single line, no comments, made to replace old get_table_string function
|
||||||
|
if type(tbl) == 'table' then --function only works for tables!
|
||||||
|
|
||||||
|
local tbl_str = {}
|
||||||
|
|
||||||
|
tbl_str[#tbl_str + 1] = '{'
|
||||||
|
|
||||||
|
for ind,val in pairs(tbl) do -- serialize its fields
|
||||||
|
if type(ind) == "number" then
|
||||||
|
tbl_str[#tbl_str + 1] = '['
|
||||||
|
tbl_str[#tbl_str + 1] = tostring(ind)
|
||||||
|
tbl_str[#tbl_str + 1] = ']='
|
||||||
|
else --must be a string
|
||||||
|
tbl_str[#tbl_str + 1] = '['
|
||||||
|
tbl_str[#tbl_str + 1] = Include.basicSerialize(ind)
|
||||||
|
tbl_str[#tbl_str + 1] = ']='
|
||||||
|
end
|
||||||
|
|
||||||
|
if ((type(val) == 'number') or (type(val) == 'boolean')) then
|
||||||
|
tbl_str[#tbl_str + 1] = tostring(val)
|
||||||
|
tbl_str[#tbl_str + 1] = ','
|
||||||
|
elseif type(val) == 'string' then
|
||||||
|
tbl_str[#tbl_str + 1] = Include.basicSerialize(val)
|
||||||
|
tbl_str[#tbl_str + 1] = ','
|
||||||
|
elseif type(val) == 'nil' then -- won't ever happen, right?
|
||||||
|
tbl_str[#tbl_str + 1] = 'nil,'
|
||||||
|
elseif type(val) == 'table' then
|
||||||
|
if ind == "__index" then
|
||||||
|
tbl_str[#tbl_str + 1] = "__index"
|
||||||
|
tbl_str[#tbl_str + 1] = ',' --I think this is right, I just added it
|
||||||
|
else
|
||||||
|
tbl_str[#tbl_str + 1] = Include.oneLineSerialize(val)
|
||||||
|
tbl_str[#tbl_str + 1] = ',' --I think this is right, I just added it
|
||||||
|
end
|
||||||
|
elseif type(val) == 'function' then
|
||||||
|
tbl_str[#tbl_str + 1] = "function " .. tostring(ind)
|
||||||
|
tbl_str[#tbl_str + 1] = ',' --I think this is right, I just added it
|
||||||
|
else
|
||||||
|
env.info('unable to serialize value type ' .. Include.basicSerialize(type(val)) .. ' at index ' .. tostring(ind))
|
||||||
|
env.info( debug.traceback() )
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
tbl_str[#tbl_str + 1] = '}'
|
||||||
|
return table.concat(tbl_str)
|
||||||
|
else
|
||||||
|
return tostring(tbl)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
Include.ScanFiles( )
|
||||||
|
|
||||||
|
Include.File( "Database" )
|
||||||
|
|
||||||
|
env.info("Loaded MOOSE Include Engine")
|
||||||
@ -7,9 +7,9 @@ Include.File( "Routines" )
|
|||||||
BASE = {
|
BASE = {
|
||||||
|
|
||||||
ClassName = "BASE",
|
ClassName = "BASE",
|
||||||
|
TraceOn = false,
|
||||||
ClassID = 0,
|
ClassID = 0,
|
||||||
Events = {}
|
Events = {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
--- The base constructor. This is the top top class of all classed defined within the MOOSE.
|
--- The base constructor. This is the top top class of all classed defined within the MOOSE.
|
||||||
@ -188,3 +188,22 @@ function BASE:onEvent(event)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Trace section
|
||||||
|
|
||||||
|
|
||||||
|
function BASE:T( Arguments )
|
||||||
|
|
||||||
|
if BASE.TraceOn then
|
||||||
|
|
||||||
|
local DebugInfo = debug.getinfo( 2, "nl" )
|
||||||
|
|
||||||
|
local Function = "function"
|
||||||
|
if DebugInfo.name then
|
||||||
|
Function = DebugInfo.name
|
||||||
|
end
|
||||||
|
|
||||||
|
local Line = DebugInfo.currentline
|
||||||
|
|
||||||
|
env.info( string.format( "%6d/%1s:%20s.%s\(%s\)" , Line, "T", self.ClassName, Function .. routines.utils.oneLineSerialize( Arguments ) ) )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|||||||
@ -1,50 +0,0 @@
|
|||||||
--- Bug Client Activation Multiplayer Classes
|
|
||||||
-- @classmod CLIENTBUG
|
|
||||||
|
|
||||||
Include.File( "Routines" )
|
|
||||||
Include.File( "Base" )
|
|
||||||
|
|
||||||
|
|
||||||
CLIENTBUG = {
|
|
||||||
ClassName = "CLIENTBUG",
|
|
||||||
}
|
|
||||||
|
|
||||||
function CLIENTBUG:New( )
|
|
||||||
trace.f( self.ClassName )
|
|
||||||
|
|
||||||
-- Arrange meta tables
|
|
||||||
local self = BASE:Inherit( self, BASE:New() )
|
|
||||||
|
|
||||||
self.ActiveClients = {}
|
|
||||||
|
|
||||||
self.ClientBugWorkaround = routines.scheduleFunction( self._ClientBugWorkaround, { self }, timer.getTime() + 1, 0.1 )
|
|
||||||
|
|
||||||
return self
|
|
||||||
end
|
|
||||||
|
|
||||||
function CLIENTBUG:_ClientBugWorkaround()
|
|
||||||
|
|
||||||
-- Get the units of the players
|
|
||||||
local CoalitionsData = { AlivePlayersRed = coalition.getPlayers( coalition.side.RED ), AlivePlayersBlue = coalition.getPlayers( coalition.side.BLUE ) }
|
|
||||||
|
|
||||||
for CoalitionId, CoalitionData in pairs( CoalitionsData ) do
|
|
||||||
trace.i( self.ClassName, CoalitionData )
|
|
||||||
|
|
||||||
for UnitId, UnitData in pairs( CoalitionData ) do
|
|
||||||
trace.i( self.ClassName, UnitData )
|
|
||||||
|
|
||||||
if UnitData and UnitData:isExist() then
|
|
||||||
|
|
||||||
local UnitSkill = _Database.Units[UnitData:getName()].Template.skill
|
|
||||||
trace.i( self.ClassName, "UnitSkill = " .. UnitSkill )
|
|
||||||
|
|
||||||
if UnitSkill == "Client" then
|
|
||||||
|
|
||||||
-- Generate birth event
|
|
||||||
self:CreateEventBirth( 0, UnitData, UnitData:getName(), 0, 0 )
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
@ -31,12 +31,11 @@ MISSION = {
|
|||||||
|
|
||||||
|
|
||||||
function MISSION:Meta()
|
function MISSION:Meta()
|
||||||
trace.f(self.ClassName)
|
|
||||||
|
|
||||||
-- Arrange meta tables
|
local self = BASE:Inherit( self, BASE:New() )
|
||||||
local Child = BASE:Inherit( self, BASE:New() )
|
self:T()
|
||||||
trace.r( self.ClassName, "", { Child } )
|
|
||||||
return Child
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- This is the main MISSION declaration method. Each Mission is like the master or a Mission orchestration between, Clients, Tasks, Stages etc.
|
--- This is the main MISSION declaration method. Each Mission is like the master or a Mission orchestration between, Clients, Tasks, Stages etc.
|
||||||
@ -56,8 +55,9 @@ end
|
|||||||
-- local Mission = MISSIONSCHEDULER.AddMission( 'NATO Sling Load', 'Operational', 'Fly to the cargo pickup zone at Dzegvi or Kaspi, and sling the cargo to Soganlug airbase.', 'NATO' )
|
-- local Mission = MISSIONSCHEDULER.AddMission( 'NATO Sling Load', 'Operational', 'Fly to the cargo pickup zone at Dzegvi or Kaspi, and sling the cargo to Soganlug airbase.', 'NATO' )
|
||||||
-- local Mission = MISSIONSCHEDULER.AddMission( 'Rescue secret agent', 'Tactical', 'In order to be in full control of the situation, we need you to rescue a secret agent from the woods behind enemy lines. Avoid the Russian defenses and rescue the agent. Keep south until Khasuri, and keep your eyes open for any SAM presence. The agent is located at waypoint 4 on your kneeboard.', 'NATO' )
|
-- local Mission = MISSIONSCHEDULER.AddMission( 'Rescue secret agent', 'Tactical', 'In order to be in full control of the situation, we need you to rescue a secret agent from the woods behind enemy lines. Avoid the Russian defenses and rescue the agent. Keep south until Khasuri, and keep your eyes open for any SAM presence. The agent is located at waypoint 4 on your kneeboard.', 'NATO' )
|
||||||
function MISSION:New( MissionName, MissionPriority, MissionBriefing, MissionCoalition )
|
function MISSION:New( MissionName, MissionPriority, MissionBriefing, MissionCoalition )
|
||||||
trace.f(self.ClassName, { MissionName, MissionPriority, MissionBriefing, MissionCoalition } )
|
|
||||||
self = MISSION:Meta()
|
self = MISSION:Meta()
|
||||||
|
self:T({ MissionName, MissionPriority, MissionBriefing, MissionCoalition })
|
||||||
|
|
||||||
local Valid = true
|
local Valid = true
|
||||||
|
|
||||||
@ -73,20 +73,19 @@ trace.f(self.ClassName, { MissionName, MissionPriority, MissionBriefing, Mission
|
|||||||
self.MissionCoalition = MissionCoalition
|
self.MissionCoalition = MissionCoalition
|
||||||
end
|
end
|
||||||
|
|
||||||
trace.r( self.ClassName, "" )
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Returns if a Mission has completed.
|
--- Returns if a Mission has completed.
|
||||||
-- @treturn bool
|
-- @treturn bool
|
||||||
function MISSION:IsCompleted()
|
function MISSION:IsCompleted()
|
||||||
trace.f(self.ClassName)
|
self:T()
|
||||||
return self.MissionStatus == "ACCOMPLISHED"
|
return self.MissionStatus == "ACCOMPLISHED"
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Set a Mission to completed.
|
--- Set a Mission to completed.
|
||||||
function MISSION:Completed()
|
function MISSION:Completed()
|
||||||
trace.f(self.ClassName)
|
self:T()
|
||||||
self.MissionStatus = "ACCOMPLISHED"
|
self.MissionStatus = "ACCOMPLISHED"
|
||||||
self:StatusToClients()
|
self:StatusToClients()
|
||||||
end
|
end
|
||||||
@ -94,13 +93,13 @@ end
|
|||||||
--- Returns if a Mission is ongoing.
|
--- Returns if a Mission is ongoing.
|
||||||
-- treturn bool
|
-- treturn bool
|
||||||
function MISSION:IsOngoing()
|
function MISSION:IsOngoing()
|
||||||
trace.f(self.ClassName)
|
self:T()
|
||||||
return self.MissionStatus == "ONGOING"
|
return self.MissionStatus == "ONGOING"
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Set a Mission to ongoing.
|
--- Set a Mission to ongoing.
|
||||||
function MISSION:Ongoing()
|
function MISSION:Ongoing()
|
||||||
trace.f(self.ClassName)
|
self:T()
|
||||||
self.MissionStatus = "ONGOING"
|
self.MissionStatus = "ONGOING"
|
||||||
--self:StatusToClients()
|
--self:StatusToClients()
|
||||||
end
|
end
|
||||||
@ -108,13 +107,13 @@ end
|
|||||||
--- Returns if a Mission is pending.
|
--- Returns if a Mission is pending.
|
||||||
-- treturn bool
|
-- treturn bool
|
||||||
function MISSION:IsPending()
|
function MISSION:IsPending()
|
||||||
trace.f(self.ClassName)
|
self:T()
|
||||||
return self.MissionStatus == "PENDING"
|
return self.MissionStatus == "PENDING"
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Set a Mission to pending.
|
--- Set a Mission to pending.
|
||||||
function MISSION:Pending()
|
function MISSION:Pending()
|
||||||
trace.f(self.ClassName)
|
self:T()
|
||||||
self.MissionStatus = "PENDING"
|
self.MissionStatus = "PENDING"
|
||||||
self:StatusToClients()
|
self:StatusToClients()
|
||||||
end
|
end
|
||||||
@ -122,31 +121,31 @@ end
|
|||||||
--- Returns if a Mission has failed.
|
--- Returns if a Mission has failed.
|
||||||
-- treturn bool
|
-- treturn bool
|
||||||
function MISSION:IsFailed()
|
function MISSION:IsFailed()
|
||||||
trace.f(self.ClassName)
|
self:T()
|
||||||
return self.MissionStatus == "FAILED"
|
return self.MissionStatus == "FAILED"
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Set a Mission to failed.
|
--- Set a Mission to failed.
|
||||||
function MISSION:Failed()
|
function MISSION:Failed()
|
||||||
trace.f(self.ClassName)
|
self:T()
|
||||||
self.MissionStatus = "FAILED"
|
self.MissionStatus = "FAILED"
|
||||||
self:StatusToClients()
|
self:StatusToClients()
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Send the status of the MISSION to all Clients.
|
--- Send the status of the MISSION to all Clients.
|
||||||
function MISSION:StatusToClients()
|
function MISSION:StatusToClients()
|
||||||
trace.f(self.ClassName)
|
self:T()
|
||||||
if self.MissionReportFlash then
|
if self.MissionReportFlash then
|
||||||
for ClientID, Client in pairs( self._Clients ) do
|
for ClientID, Client in pairs( self._Clients ) do
|
||||||
Client:Message( self.MissionCoalition .. ' "' .. self.Name .. '": ' .. self.MissionStatus .. '! ( ' .. self.MissionPriority .. ' mission ) ', 10, self.Name .. '/Status', "Mission Command: Mission Status")
|
Client:Message( self.MissionCoalition .. ' "' .. self.Name .. '": ' .. self.MissionStatus .. '! ( ' .. self.MissionPriority .. ' mission ) ', 10, self.Name .. '/Status', "Mission Command: Mission Status")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
trace.e()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Handles the reporting. After certain time intervals, a MISSION report MESSAGE will be shown to All Players.
|
--- Handles the reporting. After certain time intervals, a MISSION report MESSAGE will be shown to All Players.
|
||||||
function MISSION:ReportTrigger()
|
function MISSION:ReportTrigger()
|
||||||
trace.f(self.ClassName)
|
self:T()
|
||||||
|
|
||||||
if self.MissionReportShow == true then
|
if self.MissionReportShow == true then
|
||||||
self.MissionReportShow = false
|
self.MissionReportShow = false
|
||||||
trace.r( "MISSION", "1", { true } )
|
trace.r( "MISSION", "1", { true } )
|
||||||
@ -171,7 +170,8 @@ end
|
|||||||
|
|
||||||
--- Report the status of all MISSIONs to all active Clients.
|
--- Report the status of all MISSIONs to all active Clients.
|
||||||
function MISSION:ReportToAll()
|
function MISSION:ReportToAll()
|
||||||
trace.f(self.ClassName)
|
self:T()
|
||||||
|
|
||||||
local AlivePlayers = ''
|
local AlivePlayers = ''
|
||||||
for ClientID, Client in pairs( self._Clients ) do
|
for ClientID, Client in pairs( self._Clients ) do
|
||||||
if Client:ClientGroup() then
|
if Client:ClientGroup() then
|
||||||
@ -192,7 +192,6 @@ trace.f(self.ClassName)
|
|||||||
TaskText = TaskText .. " - Task " .. TaskID .. ": " .. TaskData.Name .. ": " .. TaskData:GetGoalProgress() .. "\n"
|
TaskText = TaskText .. " - Task " .. TaskID .. ": " .. TaskData.Name .. ": " .. TaskData:GetGoalProgress() .. "\n"
|
||||||
end
|
end
|
||||||
MESSAGE:New( self.MissionCoalition .. ' "' .. self.Name .. '": ' .. self.MissionStatus .. ' ( ' .. self.MissionPriority .. ' mission )' .. AlivePlayers .. "\n" .. TaskText:gsub("\n$",""), "Mission Command: Mission Report", 10, self.Name .. '/Status'):ToAll()
|
MESSAGE:New( self.MissionCoalition .. ' "' .. self.Name .. '": ' .. self.MissionStatus .. ' ( ' .. self.MissionPriority .. ' mission )' .. AlivePlayers .. "\n" .. TaskText:gsub("\n$",""), "Mission Command: Mission Report", 10, self.Name .. '/Status'):ToAll()
|
||||||
trace.e()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -233,16 +232,15 @@ end
|
|||||||
-- local Mission = MISSIONSCHEDULER.AddMission( 'NATO Transport Troops', 'Operational', 'Transport 3 groups of air defense engineers from our barracks "Gold" and "Titan" to each patriot battery control center to activate our air defenses.', 'NATO' )
|
-- local Mission = MISSIONSCHEDULER.AddMission( 'NATO Transport Troops', 'Operational', 'Transport 3 groups of air defense engineers from our barracks "Gold" and "Titan" to each patriot battery control center to activate our air defenses.', 'NATO' )
|
||||||
-- Mission:AddGoalFunction( DeployPatriotTroopsGoal )
|
-- Mission:AddGoalFunction( DeployPatriotTroopsGoal )
|
||||||
function MISSION:AddGoalFunction( GoalFunction )
|
function MISSION:AddGoalFunction( GoalFunction )
|
||||||
trace.f(self.ClassName)
|
self:T()
|
||||||
self.GoalFunction = GoalFunction
|
self.GoalFunction = GoalFunction
|
||||||
trace.e()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Show the briefing of the MISSION to the CLIENT.
|
--- Show the briefing of the MISSION to the CLIENT.
|
||||||
-- @tparam CLIENT Client to show briefing to.
|
-- @tparam CLIENT Client to show briefing to.
|
||||||
-- @treturn CLIENT
|
-- @treturn CLIENT
|
||||||
function MISSION:ShowBriefing( Client )
|
function MISSION:ShowBriefing( Client )
|
||||||
trace.f(self.ClassName, { Client.ClientName } )
|
self:T( { Client.ClientName } )
|
||||||
|
|
||||||
if not Client.ClientBriefingShown then
|
if not Client.ClientBriefingShown then
|
||||||
Client.ClientBriefingShown = true
|
Client.ClientBriefingShown = true
|
||||||
@ -266,7 +264,7 @@ end
|
|||||||
-- Mission:AddClient( CLIENT:New( 'US UH-1H*HOT-Deploy Troops 2', 'Transport 3 groups of air defense engineers from our barracks "Gold" and "Titan" to each patriot battery control center to activate our air defenses.' ):Transport() )
|
-- Mission:AddClient( CLIENT:New( 'US UH-1H*HOT-Deploy Troops 2', 'Transport 3 groups of air defense engineers from our barracks "Gold" and "Titan" to each patriot battery control center to activate our air defenses.' ):Transport() )
|
||||||
-- Mission:AddClient( CLIENT:New( 'US UH-1H*RAMP-Deploy Troops 4', 'Transport 3 groups of air defense engineers from our barracks "Gold" and "Titan" to each patriot battery control center to activate our air defenses.' ):Transport() )
|
-- Mission:AddClient( CLIENT:New( 'US UH-1H*RAMP-Deploy Troops 4', 'Transport 3 groups of air defense engineers from our barracks "Gold" and "Titan" to each patriot battery control center to activate our air defenses.' ):Transport() )
|
||||||
function MISSION:AddClient( Client )
|
function MISSION:AddClient( Client )
|
||||||
trace.f(self.ClassName, { Client } )
|
self:T( { Client } )
|
||||||
|
|
||||||
local Valid = true
|
local Valid = true
|
||||||
|
|
||||||
@ -285,8 +283,7 @@ end
|
|||||||
-- -- Seach for Client "Bomber" within the Mission.
|
-- -- Seach for Client "Bomber" within the Mission.
|
||||||
-- local BomberClient = Mission:FindClient( "Bomber" )
|
-- local BomberClient = Mission:FindClient( "Bomber" )
|
||||||
function MISSION:FindClient( ClientName )
|
function MISSION:FindClient( ClientName )
|
||||||
trace.f(self.ClassName)
|
self:T( { self._Clients[ClientName] } )
|
||||||
trace.r( "", "", { self._Clients[ClientName] } )
|
|
||||||
return self._Clients[ClientName]
|
return self._Clients[ClientName]
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -317,13 +314,12 @@ end
|
|||||||
-- Mission:AddTask( DeployTask, 2 )
|
-- Mission:AddTask( DeployTask, 2 )
|
||||||
|
|
||||||
function MISSION:AddTask( Task, TaskNumber )
|
function MISSION:AddTask( Task, TaskNumber )
|
||||||
trace.f(self.ClassName)
|
self:T()
|
||||||
|
|
||||||
self._Tasks[TaskNumber] = Task
|
self._Tasks[TaskNumber] = Task
|
||||||
self._Tasks[TaskNumber]:EnableEvents()
|
self._Tasks[TaskNumber]:EnableEvents()
|
||||||
self._Tasks[TaskNumber].ID = TaskNumber
|
self._Tasks[TaskNumber].ID = TaskNumber
|
||||||
|
|
||||||
trace.r( self.ClassName, "" )
|
|
||||||
return Task
|
return Task
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -335,7 +331,7 @@ trace.r( self.ClassName, "" )
|
|||||||
-- Task2 = Mission:GetTask( 2 )
|
-- Task2 = Mission:GetTask( 2 )
|
||||||
|
|
||||||
function MISSION:GetTask( TaskNumber )
|
function MISSION:GetTask( TaskNumber )
|
||||||
trace.f(self.ClassName)
|
self:T()
|
||||||
|
|
||||||
local Valid = true
|
local Valid = true
|
||||||
|
|
||||||
@ -359,7 +355,7 @@ end
|
|||||||
-- Tasks = Mission:GetTasks()
|
-- Tasks = Mission:GetTasks()
|
||||||
-- env.info( "Task 2 Completion = " .. Tasks[2]:GetGoalPercentage() .. "%" )
|
-- env.info( "Task 2 Completion = " .. Tasks[2]:GetGoalPercentage() .. "%" )
|
||||||
function MISSION:GetTasks()
|
function MISSION:GetTasks()
|
||||||
trace.f(self.ClassName)
|
self:T()
|
||||||
|
|
||||||
return self._Tasks
|
return self._Tasks
|
||||||
end
|
end
|
||||||
@ -367,7 +363,7 @@ end
|
|||||||
--- Add Cargo to the mission... Cargo functionality needs to be reworked a bit, so this is still under construction. I need to make a CARGO Class...
|
--- Add Cargo to the mission... Cargo functionality needs to be reworked a bit, so this is still under construction. I need to make a CARGO Class...
|
||||||
SpawnCargo = {}
|
SpawnCargo = {}
|
||||||
function MISSION:AddCargo( Cargos )
|
function MISSION:AddCargo( Cargos )
|
||||||
trace.f(self.ClassName, { Cargos } )
|
self:T( { Cargos } )
|
||||||
|
|
||||||
if type( Cargos ) == "table" then
|
if type( Cargos ) == "table" then
|
||||||
for CargoID, Cargo in pairs( Cargos ) do
|
for CargoID, Cargo in pairs( Cargos ) do
|
||||||
|
|||||||
@ -1,39 +0,0 @@
|
|||||||
--- A SLINGLOADHOOKTASK will orchestrate the sling-load hook activity to slingload a CARGO from a specific landing zone(s).
|
|
||||||
-- @classmod SLINGLOADHOOKTASK
|
|
||||||
|
|
||||||
Include.File("Task")
|
|
||||||
|
|
||||||
SLINGLOADHOOKTASK = {
|
|
||||||
ClassName = "SLINGLOADHOOKTASK",
|
|
||||||
GoalVerb = "Hook and Sling Cargo"
|
|
||||||
}
|
|
||||||
|
|
||||||
--- Creates a new SLINGLOADHOOKTASK.
|
|
||||||
-- @tparam table{string,...}|string LandingZones Table or name of the zone(s) where Cargo is to be loaded.
|
|
||||||
-- @tparam table{string,...)|string CargoPrefixes is the name or prefix of the name of the Cargo objects defined within the DCS ME.
|
|
||||||
-- @treturn SLINGLOADHOOKTASK
|
|
||||||
function SLINGLOADHOOKTASK:New( LandingZones, CargoPrefixes )
|
|
||||||
trace.f(self.ClassName)
|
|
||||||
|
|
||||||
local self = BASE:Inherit( self, TASK:New() )
|
|
||||||
|
|
||||||
self.Name = 'Hook and Sling Cargo'
|
|
||||||
self.TaskBriefing = "Task: Hook"
|
|
||||||
|
|
||||||
if type( LandingZones ) == "table" then
|
|
||||||
self.LandingZones = LandingZones
|
|
||||||
else
|
|
||||||
self.LandingZones = { LandingZones }
|
|
||||||
end
|
|
||||||
|
|
||||||
if type( CargoPrefixes ) == "table" then
|
|
||||||
self.CargoPrefixes = CargoPrefixes
|
|
||||||
else
|
|
||||||
self.CargoPrefixes = { CargoPrefixes }
|
|
||||||
end
|
|
||||||
|
|
||||||
self.Stages = { STAGEBRIEF:New(), STAGESTART:New(), STAGEROUTE:New(), STAGE_SLINGLOAD_HOOK:New(), STAGEDONE:New() }
|
|
||||||
self:SetStage( 1 )
|
|
||||||
|
|
||||||
return self
|
|
||||||
end
|
|
||||||
@ -1,38 +0,0 @@
|
|||||||
--- A SLINGLOADUNHOOKTASK will orchestrate the sling-load unhook activity to (sling)load a CARGO and deploy it in a specific landing zone(s).
|
|
||||||
-- @classmod SLINGLOADUNHOOKTASK
|
|
||||||
|
|
||||||
Include.File("Task")
|
|
||||||
|
|
||||||
SLINGLOADUNHOOKTASK = {
|
|
||||||
ClassName = "SLINGLOADUNHOOKTASK",
|
|
||||||
GoalVerb = "Sling and UnHook Cargo"
|
|
||||||
}
|
|
||||||
|
|
||||||
--- Creates a new SLINGLOADUNHOOKTASK.
|
|
||||||
-- @tparam table{string,...}|string LandingZones Table or name of the zone(s) where Cargo is to be loaded.
|
|
||||||
-- @tparam table{string,...}|string CargoPrefixes is the name or prefix of the name of the Cargo objects defined within the DCS ME.
|
|
||||||
function SLINGLOADUNHOOKTASK:New( LandingZones, CargoPrefixes )
|
|
||||||
trace.f(self.ClassName)
|
|
||||||
|
|
||||||
local self = BASE:Inherit( self, TASK:New() )
|
|
||||||
|
|
||||||
self.Name = 'Sling and Unhook Cargo'
|
|
||||||
self.TaskBriefing = "Task: UnHook"
|
|
||||||
|
|
||||||
if type( LandingZones ) == "table" then
|
|
||||||
self.LandingZones = LandingZones
|
|
||||||
else
|
|
||||||
self.LandingZones = { LandingZones }
|
|
||||||
end
|
|
||||||
|
|
||||||
if type( CargoPrefixes ) == "table" then
|
|
||||||
self.CargoPrefixes = CargoPrefixes
|
|
||||||
else
|
|
||||||
self.CargoPrefixes = { CargoPrefixes }
|
|
||||||
end
|
|
||||||
|
|
||||||
self.Stages = { STAGEBRIEF:New(), STAGESTART:New(), STAGEROUTE:New(), STAGE_SLINGLOAD_UNHOOK:New(), STAGEDONE:New() }
|
|
||||||
self:SetStage( 1 )
|
|
||||||
|
|
||||||
return self
|
|
||||||
end
|
|
||||||
@ -2,6 +2,8 @@
|
|||||||
-- @classmod SPAWN
|
-- @classmod SPAWN
|
||||||
-- @author Flightcontrol
|
-- @author Flightcontrol
|
||||||
|
|
||||||
|
MOOSE_Version = "0.1.1.1"
|
||||||
|
|
||||||
Include.File( "Routines" )
|
Include.File( "Routines" )
|
||||||
Include.File( "Base" )
|
Include.File( "Base" )
|
||||||
Include.File( "Database" )
|
Include.File( "Database" )
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user