Many things

Added correct hooks for fuel trucks
Added code for finding closest hook
Cleanup
This commit is contained in:
IngoKauffmann 2015-08-18 00:42:35 +02:00
parent 1bba0681c8
commit f54beb5c86
18 changed files with 95 additions and 161 deletions

View File

@ -115,7 +115,6 @@ class CfgVehicles {
}; };
class Sign_Sphere10cm_F; class Sign_Sphere10cm_F;
class ACE_refuel_fuelNozzle : Sign_Sphere10cm_F { class ACE_refuel_fuelNozzle : Sign_Sphere10cm_F {
XEH_ENABLED; XEH_ENABLED;
MACRO_NOZZLE_ACTIONS MACRO_NOZZLE_ACTIONS
@ -125,16 +124,7 @@ class CfgVehicles {
class Static : All {}; class Static : All {};
class Building : Static { class Building : Static {};
class ACE_Actions {
class ACE_MainActions {
displayName = ECSTRING(interaction,MainAction);
selection = "";
distance = 10;
condition = "true";
};
};
};
class NonStrategic : Building {}; class NonStrategic : Building {};
@ -144,9 +134,16 @@ class CfgVehicles {
class House_F : House {}; class House_F : House {};
class House_Small_F : House_F {}; class House_Small_F : House_F {
class ACE_Actions {
class Strategic : Building {}; class ACE_MainActions {
displayName = ECSTRING(interaction,MainAction);
selection = "";
distance = 10;
condition = "true";
};
};
};
class AllVehicles : All { class AllVehicles : All {
GVAR(flowRate) = 1; GVAR(flowRate) = 1;
@ -291,14 +288,14 @@ class CfgVehicles {
GVAR(fuelCapacity) = 80; 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 transportFuel = 0; //1k
MACRO_REFUEL_ACTIONS MACRO_REFUEL_ACTIONS
GVAR(hooks[]) = {{0,0,0}}; GVAR(hooks[]) = {{0.38,-3.17,-.7},{-0.41,-3.17,-.7}};
GVAR(fuelCargo) = 2000; GVAR(fuelCargo) = 2000;
}; };
class Tank_F : Tank { class Tank_F: Tank {
GVAR(fuelCapacity) = 1200; 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_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 transportFuel = 0; //3k
MACRO_REFUEL_ACTIONS MACRO_REFUEL_ACTIONS
GVAR(hooks[]) = {{0,0,0}}; GVAR(hooks[]) = {{-1.08,-4.81,-.8}};
GVAR(fuelCargo) = 1000; GVAR(fuelCargo) = 1000;
}; };
class APC_Tracked_02_base_F: Tank_F { class APC_Tracked_02_base_F : Tank_F {
// BM-2T // BM-2T
// Assuming 1 L/km // Assuming 1 L/km
GVAR(fuelCapacity) = 1000; GVAR(fuelCapacity) = 1000;
@ -432,31 +429,24 @@ class CfgVehicles {
}; };
// Vanilla fuel vehicles // 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 transportFuel = 0; //3k
MACRO_REFUEL_ACTIONS 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 O_Truck_02_fuel_F : Truck_02_base_F {
transportFuel = 0; //3k
MACRO_REFUEL_ACTIONS
GVAR(hooks[]) = {{0,0,0}};
GVAR(fuelCargo) = 10000; GVAR(fuelCargo) = 10000;
}; };
class B_Truck_01_fuel_F : B_Truck_01_mover_F { class B_Truck_01_fuel_F : B_Truck_01_mover_F {
transportFuel = 0; //3k transportFuel = 0; //3k
MACRO_REFUEL_ACTIONS MACRO_REFUEL_ACTIONS
GVAR(hooks[]) = {{0,0,0}}; GVAR(hooks[]) = {{.28,-4.99,-.3},{-.25,-4.99,-.3}};
GVAR(fuelCargo) = 10000; GVAR(fuelCargo) = 10000;
}; };
class O_Truck_03_fuel_F : Truck_03_base_F { class O_Truck_03_fuel_F : Truck_03_base_F {
transportFuel = 0; //3k transportFuel = 0; //3k
MACRO_REFUEL_ACTIONS MACRO_REFUEL_ACTIONS
GVAR(hooks[]) = {{0,0,0}}; GVAR(hooks[]) = {{1.3,-1.59,-.62},{-1.16,-1.59,-.62}};
GVAR(fuelCargo) = 10000; GVAR(fuelCargo) = 10000;
}; };
@ -474,90 +464,45 @@ class CfgVehicles {
}; };
class B_Slingload_01_Fuel_F : Slingload_01_Base_F { class B_Slingload_01_Fuel_F : Slingload_01_Base_F {
XEH_ENABLED;
transportFuel = 0; //3k transportFuel = 0; //3k
MACRO_REFUEL_ACTIONS 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; GVAR(fuelCargo) = 10000;
}; };
class O_Heli_Transport_04_fuel_F : Heli_Transport_04_base_F { class O_Heli_Transport_04_fuel_F : Heli_Transport_04_base_F {
XEH_ENABLED;
transportFuel = 0; //3k transportFuel = 0; //3k
MACRO_REFUEL_ACTIONS MACRO_REFUEL_ACTIONS
GVAR(hooks[]) = {{0,0,0}}; GVAR(hooks[]) = {{-1.52,1.14,-1.18}};
GVAR(fuelCargo) = 10000; GVAR(fuelCargo) = 10000;
}; };
class Pod_Heli_Transport_04_base_F : StaticWeapon {}; class Pod_Heli_Transport_04_base_F : StaticWeapon {};
class Land_Pod_Heli_Transport_04_fuel_F : Pod_Heli_Transport_04_base_F { class Land_Pod_Heli_Transport_04_fuel_F : Pod_Heli_Transport_04_base_F {
XEH_ENABLED;
transportFuel = 0; //3k transportFuel = 0; //3k
MACRO_REFUEL_ACTIONS MACRO_REFUEL_ACTIONS
GVAR(hooks[]) = {{0,0,0}}; GVAR(hooks[]) = {{-1.49,1.41,-.3}};
GVAR(fuelCargo) = 10000; GVAR(fuelCargo) = 10000;
}; };
// Vanilla buildings // Vanilla buildings
class Land_Fuelstation_Feed_F : House_Small_F { class Land_Fuelstation_Feed_F : House_Small_F {
XEH_ENABLED;
transportFuel = 0; //50k transportFuel = 0; //50k
MACRO_REFUEL_ACTIONS MACRO_REFUEL_ACTIONS
GVAR(hooks[]) = {{0,0,0}}; GVAR(hooks[]) = {{0,0,-1}};
GVAR(fuelCargo) = -1; GVAR(fuelCargo) = INFINITE_FUEL;
}; };
class Land_fs_feed_F : House_Small_F { class Land_fs_feed_F : House_Small_F {
XEH_ENABLED;
transportFuel = 0; //50k transportFuel = 0; //50k
MACRO_REFUEL_ACTIONS MACRO_REFUEL_ACTIONS
GVAR(hooks[]) = {{0,0,0}}; GVAR(hooks[]) = {{-0.4,0.022,-.23}};
GVAR(fuelCargo) = -1; GVAR(fuelCargo) = INFINITE_FUEL;
};
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;
}; };
/* // Barrels from rhs? /* // Barrels from rhs?

View File

@ -1,5 +1,5 @@
/* /*
* Author: Jonpas * Author: Jonpas, GitHawk
* Checks if unit can check fuel. * Checks if unit can check fuel.
* *
* Arguments: * Arguments:
@ -18,6 +18,8 @@
params ["_unit", "_target"]; params ["_unit", "_target"];
if (isNull _unit || {!(_unit isKindOf "CAManBase")} || {!local _unit} || {(_target distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false}; !(isNull _unit ||
{!(_unit isKindOf "CAManBase")} ||
true {!local _unit} ||
{(_target distance _unit) > REFUEL_ACTION_DISTANCE} ||
{(_target call FUNC(getFuel) == INFINITE_FUEL)})

View File

@ -20,6 +20,5 @@ private ["_nozzle"];
params ["_unit", "_target"]; params ["_unit", "_target"];
_nozzle = _unit getVariable QGVAR(nozzle); _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})

View File

@ -16,7 +16,7 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_nozzle", "_sink", "_fueling"]; private ["_nozzle", "_sink"];
params ["_unit", "_nozzleHolder"]; params ["_unit", "_nozzleHolder"];
if (isNull _unit || {!(_unit isKindOf "CAManBase")} || {!local _unit} || {(_nozzleHolder distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false}; 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}; if (isNull _nozzle) exitWith {false};
_sink = _nozzle getVariable [QGVAR(sink), objNull]; _sink = _nozzle getVariable [QGVAR(sink), objNull];
if (isNull _sink) exitWith {false};
_fueling = _nozzle getVariable [QGVAR(fueling), 0]; !((isNull _sink) || {_nozzle getVariable [QGVAR(isRefueling), false]});
if (_fueling == 1) exitWith {false};
true

View File

@ -20,6 +20,5 @@ params ["_unit", "_target"];
if (isNull _unit || {!(_unit isKindOf "CAManBase")} || {!local _unit} || {(_target distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false}; if (isNull _unit || {!(_unit isKindOf "CAManBase")} || {!local _unit} || {(_target distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false};
_fuel = [_target] call FUNC(getFuel); _fuel = [_target] call FUNC(getFuel);
if (_fuel > 0 || {_fuel == -1}) exitWith {true};
false (_fuel > 0 || {_fuel == -1})

View File

@ -20,5 +20,4 @@ params ["_unit", "_target"];
if (isNull _unit || {!(_unit isKindOf "CAManBase")} || {!local _unit} || {(_target distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false}; 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])} !(_target getVariable [QGVAR(isConnected), false]) && {!(_unit getVariable [QGVAR(isRefueling), false])}

View File

@ -20,4 +20,4 @@ params ["_unit", "_nozzleHolder"];
if (isNull _unit || {!(_unit isKindOf "CAManBase")} || {!local _unit} || {(_nozzleHolder distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false}; 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]}

View File

@ -15,7 +15,7 @@
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_fuel", "_type"]; private ["_fuel"];
params ["_unit", "_target"]; params ["_unit", "_target"];
_fuel = [_target] call FUNC(getFuel); _fuel = [_target] call FUNC(getFuel);

View File

@ -80,12 +80,11 @@ detach _nozzle;
_weaponSelect = _unit getVariable QGVAR(selectedWeaponOnRefuel); _weaponSelect = _unit getVariable QGVAR(selectedWeaponOnRefuel);
_unit selectWeapon _weaponSelect; _unit selectWeapon _weaponSelect;
_unit setVariable [QGVAR(selectedWeaponOnRefuel), nil]; _unit setVariable [QGVAR(selectedWeaponOnRefuel), nil];
_unit setVariable [QGVAR(isRefueling), false];
_nozzle attachTo [_target, _endPosTestOffset]; _nozzle attachTo [_target, _endPosTestOffset];
_nozzle setVariable [QGVAR(sink), _target, true]; _nozzle setVariable [QGVAR(sink), _target, true];
_nozzle setVariable [QGVAR(fueling), 1, true]; _nozzle setVariable [QGVAR(isRefueling), true, true];
_target setVariable [QGVAR(nozzle), _nozzle, true]; _target setVariable [QGVAR(nozzle), _nozzle, true];
[_unit, _target, _nozzle] call FUNC(refuel); [_unit, _target, _nozzle] call FUNC(refuel);
true

View File

@ -16,12 +16,13 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_nozzle"];
params ["_unit", "_nozzleHolder"]; params ["_unit", "_nozzleHolder"];
_nozzle = _nozzleHolder getVariable QGVAR(nozzle); _nozzle = _nozzleHolder getVariable QGVAR(nozzle);
detach _nozzle; detach _nozzle;
_nozzle setVariable [QGVAR(sink), objNull]; _nozzle setVariable [QGVAR(sink), objNull, true];
_nozzleHolder setVariable [QGVAR(nozzle), objNull, true]; _nozzleHolder setVariable [QGVAR(nozzle), objNull, true];
_unit setVariable [QGVAR(nozzle), _nozzle]; _unit setVariable [QGVAR(nozzle), _nozzle];

View File

@ -18,7 +18,7 @@
private ["_fuel"]; private ["_fuel"];
params ["_target"]; params ["_target"];
_fuel = _target getVariable [QGVAR(currentFuelCargo), nil]; _fuel = _target getVariable QGVAR(currentFuelCargo);
if (isNil "_fuel") then { if (isNil "_fuel") then {
_fuel = getNumber (configFile >> "CfgVehicles" >> typeOf _target >> QGVAR(fuelCargo)); _fuel = getNumber (configFile >> "CfgVehicles" >> typeOf _target >> QGVAR(fuelCargo));

View File

@ -29,25 +29,30 @@ _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(f
params ["_args", "_pfID"]; params ["_args", "_pfID"];
_args params ["_unit", "_nozzle", "_rate", "_startFuel", "_maxFuel"]; _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]; _source = _nozzle getVariable [QGVAR(source), objNull];
_sink = _nozzle getVariable [QGVAR(sink), 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); [LSTRING(Hint_TooFar), 2, _unit] call EFUNC(common,displayTextStructured);
detach _nozzle; detach _nozzle;
_nozzle setPosATL [(getPosATL _nozzle) select 0,(getPosATL _nozzle) select 1, 0]; _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; [_pfID] call cba_fnc_removePerFrameHandler;
}; };
_fuelInSource = [_source] call FUNC(getFuel); _fuelInSource = [_source] call FUNC(getFuel);
if (_fuelInSource == 0) exitWith { if (_fuelInSource == 0) exitWith {
[LSTRING(Hint_SourceEmpty), 2, _unit] call EFUNC(common,displayTextStructured); [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; [_pfID] call cba_fnc_removePerFrameHandler;
}; };
_finished = false; _finished = false;
if !(_fuelInSource == INFINITE_FUEL) then {
_fuelInSource = _fuelInSource - _rate; _fuelInSource = _fuelInSource - _rate;
};
if (_fuelInSource < 0 && {_fuelInSource > -1}) then { if (_fuelInSource < 0 && {_fuelInSource > -1}) then {
_fuelInSource = 0; _fuelInSource = 0;
_finished = true; _finished = true;
@ -67,11 +72,11 @@ _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(f
}; };
[_unit, _source, _fuelInSource] call FUNC(setFuel); [_unit, _source, _fuelInSource] call FUNC(setFuel);
if (_finished || {_fueling == 0}) exitWith { if (_finished || {!_fueling}) exitWith {
if (_fueling == 0) then { if !(_fueling) then {
[LSTRING(Hint_Stopped), 2, _unit] call EFUNC(common,displayTextStructured); [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; [_pfID] call cba_fnc_removePerFrameHandler;
}; };

View File

@ -1,5 +1,5 @@
/* /*
* Author: GitHawk et.al., Jonpas * Author: GitHawk, Jonpas
* Returns the nozzle back to source vehicle. * Returns the nozzle back to source vehicle.
* *
* Arguments: * Arguments:
@ -16,14 +16,13 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_nozzle"]; private ["_nozzle", "_dummy"];
params ["_unit", "_target"]; params ["_unit", "_target"];
_source = _nozzle getVariable QGVAR(source);
_nozzle = _unit getVariable QGVAR(nozzle); _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]; _unit setVariable [QGVAR(nozzle), nil];
detach _nozzle; detach _nozzle;

View File

@ -19,6 +19,10 @@
private ["_maxFuel"]; private ["_maxFuel"];
params ["_unit", "_target", "_fuel"]; 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]; _target setVariable [QGVAR(currentFuelCargo), (getNumber (configFile >> "CfgVehicles" >> typeOf _target >> QGVAR(fuelCargo))) min _fuel, true];

View File

@ -26,19 +26,27 @@ _unit setVariable [QGVAR(selectedWeaponOnRefuel), currentWeapon _unit];
_unit action ["SwitchWeapon", _unit, _unit, 99]; _unit action ["SwitchWeapon", _unit, _unit, 99];
if (isNull _nozzle) then { // func is called on fuel truck 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 ? // TODO add pickup animation ?
[{ [{
params ["_unit", "_target"]; params ["_unit", "_target", "_endPosOffset"];
_newNozzle = "ACE_refuel_fuelNozzle" createVehicle position _unit; _newNozzle = "ACE_refuel_fuelNozzle" createVehicle position _unit;
_newNozzle attachTo [_unit, [-0.02,-0.05,0], "righthandmiddle1"]; // TODO replace with right coordinates for real model _newNozzle attachTo [_unit, [-0.02,-0.05,0], "righthandmiddle1"]; // TODO replace with right coordinates for real model
_unit setVariable [QGVAR(nozzle), _newNozzle]; _unit setVariable [QGVAR(nozzle), _newNozzle];
// Create rope with offset -1 to prevent wrapping over interaction base point _rope = ropeCreate [_target, _endPosOffset, _newNozzle, [0, 0, 0], 12];
_rope = ropeCreate [_target, [0, 0, -1], _newNozzle, [0, 0, 0], 12]; _newNozzle setVariable [QGVAR(attachPos), _endPosOffset, true];
_newNozzle setVariable [QGVAR(source), _target, true]; _newNozzle setVariable [QGVAR(source), _target, true];
_newNozzle setVariable [QGVAR(rope), _rope, true]; _newNozzle setVariable [QGVAR(rope), _rope, true];
_target setVariable [QGVAR(isConnected), true, true]; _target setVariable [QGVAR(isConnected), true, true];
@ -47,14 +55,15 @@ if (isNull _nozzle) then { // func is called on fuel truck
[{ [{
private ["_nozzle"]; private ["_nozzle"];
params ["_args", "_pfID"]; 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]; _nozzle = _unit getVariable [QGVAR(nozzle), objNull];
if !(isNull _nozzle) then { if !(isNull _nozzle) then {
detach _nozzle; detach _nozzle;
_nozzle setPosATL [(getPosATL _unit) select 0,(getPosATL _unit) select 1, 0]; _nozzle setPosATL [(getPosATL _unit) select 0,(getPosATL _unit) select 1, 0];
_nozzle setVelocity [0,0,0]; _nozzle setVelocity [0,0,0];
_nozzle setVariable [QGVAR(isRefueling), false, true];
_unit setVariable [QGVAR(isRefueling), false]; _unit setVariable [QGVAR(isRefueling), false];
_unit setVariable [QGVAR(nozzle), objNull]; _unit setVariable [QGVAR(nozzle), objNull];
@ -67,7 +76,7 @@ if (isNull _nozzle) then { // func is called on fuel truck
}; };
[_pfID] call cba_fnc_removePerFrameHandler; [_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]; _unit setVariable [QGVAR(isRefueling), true];
} else { // func is called in muzzle either connected or on ground } else { // func is called in muzzle either connected or on ground

View File

@ -17,4 +17,4 @@
params ["_nozzleHolder"]; params ["_nozzleHolder"];
(_nozzleHolder getVariable QGVAR(nozzle)) setVariable [QGVAR(fueling), 0]; (_nozzleHolder getVariable QGVAR(nozzle)) setVariable [QGVAR(isRefueling), false, true];

View File

@ -11,5 +11,5 @@
#include "\z\ace\addons\main\script_macros.hpp" #include "\z\ace\addons\main\script_macros.hpp"
#define INFINITE_FUEL -1
#define REFUEL_ACTION_DISTANCE 7 #define REFUEL_ACTION_DISTANCE 7

View File

@ -3,7 +3,7 @@
<Package name="Refuel"> <Package name="Refuel">
<Key ID="STR_ACE_Refuel_RefuelSettings_Module_DisplayName"> <Key ID="STR_ACE_Refuel_RefuelSettings_Module_DisplayName">
<English>Refuel Settings</English> <English>Refuel Settings</English>
<German>Tankeinstellungen</German> <German>Betankung</German>
</Key> </Key>
<Key ID="STR_ACE_Refuel_RefuelSettings_speed_DisplayName"> <Key ID="STR_ACE_Refuel_RefuelSettings_speed_DisplayName">
<English>Flow Rate</English> <English>Flow Rate</English>
@ -21,32 +21,9 @@
<English>Realistic</English> <English>Realistic</English>
<German>Realistisch</German> <German>Realistisch</German>
</Key> </Key>
<Key ID="STR_ACE_Refuel_RefuelSettings_civ_fuel_DisplayName">
<English>Civilian Volume</English>
<German>Ziviles Volumen</German>
</Key>
<Key ID="STR_ACE_Refuel_RefuelSettings_civ_fuel_Description">
<English>How many liters does a civilian tank truck hold? -1 is infinite.</English>
<German>Wieviele Liter enthält ein ziviler Tankwagen? -1 bedeutet unendlich.</German>
</Key>
<Key ID="STR_ACE_Refuel_RefuelSettings_mil_fuel_DisplayName">
<English>Military Volume</English>
<German>Militärisches Volumen</German>
</Key>
<Key ID="STR_ACE_Refuel_RefuelSettings_mil_fuel_Description">
<English>How many liters does a military tank truck hold? -1 is infinite.</English>
<German>Wieviele Liter enthält ein militärischer Tankwagen? -1 bedeutet unendlich.</German>
</Key>
<Key ID="STR_ACE_Refuel_RefuelSettings_stationary_fuel_DisplayName">
<English>Stationary Volume</English>
<German>Stationäres Volumen</German>
</Key>
<Key ID="STR_ACE_Refuel_RefuelSettings_stationary_fuel_Description">
<English>How many liters does a stationary object e.g. a fuel station hold? -1 is infinite.</English>
<German>Wieviele Liter enthält ein stationäres Objekt z.B. eine Tankstelle? -1 bedeutet unendlich.</German>
</Key>
<Key ID="STR_ACE_Refuel_Refuel"> <Key ID="STR_ACE_Refuel_Refuel">
<English>Refuel</English> <English>Refuel</English>
<German>Betankung</German>
</Key> </Key>
<Key ID="STR_ACE_Refuel_TakeNozzle"> <Key ID="STR_ACE_Refuel_TakeNozzle">
<English>Take fuel nozzle</English> <English>Take fuel nozzle</English>
@ -65,8 +42,8 @@
<German>Anschließen</German> <German>Anschließen</German>
</Key> </Key>
<Key ID="STR_ACE_Refuel_CheckFuel"> <Key ID="STR_ACE_Refuel_CheckFuel">
<English>Check remaining fuel</English> <English>Check remaining fuel ...</English>
<German>Verbleibenden Kraftstoff überprüfen</German> <German>Verbleibenden Kraftstoff überprüfen ...</German>
</Key> </Key>
<Key ID="STR_ACE_Refuel_Hint_RemainingFuel"> <Key ID="STR_ACE_Refuel_Hint_RemainingFuel">
<English>There are %1 liters left.</English> <English>There are %1 liters left.</English>