Update Base.lua (#1667)

Code Formatting. General whitespace and spelling.
This commit is contained in:
TommyC81
2021-12-17 12:07:13 +04:00
committed by GitHub
parent 9c5561921b
commit e8e790102a
+26 -47
View File
@@ -7,7 +7,7 @@
-- * The construction and inheritance of MOOSE classes.
-- * The class naming and numbering system.
-- * The class hierarchy search system.
-- * The tracing of information or objects during mission execution for debuggin purposes.
-- * The tracing of information or objects during mission execution for debugging purposes.
-- * The subscription to DCS events for event handling in MOOSE objects.
-- * Object inspection.
--
@@ -49,7 +49,8 @@ local _ClassID = 0
-- # 2. Trace information for debugging.
--
-- The BASE class contains trace methods to trace progress within a mission execution of a certain object.
-- These trace methods are inherited by each MOOSE class interiting BASE, soeach object created from derived class from BASE can use the tracing methods to trace its execution.
-- These trace methods are inherited by each MOOSE class inheriting BASE, thus all objects created from
-- a class derived from BASE can use the tracing methods to trace its execution.
--
-- Any type of information can be passed to these tracing methods. See the following examples:
--
@@ -111,7 +112,6 @@ local _ClassID = 0
--
-- The method @{#BASE.IsTrace}() will validate if tracing is activated or not.
--
--
-- # 3. DCS simulator Event Handling.
--
-- The BASE class provides methods to catch DCS Events. These are events that are triggered from within the DCS simulator,
@@ -157,8 +157,6 @@ local _ClassID = 0
-- self:SmokeBlue()
-- end
--
--
--
-- See the @{Event} module for more information about event handling.
--
-- # 4. Class identification methods.
@@ -203,13 +201,12 @@ BASE = {
Scheduler = nil,
}
--- @field #BASE.__
BASE.__ = {}
--- @field #BASE._
BASE._ = {
Schedules = {} --- Contains the Schedulers Active
Schedules = {}, --- Contains the Schedulers Active
}
--- The Formation Class
@@ -217,11 +214,9 @@ BASE._ = {
-- @field Cone A cone formation.
FORMATION = {
Cone = "Cone",
Vee = "Vee"
Vee = "Vee",
}
--- BASE constructor.
--
-- This is an example how to use the BASE:New() constructor in a new class definition when inheriting from BASE.
@@ -275,7 +270,6 @@ function BASE:Inherit( Child, Parent )
return Child
end
local function getParent( Child )
local Parent = nil
@@ -291,7 +285,6 @@ local function getParent( Child )
return Parent
end
--- This is the worker method to retrieve the Parent class.
-- Note that the Parent class must be passed to call the parent class method.
--
@@ -304,7 +297,6 @@ end
-- @return #BASE
function BASE:GetParent( Child, FromClass )
local Parent
-- BASE class has no parent
if Child.ClassName == 'BASE' then
@@ -419,7 +411,6 @@ do -- Event Handling
return _EVENTDISPATCHER
end
--- Get the Class @{Event} processing Priority.
-- The Event processing Priority is a number from 1 to 10,
-- reflecting the order of the classes subscribed to the Event to be processed.
@@ -480,29 +471,29 @@ do -- Event Handling
-- @param Core.Event#EVENTDATA EventData The EventData structure.
--- Occurs whenever an object is hit by a weapon.
-- initiator : The unit object the fired the weapon
-- weapon: Weapon object that hit the target
-- initiator : The unit object the fired the weapon.
-- weapon: Weapon object that hit the target.
-- target: The Object that was hit.
-- @function [parent=#BASE] OnEventHit
-- @param #BASE self
-- @param Core.Event#EVENTDATA EventData The EventData structure.
--- Occurs when an aircraft takes off from an airbase, farp, or ship.
-- initiator : The unit that tookoff
-- place: Object from where the AI took-off from. Can be an Airbase Object, FARP, or Ships
-- initiator : The unit that took off.
-- place: Object from where the AI took-off from. Can be an Airbase Object, FARP, or Ships.
-- @function [parent=#BASE] OnEventTakeoff
-- @param #BASE self
-- @param Core.Event#EVENTDATA EventData The EventData structure.
--- Occurs when an aircraft lands at an airbase, farp or ship
-- initiator : The unit that has landed
-- place: Object that the unit landed on. Can be an Airbase Object, FARP, or Ships
-- initiator : The unit that has landed.
-- place: Object that the unit landed on. Can be an Airbase Object, FARP, or Ships.
-- @function [parent=#BASE] OnEventLand
-- @param #BASE self
-- @param Core.Event#EVENTDATA EventData The EventData structure.
--- Occurs when any aircraft crashes into the ground and is completely destroyed.
-- initiator : The unit that has crashed
-- initiator : The unit that has crashed.
-- @function [parent=#BASE] OnEventCrash
-- @param #BASE self
-- @param Core.Event#EVENTDATA EventData The EventData structure.
@@ -538,18 +529,18 @@ do -- Event Handling
-- @param Core.Event#EVENTDATA EventData The EventData structure.
--- Occurs when a ground unit captures either an airbase or a farp.
-- initiator : The unit that captured the base
-- initiator : The unit that captured the base.
-- place: The airbase that was captured, can be a FARP or Airbase. When calling place:getCoalition() the faction will already be the new owning faction.
-- @function [parent=#BASE] OnEventBaseCaptured
-- @param #BASE self
-- @param Core.Event#EVENTDATA EventData The EventData structure.
--- Occurs when a mission starts
--- Occurs when a mission starts.
-- @function [parent=#BASE] OnEventMissionStart
-- @param #BASE self
-- @param Core.Event#EVENTDATA EventData The EventData structure.
--- Occurs when a mission ends
--- Occurs when a mission ends.
-- @function [parent=#BASE] OnEventMissionEnd
-- @param #BASE self
-- @param Core.Event#EVENTDATA EventData The EventData structure.
@@ -561,25 +552,25 @@ do -- Event Handling
-- @param Core.Event#EVENTDATA EventData The EventData structure.
--- Occurs when any object is spawned into the mission.
-- initiator : The unit that was spawned
-- initiator : The unit that was spawned.
-- @function [parent=#BASE] OnEventBirth
-- @param #BASE self
-- @param Core.Event#EVENTDATA EventData The EventData structure.
--- Occurs when any system fails on a human controlled aircraft.
-- initiator : The unit that had the failure
-- initiator : The unit that had the failure.
-- @function [parent=#BASE] OnEventHumanFailure
-- @param #BASE self
-- @param Core.Event#EVENTDATA EventData The EventData structure.
--- Occurs when any aircraft starts its engines.
-- initiator : The unit that is starting its engines.
-- initiator : The unit that is starting its engines..
-- @function [parent=#BASE] OnEventEngineStartup
-- @param #BASE self
-- @param Core.Event#EVENTDATA EventData The EventData structure.
--- Occurs when any aircraft shuts down its engines.
-- initiator : The unit that is stopping its engines.
-- initiator : The unit that is stopping its engines..
-- @function [parent=#BASE] OnEventEngineShutdown
-- @param #BASE self
-- @param Core.Event#EVENTDATA EventData The EventData structure.
@@ -627,7 +618,6 @@ do -- Event Handling
-- @param #BASE self
-- @param Core.Event#EVENTDATA EventData The EventData structure.
--- Unknown precisely what creates this event, likely tied into newer damage model. Will update this page when new information become available.
--
-- * initiator: The unit that had the failure.
@@ -644,7 +634,7 @@ do -- Event Handling
--- Occurs on the death of a unit. Contains more and different information. Similar to unit_lost it will occur for aircraft before the aircraft crash event occurs.
--
-- * initiator: The unit that killed the target
-- * initiator: The unit that killed the target.
-- * target: Target Object
-- * weapon: Weapon Object
--
@@ -706,7 +696,6 @@ do -- Event Handling
-- @param #BASE self
-- @param Core.Event#EVENTDATA EventData The EventData structure.
--- Occurs when a player enters a slot and takes control of an aircraft.
-- **NOTE**: This is a workaround of a long standing DCS bug with the PLAYER_ENTER_UNIT event.
-- initiator : The unit that is being taken control of.
@@ -716,7 +705,6 @@ do -- Event Handling
end
--- Creation of a Birth Event.
-- @param #BASE self
-- @param DCS#Time EventTime The time stamp of the event.
@@ -733,7 +721,7 @@ function BASE:CreateEventBirth( EventTime, Initiator, IniUnitName, place, subpla
initiator = Initiator,
IniUnitName = IniUnitName,
place = place,
subplace = subplace
subplace = subplace,
}
world.onEvent( Event )
@@ -812,7 +800,7 @@ end
local Event = {
id = EVENTS.PlayerEnterAircraft,
time = timer.getTime(),
initiator = PlayerUnit:GetDCSObject()
initiator = PlayerUnit:GetDCSObject(),
}
world.onEvent( Event )
@@ -938,9 +926,8 @@ do -- Scheduling
end
--- Set a state or property of the Object given a Key and a Value.
-- Note that if the Object is destroyed, nillified or garbage collected, then the Values and Keys will also be gone.
-- Note that if the Object is destroyed, set to nil, or garbage collected, then the Values and Keys will also be gone.
-- @param #BASE self
-- @param Object The object that will hold the Value set by the Key.
-- @param Key The key that is used as a reference of the value. Note that the key can be a #string, but it can also be any other type!
@@ -956,9 +943,8 @@ function BASE:SetState( Object, Key, Value )
return self.States[ClassNameAndID][Key]
end
--- Get a Value given a Key from the Object.
-- Note that if the Object is destroyed, nillified or garbage collected, then the Values and Keys will also be gone.
-- Note that if the Object is destroyed, set to nil, or garbage collected, then the Values and Keys will also be gone.
-- @param #BASE self
-- @param Object The object that holds the Value set by the Key.
-- @param Key The key that is used to retrieve the value. Note that the key can be a #string, but it can also be any other type!
@@ -1010,8 +996,6 @@ function BASE:TraceOff()
self:TraceOnOff( false )
end
--- Set trace on or off
-- Note that when trace is off, no BASE.Debug statement is performed, increasing performance!
-- When Moose is loaded statically, (as one file), tracing is switched off by default.
@@ -1020,11 +1004,13 @@ end
-- @param #BASE self
-- @param #boolean TraceOnOff Switch the tracing on or off.
-- @usage
--
-- -- Switch the tracing On
-- BASE:TraceOnOff( true )
--
-- -- Switch the tracing Off
-- BASE:TraceOnOff( false )
--
function BASE:TraceOnOff( TraceOnOff )
if TraceOnOff == false then
self:I( "Tracing in MOOSE is OFF" )
@@ -1035,7 +1021,6 @@ function BASE:TraceOnOff( TraceOnOff )
end
end
--- Enquires if tracing is on (for the class).
-- @param #BASE self
-- @return #boolean
@@ -1140,7 +1125,6 @@ function BASE:F( Arguments )
end
end
--- Trace a function call level 2. Must be at the beginning of the function logic.
-- @param #BASE self
-- @param Arguments A #table or any field.
@@ -1215,7 +1199,6 @@ function BASE:T( Arguments )
end
end
--- Trace a function logic level 2. Can be anywhere within the function logic.
-- @param #BASE self
-- @param Arguments A #table or any field.
@@ -1273,7 +1256,6 @@ function BASE:E( Arguments )
end
--- Log an information which will be traced always. Can be anywhere within the function logic.
-- @param #BASE self
-- @param Arguments A #table or any field.
@@ -1301,8 +1283,6 @@ function BASE:I( Arguments )
end
--- old stuff
-- function BASE:_Destructor()
@@ -1311,7 +1291,6 @@ end
-- --self:EventRemoveAll()
-- end
-- THIS IS WHY WE NEED LUA 5.2 ...
-- function BASE:_SetDestructor()
--