From f54beb5c86e20701008c8d8c126be8c964f389fd Mon Sep 17 00:00:00 2001 From: IngoKauffmann Date: Tue, 18 Aug 2015 00:42:35 +0200 Subject: [PATCH] Many things Added correct hooks for fuel trucks Added code for finding closest hook Cleanup --- addons/refuel/CfgVehicles.hpp | 121 +++++------------- addons/refuel/functions/fnc_canCheckFuel.sqf | 10 +- .../refuel/functions/fnc_canConnectNozzle.sqf | 3 +- addons/refuel/functions/fnc_canDisconnect.sqf | 8 +- addons/refuel/functions/fnc_canRefuel.sqf | 3 +- addons/refuel/functions/fnc_canTakeNozzle.sqf | 1 - addons/refuel/functions/fnc_canTurnOff.sqf | 2 +- addons/refuel/functions/fnc_checkFuel.sqf | 2 +- .../functions/fnc_connectNozzleAction.sqf | 5 +- addons/refuel/functions/fnc_disconnect.sqf | 3 +- addons/refuel/functions/fnc_getFuel.sqf | 2 +- addons/refuel/functions/fnc_refuel.sqf | 21 +-- addons/refuel/functions/fnc_returnNozzle.sqf | 9 +- addons/refuel/functions/fnc_setFuel.sqf | 6 +- addons/refuel/functions/fnc_takeNozzle.sqf | 25 ++-- addons/refuel/functions/fnc_turnOff.sqf | 2 +- addons/refuel/script_component.hpp | 2 +- addons/refuel/stringtable.xml | 31 +---- 18 files changed, 95 insertions(+), 161 deletions(-) diff --git a/addons/refuel/CfgVehicles.hpp b/addons/refuel/CfgVehicles.hpp index 1250167a48..c5e797ef2e 100644 --- a/addons/refuel/CfgVehicles.hpp +++ b/addons/refuel/CfgVehicles.hpp @@ -115,7 +115,6 @@ class CfgVehicles { }; class Sign_Sphere10cm_F; - class ACE_refuel_fuelNozzle : Sign_Sphere10cm_F { XEH_ENABLED; MACRO_NOZZLE_ACTIONS @@ -125,16 +124,7 @@ class CfgVehicles { class Static : All {}; - class Building : Static { - class ACE_Actions { - class ACE_MainActions { - displayName = ECSTRING(interaction,MainAction); - selection = ""; - distance = 10; - condition = "true"; - }; - }; - }; + class Building : Static {}; class NonStrategic : Building {}; @@ -144,9 +134,16 @@ class CfgVehicles { class House_F : House {}; - class House_Small_F : House_F {}; - - class Strategic : Building {}; + class House_Small_F : House_F { + class ACE_Actions { + class ACE_MainActions { + displayName = ECSTRING(interaction,MainAction); + selection = ""; + distance = 10; + condition = "true"; + }; + }; + }; class AllVehicles : All { GVAR(flowRate) = 1; @@ -291,14 +288,14 @@ class CfgVehicles { GVAR(fuelCapacity) = 80; }; - class Van_01_fuel_base_F : Van_01_base_F { + class Van_01_fuel_base_F: Van_01_base_F { transportFuel = 0; //1k MACRO_REFUEL_ACTIONS - GVAR(hooks[]) = {{0,0,0}}; + GVAR(hooks[]) = {{0.38,-3.17,-.7},{-0.41,-3.17,-.7}}; GVAR(fuelCargo) = 2000; }; - class Tank_F : Tank { + class Tank_F: Tank { GVAR(fuelCapacity) = 1200; }; @@ -310,14 +307,14 @@ class CfgVehicles { class B_APC_Tracked_01_base_F: APC_Tracked_01_base_F {}; - class B_APC_Tracked_01_CRV_F : B_APC_Tracked_01_base_F { + class B_APC_Tracked_01_CRV_F: B_APC_Tracked_01_base_F { transportFuel = 0; //3k MACRO_REFUEL_ACTIONS - GVAR(hooks[]) = {{0,0,0}}; + GVAR(hooks[]) = {{-1.08,-4.81,-.8}}; GVAR(fuelCargo) = 1000; }; - class APC_Tracked_02_base_F: Tank_F { + class APC_Tracked_02_base_F : Tank_F { // BM-2T // Assuming 1 L/km GVAR(fuelCapacity) = 1000; @@ -432,31 +429,24 @@ class CfgVehicles { }; // Vanilla fuel vehicles - class I_Truck_02_fuel_F : Truck_02_base_F { + class Truck_02_fuel_base_F : Truck_02_base_F { transportFuel = 0; //3k MACRO_REFUEL_ACTIONS - GVAR(hooks[]) = {{0,0,0}}; - GVAR(fuelCargo) = 10000; - }; - - class O_Truck_02_fuel_F : Truck_02_base_F { - transportFuel = 0; //3k - MACRO_REFUEL_ACTIONS - GVAR(hooks[]) = {{0,0,0}}; + GVAR(hooks[]) = {{0.99,-3.47,-0.67},{-1.04,-3.47,-0.67}}; GVAR(fuelCargo) = 10000; }; class B_Truck_01_fuel_F : B_Truck_01_mover_F { transportFuel = 0; //3k MACRO_REFUEL_ACTIONS - GVAR(hooks[]) = {{0,0,0}}; + GVAR(hooks[]) = {{.28,-4.99,-.3},{-.25,-4.99,-.3}}; GVAR(fuelCargo) = 10000; }; class O_Truck_03_fuel_F : Truck_03_base_F { transportFuel = 0; //3k MACRO_REFUEL_ACTIONS - GVAR(hooks[]) = {{0,0,0}}; + GVAR(hooks[]) = {{1.3,-1.59,-.62},{-1.16,-1.59,-.62}}; GVAR(fuelCargo) = 10000; }; @@ -474,90 +464,45 @@ class CfgVehicles { }; class B_Slingload_01_Fuel_F : Slingload_01_Base_F { + XEH_ENABLED; transportFuel = 0; //3k MACRO_REFUEL_ACTIONS - GVAR(hooks[]) = {{0,0,0}}; + GVAR(hooks[]) = {{0.55,3.02,-0.5},{-0.52,3.02,-0.5}}; GVAR(fuelCargo) = 10000; }; class O_Heli_Transport_04_fuel_F : Heli_Transport_04_base_F { + XEH_ENABLED; transportFuel = 0; //3k MACRO_REFUEL_ACTIONS - GVAR(hooks[]) = {{0,0,0}}; + GVAR(hooks[]) = {{-1.52,1.14,-1.18}}; GVAR(fuelCargo) = 10000; }; class Pod_Heli_Transport_04_base_F : StaticWeapon {}; - class Land_Pod_Heli_Transport_04_fuel_F : Pod_Heli_Transport_04_base_F { + XEH_ENABLED; transportFuel = 0; //3k MACRO_REFUEL_ACTIONS - GVAR(hooks[]) = {{0,0,0}}; + GVAR(hooks[]) = {{-1.49,1.41,-.3}}; GVAR(fuelCargo) = 10000; }; // Vanilla buildings class Land_Fuelstation_Feed_F : House_Small_F { + XEH_ENABLED; transportFuel = 0; //50k MACRO_REFUEL_ACTIONS - GVAR(hooks[]) = {{0,0,0}}; - GVAR(fuelCargo) = -1; + GVAR(hooks[]) = {{0,0,-1}}; + GVAR(fuelCargo) = INFINITE_FUEL; }; class Land_fs_feed_F : House_Small_F { + XEH_ENABLED; transportFuel = 0; //50k MACRO_REFUEL_ACTIONS - GVAR(hooks[]) = {{0,0,0}}; - GVAR(fuelCargo) = -1; - }; - - class FuelStation : Strategic { - transportFuel = 0; //50k - MACRO_REFUEL_ACTIONS - GVAR(hooks[]) = {{0,0,0}}; - GVAR(fuelCargo) = -1; - }; - - class Land_Fuelstation : Strategic { - transportFuel = 0; //50k - MACRO_REFUEL_ACTIONS - GVAR(hooks[]) = {{0,0,0}}; - GVAR(fuelCargo) = -1; - }; - - class Land_Fuelstation_army : Strategic { - transportFuel = 0; //50k - MACRO_REFUEL_ACTIONS - GVAR(hooks[]) = {{0,0,0}}; - GVAR(fuelCargo) = -1; - }; - - class Land_Benzina_schnell : Strategic { - transportFuel = 0; //50k - MACRO_REFUEL_ACTIONS - GVAR(hooks[]) = {{0,0,0}}; - GVAR(fuelCargo) = -1; - }; - - class Land_A_FuelStation_Feed : Strategic { - transportFuel = 0; //50k - MACRO_REFUEL_ACTIONS - GVAR(hooks[]) = {{0,0,0}}; - GVAR(fuelCargo) = -1; - }; - - class Land_Ind_FuelStation_Feed_EP1 : Strategic { - transportFuel = 0; //50k - MACRO_REFUEL_ACTIONS - GVAR(hooks[]) = {{0,0,0}}; - GVAR(fuelCargo) = -1; - }; - - class Land_FuelStation_Feed_PMC : Strategic { - transportFuel = 0; //50k - MACRO_REFUEL_ACTIONS - GVAR(hooks[]) = {{0,0,0}}; - GVAR(fuelCargo) = -1; + GVAR(hooks[]) = {{-0.4,0.022,-.23}}; + GVAR(fuelCargo) = INFINITE_FUEL; }; /* // Barrels from rhs? diff --git a/addons/refuel/functions/fnc_canCheckFuel.sqf b/addons/refuel/functions/fnc_canCheckFuel.sqf index 0abd2c5f21..6d75f49675 100644 --- a/addons/refuel/functions/fnc_canCheckFuel.sqf +++ b/addons/refuel/functions/fnc_canCheckFuel.sqf @@ -1,5 +1,5 @@ /* - * Author: Jonpas + * Author: Jonpas, GitHawk * Checks if unit can check fuel. * * Arguments: @@ -18,6 +18,8 @@ params ["_unit", "_target"]; -if (isNull _unit || {!(_unit isKindOf "CAManBase")} || {!local _unit} || {(_target distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false}; - -true +!(isNull _unit || + {!(_unit isKindOf "CAManBase")} || + {!local _unit} || + {(_target distance _unit) > REFUEL_ACTION_DISTANCE} || + {(_target call FUNC(getFuel) == INFINITE_FUEL)}) diff --git a/addons/refuel/functions/fnc_canConnectNozzle.sqf b/addons/refuel/functions/fnc_canConnectNozzle.sqf index f2314eb67e..0dfd89605b 100644 --- a/addons/refuel/functions/fnc_canConnectNozzle.sqf +++ b/addons/refuel/functions/fnc_canConnectNozzle.sqf @@ -20,6 +20,5 @@ private ["_nozzle"]; params ["_unit", "_target"]; _nozzle = _unit getVariable QGVAR(nozzle); -if (isNil "_nozzle" || {(_target distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false}; -true +!(isNil "_nozzle" || {(_target distance _unit) > REFUEL_ACTION_DISTANCE}) diff --git a/addons/refuel/functions/fnc_canDisconnect.sqf b/addons/refuel/functions/fnc_canDisconnect.sqf index 6453e54b86..72d017b50d 100644 --- a/addons/refuel/functions/fnc_canDisconnect.sqf +++ b/addons/refuel/functions/fnc_canDisconnect.sqf @@ -16,7 +16,7 @@ */ #include "script_component.hpp" -private ["_nozzle", "_sink", "_fueling"]; +private ["_nozzle", "_sink"]; params ["_unit", "_nozzleHolder"]; if (isNull _unit || {!(_unit isKindOf "CAManBase")} || {!local _unit} || {(_nozzleHolder distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false}; @@ -25,9 +25,5 @@ _nozzle = _nozzleHolder getVariable [QGVAR(nozzle), objNull]; if (isNull _nozzle) exitWith {false}; _sink = _nozzle getVariable [QGVAR(sink), objNull]; -if (isNull _sink) exitWith {false}; -_fueling = _nozzle getVariable [QGVAR(fueling), 0]; -if (_fueling == 1) exitWith {false}; - -true +!((isNull _sink) || {_nozzle getVariable [QGVAR(isRefueling), false]}); diff --git a/addons/refuel/functions/fnc_canRefuel.sqf b/addons/refuel/functions/fnc_canRefuel.sqf index 72d10e4058..47ef651f88 100644 --- a/addons/refuel/functions/fnc_canRefuel.sqf +++ b/addons/refuel/functions/fnc_canRefuel.sqf @@ -20,6 +20,5 @@ params ["_unit", "_target"]; if (isNull _unit || {!(_unit isKindOf "CAManBase")} || {!local _unit} || {(_target distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false}; _fuel = [_target] call FUNC(getFuel); -if (_fuel > 0 || {_fuel == -1}) exitWith {true}; -false +(_fuel > 0 || {_fuel == -1}) diff --git a/addons/refuel/functions/fnc_canTakeNozzle.sqf b/addons/refuel/functions/fnc_canTakeNozzle.sqf index df61329a23..b939778ce8 100644 --- a/addons/refuel/functions/fnc_canTakeNozzle.sqf +++ b/addons/refuel/functions/fnc_canTakeNozzle.sqf @@ -20,5 +20,4 @@ params ["_unit", "_target"]; if (isNull _unit || {!(_unit isKindOf "CAManBase")} || {!local _unit} || {(_target distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false}; -// Check if the fuel source is already in use !(_target getVariable [QGVAR(isConnected), false]) && {!(_unit getVariable [QGVAR(isRefueling), false])} diff --git a/addons/refuel/functions/fnc_canTurnOff.sqf b/addons/refuel/functions/fnc_canTurnOff.sqf index 9e62778f18..c16b8308fd 100644 --- a/addons/refuel/functions/fnc_canTurnOff.sqf +++ b/addons/refuel/functions/fnc_canTurnOff.sqf @@ -20,4 +20,4 @@ params ["_unit", "_nozzleHolder"]; if (isNull _unit || {!(_unit isKindOf "CAManBase")} || {!local _unit} || {(_nozzleHolder distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false}; -!(isNull (_nozzleHolder getVariable [QGVAR(nozzle), objNull])) && {(_nozzleHolder getVariable QGVAR(nozzle)) getVariable [QGVAR(fueling), 0] != 0} +!(isNull (_nozzleHolder getVariable [QGVAR(nozzle), objNull])) && {(_nozzleHolder getVariable QGVAR(nozzle)) getVariable [QGVAR(isRefueling), false]} diff --git a/addons/refuel/functions/fnc_checkFuel.sqf b/addons/refuel/functions/fnc_checkFuel.sqf index 81da60ed95..51af1f8df4 100644 --- a/addons/refuel/functions/fnc_checkFuel.sqf +++ b/addons/refuel/functions/fnc_checkFuel.sqf @@ -15,7 +15,7 @@ * Public: No */ #include "script_component.hpp" -private ["_fuel", "_type"]; +private ["_fuel"]; params ["_unit", "_target"]; _fuel = [_target] call FUNC(getFuel); diff --git a/addons/refuel/functions/fnc_connectNozzleAction.sqf b/addons/refuel/functions/fnc_connectNozzleAction.sqf index 4fa30943a1..5cb3daea91 100644 --- a/addons/refuel/functions/fnc_connectNozzleAction.sqf +++ b/addons/refuel/functions/fnc_connectNozzleAction.sqf @@ -80,12 +80,11 @@ detach _nozzle; _weaponSelect = _unit getVariable QGVAR(selectedWeaponOnRefuel); _unit selectWeapon _weaponSelect; _unit setVariable [QGVAR(selectedWeaponOnRefuel), nil]; +_unit setVariable [QGVAR(isRefueling), false]; _nozzle attachTo [_target, _endPosTestOffset]; _nozzle setVariable [QGVAR(sink), _target, true]; -_nozzle setVariable [QGVAR(fueling), 1, true]; +_nozzle setVariable [QGVAR(isRefueling), true, true]; _target setVariable [QGVAR(nozzle), _nozzle, true]; [_unit, _target, _nozzle] call FUNC(refuel); - -true diff --git a/addons/refuel/functions/fnc_disconnect.sqf b/addons/refuel/functions/fnc_disconnect.sqf index 7d3d5be846..1290d90091 100644 --- a/addons/refuel/functions/fnc_disconnect.sqf +++ b/addons/refuel/functions/fnc_disconnect.sqf @@ -16,12 +16,13 @@ */ #include "script_component.hpp" +private ["_nozzle"]; params ["_unit", "_nozzleHolder"]; _nozzle = _nozzleHolder getVariable QGVAR(nozzle); detach _nozzle; -_nozzle setVariable [QGVAR(sink), objNull]; +_nozzle setVariable [QGVAR(sink), objNull, true]; _nozzleHolder setVariable [QGVAR(nozzle), objNull, true]; _unit setVariable [QGVAR(nozzle), _nozzle]; diff --git a/addons/refuel/functions/fnc_getFuel.sqf b/addons/refuel/functions/fnc_getFuel.sqf index a9f5aae11f..038119bd46 100644 --- a/addons/refuel/functions/fnc_getFuel.sqf +++ b/addons/refuel/functions/fnc_getFuel.sqf @@ -18,7 +18,7 @@ private ["_fuel"]; params ["_target"]; -_fuel = _target getVariable [QGVAR(currentFuelCargo), nil]; +_fuel = _target getVariable QGVAR(currentFuelCargo); if (isNil "_fuel") then { _fuel = getNumber (configFile >> "CfgVehicles" >> typeOf _target >> QGVAR(fuelCargo)); diff --git a/addons/refuel/functions/fnc_refuel.sqf b/addons/refuel/functions/fnc_refuel.sqf index 08889e0468..1b21facb82 100644 --- a/addons/refuel/functions/fnc_refuel.sqf +++ b/addons/refuel/functions/fnc_refuel.sqf @@ -29,25 +29,30 @@ _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(f params ["_args", "_pfID"]; _args params ["_unit", "_nozzle", "_rate", "_startFuel", "_maxFuel"]; - _fueling = _nozzle getVariable [QGVAR(fueling), 0]; + _fueling = _nozzle getVariable [QGVAR(isRefueling), false]; _source = _nozzle getVariable [QGVAR(source), objNull]; _sink = _nozzle getVariable [QGVAR(sink), objNull]; - if (isNull _source || {isNull _sink} || {(_source distance _sink) > 10}) exitWith { + if (isNull _source || {isNull _sink} || {(_sink distance (_source modelToWorld (_nozzle getVariable [QGVAR(attachPos), [0,0,0]]))) > 10}) exitWith { [LSTRING(Hint_TooFar), 2, _unit] call EFUNC(common,displayTextStructured); detach _nozzle; _nozzle setPosATL [(getPosATL _nozzle) select 0,(getPosATL _nozzle) select 1, 0]; - _nozzle setVariable [QGVAR(sink), objNull]; + _nozzle setVelocity [0, 0, 0]; + _nozzle setVariable [QGVAR(isRefueling), false, true]; + _nozzle setVariable [QGVAR(sink), objNull, true]; + _sink setVariable [QGVAR(nozzle), objNull, true]; [_pfID] call cba_fnc_removePerFrameHandler; }; _fuelInSource = [_source] call FUNC(getFuel); if (_fuelInSource == 0) exitWith { [LSTRING(Hint_SourceEmpty), 2, _unit] call EFUNC(common,displayTextStructured); - _nozzle setVariable [QGVAR(fueling), 0, true]; + _nozzle setVariable [QGVAR(isRefueling), false, true]; [_pfID] call cba_fnc_removePerFrameHandler; }; _finished = false; - _fuelInSource = _fuelInSource - _rate; + if !(_fuelInSource == INFINITE_FUEL) then { + _fuelInSource = _fuelInSource - _rate; + }; if (_fuelInSource < 0 && {_fuelInSource > -1}) then { _fuelInSource = 0; _finished = true; @@ -67,11 +72,11 @@ _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(f }; [_unit, _source, _fuelInSource] call FUNC(setFuel); - if (_finished || {_fueling == 0}) exitWith { - if (_fueling == 0) then { + if (_finished || {!_fueling}) exitWith { + if !(_fueling) then { [LSTRING(Hint_Stopped), 2, _unit] call EFUNC(common,displayTextStructured); }; - _nozzle setVariable [QGVAR(fueling), 0, true]; + _nozzle setVariable [QGVAR(isRefueling), false, true]; [_pfID] call cba_fnc_removePerFrameHandler; }; diff --git a/addons/refuel/functions/fnc_returnNozzle.sqf b/addons/refuel/functions/fnc_returnNozzle.sqf index 0bf1bc4406..21571282e6 100644 --- a/addons/refuel/functions/fnc_returnNozzle.sqf +++ b/addons/refuel/functions/fnc_returnNozzle.sqf @@ -1,5 +1,5 @@ /* - * Author: GitHawk et.al., Jonpas + * Author: GitHawk, Jonpas * Returns the nozzle back to source vehicle. * * Arguments: @@ -16,14 +16,13 @@ */ #include "script_component.hpp" -private ["_nozzle"]; - +private ["_nozzle", "_dummy"]; params ["_unit", "_target"]; -_source = _nozzle getVariable QGVAR(source); _nozzle = _unit getVariable QGVAR(nozzle); +_source = _nozzle getVariable QGVAR(source); -if (_source != _target || {isNil "_nozzle"}) exitWith {false}; +if (isNil "_nozzle" || {_source != _target}) exitWith {false}; _unit setVariable [QGVAR(nozzle), nil]; detach _nozzle; diff --git a/addons/refuel/functions/fnc_setFuel.sqf b/addons/refuel/functions/fnc_setFuel.sqf index f5f3edbe10..8e6aadc0f7 100644 --- a/addons/refuel/functions/fnc_setFuel.sqf +++ b/addons/refuel/functions/fnc_setFuel.sqf @@ -19,6 +19,10 @@ private ["_maxFuel"]; params ["_unit", "_target", "_fuel"]; -if (isNull _unit || {isNull _target} || {!(_unit isKindOf "CAManBase")} || {!local _unit} || { (_target distance _unit) > 7}) exitWith {0}; +if (isNull _unit || + {isNull _target} || + {!(_unit isKindOf "CAManBase")} || + {!local _unit} || + {(_target distance _unit) > 7}) exitWith {}; _target setVariable [QGVAR(currentFuelCargo), (getNumber (configFile >> "CfgVehicles" >> typeOf _target >> QGVAR(fuelCargo))) min _fuel, true]; diff --git a/addons/refuel/functions/fnc_takeNozzle.sqf b/addons/refuel/functions/fnc_takeNozzle.sqf index 96e4c48ed7..7699c9797c 100644 --- a/addons/refuel/functions/fnc_takeNozzle.sqf +++ b/addons/refuel/functions/fnc_takeNozzle.sqf @@ -26,19 +26,27 @@ _unit setVariable [QGVAR(selectedWeaponOnRefuel), currentWeapon _unit]; _unit action ["SwitchWeapon", _unit, _unit, 99]; if (isNull _nozzle) then { // func is called on fuel truck - _endPosOffset = getArray (configFile >> "CfgVehicles" >> typeOf _target >> "ace_refuel_hooks") select 0; + _endPosOffset = getArray (configFile >> "CfgVehicles" >> typeOf _target >> "ace_refuel_hooks"); + if (count _endPosOffset == 2) then { + if (_unit distance (_target modelToWorld (_endPosOffset select 0)) < _unit distance (_target modelToWorld (_endPosOffset select 1))) then { + _endPosOffset = _endPosOffset select 0; + } else { + _endPosOffset = _endPosOffset select 1; + }; + } else { + _endPosOffset = _endPosOffset select 0; + }; // TODO add pickup animation ? [{ - params ["_unit", "_target"]; + params ["_unit", "_target", "_endPosOffset"]; _newNozzle = "ACE_refuel_fuelNozzle" createVehicle position _unit; _newNozzle attachTo [_unit, [-0.02,-0.05,0], "righthandmiddle1"]; // TODO replace with right coordinates for real model _unit setVariable [QGVAR(nozzle), _newNozzle]; - // Create rope with offset -1 to prevent wrapping over interaction base point - _rope = ropeCreate [_target, [0, 0, -1], _newNozzle, [0, 0, 0], 12]; - + _rope = ropeCreate [_target, _endPosOffset, _newNozzle, [0, 0, 0], 12]; + _newNozzle setVariable [QGVAR(attachPos), _endPosOffset, true]; _newNozzle setVariable [QGVAR(source), _target, true]; _newNozzle setVariable [QGVAR(rope), _rope, true]; _target setVariable [QGVAR(isConnected), true, true]; @@ -47,14 +55,15 @@ if (isNull _nozzle) then { // func is called on fuel truck [{ private ["_nozzle"]; params ["_args", "_pfID"]; - _args params ["_unit", "_target"]; + _args params ["_unit", "_source", "_endPosOffset"]; - if ((_unit distance _target) > 10) exitWith { + if (_unit distance (_source modelToWorld _endPosOffset) > 10) exitWith { _nozzle = _unit getVariable [QGVAR(nozzle), objNull]; if !(isNull _nozzle) then { detach _nozzle; _nozzle setPosATL [(getPosATL _unit) select 0,(getPosATL _unit) select 1, 0]; _nozzle setVelocity [0,0,0]; + _nozzle setVariable [QGVAR(isRefueling), false, true]; _unit setVariable [QGVAR(isRefueling), false]; _unit setVariable [QGVAR(nozzle), objNull]; @@ -67,7 +76,7 @@ if (isNull _nozzle) then { // func is called on fuel truck }; [_pfID] call cba_fnc_removePerFrameHandler; }; - }, 0, [_unit, _target]] call cba_fnc_addPerFrameHandler; + }, 0, [_unit, _target, _endPosOffset]] call cba_fnc_addPerFrameHandler; _unit setVariable [QGVAR(isRefueling), true]; } else { // func is called in muzzle either connected or on ground diff --git a/addons/refuel/functions/fnc_turnOff.sqf b/addons/refuel/functions/fnc_turnOff.sqf index babc360d0a..7637399878 100644 --- a/addons/refuel/functions/fnc_turnOff.sqf +++ b/addons/refuel/functions/fnc_turnOff.sqf @@ -17,4 +17,4 @@ params ["_nozzleHolder"]; -(_nozzleHolder getVariable QGVAR(nozzle)) setVariable [QGVAR(fueling), 0]; +(_nozzleHolder getVariable QGVAR(nozzle)) setVariable [QGVAR(isRefueling), false, true]; diff --git a/addons/refuel/script_component.hpp b/addons/refuel/script_component.hpp index b24e276a52..fb0afb9ba4 100644 --- a/addons/refuel/script_component.hpp +++ b/addons/refuel/script_component.hpp @@ -11,5 +11,5 @@ #include "\z\ace\addons\main\script_macros.hpp" - +#define INFINITE_FUEL -1 #define REFUEL_ACTION_DISTANCE 7 diff --git a/addons/refuel/stringtable.xml b/addons/refuel/stringtable.xml index 461b5bc2b7..61adcc0890 100644 --- a/addons/refuel/stringtable.xml +++ b/addons/refuel/stringtable.xml @@ -3,7 +3,7 @@ Refuel Settings - Tankeinstellungen + Betankung Flow Rate @@ -21,32 +21,9 @@ Realistic Realistisch - - Civilian Volume - Ziviles Volumen - - - How many liters does a civilian tank truck hold? -1 is infinite. - Wieviele Liter enthält ein ziviler Tankwagen? -1 bedeutet unendlich. - - - Military Volume - Militärisches Volumen - - - How many liters does a military tank truck hold? -1 is infinite. - Wieviele Liter enthält ein militärischer Tankwagen? -1 bedeutet unendlich. - - - Stationary Volume - Stationäres Volumen - - - How many liters does a stationary object e.g. a fuel station hold? -1 is infinite. - Wieviele Liter enthält ein stationäres Objekt z.B. eine Tankstelle? -1 bedeutet unendlich. - Refuel + Betankung Take fuel nozzle @@ -65,8 +42,8 @@ Anschließen - Check remaining fuel - Verbleibenden Kraftstoff überprüfen + Check remaining fuel ... + Verbleibenden Kraftstoff überprüfen ... There are %1 liters left.