diff --git a/OPS - CTLD/CTLD-120 - Statics/CTLD-120 - Statics.lua b/OPS - CTLD/CTLD-120 - Statics/CTLD-120 - Statics.lua new file mode 100644 index 0000000000..b0f9085c3f --- /dev/null +++ b/OPS - CTLD/CTLD-120 - Statics/CTLD-120 - Statics.lua @@ -0,0 +1,75 @@ +------------------------------------------------------------------------- +-- CTLD 120 - Statics - Test Mission +------------------------------------------------------------------------- +-- Documentation +-- +-- CTLD: https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Ops.CTLD.html +-- +------------------------------------------------------------------------- +-- Join a Helicopter. Use the F10 menu to request ammo crates. +-- Load and fly over 5 ammunition crates to the trucks waiting at the farm at waypoint 1. +-- Once dropped, the trucks will drive to the artillery, so Kobuleti can be shelled! +------------------------------------------------------------------------- +-- Date: 23 June 2021 +------------------------------------------------------------------------- + +-- Set up CTLD +local myctld = CTLD:New(coalition.side.BLUE,{"Player"},"LtRg II") +myctld.allowcratepickupagain = false +myctld.dropcratesanywhere = false +myctld.forcehoverload = false +myctld.smokedistance = UTILS.NMToMeters(3) +myctld.verbose = 2 +myctld:__Start(5) + +-- define a pickup zone +myctld:AddCTLDZone("PickupZone",CTLD.CargoZoneType.LOAD,SMOKECOLOR.Blue,true,true) + +-- define a drop zone +myctld:AddCTLDZone("DropZone",CTLD.CargoZoneType.LOAD,SMOKECOLOR.Red,true,true) + +-- define statics cargo +myctld:AddStaticsCargo("Ammunition",50,25) -- ammuntion weight 50kg ;) stock 25 pc + +-- update unit capabilities for testing - allow 5 crates +myctld:UnitCapabilities("UH-1H", true, true, 5, 12, 15) +myctld:UnitCapabilities("SA342L", true, true, 5, 3, 12) +myctld:UnitCapabilities("Mi-24P", true, true, 5, 8, 18) +myctld:UnitCapabilities("Mi-8MT", true, true, 5, 12, 15) + +-- count dropped ammo +local ammocounter = 0 + +-- check CratesDropped FSM event and action if enough ammo dropped +function myctld:OnAfterCratesDropped(From,Event,To,Group,Unit,Cargotable) + local table = Cargotable + for _,_cargo in pairs (table) do + -- count objects + local cargo = _cargo -- Ops.CTLD#CTLD_CARGO + local name = cargo:GetName() + if string.find(name,"Ammunition") then + ammocounter = ammocounter + 1 + local obj = cargo:GetPositionable() + if obj and obj:IsAlive() then -- "load" on truck + obj:Destroy() + end + end + end + local m = MESSAGE:New(string.format("Overall %d ammo boxes loaded!",ammocounter),20,"Info"):ToAll() + if math.floor(ammocounter / 5) >= 1 then -- dropped enough boxes? + -- Get Going! + local m = MESSAGE:New("Moving Trucks!",20,"Info"):ToAll() + local trucks = GROUP:FindByName("Ammo Trucks") -- Wrapper.Group#GROUP + local coord = ZONE:New("TruckTarget"):GetCoordinate() + trucks:RouteGroundTo(coord,30,"Line abreast",5) + -- Order Ari to fire + local ari = GROUP:FindByName("Blue Artillery") + local tgtzone = ZONE:New("TargetZone"):GetCoordinate() + local vec2 = tgtzone:GetVec2() + local task = ari:TaskFireAtPoint(vec2,325,500) + ari:PushTask(task,300) + end +end + + + diff --git a/OPS - CTLD/CTLD-120 - Statics/CTLD-120 - Statics.miz b/OPS - CTLD/CTLD-120 - Statics/CTLD-120 - Statics.miz new file mode 100644 index 0000000000..851cdd99b3 Binary files /dev/null and b/OPS - CTLD/CTLD-120 - Statics/CTLD-120 - Statics.miz differ diff --git a/OPS - CTLD/CTLD-120 - Statics/pack.ps1 b/OPS - CTLD/CTLD-120 - Statics/pack.ps1 new file mode 100644 index 0000000000..caa79efcaf --- /dev/null +++ b/OPS - CTLD/CTLD-120 - Statics/pack.ps1 @@ -0,0 +1,6 @@ +$dir = split-path -parent $MyInvocation.MyCommand.Definition +cd $dir +$file = Split-Path $dir -leaf +cd "_unpacked" +. 7z a -r -y -tzip "..\$file.miz" * +cd .. diff --git a/OPS - CTLD/CTLD-120 - Statics/unpack.ps1 b/OPS - CTLD/CTLD-120 - Statics/unpack.ps1 new file mode 100644 index 0000000000..0206e08131 --- /dev/null +++ b/OPS - CTLD/CTLD-120 - Statics/unpack.ps1 @@ -0,0 +1,7 @@ +$dir = split-path -parent $MyInvocation.MyCommand.Definition +cd $dir +$file = Split-Path $dir -leaf +Remove-Item .\_unpacked -Force -Recurse +md "_unpacked" +cd "_unpacked" +. 7z x -r -y "..\$file.miz" *