mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Create the PATROLZONE class
This commit is contained in:
parent
36b101fa6d
commit
b2bd37edbc
@ -13,13 +13,24 @@
|
|||||||
--
|
--
|
||||||
-- * @{#AIBALANCER.New}: Creates a new AIBALANCER object.
|
-- * @{#AIBALANCER.New}: Creates a new AIBALANCER object.
|
||||||
--
|
--
|
||||||
-- 1.2) AIBALANCER return AI to Airbases:
|
-- 1.2) AIBALANCER returns AI to Airbases:
|
||||||
-- --------------------------------------
|
-- ---------------------------------------
|
||||||
-- You can configure to have the AI to return to:
|
-- You can configure to have the AI to return to:
|
||||||
--
|
--
|
||||||
-- * @{#AIBALANCER.ReturnToHomeAirbase}: Returns the AI to the home @{Airbase#AIRBASE}.
|
-- * @{#AIBALANCER.ReturnToHomeAirbase}: Returns the AI to the home @{Airbase#AIRBASE}.
|
||||||
-- * @{#AIBALANCER.ReturnToNearestAirbases}: Returns the AI to the nearest friendly @{Airbase#AIRBASE}.
|
-- * @{#AIBALANCER.ReturnToNearestAirbases}: Returns the AI to the nearest friendly @{Airbase#AIRBASE}.
|
||||||
--
|
--
|
||||||
|
-- 1.3) AIBALANCER allows AI to patrol specific zones:
|
||||||
|
-- ---------------------------------------------------
|
||||||
|
-- Use @{AIBalancer#AIBALANCER.AddPatrolZone}() to specify zones where airplanes need patrol a zone ( @{Zone} ) for a specific time, at a specific altitude, with a specific speed.
|
||||||
|
-- Multiple zones can be patrolled, calling @{AIBalancer#AIBALANCER.AddPatrolZone}() multiple times. The AI will patrol at a random zone in the list.
|
||||||
|
-- And when the PatrolTime is finished, it will patrol another zone.
|
||||||
|
--
|
||||||
|
-- 1.4) AIRBALANCER manages AI out of fuel events:
|
||||||
|
-- -----------------------------------------------
|
||||||
|
-- Once an AI is out of fuel, it will contact the home base, so that on time, a new replacement AI is spawned, while the old will orbit for a specific time and RTB.
|
||||||
|
-- Use @{AIBalancer#AIBALANCER.GuardFuel}() to guard for each AI the fuel status.
|
||||||
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- CREDITS
|
-- CREDITS
|
||||||
@ -28,6 +39,10 @@
|
|||||||
-- Working together with James has resulted in the creation of the AIBALANCER class.
|
-- Working together with James has resulted in the creation of the AIBALANCER class.
|
||||||
-- James has shared his ideas on balancing AI with air units, and together we made a first design which you can use now :-)
|
-- James has shared his ideas on balancing AI with air units, and together we made a first design which you can use now :-)
|
||||||
--
|
--
|
||||||
|
-- **SNAFU**
|
||||||
|
-- Had a couple of mails with the guys to validate, if the same concept in the GTI/CAP script could be reworked within MOOSE.
|
||||||
|
-- Non of the script code has been used however within the new AIBALANCER moose class.
|
||||||
|
--
|
||||||
-- @module AIBalancer
|
-- @module AIBalancer
|
||||||
-- @author FlightControl
|
-- @author FlightControl
|
||||||
|
|
||||||
|
|||||||
60
Moose Development/Moose/PatrolZone.lua
Normal file
60
Moose Development/Moose/PatrolZone.lua
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
--- This module contains the PATROLZONE class.
|
||||||
|
--
|
||||||
|
-- ===
|
||||||
|
--
|
||||||
|
-- 1) @{Patrol#PATROLZONE} class, extends @{Base#BASE}
|
||||||
|
-- ===================================================
|
||||||
|
-- The @{Patrol#PATROLZONE} class implements the core functions to patrol a @{Zone}.
|
||||||
|
--
|
||||||
|
-- 1.1) PATROLZONE constructor:
|
||||||
|
-- ----------------------------
|
||||||
|
-- @{PatrolZone#PATROLZONE.New}(): Creates a new PATROLZONE object.
|
||||||
|
--
|
||||||
|
-- 1.2) Modify the PATROLZONE parameters:
|
||||||
|
-- --------------------------------------
|
||||||
|
-- The following methods are available to modify the parameters of a PATROLZONE object:
|
||||||
|
--
|
||||||
|
-- * @{PatrolZone#PATROLZONE.SetSpeed}(): Set the patrol speed of the AI, while patrolling.
|
||||||
|
-- * @{PatrolZone#PATROLZONE.SetAltitude}(): Set altitude of the AI, while patrolling.
|
||||||
|
--
|
||||||
|
-- ===
|
||||||
|
--
|
||||||
|
-- @module PatrolZone
|
||||||
|
-- @author FlightControl
|
||||||
|
|
||||||
|
|
||||||
|
--- PATROLZONE class
|
||||||
|
-- @type PATROLZONE
|
||||||
|
-- @extends Base#BASE
|
||||||
|
PATROLZONE = {
|
||||||
|
ClassName = "PATROLZONE",
|
||||||
|
}
|
||||||
|
|
||||||
|
--- Creates a new PATROLZONE object, taking a @{Group} object as a parameter. The GROUP needs to be alive.
|
||||||
|
-- @param #PATROLZONE self
|
||||||
|
-- @param Group#GROUP PatrolGroup The @{Group} patrolling.
|
||||||
|
-- @param Zone#ZONE_BASE PatrolZone The @{Zone} where the patrol needs to be executed.
|
||||||
|
-- @param DCSTypes#Altitude PatrolFloorAltitude The lowest altitude in meters where to execute the patrol.
|
||||||
|
-- @param DCSTypes#Altitude PatrolCeilingAltitude The highest altitude in meters where to execute the patrol.
|
||||||
|
-- @param DCSTypes#Speed PatrolMinSpeed The minimum speed of the @{Group} in km/h.
|
||||||
|
-- @param DCSTypes#Speed PatrolMaxSpeed The maximum speed of the @{Group} in km/h.
|
||||||
|
-- @return #PATROLZONE self
|
||||||
|
-- @usage
|
||||||
|
-- -- Define a new PATROLZONE Object. This PatrolArea will patrol a group within PatrolZone between 3000 and 6000 meters, with a variying speed between 600 and 900 km/h.
|
||||||
|
-- PatrolZone = ZONE:New( 'PatrolZone' )
|
||||||
|
-- PatrolGroup = GROUP:FindByName( "Patrol Group" )
|
||||||
|
-- PatrolArea = PATROLZONE:New( PatrolGroup, PatrolZone, 3000, 6000, 600, 900 )
|
||||||
|
function PATROLZONE:New( PatrolGroup, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed )
|
||||||
|
|
||||||
|
-- Inherits from BASE
|
||||||
|
local self = BASE:Inherit( self, BASE:New() )
|
||||||
|
|
||||||
|
self.PatrolGroup = PatrolGroup
|
||||||
|
self.PatrolZone = PatrolZone
|
||||||
|
self.PatrolFloorAltitude = PatrolFloorAltitude
|
||||||
|
self.PatrolCeilingAltitude = PatrolCeilingAltitude
|
||||||
|
self.PatrolMinSpeed = PatrolMinSpeed
|
||||||
|
self.PatrolMaxSpeed = PatrolMaxSpeed
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
@ -238,8 +238,6 @@ SET_BASE = {
|
|||||||
-- DBObject = SET_BASE:New()
|
-- DBObject = SET_BASE:New()
|
||||||
function SET_BASE:New( Database )
|
function SET_BASE:New( Database )
|
||||||
|
|
||||||
env.info( tostring( Database ) )
|
|
||||||
|
|
||||||
-- Inherits from BASE
|
-- Inherits from BASE
|
||||||
local self = BASE:Inherit( self, BASE:New() )
|
local self = BASE:Inherit( self, BASE:New() )
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user