Module Functional.AmmoTruck
Functional -- Send a truck to supply artillery groups.
AMMOTRUCK - Send a truck to supply artillery groups.
Missions:
AmmoTruck
Author : applevangelist
Global(s)
Global AMMOTRUCK |
Amateurs talk about tactics, but professionals study logistics. - General Robert H Barrow, USMC Simple Class to re-arm your artillery with trucks. |
Amateurs talk about tactics, but professionals study logistics. - General Robert H Barrow, USMC
Simple Class to re-arm your artillery with trucks.
AMMOTRUCK
- Controls a SET_GROUP of trucks which will re-arm a SET_GROUP of artillery groups when they run out of ammunition.
1 The AMMOTRUCK concept
A SET_GROUP of trucks which will re-arm a SET_GROUP of artillery groups when they run out of ammunition. They will be based on a homebase and drive from there to the artillery groups and then back home. Trucks are the only known in-game mechanic to re-arm artillery and other units in DCS. Working units are e.g.: M-939 (blue), Ural-375 and ZIL-135 (both red).
2 Set-up
Define a set of trucks and a set of artillery:
local truckset = SET_GROUP:New():FilterCoalitions("blue"):FilterActive(true):FilterCategoryGround():FilterPrefixes("Ammo Truck"):FilterStart()
local ariset = SET_GROUP:New():FilterCoalitions("blue"):FilterActive(true):FilterCategoryGround():FilterPrefixes("Artillery"):FilterStart()
Create an AMMOTRUCK object to take care of the artillery using the trucks, with a homezone:
local ammotruck = AMMOTRUCK:New(truckset,ariset,coalition.side.BLUE,"Logistics",ZONE:FindByName("HomeZone")
2 Options and their default values
ammotruck.ammothreshold = 5 -- send a truck when down to this many rounds
ammotruck.remunidist = 20000 -- 20km - send trucks max this far from home
ammotruck.unloadtime = 600 -- 10 minutes - min time to unload ammunition
ammotruck.waitingtime = 1800 -- 30 mintes - wait max this long until remunition is done
ammotruck.monitor = -60 - 1 minute - AMMOTRUCK checks on things every 1 minute
ammotruck.routeonroad = true - Trucks will **try** to drive on roads
ammotruck.usearmygroup = false - if true, will make use of ARMYGROUP in the background (if used in DEV branch)
3 FSM Events to shape mission
Truck has been sent off:
function ammotruck:OnAfterRouteTruck(From, Event, To, Truckdata, Aridata)
...
end
Truck has arrived:
function ammotruck:OnAfterTruckArrived(From, Event, To, Truckdata)
...
end
Truck is unloading:
function ammotruck:OnAfterTruckUnloading(From, Event, To, Truckdata)
...
end
Truck is returning home:
function ammotruck:OnAfterTruckReturning(From, Event, To, Truckdata)
...
end
Truck is arrived at home:
function ammotruck:OnAfterTruckHome(From, Event, To, Truckdata)
...
end
Type(s)
Fields and Methods inherited from AMMOTRUCK | Description |
---|---|
Class Name |
|
AMMOTRUCK:New(Truckset, Targetset, Coalition, Alias, Homezone) |
|
On after "RouteTruck" event. |
|
On after "TruckHome" event. |
|
On after "TruckReturning" event. |
|
On after "TruckUnloading" event. |
|
Triggers the FSM event "Stop". |
|
Triggers the FSM event "Stop" after a delay. |
|
Alias name |
|
Threshold (min) ammo before sending a truck |
|
Coalition this is for |
|
Debug flag |
|
Lid for log entries |
|
Monitor interval in seconds |
|
AMMOTRUCK:onafterRouteTruck(From, Event, To, Truckdata, Aridata) |
|
Max distance trucks will go |
|
List of (alive) #AMMOTRUCK.data artillery to be reloaded |
|
Route truck on road if true (default) |
|
List of (alive) #AMMOTRUCK.data artillery |
|
SET of artillery |
|
List of (alive) #AMMOTRUCK.data trucks |
|
SET of trucks |
|
Unload time in seconds |
|
Version string |
|
List of (alive) #AMMOTRUCK.data artillery waiting |
|
Max waiting time in seconds |
Fields and Methods inherited from AMMOTRUCK.State | Description |
---|---|
Fields and Methods inherited from AMMOTRUCK.data | Description |
---|---|
- AMMOTRUCK class, extends Core.FSM#FSM
Field(s)
Class Name
Alias name
Threshold (min) ammo before sending a truck
Coalition this is for
Debug flag
Lid for log entries
Monitor interval in seconds
Max distance trucks will go
List of (alive) #AMMOTRUCK.data artillery to be reloaded
Route truck on road if true (default)
List of (alive) #AMMOTRUCK.data artillery
List of (alive) #AMMOTRUCK.data trucks
Unload time in seconds
Version string
List of (alive) #AMMOTRUCK.data artillery waiting
Max waiting time in seconds
Function(s)
Defined in:
AMMOTRUCK
Parameter:
#table dataset
table of #AMMOTRUCK.data entries
Return value:
self
Defined in:
AMMOTRUCK
Parameter:
#table dataset
table of #AMMOTRUCK.data entries
Return value:
self
Defined in:
AMMOTRUCK
Parameter:
#table dataset
table of #AMMOTRUCK.data entries
Return value:
self
Defined in:
AMMOTRUCK
Parameter:
#table dataset
table of #AMMOTRUCK.data entries
Return value:
self
Defined in:
AMMOTRUCK
Parameter:
#table dataset
table of #AMMOTRUCK.data entries
Return value:
self
Defined in:
AMMOTRUCK
Parameter:
#string name
Artillery group name to find
Return value:
Data
Defined in:
AMMOTRUCK
Parameter:
#string name
Truck group name to find
Return value:
Data
Defined in:
AMMOTRUCK
Parameters:
Core.Set#SET_GROUP Truckset
Set of truck groups
Core.Set#SET_GROUP Targetset
Set of artillery groups
#number Coalition
Coalition
#string Alias
Alias Name
Core.Zone#ZONE Homezone
Home, return zone for trucks
Return value:
self
Usage:
Define a set of trucks and a set of artillery:
local truckset = SET_GROUP:New():FilterCoalitions("blue"):FilterActive(true):FilterCategoryGround():FilterPrefixes("Ammo Truck"):FilterStart()
local ariset = SET_GROUP:New():FilterCoalitions("blue"):FilterActive(true):FilterCategoryGround():FilterPrefixes("Artillery"):FilterStart()
Create an AMMOTRUCK object to take care of the artillery using the trucks, with a homezone:
local ammotruck = AMMOTRUCK:New(truckset,ariset,coalition.side.BLUE,"Logistics",ZONE:FindByName("HomeZone")
On after "RouteTruck" event.
Defined in:
AMMOTRUCK
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
#AMMOTRUCK.data Truck
On after "TruckHome" event.
Defined in:
AMMOTRUCK
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
#AMMOTRUCK.data Truck
On after "TruckReturning" event.
Defined in:
AMMOTRUCK
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
#AMMOTRUCK.data Truck
On after "TruckUnloading" event.
Defined in:
AMMOTRUCK
Parameters:
#string From
From state.
#string Event
Event.
#string To
To state.
#AMMOTRUCK.data Truck
Triggers the FSM event "Stop".
Stops the AMMOTRUCK and all its event handlers.
Defined in:
AMMOTRUCK
Triggers the FSM event "Stop" after a delay.
Stops the AMMOTRUCK and all its event handlers.
Defined in:
AMMOTRUCK
Parameter:
#number delay
Delay in seconds.
Defined in:
AMMOTRUCK
Parameters:
#string From
#string Event
#string To
Return value:
self
Defined in:
AMMOTRUCK
Parameters:
#string From
#string Event
#string To
#AMMOTRUCK.data Truckdata
#AMMOTRUCK.data Aridata
Return value:
self
Defined in:
AMMOTRUCK
Parameters:
#string From
#string Event
#string To
Return value:
self
Defined in:
AMMOTRUCK
Parameters:
#string From
#string Event
#string To
Return value:
self
Defined in:
AMMOTRUCK
Parameters:
#string From
#string Event
#string To
#AMMOTRUCK.data Truck
Return value:
self
Defined in:
AMMOTRUCK
Parameters:
#string From
#string Event
#string To
#AMMOTRUCK.data Truckdata
Return value:
self