Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refuel - Add events for start, stop and progress #7023

Merged
merged 6 commits into from
Oct 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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