Skip to content

Commit

Permalink
Refuel - Add events for start, stop and progress (#7023)
Browse files Browse the repository at this point in the history
* Add refuelTick Event

* Add refuelStarted event

* Add refuelStopped event

* Add event documentation

* Rename events

Fix EOF

* Rename one more event
  • Loading branch information
dedmen authored and PabstMirror committed Oct 13, 2019
1 parent 2e5cdbd commit 3946928
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions addons/refuel/functions/fnc_refuel.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,16 @@ if (_maxFuel == 0) then {
};
_unit setVariable [QGVAR(tempFuel), _fuelInSink];

[QGVAR(tick), [_source, _sink, _rateTime]] call CBA_fnc_localEvent;

[QEGVAR(common,setFuel), [_sink, _fuelInSink], _sink] call CBA_fnc_targetEvent;
[_source, _fuelInSource] call FUNC(setFuel);
} else {
_unit setVariable [QGVAR(tempFuel), fuel _sink];
};

if (_finished) exitWith {
[QGVAR(stopped), [_source, _sink]] call CBA_fnc_localEvent;
_nozzle setVariable [QGVAR(lastTickMissionTime), nil];
_nozzle setVariable [QGVAR(isRefueling), false, true];
};
Expand Down
1 change: 1 addition & 0 deletions addons/refuel/functions/fnc_turnOff.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]]];
_nozzle setVariable [QGVAR(lastTickMissionTime), nil];
_nozzle setVariable [QGVAR(isRefueling), false, true];
[LSTRING(Hint_Stopped), 1.5, _unit] call EFUNC(common,displayTextStructured);
[QGVAR(stopped), [_nozzle getVariable QGVAR(source), _nozzle getVariable QGVAR(sink)]] call CBA_fnc_localEvent;
1 change: 1 addition & 0 deletions addons/refuel/functions/fnc_turnOn.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]]];
_nozzle setVariable [QGVAR(lastTickMissionTime), CBA_missionTime];
_nozzle setVariable [QGVAR(isRefueling), true, true];
[LSTRING(Hint_Started), 1.5, _unit] call EFUNC(common,displayTextStructured);
[QGVAR(started), [_nozzle getVariable QGVAR(source), _nozzle getVariable QGVAR(sink)]] call CBA_fnc_localEvent;
8 changes: 8 additions & 0 deletions docs/wiki/framework/events-framework.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,14 @@ MenuType: 0 = Interaction, 1 = Self Interaction
|----------|---------|---------|---------|---------|---------|
|`ace_wireCuttingStarted` | [_unit, _fence] | Global | Listen | Fence cutting started

### 2.9 Refuel (`ace_refuel`)

| Event Key | Parameters | Locality | Type | Description |
|----------|---------|---------|---------|---------|---------|
|`ace_refuel_started` | [_source, _target] | Local | Listen | Refueling has started
|`ace_refuel_tick` | [_source, _target, _amount] | Local | Listen | Amount of fuel transferred in a tick
|`ace_refuel_stopped` | [_source, _target] | Local | Listen | Refueling has stopped


## 3. Usage
Also Reference [CBA Events System](https://github.com/CBATeam/CBA_A3/wiki/Custom-Events-System){:target="_blank"} documentation.
Expand Down

0 comments on commit 3946928

Please sign in to comment.