Skip to content

Commit

Permalink
Added mission Core/Zone/520-Draw-Zones-and-Shapes
Browse files Browse the repository at this point in the history
  • Loading branch information
kaltokri committed Feb 23, 2024
1 parent 1f976bb commit c5db5f3
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
-- Author: Applevangelist
-- Created: 13.05.2021
-- Contributors: kaltokri
-- Modified: 23.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:
--
-- This demo mission illustrates how to draw zones (circular and polygon) defined in the Mission Editor on the F10 map.
-- Furthermore, it shows how to create cicles, rectangled, lines, arrows and text at arbitrary coordinates on the F10 map.
--
-- # Guide:
-- 1. Start the mission and join as Observer.
-- 2. Zoom out and find all the different drawings.

-- Circular zone defined in the ME.
local circzone=ZONE:New("Circular Zone")

-- Draw the zone on the F10 map. Colors are taken from the ME settings.
circzone:DrawZone()

-- Quad-point zone defined in the ME.
local quadzone=ZONE:New("Quad Zone") --Core.Zone#ZONE_POLYGON_BASE

-- Draw the zone on the F10 map. Colors are taken from the ME settings.
quadzone:DrawZone()

-- After 500 seconds, the drawing is removed.
quadzone:UndrawZone(500)


-- Polygon zone defined by waypoints of the group "Rotary-1". This surrounds a lake near Poti.
local polyzone=ZONE_POLYGON:NewFromGroupName("Rotary-1")

-- Draw the zone. Line color is green, fill color is turquoise with 50% alpha. Line type is dashed.
polyzone:DrawZone(-1, {0,1,0}, 1.0, {0,1,1}, 0.5, 2)


-- Get coordinates of some airbases of the map.
local coordBatumi=AIRBASE:FindByName("Batumi"):GetCoordinate()
local coordKobuleti=AIRBASE:FindByName("Kobuleti"):GetCoordinate()
local coordGudauta=AIRBASE:FindByName(AIRBASE.Caucasus.Gudauta):GetCoordinate()
local coordKrymsk=AIRBASE:FindByName(AIRBASE.Caucasus.Krymsk):GetCoordinate()
local coordBeslan=AIRBASE:FindByName(AIRBASE.Caucasus.Beslan):GetCoordinate()
local coordNalchik=AIRBASE:FindByName(AIRBASE.Caucasus.Nalchik):GetCoordinate()
local coordMinVody=AIRBASE:FindByName(AIRBASE.Caucasus.Mineralnye_Vody):GetCoordinate()
local coordMozdok=AIRBASE:FindByName(AIRBASE.Caucasus.Mozdok):GetCoordinate()


-- Draw a circle with 15 km radius around Krymsk Airbase.
coordKrymsk:CircleToAll(15000)

-- Draw a rectancle. First corner is Gudauta. Opposite corner is 30000 meters in heading 135 degrees.
coordGudauta:RectToAll(coordGudauta:Translate(30000, 135))

-- Draw a quad-point shape. Corners are defined by the airbases.
coordBeslan:QuadToAll(coordNalchik, coordMinVody, coordMozdok, nil, {1,0,1}, nil, {0,1,0}, 0.8, 4)

-- Draw a blue line from Mozdok to Krymsk.
coordMozdok:LineToAll(coordKrymsk, nil, {0,0,1})

-- Draw a green arrow from Batumi to a ship group called "Naval-1". This arrow is only visible to the blue coalition.
coordBatumi:ArrowToAll(GROUP:FindByName("Naval-1"):GetCoordinate(), 2, {0,1,0})

-- Write text "Target Warehouse" at position of a static warehouse.
STATIC:FindByName("Static Warehouse-1"):GetCoordinate():TextToAll("Target Warehouse")
Binary file not shown.

0 comments on commit c5db5f3

Please sign in to comment.