-
Notifications
You must be signed in to change notification settings - Fork 13
4. Logistics
Defining a list of items that can be requested is done with the "List function" module attribute. This is code ran whenever the menu is opened that must return an array of items formatted with the following arguments:
0: Item class name or array of classes <STRING | ARRAY>
1: Formatting options (custom name, icon path, tooltip, and extra info displayed on the side panel) <STRING | ARRAY>
2: Item init code (local execution) <CODE>
3: Extra arguments passed to the init code <ANY>
4: Item load (default: 1) <NUMBER>
5: Limit per request (default: unlimited) <NUMBER>
6: Total quantity available. A number gives control of this list to SSS. A string checks for a variable set on the entity. <NUMBER | STRING>
You can also define item categories with the following arguments:
0: Category name (must be prefixed with #) <STRING>
1: Child items array <ARRAY>
Here is an example utilizing various arguments outlined above:
[
"B_Quadbike_01_F",
"B_LSV_01_armed_F",
["B_MRAP_01_hmg_F","",{},[],1,-1,4],
["#Infantry",[
"B_soldier_AT_F",
"B_HeavyGunner_F",
"B_Soldier_F",
"B_Soldier_GL_F"
]],
["#Groups",[
[["B_Soldier_F","B_Soldier_GL_F","B_HeavyGunner_F","B_soldier_AT_F"],"Fire Team",{},[],4,1],
[["B_Soldier_F","B_Soldier_GL_F","B_HeavyGunner_F","B_soldier_AT_F","B_LSV_01_armed_F"],"Fire Team w/ DAGOR",{},[],5,1]
]],
["#Supplies",[
["B_supplyCrate_F",["Resupply - Ammo","@resupply"],{
[_this,"#group",false,true,20,10,10,10,10,0] call sss_logistics_fnc_autoFill;
},[],1,1],
["B_supplyCrate_F",["Resupply - Medical","@resupply"],{
[_this,"#group",false,true,0,0,0,0,0,20] call sss_logistics_fnc_autoFill;
},[],1,1],
["B_supplyCrate_F","Basic weapons and ammo",{
clearItemCargoGlobal _this;
clearMagazineCargoGlobal _this;
clearWeaponCargoGlobal _this;
clearBackpackCargoGlobal _this;
_this addWeaponCargoGlobal ["arifle_MX_F",4];
_this addMagazineCargoGlobal ["30Rnd_65x39_caseless_mag",40];
_this addWeaponCargoGlobal ["arifle_TRG21_F",4];
_this addMagazineCargoGlobal ["30Rnd_556x45_Stanag",40];
_this addWeaponCargoGlobal ["srifle_EBR_F",2];
_this addMagazineCargoGlobal ["20Rnd_762x51_Mag",20];
}]
]]
]
You can dynamically populate logistics lists with the "Logistics Reference Area" module. Objects that are present in the area of this module will be added to the top of the list. To use this module, set up the attributes how you see fit, then sync it to any available Logistics support modules.
To automatically fill a supply box with current or compatible magazines and medical items, you can use the included sss_logistics_fnc_autoFill
function. You may notice it's used in the logistics list example above. Here are the function parameters:
0: Cargo object <OBJECT>
1: Units to construct inventory from <ARRAY | OBJECT | GROUP | SIDE | STRING>
2: Munition defaults only <BOOL>
3: Medical defaults only <BOOL>
4: Magazine count <NUMBER | ARRAY>
5: Under-barrel count <NUMBER | ARRAY>
6: Rocket count <NUMBER | ARRAY>
7: Throwable count <NUMBER | ARRAY>
8: Placeable count <NUMBER | ARRAY>
9: Medical count <NUMBER | ARRAY>
The 'units' argument can use special strings which will automatically compile the list of units from the requester:
-
"#side"
: All the players (excludes AI) from the side of the requester -
"#group"
: All units (includes AI) from the requester's group -
"#players"
: All players in the game
The 'defaults only' arguments determines whether or not the inventory will only use the weapon or item defaults or whatever the players currently are equipped with.
Every 'count' argument accepts the basic count of every magazine type, or you can include define the ability to multiply that count per the amount of players that share the same magazine types. To do so, make the the argument an array and include the boolean that allows multiplying the count. For example: [20,true]
Usage example:
[
_this, // Object to fill inventory (In the case of item init we use _this)
"#group", // Units to use (Here we set it use all the units from the requester's group)
false, // Munition defaults only (Set false to use whatever players are equipped with)
true, // Medical defaults only (Set true so it fills the box with all default medical items)
20, // Magazine count (20 per type
5, // Under-barrel count
[5,true], // Rocket count (Base count of 5, but multiply this by the amount of players that carry rockets)
5, // Throwable count
5, // Placeable count
10 // Medical count
] call sss_logistics_fnc_autoFill;