mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
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:
parent
edf4a70ed6
commit
28e8e7d4ca
@ -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),
|
||||
|
@ -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];
|
||||
};
|
||||
|
||||
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;
|
||||
|
@ -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 |
|
||||
|
Loading…
Reference in New Issue
Block a user