mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge branch 'master' into develop
This commit is contained in:
commit
f984ff044b
@ -1851,7 +1851,26 @@ do -- Patrol methods
|
|||||||
|
|
||||||
-- Calculate the new Route.
|
-- Calculate the new Route.
|
||||||
local FromCoord = PatrolGroup:GetCoordinate()
|
local FromCoord = PatrolGroup:GetCoordinate()
|
||||||
local From = FromCoord:WaypointGround( 120 )
|
|
||||||
|
-- test for submarine
|
||||||
|
local depth = 0
|
||||||
|
local IsSub = false
|
||||||
|
if PatrolGroup:IsShip() then
|
||||||
|
local navalvec3 = FromCoord:GetVec3()
|
||||||
|
if navalvec3.y < 0 then
|
||||||
|
depth = navalvec3.y
|
||||||
|
IsSub = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local Waypoint = Waypoints[1]
|
||||||
|
local Speed = Waypoint.speed or (20 / 3.6)
|
||||||
|
local From = FromCoord:WaypointGround( Speed )
|
||||||
|
|
||||||
|
if IsSub then
|
||||||
|
From = FromCoord:WaypointNaval( Speed, Waypoint.alt )
|
||||||
|
end
|
||||||
|
|
||||||
table.insert( Waypoints, 1, From )
|
table.insert( Waypoints, 1, From )
|
||||||
|
|
||||||
@ -1892,7 +1911,16 @@ do -- Patrol methods
|
|||||||
if ToWaypoint then
|
if ToWaypoint then
|
||||||
FromWaypoint = ToWaypoint
|
FromWaypoint = ToWaypoint
|
||||||
end
|
end
|
||||||
|
-- test for submarine
|
||||||
|
local depth = 0
|
||||||
|
local IsSub = false
|
||||||
|
if PatrolGroup:IsShip() then
|
||||||
|
local navalvec3 = FromCoord:GetVec3()
|
||||||
|
if navalvec3.y < 0 then
|
||||||
|
depth = navalvec3.y
|
||||||
|
IsSub = true
|
||||||
|
end
|
||||||
|
end
|
||||||
-- Loop until a waypoint has been found that is not the same as the current waypoint.
|
-- Loop until a waypoint has been found that is not the same as the current waypoint.
|
||||||
-- Otherwise the object zon't move or drive in circles and the algorithm would not do exactly
|
-- Otherwise the object zon't move or drive in circles and the algorithm would not do exactly
|
||||||
-- what it is supposed to do, which is making groups drive around.
|
-- what it is supposed to do, which is making groups drive around.
|
||||||
@ -1907,9 +1935,13 @@ do -- Patrol methods
|
|||||||
local ToCoord = COORDINATE:NewFromVec2( { x = Waypoint.x, y = Waypoint.y } )
|
local ToCoord = COORDINATE:NewFromVec2( { x = Waypoint.x, y = Waypoint.y } )
|
||||||
-- Create a "ground route point", which is a "point" structure that can be given as a parameter to a Task
|
-- Create a "ground route point", which is a "point" structure that can be given as a parameter to a Task
|
||||||
local Route = {}
|
local Route = {}
|
||||||
|
if IsSub then
|
||||||
|
Route[#Route+1] = FromCoord:WaypointNaval( Speed, depth )
|
||||||
|
Route[#Route+1] = ToCoord:WaypointNaval( Speed, Waypoint.alt )
|
||||||
|
else
|
||||||
Route[#Route+1] = FromCoord:WaypointGround( Speed, Formation )
|
Route[#Route+1] = FromCoord:WaypointGround( Speed, Formation )
|
||||||
Route[#Route+1] = ToCoord:WaypointGround( Speed, Formation )
|
Route[#Route+1] = ToCoord:WaypointGround( Speed, Formation )
|
||||||
|
end
|
||||||
|
|
||||||
local TaskRouteToZone = PatrolGroup:TaskFunction( "CONTROLLABLE.PatrolRouteRandom", Speed, Formation, ToWaypoint )
|
local TaskRouteToZone = PatrolGroup:TaskFunction( "CONTROLLABLE.PatrolRouteRandom", Speed, Formation, ToWaypoint )
|
||||||
|
|
||||||
@ -1954,15 +1986,30 @@ do -- Patrol methods
|
|||||||
-- Calculate the new Route.
|
-- Calculate the new Route.
|
||||||
local FromCoord = PatrolGroup:GetCoordinate()
|
local FromCoord = PatrolGroup:GetCoordinate()
|
||||||
|
|
||||||
|
-- test for submarine
|
||||||
|
local depth = 0
|
||||||
|
local IsSub = false
|
||||||
|
if PatrolGroup:IsShip() then
|
||||||
|
local navalvec3 = FromCoord:GetVec3()
|
||||||
|
if navalvec3.y < 0 then
|
||||||
|
depth = navalvec3.y
|
||||||
|
IsSub = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Select a random Zone and get the Coordinate of the new Zone.
|
-- Select a random Zone and get the Coordinate of the new Zone.
|
||||||
local RandomZone = ZoneList[ math.random( 1, #ZoneList ) ] -- Core.Zone#ZONE
|
local RandomZone = ZoneList[ math.random( 1, #ZoneList ) ] -- Core.Zone#ZONE
|
||||||
local ToCoord = RandomZone:GetRandomCoordinate( 10 )
|
local ToCoord = RandomZone:GetRandomCoordinate( 10 )
|
||||||
|
|
||||||
-- Create a "ground route point", which is a "point" structure that can be given as a parameter to a Task
|
-- Create a "ground route point", which is a "point" structure that can be given as a parameter to a Task
|
||||||
local Route = {}
|
local Route = {}
|
||||||
|
if IsSub then
|
||||||
|
Route[#Route+1] = FromCoord:WaypointNaval( Speed, depth )
|
||||||
|
Route[#Route+1] = ToCoord:WaypointNaval( Speed, depth )
|
||||||
|
else
|
||||||
Route[#Route+1] = FromCoord:WaypointGround( Speed, Formation )
|
Route[#Route+1] = FromCoord:WaypointGround( Speed, Formation )
|
||||||
Route[#Route+1] = ToCoord:WaypointGround( Speed, Formation )
|
Route[#Route+1] = ToCoord:WaypointGround( Speed, Formation )
|
||||||
|
end
|
||||||
|
|
||||||
local TaskRouteToZone = PatrolGroup:TaskFunction( "CONTROLLABLE.PatrolZones", ZoneList, Speed, Formation, DelayMin, DelayMax )
|
local TaskRouteToZone = PatrolGroup:TaskFunction( "CONTROLLABLE.PatrolZones", ZoneList, Speed, Formation, DelayMin, DelayMax )
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user