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); [_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), localize LSTRING(ConnectAction),

View File

@ -18,24 +18,12 @@
params [["_unit", objNull, [objNull]], ["_source", objNull, [objNull]]]; params [["_unit", objNull, [objNull]], ["_source", objNull, [objNull]]];
[ private _currentFuel = [_source] call FUNC(getFuel);
TIME_PROGRESSBAR(REFUEL_PROGRESS_DURATION), private _fuelCounter = if (_currentFuel == REFUEL_INFINITE_FUEL) then {
[_unit, _source], _source getVariable [QGVAR(fuelCounter), 0]
{ } else {
params ["_args"]; (_source getVariable [QGVAR(fuelCounter), _currentFuel]) - _currentFuel
_args params [["_unit", objNull, [objNull]], ["_source", objNull, [objNull]]]; };
private _currentFuel = [_source] call FUNC(getFuel); private _fuelCounter = 0.01 * round (100 * _fuelCounter);
if (_currentFuel == REFUEL_INFINITE_FUEL) then { [[LSTRING(Hint_FuelCounter), _fuelCounter], 1.5, _unit] call EFUNC(common,displayTextStructured);
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);

View File

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

View File

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

View File

@ -256,21 +256,6 @@
<Chinesesimp>停止加油</Chinesesimp> <Chinesesimp>停止加油</Chinesesimp>
<Chinese>停止加油</Chinese> <Chinese>停止加油</Chinese>
</Key> </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"> <Key ID="STR_ACE_Refuel_TurnOn">
<English>Start fueling</English> <English>Start fueling</English>
<German>Betankung beginnen</German> <German>Betankung beginnen</German>
@ -286,20 +271,8 @@
<Chinesesimp>开始加油</Chinesesimp> <Chinesesimp>开始加油</Chinesesimp>
<Chinese>開始加油</Chinese> <Chinese>開始加油</Chinese>
</Key> </Key>
<Key ID="STR_ACE_Refuel_TurnOnAction"> <Key ID="STR_ACE_Refuel_CouldNotTurnOn">
<English>Starting fueling...</English> <English>Couldn't turn on fuel nozzle</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> </Key>
<Key ID="STR_ACE_Refuel_Hint_FuelProgress"> <Key ID="STR_ACE_Refuel_Hint_FuelProgress">
<English>%1 Liters fueled</English> <English>%1 Liters fueled</English>
@ -436,21 +409,6 @@
<Chinesesimp>检查燃料表</Chinesesimp> <Chinesesimp>检查燃料表</Chinesesimp>
<Chinese>檢查燃料表</Chinese> <Chinese>檢查燃料表</Chinese>
</Key> </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"> <Key ID="STR_ACE_Refuel_Hint_FuelCounter">
<English>%1 liters have been fueled.</English> <English>%1 liters have been fueled.</English>
<German>%1 Liter wurden getankt.</German> <German>%1 Liter wurden getankt.</German>