Banner Image

Module Cargo.CargoCrate

Cargo - Management of single cargo crates, which are based on a STATIC object.


Demo Missions

YouTube Playlist


Author: FlightControl

Contributions:


Global(s)

Global CARGO_CRATE

Defines a cargo that is represented by a UNIT object within the simulator, and can be transported by a carrier.

#CARGO_CRATE CARGO_CRATE

Defines a cargo that is represented by a UNIT object within the simulator, and can be transported by a carrier.

Use the event functions as described above to Load, UnLoad, Board, UnBoard the CARGO_CRATE objects to and from carriers.

The above cargo classes are used by the following AI_CARGO_ classes to allow AI groups to transport cargo:

The above cargo classes are also used by the TASK_CARGO_ classes to allow human players to transport cargo as part of a tasking:


Type(s)

Fields and Methods inherited from CARGO_CRATE Description

CARGO_CRATE:CanBoard()

Check if the cargo can be Boarded.

CARGO_CRATE:CanSlingload()

Check if the cargo can be sling loaded.

CARGO_CRATE:CanUnboard()

Check if the cargo can be Unboarded.

CARGO_CRATE.CargoCarrier

CARGO_CRATE.CargoObject

CARGO_CRATE:GetCoordinate()

Get the current Coordinate of the CargoGroup.

CARGO_CRATE:GetTransportationMethod()

Get the transportation method of the Cargo.

CARGO_CRATE:IsAlive()

Check if the CargoGroup is alive.

CARGO_CRATE:IsInLoadRadius(Coordinate)

Check if Cargo Crate is in the radius for the Cargo to be Boarded or Loaded.

CARGO_CRATE:IsInReportRadius(Coordinate)

Check if Cargo Crate is in the radius for the Cargo to be reported.

CARGO_CRATE:IsNear(CargoCarrier, NearRadius)

Check if Cargo is near to the Carrier.

CARGO_CRATE.NearRadius

CARGO_CRATE:New(CargoStatic, Type, Name, LoadRadius, NearRadius)

CARGO_CRATE Constructor.

CARGO_CRATE.NoDestroy

CARGO_CRATE:OnEventCargoDead(EventData)

CARGO_CRATE.OnUnLoadedCallBack

CARGO_CRATE:Respawn()

Respawn the CargoGroup.

CARGO_CRATE:RouteTo(Coordinate)

Route Cargo to Coordinate and randomize locations.

CARGO_CRATE:onafterReset()

Respawn the CargoGroup.

CARGO_CRATE:onenterLoaded(Event, From, To, CargoCarrier)

Loaded State.

CARGO_CRATE:onenterUnLoaded(Event, From, To, Core, ToPointVec2)

Enter UnLoaded State.

Fields and Methods inherited from CARGO_REPRESENTABLE Description

CARGO_CRATE:Destroy()

CARGO_REPRESENTABLE Destructor.

CARGO_CRATE:MessageToGroup(Message, TaskGroup, Name)

Send a message to a Wrapper.Group through a communication channel near the cargo.

CARGO_CRATE:New(CargoObject, Type, Name, LoadRadius, NearRadius)

CARGO_REPRESENTABLE Constructor.

CARGO_CRATE:RouteTo(ToPointVec2, Speed)

Route a cargo unit to a PointVec2.

CARGO_CRATE.test

Models the behaviour of cargo crates, which can be slingloaded and boarded on helicopters.

Field(s)

Function(s)

Check if the cargo can be Boarded.

Defined in:

CARGO_CRATE

Check if the cargo can be sling loaded.

Defined in:

CARGO_CRATE

Check if the cargo can be Unboarded.

Defined in:

CARGO_CRATE

Get the current Coordinate of the CargoGroup.

Defined in:

CARGO_CRATE

Return values:

The current Coordinate of the first Cargo of the CargoGroup.

#nil:

There is no valid Cargo in the CargoGroup.

Get the transportation method of the Cargo.

Defined in:

CARGO_CRATE

Return value:

#string:

The transportation method of the Cargo.

Check if the CargoGroup is alive.

Defined in:

CARGO_CRATE

Return values:

#boolean:

true if the CargoGroup is alive.

#boolean:

false if the CargoGroup is dead.

Check if Cargo Crate is in the radius for the Cargo to be Boarded or Loaded.

Defined in:

CARGO_CRATE

Parameter:

Return value:

#boolean:

true if the Cargo Crate is within the loading radius.

Check if Cargo Crate is in the radius for the Cargo to be reported.

Defined in:

CARGO_CRATE

Parameter:

Return value:

#boolean:

true if the Cargo Crate is within the report radius.

Check if Cargo is near to the Carrier.

The Cargo is near to the Carrier within NearRadius.

Defined in:

CARGO_CRATE

Parameters:

Wrapper.Group#GROUP CargoCarrier

#number NearRadius

Return values:

#boolean:

The Cargo is near to the Carrier.

#nil:

The Cargo is not near to the Carrier.

CARGO_CRATE Constructor.

Defined in:

CARGO_CRATE

Parameters:

Wrapper.Static#STATIC CargoStatic

#string Type

#string Name

#number LoadRadius

(optional)

#number NearRadius

(optional)

Return value:

Defined in:

CARGO_CRATE

Parameter:

Respawn the CargoGroup.

Defined in:

CARGO_CRATE

Route Cargo to Coordinate and randomize locations.

Defined in:

CARGO_CRATE

Parameter:

Respawn the CargoGroup.

Defined in:

CARGO_CRATE

Loaded State.

Defined in:

CARGO_CRATE

Parameters:

#string Event

#string From

#string To

Wrapper.Unit#UNIT CargoCarrier

Enter UnLoaded State.

Defined in:

CARGO_CRATE

Parameters:

#string Event

#string From

#string To

Core

Point#POINT_VEC2

ToPointVec2

Field(s)

Function(s)

CARGO_REPRESENTABLE Destructor.

Send a message to a Wrapper.Group through a communication channel near the cargo.

Defined in:

Parameters:

#string Message

#string Name

(optional) The name of the Group used as a prefix for the message to the Group. If not provided, there will be nothing shown.

CARGO_REPRESENTABLE Constructor.

Defined in:

Parameters:

The cargo object.

#string Type

Type name

#string Name

Name.

#number LoadRadius

(optional) Radius in meters.

#number NearRadius

(optional) Radius in meters when the cargo is loaded into the carrier.

Return value:

Route a cargo unit to a PointVec2.

Defined in:

Parameters:

Core.Point#POINT_VEC2 ToPointVec2

#number Speed

Return value: