* Remove utils.routines
This commit is contained in:
Applevangelist 2023-09-07 18:01:16 +02:00
parent 58f60dbf1b
commit 568f76b0b2
15 changed files with 28 additions and 32 deletions

View File

@ -229,7 +229,7 @@ FORMATION = {
-- @param #BASE self
-- @return #BASE
function BASE:New()
--local self = routines.utils.deepCopy( self ) -- Create a new self instance
--local self = UTILS.DeepCopy( self ) -- Create a new self instance
local self = UTILS.DeepCopy(self)
_ClassID = _ClassID + 1
@ -252,7 +252,7 @@ end
function BASE:Inherit( Child, Parent )
-- Create child.
local Child = routines.utils.deepCopy( Child )
local Child = UTILS.DeepCopy( Child )
if Child ~= nil then
@ -1167,7 +1167,7 @@ function BASE:_F( Arguments, DebugInfoCurrentParam, DebugInfoFromParam )
if DebugInfoFrom then
LineFrom = DebugInfoFrom.currentline
end
env.info( string.format( "%6d(%6d)/%1s:%30s%05d.%s(%s)", LineCurrent, LineFrom, "F", self.ClassName, self.ClassID, Function, routines.utils.oneLineSerialize( Arguments ) ) )
env.info( string.format( "%6d(%6d)/%1s:%30s%05d.%s(%s)", LineCurrent, LineFrom, "F", self.ClassName, self.ClassID, Function, UTILS.OneLineSerialize( Arguments ) ) )
end
end
end
@ -1241,7 +1241,7 @@ function BASE:_T( Arguments, DebugInfoCurrentParam, DebugInfoFromParam )
if DebugInfoFrom then
LineFrom = DebugInfoFrom.currentline
end
env.info( string.format( "%6d(%6d)/%1s:%30s%05d.%s", LineCurrent, LineFrom, "T", self.ClassName, self.ClassID, routines.utils.oneLineSerialize( Arguments ) ) )
env.info( string.format( "%6d(%6d)/%1s:%30s%05d.%s", LineCurrent, LineFrom, "T", self.ClassName, self.ClassID, UTILS.OneLineSerialize( Arguments ) ) )
end
end
end
@ -1311,9 +1311,9 @@ function BASE:E( Arguments )
LineFrom = DebugInfoFrom.currentline
end
env.info( string.format( "%6d(%6d)/%1s:%30s%05d.%s(%s)", LineCurrent, LineFrom, "E", self.ClassName, self.ClassID, Function, routines.utils.oneLineSerialize( Arguments ) ) )
env.info( string.format( "%6d(%6d)/%1s:%30s%05d.%s(%s)", LineCurrent, LineFrom, "E", self.ClassName, self.ClassID, Function, UTILS.OneLineSerialize( Arguments ) ) )
else
env.info( string.format( "%1s:%30s%05d(%s)", "E", self.ClassName, self.ClassID, routines.utils.oneLineSerialize( Arguments ) ) )
env.info( string.format( "%1s:%30s%05d(%s)", "E", self.ClassName, self.ClassID, UTILS.OneLineSerialize( Arguments ) ) )
end
end
@ -1338,9 +1338,9 @@ function BASE:I( Arguments )
LineFrom = DebugInfoFrom.currentline
end
env.info( string.format( "%6d(%6d)/%1s:%30s%05d.%s(%s)", LineCurrent, LineFrom, "I", self.ClassName, self.ClassID, Function, routines.utils.oneLineSerialize( Arguments ) ) )
env.info( string.format( "%6d(%6d)/%1s:%30s%05d.%s(%s)", LineCurrent, LineFrom, "I", self.ClassName, self.ClassID, Function, UTILS.OneLineSerialize( Arguments ) ) )
else
env.info( string.format( "%1s:%30s%05d(%s)", "I", self.ClassName, self.ClassID, routines.utils.oneLineSerialize( Arguments ) ) )
env.info( string.format( "%1s:%30s%05d(%s)", "I", self.ClassName, self.ClassID, UTILS.OneLineSerialize( Arguments ) ) )
end
end

View File

@ -1854,7 +1854,7 @@ function DATABASE:_RegisterTemplates()
self.Navpoints = {}
self.UNITS = {}
--Build routines.db.units and self.Navpoints
--Build self.Navpoints
for CoalitionName, coa_data in pairs(env.mission.coalition) do
self:T({CoalitionName=CoalitionName})
@ -1876,7 +1876,7 @@ function DATABASE:_RegisterTemplates()
for nav_ind, nav_data in pairs(coa_data.nav_points) do
if type(nav_data) == 'table' then
self.Navpoints[CoalitionName][nav_ind] = routines.utils.deepCopy(nav_data)
self.Navpoints[CoalitionName][nav_ind] = UTILS.DeepCopy(nav_data)
self.Navpoints[CoalitionName][nav_ind]['name'] = nav_data.callsignStr -- name is a little bit more self-explanatory.
self.Navpoints[CoalitionName][nav_ind]['point'] = {} -- point is used by SSE, support it.

View File

@ -208,7 +208,7 @@ SCHEDULER = {
-- @param #number RandomizeFactor Specifies a randomization factor between 0 and 1 to randomize the Repeat.
-- @param #number Stop Specifies the amount of seconds when the scheduler will be stopped.
-- @return #SCHEDULER self.
-- @return #table The ScheduleID of the planned schedule.
-- @return #string The ScheduleID of the planned schedule.
function SCHEDULER:New( MasterObject, SchedulerFunction, SchedulerArguments, Start, Repeat, RandomizeFactor, Stop )
local self = BASE:Inherit( self, BASE:New() ) -- #SCHEDULER

View File

@ -439,7 +439,7 @@ do -- SET_BASE
function SET_BASE:SetDatabase( BaseSet )
-- Copy the filter criteria of the BaseSet
local OtherFilter = routines.utils.deepCopy( BaseSet.Filter )
local OtherFilter = UTILS.DeepCopy( BaseSet.Filter )
self.Filter = OtherFilter
-- Now base the new Set on the BaseSet

View File

@ -1202,7 +1202,6 @@ function SPAWN:InitCleanUp( SpawnCleanUpInterval )
local SpawnGroup, SpawnCursor = self:GetFirstAliveGroup()
self:T( { "CleanUp Scheduler:", SpawnGroup } )
-- self.CleanUpFunction = routines.scheduleFunction( self._SpawnCleanUpScheduler, { self }, timer.getTime() + 1, SpawnCleanUpInterval )
self.CleanUpScheduler = SCHEDULER:New( self, self._SpawnCleanUpScheduler, {}, 1, SpawnCleanUpInterval, 0.2 )
return self
end

View File

@ -983,7 +983,7 @@ do -- Spot
end -- Spot
do -- Controller
--- Controller is an object that performs A.I.-routines. Other words controller is an instance of A.I.. Controller stores current main task, active enroute tasks and behavior options. Controller performs commands. Please, read DCS A-10C GUI Manual EN.pdf chapter "Task Planning for Unit Groups", page 91 to understand A.I. system of DCS:A-10C.
--- Controller is an object that performs A.I.-tasks. Other words controller is an instance of A.I.. Controller stores current main task, active enroute tasks and behavior options. Controller performs commands. Please, read DCS A-10C GUI Manual EN.pdf chapter "Task Planning for Unit Groups", page 91 to understand A.I. system of DCS:A-10C.
--
-- This class has 2 types of functions:
--

View File

@ -600,7 +600,7 @@ function ESCORT:MenuReportTargets( Seconds )
self.EscortMenuAttackNearbyTargets = MENU_GROUP:New( self.EscortClient:GetGroup(), "Attack targets", self.EscortMenu )
self.ReportTargetsScheduler = SCHEDULER:New( self, self._ReportTargetsScheduler, {}, 1, Seconds )
self.ReportTargetsScheduler, self.ReportTargetsSchedulerID = SCHEDULER:New( self, self._ReportTargetsScheduler, {}, 1, Seconds )
return self
end
@ -809,7 +809,7 @@ function ESCORT:_SwitchReportNearbyTargets( ReportTargets )
self.ReportTargetsScheduler:Schedule( self, self._ReportTargetsScheduler, {}, 1, 30 )
end
else
routines.removeFunction( self.ReportTargetsScheduler )
self.ReportTargetsScheduler:Remove(self.ReportTargetsSchedulerID)
self.ReportTargetsScheduler = nil
end
end

View File

@ -560,7 +560,7 @@ function MISSILETRAINER:_AddBearing( Client, TrainerWeapon )
local DirectionVector = { x = PositionMissile.x - TargetVec3.x, y = PositionMissile.y - TargetVec3.y, z = PositionMissile.z - TargetVec3.z }
local DirectionRadians = math.atan2( DirectionVector.z, DirectionVector.x )
--DirectionRadians = DirectionRadians + routines.getNorthCorrection( PositionTarget )
if DirectionRadians < 0 then
DirectionRadians = DirectionRadians + 2 * math.pi
end

View File

@ -55,7 +55,6 @@ end
--- Call this function to start the MOVEMENT scheduling.
function MOVEMENT:ScheduleStart()
self:F()
--self.MoveFunction = routines.scheduleFunction( self._Scheduler, { self }, timer.getTime() + 1, 120 )
self.MoveFunction = SCHEDULER:New( self, self._Scheduler, {}, 1, 120 )
end

View File

@ -1,5 +1,4 @@
__Moose.Include( 'Utilities\\Enums.lua' )
__Moose.Include( 'Utilities\\Routines.lua' )
__Moose.Include( 'Utilities\\Utils.lua' )
__Moose.Include( 'Utilities\\Profiler.lua' )
__Moose.Include( 'Utilities\\Templates.lua' )

View File

@ -25,7 +25,7 @@ routines.utils.round = function( number, decimals )
end
-- from http://lua-users.org/wiki/CopyTable
routines.utils.deepCopy = function( object )
UTILS.DeepCopy = function( object )
local lookup_table = {}
local function _copy( object )
if type( object ) ~= "table" then
@ -474,7 +474,7 @@ function routines.getRandPointInCircle( point, radius, innerRadius )
end
routines.goRoute = function( group, path )
local misTask = { id = 'Mission', params = { route = { points = routines.utils.deepCopy( path ) } } }
local misTask = { id = 'Mission', params = { route = { points = UTILS.DeepCopy( path ) } } }
if type( group ) == 'string' then
group = Group.getByName( group )
end
@ -1671,7 +1671,7 @@ routines.ground.patrolRoute = function( vars )
end
if pType and string.lower( pType ) == 'doubleback' then
local curRoute = routines.utils.deepCopy( useRoute )
local curRoute = UTILS.DeepCopy( useRoute )
for i = #curRoute, 2, -1 do
useRoute[#useRoute + 1] = routines.ground.buildWP( curRoute[i], curRoute[i].action, curRoute[i].speed )
end

View File

@ -324,7 +324,7 @@ UTILS.OneLineSerialize = function( tbl ) -- serialization of a table all on a s
ind_str[#ind_str + 1] = ']='
else --must be a string
ind_str[#ind_str + 1] = '['
ind_str[#ind_str + 1] = routines.utils.basicSerialize(ind)
ind_str[#ind_str + 1] = UTILS.BasicSerialize(ind)
ind_str[#ind_str + 1] = ']='
end
@ -335,7 +335,7 @@ UTILS.OneLineSerialize = function( tbl ) -- serialization of a table all on a s
tbl_str[#tbl_str + 1] = table.concat(ind_str)
tbl_str[#tbl_str + 1] = table.concat(val_str)
elseif type(val) == 'string' then
val_str[#val_str + 1] = routines.utils.basicSerialize(val)
val_str[#val_str + 1] = UTILS.BasicSerialize(val)
val_str[#val_str + 1] = ','
tbl_str[#tbl_str + 1] = table.concat(ind_str)
tbl_str[#tbl_str + 1] = table.concat(val_str)
@ -358,7 +358,7 @@ UTILS.OneLineSerialize = function( tbl ) -- serialization of a table all on a s
tbl_str[#tbl_str + 1] = "f() " .. tostring(ind)
tbl_str[#tbl_str + 1] = ',' --I think this is right, I just added it
else
env.info('unable to serialize value type ' .. routines.utils.basicSerialize(type(val)) .. ' at index ' .. tostring(ind))
env.info('unable to serialize value type ' .. UTILS.BasicSerialize(type(val)) .. ' at index ' .. tostring(ind))
env.info( debug.traceback() )
end

View File

@ -2829,7 +2829,7 @@ end
function CONTROLLABLE:GetTaskMission()
self:F2( self.ControllableName )
return routines.utils.deepCopy( _DATABASE.Templates.Controllables[self.ControllableName].Template )
return UTILS.DeepCopy( _DATABASE.Templates.Controllables[self.ControllableName].Template )
end
--- Return the mission route of the controllable.
@ -2838,7 +2838,7 @@ end
function CONTROLLABLE:GetTaskRoute()
self:F2( self.ControllableName )
return routines.utils.deepCopy( _DATABASE.Templates.Controllables[self.ControllableName].Template.route.points )
return UTILS.DeepCopy( _DATABASE.Templates.Controllables[self.ControllableName].Template.route.points )
end
--- Return the route of a controllable by using the @{Core.Database#DATABASE} class.
@ -2874,7 +2874,7 @@ function CONTROLLABLE:CopyRoute( Begin, End, Randomize, Radius )
for TPointID = Begin + 1, #Template.route.points - End do
if Template.route.points[TPointID] then
Points[#Points + 1] = routines.utils.deepCopy( Template.route.points[TPointID] )
Points[#Points + 1] = UTILS.DeepCopy( Template.route.points[TPointID] )
if Randomize then
if not Radius then
Radius = 500

View File

@ -2200,7 +2200,7 @@ end
function GROUP:GetTaskMission()
self:F2( self.GroupName )
return routines.utils.deepCopy( _DATABASE.Templates.Groups[self.GroupName].Template )
return UTILS.DeepCopy( _DATABASE.Templates.Groups[self.GroupName].Template )
end
--- Return the mission route of the group.
@ -2209,7 +2209,7 @@ end
function GROUP:GetTaskRoute()
self:F2( self.GroupName )
return routines.utils.deepCopy( _DATABASE.Templates.Groups[self.GroupName].Template.route.points )
return UTILS.DeepCopy( _DATABASE.Templates.Groups[self.GroupName].Template.route.points )
end
--- Return the route of a group by using the global _DATABASE object (an instance of @{Core.Database#DATABASE}).
@ -2245,7 +2245,7 @@ function GROUP:CopyRoute( Begin, End, Randomize, Radius )
for TPointID = Begin + 1, #Template.route.points - End do
if Template.route.points[TPointID] then
Points[#Points+1] = routines.utils.deepCopy( Template.route.points[TPointID] )
Points[#Points+1] = UTILS.DeepCopy( Template.route.points[TPointID] )
if Randomize then
if not Radius then
Radius = 500

View File

@ -1,5 +1,4 @@
Utilities/Enums.lua
Utilities/Routines.lua
Utilities/Utils.lua
Utilities/Enums.lua
Utilities/Profiler.lua