Refuel - Add events for fuel source and jerry can creation (#9133)

* Refuel - Added events

* Added ´ace_refuel_fuelSourceInitialized´ and `ace_refuel_jerryCanInitalized´ events
* Updated documentation

* Cleaner implementation && more coherent with analog rearm event

* Rebase merging is weird
This commit is contained in:
TACHarsis 2023-02-18 03:49:57 +01:00 committed by GitHub
parent edf4a70ed6
commit 28e8e7d4ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 7 deletions

View File

@ -24,9 +24,12 @@ if (isNull _target ||
_target setVariable [QGVAR(jerryCan), true];
_target setVariable [QGVAR(source), _target];
_target setVariable [QGVAR(capacity), _fuelAmount];
if (isServer) then { [_target, _fuelAmount] call FUNC(setFuel); };
if (isServer) then {
[_target, _fuelAmount] call FUNC(setFuel); // has global effects
[QVAR(jerryCanInitalized), [_target]] call CBA_fnc_globalevent;
};
// Main Action
private _action = [QGVAR(Refuel),

View File

@ -56,9 +56,11 @@ if (
_source setVariable [QGVAR(hooks), _hooks, true];
};
// check if menu already exists
if (_fuelCargoConfig != 0 || {!isNil {_source getVariable QGVAR(initSource_jipID)}}) exitWith {};
// only add if menu doesn't already exist
if (!(_fuelCargoConfig != 0 && {!isNil {_source getVariable QGVAR(initSource_jipID)}})) then {
private _jipID = [QGVAR(initSource), [_source]] call CBA_fnc_globalEventJIP;
[_jipID, _source] call CBA_fnc_removeGlobalEventJIP;
_source setVariable [QGVAR(initSource_jipID), _jipID];
};
[QGVAR(sourceInitialized), [_source]] call CBA_fnc_globalEvent;

View File

@ -125,3 +125,10 @@ The jerry can will now have a volume of 200 liters.
---| --------- | -----------
0 | `cursorObject` | Fuel source object
1 | `100` | Fuel supply
## 3. Events
| Name | Arguments | Global? | Added in |
| ------------- | ------------- | ------------- |
| ace_refuel_sourceInitialized | Fuel source (OBJECT), items (BOOL or ARRAY) | Yes | 3.16.0 |
| ace_refuel_jerryCanInitalized | Jerry can (OBJECT) | Yes | 3.16.0 |