diff --git a/Moose Development/Moose/Core/Point.lua b/Moose Development/Moose/Core/Point.lua index e31653d0e..cfb27e42f 100644 --- a/Moose Development/Moose/Core/Point.lua +++ b/Moose Development/Moose/Core/Point.lua @@ -38,6 +38,8 @@ -- -- Hereby the change log: -- +-- 2017-02-18: POINT_VEC3:**NewFromVec2( Vec2, LandHeightAdd )** added. +-- -- 2016-08-12: POINT_VEC3:**Translate( Distance, Angle )** added. -- -- 2016-08-06: Made PointVec3 and Vec3, PointVec2 and Vec2 terminology used in the code consistent. @@ -127,6 +129,24 @@ function POINT_VEC3:New( x, y, z ) return self end +--- Create a new POINT_VEC3 object from Vec2 coordinates. +-- @param #POINT_VEC3 self +-- @param Dcs.DCSTypes#Vec2 Vec2 The Vec2 point. +-- @return Core.Point#POINT_VEC3 self +function POINT_VEC3:NewFromVec2( Vec2, LandHeightAdd ) + + local LandHeight = land.getHeight( Vec2 ) + + LandHeightAdd = LandHeightAdd or 0 + LandHeight = LandHeight + LandHeightAdd + + self = self:New( Vec2.x, LandHeight, Vec2.y ) + + self:F2( self ) + + return self +end + --- Create a new POINT_VEC3 object from Vec3 coordinates. -- @param #POINT_VEC3 self -- @param Dcs.DCSTypes#Vec3 Vec3 The Vec3 point. diff --git a/Moose Development/Moose/Core/Zone.lua b/Moose Development/Moose/Core/Zone.lua index e9eef3e1b..87ce48bce 100644 --- a/Moose Development/Moose/Core/Zone.lua +++ b/Moose Development/Moose/Core/Zone.lua @@ -1,4 +1,5 @@ ---- This module contains the ZONE classes, inherited from @{Zone#ZONE_BASE}. +--- This core module contains the ZONE classes, inherited from @{Zone#ZONE_BASE}. +-- -- There are essentially two core functions that zones accomodate: -- -- * Test if an object is within the zone boundaries. @@ -24,94 +25,111 @@ -- -- === -- --- 1) @{Zone#ZONE_BASE} class, extends @{Base#BASE} --- ================================================ +-- # 1) @{Zone#ZONE_BASE} class, extends @{Base#BASE} +-- -- This class is an abstract BASE class for derived classes, and is not meant to be instantiated. -- --- ### 1.1) Each zone has a name: +-- ## 1.1) Each zone has a name: -- -- * @{#ZONE_BASE.GetName}(): Returns the name of the zone. -- --- ### 1.2) Each zone implements two polymorphic functions defined in @{Zone#ZONE_BASE}: +-- ## 1.2) Each zone implements two polymorphic functions defined in @{Zone#ZONE_BASE}: -- -- * @{#ZONE_BASE.IsPointVec2InZone}(): Returns if a @{Point#POINT_VEC2} is within the zone. -- * @{#ZONE_BASE.IsPointVec3InZone}(): Returns if a @{Point#POINT_VEC3} is within the zone. -- --- ### 1.3) A zone has a probability factor that can be set to randomize a selection between zones: +-- ## 1.3) A zone has a probability factor that can be set to randomize a selection between zones: -- -- * @{#ZONE_BASE.SetRandomizeProbability}(): Set the randomization probability of a zone to be selected, taking a value between 0 and 1 ( 0 = 0%, 1 = 100% ) -- * @{#ZONE_BASE.GetRandomizeProbability}(): Get the randomization probability of a zone to be selected, passing a value between 0 and 1 ( 0 = 0%, 1 = 100% ) -- * @{#ZONE_BASE.GetZoneMaybe}(): Get the zone taking into account the randomization probability. nil is returned if this zone is not a candidate. -- --- ### 1.4) A zone manages Vectors: +-- ## 1.4) A zone manages Vectors: -- -- * @{#ZONE_BASE.GetVec2}(): Returns the @{DCSTypes#Vec2} coordinate of the zone. -- * @{#ZONE_BASE.GetRandomVec2}(): Define a random @{DCSTypes#Vec2} within the zone. -- --- ### 1.5) A zone has a bounding square: +-- ## 1.5) A zone has a bounding square: -- -- * @{#ZONE_BASE.GetBoundingSquare}(): Get the outer most bounding square of the zone. -- --- ### 1.6) A zone can be marked: +-- ## 1.6) A zone can be marked: -- -- * @{#ZONE_BASE.SmokeZone}(): Smokes the zone boundaries in a color. -- * @{#ZONE_BASE.FlareZone}(): Flares the zone boundaries in a color. -- -- === -- --- 2) @{Zone#ZONE_RADIUS} class, extends @{Zone#ZONE_BASE} --- ======================================================= +-- # 2) @{Zone#ZONE_RADIUS} class, extends @{Zone#ZONE_BASE} +-- -- The ZONE_RADIUS class defined by a zone name, a location and a radius. -- This class implements the inherited functions from Core.Zone#ZONE_BASE taking into account the own zone format and properties. -- --- ### 2.1) @{Zone#ZONE_RADIUS} constructor: +-- ## 2.1) @{Zone#ZONE_RADIUS} constructor -- --- * @{#ZONE_BASE.New}(): Constructor. +-- * @{#ZONE_RADIUS.New}(): Constructor. -- --- ### 2.2) Manage the radius of the zone: +-- ## 2.2) Manage the radius of the zone -- --- * @{#ZONE_BASE.SetRadius}(): Sets the radius of the zone. --- * @{#ZONE_BASE.GetRadius}(): Returns the radius of the zone. +-- * @{#ZONE_RADIUS.SetRadius}(): Sets the radius of the zone. +-- * @{#ZONE_RADIUS.GetRadius}(): Returns the radius of the zone. -- --- ### 2.3) Manage the location of the zone: +-- ## 2.3) Manage the location of the zone -- --- * @{#ZONE_BASE.SetVec2}(): Sets the @{DCSTypes#Vec2} of the zone. --- * @{#ZONE_BASE.GetVec2}(): Returns the @{DCSTypes#Vec2} of the zone. --- * @{#ZONE_BASE.GetVec3}(): Returns the @{DCSTypes#Vec3} of the zone, taking an additional height parameter. +-- * @{#ZONE_RADIUS.SetVec2}(): Sets the @{DCSTypes#Vec2} of the zone. +-- * @{#ZONE_RADIUS.GetVec2}(): Returns the @{DCSTypes#Vec2} of the zone. +-- * @{#ZONE_RADIUS.GetVec3}(): Returns the @{DCSTypes#Vec3} of the zone, taking an additional height parameter. +-- +-- ## 2.4) Zone point randomization +-- +-- Various functions exist to find random points within the zone. +-- +-- * @{#ZONE_RADIUS.GetRandomVec2}(): Gets a random 2D point in the zone. +-- * @{#ZONE_RADIUS.GetRandomPointVec2}(): Gets a @{Point#POINT_VEC2} object representing a random 2D point in the zone. +-- * @{#ZONE_RADIUS.GetRandomPointVec3}(): Gets a @{Point#POINT_VEC3} object representing a random 3D point in the zone. Note that the height of the point is at landheight. -- -- === -- --- 3) @{Zone#ZONE} class, extends @{Zone#ZONE_RADIUS} --- ========================================== +-- # 3) @{Zone#ZONE} class, extends @{Zone#ZONE_RADIUS} +-- -- The ZONE class, defined by the zone name as defined within the Mission Editor. -- This class implements the inherited functions from {Core.Zone#ZONE_RADIUS} taking into account the own zone format and properties. -- -- === -- --- 4) @{Zone#ZONE_UNIT} class, extends @{Zone#ZONE_RADIUS} --- ======================================================= +-- # 4) @{Zone#ZONE_UNIT} class, extends @{Zone#ZONE_RADIUS} +-- -- The ZONE_UNIT class defined by a zone around a @{Unit#UNIT} with a radius. -- This class implements the inherited functions from @{Zone#ZONE_RADIUS} taking into account the own zone format and properties. -- -- === -- --- 5) @{Zone#ZONE_GROUP} class, extends @{Zone#ZONE_RADIUS} --- ======================================================= +-- # 5) @{Zone#ZONE_GROUP} class, extends @{Zone#ZONE_RADIUS} +-- -- The ZONE_GROUP class defines by a zone around a @{Group#GROUP} with a radius. The current leader of the group defines the center of the zone. -- This class implements the inherited functions from @{Zone#ZONE_RADIUS} taking into account the own zone format and properties. -- -- === -- --- 6) @{Zone#ZONE_POLYGON_BASE} class, extends @{Zone#ZONE_BASE} --- ======================================================== +-- # 6) @{Zone#ZONE_POLYGON_BASE} class, extends @{Zone#ZONE_BASE} +-- -- The ZONE_POLYGON_BASE class defined by a sequence of @{Group#GROUP} waypoints within the Mission Editor, forming a polygon. -- This class implements the inherited functions from @{Zone#ZONE_RADIUS} taking into account the own zone format and properties. -- This class is an abstract BASE class for derived classes, and is not meant to be instantiated. -- +-- ## 6.1) Zone point randomization +-- +-- Various functions exist to find random points within the zone. +-- +-- * @{#ZONE_POLYGON_BASE.GetRandomVec2}(): Gets a random 2D point in the zone. +-- * @{#ZONE_POLYGON_BASE.GetRandomPointVec2}(): Return a @{Point#POINT_VEC2} object representing a random 2D point within the zone. +-- * @{#ZONE_POLYGON_BASE.GetRandomPointVec3}(): Return a @{Point#POINT_VEC3} object representing a random 3D point at landheight within the zone. +-- +-- -- === -- --- 7) @{Zone#ZONE_POLYGON} class, extends @{Zone#ZONE_POLYGON_BASE} --- ================================================================ +-- # 7) @{Zone#ZONE_POLYGON} class, extends @{Zone#ZONE_POLYGON_BASE} +-- -- The ZONE_POLYGON class defined by a sequence of @{Group#GROUP} waypoints within the Mission Editor, forming a polygon. -- This class implements the inherited functions from @{Zone#ZONE_RADIUS} taking into account the own zone format and properties. -- @@ -127,6 +145,14 @@ -- -- Hereby the change log: -- +-- 2017-02-18: ZONE_POLYGON_BASE:**GetRandomPointVec2()** added. +-- +-- 2017-02-18: ZONE_POLYGON_BASE:**GetRandomPointVec3()** added. +-- +-- 2017-02-18: ZONE_RADIUS:**GetRandomPointVec3( inner, outer )** added. +-- +-- 2017-02-18: ZONE_RADIUS:**GetRandomPointVec2( inner, outer )** added. +-- -- 2016-08-15: ZONE_BASE:**GetName()** added. -- -- 2016-08-15: ZONE_BASE:**SetZoneProbability( ZoneProbability )** added. @@ -265,7 +291,6 @@ function ZONE_BASE:GetPointVec3( Height ) end - --- Define a random @{DCSTypes#Vec2} within the zone. -- @param #ZONE_BASE self -- @return Dcs.DCSTypes#Vec2 The Vec2 coordinates. @@ -273,6 +298,20 @@ function ZONE_BASE:GetRandomVec2() return nil end +--- Define a random @{Point#POINT_VEC2} within the zone. +-- @param #ZONE_BASE self +-- @return Core.Point#POINT_VEC2 The PointVec2 coordinates. +function ZONE_BASE:GetRandomPointVec2() + return nil +end + +--- Define a random @{Point#POINT_VEC3} within the zone. +-- @param #ZONE_BASE self +-- @return Core.Point#POINT_VEC3 The PointVec3 coordinates. +function ZONE_BASE:GetRandomPointVec3() + return nil +end + --- Get the bounding square the zone. -- @param #ZONE_BASE self -- @return #nil The bounding square. @@ -501,12 +540,12 @@ function ZONE_RADIUS:IsPointVec3InZone( Vec3 ) return InZone end ---- Returns a random location within the zone. +--- Returns a random Vec2 location within the zone. -- @param #ZONE_RADIUS self --- @param #number inner minimal distance from the center of the zone --- @param #number outer minimal distance from the outer edge of the zone +-- @param #number inner (optional) Minimal distance from the center of the zone. Default is 0. +-- @param #number outer (optional) Maximal distance from the outer edge of the zone. Default is the radius of the zone. -- @return Dcs.DCSTypes#Vec2 The random location within the zone. -function ZONE_RADIUS:GetRandomVec2(inner, outer) +function ZONE_RADIUS:GetRandomVec2( inner, outer ) self:F( self.ZoneName, inner, outer ) local Point = {} @@ -523,6 +562,36 @@ function ZONE_RADIUS:GetRandomVec2(inner, outer) return Point end +--- Returns a @{Point#POINT_VEC2} object reflecting a random 2D location within the zone. +-- @param #ZONE_RADIUS self +-- @param #number inner (optional) Minimal distance from the center of the zone. Default is 0. +-- @param #number outer (optional) Maximal distance from the outer edge of the zone. Default is the radius of the zone. +-- @return Core.Point#POINT_VEC2 The @{Point#POINT_VEC2} object reflecting the random 3D location within the zone. +function ZONE_RADIUS:GetRandomPointVec2( inner, outer ) + self:F( self.ZoneName, inner, outer ) + + local PointVec2 = POINT_VEC2:NewFromVec2( self:GetRandomVec2() ) + + self:T3( { PointVec2 } ) + + return PointVec2 +end + +--- Returns a @{Point#POINT_VEC3} object reflecting a random 3D location within the zone. +-- @param #ZONE_RADIUS self +-- @param #number inner (optional) Minimal distance from the center of the zone. Default is 0. +-- @param #number outer (optional) Maximal distance from the outer edge of the zone. Default is the radius of the zone. +-- @return Core.Point#POINT_VEC3 The @{Point#POINT_VEC3} object reflecting the random 3D location within the zone. +function ZONE_RADIUS:GetRandomPointVec3( inner, outer ) + self:F( self.ZoneName, inner, outer ) + + local PointVec3 = POINT_VEC3:NewFromVec2( self:GetRandomVec2() ) + + self:T3( { PointVec3 } ) + + return PointVec3 +end + --- The ZONE class, defined by the zone name as defined within the Mission Editor. The location and the radius are automatically collected from the mission settings. @@ -837,6 +906,33 @@ function ZONE_POLYGON_BASE:GetRandomVec2() return Vec2 end +--- Return a @{Point#POINT_VEC2} object representing a random 2D point at landheight within the zone. +-- @param #ZONE_POLYGON_BASE self +-- @return @{Point#POINT_VEC2} +function ZONE_POLYGON_BASE:GetRandomPointVec2() + self:F2() + + local PointVec2 = POINT_VEC2:NewFromVec2( self:GetRandomVec2() ) + + self:T2( PointVec2 ) + + return PointVec2 +end + +--- Return a @{Point#POINT_VEC3} object representing a random 3D point at landheight within the zone. +-- @param #ZONE_POLYGON_BASE self +-- @return @{Point#POINT_VEC3} +function ZONE_POLYGON_BASE:GetRandomPointVec3() + self:F2() + + local PointVec3 = POINT_VEC3:NewFromVec2( self:GetRandomVec2() ) + + self:T2( PointVec3 ) + + return PointVec3 +end + + --- Get the bounding square the zone. -- @param #ZONE_POLYGON_BASE self -- @return #ZONE_POLYGON_BASE.BoundingSquare The bounding square. diff --git a/Moose Development/Moose/Functional/MissileTrainer.lua b/Moose Development/Moose/Functional/MissileTrainer.lua index 094b7d044..511cbca44 100644 --- a/Moose Development/Moose/Functional/MissileTrainer.lua +++ b/Moose Development/Moose/Functional/MissileTrainer.lua @@ -501,9 +501,8 @@ function MISSILETRAINER:OnEventShot( EVentData ) end else -- TODO: some weapons don't know the target unit... Need to develop a workaround for this. - SCHEDULER:New( TrainerWeapon, TrainerWeapon.destroy, {}, 2 ) - if ( TrainerWeapon:getTypeName() == "9M311" ) then - SCHEDULER:New( TrainerWeapon, TrainerWeapon.destroy, {}, 2 ) + if ( TrainerWeapon:getTypeName() == "9M311" ) then + SCHEDULER:New( TrainerWeapon, TrainerWeapon.destroy, {}, 1 ) else end end diff --git a/Moose Development/ReleaseNotes.txt b/Moose Development/ReleaseNotes.txt index ba7807ff0..64a580998 100644 --- a/Moose Development/ReleaseNotes.txt +++ b/Moose Development/ReleaseNotes.txt @@ -1,10 +1,18 @@ +2017-02-18 + + - Reworked some vector functions. + -- POINT_VEC3:NewFromVec2( Vec2, LandHeightAdd ) added. + -- ZONE_RADIUS:GetRandomPointVec2( inner, outer ) added. + -- ZONE_RADIUS:GetRandomPointVec3( inner, outer ) added. + -- ZONE_POLYGON_BASE:GetRandomPointVec2() added. + -- ZONE_POLYGON_BASE:GetRandomPointVec3() added. + 2017-02-17 - Added ACT_ROUTE_POINT -- Routes a controllable to a point with a defined distance. -- Upon arrived within the engagement distance, an arrival text is shown. - - + 2016-12-06 - Renamed the documentation references following the structure of the files. diff --git a/Moose Test Missions/EVT - Event Handling/EVT-501 - OnEventLand LandingChallengeComplex/EVT-501 - OnEventLand LandingChallengeComplex.lua b/Moose Test Missions/EVT - Event Handling/EVT-501 - OnEventLand LandingChallengeComplex/EVT-501 - OnEventLand LandingChallengeComplex.lua new file mode 100644 index 000000000..469122ac9 --- /dev/null +++ b/Moose Test Missions/EVT - Event Handling/EVT-501 - OnEventLand LandingChallengeComplex/EVT-501 - OnEventLand LandingChallengeComplex.lua @@ -0,0 +1,151 @@ +--- +-- Name: EVT-103 - OnEventLand LandingChallengeComplex +-- Author: CraigOwen +-- Date Created: 12 February 2017 +-- +-- # Situation: +-- +-- Approaching the airfield the client gets a message and can try to land inside the landing zones. +-- Here we want all clients to participate in the challenge, not only one. +-- When the plane landed in one of the zones, a vehicle flares and a message ist printed out to the client. +-- +-- # Test cases: +-- +-- 1. Land one of the planes. +-- 2. While landing the plane, observe your message and the signal (flare). +-- 3. Check the contents of the fields of the S_EVENT_LAND entry in the dcs.log file. + +-- In this advanced challenge we want to make sure all the following. +-- 1. The challenge takes place at a certain airfield. +-- 2. All clients can repeat the challange at any time, try after try. +-- 3. All clients approaching the airport get a message indicating the challenge. +-- 4. There is no useraction needet to participate in this, providing full focus on the task. + +-- So lets go then... in five steps +-- 1. Create a unit to signalize (flare) whenever a client landed correctly +-- 2. Create Zones +-- 3. Create a set of clients +-- 4. Handle the EVENT.Land for all clients in the set using the signal unit +-- 5. Create a scheduler checking for clients in zones + +-- 1. Create a unit which signalizes if the client landed good. +signal = UNIT:FindByName("LandingZoneChallenge - Signal") + +-- 2. Create Zones +-- Init Zone - This is the global Zone for the LandingChallenge +InitZone = ZONE:New("LandingChallange - InitZone") + +--Ingress Zone - This Zone tries to asure the client approaches the runway from the right side +IngressZoneTemplate = GROUP:FindByName( "LandingZoneChallenge - IngressZone" ) +IngressZone = ZONE_POLYGON:New( "IngressZone", IngressZoneTemplate ) + +-- Ropes - theese zones will simulate the ropes on a carrier. +zonegroup1 = GROUP:FindByName("LandingZoneChallenge - Rope 1" ) +zonegroup2 = GROUP:FindByName("LandingZoneChallenge - Rope 2" ) +zonegroup3 = GROUP:FindByName("LandingZoneChallenge - Rope 3" ) +LandZoneRope1 = ZONE_POLYGON:New( "Rope1", zonegroup1) +LandZoneRope2 = ZONE_POLYGON:New( "Rope2", zonegroup2) +LandZoneRope3 = ZONE_POLYGON:New( "Rope3", zonegroup3) + + +-- 3. Create a set of clients +-- In this example we do not want to handle the event for one specific client, but rather for all red plane clients. +-- To achieve this, we start with filtering the clients and saving those into the "BlueClients" variable +RedClients = SET_CLIENT:New():FilterCoalitions("red"):FilterStart() + + +-- 4. We want to let every client subscribe to the event EVENT.Land. This event occurs when a plane lands. Be aware that this could be any airfield at this point. +-- To do so, we run the ForEachClient method on our set of clients and call a function taking the client as parameter +RedClients:ForEachClient( + --- This function will be called for every single client in the set + -- @param MooseClient#CLIENT ClientInSet + function( ClientInSet ) + + -- Inside here we want to do two things. + -- 1. Write down the local function doing all the magic. + -- 2. Call this function for each ClientInSet + + -- 1. The magic + local function ResetClientForZone( MooseClient ) + --At first we set this client to a state, in wich she/he is not participating in this event + MooseClient:SetState( MooseClient, "ZoneStep", "0" ) + + --Now we subscribe to the event just like we did in the first example. + MooseClient:HandleEvent(EVENTS.Land) + + + --- Finally we set up the so called handler FOR the event. This is a function wich will determine what happens, whenever a client lands. + -- Note here, that the function has the MooseClient in front. So this function will literaly get a part of the client itself. + -- Therefore we can refere to "self" inside the function whenever meaning the MooseClient + -- The param EventData is a parameter given to all event handlers and providing several data about this particular event. + -- @param Core.Event#EVENTDATA EventData + function MooseClient:OnEventLand( EventData ) + + -- Ok now the client "MooseClient" definetly has landed. And beeing here means being the client. MooseClient <-> self + -- So now i want to know 2 things, to verify that i have done everything right. + -- 1. I want to know if my(self) landed in the challengeZone, so landing in other places will not react to this challenge + -- 2. Furthermore i want to know if my(self) came from the right side. + -- In all other cases nothing shell happen, so we reset the client state here and return doin nothing else. + if not self:IsInZone(InitZone) or self:GetState( self, "ZoneStep" ) ~= "2" then + self:SetState( self, "ZoneStep", "0" ) + return + end + + -- Here we check wich rope was picked and set the signal and message according to it. + if self:IsInZone(LandZoneRope1) then + MESSAGE:New("Great job! You picked the first rope.", 15, "Landing challenge" ):ToClient( self ) + signal:FlareGreen() + elseif self:IsInZone(LandZoneRope2) then + MESSAGE:New("Good job! You picked the second rope.", 15, "Landing challenge" ):ToClient( self ) + signal:FlareYellow() + elseif self:IsInZone(LandZoneRope3) then + MESSAGE:New("Close! You picked the last rope.", 15, "Landing challenge" ):ToClient( self ) + signal:FlareRed() + else + MESSAGE:New("Too bad, no rope picked! Thrust your engines and try again.", 15, "Landing challenge" ):ToClient( self ) + end + + -- Finally we set the client back to step 1, allowing a new message for landing + self:SetState( self, "ZoneStep", "1" ) + + end + end + + -- 2. As we're now all set, we can finally call our function for every ClientInSet + ClientInSet:Alive( ResetClientForZone ) + + end + ) + +-- 5. Finally we use a scheduler checking wether clients are inside or outside these zones. +LandingChallangeActionsScheduler, LandingChallangeActionsSchedulerID = SCHEDULER:New( nil, + function () + + -- Flying by the airport there will be a message showing that the landing challange is currently in place. + -- This will make the ClientState shift from 0 -> 1 + RedClients:ForEachClientInZone( InitZone, + function( MooseClient ) + BASE:E( { Client = MooseClient, State = MooseClient:GetState( MooseClient, "ZoneStep" ) } ) + if MooseClient:IsAlive() and MooseClient:GetState( MooseClient, "ZoneStep" ) == "0" then + MooseClient:SetState( MooseClient, "ZoneStep", "1" ) + MESSAGE:New("Welcome to the Landing challenge. If you want to participate, get yourself a landing clearance by ATC and navigate to the landing corridor.", 20, "Landing challenge" ):ToClient( MooseClient ) + end + end + ) + + -- The client is approaching the runway from the correct side? + -- If yes, then shift state from 1 to 2 + RedClients:ForEachClientInZone( IngressZone, + function( MooseClient ) + BASE:E( { Client = MooseClient, State = MooseClient:GetState( MooseClient, "ZoneStep" ) } ) + if MooseClient:IsAlive() and MooseClient:GetState( MooseClient, "ZoneStep" ) == "1" then + MooseClient:SetState( MooseClient, "ZoneStep", "2" ) + MESSAGE:New("Ok, now its your turn. Land your airframe and try to get one of the ropes. Good luck!", 15, "Landing challenge" ):ToClient( MooseClient ) + end + end + ) + + end, {}, 5, 5 + ) + +MESSAGE:New("Try to land on the runway in between the red trucks located at the right side.", 15, "Landing challenge"):ToAll() \ No newline at end of file diff --git a/Moose Test Missions/EVT - Event Handling/EVT-501 - OnEventLand LandingChallengeComplex/EVT-501 - OnEventLand LandingChallengeComplex.miz b/Moose Test Missions/EVT - Event Handling/EVT-501 - OnEventLand LandingChallengeComplex/EVT-501 - OnEventLand LandingChallengeComplex.miz new file mode 100644 index 000000000..defc5059d Binary files /dev/null and b/Moose Test Missions/EVT - Event Handling/EVT-501 - OnEventLand LandingChallengeComplex/EVT-501 - OnEventLand LandingChallengeComplex.miz differ diff --git a/Moose Test Missions/ZON - Zones/ZON-101 - Normal Zone - Random Point/ZON-101 - Normal Zone - Random Point.lua b/Moose Test Missions/ZON - Zones/ZON-101 - Normal Zone - Random Point/ZON-101 - Normal Zone - Random Point.lua new file mode 100644 index 000000000..ed9dd3595 --- /dev/null +++ b/Moose Test Missions/ZON - Zones/ZON-101 - Normal Zone - Random Point/ZON-101 - Normal Zone - Random Point.lua @@ -0,0 +1,43 @@ +--- +-- Name: ZON-101 - Normal Zone - Random Point +-- Author: FlightControl +-- Date Created: 18 Feb 2017 +-- +-- # Situation: +-- +-- Three zones are defined. +-- 15 points are smoked in each zone. +-- The first 15 points are blue smoked using the GetRandomVec2() API. +-- The second 15 points are orange smoked using the GetRandomPointVec2() API. +-- The third 15 points are red smoked using the GetRandomPointVec3() API. +-- Note: The zones perimeters are also smoked in white, so you can observe the random point placement. +-- Note: At each zone an vehicle is placed, so you can view the smoking in external view. +-- +-- # Test cases: +-- +-- 1. Observe smoking of Blue smoke in Zone 1. +-- 2. Observe smoking of Orange smoke in Zone 2. +-- 3. Observe smoking of Red smoke in Zone 3. + +local Zone1 = ZONE:New( "Zone 1" ) +local Zone2 = ZONE:New( "Zone 2" ) +local Zone3 = ZONE:New( "Zone 3" ) + +Zone1:SmokeZone( SMOKECOLOR.White, 18 ) +Zone2:SmokeZone( SMOKECOLOR.White, 18 ) +Zone3:SmokeZone( SMOKECOLOR.White, 18 ) + +for i = 1, 15 do + -- Zone 1 + local Vec2 = Zone1:GetRandomVec2() + local PointVec2 = POINT_VEC2:NewFromVec2( Vec2 ) + PointVec2:SmokeBlue() + + -- Zone 2 + local PointVec2 = Zone2:GetRandomPointVec2() + PointVec2:SmokeOrange() + + -- Zone 3 + local PointVec3 = Zone3:GetRandomPointVec3() + PointVec3:SmokeRed() +end diff --git a/Moose Test Missions/ZON - Zones/ZON-101 - Normal Zone - Random Point/ZON-101 - Normal Zone - Random Point.miz b/Moose Test Missions/ZON - Zones/ZON-101 - Normal Zone - Random Point/ZON-101 - Normal Zone - Random Point.miz new file mode 100644 index 000000000..6af4a527d Binary files /dev/null and b/Moose Test Missions/ZON - Zones/ZON-101 - Normal Zone - Random Point/ZON-101 - Normal Zone - Random Point.miz differ diff --git a/Moose Test Missions/ZON - Zones/ZON-201 - Group Zone - Random Point/ZON-201 - Group Zone - Random Point.lua b/Moose Test Missions/ZON - Zones/ZON-201 - Group Zone - Random Point/ZON-201 - Group Zone - Random Point.lua new file mode 100644 index 000000000..e20b5913d --- /dev/null +++ b/Moose Test Missions/ZON - Zones/ZON-201 - Group Zone - Random Point/ZON-201 - Group Zone - Random Point.lua @@ -0,0 +1,43 @@ +--- +-- Name: ZON-201 - Group Zone - Random Point +-- Author: FlightControl +-- Date Created: 18 Feb 2017 +-- +-- # Situation: +-- +-- Three zones are defined. +-- 15 points are smoked in each zone. +-- The first 15 points are blue smoked using the GetRandomVec2() API. +-- The second 15 points are orange smoked using the GetRandomPointVec2() API. +-- The third 15 points are red smoked using the GetRandomPointVec3() API. +-- Note: The zones perimeters are also smoked in white, so you can observe the random point placement. +-- Note: At each zone an vehicle is placed, so you can view the smoking in external view. +-- +-- # Test cases: +-- +-- 1. Observe smoking of Blue smoke in Zone 1. +-- 2. Observe smoking of Orange smoke in Zone 2. +-- 3. Observe smoking of Red smoke in Zone 3. + +local Zone1 = ZONE_GROUP:New( "Zone 1", GROUP:FindByName( "Zone 1" ), 300 ) +local Zone2 = ZONE_GROUP:New( "Zone 2", GROUP:FindByName( "Zone 2" ), 300 ) +local Zone3 = ZONE_GROUP:New( "Zone 3", GROUP:FindByName( "Zone 3" ), 300 ) + +Zone1:SmokeZone( SMOKECOLOR.White, 18 ) +Zone2:SmokeZone( SMOKECOLOR.White, 18 ) +Zone3:SmokeZone( SMOKECOLOR.White, 18 ) + +for i = 1, 15 do + -- Zone 1 + local Vec2 = Zone1:GetRandomVec2() + local PointVec2 = POINT_VEC2:NewFromVec2( Vec2 ) + PointVec2:SmokeBlue() + + -- Zone 2 + local PointVec2 = Zone2:GetRandomPointVec2() + PointVec2:SmokeOrange() + + -- Zone 3 + local PointVec3 = Zone3:GetRandomPointVec3() + PointVec3:SmokeRed() +end diff --git a/Moose Test Missions/ZON - Zones/ZON-201 - Group Zone - Random Point/ZON-201 - Group Zone - Random Point.miz b/Moose Test Missions/ZON - Zones/ZON-201 - Group Zone - Random Point/ZON-201 - Group Zone - Random Point.miz new file mode 100644 index 000000000..a52ef23db Binary files /dev/null and b/Moose Test Missions/ZON - Zones/ZON-201 - Group Zone - Random Point/ZON-201 - Group Zone - Random Point.miz differ diff --git a/Moose Test Missions/ZON - Zones/ZON-301 - Unit Zone - Random Point/ZON-301 - Unit Zone - Random Point.lua b/Moose Test Missions/ZON - Zones/ZON-301 - Unit Zone - Random Point/ZON-301 - Unit Zone - Random Point.lua new file mode 100644 index 000000000..95a38c69b --- /dev/null +++ b/Moose Test Missions/ZON - Zones/ZON-301 - Unit Zone - Random Point/ZON-301 - Unit Zone - Random Point.lua @@ -0,0 +1,43 @@ +--- +-- Name: ZON-301 - Unit Zone - Random Point +-- Author: FlightControl +-- Date Created: 18 Feb 2017 +-- +-- # Situation: +-- +-- Three zones are defined. +-- 15 points are smoked in each zone. +-- The first 15 points are blue smoked using the GetRandomVec2() API. +-- The second 15 points are orange smoked using the GetRandomPointVec2() API. +-- The third 15 points are red smoked using the GetRandomPointVec3() API. +-- Note: The zones perimeters are also smoked in white, so you can observe the random point placement. +-- Note: At each zone an vehicle is placed, so you can view the smoking in external view. +-- +-- # Test cases: +-- +-- 1. Observe smoking of Blue smoke in Zone 1. +-- 2. Observe smoking of Orange smoke in Zone 2. +-- 3. Observe smoking of Red smoke in Zone 3. + +local Zone1 = ZONE_UNIT:New( "Zone 1", UNIT:FindByName( "Zone 1" ), 300 ) +local Zone2 = ZONE_UNIT:New( "Zone 2", UNIT:FindByName( "Zone 2" ), 300 ) +local Zone3 = ZONE_UNIT:New( "Zone 3", UNIT:FindByName( "Zone 3" ), 300 ) + +Zone1:SmokeZone( SMOKECOLOR.White, 18 ) +Zone2:SmokeZone( SMOKECOLOR.White, 18 ) +Zone3:SmokeZone( SMOKECOLOR.White, 18 ) + +for i = 1, 15 do + -- Zone 1 + local Vec2 = Zone1:GetRandomVec2() + local PointVec2 = POINT_VEC2:NewFromVec2( Vec2 ) + PointVec2:SmokeBlue() + + -- Zone 2 + local PointVec2 = Zone2:GetRandomPointVec2() + PointVec2:SmokeOrange() + + -- Zone 3 + local PointVec3 = Zone3:GetRandomPointVec3() + PointVec3:SmokeRed() +end diff --git a/Moose Test Missions/ZON - Zones/ZON-301 - Unit Zone - Random Point/ZON-301 - Unit Zone - Random Point.miz b/Moose Test Missions/ZON - Zones/ZON-301 - Unit Zone - Random Point/ZON-301 - Unit Zone - Random Point.miz new file mode 100644 index 000000000..2c0d5beed Binary files /dev/null and b/Moose Test Missions/ZON - Zones/ZON-301 - Unit Zone - Random Point/ZON-301 - Unit Zone - Random Point.miz differ diff --git a/Moose Test Missions/ZON - Zones/ZON-401 - Radius Zone - Random Point/ZON-401 - Radius Zone - Random Point.lua b/Moose Test Missions/ZON - Zones/ZON-401 - Radius Zone - Random Point/ZON-401 - Radius Zone - Random Point.lua new file mode 100644 index 000000000..62857df37 --- /dev/null +++ b/Moose Test Missions/ZON - Zones/ZON-401 - Radius Zone - Random Point/ZON-401 - Radius Zone - Random Point.lua @@ -0,0 +1,48 @@ +--- +-- Name: ZON-401 - Radius Zone - Random Point +-- Author: FlightControl +-- Date Created: 18 Feb 2017 +-- +-- # Situation: +-- +-- Three zones are defined. +-- 15 points are smoked in each zone. +-- The first 15 points are blue smoked using the GetRandomVec2() API. +-- The second 15 points are orange smoked using the GetRandomPointVec2() API. +-- The third 15 points are red smoked using the GetRandomPointVec3() API. +-- Note: The zones perimeters are also smoked in white, so you can observe the random point placement. +-- Note: At each zone an vehicle is placed, so you can view the smoking in external view. +-- +-- # Test cases: +-- +-- 1. Observe smoking of Blue smoke in Zone 1. +-- 2. Observe smoking of Orange smoke in Zone 2. +-- 3. Observe smoking of Red smoke in Zone 3. + +local Unit1 = UNIT:FindByName( "Zone 1" ) +local Unit2 = UNIT:FindByName( "Zone 2" ) +local Unit3 = UNIT:FindByName( "Zone 3" ) + + +local Zone1 = ZONE_RADIUS:New( "Zone 1", Unit1:GetVec2(), 300 ) +local Zone2 = ZONE_RADIUS:New( "Zone 2", Unit2:GetVec2(), 300 ) +local Zone3 = ZONE_RADIUS:New( "Zone 3", Unit3:GetVec2(), 300 ) + +Zone1:SmokeZone( SMOKECOLOR.White, 18 ) +Zone2:SmokeZone( SMOKECOLOR.White, 18 ) +Zone3:SmokeZone( SMOKECOLOR.White, 18 ) + +for i = 1, 15 do + -- Zone 1 + local Vec2 = Zone1:GetRandomVec2() + local PointVec2 = POINT_VEC2:NewFromVec2( Vec2 ) + PointVec2:SmokeBlue() + + -- Zone 2 + local PointVec2 = Zone2:GetRandomPointVec2() + PointVec2:SmokeOrange() + + -- Zone 3 + local PointVec3 = Zone3:GetRandomPointVec3() + PointVec3:SmokeRed() +end diff --git a/Moose Test Missions/ZON - Zones/ZON-401 - Radius Zone - Random Point/ZON-401 - Radius Zone - Random Point.miz b/Moose Test Missions/ZON - Zones/ZON-401 - Radius Zone - Random Point/ZON-401 - Radius Zone - Random Point.miz new file mode 100644 index 000000000..3c187ce3f Binary files /dev/null and b/Moose Test Missions/ZON - Zones/ZON-401 - Radius Zone - Random Point/ZON-401 - Radius Zone - Random Point.miz differ diff --git a/Moose Test Missions/ZON - Zones/ZON-501 - Polygon Zone - Random Point/ZON-501 - Polygon Zone - Random Point.lua b/Moose Test Missions/ZON - Zones/ZON-501 - Polygon Zone - Random Point/ZON-501 - Polygon Zone - Random Point.lua new file mode 100644 index 000000000..451aec542 --- /dev/null +++ b/Moose Test Missions/ZON - Zones/ZON-501 - Polygon Zone - Random Point/ZON-501 - Polygon Zone - Random Point.lua @@ -0,0 +1,43 @@ +--- +-- Name: ZON-501 - Polygon Zone - Random Point +-- Author: FlightControl +-- Date Created: 18 Feb 2017 +-- +-- # Situation: +-- +-- Three zones are defined. +-- 15 points are smoked in each zone. +-- The first 15 points are blue smoked using the GetRandomVec2() API. +-- The second 15 points are orange smoked using the GetRandomPointVec2() API. +-- The third 15 points are red smoked using the GetRandomPointVec3() API. +-- Note: The zones perimeters are also smoked in white, so you can observe the random point placement. +-- Note: At each zone an vehicle is placed, so you can view the smoking in external view. +-- +-- # Test cases: +-- +-- 1. Observe smoking of Blue smoke in Zone 1. +-- 2. Observe smoking of Orange smoke in Zone 2. +-- 3. Observe smoking of Red smoke in Zone 3. + +local Zone1 = ZONE_POLYGON:New( "Zone 1", GROUP:FindByName( "Zone 1" ) ) +local Zone2 = ZONE_POLYGON:New( "Zone 2", GROUP:FindByName( "Zone 2" ) ) +local Zone3 = ZONE_POLYGON:New( "Zone 3", GROUP:FindByName( "Zone 3" ) ) + +Zone1:SmokeZone( SMOKECOLOR.White, 4 ) +Zone2:SmokeZone( SMOKECOLOR.White, 4 ) +Zone3:SmokeZone( SMOKECOLOR.White, 4 ) + +for i = 1, 15 do + -- Zone 1 + local Vec2 = Zone1:GetRandomVec2() + local PointVec2 = POINT_VEC2:NewFromVec2( Vec2 ) + PointVec2:SmokeBlue() + + -- Zone 2 + local PointVec2 = Zone2:GetRandomPointVec2() + PointVec2:SmokeOrange() + + -- Zone 3 + local PointVec3 = Zone3:GetRandomPointVec3() + PointVec3:SmokeRed() +end diff --git a/Moose Test Missions/ZON - Zones/ZON-501 - Polygon Zone - Random Point/ZON-501 - Polygon Zone - Random Point.miz b/Moose Test Missions/ZON - Zones/ZON-501 - Polygon Zone - Random Point/ZON-501 - Polygon Zone - Random Point.miz new file mode 100644 index 000000000..9b9803f24 Binary files /dev/null and b/Moose Test Missions/ZON - Zones/ZON-501 - Polygon Zone - Random Point/ZON-501 - Polygon Zone - Random Point.miz differ diff --git a/docs/Documentation/Event.html b/docs/Documentation/Event.html index 61b353615..c8ab35fec 100644 --- a/docs/Documentation/Event.html +++ b/docs/Documentation/Event.html @@ -245,6 +245,12 @@ YYYY-MM-DD: CLASS:NewFunction( Params ) added
EVENTHANDLER| EVENTHANDLER.ClassID | ++ + | +
| EVENTHANDLER.ClassName | ++ + | +
| EVENTHANDLER:New() | +
+ The EVENTHANDLER constructor |
EVENTHANDLERThe EVENTHANDLER structure
+ +The EVENTHANDLER constructor
+ +Hereby the change log:
+2017-02-18: POINT_VEC3:NewFromVec2( Vec2, LandHeightAdd ) added.
+2016-08-12: POINT_VEC3:Translate( Distance, Angle ) added.
2016-08-06: Made PointVec3 and Vec3, PointVec2 and Vec2 terminology used in the code consistent.
@@ -399,6 +401,12 @@ In order to keep the credibility of the the author, I want to emphasize that theCreate a new POINT_VEC3 object.
+Create a new POINT_VEC3 object from Vec2 coordinates.
Create a new POINT_VEC3 object from Vec2 coordinates.
+ +Dcs.DCSTypes#Vec2 Vec2 :
+The Vec2 point.
LandHeightAdd :
Core.Point#POINT_VEC3: +self
+ +Don't repeat the group from Take-Off till Landing and back Take-Off by ReSpawning.
-When the first Spawn executes, all the Groups need to be made visible before start.
+Flag that indicates if all the Groups of the SpawnGroup need to be visible when Spawned.
This module contains the ZONE classes, inherited from Zone#ZONE_BASE.
+This core module contains the ZONE classes, inherited from Zone#ZONE_BASE.