- MESSAGE class finished and now properly documented. Changed New()
function API.
- Reworked Include.File lines. No Include.File line anymore in the
Modules. All included in Moose.lua for dynamic loading.
This commit is contained in:
FlightControl
2016-06-09 12:47:15 +02:00
parent 5211f06cba
commit be8e76e7f1
71 changed files with 874 additions and 1135 deletions

View File

@@ -41,9 +41,9 @@
-- @module Airbase
-- @author FlightControl
Include.File( "Routines" )
Include.File( "Base" )
Include.File( "Message" )
--- The AIRBASE class
-- @type AIRBASE

View File

@@ -53,7 +53,7 @@
-- @module Base
-- @author FlightControl
Include.File( "Routines" )
local _TraceOn = true
local _TraceLevel = 1

View File

@@ -1,10 +1,10 @@
--- CARGO Classes
-- @module CARGO
Include.File( "Routines" )
Include.File( "Base" )
Include.File( "Message" )
Include.File( "Scheduler" )
--- Clients are those Groups defined within the Mission Editor that have the skillset defined as "Client" or "Player".

View File

@@ -2,11 +2,11 @@
-- @module CleanUp
-- @author Flightcontrol
Include.File( "Routines" )
Include.File( "Base" )
Include.File( "Mission" )
Include.File( "Client" )
Include.File( "Task" )
--- The CLEANUP class.
-- @type CLEANUP
@@ -58,7 +58,6 @@ function CLEANUP:_DestroyGroup( GroupObject, CleanUpGroupName )
self:F( { GroupObject, CleanUpGroupName } )
if GroupObject then -- and GroupObject:isExist() then
--MESSAGE:New( "Destroy Group " .. CleanUpGroupName, CleanUpGroupName, 1, CleanUpGroupName ):ToAll()
trigger.action.deactivateGroup(GroupObject)
self:T( { "GroupObject Destroyed", GroupObject } )
end
@@ -72,7 +71,6 @@ function CLEANUP:_DestroyUnit( CleanUpUnit, CleanUpUnitName )
self:F( { CleanUpUnit, CleanUpUnitName } )
if CleanUpUnit then
--MESSAGE:New( "Destroy " .. CleanUpUnitName, CleanUpUnitName, 1, CleanUpUnitName ):ToAll()
local CleanUpGroup = Unit.getGroup(CleanUpUnit)
-- TODO Client bug in 1.5.3
if CleanUpGroup and CleanUpGroup:isExist() then
@@ -142,7 +140,6 @@ function CLEANUP:_EventCrash( Event )
self:F( { Event } )
--TODO: This stuff is not working due to a DCS bug. Burning units cannot be destroyed.
--MESSAGE:New( "Crash ", "Crash", 10, "Crash" ):ToAll()
-- self:T("before getGroup")
-- local _grp = Unit.getGroup(event.initiator)-- Identify the group that fired
-- self:T("after getGroup")
@@ -277,7 +274,6 @@ function CLEANUP:_CleanUpScheduler()
--self:T( CleanUpUnitVec2 )
local CleanUpSurfaceType = land.getSurfaceType(CleanUpUnitVec2)
--self:T( CleanUpSurfaceType )
--MESSAGE:New( "Surface " .. CleanUpUnitName .. " = " .. CleanUpSurfaceTypeText[CleanUpSurfaceType], CleanUpUnitName, 10, CleanUpUnitName ):ToAll()
if CleanUpUnit and CleanUpUnit:getLife() <= CleanUpUnit:getLife0() * 0.95 then
if CleanUpSurfaceType == land.SurfaceType.RUNWAY then
@@ -309,7 +305,6 @@ function CLEANUP:_CleanUpScheduler()
else
UnitData.CleanUpTime = timer.getTime()
UnitData.CleanUpMoved = true
--MESSAGE:New( "Moved " .. CleanUpUnitName, CleanUpUnitName, 10, CleanUpUnitName ):ToAll()
end
end

View File

@@ -37,10 +37,10 @@
-- @module Client
-- @author FlightControl
Include.File( "Routines" )
Include.File( "Base" )
Include.File( "Cargo" )
Include.File( "Message" )
--- The CLIENT class
@@ -462,16 +462,16 @@ function CLIENT:Message( Message, MessageDuration, MessageId, MessageCategory, M
else
self.Messages[MessageId].MessageInterval = MessageInterval
end
MESSAGE:New( Message, MessageCategory, MessageDuration, MessageId ):ToClient( self )
MESSAGE:New( Message, MessageDuration, MessageCategory ):ToClient( self )
else
if self:GetClientGroupDCSUnit() and not self:GetClientGroupDCSUnit():inAir() 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, MessageDuration , MessageCategory):ToClient( self )
self.Messages[MessageId].MessageTime = timer.getTime()
end
else
if timer.getTime() - self.Messages[MessageId].MessageTime >= self.Messages[MessageId].MessageDuration + self.Messages[MessageId].MessageInterval then
MESSAGE:New( Message, MessageCategory, MessageDuration, MessageId ):ToClient( self )
MESSAGE:New( Message, MessageDuration, MessageCategory ):ToClient( self )
self.Messages[MessageId].MessageTime = timer.getTime()
end
end

View File

@@ -32,15 +32,15 @@
-- @module Database
-- @author FlightControl
Include.File( "Routines" )
Include.File( "Base" )
Include.File( "Menu" )
Include.File( "Group" )
Include.File( "Static" )
Include.File( "Unit" )
Include.File( "Event" )
Include.File( "Client" )
Include.File( "Scheduler" )
--- DATABASE class

View File

@@ -1,7 +1,7 @@
--- A DEPLOYTASK orchestrates the deployment of CARGO within a specific landing zone.
-- @module DEPLOYTASK
Include.File( "Task" )
--- A DeployTask
-- @type DEPLOYTASK

View File

@@ -4,7 +4,7 @@
-- @see DESTROYUNITTYPESTASK
-- @see DESTROY_RADARS_TASK
Include.File("Task")
--- The DESTROYBASETASK class
-- @type DESTROYBASETASK

View File

@@ -1,7 +1,7 @@
--- DESTROYGROUPSTASK
-- @module DESTROYGROUPSTASK
Include.File("DestroyBaseTask")
--- The DESTROYGROUPSTASK class
-- @type

View File

@@ -1,7 +1,7 @@
--- Task class to destroy radar installations.
-- @module DESTROYRADARSTASK
Include.File("DestroyBaseTask")
--- The DESTROYRADARS class
-- @type

View File

@@ -1,7 +1,7 @@
--- Set TASK to destroy certain unit types.
-- @module DESTROYUNITTYPESTASK
Include.File("DestroyBaseTask")
--- The DESTROYUNITTYPESTASK class
-- @type

View File

@@ -102,11 +102,11 @@
-- @module Escort
-- @author FlightControl
Include.File( "Routines" )
Include.File( "Base" )
Include.File( "Database" )
Include.File( "Group" )
Include.File( "Zone" )
---
-- @type ESCORT

View File

@@ -2,9 +2,6 @@
-- @module Event
-- @author FlightControl
Include.File( "Routines" )
Include.File( "Base" )
--- The EVENT structure
-- @type EVENT
-- @field #EVENT.Events Events

View File

@@ -1,8 +1,6 @@
--- A GOHOMETASK orchestrates the travel back to the home base, which is a specific zone defined within the ME.
-- @module GOHOMETASK
Include.File("Task")
--- The GOHOMETASK class
-- @type
GOHOMETASK = {

View File

@@ -146,11 +146,6 @@
-- @module Group
-- @author FlightControl
Include.File( "Routines" )
Include.File( "Base" )
Include.File( "Message" )
Include.File( "Unit" )
--- The GROUP class
-- @type GROUP
-- @extends Base#BASE
@@ -2672,7 +2667,7 @@ function GROUP:Message( Message, Duration )
local DCSGroup = self:GetDCSGroup()
if DCSGroup then
return MESSAGE:New( Message, self:GetCallsign() .. " (" .. self:GetTypeName() .. ")", Duration, self:GetClassNameAndID() )
return MESSAGE:New( Message, Duration, self:GetCallsign() .. " (" .. self:GetTypeName() .. ")" )
end
return nil

View File

@@ -1,9 +1,6 @@
--- Encapsulation of DCS World Menu system in a set of MENU classes.
-- @module Menu
Include.File( "Routines" )
Include.File( "Base" )
--- The MENU class
-- @type MENU
-- @extends Base#BASE

View File

@@ -1,17 +1,29 @@
--- Message System to display Messages for Clients and Coalitions or All.
-- Messages are grouped on the display panel per Category to improve readability for the players.
--- This module contains the MESSAGE class.
--
-- 1) @{Message#MESSAGE} class, extends @{Base#BASE}
-- =================================================
-- Message System to display Messages to Clients, Coalitions or All.
-- Messages are shown on the display panel for an amount of seconds, and will then disappear.
-- Messages are identified by an ID. The messages with the same ID belonging to the same category will be overwritten if they were still being displayed on the display panel.
-- Messages are created with MESSAGE:@{New}().
-- Messages are sent to Clients with MESSAGE:@{ToClient}().
-- Messages are sent to Coalitions with MESSAGE:@{ToCoalition}().
-- Messages are sent to All Players with MESSAGE:@{ToAll}().
-- Messages can contain a category which is indicating the category of the message.
--
-- 1.1) MESSAGE construction methods
-- ---------------------------------
-- Messages are created with MESSAGE:@{New}. Note that when the MESSAGE object is created, no message is sent yet.
-- To send messages, you need to use the To functions.
--
-- 1.2) Send messages with MESSAGE To methods
-- ------------------------------------------
-- Messages are sent to:
-- * Clients with MESSAGE:@{ToClient}().
-- * Coalitions with MESSAGE:@{ToCoalition}().
-- * All Players with MESSAGE:@{ToAll}().
--
-- @module Message
Include.File( "Base" )
-- @author FlightControl
--- The MESSAGE class
-- @type MESSAGE
-- @extends Base#BASE
MESSAGE = {
ClassName = "MESSAGE",
MessageCategory = 0,
@@ -22,9 +34,8 @@ MESSAGE = {
--- Creates a new MESSAGE object. Note that these MESSAGE objects are not yet displayed on the display panel. You must use the functions @{ToClient} or @{ToCoalition} or @{ToAll} to send these Messages to the respective recipients.
-- @param self
-- @param #string MessageText is the text of the Message.
-- @param #string MessageCategory is a string expressing the Category of the Message. Messages are grouped on the display panel per Category to improve readability.
-- @param #number MessageDuration is a number in seconds of how long the MESSAGE should be shown on the display panel.
-- @param #string MessageID is a string expressing the ID of the Message.
-- @param #string MessageCategory (optional) is a string expressing the "category" of the Message. The category will be shown as the first text in the message followed by a ": ".
-- @return #MESSAGE
-- @usage
-- -- Create a series of new Messages.
@@ -32,15 +43,15 @@ MESSAGE = {
-- -- MessageRED is meant to be sent to the RED players only, for 10 seconds, and is classified as "End of Mission", with ID "Win".
-- -- MessageClient1 is meant to be sent to a Client, for 25 seconds, and is classified as "Score", with ID "Score".
-- -- MessageClient1 is meant to be sent to a Client, for 25 seconds, and is classified as "Score", with ID "Score".
-- MessageAll = MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", "End of Mission", 25, "Win" )
-- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25, "Score" )
-- MessageClient1 = MESSAGE:New( "Congratulations, you've just hit a target", "Score", 25, "Score" )
-- MessageClient2 = MESSAGE:New( "Congratulations, you've just killed a target", "Score", 25, "Score" )
function MESSAGE:New( MessageText, MessageCategory, MessageDuration, MessageID )
-- MessageAll = MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", 25, "End of Mission" )
-- MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", 25, "Penalty" )
-- MessageClient1 = MESSAGE:New( "Congratulations, you've just hit a target", 25, "Score" )
-- MessageClient2 = MESSAGE:New( "Congratulations, you've just killed a target", 25, "Score")
function MESSAGE:New( MessageText, MessageDuration, MessageCategory )
local self = BASE:Inherit( self, BASE:New() )
self:F( { MessageText, MessageCategory, MessageDuration, MessageID } )
self:F( { MessageText, MessageDuration, MessageCategory } )
-- When no messagecategory is given, we don't show it as a title...
-- When no MessageCategory is given, we don't show it as a title...
if MessageCategory and MessageCategory ~= "" then
self.MessageCategory = MessageCategory .. ": "
else
@@ -48,7 +59,6 @@ function MESSAGE:New( MessageText, MessageCategory, MessageDuration, MessageID )
end
self.MessageDuration = MessageDuration
self.MessageID = MessageID
self.MessageTime = timer.getTime()
self.MessageText = MessageText
@@ -174,77 +184,77 @@ end
--- The MESSAGEQUEUE class
-- @type MESSAGEQUEUE
MESSAGEQUEUE = {
ClientGroups = {},
CoalitionSides = {}
}
function MESSAGEQUEUE:New( RefreshInterval )
local self = BASE:Inherit( self, BASE:New() )
self:F( { RefreshInterval } )
self.RefreshInterval = RefreshInterval
--self.DisplayFunction = routines.scheduleFunction( self._DisplayMessages, { self }, 0, RefreshInterval )
self.DisplayFunction = SCHEDULER:New( self, self._DisplayMessages, {}, 0, RefreshInterval )
return self
end
--- This function is called automatically by the MESSAGEQUEUE scheduler.
function MESSAGEQUEUE:_DisplayMessages()
-- First we display all messages that a coalition needs to receive... Also those who are not in a client (CA module clients...).
for CoalitionSideID, CoalitionSideData in pairs( self.CoalitionSides ) do
for MessageID, MessageData in pairs( CoalitionSideData.Messages ) do
if MessageData.MessageSent == false then
--trigger.action.outTextForCoalition( CoalitionSideID, MessageData.MessageCategory .. '\n' .. MessageData.MessageText:gsub("\n$",""):gsub("\n$",""), MessageData.MessageDuration )
MessageData.MessageSent = true
end
local MessageTimeLeft = ( MessageData.MessageTime + MessageData.MessageDuration ) - timer.getTime()
if MessageTimeLeft <= 0 then
MessageData = nil
end
end
end
-- Then we send the messages for each individual client, but also to be included are those Coalition messages for the Clients who belong to a coalition.
-- Because the Client messages will overwrite the Coalition messages (for that Client).
for ClientGroupName, ClientGroupData in pairs( self.ClientGroups ) do
for MessageID, MessageData in pairs( ClientGroupData.Messages ) do
if MessageData.MessageGroup == false then
trigger.action.outTextForGroup( Group.getByName(ClientGroupName):getID(), MessageData.MessageCategory .. '\n' .. MessageData.MessageText:gsub("\n$",""):gsub("\n$",""), MessageData.MessageDuration )
MessageData.MessageGroup = true
end
local MessageTimeLeft = ( MessageData.MessageTime + MessageData.MessageDuration ) - timer.getTime()
if MessageTimeLeft <= 0 then
MessageData = nil
end
end
-- Now check if the Client also has messages that belong to the Coalition of the Client...
for CoalitionSideID, CoalitionSideData in pairs( self.CoalitionSides ) do
for MessageID, MessageData in pairs( CoalitionSideData.Messages ) do
local CoalitionGroup = Group.getByName( ClientGroupName )
if CoalitionGroup and CoalitionGroup:getCoalition() == CoalitionSideID then
if MessageData.MessageCoalition == false then
trigger.action.outTextForGroup( Group.getByName(ClientGroupName):getID(), MessageData.MessageCategory .. '\n' .. MessageData.MessageText:gsub("\n$",""):gsub("\n$",""), MessageData.MessageDuration )
MessageData.MessageCoalition = true
end
end
local MessageTimeLeft = ( MessageData.MessageTime + MessageData.MessageDuration ) - timer.getTime()
if MessageTimeLeft <= 0 then
MessageData = nil
end
end
end
end
return true
end
--- The _MessageQueue object is created when the MESSAGE class module is loaded.
--_MessageQueue = MESSAGEQUEUE:New( 0.5 )
----- The MESSAGEQUEUE class
---- @type MESSAGEQUEUE
--MESSAGEQUEUE = {
-- ClientGroups = {},
-- CoalitionSides = {}
--}
--
--function MESSAGEQUEUE:New( RefreshInterval )
-- local self = BASE:Inherit( self, BASE:New() )
-- self:F( { RefreshInterval } )
--
-- self.RefreshInterval = RefreshInterval
--
-- --self.DisplayFunction = routines.scheduleFunction( self._DisplayMessages, { self }, 0, RefreshInterval )
-- self.DisplayFunction = SCHEDULER:New( self, self._DisplayMessages, {}, 0, RefreshInterval )
--
-- return self
--end
--
----- This function is called automatically by the MESSAGEQUEUE scheduler.
--function MESSAGEQUEUE:_DisplayMessages()
--
-- -- First we display all messages that a coalition needs to receive... Also those who are not in a client (CA module clients...).
-- for CoalitionSideID, CoalitionSideData in pairs( self.CoalitionSides ) do
-- for MessageID, MessageData in pairs( CoalitionSideData.Messages ) do
-- if MessageData.MessageSent == false then
-- --trigger.action.outTextForCoalition( CoalitionSideID, MessageData.MessageCategory .. '\n' .. MessageData.MessageText:gsub("\n$",""):gsub("\n$",""), MessageData.MessageDuration )
-- MessageData.MessageSent = true
-- end
-- local MessageTimeLeft = ( MessageData.MessageTime + MessageData.MessageDuration ) - timer.getTime()
-- if MessageTimeLeft <= 0 then
-- MessageData = nil
-- end
-- end
-- end
--
-- -- Then we send the messages for each individual client, but also to be included are those Coalition messages for the Clients who belong to a coalition.
-- -- Because the Client messages will overwrite the Coalition messages (for that Client).
-- for ClientGroupName, ClientGroupData in pairs( self.ClientGroups ) do
-- for MessageID, MessageData in pairs( ClientGroupData.Messages ) do
-- if MessageData.MessageGroup == false then
-- trigger.action.outTextForGroup( Group.getByName(ClientGroupName):getID(), MessageData.MessageCategory .. '\n' .. MessageData.MessageText:gsub("\n$",""):gsub("\n$",""), MessageData.MessageDuration )
-- MessageData.MessageGroup = true
-- end
-- local MessageTimeLeft = ( MessageData.MessageTime + MessageData.MessageDuration ) - timer.getTime()
-- if MessageTimeLeft <= 0 then
-- MessageData = nil
-- end
-- end
--
-- -- Now check if the Client also has messages that belong to the Coalition of the Client...
-- for CoalitionSideID, CoalitionSideData in pairs( self.CoalitionSides ) do
-- for MessageID, MessageData in pairs( CoalitionSideData.Messages ) do
-- local CoalitionGroup = Group.getByName( ClientGroupName )
-- if CoalitionGroup and CoalitionGroup:getCoalition() == CoalitionSideID then
-- if MessageData.MessageCoalition == false then
-- trigger.action.outTextForGroup( Group.getByName(ClientGroupName):getID(), MessageData.MessageCategory .. '\n' .. MessageData.MessageText:gsub("\n$",""):gsub("\n$",""), MessageData.MessageDuration )
-- MessageData.MessageCoalition = true
-- end
-- end
-- local MessageTimeLeft = ( MessageData.MessageTime + MessageData.MessageDuration ) - timer.getTime()
-- if MessageTimeLeft <= 0 then
-- MessageData = nil
-- end
-- end
-- end
-- end
--
-- return true
--end
--
----- The _MessageQueue object is created when the MESSAGE class module is loaded.
----_MessageQueue = MESSAGEQUEUE:New( 0.5 )
--

View File

@@ -70,9 +70,6 @@
-- @author FlightControl
Include.File( "Client" )
Include.File( "Scheduler" )
--- The MISSILETRAINER class
-- @type MISSILETRAINER
-- @extends Base#BASE
@@ -217,9 +214,9 @@ function MISSILETRAINER:InitMessagesOnOff( MessagesOnOff )
self.MessagesOnOff = MessagesOnOff
if self.MessagesOnOff == true then
MESSAGE:New( "Messages ON", "Menu", 15, "ID" ):ToAll()
MESSAGE:New( "Messages ON", 15, "Menu" ):ToAll()
else
MESSAGE:New( "Messages OFF", "Menu", 15, "ID" ):ToAll()
MESSAGE:New( "Messages OFF", 15, "Menu" ):ToAll()
end
return self
@@ -234,9 +231,9 @@ function MISSILETRAINER:InitTrackingToAll( TrackingToAll )
self.TrackingToAll = TrackingToAll
if self.TrackingToAll == true then
MESSAGE:New( "Missile tracking to all players ON", "Menu", 15, "ID" ):ToAll()
MESSAGE:New( "Missile tracking to all players ON", 15, "Menu" ):ToAll()
else
MESSAGE:New( "Missile tracking to all players OFF", "Menu", 15, "ID" ):ToAll()
MESSAGE:New( "Missile tracking to all players OFF", 15, "Menu" ):ToAll()
end
return self
@@ -251,9 +248,9 @@ function MISSILETRAINER:InitTrackingOnOff( TrackingOnOff )
self.TrackingOnOff = TrackingOnOff
if self.TrackingOnOff == true then
MESSAGE:New( "Missile tracking ON", "Menu", 15, "ID" ):ToAll()
MESSAGE:New( "Missile tracking ON", 15, "Menu" ):ToAll()
else
MESSAGE:New( "Missile tracking OFF", "Menu", 15, "ID" ):ToAll()
MESSAGE:New( "Missile tracking OFF", 15, "Menu" ):ToAll()
end
return self
@@ -272,7 +269,7 @@ function MISSILETRAINER:InitTrackingFrequency( TrackingFrequency )
self.TrackingFrequency = 0.5
end
if self.TrackingFrequency then
MESSAGE:New( "Missile tracking frequency is " .. self.TrackingFrequency .. " seconds.", "Menu", 15, "ID" ):ToAll()
MESSAGE:New( "Missile tracking frequency is " .. self.TrackingFrequency .. " seconds.", 15, "Menu" ):ToAll()
end
return self
@@ -287,9 +284,9 @@ function MISSILETRAINER:InitAlertsToAll( AlertsToAll )
self.AlertsToAll = AlertsToAll
if self.AlertsToAll == true then
MESSAGE:New( "Alerts to all players ON", "Menu", 15, "ID" ):ToAll()
MESSAGE:New( "Alerts to all players ON", 15, "Menu" ):ToAll()
else
MESSAGE:New( "Alerts to all players OFF", "Menu", 15, "ID" ):ToAll()
MESSAGE:New( "Alerts to all players OFF", 15, "Menu" ):ToAll()
end
return self
@@ -304,9 +301,9 @@ function MISSILETRAINER:InitAlertsHitsOnOff( AlertsHitsOnOff )
self.AlertsHitsOnOff = AlertsHitsOnOff
if self.AlertsHitsOnOff == true then
MESSAGE:New( "Alerts Hits ON", "Menu", 15, "ID" ):ToAll()
MESSAGE:New( "Alerts Hits ON", 15, "Menu" ):ToAll()
else
MESSAGE:New( "Alerts Hits OFF", "Menu", 15, "ID" ):ToAll()
MESSAGE:New( "Alerts Hits OFF", 15, "Menu" ):ToAll()
end
return self
@@ -321,9 +318,9 @@ function MISSILETRAINER:InitAlertsLaunchesOnOff( AlertsLaunchesOnOff )
self.AlertsLaunchesOnOff = AlertsLaunchesOnOff
if self.AlertsLaunchesOnOff == true then
MESSAGE:New( "Alerts Launches ON", "Menu", 15, "ID" ):ToAll()
MESSAGE:New( "Alerts Launches ON", 15, "Menu" ):ToAll()
else
MESSAGE:New( "Alerts Launches OFF", "Menu", 15, "ID" ):ToAll()
MESSAGE:New( "Alerts Launches OFF", 15, "Menu" ):ToAll()
end
return self
@@ -338,9 +335,9 @@ function MISSILETRAINER:InitRangeOnOff( DetailsRangeOnOff )
self.DetailsRangeOnOff = DetailsRangeOnOff
if self.DetailsRangeOnOff == true then
MESSAGE:New( "Range display ON", "Menu", 15, "ID" ):ToAll()
MESSAGE:New( "Range display ON", 15, "Menu" ):ToAll()
else
MESSAGE:New( "Range display OFF", "Menu", 15, "ID" ):ToAll()
MESSAGE:New( "Range display OFF", 15, "Menu" ):ToAll()
end
return self
@@ -355,9 +352,9 @@ function MISSILETRAINER:InitBearingOnOff( DetailsBearingOnOff )
self.DetailsBearingOnOff = DetailsBearingOnOff
if self.DetailsBearingOnOff == true then
MESSAGE:New( "Bearing display OFF", "Menu", 15, "ID" ):ToAll()
MESSAGE:New( "Bearing display OFF", 15, "Menu" ):ToAll()
else
MESSAGE:New( "Bearing display OFF", "Menu", 15, "ID" ):ToAll()
MESSAGE:New( "Bearing display OFF", 15, "Menu" ):ToAll()
end
return self
@@ -372,9 +369,9 @@ function MISSILETRAINER:InitMenusOnOff( MenusOnOff )
self.MenusOnOff = MenusOnOff
if self.MenusOnOff == true then
MESSAGE:New( "Menus are ENABLED (only when a player rejoins a slot)", "Menu", 15, "ID" ):ToAll()
MESSAGE:New( "Menus are ENABLED (only when a player rejoins a slot)", 15, "Menu" ):ToAll()
else
MESSAGE:New( "Menus are DISABLED", "Menu", 15, "ID" ):ToAll()
MESSAGE:New( "Menus are DISABLED", 15, "Menu" ):ToAll()
end
return self
@@ -425,7 +422,7 @@ function MISSILETRAINER._MenuMessages( MenuParameters )
if MenuParameters.Distance ~= nil then
self.Distance = MenuParameters.Distance
MESSAGE:New( "Hit detection distance set to " .. self.Distance .. " meters", "Menu", 15, "ID" ):ToAll()
MESSAGE:New( "Hit detection distance set to " .. self.Distance .. " meters", 15, "Menu" ):ToAll()
end
end
@@ -461,7 +458,7 @@ function MISSILETRAINER:_EventShot( Event )
string.format( "%s launched a %s",
TrainerSourceUnit:GetTypeName(),
TrainerWeaponName
) .. self:_AddRange( Client, TrainerWeapon ) .. self:_AddBearing( Client, TrainerWeapon ),"Launch Alert", 5, "ID" )
) .. self:_AddRange( Client, TrainerWeapon ) .. self:_AddBearing( Client, TrainerWeapon ), 5, "Launch Alert" )
if self.AlertsToAll then
Message:ToAll()
@@ -576,7 +573,7 @@ function MISSILETRAINER:_TrackMissiles()
TrainerWeapon:getTypeName(),
TrainerSourceUnit:GetTypeName(),
TrainerTargetUnit:GetPlayerName()
),"Hit Alert", 15, "ID" )
), 15, "Hit Alert" )
if self.AlertsToAll == true then
Message:ToAll()
@@ -597,7 +594,7 @@ function MISSILETRAINER:_TrackMissiles()
string.format( "%s launched by %s self destructed!",
TrainerWeaponTypeName,
TrainerSourceUnit:GetTypeName()
),"Tracking", 5, "ID" )
), 5, "Tracking" )
if self.AlertsToAll == true then
Message:ToAll()
@@ -671,7 +668,7 @@ function MISSILETRAINER:_TrackMissiles()
-- Once the Player Client and the Other Player Client tracking messages are prepared, show them.
if ClientData.MessageToClient ~= "" or ClientData.MessageToAll ~= "" then
local Message = MESSAGE:New( ClientData.MessageToClient .. ClientData.MessageToAll, "Tracking", 1, "ID" ):ToClient( Client )
local Message = MESSAGE:New( ClientData.MessageToClient .. ClientData.MessageToAll, 1, "Tracking" ):ToClient( Client )
end
end
end

View File

@@ -2,11 +2,6 @@
-- A @{CLIENT} needs to be registered within the @{MISSION} through the function @{AddClient}. A @{TASK} needs to be registered within the @{MISSION} through the function @{AddTask}.
-- @module Mission
Include.File( "Routines" )
Include.File( "Base" )
Include.File( "Client" )
Include.File( "Task" )
--- The MISSION class
-- @type MISSION
-- @extends Base#BASE
@@ -191,7 +186,7 @@ function MISSION:ReportToAll()
for TaskID, TaskData in pairs( Tasks ) do
TaskText = TaskText .. " - Task " .. TaskID .. ": " .. TaskData.Name .. ": " .. TaskData:GetGoalProgress() .. "\n"
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$",""), 10, "Mission Command: Mission Report" ):ToAll()
end
@@ -650,7 +645,7 @@ function MISSIONSCHEDULER:TimeShow()
self.TimeIntervalCount = self.TimeIntervalCount + 1
if self.TimeIntervalCount >= self.TimeTriggerShow then
local TimeMsg = string.format("%00d", ( self.TimeSeconds / 60 ) - ( timer.getTime() / 60 )) .. ' minutes left until mission reload.'
MESSAGE:New( TimeMsg, "Mission time", self.TimeShow, '/TimeMsg' ):ToAll()
MESSAGE:New( TimeMsg, self.TimeShow, "Mission time" ):ToAll()
self.TimeIntervalCount = 0
end
end

View File

@@ -2,8 +2,73 @@
Include.File( "Routines" )
Include.File( "Base" )
Include.File( "Database" )
Include.File( "Scheduler" )
Include.File( "Event" )
Include.File( "Menu" )
Include.File( "Group" )
Include.File( "Unit" )
Include.File( "Zone" )
Include.File( "Client" )
Include.File( "Static" )
Include.File( "Database" )
Include.File( "Set" )
Include.File( "Point" )
Include.File( "Moose" )
Include.File( "Scoring" )
Include.File( "Cargo" )
Include.File( "Message" )
Include.File( "Stage" )
Include.File( "Task" )
Include.File( "GoHomeTask" )
Include.File( "DestroyBaseTask" )
Include.File( "DestroyGroupsTask" )
Include.File( "DestroyRadarsTask" )
Include.File( "DestroyUnitTypesTask" )
Include.File( "PickupTask" )
Include.File( "DeployTask" )
Include.File( "NoTask" )
Include.File( "RouteTask" )
Include.File( "Mission" )
Include.File( "CleanUp" )
Include.File( "Spawn" )
Include.File( "Movement" )
Include.File( "Sead" )
Include.File( "Escort" )
Include.File( "MissileTrainer" )
-- The order of the declarations is important here. Don't touch it.

View File

@@ -5,8 +5,6 @@
-- on defined intervals (currently every minute).
-- @module MOVEMENT
Include.File( "Routines" )
--- the MOVEMENT class
-- @type
MOVEMENT = {

View File

@@ -1,8 +1,6 @@
--- A NOTASK is a dummy activity... But it will show a Mission Briefing...
-- @module NOTASK
Include.File("Task")
--- The NOTASK class
-- @type
NOTASK = {

View File

@@ -2,9 +2,6 @@
-- @module PICKUPTASK
-- @parent TASK
Include.File("Task")
Include.File("Cargo")
--- The PICKUPTASK class
-- @type
PICKUPTASK = {

View File

@@ -25,10 +25,6 @@
-- @module Point
-- @author FlightControl
Include.File( "Routines" )
Include.File( "Base" )
Include.File( "Point" )
--- The POINT_VEC3 class
-- @type POINT_VEC3
-- @extends Base#BASE

View File

@@ -2,10 +2,6 @@
-- @module routines
-- @author Flightcontrol
--Include.File( "Trace" )
--Include.File( "Message" )
env.setErrorMessageBoxEnabled(false)
--- Extract of MIST functions.
@@ -2310,19 +2306,19 @@ end
function MessageToAll( MsgText, MsgTime, MsgName )
--trace.f()
MESSAGE:New( MsgText, "Message", MsgTime, MsgName ):ToCoalition( coalition.side.RED ):ToCoalition( coalition.side.BLUE )
MESSAGE:New( MsgText, MsgTime, "Message" ):ToCoalition( coalition.side.RED ):ToCoalition( coalition.side.BLUE )
end
function MessageToRed( MsgText, MsgTime, MsgName )
--trace.f()
MESSAGE:New( MsgText, "To Red Coalition", MsgTime, MsgName ):ToCoalition( coalition.side.RED )
MESSAGE:New( MsgText, MsgTime, "To Red Coalition" ):ToCoalition( coalition.side.RED )
end
function MessageToBlue( MsgText, MsgTime, MsgName )
--trace.f()
MESSAGE:New( MsgText, "To Blue Coalition", MsgTime, MsgName ):ToCoalition( coalition.side.RED )
MESSAGE:New( MsgText, MsgTime, "To Blue Coalition" ):ToCoalition( coalition.side.RED )
end
function getCarrierHeight( CarrierGroup )

View File

@@ -20,10 +20,6 @@
-- @module Scheduler
-- @author FlightControl
Include.File( "Routines" )
Include.File( "Base" )
--- The SCHEDULER class
-- @type SCHEDULER
-- @extends Base#BASE

View File

@@ -7,13 +7,6 @@
-- @author FlightControl
Include.File( "Routines" )
Include.File( "Base" )
Include.File( "Menu" )
Include.File( "Group" )
Include.File( "Event" )
--- The Scoring class
-- @type SCORING
-- @field Players A collection of the current players that have joined the game.
@@ -176,7 +169,7 @@ function SCORING:_EventOnDeadOrCrash( Event )
MESSAGE:New( "Player '" .. PlayerName .. "' killed a friendly " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " ..
PlayerData.Kill[TargetCategory][TargetType].PenaltyKill .. " times. Penalty: -" .. PlayerData.Kill[TargetCategory][TargetType].Penalty ..
". Score Total:" .. PlayerData.Score - PlayerData.Penalty,
"", 5, "/PENALTY" .. PlayerName .. "/" .. InitUnitName ):ToAll()
5 ):ToAll()
self:ScoreCSV( PlayerName, "KILL_PENALTY", 1, -125, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
else
PlayerData.Score = PlayerData.Score + 10
@@ -185,7 +178,7 @@ function SCORING:_EventOnDeadOrCrash( Event )
MESSAGE:New( "Player '" .. PlayerName .. "' killed an enemy " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " ..
PlayerData.Kill[TargetCategory][TargetType].ScoreKill .. " times. Score: " .. PlayerData.Kill[TargetCategory][TargetType].Score ..
". Score Total:" .. PlayerData.Score - PlayerData.Penalty,
"", 5, "/SCORE" .. PlayerName .. "/" .. InitUnitName ):ToAll()
5 ):ToAll()
self:ScoreCSV( PlayerName, "KILL_SCORE", 1, 10, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
end
end
@@ -236,9 +229,7 @@ function SCORING:_AddPlayerFromUnit( UnitData )
self.Players[PlayerName].PenaltyCoalition = self.Players[PlayerName].PenaltyCoalition + 1
MESSAGE:New( "Player '" .. PlayerName .. "' changed coalition from " .. _SCORINGCoalition[self.Players[PlayerName].UnitCoalition] .. " to " .. _SCORINGCoalition[UnitCoalition] ..
"(changed " .. self.Players[PlayerName].PenaltyCoalition .. " times the coalition). 50 Penalty points added.",
"",
2,
"/PENALTYCOALITION" .. PlayerName
2
):ToAll()
self:ScoreCSV( PlayerName, "COALITION_PENALTY", 1, -50, self.Players[PlayerName].UnitName, _SCORINGCoalition[self.Players[PlayerName].UnitCoalition], _SCORINGCategory[self.Players[PlayerName].UnitCategory], self.Players[PlayerName].UnitType,
UnitName, _SCORINGCoalition[UnitCoalition], _SCORINGCategory[UnitCategory], UnitData:getTypeName() )
@@ -252,9 +243,7 @@ function SCORING:_AddPlayerFromUnit( UnitData )
if self.Players[PlayerName].Penalty > 100 then
if self.Players[PlayerName].PenaltyWarning < 1 then
MESSAGE:New( "Player '" .. PlayerName .. "': WARNING! If you continue to commit FRATRICIDE and have a PENALTY score higher than 150, you will be COURT MARTIALED and DISMISSED from this mission! \nYour total penalty is: " .. self.Players[PlayerName].Penalty,
"",
30,
"/PENALTYCOALITION" .. PlayerName
30
):ToAll()
self.Players[PlayerName].PenaltyWarning = self.Players[PlayerName].PenaltyWarning + 1
end
@@ -264,9 +253,7 @@ function SCORING:_AddPlayerFromUnit( UnitData )
ClientGroup = GROUP:NewFromDCSUnit( UnitData )
ClientGroup:Destroy()
MESSAGE:New( "Player '" .. PlayerName .. "' committed FRATRICIDE, he will be COURT MARTIALED and is DISMISSED from this mission!",
"",
10,
"/PENALTYCOALITION" .. PlayerName
10
):ToAll()
end
@@ -294,7 +281,7 @@ function SCORING:_AddMissionTaskScore( PlayerUnit, MissionName, Score )
MESSAGE:New( "Player '" .. PlayerName .. "' has finished another Task in Mission '" .. MissionName .. "'. " ..
Score .. " Score points added.",
"", 20, "/SCORETASK" .. PlayerName ):ToAll()
20 ):ToAll()
self:ScoreCSV( PlayerName, "TASK_" .. MissionName:gsub( ' ', '_' ), 1, Score, PlayerUnit:getName() )
end
@@ -311,7 +298,7 @@ function SCORING:_AddMissionScore( MissionName, Score )
PlayerData.Mission[MissionName].ScoreMission = PlayerData.Mission[MissionName].ScoreMission + Score
MESSAGE:New( "Player '" .. PlayerName .. "' has finished Mission '" .. MissionName .. "'. " ..
Score .. " Score points added.",
"", 20, "/SCOREMISSION" .. PlayerName ):ToAll()
20 ):ToAll()
self:ScoreCSV( PlayerName, "MISSION_" .. MissionName:gsub( ' ', '_' ), 1, Score )
end
end
@@ -421,9 +408,7 @@ function SCORING:_EventOnHit( Event )
MESSAGE:New( "Player '" .. InitPlayerName .. "' hit a friendly " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " ..
self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].PenaltyHit .. " times. Penalty: -" .. self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].Penalty ..
". Score Total:" .. self.Players[InitPlayerName].Score - self.Players[InitPlayerName].Penalty,
"",
2,
"/PENALTY" .. InitPlayerName .. "/" .. InitUnitName
2
):ToAll()
self:ScoreCSV( InitPlayerName, "HIT_PENALTY", 1, -25, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
else
@@ -433,9 +418,7 @@ function SCORING:_EventOnHit( Event )
MESSAGE:New( "Player '" .. InitPlayerName .. "' hit a target " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " ..
self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].ScoreHit .. " times. Score: " .. self.Players[InitPlayerName].Hit[TargetCategory][TargetUnitName].Score ..
". Score Total:" .. self.Players[InitPlayerName].Score - self.Players[InitPlayerName].Penalty,
"",
2,
"/SCORE" .. InitPlayerName .. "/" .. InitUnitName
2
):ToAll()
self:ScoreCSV( InitPlayerName, "HIT_SCORE", 1, 1, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
end
@@ -556,7 +539,7 @@ function SCORING:ReportScoreAll()
PlayerMessage = PlayerMessage .. string.format( "Player '%s' Score:%d (%d Score -%d Penalties)%s", PlayerName, PlayerScore - PlayerPenalty, PlayerScore, PlayerPenalty, ScoreMessage )
end
end
MESSAGE:New( PlayerMessage, "Player Scores", 30, "AllPlayerScores"):ToAll()
MESSAGE:New( PlayerMessage, 30, "Player Scores" ):ToAll()
end
@@ -669,7 +652,7 @@ function SCORING:ReportScorePlayer()
PlayerMessage = PlayerMessage .. string.format( "Player '%s' Score = %d ( %d Score, -%d Penalties ):%s", PlayerName, PlayerScore - PlayerPenalty, PlayerScore, PlayerPenalty, ScoreMessage )
end
end
MESSAGE:New( PlayerMessage, "Player Scores", 30, "AllPlayerScores"):ToAll()
MESSAGE:New( PlayerMessage, 30, "Player Scores" ):ToAll()
end

View File

@@ -3,13 +3,6 @@
-- @author to be searched on the forum
-- @author (co) Flightcontrol (Modified and enriched with functionality)
Include.File( "Routines" )
Include.File( "Event" )
Include.File( "Base" )
Include.File( "Mission" )
Include.File( "Client" )
Include.File( "Task" )
--- The SEAD class
-- @type SEAD
-- @extends Base#BASE

View File

@@ -127,14 +127,6 @@
-- @module Set
-- @author FlightControl
Include.File( "Routines" )
Include.File( "Base" )
Include.File( "Menu" )
Include.File( "Group" )
Include.File( "Unit" )
Include.File( "Event" )
Include.File( "Client" )
--- SET_BASE class
-- @type SET_BASE
-- @extends Base#BASE

View File

@@ -74,14 +74,6 @@
-- @module Spawn
-- @author FlightControl
Include.File( "Routines" )
Include.File( "Base" )
Include.File( "Database" )
Include.File( "Group" )
Include.File( "Zone" )
Include.File( "Event" )
Include.File( "Scheduler" )
--- SPAWN Class
-- @type SPAWN
-- @extends Base#BASE
@@ -783,7 +775,7 @@ end
-- If no index is given, it will return the first group in the list.
-- @param #SPAWN self
-- @param #number SpawnIndex The index of the group to return.
-- @return Group#GROUP
-- @return Group#GROUP self
function SPAWN:GetGroupFromIndex( SpawnIndex )
self:F( { self.SpawnTemplatePrefix, self.SpawnAliasPrefix, SpawnIndex } )

View File

@@ -2,11 +2,11 @@
-- @module STAGE
-- @author Flightcontrol
Include.File( "Routines" )
Include.File( "Base" )
Include.File( "Mission" )
Include.File( "Client" )
Include.File( "Task" )
--- The STAGE class
-- @type

View File

@@ -1,7 +1,7 @@
--- Provides a logging of statistics in a running DCS Mission.
-- @script eStatHandler
Include.File( "Routines" )
--Handler table

View File

@@ -31,9 +31,9 @@
-- @module Static
-- @author FlightControl
Include.File( "Routines" )
Include.File( "Base" )
Include.File( "Message" )
--- The STATIC class

View File

@@ -1,11 +1,11 @@
--- The TASK Classes define major end-to-end activities within a MISSION. The TASK Class is the Master Class to orchestrate these activities. From this class, many concrete TASK classes are inherited.
-- @module TASK
Include.File( "Routines" )
Include.File( "Base" )
Include.File( "Mission" )
Include.File( "Client" )
Include.File( "Stage" )
--- The TASK class
-- @type TASK

View File

@@ -68,9 +68,9 @@
-- @module Unit
-- @author FlightControl
Include.File( "Routines" )
Include.File( "Base" )
Include.File( "Message" )
--- The UNIT class
-- @type UNIT

View File

@@ -62,10 +62,10 @@
-- @author FlightControl
Include.File( "Routines" )
Include.File( "Base" )
Include.File( "Message" )
Include.File( "Point" )