Refuel: Turn on nozzle after connection (#5426)

* Turn on nozzle after connection

* Remove some superflous progress bars

* Handle tempFuel var

* Handle conflicts 2: conflict harder

* Remove duplicate code
This commit is contained in:
Ozan Eğitmen 2017-09-21 17:24:58 +03:00 committed by jonpas
parent 90f92db01d
commit 41e1b25397
5 changed files with 23 additions and 94 deletions

View File

@ -122,6 +122,13 @@ private _attachPosModel = _sink worldToModel (ASLtoAGL _bestPosASL);
};
[_unit, _sink, _nozzle, _endPosTestOffset] call FUNC(refuel);
if ([_unit, _nozzle] call FUNC(canTurnOn)) then {
_unit setVariable [QGVAR(tempFuel), nil];
[_unit, _nozzle] call FUNC(turnOn);
} else {
[LSTRING(CouldNotTurnOn)] call EFUNC(common,displayText);
};
},
"",
localize LSTRING(ConnectAction),

View File

@ -18,24 +18,12 @@
params [["_unit", objNull, [objNull]], ["_source", objNull, [objNull]]];
[
TIME_PROGRESSBAR(REFUEL_PROGRESS_DURATION),
[_unit, _source],
{
params ["_args"];
_args params [["_unit", objNull, [objNull]], ["_source", objNull, [objNull]]];
private _currentFuel = [_source] call FUNC(getFuel);
private _fuelCounter = if (_currentFuel == REFUEL_INFINITE_FUEL) then {
_source getVariable [QGVAR(fuelCounter), 0]
} else {
(_source getVariable [QGVAR(fuelCounter), _currentFuel]) - _currentFuel
};
private _currentFuel = [_source] call FUNC(getFuel);
if (_currentFuel == REFUEL_INFINITE_FUEL) then {
private _fuelCounter = 0.01 * round (100 * (_source getVariable [QGVAR(fuelCounter), 0]));
[[LSTRING(Hint_FuelCounter), _fuelCounter], 1.5, _unit] call EFUNC(common,displayTextStructured);
} else {
private _fuelCounter = 0.01 * round (100 * ((_source getVariable [QGVAR(fuelCounter), _currentFuel]) - _currentFuel));
[[LSTRING(Hint_FuelCounter), _fuelCounter], 1.5, _unit] call EFUNC(common,displayTextStructured);
};
},
"",
localize LSTRING(CheckFuelCounterAction),
{true},
[INTERACT_EXCEPTIONS]
] call EFUNC(common,progressBar);
private _fuelCounter = 0.01 * round (100 * _fuelCounter);
[[LSTRING(Hint_FuelCounter), _fuelCounter], 1.5, _unit] call EFUNC(common,displayTextStructured);

View File

@ -18,18 +18,6 @@
params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]]];
[
TIME_PROGRESSBAR(REFUEL_PROGRESS_DURATION),
[_unit, _nozzle],
{
params ["_args"];
_args 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);
},
"",
localize LSTRING(TurnOffAction),
{true},
[INTERACT_EXCEPTIONS]
] call EFUNC(common,progressBar);
_nozzle setVariable [QGVAR(lastTickMissionTime), nil];
_nozzle setVariable [QGVAR(isRefueling), false, true];
[LSTRING(Hint_Stopped), 1.5, _unit] call EFUNC(common,displayTextStructured);

View File

@ -18,18 +18,6 @@
params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]]];
[
TIME_PROGRESSBAR(REFUEL_PROGRESS_DURATION),
[_unit, _nozzle],
{
params ["_args"];
_args 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);
},
"",
localize LSTRING(TurnOnAction),
{true},
[INTERACT_EXCEPTIONS]
] call EFUNC(common,progressBar);
_nozzle setVariable [QGVAR(lastTickMissionTime), CBA_missionTime];
_nozzle setVariable [QGVAR(isRefueling), true, true];
[LSTRING(Hint_Started), 1.5, _unit] call EFUNC(common,displayTextStructured);

View File

@ -256,21 +256,6 @@
<Chinesesimp>停止加油</Chinesesimp>
<Chinese>停止加油</Chinese>
</Key>
<Key ID="STR_ACE_Refuel_TurnOffAction">
<English>Stopping fueling...</English>
<German>Stoppe Betankung...</German>
<Polish>Zatrzymywanie tankowania...</Polish>
<Russian>Останавливаем заправку...</Russian>
<Portuguese>Parando reabastecimento...</Portuguese>
<Czech>Zastavuji tankování...</Czech>
<Italian>Fermando il rifornimento...</Italian>
<Spanish>Deteniendo reabastecimiento...</Spanish>
<French>Arrête le ravitaillement...</French>
<Japanese>給油をやめている・・・</Japanese>
<Korean>재급유 그만하는중...</Korean>
<Chinesesimp>停止加油中...</Chinesesimp>
<Chinese>停止加油中...</Chinese>
</Key>
<Key ID="STR_ACE_Refuel_TurnOn">
<English>Start fueling</English>
<German>Betankung beginnen</German>
@ -286,20 +271,8 @@
<Chinesesimp>开始加油</Chinesesimp>
<Chinese>開始加油</Chinese>
</Key>
<Key ID="STR_ACE_Refuel_TurnOnAction">
<English>Starting fueling...</English>
<German>Beginne Betankung...</German>
<Polish>Rozpoczynanie tankowania...</Polish>
<Russian>Начинаем заправку...</Russian>
<Portuguese>Começando reabastecimento...</Portuguese>
<Czech>Spouštím tankování...</Czech>
<Italian>Iniziando il rifornimento...</Italian>
<Spanish>Comenzando reabastecimiento...</Spanish>
<French>Début du ravitaillement...</French>
<Japanese>給油を始めている・・・</Japanese>
<Korean>재급유 시작중...</Korean>
<Chinesesimp>开始加油中...</Chinesesimp>
<Chinese>開始加油中...</Chinese>
<Key ID="STR_ACE_Refuel_CouldNotTurnOn">
<English>Couldn't turn on fuel nozzle</English>
</Key>
<Key ID="STR_ACE_Refuel_Hint_FuelProgress">
<English>%1 Liters fueled</English>
@ -436,21 +409,6 @@
<Chinesesimp>检查燃料表</Chinesesimp>
<Chinese>檢查燃料表</Chinese>
</Key>
<Key ID="STR_ACE_Refuel_CheckFuelCounterAction">
<English>Checking fuel counter...</English>
<German>Betrachte Tankuhr...</German>
<Polish>Sprawdzanie wskaźnika paliwa...</Polish>
<Russian>Проверяем счетчик топлива...</Russian>
<Portuguese>Verificando contador de combustível...</Portuguese>
<Czech>Konroluji palivoměr...</Czech>
<Italian>Controllando l'indicatore del livello benzina...</Italian>
<Spanish>Verificando el contador de combustible</Spanish>
<French>Vérification du compteur...</French>
<Japanese>燃料計を見ている・・・</Japanese>
<Korean>연료카운터 확인중...</Korean>
<Chinesesimp>检查燃料表中...</Chinesesimp>
<Chinese>檢查燃料表中...</Chinese>
</Key>
<Key ID="STR_ACE_Refuel_Hint_FuelCounter">
<English>%1 liters have been fueled.</English>
<German>%1 Liter wurden getankt.</German>