mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Compare commits
119 Commits
FF/OpsStuf
...
kk/usergui
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4c66fd7cab | ||
|
|
80f76b26c2 | ||
|
|
4e956c3203 | ||
|
|
08f2c29014 | ||
|
|
dcd4d0ab62 | ||
|
|
bb07e1935e | ||
|
|
088436c5ce | ||
|
|
797bf0047b | ||
|
|
f29d055ca3 | ||
|
|
1468641563 | ||
|
|
8b08942c4d | ||
|
|
eb84ad3cee | ||
|
|
91a34ac4d8 | ||
|
|
28c8d99878 | ||
|
|
4fda8cc5fb | ||
|
|
4ac583e434 | ||
|
|
fa762fe0fc | ||
|
|
aca5846209 | ||
|
|
4fd7d7cba9 | ||
|
|
9280a1224d | ||
|
|
fce7b07014 | ||
|
|
4696569f83 | ||
|
|
84230e2360 | ||
|
|
ca9913e38b | ||
|
|
ff951c69d9 | ||
|
|
f2f7c88299 | ||
|
|
f5d6d31b10 | ||
|
|
9b95e71d75 | ||
|
|
db6dc7b77e | ||
|
|
4c81333a0a | ||
|
|
79b1f1615f | ||
|
|
47f010cb28 | ||
|
|
d14b7e8f4c | ||
|
|
d9748ef147 | ||
|
|
64d7946c06 | ||
|
|
b052fc6243 | ||
|
|
8385b1d21a | ||
|
|
d4f4465b0a | ||
|
|
5fe77956cb | ||
|
|
d640acc7cc | ||
|
|
8dcd22f18c | ||
|
|
2d086a62f0 | ||
|
|
47ad2499d4 | ||
|
|
5d510807c9 | ||
|
|
5ba8f9e0e8 | ||
|
|
0338fd5d33 | ||
|
|
ea2175bba8 | ||
|
|
0835022c5c | ||
|
|
f306361317 | ||
|
|
0347e42fc7 | ||
|
|
9cc32ff8dc | ||
|
|
b052d99349 | ||
|
|
4fe1318e7c | ||
|
|
6ffe69484c | ||
|
|
501ab70992 | ||
|
|
6ac46addf0 | ||
|
|
3bdf4b4c76 | ||
|
|
46f70dd8a6 | ||
|
|
aeac2eb3d7 | ||
|
|
e83c8c3ee0 | ||
|
|
d65042c640 | ||
|
|
c72cdd8f0b | ||
|
|
7e2f8771b5 | ||
|
|
3ccfcdbd0f | ||
|
|
16f3dcbbb4 | ||
|
|
f6f3189504 | ||
|
|
071554bfc5 | ||
|
|
1527b53c76 | ||
|
|
bbc7f7e14c | ||
|
|
b9830a8437 | ||
|
|
caaee4f551 | ||
|
|
5f7115f4fe | ||
|
|
9ec92a8fca | ||
|
|
7cc040c234 | ||
|
|
9227ba9ecd | ||
|
|
e7fb073bab | ||
|
|
f86b3505b2 | ||
|
|
e89b921f3e | ||
|
|
0d18ce086c | ||
|
|
8fb126682f | ||
|
|
ebe486c69a | ||
|
|
702ec75935 | ||
|
|
465ec216ea | ||
|
|
d803b51e84 | ||
|
|
53f89fd42c | ||
|
|
c72f109553 | ||
|
|
92e03522db | ||
|
|
9716162739 | ||
|
|
4eea8fcadd | ||
|
|
0ae9be49da | ||
|
|
bda4efc634 | ||
|
|
e84e16f58b | ||
|
|
55ffe37a79 | ||
|
|
68548f4581 | ||
|
|
8382eb9cd8 | ||
|
|
f837e9dec7 | ||
|
|
230d9d82bf | ||
|
|
c089e56060 | ||
|
|
87f1a5ed0d | ||
|
|
d2d6fac7df | ||
|
|
bc3f9ed7c0 | ||
|
|
0f4162a9a9 | ||
|
|
6b270916c4 | ||
|
|
b3a006096c | ||
|
|
6903e252d2 | ||
|
|
ff6704f123 | ||
|
|
c770f4cb68 | ||
|
|
9ce1d360d6 | ||
|
|
6f473faa92 | ||
|
|
dd37a42470 | ||
|
|
88e1bbd60d | ||
|
|
e078e48853 | ||
|
|
67924c894d | ||
|
|
1b1f8e0d2c | ||
|
|
f87126f22c | ||
|
|
af3c579a03 | ||
|
|
a508c63279 | ||
|
|
084caad5d7 | ||
|
|
52c2401d93 |
8
.github/workflows/build-includes.yml
vendored
8
.github/workflows/build-includes.yml
vendored
@@ -95,10 +95,6 @@ jobs:
|
||||
export COMMIT_TIME=$(git show -s --format=%cd ${{ github.sha }} --date=iso-strict)
|
||||
lua5.3 "./Moose Setup/Moose_Create.lua" D "$COMMIT_TIME-${{ github.sha }}" "./Moose Development/Moose" "./Moose Setup" "./build/result/Moose_Include_Dynamic"
|
||||
|
||||
- name: Run LuaSrcDiet
|
||||
run: |
|
||||
luasrcdiet --basic --opt-emptylines ./build/result/Moose_Include_Static/Moose.lua -o ./build/result/Moose_Include_Static/Moose_.lua
|
||||
|
||||
#########################################################################
|
||||
# Run LuaCheck
|
||||
#########################################################################
|
||||
@@ -108,6 +104,10 @@ jobs:
|
||||
run: |
|
||||
luacheck --std=lua51c --config=.luacheckrc -gurasqq "Moose Development/Moose"
|
||||
|
||||
- name: Run LuaSrcDiet
|
||||
run: |
|
||||
luasrcdiet --basic --opt-emptylines ./build/result/Moose_Include_Static/Moose.lua -o ./build/result/Moose_Include_Static/Moose_.lua
|
||||
|
||||
#########################################################################
|
||||
# Push to MOOSE_INCLUDE
|
||||
#########################################################################
|
||||
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -221,6 +221,9 @@ pip-log.txt
|
||||
#Goodsync
|
||||
_gsdata_/
|
||||
|
||||
# PyCharm
|
||||
.idea
|
||||
|
||||
#GITHUB
|
||||
Moose Test Missions/MOOSE_Test_Template.miz
|
||||
Moose Development/Moose/.vscode/launch.json
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
--
|
||||
-- ## Missions:
|
||||
--
|
||||
-- [AID-A2A - AI A2A Dispatching](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AID%20-%20AI%20Dispatching/AID-A2A%20-%20AI%20A2A%20Dispatching)
|
||||
-- [AID-A2A - AI A2A Dispatching](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_A2A_Dispatcher)
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
@@ -310,7 +310,7 @@ do -- AI_A2A_DISPATCHER
|
||||
-- Use the method @{#AI_A2A_DISPATCHER.SetEngageRadius}() to set a specific Engage Radius.
|
||||
-- **The Engage Radius is defined for ALL squadrons which are operational.**
|
||||
--
|
||||
-- Demonstration Mission: [AID-019 - AI_A2A - Engage Range Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AID%20-%20AI%20Dispatching/AID-A2A%20-%20AI%20A2A%20Dispatching/AID-A2A-019%20-%20Engage%20Range%20Test)
|
||||
-- Demonstration Mission: [AID-019 - AI_A2A - Engage Range Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_A2A_Dispatcher/AID-A2A-019%20-%20Engage%20Range%20Test)
|
||||
--
|
||||
-- In this example an Engage Radius is set to various values.
|
||||
--
|
||||
@@ -333,7 +333,7 @@ do -- AI_A2A_DISPATCHER
|
||||
-- Use the method @{#AI_A2A_DISPATCHER.SetGciRadius}() to set a specific controlled ground intercept radius.
|
||||
-- **The Ground Controlled Intercept radius is defined for ALL squadrons which are operational.**
|
||||
--
|
||||
-- Demonstration Mission: [AID-013 - AI_A2A - Intercept Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AID%20-%20AI%20Dispatching/AID-A2A%20-%20AI%20A2A%20Dispatching/AID-A2A-013%20-%20Intercept%20Test)
|
||||
-- Demonstration Mission: [AID-013 - AI_A2A - Intercept Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_A2A_Dispatcher/AID-A2A-013%20-%20Intercept%20Test)
|
||||
--
|
||||
-- In these examples, the Gci Radius is set to various values:
|
||||
--
|
||||
@@ -366,7 +366,7 @@ do -- AI_A2A_DISPATCHER
|
||||
-- it makes it easier sometimes for the mission maker to envisage where the red and blue territories roughly are.
|
||||
-- In a hot war the borders are effectively defined by the ground based radar coverage of a coalition.
|
||||
--
|
||||
-- Demonstration Mission: [AID-009 - AI_A2A - Border Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AID%20-%20AI%20Dispatching/AID-A2A%20-%20AI%20A2A%20Dispatching/AID-A2A-009%20-%20Border%20Test)
|
||||
-- Demonstration Mission: [AID-009 - AI_A2A - Border Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_A2A_Dispatcher/AID-A2A-009%20-%20Border%20Test)
|
||||
--
|
||||
-- In this example a border is set for the CCCP A2A dispatcher:
|
||||
--
|
||||
@@ -1233,7 +1233,7 @@ do -- AI_A2A_DISPATCHER
|
||||
--
|
||||
-- **Use the method @{#AI_A2A_DISPATCHER.SetEngageRadius}() to modify the default Engage Radius for ALL squadrons.**
|
||||
--
|
||||
-- Demonstration Mission: [AID-019 - AI_A2A - Engage Range Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AID%20-%20AI%20Dispatching/AID-A2A%20-%20AI%20A2A%20Dispatching/AID-A2A-019%20-%20Engage%20Range%20Test)
|
||||
-- Demonstration Mission: [AID-019 - AI_A2A - Engage Range Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_A2A_Dispatcher/AID-A2A-019%20-%20Engage%20Range%20Test)
|
||||
--
|
||||
-- @param #AI_A2A_DISPATCHER self
|
||||
-- @param #number EngageRadius (Optional, Default = 100000) The radius to report friendlies near the target.
|
||||
@@ -1283,7 +1283,7 @@ do -- AI_A2A_DISPATCHER
|
||||
-- Use the method @{#AI_A2A_DISPATCHER.SetGciRadius}() to set a specific controlled ground intercept radius.
|
||||
-- **The Ground Controlled Intercept radius is defined for ALL squadrons which are operational.**
|
||||
--
|
||||
-- Demonstration Mission: [AID-013 - AI_A2A - Intercept Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AID%20-%20AI%20Dispatching/AID-A2A%20-%20AI%20A2A%20Dispatching/AID-A2A-013%20-%20Intercept%20Test)
|
||||
-- Demonstration Mission: [AID-013 - AI_A2A - Intercept Test](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_A2A_Dispatcher/AID-A2A-013%20-%20Intercept%20Test)
|
||||
--
|
||||
-- @param #AI_A2A_DISPATCHER self
|
||||
-- @param #number GciRadius (Optional, Default = 200000) The radius to ground control intercept detected targets from the nearest airbase.
|
||||
@@ -3257,7 +3257,8 @@ do -- AI_A2A_DISPATCHER
|
||||
end
|
||||
end
|
||||
|
||||
--- @param #AI_A2A_DISPATCHER self
|
||||
--- AI_A2A_Fsm:onafterHome
|
||||
-- @param #AI_A2A_DISPATCHER self
|
||||
function AI_A2A_Fsm:onafterHome( Defender, From, Event, To, Action )
|
||||
if Defender and Defender:IsAlive() then
|
||||
self:F( { "CAP Home", Defender:GetName() } )
|
||||
@@ -3505,7 +3506,8 @@ do -- AI_A2A_DISPATCHER
|
||||
Dispatcher:ClearDefenderTaskTarget( DefenderGroup )
|
||||
end
|
||||
|
||||
--- @param #AI_A2A_DISPATCHER self
|
||||
--- function Fsm:onafterLostControl
|
||||
-- @param #AI_A2A_DISPATCHER self
|
||||
function Fsm:onafterLostControl( Defender, From, Event, To )
|
||||
self:F( { "GCI LostControl", Defender:GetName() } )
|
||||
self:GetParent( self ).onafterHome( self, Defender, From, Event, To )
|
||||
@@ -3518,7 +3520,8 @@ do -- AI_A2A_DISPATCHER
|
||||
end
|
||||
end
|
||||
|
||||
--- @param #AI_A2A_DISPATCHER self
|
||||
--- function Fsm:onafterHome
|
||||
-- @param #AI_A2A_DISPATCHER self
|
||||
function Fsm:onafterHome( DefenderGroup, From, Event, To, Action )
|
||||
self:F( { "GCI Home", DefenderGroup:GetName() } )
|
||||
self:GetParent( self ).onafterHome( self, DefenderGroup, From, Event, To )
|
||||
@@ -3959,7 +3962,7 @@ do
|
||||
--
|
||||
-- # Demo Missions
|
||||
--
|
||||
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AID%20-%20AI%20Dispatching/AID-A2A%20-%20AI%20A2A%20Dispatching)
|
||||
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_A2A_Dispatcher)
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
--
|
||||
-- ## Missions:
|
||||
--
|
||||
-- [AID-A2G - AI A2G Dispatching](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AID%20-%20AI%20Dispatching/AID-A2G%20-%20AI%20A2G%20Dispatching)
|
||||
-- [AID-A2G - AI A2G Dispatching](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_A2G_Dispatcher)
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
--
|
||||
-- ## Missions:
|
||||
--
|
||||
-- [AID-AIR - AI AIR Dispatching](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AID%20-%20AI%20Dispatching)
|
||||
-- [AI_A2A_Dispatcher](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_A2A_Dispatcher)
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/BAI%20-%20Battlefield%20Air%20Interdiction)
|
||||
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_BAI)
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AIB%20-%20AI%20Balancing)
|
||||
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_Balancer)
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
@@ -168,7 +168,8 @@ function AI_BALANCER:ReturnToHomeAirbase( ReturnThresholdRange )
|
||||
self.ReturnThresholdRange = ReturnThresholdRange
|
||||
end
|
||||
|
||||
--- @param #AI_BALANCER self
|
||||
--- AI_BALANCER:onenterSpawning
|
||||
-- @param #AI_BALANCER self
|
||||
-- @param Core.Set#SET_GROUP SetGroup
|
||||
-- @param #string ClientName
|
||||
-- @param Wrapper.Group#GROUP AIGroup
|
||||
@@ -190,7 +191,8 @@ function AI_BALANCER:onenterSpawning( SetGroup, From, Event, To, ClientName )
|
||||
end
|
||||
end
|
||||
|
||||
--- @param #AI_BALANCER self
|
||||
--- AI_BALANCER:onenterDestroying
|
||||
-- @param #AI_BALANCER self
|
||||
-- @param Core.Set#SET_GROUP SetGroup
|
||||
-- @param Wrapper.Group#GROUP AIGroup
|
||||
function AI_BALANCER:onenterDestroying( SetGroup, From, Event, To, ClientName, AIGroup )
|
||||
@@ -233,15 +235,16 @@ function AI_BALANCER:onenterReturning( SetGroup, From, Event, To, AIGroup )
|
||||
|
||||
end
|
||||
|
||||
|
||||
--- @param #AI_BALANCER self
|
||||
--- AI_BALANCER:onenterMonitoring
|
||||
-- @param #AI_BALANCER self
|
||||
function AI_BALANCER:onenterMonitoring( SetGroup )
|
||||
|
||||
self:T2( { self.SetClient:Count() } )
|
||||
--self.SetClient:Flush()
|
||||
|
||||
self.SetClient:ForEachClient(
|
||||
--- @param Wrapper.Client#CLIENT Client
|
||||
--- SetClient:ForEachClient
|
||||
-- @param Wrapper.Client#CLIENT Client
|
||||
function( Client )
|
||||
self:T3(Client.ClientName)
|
||||
|
||||
@@ -264,7 +267,8 @@ function AI_BALANCER:onenterMonitoring( SetGroup )
|
||||
self:T2( RangeZone )
|
||||
|
||||
_DATABASE:ForEachPlayerUnit(
|
||||
--- @param Wrapper.Unit#UNIT RangeTestUnit
|
||||
--- Nameless function
|
||||
-- @param Wrapper.Unit#UNIT RangeTestUnit
|
||||
function( RangeTestUnit, RangeZone, AIGroup, PlayerInRange )
|
||||
self:T2( { PlayerInRange, RangeTestUnit.UnitName, RangeZone.ZoneName } )
|
||||
if RangeTestUnit:IsInZone( RangeZone ) == true then
|
||||
@@ -276,7 +280,8 @@ function AI_BALANCER:onenterMonitoring( SetGroup )
|
||||
end
|
||||
end,
|
||||
|
||||
--- @param Core.Zone#ZONE_RADIUS RangeZone
|
||||
--- Nameless function
|
||||
-- @param Core.Zone#ZONE_RADIUS RangeZone
|
||||
-- @param Wrapper.Group#GROUP AIGroup
|
||||
function( RangeZone, AIGroup, PlayerInRange )
|
||||
if PlayerInRange.Value == false then
|
||||
@@ -307,6 +312,3 @@ function AI_BALANCER:onenterMonitoring( SetGroup )
|
||||
|
||||
self:__Monitor( 10 )
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/CAP%20-%20Combat%20Air%20Patrol)
|
||||
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_CAP)
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/CAS%20-%20Close%20Air%20Support)
|
||||
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_CAS)
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
--
|
||||
-- Test missions can be located on the main GITHUB site.
|
||||
--
|
||||
-- [FlightControl-Master/MOOSE_MISSIONS/AID - AI Dispatching/AID-CGO - AI Cargo Dispatching/](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/AID%20-%20AI%20Dispatching/AID-CGO%20-%20AI%20Cargo%20Dispatching)
|
||||
-- [FlightControl-Master/MOOSE_MISSIONS/AID - AI Dispatching/AID-CGO - AI Cargo Dispatching/](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_Cargo_Dispatcher)
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
@@ -583,10 +583,12 @@ AI_CARGO_DISPATCHER = {
|
||||
PickupCargo = {}
|
||||
}
|
||||
|
||||
--- @field #list
|
||||
--- List of AI_Cargo
|
||||
-- @field #list
|
||||
AI_CARGO_DISPATCHER.AI_Cargo = {}
|
||||
|
||||
--- @field #list
|
||||
--- List of PickupCargo
|
||||
-- @field #list
|
||||
AI_CARGO_DISPATCHER.PickupCargo = {}
|
||||
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
--
|
||||
-- ## Missions:
|
||||
--
|
||||
-- [ESC - Escorting](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/ESC%20-%20Escorting)
|
||||
-- [ESC - Escorting](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_Escort)
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
--
|
||||
-- ## Missions:
|
||||
--
|
||||
-- [ESC - Escorting](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/ESC%20-%20Escorting)
|
||||
-- [ESC - Escorting](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_Escort)
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/FOR%20-%20AI%20Group%20Formation)
|
||||
-- ## Additional Material:
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- ### [YouTube Playlist](https://www.youtube.com/playlist?list=PL7ZUrU4zZUl0bFIJ9jIdYM22uaWmIN4oz)
|
||||
-- * **Demo Missions:** [GitHub](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_Formation)
|
||||
-- * **YouTube videos:** [Playlist](https://www.youtube.com/playlist?list=PL7ZUrU4zZUl0bFIJ9jIdYM22uaWmIN4oz)
|
||||
-- * **Guides:** None
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/PAT%20-%20Patrolling)
|
||||
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AI/AI_Patrol)
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
|
||||
@@ -370,7 +370,7 @@ CARGOS = {}
|
||||
|
||||
do -- CARGO
|
||||
|
||||
--- @type CARGO
|
||||
-- @type CARGO
|
||||
-- @extends Core.Fsm#FSM_PROCESS
|
||||
-- @field #string Type A string defining the type of the cargo. eg. Engineers, Equipment, Screwdrivers.
|
||||
-- @field #string Name A string defining the name of the cargo. The name is the unique identifier of the cargo.
|
||||
@@ -433,7 +433,7 @@ do -- CARGO
|
||||
Reported = {},
|
||||
}
|
||||
|
||||
--- @type CARGO.CargoObjects
|
||||
-- @type CARGO.CargoObjects
|
||||
-- @map < #string, Wrapper.Positionable#POSITIONABLE > The alive POSITIONABLE objects representing the the cargo.
|
||||
|
||||
--- CARGO Constructor. This class is an abstract class and should not be instantiated.
|
||||
@@ -447,7 +447,7 @@ do -- CARGO
|
||||
function CARGO:New( Type, Name, Weight, LoadRadius, NearRadius ) --R2.1
|
||||
|
||||
local self = BASE:Inherit( self, FSM:New() ) -- #CARGO
|
||||
self:F( { Type, Name, Weight, LoadRadius, NearRadius } )
|
||||
self:T( { Type, Name, Weight, LoadRadius, NearRadius } )
|
||||
|
||||
self:SetStartState( "UnLoaded" )
|
||||
self:AddTransition( { "UnLoaded", "Boarding" }, "Board", "Boarding" )
|
||||
@@ -711,7 +711,7 @@ do -- CARGO
|
||||
-- @param #CARGO self
|
||||
-- @return #CARGO
|
||||
function CARGO:Spawn( PointVec2 )
|
||||
self:F()
|
||||
self:T()
|
||||
|
||||
end
|
||||
|
||||
@@ -812,7 +812,7 @@ do -- CARGO
|
||||
-- @param Core.Point#COORDINATE Coordinate
|
||||
-- @return #boolean true if the CargoGroup is within the loading radius.
|
||||
function CARGO:IsInLoadRadius( Coordinate )
|
||||
self:F( { Coordinate, LoadRadius = self.LoadRadius } )
|
||||
self:T( { Coordinate, LoadRadius = self.LoadRadius } )
|
||||
|
||||
local Distance = 0
|
||||
if self:IsUnLoaded() then
|
||||
@@ -832,7 +832,7 @@ do -- CARGO
|
||||
-- @param Core.Point#COORDINATE Coordinate
|
||||
-- @return #boolean true if the Cargo can report itself.
|
||||
function CARGO:IsInReportRadius( Coordinate )
|
||||
self:F( { Coordinate } )
|
||||
self:T( { Coordinate } )
|
||||
|
||||
local Distance = 0
|
||||
if self:IsUnLoaded() then
|
||||
@@ -853,23 +853,23 @@ do -- CARGO
|
||||
-- @param #number NearRadius The radius when the cargo will board the Carrier (to avoid collision).
|
||||
-- @return #boolean
|
||||
function CARGO:IsNear( Coordinate, NearRadius )
|
||||
--self:F( { PointVec2 = PointVec2, NearRadius = NearRadius } )
|
||||
--self:T( { PointVec2 = PointVec2, NearRadius = NearRadius } )
|
||||
|
||||
if self.CargoObject:IsAlive() then
|
||||
--local Distance = PointVec2:Get2DDistance( self.CargoObject:GetPointVec2() )
|
||||
--self:F( { CargoObjectName = self.CargoObject:GetName() } )
|
||||
--self:F( { CargoObjectVec2 = self.CargoObject:GetVec2() } )
|
||||
--self:F( { PointVec2 = PointVec2:GetVec2() } )
|
||||
--self:T( { CargoObjectName = self.CargoObject:GetName() } )
|
||||
--self:T( { CargoObjectVec2 = self.CargoObject:GetVec2() } )
|
||||
--self:T( { PointVec2 = PointVec2:GetVec2() } )
|
||||
local Distance = Coordinate:Get2DDistance( self.CargoObject:GetCoordinate() )
|
||||
--self:F( { Distance = Distance, NearRadius = NearRadius or "nil" } )
|
||||
--self:T( { Distance = Distance, NearRadius = NearRadius or "nil" } )
|
||||
|
||||
if Distance <= NearRadius then
|
||||
--self:F( { PointVec2 = PointVec2, NearRadius = NearRadius, IsNear = true } )
|
||||
--self:T( { PointVec2 = PointVec2, NearRadius = NearRadius, IsNear = true } )
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
--self:F( { PointVec2 = PointVec2, NearRadius = NearRadius, IsNear = false } )
|
||||
--self:T( { PointVec2 = PointVec2, NearRadius = NearRadius, IsNear = false } )
|
||||
return false
|
||||
end
|
||||
|
||||
@@ -878,12 +878,12 @@ do -- CARGO
|
||||
-- @param Core.Zone#ZONE_BASE Zone
|
||||
-- @return #boolean **true** if cargo is in the Zone, **false** if cargo is not in the Zone.
|
||||
function CARGO:IsInZone( Zone )
|
||||
--self:F( { Zone } )
|
||||
--self:T( { Zone } )
|
||||
|
||||
if self:IsLoaded() then
|
||||
return Zone:IsPointVec2InZone( self.CargoCarrier:GetPointVec2() )
|
||||
else
|
||||
--self:F( { Size = self.CargoObject:GetSize(), Units = self.CargoObject:GetUnits() } )
|
||||
--self:T( { Size = self.CargoObject:GetSize(), Units = self.CargoObject:GetUnits() } )
|
||||
if self.CargoObject:GetSize() ~= 0 then
|
||||
return Zone:IsPointVec2InZone( self.CargoObject:GetPointVec2() )
|
||||
else
|
||||
@@ -1034,7 +1034,7 @@ end -- CARGO
|
||||
|
||||
do -- CARGO_REPRESENTABLE
|
||||
|
||||
--- @type CARGO_REPRESENTABLE
|
||||
-- @type CARGO_REPRESENTABLE
|
||||
-- @extends #CARGO
|
||||
-- @field test
|
||||
|
||||
@@ -1056,7 +1056,7 @@ do -- CARGO_REPRESENTABLE
|
||||
|
||||
-- Inherit CARGO.
|
||||
local self = BASE:Inherit( self, CARGO:New( Type, Name, 0, LoadRadius, NearRadius ) ) -- #CARGO_REPRESENTABLE
|
||||
self:F( { Type, Name, LoadRadius, NearRadius } )
|
||||
self:T( { Type, Name, LoadRadius, NearRadius } )
|
||||
|
||||
-- Descriptors.
|
||||
local Desc=CargoObject:GetDesc()
|
||||
@@ -1086,7 +1086,7 @@ do -- CARGO_REPRESENTABLE
|
||||
function CARGO_REPRESENTABLE:Destroy()
|
||||
|
||||
-- Cargo objects are deleted from the _DATABASE and SET_CARGO objects.
|
||||
self:F( { CargoName = self:GetName() } )
|
||||
self:T( { CargoName = self:GetName() } )
|
||||
--_EVENTDISPATCHER:CreateEventDeleteCargo( self )
|
||||
|
||||
return self
|
||||
@@ -1123,12 +1123,12 @@ do -- CARGO_REPRESENTABLE
|
||||
CoordinateZone:Scan( { Object.Category.UNIT } )
|
||||
for _, DCSUnit in pairs( CoordinateZone:GetScannedUnits() ) do
|
||||
local NearUnit = UNIT:Find( DCSUnit )
|
||||
self:F({NearUnit=NearUnit})
|
||||
self:T({NearUnit=NearUnit})
|
||||
local NearUnitCoalition = NearUnit:GetCoalition()
|
||||
local CargoCoalition = self:GetCoalition()
|
||||
if NearUnitCoalition == CargoCoalition then
|
||||
local Attributes = NearUnit:GetDesc()
|
||||
self:F({Desc=Attributes})
|
||||
self:T({Desc=Attributes})
|
||||
if NearUnit:HasAttribute( "Trucks" ) then
|
||||
MESSAGE:New( Message, 20, NearUnit:GetCallsign() .. " reporting - Cargo " .. self:GetName() ):ToGroup( TaskGroup )
|
||||
break
|
||||
@@ -1142,7 +1142,7 @@ end -- CARGO_REPRESENTABLE
|
||||
|
||||
do -- CARGO_REPORTABLE
|
||||
|
||||
--- @type CARGO_REPORTABLE
|
||||
-- @type CARGO_REPORTABLE
|
||||
-- @extends #CARGO
|
||||
CARGO_REPORTABLE = {
|
||||
ClassName = "CARGO_REPORTABLE"
|
||||
@@ -1158,7 +1158,7 @@ do -- CARGO_REPORTABLE
|
||||
-- @return #CARGO_REPORTABLE
|
||||
function CARGO_REPORTABLE:New( Type, Name, Weight, LoadRadius, NearRadius )
|
||||
local self = BASE:Inherit( self, CARGO:New( Type, Name, Weight, LoadRadius, NearRadius ) ) -- #CARGO_REPORTABLE
|
||||
self:F( { Type, Name, Weight, LoadRadius, NearRadius } )
|
||||
self:T( { Type, Name, Weight, LoadRadius, NearRadius } )
|
||||
|
||||
return self
|
||||
end
|
||||
@@ -1178,7 +1178,7 @@ end
|
||||
|
||||
do -- CARGO_PACKAGE
|
||||
|
||||
--- @type CARGO_PACKAGE
|
||||
-- @type CARGO_PACKAGE
|
||||
-- @extends #CARGO_REPRESENTABLE
|
||||
CARGO_PACKAGE = {
|
||||
ClassName = "CARGO_PACKAGE"
|
||||
@@ -1195,7 +1195,7 @@ do -- CARGO_PACKAGE
|
||||
-- @return #CARGO_PACKAGE
|
||||
function CARGO_PACKAGE:New( CargoCarrier, Type, Name, Weight, LoadRadius, NearRadius )
|
||||
local self = BASE:Inherit( self, CARGO_REPRESENTABLE:New( CargoCarrier, Type, Name, Weight, LoadRadius, NearRadius ) ) -- #CARGO_PACKAGE
|
||||
self:F( { Type, Name, Weight, LoadRadius, NearRadius } )
|
||||
self:T( { Type, Name, Weight, LoadRadius, NearRadius } )
|
||||
|
||||
self:T( CargoCarrier )
|
||||
self.CargoCarrier = CargoCarrier
|
||||
@@ -1213,7 +1213,7 @@ end
|
||||
-- @param #number BoardDistance
|
||||
-- @param #number Angle
|
||||
function CARGO_PACKAGE:onafterOnBoard( From, Event, To, CargoCarrier, Speed, BoardDistance, LoadDistance, Angle )
|
||||
self:F()
|
||||
self:T()
|
||||
|
||||
self.CargoInAir = self.CargoCarrier:InAir()
|
||||
|
||||
@@ -1246,7 +1246,7 @@ end
|
||||
-- @param Wrapper.Unit#UNIT CargoCarrier
|
||||
-- @return #boolean
|
||||
function CARGO_PACKAGE:IsNear( CargoCarrier )
|
||||
self:F()
|
||||
self:T()
|
||||
|
||||
local CargoCarrierPoint = CargoCarrier:GetCoordinate()
|
||||
|
||||
@@ -1271,7 +1271,7 @@ end
|
||||
-- @param #number LoadDistance
|
||||
-- @param #number Angle
|
||||
function CARGO_PACKAGE:onafterOnBoarded( From, Event, To, CargoCarrier, Speed, BoardDistance, LoadDistance, Angle )
|
||||
self:F()
|
||||
self:T()
|
||||
|
||||
if self:IsNear( CargoCarrier ) then
|
||||
self:__Load( 1, CargoCarrier, Speed, LoadDistance, Angle )
|
||||
@@ -1292,7 +1292,7 @@ end
|
||||
-- @param #number Radius
|
||||
-- @param #number Angle
|
||||
function CARGO_PACKAGE:onafterUnBoard( From, Event, To, CargoCarrier, Speed, UnLoadDistance, UnBoardDistance, Radius, Angle )
|
||||
self:F()
|
||||
self:T()
|
||||
|
||||
self.CargoInAir = self.CargoCarrier:InAir()
|
||||
|
||||
@@ -1331,7 +1331,7 @@ end
|
||||
-- @param Wrapper.Unit#UNIT CargoCarrier
|
||||
-- @param #number Speed
|
||||
function CARGO_PACKAGE:onafterUnBoarded( From, Event, To, CargoCarrier, Speed )
|
||||
self:F()
|
||||
self:T()
|
||||
|
||||
if self:IsNear( CargoCarrier ) then
|
||||
self:__UnLoad( 1, CargoCarrier, Speed )
|
||||
@@ -1350,7 +1350,7 @@ end
|
||||
-- @param #number LoadDistance
|
||||
-- @param #number Angle
|
||||
function CARGO_PACKAGE:onafterLoad( From, Event, To, CargoCarrier, Speed, LoadDistance, Angle )
|
||||
self:F()
|
||||
self:T()
|
||||
|
||||
self.CargoCarrier = CargoCarrier
|
||||
|
||||
@@ -1378,7 +1378,7 @@ end
|
||||
-- @param #number Distance
|
||||
-- @param #number Angle
|
||||
function CARGO_PACKAGE:onafterUnLoad( From, Event, To, CargoCarrier, Speed, Distance, Angle )
|
||||
self:F()
|
||||
self:T()
|
||||
|
||||
local StartPointVec2 = self.CargoCarrier:GetPointVec2()
|
||||
local CargoCarrierHeading = self.CargoCarrier:GetHeading() -- Get Heading of object in degrees.
|
||||
|
||||
@@ -59,7 +59,7 @@ do -- CARGO_CRATE
|
||||
-- @return #CARGO_CRATE
|
||||
function CARGO_CRATE:New( CargoStatic, Type, Name, LoadRadius, NearRadius )
|
||||
local self = BASE:Inherit( self, CARGO_REPRESENTABLE:New( CargoStatic, Type, Name, nil, LoadRadius, NearRadius ) ) -- #CARGO_CRATE
|
||||
self:F( { Type, Name, NearRadius } )
|
||||
self:T( { Type, Name, NearRadius } )
|
||||
|
||||
self.CargoObject = CargoStatic -- Wrapper.Static#STATIC
|
||||
|
||||
@@ -116,7 +116,7 @@ do -- CARGO_CRATE
|
||||
-- @param #string To
|
||||
-- @param Core.Point#POINT_VEC2
|
||||
function CARGO_CRATE:onenterUnLoaded( From, Event, To, ToPointVec2 )
|
||||
--self:F( { ToPointVec2, From, Event, To } )
|
||||
--self:T( { ToPointVec2, From, Event, To } )
|
||||
|
||||
local Angle = 180
|
||||
local Speed = 10
|
||||
@@ -153,7 +153,7 @@ do -- CARGO_CRATE
|
||||
-- @param #string To
|
||||
-- @param Wrapper.Unit#UNIT CargoCarrier
|
||||
function CARGO_CRATE:onenterLoaded( From, Event, To, CargoCarrier )
|
||||
--self:F( { From, Event, To, CargoCarrier } )
|
||||
--self:T( { From, Event, To, CargoCarrier } )
|
||||
|
||||
self.CargoCarrier = CargoCarrier
|
||||
|
||||
@@ -190,7 +190,7 @@ do -- CARGO_CRATE
|
||||
-- @param Core.Point#COORDINATE Coordinate
|
||||
-- @return #boolean true if the Cargo Crate is within the report radius.
|
||||
function CARGO_CRATE:IsInReportRadius( Coordinate )
|
||||
--self:F( { Coordinate, LoadRadius = self.LoadRadius } )
|
||||
--self:T( { Coordinate, LoadRadius = self.LoadRadius } )
|
||||
|
||||
local Distance = 0
|
||||
if self:IsUnLoaded() then
|
||||
@@ -210,7 +210,7 @@ do -- CARGO_CRATE
|
||||
-- @param Core.Point#Coordinate Coordinate
|
||||
-- @return #boolean true if the Cargo Crate is within the loading radius.
|
||||
function CARGO_CRATE:IsInLoadRadius( Coordinate )
|
||||
--self:F( { Coordinate, LoadRadius = self.NearRadius } )
|
||||
--self:T( { Coordinate, LoadRadius = self.NearRadius } )
|
||||
|
||||
local Distance = 0
|
||||
if self:IsUnLoaded() then
|
||||
@@ -231,7 +231,7 @@ do -- CARGO_CRATE
|
||||
-- @return Core.Point#COORDINATE The current Coordinate of the first Cargo of the CargoGroup.
|
||||
-- @return #nil There is no valid Cargo in the CargoGroup.
|
||||
function CARGO_CRATE:GetCoordinate()
|
||||
--self:F()
|
||||
--self:T()
|
||||
|
||||
return self.CargoObject:GetCoordinate()
|
||||
end
|
||||
@@ -261,7 +261,7 @@ do -- CARGO_CRATE
|
||||
-- @param #CARGO_CRATE self
|
||||
-- @param Core.Point#COORDINATE Coordinate
|
||||
function CARGO_CRATE:RouteTo( Coordinate )
|
||||
self:F( {Coordinate = Coordinate } )
|
||||
self:T( {Coordinate = Coordinate } )
|
||||
|
||||
end
|
||||
|
||||
@@ -274,7 +274,7 @@ do -- CARGO_CRATE
|
||||
-- @return #boolean The Cargo is near to the Carrier.
|
||||
-- @return #nil The Cargo is not near to the Carrier.
|
||||
function CARGO_CRATE:IsNear( CargoCarrier, NearRadius )
|
||||
self:F( {NearRadius = NearRadius } )
|
||||
self:T( {NearRadius = NearRadius } )
|
||||
|
||||
return self:IsNear( CargoCarrier:GetCoordinate(), NearRadius )
|
||||
end
|
||||
@@ -283,7 +283,7 @@ do -- CARGO_CRATE
|
||||
-- @param #CARGO_CRATE self
|
||||
function CARGO_CRATE:Respawn()
|
||||
|
||||
self:F( { "Respawning crate " .. self:GetName() } )
|
||||
self:T( { "Respawning crate " .. self:GetName() } )
|
||||
|
||||
|
||||
-- Respawn the group...
|
||||
@@ -300,7 +300,7 @@ do -- CARGO_CRATE
|
||||
-- @param #CARGO_CRATE self
|
||||
function CARGO_CRATE:onafterReset()
|
||||
|
||||
self:F( { "Reset crate " .. self:GetName() } )
|
||||
self:T( { "Reset crate " .. self:GetName() } )
|
||||
|
||||
|
||||
-- Respawn the group...
|
||||
|
||||
@@ -64,7 +64,7 @@ do -- CARGO_GROUP
|
||||
|
||||
-- Inherit CAROG_REPORTABLE
|
||||
local self = BASE:Inherit( self, CARGO_REPORTABLE:New( Type, Name, 0, LoadRadius, NearRadius ) ) -- #CARGO_GROUP
|
||||
self:F( { Type, Name, LoadRadius } )
|
||||
self:T( { Type, Name, LoadRadius } )
|
||||
|
||||
self.CargoSet = SET_CARGO:New()
|
||||
self.CargoGroup = CargoGroup
|
||||
@@ -146,7 +146,7 @@ do -- CARGO_GROUP
|
||||
-- @param #CARGO_GROUP self
|
||||
function CARGO_GROUP:Respawn()
|
||||
|
||||
self:F( { "Respawning" } )
|
||||
self:T( { "Respawning" } )
|
||||
|
||||
for CargoID, CargoData in pairs( self.CargoSet:GetSet() ) do
|
||||
local Cargo = CargoData -- Cargo.Cargo#CARGO
|
||||
@@ -227,7 +227,7 @@ do -- CARGO_GROUP
|
||||
-- @param #CARGO_GROUP self
|
||||
function CARGO_GROUP:Regroup()
|
||||
|
||||
self:F("Regroup")
|
||||
self:T("Regroup")
|
||||
|
||||
if self.Grouped == false then
|
||||
|
||||
@@ -241,7 +241,7 @@ do -- CARGO_GROUP
|
||||
for CargoUnitName, CargoUnit in pairs( self.CargoSet:GetSet() ) do
|
||||
local CargoUnit = CargoUnit -- Cargo.CargoUnit#CARGO_UNIT
|
||||
|
||||
self:F( { CargoUnit:GetName(), UnLoaded = CargoUnit:IsUnLoaded() } )
|
||||
self:T( { CargoUnit:GetName(), UnLoaded = CargoUnit:IsUnLoaded() } )
|
||||
|
||||
if CargoUnit:IsUnLoaded() then
|
||||
|
||||
@@ -258,7 +258,7 @@ do -- CARGO_GROUP
|
||||
-- Then we register the new group in the database
|
||||
self.CargoGroup = GROUP:NewTemplate( GroupTemplate, GroupTemplate.CoalitionID, GroupTemplate.CategoryID, GroupTemplate.CountryID )
|
||||
|
||||
self:F( { "Regroup", GroupTemplate } )
|
||||
self:T( { "Regroup", GroupTemplate } )
|
||||
|
||||
-- Now we spawn the new group based on the template created.
|
||||
self.CargoObject = _DATABASE:Spawn( GroupTemplate )
|
||||
@@ -271,7 +271,7 @@ do -- CARGO_GROUP
|
||||
-- @param Core.Event#EVENTDATA EventData
|
||||
function CARGO_GROUP:OnEventCargoDead( EventData )
|
||||
|
||||
self:E(EventData)
|
||||
self:T(EventData)
|
||||
|
||||
local Destroyed = false
|
||||
|
||||
@@ -296,7 +296,7 @@ do -- CARGO_GROUP
|
||||
|
||||
if Destroyed then
|
||||
self:Destroyed()
|
||||
self:E( { "Cargo group destroyed" } )
|
||||
self:T( { "Cargo group destroyed" } )
|
||||
end
|
||||
|
||||
end
|
||||
@@ -309,14 +309,14 @@ do -- CARGO_GROUP
|
||||
-- @param Wrapper.Unit#UNIT CargoCarrier
|
||||
-- @param #number NearRadius If distance is smaller than this number, cargo is loaded into the carrier.
|
||||
function CARGO_GROUP:onafterBoard( From, Event, To, CargoCarrier, NearRadius, ... )
|
||||
self:F( { CargoCarrier.UnitName, From, Event, To, NearRadius = NearRadius } )
|
||||
self:T( { CargoCarrier.UnitName, From, Event, To, NearRadius = NearRadius } )
|
||||
|
||||
NearRadius = NearRadius or self.NearRadius
|
||||
|
||||
-- For each Cargo object within the CARGO_GROUPED, route each object to the CargoLoadPointVec2
|
||||
self.CargoSet:ForEach(
|
||||
function( Cargo, ... )
|
||||
self:F( { "Board Unit", Cargo:GetName( ), Cargo:IsDestroyed(), Cargo.CargoObject:IsAlive() } )
|
||||
self:T( { "Board Unit", Cargo:GetName( ), Cargo:IsDestroyed(), Cargo.CargoObject:IsAlive() } )
|
||||
local CargoGroup = Cargo.CargoObject --Wrapper.Group#GROUP
|
||||
CargoGroup:OptionAlarmStateGreen()
|
||||
Cargo:__Board( 1, CargoCarrier, NearRadius, ... )
|
||||
@@ -334,7 +334,7 @@ do -- CARGO_GROUP
|
||||
-- @param #string To
|
||||
-- @param Wrapper.Unit#UNIT CargoCarrier
|
||||
function CARGO_GROUP:onafterLoad( From, Event, To, CargoCarrier, ... )
|
||||
--self:F( { From, Event, To, CargoCarrier, ...} )
|
||||
--self:T( { From, Event, To, CargoCarrier, ...} )
|
||||
|
||||
if From == "UnLoaded" then
|
||||
-- For each Cargo object within the CARGO_GROUP, load each cargo to the CargoCarrier.
|
||||
@@ -359,7 +359,7 @@ do -- CARGO_GROUP
|
||||
-- @param Wrapper.Unit#UNIT CargoCarrier
|
||||
-- @param #number NearRadius If distance is smaller than this number, cargo is loaded into the carrier.
|
||||
function CARGO_GROUP:onafterBoarding( From, Event, To, CargoCarrier, NearRadius, ... )
|
||||
--self:F( { CargoCarrier.UnitName, From, Event, To } )
|
||||
--self:T( { CargoCarrier.UnitName, From, Event, To } )
|
||||
|
||||
local Boarded = true
|
||||
local Cancelled = false
|
||||
@@ -393,7 +393,7 @@ do -- CARGO_GROUP
|
||||
if not Boarded then
|
||||
self:__Boarding( -5, CargoCarrier, NearRadius, ... )
|
||||
else
|
||||
self:F("Group Cargo is loaded")
|
||||
self:T("Group Cargo is loaded")
|
||||
self:__Load( 1, CargoCarrier, ... )
|
||||
end
|
||||
else
|
||||
@@ -413,7 +413,7 @@ do -- CARGO_GROUP
|
||||
-- @param Core.Point#POINT_VEC2 ToPointVec2
|
||||
-- @param #number NearRadius If distance is smaller than this number, cargo is loaded into the carrier.
|
||||
function CARGO_GROUP:onafterUnBoard( From, Event, To, ToPointVec2, NearRadius, ... )
|
||||
self:F( {From, Event, To, ToPointVec2, NearRadius } )
|
||||
self:T( {From, Event, To, ToPointVec2, NearRadius } )
|
||||
|
||||
NearRadius = NearRadius or 25
|
||||
|
||||
@@ -456,7 +456,7 @@ do -- CARGO_GROUP
|
||||
-- @param Core.Point#POINT_VEC2 ToPointVec2
|
||||
-- @param #number NearRadius If distance is smaller than this number, cargo is loaded into the carrier.
|
||||
function CARGO_GROUP:onafterUnBoarding( From, Event, To, ToPointVec2, NearRadius, ... )
|
||||
--self:F( { From, Event, To, ToPointVec2, NearRadius } )
|
||||
--self:T( { From, Event, To, ToPointVec2, NearRadius } )
|
||||
|
||||
--local NearRadius = NearRadius or 25
|
||||
|
||||
@@ -493,7 +493,7 @@ do -- CARGO_GROUP
|
||||
-- @param #string To
|
||||
-- @param Core.Point#POINT_VEC2 ToPointVec2
|
||||
function CARGO_GROUP:onafterUnLoad( From, Event, To, ToPointVec2, ... )
|
||||
--self:F( { From, Event, To, ToPointVec2 } )
|
||||
--self:T( { From, Event, To, ToPointVec2 } )
|
||||
|
||||
if From == "Loaded" then
|
||||
|
||||
@@ -611,7 +611,7 @@ do -- CARGO_GROUP
|
||||
-- @param #CARGO_GROUP self
|
||||
-- @param Core.Point#COORDINATE Coordinate
|
||||
function CARGO_GROUP:RouteTo( Coordinate )
|
||||
--self:F( {Coordinate = Coordinate } )
|
||||
--self:T( {Coordinate = Coordinate } )
|
||||
|
||||
-- For each Cargo within the CargoSet, route each object to the Coordinate
|
||||
self.CargoSet:ForEach(
|
||||
@@ -629,13 +629,13 @@ do -- CARGO_GROUP
|
||||
-- @param #number NearRadius
|
||||
-- @return #boolean The Cargo is near to the Carrier or #nil if the Cargo is not near to the Carrier.
|
||||
function CARGO_GROUP:IsNear( CargoCarrier, NearRadius )
|
||||
self:F( {NearRadius = NearRadius } )
|
||||
self:T( {NearRadius = NearRadius } )
|
||||
|
||||
for _, Cargo in pairs( self.CargoSet:GetSet() ) do
|
||||
local Cargo = Cargo -- Cargo.Cargo#CARGO
|
||||
if Cargo:IsAlive() then
|
||||
if Cargo:IsNear( CargoCarrier:GetCoordinate(), NearRadius ) then
|
||||
self:F( "Near" )
|
||||
self:T( "Near" )
|
||||
return true
|
||||
end
|
||||
end
|
||||
@@ -649,7 +649,7 @@ do -- CARGO_GROUP
|
||||
-- @param Core.Point#COORDINATE Coordinate
|
||||
-- @return #boolean true if the Cargo Group is within the load radius.
|
||||
function CARGO_GROUP:IsInLoadRadius( Coordinate )
|
||||
--self:F( { Coordinate } )
|
||||
--self:T( { Coordinate } )
|
||||
|
||||
local Cargo = self:GetFirstAlive() -- Cargo.Cargo#CARGO
|
||||
|
||||
@@ -669,7 +669,7 @@ do -- CARGO_GROUP
|
||||
return false
|
||||
end
|
||||
|
||||
self:F( { Distance = Distance, LoadRadius = self.LoadRadius } )
|
||||
self:T( { Distance = Distance, LoadRadius = self.LoadRadius } )
|
||||
if Distance <= self.LoadRadius then
|
||||
return true
|
||||
else
|
||||
@@ -687,12 +687,12 @@ do -- CARGO_GROUP
|
||||
-- @param Core.Point#Coordinate Coordinate
|
||||
-- @return #boolean true if the Cargo Group is within the report radius.
|
||||
function CARGO_GROUP:IsInReportRadius( Coordinate )
|
||||
--self:F( { Coordinate } )
|
||||
--self:T( { Coordinate } )
|
||||
|
||||
local Cargo = self:GetFirstAlive() -- Cargo.Cargo#CARGO
|
||||
|
||||
if Cargo then
|
||||
self:F( { Cargo } )
|
||||
self:T( { Cargo } )
|
||||
local Distance = 0
|
||||
if Cargo:IsUnLoaded() then
|
||||
Distance = Coordinate:Get2DDistance( Cargo.CargoObject:GetCoordinate() )
|
||||
@@ -738,7 +738,7 @@ do -- CARGO_GROUP
|
||||
-- @return #boolean **true** if the first element of the CargoGroup is in the Zone
|
||||
-- @return #boolean **false** if there is no element of the CargoGroup in the Zone.
|
||||
function CARGO_GROUP:IsInZone( Zone )
|
||||
--self:F( { Zone } )
|
||||
--self:T( { Zone } )
|
||||
|
||||
local Cargo = self.CargoSet:GetFirst() -- Cargo.Cargo#CARGO
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ do -- CARGO_SLINGLOAD
|
||||
-- @return #CARGO_SLINGLOAD
|
||||
function CARGO_SLINGLOAD:New( CargoStatic, Type, Name, LoadRadius, NearRadius )
|
||||
local self = BASE:Inherit( self, CARGO_REPRESENTABLE:New( CargoStatic, Type, Name, nil, LoadRadius, NearRadius ) ) -- #CARGO_SLINGLOAD
|
||||
self:F( { Type, Name, NearRadius } )
|
||||
self:T( { Type, Name, NearRadius } )
|
||||
|
||||
self.CargoObject = CargoStatic
|
||||
|
||||
@@ -130,7 +130,7 @@ do -- CARGO_SLINGLOAD
|
||||
-- @param Core.Point#COORDINATE Coordinate
|
||||
-- @return #boolean true if the Cargo Crate is within the report radius.
|
||||
function CARGO_SLINGLOAD:IsInReportRadius( Coordinate )
|
||||
--self:F( { Coordinate, LoadRadius = self.LoadRadius } )
|
||||
--self:T( { Coordinate, LoadRadius = self.LoadRadius } )
|
||||
|
||||
local Distance = 0
|
||||
if self:IsUnLoaded() then
|
||||
@@ -149,7 +149,7 @@ do -- CARGO_SLINGLOAD
|
||||
-- @param Core.Point#COORDINATE Coordinate
|
||||
-- @return #boolean true if the Cargo Slingload is within the loading radius.
|
||||
function CARGO_SLINGLOAD:IsInLoadRadius( Coordinate )
|
||||
--self:F( { Coordinate } )
|
||||
--self:T( { Coordinate } )
|
||||
|
||||
local Distance = 0
|
||||
if self:IsUnLoaded() then
|
||||
@@ -169,7 +169,7 @@ do -- CARGO_SLINGLOAD
|
||||
-- @return Core.Point#COORDINATE The current Coordinate of the first Cargo of the CargoGroup.
|
||||
-- @return #nil There is no valid Cargo in the CargoGroup.
|
||||
function CARGO_SLINGLOAD:GetCoordinate()
|
||||
--self:F()
|
||||
--self:T()
|
||||
|
||||
return self.CargoObject:GetCoordinate()
|
||||
end
|
||||
@@ -199,7 +199,7 @@ do -- CARGO_SLINGLOAD
|
||||
-- @param #CARGO_SLINGLOAD self
|
||||
-- @param Core.Point#COORDINATE Coordinate
|
||||
function CARGO_SLINGLOAD:RouteTo( Coordinate )
|
||||
--self:F( {Coordinate = Coordinate } )
|
||||
--self:T( {Coordinate = Coordinate } )
|
||||
|
||||
end
|
||||
|
||||
@@ -212,7 +212,7 @@ do -- CARGO_SLINGLOAD
|
||||
-- @return #boolean The Cargo is near to the Carrier.
|
||||
-- @return #nil The Cargo is not near to the Carrier.
|
||||
function CARGO_SLINGLOAD:IsNear( CargoCarrier, NearRadius )
|
||||
--self:F( {NearRadius = NearRadius } )
|
||||
--self:T( {NearRadius = NearRadius } )
|
||||
|
||||
return self:IsNear( CargoCarrier:GetCoordinate(), NearRadius )
|
||||
end
|
||||
@@ -222,7 +222,7 @@ do -- CARGO_SLINGLOAD
|
||||
-- @param #CARGO_SLINGLOAD self
|
||||
function CARGO_SLINGLOAD:Respawn()
|
||||
|
||||
--self:F( { "Respawning slingload " .. self:GetName() } )
|
||||
--self:T( { "Respawning slingload " .. self:GetName() } )
|
||||
|
||||
|
||||
-- Respawn the group...
|
||||
@@ -239,7 +239,7 @@ do -- CARGO_SLINGLOAD
|
||||
-- @param #CARGO_SLINGLOAD self
|
||||
function CARGO_SLINGLOAD:onafterReset()
|
||||
|
||||
--self:F( { "Reset slingload " .. self:GetName() } )
|
||||
--self:T( { "Reset slingload " .. self:GetName() } )
|
||||
|
||||
|
||||
-- Respawn the group...
|
||||
|
||||
@@ -75,7 +75,7 @@ do -- CARGO_UNIT
|
||||
-- @param Core.Point#POINT_VEC2 ToPointVec2
|
||||
-- @param #number NearRadius (optional) Defaut 25 m.
|
||||
function CARGO_UNIT:onenterUnBoarding( From, Event, To, ToPointVec2, NearRadius )
|
||||
self:F( { From, Event, To, ToPointVec2, NearRadius } )
|
||||
self:T( { From, Event, To, ToPointVec2, NearRadius } )
|
||||
|
||||
local Angle = 180
|
||||
local Speed = 60
|
||||
@@ -114,7 +114,7 @@ do -- CARGO_UNIT
|
||||
else
|
||||
self.CargoObject:ReSpawnAt( FromPointVec2, CargoDeployHeading )
|
||||
end
|
||||
self:F( { "CargoUnits:", self.CargoObject:GetGroup():GetName() } )
|
||||
self:T( { "CargoUnits:", self.CargoObject:GetGroup():GetName() } )
|
||||
self.CargoCarrier = nil
|
||||
|
||||
local Points = {}
|
||||
@@ -148,7 +148,7 @@ do -- CARGO_UNIT
|
||||
-- @param Core.Point#POINT_VEC2 ToPointVec2
|
||||
-- @param #number NearRadius (optional) Defaut 100 m.
|
||||
function CARGO_UNIT:onleaveUnBoarding( From, Event, To, ToPointVec2, NearRadius )
|
||||
self:F( { From, Event, To, ToPointVec2, NearRadius } )
|
||||
self:T( { From, Event, To, ToPointVec2, NearRadius } )
|
||||
|
||||
local Angle = 180
|
||||
local Speed = 10
|
||||
@@ -174,7 +174,7 @@ do -- CARGO_UNIT
|
||||
-- @param Core.Point#POINT_VEC2 ToPointVec2
|
||||
-- @param #number NearRadius (optional) Defaut 100 m.
|
||||
function CARGO_UNIT:onafterUnBoarding( From, Event, To, ToPointVec2, NearRadius )
|
||||
self:F( { From, Event, To, ToPointVec2, NearRadius } )
|
||||
self:T( { From, Event, To, ToPointVec2, NearRadius } )
|
||||
|
||||
self.CargoInAir = self.CargoObject:InAir()
|
||||
|
||||
@@ -199,7 +199,7 @@ do -- CARGO_UNIT
|
||||
-- @param #string To
|
||||
-- @param Core.Point#POINT_VEC2
|
||||
function CARGO_UNIT:onenterUnLoaded( From, Event, To, ToPointVec2 )
|
||||
self:F( { ToPointVec2, From, Event, To } )
|
||||
self:T( { ToPointVec2, From, Event, To } )
|
||||
|
||||
local Angle = 180
|
||||
local Speed = 10
|
||||
@@ -236,7 +236,7 @@ do -- CARGO_UNIT
|
||||
-- @param Wrapper.Group#GROUP CargoCarrier
|
||||
-- @param #number NearRadius
|
||||
function CARGO_UNIT:onafterBoard( From, Event, To, CargoCarrier, NearRadius, ... )
|
||||
self:F( { From, Event, To, CargoCarrier, NearRadius = NearRadius } )
|
||||
self:T( { From, Event, To, CargoCarrier, NearRadius = NearRadius } )
|
||||
|
||||
self.CargoInAir = self.CargoObject:InAir()
|
||||
|
||||
@@ -244,7 +244,7 @@ do -- CARGO_UNIT
|
||||
local MaxSpeed = Desc.speedMaxOffRoad
|
||||
local TypeName = Desc.typeName
|
||||
|
||||
--self:F({Unit=self.CargoObject:GetName()})
|
||||
--self:T({Unit=self.CargoObject:GetName()})
|
||||
|
||||
-- A cargo unit can only be boarded if it is not dead
|
||||
|
||||
@@ -298,9 +298,9 @@ do -- CARGO_UNIT
|
||||
-- @param Wrapper.Client#CLIENT CargoCarrier
|
||||
-- @param #number NearRadius Default 25 m.
|
||||
function CARGO_UNIT:onafterBoarding( From, Event, To, CargoCarrier, NearRadius, ... )
|
||||
self:F( { From, Event, To, CargoCarrier:GetName(), NearRadius = NearRadius } )
|
||||
self:T( { From, Event, To, CargoCarrier:GetName(), NearRadius = NearRadius } )
|
||||
|
||||
self:F( { IsAlive=self.CargoObject:IsAlive() } )
|
||||
self:T( { IsAlive=self.CargoObject:IsAlive() } )
|
||||
|
||||
if CargoCarrier and CargoCarrier:IsAlive() then -- and self.CargoObject and self.CargoObject:IsAlive() then
|
||||
if (CargoCarrier:IsAir() and not CargoCarrier:InAir()) or true then
|
||||
@@ -321,7 +321,7 @@ do -- CARGO_UNIT
|
||||
local Angle = 180
|
||||
local Distance = 0
|
||||
|
||||
--self:F({Unit=self.CargoObject:GetName()})
|
||||
--self:T({Unit=self.CargoObject:GetName()})
|
||||
|
||||
local CargoCarrierPointVec2 = CargoCarrier:GetPointVec2()
|
||||
local CargoCarrierHeading = CargoCarrier:GetHeading() -- Get Heading of object in degrees.
|
||||
@@ -348,7 +348,7 @@ do -- CARGO_UNIT
|
||||
self.CargoObject:SetCommand( self.CargoObject:CommandStopRoute( true ) )
|
||||
end
|
||||
else
|
||||
self:E("Something is wrong")
|
||||
self:T("Something is wrong")
|
||||
end
|
||||
|
||||
end
|
||||
@@ -361,11 +361,11 @@ do -- CARGO_UNIT
|
||||
-- @param #string To
|
||||
-- @param Wrapper.Unit#UNIT CargoCarrier
|
||||
function CARGO_UNIT:onenterLoaded( From, Event, To, CargoCarrier )
|
||||
self:F( { From, Event, To, CargoCarrier } )
|
||||
self:T( { From, Event, To, CargoCarrier } )
|
||||
|
||||
self.CargoCarrier = CargoCarrier
|
||||
|
||||
--self:F({Unit=self.CargoObject:GetName()})
|
||||
--self:T({Unit=self.CargoObject:GetName()})
|
||||
|
||||
-- Only destroy the CargoObject if there is a CargoObject (packages don't have CargoObjects).
|
||||
if self.CargoObject then
|
||||
|
||||
@@ -489,8 +489,30 @@ do -- Zones and Pathlines
|
||||
-- Create new polygon zone.
|
||||
local Zone=ZONE_POLYGON:NewFromPointsArray(ZoneName, points)
|
||||
|
||||
--Zone.DrawID = objectID
|
||||
|
||||
-- Set color.
|
||||
Zone:SetColor({1, 0, 0}, 0.15)
|
||||
Zone:SetFillColor({1, 0, 0}, 0.15)
|
||||
|
||||
if objectData.colorString then
|
||||
-- eg colorString = 0xff0000ff
|
||||
local color = string.gsub(objectData.colorString,"^0x","")
|
||||
local r = tonumber(string.sub(color,1,2),16)/255
|
||||
local g = tonumber(string.sub(color,3,4),16)/255
|
||||
local b = tonumber(string.sub(color,5,6),16)/255
|
||||
local a = tonumber(string.sub(color,7,8),16)/255
|
||||
Zone:SetColor({r, g, b}, a)
|
||||
end
|
||||
if objectData.fillColorString then
|
||||
-- eg fillColorString = 0xff00004b
|
||||
local color = string.gsub(objectData.colorString,"^0x","")
|
||||
local r = tonumber(string.sub(color,1,2),16)/255
|
||||
local g = tonumber(string.sub(color,3,4),16)/255
|
||||
local b = tonumber(string.sub(color,5,6),16)/255
|
||||
local a = tonumber(string.sub(color,7,8),16)/255
|
||||
Zone:SetFillColor({r, g, b}, a)
|
||||
end
|
||||
|
||||
-- Store in DB.
|
||||
self.ZONENAMES[ZoneName] = ZoneName
|
||||
@@ -533,6 +555,25 @@ do -- Zones and Pathlines
|
||||
-- Set color.
|
||||
Zone:SetColor({1, 0, 0}, 0.15)
|
||||
|
||||
if objectData.colorString then
|
||||
-- eg colorString = 0xff0000ff
|
||||
local color = string.gsub(objectData.colorString,"^0x","")
|
||||
local r = tonumber(string.sub(color,1,2),16)/255
|
||||
local g = tonumber(string.sub(color,3,4),16)/255
|
||||
local b = tonumber(string.sub(color,5,6),16)/255
|
||||
local a = tonumber(string.sub(color,7,8),16)/255
|
||||
Zone:SetColor({r, g, b}, a)
|
||||
end
|
||||
if objectData.fillColorString then
|
||||
-- eg fillColorString = 0xff00004b
|
||||
local color = string.gsub(objectData.colorString,"^0x","")
|
||||
local r = tonumber(string.sub(color,1,2),16)/255
|
||||
local g = tonumber(string.sub(color,3,4),16)/255
|
||||
local b = tonumber(string.sub(color,5,6),16)/255
|
||||
local a = tonumber(string.sub(color,7,8),16)/255
|
||||
Zone:SetFillColor({r, g, b}, a)
|
||||
end
|
||||
|
||||
-- Store in DB.
|
||||
self.ZONENAMES[ZoneName] = ZoneName
|
||||
|
||||
@@ -756,7 +797,7 @@ end -- cargo
|
||||
|
||||
--- Finds a CLIENT based on the ClientName.
|
||||
-- @param #DATABASE self
|
||||
-- @param #string ClientName
|
||||
-- @param #string ClientName - Note this is the UNIT name of the client!
|
||||
-- @return Wrapper.Client#CLIENT The found CLIENT.
|
||||
function DATABASE:FindClient( ClientName )
|
||||
|
||||
@@ -1303,8 +1344,16 @@ function DATABASE:_RegisterAirbase(airbase)
|
||||
-- Unique ID.
|
||||
local airbaseUID=airbase:GetID(true)
|
||||
|
||||
local typename = airbase:GetTypeName()
|
||||
|
||||
local category = airbase.category
|
||||
|
||||
if category == Airbase.Category.SHIP and typename == "FARP_SINGLE_01" then
|
||||
category = Airbase.Category.HELIPAD
|
||||
end
|
||||
|
||||
-- Debug output.
|
||||
local text=string.format("Register %s: %s (UID=%d), Runways=%d, Parking=%d [", AIRBASE.CategoryName[airbase.category], tostring(DCSAirbaseName), airbaseUID, #airbase.runways, airbase.NparkingTotal)
|
||||
local text=string.format("Register %s: %s (UID=%d), Runways=%d, Parking=%d [", AIRBASE.CategoryName[category], tostring(DCSAirbaseName), airbaseUID, #airbase.runways, airbase.NparkingTotal)
|
||||
for _,terminalType in pairs(AIRBASE.TerminalType) do
|
||||
if airbase.NparkingTerminal and airbase.NparkingTerminal[terminalType] then
|
||||
text=text..string.format("%d=%d ", terminalType, airbase.NparkingTerminal[terminalType])
|
||||
@@ -1852,7 +1901,7 @@ end
|
||||
|
||||
--- Add a flight control to the data base.
|
||||
-- @param #DATABASE self
|
||||
-- @param Ops.FlightControl#FLIGHTCONTROL flightcontrol
|
||||
-- @param OPS.FlightControl#FLIGHTCONTROL flightcontrol
|
||||
function DATABASE:AddFlightControl(flightcontrol)
|
||||
self:F2( { flightcontrol } )
|
||||
self.FLIGHTCONTROLS[flightcontrol.airbasename]=flightcontrol
|
||||
@@ -1861,7 +1910,7 @@ end
|
||||
--- Get a flight control object from the data base.
|
||||
-- @param #DATABASE self
|
||||
-- @param #string airbasename Name of the associated airbase.
|
||||
-- @return Ops.FlightControl#FLIGHTCONTROL The FLIGHTCONTROL object.s
|
||||
-- @return OPS.FlightControl#FLIGHTCONTROL The FLIGHTCONTROL object.s
|
||||
function DATABASE:GetFlightControl(airbasename)
|
||||
return self.FLIGHTCONTROLS[airbasename]
|
||||
end
|
||||
|
||||
@@ -249,7 +249,7 @@ do -- FSM
|
||||
--
|
||||
-- ### Linear Transition Example
|
||||
--
|
||||
-- This example is fully implemented in the MOOSE test mission on GITHUB: [FSM-100 - Transition Explanation](https://github.com/FlightControl-Master/MOOSE_MISSIONS/blob/master/FSM%20-%20Finite%20State%20Machine/FSM-100%20-%20Transition%20Explanation/FSM-100%20-%20Transition%20Explanation.lua)
|
||||
-- This example is fully implemented in the MOOSE test mission on GitHub: [FSM-100 - Transition Explanation](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Core/FSM/FSM-100%20-%20Transition%20Explanation)
|
||||
--
|
||||
-- It models a unit standing still near Batumi, and flaring every 5 seconds while switching between a Green flare and a Red flare.
|
||||
-- The purpose of this example is not to show how exciting flaring is, but it demonstrates how a Linear Transition FSM can be build.
|
||||
|
||||
@@ -368,7 +368,7 @@ function MESSAGE:ToCoalition( CoalitionSide, Settings )
|
||||
if CoalitionSide then
|
||||
if self.MessageDuration ~= 0 then
|
||||
self:T( self.MessageCategory .. self.MessageText:gsub( "\n$", "" ):gsub( "\n$", "" ) .. " / " .. self.MessageDuration )
|
||||
trigger.action.outTextForCoalition( CoalitionSide, self.MessageText:gsub( "\n$", "" ):gsub( "\n$", "" ), self.MessageDuration, self.ClearScreen )
|
||||
trigger.action.outTextForCoalition( CoalitionSide, self.MessageCategory .. self.MessageText:gsub( "\n$", "" ):gsub( "\n$", "" ), self.MessageDuration, self.ClearScreen )
|
||||
end
|
||||
end
|
||||
|
||||
@@ -459,14 +459,14 @@ end
|
||||
|
||||
_MESSAGESRS = {}
|
||||
|
||||
--- Set up MESSAGE generally to allow Text-To-Speech via SRS and TTS functions.
|
||||
-- @param #string PathToSRS Path to SRS Folder, defaults to "C:\\\\Program Files\\\\DCS-SimpleRadio-Standalone".
|
||||
-- @param #number Port Port number of SRS, defaults to 5002.
|
||||
-- @param #string PathToCredentials (optional) Path to credentials file for e.g. Google.
|
||||
--- Set up MESSAGE generally to allow Text-To-Speech via SRS and TTS functions. `SetMSRS()` will try to use as many attributes configured with @{Sound.SRS#MSRS.LoadConfigFile}() as possible.
|
||||
-- @param #string PathToSRS (optional) Path to SRS Folder, defaults to "C:\\\\Program Files\\\\DCS-SimpleRadio-Standalone" or your configuration file setting.
|
||||
-- @param #number Port Port (optional) number of SRS, defaults to 5002 or your configuration file setting.
|
||||
-- @param #string PathToCredentials (optional) Path to credentials file for Google.
|
||||
-- @param #number Frequency Frequency in MHz. Can also be given as a #table of frequencies.
|
||||
-- @param #number Modulation Modulation, i.e. radio.modulation.AM or radio.modulation.FM. Can also be given as a #table of modulations.
|
||||
-- @param #string Gender (optional) Gender, i.e. "male" or "female", defaults to "female".
|
||||
-- @param #string Culture (optional) Culture, e.g. "en-US", defaults to "en-GB"
|
||||
-- @param #string Gender (optional) Gender, i.e. "male" or "female", defaults to "female" or your configuration file setting.
|
||||
-- @param #string Culture (optional) Culture, e.g. "en-US", defaults to "en-GB" or your configuration file setting.
|
||||
-- @param #string Voice (optional) Voice. Will override gender and culture settings, e.g. MSRS.Voices.Microsoft.Hazel or MSRS.Voices.Google.Standard.de_DE_Standard_D. Hint on Microsoft voices - working voices are limited to Hedda, Hazel, David, Zira and Hortense. **Must** be installed on your Desktop or Server!
|
||||
-- @param #number Coalition (optional) Coalition, can be coalition.side.RED, coalition.side.BLUE or coalition.side.NEUTRAL. Defaults to coalition.side.NEUTRAL.
|
||||
-- @param #number Volume (optional) Volume, can be between 0.0 and 1.0 (loudest).
|
||||
@@ -480,45 +480,51 @@ _MESSAGESRS = {}
|
||||
-- MESSAGE:New("Test message!",15,"SPAWN"):ToSRS()
|
||||
--
|
||||
function MESSAGE.SetMSRS(PathToSRS,Port,PathToCredentials,Frequency,Modulation,Gender,Culture,Voice,Coalition,Volume,Label,Coordinate)
|
||||
_MESSAGESRS.MSRS = MSRS:New(PathToSRS,Frequency or 243,Modulation or radio.modulation.AM,Volume)
|
||||
|
||||
_MESSAGESRS.frequency = Frequency
|
||||
_MESSAGESRS.modulation = Modulation or radio.modulation.AM
|
||||
_MESSAGESRS.PathToSRS = PathToSRS or MSRS.path or "C:\\Program Files\\DCS-SimpleRadio-Standalone"
|
||||
|
||||
_MESSAGESRS.MSRS:SetCoalition(Coalition or coalition.side.NEUTRAL)
|
||||
_MESSAGESRS.coalition = Coalition or coalition.side.NEUTRAL
|
||||
_MESSAGESRS.frequency = Frequency or MSRS.frequencies or 243
|
||||
_MESSAGESRS.modulation = Modulation or MSRS.modulations or radio.modulation.AM
|
||||
|
||||
_MESSAGESRS.MSRS = MSRS:New(_MESSAGESRS.PathToSRS,_MESSAGESRS.frequency, _MESSAGESRS.modulation)
|
||||
|
||||
_MESSAGESRS.coalition = Coalition or MSRS.coalition or coalition.side.NEUTRAL
|
||||
_MESSAGESRS.MSRS:SetCoalition(_MESSAGESRS.coalition)
|
||||
|
||||
_MESSAGESRS.coordinate = Coordinate
|
||||
_MESSAGESRS.MSRS:SetCoordinate(Coordinate)
|
||||
|
||||
if Coordinate then
|
||||
_MESSAGESRS.MSRS:SetCoordinate(Coordinate)
|
||||
end
|
||||
|
||||
_MESSAGESRS.Culture = Culture or MSRS.culture or "en-GB"
|
||||
_MESSAGESRS.MSRS:SetCulture(Culture)
|
||||
_MESSAGESRS.Culture = Culture or "en-GB"
|
||||
|
||||
_MESSAGESRS.Gender = Gender or MSRS.gender or "female"
|
||||
_MESSAGESRS.MSRS:SetGender(Gender)
|
||||
_MESSAGESRS.Gender = Gender or "female"
|
||||
|
||||
_MESSAGESRS.MSRS:SetGoogle(PathToCredentials)
|
||||
_MESSAGESRS.google = PathToCredentials
|
||||
if PathToCredentials then
|
||||
_MESSAGESRS.MSRS:SetProviderOptionsGoogle(PathToCredentials)
|
||||
_MESSAGESRS.MSRS:SetProvider(MSRS.Provider.GOOGLE)
|
||||
end
|
||||
|
||||
_MESSAGESRS.label = Label or MSRS.Label or "MESSAGE"
|
||||
_MESSAGESRS.MSRS:SetLabel(Label or "MESSAGE")
|
||||
_MESSAGESRS.label = Label or "MESSAGE"
|
||||
|
||||
_MESSAGESRS.port = Port or MSRS.port or 5002
|
||||
_MESSAGESRS.MSRS:SetPort(Port or 5002)
|
||||
_MESSAGESRS.port = Port or 5002
|
||||
|
||||
_MESSAGESRS.volume = Volume or 1
|
||||
_MESSAGESRS.volume = Volume or MSRS.volume or 1
|
||||
_MESSAGESRS.MSRS:SetVolume(_MESSAGESRS.volume)
|
||||
|
||||
if Voice then _MESSAGESRS.MSRS:SetVoice(Voice) end
|
||||
|
||||
_MESSAGESRS.voice = Voice --or MSRS.Voices.Microsoft.Hedda
|
||||
--if _MESSAGESRS.google and not Voice then _MESSAGESRS.Voice = MSRS.Voices.Google.Standard.en_GB_Standard_A end
|
||||
--_MESSAGESRS.MSRS:SetVoice(Voice or _MESSAGESRS.voice)
|
||||
_MESSAGESRS.voice = Voice or MSRS.voice --or MSRS.Voices.Microsoft.Hedda
|
||||
|
||||
_MESSAGESRS.SRSQ = MSRSQUEUE:New(Label or "MESSAGE")
|
||||
_MESSAGESRS.SRSQ = MSRSQUEUE:New(_MESSAGESRS.label)
|
||||
end
|
||||
|
||||
--- Sends a message via SRS.
|
||||
--- Sends a message via SRS. `ToSRS()` will try to use as many attributes configured with @{Core.Message#MESSAGE.SetMSRS}() and @{Sound.SRS#MSRS.LoadConfigFile}() as possible.
|
||||
-- @param #MESSAGE self
|
||||
-- @param #number frequency (optional) Frequency in MHz. Can also be given as a #table of frequencies. Only needed if you want to override defaults set with `MESSAGE.SetMSRS()` for this one setting.
|
||||
-- @param #number modulation (optional) Modulation, i.e. radio.modulation.AM or radio.modulation.FM. Can also be given as a #table of modulations. Only needed if you want to override defaults set with `MESSAGE.SetMSRS()` for this one setting.
|
||||
@@ -546,7 +552,7 @@ function MESSAGE:ToSRS(frequency,modulation,gender,culture,voice,coalition,volum
|
||||
_MESSAGESRS.MSRS:SetCoordinate(coordinate)
|
||||
end
|
||||
local category = string.gsub(self.MessageCategory,":","")
|
||||
_MESSAGESRS.SRSQ:NewTransmission(self.MessageText,nil,_MESSAGESRS.MSRS,nil,nil,nil,nil,nil,frequency or _MESSAGESRS.frequency,modulation or _MESSAGESRS.modulation, gender or _MESSAGESRS.Gender,culture or _MESSAGESRS.Culture,nil,volume or _MESSAGESRS.volume,category,coordinate or _MESSAGESRS.coordinate)
|
||||
_MESSAGESRS.SRSQ:NewTransmission(self.MessageText,nil,_MESSAGESRS.MSRS,0.5,1,nil,nil,nil,frequency or _MESSAGESRS.frequency,modulation or _MESSAGESRS.modulation, gender or _MESSAGESRS.Gender,culture or _MESSAGESRS.Culture,nil,volume or _MESSAGESRS.volume,category,coordinate or _MESSAGESRS.coordinate)
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
|
||||
do -- COORDINATE
|
||||
|
||||
--- @type COORDINATE
|
||||
---
|
||||
-- @type COORDINATE
|
||||
-- @field #string ClassName Name of the class
|
||||
-- @field #number x Component of the 3D vector.
|
||||
-- @field #number y Component of the 3D vector.
|
||||
@@ -180,7 +181,7 @@ do -- COORDINATE
|
||||
-- * @{#COORDINATE.ToStringBR}(): Generates a Bearing & Range text in the format of DDD for DI where DDD is degrees and DI is distance.
|
||||
-- * @{#COORDINATE.ToStringBRA}(): Generates a Bearing, Range & Altitude text.
|
||||
-- * @{#COORDINATE.ToStringBRAANATO}(): Generates a Generates a Bearing, Range, Aspect & Altitude text in NATOPS.
|
||||
-- * @{#COORDINATE.ToStringLL}(): Generates a Latutide & Longitude text.
|
||||
-- * @{#COORDINATE.ToStringLL}(): Generates a Latitude & Longitude text.
|
||||
-- * @{#COORDINATE.ToStringLLDMS}(): Generates a Lat, Lon, Degree, Minute, Second text.
|
||||
-- * @{#COORDINATE.ToStringLLDDM}(): Generates a Lat, Lon, Degree, decimal Minute text.
|
||||
-- * @{#COORDINATE.ToStringMGRS}(): Generates a MGRS grid coordinate text.
|
||||
@@ -2455,15 +2456,18 @@ do -- COORDINATE
|
||||
-- Write command as string and execute that. Idea by Grimes https://forum.dcs.world/topic/324201-mark-to-all-function/#comment-5273793
|
||||
local s=string.format("trigger.action.markupToAll(7, %d, %d,", Coalition, MarkID)
|
||||
for _,vec in pairs(vecs) do
|
||||
s=s..string.format("%s,", UTILS._OneLineSerialize(vec))
|
||||
--s=s..string.format("%s,", UTILS._OneLineSerialize(vec))
|
||||
s=s..string.format("{x=%.1f, y=%.1f, z=%.1f},", vec.x, vec.y, vec.z)
|
||||
end
|
||||
s=s..string.format("%s, %s, %s, %s", UTILS._OneLineSerialize(Color), UTILS._OneLineSerialize(FillColor), tostring(LineType), tostring(ReadOnly))
|
||||
if Text and Text~="" then
|
||||
s=s..string.format(", \"%s\"", Text)
|
||||
s=s..string.format("{%.3f, %.3f, %.3f, %.3f},", Color[1], Color[2], Color[3], Color[4])
|
||||
s=s..string.format("{%.3f, %.3f, %.3f, %.3f},", FillColor[1], FillColor[2], FillColor[3], FillColor[4])
|
||||
s=s..string.format("%d,", LineType or 1)
|
||||
s=s..string.format("%s", tostring(ReadOnly))
|
||||
if Text and type(Text)=="string" and string.len(Text)>0 then
|
||||
s=s..string.format(", \"%s\"", tostring(Text))
|
||||
end
|
||||
s=s..")"
|
||||
|
||||
|
||||
-- Execute string command
|
||||
local success=UTILS.DoString(s)
|
||||
|
||||
@@ -2551,7 +2555,7 @@ do -- COORDINATE
|
||||
|
||||
Offset=Offset or 2
|
||||
|
||||
-- Measurement of visibility should not be from the ground, so Adding a hypotethical 2 meters to each Coordinate.
|
||||
-- Measurement of visibility should not be from the ground, so Adding a hypothetical 2 meters to each Coordinate.
|
||||
local FromVec3 = self:GetVec3()
|
||||
FromVec3.y = FromVec3.y + Offset
|
||||
|
||||
@@ -2952,10 +2956,10 @@ do -- COORDINATE
|
||||
end
|
||||
|
||||
-- corrected Track to be direction of travel of bogey (self in this case)
|
||||
local track = "Maneuver"
|
||||
local track = "Maneuver"
|
||||
|
||||
if self.Heading then
|
||||
track = UTILS.BearingToCardinal(self.Heading) or "North"
|
||||
if self.Heading then
|
||||
track = UTILS.BearingToCardinal(self.Heading) or "North"
|
||||
end
|
||||
|
||||
if rangeNM > 3 then
|
||||
@@ -3067,6 +3071,18 @@ do -- COORDINATE
|
||||
return coord.LOtoLL( self:GetVec3() )
|
||||
end
|
||||
|
||||
--- Get Latitude & Longitude text.
|
||||
-- @param #COORDINATE self
|
||||
-- @param Core.Settings#SETTINGS Settings (optional) The settings. Can be nil, and in this case the default settings are used. If you want to specify your own settings, use the _SETTINGS object.
|
||||
-- @return #string LLText
|
||||
function COORDINATE:ToStringLL( Settings )
|
||||
|
||||
local LL_Accuracy = Settings and Settings.LL_Accuracy or _SETTINGS.LL_Accuracy
|
||||
local lat, lon = coord.LOtoLL( self:GetVec3() )
|
||||
return string.format('%f', lat) .. ' ' .. string.format('%f', lon)
|
||||
end
|
||||
|
||||
|
||||
--- Provides a Lat Lon string in Degree Minute Second format.
|
||||
-- @param #COORDINATE self
|
||||
-- @param Core.Settings#SETTINGS Settings (optional) The settings. Can be nil, and in this case the default settings are used. If you want to specify your own settings, use the _SETTINGS object.
|
||||
@@ -3101,6 +3117,49 @@ do -- COORDINATE
|
||||
return "MGRS " .. UTILS.tostringMGRS( MGRS, MGRS_Accuracy )
|
||||
end
|
||||
|
||||
--- Provides a COORDINATE from an MGRS String
|
||||
-- @param #COORDINATE self
|
||||
-- @param #string MGRSString MGRS String, e.g. "MGRS 37T DK 12345 12345"
|
||||
-- @return #COORDINATE self
|
||||
function COORDINATE:NewFromMGRSString( MGRSString )
|
||||
local myparts = UTILS.Split(MGRSString," ")
|
||||
local northing = tostring(myparts[5]) or ""
|
||||
local easting = tostring(myparts[4]) or ""
|
||||
if string.len(easting) < 5 then easting = easting..string.rep("0",5-string.len(easting)) end
|
||||
if string.len(northing) < 5 then northing = northing..string.rep("0",5-string.len(northing)) end
|
||||
local MGRS = {
|
||||
UTMZone = myparts[2],
|
||||
MGRSDigraph = myparts[3],
|
||||
Easting = easting,
|
||||
Northing = northing,
|
||||
}
|
||||
local lat, lon = coord.MGRStoLL(MGRS)
|
||||
local point = coord.LLtoLO(lat, lon, 0)
|
||||
local coord = COORDINATE:NewFromVec2({x=point.x,y=point.z})
|
||||
return coord
|
||||
end
|
||||
|
||||
--- Provides a COORDINATE from an MGRS Coordinate
|
||||
-- @param #COORDINATE self
|
||||
-- @param #string UTMZone UTM Zone, e.g. "37T"
|
||||
-- @param #string MGRSDigraph Digraph, e.g. "DK"
|
||||
-- @param #string Easting Meters easting - string in order to allow for leading zeros, e.g. "01234". Should be 5 digits.
|
||||
-- @param #string Northing Meters northing - string in order to allow for leading zeros, e.g. "12340". Should be 5 digits.
|
||||
-- @return #COORDINATE self
|
||||
function COORDINATE:NewFromMGRS( UTMZone, MGRSDigraph, Easting, Northing )
|
||||
if string.len(Easting) < 5 then Easting = Easting..string.rep("0",5-string.len(Easting) )end
|
||||
if string.len(Northing) < 5 then Northing = Northing..string.rep("0",5-string.len(Northing) )end
|
||||
local MGRS = {
|
||||
UTMZone = UTMZone,
|
||||
MGRSDigraph = MGRSDigraph,
|
||||
Easting = Easting,
|
||||
Northing = Northing,
|
||||
}
|
||||
local lat, lon = coord.MGRStoLL(MGRS)
|
||||
local point = coord.LLtoLO(lat, lon, 0)
|
||||
local coord = COORDINATE:NewFromVec2({x=point.x,y=point.z})
|
||||
end
|
||||
|
||||
--- Provides a coordinate string of the point, based on a coordinate format system:
|
||||
-- * Uses default settings in COORDINATE.
|
||||
-- * Can be overridden if for a GROUP containing x clients, a menu was selected to override the default.
|
||||
@@ -3613,7 +3672,7 @@ end
|
||||
|
||||
do -- POINT_VEC2
|
||||
|
||||
--- @type POINT_VEC2
|
||||
-- @type POINT_VEC2
|
||||
-- @field DCS#Distance x The x coordinate in meters.
|
||||
-- @field DCS#Distance y the y coordinate in meters.
|
||||
-- @extends Core.Point#COORDINATE
|
||||
|
||||
@@ -14,17 +14,13 @@
|
||||
--
|
||||
-- # Demo Missions
|
||||
--
|
||||
-- ### [SCHEDULER Demo Missions source code](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/SCH%20-%20Scheduler)
|
||||
--
|
||||
-- ### [SCHEDULER Demo Missions, only for beta testers](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/SCH%20-%20Scheduler)
|
||||
--
|
||||
-- ### [ALL Demo Missions pack of the last release](https://github.com/FlightControl-Master/MOOSE_MISSIONS/releases)
|
||||
-- ### [SCHEDULER Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Core/Scheduler)
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- # YouTube Channel
|
||||
--
|
||||
-- ### [SCHEDULER YouTube Channel (none)]()
|
||||
-- ### None
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
|
||||
@@ -147,6 +147,44 @@ do -- SET_BASE
|
||||
return self
|
||||
end
|
||||
|
||||
--- [Internal] Add a functional filter
|
||||
-- @param #SET_BASE self
|
||||
-- @param #function ConditionFunction If this function returns `true`, the object is added to the SET. The function needs to take a CONTROLLABLE object as first argument.
|
||||
-- @param ... Condition function arguments, if any.
|
||||
-- @return #boolean If true, at least one condition is true
|
||||
function SET_BASE:FilterFunction(ConditionFunction, ...)
|
||||
|
||||
local condition={}
|
||||
condition.func=ConditionFunction
|
||||
condition.arg={}
|
||||
|
||||
if arg then
|
||||
condition.arg=arg
|
||||
end
|
||||
|
||||
if not self.Filter.Functions then self.Filter.Functions = {} end
|
||||
table.insert(self.Filter.Functions, condition)
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- [Internal] Check if the condition functions returns true.
|
||||
-- @param #SET_BASE self
|
||||
-- @param Wrapper.Controllable#CONTROLLABLE Object The object to filter for
|
||||
-- @return #boolean If true, if **all** conditions are true
|
||||
function SET_BASE:_EvalFilterFunctions(Object)
|
||||
-- All conditions must be true.
|
||||
for _,_condition in pairs(self.Filter.Functions or {}) do
|
||||
local condition=_condition
|
||||
-- Call function.
|
||||
if condition.func(Object,unpack(condition.arg)) == false then
|
||||
return false
|
||||
end
|
||||
end
|
||||
-- No condition was true.
|
||||
return true
|
||||
end
|
||||
|
||||
--- Clear the Objects in the Set.
|
||||
-- @param #SET_BASE self
|
||||
-- @param #boolean TriggerEvent If `true`, an event remove is triggered for each group that is removed from the set.
|
||||
@@ -417,14 +455,35 @@ do -- SET_BASE
|
||||
|
||||
--- Gets a random object from the @{Core.Set#SET_BASE} and derived classes.
|
||||
-- @param #SET_BASE self
|
||||
-- @return Core.Base#BASE
|
||||
-- @return Core.Base#BASE or nil if none found or the SET is empty!
|
||||
function SET_BASE:GetRandom()
|
||||
local tablemax = table.maxn(self.Index)
|
||||
local tablemax = 0
|
||||
for _,_ind in pairs(self.Index) do
|
||||
tablemax = tablemax + 1
|
||||
end
|
||||
--local tablemax = table.maxn(self.Index)
|
||||
local RandomItem = self.Set[self.Index[math.random(1,tablemax)]]
|
||||
self:T3( { RandomItem } )
|
||||
return RandomItem
|
||||
end
|
||||
|
||||
--- Gets a random object from the @{Core.Set#SET_BASE} and derived classes. A bit slower than @{#SET_BASE.GetRandom}() but tries to ensure you get an object back if the SET is not empty.
|
||||
-- @param #SET_BASE self
|
||||
-- @return Core.Base#BASE or nil if the SET is empty!
|
||||
function SET_BASE:GetRandomSurely()
|
||||
local tablemax = 0
|
||||
local sorted = {}
|
||||
for _,_obj in pairs(self.Set) do
|
||||
tablemax = tablemax + 1
|
||||
sorted[tablemax] = _obj
|
||||
end
|
||||
--local tablemax = table.maxn(self.Index)
|
||||
--local RandomItem = self.Set[self.Index[math.random(1,tablemax)]]
|
||||
local RandomItem = sorted[math.random(1,tablemax)]
|
||||
self:T3( { RandomItem } )
|
||||
return RandomItem
|
||||
end
|
||||
|
||||
--- Retrieves the amount of objects in the @{Core.Set#SET_BASE} and derived classes.
|
||||
-- @param #SET_BASE self
|
||||
-- @return #number Count
|
||||
@@ -561,10 +620,12 @@ do -- SET_BASE
|
||||
return self
|
||||
end
|
||||
|
||||
--- Iterate the SET_BASE while identifying the nearest object from a @{Core.Point#POINT_VEC2}.
|
||||
--- Iterate the SET_BASE while identifying the nearest object in the set from a @{Core.Point#POINT_VEC2}.
|
||||
-- @param #SET_BASE self
|
||||
-- @param Core.Point#POINT_VEC2 PointVec2 A @{Core.Point#POINT_VEC2} object from where to evaluate the closest object in the set.
|
||||
-- @param Core.Point#POINT_VEC2 PointVec2 A @{Core.Point#COORDINATE} or @{Core.Point#POINT_VEC2} object (but **not** a simple DCS#Vec2!) from where to evaluate the closest object in the set.
|
||||
-- @return Core.Base#BASE The closest object.
|
||||
-- @usage
|
||||
-- myset:FindNearestObjectFromPointVec2( ZONE:New("Test Zone"):GetCoordinate() )
|
||||
function SET_BASE:FindNearestObjectFromPointVec2( PointVec2 )
|
||||
self:F2( PointVec2 )
|
||||
|
||||
@@ -961,6 +1022,7 @@ do
|
||||
-- * @{#SET_GROUP.FilterCategoryShip}: Builds the SET_GROUP from ships.
|
||||
-- * @{#SET_GROUP.FilterCategoryStructure}: Builds the SET_GROUP from structures.
|
||||
-- * @{#SET_GROUP.FilterZones}: Builds the SET_GROUP with the groups within a @{Core.Zone#ZONE}.
|
||||
-- * @{#SET_GROUP.FilterFunction}: Builds the SET_GROUP with a custom condition.
|
||||
--
|
||||
-- Once the filter criteria have been set for the SET_GROUP, you can start filtering using:
|
||||
--
|
||||
@@ -1034,6 +1096,7 @@ do
|
||||
Countries = nil,
|
||||
GroupPrefixes = nil,
|
||||
Zones = nil,
|
||||
Functions = nil,
|
||||
},
|
||||
FilterMeta = {
|
||||
Coalitions = {
|
||||
@@ -1248,6 +1311,25 @@ do
|
||||
return self
|
||||
end
|
||||
|
||||
--- [User] Add a custom condition function.
|
||||
-- @function [parent=#SET_GROUP] FilterFunction
|
||||
-- @param #SET_GROUP self
|
||||
-- @param #function ConditionFunction If this function returns `true`, the object is added to the SET. The function needs to take a GROUP object as first argument.
|
||||
-- @param ... Condition function arguments if any.
|
||||
-- @return #SET_GROUP self
|
||||
-- @usage
|
||||
-- -- Image you want to exclude a specific GROUP from a SET:
|
||||
-- local groundset = SET_GROUP:New():FilterCoalitions("blue"):FilterCategoryGround():FilterFunction(
|
||||
-- -- The function needs to take a GROUP object as first - and in this case, only - argument.
|
||||
-- function(grp)
|
||||
-- local isinclude = true
|
||||
-- if grp:GetName() == "Exclude Me" then isinclude = false end
|
||||
-- return isinclude
|
||||
-- end
|
||||
-- ):FilterOnce()
|
||||
-- BASE:I(groundset:Flush())
|
||||
|
||||
|
||||
--- Builds a set of groups of coalitions.
|
||||
-- Possible current coalitions are red, blue and neutral.
|
||||
-- @param #SET_GROUP self
|
||||
@@ -1496,7 +1578,7 @@ do
|
||||
function SET_GROUP:AddInDatabase( Event )
|
||||
self:F3( { Event } )
|
||||
|
||||
if Event.IniObjectCategory == 1 then
|
||||
if Event.IniObjectCategory == Object.Category.UNIT then
|
||||
if not self.Database[Event.IniDCSGroupName] then
|
||||
self.Database[Event.IniDCSGroupName] = GROUP:Register( Event.IniDCSGroupName )
|
||||
self:T3( self.Database[Event.IniDCSGroupName] )
|
||||
@@ -1921,7 +2003,7 @@ do
|
||||
MGroupInclude = MGroupInclude and MGroupActive
|
||||
end
|
||||
|
||||
if self.Filter.Coalitions then
|
||||
if self.Filter.Coalitions and MGroupInclude then
|
||||
local MGroupCoalition = false
|
||||
for CoalitionID, CoalitionName in pairs( self.Filter.Coalitions ) do
|
||||
self:T3( { "Coalition:", MGroup:GetCoalition(), self.FilterMeta.Coalitions[CoalitionName], CoalitionName } )
|
||||
@@ -1932,7 +2014,7 @@ do
|
||||
MGroupInclude = MGroupInclude and MGroupCoalition
|
||||
end
|
||||
|
||||
if self.Filter.Categories then
|
||||
if self.Filter.Categories and MGroupInclude then
|
||||
local MGroupCategory = false
|
||||
for CategoryID, CategoryName in pairs( self.Filter.Categories ) do
|
||||
self:T3( { "Category:", MGroup:GetCategory(), self.FilterMeta.Categories[CategoryName], CategoryName } )
|
||||
@@ -1943,7 +2025,7 @@ do
|
||||
MGroupInclude = MGroupInclude and MGroupCategory
|
||||
end
|
||||
|
||||
if self.Filter.Countries then
|
||||
if self.Filter.Countries and MGroupInclude then
|
||||
local MGroupCountry = false
|
||||
for CountryID, CountryName in pairs( self.Filter.Countries ) do
|
||||
self:T3( { "Country:", MGroup:GetCountry(), CountryName } )
|
||||
@@ -1954,7 +2036,7 @@ do
|
||||
MGroupInclude = MGroupInclude and MGroupCountry
|
||||
end
|
||||
|
||||
if self.Filter.GroupPrefixes then
|
||||
if self.Filter.GroupPrefixes and MGroupInclude then
|
||||
local MGroupPrefix = false
|
||||
for GroupPrefixId, GroupPrefix in pairs( self.Filter.GroupPrefixes ) do
|
||||
self:T3( { "Prefix:", string.find( MGroup:GetName(), GroupPrefix, 1 ), GroupPrefix } )
|
||||
@@ -1965,7 +2047,7 @@ do
|
||||
MGroupInclude = MGroupInclude and MGroupPrefix
|
||||
end
|
||||
|
||||
if self.Filter.Zones then
|
||||
if self.Filter.Zones and MGroupInclude then
|
||||
local MGroupZone = false
|
||||
for ZoneName, Zone in pairs( self.Filter.Zones ) do
|
||||
--self:T( "Zone:", ZoneName )
|
||||
@@ -1976,6 +2058,12 @@ do
|
||||
MGroupInclude = MGroupInclude and MGroupZone
|
||||
end
|
||||
|
||||
if self.Filter.Functions and MGroupInclude then
|
||||
local MGroupFunc = false
|
||||
MGroupFunc = self:_EvalFilterFunctions(MGroup)
|
||||
MGroupInclude = MGroupInclude and MGroupFunc
|
||||
end
|
||||
|
||||
self:T2( MGroupInclude )
|
||||
return MGroupInclude
|
||||
end
|
||||
@@ -2074,6 +2162,7 @@ do -- SET_UNIT
|
||||
-- Have a read through here to understand the application of regular expressions: [LUA regular expressions](https://riptutorial.com/lua/example/20315/lua-pattern-matching)
|
||||
-- * @{#SET_UNIT.FilterActive}: Builds the SET_UNIT with the units that are only active. Units that are inactive (late activation) won't be included in the set!
|
||||
-- * @{#SET_UNIT.FilterZones}: Builds the SET_UNIT with the units within a @{Core.Zone#ZONE}.
|
||||
-- * @{#SET_UNIT.FilterFunction}: Builds the SET_UNIT with a custom condition.
|
||||
--
|
||||
-- Once the filter criteria have been set for the SET_UNIT, you can start filtering using:
|
||||
--
|
||||
@@ -2152,6 +2241,7 @@ do -- SET_UNIT
|
||||
Countries = nil,
|
||||
UnitPrefixes = nil,
|
||||
Zones = nil,
|
||||
Functions = nil,
|
||||
},
|
||||
FilterMeta = {
|
||||
Coalitions = {
|
||||
@@ -2523,6 +2613,25 @@ do -- SET_UNIT
|
||||
return self
|
||||
end
|
||||
|
||||
--- [User] Add a custom condition function.
|
||||
-- @function [parent=#SET_UNIT] FilterFunction
|
||||
-- @param #SET_UNIT self
|
||||
-- @param #function ConditionFunction If this function returns `true`, the object is added to the SET. The function needs to take a UNIT object as first argument.
|
||||
-- @param ... Condition function arguments if any.
|
||||
-- @return #SET_UNIT self
|
||||
-- @usage
|
||||
-- -- Image you want to exclude a specific UNIT from a SET:
|
||||
-- local groundset = SET_UNIT:New():FilterCoalitions("blue"):FilterCategories("ground"):FilterFunction(
|
||||
-- -- The function needs to take a UNIT object as first - and in this case, only - argument.
|
||||
-- function(unit)
|
||||
-- local isinclude = true
|
||||
-- if unit:GetName() == "Exclude Me" then isinclude = false end
|
||||
-- return isinclude
|
||||
-- end
|
||||
-- ):FilterOnce()
|
||||
-- BASE:I(groundset:Flush())
|
||||
|
||||
|
||||
--- Handles the Database to check on an event (birth) that the Object was added in the Database.
|
||||
-- This is required, because sometimes the _DATABASE birth event gets called later than the SET_BASE birth event!
|
||||
-- @param #SET_UNIT self
|
||||
@@ -2532,7 +2641,7 @@ do -- SET_UNIT
|
||||
function SET_UNIT:AddInDatabase( Event )
|
||||
self:F3( { Event } )
|
||||
|
||||
if Event.IniObjectCategory == 1 then
|
||||
if Event.IniObjectCategory == Object.Category.UNIT then
|
||||
if not self.Database[Event.IniDCSUnitName] then
|
||||
self.Database[Event.IniDCSUnitName] = UNIT:Register( Event.IniDCSUnitName )
|
||||
self:T3( self.Database[Event.IniDCSUnitName] )
|
||||
@@ -2848,59 +2957,50 @@ do -- SET_UNIT
|
||||
-- @return Core.Point#COORDINATE The center coordinate of all the units in the set, including heading in degrees and speed in mps in case of moving units.
|
||||
function SET_UNIT:GetCoordinate()
|
||||
|
||||
local Coordinate = nil
|
||||
local unit = self:GetRandom()
|
||||
if self:Count() == 1 and unit then
|
||||
return unit:GetCoordinate()
|
||||
end
|
||||
if unit then
|
||||
local Coordinate = unit:GetCoordinate()
|
||||
--self:F({Coordinate:GetVec3()})
|
||||
|
||||
|
||||
local x1 = Coordinate.x
|
||||
local x2 = Coordinate.x
|
||||
local y1 = Coordinate.y
|
||||
local y2 = Coordinate.y
|
||||
local z1 = Coordinate.z
|
||||
local z2 = Coordinate.z
|
||||
local MaxVelocity = 0
|
||||
local AvgHeading = nil
|
||||
local MovingCount = 0
|
||||
|
||||
for UnitName, UnitData in pairs( self:GetAliveSet() ) do
|
||||
|
||||
local Unit = UnitData -- Wrapper.Unit#UNIT
|
||||
local Coordinate = Unit:GetCoordinate()
|
||||
|
||||
x1 = (Coordinate.x < x1) and Coordinate.x or x1
|
||||
x2 = (Coordinate.x > x2) and Coordinate.x or x2
|
||||
y1 = (Coordinate.y < y1) and Coordinate.y or y1
|
||||
y2 = (Coordinate.y > y2) and Coordinate.y or y2
|
||||
z1 = (Coordinate.y < z1) and Coordinate.z or z1
|
||||
z2 = (Coordinate.y > z2) and Coordinate.z or z2
|
||||
|
||||
local Velocity = Coordinate:GetVelocity()
|
||||
if Velocity ~= 0 then
|
||||
MaxVelocity = (MaxVelocity < Velocity) and Velocity or MaxVelocity
|
||||
local Heading = Coordinate:GetHeading()
|
||||
AvgHeading = AvgHeading and (AvgHeading + Heading) or Heading
|
||||
MovingCount = MovingCount + 1
|
||||
local function GetSetVec3(units)
|
||||
-- Init.
|
||||
local x=0
|
||||
local y=0
|
||||
local z=0
|
||||
local n=0
|
||||
-- Loop over all units.
|
||||
for _,unit in pairs(units) do
|
||||
local vec3=nil --DCS#Vec3
|
||||
if unit and unit:IsAlive() then
|
||||
vec3 = unit:GetVec3()
|
||||
end
|
||||
if vec3 then
|
||||
-- Sum up posits.
|
||||
x=x+vec3.x
|
||||
y=y+vec3.y
|
||||
z=z+vec3.z
|
||||
-- Increase counter.
|
||||
n=n+1
|
||||
end
|
||||
end
|
||||
|
||||
AvgHeading = AvgHeading and (AvgHeading / MovingCount)
|
||||
|
||||
Coordinate.x = (x2 - x1) / 2 + x1
|
||||
Coordinate.y = (y2 - y1) / 2 + y1
|
||||
Coordinate.z = (z2 - z1) / 2 + z1
|
||||
Coordinate:SetHeading( AvgHeading )
|
||||
Coordinate:SetVelocity( MaxVelocity )
|
||||
|
||||
self:F( { Coordinate = Coordinate } )
|
||||
if n>0 then
|
||||
-- Average.
|
||||
local Vec3={x=x/n, y=y/n, z=z/n} --DCS#Vec3
|
||||
return Vec3
|
||||
end
|
||||
return nil
|
||||
end
|
||||
return Coordinate
|
||||
|
||||
local Coordinate = nil
|
||||
local Vec3 = GetSetVec3(self.Set)
|
||||
if Vec3 then
|
||||
Coordinate = COORDINATE:NewFromVec3(Vec3)
|
||||
end
|
||||
|
||||
if Coordinate then
|
||||
local heading = self:GetHeading() or 0
|
||||
local velocity = self:GetVelocity() or 0
|
||||
Coordinate:SetHeading( heading )
|
||||
Coordinate:SetVelocity( velocity )
|
||||
self:I(UTILS.PrintTableToLog(Coordinate))
|
||||
end
|
||||
|
||||
return Coordinate
|
||||
end
|
||||
|
||||
--- Get the maximum velocity of the SET_UNIT.
|
||||
@@ -3109,7 +3209,7 @@ do -- SET_UNIT
|
||||
MUnitInclude = MUnitInclude and MUnitActive
|
||||
end
|
||||
|
||||
if self.Filter.Coalitions then
|
||||
if self.Filter.Coalitions and MUnitInclude then
|
||||
local MUnitCoalition = false
|
||||
for CoalitionID, CoalitionName in pairs( self.Filter.Coalitions ) do
|
||||
self:F( { "Coalition:", MUnit:GetCoalition(), self.FilterMeta.Coalitions[CoalitionName], CoalitionName } )
|
||||
@@ -3120,7 +3220,7 @@ do -- SET_UNIT
|
||||
MUnitInclude = MUnitInclude and MUnitCoalition
|
||||
end
|
||||
|
||||
if self.Filter.Categories then
|
||||
if self.Filter.Categories and MUnitInclude then
|
||||
local MUnitCategory = false
|
||||
for CategoryID, CategoryName in pairs( self.Filter.Categories ) do
|
||||
self:T3( { "Category:", MUnit:GetDesc().category, self.FilterMeta.Categories[CategoryName], CategoryName } )
|
||||
@@ -3131,7 +3231,7 @@ do -- SET_UNIT
|
||||
MUnitInclude = MUnitInclude and MUnitCategory
|
||||
end
|
||||
|
||||
if self.Filter.Types then
|
||||
if self.Filter.Types and MUnitInclude then
|
||||
local MUnitType = false
|
||||
for TypeID, TypeName in pairs( self.Filter.Types ) do
|
||||
self:T3( { "Type:", MUnit:GetTypeName(), TypeName } )
|
||||
@@ -3142,7 +3242,7 @@ do -- SET_UNIT
|
||||
MUnitInclude = MUnitInclude and MUnitType
|
||||
end
|
||||
|
||||
if self.Filter.Countries then
|
||||
if self.Filter.Countries and MUnitInclude then
|
||||
local MUnitCountry = false
|
||||
for CountryID, CountryName in pairs( self.Filter.Countries ) do
|
||||
self:T3( { "Country:", MUnit:GetCountry(), CountryName } )
|
||||
@@ -3153,7 +3253,7 @@ do -- SET_UNIT
|
||||
MUnitInclude = MUnitInclude and MUnitCountry
|
||||
end
|
||||
|
||||
if self.Filter.UnitPrefixes then
|
||||
if self.Filter.UnitPrefixes and MUnitInclude then
|
||||
local MUnitPrefix = false
|
||||
for UnitPrefixId, UnitPrefix in pairs( self.Filter.UnitPrefixes ) do
|
||||
self:T3( { "Prefix:", string.find( MUnit:GetName(), UnitPrefix, 1 ), UnitPrefix } )
|
||||
@@ -3164,7 +3264,7 @@ do -- SET_UNIT
|
||||
MUnitInclude = MUnitInclude and MUnitPrefix
|
||||
end
|
||||
|
||||
if self.Filter.RadarTypes then
|
||||
if self.Filter.RadarTypes and MUnitInclude then
|
||||
local MUnitRadar = false
|
||||
for RadarTypeID, RadarType in pairs( self.Filter.RadarTypes ) do
|
||||
self:T3( { "Radar:", RadarType } )
|
||||
@@ -3178,7 +3278,7 @@ do -- SET_UNIT
|
||||
MUnitInclude = MUnitInclude and MUnitRadar
|
||||
end
|
||||
|
||||
if self.Filter.SEAD then
|
||||
if self.Filter.SEAD and MUnitInclude then
|
||||
local MUnitSEAD = false
|
||||
if MUnit:HasSEAD() == true then
|
||||
self:T3( "SEAD Found" )
|
||||
@@ -3188,7 +3288,7 @@ do -- SET_UNIT
|
||||
end
|
||||
end
|
||||
|
||||
if self.Filter.Zones then
|
||||
if self.Filter.Zones and MUnitInclude then
|
||||
local MGroupZone = false
|
||||
for ZoneName, Zone in pairs( self.Filter.Zones ) do
|
||||
self:T3( "Zone:", ZoneName )
|
||||
@@ -3199,6 +3299,11 @@ do -- SET_UNIT
|
||||
MUnitInclude = MUnitInclude and MGroupZone
|
||||
end
|
||||
|
||||
if self.Filter.Functions and MUnitInclude then
|
||||
local MUnitFunc = self:_EvalFilterFunctions(MUnit)
|
||||
MUnitInclude = MUnitInclude and MUnitFunc
|
||||
end
|
||||
|
||||
self:T2( MUnitInclude )
|
||||
return MUnitInclude
|
||||
end
|
||||
@@ -3280,6 +3385,7 @@ do -- SET_STATIC
|
||||
-- * @{#SET_STATIC.FilterPrefixes}: Builds the SET_STATIC with the units containing the same string(s) in their name. **Attention!** LUA regular expression apply here, so special characters in names like minus, dot, hash (#) etc might lead to unexpected results.
|
||||
-- Have a read through here to understand the application of regular expressions: [LUA regular expressions](https://riptutorial.com/lua/example/20315/lua-pattern-matching)
|
||||
-- * @{#SET_STATIC.FilterZones}: Builds the SET_STATIC with the units within a @{Core.Zone#ZONE}.
|
||||
-- * @{#SET_STATIC.FilterFunction}: Builds the SET_STATIC with a custom condition.
|
||||
--
|
||||
-- Once the filter criteria have been set for the SET_STATIC, you can start filtering using:
|
||||
--
|
||||
@@ -3483,6 +3589,24 @@ do -- SET_STATIC
|
||||
return self
|
||||
end
|
||||
|
||||
--- [User] Add a custom condition function.
|
||||
-- @function [parent=#SET_STATIC] FilterFunction
|
||||
-- @param #SET_STATIC self
|
||||
-- @param #function ConditionFunction If this function returns `true`, the object is added to the SET. The function needs to take a STATIC object as first argument.
|
||||
-- @param ... Condition function arguments if any.
|
||||
-- @return #SET_STATIC self
|
||||
-- @usage
|
||||
-- -- Image you want to exclude a specific CLIENT from a SET:
|
||||
-- local groundset = SET_STATIC:New():FilterCoalitions("blue"):FilterActive(true):FilterFunction(
|
||||
-- -- The function needs to take a STATIC object as first - and in this case, only - argument.
|
||||
-- function(static)
|
||||
-- local isinclude = true
|
||||
-- if static:GetName() == "Exclude Me" then isinclude = false end
|
||||
-- return isinclude
|
||||
-- end
|
||||
-- ):FilterOnce()
|
||||
-- BASE:I(groundset:Flush())
|
||||
|
||||
--- Builds a set of units of defined countries.
|
||||
-- Possible current countries are those known within DCS world.
|
||||
-- @param #SET_STATIC self
|
||||
@@ -4039,6 +4163,7 @@ do -- SET_CLIENT
|
||||
-- Have a read through here to understand the application of regular expressions: [LUA regular expressions](https://riptutorial.com/lua/example/20315/lua-pattern-matching)
|
||||
-- * @{#SET_CLIENT.FilterActive}: Builds the SET_CLIENT with the units that are only active. Units that are inactive (late activation) won't be included in the set!
|
||||
-- * @{#SET_CLIENT.FilterZones}: Builds the SET_CLIENT with the clients within a @{Core.Zone#ZONE}.
|
||||
-- * @{#SET_CLIENT.FilterFunction}: Builds the SET_CLIENT with a custom condition.
|
||||
--
|
||||
-- Once the filter criteria have been set for the SET_CLIENT, you can start filtering using:
|
||||
--
|
||||
@@ -4393,7 +4518,7 @@ do -- SET_CLIENT
|
||||
function SET_CLIENT:_EventPlayerEnterUnit(Event)
|
||||
self:I( "_EventPlayerEnterUnit" )
|
||||
if Event.IniDCSUnit then
|
||||
if Event.IniObjectCategory == 1 and Event.IniGroup and Event.IniGroup:IsGround() then
|
||||
if Event.IniObjectCategory == Object.Category.UNIT and Event.IniGroup and Event.IniGroup:IsGround() then
|
||||
-- CA Slot entered
|
||||
local ObjectName, Object = self:AddInDatabase( Event )
|
||||
self:I( ObjectName, UTILS.PrintTableToLog(Object) )
|
||||
@@ -4412,7 +4537,7 @@ do -- SET_CLIENT
|
||||
function SET_CLIENT:_EventPlayerLeaveUnit(Event)
|
||||
self:I( "_EventPlayerLeaveUnit" )
|
||||
if Event.IniDCSUnit then
|
||||
if Event.IniObjectCategory == 1 and Event.IniGroup and Event.IniGroup:IsGround() then
|
||||
if Event.IniObjectCategory == Object.Category.UNIT and Event.IniGroup and Event.IniGroup:IsGround() then
|
||||
-- CA Slot left
|
||||
local ObjectName, Object = self:FindInDatabase( Event )
|
||||
if ObjectName then
|
||||
@@ -4541,6 +4666,25 @@ do -- SET_CLIENT
|
||||
return AliveSet.Set or {}
|
||||
end
|
||||
|
||||
--- [User] Add a custom condition function.
|
||||
-- @function [parent=#SET_CLIENT] FilterFunction
|
||||
-- @param #SET_CLIENT self
|
||||
-- @param #function ConditionFunction If this function returns `true`, the object is added to the SET. The function needs to take a CLIENT object as first argument.
|
||||
-- @param ... Condition function arguments if any.
|
||||
-- @return #SET_CLIENT self
|
||||
-- @usage
|
||||
-- -- Image you want to exclude a specific CLIENT from a SET:
|
||||
-- local groundset = SET_CLIENT:New():FilterCoalitions("blue"):FilterActive(true):FilterFunction(
|
||||
-- -- The function needs to take a UNIT object as first - and in this case, only - argument.
|
||||
-- function(client)
|
||||
-- local isinclude = true
|
||||
-- if client:GetPlayerName() == "Exclude Me" then isinclude = false end
|
||||
-- return isinclude
|
||||
-- end
|
||||
-- ):FilterOnce()
|
||||
-- BASE:I(groundset:Flush())
|
||||
|
||||
|
||||
---
|
||||
-- @param #SET_CLIENT self
|
||||
-- @param Wrapper.Client#CLIENT MClient
|
||||
@@ -4562,7 +4706,7 @@ do -- SET_CLIENT
|
||||
MClientInclude = MClientInclude and MClientActive
|
||||
end
|
||||
|
||||
if self.Filter.Coalitions then
|
||||
if self.Filter.Coalitions and MClientInclude then
|
||||
local MClientCoalition = false
|
||||
for CoalitionID, CoalitionName in pairs( self.Filter.Coalitions ) do
|
||||
local ClientCoalitionID = _DATABASE:GetCoalitionFromClientTemplate( MClientName )
|
||||
@@ -4575,7 +4719,7 @@ do -- SET_CLIENT
|
||||
MClientInclude = MClientInclude and MClientCoalition
|
||||
end
|
||||
|
||||
if self.Filter.Categories then
|
||||
if self.Filter.Categories and MClientInclude then
|
||||
local MClientCategory = false
|
||||
for CategoryID, CategoryName in pairs( self.Filter.Categories ) do
|
||||
local ClientCategoryID = _DATABASE:GetCategoryFromClientTemplate( MClientName )
|
||||
@@ -4588,7 +4732,7 @@ do -- SET_CLIENT
|
||||
MClientInclude = MClientInclude and MClientCategory
|
||||
end
|
||||
|
||||
if self.Filter.Types then
|
||||
if self.Filter.Types and MClientInclude then
|
||||
local MClientType = false
|
||||
for TypeID, TypeName in pairs( self.Filter.Types ) do
|
||||
self:T3( { "Type:", MClient:GetTypeName(), TypeName } )
|
||||
@@ -4600,7 +4744,7 @@ do -- SET_CLIENT
|
||||
MClientInclude = MClientInclude and MClientType
|
||||
end
|
||||
|
||||
if self.Filter.Countries then
|
||||
if self.Filter.Countries and MClientInclude then
|
||||
local MClientCountry = false
|
||||
for CountryID, CountryName in pairs( self.Filter.Countries ) do
|
||||
local ClientCountryID = _DATABASE:GetCountryFromClientTemplate( MClientName )
|
||||
@@ -4613,7 +4757,7 @@ do -- SET_CLIENT
|
||||
MClientInclude = MClientInclude and MClientCountry
|
||||
end
|
||||
|
||||
if self.Filter.ClientPrefixes then
|
||||
if self.Filter.ClientPrefixes and MClientInclude then
|
||||
local MClientPrefix = false
|
||||
for ClientPrefixId, ClientPrefix in pairs( self.Filter.ClientPrefixes ) do
|
||||
self:T3( { "Prefix:", string.find( MClient.UnitName, ClientPrefix, 1 ), ClientPrefix } )
|
||||
@@ -4625,7 +4769,7 @@ do -- SET_CLIENT
|
||||
MClientInclude = MClientInclude and MClientPrefix
|
||||
end
|
||||
|
||||
if self.Filter.Zones then
|
||||
if self.Filter.Zones and MClientInclude then
|
||||
local MClientZone = false
|
||||
for ZoneName, Zone in pairs( self.Filter.Zones ) do
|
||||
self:T3( "Zone:", ZoneName )
|
||||
@@ -4637,7 +4781,7 @@ do -- SET_CLIENT
|
||||
MClientInclude = MClientInclude and MClientZone
|
||||
end
|
||||
|
||||
if self.Filter.Playernames then
|
||||
if self.Filter.Playernames and MClientInclude then
|
||||
local MClientPlayername = false
|
||||
local playername = MClient:GetPlayerName() or "Unknown"
|
||||
--self:T(playername)
|
||||
@@ -4650,7 +4794,7 @@ do -- SET_CLIENT
|
||||
MClientInclude = MClientInclude and MClientPlayername
|
||||
end
|
||||
|
||||
if self.Filter.Callsigns then
|
||||
if self.Filter.Callsigns and MClientInclude then
|
||||
local MClientCallsigns = false
|
||||
local callsign = MClient:GetCallsign()
|
||||
--self:I(callsign)
|
||||
@@ -4663,6 +4807,11 @@ do -- SET_CLIENT
|
||||
MClientInclude = MClientInclude and MClientCallsigns
|
||||
end
|
||||
|
||||
if self.Filter.Functions and MClientInclude then
|
||||
local MClientFunc = self:_EvalFilterFunctions(MClient)
|
||||
MClientInclude = MClientInclude and MClientFunc
|
||||
end
|
||||
|
||||
end
|
||||
self:T2( MClientInclude )
|
||||
return MClientInclude
|
||||
@@ -5256,7 +5405,7 @@ do -- SET_AIRBASE
|
||||
function SET_AIRBASE:GetRandomAirbase()
|
||||
|
||||
local RandomAirbase = self:GetRandom()
|
||||
self:F( { RandomAirbase = RandomAirbase:GetName() } )
|
||||
--self:F( { RandomAirbase = RandomAirbase:GetName() } )
|
||||
|
||||
return RandomAirbase
|
||||
end
|
||||
@@ -5422,7 +5571,7 @@ do -- SET_AIRBASE
|
||||
MAirbaseInclude = MAirbaseInclude and MAirbaseCoalition
|
||||
end
|
||||
|
||||
if self.Filter.Categories then
|
||||
if self.Filter.Categories and MAirbaseInclude then
|
||||
local MAirbaseCategory = false
|
||||
for CategoryID, CategoryName in pairs( self.Filter.Categories ) do
|
||||
local AirbaseCategoryID = _DATABASE:GetCategoryFromAirbase( MAirbaseName )
|
||||
@@ -7688,6 +7837,28 @@ do -- SET_OPSGROUP
|
||||
return self
|
||||
end
|
||||
|
||||
--- Handles the OnBirth event for the Set.
|
||||
-- @param #SET_OPSGROUP self
|
||||
-- @param Core.Event#EVENTDATA Event Event data.
|
||||
function SET_OPSGROUP:_EventOnBirth( Event )
|
||||
self:F3( { Event } )
|
||||
|
||||
if Event.IniDCSUnit and Event.IniDCSGroup then
|
||||
local DCSgroup=Event.IniDCSGroup --DCS#Group
|
||||
|
||||
if DCSgroup:getInitialSize() == DCSgroup:getSize() then -- This seems to be not a good check as even for the first birth event, getSize returns the total number of units in the group.
|
||||
|
||||
local groupname, group = self:AddInDatabase( Event )
|
||||
|
||||
if group and group:CountAliveUnits()==DCSgroup:getInitialSize() then
|
||||
if group and self:IsIncludeObject( group ) then
|
||||
self:Add( groupname, group )
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--- Handles the OnDead or OnCrash event for alive groups set.
|
||||
-- Note: The GROUP object in the SET_OPSGROUP collection will only be removed if the last unit is destroyed of the GROUP.
|
||||
-- @param #SET_OPSGROUP self
|
||||
@@ -7708,12 +7879,12 @@ do -- SET_OPSGROUP
|
||||
--- Handles the Database to check on an event (birth) that the Object was added in the Database.
|
||||
-- This is required, because sometimes the _DATABASE birth event gets called later than the SET_BASE birth event!
|
||||
-- @param #SET_OPSGROUP self
|
||||
-- @param Core.Event#EVENTDATA Event
|
||||
-- @return #string The name of the GROUP
|
||||
-- @return #table The GROUP
|
||||
-- @param Core.Event#EVENTDATA Event Event data.
|
||||
-- @return #string The name of the GROUP.
|
||||
-- @return Wrapper.Group#GROUP The GROUP object.
|
||||
function SET_OPSGROUP:AddInDatabase( Event )
|
||||
|
||||
if Event.IniObjectCategory==1 then
|
||||
if Event.IniObjectCategory==Object.Category.UNIT then
|
||||
|
||||
if not self.Database[Event.IniDCSGroupName] then
|
||||
self.Database[Event.IniDCSGroupName] = GROUP:Register( Event.IniDCSGroupName )
|
||||
@@ -7728,8 +7899,8 @@ do -- SET_OPSGROUP
|
||||
-- This is required, because sometimes the _DATABASE event gets called later than the SET_BASE event or vise versa!
|
||||
-- @param #SET_OPSGROUP self
|
||||
-- @param Core.Event#EVENTDATA Event Event data table.
|
||||
-- @return #string The name of the GROUP
|
||||
-- @return #table The GROUP
|
||||
-- @return #string The name of the GROUP.
|
||||
-- @return Wrapper.Group#GROUP The GROUP object.
|
||||
function SET_OPSGROUP:FindInDatabase(Event)
|
||||
return Event.IniDCSGroupName, self.Database[Event.IniDCSGroupName]
|
||||
end
|
||||
@@ -7768,7 +7939,7 @@ do -- SET_OPSGROUP
|
||||
end
|
||||
|
||||
-- Filter coalitions.
|
||||
if self.Filter.Coalitions then
|
||||
if self.Filter.Coalitions and MGroupInclude then
|
||||
|
||||
local MGroupCoalition = false
|
||||
|
||||
@@ -7782,7 +7953,7 @@ do -- SET_OPSGROUP
|
||||
end
|
||||
|
||||
-- Filter categories.
|
||||
if self.Filter.Categories then
|
||||
if self.Filter.Categories and MGroupInclude then
|
||||
|
||||
local MGroupCategory = false
|
||||
|
||||
@@ -7796,7 +7967,7 @@ do -- SET_OPSGROUP
|
||||
end
|
||||
|
||||
-- Filter countries.
|
||||
if self.Filter.Countries then
|
||||
if self.Filter.Countries and MGroupInclude then
|
||||
local MGroupCountry = false
|
||||
for CountryID, CountryName in pairs( self.Filter.Countries ) do
|
||||
if country.id[CountryName] == MGroup:GetCountry() then
|
||||
@@ -7807,12 +7978,12 @@ do -- SET_OPSGROUP
|
||||
end
|
||||
|
||||
-- Filter "prefixes".
|
||||
if self.Filter.GroupPrefixes then
|
||||
if self.Filter.GroupPrefixes and MGroupInclude then
|
||||
|
||||
local MGroupPrefix = false
|
||||
|
||||
for GroupPrefixId, GroupPrefix in pairs( self.Filter.GroupPrefixes ) do
|
||||
if string.find( MGroup:GetName(), GroupPrefix:gsub ("-", "%%-"), 1 ) then --Not sure why "-" is replaced by "%-" ?!
|
||||
if string.find( MGroup:GetName(), GroupPrefix:gsub ("-", "%%-"), 1 ) then --Not sure why "-" is replaced by "%-" ?! - So we can still match group names with a dash in them
|
||||
MGroupPrefix = true
|
||||
end
|
||||
end
|
||||
@@ -8048,7 +8219,7 @@ do -- SET_SCENERY
|
||||
end
|
||||
|
||||
--- Get a table of alive objects.
|
||||
-- @param #SET_GROUP self
|
||||
-- @param #SET_SCENERY self
|
||||
-- @return #table Table of alive objects
|
||||
-- @return Core.Set#SET_SCENERY SET of alive objects
|
||||
function SET_SCENERY:GetAliveSet()
|
||||
@@ -8084,7 +8255,13 @@ do -- SET_SCENERY
|
||||
-- @return Core.Point#COORDINATE The center coordinate of all the objects in the set.
|
||||
function SET_SCENERY:GetCoordinate()
|
||||
|
||||
local Coordinate = self:GetRandom():GetCoordinate()
|
||||
local Coordinate = COORDINATE:New({0,0,0})
|
||||
|
||||
local Item = self:GetRandomSurely()
|
||||
|
||||
if Item then
|
||||
Coordinate:GetCoordinate()
|
||||
end
|
||||
|
||||
local x1 = Coordinate.x
|
||||
local x2 = Coordinate.x
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/SPA%20-%20Spawning)
|
||||
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Core/Spawn)
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
@@ -1108,6 +1108,22 @@ function SPAWN:InitRandomizeCallsign()
|
||||
return self
|
||||
end
|
||||
|
||||
--- [BLUE AIR only!] This method sets a specific callsign for a spawned group. Use for a group with one unit only!
|
||||
-- @param #SPAWN self
|
||||
-- @param #number ID ID of the callsign enumerator, e.g. CALLSIGN.Tanker.Texaco - - resulting in e.g. Texaco-2-1
|
||||
-- @param #string Name Name of this callsign as it cannot be determined from the ID because of the dependency on the task type of the plane, and the plane type. E.g. "Texaco"
|
||||
-- @param #number Minor Minor number, i.e. the unit number within the group, e.g 2 - resulting in e.g. Texaco-2-1
|
||||
-- @param #number Major Major number, i.e. the group number of this name, e.g. 1 - resulting in e.g. Texaco-2-1
|
||||
-- @return #SPAWN self
|
||||
function SPAWN:InitCallSign(ID,Name,Minor,Major)
|
||||
self.SpawnInitCallSign = true
|
||||
self.SpawnInitCallSignID = ID or 1
|
||||
self.SpawnInitCallSignMinor = Minor or 1
|
||||
self.SpawnInitCallSignMajor = Major or 1
|
||||
self.SpawnInitCallSignName = string.lower(Name) or "enfield"
|
||||
return self
|
||||
end
|
||||
|
||||
--- This method sets a spawn position for the group that is different from the location of the template.
|
||||
-- @param #SPAWN self
|
||||
-- @param Core.Point#COORDINATE Coordinate The position to spawn from
|
||||
@@ -1442,6 +1458,7 @@ function SPAWN:SpawnWithIndex( SpawnIndex, NoBirth )
|
||||
else
|
||||
|
||||
local SpawnTemplate = self.SpawnGroups[self.SpawnIndex].SpawnTemplate
|
||||
local SpawnZone = self.SpawnGroups[self.SpawnIndex].SpawnZone
|
||||
self:T( SpawnTemplate.name )
|
||||
|
||||
if SpawnTemplate then
|
||||
@@ -1467,6 +1484,23 @@ function SPAWN:SpawnWithIndex( SpawnIndex, NoBirth )
|
||||
if self.SpawnRandomizeUnits then
|
||||
for UnitID = 1, #SpawnTemplate.units do
|
||||
local RandomVec2 = PointVec3:GetRandomVec2InRadius( self.SpawnOuterRadius, self.SpawnInnerRadius )
|
||||
if (SpawnZone) then
|
||||
local inZone = SpawnZone:IsVec2InZone(RandomVec2)
|
||||
local numTries = 1
|
||||
while (not inZone) and (numTries < 20) do
|
||||
if not inZone then
|
||||
RandomVec2 = PointVec3:GetRandomVec2InRadius( self.SpawnOuterRadius, self.SpawnInnerRadius )
|
||||
numTries = numTries + 1
|
||||
inZone = SpawnZone:IsVec2InZone(RandomVec2)
|
||||
self:I("Retrying " .. numTries .. "spawn " .. SpawnTemplate.name .. " in Zone " .. SpawnZone:GetName() .. "!")
|
||||
self:I(SpawnZone)
|
||||
end
|
||||
end
|
||||
if (not inZone) then
|
||||
self:I("Could not place unit within zone and within radius!")
|
||||
RandomVec2 = SpawnZone:GetRandomVec2()
|
||||
end
|
||||
end
|
||||
SpawnTemplate.units[UnitID].x = RandomVec2.x
|
||||
SpawnTemplate.units[UnitID].y = RandomVec2.y
|
||||
self:T( 'SpawnTemplate.units[' .. UnitID .. '].x = ' .. SpawnTemplate.units[UnitID].x .. ', SpawnTemplate.units[' .. UnitID .. '].y = ' .. SpawnTemplate.units[UnitID].y )
|
||||
@@ -1518,12 +1552,14 @@ function SPAWN:SpawnWithIndex( SpawnIndex, NoBirth )
|
||||
|
||||
for UnitID = 1, #SpawnTemplate.units do
|
||||
|
||||
if UnitID > 1 then -- don't rotate position of unit #1
|
||||
local unitXOff = SpawnTemplate.units[UnitID].x - pivotX -- rotate position offset around unit #1
|
||||
local unitYOff = SpawnTemplate.units[UnitID].y - pivotY
|
||||
if not self.SpawnRandomizeUnits then
|
||||
if UnitID > 1 then -- don't rotate position of unit #1
|
||||
local unitXOff = SpawnTemplate.units[UnitID].x - pivotX -- rotate position offset around unit #1
|
||||
local unitYOff = SpawnTemplate.units[UnitID].y - pivotY
|
||||
|
||||
SpawnTemplate.units[UnitID].x = pivotX + (unitXOff * cosHeading) - (unitYOff * sinHeading)
|
||||
SpawnTemplate.units[UnitID].y = pivotY + (unitYOff * cosHeading) + (unitXOff * sinHeading)
|
||||
SpawnTemplate.units[UnitID].x = pivotX + (unitXOff * cosHeading) - (unitYOff * sinHeading)
|
||||
SpawnTemplate.units[UnitID].y = pivotY + (unitYOff * cosHeading) + (unitXOff * sinHeading)
|
||||
end
|
||||
end
|
||||
|
||||
-- adjust heading of all units, including unit #1
|
||||
@@ -3321,28 +3357,41 @@ function SPAWN:_Prepare( SpawnTemplatePrefix, SpawnIndex ) -- R2.2
|
||||
SpawnTemplate.units[UnitID].callsign[2] = UnitID
|
||||
SpawnTemplate.units[UnitID].callsign[3] = "1"
|
||||
SpawnTemplate.units[UnitID].callsign["name"] = tostring(callsignname)..tostring(UnitID).."1"
|
||||
-- UTILS.PrintTableToLog(SpawnTemplate.units[UnitID].callsign,1)
|
||||
-- UTILS.PrintTableToLog(SpawnTemplate.units[UnitID].callsign,1)
|
||||
end
|
||||
else
|
||||
-- Ruskis
|
||||
-- Russkis
|
||||
for UnitID = 1, #SpawnTemplate.units do
|
||||
SpawnTemplate.units[UnitID].callsign = math.random(1,999)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if self.SpawnInitCallSign then
|
||||
for UnitID = 1, #SpawnTemplate.units do
|
||||
local Callsign = SpawnTemplate.units[UnitID].callsign
|
||||
if Callsign and type( Callsign ) ~= "number" then
|
||||
SpawnTemplate.units[UnitID].callsign[1] = self.SpawnInitCallSignID
|
||||
SpawnTemplate.units[UnitID].callsign[2] = self.SpawnInitCallSignMinor
|
||||
SpawnTemplate.units[UnitID].callsign[3] = self.SpawnInitCallSignMajor
|
||||
SpawnTemplate.units[UnitID].callsign["name"] = string.format("%s%d%d",self.SpawnInitCallSignName,self.SpawnInitCallSignMinor,self.SpawnInitCallSignMajor)
|
||||
--UTILS.PrintTableToLog(SpawnTemplate.units[UnitID].callsign,1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for UnitID = 1, #SpawnTemplate.units do
|
||||
local Callsign = SpawnTemplate.units[UnitID].callsign
|
||||
if Callsign then
|
||||
if type( Callsign ) ~= "number" then -- blue callsign
|
||||
--UTILS.PrintTableToLog(Callsign,1)
|
||||
if type( Callsign ) ~= "number" and not self.SpawnInitCallSign then -- blue callsign
|
||||
-- UTILS.PrintTableToLog(Callsign,1)
|
||||
Callsign[2] = ((SpawnIndex - 1) % 10) + 1
|
||||
local CallsignName = SpawnTemplate.units[UnitID].callsign["name"] -- #string
|
||||
CallsignName = string.match(CallsignName,"^(%a+)") -- 2.8 - only the part w/o numbers
|
||||
local CallsignLen = CallsignName:len()
|
||||
SpawnTemplate.units[UnitID].callsign[2] = UnitID
|
||||
SpawnTemplate.units[UnitID].callsign["name"] = CallsignName:sub( 1, CallsignLen ) .. SpawnTemplate.units[UnitID].callsign[2] .. SpawnTemplate.units[UnitID].callsign[3]
|
||||
else
|
||||
elseif type( Callsign ) == "number" then
|
||||
SpawnTemplate.units[UnitID].callsign = Callsign + SpawnIndex
|
||||
end
|
||||
end
|
||||
@@ -3377,11 +3426,11 @@ function SPAWN:_Prepare( SpawnTemplatePrefix, SpawnIndex ) -- R2.2
|
||||
end
|
||||
end
|
||||
-- VoiceCallsignNumber
|
||||
if SpawnTemplate.units[UnitID].AddPropAircraft.VoiceCallsignNumber then
|
||||
if SpawnTemplate.units[UnitID].AddPropAircraft.VoiceCallsignNumber and type( Callsign ) ~= "number" then
|
||||
SpawnTemplate.units[UnitID].AddPropAircraft.VoiceCallsignNumber = SpawnTemplate.units[UnitID].callsign[2] .. SpawnTemplate.units[UnitID].callsign[3]
|
||||
end
|
||||
-- VoiceCallsignLabel
|
||||
if SpawnTemplate.units[UnitID].AddPropAircraft.VoiceCallsignLabel then
|
||||
if SpawnTemplate.units[UnitID].AddPropAircraft.VoiceCallsignLabel and type( Callsign ) ~= "number" then
|
||||
local CallsignName = SpawnTemplate.units[UnitID].callsign["name"] -- #string
|
||||
CallsignName = string.match(CallsignName,"^(%a+)") -- 2.8 - only the part w/o numbers
|
||||
local label = "NY" -- Navy One exception
|
||||
@@ -3390,7 +3439,7 @@ function SPAWN:_Prepare( SpawnTemplatePrefix, SpawnIndex ) -- R2.2
|
||||
end
|
||||
SpawnTemplate.units[UnitID].AddPropAircraft.VoiceCallsignLabel = label
|
||||
end
|
||||
-- UTILS.PrintTableToLog(SpawnTemplate.units[UnitID].AddPropAircraft,1)
|
||||
-- UTILS.PrintTableToLog(SpawnTemplate.units[UnitID].AddPropAircraft,1)
|
||||
-- FlightLead
|
||||
if SpawnTemplate.units[UnitID].datalinks and SpawnTemplate.units[UnitID].datalinks.Link16 and SpawnTemplate.units[UnitID].datalinks.Link16.settings then
|
||||
SpawnTemplate.units[UnitID].datalinks.Link16.settings.flightLead = UnitID == 1 and true or false
|
||||
@@ -3399,11 +3448,28 @@ function SPAWN:_Prepare( SpawnTemplatePrefix, SpawnIndex ) -- R2.2
|
||||
if SpawnTemplate.units[UnitID].datalinks and SpawnTemplate.units[UnitID].datalinks.SADL and SpawnTemplate.units[UnitID].datalinks.SADL.settings then
|
||||
SpawnTemplate.units[UnitID].datalinks.SADL.settings.flightLead = UnitID == 1 and true or false
|
||||
end
|
||||
--UTILS.PrintTableToLog(SpawnTemplate.units[UnitID].datalinks,1)
|
||||
-- UTILS.PrintTableToLog(SpawnTemplate.units[UnitID].datalinks,1)
|
||||
end
|
||||
end
|
||||
-- Link16 team members
|
||||
for UnitID = 1, #SpawnTemplate.units do
|
||||
if SpawnTemplate.units[UnitID].datalinks and SpawnTemplate.units[UnitID].datalinks.Link16 and SpawnTemplate.units[UnitID].datalinks.Link16.network then
|
||||
local team = {}
|
||||
local isF16 = string.find(SpawnTemplate.units[UnitID].type,"F-16",1,true) and true or false
|
||||
for ID = 1, #SpawnTemplate.units do
|
||||
local member = {}
|
||||
member.missionUnitId = ID
|
||||
if isF16 then
|
||||
member.TDOA = true
|
||||
end
|
||||
table.insert(team,member)
|
||||
end
|
||||
SpawnTemplate.units[UnitID].datalinks.Link16.network.teamMembers = team
|
||||
end
|
||||
end
|
||||
|
||||
self:T3( { "Template:", SpawnTemplate } )
|
||||
--UTILS.PrintTableToLog(SpawnTemplate,1)
|
||||
return SpawnTemplate
|
||||
|
||||
end
|
||||
@@ -3545,6 +3611,7 @@ function SPAWN:_RandomizeZones( SpawnIndex )
|
||||
self:T( { SpawnVec2 = SpawnVec2 } )
|
||||
|
||||
local SpawnTemplate = self.SpawnGroups[SpawnIndex].SpawnTemplate
|
||||
self.SpawnGroups[SpawnIndex].SpawnZone = SpawnZone
|
||||
|
||||
self:T( { Route = SpawnTemplate.route } )
|
||||
|
||||
|
||||
@@ -15,14 +15,14 @@
|
||||
--
|
||||
-- # Demo Missions
|
||||
--
|
||||
-- ## [SPAWNSTATIC Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/SPS%20-%20Spawning%20Statics)
|
||||
-- ## [SPAWNSTATIC Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Core/SpawnStatic)
|
||||
--
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- # YouTube Channel
|
||||
--
|
||||
-- ## [SPAWNSTATIC YouTube Channel]() [No videos yet!]
|
||||
-- ## No videos yet!
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
-- * Create moving zones around a unit.
|
||||
-- * Create moving zones around a group.
|
||||
-- * Provide the zone behavior. Some zones are static, while others are moveable.
|
||||
-- * Enquiry if a coordinate is within a zone.
|
||||
-- * Enquire if a coordinate is within a zone.
|
||||
-- * Smoke zones.
|
||||
-- * Set a zone probability to control zone selection.
|
||||
-- * Get zone coordinates.
|
||||
@@ -42,7 +42,7 @@
|
||||
-- * @{#ZONE_UNIT}: The ZONE_UNIT class defines by a zone around a @{Wrapper.Unit#UNIT} with a radius.
|
||||
-- * @{#ZONE_GROUP}: The ZONE_GROUP class defines by a zone around a @{Wrapper.Group#GROUP} with a radius.
|
||||
-- * @{#ZONE_POLYGON}: The ZONE_POLYGON class defines by a sequence of @{Wrapper.Group#GROUP} waypoints within the Mission Editor, forming a polygon.
|
||||
-- * @{#ZONE_OVAL}: The ZONE_OVAL class isdefined by a center point, major axis, minor axis, and angle.
|
||||
-- * @{#ZONE_OVAL}: The ZONE_OVAL class is defined by a center point, major axis, minor axis, and angle.
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
@@ -480,12 +480,14 @@ function ZONE_BASE:UndrawZone(Delay)
|
||||
if Delay and Delay>0 then
|
||||
self:ScheduleOnce(Delay, ZONE_BASE.UndrawZone, self)
|
||||
else
|
||||
if self.DrawID and type(self.DrawID) ~= "table" then
|
||||
UTILS.RemoveMark(self.DrawID)
|
||||
else -- DrawID is a table with a collections of mark ids, as used in ZONE_POLYGON
|
||||
if self.DrawID then
|
||||
if type(self.DrawID) ~= "table" then
|
||||
UTILS.RemoveMark(self.DrawID)
|
||||
else -- DrawID is a table with a collections of mark ids, as used in ZONE_POLYGON
|
||||
for _, mark_id in pairs(self.DrawID) do
|
||||
UTILS.RemoveMark(mark_id)
|
||||
UTILS.RemoveMark(mark_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return self
|
||||
@@ -1999,249 +2001,33 @@ function ZONE_GROUP:GetRandomPointVec2( inner, outer )
|
||||
end
|
||||
|
||||
|
||||
--- ZONE_OVAL created from a center point, major axis, minor axis, and angle.
|
||||
-- Ported from https://github.com/nielsvaes/CCMOOSE/blob/master/Moose%20Development/Moose/Shapes/Oval.lua
|
||||
-- @type ZONE_OVAL
|
||||
-- @extends Core.Zone#ZONE_BASE
|
||||
|
||||
--- ## ZONE_OVAL class, extends @{#ZONE_BASE}
|
||||
--
|
||||
-- The ZONE_OVAL class is defined by a center point, major axis, minor axis, and angle.
|
||||
-- This class implements the inherited functions from @{#ZONE_BASE} taking into account the own zone format and properties.
|
||||
--
|
||||
-- @field #ZONE_OVAL
|
||||
ZONE_OVAL = {
|
||||
ClassName = "OVAL",
|
||||
ZoneName="",
|
||||
MajorAxis = nil,
|
||||
MinorAxis = nil,
|
||||
Angle = 0,
|
||||
DrawPoly = nil -- let's just use a ZONE_POLYGON to draw the ZONE_OVAL on the map
|
||||
}
|
||||
|
||||
--- Creates a new ZONE_OVAL from a center point, major axis, minor axis, and angle.
|
||||
--- ported from https://github.com/nielsvaes/CCMOOSE/blob/master/Moose%20Development/Moose/Shapes/Oval.lua
|
||||
-- @param #table vec2 The center point of the oval
|
||||
-- @param #number major_axis The major axis of the oval
|
||||
-- @param #number minor_axis The minor axis of the oval
|
||||
-- @param #number angle The angle of the oval
|
||||
-- @return #ZONE_OVAL The new oval
|
||||
function ZONE_OVAL:New(name, vec2, major_axis, minor_axis, angle)
|
||||
self = BASE:Inherit(self, ZONE_BASE:New())
|
||||
self.ZoneName = name
|
||||
self.CenterVec2 = vec2
|
||||
self.MajorAxis = major_axis
|
||||
self.MinorAxis = minor_axis
|
||||
self.Angle = angle or 0
|
||||
|
||||
_DATABASE:AddZone(name, self)
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Constructor to create a ZONE_OVAL instance, taking the name of a drawing made with the draw tool in the Mission Editor.
|
||||
--- ported from https://github.com/nielsvaes/CCMOOSE/blob/master/Moose%20Development/Moose/Shapes/Oval.lua
|
||||
-- @param #ZONE_OVAL self
|
||||
-- @param #string DrawingName The name of the drawing in the Mission Editor
|
||||
-- @return #ZONE_OVAL self
|
||||
function ZONE_OVAL:NewFromDrawing(DrawingName)
|
||||
self = BASE:Inherit(self, ZONE_BASE:New(DrawingName))
|
||||
for _, layer in pairs(env.mission.drawings.layers) do
|
||||
for _, object in pairs(layer["objects"]) do
|
||||
if string.find(object["name"], DrawingName, 1, true) then
|
||||
if object["polygonMode"] == "oval" then
|
||||
self.CenterVec2 = { x = object["mapX"], y = object["mapY"] }
|
||||
self.MajorAxis = object["r1"]
|
||||
self.MinorAxis = object["r2"]
|
||||
self.Angle = object["angle"]
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
_DATABASE:AddZone(DrawingName, self)
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Gets the major axis of the oval.
|
||||
-- @param #ZONE_OVAL self
|
||||
-- @return #number The major axis of the oval
|
||||
function ZONE_OVAL:GetMajorAxis()
|
||||
return self.MajorAxis
|
||||
end
|
||||
|
||||
--- Gets the minor axis of the oval.
|
||||
-- @param #ZONE_OVAL self
|
||||
-- @return #number The minor axis of the oval
|
||||
function ZONE_OVAL:GetMinorAxis()
|
||||
return self.MinorAxis
|
||||
end
|
||||
|
||||
--- Gets the angle of the oval.
|
||||
-- @param #ZONE_OVAL self
|
||||
-- @return #number The angle of the oval
|
||||
function ZONE_OVAL:GetAngle()
|
||||
return self.Angle
|
||||
end
|
||||
|
||||
--- Returns a the center point of the oval
|
||||
-- @param #ZONE_OVAL self
|
||||
-- @return #table The center Vec2
|
||||
function ZONE_OVAL:GetVec2()
|
||||
return self.CenterVec2
|
||||
end
|
||||
|
||||
--- Checks if a point is contained within the oval.
|
||||
-- @param #ZONE_OVAL self
|
||||
-- @param #table point The point to check
|
||||
-- @return #bool True if the point is contained, false otherwise
|
||||
function ZONE_OVAL:IsVec2InZone(vec2)
|
||||
local cos, sin = math.cos, math.sin
|
||||
local dx = vec2.x - self.CenterVec2.x
|
||||
local dy = vec2.y - self.CenterVec2.y
|
||||
local rx = dx * cos(self.Angle) + dy * sin(self.Angle)
|
||||
local ry = -dx * sin(self.Angle) + dy * cos(self.Angle)
|
||||
return rx * rx / (self.MajorAxis * self.MajorAxis) + ry * ry / (self.MinorAxis * self.MinorAxis) <= 1
|
||||
end
|
||||
|
||||
--- Calculates the bounding box of the oval. The bounding box is the smallest rectangle that contains the oval.
|
||||
-- @param #ZONE_OVAL self
|
||||
-- @return #table The bounding box of the oval
|
||||
function ZONE_OVAL:GetBoundingSquare()
|
||||
local min_x = self.CenterVec2.x - self.MajorAxis
|
||||
local min_y = self.CenterVec2.y - self.MinorAxis
|
||||
local max_x = self.CenterVec2.x + self.MajorAxis
|
||||
local max_y = self.CenterVec2.y + self.MinorAxis
|
||||
|
||||
return {
|
||||
{x=min_x, y=min_x}, {x=max_x, y=min_y}, {x=max_x, y=max_y}, {x=min_x, y=max_y}
|
||||
}
|
||||
end
|
||||
|
||||
--- Find points on the edge of the oval
|
||||
-- @param #ZONE_OVAL self
|
||||
-- @param #number num_points How many points should be found. More = smoother shape
|
||||
-- @return #table Points on he edge
|
||||
function ZONE_OVAL:PointsOnEdge(num_points)
|
||||
num_points = num_points or 40
|
||||
local points = {}
|
||||
local dtheta = 2 * math.pi / num_points
|
||||
|
||||
for i = 0, num_points - 1 do
|
||||
local theta = i * dtheta
|
||||
local x = self.CenterVec2.x + self.MajorAxis * math.cos(theta) * math.cos(self.Angle) - self.MinorAxis * math.sin(theta) * math.sin(self.Angle)
|
||||
local y = self.CenterVec2.y + self.MajorAxis * math.cos(theta) * math.sin(self.Angle) + self.MinorAxis * math.sin(theta) * math.cos(self.Angle)
|
||||
table.insert(points, {x = x, y = y})
|
||||
end
|
||||
|
||||
return points
|
||||
end
|
||||
|
||||
--- Returns a random Vec2 within the oval.
|
||||
-- @param #ZONE_OVAL self
|
||||
-- @return #table The random Vec2
|
||||
function ZONE_OVAL:GetRandomVec2()
|
||||
local theta = math.rad(self.Angle)
|
||||
|
||||
local random_point = math.sqrt(math.random()) --> uniformly
|
||||
--local random_point = math.random() --> more clumped around center
|
||||
local phi = math.random() * 2 * math.pi
|
||||
local x_c = random_point * math.cos(phi)
|
||||
local y_c = random_point * math.sin(phi)
|
||||
local x_e = x_c * self.MajorAxis
|
||||
local y_e = y_c * self.MinorAxis
|
||||
local rx = (x_e * math.cos(theta) - y_e * math.sin(theta)) + self.CenterVec2.x
|
||||
local ry = (x_e * math.sin(theta) + y_e * math.cos(theta)) + self.CenterVec2.y
|
||||
|
||||
return {x=rx, y=ry}
|
||||
end
|
||||
|
||||
--- Define a random @{Core.Point#POINT_VEC2} within the zone.
|
||||
-- @param #ZONE_OVAL self
|
||||
-- @return Core.Point#POINT_VEC2 The PointVec2 coordinates.
|
||||
function ZONE_OVAL:GetRandomPointVec2()
|
||||
return POINT_VEC2:NewFromVec2(self:GetRandomVec2())
|
||||
end
|
||||
|
||||
--- Define a random @{Core.Point#POINT_VEC2} within the zone.
|
||||
-- @param #ZONE_OVAL self
|
||||
-- @return Core.Point#POINT_VEC2 The PointVec2 coordinates.
|
||||
function ZONE_OVAL:GetRandomPointVec3()
|
||||
return POINT_VEC2:NewFromVec3(self:GetRandomVec2())
|
||||
end
|
||||
|
||||
--- Draw the zone on the F10 map.
|
||||
--- ported from https://github.com/nielsvaes/CCMOOSE/blob/master/Moose%20Development/Moose/Shapes/Oval.lua
|
||||
-- @param #ZONE_OVAL self
|
||||
-- @param #number Coalition Coalition: All=-1, Neutral=0, Red=1, Blue=2. Default -1=All.
|
||||
-- @param #table Color RGB color table {r, g, b}, e.g. {1,0,0} for red.
|
||||
-- @param #number Alpha Transparency [0,1]. Default 1.
|
||||
-- @param #table FillColor RGB color table {r, g, b}, e.g. {1,0,0} for red. Default is same as `Color` value. -- doesn't seem to work
|
||||
-- @param #number FillAlpha Transparency [0,1]. Default 0.15. -- doesn't seem to work
|
||||
-- @param #number LineType Line type: 0=No line, 1=Solid, 2=Dashed, 3=Dotted, 4=Dot dash, 5=Long dash, 6=Two dash. Default 1=Solid.
|
||||
-- @param #boolean ReadOnly (Optional) Mark is readonly and cannot be removed by users. Default false.
|
||||
-- @return #ZONE_OVAL self
|
||||
function ZONE_OVAL:DrawZone(Coalition, Color, Alpha, FillColor, FillAlpha, LineType)
|
||||
Coalition = Coalition or self:GetDrawCoalition()
|
||||
|
||||
-- Set draw coalition.
|
||||
self:SetDrawCoalition(Coalition)
|
||||
|
||||
Color = Color or self:GetColorRGB()
|
||||
Alpha = Alpha or 1
|
||||
|
||||
-- Set color.
|
||||
self:SetColor(Color, Alpha)
|
||||
|
||||
FillColor = FillColor or self:GetFillColorRGB()
|
||||
if not FillColor then
|
||||
UTILS.DeepCopy(Color)
|
||||
end
|
||||
FillAlpha = FillAlpha or self:GetFillColorAlpha()
|
||||
if not FillAlpha then
|
||||
FillAlpha = 0.15
|
||||
end
|
||||
|
||||
LineType = LineType or 1
|
||||
|
||||
-- Set fill color -----------> has fill color worked in recent versions of DCS?
|
||||
-- doing something like
|
||||
--
|
||||
-- trigger.action.markupToAll(7, -1, 501, p.Coords[1]:GetVec3(), p.Coords[2]:GetVec3(),p.Coords[3]:GetVec3(),p.Coords[4]:GetVec3(),{1,0,0, 1}, {1,0,0, 1}, 4, false, Text or "")
|
||||
--
|
||||
-- doesn't seem to fill in the shape for an n-sided polygon
|
||||
self:SetFillColor(FillColor, FillAlpha)
|
||||
|
||||
self.DrawPoly = ZONE_POLYGON:NewFromPointsArray(self.ZoneName, self:PointsOnEdge(80))
|
||||
self.DrawPoly:DrawZone(Coalition, Color, Alpha, FillColor, FillAlpha, LineType)
|
||||
end
|
||||
|
||||
--- Remove drawing from F10 map
|
||||
-- @param #ZONE_OVAL self
|
||||
function ZONE_OVAL:UndrawZone()
|
||||
if self.DrawPoly then
|
||||
self.DrawPoly:UndrawZone()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--- Ported from https://github.com/nielsvaes/CCMOOSE/blob/master/Moose%20Development/Moose/Shapes/Triangle.lua
|
||||
--- This triangle "zone" is not really to be used on its own, it only serves as building blocks for
|
||||
--- ZONE_POLYGON to accurately find a point inside a polygon; as well as getting the correct surface area of
|
||||
--- a polygon.
|
||||
-- @type _ZONE_TRIANGLE
|
||||
-- @extends #BASE
|
||||
-- @extends Core.Zone#ZONE_BASE
|
||||
|
||||
--- ## _ZONE_TRIANGLE class, extends @{#ZONE_BASE}
|
||||
--
|
||||
-- _ZONE_TRIANGLE class is a helper class for ZONE_POLYGON
|
||||
-- This class implements the inherited functions from @{#ZONE_BASE} taking into account the own zone format and properties.
|
||||
--
|
||||
-- @field #_ZONE_TRIANGLE
|
||||
_ZONE_TRIANGLE = {
|
||||
ClassName="ZONE_TRIANGLE",
|
||||
Points={},
|
||||
Coords={},
|
||||
CenterVec2={x=0, y=0},
|
||||
SurfaceArea=0,
|
||||
DrawIDs={}
|
||||
DrawID={}
|
||||
}
|
||||
|
||||
---
|
||||
-- @param #_ZONE_TRIANGLE self
|
||||
-- @param DCS#Vec p1
|
||||
-- @param DCS#Vec p2
|
||||
-- @param DCS#Vec p3
|
||||
-- @return #_ZONE_TRIANGLE self
|
||||
function _ZONE_TRIANGLE:New(p1, p2, p3)
|
||||
local self = BASE:Inherit(self, ZONE_BASE:New())
|
||||
self.Points = {p1, p2, p3}
|
||||
@@ -2260,6 +2046,7 @@ function _ZONE_TRIANGLE:New(p1, p2, p3)
|
||||
end
|
||||
|
||||
--- Checks if a point is contained within the triangle.
|
||||
-- @param #_ZONE_TRIANGLE self
|
||||
-- @param #table pt The point to check
|
||||
-- @param #table points (optional) The points of the triangle, or 3 other points if you're just using the TRIANGLE class without an object of it
|
||||
-- @return #bool True if the point is contained, false otherwise
|
||||
@@ -2281,6 +2068,7 @@ function _ZONE_TRIANGLE:ContainsPoint(pt, points)
|
||||
end
|
||||
|
||||
--- Returns a random Vec2 within the triangle.
|
||||
-- @param #_ZONE_TRIANGLE self
|
||||
-- @param #table points The points of the triangle, or 3 other points if you're just using the TRIANGLE class without an object of it
|
||||
-- @return #table The random Vec2
|
||||
function _ZONE_TRIANGLE:GetRandomVec2(points)
|
||||
@@ -2296,6 +2084,8 @@ function _ZONE_TRIANGLE:GetRandomVec2(points)
|
||||
end
|
||||
|
||||
--- Draw the triangle
|
||||
-- @param #_ZONE_TRIANGLE self
|
||||
-- @return #table of draw IDs
|
||||
function _ZONE_TRIANGLE:Draw(Coalition, Color, Alpha, FillColor, FillAlpha, LineType, ReadOnly)
|
||||
Coalition=Coalition or -1
|
||||
|
||||
@@ -2310,15 +2100,35 @@ function _ZONE_TRIANGLE:Draw(Coalition, Color, Alpha, FillColor, FillAlpha, Line
|
||||
for i=1, #self.Coords do
|
||||
local c1 = self.Coords[i]
|
||||
local c2 = self.Coords[i % #self.Coords + 1]
|
||||
table.add(self.DrawIDs, c1:LineToAll(c2, Coalition, Color, Alpha, LineType, ReadOnly))
|
||||
local id = c1:LineToAll(c2, Coalition, Color, Alpha, LineType, ReadOnly)
|
||||
self.DrawID[#self.DrawID+1] = id
|
||||
end
|
||||
return self.DrawIDs
|
||||
local newID = self.Coords[1]:MarkupToAllFreeForm({self.Coords[2],self.Coords[3]},Coalition,Color,Alpha,FillColor,FillAlpha,LineType,ReadOnly)
|
||||
self.DrawID[#self.DrawID+1] = newID
|
||||
return self.DrawID
|
||||
end
|
||||
|
||||
--- Draw the triangle
|
||||
-- @param #_ZONE_TRIANGLE self
|
||||
-- @return #table of draw IDs
|
||||
function _ZONE_TRIANGLE:Fill(Coalition, FillColor, FillAlpha, ReadOnly)
|
||||
Coalition=Coalition or -1
|
||||
FillColor = FillColor
|
||||
FillAlpha = FillAlpha
|
||||
local newID = self.Coords[1]:MarkupToAllFreeForm({self.Coords[2],self.Coords[3]},Coalition,nil,nil,FillColor,FillAlpha,0,nil)
|
||||
self.DrawID[#self.DrawID+1] = newID
|
||||
return self.DrawID
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
-- @type ZONE_POLYGON_BASE
|
||||
-- @field #ZONE_POLYGON_BASE.ListVec2 Polygon The polygon defined by an array of @{DCS#Vec2}.
|
||||
-- @field #number SurfaceArea
|
||||
-- @field #table DrawID
|
||||
-- @field #table FillTriangles
|
||||
-- @field #table _Triangles
|
||||
-- @field #table Borderlines
|
||||
-- @extends #ZONE_BASE
|
||||
|
||||
|
||||
@@ -2343,9 +2153,11 @@ end
|
||||
-- @field #ZONE_POLYGON_BASE
|
||||
ZONE_POLYGON_BASE = {
|
||||
ClassName="ZONE_POLYGON_BASE",
|
||||
_Triangles={}, -- _ZONE_TRIANGLES
|
||||
_Triangles={}, -- #table of #_ZONE_TRIANGLE
|
||||
SurfaceArea=0,
|
||||
DrawID={} -- making a table out of the MarkID so its easier to draw an n-sided polygon, see ZONE_POLYGON_BASE:Draw()
|
||||
DrawID={}, -- making a table out of the MarkID so its easier to draw an n-sided polygon, see ZONE_POLYGON_BASE:Draw()
|
||||
FillTriangles = {},
|
||||
Borderlines = {},
|
||||
}
|
||||
|
||||
--- A 2D points array.
|
||||
@@ -2378,19 +2190,20 @@ function ZONE_POLYGON_BASE:New( ZoneName, PointsArray )
|
||||
self._.Polygon[i].y = PointsArray[i].y
|
||||
end
|
||||
|
||||
end
|
||||
-- triangulate the polygon so we can work with it
|
||||
self._Triangles = self:_Triangulate()
|
||||
-- set the polygon's surface area
|
||||
self.SurfaceArea = self:_CalculateSurfaceArea()
|
||||
|
||||
-- triangulate the polygon so we can work with it
|
||||
self._Triangles = self:_Triangulate()
|
||||
-- set the polygon's surface area
|
||||
self.SurfaceArea = self:_CalculateSurfaceArea()
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Triangulates the polygon.
|
||||
--- ported from https://github.com/nielsvaes/CCMOOSE/blob/master/Moose%20Development/Moose/Shapes/Polygon.lua
|
||||
-- @return #table The #_TRIANGLE list that make up
|
||||
-- @param #ZONE_POLYGON_BASE self
|
||||
-- @return #table The #_ZONE_TRIANGLE list that makes up the polygon
|
||||
function ZONE_POLYGON_BASE:_Triangulate()
|
||||
local points = self._.Polygon
|
||||
local triangles = {}
|
||||
@@ -2519,6 +2332,7 @@ end
|
||||
|
||||
--- Calculates the surface area of the polygon. The surface area is the sum of the areas of the triangles that make up the polygon.
|
||||
--- ported from https://github.com/nielsvaes/CCMOOSE/blob/master/Moose%20Development/Moose/Shapes/Polygon.lua
|
||||
-- @param #ZONE_POLYGON_BASE self
|
||||
-- @return #number The surface area of the polygon
|
||||
function ZONE_POLYGON_BASE:_CalculateSurfaceArea()
|
||||
local area = 0
|
||||
@@ -2678,57 +2492,113 @@ end
|
||||
-- @param #table FillColor RGB color table {r, g, b}, e.g. {1,0,0} for red. Default is same as `Color` value. -- doesn't seem to work
|
||||
-- @param #number FillAlpha Transparency [0,1]. Default 0.15. -- doesn't seem to work
|
||||
-- @param #number LineType Line type: 0=No line, 1=Solid, 2=Dashed, 3=Dotted, 4=Dot dash, 5=Long dash, 6=Two dash. Default 1=Solid.
|
||||
-- @param #boolean ReadOnly (Optional) Mark is readonly and cannot be removed by users. Default false.
|
||||
-- @param #boolean ReadOnly (Optional) Mark is readonly and cannot be removed by users. Default false.s
|
||||
-- @return #ZONE_POLYGON_BASE self
|
||||
function ZONE_POLYGON_BASE:DrawZone(Coalition, Color, Alpha, FillColor, FillAlpha, LineType, ReadOnly, IncludeTriangles)
|
||||
if self._.Polygon and #self._.Polygon >= 3 then
|
||||
Coalition = Coalition or self:GetDrawCoalition()
|
||||
|
||||
-- Set draw coalition.
|
||||
self:SetDrawCoalition(Coalition)
|
||||
|
||||
Color = Color or self:GetColorRGB()
|
||||
Alpha = Alpha or 1
|
||||
if self._.Polygon and #self._.Polygon >= 3 then
|
||||
Coalition = Coalition or self:GetDrawCoalition()
|
||||
|
||||
-- Set color.
|
||||
self:SetColor(Color, Alpha)
|
||||
-- Set draw coalition.
|
||||
self:SetDrawCoalition(Coalition)
|
||||
|
||||
FillColor = FillColor or self:GetFillColorRGB()
|
||||
if not FillColor then
|
||||
UTILS.DeepCopy(Color)
|
||||
end
|
||||
FillAlpha = FillAlpha or self:GetFillColorAlpha()
|
||||
if not FillAlpha then
|
||||
FillAlpha = 0.15
|
||||
end
|
||||
Color = Color or self:GetColorRGB()
|
||||
Alpha = Alpha or self:GetColorAlpha()
|
||||
|
||||
-- Set fill color -----------> has fill color worked in recent versions of DCS?
|
||||
-- doing something like
|
||||
--
|
||||
-- trigger.action.markupToAll(7, -1, 501, p.Coords[1]:GetVec3(), p.Coords[2]:GetVec3(),p.Coords[3]:GetVec3(),p.Coords[4]:GetVec3(),{1,0,0, 1}, {1,0,0, 1}, 4, false, Text or "")
|
||||
--
|
||||
-- doesn't seem to fill in the shape for an n-sided polygon
|
||||
self:SetFillColor(FillColor, FillAlpha)
|
||||
FillColor = FillColor or self:GetFillColorRGB()
|
||||
FillAlpha = FillAlpha or self:GetFillColorAlpha()
|
||||
|
||||
IncludeTriangles = IncludeTriangles or false
|
||||
|
||||
-- just draw the triangles, we get the outline for free
|
||||
if IncludeTriangles then
|
||||
for _, triangle in pairs(self._Triangles) do
|
||||
local draw_ids = triangle:Draw()
|
||||
table.combine(self.DrawID, draw_ids)
|
||||
end
|
||||
-- draw outline only
|
||||
else
|
||||
local coords = self:GetVerticiesCoordinates()
|
||||
for i = 1, #coords do
|
||||
local c1 = coords[i]
|
||||
local c2 = coords[i % #coords + 1]
|
||||
table.add(self.DrawID, c1:LineToAll(c2, Coalition, Color, Alpha, LineType, ReadOnly))
|
||||
end
|
||||
end
|
||||
if FillColor then
|
||||
self:ReFill(FillColor,FillAlpha)
|
||||
end
|
||||
return self
|
||||
|
||||
if Color then
|
||||
self:ReDrawBorderline(Color,Alpha,LineType)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if false then
|
||||
local coords = self:GetVerticiesCoordinates()
|
||||
|
||||
local coord=coords[1] --Core.Point#COORDINATE
|
||||
|
||||
table.remove(coords, 1)
|
||||
|
||||
coord:MarkupToAllFreeForm(coords, Coalition, Color, Alpha, FillColor, FillAlpha, LineType, ReadOnly, "Drew Polygon")
|
||||
|
||||
if true then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Change/Re-fill a Polygon Zone
|
||||
-- @param #ZONE_POLYGON_BASE self
|
||||
-- @param #table Color RGB color table {r, g, b}, e.g. {1,0,0} for red.
|
||||
-- @param #number Alpha Transparency [0,1]. Default 1.
|
||||
-- @return #ZONE_POLYGON_BASE self
|
||||
function ZONE_POLYGON_BASE:ReFill(Color,Alpha)
|
||||
local color = Color or self:GetFillColorRGB() or {1,0,0}
|
||||
local alpha = Alpha or self:GetFillColorAlpha() or 1
|
||||
local coalition = self:GetDrawCoalition() or -1
|
||||
-- undraw if already filled
|
||||
if #self.FillTriangles > 0 then
|
||||
for _, triangle in pairs(self._Triangles) do
|
||||
triangle:UndrawZone()
|
||||
end
|
||||
-- remove mark IDs
|
||||
for _,_value in pairs(self.FillTriangles) do
|
||||
table.remove_by_value(self.DrawID, _value)
|
||||
end
|
||||
self.FillTriangles = nil
|
||||
self.FillTriangles = {}
|
||||
end
|
||||
-- refill
|
||||
for _, triangle in pairs(self._Triangles) do
|
||||
local draw_ids = triangle:Fill(coalition,color,alpha,nil)
|
||||
self.FillTriangles = draw_ids
|
||||
table.combine(self.DrawID, draw_ids)
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
--- Change/Re-draw the border of a Polygon Zone
|
||||
-- @param #ZONE_POLYGON_BASE self
|
||||
-- @param #table Color RGB color table {r, g, b}, e.g. {1,0,0} for red.
|
||||
-- @param #number Alpha Transparency [0,1]. Default 1.
|
||||
-- @param #number LineType Line type: 0=No line, 1=Solid, 2=Dashed, 3=Dotted, 4=Dot dash, 5=Long dash, 6=Two dash. Default 1=Solid.
|
||||
-- @return #ZONE_POLYGON_BASE
|
||||
function ZONE_POLYGON_BASE:ReDrawBorderline(Color, Alpha, LineType)
|
||||
local color = Color or self:GetFillColorRGB() or {1,0,0}
|
||||
local alpha = Alpha or self:GetFillColorAlpha() or 1
|
||||
local coalition = self:GetDrawCoalition() or -1
|
||||
local linetype = LineType or 1
|
||||
-- undraw if already drawn
|
||||
if #self.Borderlines > 0 then
|
||||
for _, MarkID in pairs(self.Borderlines) do
|
||||
trigger.action.removeMark(MarkID)
|
||||
end
|
||||
-- remove mark IDs
|
||||
for _,_value in pairs(self.Borderlines) do
|
||||
table.remove_by_value(self.DrawID, _value)
|
||||
end
|
||||
self.Borderlines = nil
|
||||
self.Borderlines = {}
|
||||
end
|
||||
-- Redraw border
|
||||
local coords = self:GetVerticiesCoordinates()
|
||||
for i = 1, #coords do
|
||||
local c1 = coords[i]
|
||||
local c2 = coords[i % #coords + 1]
|
||||
local newID = c1:LineToAll(c2, coalition, color, alpha, linetype, nil)
|
||||
self.DrawID[#self.DrawID+1]=newID
|
||||
self.Borderlines[#self.Borderlines+1] = newID
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
--- Get the surface area of this polygon
|
||||
@@ -3064,6 +2934,7 @@ function ZONE_POLYGON_BASE:Boundary(Coalition, Color, Radius, Alpha, Segments, C
|
||||
Alpha = Alpha or 1
|
||||
Segments = Segments or 10
|
||||
Closed = Closed or false
|
||||
local Limit
|
||||
local i = 1
|
||||
local j = #self._.Polygon
|
||||
if (Closed) then
|
||||
@@ -3088,9 +2959,13 @@ function ZONE_POLYGON_BASE:Boundary(Coalition, Color, Radius, Alpha, Segments, C
|
||||
return self
|
||||
end
|
||||
|
||||
do -- Zone_Polygon
|
||||
|
||||
|
||||
---
|
||||
-- @type ZONE_POLYGON
|
||||
-- @extends #ZONE_POLYGON_BASE
|
||||
-- @extends #ZONE_BASE
|
||||
|
||||
|
||||
--- The ZONE_POLYGON class defined by a sequence of @{Wrapper.Group#GROUP} waypoints within the Mission Editor, forming a polygon, OR by drawings made with the Draw tool
|
||||
@@ -3122,8 +2997,7 @@ end
|
||||
--
|
||||
-- This class has been updated to use a accurate way of generating random points inside the polygon without having to use trial and error guesses.
|
||||
-- You can also get the surface area of the polygon now, handy if you want measure which coalition has the largest captured area, for example.
|
||||
|
||||
|
||||
--
|
||||
-- @field #ZONE_POLYGON
|
||||
ZONE_POLYGON = {
|
||||
ClassName="ZONE_POLYGON",
|
||||
@@ -3588,9 +3462,11 @@ function ZONE_POLYGON:IsNoneInZone()
|
||||
return self:CountScannedCoalitions() == 0
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
do -- ZONE_ELASTIC
|
||||
|
||||
---
|
||||
-- @type ZONE_ELASTIC
|
||||
-- @field #table points Points in 2D.
|
||||
-- @field #table setGroups Set of GROUPs.
|
||||
@@ -3789,8 +3665,242 @@ do -- ZONE_ELASTIC
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
--- ZONE_OVAL created from a center point, major axis, minor axis, and angle.
|
||||
-- Ported from https://github.com/nielsvaes/CCMOOSE/blob/master/Moose%20Development/Moose/Shapes/Oval.lua
|
||||
-- @type ZONE_OVAL
|
||||
-- @extends Core.Zone#ZONE_BASE
|
||||
|
||||
--- ## ZONE_OVAL class, extends @{#ZONE_BASE}
|
||||
--
|
||||
-- The ZONE_OVAL class is defined by a center point, major axis, minor axis, and angle.
|
||||
-- This class implements the inherited functions from @{#ZONE_BASE} taking into account the own zone format and properties.
|
||||
--
|
||||
-- @field #ZONE_OVAL
|
||||
ZONE_OVAL = {
|
||||
ClassName = "OVAL",
|
||||
ZoneName="",
|
||||
MajorAxis = nil,
|
||||
MinorAxis = nil,
|
||||
Angle = 0,
|
||||
DrawPoly = nil -- let's just use a ZONE_POLYGON to draw the ZONE_OVAL on the map
|
||||
}
|
||||
|
||||
--- Creates a new ZONE_OVAL from a center point, major axis, minor axis, and angle.
|
||||
--- ported from https://github.com/nielsvaes/CCMOOSE/blob/master/Moose%20Development/Moose/Shapes/Oval.lua
|
||||
-- @param #ZONE_OVAL self
|
||||
-- @param #string name Name of the zone.
|
||||
-- @param #table vec2 The center point of the oval
|
||||
-- @param #number major_axis The major axis of the oval
|
||||
-- @param #number minor_axis The minor axis of the oval
|
||||
-- @param #number angle The angle of the oval
|
||||
-- @return #ZONE_OVAL The new oval
|
||||
function ZONE_OVAL:New(name, vec2, major_axis, minor_axis, angle)
|
||||
|
||||
self = BASE:Inherit(self, ZONE_BASE:New())
|
||||
|
||||
self.ZoneName = name
|
||||
self.CenterVec2 = vec2
|
||||
self.MajorAxis = major_axis
|
||||
self.MinorAxis = minor_axis
|
||||
self.Angle = angle or 0
|
||||
|
||||
_DATABASE:AddZone(name, self)
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Constructor to create a ZONE_OVAL instance, taking the name of a drawing made with the draw tool in the Mission Editor.
|
||||
--- ported from https://github.com/nielsvaes/CCMOOSE/blob/master/Moose%20Development/Moose/Shapes/Oval.lua
|
||||
-- @param #ZONE_OVAL self
|
||||
-- @param #string DrawingName The name of the drawing in the Mission Editor
|
||||
-- @return #ZONE_OVAL self
|
||||
function ZONE_OVAL:NewFromDrawing(DrawingName)
|
||||
self = BASE:Inherit(self, ZONE_BASE:New(DrawingName))
|
||||
for _, layer in pairs(env.mission.drawings.layers) do
|
||||
for _, object in pairs(layer["objects"]) do
|
||||
if string.find(object["name"], DrawingName, 1, true) then
|
||||
if object["polygonMode"] == "oval" then
|
||||
self.CenterVec2 = { x = object["mapX"], y = object["mapY"] }
|
||||
self.MajorAxis = object["r1"]
|
||||
self.MinorAxis = object["r2"]
|
||||
self.Angle = object["angle"]
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
_DATABASE:AddZone(DrawingName, self)
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Gets the major axis of the oval.
|
||||
-- @param #ZONE_OVAL self
|
||||
-- @return #number The major axis of the oval
|
||||
function ZONE_OVAL:GetMajorAxis()
|
||||
return self.MajorAxis
|
||||
end
|
||||
|
||||
--- Gets the minor axis of the oval.
|
||||
-- @param #ZONE_OVAL self
|
||||
-- @return #number The minor axis of the oval
|
||||
function ZONE_OVAL:GetMinorAxis()
|
||||
return self.MinorAxis
|
||||
end
|
||||
|
||||
--- Gets the angle of the oval.
|
||||
-- @param #ZONE_OVAL self
|
||||
-- @return #number The angle of the oval
|
||||
function ZONE_OVAL:GetAngle()
|
||||
return self.Angle
|
||||
end
|
||||
|
||||
--- Returns a the center point of the oval
|
||||
-- @param #ZONE_OVAL self
|
||||
-- @return #table The center Vec2
|
||||
function ZONE_OVAL:GetVec2()
|
||||
return self.CenterVec2
|
||||
end
|
||||
|
||||
--- Checks if a point is contained within the oval.
|
||||
-- @param #ZONE_OVAL self
|
||||
-- @param #table point The point to check
|
||||
-- @return #bool True if the point is contained, false otherwise
|
||||
function ZONE_OVAL:IsVec2InZone(vec2)
|
||||
local cos, sin = math.cos, math.sin
|
||||
local dx = vec2.x - self.CenterVec2.x
|
||||
local dy = vec2.y - self.CenterVec2.y
|
||||
local rx = dx * cos(self.Angle) + dy * sin(self.Angle)
|
||||
local ry = -dx * sin(self.Angle) + dy * cos(self.Angle)
|
||||
return rx * rx / (self.MajorAxis * self.MajorAxis) + ry * ry / (self.MinorAxis * self.MinorAxis) <= 1
|
||||
end
|
||||
|
||||
--- Calculates the bounding box of the oval. The bounding box is the smallest rectangle that contains the oval.
|
||||
-- @param #ZONE_OVAL self
|
||||
-- @return #table The bounding box of the oval
|
||||
function ZONE_OVAL:GetBoundingSquare()
|
||||
local min_x = self.CenterVec2.x - self.MajorAxis
|
||||
local min_y = self.CenterVec2.y - self.MinorAxis
|
||||
local max_x = self.CenterVec2.x + self.MajorAxis
|
||||
local max_y = self.CenterVec2.y + self.MinorAxis
|
||||
|
||||
return {
|
||||
{x=min_x, y=min_x}, {x=max_x, y=min_y}, {x=max_x, y=max_y}, {x=min_x, y=max_y}
|
||||
}
|
||||
end
|
||||
|
||||
--- Find points on the edge of the oval
|
||||
-- @param #ZONE_OVAL self
|
||||
-- @param #number num_points How many points should be found. More = smoother shape
|
||||
-- @return #table Points on he edge
|
||||
function ZONE_OVAL:PointsOnEdge(num_points)
|
||||
num_points = num_points or 40
|
||||
local points = {}
|
||||
local dtheta = 2 * math.pi / num_points
|
||||
|
||||
for i = 0, num_points - 1 do
|
||||
local theta = i * dtheta
|
||||
local x = self.CenterVec2.x + self.MajorAxis * math.cos(theta) * math.cos(self.Angle) - self.MinorAxis * math.sin(theta) * math.sin(self.Angle)
|
||||
local y = self.CenterVec2.y + self.MajorAxis * math.cos(theta) * math.sin(self.Angle) + self.MinorAxis * math.sin(theta) * math.cos(self.Angle)
|
||||
table.insert(points, {x = x, y = y})
|
||||
end
|
||||
|
||||
return points
|
||||
end
|
||||
|
||||
--- Returns a random Vec2 within the oval.
|
||||
-- @param #ZONE_OVAL self
|
||||
-- @return #table The random Vec2
|
||||
function ZONE_OVAL:GetRandomVec2()
|
||||
local theta = math.rad(self.Angle)
|
||||
|
||||
local random_point = math.sqrt(math.random()) --> uniformly
|
||||
--local random_point = math.random() --> more clumped around center
|
||||
local phi = math.random() * 2 * math.pi
|
||||
local x_c = random_point * math.cos(phi)
|
||||
local y_c = random_point * math.sin(phi)
|
||||
local x_e = x_c * self.MajorAxis
|
||||
local y_e = y_c * self.MinorAxis
|
||||
local rx = (x_e * math.cos(theta) - y_e * math.sin(theta)) + self.CenterVec2.x
|
||||
local ry = (x_e * math.sin(theta) + y_e * math.cos(theta)) + self.CenterVec2.y
|
||||
|
||||
return {x=rx, y=ry}
|
||||
end
|
||||
|
||||
--- Define a random @{Core.Point#POINT_VEC2} within the zone.
|
||||
-- @param #ZONE_OVAL self
|
||||
-- @return Core.Point#POINT_VEC2 The PointVec2 coordinates.
|
||||
function ZONE_OVAL:GetRandomPointVec2()
|
||||
return POINT_VEC2:NewFromVec2(self:GetRandomVec2())
|
||||
end
|
||||
|
||||
--- Define a random @{Core.Point#POINT_VEC2} within the zone.
|
||||
-- @param #ZONE_OVAL self
|
||||
-- @return Core.Point#POINT_VEC2 The PointVec2 coordinates.
|
||||
function ZONE_OVAL:GetRandomPointVec3()
|
||||
return POINT_VEC2:NewFromVec3(self:GetRandomVec2())
|
||||
end
|
||||
|
||||
--- Draw the zone on the F10 map.
|
||||
--- ported from https://github.com/nielsvaes/CCMOOSE/blob/master/Moose%20Development/Moose/Shapes/Oval.lua
|
||||
-- @param #ZONE_OVAL self
|
||||
-- @param #number Coalition Coalition: All=-1, Neutral=0, Red=1, Blue=2. Default -1=All.
|
||||
-- @param #table Color RGB color table {r, g, b}, e.g. {1,0,0} for red.
|
||||
-- @param #number Alpha Transparency [0,1]. Default 1.
|
||||
-- @param #table FillColor RGB color table {r, g, b}, e.g. {1,0,0} for red. Default is same as `Color` value. -- doesn't seem to work
|
||||
-- @param #number FillAlpha Transparency [0,1]. Default 0.15. -- doesn't seem to work
|
||||
-- @param #number LineType Line type: 0=No line, 1=Solid, 2=Dashed, 3=Dotted, 4=Dot dash, 5=Long dash, 6=Two dash. Default 1=Solid.
|
||||
-- @param #boolean ReadOnly (Optional) Mark is readonly and cannot be removed by users. Default false.
|
||||
-- @return #ZONE_OVAL self
|
||||
function ZONE_OVAL:DrawZone(Coalition, Color, Alpha, FillColor, FillAlpha, LineType)
|
||||
Coalition = Coalition or self:GetDrawCoalition()
|
||||
|
||||
-- Set draw coalition.
|
||||
self:SetDrawCoalition(Coalition)
|
||||
|
||||
Color = Color or self:GetColorRGB()
|
||||
Alpha = Alpha or 1
|
||||
|
||||
-- Set color.
|
||||
self:SetColor(Color, Alpha)
|
||||
|
||||
FillColor = FillColor or self:GetFillColorRGB()
|
||||
if not FillColor then
|
||||
UTILS.DeepCopy(Color)
|
||||
end
|
||||
FillAlpha = FillAlpha or self:GetFillColorAlpha()
|
||||
if not FillAlpha then
|
||||
FillAlpha = 0.15
|
||||
end
|
||||
|
||||
LineType = LineType or 1
|
||||
|
||||
-- Set fill color -----------> has fill color worked in recent versions of DCS?
|
||||
-- doing something like
|
||||
--
|
||||
-- trigger.action.markupToAll(7, -1, 501, p.Coords[1]:GetVec3(), p.Coords[2]:GetVec3(),p.Coords[3]:GetVec3(),p.Coords[4]:GetVec3(),{1,0,0, 1}, {1,0,0, 1}, 4, false, Text or "")
|
||||
--
|
||||
-- doesn't seem to fill in the shape for an n-sided polygon
|
||||
self:SetFillColor(FillColor, FillAlpha)
|
||||
|
||||
self.DrawPoly = ZONE_POLYGON:NewFromPointsArray(self.ZoneName, self:PointsOnEdge(80))
|
||||
self.DrawPoly:DrawZone(Coalition, Color, Alpha, FillColor, FillAlpha, LineType)
|
||||
end
|
||||
|
||||
--- Remove drawing from F10 map
|
||||
-- @param #ZONE_OVAL self
|
||||
function ZONE_OVAL:UndrawZone()
|
||||
if self.DrawPoly then
|
||||
self.DrawPoly:UndrawZone()
|
||||
end
|
||||
end
|
||||
|
||||
do -- ZONE_AIRBASE
|
||||
|
||||
---
|
||||
-- @type ZONE_AIRBASE
|
||||
-- @field #boolean isShip If `true`, airbase is a ship.
|
||||
-- @field #boolean isHelipad If `true`, airbase is a helipad.
|
||||
|
||||
@@ -10,9 +10,7 @@
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- ## Missions:
|
||||
--
|
||||
-- [ABP - Airbase Police](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/ABP%20-%20Airbase%20Police)
|
||||
-- ## Missions: None
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
@@ -699,7 +697,8 @@ end
|
||||
function ATC_GROUND_UNIVERSAL:_AirbaseMonitor()
|
||||
self:I("_AirbaseMonitor")
|
||||
self.SetClient:ForEachClient(
|
||||
--- @param Wrapper.Client#CLIENT Client
|
||||
--- Nameless function
|
||||
-- @param Wrapper.Client#CLIENT Client
|
||||
function( Client )
|
||||
|
||||
if Client:IsAlive() then
|
||||
|
||||
@@ -3546,9 +3546,7 @@ end
|
||||
-- @param #string To To state.
|
||||
function ARTY:onafterRespawn(Controllable, From, Event, To)
|
||||
self:_EventFromTo("onafterRespawn", Event, From, To)
|
||||
|
||||
env.info("FF Respawning arty group")
|
||||
|
||||
self:I("Respawning arty group")
|
||||
local group=self.Controllable --Wrapper.Group#GROUP
|
||||
|
||||
-- Respawn group.
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
--
|
||||
-- ## Missions:
|
||||
--
|
||||
-- [CLA - CleanUp Airbase](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/CLA%20-%20CleanUp%20Airbase)
|
||||
-- [CLA - CleanUp Airbase](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Functional/CleanUp)
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
|
||||
@@ -15,9 +15,11 @@
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- ## Missions:
|
||||
-- ## Additional Material:
|
||||
--
|
||||
-- [DES - Designation](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/DES%20-%20Designation)
|
||||
-- * **Demo Missions:** [GitHub](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Functional/Designate)
|
||||
-- * **YouTube videos:** None
|
||||
-- * **Guides:** None
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
--
|
||||
-- ## Missions:
|
||||
--
|
||||
-- [DET - Detection](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/DET%20-%20Detection)
|
||||
-- [DET - Detection](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/Functional/Detection)
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
@@ -39,7 +39,8 @@
|
||||
|
||||
do -- DETECTION_BASE
|
||||
|
||||
--- @type DETECTION_BASE
|
||||
---
|
||||
-- @type DETECTION_BASE
|
||||
-- @field Core.Set#SET_GROUP DetectionSetGroup The @{Core.Set} of GROUPs in the Forward Air Controller role.
|
||||
-- @field DCS#Distance DetectionRange The range till which targets are accepted to be detected.
|
||||
-- @field #DETECTION_BASE.DetectedObjects DetectedObjects The list of detected objects.
|
||||
@@ -91,6 +92,11 @@ do -- DETECTION_BASE
|
||||
--
|
||||
-- DetectionObject:FilterCategories( { Unit.Category.AIRPLANE, Unit.Category.HELICOPTER } )
|
||||
--
|
||||
--
|
||||
-- ## Radar Blur - use to make the radar less exact, e.g. for WWII scenarios
|
||||
--
|
||||
-- * @{#DETECTION_BASE.SetRadarBlur}(): Set the radar blur to be used.
|
||||
--
|
||||
-- ## **DETECTION_ derived classes** group the detected units into a **DetectedItems[]** list
|
||||
--
|
||||
-- DETECTION_BASE derived classes build a list called DetectedItems[], which is essentially a first later
|
||||
@@ -269,10 +275,12 @@ do -- DETECTION_BASE
|
||||
DetectedItemsByIndex = {},
|
||||
}
|
||||
|
||||
--- @type DETECTION_BASE.DetectedObjects
|
||||
---
|
||||
-- @type DETECTION_BASE.DetectedObjects
|
||||
-- @list <#DETECTION_BASE.DetectedObject>
|
||||
|
||||
--- @type DETECTION_BASE.DetectedObject
|
||||
---
|
||||
-- @type DETECTION_BASE.DetectedObject
|
||||
-- @field #string Name
|
||||
-- @field #boolean IsVisible
|
||||
-- @field #boolean KnowType
|
||||
@@ -284,7 +292,8 @@ do -- DETECTION_BASE
|
||||
-- @field #boolean LastPos
|
||||
-- @field #number LastVelocity
|
||||
|
||||
--- @type DETECTION_BASE.DetectedItems
|
||||
---
|
||||
-- @type DETECTION_BASE.DetectedItems
|
||||
-- @list <#DETECTION_BASE.DetectedItem>
|
||||
|
||||
--- Detected item data structure.
|
||||
@@ -522,7 +531,7 @@ do -- DETECTION_BASE
|
||||
|
||||
do -- State Transition Handling
|
||||
|
||||
--- @param #DETECTION_BASE self
|
||||
-- @param #DETECTION_BASE self
|
||||
-- @param #string From The From State string.
|
||||
-- @param #string Event The Event string.
|
||||
-- @param #string To The To State string.
|
||||
@@ -530,7 +539,7 @@ do -- DETECTION_BASE
|
||||
self:__Detect( 1 )
|
||||
end
|
||||
|
||||
--- @param #DETECTION_BASE self
|
||||
-- @param #DETECTION_BASE self
|
||||
-- @param #string From The From State string.
|
||||
-- @param #string Event The Event string.
|
||||
-- @param #string To The To State string.
|
||||
@@ -570,7 +579,7 @@ do -- DETECTION_BASE
|
||||
|
||||
end
|
||||
|
||||
--- @param #DETECTION_BASE self
|
||||
-- @param #DETECTION_BASE self
|
||||
-- @param #number The amount of alive recce.
|
||||
function DETECTION_BASE:CountAliveRecce()
|
||||
|
||||
@@ -578,7 +587,7 @@ do -- DETECTION_BASE
|
||||
|
||||
end
|
||||
|
||||
--- @param #DETECTION_BASE self
|
||||
-- @param #DETECTION_BASE self
|
||||
function DETECTION_BASE:ForEachAliveRecce( IteratorFunction, ... )
|
||||
self:F2( arg )
|
||||
|
||||
@@ -587,7 +596,7 @@ do -- DETECTION_BASE
|
||||
return self
|
||||
end
|
||||
|
||||
--- @param #DETECTION_BASE self
|
||||
-- @param #DETECTION_BASE self
|
||||
-- @param #string From The From State string.
|
||||
-- @param #string Event The Event string.
|
||||
-- @param #string To The To State string.
|
||||
@@ -712,6 +721,31 @@ do -- DETECTION_BASE
|
||||
end
|
||||
end
|
||||
|
||||
-- Calculate radar blur probability
|
||||
|
||||
if self.RadarBlur then
|
||||
MESSAGE:New("Radar Blur",10):ToLogIf(self.debug):ToAllIf(self.verbose)
|
||||
local minheight = self.RadarBlurMinHeight or 250 -- meters
|
||||
local thresheight = self.RadarBlurThresHeight or 90 -- 10% chance to find a low flying group
|
||||
local thresblur = self.RadarBlurThresBlur or 85 -- 25% chance to escape the radar overall
|
||||
local dist = math.floor(Distance)
|
||||
if dist <= self.RadarBlurClosing then
|
||||
thresheight = (((dist*dist)/self.RadarBlurClosingSquare)*thresheight)
|
||||
thresblur = (((dist*dist)/self.RadarBlurClosingSquare)*thresblur)
|
||||
end
|
||||
local fheight = math.floor(math.random(1,10000)/100)
|
||||
local fblur = math.floor(math.random(1,10000)/100)
|
||||
local unit = UNIT:FindByName(DetectedObjectName)
|
||||
if unit and unit:IsAlive() then
|
||||
local AGL = unit:GetAltitude(true)
|
||||
MESSAGE:New("Unit "..DetectedObjectName.." is at "..math.floor(AGL).."m. Distance "..math.floor(Distance).."km.",10):ToLogIf(self.debug):ToAllIf(self.verbose)
|
||||
MESSAGE:New(string.format("fheight = %d/%d | fblur = %d/%d",fheight,thresheight,fblur,thresblur),10):ToLogIf(self.debug):ToAllIf(self.verbose)
|
||||
if fblur > thresblur then DetectionAccepted = false end
|
||||
if AGL <= minheight and fheight < thresheight then DetectionAccepted = false end
|
||||
MESSAGE:New("Detection Accepted = "..tostring(DetectionAccepted),10):ToLogIf(self.debug):ToAllIf(self.verbose)
|
||||
end
|
||||
end
|
||||
|
||||
-- Calculate additional probabilities
|
||||
|
||||
if not self.DetectedObjects[DetectedObjectName] and TargetIsVisible and self.DistanceProbability then
|
||||
@@ -1012,6 +1046,23 @@ do -- DETECTION_BASE
|
||||
|
||||
end
|
||||
|
||||
--- Method to make the radar detection less accurate, e.g. for WWII scenarios.
|
||||
-- @param #DETECTION_BASE self
|
||||
-- @param #number minheight Minimum flight height to be detected, in meters AGL (above ground)
|
||||
-- @param #number thresheight Threshold to escape the radar if flying below minheight, defaults to 90 (90% escape chance)
|
||||
-- @param #number thresblur Threshold to be detected by the radar overall, defaults to 85 (85% chance to be found)
|
||||
-- @param #number closing Closing-in in km - the limit of km from which on it becomes increasingly difficult to escape radar detection if flying towards the radar position. Should be about 1/3 of the radar detection radius in kilometers, defaults to 20.
|
||||
-- @return #DETECTION_BASE self
|
||||
function DETECTION_BASE:SetRadarBlur(minheight,thresheight,thresblur,closing)
|
||||
self.RadarBlur = true
|
||||
self.RadarBlurMinHeight = minheight or 250 -- meters
|
||||
self.RadarBlurThresHeight = thresheight or 90 -- 10% chance to find a low flying group
|
||||
self.RadarBlurThresBlur = thresblur or 85 -- 25% chance to escape the radar overall
|
||||
self.RadarBlurClosing = closing or 20 -- 20km
|
||||
self.RadarBlurClosingSquare = self.RadarBlurClosing * self.RadarBlurClosing
|
||||
return self
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
do
|
||||
@@ -1354,7 +1405,7 @@ do -- DETECTION_BASE
|
||||
}
|
||||
}
|
||||
|
||||
--- @param DCS#Unit FoundDCSUnit
|
||||
-- @param DCS#Unit FoundDCSUnit
|
||||
-- @param Wrapper.Group#GROUP ReportGroup
|
||||
-- @param Core.Set#SET_GROUP ReportSetGroup
|
||||
local FindNearByFriendlies = function( FoundDCSUnit, ReportGroupData )
|
||||
@@ -1419,7 +1470,7 @@ do -- DETECTION_BASE
|
||||
DetectedItem.PlayersNearBy = nil
|
||||
|
||||
_DATABASE:ForEachPlayer(
|
||||
--- @param Wrapper.Unit#UNIT PlayerUnit
|
||||
-- @param Wrapper.Unit#UNIT PlayerUnit
|
||||
function( PlayerUnitName )
|
||||
local PlayerUnit = UNIT:FindByName( PlayerUnitName )
|
||||
|
||||
@@ -1976,7 +2027,8 @@ end
|
||||
|
||||
do -- DETECTION_UNITS
|
||||
|
||||
--- @type DETECTION_UNITS
|
||||
---
|
||||
-- @type DETECTION_UNITS
|
||||
-- @field DCS#Distance DetectionRange The range till which targets are detected.
|
||||
-- @extends Functional.Detection#DETECTION_BASE
|
||||
|
||||
@@ -2232,7 +2284,8 @@ end
|
||||
|
||||
do -- DETECTION_TYPES
|
||||
|
||||
--- @type DETECTION_TYPES
|
||||
---
|
||||
-- @type DETECTION_TYPES
|
||||
-- @extends Functional.Detection#DETECTION_BASE
|
||||
|
||||
--- Will detect units within the battle zone.
|
||||
@@ -2435,7 +2488,8 @@ end
|
||||
|
||||
do -- DETECTION_AREAS
|
||||
|
||||
--- @type DETECTION_AREAS
|
||||
---
|
||||
-- @type DETECTION_AREAS
|
||||
-- @field DCS#Distance DetectionZoneRange The range till which targets are grouped upon the first detected target.
|
||||
-- @field #DETECTION_BASE.DetectedItems DetectedItems A list of areas containing the set of @{Wrapper.Unit}s, @{Core.Zone}s, the center @{Wrapper.Unit} within the zone, and ID of each area that was detected within a DetectionZoneRange.
|
||||
-- @extends Functional.Detection#DETECTION_BASE
|
||||
@@ -2961,7 +3015,7 @@ do -- DETECTION_AREAS
|
||||
|
||||
-- DetectedSet:Flush( self )
|
||||
|
||||
DetectedSet:ForEachUnit( --- @param Wrapper.Unit#UNIT DetectedUnit
|
||||
DetectedSet:ForEachUnit( -- @param Wrapper.Unit#UNIT DetectedUnit
|
||||
function( DetectedUnit )
|
||||
if DetectedUnit:IsAlive() then
|
||||
-- self:T( "Detected Set #" .. DetectedItem.ID .. ":" .. DetectedUnit:GetName() )
|
||||
|
||||
@@ -17,9 +17,11 @@
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- ## Missions:
|
||||
-- ## Additional Material:
|
||||
--
|
||||
-- [ESC - Escorting](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/ESC%20-%20Escorting)
|
||||
-- * **Demo Missions:** [GitHub](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Functional/Escort)
|
||||
-- * **YouTube videos:** None
|
||||
-- * **Guides:** None
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
--
|
||||
-- ## Missions:
|
||||
--
|
||||
-- ### [MANTIS - Modular, Automatic and Network capable Targeting and Interception System](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/MTS%20-%20Mantis/MTS-010%20-%20Basic%20Mantis%20Demo)
|
||||
-- ### [MANTIS - Modular, Automatic and Network capable Targeting and Interception System](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Functional/Mantis)
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
@@ -22,7 +22,7 @@
|
||||
-- @module Functional.Mantis
|
||||
-- @image Functional.Mantis.jpg
|
||||
--
|
||||
-- Last Update: Nov 2023
|
||||
-- Last Update: Dec 2023
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
--- **MANTIS** class, extends Core.Base#BASE
|
||||
@@ -94,7 +94,7 @@
|
||||
-- Known SAM types at the time of writing are:
|
||||
--
|
||||
-- * Avenger
|
||||
-- * Chaparrel
|
||||
-- * Chaparral
|
||||
-- * Hawk
|
||||
-- * Linebacker
|
||||
-- * NASAMS
|
||||
@@ -365,7 +365,7 @@ MANTIS.SamData = {
|
||||
["SA-15"] = { Range=11, Blindspot=0, Height=6, Type="Short", Radar="Tor 9A331" },
|
||||
["SA-13"] = { Range=5, Blindspot=0, Height=3, Type="Short", Radar="Strela" },
|
||||
["Avenger"] = { Range=4, Blindspot=0, Height=3, Type="Short", Radar="Avenger" },
|
||||
["Chaparrel"] = { Range=8, Blindspot=0, Height=3, Type="Short", Radar="Chaparral" },
|
||||
["Chaparral"] = { Range=8, Blindspot=0, Height=3, Type="Short", Radar="Chaparral" },
|
||||
["Linebacker"] = { Range=4, Blindspot=0, Height=3, Type="Short", Radar="Linebacker" },
|
||||
["Silkworm"] = { Range=90, Blindspot=1, Height=0.2, Type="Long", Radar="Silkworm" },
|
||||
-- units from HDS Mod, multi launcher options is tricky
|
||||
@@ -631,7 +631,7 @@ do
|
||||
|
||||
-- TODO Version
|
||||
-- @field #string version
|
||||
self.version="0.8.15"
|
||||
self.version="0.8.16"
|
||||
self:I(string.format("***** Starting MANTIS Version %s *****", self.version))
|
||||
|
||||
--- FSM Functions ---
|
||||
@@ -1149,7 +1149,7 @@ do
|
||||
--self:T(self.lid.." Relocating HQ")
|
||||
local text = self.lid.." Relocating HQ"
|
||||
--local m= MESSAGE:New(text,10,"MANTIS"):ToAll()
|
||||
_hqgrp:RelocateGroundRandomInRadius(20,500,true,true)
|
||||
_hqgrp:RelocateGroundRandomInRadius(20,500,true,true,nil,true)
|
||||
end
|
||||
--relocate EWR
|
||||
-- TODO: maybe dependent on AlarmState? Observed: SA11 SR only relocates if no objects in reach
|
||||
@@ -1163,7 +1163,7 @@ do
|
||||
local text = self.lid.." Relocating EWR ".._grp:GetName()
|
||||
local m= MESSAGE:New(text,10,"MANTIS"):ToAllIf(self.debug)
|
||||
if self.verbose then self:I(text) end
|
||||
_grp:RelocateGroundRandomInRadius(20,500,true,true)
|
||||
_grp:RelocateGroundRandomInRadius(20,500,true,true,nil,true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
--
|
||||
-- ## Missions:
|
||||
--
|
||||
-- [MIT - Missile Trainer](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/MIT%20-%20Missile%20Trainer)
|
||||
-- [MIT - Missile Trainer](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Functional/MissileTrainer)
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
@@ -72,7 +72,6 @@
|
||||
-- @module Functional.MissileTrainer
|
||||
-- @image Missile_Trainer.JPG
|
||||
|
||||
|
||||
---
|
||||
-- @type MISSILETRAINER
|
||||
-- @field Core.Set#SET_CLIENT DBClients
|
||||
|
||||
@@ -33,16 +33,11 @@
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- ## Missions:
|
||||
-- ## Additional Material:
|
||||
--
|
||||
-- ### [RAT - Random Air Traffic](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/RAT%20-%20Random%20Air%20Traffic)
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- # YouTube Channel
|
||||
--
|
||||
-- ### [MOOSE YouTube Channel](https://www.youtube.com/channel/UCjrA9j5LQoWsG4SpS8i79Qg)
|
||||
-- ### [MOOSE - RAT - Random Air Traffic](https://www.youtube.com/playlist?list=PL7ZUrU4zZUl0u4Zxywtg-mx_ov4vi68CO)
|
||||
-- * **Demo Missions:** [GitHub](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Functional/RAT)
|
||||
-- * **YouTube videos:** [Random Air Traffic](https://www.youtube.com/playlist?list=PL7ZUrU4zZUl0u4Zxywtg-mx_ov4vi68CO)
|
||||
-- * **Guides:** None
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
@@ -170,7 +165,7 @@
|
||||
--
|
||||
-- * A specific departure and/or destination airport can be chosen.
|
||||
-- * Valid coalitions can be set, e.g. only red, blue or neutral, all three "colours".
|
||||
-- * It is possible to start in air within a zone defined in the mission editor or within a zone above an airport of the map.
|
||||
-- * It is possible to start in air within a zone or within a zone above an airport of the map.
|
||||
--
|
||||
-- ## Flight Plan
|
||||
--
|
||||
@@ -1179,13 +1174,13 @@ function RAT:SetTakeoffAir()
|
||||
return self
|
||||
end
|
||||
|
||||
--- Set possible departure ports. This can be an airport or a zone defined in the mission editor.
|
||||
--- Set possible departure ports. This can be an airport or a zone.
|
||||
-- @param #RAT self
|
||||
-- @param #string departurenames Name or table of names of departure airports or zones.
|
||||
-- @return #RAT RAT self object.
|
||||
-- @usage RAT:SetDeparture("Sochi-Adler") will spawn RAT objects at Sochi-Adler airport.
|
||||
-- @usage RAT:SetDeparture({"Sochi-Adler", "Gudauta"}) will spawn RAT aircraft radomly at Sochi-Adler or Gudauta airport.
|
||||
-- @usage RAT:SetDeparture({"Zone A", "Gudauta"}) will spawn RAT aircraft in air randomly within Zone A, which has to be defined in the mission editor, or within a zone around Gudauta airport. Note that this also requires RAT:takeoff("air") to be set.
|
||||
-- @usage RAT:SetDeparture({"Zone A", "Gudauta"}) will spawn RAT aircraft in air randomly within Zone A, or within a zone around Gudauta airport. Note that this also requires RAT:takeoff("air") to be set.
|
||||
function RAT:SetDeparture(departurenames)
|
||||
self:F2(departurenames)
|
||||
|
||||
@@ -2537,7 +2532,7 @@ function RAT:_SetRoute(takeoff, landing, _departure, _destination, _waypoint)
|
||||
end
|
||||
elseif self:_ZoneExists(_departure) then
|
||||
-- If it's not an airport, check whether it's a zone.
|
||||
departure=ZONE:New(_departure)
|
||||
departure=ZONE:FindByName(_departure)
|
||||
else
|
||||
local text=string.format("ERROR! Specified departure airport %s does not exist for %s.", _departure, self.alias)
|
||||
self:E(RAT.id..text)
|
||||
@@ -2635,7 +2630,7 @@ function RAT:_SetRoute(takeoff, landing, _departure, _destination, _waypoint)
|
||||
end
|
||||
|
||||
elseif self:_ZoneExists(_destination) then
|
||||
destination=ZONE:New(_destination)
|
||||
destination=ZONE:FindByName(_destination)
|
||||
else
|
||||
local text=string.format("ERROR: Specified destination airport/zone %s does not exist for %s!", _destination, self.alias)
|
||||
self:E(RAT.id.."ERROR: "..text)
|
||||
@@ -3142,7 +3137,7 @@ function RAT:_PickDeparture(takeoff)
|
||||
end
|
||||
elseif self:_ZoneExists(name) then
|
||||
if takeoff==RAT.wp.air then
|
||||
dep=ZONE:New(name)
|
||||
dep=ZONE:FindByName(name)
|
||||
else
|
||||
self:E(RAT.id..string.format("ERROR! Takeoff is not in air. Cannot use %s as departure.", name))
|
||||
end
|
||||
@@ -3254,7 +3249,7 @@ function RAT:_PickDestination(departure, q, minrange, maxrange, random, landing)
|
||||
end
|
||||
elseif self:_ZoneExists(name) then
|
||||
if landing==RAT.wp.air then
|
||||
dest=ZONE:New(name)
|
||||
dest=ZONE:FindByName(name)
|
||||
else
|
||||
self:E(RAT.id..string.format("ERROR! Landing is not in air. Cannot use zone %s as destination!", name))
|
||||
end
|
||||
@@ -4930,12 +4925,12 @@ function RAT:_AirportExists(name)
|
||||
return false
|
||||
end
|
||||
|
||||
--- Test if a trigger zone defined in the mission editor exists.
|
||||
--- Test if a zone exists.
|
||||
-- @param #RAT self
|
||||
-- @param #string name
|
||||
-- @return #boolean True if zone exsits, false otherwise.
|
||||
function RAT:_ZoneExists(name)
|
||||
local z=trigger.misc.getZone(name)
|
||||
local z=ZONE:FindByName(name) --trigger.misc.getZone(name) as suggested by @Viking on MOOSE discord #rat
|
||||
if z then
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -1207,20 +1207,22 @@ end
|
||||
-- @return #RANGE self
|
||||
function RANGE:SetSRS(PathToSRS, Port, Coalition, Frequency, Modulation, Volume, PathToGoogleKey)
|
||||
|
||||
if PathToSRS then
|
||||
if PathToSRS or MSRS.path then
|
||||
|
||||
self.useSRS=true
|
||||
|
||||
self.controlmsrs=MSRS:New(PathToSRS, Frequency or 256, Modulation or radio.modulation.AM, Volume or 1.0)
|
||||
self.controlmsrs:SetPort(Port)
|
||||
self.controlmsrs=MSRS:New(PathToSRS or MSRS.path, Frequency or 256, Modulation or radio.modulation.AM)
|
||||
self.controlmsrs:SetPort(Port or MSRS.port)
|
||||
self.controlmsrs:SetCoalition(Coalition or coalition.side.BLUE)
|
||||
self.controlmsrs:SetLabel("RANGEC")
|
||||
self.controlmsrs:SetVolume(Volume or 1.0)
|
||||
self.controlsrsQ = MSRSQUEUE:New("CONTROL")
|
||||
|
||||
self.instructmsrs=MSRS:New(PathToSRS, Frequency or 305, Modulation or radio.modulation.AM, Volume or 1.0)
|
||||
self.instructmsrs:SetPort(Port)
|
||||
self.instructmsrs=MSRS:New(PathToSRS or MSRS.path, Frequency or 305, Modulation or radio.modulation.AM)
|
||||
self.instructmsrs:SetPort(Port or MSRS.port)
|
||||
self.instructmsrs:SetCoalition(Coalition or coalition.side.BLUE)
|
||||
self.instructmsrs:SetLabel("RANGEI")
|
||||
self.instructmsrs:SetVolume(Volume or 1.0)
|
||||
self.instructsrsQ = MSRSQUEUE:New("INSTRUCT")
|
||||
|
||||
if PathToGoogleKey then
|
||||
@@ -1738,6 +1740,8 @@ end
|
||||
function RANGE:OnEventBirth( EventData )
|
||||
self:F( { eventbirth = EventData } )
|
||||
|
||||
if not EventData.IniPlayerName then return end
|
||||
|
||||
local _unitName = EventData.IniUnitName
|
||||
local _unit, _playername = self:_GetPlayerUnitAndName( _unitName )
|
||||
|
||||
@@ -2187,7 +2191,7 @@ function RANGE:onafterExitRange( From, Event, To, player )
|
||||
|
||||
local text = "You left the bombing range zone. "
|
||||
|
||||
local r=math.random(2)
|
||||
local r=math.random(5)
|
||||
|
||||
if r==1 then
|
||||
text=text.."Have a nice day!"
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
--
|
||||
-- ## Missions:
|
||||
--
|
||||
-- [SCO - Scoring](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/SCO%20-%20Scoring)
|
||||
-- [SCO - Scoring](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Functional/Scoring)
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
@@ -276,9 +276,15 @@ function SCORING:New( GameName )
|
||||
self:SetMessagesZone( true )
|
||||
|
||||
-- Scales
|
||||
|
||||
self:SetScaleDestroyScore( 10 )
|
||||
self:SetScaleDestroyPenalty( 30 )
|
||||
|
||||
-- Hitting a target multiple times before destoying it should not result in a higger score
|
||||
-- Multiple hits is typically a results of bombs/missles missing their target but still inflict some spash damage
|
||||
-- Making this configurable to anyone can enable this anyway if they want
|
||||
self:SetScoreIncrementOnHit(0)
|
||||
|
||||
-- Default fratricide penalty level (maximum penalty that can be assigned to a player before he gets kicked).
|
||||
self:SetFratricide( self.ScaleDestroyPenalty * 3 )
|
||||
self.penaltyonfratricide = true
|
||||
@@ -467,6 +473,16 @@ function SCORING:SetMessagesHit( OnOff )
|
||||
return self
|
||||
end
|
||||
|
||||
--- Configure to increment score after a target has been hit.
|
||||
-- @param #SCORING self
|
||||
-- @param #number score amount of point to inclement score on each hit
|
||||
-- @return #SCORING
|
||||
function SCORING:SetScoreIncrementOnHit( score )
|
||||
|
||||
self.ScoreIncrementOnHit = score
|
||||
return self
|
||||
end
|
||||
|
||||
--- If to send messages after a target has been hit.
|
||||
-- @param #SCORING self
|
||||
-- @return #boolean
|
||||
@@ -885,6 +901,7 @@ function SCORING:OnEventBirth( Event )
|
||||
Event.IniUnit.BirthTime = timer.getTime()
|
||||
if PlayerName then
|
||||
self:_AddPlayerFromUnit( Event.IniUnit )
|
||||
self.Players[PlayerName].PlayerKills = 0
|
||||
self:SetScoringMenu( Event.IniGroup )
|
||||
end
|
||||
end
|
||||
@@ -1015,7 +1032,7 @@ function SCORING:_EventOnHit( Event )
|
||||
PlayerHit.UNIT = PlayerHit.UNIT or TargetUNIT
|
||||
-- After an instant kill we can't compute the thread level anymore. To fix this we compute at OnEventBirth
|
||||
if PlayerHit.UNIT.ThreatType == nil then
|
||||
PlayerHit.ThreatLevel, PlayerHit.ThreatType = PlayerHit.UNIT:GetThreatLevel()
|
||||
PlayerHit.ThreatLevel, PlayerHit.ThreatType = PlayerHit.UNIT:GetThreatLevel()
|
||||
-- if this fails for some reason, set a good default value
|
||||
if PlayerHit.ThreatType == nil then
|
||||
PlayerHit.ThreatLevel = 1
|
||||
@@ -1060,10 +1077,8 @@ function SCORING:_EventOnHit( Event )
|
||||
end
|
||||
self:ScoreCSV( InitPlayerName, TargetPlayerName, "HIT_PENALTY", 1, -10, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
|
||||
else
|
||||
-- Hitting a target multiple times before destoying it should not result in a higger score
|
||||
-- Multiple hits is typically a results of bombs/missles missing their target but still inflict some spash damage
|
||||
-- Player.Score = Player.Score + 1
|
||||
-- PlayerHit.Score = PlayerHit.Score + 1
|
||||
Player.Score = Player.Score + self.ScoreIncrementOnHit
|
||||
PlayerHit.Score = PlayerHit.Score + self.ScoreIncrementOnHit
|
||||
PlayerHit.ScoreHit = PlayerHit.ScoreHit + 1
|
||||
if TargetPlayerName ~= nil then -- It is a player hitting another player ...
|
||||
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. InitPlayerName .. "' hit enemy player '" .. TargetPlayerName .. "' " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " .. PlayerHit.ScoreHit .. " times. " ..
|
||||
@@ -1128,7 +1143,7 @@ function SCORING:_EventOnHit( Event )
|
||||
PlayerHit.UNIT = PlayerHit.UNIT or TargetUNIT
|
||||
-- After an instant kill we can't compute the thread level anymore. To fix this we compute at OnEventBirth
|
||||
if PlayerHit.UNIT.ThreatType == nil then
|
||||
PlayerHit.ThreatLevel, PlayerHit.ThreatType = PlayerHit.UNIT:GetThreatLevel()
|
||||
PlayerHit.ThreatLevel, PlayerHit.ThreatType = PlayerHit.UNIT:GetThreatLevel()
|
||||
-- if this fails for some reason, set a good default value
|
||||
if PlayerHit.ThreatType == nil then
|
||||
PlayerHit.ThreatLevel = 1
|
||||
@@ -1163,10 +1178,8 @@ function SCORING:_EventOnHit( Event )
|
||||
:ToCoalitionIf( Event.WeaponCoalition, self:IfMessagesHit() and self:IfMessagesToCoalition() )
|
||||
self:ScoreCSV( Event.WeaponPlayerName, TargetPlayerName, "HIT_PENALTY", 1, -10, Event.WeaponName, Event.WeaponCoalition, Event.WeaponCategory, Event.WeaponTypeName, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType )
|
||||
else
|
||||
-- Hitting a target multiple times before destoying it should not result in a higger score
|
||||
-- Multiple hits is typically a results of bombs/missles missing their target but still inflict some spash damage
|
||||
-- Player.Score = Player.Score + 1
|
||||
-- PlayerHit.Score = PlayerHit.Score + 1
|
||||
Player.Score = Player.Score + self.ScoreIncrementOnHit
|
||||
PlayerHit.Score = PlayerHit.Score + self.ScoreIncrementOnHit
|
||||
PlayerHit.ScoreHit = PlayerHit.ScoreHit + 1
|
||||
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. Event.WeaponPlayerName .. "' hit enemy target " .. TargetUnitCategory .. " ( " .. TargetType .. " ) " ..
|
||||
"Score: " .. PlayerHit.Score .. ". Score Total:" .. Player.Score - Player.Penalty,
|
||||
@@ -1274,13 +1287,18 @@ function SCORING:_EventOnDeadOrCrash( Event )
|
||||
TargetDestroy.Penalty = TargetDestroy.Penalty + ThreatPenalty
|
||||
TargetDestroy.PenaltyDestroy = TargetDestroy.PenaltyDestroy + 1
|
||||
|
||||
|
||||
self:OnKillPvP(Player, TargetPlayerName, true, TargetThreatLevel, Player.ThreatLevel, ThreatPenalty)
|
||||
|
||||
if Player.HitPlayers[TargetPlayerName] then -- A player destroyed another player
|
||||
self:OnKillPvP(Player, TargetPlayerName, true)
|
||||
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' destroyed friendly player '" .. TargetPlayerName .. "' " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " ..
|
||||
"Penalty: -" .. ThreatPenalty .. " = " .. Player.Score - Player.Penalty,
|
||||
MESSAGE.Type.Information )
|
||||
:ToAllIf( self:IfMessagesDestroy() and self:IfMessagesToAll() )
|
||||
:ToCoalitionIf( InitCoalition, self:IfMessagesDestroy() and self:IfMessagesToCoalition() )
|
||||
else
|
||||
self:OnKillPvE(Player, TargetUnitName, true, TargetThreatLevel, Player.ThreatLevel, ThreatPenalty)
|
||||
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' destroyed friendly target " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " ..
|
||||
"Penalty: -" .. ThreatPenalty .. " = " .. Player.Score - Player.Penalty,
|
||||
MESSAGE.Type.Information )
|
||||
@@ -1303,12 +1321,19 @@ function SCORING:_EventOnDeadOrCrash( Event )
|
||||
TargetDestroy.Score = TargetDestroy.Score + ThreatScore
|
||||
TargetDestroy.ScoreDestroy = TargetDestroy.ScoreDestroy + 1
|
||||
if Player.HitPlayers[TargetPlayerName] then -- A player destroyed another player
|
||||
if Player.PlayerKills ~= nil then
|
||||
Player.PlayerKills = Player.PlayerKills + 1
|
||||
else
|
||||
Player.PlayerKills = 1
|
||||
end
|
||||
self:OnKillPvP(Player, TargetPlayerName, false, TargetThreatLevel, Player.ThreatLevel, ThreatScore)
|
||||
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' destroyed enemy player '" .. TargetPlayerName .. "' " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " ..
|
||||
"Score: +" .. ThreatScore .. " = " .. Player.Score - Player.Penalty,
|
||||
MESSAGE.Type.Information )
|
||||
:ToAllIf( self:IfMessagesDestroy() and self:IfMessagesToAll() )
|
||||
:ToCoalitionIf( InitCoalition, self:IfMessagesDestroy() and self:IfMessagesToCoalition() )
|
||||
else
|
||||
self:OnKillPvE(Player, TargetUnitName, false, TargetThreatLevel, Player.ThreatLevel, ThreatScore)
|
||||
MESSAGE:NewType( self.DisplayMessagePrefix .. "Player '" .. PlayerName .. "' destroyed enemy " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " ..
|
||||
"Score: +" .. ThreatScore .. " = " .. Player.Score - Player.Penalty,
|
||||
MESSAGE.Type.Information )
|
||||
@@ -1907,3 +1932,26 @@ function SCORING:SwitchAutoSave(OnOff)
|
||||
self.AutoSave = OnOff
|
||||
return self
|
||||
end
|
||||
|
||||
--- Handles the event when one player kill another player
|
||||
-- @param #SCORING self
|
||||
-- @param #PLAYER Player the ataching player
|
||||
-- @param #string TargetPlayerName the name of the killed player
|
||||
-- @param #bool IsTeamKill true if this kill was a team kill
|
||||
-- @param #number TargetThreatLevel Thread level of the target
|
||||
-- @param #number PlayerThreatLevelThread level of the player
|
||||
-- @param #number Score The score based on both threat levels
|
||||
function SCORING:OnKillPvP(Player, TargetPlayerName, IsTeamKill, TargetThreatLevel, PlayerThreatLevel, Score)
|
||||
|
||||
end
|
||||
--- Handles the event when one player kill another player
|
||||
-- @param #SCORING self
|
||||
-- @param #PLAYER Player the ataching player
|
||||
-- @param #string TargetUnitName the name of the killed unit
|
||||
-- @param #bool IsTeamKill true if this kill was a team kill
|
||||
-- @param #number TargetThreatLevel Thread level of the target
|
||||
-- @param #number PlayerThreatLevelThread level of the player
|
||||
-- @param #number Score The score based on both threat levels
|
||||
function SCORING:OnKillPvE(Player, TargetUnitName, IsTeamKill, TargetThreatLevel, PlayerThreatLevel, Score)
|
||||
|
||||
end
|
||||
@@ -13,13 +13,13 @@
|
||||
--
|
||||
-- ## Missions:
|
||||
--
|
||||
-- [SEV - SEAD Evasion](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/SEV%20-%20SEAD%20Evasion)
|
||||
-- [SEV - SEAD Evasion](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Functional/Sead)
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- ### Authors: **FlightControl**, **applevangelist**
|
||||
-- ### Authors: **applevangelist**, **FlightControl**
|
||||
--
|
||||
-- Last Update: Oct 2023
|
||||
-- Last Update: Dec 2023
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
@@ -144,7 +144,7 @@ function SEAD:New( SEADGroupPrefixes, Padding )
|
||||
self:AddTransition("*", "ManageEvasion", "*")
|
||||
self:AddTransition("*", "CalculateHitZone", "*")
|
||||
|
||||
self:I("*** SEAD - Started Version 0.4.5")
|
||||
self:I("*** SEAD - Started Version 0.4.6")
|
||||
return self
|
||||
end
|
||||
|
||||
@@ -401,7 +401,7 @@ function SEAD:onafterManageEvasion(From,Event,To,_targetskill,_targetgroup,SEADP
|
||||
grp:EnableEmission(false)
|
||||
end
|
||||
grp:OptionAlarmStateGreen() -- needed else we cannot move around
|
||||
grp:RelocateGroundRandomInRadius(20,300,false,false,"Diamond")
|
||||
grp:RelocateGroundRandomInRadius(20,300,false,false,"Diamond",true)
|
||||
if self.UseCallBack then
|
||||
local object = self.CallBack
|
||||
object:SeadSuppressionStart(grp,name,attacker)
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
--
|
||||
-- ## Missions:
|
||||
--
|
||||
-- ### [SHORAD - Short Range Air Defense](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/SRD%20-%20SHORAD%20Defense)
|
||||
-- ### [SHORAD - Short Range Air Defense](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Functional/Shorad)
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
-- @field #number respawndelay Delay before respawn in seconds.
|
||||
-- @field #number runwaydestroyed Time stamp timer.getAbsTime() when the runway was destroyed.
|
||||
-- @field #number runwayrepairtime Time in seconds until runway will be repaired after it was destroyed. Default is 3600 sec (one hour).
|
||||
-- @field Ops.FlightControl#FLIGHTCONTROL flightcontrol Flight control of this warehouse.
|
||||
-- @field OPS.FlightControl#FLIGHTCONTROL flightcontrol Flight control of this warehouse.
|
||||
-- @extends Core.Fsm#FSM
|
||||
|
||||
--- Have your assets at the right place at the right time - or not!
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
--
|
||||
-- ## Missions:
|
||||
--
|
||||
-- [CAZ - Capture Zones](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/CAZ%20-%20Capture%20Zones)
|
||||
-- [CAZ - Capture Zones](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Functional/ZoneCaptureCoalition)
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
|
||||
@@ -1,149 +1,149 @@
|
||||
__Moose.Include( 'Scripts/Moose/Utilities/Enums.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Utilities/Utils.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Utilities/Profiler.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Utilities/Templates.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Utilities/STTS.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Utilities/FiFo.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Utilities/Socket.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Utilities/Enums.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Utilities/Utils.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Utilities/Profiler.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Utilities/Templates.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Utilities/STTS.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Utilities/FiFo.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Utilities/Socket.lua' )
|
||||
|
||||
__Moose.Include( 'Scripts/Moose/Core/Base.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Core/Astar.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Core/Beacon.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Core/Condition.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Core/UserFlag.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Core/Report.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Core/Scheduler.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Core/ScheduleDispatcher.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Core/Event.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Core/Settings.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Core/Menu.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Core/Zone.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Core/Zone_Detection.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Core/Database.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Core/Set.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Core/Point.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Core/Velocity.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Core/Message.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Core/Fsm.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Core/Spawn.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Core/SpawnStatic.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Core/Timer.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Core/Goal.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Core/Spot.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Core/MarkerOps_Base.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Core/TextAndSound.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Core/Pathline.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Base.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Astar.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Beacon.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Condition.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/UserFlag.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Report.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Scheduler.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/ScheduleDispatcher.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Event.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Settings.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Menu.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Zone.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Zone_Detection.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Database.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Set.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Point.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Velocity.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Message.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Fsm.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Spawn.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/SpawnStatic.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Timer.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Goal.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Spot.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/MarkerOps_Base.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/TextAndSound.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Core/Pathline.lua' )
|
||||
|
||||
__Moose.Include( 'Scripts/Moose/Wrapper/Object.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Wrapper/Identifiable.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Wrapper/Positionable.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Wrapper/Controllable.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Wrapper/Group.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Wrapper/Unit.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Wrapper/Client.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Wrapper/Static.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Wrapper/Airbase.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Wrapper/Scenery.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Wrapper/Marker.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Wrapper/Weapon.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Wrapper/Net.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Wrapper/Storage.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Object.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Identifiable.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Positionable.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Controllable.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Group.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Unit.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Client.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Static.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Airbase.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Scenery.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Marker.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Weapon.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Net.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Storage.lua' )
|
||||
|
||||
__Moose.Include( 'Scripts/Moose/Cargo/Cargo.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Cargo/CargoUnit.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Cargo/CargoSlingload.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Cargo/CargoCrate.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Cargo/CargoGroup.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Cargo/Cargo.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Cargo/CargoUnit.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Cargo/CargoSlingload.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Cargo/CargoCrate.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Cargo/CargoGroup.lua' )
|
||||
|
||||
__Moose.Include( 'Scripts/Moose/Functional/Scoring.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Functional/CleanUp.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Functional/Movement.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Functional/Sead.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Functional/Escort.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Functional/MissileTrainer.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Functional/ATC_Ground.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Functional/Detection.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Functional/DetectionZones.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Functional/Designate.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Functional/RAT.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Functional/Range.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Functional/ZoneGoal.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Functional/ZoneGoalCoalition.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Functional/ZoneCaptureCoalition.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Functional/Artillery.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Functional/Suppression.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Functional/PseudoATC.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Functional/Warehouse.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Functional/Fox.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Functional/Mantis.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Functional/Shorad.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Scoring.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/CleanUp.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Movement.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Sead.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Escort.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/MissileTrainer.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/ATC_Ground.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Detection.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/DetectionZones.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Designate.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/RAT.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Range.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/ZoneGoal.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/ZoneGoalCoalition.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/ZoneCaptureCoalition.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Artillery.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Suppression.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/PseudoATC.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Warehouse.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Fox.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Mantis.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Functional/Shorad.lua' )
|
||||
|
||||
__Moose.Include( 'Scripts/Moose/Ops/Airboss.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Ops/RecoveryTanker.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Ops/RescueHelo.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Ops/ATIS.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Ops/CTLD.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Ops/CSAR.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/Airboss.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/RecoveryTanker.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/RescueHelo.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/ATIS.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/CTLD.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Ops/CSAR.lua' )
|
||||
|
||||
__Moose.Include( 'Scripts/Moose/AI/AI_Balancer.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/AI/AI_Air.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/AI/AI_Air_Patrol.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/AI/AI_Air_Engage.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/AI/AI_A2A_Patrol.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/AI/AI_A2A_Cap.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/AI/AI_A2A_Gci.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/AI/AI_A2A_Dispatcher.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/AI/AI_A2G_BAI.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/AI/AI_A2G_CAS.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/AI/AI_A2G_SEAD.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/AI/AI_A2G_Dispatcher.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/AI/AI_Patrol.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/AI/AI_CAP.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/AI/AI_CAS.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/AI/AI_BAI.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/AI/AI_Formation.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/AI/AI_Escort.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/AI/AI_Escort_Request.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/AI/AI_Escort_Dispatcher.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/AI/AI_Escort_Dispatcher_Request.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/AI/AI_Cargo.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/AI/AI_Cargo_APC.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/AI/AI_Cargo_Helicopter.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/AI/AI_Cargo_Airplane.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/AI/AI_Cargo_Ship.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/AI/AI_Cargo_Dispatcher.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/AI/AI_Cargo_Dispatcher_APC.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/AI/AI_Cargo_Dispatcher_Helicopter.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/AI/AI_Cargo_Dispatcher_Airplane.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/AI/AI_Cargo_Dispatcher_Ship.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Balancer.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Air.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Air_Patrol.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Air_Engage.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_A2A_Patrol.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_A2A_Cap.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_A2A_Gci.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_A2A_Dispatcher.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_A2G_BAI.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_A2G_CAS.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_A2G_SEAD.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_A2G_Dispatcher.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Patrol.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_CAP.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_CAS.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_BAI.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Formation.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Escort.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Escort_Request.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Escort_Dispatcher.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Escort_Dispatcher_Request.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Cargo.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Cargo_APC.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Cargo_Helicopter.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Cargo_Airplane.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Cargo_Ship.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Cargo_Dispatcher.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Cargo_Dispatcher_APC.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Cargo_Dispatcher_Helicopter.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Cargo_Dispatcher_Airplane.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/AI/AI_Cargo_Dispatcher_Ship.lua' )
|
||||
|
||||
__Moose.Include( 'Scripts/Moose/Actions/Act_Assign.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Actions/Act_Route.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Actions/Act_Account.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Actions/Act_Assist.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Actions/Act_Assign.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Actions/Act_Route.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Actions/Act_Account.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Actions/Act_Assist.lua' )
|
||||
|
||||
__Moose.Include( 'Scripts/Moose/Sound/UserSound.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Sound/SoundOutput.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Sound/Radio.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Sound/RadioQueue.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Sound/RadioSpeech.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Sound/SRS.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Sound/UserSound.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Sound/SoundOutput.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Sound/Radio.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Sound/RadioQueue.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Sound/RadioSpeech.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Sound/SRS.lua' )
|
||||
|
||||
__Moose.Include( 'Scripts/Moose/Tasking/CommandCenter.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Tasking/Mission.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Tasking/Task.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Tasking/TaskInfo.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Tasking/Task_Manager.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Tasking/DetectionManager.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Tasking/Task_A2G_Dispatcher.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Tasking/Task_A2G.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Tasking/Task_A2A_Dispatcher.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Tasking/Task_A2A.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Tasking/Task_CARGO.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Tasking/Task_Cargo_Transport.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Tasking/Task_Cargo_CSAR.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Tasking/Task_Cargo_Dispatcher.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Tasking/Task_Capture_Zone.lua' )
|
||||
__Moose.Include( 'Scripts/Moose/Tasking/Task_Capture_Dispatcher.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/CommandCenter.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Mission.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/TaskInfo.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_Manager.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/DetectionManager.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_A2G_Dispatcher.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_A2G.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_A2A_Dispatcher.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_A2A.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_CARGO.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_Cargo_Transport.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_Cargo_CSAR.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_Cargo_Dispatcher.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_Capture_Zone.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Tasking/Task_Capture_Dispatcher.lua' )
|
||||
|
||||
__Moose.Include( 'Scripts/Moose/Globals.lua' )
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Globals.lua' )
|
||||
|
||||
@@ -700,7 +700,7 @@ ATIS.Messages = {
|
||||
EN =
|
||||
{
|
||||
HOURS = "hours",
|
||||
TIME = "hours",
|
||||
TIME = "Hours",
|
||||
NOCLOUDINFO = "Cloud coverage information not available",
|
||||
OVERCAST = "Overcast",
|
||||
BROKEN = "Broken clouds",
|
||||
@@ -890,7 +890,7 @@ _ATIS = {}
|
||||
|
||||
--- ATIS class version.
|
||||
-- @field #string version
|
||||
ATIS.version = "0.10.4"
|
||||
ATIS.version = "1.0.0"
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- TODO list
|
||||
@@ -1526,34 +1526,62 @@ function ATIS:MarkRunways( markall )
|
||||
end
|
||||
end
|
||||
|
||||
--- Use SRS Simple-Text-To-Speech for transmissions. No sound files necessary.
|
||||
--- Use SRS Simple-Text-To-Speech for transmissions. No sound files necessary.`SetSRS()` will try to use as many attributes configured with @{Sound.SRS#MSRS.LoadConfigFile}() as possible.
|
||||
-- @param #ATIS self
|
||||
-- @param #string PathToSRS Path to SRS directory.
|
||||
-- @param #string PathToSRS Path to SRS directory (only necessary if SRS exe backend is used).
|
||||
-- @param #string Gender Gender: "male" or "female" (default).
|
||||
-- @param #string Culture Culture, e.g. "en-GB" (default).
|
||||
-- @param #string Voice Specific voice. Overrides `Gender` and `Culture`.
|
||||
-- @param #number Port SRS port. Default 5002.
|
||||
-- @param #string GoogleKey Path to Google JSON-Key.
|
||||
-- @param #string GoogleKey Path to Google JSON-Key (SRS exe backend) or Google API key (DCS-gRPC backend).
|
||||
-- @return #ATIS self
|
||||
function ATIS:SetSRS(PathToSRS, Gender, Culture, Voice, Port, GoogleKey)
|
||||
if PathToSRS or MSRS.path then
|
||||
--if PathToSRS or MSRS.path then
|
||||
self.useSRS=true
|
||||
self.msrs=MSRS:New(PathToSRS, self.frequency, self.modulation)
|
||||
self.msrs:SetGender(Gender)
|
||||
self.msrs:SetCulture(Culture)
|
||||
self.msrs:SetVoice(Voice)
|
||||
self.msrs:SetPort(Port)
|
||||
|
||||
local path = PathToSRS or MSRS.path
|
||||
local gender = Gender or MSRS.gender
|
||||
local culture = Culture or MSRS.culture
|
||||
local voice = Voice or MSRS.voice
|
||||
local port = Port or MSRS.port or 5002
|
||||
|
||||
self.msrs=MSRS:New(path, self.frequency, self.modulation)
|
||||
self.msrs:SetGender(gender)
|
||||
self.msrs:SetCulture(culture)
|
||||
self.msrs:SetPort(port)
|
||||
self.msrs:SetCoalition(self:GetCoalition())
|
||||
self.msrs:SetLabel("ATIS")
|
||||
self.msrs:SetGoogle(GoogleKey)
|
||||
if GoogleKey then
|
||||
self.msrs:SetProviderOptionsGoogle(GoogleKey,GoogleKey)
|
||||
self.msrs:SetProvider(MSRS.Provider.GOOGLE)
|
||||
end
|
||||
-- Pre-configured Google?
|
||||
if (not GoogleKey) and self.msrs:GetProvider() == MSRS.Provider.GOOGLE then
|
||||
voice = Voice or MSRS.poptions.gcloud.voice
|
||||
end
|
||||
self.msrs:SetVoice(voice)
|
||||
self.msrs:SetCoordinate(self.airbase:GetCoordinate())
|
||||
self.msrsQ = MSRSQUEUE:New("ATIS")
|
||||
self.msrsQ:SetTransmitOnlyWithPlayers(self.TransmitOnlyWithPlayers)
|
||||
if self.dTQueueCheck<=10 then
|
||||
self:SetQueueUpdateTime(90)
|
||||
end
|
||||
--else
|
||||
--self:E(self.lid..string.format("ERROR: No SRS path specified!"))
|
||||
--end
|
||||
return self
|
||||
end
|
||||
|
||||
--- Set an alternative provider to the one set in your MSRS configuration file.
|
||||
-- @param #ATIS self
|
||||
-- @param #string Provider The provider to use. Known providers are: `MSRS.Provider.WINDOWS` and `MSRS.Provider.GOOGLE`
|
||||
-- @return #ATIS self
|
||||
function ATIS:SetSRSProvider(Provider)
|
||||
self:T(self.lid.."SetSRSProvider")
|
||||
if self.msrs then
|
||||
self.msrs:SetProvider(Provider)
|
||||
else
|
||||
self:E(self.lid..string.format("ERROR: No SRS path specified!"))
|
||||
MESSAGE:New(self.lid.."Set up SRS first before trying to change the provider!",30,"ATIS"):ToAll():ToLog()
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
--
|
||||
-- ## Example Missions
|
||||
--
|
||||
-- Example missions can be found [here](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/OPS%20-%20Airboss).
|
||||
-- Example missions can be found [here](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Ops/Airboss).
|
||||
-- They contain the latest development Moose.lua file.
|
||||
--
|
||||
-- ## IMPORTANT
|
||||
@@ -1746,7 +1746,7 @@ AIRBOSS.MenuF10Root = nil
|
||||
|
||||
--- Airboss class version.
|
||||
-- @field #string version
|
||||
AIRBOSS.version = "1.3.2"
|
||||
AIRBOSS.version = "1.3.3"
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- TODO list
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -3062,7 +3062,7 @@ function AIRBOSS:EnableSRS(PathToSRS,Port,Culture,Gender,Voice,GoogleCreds,Volum
|
||||
-- SRS
|
||||
local Frequency = self.AirbossRadio.frequency
|
||||
local Modulation = self.AirbossRadio.modulation
|
||||
self.SRS = MSRS:New(PathToSRS,Frequency,Modulation,Volume,AltBackend)
|
||||
self.SRS = MSRS:New(PathToSRS,Frequency,Modulation,AltBackend)
|
||||
self.SRS:SetCoalition(self:GetCoalition())
|
||||
self.SRS:SetCoordinate(self:GetCoordinate())
|
||||
self.SRS:SetCulture(Culture or "en-US")
|
||||
@@ -3071,6 +3071,8 @@ function AIRBOSS:EnableSRS(PathToSRS,Port,Culture,Gender,Voice,GoogleCreds,Volum
|
||||
self.SRS:SetPath(PathToSRS)
|
||||
self.SRS:SetPort(Port or 5002)
|
||||
self.SRS:SetLabel(self.AirbossRadio.alias or "AIRBOSS")
|
||||
self.SRS:SetCoordinate(self.carrier:GetCoordinate())
|
||||
self.SRS:SetVolume(Volume or 1)
|
||||
--self.SRS:SetModulations(Modulations)
|
||||
if GoogleCreds then
|
||||
self.SRS:SetGoogle(GoogleCreds)
|
||||
@@ -8211,7 +8213,7 @@ function AIRBOSS:OnEventBirth( EventData )
|
||||
self:E( EventData )
|
||||
return
|
||||
end
|
||||
if EventData.IniUnit == nil then
|
||||
if EventData.IniUnit == nil and (not EventData.IniObjectCategory == Object.Category.STATIC) then
|
||||
self:E( self.lid .. "ERROR: EventData.IniUnit=nil in event BIRTH!" )
|
||||
self:E( EventData )
|
||||
return
|
||||
@@ -10266,7 +10268,7 @@ function AIRBOSS:_GetSternCoord()
|
||||
elseif case==2 or case==1 then
|
||||
-- V/Stol: Translate 8 meters port.
|
||||
self.sterncoord:Translate(self.carrierparam.sterndist, hdg, true, true):Translate(8, FB-90, true, true)
|
||||
end
|
||||
end
|
||||
elseif self.carriertype==AIRBOSS.CarrierType.STENNIS then
|
||||
-- Stennis: translate 7 meters starboard wrt Final bearing.
|
||||
self.sterncoord:Translate( self.carrierparam.sterndist, hdg, true, true ):Translate( 7, FB + 90, true, true )
|
||||
@@ -11196,7 +11198,7 @@ function AIRBOSS:_AttitudeMonitor( playerData )
|
||||
end
|
||||
text = text .. string.format( "\nPitch=%.1f° | Roll=%.1f° | Yaw=%.1f°", pitch, roll, yaw )
|
||||
text = text .. string.format( "\nClimb Angle=%.1f° | Rate=%d ft/min", unit:GetClimbAngle(), velo.y * 196.85 )
|
||||
local dist = self:_GetOptLandingCoordinate():Get3DDistance( playerData.unit )
|
||||
local dist = self:_GetOptLandingCoordinate():Get3DDistance( playerData.unit:GetVec3() )
|
||||
-- Get player velocity in km/h.
|
||||
local vplayer = playerData.unit:GetVelocityKMH()
|
||||
-- Get carrier velocity in km/h.
|
||||
@@ -14881,6 +14883,7 @@ function AIRBOSS:RadioTransmission( radio, call, loud, delay, interval, click, p
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
-- SRS transmission
|
||||
if call.subtitle ~= nil and string.len(call.subtitle) > 1 then
|
||||
|
||||
@@ -14955,7 +14958,7 @@ function AIRBOSS:SetSRSPilotVoice( Voice, Gender, Culture )
|
||||
self.PilotRadio.gender = Gender or "male"
|
||||
self.PilotRadio.culture = Culture or "en-US"
|
||||
|
||||
if (not Voice) and self.SRS and self.SRS.google then
|
||||
if (not Voice) and self.SRS and self.SRS:GetProvider() == MSRS.Provider.GOOGLE then
|
||||
self.PilotRadio.voice = MSRS.Voices.Google.Standard.en_US_Standard_J
|
||||
end
|
||||
|
||||
@@ -15604,6 +15607,11 @@ function AIRBOSS:_Number2Radio( radio, number, delay, interval, pilotcall )
|
||||
Sender = "PilotCall"
|
||||
end
|
||||
|
||||
if Sender=="" then
|
||||
self:E( self.lid .. string.format( "ERROR: Sender unknown!") )
|
||||
return
|
||||
end
|
||||
|
||||
-- Split string into characters.
|
||||
local numbers = _split( number )
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
--
|
||||
-- ## Missions:
|
||||
--
|
||||
-- ### [CSAR - Combat Search & Rescue](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/OPS%20-%20CSAR)
|
||||
-- ### [CSAR - Combat Search & Rescue](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/Ops/CSAR)
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
@@ -31,7 +31,7 @@
|
||||
-- @image OPS_CSAR.jpg
|
||||
|
||||
-- Date: May 2023
|
||||
-- Last: Update Oct 2024
|
||||
-- Last: Update Dec 2024
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
--- **CSAR** class, extends Core.Base#BASE, Core.Fsm#FSM
|
||||
@@ -293,7 +293,7 @@ CSAR.AircraftType["Bronco-OV-10A"] = 2
|
||||
|
||||
--- CSAR class version.
|
||||
-- @field #string version
|
||||
CSAR.version="1.0.18"
|
||||
CSAR.version="1.0.19"
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- ToDo list
|
||||
@@ -536,6 +536,7 @@ function CSAR:New(Coalition, Template, Alias)
|
||||
-- @param #number Frequency Beacon frequency in kHz.
|
||||
-- @param #string Leadername Name of the #UNIT of the downed pilot.
|
||||
-- @param #string CoordinatesText String of the position of the pilot. Format determined by self.coordtype.
|
||||
-- @param #string Playername Player name if any given. Might be nil!
|
||||
|
||||
--- On After "Aproach" event. Heli close to downed Pilot.
|
||||
-- @function [parent=#CSAR] OnAfterApproach
|
||||
@@ -842,7 +843,7 @@ function CSAR:_AddCsar(_coalition , _country, _point, _typeName, _unitName, _pla
|
||||
|
||||
self:_CreateDownedPilotTrack(_spawnedGroup,_GroupName,_coalition,_unitName,_text,_typeName,_freq,_playerName,wetfeet)
|
||||
|
||||
self:_InitSARForPilot(_spawnedGroup, _unitName, _freq, noMessage) --shagrat use unitName to have the aircraft callsign / descriptive "name" etc.
|
||||
self:_InitSARForPilot(_spawnedGroup, _unitName, _freq, noMessage, _playerName) --shagrat use unitName to have the aircraft callsign / descriptive "name" etc.
|
||||
|
||||
return self
|
||||
end
|
||||
@@ -1224,7 +1225,8 @@ end
|
||||
-- @param #string _GroupName Name of the Group
|
||||
-- @param #number _freq Beacon frequency.
|
||||
-- @param #boolean _nomessage Send message true or false.
|
||||
function CSAR:_InitSARForPilot(_downedGroup, _GroupName, _freq, _nomessage)
|
||||
-- @param #string _playername Name of the downed pilot if any
|
||||
function CSAR:_InitSARForPilot(_downedGroup, _GroupName, _freq, _nomessage, _playername)
|
||||
self:T(self.lid .. " _InitSARForPilot")
|
||||
local _leader = _downedGroup:GetUnit(1)
|
||||
local _groupName = _GroupName
|
||||
@@ -1247,7 +1249,7 @@ function CSAR:_InitSARForPilot(_downedGroup, _GroupName, _freq, _nomessage)
|
||||
end
|
||||
|
||||
-- trigger FSM event
|
||||
self:__PilotDown(2,_downedGroup, _freqk, _groupName, _coordinatesText)
|
||||
self:__PilotDown(2,_downedGroup, _freqk, _groupName, _coordinatesText, _playername)
|
||||
|
||||
return self
|
||||
end
|
||||
@@ -1923,7 +1925,7 @@ function CSAR:_DisplayToAllSAR(_message, _side, _messagetime)
|
||||
local messagetime = _messagetime or self.messageTime
|
||||
if self.msrs then
|
||||
local voice = self.CSARVoice or MSRS.Voices.Google.Standard.en_GB_Standard_F
|
||||
if self.msrs.google == nil then
|
||||
if self.msrs:GetProvider() == MSRS.Provider.WINDOWS then
|
||||
voice = self.CSARVoiceMS or MSRS.Voices.Microsoft.Hedda
|
||||
end
|
||||
self:I("Voice = "..voice)
|
||||
@@ -2310,7 +2312,8 @@ function CSAR:onafterStart(From, Event, To)
|
||||
self.msrs:SetVoice(self.SRSVoice)
|
||||
self.msrs:SetGender(self.SRSGender)
|
||||
if self.SRSGPathToCredentials then
|
||||
self.msrs:SetGoogle(self.SRSGPathToCredentials)
|
||||
self.msrs:SetProviderOptionsGoogle(self.SRSGPathToCredentials,self.SRSGPathToCredentials)
|
||||
self.msrs:SetProvider(MSRS.Provider.GOOGLE)
|
||||
end
|
||||
self.msrs:SetVolume(self.SRSVolume)
|
||||
self.msrs:SetLabel("CSAR")
|
||||
@@ -2542,8 +2545,9 @@ end
|
||||
-- @param #number Frequency Beacon frequency in kHz.
|
||||
-- @param #string Leadername Name of the #UNIT of the downed pilot.
|
||||
-- @param #string CoordinatesText String of the position of the pilot. Format determined by self.coordtype.
|
||||
function CSAR:onbeforePilotDown(From, Event, To, Group, Frequency, Leadername, CoordinatesText)
|
||||
self:T({From, Event, To, Group, Frequency, Leadername, CoordinatesText})
|
||||
-- @param #string Playername Player name if any given. Might be nil!
|
||||
function CSAR:onbeforePilotDown(From, Event, To, Group, Frequency, Leadername, CoordinatesText, Playername)
|
||||
self:T({From, Event, To, Group, Frequency, Leadername, CoordinatesText, tostring(Playername)})
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
--
|
||||
-- ## Missions:
|
||||
--
|
||||
-- ### [CTLD - Combat Troop & Logistics Deployment](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/OPS%20-%20CTLD)
|
||||
-- ### [CTLD - Combat Troop & Logistics Deployment](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/Ops/CTLD)
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
@@ -24,7 +24,7 @@
|
||||
-- @module Ops.CTLD
|
||||
-- @image OPS_CTLD.jpg
|
||||
|
||||
-- Last Update November 2023
|
||||
-- Last Update December 2023
|
||||
|
||||
do
|
||||
|
||||
@@ -1228,7 +1228,7 @@ CTLD.UnitTypeCapabilities = {
|
||||
|
||||
--- CTLD class version.
|
||||
-- @field #string version
|
||||
CTLD.version="1.0.43"
|
||||
CTLD.version="1.0.45"
|
||||
|
||||
--- Instantiate a new CTLD.
|
||||
-- @param #CTLD self
|
||||
@@ -1443,6 +1443,7 @@ function CTLD:New(Coalition, Prefixes, Alias)
|
||||
-- @param #number delay Delay in seconds.
|
||||
|
||||
--- Triggers the FSM event "Stop". Stops the CTLD and all its event handlers.
|
||||
-- @function [parent=#CTLD] Stop
|
||||
-- @param #CTLD self
|
||||
|
||||
--- Triggers the FSM event "Stop" after a delay. Stops the CTLD and all its event handlers.
|
||||
@@ -1743,7 +1744,7 @@ end
|
||||
function CTLD:_GenerateUHFrequencies()
|
||||
self:T(self.lid .. " _GenerateUHFrequencies")
|
||||
self.FreeUHFFrequencies = {}
|
||||
self.FreeUHFFrequencies = UTILS.GenerateUHFrequencies()
|
||||
self.FreeUHFFrequencies = UTILS.GenerateUHFrequencies(243,320)
|
||||
return self
|
||||
end
|
||||
|
||||
@@ -2455,10 +2456,12 @@ function CTLD:_GetCrates(Group, Unit, Cargo, number, drop, pack)
|
||||
table.insert(droppedcargo,realcargo)
|
||||
else
|
||||
realcargo = CTLD_CARGO:New(self.CargoCounter,cratename,templ,sorte,false,false,cratesneeded,self.Spawned_Crates[self.CrateCounter],false,cargotype.PerCrateMass,nil,subcat)
|
||||
Cargo:RemoveStock()
|
||||
end
|
||||
table.insert(self.Spawned_Cargo, realcargo)
|
||||
end
|
||||
if not (drop or pack) then
|
||||
Cargo:RemoveStock()
|
||||
end
|
||||
local text = string.format("Crates for %s have been positioned near you!",cratename)
|
||||
if drop then
|
||||
text = string.format("Crates for %s have been dropped!",cratename)
|
||||
@@ -3010,6 +3013,35 @@ function CTLD:IsHercules(Unit)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--- (Internal) Function to set troops positions of a template to a nice circle
|
||||
-- @param #CTLD self
|
||||
-- @param Core.Point#COORDINATE Coordinate Start coordinate to use
|
||||
-- @param #number Radius Radius to be used
|
||||
-- @param #number Heading Heading starting with
|
||||
-- @param #string Template The group template name
|
||||
-- @return #table Positions The positions table
|
||||
function CTLD:_GetUnitPositions(Coordinate,Radius,Heading,Template)
|
||||
local Positions = {}
|
||||
local template = _DATABASE:GetGroupTemplate(Template)
|
||||
UTILS.PrintTableToLog(template)
|
||||
local numbertroops = #template.units
|
||||
local newcenter = Coordinate:Translate(Radius,((Heading+270)%360))
|
||||
for i=1,360,math.floor(360/numbertroops) do
|
||||
local phead = ((Heading+270+i)%360)
|
||||
local post = newcenter:Translate(Radius,phead)
|
||||
local pos1 = post:GetVec2()
|
||||
local p1t = {
|
||||
x = pos1.x,
|
||||
y = pos1.y,
|
||||
heading = phead,
|
||||
}
|
||||
table.insert(Positions,p1t)
|
||||
end
|
||||
UTILS.PrintTableToLog(Positions)
|
||||
return Positions
|
||||
end
|
||||
|
||||
--- (Internal) Function to unload troops from heli.
|
||||
-- @param #CTLD self
|
||||
-- @param Wrapper.Group#GROUP Group
|
||||
@@ -3061,14 +3093,29 @@ function CTLD:_UnloadTroops(Group, Unit)
|
||||
zoneradius = Unit:GetVelocityMPS() or 100
|
||||
end
|
||||
local zone = ZONE_GROUP:New(string.format("Unload zone-%s",unitname),Group,zoneradius*factor)
|
||||
local randomcoord = zone:GetRandomCoordinate(10,30*factor):GetVec2()
|
||||
local randomcoord = zone:GetRandomCoordinate(10,30*factor) --:GetVec2()
|
||||
local heading = Group:GetHeading() or 0
|
||||
-- Spawn troops left from us, closer when hovering, further off when landed
|
||||
if hoverunload or grounded then
|
||||
randomcoord = Group:GetCoordinate()
|
||||
-- slightly left from us
|
||||
local Angle = (heading+270)%360
|
||||
local offset = hoverunload and 1.5 or 5
|
||||
randomcoord:Translate(offset,Angle,nil,true)
|
||||
end
|
||||
local tempcount = 0
|
||||
for _,_template in pairs(temptable) do
|
||||
self.TroopCounter = self.TroopCounter + 1
|
||||
tempcount = tempcount+1
|
||||
local alias = string.format("%s-%d", _template, math.random(1,100000))
|
||||
local rad = 2.5+tempcount
|
||||
local Positions = self:_GetUnitPositions(randomcoord,rad,heading,_template)
|
||||
self.DroppedTroops[self.TroopCounter] = SPAWN:NewWithAlias(_template,alias)
|
||||
:InitRandomizeUnits(true,20,2)
|
||||
--:InitRandomizeUnits(true,20,2)
|
||||
--:InitHeading(heading)
|
||||
:InitDelayOff()
|
||||
:SpawnFromVec2(randomcoord)
|
||||
:InitSetUnitAbsolutePositions(Positions)
|
||||
:SpawnFromVec2(randomcoord:GetVec2())
|
||||
self:__TroopsDeployed(1, Group, Unit, self.DroppedTroops[self.TroopCounter],type)
|
||||
end -- template loop
|
||||
cargo:SetWasDropped(true)
|
||||
@@ -3671,6 +3718,7 @@ function CTLD:_RefreshF10Menus()
|
||||
local loadmenu = MENU_GROUP_COMMAND:New(_group,"Load crates",topcrates, self._LoadCratesNearby, self, _group, _unit)
|
||||
local cratesmenu = MENU_GROUP:New(_group,"Get Crates",topcrates)
|
||||
local packmenu = MENU_GROUP_COMMAND:New(_group, "Pack crates", topcrates, self._PackCratesNearby, self, _group, _unit)
|
||||
local removecratesmenu = MENU_GROUP:New(_group, "Remove crates", topcrates)
|
||||
|
||||
if self.usesubcats then
|
||||
local subcatmenus = {}
|
||||
@@ -3706,7 +3754,7 @@ function CTLD:_RefreshF10Menus()
|
||||
end
|
||||
end
|
||||
listmenu = MENU_GROUP_COMMAND:New(_group,"List crates nearby",topcrates, self._ListCratesNearby, self, _group, _unit)
|
||||
listmenu = MENU_GROUP_COMMAND:New(_group,"Remove crates nearby",topcrates, self._RemoveCratesNearby, self, _group, _unit)
|
||||
removecrates = MENU_GROUP_COMMAND:New(_group,"Remove crates nearby",removecratesmenu, self._RemoveCratesNearby, self, _group, _unit)
|
||||
local unloadmenu = MENU_GROUP_COMMAND:New(_group,"Drop crates",topcrates, self._UnloadCrates, self, _group, _unit)
|
||||
if not self.nobuildmenu then
|
||||
local buildmenu = MENU_GROUP_COMMAND:New(_group,"Build crates",topcrates, self._BuildCrates, self, _group, _unit)
|
||||
@@ -3779,7 +3827,7 @@ end
|
||||
-- @param #CTLD_CARGO.Enum Type Type of cargo. I.e. VEHICLE or FOB. VEHICLE will move to destination zones when dropped/build, FOB stays put.
|
||||
-- @param #number NoCrates Number of crates needed to build this cargo.
|
||||
-- @param #number PerCrateMass Mass in kg of each crate
|
||||
-- @param #number Stock Number of groups in stock. Nil for unlimited.
|
||||
-- @param #number Stock Number of buildable groups in stock. Nil for unlimited.
|
||||
-- @param #string SubCategory Name of sub-category (optional).
|
||||
function CTLD:AddCratesCargo(Name,Templates,Type,NoCrates,PerCrateMass,Stock,SubCategory)
|
||||
self:T(self.lid .. " AddCratesCargo")
|
||||
|
||||
@@ -183,8 +183,10 @@ end
|
||||
-- @param #number Port SRS port. Default 5002.
|
||||
-- @return #RADIOQUEUE self The RADIOQUEUE object.
|
||||
function RADIOQUEUE:SetSRS(PathToSRS, Port)
|
||||
self.msrs=MSRS:New(PathToSRS, self.frequency/1000000, self.modulation)
|
||||
self.msrs:SetPort(Port)
|
||||
local path = PathToSRS or MSRS.path
|
||||
local port = Port or MSRS.port
|
||||
self.msrs=MSRS:New(path, self.frequency/1000000, self.modulation)
|
||||
self.msrs:SetPort(port)
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -160,24 +160,28 @@ do -- Sound File
|
||||
-- @param #string FileName The name of the sound file, e.g. "Hello World.ogg".
|
||||
-- @param #string Path The path of the directory, where the sound file is located. Default is "l10n/DEFAULT/" within the miz file.
|
||||
-- @param #number Duration Duration in seconds, how long it takes to play the sound file. Default is 3 seconds.
|
||||
-- @param #bolean UseSrs Set if SRS should be used to play this file. Default is false.
|
||||
-- @return #SOUNDFILE self
|
||||
function SOUNDFILE:New(FileName, Path, Duration)
|
||||
function SOUNDFILE:New(FileName, Path, Duration, UseSrs)
|
||||
|
||||
-- Inherit BASE.
|
||||
local self=BASE:Inherit(self, BASE:New()) -- #SOUNDFILE
|
||||
|
||||
-- Debug info:
|
||||
self:F( {FileName, Path, Duration, UseSrs} )
|
||||
|
||||
-- Set file name.
|
||||
self:SetFileName(FileName)
|
||||
|
||||
-- Set if SRS should be used to play this file
|
||||
self:SetPlayWithSRS(UseSrs or false)
|
||||
|
||||
-- Set path.
|
||||
self:SetPath(Path)
|
||||
|
||||
-- Set duration.
|
||||
self:SetDuration(Duration)
|
||||
|
||||
-- Debug info:
|
||||
self:T(string.format("New SOUNDFILE: file name=%s, path=%s", self.filename, self.path))
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
@@ -186,12 +190,17 @@ do -- Sound File
|
||||
-- @param #string Path Path to the directory, where the sound file is located. In case this is nil, it defaults to the DCS mission temp directory.
|
||||
-- @return #SOUNDFILE self
|
||||
function SOUNDFILE:SetPath(Path)
|
||||
self:F( {Path} )
|
||||
|
||||
-- Init path.
|
||||
self.path=Path or "l10n/DEFAULT/"
|
||||
|
||||
if not Path and self.useSRS then -- use path to mission temp dir
|
||||
self.path = os.getenv('TMP') .. "\\DCS\\Mission\\l10n\\DEFAULT"
|
||||
if not Path then
|
||||
if self.useSRS then -- use path to mission temp dir
|
||||
self.path = lfs.tempdir() .. "Mission\\l10n\\DEFAULT"
|
||||
else -- use internal path in miz file
|
||||
self.path="l10n/DEFAULT/"
|
||||
end
|
||||
else
|
||||
self.path = Path
|
||||
end
|
||||
|
||||
-- Remove (back)slashes.
|
||||
@@ -204,6 +213,8 @@ do -- Sound File
|
||||
-- Append slash.
|
||||
self.path=self.path.."/"
|
||||
|
||||
self:T("self.path=".. self.path)
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
@@ -264,11 +275,13 @@ do -- Sound File
|
||||
-- @param #boolean Switch If true or nil, use SRS. If false, use DCS transmission.
|
||||
-- @return #SOUNDFILE self
|
||||
function SOUNDFILE:SetPlayWithSRS(Switch)
|
||||
self:F( {Switch} )
|
||||
if Switch==true or Switch==nil then
|
||||
self.useSRS=true
|
||||
else
|
||||
self.useSRS=false
|
||||
end
|
||||
self:T("self.useSRS=".. tostring(self.useSRS))
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
@@ -137,7 +137,7 @@ do -- UserSound
|
||||
return self
|
||||
end
|
||||
|
||||
--- Play the usersound to the given @{Wrapper.Unit}.
|
||||
--- Play the usersound to the given @{Wrapper.Unit}.
|
||||
-- @param #USERSOUND self
|
||||
-- @param Wrapper.Unit#UNIT Unit The @{Wrapper.Unit} to play the usersound to.
|
||||
-- @param #number Delay (Optional) Delay in seconds, before the sound is played. Default 0.
|
||||
@@ -159,4 +159,24 @@ do -- UserSound
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Play the usersound to the given @{Wrapper.Client}.
|
||||
-- @param #USERSOUND self
|
||||
-- @param Wrapper.Client#CLIENT The @{Wrapper.Client} to play the usersound to.
|
||||
-- @param #number Delay (Optional) Delay in seconds, before the sound is played. Default 0.
|
||||
-- @return #USERSOUND The usersound instance.
|
||||
-- @usage
|
||||
-- local BlueVictory = USERSOUND:New( "BlueVictory.ogg" )
|
||||
-- local PlayerUnit = CLIENT:FindByPlayerName("Karl Heinz")-- Search for the active client with playername "Karl Heinz", a human player.
|
||||
-- BlueVictory:ToClient( PlayerUnit ) -- Play the victory sound to the player unit.
|
||||
--
|
||||
function USERSOUND:ToClient( Client, Delay )
|
||||
Delay=Delay or 0
|
||||
if Delay>0 then
|
||||
SCHEDULER:New(nil, USERSOUND.ToClient,{self, Client}, Delay)
|
||||
else
|
||||
trigger.action.outSoundForUnit( Client:GetID(), self.UserSoundFileName )
|
||||
end
|
||||
return self
|
||||
end
|
||||
end
|
||||
@@ -14,7 +14,7 @@
|
||||
--
|
||||
-- Test missions can be located on the main GITHUB site.
|
||||
--
|
||||
-- [FlightControl-Master/MOOSE_MISSIONS/TAD - Task Dispatching/CGO - Cargo Dispatching/](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/TAD%20-%20Task%20Dispatching/CGO%20-%20Cargo%20Task%20Dispatching)
|
||||
-- [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Tasking/Task_Cargo_Dispatcher)
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
|
||||
@@ -523,6 +523,7 @@ ENUMS.ReportingName =
|
||||
Hawkeye = "E-2D",
|
||||
Sentry = "E-3A",
|
||||
Stratotanker = "KC-135",
|
||||
Gasstation = "KC-135MPRS",
|
||||
Extender = "KC-10",
|
||||
Orion = "P-3C",
|
||||
Viking = "S-3B",
|
||||
|
||||
@@ -443,22 +443,35 @@ end
|
||||
|
||||
--- Print a table to log in a nice format
|
||||
-- @param #table table The table to print
|
||||
-- @param #number indent Number of idents
|
||||
-- @param #number indent Number of indents
|
||||
-- @return #string text Text created on the fly of the log output
|
||||
function UTILS.PrintTableToLog(table, indent)
|
||||
local text = "\n"
|
||||
if not table then
|
||||
env.warning("No table passed!")
|
||||
return
|
||||
return nil
|
||||
end
|
||||
if not indent then indent = 0 end
|
||||
for k, v in pairs(table) do
|
||||
if string.find(k," ") then k='"'..k..'"'end
|
||||
if type(v) == "table" then
|
||||
env.info(string.rep(" ", indent) .. tostring(k) .. " = {")
|
||||
UTILS.PrintTableToLog(v, indent + 1)
|
||||
env.info(string.rep(" ", indent) .. "}")
|
||||
text = text ..string.rep(" ", indent) .. tostring(k) .. " = {\n"
|
||||
text = text .. tostring(UTILS.PrintTableToLog(v, indent + 1)).."\n"
|
||||
env.info(string.rep(" ", indent) .. "},")
|
||||
text = text .. string.rep(" ", indent) .. "},\n"
|
||||
else
|
||||
env.info(string.rep(" ", indent) .. tostring(k) .. " = " .. tostring(v))
|
||||
local value
|
||||
if tostring(v) == "true" or tostring(v) == "false" or tonumber(v) ~= nil then
|
||||
value=v
|
||||
else
|
||||
value = '"'..tostring(v)..'"'
|
||||
end
|
||||
env.info(string.rep(" ", indent) .. tostring(k) .. " = " .. tostring(value)..",\n")
|
||||
text = text .. string.rep(" ", indent) .. tostring(k) .. " = " .. tostring(value)..",\n"
|
||||
end
|
||||
end
|
||||
return text
|
||||
end
|
||||
|
||||
--- Returns table in a easy readable string representation.
|
||||
@@ -1051,9 +1064,9 @@ function UTILS.BeaufortScale(speed)
|
||||
return bn,bd
|
||||
end
|
||||
|
||||
--- Split string at seperators. C.f. [split-string-in-lua](http://stackoverflow.com/questions/1426954/split-string-in-lua).
|
||||
--- Split string at separators. C.f. [split-string-in-lua](http://stackoverflow.com/questions/1426954/split-string-in-lua).
|
||||
-- @param #string str Sting to split.
|
||||
-- @param #string sep Speparator for split.
|
||||
-- @param #string sep Separator for split.
|
||||
-- @return #table Split text.
|
||||
function UTILS.Split(str, sep)
|
||||
local result = {}
|
||||
@@ -2133,17 +2146,17 @@ function UTILS.IsLoadingDoorOpen( unit_name )
|
||||
return true
|
||||
end
|
||||
|
||||
if string.find(type_name, "Bell-47") then -- bell aint got no doors so always ready to load injured soldiers
|
||||
if type_name == "Bell-47" then -- bell aint got no doors so always ready to load injured soldiers
|
||||
BASE:T(unit_name .. " door is open")
|
||||
return true
|
||||
end
|
||||
|
||||
if string.find(type_name, "UH-60L") and (unit:getDrawArgumentValue(401) == 1 or unit:getDrawArgumentValue(402) == 1) then
|
||||
if type_name == "UH-60L" and (unit:getDrawArgumentValue(401) == 1 or unit:getDrawArgumentValue(402) == 1) then
|
||||
BASE:T(unit_name .. " cargo door is open")
|
||||
return true
|
||||
end
|
||||
|
||||
if string.find(type_name, "UH-60L" ) and (unit:getDrawArgumentValue(38) == 1 or unit:getDrawArgumentValue(400) == 1 ) then
|
||||
if type_name == "UH-60L" and (unit:getDrawArgumentValue(38) > 0 or unit:getDrawArgumentValue(400) == 1 ) then
|
||||
BASE:T(unit_name .. " front door(s) are open")
|
||||
return true
|
||||
end
|
||||
@@ -2258,20 +2271,37 @@ function UTILS.GenerateVHFrequencies()
|
||||
return FreeVHFFrequencies
|
||||
end
|
||||
|
||||
--- Function to generate valid UHF Frequencies in mHz (AM).
|
||||
--- Function to generate valid UHF Frequencies in mHz (AM). Can be between 220 and 399 mHz. 243 is auto-excluded.
|
||||
-- @param Start (Optional) Avoid frequencies between Start and End in mHz, e.g. 244
|
||||
-- @param End (Optional) Avoid frequencies between Start and End in mHz, e.g. 320
|
||||
-- @return #table UHF Frequencies
|
||||
function UTILS.GenerateUHFrequencies()
|
||||
function UTILS.GenerateUHFrequencies(Start,End)
|
||||
|
||||
local FreeUHFFrequencies = {}
|
||||
local _start = 220000000
|
||||
|
||||
while _start < 399000000 do
|
||||
if _start ~= 243000000 then
|
||||
table.insert(FreeUHFFrequencies, _start)
|
||||
end
|
||||
_start = _start + 500000
|
||||
if not Start then
|
||||
while _start < 399000000 do
|
||||
if _start ~= 243000000 then
|
||||
table.insert(FreeUHFFrequencies, _start)
|
||||
end
|
||||
_start = _start + 500000
|
||||
end
|
||||
else
|
||||
local myend = End*1000000 or 399000000
|
||||
local mystart = Start*1000000 or 220000000
|
||||
|
||||
while _start < 399000000 do
|
||||
if _start ~= 243000000 and (_start < mystart or _start > myend) then
|
||||
print(_start)
|
||||
table.insert(FreeUHFFrequencies, _start)
|
||||
end
|
||||
_start = _start + 500000
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
return FreeUHFFrequencies
|
||||
end
|
||||
|
||||
|
||||
@@ -1900,7 +1900,16 @@ function AIRBASE:_InitRunways(IncludeInverse)
|
||||
|
||||
-- Data table.
|
||||
local runway={} --#AIRBASE.Runway
|
||||
runway.name=string.format("%02d", tonumber(name))
|
||||
|
||||
local namefromheading = math.floor(heading/10)
|
||||
|
||||
if self.AirbaseName == AIRBASE.Syria.Beirut_Rafic_Hariri and math.abs(namefromheading-name) > 1 then
|
||||
runway.name=string.format("%02d", tonumber(namefromheading))
|
||||
else
|
||||
runway.name=string.format("%02d", tonumber(name))
|
||||
end
|
||||
|
||||
--runway.name=string.format("%02d", tonumber(name))
|
||||
runway.magheading=tonumber(runway.name)*10
|
||||
runway.heading=heading
|
||||
runway.width=width or 0
|
||||
|
||||
@@ -99,7 +99,7 @@
|
||||
-- This method can also be used to **embed a function call when a certain waypoint has been reached**.
|
||||
-- See below the **Tasks at Waypoints** section.
|
||||
--
|
||||
-- Demonstration Mission: [GRP-502 - Route at waypoint to random point](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/GRP%20-%20Group%20Commands/GRP-502%20-%20Route%20at%20waypoint%20to%20random%20point)
|
||||
-- Demonstration Mission: [GRP-502 - Route at waypoint to random point](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/Wrapper/Group/GRP-502%20-%20Route%20at%20waypoint%20to%20random%20point)
|
||||
--
|
||||
-- ## 2.5) Tasks at Waypoints
|
||||
--
|
||||
@@ -938,20 +938,22 @@ end
|
||||
-- @param #CONTROLLABLE self
|
||||
-- @param #number Frequency Radio frequency in MHz.
|
||||
-- @param #number Modulation Radio modulation. Default `radio.modulation.AM`.
|
||||
-- @param #number Power (Optional) Power of the Radio in Watts. Defaults to 10.
|
||||
-- @param #number Delay (Optional) Delay in seconds before the frequency is set. Default is immediately.
|
||||
-- @return #CONTROLLABLE self
|
||||
function CONTROLLABLE:CommandSetFrequency( Frequency, Modulation, Delay )
|
||||
function CONTROLLABLE:CommandSetFrequency( Frequency, Modulation, Power, Delay )
|
||||
|
||||
local CommandSetFrequency = {
|
||||
id = 'SetFrequency',
|
||||
params = {
|
||||
frequency = Frequency * 1000000,
|
||||
modulation = Modulation or radio.modulation.AM,
|
||||
power=Power or 10,
|
||||
},
|
||||
}
|
||||
|
||||
if Delay and Delay > 0 then
|
||||
SCHEDULER:New( nil, self.CommandSetFrequency, { self, Frequency, Modulation }, Delay )
|
||||
SCHEDULER:New( nil, self.CommandSetFrequency, { self, Frequency, Modulation, Power } )
|
||||
else
|
||||
self:SetCommand( CommandSetFrequency )
|
||||
end
|
||||
@@ -959,6 +961,32 @@ function CONTROLLABLE:CommandSetFrequency( Frequency, Modulation, Delay )
|
||||
return self
|
||||
end
|
||||
|
||||
--- [AIR] Set radio frequency. See [DCS command EPLRS](https://wiki.hoggitworld.com/view/DCS_command_setFrequencyForUnit)
|
||||
-- @param #CONTROLLABLE self
|
||||
-- @param #number Frequency Radio frequency in MHz.
|
||||
-- @param #number Modulation Radio modulation. Default `radio.modulation.AM`.
|
||||
-- @param #number Power (Optional) Power of the Radio in Watts. Defaults to 10.
|
||||
-- @param #UnitID UnitID (Optional, if your object is a UNIT) The UNIT ID this is for.
|
||||
-- @param #number Delay (Optional) Delay in seconds before the frequency is set. Default is immediately.
|
||||
-- @return #CONTROLLABLE self
|
||||
function CONTROLLABLE:CommandSetFrequencyForUnit(Frequency,Modulation,Power,UnitID,Delay)
|
||||
local CommandSetFrequencyForUnit={
|
||||
id='SetFrequencyForUnit',
|
||||
params={
|
||||
frequency=Frequency*1000000,
|
||||
modulation=Modulation or radio.modulation.AM,
|
||||
unitId=UnitID or self:GetID(),
|
||||
power=Power or 10,
|
||||
},
|
||||
}
|
||||
if Delay and Delay>0 then
|
||||
SCHEDULER:New(nil,self.CommandSetFrequencyForUnit,{self,Frequency,Modulation,Power,UnitID})
|
||||
else
|
||||
self:SetCommand(CommandSetFrequencyForUnit)
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
--- Set EPLRS data link on/off.
|
||||
-- @param #CONTROLLABLE self
|
||||
-- @param #boolean SwitchOnOff If true (or nil) switch EPLRS on. If false switch off.
|
||||
@@ -2937,7 +2965,7 @@ function CONTROLLABLE:CopyRoute( Begin, End, Randomize, Radius )
|
||||
end
|
||||
|
||||
--- Return the detected targets of the controllable.
|
||||
-- The optional parametes specify the detection methods that can be applied.
|
||||
-- The optional parameters specify the detection methods that can be applied.
|
||||
-- If no detection method is given, the detection will use all the available methods by default.
|
||||
-- @param #CONTROLLABLE self
|
||||
-- @param #boolean DetectVisual (optional)
|
||||
@@ -3772,54 +3800,66 @@ function CONTROLLABLE:OptionProhibitAfterburner( Prohibit )
|
||||
return self
|
||||
end
|
||||
|
||||
--- Defines the usage of Electronic Counter Measures by airborne forces. Disables the ability for AI to use their ECM.
|
||||
--- [Air] Defines the usage of Electronic Counter Measures by airborne forces.
|
||||
-- @param #CONTROLLABLE self
|
||||
-- @param #number ECMvalue Can be - 0=Never on, 1=if locked by radar, 2=if detected by radar, 3=always on, defaults to 1
|
||||
-- @return #CONTROLLABLE self
|
||||
function CONTROLLABLE:OptionECM( ECMvalue )
|
||||
self:F2( { self.ControllableName } )
|
||||
|
||||
local DCSControllable = self:GetDCSObject()
|
||||
if DCSControllable then
|
||||
local Controller = self:_GetController()
|
||||
|
||||
if self:IsAir() then
|
||||
Controller:setOption( AI.Option.Air.id.ECM_USING, ECMvalue or 1 )
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- [Air] Defines the usage of Electronic Counter Measures by airborne forces. Disables the ability for AI to use their ECM.
|
||||
-- @param #CONTROLLABLE self
|
||||
-- @return #CONTROLLABLE self
|
||||
function CONTROLLABLE:OptionECM_Never()
|
||||
self:F2( { self.ControllableName } )
|
||||
|
||||
if self:IsAir() then
|
||||
self:SetOption( AI.Option.Air.id.ECM_USING, 0 )
|
||||
end
|
||||
self:OptionECM(0)
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Defines the usage of Electronic Counter Measures by airborne forces. If the AI is actively being locked by an enemy radar they will enable their ECM jammer.
|
||||
--- [Air] Defines the usage of Electronic Counter Measures by airborne forces. If the AI is actively being locked by an enemy radar they will enable their ECM jammer.
|
||||
-- @param #CONTROLLABLE self
|
||||
-- @return #CONTROLLABLE self
|
||||
function CONTROLLABLE:OptionECM_OnlyLockByRadar()
|
||||
self:F2( { self.ControllableName } )
|
||||
|
||||
if self:IsAir() then
|
||||
self:SetOption( AI.Option.Air.id.ECM_USING, 1 )
|
||||
end
|
||||
self:OptionECM(1)
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Defines the usage of Electronic Counter Measures by airborne forces. If the AI is being detected by a radar they will enable their ECM.
|
||||
--- [Air] Defines the usage of Electronic Counter Measures by airborne forces. If the AI is being detected by a radar they will enable their ECM.
|
||||
-- @param #CONTROLLABLE self
|
||||
-- @return #CONTROLLABLE self
|
||||
function CONTROLLABLE:OptionECM_DetectedLockByRadar()
|
||||
self:F2( { self.ControllableName } )
|
||||
|
||||
if self:IsAir() then
|
||||
self:SetOption( AI.Option.Air.id.ECM_USING, 2 )
|
||||
end
|
||||
self:OptionECM(2)
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Defines the usage of Electronic Counter Measures by airborne forces. AI will leave their ECM on all the time.
|
||||
--- [Air] Defines the usage of Electronic Counter Measures by airborne forces. AI will leave their ECM on all the time.
|
||||
-- @param #CONTROLLABLE self
|
||||
-- @return #CONTROLLABLE self
|
||||
function CONTROLLABLE:OptionECM_AlwaysOn()
|
||||
self:F2( { self.ControllableName } )
|
||||
|
||||
if self:IsAir() then
|
||||
self:SetOption( AI.Option.Air.id.ECM_USING, 3 )
|
||||
end
|
||||
self:OptionECM(3)
|
||||
|
||||
return self
|
||||
end
|
||||
@@ -4006,6 +4046,62 @@ function CONTROLLABLE:OptionEngageRange( EngageRange )
|
||||
return nil
|
||||
end
|
||||
|
||||
--- [AIR] Set how the AI uses the onboard radar.
|
||||
-- @param #CONTROLLABLE self
|
||||
-- @param #number Option Options are: `NEVER = 0, FOR_ATTACK_ONLY = 1,FOR_SEARCH_IF_REQUIRED = 2, FOR_CONTINUOUS_SEARCH = 3`
|
||||
-- @return #CONTROLLABLE self
|
||||
function CONTROLLABLE:SetOptionRadarUsing(Option)
|
||||
self:F2( { self.ControllableName } )
|
||||
if self:IsAir() then
|
||||
self:SetOption(AI.Option.Air.id.RADAR_USING,Option)
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
--- [AIR] Set how the AI uses the onboard radar. Here: never.
|
||||
-- @param #CONTROLLABLE self
|
||||
-- @return #CONTROLLABLE self
|
||||
function CONTROLLABLE:SetOptionRadarUsingNever()
|
||||
self:F2( { self.ControllableName } )
|
||||
if self:IsAir() then
|
||||
self:SetOption(AI.Option.Air.id.RADAR_USING,0)
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
--- [AIR] Set how the AI uses the onboard radar, here: for attack only.
|
||||
-- @param #CONTROLLABLE self
|
||||
-- @return #CONTROLLABLE self
|
||||
function CONTROLLABLE:SetOptionRadarUsingForAttackOnly()
|
||||
self:F2( { self.ControllableName } )
|
||||
if self:IsAir() then
|
||||
self:SetOption(AI.Option.Air.id.RADAR_USING,1)
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
--- [AIR] Set how the AI uses the onboard radar, here: when required for searching.
|
||||
-- @param #CONTROLLABLE self
|
||||
-- @return #CONTROLLABLE self
|
||||
function CONTROLLABLE:SetOptionRadarUsingForSearchIfRequired()
|
||||
self:F2( { self.ControllableName } )
|
||||
if self:IsAir() then
|
||||
self:SetOption(AI.Option.Air.id.RADAR_USING,2)
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
--- [AIR] Set how the AI uses the onboard radar, here: always on.
|
||||
-- @param #CONTROLLABLE self
|
||||
-- @return #CONTROLLABLE self
|
||||
function CONTROLLABLE:SetOptionRadarUsingForContinousSearch()
|
||||
self:F2( { self.ControllableName } )
|
||||
if self:IsAir() then
|
||||
self:SetOption(AI.Option.Air.id.RADAR_USING,3)
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
--- (GROUND) Relocate controllable to a random point within a given radius; use e.g.for evasive actions; Note that not all ground controllables can actually drive, also the alarm state of the controllable might stop it from moving.
|
||||
-- @param #CONTROLLABLE self
|
||||
-- @param #number speed Speed of the controllable, default 20
|
||||
@@ -4013,14 +4109,22 @@ end
|
||||
-- @param #boolean onroad If true, route on road (less problems with AI way finding), default true
|
||||
-- @param #boolean shortcut If true and onroad is set, take a shorter route - if available - off road, default false
|
||||
-- @param #string formation Formation string as in the mission editor, e.g. "Vee", "Diamond", "Line abreast", etc. Defaults to "Off Road"
|
||||
-- @param #boolean onland (optional) If true, try up to 50 times to get a coordinate on land.SurfaceType.LAND. Note - this descriptor value is not reliably implemented on all maps.
|
||||
-- @return #CONTROLLABLE self
|
||||
function CONTROLLABLE:RelocateGroundRandomInRadius( speed, radius, onroad, shortcut, formation )
|
||||
function CONTROLLABLE:RelocateGroundRandomInRadius( speed, radius, onroad, shortcut, formation, onland )
|
||||
self:F2( { self.ControllableName } )
|
||||
|
||||
local _coord = self:GetCoordinate()
|
||||
local _radius = radius or 500
|
||||
local _speed = speed or 20
|
||||
local _tocoord = _coord:GetRandomCoordinateInRadius( _radius, 100 )
|
||||
if onland then
|
||||
for i=1,50 do
|
||||
local island = _tocoord:GetSurfaceType() == land.SurfaceType.LAND and true or false
|
||||
if island then break end
|
||||
_tocoord = _coord:GetRandomCoordinateInRadius( _radius, 100 )
|
||||
end
|
||||
end
|
||||
local _onroad = onroad or true
|
||||
local _grptsk = {}
|
||||
local _candoroad = false
|
||||
@@ -5337,9 +5441,10 @@ end
|
||||
-- @param #number Altitude (Optional) Altitude in meters. Defaults to the altitude of the coordinate.
|
||||
-- @param #number Speed (Optional) Speed in kph. Defaults to 500 kph.
|
||||
-- @param #number Formation (Optional) Formation to take, e.g. ENUMS.Formation.FixedWing.Trail.Close, also see [Hoggit Wiki](https://wiki.hoggitworld.com/view/DCS_option_formation).
|
||||
-- @param #boolean AGL (Optional) If true, set altitude to above ground level (AGL), not above sea level (ASL).
|
||||
-- @param #number Delay (Optional) Set the task after delay seconds only.
|
||||
-- @return #CONTROLLABLE self
|
||||
function CONTROLLABLE:PatrolRaceTrack(Point1, Point2, Altitude, Speed, Formation, Delay)
|
||||
function CONTROLLABLE:PatrolRaceTrack(Point1, Point2, Altitude, Speed, Formation, AGL, Delay)
|
||||
|
||||
local PatrolGroup = self -- Wrapper.Group#GROUP
|
||||
|
||||
@@ -5361,8 +5466,10 @@ function CONTROLLABLE:PatrolRaceTrack(Point1, Point2, Altitude, Speed, Formation
|
||||
|
||||
-- Calculate the new Route
|
||||
if Altitude then
|
||||
FromCoord:SetAltitude(Altitude)
|
||||
ToCoord:SetAltitude(Altitude)
|
||||
local asl = true
|
||||
if AGL then asl = false end
|
||||
FromCoord:SetAltitude(Altitude, asl)
|
||||
ToCoord:SetAltitude(Altitude, asl)
|
||||
end
|
||||
|
||||
-- Create a "air waypoint", which is a "point" structure that can be given as a parameter to a Task
|
||||
|
||||
@@ -302,7 +302,7 @@ end
|
||||
|
||||
--- Find the first(!) GROUP matching using patterns. Note that this is **a lot** slower than `:FindByName()`!
|
||||
-- @param #GROUP self
|
||||
-- @param #string Pattern The pattern to look for. Refer to [LUA patterns](http://www.easyuo.com/openeuo/wiki/index.php/Lua_Patterns_and_Captures_(Regular_Expressions)) for regular expressions in LUA.
|
||||
-- @param #string Pattern The pattern to look for. Refer to [LUA patterns](http://www.easyuo.com/openeuo/wiki/index.php/Lua_Patterns_and_Captures_\(Regular_Expressions\)) for regular expressions in LUA.
|
||||
-- @return #GROUP The GROUP.
|
||||
-- @usage
|
||||
-- -- Find a group with a partial group name
|
||||
@@ -327,7 +327,7 @@ end
|
||||
|
||||
--- Find all GROUP objects matching using patterns. Note that this is **a lot** slower than `:FindByName()`!
|
||||
-- @param #GROUP self
|
||||
-- @param #string Pattern The pattern to look for. Refer to [LUA patterns](http://www.easyuo.com/openeuo/wiki/index.php/Lua_Patterns_and_Captures_(Regular_Expressions)) for regular expressions in LUA.
|
||||
-- @param #string Pattern The pattern to look for. Refer to [LUA patterns](http://www.easyuo.com/openeuo/wiki/index.php/Lua_Patterns_and_Captures_\(Regular_Expressions\)) for regular expressions in LUA.
|
||||
-- @return #table Groups Table of matching #GROUP objects found
|
||||
-- @usage
|
||||
-- -- Find all group with a partial group name
|
||||
@@ -689,7 +689,15 @@ function GROUP:GetUnits()
|
||||
local DCSUnits = DCSGroup:getUnits() or {}
|
||||
local Units = {}
|
||||
for Index, UnitData in pairs( DCSUnits ) do
|
||||
Units[#Units+1] = UNIT:Find( UnitData )
|
||||
|
||||
local unit=UNIT:Find( UnitData )
|
||||
if unit then
|
||||
Units[#Units+1] = UNIT:Find( UnitData )
|
||||
else
|
||||
local UnitName=UnitData:getName()
|
||||
unit=_DATABASE:AddUnit(UnitName)
|
||||
Units[#Units+1]=unit
|
||||
end
|
||||
end
|
||||
self:T3( Units )
|
||||
return Units
|
||||
@@ -1157,6 +1165,7 @@ function GROUP:GetAverageCoordinate()
|
||||
local coord = COORDINATE:NewFromVec3(vec3)
|
||||
local Heading = self:GetHeading()
|
||||
coord.Heading = Heading
|
||||
return coord
|
||||
else
|
||||
BASE:E( { "Cannot GetAverageCoordinate", Group = self, Alive = self:IsAlive() } )
|
||||
return nil
|
||||
@@ -2762,7 +2771,7 @@ end
|
||||
|
||||
--- Switch on/off invisible flag for the group.
|
||||
-- @param #GROUP self
|
||||
-- @param #boolean switch If true, emission is enabled. If false, emission is disabled.
|
||||
-- @param #boolean switch If true, Invisible is enabled. If false, Invisible is disabled.
|
||||
-- @return #GROUP self
|
||||
function GROUP:SetCommandInvisible(switch)
|
||||
self:F2( self.GroupName )
|
||||
@@ -2776,7 +2785,7 @@ end
|
||||
|
||||
--- Switch on/off immortal flag for the group.
|
||||
-- @param #GROUP self
|
||||
-- @param #boolean switch If true, emission is enabled. If false, emission is disabled.
|
||||
-- @param #boolean switch If true, Immortal is enabled. If false, Immortal is disabled.
|
||||
-- @return #GROUP self
|
||||
function GROUP:SetCommandImmortal(switch)
|
||||
self:F2( self.GroupName )
|
||||
@@ -2982,3 +2991,36 @@ function GROUP:GetGroupSTN()
|
||||
return tSTN,text
|
||||
end
|
||||
|
||||
--- [GROUND] Determine if a GROUP is a SAM unit, i.e. has radar or optical tracker and is no mobile AAA.
|
||||
-- @param #GROUP self
|
||||
-- @return #boolean IsSAM True if SAM, else false
|
||||
function GROUP:IsSAM()
|
||||
local issam = false
|
||||
local units = self:GetUnits()
|
||||
for _,_unit in pairs(units or {}) do
|
||||
local unit = _unit -- Wrapper.Unit#UNIT
|
||||
if unit:HasSEAD() and unit:IsGround() and (not unit:HasAttribute("Mobile AAA")) then
|
||||
issam = true
|
||||
break
|
||||
end
|
||||
end
|
||||
return issam
|
||||
end
|
||||
|
||||
--- [GROUND] Determine if a GROUP has a AAA unit, i.e. has no radar or optical tracker but the AAA = true or the "Mobile AAA" = true attribute.
|
||||
-- @param #GROUP self
|
||||
-- @return #boolean IsSAM True if AAA, else false
|
||||
function GROUP:IsAAA()
|
||||
local issam = false
|
||||
local units = self:GetUnits()
|
||||
for _,_unit in pairs(units or {}) do
|
||||
local unit = _unit -- Wrapper.Unit#UNIT
|
||||
local desc = unit:GetDesc() or {}
|
||||
local attr = desc.attributes or {}
|
||||
if unit:HasSEAD() then return false end
|
||||
if attr["AAA"] or attr["SAM related"] then
|
||||
issam = true
|
||||
end
|
||||
end
|
||||
return issam
|
||||
end
|
||||
|
||||
@@ -164,7 +164,7 @@ end
|
||||
|
||||
--- Find the first(!) UNIT matching using patterns. Note that this is **a lot** slower than `:FindByName()`!
|
||||
-- @param #UNIT self
|
||||
-- @param #string Pattern The pattern to look for. Refer to [LUA patterns](http://www.easyuo.com/openeuo/wiki/index.php/Lua_Patterns_and_Captures_(Regular_Expressions)) for regular expressions in LUA.
|
||||
-- @param #string Pattern The pattern to look for. Refer to [LUA patterns](http://www.easyuo.com/openeuo/wiki/index.php/Lua_Patterns_and_Captures_\(Regular_Expressions\)) for regular expressions in LUA.
|
||||
-- @return #UNIT The UNIT.
|
||||
-- @usage
|
||||
-- -- Find a group with a partial group name
|
||||
@@ -189,7 +189,7 @@ end
|
||||
|
||||
--- Find all UNIT objects matching using patterns. Note that this is **a lot** slower than `:FindByName()`!
|
||||
-- @param #UNIT self
|
||||
-- @param #string Pattern The pattern to look for. Refer to [LUA patterns](http://www.easyuo.com/openeuo/wiki/index.php/Lua_Patterns_and_Captures_(Regular_Expressions)) for regular expressions in LUA.
|
||||
-- @param #string Pattern The pattern to look for. Refer to [LUA patterns](http://www.easyuo.com/openeuo/wiki/index.php/Lua_Patterns_and_Captures_\(Regular_Expressions\)) for regular expressions in LUA.
|
||||
-- @return #table Units Table of matching #UNIT objects found
|
||||
-- @usage
|
||||
-- -- Find all group with a partial group name
|
||||
|
||||
@@ -12,9 +12,11 @@
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- ## Example Missions:
|
||||
-- ## Additional Material:
|
||||
--
|
||||
-- Demo missions can be found on [github](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/WRAPPER%20-%20Weapon).
|
||||
-- * **Demo Missions:** [GitHub](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop/Wrapper/Weapon)
|
||||
-- * **YouTube videos:** None
|
||||
-- * **Guides:** None
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
|
||||
@@ -18,5 +18,7 @@ __Moose.Include = function( IncludeFile )
|
||||
end
|
||||
|
||||
__Moose.Includes = {}
|
||||
|
||||
__Moose.Include( 'Scripts/Moose/Modules.lua' )
|
||||
if not MOOSE_DEVELOPMENT_FOLDER then
|
||||
MOOSE_DEVELOPMENT_FOLDER='Scripts'
|
||||
end
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Modules.lua' )
|
||||
|
||||
@@ -1,2 +1,51 @@
|
||||
|
||||
-- Automatic dynamic loading of development files, if they exists.
|
||||
-- Try to load Moose as individual script files from <DcsInstallDir\Script\Moose
|
||||
-- which should be a Junction link to the MOOSE repository subfolder "Moose Development\Moose".
|
||||
-- This method is used by Moose developers and not mission builders.
|
||||
if not MOOSE_DEVELOPMENT_FOLDER then
|
||||
MOOSE_DEVELOPMENT_FOLDER='Scripts'
|
||||
end
|
||||
|
||||
ModuleLoader = MOOSE_DEVELOPMENT_FOLDER..'/Moose/Modules.lua'
|
||||
|
||||
if io then
|
||||
local f=io.open(ModuleLoader,"r")
|
||||
if f~=nil then
|
||||
io.close(f)
|
||||
|
||||
env.info( '*** MOOSE DYNAMIC INCLUDE START *** ' )
|
||||
|
||||
local base = _G
|
||||
|
||||
__Moose = {}
|
||||
|
||||
__Moose.Include = function( IncludeFile )
|
||||
if not __Moose.Includes[ IncludeFile ] then
|
||||
__Moose.Includes[IncludeFile] = IncludeFile
|
||||
local f = assert( base.loadfile( IncludeFile ) )
|
||||
if f == nil then
|
||||
error ("Moose: Could not load Moose file " .. IncludeFile )
|
||||
else
|
||||
env.info( "Moose: " .. IncludeFile .. " dynamically loaded." )
|
||||
return f()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
__Moose.Includes = {}
|
||||
|
||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Modules.lua' )
|
||||
BASE:TraceOnOff( true )
|
||||
env.info( '*** MOOSE INCLUDE END *** ' )
|
||||
|
||||
-- Skip the static part of this file completly
|
||||
do return end
|
||||
end
|
||||
else
|
||||
env.info( '*** MOOSE DYNAMIC INCLUDE NOT POSSIBLE (Desanitize io to use it) *** ' )
|
||||
end
|
||||
|
||||
-- Individual Moose files are not found. Use the static code below.
|
||||
env.info( '*** MOOSE STATIC INCLUDE START *** ' )
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ while( MooseSource ) do
|
||||
MooseSource = string.gsub(MooseSource, "\r", "")
|
||||
|
||||
if MooseSource ~= "" then
|
||||
MooseSource = string.match( MooseSource, "Scripts/Moose/(.+)'" )
|
||||
MooseSource = string.match( MooseSource, "/Moose/(.+)'" )
|
||||
local MooseFilePath = MooseDevelopmentPath .. "/" .. MooseSource
|
||||
if MooseDynamicStatic == "D" then
|
||||
print( "Load dynamic: " .. MooseFilePath )
|
||||
|
||||
112
docs/advanced/concepts.md
Normal file
112
docs/advanced/concepts.md
Normal file
@@ -0,0 +1,112 @@
|
||||
---
|
||||
title: Concepts
|
||||
parent: Advanced
|
||||
nav_order: 01
|
||||
---
|
||||
|
||||
If you want to get deeper into Moose, you will encounter a few terms and
|
||||
concepts that we will explain here. You will need them for the later pages.
|
||||
|
||||
# Git and GitHub
|
||||
|
||||
Moose has about 260.000 lines of code and the amount is increasing each week.
|
||||
To maintain such a big code base a vcs (version control system) is needed.
|
||||
Moose uses [GitHub] as developer platform to create, store, and manage the code.
|
||||
[GitHub] uses [Git] as version control system and provides additional
|
||||
functionality like access control, bug tracking, feature requests and much more.
|
||||
|
||||
As a Moose user you don't need to learn how to use [Git]. You can download the
|
||||
files on [GitHub] with a browser. But using [Git] will ease up the steps to keep
|
||||
the Moose version on your hard disk up to date.
|
||||
|
||||
You will need to interact with [GitHub]. At least to download the Moose files.
|
||||
For non developers the page can be confusing. Take your time and read this
|
||||
documentation. We are not able to explain every single detail on using [GitHub]
|
||||
and [Git]. Especially because it is changing really quick and this documentaion
|
||||
will not. So try to use the help system of [GitHub] or find some videos on
|
||||
[YouTube]. If you get stuck ask for help in the [Moose Discord].
|
||||
|
||||
Moose uses more then one repository on [GitHub] which doesn't exactly make it
|
||||
any clearer. A list can be found on the [reposities] page.
|
||||
|
||||
# Branches: master & develop
|
||||
|
||||
As already explained in the [overview] two branches are used:
|
||||
|
||||
- [master]: Stable release branch.
|
||||
- [develop]: Newest development with more OPS classes.
|
||||
|
||||
As a starter it is okay to begin your journey with the `master` branch.
|
||||
If you are interested in some newer classes you need to use the `develop`
|
||||
branch. The later one is also very stable, but it's missing more detailed
|
||||
documentation and example missions for some of the new OPS classes.
|
||||
|
||||
You can switch between these branches with a drop down in the upper left corner
|
||||
of th [GitHub] repository page. The list of branches is long. So it is a best
|
||||
practise to save a bookmark in your browser with the links above.
|
||||
Both branches are available on most of the different repositories. But because
|
||||
of a limitation of [GitHub pages], we had to split the documentation in two
|
||||
different repositories:
|
||||
|
||||
- Documentation of `master` branch: [MOOSE_DOCS]
|
||||
- Documentation of `develop` branch: [MOOSE_DOCS_DEVELOP]
|
||||
|
||||
# Build result vs. source files
|
||||
|
||||
Moose consists of more than 140 individual files with the file extension `.lua`.
|
||||
They are places in a [directory tree], which makes it more organized and its
|
||||
semantic is pre-defined for IntelliSense to work.
|
||||
|
||||
On every change which is pushed to [GitHub] a build job will combine all of
|
||||
these files to a single file called `Moose.lua`. In a second step all
|
||||
comments will be removed to decrease the file size and the result will be saved
|
||||
as `Moose_.lua`. These both files are created for users of Moose to include in
|
||||
your missions.
|
||||
|
||||
The individual `.lua` files are used by the Mosse developers and power users.
|
||||
It is complicated to use them, but in combination with an IDE and a debugger it
|
||||
is very usefull to analyse even complex problems or write new additions to the
|
||||
Moose framework.
|
||||
|
||||
# Static loading vs. dynamic loading
|
||||
|
||||
If you add a script file with a `DO SCRIPT FILE` trigger, like we described in
|
||||
[Create your own Hello world], the script file will be copied into the mission
|
||||
file. This mission file (file extension .MIZ) is only a compressed ZIP archive
|
||||
with another file ending.
|
||||
|
||||
If you change the script file after adding it to the mission, the changes are
|
||||
not available on mission start. You have to re-add the script after each change.
|
||||
This can be very annoying and often leads to forgetting to add the change again.
|
||||
Then you wonder why the script does not deliver the desired result.
|
||||
|
||||
But when the mission is finished you can upload it to your dedicated DCS server
|
||||
or give it to a friend and it should run without problems. This way of embedding
|
||||
the scripts do we call `static loading` and the resulting mission is very
|
||||
portable.
|
||||
|
||||
The other way on loading scripts is by using `DO SCRIPT`. This time the mission
|
||||
editor don't show a file browse button. Instead you see a (very small) text
|
||||
field to enter the code directly into it. It is only usefull for very small
|
||||
script snippets. But we can use it to load a file from our hard drive like this:
|
||||
|
||||
```lua
|
||||
aaa
|
||||
```
|
||||
|
||||
# IDE vs. Notepad++
|
||||
|
||||
# What is a debugger (good for)
|
||||
|
||||
[Git]: https://en.wikipedia.org/wiki/Git
|
||||
[GitHub]: https://github.com/
|
||||
[YouTube]: https://www.youtube.com/
|
||||
[Moose Discord]: https://discord.gg/gj68fm969S
|
||||
[overview]: ../index.md
|
||||
[reposities]: ../repositories.md
|
||||
[master]: https://github.com/FlightControl-Master/MOOSE/tree/master
|
||||
[develop]: https://github.com/FlightControl-Master/MOOSE/tree/develop
|
||||
[GitHub pages]: https://pages.github.com/
|
||||
[MOOSE_DOCS]: https://flightcontrol-master.github.io/MOOSE_DOCS/
|
||||
[MOOSE_DOCS_DEVELOP]: https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/
|
||||
[directory tree]: https://github.com/FlightControl-Master/MOOSE/tree/master/Moose%20Development/Moose
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
title: De-Sanitize DCS
|
||||
parent: Advanced
|
||||
nav_order: 2
|
||||
nav_order: 98
|
||||
---
|
||||
# De-Sanitize the DCS scripting environment
|
||||
{: .no_toc }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
parent: Advanced
|
||||
nav_order: 1
|
||||
nav_order: 97
|
||||
---
|
||||
# Eclipse Installation
|
||||
{: .no_toc }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
parent: Advanced
|
||||
nav_order: 2
|
||||
nav_order: 99
|
||||
---
|
||||
# Text to Speech
|
||||
{: .no_toc }
|
||||
|
||||
77
docs/beginner/ask-for-help.md
Normal file
77
docs/beginner/ask-for-help.md
Normal file
@@ -0,0 +1,77 @@
|
||||
---
|
||||
parent: Beginner
|
||||
nav_order: 06
|
||||
---
|
||||
# How to ask for help
|
||||
{: .no_toc }
|
||||
|
||||
1. Table of contents
|
||||
{:toc}
|
||||
|
||||
After you have tried to solve the problem on your own, you can also get help
|
||||
from the community.
|
||||
|
||||
{: .highlight }
|
||||
> But it is important to follow certain rules! Read them below.
|
||||
|
||||
## Communities
|
||||
|
||||
There are two ways to communicate with the community.
|
||||
The fastest way is to use Discord:
|
||||
|
||||
- <https://discord.gg/gj68fm969S>{:target="_blank"}
|
||||
|
||||
But if you don't like Discord, you are able to post in the DCS forum.
|
||||
Check out the MOOSE thread here:
|
||||
|
||||
- <https://forums.eagle.ru/showthread.php?t=138043>
|
||||
|
||||
## How to post requests
|
||||
|
||||
MOOSE is a community project and support is community based.
|
||||
|
||||
Please remember when posting a question:
|
||||
|
||||
- Before posting anything follow the [troubleshooting steps].
|
||||
- **Read your logs**.
|
||||
|
||||
A post should contain the following:
|
||||
|
||||
1. A describtion what you expected to happen and what actually happened.
|
||||
- Do not use vague words this stuff is hard to help with! Be specific.
|
||||
|
||||
2. Describe what happens instead.
|
||||
- The less detail you offer, the less chance you can be helped.
|
||||
- Don’t say it doesn’t work. Or is it broken. Say what it actually does.
|
||||
|
||||
3. Post your code in Discord as formatted code:
|
||||
|
||||
- Wrap a single line of code in backticks \` like this:
|
||||
|
||||

|
||||
|
||||
- Multiple lines of code should be posted like this:
|
||||
|
||||

|
||||
|
||||
- Post your log lines with the error or warning messages. Format them like this:
|
||||
|
||||

|
||||
|
||||
- Some complex problems need the mission (.miz file) also.
|
||||
|
||||
- But post your mission only when requested.
|
||||
- Try to simplify your mission if it is complex!
|
||||
|
||||
There are people in the Discord and in the forum, who spend their free time to
|
||||
help you. <br />
|
||||
It is your responsibility to make their "work" as easy as possible.
|
||||
|
||||
Welcome to MOOSE and good luck!
|
||||
|
||||
## Next step
|
||||
|
||||
Last but not least some [tipps and tricks].
|
||||
|
||||
[troubleshooting steps]: problems.md
|
||||
[tipps and tricks]: tipps-and-tricks.md
|
||||
58
docs/beginner/demo-missions.md
Normal file
58
docs/beginner/demo-missions.md
Normal file
@@ -0,0 +1,58 @@
|
||||
---
|
||||
parent: Beginner
|
||||
nav_order: 04
|
||||
---
|
||||
|
||||
# Demo missions
|
||||
{: .no_toc }
|
||||
|
||||
1. Table of contents
|
||||
{:toc}
|
||||
|
||||
The best way to get comfortable with a Moose class is to try the demo missions
|
||||
of the class you want to learn. The Moose team created a lot of demo missions
|
||||
for most of the classes.
|
||||
|
||||
## Download demo missions
|
||||
|
||||
Go to the repository [MOOSE_MISSIONS]{:target="_blank"}, search the folder of
|
||||
the class, download the mission (`.miz`) and run them.
|
||||
|
||||
## Read the mission script
|
||||
|
||||
In the same folder a `.lua` file with the same name is placed which is the
|
||||
included mission script. You can watch these mission scripts easily online at
|
||||
GitHub to understand what is happening in the mission.
|
||||
|
||||
## Read documentation
|
||||
|
||||
Next step is to read the [documentation]{:target="_blank"} of the class to
|
||||
understand the code of the demo mission.
|
||||
|
||||
{: .note }
|
||||
> The documentation is quite long and might be confusing for beginners.
|
||||
> Start by looking at the description at the top of the documentation of a
|
||||
> class. It often contains examples and explanations. <br /><br />
|
||||
> Then search for the function names and look at the description of the
|
||||
> functions and its parameters.
|
||||
|
||||
## Make small changes to the script
|
||||
|
||||
Download the `.lua` file, change the parameters to suit your needs in
|
||||
[Notepad++]{:target="_blank"}, add it to the mission and rerun the mission.
|
||||
Observe what happens and adapt the code.
|
||||
|
||||
If you want to use more functions combine them all up.
|
||||
|
||||
{: .note }
|
||||
> But it is wise to do this in small steps. So it is easier to find errors.
|
||||
|
||||
## Next step
|
||||
|
||||
If the mission does not show the expected behaviour take a look at section
|
||||
[problems].
|
||||
|
||||
[MOOSE_MISSIONS]: https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/develop
|
||||
[documentation]: https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/index.html
|
||||
[Notepad++]: https://notepad-plus-plus.org/downloads/
|
||||
[problems]: problems.md
|
||||
@@ -4,6 +4,178 @@ nav_order: 03
|
||||
---
|
||||
|
||||
# Create your own Hello world
|
||||
{: .no_toc }
|
||||
|
||||
{: .warning }
|
||||
> THIS DOCUMENT IS STILL WORK IN PROGRESS!
|
||||
1. Table of contents
|
||||
{:toc}
|
||||
|
||||
This page will lead you step by step through the process of creating a mission
|
||||
with MOOSE. This time we include a simple mission script, which sends only
|
||||
a "Hello world" message to all players. But the steps are the same to add
|
||||
another mission script, which will do whatever class(es) you want to use.
|
||||
|
||||
## Create Mission script
|
||||
|
||||
At first we will create the mission script. It is a simple text file and can be
|
||||
changed with a lot of different tools. Theoretically even the Microsoft Notepad
|
||||
editor can be used. But it lacks a lot of features, which helps you to avoid
|
||||
errors.
|
||||
|
||||
For this guide we suggest you to download, install and use [Notepad++]{:target="_blank"}.
|
||||
|
||||
{: .important }
|
||||
> Windows hides filename extensions by default. So when you create a text file
|
||||
> and name it `hello-world.lua` it's name is `hello-world.lua.txt` in reality.
|
||||
> You must activate the display of the file name extension.
|
||||
> Open a `File Explorer`, switch to menu `View` and find the option
|
||||
> `File name extensions` in the section `Show/hide`. Activate it.
|
||||
|
||||
- Open a File Explorer.
|
||||
- Go to the subfolder `Missions` of your [Saved Games folder]{:target="_blank"}.
|
||||
- Create a new text file and name it `hello-world.lua`.
|
||||
- Add the following content and save the file:
|
||||
|
||||
`MESSAGE:New( "Hello World! This messages is printed by MOOSE", 35, "INFO" ):ToAll()`
|
||||
|
||||
## Get Moose
|
||||
|
||||
To download Moose click on the following link:
|
||||
|
||||
- [Moose_.lua from develop branch]{:target="_blank"}
|
||||
|
||||
Press `Ctrl + S` to save the file on your hard disk next to your mission script.
|
||||
|
||||
## Create the mission
|
||||
|
||||
- Start DCS.
|
||||
- In the main menu choose `MISSION EDITOR`.
|
||||
- Click on `create new mission`.
|
||||
- In the dialog `NEW MISSION SETTINGS`:
|
||||
- Choose map `Caucasus`.
|
||||
- In the drop box upper left choose `Modern` as coalition preset.
|
||||
- Click on `OK`.
|
||||
- The mission editor will load with a fresh new and empty mission.
|
||||
- Click on `File` in the menu bar and `SAVE` or Press `Ctrl + S`.
|
||||
- Open `My Missions` and save the file with the name `hello-world.miz`.
|
||||
|
||||
## Add Moose to the mission
|
||||
|
||||
- On the left side activate `TRIGGERS`:
|
||||
|
||||

|
||||
|
||||
- On the right side the `TRIGGERS` dialog opens with a lot of options.
|
||||
- Click on `NEW`, choose `4 MISSION START` as **TYPE**.
|
||||
- Give it the `Load MOOSE` as **NAME**.
|
||||
- Leave the **EVENT** option set to `NO EVENT`.
|
||||
- Optional: Choose a color for easy recognition (e.g. yellow).
|
||||
|
||||

|
||||
|
||||
- In the middle part the `CONDITIONS` will be shown.
|
||||
For this trigger we do not configure any conditions.
|
||||
|
||||

|
||||
|
||||
{: .important }
|
||||
> The trigger type `4 MISSION START` does not support `CONDITIONS`. <br />
|
||||
> So `CONDITIONS` must left blank when using it. <br />
|
||||
> **If you add a condition the trigger will never be executed!**
|
||||
|
||||

|
||||
|
||||
- On the right side `ACTIONS` is shown.
|
||||
- We need to click on `NEW`.
|
||||
- Choose **ACTION** `Do SCRIPT FILE` and ignore all other actions.
|
||||
- Click **OPEN** and navigate to the downloaded `Moose_.lua` file.
|
||||
- The result should look like this:
|
||||
|
||||

|
||||
|
||||
## Add the mission script
|
||||
|
||||
- Click on `NEW`, choose `1 ONCE` as **TYPE**.
|
||||
- Give it the `Load Mission Script` as **NAME**.
|
||||
- Leave the **EVENT** option set to `NO EVENT`.
|
||||
- Optional: Choose a color for easy recognition (e.g. green).
|
||||
- The result should look like this:
|
||||
|
||||

|
||||
|
||||
- Switch to the middle part, the `CONDITIONS` section. <br />
|
||||
For this trigger we add one condition:
|
||||
|
||||

|
||||
|
||||
- The combination of `1 ONCE` with `TIME MORE(1)` will ensure, that the mission
|
||||
script is executed 1 second after the mission is started.
|
||||
|
||||
- On the right side under `ACTIONS` you need to add the script:
|
||||
- Click on `NEW`.
|
||||
- Choose **ACTION** `Do SCRIPT FILE`.
|
||||
- Click **OPEN** and navigate to the created `hello-world.lua` file.
|
||||
|
||||
{: .important }
|
||||
> Most important is the fact, that the mission script (`hello-world.lua`)
|
||||
> is executed **after** `Moose_.lua`, because the mission script needs the
|
||||
> classes defined in `Moose_.lua`. And they are only available when `Moose_.lua`
|
||||
> is executed before the mission script.
|
||||
|
||||
## Test the mission
|
||||
|
||||
- Save the mission again.
|
||||
- Click on the green **Fly mission** cirlce on the left tool side bar.
|
||||
- It is an empty mission, so skip `BRIEFING` with `START` and then `FLY`.
|
||||
- You spawn as a spectator. After some seconds you will see this message in
|
||||
the upper right corner:
|
||||
|
||||

|
||||
|
||||
This is the same result as already seen in the last chapter, but this time you
|
||||
have create everything on your own.
|
||||
|
||||
{: .note }
|
||||
> You can use this mission as a template for your own missions. So you don't
|
||||
> need to do alle these steps again and again.
|
||||
|
||||
## Update mission script
|
||||
|
||||
- Open the `hello-world.lua` with Notepad++ again.
|
||||
- Change the text a little bit, like `Hello Dude! ...` and save the file.
|
||||
- Run the mission again.
|
||||
- The text will not be changed in the mission. Why?
|
||||
|
||||
{: .important }
|
||||
The mission editor copies the script into the mission file when you add it.
|
||||
Every change on the script file on your hard disk is not recognized by mission
|
||||
editor. **You have to add the file after each change again!**
|
||||
|
||||
There is also another method available to dynamically load mission scripts.
|
||||
But this method has some brawbacks and will be explained in the advanced section.
|
||||
|
||||
Now we add the mission script again:
|
||||
|
||||
- On the left side of the `TRIGGERS` dialog click on `Load Mission Script`.
|
||||
- On the right side under `ACTIONS` you need to add the script again:
|
||||
- Click **OPEN** and navigate to the created `hello-world.lua` file.
|
||||
- Save the mission and test it again.
|
||||
- Now the new text should be shown.
|
||||
|
||||
## Update Moose
|
||||
|
||||
Moose is constantly being developed so that new functionallity is added or
|
||||
existing errors are corrected. Also from time to time changes of the DCS
|
||||
scripting engine comes with a new DCS version. It may therefore be useful or
|
||||
necessary to update Moose.
|
||||
|
||||
- To update Moose download it again and add it again in the same way you did
|
||||
with the mission script in the last step.
|
||||
|
||||
## Next step
|
||||
|
||||
Let's move on to the [demo missions].
|
||||
|
||||
[Notepad++]: https://notepad-plus-plus.org/downloads/
|
||||
[Saved Games folder]: tipps-and-tricks.md#find-the-saved-games-folder
|
||||
[Moose_.lua from develop branch]: https://raw.githubusercontent.com/FlightControl-Master/MOOSE_INCLUDE/develop/Moose_Include_Static/Moose_.lua
|
||||
[demo missions]: demo-missions.md
|
||||
|
||||
46
docs/beginner/problems.md
Normal file
46
docs/beginner/problems.md
Normal file
@@ -0,0 +1,46 @@
|
||||
---
|
||||
parent: Beginner
|
||||
nav_order: 05
|
||||
---
|
||||
|
||||
# Problems
|
||||
{: .no_toc }
|
||||
|
||||
1. Table of contents
|
||||
{:toc}
|
||||
|
||||
## Something went wrong
|
||||
|
||||
If the mission shows not the expected behaviour do the following steps:
|
||||
|
||||
1. Double check if you added the changed mission script to the mission again!
|
||||
1. Check if the triggers are configured as requested in the last sections.
|
||||
|
||||
## Read the logs
|
||||
|
||||
The DCS log is a super important and useful log for the entire of DCS World.
|
||||
All scripting and other errors are recorded here. It is the one stop shop for
|
||||
things that occurred in your mission. It will tell you if there was a mistake.
|
||||
|
||||
1. Open the file `dcs.log` in the `Logs` subfolder in your DCS
|
||||
[Saved Games folder].
|
||||
|
||||
1. Search for the following line: `*** MOOSE INCLUDE END ***`
|
||||
- If it is included in the log, Moose was loaded.
|
||||
- If the line is not in the log check the triggers again!
|
||||
|
||||
1. Search for lines with `SCRIPTING` and `WARNING` or `ERROR` and read them.
|
||||
- This might help to find your error.
|
||||
|
||||
{: .note }
|
||||
> You will find a lot of warning and error lines in the log which are not
|
||||
> related to `SCRIPTING`. They are related to stuff from Eagle Dynamics or
|
||||
> Third Parties and you have to ignore them. EA does the same. ;o)
|
||||
|
||||
## Next step
|
||||
|
||||
If you don't find the error and/or don't understand the messages in the log file
|
||||
you can [ask for help].
|
||||
|
||||
[Saved Games folder]: tipps-and-tricks.md#find-the-saved-games-folder
|
||||
[ask for help]: ask-for-help.md
|
||||
@@ -33,7 +33,9 @@ This folder can be found in your userprofile as subfolder of `Saved Games`.
|
||||
The easiest way to find it, is to open search and paste the text below into it
|
||||
and press Enter:
|
||||
|
||||
```%userprofile%\Saved Games```
|
||||
```
|
||||
%userprofile%\Saved Games
|
||||
```
|
||||
|
||||
{: .note }
|
||||
> The text will work even if your Windows is installed with another language,
|
||||
|
||||
BIN
docs/images/beginner/dcs-triggers-once-conditions-conf.png
Normal file
BIN
docs/images/beginner/dcs-triggers-once-conditions-conf.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
BIN
docs/images/beginner/discord-fomat-logs.png
Normal file
BIN
docs/images/beginner/discord-fomat-logs.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.6 KiB |
BIN
docs/images/beginner/discord-multi-line-code.png
Normal file
BIN
docs/images/beginner/discord-multi-line-code.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.3 KiB |
BIN
docs/images/beginner/discord-single-line-code.png
Normal file
BIN
docs/images/beginner/discord-single-line-code.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.3 KiB |
@@ -26,14 +26,30 @@ You only need to load **one** of those files at the beginning of your mission.
|
||||
|
||||
This repository contains the generated documentation and pictures and other references.
|
||||
The generated documentation is reflected in html and is published at:
|
||||
- Stable `master` branch: <https://flightcontrol-master.github.io/MOOSE_DOCS/>
|
||||
- `master` branch: <https://flightcontrol-master.github.io/MOOSE_DOCS/>
|
||||
- `develop` branch: <https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/>
|
||||
|
||||
## [MOOSE_GUIDES](https://github.com/FlightControl-Master/MOOSE_GUIDES) - For external documentation and help
|
||||
|
||||
This repository will be removed in future.
|
||||
|
||||
## [MOOSE_PRESENTATIONS](https://github.com/FlightControl-Master/MOOSE_PRESENTATIONS)
|
||||
|
||||
A collection of presentations used in the videos on the youtube channel of FlightControl.
|
||||
|
||||
## [MOOSE_MISSIONS](https://github.com/FlightControl-Master/MOOSE_MISSIONS) - For users (provides demo missions)
|
||||
|
||||
This repository contains all the demonstration missions in packed format (*.miz),
|
||||
and can be used without any further setup in DCS WORLD.
|
||||
|
||||
## [Moose_Community_Scripts](https://github.com/FlightControl-Master/Moose_Community_Scripts)
|
||||
|
||||
This repository is for Moose based helper scripts, snippets, functional demos.
|
||||
|
||||
## [MOOSE_SOUND](https://github.com/FlightControl-Master/MOOSE_SOUND)
|
||||
|
||||
Sound packs for different MOOSE framework classes.
|
||||
|
||||
## [MOOSE_MISSIONS_DYNAMIC](https://github.com/FlightControl-Master/MOOSE_MISSIONS_DYNAMIC) - Outdated
|
||||
|
||||
This repository will be removed in future.
|
||||
@@ -41,3 +57,11 @@ This repository will be removed in future.
|
||||
## [MOOSE_MISSIONS_UNPACKED](https://github.com/FlightControl-Master/MOOSE_MISSIONS_UNPACKED) - Outdated
|
||||
|
||||
This repository will be removed in future.
|
||||
|
||||
## [MOOSE_COMMUNITY_MISSIONS](https://github.com/FlightControl-Master/MOOSE_COMMUNITY_MISSIONS) - Outdated
|
||||
|
||||
A database of missions created by the community, using MOOSE.
|
||||
|
||||
## [MOOSE_TOOLS](https://github.com/FlightControl-Master/MOOSE_TOOLS) - Outdated
|
||||
|
||||
A collection of the required tools to develop and contribute in the MOOSE framework for DCS World.
|
||||
|
||||
Reference in New Issue
Block a user