Updated Moose.lua

This commit is contained in:
funkyfranky
2022-10-14 16:49:26 +00:00
parent 492c97dbae
commit 2c98595cb2
125 changed files with 6060 additions and 387 deletions
@@ -1,24 +1,24 @@
---
-- Name: AIC-APC-001 - Troops Relocate APC
-- Author: FlightControl
-- Date Created: 07 Apr 2018
--
-- Demonstration of troops relocation when carrier is destroyed...
-- Carrier will relocate to the rescue carrier.
local InfantryCargoSet = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart()
local CargoCarrier = GROUP:FindByName( "Carrier" )
CargoTroops = AI_CARGO_APC:New( CargoCarrier, InfantryCargoSet, 500 )
function CargoTroops:OnAfterDestroyed( CargoCarrier )
CargoTroops:F( { Destroyed = CargoCarrier } )
-- The coordinate is passed where the carrier is destroyed.
local NewCarrierGroup = self:FindCarrier( CargoCarrier:GetCoordinate(), 1000 ) -- which returns one Carrier GROUP object or nil.
if NewCarrierGroup then
self:SetCarrier( NewCarrierGroup )
end
end
---
-- Name: AIC-APC-001 - Troops Relocate APC
-- Author: FlightControl
-- Date Created: 07 Apr 2018
--
-- Demonstration of troops relocation when carrier is destroyed...
-- Carrier will relocate to the rescue carrier.
local InfantryCargoSet = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart()
local CargoCarrier = GROUP:FindByName( "Carrier" )
CargoTroops = AI_CARGO_APC:New( CargoCarrier, InfantryCargoSet, 500 )
function CargoTroops:OnAfterDestroyed( CargoCarrier )
CargoTroops:F( { Destroyed = CargoCarrier } )
-- The coordinate is passed where the carrier is destroyed.
local NewCarrierGroup = self:FindCarrier( CargoCarrier:GetCoordinate(), 1000 ) -- which returns one Carrier GROUP object or nil.
if NewCarrierGroup then
self:SetCarrier( NewCarrierGroup )
end
end
@@ -0,0 +1,38 @@
---
-- Name: AIC-HEL-000 - Helicopter
-- Author: FlightControl
-- Date Created: 13 Apr 2018
-- Date Checked: 01 Jan 2021
-- Updated Moose, needs fix #1417 to work
--
BASE:TraceClass("AI_CARGO")
BASE:TraceClass("AI_CARGO_HELICOPTER")
BASE:TraceOn()
WorkerCargoSet = SET_CARGO:New():FilterTypes( "Workers" ):FilterStart()
for i = 1, 5 do
local WorkerGroup = GROUP:FindByName( string.format( "Infantry %03d", i ) )
local WorkersCargo = CARGO_GROUP:New( WorkerGroup, "Workers", string.format( "Infantry %d", i ), 750, 35 )
end
local Helicopter = GROUP:FindByName( "Helicopter" )
CargoHelicopter = AI_CARGO_HELICOPTER:New( Helicopter, WorkerCargoSet )
PickupZone = ZONE:New( "PickupZone" )
DeployZones = { ZONE:New( "DeployZone Alpha" ), ZONE:New( "DeployZone Beta" ), ZONE:New( "DeployZone Gamma" ) }
CargoHelicopter:Pickup( PickupZone:GetRandomCoordinate( 400, 100 ) )
function CargoHelicopter:OnAfterLoaded( Helicopter, From, Event, To, Cargo )
CargoHelicopter:__Deploy(5,DeployZones[math.random( 1, #DeployZones ) ]:GetRandomCoordinate( 500, 100 ), math.random( 50, 250 ) )
end
function CargoHelicopter:OnAfterUnloaded( Helicopter, From, Event, To, Cargo )
CargoHelicopter:__Pickup( 5,PickupZone:GetRandomCoordinate( 500, 200 ), math.random( 50, 250 ) )
end