Added ace_rearm_sourceInitialized event (#9134)

This commit is contained in:
TACHarsis 2023-02-18 03:59:23 +01:00 committed by GitHub
parent 28e8e7d4ca
commit 1693e6834d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 9 deletions

View File

@ -43,14 +43,16 @@ _source setVariable [QGVAR(currentSupply), _currentSupply + _rearmCargo, true];
private _rearmCargoConfig = getNumber (configOf _source >> QGVAR(defaultSupply));
// already initialized because this is a config rearm vehicle
if (_rearmCargoConfig > 0 || _source getVariable [QGVAR(isSupplyVehicle), false]) exitWith {};
// initialize if it's not a config rearm vehicle
if (!(_rearmCargoConfig > 0 && _source getVariable [QGVAR(isSupplyVehicle), false])) then {
_source setVariable [QGVAR(isSupplyVehicle), true, true];
_source setVariable [QGVAR(isSupplyVehicle), true, true];
// only add if menu does not already exist
if (isNil {_source getVariable QGVAR(initSupplyVehicle_jipID)}) then {
private _jipID = [QGVAR(initSupplyVehicle), [_source]] call CBA_fnc_globalEventJIP;
[_jipID, _source] call CBA_fnc_removeGlobalEventJIP;
_source setVariable [QGVAR(initSupplyVehicle_jipID), _jipID];
};
};
// check if menu already exists
if (!isNil {_source getVariable QGVAR(initSupplyVehicle_jipID)}) exitWith {};
private _jipID = [QGVAR(initSupplyVehicle), [_source]] call CBA_fnc_globalEventJIP;
[_jipID, _source] call CBA_fnc_removeGlobalEventJIP;
_source setVariable [QGVAR(initSupplyVehicle_jipID), _jipID];
[QGVAR(rearmSourceInitalized), [_source]] call CBA_fnc_globalEvent;

View File

@ -235,3 +235,9 @@ This function sets the current supply count of the ammo truck. It can be used to
---| --------- | -----------
0 | `ammo_truck` | My ammo truck object
1 | `1000`| Supply Count
## 4. Events
| Name | Arguments | Global? | Added in |
| ------------- | ------------- | ------------- |
| ace_rearm_sourceInitalized | Yes | Ammo truck (OBJECT) | 3.16.0 |