Migrated some Core.Zone examples

This commit is contained in:
kaltokri 2024-02-18 16:42:25 +01:00
parent 918c54b13d
commit aee32cce5d
6 changed files with 119 additions and 0 deletions

View File

@ -0,0 +1,34 @@
---
-- Author: FlightControl
-- Created: 21.02.2017
-- Contributors: kaltokri
-- Modified: 18.02.2024
--
-- # Documentation:
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Zone.html
--
-- # Description:
--
-- A ZONE has been defined in mission editor. It's boundaries are marked with white smoke.
-- A vehicle is driving through the zone perimeters.
-- When the vehicle is driving within the zone, a red smoke is placed at the vehicle location.
--
-- # Guide:
--
-- 1. Start the mission.
-- 2. Observe the zone perimeter. It should be marked with white smoke.
-- 3. Observe the vehicle. It should place red smoke when driving through the zone.
GroupInside = GROUP:FindByName( "Test Inside Zone" )
ZoneA = ZONE:New( "Zone A" )
ZoneA:SmokeZone( SMOKECOLOR.White, 90 )
Messager = SCHEDULER:New( nil,
function()
GroupInside:MessageToAll( ( GroupInside:IsCompletelyInZone( ZoneA ) ) and "Inside Zone A" or "Outside Zone A", 1 )
if GroupInside:IsCompletelyInZone( ZoneA ) then
GroupInside:GetUnit(1):SmokeRed()
end
end,
{}, 0, 1 )

Binary file not shown.

View File

@ -0,0 +1,49 @@
---
-- Author: FlightControl
-- Created: 18.02.2017
-- Contributors: kaltokri
-- Modified: 18.02.2024
--
-- # Documentation:
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Zone.html
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Point.html
--
-- # Description:
--
-- 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 by pressing F7.
--
-- # Guide:
--
-- 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.
Zone1 = ZONE:New( "Zone 1" )
Zone2 = ZONE:New( "Zone 2" )
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

View File

@ -0,0 +1,36 @@
---
-- Author: FlightControl
-- Created: 21.02.2017
-- Contributors: kaltokri
-- Modified: 18.02.2024
--
-- # Documentation:
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Zone.html
--
-- # Description:
--
-- A ZONE has been defined in mission editor. It's boundaries are marked with tires.
-- Take a look at the F10 map to see the tires. It may help to disable the lables in F10 map.
-- You can you to a tires with F12.
-- A vehicle is driving through the zone perimeters.
-- When the vehicle is driving within the zone, a red smoke is placed at the vehicle location.
--
-- # Guide:
--
-- 1. Start the mission.
-- 2. Observe the zone perimeter. It should be marked with tires.
-- 3. Observe the vehicle. It should place red smoke when driving through the zone.
GroupInside = GROUP:FindByName( "Test Inside Zone" )
ZoneA = ZONE:New( "Zone A" )
ZoneA:BoundZone( 90, country.id.USA )
Messager = SCHEDULER:New( nil,
function()
GroupInside:MessageToAll( ( GroupInside:IsCompletelyInZone( ZoneA ) ) and "Inside Zone A" or "Outside Zone A", 1 )
if GroupInside:IsCompletelyInZone( ZoneA ) then
GroupInside:GetUnit(1):SmokeRed()
end
end,
{}, 0, 1 )