Initial upload. Not currently functional as a mod. Includes some slightly refactored source code as well as the original mission this was debuted in zipped up as reference + example of usage.
This commit is contained in:
commit
75b737230e
32 files changed
+2049
No files matched your search
@@ -0,0 +1,169 @@
|
||||
/*
|
||||
* Author: Clarky
|
||||
* Usage:
|
||||
* [this] call CLF_fnc_initSupplyVehicleInteractions;
|
||||
*
|
||||
* Intended to run locally on each client.
|
||||
*
|
||||
*/
|
||||
|
||||
params ["_vehicle"];
|
||||
|
||||
if (isNull _vehicle) exitWith {hint "Vehicle ain't exist";};
|
||||
if !(_vehicle getVariable ["isSupplyVehicle", false]) exitWith {hint "Vehicle ain't supply vehicle";};
|
||||
|
||||
// Prevent duplicate actions if script runs again
|
||||
if (_vehicle getVariable ["supplyInteractionsAdded", false]) exitWith {};
|
||||
|
||||
_vehicle setVariable ["supplyInteractionsAdded", true];
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// INIT STATUS ACTION
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
_vehicle addAction [
|
||||
"<t color='#FFD700'>Check Materiel Status</t>",
|
||||
{
|
||||
params ["_target", "_caller"];
|
||||
|
||||
private _current =
|
||||
_target getVariable ["currentMateriel", 0];
|
||||
|
||||
private _max =
|
||||
_target getVariable ["maxMateriel", 300];
|
||||
|
||||
private _rate =
|
||||
_target getVariable ["transferRate", 50];
|
||||
|
||||
[
|
||||
"CLF_ShowMessage",
|
||||
[
|
||||
3,
|
||||
1,
|
||||
format
|
||||
[
|
||||
"SUPPLY VEHICLE STORAGE<br />Materiel: %1 / %2",
|
||||
_current,
|
||||
_max]
|
||||
],
|
||||
_caller
|
||||
] call CBA_fnc_targetEvent;
|
||||
},
|
||||
nil,
|
||||
1,
|
||||
true,
|
||||
false,
|
||||
"",
|
||||
"true",
|
||||
6
|
||||
];
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// INIT LOAD ACTION
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
[
|
||||
_vehicle, // Object the action is attached to
|
||||
"<t color='#c4ff22'>Load Materiel</t>", // Title of the action
|
||||
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_loaddevice_ca.paa", // Idle icon shown on screen
|
||||
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_loaddevice_ca.paa", // Progress icon shown on screen
|
||||
"(([_this] call ace_common_fnc_isEngineer) || (missionNamespace getVariable 'allCanUseLogistics')) &&
|
||||
(
|
||||
(nearestObjects [_target, [], 15] findIf {
|
||||
_x getVariable ['isSupplyDepot', false]
|
||||
}) > -1
|
||||
) &&
|
||||
(_target distance _this < 7)", // Condition for the action to be shown
|
||||
"alive _target", // Condition for the action to progress
|
||||
{}, // Code executed when action starts
|
||||
{}, // Code executed on every progress tick
|
||||
{
|
||||
params ["_target", "_caller"];
|
||||
|
||||
private _depot = (
|
||||
nearestObjects [_target, [], 15]
|
||||
select {
|
||||
_x getVariable ["isSupplyDepot", false]
|
||||
}
|
||||
) param [0, objNull];
|
||||
|
||||
if (isNull _depot) exitWith {
|
||||
[
|
||||
"CLF_ShowMessage",
|
||||
[
|
||||
1,
|
||||
0,
|
||||
"No supply depot nearby."
|
||||
],
|
||||
_caller
|
||||
] call CBA_fnc_targetEvent;
|
||||
};
|
||||
|
||||
[
|
||||
"CLF_VehicleLoaded",
|
||||
[_target, _caller, _depot]
|
||||
] call CBA_fnc_serverEvent;
|
||||
}, // Code executed on completion
|
||||
{}, // Code executed on interrupted
|
||||
[], // Arguments passed to the scripts as _this select 3
|
||||
5, // Action duration in seconds
|
||||
0, // Priority
|
||||
false, // Remove on completion
|
||||
false, // Show in unconscious state
|
||||
true // Show on screen
|
||||
] call BIS_fnc_holdActionAdd;
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// INIT UNLOAD ACTION
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
[
|
||||
_vehicle, // Object the action is attached to
|
||||
"<t color='#c4ff22'>Unload Materiel</t>", // Title of the action
|
||||
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_unloaddevice_ca.paa", // Idle icon shown on screen
|
||||
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_unloaddevice_ca.paa", // Progress icon shown on screen
|
||||
"(([_this] call ace_common_fnc_isEngineer) || (missionNamespace getVariable 'allCanUseLogistics')) &&
|
||||
(
|
||||
(nearestObjects [_target, [], 15] findIf {
|
||||
_x getVariable ['isSupplyDepot', false]
|
||||
}) > -1
|
||||
) &&
|
||||
(_target distance _this < 7)", // Condition for the action to be shown
|
||||
"alive _target", // Condition for the action to progress
|
||||
{}, // Code executed when action starts
|
||||
{}, // Code executed on every progress tick
|
||||
{
|
||||
params ["_target", "_caller"];
|
||||
|
||||
private _depot = (
|
||||
nearestObjects [_target, [], 15]
|
||||
select {
|
||||
_x getVariable ["isSupplyDepot", false]
|
||||
}
|
||||
) param [0, objNull];
|
||||
|
||||
if (isNull _depot) exitWith {
|
||||
[
|
||||
"CLF_ShowMessage",
|
||||
[
|
||||
1,
|
||||
0,
|
||||
"No supply depot nearby."
|
||||
],
|
||||
_caller
|
||||
] call CBA_fnc_targetEvent;
|
||||
};
|
||||
|
||||
[
|
||||
"CLF_VehicleUnloaded",
|
||||
[_target, _caller, _depot]
|
||||
] call CBA_fnc_serverEvent;
|
||||
}, // Code executed on completion
|
||||
{}, // Code executed on interrupted
|
||||
[], // Arguments passed to the scripts as _this select 3
|
||||
5, // Action duration in seconds
|
||||
0, // Priority
|
||||
false, // Remove on completion
|
||||
false, // Show in unconscious state
|
||||
true // Show on screen
|
||||
] call BIS_fnc_holdActionAdd;
|
||||
Reference in new issue
Block a user