From 7d75f9cd2c475e01ebfe3bd597e4d329d45a47ae Mon Sep 17 00:00:00 2001 From: IngoKauffmann Date: Thu, 13 Aug 2015 19:33:55 +0200 Subject: [PATCH 01/25] Initial draft --- addons/refuel/$PBOPREFIX$ | 1 + addons/refuel/CfgEventHandlers.hpp | 5 + addons/refuel/CfgVehicles.hpp | 346 ++++++++++++++++++ addons/refuel/XEH_preInit.sqf | 21 ++ addons/refuel/config.cpp | 16 + .../refuel/functions/fnc_canConnectNozzle.sqf | 25 ++ addons/refuel/functions/fnc_canDisconnect.sqf | 33 ++ addons/refuel/functions/fnc_canRefuel.sqf | 25 ++ addons/refuel/functions/fnc_canTakeNozzle.sqf | 32 ++ addons/refuel/functions/fnc_canTurnOff.sqf | 30 ++ addons/refuel/functions/fnc_checkFuel.sqf | 43 +++ addons/refuel/functions/fnc_connectNozzle.sqf | 66 ++++ .../functions/fnc_connectNozzleAction.sqf | 109 ++++++ addons/refuel/functions/fnc_cutTiltRope.sqf | 34 ++ addons/refuel/functions/fnc_disconnect.sqf | 28 ++ addons/refuel/functions/fnc_getFuel.sqf | 45 +++ .../functions/fnc_moduleRefuelSettings.sqf | 25 ++ addons/refuel/functions/fnc_refuel.sqf | 69 ++++ addons/refuel/functions/fnc_setFuel.sqf | 38 ++ addons/refuel/functions/fnc_takeNozzle.sqf | 62 ++++ addons/refuel/functions/fnc_turnOff.sqf | 26 ++ addons/refuel/functions/script_component.hpp | 3 + addons/refuel/script_component.hpp | 4 + addons/refuel/stringtable.xml | 93 +++++ addons/refuel/ui/icon_module_refuel.paa | Bin 0 -> 22016 bytes addons/refuel/ui/icon_refuel_interact.paa | Bin 0 -> 22016 bytes 26 files changed, 1179 insertions(+) create mode 100644 addons/refuel/$PBOPREFIX$ create mode 100644 addons/refuel/CfgEventHandlers.hpp create mode 100644 addons/refuel/CfgVehicles.hpp create mode 100644 addons/refuel/XEH_preInit.sqf create mode 100644 addons/refuel/config.cpp create mode 100644 addons/refuel/functions/fnc_canConnectNozzle.sqf create mode 100644 addons/refuel/functions/fnc_canDisconnect.sqf create mode 100644 addons/refuel/functions/fnc_canRefuel.sqf create mode 100644 addons/refuel/functions/fnc_canTakeNozzle.sqf create mode 100644 addons/refuel/functions/fnc_canTurnOff.sqf create mode 100644 addons/refuel/functions/fnc_checkFuel.sqf create mode 100644 addons/refuel/functions/fnc_connectNozzle.sqf create mode 100644 addons/refuel/functions/fnc_connectNozzleAction.sqf create mode 100644 addons/refuel/functions/fnc_cutTiltRope.sqf create mode 100644 addons/refuel/functions/fnc_disconnect.sqf create mode 100644 addons/refuel/functions/fnc_getFuel.sqf create mode 100644 addons/refuel/functions/fnc_moduleRefuelSettings.sqf create mode 100644 addons/refuel/functions/fnc_refuel.sqf create mode 100644 addons/refuel/functions/fnc_setFuel.sqf create mode 100644 addons/refuel/functions/fnc_takeNozzle.sqf create mode 100644 addons/refuel/functions/fnc_turnOff.sqf create mode 100644 addons/refuel/functions/script_component.hpp create mode 100644 addons/refuel/script_component.hpp create mode 100644 addons/refuel/stringtable.xml create mode 100644 addons/refuel/ui/icon_module_refuel.paa create mode 100644 addons/refuel/ui/icon_refuel_interact.paa diff --git a/addons/refuel/$PBOPREFIX$ b/addons/refuel/$PBOPREFIX$ new file mode 100644 index 0000000000..2a68bfaf74 --- /dev/null +++ b/addons/refuel/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\refuel \ No newline at end of file diff --git a/addons/refuel/CfgEventHandlers.hpp b/addons/refuel/CfgEventHandlers.hpp new file mode 100644 index 0000000000..b928bc2de6 --- /dev/null +++ b/addons/refuel/CfgEventHandlers.hpp @@ -0,0 +1,5 @@ +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preInit)); + }; +}; diff --git a/addons/refuel/CfgVehicles.hpp b/addons/refuel/CfgVehicles.hpp new file mode 100644 index 0000000000..9cc0578f40 --- /dev/null +++ b/addons/refuel/CfgVehicles.hpp @@ -0,0 +1,346 @@ +#define REFUEL_ACTION_DISTANCE 4.5 +#define MACRO_REFUEL_ACTIONS \ + class ACE_Actions : ACE_Actions { \ + class ACE_MainActions : ACE_MainActions { \ + class GVAR(TakeNozzle) { \ + displayName = CSTRING(TakeNozzle); \ + distance = REFUEL_ACTION_DISTANCE; \ + condition = QUOTE([ARR_2(_player,_target)] call FUNC(canTakeNozzle)); \ + statement = QUOTE([ARR_3(_player,_target,objNull)] call FUNC(TakeNozzle)); \ + exceptions[] = {"isNotInside"}; \ + icon = PATHTOF(ui\icon_refuel_interact.paa); \ + }; \ + class GVAR(CheckFuel) { \ + displayName = CSTRING(CheckFuel); \ + distance = REFUEL_ACTION_DISTANCE; \ + condition = QUOTE(([ARR_2(_player,_target)] call FUNC(getFuel) >= 0) && {(_target distance _player) < REFUEL_ACTION_DISTANCE}); \ + statement = QUOTE([ARR_2(_player,_target)] call FUNC(checkFuel)); \ + exceptions[] = {"isNotInside"}; \ + icon = PATHTOF(ui\icon_refuel_interact.paa); \ + }; \ + }; \ + }; +#define MACRO_CONNECT_ACTIONS \ + class ACE_Actions { \ + class ACE_MainActions { \ + class GVAR(connect) { \ + displayName = CSTRING(connect); \ + distance = REFUEL_ACTION_DISTANCE; \ + condition = QUOTE([ARR_2(_player,_target)] call FUNC(canConnectNozzle)); \ + statement = QUOTE([ARR_2(_player,_target)] call DFUNC(connectNozzle)); \ + exceptions[] = {"isNotInside"}; \ + icon = PATHTOF(ui\icon_refuel_interact.paa); \ + }; \ + class GVAR(Disconnect) { \ + displayName = CSTRING(Disconnect); \ + distance = REFUEL_ACTION_DISTANCE; \ + condition = QUOTE([ARR_2(_player,_target)] call FUNC(canDisconnect)); \ + statement = QUOTE([ARR_2(_player,_target)] call DFUNC(disconnect)); \ + exceptions[] = {"isNotInside"}; \ + icon = PATHTOF(ui\icon_refuel_interact.paa); \ + }; \ + class GVAR(TurnOff) { \ + displayName = CSTRING(TurnOff); \ + distance = REFUEL_ACTION_DISTANCE; \ + condition = QUOTE([ARR_2(_player,_target)] call FUNC(canTurnOff)); \ + statement = QUOTE([ARR_2(_player,_target)] call DFUNC(turnOff)); \ + exceptions[] = {"isNotInside"}; \ + icon = PATHTOF(ui\icon_refuel_interact.paa); \ + }; \ + }; \ + }; + +// does not work +#define MACRO_NOZZLE_ACTIONS \ + class ACE_Actions { \ + class ACE_MainActions { \ + displayName = ECSTRING(interaction,MainAction); \ + selection = ""; \ + distance = 2; \ + condition = "true"; \ + class GVAR(TakeNozzle) { \ + displayName = CSTRING(TakeNozzle); \ + distance = REFUEL_ACTION_DISTANCE; \ + condition = QUOTE([ARR_2(_player,_target)] call FUNC(canTakeNozzle)); \ + statement = QUOTE([ARR_3(_player,_target,_target)] call FUNC(TakeNozzle)); \ + exceptions[] = {"isNotInside"}; \ + icon = PATHTOF(ui\icon_refuel_interact.paa); \ + }; \ + }; \ + }; + +class CfgVehicles { + class ACE_Module; + class ACE_moduleRefuelSettings : ACE_Module { + scope = 2; + displayName = CSTRING(RefuelSettings_Module_DisplayName); + icon = QUOTE(PATHTOF(ui\icon_module_refuel.paa)); + category = "ACE"; + function = QUOTE(DFUNC(moduleRefuelSettings)); + functionPriority = 1; + isGlobal = 1; + isTriggerActivated = 0; + author = ECSTRING(common,ACETeam); + class Arguments { + class rate { + displayName = CSTRING(RefuelSettings_speed_DisplayName); + description = CSTRING(RefuelSettings_speed_Description); + typeName = "NUMBER"; + class values { + class fast { + name = CSTRING(RefuelSettings_basic); + value = 10; + }; + class realistic { + name = CSTRING(RefuelSettings_advanced); + value = 1; + default = 1; + }; + }; + }; + class civ_fuel { + displayName = CSTRING(RefuelSettings_civ_fuel_DisplayName); + description = CSTRING(RefuelSettings_civ_fuel_Description); + typeName = "NUMBER"; + defaultValue = 5000; + }; + class mil_fuel { + displayName = CSTRING(RefuelSettings_mil_fuel_DisplayName); + description = CSTRING(RefuelSettings_mil_fuel_Description); + typeName = "NUMBER"; + defaultValue = 20000; + }; + class stationary_fuel { + displayName = CSTRING(RefuelSettings_stationary_fuel_DisplayName); + description = CSTRING(RefuelSettings_stationary_fuel_Description); + typeName = "NUMBER"; + defaultValue = -1; + }; + }; + }; + + class Sign_Sphere10cm_F; + class ACE_refuel_fuelNozzle : Sign_Sphere10cm_F { + // TODO replace with custom model + }; + + // Add connect to all vehicles + class LandVehicle; + class Car : LandVehicle { + MACRO_CONNECT_ACTIONS + }; + + class Tank : LandVehicle { + MACRO_CONNECT_ACTIONS + }; + + class StaticWeapon : LandVehicle { + MACRO_CONNECT_ACTIONS + }; + + class Air; + class Helicopter : Air { + MACRO_CONNECT_ACTIONS + }; + + class Plane : Air { + MACRO_CONNECT_ACTIONS + }; + + class Ship; + class Ship_F : Ship { + MACRO_CONNECT_ACTIONS + }; + + class Car_F : Car {}; + class Offroad_01_base_f : Car_F {}; + class Truck_F : Car_F {}; + class Truck_01_base_F: Truck_F {}; + class Truck_02_base_F : Truck_F {}; + class Truck_03_base_F : Truck_F {}; + class Van_01_base_F : Truck_F {}; + class Van_01_fuel_base_F : Van_01_base_F {}; + + class Tank_F : Tank {}; + class APC_Tracked_01_base_F: Tank_F {}; + class B_APC_Tracked_01_base_F: APC_Tracked_01_base_F {}; + class B_Truck_01_transport_F : Truck_01_base_F {}; + class B_Truck_01_mover_F: B_Truck_01_transport_F {}; + + class ReammoBox_F; + class Slingload_01_Base_F : ReammoBox_F { + class ACE_Actions { // FIXME ace_interact should add interactions to "All" so we can always extend + class ACE_MainActions {}; + }; + }; + class Helicopter_Base_F : Helicopter {}; + class Helicopter_Base_H : Helicopter_Base_F {}; + class Heli_Transport_04_base_F : Helicopter_Base_H {}; + class Pod_Heli_Transport_04_base_F : StaticWeapon {}; + + // Vanilla classes + class B_APC_Tracked_01_CRV_F : B_APC_Tracked_01_base_F { + transportFuel = 0; //3k + MACRO_REFUEL_ACTIONS + ace_refuel_hooks[] = {{0,0,0}}; + ace_refuel_type = "mil"; + }; + + class C_Van_01_fuel_F : Van_01_fuel_base_F { + transportFuel = 0; //1k + MACRO_REFUEL_ACTIONS + ace_refuel_hooks[] = {{0,0,0}}; + ace_refuel_type = "civ"; + }; + class I_G_Van_01_fuel_F : Van_01_fuel_base_F { + transportFuel = 0; //1k + MACRO_REFUEL_ACTIONS + ace_refuel_hooks[] = {{0,0,0}}; + ace_refuel_type = "civ"; + }; + + class I_Truck_02_fuel_F : Truck_02_base_F { + transportFuel = 0; //3k + MACRO_REFUEL_ACTIONS + ace_refuel_hooks[] = {{0,0,0}}; + ace_refuel_type = "mil"; + }; + class O_Truck_02_fuel_F : Truck_02_base_F { + transportFuel = 0; //3k + MACRO_REFUEL_ACTIONS + ace_refuel_hooks[] = {{0,0,0}}; + ace_refuel_type = "mil"; + }; + + class B_Truck_01_fuel_F : B_Truck_01_mover_F { + transportFuel = 0; //3k + MACRO_REFUEL_ACTIONS + ace_refuel_hooks[] = {{0,0,0}}; + ace_refuel_type = "mil"; + }; + + class O_Truck_03_fuel_F : Truck_03_base_F { + transportFuel = 0; //3k + MACRO_REFUEL_ACTIONS + ace_refuel_hooks[] = {{0,0,0}}; + ace_refuel_type = "mil"; + }; + + class B_Slingload_01_Fuel_F : Slingload_01_Base_F { + transportFuel = 0; //3k + MACRO_REFUEL_ACTIONS + ace_refuel_hooks[] = {{0,0,0}}; + ace_refuel_type = "mil"; + }; + + class O_Heli_Transport_04_fuel_F : Heli_Transport_04_base_F { + transportFuel = 0; //3k + MACRO_REFUEL_ACTIONS + ace_refuel_hooks[] = {{0,0,0}}; + ace_refuel_type = "mil"; + }; + + class Land_Pod_Heli_Transport_04_fuel_F : Pod_Heli_Transport_04_base_F { + transportFuel = 0; //3k + MACRO_REFUEL_ACTIONS + ace_refuel_hooks[] = {{0,0,0}}; + ace_refuel_type = "mil"; + }; + + class Static; + class Building : Static { + class ACE_Actions { + class ACE_MainActions {}; + }; + }; + class NonStrategic : Building {}; + class House_Base : NonStrategic {}; + class House : House_Base {}; + class House_F : House {}; + class House_Small_F : House_F {}; + class Strategic : Building {}; + // Vanilla buildings + class Land_Fuelstation_Feed_F : House_Small_F { + transportFuel = 0; //50k + MACRO_REFUEL_ACTIONS + ace_refuel_hooks[] = {{0,0,0}}; + ace_refuel_type = "stationary"; + }; + class Land_fs_feed_F : House_Small_F { + transportFuel = 0; //50k + MACRO_REFUEL_ACTIONS + ace_refuel_hooks[] = {{0,0,0}}; + ace_refuel_type = "stationary"; + }; + + class FuelStation : Strategic { + transportFuel = 0; //50k + MACRO_REFUEL_ACTIONS + ace_refuel_hooks[] = {{0,0,0}}; + ace_refuel_type = "stationary"; + }; + class Land_Fuelstation : Strategic { + transportFuel = 0; //50k + MACRO_REFUEL_ACTIONS + ace_refuel_hooks[] = {{0,0,0}}; + ace_refuel_type = "stationary"; + }; + class Land_Fuelstation_army : Strategic { + transportFuel = 0; //50k + MACRO_REFUEL_ACTIONS + ace_refuel_hooks[] = {{0,0,0}}; + ace_refuel_type = "stationary"; + }; + class Land_Benzina_schnell : Strategic { + transportFuel = 0; //50k + MACRO_REFUEL_ACTIONS + ace_refuel_hooks[] = {{0,0,0}}; + ace_refuel_type = "stationary"; + }; + class Land_A_FuelStation_Feed : Strategic { + transportFuel = 0; //50k + MACRO_REFUEL_ACTIONS + ace_refuel_hooks[] = {{0,0,0}}; + ace_refuel_type = "stationary"; + }; + class Land_Ind_FuelStation_Feed_EP1 : Strategic { + transportFuel = 0; //50k + MACRO_REFUEL_ACTIONS + ace_refuel_hooks[] = {{0,0,0}}; + ace_refuel_type = "stationary"; + }; + class Land_FuelStation_Feed_PMC : Strategic { + transportFuel = 0; //50k + MACRO_REFUEL_ACTIONS + ace_refuel_hooks[] = {{0,0,0}}; + ace_refuel_type = "stationary"; + }; + + /* // Barrels from rhs? + BarrelHelper : Misc_thing 100 + BarrelBase : BarrelHelper 100 + Barrels : BarrelBase 400 + Barrel1 : BarrelBase 100 + Barrel2 : BarrelBase 100 + Barrel3 : BarrelBase 100 + Barrel4 : BarrelBase 100 + Barrel5 : BarrelBase 100 + Barrel6 : BarrelBase 100 + Wooden_barrel : BarrelBase 100 + Wooden_barrels : Wooden_barrel 400 + + // Warfare points + Base_WarfareBVehicleServicePoint : WarfareBBaseStructure 3000 + Land_StorageBladder_01_F : StorageBladder_base_F 60000 + Land_FlexibleTank_01_F : FlexibleTank_base_F 300 + + // Mods + rhsusf_M978A2_usarmy_wd : rhsusf_M977A2_usarmy_wd 10000 + rhsusf_M978A2_CPK_usarmy_wd : rhsusf_M978A2_usarmy_wd 10000 + RHS_Ural_Fuel_MSV_01 : RHS_Ural_Support_MSV_Base_01 10000 + RHS_Ural_Fuel_VDV_01 : RHS_Ural_Fuel_MSV_01 10000 + RHS_Ural_Fuel_VMF_01 : RHS_Ural_Fuel_MSV_01 10000 + RHS_Ural_Fuel_VV_01 : RHS_Ural_Fuel_MSV_01 10000 + LOP_UA_Ural_fuel : RHS_Ural_Fuel_VV_01 10000 + */ +}; diff --git a/addons/refuel/XEH_preInit.sqf b/addons/refuel/XEH_preInit.sqf new file mode 100644 index 0000000000..7360046646 --- /dev/null +++ b/addons/refuel/XEH_preInit.sqf @@ -0,0 +1,21 @@ +#include "script_component.hpp" + +ADDON = false; + +PREP(canConnectNozzle); +PREP(canDisconnect); +PREP(canRefuel); +PREP(canTakeNozzle); +PREP(canTurnOff); +PREP(checkFuel); +PREP(connectNozzle); +PREP(connectNozzleAction); +PREP(disconnect); +PREP(getFuel); +PREP(moduleRefuelSettings); +PREP(setFuel); +PREP(takeNozzle); +PREP(turnOff); +PREP(refuel); + +ADDON = true; diff --git a/addons/refuel/config.cpp b/addons/refuel/config.cpp new file mode 100644 index 0000000000..7abfb2d645 --- /dev/null +++ b/addons/refuel/config.cpp @@ -0,0 +1,16 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {}; + weapons[] = {"ACE_refuel_fuelNozzle"}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_interaction"}; + author[] = {"GitHawk"}; + authorUrl = ""; + VERSION_CONFIG; + }; +}; + +#include "CfgEventHandlers.hpp" +#include "CfgVehicles.hpp" diff --git a/addons/refuel/functions/fnc_canConnectNozzle.sqf b/addons/refuel/functions/fnc_canConnectNozzle.sqf new file mode 100644 index 0000000000..07cfabd58c --- /dev/null +++ b/addons/refuel/functions/fnc_canConnectNozzle.sqf @@ -0,0 +1,25 @@ +/* + * Author: GitHawk + * Check if a unit can connect a fuel nozzle + * + * Arguments: + * 0: The unit + * 1: The target + * + * Return Value: + * NIL + * + * Example: + * [unit, target, nozzle] call ace_refuel_fnc_connectNozzle + * + * Public: Yes + */ +#include "script_component.hpp" + +private ["_nozzle"]; +params ["_unit", "_target"]; + +_nozzle = _unit getVariable [QGVAR(nozzle), nil]; +if (isNil "_nozzle") exitWith {false}; + +true \ No newline at end of file diff --git a/addons/refuel/functions/fnc_canDisconnect.sqf b/addons/refuel/functions/fnc_canDisconnect.sqf new file mode 100644 index 0000000000..ca91f0e4a7 --- /dev/null +++ b/addons/refuel/functions/fnc_canDisconnect.sqf @@ -0,0 +1,33 @@ +/* + * Author: GitHawk + * Check if a unit can disconnect a fuel nozzle + * + * Arguments: + * 0: The unit + * 0: The object holding the nozzle + * + * Return Value: + * Can disconnect + * + * Example: + * [player, truck] call ace_refuel_fnc_canDisconnect + * + * Public: Yes + */ +#include "script_component.hpp" + +private ["_nozzle", "_sink", "_fueling"]; +params ["_unit", "_nozzleHolder"]; + +if (isNull _unit || {!(_unit isKindOf "CAManBase")} || {!local _unit} || {(_nozzleHolder distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false}; + +_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 \ No newline at end of file diff --git a/addons/refuel/functions/fnc_canRefuel.sqf b/addons/refuel/functions/fnc_canRefuel.sqf new file mode 100644 index 0000000000..21b856918e --- /dev/null +++ b/addons/refuel/functions/fnc_canRefuel.sqf @@ -0,0 +1,25 @@ +/* + * Author: GitHawk + * Check if a unit can refuel + * + * Arguments: + * 0: The target + * + * Return Value: + * Can refuel + * + * Example: + * [unit, target] call ace_refuel_fnc_canRefuel + * + * Public: Yes + */ +#include "script_component.hpp" +private ["_fuel"]; +params ["_unit", "_target"]; + +if (isNull _unit || {!(_unit isKindOf "CAManBase")} || {!local _unit} || { (_target distance _unit) > 7}) exitWith {false}; + +_fuel = [_unit, _target] call FUNC(getFuel); +if (_fuel > 0 || {_fuel == -1}) exitWith {true}; + +false \ No newline at end of file diff --git a/addons/refuel/functions/fnc_canTakeNozzle.sqf b/addons/refuel/functions/fnc_canTakeNozzle.sqf new file mode 100644 index 0000000000..b306c2ec37 --- /dev/null +++ b/addons/refuel/functions/fnc_canTakeNozzle.sqf @@ -0,0 +1,32 @@ +/* + * Author: GitHawk + * Check if a unit can take a fuel nozzle + * + * Arguments: + * 0: The unit + * 1: The target + * + * Return Value: + * Can connect + * + * Example: + * [player, target] call ace_refuel_fnc_canTakeNozzle + * + * Public: Yes + */ +#include "script_component.hpp" + +private ["_connected"]; +params ["_unit", "_target"]; + +if (isNull _unit || {!(_unit isKindOf "CAManBase")} || {!local _unit} || {(_target distance _unit) > 3.5}) exitWith {false}; + +// Check if the fuel source is already in use +_connected = _target getVariable [QGVAR(connected), nil]; +if !(isNil "_connected") exitWith {false}; + +// Check if the player is already carrying another fuel nozzle +_connected = _unit getVariable [QGVAR(isRefueling), nil]; +if !(isNil "_connected") exitWith {false}; + +true \ No newline at end of file diff --git a/addons/refuel/functions/fnc_canTurnOff.sqf b/addons/refuel/functions/fnc_canTurnOff.sqf new file mode 100644 index 0000000000..d08dae90bf --- /dev/null +++ b/addons/refuel/functions/fnc_canTurnOff.sqf @@ -0,0 +1,30 @@ +/* + * Author: GitHawk + * Check if a unit can turn off a fuel nozzle + * + * Arguments: + * 0: The unit + * 1: The object holding the nozzle + * + * Return Value: + * Can turn off + * + * Example: + * [player, truck] call ace_refuel_fnc_canTurnOff + * + * Public: Yes + */ +#include "script_component.hpp" + +private ["_nozzle", "_fueling"]; +params ["_unit", "_nozzleHolder"]; + +if (isNull _unit || {!(_unit isKindOf "CAManBase")} || {!local _unit} || { (_nozzleHolder distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false}; + +_nozzle = _nozzleHolder getVariable [QGVAR(nozzle), objNull]; +if (isNull _nozzle) exitWith {false}; + +_fueling = _nozzle getVariable [QGVAR(fueling), 0]; +if (_fueling == 0) exitWith {false}; + +true \ No newline at end of file diff --git a/addons/refuel/functions/fnc_checkFuel.sqf b/addons/refuel/functions/fnc_checkFuel.sqf new file mode 100644 index 0000000000..cd3525452d --- /dev/null +++ b/addons/refuel/functions/fnc_checkFuel.sqf @@ -0,0 +1,43 @@ +/* + * Author: GitHawk + * Get the remaining fuel amount + * + * Arguments: + * 0: The unit + * 1: The target + * + * Return Value: + * nil + * + * Example: + * [unit, target] call ace_refuel_fnc_checkFuel + * + * Public: Yes + */ +#include "script_component.hpp" +private ["_fuel", "_type"]; +params ["_unit", "_target"]; + +if (isNull _unit || {!(_unit isKindOf "CAManBase")} || {!local _unit} || { (_target distance _unit) > 7}) exitWith {0}; + +_fuel = [_unit, _target] call FUNC(getFuel); + +[ + 5, + [_unit, _target, _fuel], + { + params ["_args"]; + EXPLODE_3_PVT(_args,_unit,_target,_fuel); + if (_fuel > 0 ) then { + ["displayTextStructured", [_unit], [[LSTRING(Hint_RemainingFuel), _fuel], 2, _unit]] call EFUNC(common,targetEvent); + } else { + ["displayTextStructured", [_unit], [LSTRING(Hint_Empty), 2, _unit]] call EFUNC(common,targetEvent); + }; + true + }, + {true}, + localize LSTRING(CheckFuel), + {true}, + ["isnotinside"] +] call EFUNC(common,progressBar); + diff --git a/addons/refuel/functions/fnc_connectNozzle.sqf b/addons/refuel/functions/fnc_connectNozzle.sqf new file mode 100644 index 0000000000..2b66f7e5ff --- /dev/null +++ b/addons/refuel/functions/fnc_connectNozzle.sqf @@ -0,0 +1,66 @@ +/* + * Author: GitHawk et.al. + * Connect a fuel nozzle + * With code from ace_attach + * + * Arguments: + * 0: The unit + * 1: The target + * 2: The nozzle (optional) + * + * Return Value: + * NIL + * + * Example: + * [unit, target, nozzle] call ace_refuel_fnc_connectNozzle + * + * Public: Yes + */ +#include "script_component.hpp" + +#define PLACE_WAITING -1 +#define PLACE_CANCEL 0 +#define PLACE_APPROVE 1 + +private ["_nozzle", "_actionID"]; +params ["_unit", "_target"]; + +_nozzle = _unit getVariable [QGVAR(nozzle), nil]; +if (isNil "_nozzle") exitWith {}; + +GVAR(placeAction) = PLACE_WAITING; + +[{[localize LSTRING(Connect_Action), ""] call EFUNC(interaction,showMouseHint)}, []] call EFUNC(common,execNextFrame); +_unit setVariable [QGVAR(placeActionEH), [_unit, "DefaultAction", {true}, {GVAR(placeAction) = PLACE_APPROVE;}] call EFUNC(common,AddActionEventHandler)]; + +_actionID = _unit addAction [format ["%1", localize LSTRING(Cancel)], {GVAR(placeAction) = PLACE_CANCEL;}]; + +[{ + private["_virtualPos", "_virtualPosASL", "_lineInterection"]; + params ["_args","_pfID"]; + EXPLODE_4_PVT(_args,_unit,_target,_nozzle,_actionID); + + _virtualPosASL = (eyePos _unit) vectorAdd (positionCameraToWorld [0,0,0.6]) vectorDiff (positionCameraToWorld [0,0,0]); + if (cameraView == "EXTERNAL") then { + _virtualPosASL = _virtualPosASL vectorAdd ((positionCameraToWorld [0.3,0,0]) vectorDiff (positionCameraToWorld [0,0,0])); + }; + _virtualPos = _virtualPosASL call EFUNC(common,ASLToPosition); + _lineInterection = lineIntersects [eyePos ace_player, _virtualPosASL, ace_player]; + + //Don't allow placing in a bad position: + if (_lineInterection && {GVAR(placeAction) == PLACE_APPROVE}) then {GVAR(placeAction) = PLACE_WAITING;}; + + if ((GVAR(placeAction) != PLACE_WAITING) || + {_unit != ace_player} || + {!([_unit, _target, []] call EFUNC(common,canInteractWith))}) then { + + [_pfID] call CBA_fnc_removePerFrameHandler; + [] call EFUNC(interaction,hideMouseHint); + [_unit, "DefaultAction", (_unit getVariable [QGVAR(placeActionEH), -1])] call EFUNC(common,removeActionEventHandler); + _unit removeAction _actionID; + + if (GVAR(placeAction) == PLACE_APPROVE) then { + [_unit, _target, _virtualPos, _nozzle] call FUNC(ConnectNozzleAction); + }; + }; // TODO add model like in attach/functions/fnc_attach +}, 0, [_unit, _target, _nozzle, _actionID] ] call cba_fnc_addPerFrameHandler; \ No newline at end of file diff --git a/addons/refuel/functions/fnc_connectNozzleAction.sqf b/addons/refuel/functions/fnc_connectNozzleAction.sqf new file mode 100644 index 0000000000..277478710a --- /dev/null +++ b/addons/refuel/functions/fnc_connectNozzleAction.sqf @@ -0,0 +1,109 @@ +/* + * Author: GitHawk et.al + * Calculates a connection for tilting + * With code from ace_attach + * + * Arguments: + * 0: The player + * 1: The target + * 2: The visual position + * 3: The nozzle + * + * Return Value: + * NIL + * + * Example: + * [player, tank, [0,0,0], nozzle] call ace_refuel_fnc_connectNozzleAction + * + * Public: Yes + */ +#include "script_component.hpp" +#define FLOWRATE_GND 0.165 // TODO ace_vehicles messes with fuel capacity - why? +#define FLOWRATE_AIR 0.67 +#define RATE 1 // FIXME use global var from module + +private ["_startingOffset", "_startDistanceFromCenter", "_closeInUnitVector", "_closeInMax", "_closeInMin", "_closeInDistance", "_endPosTestOffset", "_endPosTest", "_doesIntersect", "_startingPosShifted", "_endASL", "_rate", "_maxFuel"]; + +params ["_unit", "_target", "_startingPosition", "_nozzle"]; +_startingOffset = _target worldToModel _startingPosition; + +_startDistanceFromCenter = vectorMagnitude _startingOffset; +_closeInUnitVector = vectorNormalized (_startingOffset vectorFromTo [0,0,0]); + +_closeInMax = _startDistanceFromCenter; +_closeInMin = 0; + +while {(_closeInMax - _closeInMin) > 0.01} do { + _closeInDistance = (_closeInMax + _closeInMin) / 2; + _endPosTestOffset = _startingOffset vectorAdd (_closeInUnitVector vectorMultiply _closeInDistance); + _endPosTestOffset set [2, (_startingOffset select 2)]; + _endPosTest = _target modelToWorldVisual _endPosTestOffset; + + _doesIntersect = false; + { + if (_doesIntersect) exitWith {}; + _startingPosShifted = _startingPosition vectorAdd _x; + _startASL = if (surfaceIsWater _startingPosShifted) then {_startingPosShifted} else {ATLtoASL _startingPosShifted}; + { + _endPosShifted = _endPosTest vectorAdd _x; + _endASL = if (surfaceIsWater _startingPosShifted) then {_endPosShifted} else {ATLtoASL _endPosShifted}; + + //Uncomment to see the lazor show, and see how the scanning works: + // drawLine3D [_startingPosShifted, _endPosShifted, [1,0,0,1]]; + if (_target in lineIntersectsWith [_startASL, _endASL, _unit]) exitWith {_doesIntersect = true}; + } forEach [[0,0,0.045], [0,0,-0.045], [0,0.045,0], [0,-0.045,0], [0.045,0,0], [-0.045,0,0]]; + } forEach [[0,0,0], [0,0,0.05], [0,0,-0.05]]; + + if (_doesIntersect) then { + _closeInMax = _closeInDistance; + } else { + _closeInMin = _closeInDistance; + }; +}; + +_closeInDistance = (_closeInMax + _closeInMin) / 2; + +//Checks (too close to center or can't attach) +if (((_startDistanceFromCenter - _closeInDistance) < 0.1) || {!([_target, _unit, _itemClassname] call FUNC(canAttach))}) exitWith { + TRACE_2("no valid spot found",_closeInDistance,_startDistanceFromCenter); + [localize LSTRING(Failed)] call EFUNC(common,displayTextStructured); +}; + +//Move it out slightly, for visibility sake (better to look a little funny than be embedded//sunk in the hull and be useless) +_closeInDistance = (_closeInDistance - 0.0085); + +_endPosTestOffset = _startingOffset vectorAdd (_closeInUnitVector vectorMultiply _closeInDistance); +_endPosTestOffset set [2, (_startingOffset select 2)]; + +// TODO put animation and delayed connect ? + +_unit setVariable [QGVAR(nozzle), nil]; +detach _nozzle; +[_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); + +_weaponSelect = _unit getVariable QGVAR(selectedWeaponOnRefuel); +_unit selectWeapon _weaponSelect; +_unit setVariable [QGVAR(selectedWeaponOnRefuel), nil]; + +_source = _nozzle getVariable QGVAR(source); +if (_source == _target) exitWith { + _source setVariable [QGVAR(connected), nil, true]; + ropeDestroy (_nozzle getVariable QGVAR(rope)); + deleteVehicle _nozzle; + _unit setVariable [QGVAR(isRefueling), nil]; +}; + +_nozzle attachTo [_target, _endPosTestOffset]; +_nozzle setVariable [QGVAR(sink), _target, true]; +_nozzle setVariable [QGVAR(fueling), 1, true]; +_target setVariable [QGVAR(nozzle), _nozzle, true]; + +_rate = if (_target isKindOf "Air") then { FLOWRATE_AIR * RATE +} else { + FLOWRATE_GND * RATE +}; +_maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> "fuelCapacity"); + +[_unit, _target, _nozzle, _rate, _maxFuel] call FUNC(refuel); + +true \ No newline at end of file diff --git a/addons/refuel/functions/fnc_cutTiltRope.sqf b/addons/refuel/functions/fnc_cutTiltRope.sqf new file mode 100644 index 0000000000..d045b502a5 --- /dev/null +++ b/addons/refuel/functions/fnc_cutTiltRope.sqf @@ -0,0 +1,34 @@ +/* + * Author: GitHawk + * Disconnects the tilting rope + * + * Arguments: + * 0: The target + * + * Return Value: + * NIL + * + * Example: + * [player] call ace_logistics_fnc_cutTiltRope + * + * Public: Yes + */ +#include "script_component.hpp" + +private ["_rope"]; +params ["_unit"]; + +_rope = _unit getVariable [QGVAR(tiltRope), nil]; +if !(isNil "_rope") then { + ropeDestroy _rope; +}; + +(_unit getVariable QGVAR(tiltVehicle)) setVariable [QGVAR(tiltUp), nil, true]; +(_unit getVariable QGVAR(tiltVehicleTow)) setVariable [QGVAR(tiltUp), nil, true]; + +_unit setVariable [QGVAR(tiltVehicle), nil]; +_unit setVariable [QGVAR(tiltVehicleTow), nil]; +_unit setVariable [QGVAR(isTilting), nil]; +_unit setVariable [QGVAR(tiltRope), nil]; + +true \ No newline at end of file diff --git a/addons/refuel/functions/fnc_disconnect.sqf b/addons/refuel/functions/fnc_disconnect.sqf new file mode 100644 index 0000000000..12e35c3a54 --- /dev/null +++ b/addons/refuel/functions/fnc_disconnect.sqf @@ -0,0 +1,28 @@ +/* + * Author: GitHawk + * Disconnect a fuel nozzle + * + * Arguments: + * 0: The unit + * 1: The object holding the nozzle + * + * Return Value: + * NIL + * + * Example: + * [unit, truck] call ace_refuel_fnc_disconnect + * + * Public: Yes + */ +#include "script_component.hpp" + +params ["_unit", "_nozzleHolder"]; + +_nozzle = _nozzleHolder getVariable QGVAR(nozzle); + +detach _nozzle; +_nozzle setVariable [QGVAR(sink), objNull]; +_nozzleHolder setVariable [QGVAR(nozzle), objNull, true]; +_unit setVariable [QGVAR(nozzle), _nozzle]; + +[_unit, _nozzleHolder, _nozzle] call FUNC(takeNozzle); diff --git a/addons/refuel/functions/fnc_getFuel.sqf b/addons/refuel/functions/fnc_getFuel.sqf new file mode 100644 index 0000000000..5b46aafc13 --- /dev/null +++ b/addons/refuel/functions/fnc_getFuel.sqf @@ -0,0 +1,45 @@ +/* + * Author: GitHawk + * Get the remaining fuel amount + * + * Arguments: + * 0: The unit + * 1: The target + * + * Return Value: + * Number of liters left + * + * Example: + * [unit, target] call ace_refuel_fnc_getFuel + * + * Public: Yes + */ +#include "script_component.hpp" +private ["_fuel", "_type"]; +params ["_unit", "_target"]; + +if (isNull _unit || {!(_unit isKindOf "CAManBase")} || {!local _unit} || { (_target distance _unit) > 7}) exitWith {0}; + +_fuel = _target getVariable [QGVAR(fuel), -2]; +if (_fuel == -2) then { + _type = getText (configFile >> "CfgVehicles" >> typeOf _target >> "ace_refuel_type"); + if (_type == "mil") then { + //_fuel = GVAR(mil_fuel); // FIXME + _fuel = 20000; // FIXME + _target setVariable [QGVAR(fuel), _fuel, true]; + } else { + if (_type == "civ") then { + _fuel = GVAR(civ_fuel); + _target setVariable [QGVAR(fuel), _fuel, true]; + } else { + if (_type == "stationary") then { + _fuel = GVAR(stationary_fuel); + _target setVariable [QGVAR(fuel), _fuel, true]; + } else { + _fuel = 0; + }; + }; + }; +}; + +_fuel diff --git a/addons/refuel/functions/fnc_moduleRefuelSettings.sqf b/addons/refuel/functions/fnc_moduleRefuelSettings.sqf new file mode 100644 index 0000000000..e6e8fa28e7 --- /dev/null +++ b/addons/refuel/functions/fnc_moduleRefuelSettings.sqf @@ -0,0 +1,25 @@ +/* + * Author: GitHawk + * Module for adjusting the refuel settings + * + * Arguments: + * 0: The module logic + * 1: units + * 2: activated + * + * Return Value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_logic", "_units", "_activated"]; + +if !(_activated) exitWith {}; + +[_logic, QGVAR(rate), "rate"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(civ_fuel), "civ_fuel"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(mil_fuel), "mil_fuel"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(stationary_fuel), "stationary_fuel"] call EFUNC(common,readSettingFromModule); diff --git a/addons/refuel/functions/fnc_refuel.sqf b/addons/refuel/functions/fnc_refuel.sqf new file mode 100644 index 0000000000..e147a5515f --- /dev/null +++ b/addons/refuel/functions/fnc_refuel.sqf @@ -0,0 +1,69 @@ +/* + * Author: GitHawk + * Refuels the vehicle + * + * Arguments: + * 0: The target + * 1: The rate + * + * Return Value: + * NIL + * + * Public: No + */ + +#include "script_component.hpp" + +private ["_sink"]; +params ["_unit", "_target", "_nozzle", "_rate", "_maxFuel"]; + +_sink = _nozzle getVariable [QGVAR(sink), objNull]; +if (isNull _sink) exitWith {}; + +if !(local _sink) exitWith { + [_this, QUOTE(DFUNC(refuel)), _target] call EFUNC(common,execRemoteFnc); +}; + +[{ + private ["_source", "_sink", "_fuelInSource", "_fuelInSink", "_finished", "_fueling"]; + params ["_args", "_pfID"]; + EXPLODE_5_PVT(_args,_unit,_nozzle,_rate,_startFuel,_maxFuel); + + _fueling = _nozzle getVariable [QGVAR(fueling), 0]; + _rate = _rate * 0.1; + + _source = _nozzle getVariable [QGVAR(source), objNull]; + _sink = _nozzle getVariable [QGVAR(sink), objNull]; + if (isNull _source || {isNull _sink} || {(_source distance _sink) > 20}) exitWith { + detach _nozzle; + _nozzle setPosATL [(getPosATL _nozzle) select 0,(getPosATL _nozzle) select 1, 0]; + _nozzle setVariable [QGVAR(sink), objNull]; + [_pfID] call cba_fnc_removePerFrameHandler; + }; + _fuelInSource = [_unit, _source] call FUNC(getFuel); + if (_fuelInSource == 0) exitWith { + _nozzle setVariable [QGVAR(fueling), 0, true]; + [_pfID] call cba_fnc_removePerFrameHandler; + }; + _finished = false; + _fuelInSource = _fuelInSource - _rate; + if (_fuelInSource < 0 && {_fuelInSource > -1}) then { + _fuelInSource = 0; + _finished = true; + }; + + _fuelInSink = fuel _sink + ( _rate / _maxFuel); + if (_fuelInSink > 1) then { + _fuelInSink = 1; + _finished = true; + }; + _sink setFuel _fuelInSink; + [_unit, _source, _fuelInSource] call FUNC(setFuel); + + if (_finished || {_fueling == 0}) exitWith { + _nozzle setVariable [QGVAR(fueling), 0, true]; + [_pfID] call cba_fnc_removePerFrameHandler; + }; + + // TODO display ace hint how many liters were transfered +}, 0.1, [_unit, _nozzle, _rate, fuel _target, _maxFuel]] call cba_fnc_addPerFrameHandler; diff --git a/addons/refuel/functions/fnc_setFuel.sqf b/addons/refuel/functions/fnc_setFuel.sqf new file mode 100644 index 0000000000..4bcd58163f --- /dev/null +++ b/addons/refuel/functions/fnc_setFuel.sqf @@ -0,0 +1,38 @@ +/* + * Author: GitHawk + * Set the remaining fuel amount + * + * Arguments: + * 0: The unit + * 1: The target + * 2: The amout + * + * Return Value: + * Nil + * + * Example: + * [unit, target] call ace_refuel_fnc_getFuel + * + * Public: Yes + */ +#include "script_component.hpp" +private ["_maxFuel", "_type"]; +params ["_unit", "_target", "_fuel"]; + +if (isNull _unit || {isNull _target} || {!(_unit isKindOf "CAManBase")} || {!local _unit} || { (_target distance _unit) > 7}) exitWith {0}; + +_type = getText (configFile >> "CfgVehicles" >> typeOf _target >> "ace_refuel_type"); +_maxFuel = 0; +if (_type == "mil") then { + //_maxFuel = GVAR(mil_fuel); // FIXME + _maxFuel = 20000; // FIXME +}; +if (_type == "civ") then { + _maxFuel = GVAR(civ_Fuel); +}; +if (_type == "stationary") then { + _maxFuel = GVAR(stationary_Fuel); +}; +_target setVariable [QGVAR(fuel), _maxFuel min _fuel, true]; + +nil diff --git a/addons/refuel/functions/fnc_takeNozzle.sqf b/addons/refuel/functions/fnc_takeNozzle.sqf new file mode 100644 index 0000000000..b8e0d2449a --- /dev/null +++ b/addons/refuel/functions/fnc_takeNozzle.sqf @@ -0,0 +1,62 @@ +/* + * Author: GitHawk + * Take a fuel nozzle + * + * Arguments: + * 0: The unit + * 1: The target + * 2: The nozzle (optional) + * + * Return Value: + * NIL + * + * Example: + * [unit, target, truck] call ace_refuel_fnc_takeNozzle + * + * Public: Yes + */ +#include "script_component.hpp" + +private ["_endPosOffset"], +params ["_unit", "_target", "_nozzle"]; + +[_unit, QGVAR(vehAttach), true] call EFUNC(common,setForceWalkStatus); + +_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; + + // TODO pfh to check distance between _unit und _target + // if too large cancel walk and drop nozzle + + // TODO add pickup animation ? + + [{ + params ["_unit", "_target", "_endPosTestOffset"]; + _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]; + + _rope = ropeCreate [_target, _endPosTestOffset, _newNozzle, [0, 0, 0], 12]; + + _newNozzle setVariable [QGVAR(source), _target, true]; + _newNozzle setVariable [QGVAR(rope), _rope, true]; + _target setVariable [QGVAR(connected), _newNozzle, true]; + }, [_unit, _target, _endPosOffset], 2, 0] call EFUNC(common,waitAndExecute); + + _unit setVariable [QGVAR(isRefueling), 1]; +} else { // func is called in muzzle either connected or on ground + // TODO add pickup animation ? + [{ + params ["_unit", "_target", "_nozzle"]; + + detach _nozzle; + _target setVariable [QGVAR(nozzle), objNull, true]; + _nozzle attachTo [_unit, [-0.02,-0.05,0], "righthandmiddle1"]; // TODO replace with right coordinates for real model + _unit setVariable [QGVAR(nozzle), _nozzle]; + }, [_unit, _target, _nozzle], 2, 0] call EFUNC(common,waitAndExecute); +}; + +true \ No newline at end of file diff --git a/addons/refuel/functions/fnc_turnOff.sqf b/addons/refuel/functions/fnc_turnOff.sqf new file mode 100644 index 0000000000..bb37c2c7bc --- /dev/null +++ b/addons/refuel/functions/fnc_turnOff.sqf @@ -0,0 +1,26 @@ +/* + * Author: GitHawk + * Check if a unit can turn off a fuel nozzle + * + * Arguments: + * 0: The unit + * 1: The object holding the nozzle + * + * Return Value: + * Can turn off + * + * Example: + * [player, nozzle] call ace_refuel_fnc_canTurnOff + * + * Public: Yes + */ +#include "script_component.hpp" + +params ["_unit", "_nozzleHolder"]; + +if (isNull _unit || {!(_unit isKindOf "CAManBase")} || {!local _unit} || { (_nozzleHolder distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false}; + +_nozzle = _nozzleHolder getVariable QGVAR(nozzle); +_nozzle setVariable [QGVAR(fueling), 0]; + +true \ No newline at end of file diff --git a/addons/refuel/functions/script_component.hpp b/addons/refuel/functions/script_component.hpp new file mode 100644 index 0000000000..cb77e83d80 --- /dev/null +++ b/addons/refuel/functions/script_component.hpp @@ -0,0 +1,3 @@ +#include "\z\ace\addons\refuel\script_component.hpp" + +#define REFUEL_ACTION_DISTANCE 4.5 \ No newline at end of file diff --git a/addons/refuel/script_component.hpp b/addons/refuel/script_component.hpp new file mode 100644 index 0000000000..8d737b3f97 --- /dev/null +++ b/addons/refuel/script_component.hpp @@ -0,0 +1,4 @@ +#define COMPONENT refuel +#include "\z\ace\addons\main\script_mod.hpp" + +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/refuel/stringtable.xml b/addons/refuel/stringtable.xml new file mode 100644 index 0000000000..919ebcc206 --- /dev/null +++ b/addons/refuel/stringtable.xml @@ -0,0 +1,93 @@ + + + + + Refuel Settings + Tankeinstellungen + + + Flow Rate + Fließrate + + + How fast should a vehicle be refueled? + Wie schnell soll ein Fahrzeug aufgetankt sein? + + + Fast + Schnell + + + 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. + + + Take fuel nozzle + Zapfpistole nehmen + + + Connect fuel nozzle + Zapfpistole anschließen + + + Disconnect fuel nozzle + Zapfpistole entfernen + + + Connect + Anschließen + + + Check remaining fuel + Verbleibenden Kraftstoff überprüfen + + + There are %1 liters left. + Es sind noch %1 Liter übrig. + + + There is no fuel left. + Es ist kein Treibstoff übrig. + + + Cancel + Abbrechen + + + Failed + Gescheitert + + + Close nozzle + Hahn zudrehen + + + + + + + diff --git a/addons/refuel/ui/icon_module_refuel.paa b/addons/refuel/ui/icon_module_refuel.paa new file mode 100644 index 0000000000000000000000000000000000000000..2cc1a9320d28536733d81c55282d64db2f03d37b GIT binary patch literal 22016 zcmeHPdvH|M8UJ?OHG~nfBW`UAm~BlPJ5JirscV@ixha%nXS7+yy-FWbNn&kF%dYJo zVJc0sQsiapCeG+oNX25u2mI00;%#e3l0pZ9;{f(Sqf|iy$)F5u2n}L(bNl@0_!4v%0z}w4nN~Di;wYlgar4FR8kNv5COAy6W~t zj2-wezH`x{S`ELW_^ic`M}kC;g^1d9qF#K)9-Wam38f227}aPW1|ulTo-Kbr!NmINMkv3_)2_tLXnt45Nt zHoGxOe!=_---rGVo6`{N`n|H>9Q;>hLewwPmIgP(YU&Re%Owu!dW@)5zK?{Fz_@WM zosS>!8Lyp-B!(ig^>H{H_WYTOe;ebOa9Xd?@Lppi!Fogco~=Jz=WsFp^R8c4cPxQ} z^AGy7^RM`q1YYd?*-PjzlYh|<$nqd-n&SUrik%|Y$IQRQ_h@;LxNjK7RjjFpQC|92 zRsY9V&;un_SF;-m3h`NHnV$T^ulN^h#&!Z+s#SlNH9hS4y0z^GekH1x7| zyk2kGcz(xOUwL_XuKY_aPhS6z;(wHS@xwcU!QQt|irT^L{Wi4xW^Kz6)7){k+*3}9 z|4e;NbyWKr+DoIZg6k>VJKnnn-`@uXKFo>@}OVoFpv>Uej!~Koneo=mSe&6mdQT@M7WBG*-{RMnk^WAK(&wRy9{=G6G z=3g{a_*`?h{ZE(+-f|7#99J=D+gfZyfRsAvIk!7K8cI+0*`J)%;#x5rQ_VilP?HFyz!~zZ|^fGV1F;5_Hw)>(PQzg1w)tC&vTjnqI~n6 zmA>76nR1LyY=&=+rme?AgD~#c!9T~rdUqo}d}XZf%Rknv^@^zc6Cv-o6{aFk8c-Tg z8c-Tg8c-Uz+%=%_e*g%NyO7j}voyX1B!!heCZari^<3t%4myVNWi5kaBj02=;vp?XMDfH zFWr8;4b#f!C>P_-uhTZHpJejWOp(7cEH}G7qeI}!EIz_#*7cwnXn(b^z3W5sHOb}2 zvf73lhU#xg$?rKi_xfHOj9mz2gDr_Y=77)!m)0%YxP6#|^1=02r!AuX$nt+7Jm&=J zlmBadR{Ur`CRh2V;|GdHx;slbf4t1sEpd(lPix=1wWFcJXsBR(?X_s}J=M)eaWLlcFZD8Y`7inz z)@WiTj^zN|?)rD;C3@hAXN+0=&{hhxx^T$*m!JGg2OGmLpL|>JjcEo)9o3Aw@vv$| z-_L7UjRw&_W7+y;$N!IyHJ^CvV4dK<3i97-o5qc_)uMf>FX7aGv^jD7Oqp*MaXm8t5vCSOvd3C+)SGAi=|GlF8 z-o4DGEiT+j}|Vg8O+t49g$FG#HW*!H087 z$9zFyrH>1h2OpOVo^O-Ehp!7gX5G$PF>>05Rl%*s@gPdw zHyE|;R^*2feE6itaWP!>x)@dsa{js7UGd5R$886StpC3tT70Llp%E328G&~i1rT0f zj5_hZk>g9B+73Lt`lVk+Iew_yvtk`~TfVw~%*}YN>HE$Yb({S4SS~2#rMBxn9(7KC zim?ZFRg}}mAthuTvXJL>X~(&y|4%A>Vs@atgyV6eoqvY{kI%klV<}^=ix$s%{b=mi zPpE5V6yiF|8jUB(6k@^!DUUWQ-rjbT;2x70^+qQ(G(P70rO@U9}Jnx2b zfwd~_3p{pR}i?y?^W3?oE$p+$v03xE2tx9{&>>*d#YEGWZ&0g(dE ABLDyZ literal 0 HcmV?d00001 diff --git a/addons/refuel/ui/icon_refuel_interact.paa b/addons/refuel/ui/icon_refuel_interact.paa new file mode 100644 index 0000000000000000000000000000000000000000..2cc1a9320d28536733d81c55282d64db2f03d37b GIT binary patch literal 22016 zcmeHPdvH|M8UJ?OHG~nfBW`UAm~BlPJ5JirscV@ixha%nXS7+yy-FWbNn&kF%dYJo zVJc0sQsiapCeG+oNX25u2mI00;%#e3l0pZ9;{f(Sqf|iy$)F5u2n}L(bNl@0_!4v%0z}w4nN~Di;wYlgar4FR8kNv5COAy6W~t zj2-wezH`x{S`ELW_^ic`M}kC;g^1d9qF#K)9-Wam38f227}aPW1|ulTo-Kbr!NmINMkv3_)2_tLXnt45Nt zHoGxOe!=_---rGVo6`{N`n|H>9Q;>hLewwPmIgP(YU&Re%Owu!dW@)5zK?{Fz_@WM zosS>!8Lyp-B!(ig^>H{H_WYTOe;ebOa9Xd?@Lppi!Fogco~=Jz=WsFp^R8c4cPxQ} z^AGy7^RM`q1YYd?*-PjzlYh|<$nqd-n&SUrik%|Y$IQRQ_h@;LxNjK7RjjFpQC|92 zRsY9V&;un_SF;-m3h`NHnV$T^ulN^h#&!Z+s#SlNH9hS4y0z^GekH1x7| zyk2kGcz(xOUwL_XuKY_aPhS6z;(wHS@xwcU!QQt|irT^L{Wi4xW^Kz6)7){k+*3}9 z|4e;NbyWKr+DoIZg6k>VJKnnn-`@uXKFo>@}OVoFpv>Uej!~Koneo=mSe&6mdQT@M7WBG*-{RMnk^WAK(&wRy9{=G6G z=3g{a_*`?h{ZE(+-f|7#99J=D+gfZyfRsAvIk!7K8cI+0*`J)%;#x5rQ_VilP?HFyz!~zZ|^fGV1F;5_Hw)>(PQzg1w)tC&vTjnqI~n6 zmA>76nR1LyY=&=+rme?AgD~#c!9T~rdUqo}d}XZf%Rknv^@^zc6Cv-o6{aFk8c-Tg z8c-Tg8c-Uz+%=%_e*g%NyO7j}voyX1B!!heCZari^<3t%4myVNWi5kaBj02=;vp?XMDfH zFWr8;4b#f!C>P_-uhTZHpJejWOp(7cEH}G7qeI}!EIz_#*7cwnXn(b^z3W5sHOb}2 zvf73lhU#xg$?rKi_xfHOj9mz2gDr_Y=77)!m)0%YxP6#|^1=02r!AuX$nt+7Jm&=J zlmBadR{Ur`CRh2V;|GdHx;slbf4t1sEpd(lPix=1wWFcJXsBR(?X_s}J=M)eaWLlcFZD8Y`7inz z)@WiTj^zN|?)rD;C3@hAXN+0=&{hhxx^T$*m!JGg2OGmLpL|>JjcEo)9o3Aw@vv$| z-_L7UjRw&_W7+y;$N!IyHJ^CvV4dK<3i97-o5qc_)uMf>FX7aGv^jD7Oqp*MaXm8t5vCSOvd3C+)SGAi=|GlF8 z-o4DGEiT+j}|Vg8O+t49g$FG#HW*!H087 z$9zFyrH>1h2OpOVo^O-Ehp!7gX5G$PF>>05Rl%*s@gPdw zHyE|;R^*2feE6itaWP!>x)@dsa{js7UGd5R$886StpC3tT70Llp%E328G&~i1rT0f zj5_hZk>g9B+73Lt`lVk+Iew_yvtk`~TfVw~%*}YN>HE$Yb({S4SS~2#rMBxn9(7KC zim?ZFRg}}mAthuTvXJL>X~(&y|4%A>Vs@atgyV6eoqvY{kI%klV<}^=ix$s%{b=mi zPpE5V6yiF|8jUB(6k@^!DUUWQ-rjbT;2x70^+qQ(G(P70rO@U9}Jnx2b zfwd~_3p{pR}i?y?^W3?oE$p+$v03xE2tx9{&>>*d#YEGWZ&0g(dE ABLDyZ literal 0 HcmV?d00001 From de500fb80b61a9d7ece35e73662366e789b797f0 Mon Sep 17 00:00:00 2001 From: IngoKauffmann Date: Fri, 14 Aug 2015 03:18:54 +0200 Subject: [PATCH 02/25] First batch of fixes --- addons/refuel/ACE_Settings.hpp | 9 ++ addons/refuel/CfgVehicles.hpp | 150 ++++++++---------- addons/refuel/config.cpp | 1 + .../refuel/functions/fnc_canConnectNozzle.sqf | 10 +- addons/refuel/functions/fnc_canDisconnect.sqf | 6 +- addons/refuel/functions/fnc_canRefuel.sqf | 4 +- addons/refuel/functions/fnc_canTakeNozzle.sqf | 16 +- addons/refuel/functions/fnc_canTurnOff.sqf | 14 +- addons/refuel/functions/fnc_checkFuel.sqf | 6 +- addons/refuel/functions/fnc_connectNozzle.sqf | 8 +- .../functions/fnc_connectNozzleAction.sqf | 13 +- addons/refuel/functions/fnc_cutTiltRope.sqf | 34 ---- addons/refuel/functions/fnc_disconnect.sqf | 4 +- addons/refuel/functions/fnc_getFuel.sqf | 31 +--- .../functions/fnc_moduleRefuelSettings.sqf | 5 +- addons/refuel/functions/fnc_refuel.sqf | 37 +++-- addons/refuel/functions/fnc_setFuel.sqf | 22 +-- addons/refuel/functions/fnc_takeNozzle.sqf | 50 ++++-- addons/refuel/functions/fnc_turnOff.sqf | 2 +- addons/refuel/stringtable.xml | 22 ++- 20 files changed, 209 insertions(+), 235 deletions(-) create mode 100644 addons/refuel/ACE_Settings.hpp delete mode 100644 addons/refuel/functions/fnc_cutTiltRope.sqf diff --git a/addons/refuel/ACE_Settings.hpp b/addons/refuel/ACE_Settings.hpp new file mode 100644 index 0000000000..5f848a0daf --- /dev/null +++ b/addons/refuel/ACE_Settings.hpp @@ -0,0 +1,9 @@ +class ACE_Settings { + class GVAR(rate) { + displayName = LSTRING(RefuelSettings_speed_DisplayName); + description = LSTRING(RefuelSettings_speed_Description); + value = 1; + typeName = "SCALAR"; + values[] = {LSTRING(RefuelSettings_basic), LSTRING(RefuelSettings_advanced)}; + }; +}; diff --git a/addons/refuel/CfgVehicles.hpp b/addons/refuel/CfgVehicles.hpp index 9cc0578f40..94fbd2a364 100644 --- a/addons/refuel/CfgVehicles.hpp +++ b/addons/refuel/CfgVehicles.hpp @@ -26,7 +26,7 @@ class GVAR(connect) { \ displayName = CSTRING(connect); \ distance = REFUEL_ACTION_DISTANCE; \ - condition = QUOTE([ARR_2(_player,_target)] call FUNC(canConnectNozzle)); \ + condition = QUOTE([ARR_1(_player)] call FUNC(canConnectNozzle)); \ statement = QUOTE([ARR_2(_player,_target)] call DFUNC(connectNozzle)); \ exceptions[] = {"isNotInside"}; \ icon = PATHTOF(ui\icon_refuel_interact.paa); \ @@ -78,7 +78,7 @@ class CfgVehicles { category = "ACE"; function = QUOTE(DFUNC(moduleRefuelSettings)); functionPriority = 1; - isGlobal = 1; + isGlobal = 0; isTriggerActivated = 0; author = ECSTRING(common,ACETeam); class Arguments { @@ -98,24 +98,6 @@ class CfgVehicles { }; }; }; - class civ_fuel { - displayName = CSTRING(RefuelSettings_civ_fuel_DisplayName); - description = CSTRING(RefuelSettings_civ_fuel_Description); - typeName = "NUMBER"; - defaultValue = 5000; - }; - class mil_fuel { - displayName = CSTRING(RefuelSettings_mil_fuel_DisplayName); - description = CSTRING(RefuelSettings_mil_fuel_Description); - typeName = "NUMBER"; - defaultValue = 20000; - }; - class stationary_fuel { - displayName = CSTRING(RefuelSettings_stationary_fuel_DisplayName); - description = CSTRING(RefuelSettings_stationary_fuel_Description); - typeName = "NUMBER"; - defaultValue = -1; - }; }; }; @@ -155,17 +137,17 @@ class CfgVehicles { class Car_F : Car {}; class Offroad_01_base_f : Car_F {}; class Truck_F : Car_F {}; - class Truck_01_base_F: Truck_F {}; - class Truck_02_base_F : Truck_F {}; - class Truck_03_base_F : Truck_F {}; - class Van_01_base_F : Truck_F {}; + class Truck_01_base_F: Truck_F {}; + class Truck_02_base_F : Truck_F {}; + class Truck_03_base_F : Truck_F {}; + class Van_01_base_F : Truck_F {}; class Van_01_fuel_base_F : Van_01_base_F {}; - - class Tank_F : Tank {}; - class APC_Tracked_01_base_F: Tank_F {}; - class B_APC_Tracked_01_base_F: APC_Tracked_01_base_F {}; - class B_Truck_01_transport_F : Truck_01_base_F {}; - class B_Truck_01_mover_F: B_Truck_01_transport_F {}; + + class Tank_F : Tank {}; + class APC_Tracked_01_base_F: Tank_F {}; + class B_APC_Tracked_01_base_F: APC_Tracked_01_base_F {}; + class B_Truck_01_transport_F : Truck_01_base_F {}; + class B_Truck_01_mover_F: B_Truck_01_transport_F {}; class ReammoBox_F; class Slingload_01_Base_F : ReammoBox_F { @@ -182,69 +164,69 @@ class CfgVehicles { class B_APC_Tracked_01_CRV_F : B_APC_Tracked_01_base_F { transportFuel = 0; //3k MACRO_REFUEL_ACTIONS - ace_refuel_hooks[] = {{0,0,0}}; - ace_refuel_type = "mil"; + GVAR(hooks[]) = {{0,0,0}}; + GVAR(fuelCargo) = 20000; }; - class C_Van_01_fuel_F : Van_01_fuel_base_F { - transportFuel = 0; //1k + class C_Van_01_fuel_F : Van_01_fuel_base_F { + transportFuel = 0; //1k MACRO_REFUEL_ACTIONS - ace_refuel_hooks[] = {{0,0,0}}; - ace_refuel_type = "civ"; - }; - class I_G_Van_01_fuel_F : Van_01_fuel_base_F { - transportFuel = 0; //1k + GVAR(hooks[]) = {{0,0,0}}; + GVAR(fuelCargo) = 5000; + }; + class I_G_Van_01_fuel_F : Van_01_fuel_base_F { + transportFuel = 0; //1k MACRO_REFUEL_ACTIONS - ace_refuel_hooks[] = {{0,0,0}}; - ace_refuel_type = "civ"; + GVAR(hooks[]) = {{0,0,0}}; + GVAR(fuelCargo) = 5000; }; - class I_Truck_02_fuel_F : Truck_02_base_F { - transportFuel = 0; //3k + class I_Truck_02_fuel_F : Truck_02_base_F { + transportFuel = 0; //3k MACRO_REFUEL_ACTIONS - ace_refuel_hooks[] = {{0,0,0}}; - ace_refuel_type = "mil"; - }; + GVAR(hooks[]) = {{0,0,0}}; + GVAR(fuelCargo) = 20000; + }; class O_Truck_02_fuel_F : Truck_02_base_F { - transportFuel = 0; //3k + transportFuel = 0; //3k MACRO_REFUEL_ACTIONS - ace_refuel_hooks[] = {{0,0,0}}; - ace_refuel_type = "mil"; - }; + GVAR(hooks[]) = {{0,0,0}}; + GVAR(fuelCargo) = 20000; + }; - class B_Truck_01_fuel_F : B_Truck_01_mover_F { - transportFuel = 0; //3k + class B_Truck_01_fuel_F : B_Truck_01_mover_F { + transportFuel = 0; //3k MACRO_REFUEL_ACTIONS - ace_refuel_hooks[] = {{0,0,0}}; - ace_refuel_type = "mil"; - }; + GVAR(hooks[]) = {{0,0,0}}; + GVAR(fuelCargo) = 20000; + }; - class O_Truck_03_fuel_F : Truck_03_base_F { - transportFuel = 0; //3k + class O_Truck_03_fuel_F : Truck_03_base_F { + transportFuel = 0; //3k MACRO_REFUEL_ACTIONS - ace_refuel_hooks[] = {{0,0,0}}; - ace_refuel_type = "mil"; - }; + GVAR(hooks[]) = {{0,0,0}}; + GVAR(fuelCargo) = 20000; + }; class B_Slingload_01_Fuel_F : Slingload_01_Base_F { transportFuel = 0; //3k MACRO_REFUEL_ACTIONS - ace_refuel_hooks[] = {{0,0,0}}; - ace_refuel_type = "mil"; + GVAR(hooks[]) = {{0,0,0}}; + GVAR(fuelCargo) = 20000; }; class O_Heli_Transport_04_fuel_F : Heli_Transport_04_base_F { transportFuel = 0; //3k MACRO_REFUEL_ACTIONS - ace_refuel_hooks[] = {{0,0,0}}; - ace_refuel_type = "mil"; + GVAR(hooks[]) = {{0,0,0}}; + GVAR(fuelCargo) = 20000; }; class Land_Pod_Heli_Transport_04_fuel_F : Pod_Heli_Transport_04_base_F { transportFuel = 0; //3k MACRO_REFUEL_ACTIONS - ace_refuel_hooks[] = {{0,0,0}}; - ace_refuel_type = "mil"; + GVAR(hooks[]) = {{0,0,0}}; + GVAR(fuelCargo) = 20000; }; class Static; @@ -263,57 +245,57 @@ class CfgVehicles { class Land_Fuelstation_Feed_F : House_Small_F { transportFuel = 0; //50k MACRO_REFUEL_ACTIONS - ace_refuel_hooks[] = {{0,0,0}}; - ace_refuel_type = "stationary"; + GVAR(hooks[]) = {{0,0,0}}; + GVAR(fuelCargo) = -1; }; class Land_fs_feed_F : House_Small_F { transportFuel = 0; //50k MACRO_REFUEL_ACTIONS - ace_refuel_hooks[] = {{0,0,0}}; - ace_refuel_type = "stationary"; + GVAR(hooks[]) = {{0,0,0}}; + GVAR(fuelCargo) = -1; }; class FuelStation : Strategic { transportFuel = 0; //50k MACRO_REFUEL_ACTIONS - ace_refuel_hooks[] = {{0,0,0}}; - ace_refuel_type = "stationary"; + GVAR(hooks[]) = {{0,0,0}}; + GVAR(fuelCargo) = -1; }; class Land_Fuelstation : Strategic { transportFuel = 0; //50k MACRO_REFUEL_ACTIONS - ace_refuel_hooks[] = {{0,0,0}}; - ace_refuel_type = "stationary"; + GVAR(hooks[]) = {{0,0,0}}; + GVAR(fuelCargo) = -1; }; class Land_Fuelstation_army : Strategic { transportFuel = 0; //50k MACRO_REFUEL_ACTIONS - ace_refuel_hooks[] = {{0,0,0}}; - ace_refuel_type = "stationary"; + GVAR(hooks[]) = {{0,0,0}}; + GVAR(fuelCargo) = -1; }; class Land_Benzina_schnell : Strategic { transportFuel = 0; //50k MACRO_REFUEL_ACTIONS - ace_refuel_hooks[] = {{0,0,0}}; - ace_refuel_type = "stationary"; + GVAR(hooks[]) = {{0,0,0}}; + GVAR(fuelCargo) = -1; }; class Land_A_FuelStation_Feed : Strategic { transportFuel = 0; //50k MACRO_REFUEL_ACTIONS - ace_refuel_hooks[] = {{0,0,0}}; - ace_refuel_type = "stationary"; + GVAR(hooks[]) = {{0,0,0}}; + GVAR(fuelCargo) = -1; }; class Land_Ind_FuelStation_Feed_EP1 : Strategic { transportFuel = 0; //50k MACRO_REFUEL_ACTIONS - ace_refuel_hooks[] = {{0,0,0}}; - ace_refuel_type = "stationary"; + GVAR(hooks[]) = {{0,0,0}}; + GVAR(fuelCargo) = -1; }; class Land_FuelStation_Feed_PMC : Strategic { transportFuel = 0; //50k MACRO_REFUEL_ACTIONS - ace_refuel_hooks[] = {{0,0,0}}; - ace_refuel_type = "stationary"; + GVAR(hooks[]) = {{0,0,0}}; + GVAR(fuelCargo) = -1; }; /* // Barrels from rhs? diff --git a/addons/refuel/config.cpp b/addons/refuel/config.cpp index 7abfb2d645..fe5363ecd5 100644 --- a/addons/refuel/config.cpp +++ b/addons/refuel/config.cpp @@ -14,3 +14,4 @@ class CfgPatches { #include "CfgEventHandlers.hpp" #include "CfgVehicles.hpp" +#include "ACE_Settings.hpp" \ No newline at end of file diff --git a/addons/refuel/functions/fnc_canConnectNozzle.sqf b/addons/refuel/functions/fnc_canConnectNozzle.sqf index 07cfabd58c..0480262292 100644 --- a/addons/refuel/functions/fnc_canConnectNozzle.sqf +++ b/addons/refuel/functions/fnc_canConnectNozzle.sqf @@ -7,19 +7,19 @@ * 1: The target * * Return Value: - * NIL + * Can Connect Nozzle * * Example: - * [unit, target, nozzle] call ace_refuel_fnc_connectNozzle + * [unit] call ace_refuel_fnc_canConnectNozzle * - * Public: Yes + * Public: No */ #include "script_component.hpp" private ["_nozzle"]; -params ["_unit", "_target"]; +params ["_unit"]; -_nozzle = _unit getVariable [QGVAR(nozzle), nil]; +_nozzle = _unit getVariable QGVAR(nozzle); if (isNil "_nozzle") exitWith {false}; true \ No newline at end of file diff --git a/addons/refuel/functions/fnc_canDisconnect.sqf b/addons/refuel/functions/fnc_canDisconnect.sqf index ca91f0e4a7..d2cd4636c0 100644 --- a/addons/refuel/functions/fnc_canDisconnect.sqf +++ b/addons/refuel/functions/fnc_canDisconnect.sqf @@ -4,15 +4,15 @@ * * Arguments: * 0: The unit - * 0: The object holding the nozzle + * 1: The object holding the nozzle * * Return Value: - * Can disconnect + * Can disconnect * * Example: * [player, truck] call ace_refuel_fnc_canDisconnect * - * Public: Yes + * Public: No */ #include "script_component.hpp" diff --git a/addons/refuel/functions/fnc_canRefuel.sqf b/addons/refuel/functions/fnc_canRefuel.sqf index 21b856918e..038eb0abf3 100644 --- a/addons/refuel/functions/fnc_canRefuel.sqf +++ b/addons/refuel/functions/fnc_canRefuel.sqf @@ -6,12 +6,12 @@ * 0: The target * * Return Value: - * Can refuel + * Can refuel * * Example: * [unit, target] call ace_refuel_fnc_canRefuel * - * Public: Yes + * Public: No */ #include "script_component.hpp" private ["_fuel"]; diff --git a/addons/refuel/functions/fnc_canTakeNozzle.sqf b/addons/refuel/functions/fnc_canTakeNozzle.sqf index b306c2ec37..eceebca4f8 100644 --- a/addons/refuel/functions/fnc_canTakeNozzle.sqf +++ b/addons/refuel/functions/fnc_canTakeNozzle.sqf @@ -7,26 +7,18 @@ * 1: The target * * Return Value: - * Can connect + * Can connect * * Example: * [player, target] call ace_refuel_fnc_canTakeNozzle * - * Public: Yes + * Public: No */ #include "script_component.hpp" -private ["_connected"]; params ["_unit", "_target"]; -if (isNull _unit || {!(_unit isKindOf "CAManBase")} || {!local _unit} || {(_target distance _unit) > 3.5}) 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 -_connected = _target getVariable [QGVAR(connected), nil]; -if !(isNil "_connected") exitWith {false}; - -// Check if the player is already carrying another fuel nozzle -_connected = _unit getVariable [QGVAR(isRefueling), nil]; -if !(isNil "_connected") exitWith {false}; - -true \ No newline at end of file +!(_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 d08dae90bf..386b0f33cd 100644 --- a/addons/refuel/functions/fnc_canTurnOff.sqf +++ b/addons/refuel/functions/fnc_canTurnOff.sqf @@ -7,24 +7,18 @@ * 1: The object holding the nozzle * * Return Value: - * Can turn off + * Can turn off * * Example: * [player, truck] call ace_refuel_fnc_canTurnOff * - * Public: Yes + * Public: No */ #include "script_component.hpp" private ["_nozzle", "_fueling"]; 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}; -_nozzle = _nozzleHolder getVariable [QGVAR(nozzle), objNull]; -if (isNull _nozzle) exitWith {false}; - -_fueling = _nozzle getVariable [QGVAR(fueling), 0]; -if (_fueling == 0) exitWith {false}; - -true \ No newline at end of file +!(isNull (_nozzleHolder getVariable [QGVAR(nozzle), objNull])) && {(_nozzleHolder getVariable QGVAR(nozzle)) getVariable [QGVAR(fueling), 0] != 0} diff --git a/addons/refuel/functions/fnc_checkFuel.sqf b/addons/refuel/functions/fnc_checkFuel.sqf index cd3525452d..871683dfe1 100644 --- a/addons/refuel/functions/fnc_checkFuel.sqf +++ b/addons/refuel/functions/fnc_checkFuel.sqf @@ -7,12 +7,12 @@ * 1: The target * * Return Value: - * nil + * None * * Example: * [unit, target] call ace_refuel_fnc_checkFuel * - * Public: Yes + * Public: No */ #include "script_component.hpp" private ["_fuel", "_type"]; @@ -27,7 +27,7 @@ _fuel = [_unit, _target] call FUNC(getFuel); [_unit, _target, _fuel], { params ["_args"]; - EXPLODE_3_PVT(_args,_unit,_target,_fuel); + _args params ["_unit", "_target", "_fuel"]; if (_fuel > 0 ) then { ["displayTextStructured", [_unit], [[LSTRING(Hint_RemainingFuel), _fuel], 2, _unit]] call EFUNC(common,targetEvent); } else { diff --git a/addons/refuel/functions/fnc_connectNozzle.sqf b/addons/refuel/functions/fnc_connectNozzle.sqf index 2b66f7e5ff..2f17584882 100644 --- a/addons/refuel/functions/fnc_connectNozzle.sqf +++ b/addons/refuel/functions/fnc_connectNozzle.sqf @@ -9,12 +9,12 @@ * 2: The nozzle (optional) * * Return Value: - * NIL + * None * * Example: * [unit, target, nozzle] call ace_refuel_fnc_connectNozzle * - * Public: Yes + * Public: No */ #include "script_component.hpp" @@ -25,7 +25,7 @@ private ["_nozzle", "_actionID"]; params ["_unit", "_target"]; -_nozzle = _unit getVariable [QGVAR(nozzle), nil]; +_nozzle = _unit getVariable QGVAR(nozzle); if (isNil "_nozzle") exitWith {}; GVAR(placeAction) = PLACE_WAITING; @@ -38,7 +38,7 @@ _actionID = _unit addAction [format ["%1", localize LSTRI [{ private["_virtualPos", "_virtualPosASL", "_lineInterection"]; params ["_args","_pfID"]; - EXPLODE_4_PVT(_args,_unit,_target,_nozzle,_actionID); + _args params ["_unit", "_target", "_nozzle", "_actionID"]; _virtualPosASL = (eyePos _unit) vectorAdd (positionCameraToWorld [0,0,0.6]) vectorDiff (positionCameraToWorld [0,0,0]); if (cameraView == "EXTERNAL") then { diff --git a/addons/refuel/functions/fnc_connectNozzleAction.sqf b/addons/refuel/functions/fnc_connectNozzleAction.sqf index 277478710a..2d828e43d2 100644 --- a/addons/refuel/functions/fnc_connectNozzleAction.sqf +++ b/addons/refuel/functions/fnc_connectNozzleAction.sqf @@ -10,17 +10,16 @@ * 3: The nozzle * * Return Value: - * NIL + * None * * Example: * [player, tank, [0,0,0], nozzle] call ace_refuel_fnc_connectNozzleAction * - * Public: Yes + * Public: No */ #include "script_component.hpp" #define FLOWRATE_GND 0.165 // TODO ace_vehicles messes with fuel capacity - why? #define FLOWRATE_AIR 0.67 -#define RATE 1 // FIXME use global var from module private ["_startingOffset", "_startDistanceFromCenter", "_closeInUnitVector", "_closeInMax", "_closeInMin", "_closeInDistance", "_endPosTestOffset", "_endPosTest", "_doesIntersect", "_startingPosShifted", "_endASL", "_rate", "_maxFuel"]; @@ -87,10 +86,10 @@ _unit setVariable [QGVAR(selectedWeaponOnRefuel), nil]; _source = _nozzle getVariable QGVAR(source); if (_source == _target) exitWith { - _source setVariable [QGVAR(connected), nil, true]; + _source setVariable [QGVAR(isConnected), false, true]; ropeDestroy (_nozzle getVariable QGVAR(rope)); deleteVehicle _nozzle; - _unit setVariable [QGVAR(isRefueling), nil]; + _unit setVariable [QGVAR(isRefueling), false]; }; _nozzle attachTo [_target, _endPosTestOffset]; @@ -98,9 +97,9 @@ _nozzle setVariable [QGVAR(sink), _target, true]; _nozzle setVariable [QGVAR(fueling), 1, true]; _target setVariable [QGVAR(nozzle), _nozzle, true]; -_rate = if (_target isKindOf "Air") then { FLOWRATE_AIR * RATE +_rate = if (_target isKindOf "Air") then { FLOWRATE_AIR * GVAR(rate) } else { - FLOWRATE_GND * RATE + FLOWRATE_GND * GVAR(rate) }; _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> "fuelCapacity"); diff --git a/addons/refuel/functions/fnc_cutTiltRope.sqf b/addons/refuel/functions/fnc_cutTiltRope.sqf deleted file mode 100644 index d045b502a5..0000000000 --- a/addons/refuel/functions/fnc_cutTiltRope.sqf +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Author: GitHawk - * Disconnects the tilting rope - * - * Arguments: - * 0: The target - * - * Return Value: - * NIL - * - * Example: - * [player] call ace_logistics_fnc_cutTiltRope - * - * Public: Yes - */ -#include "script_component.hpp" - -private ["_rope"]; -params ["_unit"]; - -_rope = _unit getVariable [QGVAR(tiltRope), nil]; -if !(isNil "_rope") then { - ropeDestroy _rope; -}; - -(_unit getVariable QGVAR(tiltVehicle)) setVariable [QGVAR(tiltUp), nil, true]; -(_unit getVariable QGVAR(tiltVehicleTow)) setVariable [QGVAR(tiltUp), nil, true]; - -_unit setVariable [QGVAR(tiltVehicle), nil]; -_unit setVariable [QGVAR(tiltVehicleTow), nil]; -_unit setVariable [QGVAR(isTilting), nil]; -_unit setVariable [QGVAR(tiltRope), nil]; - -true \ No newline at end of file diff --git a/addons/refuel/functions/fnc_disconnect.sqf b/addons/refuel/functions/fnc_disconnect.sqf index 12e35c3a54..7d3d5be846 100644 --- a/addons/refuel/functions/fnc_disconnect.sqf +++ b/addons/refuel/functions/fnc_disconnect.sqf @@ -7,12 +7,12 @@ * 1: The object holding the nozzle * * Return Value: - * NIL + * None * * Example: * [unit, truck] call ace_refuel_fnc_disconnect * - * Public: Yes + * Public: No */ #include "script_component.hpp" diff --git a/addons/refuel/functions/fnc_getFuel.sqf b/addons/refuel/functions/fnc_getFuel.sqf index 5b46aafc13..553eb537ff 100644 --- a/addons/refuel/functions/fnc_getFuel.sqf +++ b/addons/refuel/functions/fnc_getFuel.sqf @@ -7,39 +7,24 @@ * 1: The target * * Return Value: - * Number of liters left + * Fuel left (in liters) * * Example: * [unit, target] call ace_refuel_fnc_getFuel * - * Public: Yes + * Public: No */ #include "script_component.hpp" -private ["_fuel", "_type"]; +private ["_fuel"]; params ["_unit", "_target"]; -if (isNull _unit || {!(_unit isKindOf "CAManBase")} || {!local _unit} || { (_target distance _unit) > 7}) exitWith {0}; +if (isNull _unit || {!(_unit isKindOf "CAManBase")} || {!local _unit}) exitWith {0}; + +_fuel = _target getVariable [QGVAR(currentFuelCargo), -2]; -_fuel = _target getVariable [QGVAR(fuel), -2]; if (_fuel == -2) then { - _type = getText (configFile >> "CfgVehicles" >> typeOf _target >> "ace_refuel_type"); - if (_type == "mil") then { - //_fuel = GVAR(mil_fuel); // FIXME - _fuel = 20000; // FIXME - _target setVariable [QGVAR(fuel), _fuel, true]; - } else { - if (_type == "civ") then { - _fuel = GVAR(civ_fuel); - _target setVariable [QGVAR(fuel), _fuel, true]; - } else { - if (_type == "stationary") then { - _fuel = GVAR(stationary_fuel); - _target setVariable [QGVAR(fuel), _fuel, true]; - } else { - _fuel = 0; - }; - }; - }; + _fuel = getNumber (configFile >> "CfgVehicles" >> typeOf _target >> QGVAR(fuelCargo)); + _target setVariable [QGVAR(currentFuelCargo), _fuel, true]; }; _fuel diff --git a/addons/refuel/functions/fnc_moduleRefuelSettings.sqf b/addons/refuel/functions/fnc_moduleRefuelSettings.sqf index e6e8fa28e7..d71c35e3d2 100644 --- a/addons/refuel/functions/fnc_moduleRefuelSettings.sqf +++ b/addons/refuel/functions/fnc_moduleRefuelSettings.sqf @@ -8,7 +8,7 @@ * 2: activated * * Return Value: - * None + * None * * Public: No */ @@ -20,6 +20,3 @@ params ["_logic", "_units", "_activated"]; if !(_activated) exitWith {}; [_logic, QGVAR(rate), "rate"] call EFUNC(common,readSettingFromModule); -[_logic, QGVAR(civ_fuel), "civ_fuel"] call EFUNC(common,readSettingFromModule); -[_logic, QGVAR(mil_fuel), "mil_fuel"] call EFUNC(common,readSettingFromModule); -[_logic, QGVAR(stationary_fuel), "stationary_fuel"] call EFUNC(common,readSettingFromModule); diff --git a/addons/refuel/functions/fnc_refuel.sqf b/addons/refuel/functions/fnc_refuel.sqf index e147a5515f..98158fb722 100644 --- a/addons/refuel/functions/fnc_refuel.sqf +++ b/addons/refuel/functions/fnc_refuel.sqf @@ -3,11 +3,14 @@ * Refuels the vehicle * * Arguments: - * 0: The target - * 1: The rate + * 0: The unit + * 1: The target + * 2: The nozzle + * 3: The rate + * 4: The maximum fuel volume * * Return Value: - * NIL + * None * * Public: No */ @@ -20,21 +23,17 @@ params ["_unit", "_target", "_nozzle", "_rate", "_maxFuel"]; _sink = _nozzle getVariable [QGVAR(sink), objNull]; if (isNull _sink) exitWith {}; -if !(local _sink) exitWith { - [_this, QUOTE(DFUNC(refuel)), _target] call EFUNC(common,execRemoteFnc); -}; - [{ private ["_source", "_sink", "_fuelInSource", "_fuelInSink", "_finished", "_fueling"]; params ["_args", "_pfID"]; - EXPLODE_5_PVT(_args,_unit,_nozzle,_rate,_startFuel,_maxFuel); + _args params ["_unit", "_nozzle", "_rate", "_startFuel", "_maxFuel"]; _fueling = _nozzle getVariable [QGVAR(fueling), 0]; - _rate = _rate * 0.1; _source = _nozzle getVariable [QGVAR(source), objNull]; _sink = _nozzle getVariable [QGVAR(sink), objNull]; - if (isNull _source || {isNull _sink} || {(_source distance _sink) > 20}) exitWith { + if (isNull _source || {isNull _sink} || {(_source distance _sink) > 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]; @@ -42,6 +41,7 @@ if !(local _sink) exitWith { }; _fuelInSource = [_unit, _source] call FUNC(getFuel); if (_fuelInSource == 0) exitWith { + [LSTRING(Hint_SourceEmpty), 2, _unit] call EFUNC(common,displayTextStructured); _nozzle setVariable [QGVAR(fueling), 0, true]; [_pfID] call cba_fnc_removePerFrameHandler; }; @@ -50,20 +50,31 @@ if !(local _sink) exitWith { if (_fuelInSource < 0 && {_fuelInSource > -1}) then { _fuelInSource = 0; _finished = true; + [LSTRING(Hint_Empty), 2, _unit] call EFUNC(common,displayTextStructured); }; _fuelInSink = fuel _sink + ( _rate / _maxFuel); if (_fuelInSink > 1) then { _fuelInSink = 1; _finished = true; + [LSTRING(Hint_Completed), 2, _unit] call EFUNC(common,displayTextStructured); + }; + if !(local _sink) then { + [[_sink, _fuelInSink], QUOTE({(_this select 0) setFuel (_this select 1)}), _sink] call EFUNC(common,execRemoteFnc); + } else { + _sink setFuel _fuelInSink; }; - _sink setFuel _fuelInSink; [_unit, _source, _fuelInSource] call FUNC(setFuel); if (_finished || {_fueling == 0}) exitWith { + if (_fueling == 0) then { + [LSTRING(Hint_Stopped), 2, _unit] call EFUNC(common,displayTextStructured); + }; _nozzle setVariable [QGVAR(fueling), 0, true]; [_pfID] call cba_fnc_removePerFrameHandler; }; - // TODO display ace hint how many liters were transfered -}, 0.1, [_unit, _nozzle, _rate, fuel _target, _maxFuel]] call cba_fnc_addPerFrameHandler; + // display flickers even at 1 second intervals + //["displayTextStructured", [_unit], [[localize LSTRING(Hint_FuelProgress), round((_fuelInSink - _startFuel) * _maxFuel)], 2, _unit]] call EFUNC(common,targetEvent); + //[[LSTRING(Hint_FuelProgress), round((_fuelInSink - _startFuel) * _maxFuel)], 2, _unit] call EFUNC(common,displayTextStructured); +}, 1, [_unit, _nozzle, _rate, fuel _target, _maxFuel]] call cba_fnc_addPerFrameHandler; diff --git a/addons/refuel/functions/fnc_setFuel.sqf b/addons/refuel/functions/fnc_setFuel.sqf index 4bcd58163f..f5f3edbe10 100644 --- a/addons/refuel/functions/fnc_setFuel.sqf +++ b/addons/refuel/functions/fnc_setFuel.sqf @@ -8,31 +8,17 @@ * 2: The amout * * Return Value: - * Nil + * None * * Example: * [unit, target] call ace_refuel_fnc_getFuel * - * Public: Yes + * Public: No */ #include "script_component.hpp" -private ["_maxFuel", "_type"]; +private ["_maxFuel"]; params ["_unit", "_target", "_fuel"]; if (isNull _unit || {isNull _target} || {!(_unit isKindOf "CAManBase")} || {!local _unit} || { (_target distance _unit) > 7}) exitWith {0}; -_type = getText (configFile >> "CfgVehicles" >> typeOf _target >> "ace_refuel_type"); -_maxFuel = 0; -if (_type == "mil") then { - //_maxFuel = GVAR(mil_fuel); // FIXME - _maxFuel = 20000; // FIXME -}; -if (_type == "civ") then { - _maxFuel = GVAR(civ_Fuel); -}; -if (_type == "stationary") then { - _maxFuel = GVAR(stationary_Fuel); -}; -_target setVariable [QGVAR(fuel), _maxFuel min _fuel, true]; - -nil +_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 b8e0d2449a..c972fa57d8 100644 --- a/addons/refuel/functions/fnc_takeNozzle.sqf +++ b/addons/refuel/functions/fnc_takeNozzle.sqf @@ -8,12 +8,12 @@ * 2: The nozzle (optional) * * Return Value: - * NIL + * None * * Example: * [unit, target, truck] call ace_refuel_fnc_takeNozzle * - * Public: Yes + * Public: No */ #include "script_component.hpp" @@ -28,9 +28,6 @@ _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; - // TODO pfh to check distance between _unit und _target - // if too large cancel walk and drop nozzle - // TODO add pickup animation ? [{ @@ -39,16 +36,53 @@ if (isNull _nozzle) then { // func is called on fuel truck _newNozzle attachTo [_unit, [-0.02,-0.05,0], "righthandmiddle1"]; // TODO replace with right coordinates for real model _unit setVariable [QGVAR(nozzle), _newNozzle]; + // TODO action is only local + _action = [QGVAR(TakeNozzleFromGround), + localize LSTRING(TakeNozzle), + QUOTE(PATHTOF(ui\icon_refuel_interact.paa)), + {params ["_nozzle", "_unit"]; [ARR_3(_unit,_nozzle,_nozzle)] call DFUNC(TakeNozzle); true}, + {params ["_nozzle", "_unit"]; [ARR_2(_unit,_nozzle)] call FUNC(canTakeNozzle)}, + {}, + [] + ] call EFUNC(interact_menu,createAction); + [_newNozzle, 0, [], _action] call EFUNC(interact_menu,addActionToObject); + _rope = ropeCreate [_target, _endPosTestOffset, _newNozzle, [0, 0, 0], 12]; _newNozzle setVariable [QGVAR(source), _target, true]; _newNozzle setVariable [QGVAR(rope), _rope, true]; - _target setVariable [QGVAR(connected), _newNozzle, true]; + _target setVariable [QGVAR(isConnected), true, true]; }, [_unit, _target, _endPosOffset], 2, 0] call EFUNC(common,waitAndExecute); + + [{ + private ["_nozzle"]; + params ["_args", "_pfID"]; + _args params ["_unit", "_target"]; + + if ((_unit distance _target) > 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]; + _unit setVariable [QGVAR(isRefueling), false]; + _unit setVariable [QGVAR(nozzle), objNull]; + + _weaponSelect = _unit getVariable QGVAR(selectedWeaponOnRefuel); + _unit selectWeapon _weaponSelect; + _unit setVariable [QGVAR(selectedWeaponOnRefuel), nil]; + + [_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); + [LSTRING(Hint_TooFar), 2, _unit] call EFUNC(common,displayTextStructured); + }; + [_pfID] call cba_fnc_removePerFrameHandler; + }; + }, 0, [_unit, _target]] call cba_fnc_addPerFrameHandler; - _unit setVariable [QGVAR(isRefueling), 1]; + _unit setVariable [QGVAR(isRefueling), true]; } else { // func is called in muzzle either connected or on ground // TODO add pickup animation ? + [{ params ["_unit", "_target", "_nozzle"]; @@ -58,5 +92,3 @@ if (isNull _nozzle) then { // func is called on fuel truck _unit setVariable [QGVAR(nozzle), _nozzle]; }, [_unit, _target, _nozzle], 2, 0] call EFUNC(common,waitAndExecute); }; - -true \ No newline at end of file diff --git a/addons/refuel/functions/fnc_turnOff.sqf b/addons/refuel/functions/fnc_turnOff.sqf index bb37c2c7bc..bbb0cd087c 100644 --- a/addons/refuel/functions/fnc_turnOff.sqf +++ b/addons/refuel/functions/fnc_turnOff.sqf @@ -12,7 +12,7 @@ * Example: * [player, nozzle] call ace_refuel_fnc_canTurnOff * - * Public: Yes + * Public: No */ #include "script_component.hpp" diff --git a/addons/refuel/stringtable.xml b/addons/refuel/stringtable.xml index 919ebcc206..3cffb19e7d 100644 --- a/addons/refuel/stringtable.xml +++ b/addons/refuel/stringtable.xml @@ -1,6 +1,6 @@  - + Refuel Settings Tankeinstellungen @@ -85,6 +85,26 @@ Close nozzle Hahn zudrehen + + %1 Liters fueled + %1 Liters getankt + + + The fuel source is empty. + Die Treibstoffquelle ist leer. + + + Maximum fuel hose length reached. + Maximale Schlauchlänge erreicht. + + + Fueling completed + Betankung abgeschlossen + + + Fueling stopped + Betankung angehalten + From 6dc5050dc311b76b57bbbe1c581d9c5a7b9d7dcf Mon Sep 17 00:00:00 2001 From: IngoKauffmann Date: Fri, 14 Aug 2015 03:21:16 +0200 Subject: [PATCH 03/25] Missed one return type --- addons/refuel/functions/fnc_turnOff.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/refuel/functions/fnc_turnOff.sqf b/addons/refuel/functions/fnc_turnOff.sqf index bbb0cd087c..dded1c0999 100644 --- a/addons/refuel/functions/fnc_turnOff.sqf +++ b/addons/refuel/functions/fnc_turnOff.sqf @@ -7,7 +7,7 @@ * 1: The object holding the nozzle * * Return Value: - * Can turn off + * Can turn off * * Example: * [player, nozzle] call ace_refuel_fnc_canTurnOff From 67091a7aeb1965d73ccb5e88a03345d65f68130d Mon Sep 17 00:00:00 2001 From: IngoKauffmann Date: Sat, 15 Aug 2015 16:49:57 +0200 Subject: [PATCH 04/25] Added real fuel amounts Some are best guesses though --- addons/refuel/CfgVehicles.hpp | 608 ++++++++++++++++-- .../functions/fnc_connectNozzleAction.sqf | 11 +- addons/refuel/functions/fnc_refuel.sqf | 9 +- 3 files changed, 556 insertions(+), 72 deletions(-) diff --git a/addons/refuel/CfgVehicles.hpp b/addons/refuel/CfgVehicles.hpp index 94fbd2a364..13cfd0a858 100644 --- a/addons/refuel/CfgVehicles.hpp +++ b/addons/refuel/CfgVehicles.hpp @@ -23,6 +23,10 @@ #define MACRO_CONNECT_ACTIONS \ class ACE_Actions { \ class ACE_MainActions { \ + displayName = ECSTRING(interaction,MainAction); \ + selection = ""; \ + distance = 10; \ + condition = "true"; \ class GVAR(connect) { \ displayName = CSTRING(connect); \ distance = REFUEL_ACTION_DISTANCE; \ @@ -102,12 +106,43 @@ class CfgVehicles { }; class Sign_Sphere10cm_F; + class ACE_refuel_fuelNozzle : Sign_Sphere10cm_F { // TODO replace with custom model }; - // Add connect to all vehicles - class LandVehicle; + class All; + + class Static : All {}; + + class Building : Static { + class ACE_Actions { + class ACE_MainActions { + displayName = ECSTRING(interaction,MainAction); + selection = ""; + distance = 10; + condition = "true"; + }; + }; + }; + + class NonStrategic : Building {}; + + class House_Base : NonStrategic {}; + + class House : House_Base {}; + + class House_F : House {}; + + class House_Small_F : House_F {}; + + class Strategic : Building {}; + + class AllVehicles : All { + GVAR(flowRate) = 1; + }; + class Land : AllVehicles {}; + class LandVehicle : Land {}; class Car : LandVehicle { MACRO_CONNECT_ACTIONS }; @@ -120,127 +155,337 @@ class CfgVehicles { MACRO_CONNECT_ACTIONS }; - class Air; + class Air : AllVehicles { + GVAR(flowRate) = 8; + }; + class Helicopter : Air { MACRO_CONNECT_ACTIONS + GVAR(fuelCapacity) = 1500; + }; + + class Helicopter_Base_F : Helicopter {}; + + class Helicopter_Base_H : Helicopter_Base_F { + GVAR(fuelCapacity) = 3000; }; class Plane : Air { MACRO_CONNECT_ACTIONS + GVAR(fuelCapacity) = 2000; + GVAR(flowRate) = 16; }; + + class Plane_Base_F : Plane {}; - class Ship; + class Ship : AllVehicles {}; + class Ship_F : Ship { MACRO_CONNECT_ACTIONS + GVAR(fuelCapacity) = 2000; + }; + + class Boat_Civil_01_base_F : Ship_F { + GVAR(fuelCapacity) = 200; }; - class Car_F : Car {}; - class Offroad_01_base_f : Car_F {}; - class Truck_F : Car_F {}; - class Truck_01_base_F: Truck_F {}; - class Truck_02_base_F : Truck_F {}; - class Truck_03_base_F : Truck_F {}; - class Van_01_base_F : Truck_F {}; - class Van_01_fuel_base_F : Van_01_base_F {}; + class Boat_F : Ship_F {}; + + class Boat_Armed_01_base_F : Boat_F { + GVAR(fuelCapacity) = 1000; + }; + class Rubber_duck_base_F : Boat_F { + GVAR(fuelCapacity) = 30; + }; + class SDV_01_base_F : Boat_F { + // SDV is using electrical propulsion + GVAR(fuelCapacity) = 0; + }; + + class Car_F : Car { + // Assuming large vehicle tank + GVAR(fuelCapacity) = 60; + }; + + class Kart_01_Base_F : Car_F { + GVAR(fuelCapacity) = 8; + }; + + class Offroad_01_base_F: Car_F {}; + + class Wheeled_APC_F: Car_F { + // Assuming average APC tank + GVAR(fuelCapacity) = 300; + }; + + class Hatchback_01_base_F: Car_F { + // Assume normal vehicle tank + GVAR(fuelCapacity) = 50; + }; + + class Quadbike_01_base_F : Car_F { + // Assuming usual Yamaha quad + GVAR(fuelCapacity) = 10; + }; + + class MRAP_01_base_F: Car_F { + // M-ATV + // No data, assuming similar to Fennek + GVAR(fuelCapacity) = 230; + }; + + class MRAP_02_base_F: Car_F { + // Punisher + // No data, assuming similar to Fennek + GVAR(fuelCapacity) = 230; + }; + + class MRAP_03_base_F: Car_F { + // Fennek + GVAR(fuelCapacity) = 230; + }; + + class APC_Wheeled_01_base_F: Wheeled_APC_F { + // Patria = LAV + GVAR(fuelCapacity) = 269; + }; + + class Truck_F : Car_F { + GVAR(fuelCapacity) = 400; + }; + + class Truck_01_base_F: Truck_F { + // HEMTT + GVAR(fuelCapacity) = 583; + }; - class Tank_F : Tank {}; - class APC_Tracked_01_base_F: Tank_F {}; - class B_APC_Tracked_01_base_F: APC_Tracked_01_base_F {}; class B_Truck_01_transport_F : Truck_01_base_F {}; + class B_Truck_01_mover_F: B_Truck_01_transport_F {}; - class ReammoBox_F; - class Slingload_01_Base_F : ReammoBox_F { - class ACE_Actions { // FIXME ace_interact should add interactions to "All" so we can always extend - class ACE_MainActions {}; - }; + class Truck_02_base_F: Truck_F { + // KamAZ + // Assuming similar to Ural + GVAR(fuelCapacity) = 400; }; - class Helicopter_Base_F : Helicopter {}; - class Helicopter_Base_H : Helicopter_Base_F {}; - class Heli_Transport_04_base_F : Helicopter_Base_H {}; - class Pod_Heli_Transport_04_base_F : StaticWeapon {}; - // Vanilla classes + class Truck_03_base_F: Truck_F { + // Tempest + // Assuming heavier than KamAZ + GVAR(fuelCapacity) = 600; + }; + + class Van_01_base_F : Truck_F { + // Small Truck + // Assuming 80L as in Ford Transit + GVAR(fuelCapacity) = 80; + }; + + class Van_01_fuel_base_F : Van_01_base_F { + transportFuel = 0; //1k + MACRO_REFUEL_ACTIONS + GVAR(hooks[]) = {{0,0,0}}; + GVAR(fuelCargo) = 2000; + }; + + class Tank_F : Tank { + GVAR(fuelCapacity) = 1200; + }; + + class APC_Tracked_01_base_F: Tank_F { + // Namer + // Assuming Merkava fuel + GVAR(fuelCapacity) = 1400; + }; + + 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 { transportFuel = 0; //3k MACRO_REFUEL_ACTIONS GVAR(hooks[]) = {{0,0,0}}; - GVAR(fuelCargo) = 20000; - }; - - class C_Van_01_fuel_F : Van_01_fuel_base_F { - transportFuel = 0; //1k - MACRO_REFUEL_ACTIONS - GVAR(hooks[]) = {{0,0,0}}; - GVAR(fuelCargo) = 5000; - }; - class I_G_Van_01_fuel_F : Van_01_fuel_base_F { - transportFuel = 0; //1k - MACRO_REFUEL_ACTIONS - GVAR(hooks[]) = {{0,0,0}}; - GVAR(fuelCargo) = 5000; + GVAR(fuelCargo) = 1000; }; + class APC_Tracked_02_base_F: Tank_F { + // BM-2T + // Assuming 1 L/km + GVAR(fuelCapacity) = 1000; + }; + + class APC_Tracked_03_base_F: Tank_F { + // FV 510 + // Assuming 1 L/km + GVAR(fuelCapacity) = 660; + }; + + class MBT_01_base_F: Tank_F { + // Merkava IV + GVAR(fuelCapacity) = 1400; + }; + + class MBT_02_base_F: Tank_F { + // T100 Black Eagle + // Assuming T80 + GVAR(fuelCapacity) = 1100; + }; + + class MBT_03_base_F: Tank_F { + // Leopard + GVAR(fuelCapacity) = 1160; + }; + + class MBT_01_arty_base_F : MBT_01_base_F { + // Assuming similar 2S3 + GVAR(fuelCapacity) = 830; + }; + + class MBT_02_arty_base_F : MBT_02_base_F { + // Assuming similar 2S3 + GVAR(fuelCapacity) = 830; + }; + + class Heli_Attack_01_base_F : Helicopter_Base_F { + // Commanche + }; + + class Heli_Attack_02_base_F : Helicopter_Base_F { + // Mi-48 Kajman + }; + + class Heli_Light_01_base_F : Helicopter_Base_H { + // MH-6 + GVAR(fuelCapacity) = 242; + }; + + class Heli_Light_02_base_F : Helicopter_Base_H { + // Ka-60 Kasatka + GVAR(fuelCapacity) = 1450; + }; + + class Heli_light_03_base_F : Helicopter_Base_F { + // AW159 + GVAR(fuelCapacity) = 1004; + }; + + class Heli_Transport_01_base_F : Helicopter_Base_H { + // Ghost Hawk + // Assuming similar UH60 + GVAR(fuelCapacity) = 1360; + }; + + class Heli_Transport_02_base_F : Helicopter_Base_H { + // AW101 + GVAR(fuelCapacity) = 3222; + }; + + class Heli_Transport_03_base_F : Helicopter_Base_H { + // Chinook 47I + GVAR(fuelCapacity) = 3914; + }; + + class Heli_Transport_04_base_F : Helicopter_Base_H { + // Mi-290 Taru + GVAR(fuelCapacity) = 3914; + }; + + class Plane_CAS_01_base_F : Plane_Base_F { + // Assuming similar to A10 + GVAR(fuelCapacity) = 6223; + } + + class Plane_CAS_02_base_F : Plane_Base_F { + // Yak-130 + GVAR(fuelCapacity) = 2099; + }; + + class UAV_01_base_F : Helicopter_Base_F { + // Darter is electrical + GVAR(fuelCapacity) = 0; + }; + + class UAV : Plane {}; + + class UAV_02_base_F : UAV { + // Assuming similar YAHBON-R2 + GVAR(fuelCapacity) = 270; + }; + + class UGV_01_base_F : Car_F { + // Stomper + GVAR(fuelCapacity) = 100; + }; + + class Plane_Fighter_03_base_F : Plane_Base_F { + // L-159 ALCA + GVAR(fuelCapacity) = 1914; + }; + + // Vanilla fuel vehicles class I_Truck_02_fuel_F : Truck_02_base_F { transportFuel = 0; //3k MACRO_REFUEL_ACTIONS GVAR(hooks[]) = {{0,0,0}}; - GVAR(fuelCargo) = 20000; + 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) = 20000; + 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(fuelCargo) = 20000; + 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(fuelCargo) = 20000; + GVAR(fuelCargo) = 10000; + }; + + class ReammoBox_F; + + class Slingload_01_Base_F : ReammoBox_F { + class ACE_Actions { + class ACE_MainActions { + displayName = ECSTRING(interaction,MainAction); + selection = ""; + distance = 10; + condition = "true"; + }; + }; }; class B_Slingload_01_Fuel_F : Slingload_01_Base_F { transportFuel = 0; //3k MACRO_REFUEL_ACTIONS GVAR(hooks[]) = {{0,0,0}}; - GVAR(fuelCargo) = 20000; + GVAR(fuelCargo) = 10000; }; class O_Heli_Transport_04_fuel_F : Heli_Transport_04_base_F { transportFuel = 0; //3k MACRO_REFUEL_ACTIONS GVAR(hooks[]) = {{0,0,0}}; - GVAR(fuelCargo) = 20000; + 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 { transportFuel = 0; //3k MACRO_REFUEL_ACTIONS GVAR(hooks[]) = {{0,0,0}}; - GVAR(fuelCargo) = 20000; + GVAR(fuelCargo) = 10000; }; - class Static; - class Building : Static { - class ACE_Actions { - class ACE_MainActions {}; - }; - }; - class NonStrategic : Building {}; - class House_Base : NonStrategic {}; - class House : House_Base {}; - class House_F : House {}; - class House_Small_F : House_F {}; - class Strategic : Building {}; // Vanilla buildings class Land_Fuelstation_Feed_F : House_Small_F { transportFuel = 0; //50k @@ -248,6 +493,7 @@ class CfgVehicles { GVAR(hooks[]) = {{0,0,0}}; GVAR(fuelCargo) = -1; }; + class Land_fs_feed_F : House_Small_F { transportFuel = 0; //50k MACRO_REFUEL_ACTIONS @@ -261,36 +507,42 @@ class CfgVehicles { 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 @@ -325,4 +577,244 @@ class CfgVehicles { RHS_Ural_Fuel_VV_01 : RHS_Ural_Fuel_MSV_01 10000 LOP_UA_Ural_fuel : RHS_Ural_Fuel_VV_01 10000 */ + + // Trucks + // Src: HEMTT http://www.inetres.com/gp/military/cv/eng/M977.html 583L > 483km + // Src: https://en.wikipedia.org/wiki/Heavy_Expanded_Mobility_Tactical_Truck 587L > 483km + // Src: https://en.wikipedia.org/wiki/Kamaz_Typhoon ? > 1200km + // Src: https://en.wikipedia.org/wiki/Humvee 95L + // Src: https://en.wikipedia.org/wiki/RG-33 80 gal = 302 + // Src: MTVR http://oshkoshdefense.com/wp-content/uploads/2013/08/MTVR_StndCargo_SS_6-13-11.pdf 295L + // Src: M1078 http://tarakia.weebly.com/ta-vehicles.html 219L + // Src: https://en.wikipedia.org/wiki/Ural-4320 360L + // Src: http://www.automobile-catalog.com/car/2012/1024400/gaz_233011_tigr.html 138L + // Src: https://en.wikipedia.org/wiki/UAZ-469 78L + // Src: https://en.wikipedia.org/wiki/GAZ-66 210L + + // Tracked IFV + // Src: https://en.wikipedia.org/wiki/Marder_%28IFV%29 652L > 520km + // Src: https://en.wikipedia.org/wiki/Tanque_Argentino_Mediano ~250L > 500km (200L additional tank for 400km range boost) + // Src: https://en.wikipedia.org/wiki/ACEC_Cobra 309L > 600km + // Src: https://en.wikipedia.org/wiki/Egyptian_Infantry_Fighting_Vehicle 454L > 482km + // Src: https://en.wikipedia.org/wiki/Lazika 400L > 400-450km + // Src: https://en.wikipedia.org/wiki/Type_73_Armored_Personnel_Carrier 450L > 300km + // Src: https://en.wikipedia.org/wiki/BMP-1 462L > 500-600km + // Src: http://www.inetres.com/gp/military/cv/inf/BMP-1.html 460L > 600km + // Src: http://www.inetres.com/gp/military/cv/inf/BMP-2.html 460L > 600km + // Src: http://www.inetres.com/gp/military/cv/inf/M2.html 662L > 483-402km + // Src: https://en.wikipedia.org/wiki/2T_Stalker ? > 1000km + // Src: https://en.wikipedia.org/wiki/Namer ? > 500km + // Src: https://en.wikipedia.org/wiki/Warrior_tracked_armoured_vehicle ? > 660km + // Src: http://www.globalsecurity.org/military/systems/ground/m113-specs.htm 360L + // Src: http://afvdb.50megs.com/usa/m2bradley.html 746L + // Src: https://en.wikipedia.org/wiki/BMD-1 300L + // Trend: 1-2 L/km + + // Wheeled IFV/APC + // Src: https://en.wikipedia.org/wiki/BTR-60 290L > 500km + // Src: http://www.inetres.com/gp/military/cv/inf/BTR-70.html 350L > 600km + // Src: http://www.inetres.com/gp/military/cv/inf/BTR-80.html 300L > 600km + // Src: https://en.wikipedia.org/wiki/Mowag_Piranha 4x4 200L > 700km + // Src: https://en.wikipedia.org/wiki/Mowag_Piranha 6x6 200L > 500km + // Src: https://en.wikipedia.org/wiki/ERC_90_Sagaie 242L > 700km + // Src: https://en.wikipedia.org/wiki/V%C3%A9hicule_de_l%27Avant_Blind%C3%A9 310L > 1200km + // Src: https://en.wikipedia.org/wiki/Panhard_M3 165L > 600km + // Src: https://fr.wikipedia.org/wiki/V%C3%A9hicule_blind%C3%A9_de_combat_d%27infanterie 400L > 750km + // Src: https://de.wikipedia.org/wiki/Sp%C3%A4hwagen_Fennek 230L > 460-1000km + // Src: http://www.inetres.com/gp/military/cv/inf/LAV.html 269L > 660km + // Src: http://www.inetres.com/gp/military/cv/inf/M1126.html 200L > 531km + // Src: https://en.wikipedia.org/wiki/Patria_AMV ? > 600-850km + // Src: https://en.wikipedia.org/wiki/Otokar_Arma ? > 700km + // Trend: 0.3-0.6 L/km + + // MBT + // Src: http://www.inetres.com/gp/military/cv/tank/Leopard2.html 1200L > 550km + // Src: http://www.inetres.com/gp/military/cv/tank/M1.html 1909L > 479km + // Src: https://en.wikipedia.org/wiki/T-80 1100L > 335km + // Src: https://en.wikipedia.org/wiki/T-72 1200L > 490km + // Trend: 2-4 L/km + + // Artillery + // Src: http://www.inetres.com/gp/military/cv/arty/M109.html 511L > 349km + // Src: https://en.wikipedia.org/wiki/2S3_Akatsiya 830L > 500km + + // Other + // https://en.wikipedia.org/wiki/ZSU-23-4 515L + + // Helicopter + // Src: http://www.bga-aeroweb.com/Defense/UH-1Y-Venom.html 1172kg / 0.81 kg/L = 1447L + // Src: http://www.bga-aeroweb.com/Defense/AH-1Z-Viper.html 1296kg / 0.81 kg/L = 1600L + // Src: http://www.army-technology.com/projects/black_hawk/ 1360L + // Src: http://www.bga-aeroweb.com/Defense/CH-47-Chinook.html 3914L + // Src: http://helicopters.axlegeeks.com/l/61/Boeing-AH-64-Apache 375 gal = 1420L + // Src: https://en.wikipedia.org/wiki/Mil_Mi-8 3700l + // Src: Google Ka-52 1870L + // Src: http://www.airforce-technology.com/projects/hind/ 1500kg / 0.81 L/kg = 1851L + // Src: https://en.wikipedia.org/wiki/MD_Helicopters_MH-6_Little_Bird 242L + // Src: http://www.globalsecurity.org/military/world/europe/aw159-specs.htm 1004L + // Src: https://en.wikipedia.org/wiki/AgustaWestland_AW101 3 * 1074L = 3222L + // Src: http://www.aviastar.org/helicopters_eng/ka-62.php 1450L + + // Planes + // Src: http://www.theaviationzone.com/factsheets/c130j.asp 20820kg / 0.81 kg/L = 25704L + // Src: http://www.avialogs.com/viewer/avialogs-documentviewer.php?id=3298 p29 1644 gal = 6223L + // Src: http://www.airforce-technology.com/projects/su25/ 3600L + // Src: http://www.thaitechnics.com/aircraft/L159.html 1551kg / 0.81 kg/L = 1914L + // Src: https://en.wikipedia.org/wiki/Yakovlev_Yak-130 1700kg / 0.81 kg/L = 2099L + // Src: http://www.adcom-systems.com/ENG/UAV/YAHBON-R2/Overview.html 270L + + // BWMod + class BWA3_Puma_base: Tank_F { + // Assuming 1 L/km + GVAR(fuelCapacity) = 700; + }; + + class BWA3_Leopard_base: Tank_F { + GVAR(fuelCapacity) = 1160; + }; + + // RHS + class RHS_UH1_Base : Heli_light_03_base_F { + GVAR(fuelCapacity) = 1447; + }; + + class RHS_UH60_Base : Heli_Transport_01_base_F { + GVAR(fuelCapacity) = 1360; + }; + + class RHS_CH_47F_base : Heli_Transport_02_base_F { + GVAR(fuelCapacity) = 3914; + }; + + class RHS_AH1Z_base : Heli_Attack_01_base_F { + GVAR(fuelCapacity) = 1600; + }; + class RHS_AH64_base : Heli_Attack_01_base_F { + GVAR(fuelCapacity) = 1420; + }; + + class rhsusf_m1a1tank_base : MBT_01_base_F { + GVAR(fuelCapacity) = 1909; + }; + + class rhsusf_m109tank_base : MBT_01_arty_base_F { + GVAR(fuelCapacity) = 511; + }; + + class rhsusf_hmmwe_base : MRAP_01_base_F { + GVAR(fuelCapacity) = 95; + }; + + class rhsusf_rg33_base : MRAP_01_base_F { + GVAR(fuelCapacity) = 302; + }; + + class rhsusf_fmtv_base : Truck_01_base_F { + GVAR(fuelCapacity) = 219; + }; + + class rhsusf_m113_tank_base : APC_Tracked_02_base_F { + GVAR(fuelCapacity) = 360; + }; + + class RHS_M2A2_Base : APC_Tracked_03_base_F { + GVAR(fuelCapacity) = 746; + }; + + class RHS_A10 : Plane_CAS_01_base_F { + GVAR(fuelCapacity) = 6223; + }; + + class RHS_C130J_Base : Plane_Base_F { + GVAR(fuelCapacity) = 25704; + }; + + class O_Plane_CAS_02_F : Plane_CAS_02_base_F {}; + class RHS_su25_base : O_Plane_CAS_02_F { + GVAR(fuelCapacity) = 3600; + }; + + class RHS_Mi8_base : Heli_Light_02_base_F { + GVAR(fuelCapacity) = 3700; + }; + + class RHS_Ka52_base : Heli_Attack_02_base_F { + GVAR(fuelCapacity) = 1870; + }; + + class RHS_Mi24_base : Heli_Attack_02_base_F { + GVAR(fuelCapacity) = 1851; + }; + + class rhs_bmp3tank_base : Tank_F { + // Assuming same as BMP1/2 + GVAR(fuelCapacity) = 460; + }; + + class a3t72tank_base : Tank_F { + GVAR(fuelCapacity) = 1200; + }; + + class rhs_tank_base : Tank_F { + GVAR(fuelCapacity) = 1200; + }; + class rhs_t80b : rhs_tank_base { + GVAR(fuelCapacity) = 1100; + }; + + class RHS_Ural_BaseTurret : Truck_F { + GVAR(fuelCapacity) = 360; + }; + + class rhs_tigr_base : MRAP_02_base_F { + GVAR(fuelCapacity) = 138; + }; + + class RHS_UAZ_Base : Offroad_01_base_f { + GVAR(fuelCapacity) = 78; + }; + + class rhs_zsutank_base : APC_Tracked_02_base_F { + GVAR(fuelCapacity) = 515; + }; + + class rhs_bmp1tank_base : Tank_F { + GVAR(fuelCapacity) = 460; + }; + + class rhs_truck : Truck_F { + GVAR(fuelCapacity) = 210; + }; + + class rhs_btr_base : Wheeled_Apc_F {}; + class rhs_btr60_base : rhs_btr_base { + GVAR(fuelCapacity) = 290; + }; + class rhs_btr70_vmf : rhs_btr_base { + GVAR(fuelCapacity) = 350; + }; + + class rhs_btr70_msv : rhs_btr70_vmf {}; + + class rhs_btr80_msv : rhs_btr70_msv { + GVAR(fuelCapacity) = 300; + }; + + class rhs_a3spruttank_base : Tank_F { + // BMD4 / 2S25 + GVAR(fuelCapacity) = 400; + }; + + class rhs_bmd_base : Tank_F { + GVAR(fuelCapacity) = 300; + }; + + class rhs_2s3tank_base : Tank_F { + GVAR(fuelCapacity) = 830; + }; + + class OTR21_Base : Truck_F { + // No info about ballistic carrier ;-) + GVAR(fuelCapacity) = 500; + }; }; diff --git a/addons/refuel/functions/fnc_connectNozzleAction.sqf b/addons/refuel/functions/fnc_connectNozzleAction.sqf index 2d828e43d2..8a0f9f94ee 100644 --- a/addons/refuel/functions/fnc_connectNozzleAction.sqf +++ b/addons/refuel/functions/fnc_connectNozzleAction.sqf @@ -18,9 +18,6 @@ * Public: No */ #include "script_component.hpp" -#define FLOWRATE_GND 0.165 // TODO ace_vehicles messes with fuel capacity - why? -#define FLOWRATE_AIR 0.67 - private ["_startingOffset", "_startDistanceFromCenter", "_closeInUnitVector", "_closeInMax", "_closeInMin", "_closeInDistance", "_endPosTestOffset", "_endPosTest", "_doesIntersect", "_startingPosShifted", "_endASL", "_rate", "_maxFuel"]; params ["_unit", "_target", "_startingPosition", "_nozzle"]; @@ -97,12 +94,6 @@ _nozzle setVariable [QGVAR(sink), _target, true]; _nozzle setVariable [QGVAR(fueling), 1, true]; _target setVariable [QGVAR(nozzle), _nozzle, true]; -_rate = if (_target isKindOf "Air") then { FLOWRATE_AIR * GVAR(rate) -} else { - FLOWRATE_GND * GVAR(rate) -}; -_maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> "fuelCapacity"); - -[_unit, _target, _nozzle, _rate, _maxFuel] call FUNC(refuel); +[_unit, _target, _nozzle] call FUNC(refuel); true \ No newline at end of file diff --git a/addons/refuel/functions/fnc_refuel.sqf b/addons/refuel/functions/fnc_refuel.sqf index 98158fb722..1eed5108b7 100644 --- a/addons/refuel/functions/fnc_refuel.sqf +++ b/addons/refuel/functions/fnc_refuel.sqf @@ -6,8 +6,6 @@ * 0: The unit * 1: The target * 2: The nozzle - * 3: The rate - * 4: The maximum fuel volume * * Return Value: * None @@ -17,12 +15,15 @@ #include "script_component.hpp" -private ["_sink"]; -params ["_unit", "_target", "_nozzle", "_rate", "_maxFuel"]; +private ["_sink", "_rate", "_maxFuel"]; +params ["_unit", "_target", "_nozzle"]; _sink = _nozzle getVariable [QGVAR(sink), objNull]; if (isNull _sink) exitWith {}; +_rate = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(flowRate)) * GVAR(rate); +_maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(fuelCapacity)); + [{ private ["_source", "_sink", "_fuelInSource", "_fuelInSink", "_finished", "_fueling"]; params ["_args", "_pfID"]; From 94a5b38cf6cd9dc1b52e3127ef4dc5e2c7aaea20 Mon Sep 17 00:00:00 2001 From: IngoKauffmann Date: Sat, 15 Aug 2015 17:24:11 +0200 Subject: [PATCH 05/25] Renamed an interaction --- addons/refuel/CfgVehicles.hpp | 8 ++++++++ addons/refuel/stringtable.xml | 10 +++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/addons/refuel/CfgVehicles.hpp b/addons/refuel/CfgVehicles.hpp index 13cfd0a858..251b4e46f2 100644 --- a/addons/refuel/CfgVehicles.hpp +++ b/addons/refuel/CfgVehicles.hpp @@ -18,6 +18,14 @@ exceptions[] = {"isNotInside"}; \ icon = PATHTOF(ui\icon_refuel_interact.paa); \ }; \ + class GVAR(connect) { \ + displayName = CSTRING(Return); \ + distance = REFUEL_ACTION_DISTANCE; \ + condition = QUOTE([ARR_1(_player)] call FUNC(canConnectNozzle)); \ + statement = QUOTE([ARR_2(_player,_target)] call DFUNC(connectNozzle)); \ + exceptions[] = {"isNotInside"}; \ + icon = PATHTOF(ui\icon_refuel_interact.paa); \ + }; \ }; \ }; #define MACRO_CONNECT_ACTIONS \ diff --git a/addons/refuel/stringtable.xml b/addons/refuel/stringtable.xml index 3cffb19e7d..25ebe00727 100644 --- a/addons/refuel/stringtable.xml +++ b/addons/refuel/stringtable.xml @@ -82,8 +82,8 @@ Gescheitert - Close nozzle - Hahn zudrehen + Stop fueling + Betankung anhalten %1 Liters fueled @@ -105,9 +105,9 @@ Fueling stopped Betankung angehalten - - - + + Return fuel nozzle + Zapfpistole zurückstecken From a576ed82eeb38ba525b18f91132385d4974b6863 Mon Sep 17 00:00:00 2001 From: IngoKauffmann Date: Sat, 15 Aug 2015 19:26:26 +0200 Subject: [PATCH 06/25] Fixed some macro stuff --- addons/refuel/ACE_Settings.hpp | 6 +++--- addons/refuel/script_component.hpp | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/addons/refuel/ACE_Settings.hpp b/addons/refuel/ACE_Settings.hpp index 5f848a0daf..04f1f48fe8 100644 --- a/addons/refuel/ACE_Settings.hpp +++ b/addons/refuel/ACE_Settings.hpp @@ -1,9 +1,9 @@ class ACE_Settings { class GVAR(rate) { - displayName = LSTRING(RefuelSettings_speed_DisplayName); - description = LSTRING(RefuelSettings_speed_Description); + displayName = CSTRING(RefuelSettings_speed_DisplayName); + description = CSTRING(RefuelSettings_speed_Description); value = 1; typeName = "SCALAR"; - values[] = {LSTRING(RefuelSettings_basic), LSTRING(RefuelSettings_advanced)}; + values[] = {CSTRING(RefuelSettings_basic), CSTRING(RefuelSettings_advanced)}; }; }; diff --git a/addons/refuel/script_component.hpp b/addons/refuel/script_component.hpp index 8d737b3f97..4a6efdd42a 100644 --- a/addons/refuel/script_component.hpp +++ b/addons/refuel/script_component.hpp @@ -1,4 +1,12 @@ #define COMPONENT refuel #include "\z\ace\addons\main\script_mod.hpp" +#ifdef DEBUG_ENABLED_REFUEL + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_ENABLED_REFUEL + #define DEBUG_SETTINGS DEBUG_ENABLED_REFUEL +#endif + #include "\z\ace\addons\main\script_macros.hpp" From 214c63983908fd1b2c64c372f690e7495ea2376c Mon Sep 17 00:00:00 2001 From: IngoKauffmann Date: Sat, 15 Aug 2015 23:38:08 +0200 Subject: [PATCH 07/25] Added module icon --- addons/refuel/ui/icon_module_refuel.paa | Bin 22016 -> 5625 bytes .../Icon_Module_png/Icons_Modules_Refuel.png | Bin 0 -> 3357 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 extras/assets/icons/Icon_Module_png/Icons_Modules_Refuel.png diff --git a/addons/refuel/ui/icon_module_refuel.paa b/addons/refuel/ui/icon_module_refuel.paa index 2cc1a9320d28536733d81c55282d64db2f03d37b..84704c13d7012da0813d5408c367ad9ebe395dca 100644 GIT binary patch literal 5625 zcmd^DO-x)>6h4D9!<4f7@@z%(jTJFj-5@{^hv9B3D^FzP%s z+Qb-&s7X~C(nal}(X=k6E=*?3lvb14CN8veObY!8X-W!GOKUUq`ki~6A-^pZD`~f%OO+=`%d5e~a)Ka1g?)T6c7c{G z-)=vAThsKO)JLIE2+e&pfqsQ`U1#hJ^f{$okH=%zf7^2PW^ZS8mOX6HeDde&)A}tO zl=^M<6Xkhvu^tU%*S{Ff9A8r&_u=0|{GS4|SXY>vWjp7by}xWsd)V9U@l0dQ>NO+& zs+Y7MuNwQ8LuTsbcrA<-1ME;e0Pk}Ak<1toYYPUYfBP-0!@=-(CN}e5*XPN96@Mv@ z!!P?IWGo-)k_EQ=2g%>0@*U~VA)iB#&-pL?i}cU%?;K_T<=!0PAqAxK^ZZxi!E}K> zng3EhrhkV1-1WiVIr(d)@w3Cz{r&&KGTrXtW8ZW%oQ#I6&H3oq_|f0I)Ku|<)rty! zvj6AD71y|>^rF>HhaEd8e}|mkn4i2vFKcpko}3Ujc1!CVsA6u4!hv|#=N-)a?I2PMZuD&b2VU#a#NeH;y!N4G!C_UYIl zdai6dk?;+~g*YqjD<~*9b}KT;xy;0gEB0IU#r$}G9I0ZG~pVQ5MSpZK%N znlH|yM=FwsEdOTKr&4MT4|5#t?8;@HSzFY!r7VO=+3*cRsKrzx?3eu&{? zuatL(V-JoghLh!E7jm;bv}?xFk3*gqteGu)b<&K;Ks>rvjz`lNN88Iyj8hKyeSKD$ zj8jNPf4e-`U+FdFyWQFF^LTh$VE^FUCdYSY{MtFOA<*6VgW`9Q(JM*`A`k^B;f*~a z7WNICQV8e5MdYzoCNFMF#zMGZ_swK%=AnUf-gJKBTFH1E7wbwgK0@m6*)oO_`V%H;s*LV6@yc6U#BHyizep;*4 zd6>T{+5DhVkF$st?{QF|O|JG3sIR&F<|Bb{hYTA=>C!HK@6hHNyJ1n$j*!x0L?Oy8&Y`ndHTPmTCX`QS!^_`tdW^LbwT3p^2;5 zO=hv3zkmuzBO0sSwsz~uj<2k4hqU#3-hZYL(N|*D9FKNXM>o|m@?adVh!6J;e^IfC b@n(G0apDi=57Ub;^*((5N7c#C0|5O49^AEN literal 22016 zcmeHPdvH|M8UJ?OHG~nfBW`UAm~BlPJ5JirscV@ixha%nXS7+yy-FWbNn&kF%dYJo zVJc0sQsiapCeG+oNX25u2mI00;%#e3l0pZ9;{f(Sqf|iy$)F5u2n}L(bNl@0_!4v%0z}w4nN~Di;wYlgar4FR8kNv5COAy6W~t zj2-wezH`x{S`ELW_^ic`M}kC;g^1d9qF#K)9-Wam38f227}aPW1|ulTo-Kbr!NmINMkv3_)2_tLXnt45Nt zHoGxOe!=_---rGVo6`{N`n|H>9Q;>hLewwPmIgP(YU&Re%Owu!dW@)5zK?{Fz_@WM zosS>!8Lyp-B!(ig^>H{H_WYTOe;ebOa9Xd?@Lppi!Fogco~=Jz=WsFp^R8c4cPxQ} z^AGy7^RM`q1YYd?*-PjzlYh|<$nqd-n&SUrik%|Y$IQRQ_h@;LxNjK7RjjFpQC|92 zRsY9V&;un_SF;-m3h`NHnV$T^ulN^h#&!Z+s#SlNH9hS4y0z^GekH1x7| zyk2kGcz(xOUwL_XuKY_aPhS6z;(wHS@xwcU!QQt|irT^L{Wi4xW^Kz6)7){k+*3}9 z|4e;NbyWKr+DoIZg6k>VJKnnn-`@uXKFo>@}OVoFpv>Uej!~Koneo=mSe&6mdQT@M7WBG*-{RMnk^WAK(&wRy9{=G6G z=3g{a_*`?h{ZE(+-f|7#99J=D+gfZyfRsAvIk!7K8cI+0*`J)%;#x5rQ_VilP?HFyz!~zZ|^fGV1F;5_Hw)>(PQzg1w)tC&vTjnqI~n6 zmA>76nR1LyY=&=+rme?AgD~#c!9T~rdUqo}d}XZf%Rknv^@^zc6Cv-o6{aFk8c-Tg z8c-Tg8c-Uz+%=%_e*g%NyO7j}voyX1B!!heCZari^<3t%4myVNWi5kaBj02=;vp?XMDfH zFWr8;4b#f!C>P_-uhTZHpJejWOp(7cEH}G7qeI}!EIz_#*7cwnXn(b^z3W5sHOb}2 zvf73lhU#xg$?rKi_xfHOj9mz2gDr_Y=77)!m)0%YxP6#|^1=02r!AuX$nt+7Jm&=J zlmBadR{Ur`CRh2V;|GdHx;slbf4t1sEpd(lPix=1wWFcJXsBR(?X_s}J=M)eaWLlcFZD8Y`7inz z)@WiTj^zN|?)rD;C3@hAXN+0=&{hhxx^T$*m!JGg2OGmLpL|>JjcEo)9o3Aw@vv$| z-_L7UjRw&_W7+y;$N!IyHJ^CvV4dK<3i97-o5qc_)uMf>FX7aGv^jD7Oqp*MaXm8t5vCSOvd3C+)SGAi=|GlF8 z-o4DGEiT+j}|Vg8O+t49g$FG#HW*!H087 z$9zFyrH>1h2OpOVo^O-Ehp!7gX5G$PF>>05Rl%*s@gPdw zHyE|;R^*2feE6itaWP!>x)@dsa{js7UGd5R$886StpC3tT70Llp%E328G&~i1rT0f zj5_hZk>g9B+73Lt`lVk+Iew_yvtk`~TfVw~%*}YN>HE$Yb({S4SS~2#rMBxn9(7KC zim?ZFRg}}mAthuTvXJL>X~(&y|4%A>Vs@atgyV6eoqvY{kI%klV<}^=ix$s%{b=mi zPpE5V6yiF|8jUB(6k@^!DUUWQ-rjbT;2x70^+qQ(G(P70rO@U9}Jnx2b zfwd~_3p{pR}i?y?^W3?oE$p+$v03xE2tx9{&>>*d#YEGWZ&0g(dE ABLDyZ diff --git a/extras/assets/icons/Icon_Module_png/Icons_Modules_Refuel.png b/extras/assets/icons/Icon_Module_png/Icons_Modules_Refuel.png new file mode 100644 index 0000000000000000000000000000000000000000..da50b92cafa23d92763a30a09f4a0cbe30ceecc6 GIT binary patch literal 3357 zcmV+&4dU{NP)EX>4Tx07%E3mUmQC*A|D*y?1({%`gH|hTglt0MdJtUPWP;8DJ;_4l^{dA)*2i zMMRn+NKnLp(NH8-M6nPQRImpm2q-ZaMN}+rM%Ih2ti1Q~^84egZ|$@9x%=$B&srA% zlBX}1mj+7#kjfMAgFKw+5s^`J>;QlP9$S?PR%=$HTzo3l9?ED;xoI3-JvF1F8#m>QQXW*8-Az9>Nv%ZWK* zkqtikEV84R*{M9Xh{ZXlvs2k(?iKO2Od&_ah_8qXGr62B5#JKAMv5?%E8;ie*i;TP z0{|3BY!`4?i6S-;F^L}%f`(o2L0Dz>ZZyndax(`h}FNp#{ zx{a}MR#uh~m%}m=7xWMPPlvyuufAs_KJJh5&|Nw4Oks+EF0LCZEhSCJr)Q)ySsc3I zpNIG#2mW;)20@&74xhslMTCi_jLS<9wVTK03b<)JI+ypKn)naH{-njZ7KzgM5l~}{ zfYfy=Kz{89C<+lE(fh?+|D$id_%I-TdEqLPi*x_)H~nY9rQ#)noA5c#B`Ac>67n+_ z_r%Wu$9dISw03U@r;Pdb`_%=KWKZEBGfDjQHqKX(I48#TT zN1~8;gpaI8ijWGV0cl0Lkv`-mGK$O~Z&4T&1w}_0qHIx~s8AFOwFb2wRf4KU9Y%Ga zdQmq~W2jlwM>H9&h}K8jpuNx$=mc~Yx)5D~ZbG-CFQRXwC(y4k7z_=gjj_UbVj?j~ zn6;P^%sxyT<{V}aGme?VVzKgAeXJeUAIroFu!Yzv>{0Al>=1SW`vynEso>0T?zku% z50{Utz#YMz!42UiaSM1Uye8fT?~iBWbMU43MtnE^I(`DbK#(SA6YK~fge1ZyLM5S< zaFOtU@RCR*su8V;fkZBGBe9ZrjCh$iMtn<>A?cA^NYNxAX$R>L=^W`U=_Q#=)*?HS zqsRjC4stX30{Id7jRZx)NWx2kEwMqOMxsMvNaDF9UQ$!iNpiJhu4IMe3CZh{Gg5dd zEh!f%rqp_=8mW^~BT{qH6lqgwf9X`|66qt-SEQ$8urgXQZZd3{0-1v{7i7jM2t}RZ zLSa!hQyM83DHBu-Rh#NXO`;Z4zoQONXJut%m&u07X3N&do|YY@Av7(T7cGTWN;^&) zroCIDw8Uu%XUX;@txJZM%*!p6bCl!A70I>9-IjYNPnUO-PnO>$-zoo40i~d)5U7x) zuwUV#!pu_YQro4hrA14RFTJM-E9xl*DXvvKsMxPKr=+app_HyvrF21QMwzDUsGOu+ zu6#y$T7{xwufkO+S2?TllrBqmqNmU+>Amz>RYg@#RiSFV>VWEknzmY~TE1GF+Cz1M zIzv5Pys-#cBCZ~;MXm#GGH#)6 z)ozd6)!Y-@Tijj2>R4y()XvmDLKXQ&yjjk&I!+oQOrohQ}U>eb4k~HZbSnyy9x(W?3$*y{uH6t~>7#3G*6dj`%lF|oWk4CLGP(p*(a%)BP)E2$IF@Oj zS(EuDD=h0owsbZxyFW)SXM4_Mu6ypcYf)=iYkTrk^ETy;t#evezaCm2x4vhC`i6oH z6B|7?9^ORQl)UMue3SgL{8yX9H+L5(6>KaR-{P^QrBI@fUpTVWc5B@>)Hd$6f$iqo ztG0hEVi#R4HYu(seqX{Wx%!RiH@;dd*9H0 z$NjB!N_E9`?+$Pe+^P4d?`Y6!s5po@n0fF?V_0L~w~TL_n-rRgn?4-k9U46xbhx+K zs=4`y;*ru8xJB49eKh*$jqhB)>uNP@t#6~X6(0k~gvXwKAN&3Aai8NoCm1JMf6)A) zww=;m)B$zmbj)@pc8+#Mb`75NKH1Z4+ui=7(T|5tsh+AiEql834Bs>djZ*&hXA3QVUFm(Q=>&;8Iyl!2)z2f%ZaOm)zk?4`pJM24C zcT?`ZxR-fv;r_-4=m$j)r5;v1Qhe0#v+mDrqn4wm$6Uwy9|u3aKh7F|_DjYu?mT-%DP~ zzdZD6*{hzpfVoGnQ(rI47rl{xbNDUeZQr}_casZQ@3HSIKj?nw{^;}Z!Kc(upZ)~{ znDhLU8A*Kr000JJOGiWi{{a60|De66lK=n!32;bRa{vGf6951U69E94oEQKA0)k0I zK~#9!?V3Gk6hRcne{VO3co@_mNU#tE3rVjCv9q+3ppB%kQ40~j8ao?NNGVu|XrqXQ zh=sj~2$qW22_ZHrhUg)BAM>}!9xUNbE}PxU?#?_on48&qH}l(lpLZrnGyf* zFG_EO=Mn(;4q&2Ahgs_K2T6$Zl-uvvM4 z_a?Ajcts^n-iN`E2?hW`f&>ZTv6xSlUx)$$KmZV=35I|HEfM^VdZvb0- zPJ~pJ2((!Mh8=Xt3jnQFtD6iz0WVTZT`vGkPEPhs;0bWjJ0H+)w`WtP5T};5l_6^_ zJQ0eb==hMO-ICq_pGQ!$2iRFT0Fs)(QArF)-wimDylQI#)4-uJCvQcYz&YTTnf)zm z;Z@kCoO4a!GH}DpzIzA2%oc!_bM6taT$aplEC8Hy2Y}PS<2a7Lmbv#36?FIKliK}a ze@fCWFPvbv+uaIW2d>c=?p2{zkt+a6hk;YTLo-|U3P95LyTWR( zZ-I(Po&fd%CxE+Vwz#$^{7++~9stbjOftMQV0j8~b@u`1ftzMFsM%TnCji(Eyc@E% z!-pvF0oXghH_Rl%73wUK<|Qpjn(ohaI-Q23my+6&_DgC?dL?Nw;}4@hCA}^yfQF=} zl72|KCF!c9_sPbOrLK!5-N^{xt)yJD*W8quSqGStbT%o2r&#R-&zRZA)O9^cy^LSe nGqYT~$>C2@crF2e?*RS*6%*~O3rMz@00000NkvXXu0mjf6OK#O literal 0 HcmV?d00001 From b717ff8dde7e956e1e9653df81fb34fef90caed7 Mon Sep 17 00:00:00 2001 From: jonpas Date: Mon, 17 Aug 2015 00:55:26 +0200 Subject: [PATCH 08/25] Fixed interaction menu overwrapping, Moved all actions under one main Refuel action, Changed fuel nozzle pickup action to config --- addons/refuel/CfgVehicles.hpp | 338 +++++++++++---------- addons/refuel/functions/fnc_takeNozzle.sqf | 34 +-- addons/refuel/stringtable.xml | 13 +- 3 files changed, 191 insertions(+), 194 deletions(-) diff --git a/addons/refuel/CfgVehicles.hpp b/addons/refuel/CfgVehicles.hpp index 251b4e46f2..b951d8ef13 100644 --- a/addons/refuel/CfgVehicles.hpp +++ b/addons/refuel/CfgVehicles.hpp @@ -1,10 +1,18 @@ #define REFUEL_ACTION_DISTANCE 4.5 + #define MACRO_REFUEL_ACTIONS \ - class ACE_Actions : ACE_Actions { \ - class ACE_MainActions : ACE_MainActions { \ + class ACE_Actions: ACE_Actions { \ + class ACE_MainActions: ACE_MainActions { \ + class GVAR(Refuel) { \ + displayName = CSTRING(Refuel); \ + distance = REFUEL_ACTION_DISTANCE; \ + condition = "true"; \ + statement = ""; \ + showDisabled = 0; \ + priority = 2; \ + icon = PATHTOF(ui\icon_refuel_interact.paa); \ class GVAR(TakeNozzle) { \ displayName = CSTRING(TakeNozzle); \ - distance = REFUEL_ACTION_DISTANCE; \ condition = QUOTE([ARR_2(_player,_target)] call FUNC(canTakeNozzle)); \ statement = QUOTE([ARR_3(_player,_target,objNull)] call FUNC(TakeNozzle)); \ exceptions[] = {"isNotInside"}; \ @@ -12,32 +20,35 @@ }; \ class GVAR(CheckFuel) { \ displayName = CSTRING(CheckFuel); \ - distance = REFUEL_ACTION_DISTANCE; \ - condition = QUOTE(([ARR_2(_player,_target)] call FUNC(getFuel) >= 0) && {(_target distance _player) < REFUEL_ACTION_DISTANCE}); \ + condition = QUOTE([ARR_2(_player,_target)] call FUNC(getFuel) >= 0); \ statement = QUOTE([ARR_2(_player,_target)] call FUNC(checkFuel)); \ exceptions[] = {"isNotInside"}; \ icon = PATHTOF(ui\icon_refuel_interact.paa); \ }; \ - class GVAR(connect) { \ + class GVAR(Connect) { \ displayName = CSTRING(Return); \ - distance = REFUEL_ACTION_DISTANCE; \ condition = QUOTE([ARR_1(_player)] call FUNC(canConnectNozzle)); \ statement = QUOTE([ARR_2(_player,_target)] call DFUNC(connectNozzle)); \ exceptions[] = {"isNotInside"}; \ icon = PATHTOF(ui\icon_refuel_interact.paa); \ }; \ }; \ - }; + }; \ + }; + #define MACRO_CONNECT_ACTIONS \ - class ACE_Actions { \ - class ACE_MainActions { \ - displayName = ECSTRING(interaction,MainAction); \ - selection = ""; \ - distance = 10; \ + class ACE_Actions { \ + class ACE_MainActions { \ + class GVAR(Refuel) { \ + displayName = CSTRING(Refuel); \ + distance = REFUEL_ACTION_DISTANCE; \ condition = "true"; \ - class GVAR(connect) { \ - displayName = CSTRING(connect); \ - distance = REFUEL_ACTION_DISTANCE; \ + statement = ""; \ + showDisabled = 0; \ + priority = 2; \ + icon = PATHTOF(ui\icon_refuel_interact.paa); \ + class GVAR(Connect) { \ + displayName = CSTRING(Connect); \ condition = QUOTE([ARR_1(_player)] call FUNC(canConnectNozzle)); \ statement = QUOTE([ARR_2(_player,_target)] call DFUNC(connectNozzle)); \ exceptions[] = {"isNotInside"}; \ @@ -45,7 +56,6 @@ }; \ class GVAR(Disconnect) { \ displayName = CSTRING(Disconnect); \ - distance = REFUEL_ACTION_DISTANCE; \ condition = QUOTE([ARR_2(_player,_target)] call FUNC(canDisconnect)); \ statement = QUOTE([ARR_2(_player,_target)] call DFUNC(disconnect)); \ exceptions[] = {"isNotInside"}; \ @@ -53,34 +63,27 @@ }; \ class GVAR(TurnOff) { \ displayName = CSTRING(TurnOff); \ - distance = REFUEL_ACTION_DISTANCE; \ condition = QUOTE([ARR_2(_player,_target)] call FUNC(canTurnOff)); \ statement = QUOTE([ARR_2(_player,_target)] call DFUNC(turnOff)); \ exceptions[] = {"isNotInside"}; \ icon = PATHTOF(ui\icon_refuel_interact.paa); \ }; \ }; \ - }; + }; \ + }; -// does not work #define MACRO_NOZZLE_ACTIONS \ - class ACE_Actions { \ - class ACE_MainActions { \ - displayName = ECSTRING(interaction,MainAction); \ - selection = ""; \ - distance = 2; \ - condition = "true"; \ - class GVAR(TakeNozzle) { \ - displayName = CSTRING(TakeNozzle); \ - distance = REFUEL_ACTION_DISTANCE; \ - condition = QUOTE([ARR_2(_player,_target)] call FUNC(canTakeNozzle)); \ - statement = QUOTE([ARR_3(_player,_target,_target)] call FUNC(TakeNozzle)); \ - exceptions[] = {"isNotInside"}; \ - icon = PATHTOF(ui\icon_refuel_interact.paa); \ - }; \ - }; \ - }; - + class ACE_Actions { \ + class ACE_MainActions { \ + displayName = CSTRING(TakeNozzle); \ + distance = 2; \ + condition = QUOTE([ARR_2(_player,_target)] call FUNC(canTakeNozzle)); \ + statement = QUOTE([ARR_3(_player,_target,_target)] call FUNC(TakeNozzle)); \ + exceptions[] = {"isNotInside"}; \ + icon = PATHTOF(ui\icon_refuel_interact.paa); \ + }; \ + }; + class CfgVehicles { class ACE_Module; class ACE_moduleRefuelSettings : ACE_Module { @@ -112,17 +115,18 @@ class CfgVehicles { }; }; }; - + class Sign_Sphere10cm_F; - - class ACE_refuel_fuelNozzle : Sign_Sphere10cm_F { - // TODO replace with custom model + + class ACE_refuel_fuelNozzle : Sign_Sphere10cm_F { + XEH_ENABLED; + MACRO_NOZZLE_ACTIONS }; class All; - + class Static : All {}; - + class Building : Static { class ACE_Actions { class ACE_MainActions { @@ -133,19 +137,19 @@ class CfgVehicles { }; }; }; - + class NonStrategic : Building {}; - + class House_Base : NonStrategic {}; - + class House : House_Base {}; - + class House_F : House {}; - + class House_Small_F : House_F {}; - + class Strategic : Building {}; - + class AllVehicles : All { GVAR(flowRate) = 1; }; @@ -158,7 +162,7 @@ class CfgVehicles { class Tank : LandVehicle { MACRO_CONNECT_ACTIONS }; - + class StaticWeapon : LandVehicle { MACRO_CONNECT_ACTIONS }; @@ -166,14 +170,14 @@ class CfgVehicles { class Air : AllVehicles { GVAR(flowRate) = 8; }; - + class Helicopter : Air { MACRO_CONNECT_ACTIONS GVAR(fuelCapacity) = 1500; }; - + class Helicopter_Base_F : Helicopter {}; - + class Helicopter_Base_H : Helicopter_Base_F { GVAR(fuelCapacity) = 3000; }; @@ -183,11 +187,11 @@ class CfgVehicles { GVAR(fuelCapacity) = 2000; GVAR(flowRate) = 16; }; - + class Plane_Base_F : Plane {}; class Ship : AllVehicles {}; - + class Ship_F : Ship { MACRO_CONNECT_ACTIONS GVAR(fuelCapacity) = 2000; @@ -196,9 +200,9 @@ class CfgVehicles { class Boat_Civil_01_base_F : Ship_F { GVAR(fuelCapacity) = 200; }; - + class Boat_F : Ship_F {}; - + class Boat_Armed_01_base_F : Boat_F { GVAR(fuelCapacity) = 1000; }; @@ -209,33 +213,33 @@ class CfgVehicles { // SDV is using electrical propulsion GVAR(fuelCapacity) = 0; }; - + class Car_F : Car { // Assuming large vehicle tank GVAR(fuelCapacity) = 60; }; - + class Kart_01_Base_F : Car_F { GVAR(fuelCapacity) = 8; }; - + class Offroad_01_base_F: Car_F {}; - + class Wheeled_APC_F: Car_F { // Assuming average APC tank GVAR(fuelCapacity) = 300; }; - + class Hatchback_01_base_F: Car_F { // Assume normal vehicle tank GVAR(fuelCapacity) = 50; }; - + class Quadbike_01_base_F : Car_F { // Assuming usual Yamaha quad GVAR(fuelCapacity) = 10; }; - + class MRAP_01_base_F: Car_F { // M-ATV // No data, assuming similar to Fennek @@ -252,7 +256,7 @@ class CfgVehicles { // Fennek GVAR(fuelCapacity) = 230; }; - + class APC_Wheeled_01_base_F: Wheeled_APC_F { // Patria = LAV GVAR(fuelCapacity) = 269; @@ -261,72 +265,72 @@ class CfgVehicles { class Truck_F : Car_F { GVAR(fuelCapacity) = 400; }; - + class Truck_01_base_F: Truck_F { // HEMTT GVAR(fuelCapacity) = 583; }; - + class B_Truck_01_transport_F : Truck_01_base_F {}; - + class B_Truck_01_mover_F: B_Truck_01_transport_F {}; - + class Truck_02_base_F: Truck_F { // KamAZ // Assuming similar to Ural GVAR(fuelCapacity) = 400; }; - + class Truck_03_base_F: Truck_F { // Tempest // Assuming heavier than KamAZ GVAR(fuelCapacity) = 600; }; - + class Van_01_base_F : Truck_F { // Small Truck // Assuming 80L as in Ford Transit GVAR(fuelCapacity) = 80; }; - + class Van_01_fuel_base_F : Van_01_base_F { transportFuel = 0; //1k MACRO_REFUEL_ACTIONS GVAR(hooks[]) = {{0,0,0}}; GVAR(fuelCargo) = 2000; }; - + class Tank_F : Tank { - GVAR(fuelCapacity) = 1200; + GVAR(fuelCapacity) = 1200; }; - + class APC_Tracked_01_base_F: Tank_F { // Namer // Assuming Merkava fuel - GVAR(fuelCapacity) = 1400; + GVAR(fuelCapacity) = 1400; }; - + 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 { transportFuel = 0; //3k MACRO_REFUEL_ACTIONS GVAR(hooks[]) = {{0,0,0}}; GVAR(fuelCargo) = 1000; }; - + class APC_Tracked_02_base_F: Tank_F { // BM-2T // Assuming 1 L/km GVAR(fuelCapacity) = 1000; }; - + class APC_Tracked_03_base_F: Tank_F { // FV 510 // Assuming 1 L/km GVAR(fuelCapacity) = 660; }; - + class MBT_01_base_F: Tank_F { // Merkava IV GVAR(fuelCapacity) = 1400; @@ -337,98 +341,98 @@ class CfgVehicles { // Assuming T80 GVAR(fuelCapacity) = 1100; }; - + class MBT_03_base_F: Tank_F { // Leopard GVAR(fuelCapacity) = 1160; }; - + class MBT_01_arty_base_F : MBT_01_base_F { // Assuming similar 2S3 GVAR(fuelCapacity) = 830; }; - + class MBT_02_arty_base_F : MBT_02_base_F { // Assuming similar 2S3 GVAR(fuelCapacity) = 830; }; - + class Heli_Attack_01_base_F : Helicopter_Base_F { // Commanche }; - + class Heli_Attack_02_base_F : Helicopter_Base_F { // Mi-48 Kajman }; - + class Heli_Light_01_base_F : Helicopter_Base_H { // MH-6 GVAR(fuelCapacity) = 242; }; - + class Heli_Light_02_base_F : Helicopter_Base_H { // Ka-60 Kasatka GVAR(fuelCapacity) = 1450; }; - + class Heli_light_03_base_F : Helicopter_Base_F { // AW159 GVAR(fuelCapacity) = 1004; }; - + class Heli_Transport_01_base_F : Helicopter_Base_H { // Ghost Hawk // Assuming similar UH60 GVAR(fuelCapacity) = 1360; }; - + class Heli_Transport_02_base_F : Helicopter_Base_H { // AW101 GVAR(fuelCapacity) = 3222; }; - + class Heli_Transport_03_base_F : Helicopter_Base_H { // Chinook 47I GVAR(fuelCapacity) = 3914; }; - + class Heli_Transport_04_base_F : Helicopter_Base_H { // Mi-290 Taru GVAR(fuelCapacity) = 3914; }; - + class Plane_CAS_01_base_F : Plane_Base_F { // Assuming similar to A10 GVAR(fuelCapacity) = 6223; } - + class Plane_CAS_02_base_F : Plane_Base_F { // Yak-130 GVAR(fuelCapacity) = 2099; }; - + class UAV_01_base_F : Helicopter_Base_F { // Darter is electrical GVAR(fuelCapacity) = 0; }; - + class UAV : Plane {}; - + class UAV_02_base_F : UAV { // Assuming similar YAHBON-R2 GVAR(fuelCapacity) = 270; }; - + class UGV_01_base_F : Car_F { // Stomper GVAR(fuelCapacity) = 100; }; - + class Plane_Fighter_03_base_F : Plane_Base_F { // L-159 ALCA GVAR(fuelCapacity) = 1914; }; - + // Vanilla fuel vehicles class I_Truck_02_fuel_F : Truck_02_base_F { transportFuel = 0; //3k @@ -436,57 +440,57 @@ class CfgVehicles { 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(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(fuelCargo) = 10000; }; - + class O_Truck_03_fuel_F : Truck_03_base_F { transportFuel = 0; //3k MACRO_REFUEL_ACTIONS GVAR(hooks[]) = {{0,0,0}}; GVAR(fuelCargo) = 10000; }; - + class ReammoBox_F; - + class Slingload_01_Base_F : ReammoBox_F { - class ACE_Actions { + class ACE_Actions { class ACE_MainActions { displayName = ECSTRING(interaction,MainAction); selection = ""; distance = 10; condition = "true"; - }; + }; }; }; - + class B_Slingload_01_Fuel_F : Slingload_01_Base_F { transportFuel = 0; //3k MACRO_REFUEL_ACTIONS GVAR(hooks[]) = {{0,0,0}}; GVAR(fuelCargo) = 10000; }; - + class O_Heli_Transport_04_fuel_F : Heli_Transport_04_base_F { transportFuel = 0; //3k MACRO_REFUEL_ACTIONS GVAR(hooks[]) = {{0,0,0}}; 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 { transportFuel = 0; //3k MACRO_REFUEL_ACTIONS @@ -501,63 +505,63 @@ class CfgVehicles { GVAR(hooks[]) = {{0,0,0}}; GVAR(fuelCargo) = -1; }; - + class Land_fs_feed_F : House_Small_F { 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; }; - + /* // Barrels from rhs? BarrelHelper : Misc_thing 100 BarrelBase : BarrelHelper 100 @@ -570,12 +574,12 @@ class CfgVehicles { Barrel6 : BarrelBase 100 Wooden_barrel : BarrelBase 100 Wooden_barrels : Wooden_barrel 400 - + // Warfare points Base_WarfareBVehicleServicePoint : WarfareBBaseStructure 3000 Land_StorageBladder_01_F : StorageBladder_base_F 60000 Land_FlexibleTank_01_F : FlexibleTank_base_F 300 - + // Mods rhsusf_M978A2_usarmy_wd : rhsusf_M977A2_usarmy_wd 10000 rhsusf_M978A2_CPK_usarmy_wd : rhsusf_M978A2_usarmy_wd 10000 @@ -585,7 +589,7 @@ class CfgVehicles { RHS_Ural_Fuel_VV_01 : RHS_Ural_Fuel_MSV_01 10000 LOP_UA_Ural_fuel : RHS_Ural_Fuel_VV_01 10000 */ - + // Trucks // Src: HEMTT http://www.inetres.com/gp/military/cv/eng/M977.html 583L > 483km // Src: https://en.wikipedia.org/wiki/Heavy_Expanded_Mobility_Tactical_Truck 587L > 483km @@ -598,7 +602,7 @@ class CfgVehicles { // Src: http://www.automobile-catalog.com/car/2012/1024400/gaz_233011_tigr.html 138L // Src: https://en.wikipedia.org/wiki/UAZ-469 78L // Src: https://en.wikipedia.org/wiki/GAZ-66 210L - + // Tracked IFV // Src: https://en.wikipedia.org/wiki/Marder_%28IFV%29 652L > 520km // Src: https://en.wikipedia.org/wiki/Tanque_Argentino_Mediano ~250L > 500km (200L additional tank for 400km range boost) @@ -617,7 +621,7 @@ class CfgVehicles { // Src: http://afvdb.50megs.com/usa/m2bradley.html 746L // Src: https://en.wikipedia.org/wiki/BMD-1 300L // Trend: 1-2 L/km - + // Wheeled IFV/APC // Src: https://en.wikipedia.org/wiki/BTR-60 290L > 500km // Src: http://www.inetres.com/gp/military/cv/inf/BTR-70.html 350L > 600km @@ -634,21 +638,21 @@ class CfgVehicles { // Src: https://en.wikipedia.org/wiki/Patria_AMV ? > 600-850km // Src: https://en.wikipedia.org/wiki/Otokar_Arma ? > 700km // Trend: 0.3-0.6 L/km - + // MBT // Src: http://www.inetres.com/gp/military/cv/tank/Leopard2.html 1200L > 550km // Src: http://www.inetres.com/gp/military/cv/tank/M1.html 1909L > 479km // Src: https://en.wikipedia.org/wiki/T-80 1100L > 335km // Src: https://en.wikipedia.org/wiki/T-72 1200L > 490km // Trend: 2-4 L/km - + // Artillery // Src: http://www.inetres.com/gp/military/cv/arty/M109.html 511L > 349km // Src: https://en.wikipedia.org/wiki/2S3_Akatsiya 830L > 500km - + // Other // https://en.wikipedia.org/wiki/ZSU-23-4 515L - + // Helicopter // Src: http://www.bga-aeroweb.com/Defense/UH-1Y-Venom.html 1172kg / 0.81 kg/L = 1447L // Src: http://www.bga-aeroweb.com/Defense/AH-1Z-Viper.html 1296kg / 0.81 kg/L = 1600L @@ -662,7 +666,7 @@ class CfgVehicles { // Src: http://www.globalsecurity.org/military/world/europe/aw159-specs.htm 1004L // Src: https://en.wikipedia.org/wiki/AgustaWestland_AW101 3 * 1074L = 3222L // Src: http://www.aviastar.org/helicopters_eng/ka-62.php 1450L - + // Planes // Src: http://www.theaviationzone.com/factsheets/c130j.asp 20820kg / 0.81 kg/L = 25704L // Src: http://www.avialogs.com/viewer/avialogs-documentviewer.php?id=3298 p29 1644 gal = 6223L @@ -670,130 +674,130 @@ class CfgVehicles { // Src: http://www.thaitechnics.com/aircraft/L159.html 1551kg / 0.81 kg/L = 1914L // Src: https://en.wikipedia.org/wiki/Yakovlev_Yak-130 1700kg / 0.81 kg/L = 2099L // Src: http://www.adcom-systems.com/ENG/UAV/YAHBON-R2/Overview.html 270L - + // BWMod class BWA3_Puma_base: Tank_F { // Assuming 1 L/km GVAR(fuelCapacity) = 700; }; - + class BWA3_Leopard_base: Tank_F { GVAR(fuelCapacity) = 1160; }; - + // RHS class RHS_UH1_Base : Heli_light_03_base_F { GVAR(fuelCapacity) = 1447; }; - + class RHS_UH60_Base : Heli_Transport_01_base_F { GVAR(fuelCapacity) = 1360; }; - + class RHS_CH_47F_base : Heli_Transport_02_base_F { GVAR(fuelCapacity) = 3914; }; - + class RHS_AH1Z_base : Heli_Attack_01_base_F { GVAR(fuelCapacity) = 1600; }; class RHS_AH64_base : Heli_Attack_01_base_F { GVAR(fuelCapacity) = 1420; }; - + class rhsusf_m1a1tank_base : MBT_01_base_F { GVAR(fuelCapacity) = 1909; }; - + class rhsusf_m109tank_base : MBT_01_arty_base_F { GVAR(fuelCapacity) = 511; }; - + class rhsusf_hmmwe_base : MRAP_01_base_F { GVAR(fuelCapacity) = 95; }; - + class rhsusf_rg33_base : MRAP_01_base_F { GVAR(fuelCapacity) = 302; }; - + class rhsusf_fmtv_base : Truck_01_base_F { GVAR(fuelCapacity) = 219; }; - + class rhsusf_m113_tank_base : APC_Tracked_02_base_F { GVAR(fuelCapacity) = 360; }; - + class RHS_M2A2_Base : APC_Tracked_03_base_F { GVAR(fuelCapacity) = 746; }; - + class RHS_A10 : Plane_CAS_01_base_F { GVAR(fuelCapacity) = 6223; }; - + class RHS_C130J_Base : Plane_Base_F { GVAR(fuelCapacity) = 25704; }; - + class O_Plane_CAS_02_F : Plane_CAS_02_base_F {}; class RHS_su25_base : O_Plane_CAS_02_F { GVAR(fuelCapacity) = 3600; }; - + class RHS_Mi8_base : Heli_Light_02_base_F { GVAR(fuelCapacity) = 3700; }; - + class RHS_Ka52_base : Heli_Attack_02_base_F { GVAR(fuelCapacity) = 1870; }; - + class RHS_Mi24_base : Heli_Attack_02_base_F { GVAR(fuelCapacity) = 1851; }; - + class rhs_bmp3tank_base : Tank_F { // Assuming same as BMP1/2 GVAR(fuelCapacity) = 460; }; - + class a3t72tank_base : Tank_F { GVAR(fuelCapacity) = 1200; }; - + class rhs_tank_base : Tank_F { GVAR(fuelCapacity) = 1200; }; class rhs_t80b : rhs_tank_base { GVAR(fuelCapacity) = 1100; }; - + class RHS_Ural_BaseTurret : Truck_F { GVAR(fuelCapacity) = 360; }; - + class rhs_tigr_base : MRAP_02_base_F { GVAR(fuelCapacity) = 138; }; - + class RHS_UAZ_Base : Offroad_01_base_f { GVAR(fuelCapacity) = 78; }; - + class rhs_zsutank_base : APC_Tracked_02_base_F { GVAR(fuelCapacity) = 515; }; - + class rhs_bmp1tank_base : Tank_F { GVAR(fuelCapacity) = 460; }; - + class rhs_truck : Truck_F { GVAR(fuelCapacity) = 210; }; - + class rhs_btr_base : Wheeled_Apc_F {}; class rhs_btr60_base : rhs_btr_base { GVAR(fuelCapacity) = 290; @@ -801,26 +805,26 @@ class CfgVehicles { class rhs_btr70_vmf : rhs_btr_base { GVAR(fuelCapacity) = 350; }; - + class rhs_btr70_msv : rhs_btr70_vmf {}; - + class rhs_btr80_msv : rhs_btr70_msv { GVAR(fuelCapacity) = 300; }; - + class rhs_a3spruttank_base : Tank_F { // BMD4 / 2S25 GVAR(fuelCapacity) = 400; }; - + class rhs_bmd_base : Tank_F { GVAR(fuelCapacity) = 300; }; - + class rhs_2s3tank_base : Tank_F { GVAR(fuelCapacity) = 830; }; - + class OTR21_Base : Truck_F { // No info about ballistic carrier ;-) GVAR(fuelCapacity) = 500; diff --git a/addons/refuel/functions/fnc_takeNozzle.sqf b/addons/refuel/functions/fnc_takeNozzle.sqf index c972fa57d8..96e4c48ed7 100644 --- a/addons/refuel/functions/fnc_takeNozzle.sqf +++ b/addons/refuel/functions/fnc_takeNozzle.sqf @@ -29,36 +29,26 @@ if (isNull _nozzle) then { // func is called on fuel truck _endPosOffset = getArray (configFile >> "CfgVehicles" >> typeOf _target >> "ace_refuel_hooks") select 0; // TODO add pickup animation ? - + [{ - params ["_unit", "_target", "_endPosTestOffset"]; + params ["_unit", "_target"]; _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]; - - // TODO action is only local - _action = [QGVAR(TakeNozzleFromGround), - localize LSTRING(TakeNozzle), - QUOTE(PATHTOF(ui\icon_refuel_interact.paa)), - {params ["_nozzle", "_unit"]; [ARR_3(_unit,_nozzle,_nozzle)] call DFUNC(TakeNozzle); true}, - {params ["_nozzle", "_unit"]; [ARR_2(_unit,_nozzle)] call FUNC(canTakeNozzle)}, - {}, - [] - ] call EFUNC(interact_menu,createAction); - [_newNozzle, 0, [], _action] call EFUNC(interact_menu,addActionToObject); - - _rope = ropeCreate [_target, _endPosTestOffset, _newNozzle, [0, 0, 0], 12]; - + + // Create rope with offset -1 to prevent wrapping over interaction base point + _rope = ropeCreate [_target, [0, 0, -1], _newNozzle, [0, 0, 0], 12]; + _newNozzle setVariable [QGVAR(source), _target, true]; _newNozzle setVariable [QGVAR(rope), _rope, true]; _target setVariable [QGVAR(isConnected), true, true]; }, [_unit, _target, _endPosOffset], 2, 0] call EFUNC(common,waitAndExecute); - + [{ private ["_nozzle"]; params ["_args", "_pfID"]; _args params ["_unit", "_target"]; - + if ((_unit distance _target) > 10) exitWith { _nozzle = _unit getVariable [QGVAR(nozzle), objNull]; if !(isNull _nozzle) then { @@ -67,11 +57,11 @@ if (isNull _nozzle) then { // func is called on fuel truck _nozzle setVelocity [0,0,0]; _unit setVariable [QGVAR(isRefueling), false]; _unit setVariable [QGVAR(nozzle), objNull]; - + _weaponSelect = _unit getVariable QGVAR(selectedWeaponOnRefuel); _unit selectWeapon _weaponSelect; _unit setVariable [QGVAR(selectedWeaponOnRefuel), nil]; - + [_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); [LSTRING(Hint_TooFar), 2, _unit] call EFUNC(common,displayTextStructured); }; @@ -82,10 +72,10 @@ if (isNull _nozzle) then { // func is called on fuel truck _unit setVariable [QGVAR(isRefueling), true]; } else { // func is called in muzzle either connected or on ground // TODO add pickup animation ? - + [{ params ["_unit", "_target", "_nozzle"]; - + detach _nozzle; _target setVariable [QGVAR(nozzle), objNull, true]; _nozzle attachTo [_unit, [-0.02,-0.05,0], "righthandmiddle1"]; // TODO replace with right coordinates for real model diff --git a/addons/refuel/stringtable.xml b/addons/refuel/stringtable.xml index 25ebe00727..461b5bc2b7 100644 --- a/addons/refuel/stringtable.xml +++ b/addons/refuel/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -45,15 +45,18 @@ 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 + + Take fuel nozzle Zapfpistole nehmen - + Connect fuel nozzle Zapfpistole anschließen - + Disconnect fuel nozzle Zapfpistole entfernen @@ -72,7 +75,7 @@ There is no fuel left. Es ist kein Treibstoff übrig. - + Cancel Abbrechen From 40eb5a5ba9ceb356562fb81ace72ebf67a96a69e Mon Sep 17 00:00:00 2001 From: jonpas Date: Mon, 17 Aug 2015 01:12:14 +0200 Subject: [PATCH 09/25] Made return nozzle bypass connect-attach --- addons/refuel/CfgVehicles.hpp | 4 +-- addons/refuel/XEH_preInit.sqf | 1 + .../functions/fnc_connectNozzleAction.sqf | 10 +----- addons/refuel/functions/fnc_returnNozzle.sqf | 33 +++++++++++++++++++ 4 files changed, 37 insertions(+), 11 deletions(-) create mode 100644 addons/refuel/functions/fnc_returnNozzle.sqf diff --git a/addons/refuel/CfgVehicles.hpp b/addons/refuel/CfgVehicles.hpp index b951d8ef13..f84253f23b 100644 --- a/addons/refuel/CfgVehicles.hpp +++ b/addons/refuel/CfgVehicles.hpp @@ -25,10 +25,10 @@ exceptions[] = {"isNotInside"}; \ icon = PATHTOF(ui\icon_refuel_interact.paa); \ }; \ - class GVAR(Connect) { \ + class GVAR(Return) { \ displayName = CSTRING(Return); \ condition = QUOTE([ARR_1(_player)] call FUNC(canConnectNozzle)); \ - statement = QUOTE([ARR_2(_player,_target)] call DFUNC(connectNozzle)); \ + statement = QUOTE([ARR_2(_player,_target)] call DFUNC(returnNozzle)); \ exceptions[] = {"isNotInside"}; \ icon = PATHTOF(ui\icon_refuel_interact.paa); \ }; \ diff --git a/addons/refuel/XEH_preInit.sqf b/addons/refuel/XEH_preInit.sqf index 7360046646..dea296b6e1 100644 --- a/addons/refuel/XEH_preInit.sqf +++ b/addons/refuel/XEH_preInit.sqf @@ -13,6 +13,7 @@ PREP(connectNozzleAction); PREP(disconnect); PREP(getFuel); PREP(moduleRefuelSettings); +PREP(returnNozzle); PREP(setFuel); PREP(takeNozzle); PREP(turnOff); diff --git a/addons/refuel/functions/fnc_connectNozzleAction.sqf b/addons/refuel/functions/fnc_connectNozzleAction.sqf index 8a0f9f94ee..4fa30943a1 100644 --- a/addons/refuel/functions/fnc_connectNozzleAction.sqf +++ b/addons/refuel/functions/fnc_connectNozzleAction.sqf @@ -81,14 +81,6 @@ _weaponSelect = _unit getVariable QGVAR(selectedWeaponOnRefuel); _unit selectWeapon _weaponSelect; _unit setVariable [QGVAR(selectedWeaponOnRefuel), nil]; -_source = _nozzle getVariable QGVAR(source); -if (_source == _target) exitWith { - _source setVariable [QGVAR(isConnected), false, true]; - ropeDestroy (_nozzle getVariable QGVAR(rope)); - deleteVehicle _nozzle; - _unit setVariable [QGVAR(isRefueling), false]; -}; - _nozzle attachTo [_target, _endPosTestOffset]; _nozzle setVariable [QGVAR(sink), _target, true]; _nozzle setVariable [QGVAR(fueling), 1, true]; @@ -96,4 +88,4 @@ _target setVariable [QGVAR(nozzle), _nozzle, true]; [_unit, _target, _nozzle] call FUNC(refuel); -true \ No newline at end of file +true diff --git a/addons/refuel/functions/fnc_returnNozzle.sqf b/addons/refuel/functions/fnc_returnNozzle.sqf new file mode 100644 index 0000000000..0531fe738c --- /dev/null +++ b/addons/refuel/functions/fnc_returnNozzle.sqf @@ -0,0 +1,33 @@ +/* + * Author: GitHawk et.al., Jonpas + * Returns the nozzle back to source vehicle. + * + * Arguments: + * 0: Player + * 1: Target + * + * Return Value: + * Returned Nozzle + * + * Example: + * [player] call ace_refuel_fnc_returnNozzle + * + * Public: No + */ +#include "script_component.hpp" + +private ["_nozzle"]; + +params ["_unit", "_target"]; + +_source = _nozzle getVariable QGVAR(source); +_nozzle = _unit getVariable QGVAR(nozzle); + +if (_source != _target || {isNil "_nozzle"}) exitWith {false}; + +_source setVariable [QGVAR(isConnected), false, true]; +ropeDestroy (_nozzle getVariable QGVAR(rope)); +deleteVehicle _nozzle; +_unit setVariable [QGVAR(isRefueling), false]; + +true From 68489c456e8fbe6b7ff912386dd3463d2bc769ca Mon Sep 17 00:00:00 2001 From: jonpas Date: Mon, 17 Aug 2015 01:12:47 +0200 Subject: [PATCH 10/25] Alphabetized PREPs --- addons/refuel/XEH_preInit.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/refuel/XEH_preInit.sqf b/addons/refuel/XEH_preInit.sqf index dea296b6e1..5d938ec573 100644 --- a/addons/refuel/XEH_preInit.sqf +++ b/addons/refuel/XEH_preInit.sqf @@ -13,10 +13,10 @@ PREP(connectNozzleAction); PREP(disconnect); PREP(getFuel); PREP(moduleRefuelSettings); +PREP(refuel); PREP(returnNozzle); PREP(setFuel); PREP(takeNozzle); PREP(turnOff); -PREP(refuel); ADDON = true; From 68370f63d706c3bc3db3d05695b2631e85d501a6 Mon Sep 17 00:00:00 2001 From: jonpas Date: Mon, 17 Aug 2015 01:24:45 +0200 Subject: [PATCH 11/25] Fixed returnNozzle function, Moved Return action up --- addons/refuel/CfgVehicles.hpp | 14 +++++++------- addons/refuel/functions/fnc_returnNozzle.sqf | 12 +++++++++--- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/addons/refuel/CfgVehicles.hpp b/addons/refuel/CfgVehicles.hpp index f84253f23b..c110c7ce7d 100644 --- a/addons/refuel/CfgVehicles.hpp +++ b/addons/refuel/CfgVehicles.hpp @@ -18,13 +18,6 @@ exceptions[] = {"isNotInside"}; \ icon = PATHTOF(ui\icon_refuel_interact.paa); \ }; \ - class GVAR(CheckFuel) { \ - displayName = CSTRING(CheckFuel); \ - condition = QUOTE([ARR_2(_player,_target)] call FUNC(getFuel) >= 0); \ - statement = QUOTE([ARR_2(_player,_target)] call FUNC(checkFuel)); \ - exceptions[] = {"isNotInside"}; \ - icon = PATHTOF(ui\icon_refuel_interact.paa); \ - }; \ class GVAR(Return) { \ displayName = CSTRING(Return); \ condition = QUOTE([ARR_1(_player)] call FUNC(canConnectNozzle)); \ @@ -32,6 +25,13 @@ exceptions[] = {"isNotInside"}; \ icon = PATHTOF(ui\icon_refuel_interact.paa); \ }; \ + class GVAR(CheckFuel) { \ + displayName = CSTRING(CheckFuel); \ + condition = QUOTE([ARR_2(_player,_target)] call FUNC(getFuel) >= 0); \ + statement = QUOTE([ARR_2(_player,_target)] call FUNC(checkFuel)); \ + exceptions[] = {"isNotInside"}; \ + icon = PATHTOF(ui\icon_refuel_interact.paa); \ + }; \ }; \ }; \ }; diff --git a/addons/refuel/functions/fnc_returnNozzle.sqf b/addons/refuel/functions/fnc_returnNozzle.sqf index 0531fe738c..0bf1bc4406 100644 --- a/addons/refuel/functions/fnc_returnNozzle.sqf +++ b/addons/refuel/functions/fnc_returnNozzle.sqf @@ -25,9 +25,15 @@ _nozzle = _unit getVariable QGVAR(nozzle); if (_source != _target || {isNil "_nozzle"}) exitWith {false}; -_source setVariable [QGVAR(isConnected), false, true]; -ropeDestroy (_nozzle getVariable QGVAR(rope)); -deleteVehicle _nozzle; +_unit setVariable [QGVAR(nozzle), nil]; +detach _nozzle; +[_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); +_unit selectWeapon (_unit getVariable QGVAR(selectedWeaponOnRefuel)); +_unit setVariable [QGVAR(selectedWeaponOnRefuel), nil]; _unit setVariable [QGVAR(isRefueling), false]; +_target setVariable [QGVAR(isConnected), false, true]; +ropeDestroy (_nozzle getVariable QGVAR(rope)); +deleteVehicle _nozzle; + true From 4dc8747430752f43711282df906bd83834a50a30 Mon Sep 17 00:00:00 2001 From: jonpas Date: Mon, 17 Aug 2015 01:44:47 +0200 Subject: [PATCH 12/25] Bypassed interaction menu subactions distance bug --- addons/refuel/CfgVehicles.hpp | 6 ++---- .../refuel/functions/fnc_canConnectNozzle.sqf | 6 +++--- addons/refuel/functions/fnc_canDisconnect.sqf | 2 +- addons/refuel/functions/fnc_canRefuel.sqf | 4 ++-- addons/refuel/functions/fnc_canTurnOff.sqf | 1 - addons/refuel/functions/fnc_turnOff.sqf | 18 ++++++------------ addons/refuel/functions/script_component.hpp | 2 -- addons/refuel/script_component.hpp | 3 +++ 8 files changed, 17 insertions(+), 25 deletions(-) diff --git a/addons/refuel/CfgVehicles.hpp b/addons/refuel/CfgVehicles.hpp index c110c7ce7d..466bbbaba7 100644 --- a/addons/refuel/CfgVehicles.hpp +++ b/addons/refuel/CfgVehicles.hpp @@ -1,5 +1,3 @@ -#define REFUEL_ACTION_DISTANCE 4.5 - #define MACRO_REFUEL_ACTIONS \ class ACE_Actions: ACE_Actions { \ class ACE_MainActions: ACE_MainActions { \ @@ -20,7 +18,7 @@ }; \ class GVAR(Return) { \ displayName = CSTRING(Return); \ - condition = QUOTE([ARR_1(_player)] call FUNC(canConnectNozzle)); \ + condition = QUOTE([ARR_2(_player,_target)] call FUNC(canConnectNozzle)); \ statement = QUOTE([ARR_2(_player,_target)] call DFUNC(returnNozzle)); \ exceptions[] = {"isNotInside"}; \ icon = PATHTOF(ui\icon_refuel_interact.paa); \ @@ -64,7 +62,7 @@ class GVAR(TurnOff) { \ displayName = CSTRING(TurnOff); \ condition = QUOTE([ARR_2(_player,_target)] call FUNC(canTurnOff)); \ - statement = QUOTE([ARR_2(_player,_target)] call DFUNC(turnOff)); \ + statement = QUOTE([_target] call DFUNC(turnOff)); \ exceptions[] = {"isNotInside"}; \ icon = PATHTOF(ui\icon_refuel_interact.paa); \ }; \ diff --git a/addons/refuel/functions/fnc_canConnectNozzle.sqf b/addons/refuel/functions/fnc_canConnectNozzle.sqf index 0480262292..f2314eb67e 100644 --- a/addons/refuel/functions/fnc_canConnectNozzle.sqf +++ b/addons/refuel/functions/fnc_canConnectNozzle.sqf @@ -17,9 +17,9 @@ #include "script_component.hpp" private ["_nozzle"]; -params ["_unit"]; +params ["_unit", "_target"]; _nozzle = _unit getVariable QGVAR(nozzle); -if (isNil "_nozzle") exitWith {false}; +if (isNil "_nozzle" || {(_target distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false}; -true \ No newline at end of file +true diff --git a/addons/refuel/functions/fnc_canDisconnect.sqf b/addons/refuel/functions/fnc_canDisconnect.sqf index d2cd4636c0..b913b757e5 100644 --- a/addons/refuel/functions/fnc_canDisconnect.sqf +++ b/addons/refuel/functions/fnc_canDisconnect.sqf @@ -30,4 +30,4 @@ if (isNull _sink) exitWith {false}; _fueling = _nozzle getVariable [QGVAR(fueling), 0]; if (_fueling == 1) exitWith {false}; -true \ No newline at end of file +true diff --git a/addons/refuel/functions/fnc_canRefuel.sqf b/addons/refuel/functions/fnc_canRefuel.sqf index 038eb0abf3..31983776e4 100644 --- a/addons/refuel/functions/fnc_canRefuel.sqf +++ b/addons/refuel/functions/fnc_canRefuel.sqf @@ -17,9 +17,9 @@ private ["_fuel"]; params ["_unit", "_target"]; -if (isNull _unit || {!(_unit isKindOf "CAManBase")} || {!local _unit} || { (_target distance _unit) > 7}) exitWith {false}; +if (isNull _unit || {!(_unit isKindOf "CAManBase")} || {!local _unit} || {(_target distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false}; _fuel = [_unit, _target] call FUNC(getFuel); if (_fuel > 0 || {_fuel == -1}) exitWith {true}; -false \ No newline at end of file +false diff --git a/addons/refuel/functions/fnc_canTurnOff.sqf b/addons/refuel/functions/fnc_canTurnOff.sqf index 386b0f33cd..9e62778f18 100644 --- a/addons/refuel/functions/fnc_canTurnOff.sqf +++ b/addons/refuel/functions/fnc_canTurnOff.sqf @@ -16,7 +16,6 @@ */ #include "script_component.hpp" -private ["_nozzle", "_fueling"]; params ["_unit", "_nozzleHolder"]; if (isNull _unit || {!(_unit isKindOf "CAManBase")} || {!local _unit} || {(_nozzleHolder distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false}; diff --git a/addons/refuel/functions/fnc_turnOff.sqf b/addons/refuel/functions/fnc_turnOff.sqf index dded1c0999..babc360d0a 100644 --- a/addons/refuel/functions/fnc_turnOff.sqf +++ b/addons/refuel/functions/fnc_turnOff.sqf @@ -1,26 +1,20 @@ /* * Author: GitHawk - * Check if a unit can turn off a fuel nozzle + * Turn off a fuel nozzle * * Arguments: - * 0: The unit - * 1: The object holding the nozzle + * 0: The object holding the nozzle * * Return Value: - * Can turn off + * None * * Example: - * [player, nozzle] call ace_refuel_fnc_canTurnOff + * [player, nozzle] call ace_refuel_fnc_turnOff * * Public: No */ #include "script_component.hpp" -params ["_unit", "_nozzleHolder"]; +params ["_nozzleHolder"]; -if (isNull _unit || {!(_unit isKindOf "CAManBase")} || {!local _unit} || { (_nozzleHolder distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false}; - -_nozzle = _nozzleHolder getVariable QGVAR(nozzle); -_nozzle setVariable [QGVAR(fueling), 0]; - -true \ No newline at end of file +(_nozzleHolder getVariable QGVAR(nozzle)) setVariable [QGVAR(fueling), 0]; diff --git a/addons/refuel/functions/script_component.hpp b/addons/refuel/functions/script_component.hpp index cb77e83d80..167c1e614a 100644 --- a/addons/refuel/functions/script_component.hpp +++ b/addons/refuel/functions/script_component.hpp @@ -1,3 +1 @@ #include "\z\ace\addons\refuel\script_component.hpp" - -#define REFUEL_ACTION_DISTANCE 4.5 \ No newline at end of file diff --git a/addons/refuel/script_component.hpp b/addons/refuel/script_component.hpp index 4a6efdd42a..1173c86771 100644 --- a/addons/refuel/script_component.hpp +++ b/addons/refuel/script_component.hpp @@ -10,3 +10,6 @@ #endif #include "\z\ace\addons\main\script_macros.hpp" + + +#define REFUEL_ACTION_DISTANCE 4.5 From 9ad8718762b8656746b22529c10dc2d375cc15c6 Mon Sep 17 00:00:00 2001 From: jonpas Date: Mon, 17 Aug 2015 01:57:05 +0200 Subject: [PATCH 13/25] Added canCheckFuel for check fuel condition, removed extra spaces --- addons/refuel/CfgVehicles.hpp | 4 ++-- addons/refuel/XEH_preInit.sqf | 1 + addons/refuel/functions/fnc_canCheckFuel.sqf | 23 +++++++++++++++++++ addons/refuel/functions/fnc_canDisconnect.sqf | 2 +- addons/refuel/functions/fnc_canRefuel.sqf | 4 ++-- addons/refuel/functions/fnc_canTakeNozzle.sqf | 2 +- addons/refuel/functions/fnc_checkFuel.sqf | 5 +--- addons/refuel/functions/fnc_getFuel.sqf | 18 +++++++-------- addons/refuel/functions/fnc_refuel.sqf | 16 ++++++------- 9 files changed, 47 insertions(+), 28 deletions(-) create mode 100644 addons/refuel/functions/fnc_canCheckFuel.sqf diff --git a/addons/refuel/CfgVehicles.hpp b/addons/refuel/CfgVehicles.hpp index 466bbbaba7..1250167a48 100644 --- a/addons/refuel/CfgVehicles.hpp +++ b/addons/refuel/CfgVehicles.hpp @@ -25,7 +25,7 @@ }; \ class GVAR(CheckFuel) { \ displayName = CSTRING(CheckFuel); \ - condition = QUOTE([ARR_2(_player,_target)] call FUNC(getFuel) >= 0); \ + condition = QUOTE([ARR_2(_player,_target)] call FUNC(canCheckFuel)); \ statement = QUOTE([ARR_2(_player,_target)] call FUNC(checkFuel)); \ exceptions[] = {"isNotInside"}; \ icon = PATHTOF(ui\icon_refuel_interact.paa); \ @@ -47,7 +47,7 @@ icon = PATHTOF(ui\icon_refuel_interact.paa); \ class GVAR(Connect) { \ displayName = CSTRING(Connect); \ - condition = QUOTE([ARR_1(_player)] call FUNC(canConnectNozzle)); \ + condition = QUOTE([ARR_2(_player,_target)] call FUNC(canConnectNozzle)); \ statement = QUOTE([ARR_2(_player,_target)] call DFUNC(connectNozzle)); \ exceptions[] = {"isNotInside"}; \ icon = PATHTOF(ui\icon_refuel_interact.paa); \ diff --git a/addons/refuel/XEH_preInit.sqf b/addons/refuel/XEH_preInit.sqf index 5d938ec573..a30a4b82e1 100644 --- a/addons/refuel/XEH_preInit.sqf +++ b/addons/refuel/XEH_preInit.sqf @@ -2,6 +2,7 @@ ADDON = false; +PREP(canCheckFuel); PREP(canConnectNozzle); PREP(canDisconnect); PREP(canRefuel); diff --git a/addons/refuel/functions/fnc_canCheckFuel.sqf b/addons/refuel/functions/fnc_canCheckFuel.sqf new file mode 100644 index 0000000000..0abd2c5f21 --- /dev/null +++ b/addons/refuel/functions/fnc_canCheckFuel.sqf @@ -0,0 +1,23 @@ +/* + * Author: Jonpas + * Checks if unit can check fuel. + * + * Arguments: + * 0: Unit + * 1: Target + * + * Return Value: + * Can Check Fuel + * + * Example: + * [unit, target] call ace_refuel_fnc_canCheckFuel + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit", "_target"]; + +if (isNull _unit || {!(_unit isKindOf "CAManBase")} || {!local _unit} || {(_target distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false}; + +true diff --git a/addons/refuel/functions/fnc_canDisconnect.sqf b/addons/refuel/functions/fnc_canDisconnect.sqf index b913b757e5..6453e54b86 100644 --- a/addons/refuel/functions/fnc_canDisconnect.sqf +++ b/addons/refuel/functions/fnc_canDisconnect.sqf @@ -19,7 +19,7 @@ private ["_nozzle", "_sink", "_fueling"]; 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}; _nozzle = _nozzleHolder getVariable [QGVAR(nozzle), objNull]; if (isNull _nozzle) exitWith {false}; diff --git a/addons/refuel/functions/fnc_canRefuel.sqf b/addons/refuel/functions/fnc_canRefuel.sqf index 31983776e4..72d10e4058 100644 --- a/addons/refuel/functions/fnc_canRefuel.sqf +++ b/addons/refuel/functions/fnc_canRefuel.sqf @@ -17,9 +17,9 @@ private ["_fuel"]; 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 = [_unit, _target] call FUNC(getFuel); +_fuel = [_target] call FUNC(getFuel); if (_fuel > 0 || {_fuel == -1}) exitWith {true}; false diff --git a/addons/refuel/functions/fnc_canTakeNozzle.sqf b/addons/refuel/functions/fnc_canTakeNozzle.sqf index eceebca4f8..df61329a23 100644 --- a/addons/refuel/functions/fnc_canTakeNozzle.sqf +++ b/addons/refuel/functions/fnc_canTakeNozzle.sqf @@ -18,7 +18,7 @@ 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])} diff --git a/addons/refuel/functions/fnc_checkFuel.sqf b/addons/refuel/functions/fnc_checkFuel.sqf index 871683dfe1..81da60ed95 100644 --- a/addons/refuel/functions/fnc_checkFuel.sqf +++ b/addons/refuel/functions/fnc_checkFuel.sqf @@ -18,9 +18,7 @@ private ["_fuel", "_type"]; params ["_unit", "_target"]; -if (isNull _unit || {!(_unit isKindOf "CAManBase")} || {!local _unit} || { (_target distance _unit) > 7}) exitWith {0}; - -_fuel = [_unit, _target] call FUNC(getFuel); +_fuel = [_target] call FUNC(getFuel); [ 5, @@ -40,4 +38,3 @@ _fuel = [_unit, _target] call FUNC(getFuel); {true}, ["isnotinside"] ] call EFUNC(common,progressBar); - diff --git a/addons/refuel/functions/fnc_getFuel.sqf b/addons/refuel/functions/fnc_getFuel.sqf index 553eb537ff..a9f5aae11f 100644 --- a/addons/refuel/functions/fnc_getFuel.sqf +++ b/addons/refuel/functions/fnc_getFuel.sqf @@ -1,28 +1,26 @@ /* - * Author: GitHawk - * Get the remaining fuel amount + * Author: GitHawk, Jonpas + * Get the remaining fuel amount. * * Arguments: - * 0: The unit - * 1: The target + * 0: Target * * Return Value: * Fuel left (in liters) * * Example: - * [unit, target] call ace_refuel_fnc_getFuel + * [target] call ace_refuel_fnc_getFuel * * Public: No */ #include "script_component.hpp" + private ["_fuel"]; -params ["_unit", "_target"]; +params ["_target"]; -if (isNull _unit || {!(_unit isKindOf "CAManBase")} || {!local _unit}) exitWith {0}; +_fuel = _target getVariable [QGVAR(currentFuelCargo), nil]; -_fuel = _target getVariable [QGVAR(currentFuelCargo), -2]; - -if (_fuel == -2) then { +if (isNil "_fuel") then { _fuel = getNumber (configFile >> "CfgVehicles" >> typeOf _target >> QGVAR(fuelCargo)); _target setVariable [QGVAR(currentFuelCargo), _fuel, true]; }; diff --git a/addons/refuel/functions/fnc_refuel.sqf b/addons/refuel/functions/fnc_refuel.sqf index 1eed5108b7..08889e0468 100644 --- a/addons/refuel/functions/fnc_refuel.sqf +++ b/addons/refuel/functions/fnc_refuel.sqf @@ -24,13 +24,13 @@ if (isNull _sink) exitWith {}; _rate = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(flowRate)) * GVAR(rate); _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(fuelCapacity)); -[{ +[{ private ["_source", "_sink", "_fuelInSource", "_fuelInSink", "_finished", "_fueling"]; params ["_args", "_pfID"]; _args params ["_unit", "_nozzle", "_rate", "_startFuel", "_maxFuel"]; - + _fueling = _nozzle getVariable [QGVAR(fueling), 0]; - + _source = _nozzle getVariable [QGVAR(source), objNull]; _sink = _nozzle getVariable [QGVAR(sink), objNull]; if (isNull _source || {isNull _sink} || {(_source distance _sink) > 10}) exitWith { @@ -40,7 +40,7 @@ _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(f _nozzle setVariable [QGVAR(sink), objNull]; [_pfID] call cba_fnc_removePerFrameHandler; }; - _fuelInSource = [_unit, _source] call FUNC(getFuel); + _fuelInSource = [_source] call FUNC(getFuel); if (_fuelInSource == 0) exitWith { [LSTRING(Hint_SourceEmpty), 2, _unit] call EFUNC(common,displayTextStructured); _nozzle setVariable [QGVAR(fueling), 0, true]; @@ -53,7 +53,7 @@ _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(f _finished = true; [LSTRING(Hint_Empty), 2, _unit] call EFUNC(common,displayTextStructured); }; - + _fuelInSink = fuel _sink + ( _rate / _maxFuel); if (_fuelInSink > 1) then { _fuelInSink = 1; @@ -66,7 +66,7 @@ _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(f _sink setFuel _fuelInSink; }; [_unit, _source, _fuelInSource] call FUNC(setFuel); - + if (_finished || {_fueling == 0}) exitWith { if (_fueling == 0) then { [LSTRING(Hint_Stopped), 2, _unit] call EFUNC(common,displayTextStructured); @@ -74,8 +74,8 @@ _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(f _nozzle setVariable [QGVAR(fueling), 0, true]; [_pfID] call cba_fnc_removePerFrameHandler; }; - - // display flickers even at 1 second intervals + + // display flickers even at 1 second intervals //["displayTextStructured", [_unit], [[localize LSTRING(Hint_FuelProgress), round((_fuelInSink - _startFuel) * _maxFuel)], 2, _unit]] call EFUNC(common,targetEvent); //[[LSTRING(Hint_FuelProgress), round((_fuelInSink - _startFuel) * _maxFuel)], 2, _unit] call EFUNC(common,displayTextStructured); }, 1, [_unit, _nozzle, _rate, fuel _target, _maxFuel]] call cba_fnc_addPerFrameHandler; From 539fc692757572491e0de65f6255fe412968d024 Mon Sep 17 00:00:00 2001 From: jonpas Date: Mon, 17 Aug 2015 01:58:52 +0200 Subject: [PATCH 14/25] Increased interaction distance to 7 (same as attach) to cover bigger vehicles --- addons/refuel/script_component.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/refuel/script_component.hpp b/addons/refuel/script_component.hpp index 1173c86771..b24e276a52 100644 --- a/addons/refuel/script_component.hpp +++ b/addons/refuel/script_component.hpp @@ -12,4 +12,4 @@ #include "\z\ace\addons\main\script_macros.hpp" -#define REFUEL_ACTION_DISTANCE 4.5 +#define REFUEL_ACTION_DISTANCE 7 From f54beb5c86e20701008c8d8c126be8c964f389fd Mon Sep 17 00:00:00 2001 From: IngoKauffmann Date: Tue, 18 Aug 2015 00:42:35 +0200 Subject: [PATCH 15/25] 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. From 2816e8863a80b5beea999866091ac710304bbfbd Mon Sep 17 00:00:00 2001 From: IngoKauffmann Date: Tue, 18 Aug 2015 16:09:59 +0200 Subject: [PATCH 16/25] Minor fixes --- addons/refuel/functions/fnc_connectNozzleAction.sqf | 1 + addons/refuel/functions/fnc_refuel.sqf | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/addons/refuel/functions/fnc_connectNozzleAction.sqf b/addons/refuel/functions/fnc_connectNozzleAction.sqf index 5cb3daea91..bd7cce74ac 100644 --- a/addons/refuel/functions/fnc_connectNozzleAction.sqf +++ b/addons/refuel/functions/fnc_connectNozzleAction.sqf @@ -85,6 +85,7 @@ _unit setVariable [QGVAR(isRefueling), false]; _nozzle attachTo [_target, _endPosTestOffset]; _nozzle setVariable [QGVAR(sink), _target, true]; _nozzle setVariable [QGVAR(isRefueling), true, true]; +_nozzle setVariable [QGVAR(isConnected), true, true]; _target setVariable [QGVAR(nozzle), _nozzle, true]; [_unit, _target, _nozzle] call FUNC(refuel); diff --git a/addons/refuel/functions/fnc_refuel.sqf b/addons/refuel/functions/fnc_refuel.sqf index 1b21facb82..faf4f5883d 100644 --- a/addons/refuel/functions/fnc_refuel.sqf +++ b/addons/refuel/functions/fnc_refuel.sqf @@ -33,11 +33,16 @@ _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(f _source = _nozzle getVariable [QGVAR(source), objNull]; _sink = _nozzle getVariable [QGVAR(sink), objNull]; - if (isNull _source || {isNull _sink} || {(_sink distance (_source modelToWorld (_nozzle getVariable [QGVAR(attachPos), [0,0,0]]))) > 10}) exitWith { + if (isNull _source || + {isNull _sink} || + {(_sink distance (_source modelToWorld (_nozzle getVariable [QGVAR(attachPos), [0,0,0]]))) > 10} || + {!alive _source} || + {!alive _sink}) exitWith { [LSTRING(Hint_TooFar), 2, _unit] call EFUNC(common,displayTextStructured); detach _nozzle; _nozzle setPosATL [(getPosATL _nozzle) select 0,(getPosATL _nozzle) select 1, 0]; _nozzle setVelocity [0, 0, 0]; + _nozzle setVariable [QGVAR(isConnected), false, true]; _nozzle setVariable [QGVAR(isRefueling), false, true]; _nozzle setVariable [QGVAR(sink), objNull, true]; _sink setVariable [QGVAR(nozzle), objNull, true]; @@ -77,7 +82,6 @@ _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(f [LSTRING(Hint_Stopped), 2, _unit] call EFUNC(common,displayTextStructured); }; _nozzle setVariable [QGVAR(isRefueling), false, true]; - [_pfID] call cba_fnc_removePerFrameHandler; }; // display flickers even at 1 second intervals From cdd0c4c013bfdc75ed9489341db7a00b7c9bfdb5 Mon Sep 17 00:00:00 2001 From: IngoKauffmann Date: Tue, 18 Aug 2015 23:18:32 +0200 Subject: [PATCH 17/25] Next few things Clean up Removed MP issues Added macros for reused code Added death handling Added unconscious handling Added fueling restart --- addons/refuel/CfgEventHandlers.hpp | 22 ++++++ addons/refuel/CfgVehicles.hpp | 14 +++- addons/refuel/README.md | 11 +++ addons/refuel/XEH_postInit.sqf | 3 + addons/refuel/XEH_preInit.sqf | 4 + addons/refuel/XEH_respawn.sqf | 11 +++ addons/refuel/config.cpp | 2 +- addons/refuel/functions/fnc_canCheckFuel.sqf | 3 +- addons/refuel/functions/fnc_canTakeNozzle.sqf | 6 +- addons/refuel/functions/fnc_canTurnOff.sqf | 5 +- addons/refuel/functions/fnc_canTurnOn.sqf | 31 ++++++++ addons/refuel/functions/fnc_handleKilled.sqf | 26 +++++++ .../functions/fnc_handleUnconscious.sqf | 29 +++++++ addons/refuel/functions/fnc_refuel.sqf | 75 ++++++++++--------- addons/refuel/functions/fnc_returnNozzle.sqf | 5 +- addons/refuel/functions/fnc_takeNozzle.sqf | 15 +--- addons/refuel/functions/fnc_turnOff.sqf | 2 +- addons/refuel/functions/fnc_turnOn.sqf | 20 +++++ addons/refuel/script_component.hpp | 23 +++++- addons/refuel/stringtable.xml | 4 + 20 files changed, 250 insertions(+), 61 deletions(-) create mode 100644 addons/refuel/README.md create mode 100644 addons/refuel/XEH_postInit.sqf create mode 100644 addons/refuel/XEH_respawn.sqf create mode 100644 addons/refuel/functions/fnc_canTurnOn.sqf create mode 100644 addons/refuel/functions/fnc_handleKilled.sqf create mode 100644 addons/refuel/functions/fnc_handleUnconscious.sqf create mode 100644 addons/refuel/functions/fnc_turnOn.sqf diff --git a/addons/refuel/CfgEventHandlers.hpp b/addons/refuel/CfgEventHandlers.hpp index b928bc2de6..f1a9f1a3c8 100644 --- a/addons/refuel/CfgEventHandlers.hpp +++ b/addons/refuel/CfgEventHandlers.hpp @@ -3,3 +3,25 @@ class Extended_PreInit_EventHandlers { init = QUOTE(call COMPILE_FILE(XEH_preInit)); }; }; + +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_postInit)); + }; +}; + +class Extended_Respawn_EventHandlers { + class CAManBase { + class ADDON { + respawn = QUOTE(call COMPILE_FILE(XEH_respawn)); + }; + }; +}; + +class Extended_Killed_EventHandlers { + class CAManBase { + class ADDON { + killed = QUOTE(_this call FUNC(handleKilled)); + }; + }; +}; \ No newline at end of file diff --git a/addons/refuel/CfgVehicles.hpp b/addons/refuel/CfgVehicles.hpp index c5e797ef2e..0e7aacafa0 100644 --- a/addons/refuel/CfgVehicles.hpp +++ b/addons/refuel/CfgVehicles.hpp @@ -52,6 +52,13 @@ exceptions[] = {"isNotInside"}; \ icon = PATHTOF(ui\icon_refuel_interact.paa); \ }; \ + class GVAR(TurnOn) { \ + displayName = CSTRING(TurnOn); \ + condition = QUOTE([ARR_2(_player,_target)] call FUNC(canTurnOn)); \ + statement = QUOTE([_target] call DFUNC(turnOn)); \ + exceptions[] = {"isNotInside"}; \ + icon = PATHTOF(ui\icon_refuel_interact.paa); \ + }; \ class GVAR(Disconnect) { \ displayName = CSTRING(Disconnect); \ condition = QUOTE([ARR_2(_player,_target)] call FUNC(canDisconnect)); \ @@ -89,7 +96,7 @@ class CfgVehicles { displayName = CSTRING(RefuelSettings_Module_DisplayName); icon = QUOTE(PATHTOF(ui\icon_module_refuel.paa)); category = "ACE"; - function = QUOTE(DFUNC(moduleRefuelSettings)); + function = QFUNC(moduleRefuelSettings); functionPriority = 1; isGlobal = 0; isTriggerActivated = 0; @@ -451,7 +458,6 @@ class CfgVehicles { }; class ReammoBox_F; - class Slingload_01_Base_F : ReammoBox_F { class ACE_Actions { class ACE_MainActions { @@ -494,7 +500,7 @@ class CfgVehicles { transportFuel = 0; //50k MACRO_REFUEL_ACTIONS GVAR(hooks[]) = {{0,0,-1}}; - GVAR(fuelCargo) = INFINITE_FUEL; + GVAR(fuelCargo) = REFUEL_INFINITE_FUEL; }; class Land_fs_feed_F : House_Small_F { @@ -502,7 +508,7 @@ class CfgVehicles { transportFuel = 0; //50k MACRO_REFUEL_ACTIONS GVAR(hooks[]) = {{-0.4,0.022,-.23}}; - GVAR(fuelCargo) = INFINITE_FUEL; + GVAR(fuelCargo) = REFUEL_INFINITE_FUEL; }; /* // Barrels from rhs? diff --git a/addons/refuel/README.md b/addons/refuel/README.md new file mode 100644 index 0000000000..6e3d226693 --- /dev/null +++ b/addons/refuel/README.md @@ -0,0 +1,11 @@ +ace_refuel +=============== + +The Refuel module introduces ability to refuel vehicles on different realistic levels. + +## Maintainers + +The people responsible for merging changes to this component or answering potential questions. + +- [GitHawk] (https://github.com/GitHawk) +- [Jonpas] (https://github.com/jonpas) diff --git a/addons/refuel/XEH_postInit.sqf b/addons/refuel/XEH_postInit.sqf new file mode 100644 index 0000000000..682ebaf094 --- /dev/null +++ b/addons/refuel/XEH_postInit.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +["medical_onUnconscious", {_this call FUNC(handleOnUnconscious)}] call EFUNC(common,addEventHandler); diff --git a/addons/refuel/XEH_preInit.sqf b/addons/refuel/XEH_preInit.sqf index a30a4b82e1..d330a88a6e 100644 --- a/addons/refuel/XEH_preInit.sqf +++ b/addons/refuel/XEH_preInit.sqf @@ -8,16 +8,20 @@ PREP(canDisconnect); PREP(canRefuel); PREP(canTakeNozzle); PREP(canTurnOff); +PREP(canTurnOn); PREP(checkFuel); PREP(connectNozzle); PREP(connectNozzleAction); PREP(disconnect); PREP(getFuel); +PREP(handleKilled); +PREP(handleUnconscious); PREP(moduleRefuelSettings); PREP(refuel); PREP(returnNozzle); PREP(setFuel); PREP(takeNozzle); PREP(turnOff); +PREP(turnOn); ADDON = true; diff --git a/addons/refuel/XEH_respawn.sqf b/addons/refuel/XEH_respawn.sqf new file mode 100644 index 0000000000..39225f2521 --- /dev/null +++ b/addons/refuel/XEH_respawn.sqf @@ -0,0 +1,11 @@ +#include "script_component.hpp" + +private ["_unit"]; + +_unit = _this select 0; + +if !(local _unit) exitWith {}; + +[_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); +_unit setVariable [QGVAR(selectedWeaponOnRefuel), nil]; +_unit setVariable [QGVAR(isRefueling), false]; diff --git a/addons/refuel/config.cpp b/addons/refuel/config.cpp index fe5363ecd5..6140cefe8c 100644 --- a/addons/refuel/config.cpp +++ b/addons/refuel/config.cpp @@ -12,6 +12,6 @@ class CfgPatches { }; }; +#include "ACE_Settings.hpp" #include "CfgEventHandlers.hpp" #include "CfgVehicles.hpp" -#include "ACE_Settings.hpp" \ No newline at end of file diff --git a/addons/refuel/functions/fnc_canCheckFuel.sqf b/addons/refuel/functions/fnc_canCheckFuel.sqf index 6d75f49675..b61681ebea 100644 --- a/addons/refuel/functions/fnc_canCheckFuel.sqf +++ b/addons/refuel/functions/fnc_canCheckFuel.sqf @@ -21,5 +21,6 @@ params ["_unit", "_target"]; !(isNull _unit || {!(_unit isKindOf "CAManBase")} || {!local _unit} || + {!alive _target} || {(_target distance _unit) > REFUEL_ACTION_DISTANCE} || - {(_target call FUNC(getFuel) == INFINITE_FUEL)}) + {(_target call FUNC(getFuel) == REFUEL_INFINITE_FUEL)}) diff --git a/addons/refuel/functions/fnc_canTakeNozzle.sqf b/addons/refuel/functions/fnc_canTakeNozzle.sqf index b939778ce8..7e1ad25c3f 100644 --- a/addons/refuel/functions/fnc_canTakeNozzle.sqf +++ b/addons/refuel/functions/fnc_canTakeNozzle.sqf @@ -18,6 +18,10 @@ 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} || + {!alive _target} || + {(_target distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false}; !(_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 c16b8308fd..4ed1b1aa3b 100644 --- a/addons/refuel/functions/fnc_canTurnOff.sqf +++ b/addons/refuel/functions/fnc_canTurnOff.sqf @@ -18,6 +18,9 @@ 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(isRefueling), false]} diff --git a/addons/refuel/functions/fnc_canTurnOn.sqf b/addons/refuel/functions/fnc_canTurnOn.sqf new file mode 100644 index 0000000000..1f81b31ba9 --- /dev/null +++ b/addons/refuel/functions/fnc_canTurnOn.sqf @@ -0,0 +1,31 @@ +/* + * Author: GitHawk + * Check if a unit can turn on a fuel nozzle + * + * Arguments: + * 0: The unit + * 1: The object holding the nozzle + * + * Return Value: + * Can turn on + * + * Example: + * [player, truck] call ace_refuel_fnc_canTurnOn + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit", "_nozzleHolder"]; + +if (isNull _unit || + {!(_unit isKindOf "CAManBase")} || + {!local _unit} || + {(_nozzleHolder distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false}; + +private "_nozzle"; + +_nozzle = _nozzleHolder getVariable [QGVAR(nozzle), objNull]; +(!isNull _nozzle) && + {!(_nozzle getVariable [QGVAR(isRefueling), false])} && + {[_nozzle getVariable QGVAR(source)] call FUNC(getFuel) != 0} diff --git a/addons/refuel/functions/fnc_handleKilled.sqf b/addons/refuel/functions/fnc_handleKilled.sqf new file mode 100644 index 0000000000..7fd8247aab --- /dev/null +++ b/addons/refuel/functions/fnc_handleKilled.sqf @@ -0,0 +1,26 @@ +/* + * Author: GitHawk, Jonpas + * Handles medical on set dead event. + * + * Arguments: + * 0: Unit + * + * Return Value: + * None + * + * Example: + * [unit] call ace_refuel_fnc_handleKilled + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit"]; + +if (!local _unit) exitWith {}; + +_unit setVariable [QGVAR(selectedWeaponOnRefuel), nil]; +_nozzle = _unit setVariable [QGVAR(nozzle), objNull]; +if !(isNull _nozzle) then { + REFUEL_UNIT_DROP_NOZZLE +}; diff --git a/addons/refuel/functions/fnc_handleUnconscious.sqf b/addons/refuel/functions/fnc_handleUnconscious.sqf new file mode 100644 index 0000000000..0a331bb337 --- /dev/null +++ b/addons/refuel/functions/fnc_handleUnconscious.sqf @@ -0,0 +1,29 @@ +/* + * Author: GitHawk, Jonpas + * Handles medical on unconscious event. + * + * Arguments: + * 0: Unit + * 1: Is Unconscious + * + * Return Value: + * None + * + * Example: + * [unit, true] call ace_refuel_fnc_handleUnconscious + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit", "_isUnconscious"]; + +if (!local _unit || {!_isUnconscious}) exitWith {}; + +private "_nozzle"; + +[_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); +_nozzle = _unit setVariable [QGVAR(nozzle), objNull]; +if !(isNull _nozzle) then { + REFUEL_UNIT_DROP_NOZZLE +}; diff --git a/addons/refuel/functions/fnc_refuel.sqf b/addons/refuel/functions/fnc_refuel.sqf index faf4f5883d..37990c7f16 100644 --- a/addons/refuel/functions/fnc_refuel.sqf +++ b/addons/refuel/functions/fnc_refuel.sqf @@ -25,7 +25,7 @@ _rate = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(flo _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(fuelCapacity)); [{ - private ["_source", "_sink", "_fuelInSource", "_fuelInSink", "_finished", "_fueling"]; + private ["_source", "_sink", "_tooFar", "_fuelInSource", "_fuelInSink", "_finished", "_fueling"]; params ["_args", "_pfID"]; _args params ["_unit", "_nozzle", "_rate", "_startFuel", "_maxFuel"]; @@ -34,48 +34,55 @@ _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(f _source = _nozzle getVariable [QGVAR(source), objNull]; _sink = _nozzle getVariable [QGVAR(sink), objNull]; if (isNull _source || - {isNull _sink} || - {(_sink distance (_source modelToWorld (_nozzle getVariable [QGVAR(attachPos), [0,0,0]]))) > 10} || {!alive _source} || + {isNull _sink} || {!alive _sink}) exitWith { - [LSTRING(Hint_TooFar), 2, _unit] call EFUNC(common,displayTextStructured); - detach _nozzle; - _nozzle setPosATL [(getPosATL _nozzle) select 0,(getPosATL _nozzle) select 1, 0]; - _nozzle setVelocity [0, 0, 0]; + REFUEL_DROP_NOZZLE(_nozzle) _nozzle setVariable [QGVAR(isConnected), false, true]; - _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(isRefueling), false, true]; + _tooFar = (_sink distance (_source modelToWorld (_nozzle getVariable [QGVAR(attachPos), [0,0,0]]))) > 10; + if (_tooFar) exitWith { + [LSTRING(Hint_TooFar), 2, _unit] call EFUNC(common,displayTextStructured); + + REFUEL_DROP_NOZZLE(_nozzle) + _nozzle setVariable [QGVAR(isConnected), false, true]; + _nozzle setVariable [QGVAR(sink), objNull, true]; + _sink setVariable [QGVAR(nozzle), objNull, true]; [_pfID] call cba_fnc_removePerFrameHandler; }; - _finished = false; - if !(_fuelInSource == INFINITE_FUEL) then { - _fuelInSource = _fuelInSource - _rate; - }; - if (_fuelInSource < 0 && {_fuelInSource > -1}) then { - _fuelInSource = 0; - _finished = true; - [LSTRING(Hint_Empty), 2, _unit] call EFUNC(common,displayTextStructured); - }; - _fuelInSink = fuel _sink + ( _rate / _maxFuel); - if (_fuelInSink > 1) then { - _fuelInSink = 1; - _finished = true; - [LSTRING(Hint_Completed), 2, _unit] call EFUNC(common,displayTextStructured); + _finished = false; + if (_fueling) then { + _fuelInSource = [_source] call FUNC(getFuel); + if (_fuelInSource == 0) exitWith { + [LSTRING(Hint_SourceEmpty), 2, _unit] call EFUNC(common,displayTextStructured); + _nozzle setVariable [QGVAR(isRefueling), false, true]; + }; + if !(_fuelInSource == REFUEL_INFINITE_FUEL) then { + _fuelInSource = _fuelInSource - _rate; + }; + if (_fuelInSource < 0 && {_fuelInSource > -1}) then { + _fuelInSource = 0; + _finished = true; + [LSTRING(Hint_SourceEmpty), 2, _unit] call EFUNC(common,displayTextStructured); + }; + + _fuelInSink = fuel _sink + ( _rate / _maxFuel); + if (_fuelInSink > 1) then { + _fuelInSink = 1; + _finished = true; + [LSTRING(Hint_Completed), 2, _unit] call EFUNC(common,displayTextStructured); + }; + if !(local _sink) then { + [[_sink, _fuelInSink], QUOTE({(_this select 0) setFuel (_this select 1)}), _sink] call EFUNC(common,execRemoteFnc); + } else { + _sink setFuel _fuelInSink; + }; + [_unit, _source, _fuelInSource] call FUNC(setFuel); }; - if !(local _sink) then { - [[_sink, _fuelInSink], QUOTE({(_this select 0) setFuel (_this select 1)}), _sink] call EFUNC(common,execRemoteFnc); - } else { - _sink setFuel _fuelInSink; - }; - [_unit, _source, _fuelInSource] call FUNC(setFuel); if (_finished || {!_fueling}) exitWith { if !(_fueling) then { @@ -83,8 +90,4 @@ _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(f }; _nozzle setVariable [QGVAR(isRefueling), false, true]; }; - - // display flickers even at 1 second intervals - //["displayTextStructured", [_unit], [[localize LSTRING(Hint_FuelProgress), round((_fuelInSink - _startFuel) * _maxFuel)], 2, _unit]] call EFUNC(common,targetEvent); - //[[LSTRING(Hint_FuelProgress), round((_fuelInSink - _startFuel) * _maxFuel)], 2, _unit] call EFUNC(common,displayTextStructured); }, 1, [_unit, _nozzle, _rate, fuel _target, _maxFuel]] call cba_fnc_addPerFrameHandler; diff --git a/addons/refuel/functions/fnc_returnNozzle.sqf b/addons/refuel/functions/fnc_returnNozzle.sqf index 21571282e6..0423574576 100644 --- a/addons/refuel/functions/fnc_returnNozzle.sqf +++ b/addons/refuel/functions/fnc_returnNozzle.sqf @@ -27,10 +27,9 @@ if (isNil "_nozzle" || {_source != _target}) exitWith {false}; _unit setVariable [QGVAR(nozzle), nil]; detach _nozzle; [_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); -_unit selectWeapon (_unit getVariable QGVAR(selectedWeaponOnRefuel)); -_unit setVariable [QGVAR(selectedWeaponOnRefuel), nil]; -_unit setVariable [QGVAR(isRefueling), false]; +REFUEL_UNHOLSTER_WEAPON +_unit setVariable [QGVAR(isRefueling), false]; _target setVariable [QGVAR(isConnected), false, true]; ropeDestroy (_nozzle getVariable QGVAR(rope)); deleteVehicle _nozzle; diff --git a/addons/refuel/functions/fnc_takeNozzle.sqf b/addons/refuel/functions/fnc_takeNozzle.sqf index 7699c9797c..27234239b8 100644 --- a/addons/refuel/functions/fnc_takeNozzle.sqf +++ b/addons/refuel/functions/fnc_takeNozzle.sqf @@ -22,8 +22,7 @@ params ["_unit", "_target", "_nozzle"]; [_unit, QGVAR(vehAttach), true] call EFUNC(common,setForceWalkStatus); -_unit setVariable [QGVAR(selectedWeaponOnRefuel), currentWeapon _unit]; -_unit action ["SwitchWeapon", _unit, _unit, 99]; +REFUEL_HOLSTER_WEAPON if (isNull _nozzle) then { // func is called on fuel truck _endPosOffset = getArray (configFile >> "CfgVehicles" >> typeOf _target >> "ace_refuel_hooks"); @@ -60,16 +59,8 @@ if (isNull _nozzle) then { // func is called on fuel truck 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]; - - _weaponSelect = _unit getVariable QGVAR(selectedWeaponOnRefuel); - _unit selectWeapon _weaponSelect; - _unit setVariable [QGVAR(selectedWeaponOnRefuel), nil]; + REFUEL_UNIT_DROP_NOZZLE + REFUEL_UNHOLSTER_WEAPON [_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); [LSTRING(Hint_TooFar), 2, _unit] call EFUNC(common,displayTextStructured); diff --git a/addons/refuel/functions/fnc_turnOff.sqf b/addons/refuel/functions/fnc_turnOff.sqf index 7637399878..8600b22646 100644 --- a/addons/refuel/functions/fnc_turnOff.sqf +++ b/addons/refuel/functions/fnc_turnOff.sqf @@ -9,7 +9,7 @@ * None * * Example: - * [player, nozzle] call ace_refuel_fnc_turnOff + * [tank] call ace_refuel_fnc_turnOff * * Public: No */ diff --git a/addons/refuel/functions/fnc_turnOn.sqf b/addons/refuel/functions/fnc_turnOn.sqf new file mode 100644 index 0000000000..8492540cbd --- /dev/null +++ b/addons/refuel/functions/fnc_turnOn.sqf @@ -0,0 +1,20 @@ +/* + * Author: GitHawk + * Turn on a fuel nozzle + * + * Arguments: + * 0: The object holding the nozzle + * + * Return Value: + * None + * + * Example: + * [tank] call ace_refuel_fnc_turnOn + * + * Public: No + */ +#include "script_component.hpp" + +params ["_nozzleHolder"]; + +(_nozzleHolder getVariable QGVAR(nozzle)) setVariable [QGVAR(isRefueling), true, true]; diff --git a/addons/refuel/script_component.hpp b/addons/refuel/script_component.hpp index fb0afb9ba4..f30389ba72 100644 --- a/addons/refuel/script_component.hpp +++ b/addons/refuel/script_component.hpp @@ -11,5 +11,26 @@ #include "\z\ace\addons\main\script_macros.hpp" -#define INFINITE_FUEL -1 +#define REFUEL_INFINITE_FUEL -1 #define REFUEL_ACTION_DISTANCE 7 + +#define REFUEL_DROP_NOZZLE(obj) \ + detach _nozzle; \ + _nozzle setPosATL [(getPosATL obj) select 0,(getPosATL obj) select 1, 0]; \ + _nozzle setVelocity [0,0,0]; \ + _nozzle setVariable [QGVAR(isRefueling), false, true]; + + +#define REFUEL_UNIT_DROP_NOZZLE \ + REFUEL_DROP_NOZZLE(_unit) \ + _unit setVariable [QGVAR(isRefueling), false]; \ + _unit setVariable [QGVAR(nozzle), objNull]; + +#define REFUEL_HOLSTER_WEAPON \ + _unit setVariable [QGVAR(selectedWeaponOnRefuel), currentWeapon _unit]; \ + _unit action ["SwitchWeapon", _unit, _unit, 99]; + +#define REFUEL_UNHOLSTER_WEAPON \ + _weaponSelect = _unit getVariable QGVAR(selectedWeaponOnRefuel); \ + _unit selectWeapon _weaponSelect; \ + _unit setVariable [QGVAR(selectedWeaponOnRefuel), nil]; diff --git a/addons/refuel/stringtable.xml b/addons/refuel/stringtable.xml index 61adcc0890..276771f669 100644 --- a/addons/refuel/stringtable.xml +++ b/addons/refuel/stringtable.xml @@ -65,6 +65,10 @@ Stop fueling Betankung anhalten + + Start fueling + Betankung beginnen + %1 Liters fueled %1 Liters getankt From f852eb5f4bca9496963d85190f9f69f52410011b Mon Sep 17 00:00:00 2001 From: IngoKauffmann Date: Tue, 18 Aug 2015 23:48:25 +0200 Subject: [PATCH 18/25] Moved compatibility stuff --- addons/refuel/CfgVehicles.hpp | 169 --------------------- optionals/compat_bwa3/CfgVehicles.hpp | 11 ++ optionals/compat_bwa3/config.cpp | 5 +- optionals/compat_rhs_afrf3/CfgVehicles.hpp | 78 +++++++++- optionals/compat_rhs_afrf3/config.cpp | 4 +- optionals/compat_rhs_usf3/CfgVehicles.hpp | 66 +++++++- optionals/compat_rhs_usf3/config.cpp | 4 +- 7 files changed, 159 insertions(+), 178 deletions(-) create mode 100644 optionals/compat_bwa3/CfgVehicles.hpp diff --git a/addons/refuel/CfgVehicles.hpp b/addons/refuel/CfgVehicles.hpp index 0e7aacafa0..275e66ab77 100644 --- a/addons/refuel/CfgVehicles.hpp +++ b/addons/refuel/CfgVehicles.hpp @@ -523,20 +523,6 @@ class CfgVehicles { Barrel6 : BarrelBase 100 Wooden_barrel : BarrelBase 100 Wooden_barrels : Wooden_barrel 400 - - // Warfare points - Base_WarfareBVehicleServicePoint : WarfareBBaseStructure 3000 - Land_StorageBladder_01_F : StorageBladder_base_F 60000 - Land_FlexibleTank_01_F : FlexibleTank_base_F 300 - - // Mods - rhsusf_M978A2_usarmy_wd : rhsusf_M977A2_usarmy_wd 10000 - rhsusf_M978A2_CPK_usarmy_wd : rhsusf_M978A2_usarmy_wd 10000 - RHS_Ural_Fuel_MSV_01 : RHS_Ural_Support_MSV_Base_01 10000 - RHS_Ural_Fuel_VDV_01 : RHS_Ural_Fuel_MSV_01 10000 - RHS_Ural_Fuel_VMF_01 : RHS_Ural_Fuel_MSV_01 10000 - RHS_Ural_Fuel_VV_01 : RHS_Ural_Fuel_MSV_01 10000 - LOP_UA_Ural_fuel : RHS_Ural_Fuel_VV_01 10000 */ // Trucks @@ -623,159 +609,4 @@ class CfgVehicles { // Src: http://www.thaitechnics.com/aircraft/L159.html 1551kg / 0.81 kg/L = 1914L // Src: https://en.wikipedia.org/wiki/Yakovlev_Yak-130 1700kg / 0.81 kg/L = 2099L // Src: http://www.adcom-systems.com/ENG/UAV/YAHBON-R2/Overview.html 270L - - // BWMod - class BWA3_Puma_base: Tank_F { - // Assuming 1 L/km - GVAR(fuelCapacity) = 700; - }; - - class BWA3_Leopard_base: Tank_F { - GVAR(fuelCapacity) = 1160; - }; - - // RHS - class RHS_UH1_Base : Heli_light_03_base_F { - GVAR(fuelCapacity) = 1447; - }; - - class RHS_UH60_Base : Heli_Transport_01_base_F { - GVAR(fuelCapacity) = 1360; - }; - - class RHS_CH_47F_base : Heli_Transport_02_base_F { - GVAR(fuelCapacity) = 3914; - }; - - class RHS_AH1Z_base : Heli_Attack_01_base_F { - GVAR(fuelCapacity) = 1600; - }; - class RHS_AH64_base : Heli_Attack_01_base_F { - GVAR(fuelCapacity) = 1420; - }; - - class rhsusf_m1a1tank_base : MBT_01_base_F { - GVAR(fuelCapacity) = 1909; - }; - - class rhsusf_m109tank_base : MBT_01_arty_base_F { - GVAR(fuelCapacity) = 511; - }; - - class rhsusf_hmmwe_base : MRAP_01_base_F { - GVAR(fuelCapacity) = 95; - }; - - class rhsusf_rg33_base : MRAP_01_base_F { - GVAR(fuelCapacity) = 302; - }; - - class rhsusf_fmtv_base : Truck_01_base_F { - GVAR(fuelCapacity) = 219; - }; - - class rhsusf_m113_tank_base : APC_Tracked_02_base_F { - GVAR(fuelCapacity) = 360; - }; - - class RHS_M2A2_Base : APC_Tracked_03_base_F { - GVAR(fuelCapacity) = 746; - }; - - class RHS_A10 : Plane_CAS_01_base_F { - GVAR(fuelCapacity) = 6223; - }; - - class RHS_C130J_Base : Plane_Base_F { - GVAR(fuelCapacity) = 25704; - }; - - class O_Plane_CAS_02_F : Plane_CAS_02_base_F {}; - class RHS_su25_base : O_Plane_CAS_02_F { - GVAR(fuelCapacity) = 3600; - }; - - class RHS_Mi8_base : Heli_Light_02_base_F { - GVAR(fuelCapacity) = 3700; - }; - - class RHS_Ka52_base : Heli_Attack_02_base_F { - GVAR(fuelCapacity) = 1870; - }; - - class RHS_Mi24_base : Heli_Attack_02_base_F { - GVAR(fuelCapacity) = 1851; - }; - - class rhs_bmp3tank_base : Tank_F { - // Assuming same as BMP1/2 - GVAR(fuelCapacity) = 460; - }; - - class a3t72tank_base : Tank_F { - GVAR(fuelCapacity) = 1200; - }; - - class rhs_tank_base : Tank_F { - GVAR(fuelCapacity) = 1200; - }; - class rhs_t80b : rhs_tank_base { - GVAR(fuelCapacity) = 1100; - }; - - class RHS_Ural_BaseTurret : Truck_F { - GVAR(fuelCapacity) = 360; - }; - - class rhs_tigr_base : MRAP_02_base_F { - GVAR(fuelCapacity) = 138; - }; - - class RHS_UAZ_Base : Offroad_01_base_f { - GVAR(fuelCapacity) = 78; - }; - - class rhs_zsutank_base : APC_Tracked_02_base_F { - GVAR(fuelCapacity) = 515; - }; - - class rhs_bmp1tank_base : Tank_F { - GVAR(fuelCapacity) = 460; - }; - - class rhs_truck : Truck_F { - GVAR(fuelCapacity) = 210; - }; - - class rhs_btr_base : Wheeled_Apc_F {}; - class rhs_btr60_base : rhs_btr_base { - GVAR(fuelCapacity) = 290; - }; - class rhs_btr70_vmf : rhs_btr_base { - GVAR(fuelCapacity) = 350; - }; - - class rhs_btr70_msv : rhs_btr70_vmf {}; - - class rhs_btr80_msv : rhs_btr70_msv { - GVAR(fuelCapacity) = 300; - }; - - class rhs_a3spruttank_base : Tank_F { - // BMD4 / 2S25 - GVAR(fuelCapacity) = 400; - }; - - class rhs_bmd_base : Tank_F { - GVAR(fuelCapacity) = 300; - }; - - class rhs_2s3tank_base : Tank_F { - GVAR(fuelCapacity) = 830; - }; - - class OTR21_Base : Truck_F { - // No info about ballistic carrier ;-) - GVAR(fuelCapacity) = 500; - }; }; diff --git a/optionals/compat_bwa3/CfgVehicles.hpp b/optionals/compat_bwa3/CfgVehicles.hpp new file mode 100644 index 0000000000..bdcebdab9d --- /dev/null +++ b/optionals/compat_bwa3/CfgVehicles.hpp @@ -0,0 +1,11 @@ +class CfgVehicles { + class Tank_F; + class BWA3_Puma_base: Tank_F { + // Assuming 1 L/km + EGVAR(refuel,fuelCapacity) = 700; + }; + + class BWA3_Leopard_base: Tank_F { + EGVAR(refuel,fuelCapacity) = 1160; + }; +}; diff --git a/optionals/compat_bwa3/config.cpp b/optionals/compat_bwa3/config.cpp index efdebaf616..5f9c254235 100644 --- a/optionals/compat_bwa3/config.cpp +++ b/optionals/compat_bwa3/config.cpp @@ -5,8 +5,8 @@ class CfgPatches { units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"BWA3_Weapons"}; - author[]={"Ruthberg"}; + requiredAddons[] = {"BWA3_Weapons","BWA3_Tracked"}; + author[]={"Ruthberg", "GitHawk"}; VERSION_CONFIG; }; }; @@ -14,3 +14,4 @@ class CfgPatches { #include "CfgAmmo.hpp" #include "CfgWeapons.hpp" #include "CfgMagazines.hpp" +#include "CfgVehicles.hpp" diff --git a/optionals/compat_rhs_afrf3/CfgVehicles.hpp b/optionals/compat_rhs_afrf3/CfgVehicles.hpp index e9c71f4da7..963913d74d 100644 --- a/optionals/compat_rhs_afrf3/CfgVehicles.hpp +++ b/optionals/compat_rhs_afrf3/CfgVehicles.hpp @@ -28,6 +28,7 @@ class cfgVehicles { class CommanderOptics; }; class rhs_bmd_base: Tank_F { + EGVAR(refuel,fuelCapacity) = 300; class Turrets: Turrets { class CommanderOptics: NewTurret { ace_fcs_Enabled = 0; @@ -41,6 +42,7 @@ class cfgVehicles { }; }; class rhs_bmp1tank_base: Tank_F { + EGVAR(refuel,fuelCapacity) = 460; class Turrets: Turrets { class MainTurret: MainTurret { ace_fcs_Enabled = 0; @@ -57,13 +59,14 @@ class cfgVehicles { class MainTurret: MainTurret { class Turrets: Turrets { class CommanderOptics : CommanderOptics { - ace_fcs_Enabled = 0; + ace_fcs_Enabled = 0; }; }; }; }; }; class rhs_bmp3tank_base: Tank_F { + EGVAR(refuel,fuelCapacity) = 460; class Turrets: Turrets { class MainTurret: MainTurret { ace_fcs_Enabled = 0; @@ -79,6 +82,7 @@ class cfgVehicles { }; }; class rhs_btr_base: Wheeled_APC_F { + EGVAR(refuel,fuelCapacity) = 300; class Turrets: Turrets { class MainTurret: MainTurret { ace_fcs_Enabled = 0; @@ -89,6 +93,7 @@ class cfgVehicles { }; }; class rhs_a3spruttank_base: Tank_F { + EGVAR(refuel,fuelCapacity) = 400; class Turrets: Turrets { class MainTurret: MainTurret { ace_fcs_Enabled = 0; @@ -105,6 +110,7 @@ class cfgVehicles { }; }; class rhs_a3t72tank_base: Tank_F { + EGVAR(refuel,fuelCapacity) = 1200; class Turrets: Turrets { class MainTurret: MainTurret { ace_fcs_Enabled = 0; @@ -133,6 +139,7 @@ class cfgVehicles { }; }; class rhs_tank_base: Tank_F { + EGVAR(refuel,fuelCapacity) = 1200; class Turrets: Turrets { class MainTurret: MainTurret { ace_fcs_Enabled = 0; @@ -153,4 +160,71 @@ class cfgVehicles { { ace_gforcecoef = 0.55; }; -}; \ No newline at end of file + + class O_Plane_CAS_02_F; + class RHS_su25_base : O_Plane_CAS_02_F { + EGVAR(refuel,fuelCapacity) = 3600; + }; + + class Heli_Light_02_base_F; + class RHS_Mi8_base : Heli_Light_02_base_F { + EGVAR(refuel,fuelCapacity) = 3700; + }; + + class Heli_Attack_02_base_F; + class RHS_Ka52_base : Heli_Attack_02_base_F { + EGVAR(refuel,fuelCapacity) = 1870; + }; + + class RHS_Mi24_base : Heli_Attack_02_base_F { + EGVAR(refuel,fuelCapacity) = 1851; + }; + + class rhs_t80b : rhs_tank_base { + EGVAR(refuel,fuelCapacity) = 1100; + }; + + class Truck_F; + class RHS_Ural_BaseTurret : Truck_F { + EGVAR(refuel,fuelCapacity) = 360; + }; + + class rhs_truck : Truck_F { + EGVAR(refuel,fuelCapacity) = 210; + }; + + class MRAP_02_base_F; + class rhs_tigr_base : MRAP_02_base_F { + EGVAR(refuel,fuelCapacity) = 138; + }; + + class Offroad_01_base_f; + class RHS_UAZ_Base : Offroad_01_base_f { + EGVAR(refuel,fuelCapacity) = 78; + }; + + class APC_Tracked_02_base_F; + class rhs_zsutank_base : APC_Tracked_02_base_F { + EGVAR(refuel,fuelCapacity) = 515; + }; + + class rhs_btr60_base : rhs_btr_base { + EGVAR(refuel,fuelCapacity) = 290; + }; + class rhs_btr70_vmf : rhs_btr_base { + EGVAR(refuel,fuelCapacity) = 350; + }; + + class rhs_btr70_msv : rhs_btr70_vmf {}; + class rhs_btr80_msv : rhs_btr70_msv { + EGVAR(refuel,fuelCapacity) = 300; + }; + + class rhs_2s3tank_base : Tank_F { + EGVAR(refuel,fuelCapacity) = 830; + }; + + class OTR21_Base : Truck_F { + EGVAR(refuel,fuelCapacity) = 500; + }; +}; diff --git a/optionals/compat_rhs_afrf3/config.cpp b/optionals/compat_rhs_afrf3/config.cpp index 123f80b566..aa9d6bed95 100644 --- a/optionals/compat_rhs_afrf3/config.cpp +++ b/optionals/compat_rhs_afrf3/config.cpp @@ -6,7 +6,7 @@ class CfgPatches { weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"rhs_c_weapons", "rhs_c_troops"}; - author[]={"Ruthberg"}; + author[]={"Ruthberg", "GitHawk"}; VERSION_CONFIG; }; }; @@ -14,4 +14,4 @@ class CfgPatches { #include "CfgAmmo.hpp" #include "CfgMagazines.hpp" #include "CfgWeapons.hpp" -#include "CfgVehicles.hpp" \ No newline at end of file +#include "CfgVehicles.hpp" diff --git a/optionals/compat_rhs_usf3/CfgVehicles.hpp b/optionals/compat_rhs_usf3/CfgVehicles.hpp index 2be7a8076e..3c56b91aa9 100644 --- a/optionals/compat_rhs_usf3/CfgVehicles.hpp +++ b/optionals/compat_rhs_usf3/CfgVehicles.hpp @@ -15,6 +15,7 @@ class cfgVehicles { class MBT_01_base_F: Tank_F {}; class rhsusf_m1a1tank_base: MBT_01_base_F { + EGVAR(refuel,fuelCapacity) = 1909; class Turrets: Turrets { class MainTurret: MainTurret { ace_fcs_Enabled = 0; @@ -29,4 +30,67 @@ class cfgVehicles { }; }; }; -}; \ No newline at end of file + + class Heli_light_03_base_F; + class RHS_UH1_Base : Heli_light_03_base_F { + EGVAR(refuel,fuelCapacity) = 1447; + }; + + class Heli_Transport_01_base_F; + class RHS_UH60_Base : Heli_Transport_01_base_F { + EGVAR(refuel,fuelCapacity) = 1360; + }; + + class Heli_Transport_02_base_F; + class RHS_CH_47F_base : Heli_Transport_02_base_F { + EGVAR(refuel,fuelCapacity) = 3914; + }; + + class Heli_Attack_01_base_F; + class RHS_AH1Z_base : Heli_Attack_01_base_F { + EGVAR(refuel,fuelCapacity) = 1600; + }; + + class RHS_AH64_base : Heli_Attack_01_base_F { + EGVAR(refuel,fuelCapacity) = 1420; + }; + + class MBT_01_arty_base_F; + class rhsusf_m109tank_base : MBT_01_arty_base_F { + EGVAR(refuel,fuelCapacity) = 511; + }; + + class MRAP_01_base_F; + class rhsusf_hmmwe_base : MRAP_01_base_F { + EGVAR(refuel,fuelCapacity) = 95; + }; + + class rhsusf_rg33_base : MRAP_01_base_F { + EGVAR(refuel,fuelCapacity) = 302; + }; + + class Truck_01_base_F; + class rhsusf_fmtv_base : Truck_01_base_F { + EGVAR(refuel,fuelCapacity) = 219; + }; + + class APC_Tracked_02_base_F; + class rhsusf_m113_tank_base : APC_Tracked_02_base_F { + EGVAR(refuel,fuelCapacity) = 360; + }; + + class APC_Tracked_03_base_F; + class RHS_M2A2_Base : APC_Tracked_03_base_F { + EGVAR(refuel,fuelCapacity) = 746; + }; + + class Plane_CAS_01_base_F; + class RHS_A10 : Plane_CAS_01_base_F { + EGVAR(refuel,fuelCapacity) = 6223; + }; + + class Plane_Base_F; + class RHS_C130J_Base : Plane_Base_F { + EGVAR(refuel,fuelCapacity) = 25704; + }; +}; diff --git a/optionals/compat_rhs_usf3/config.cpp b/optionals/compat_rhs_usf3/config.cpp index 3e9aee6ec7..59517ed64f 100644 --- a/optionals/compat_rhs_usf3/config.cpp +++ b/optionals/compat_rhs_usf3/config.cpp @@ -6,7 +6,7 @@ class CfgPatches { weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"rhsusf_c_weapons", "rhsusf_c_troops"}; - author[]={"Ruthberg"}; + author[]={"Ruthberg", "GitHawk"}; VERSION_CONFIG; }; }; @@ -14,4 +14,4 @@ class CfgPatches { #include "CfgAmmo.hpp" #include "CfgMagazines.hpp" #include "CfgWeapons.hpp" -#include "CfgVehicles.hpp" \ No newline at end of file +#include "CfgVehicles.hpp" From f44060c6a070683a7899a0c3ddb5ff048e3d2263 Mon Sep 17 00:00:00 2001 From: IngoKauffmann Date: Thu, 20 Aug 2015 22:10:26 +0200 Subject: [PATCH 19/25] Cleanup and improvements --- addons/refuel/ACE_Settings.hpp | 1 - addons/refuel/CfgVehicles.hpp | 87 ++++++++++--------- addons/refuel/XEH_preInit.sqf | 2 +- addons/refuel/functions/fnc_canCheckFuel.sqf | 2 +- .../refuel/functions/fnc_canConnectNozzle.sqf | 10 ++- addons/refuel/functions/fnc_canDisconnect.sqf | 22 ++--- addons/refuel/functions/fnc_canRefuel.sqf | 24 ----- .../refuel/functions/fnc_canReturnNozzle.sqf | 24 +++++ addons/refuel/functions/fnc_canTakeNozzle.sqf | 6 +- addons/refuel/functions/fnc_canTurnOff.sqf | 13 +-- addons/refuel/functions/fnc_canTurnOn.sqf | 21 +++-- addons/refuel/functions/fnc_checkFuel.sqf | 4 +- addons/refuel/functions/fnc_connectNozzle.sqf | 21 +++-- .../functions/fnc_connectNozzleAction.sqf | 24 +++-- addons/refuel/functions/fnc_disconnect.sqf | 19 ++-- addons/refuel/functions/fnc_handleKilled.sqf | 2 +- .../functions/fnc_handleUnconscious.sqf | 2 +- .../functions/fnc_moduleRefuelSettings.sqf | 2 +- addons/refuel/functions/fnc_refuel.sqf | 50 ++++++----- addons/refuel/functions/fnc_returnNozzle.sqf | 5 +- addons/refuel/functions/fnc_setFuel.sqf | 8 +- addons/refuel/functions/fnc_takeNozzle.sqf | 71 +++++++-------- addons/refuel/functions/fnc_turnOff.sqf | 12 +-- addons/refuel/functions/fnc_turnOn.sqf | 12 +-- addons/refuel/stringtable.xml | 14 ++- 25 files changed, 234 insertions(+), 224 deletions(-) delete mode 100644 addons/refuel/functions/fnc_canRefuel.sqf create mode 100644 addons/refuel/functions/fnc_canReturnNozzle.sqf diff --git a/addons/refuel/ACE_Settings.hpp b/addons/refuel/ACE_Settings.hpp index 04f1f48fe8..0ae0accaad 100644 --- a/addons/refuel/ACE_Settings.hpp +++ b/addons/refuel/ACE_Settings.hpp @@ -4,6 +4,5 @@ class ACE_Settings { description = CSTRING(RefuelSettings_speed_Description); value = 1; typeName = "SCALAR"; - values[] = {CSTRING(RefuelSettings_basic), CSTRING(RefuelSettings_advanced)}; }; }; diff --git a/addons/refuel/CfgVehicles.hpp b/addons/refuel/CfgVehicles.hpp index 275e66ab77..94c8632ee2 100644 --- a/addons/refuel/CfgVehicles.hpp +++ b/addons/refuel/CfgVehicles.hpp @@ -16,9 +16,16 @@ exceptions[] = {"isNotInside"}; \ icon = PATHTOF(ui\icon_refuel_interact.paa); \ }; \ + class GVAR(Connect) { \ + displayName = CSTRING(Connect); \ + condition = QUOTE([ARR_2(_player,_target)] call FUNC(canConnectNozzle)); \ + statement = QUOTE([ARR_2(_player,_target)] call DFUNC(connectNozzle)); \ + exceptions[] = {"isNotInside"}; \ + icon = PATHTOF(ui\icon_refuel_interact.paa); \ + }; \ class GVAR(Return) { \ displayName = CSTRING(Return); \ - condition = QUOTE([ARR_2(_player,_target)] call FUNC(canConnectNozzle)); \ + condition = QUOTE([ARR_2(_player,_target)] call FUNC(canReturnNozzle)); \ statement = QUOTE([ARR_2(_player,_target)] call DFUNC(returnNozzle)); \ exceptions[] = {"isNotInside"}; \ icon = PATHTOF(ui\icon_refuel_interact.paa); \ @@ -52,27 +59,6 @@ exceptions[] = {"isNotInside"}; \ icon = PATHTOF(ui\icon_refuel_interact.paa); \ }; \ - class GVAR(TurnOn) { \ - displayName = CSTRING(TurnOn); \ - condition = QUOTE([ARR_2(_player,_target)] call FUNC(canTurnOn)); \ - statement = QUOTE([_target] call DFUNC(turnOn)); \ - exceptions[] = {"isNotInside"}; \ - icon = PATHTOF(ui\icon_refuel_interact.paa); \ - }; \ - class GVAR(Disconnect) { \ - displayName = CSTRING(Disconnect); \ - condition = QUOTE([ARR_2(_player,_target)] call FUNC(canDisconnect)); \ - statement = QUOTE([ARR_2(_player,_target)] call DFUNC(disconnect)); \ - exceptions[] = {"isNotInside"}; \ - icon = PATHTOF(ui\icon_refuel_interact.paa); \ - }; \ - class GVAR(TurnOff) { \ - displayName = CSTRING(TurnOff); \ - condition = QUOTE([ARR_2(_player,_target)] call FUNC(canTurnOff)); \ - statement = QUOTE([_target] call DFUNC(turnOff)); \ - exceptions[] = {"isNotInside"}; \ - icon = PATHTOF(ui\icon_refuel_interact.paa); \ - }; \ }; \ }; \ }; @@ -80,12 +66,41 @@ #define MACRO_NOZZLE_ACTIONS \ class ACE_Actions { \ class ACE_MainActions { \ - displayName = CSTRING(TakeNozzle); \ - distance = 2; \ - condition = QUOTE([ARR_2(_player,_target)] call FUNC(canTakeNozzle)); \ - statement = QUOTE([ARR_3(_player,_target,_target)] call FUNC(TakeNozzle)); \ - exceptions[] = {"isNotInside"}; \ + displayName = CSTRING(Refuel); \ + distance = 3; \ + condition = "true"; \ + statement = ""; \ + showDisabled = 0; \ + priority = 2; \ icon = PATHTOF(ui\icon_refuel_interact.paa); \ + class GVAR(PickUpNozzle) { \ + displayName = CSTRING(TakeNozzle); \ + condition = QUOTE([ARR_2(_player,_target)] call FUNC(canTakeNozzle)); \ + statement = QUOTE([ARR_3(_player,_target,_target)] call FUNC(TakeNozzle)); \ + exceptions[] = {"isNotInside"}; \ + icon = PATHTOF(ui\icon_refuel_interact.paa); \ + }; \ + class GVAR(TurnOn) { \ + displayName = CSTRING(TurnOn); \ + condition = QUOTE([ARR_2(_player,_target)] call FUNC(canTurnOn)); \ + statement = QUOTE([ARR_2(_player,_target)] call DFUNC(turnOn)); \ + exceptions[] = {"isNotInside"}; \ + icon = PATHTOF(ui\icon_refuel_interact.paa); \ + }; \ + class GVAR(TurnOff) { \ + displayName = CSTRING(TurnOff); \ + condition = QUOTE([ARR_2(_player,_target)] call FUNC(canTurnOff)); \ + statement = QUOTE([ARR_2(_player,_target)] call DFUNC(turnOff)); \ + exceptions[] = {"isNotInside"}; \ + icon = PATHTOF(ui\icon_refuel_interact.paa); \ + }; \ + class GVAR(Disconnect) { \ + displayName = CSTRING(Disconnect); \ + condition = QUOTE([ARR_2(_player,_target)] call FUNC(canDisconnect)); \ + statement = QUOTE([ARR_2(_player,_target)] call DFUNC(disconnect)); \ + exceptions[] = {"isNotInside"}; \ + icon = PATHTOF(ui\icon_refuel_interact.paa); \ + }; \ }; \ }; @@ -106,17 +121,7 @@ class CfgVehicles { displayName = CSTRING(RefuelSettings_speed_DisplayName); description = CSTRING(RefuelSettings_speed_Description); typeName = "NUMBER"; - class values { - class fast { - name = CSTRING(RefuelSettings_basic); - value = 10; - }; - class realistic { - name = CSTRING(RefuelSettings_advanced); - value = 1; - default = 1; - }; - }; + defaultValue = 10; }; }; }; @@ -163,6 +168,7 @@ class CfgVehicles { class Tank : LandVehicle { MACRO_CONNECT_ACTIONS + GVAR(flowRate) = 4; }; class StaticWeapon : LandVehicle { @@ -266,6 +272,7 @@ class CfgVehicles { class Truck_F : Car_F { GVAR(fuelCapacity) = 400; + GVAR(flowRate) = 2; }; class Truck_01_base_F: Truck_F { @@ -499,7 +506,7 @@ class CfgVehicles { XEH_ENABLED; transportFuel = 0; //50k MACRO_REFUEL_ACTIONS - GVAR(hooks[]) = {{0,0,-1}}; + GVAR(hooks[]) = {{0,0,-0.5}}; GVAR(fuelCargo) = REFUEL_INFINITE_FUEL; }; @@ -511,7 +518,7 @@ class CfgVehicles { GVAR(fuelCargo) = REFUEL_INFINITE_FUEL; }; - /* // Barrels from rhs? + /* // Barrels found in config \ BarrelHelper : Misc_thing 100 BarrelBase : BarrelHelper 100 Barrels : BarrelBase 400 diff --git a/addons/refuel/XEH_preInit.sqf b/addons/refuel/XEH_preInit.sqf index d330a88a6e..bc9caebd86 100644 --- a/addons/refuel/XEH_preInit.sqf +++ b/addons/refuel/XEH_preInit.sqf @@ -5,7 +5,7 @@ ADDON = false; PREP(canCheckFuel); PREP(canConnectNozzle); PREP(canDisconnect); -PREP(canRefuel); +PREP(canReturnNozzle); PREP(canTakeNozzle); PREP(canTurnOff); PREP(canTurnOn); diff --git a/addons/refuel/functions/fnc_canCheckFuel.sqf b/addons/refuel/functions/fnc_canCheckFuel.sqf index b61681ebea..bc29c23bf4 100644 --- a/addons/refuel/functions/fnc_canCheckFuel.sqf +++ b/addons/refuel/functions/fnc_canCheckFuel.sqf @@ -4,7 +4,7 @@ * * Arguments: * 0: Unit - * 1: Target + * 1: Fuel Truck/Station * * Return Value: * Can Check Fuel diff --git a/addons/refuel/functions/fnc_canConnectNozzle.sqf b/addons/refuel/functions/fnc_canConnectNozzle.sqf index 0dfd89605b..b87cb88237 100644 --- a/addons/refuel/functions/fnc_canConnectNozzle.sqf +++ b/addons/refuel/functions/fnc_canConnectNozzle.sqf @@ -3,14 +3,14 @@ * Check if a unit can connect a fuel nozzle * * Arguments: - * 0: The unit - * 1: The target + * 0: Unit + * 1: Target * * Return Value: * Can Connect Nozzle * * Example: - * [unit] call ace_refuel_fnc_canConnectNozzle + * [unit, tank] call ace_refuel_fnc_canConnectNozzle * * Public: No */ @@ -21,4 +21,6 @@ params ["_unit", "_target"]; _nozzle = _unit getVariable QGVAR(nozzle); -!(isNil "_nozzle" || {(_target distance _unit) > REFUEL_ACTION_DISTANCE}) +!(isNil "_nozzle" || + {(_target distance _unit) > REFUEL_ACTION_DISTANCE} || + {!isNull (_target getVariable [QGVAR(nozzle), objNull])}) // TODO verify cant connect multiple fuel lines diff --git a/addons/refuel/functions/fnc_canDisconnect.sqf b/addons/refuel/functions/fnc_canDisconnect.sqf index 72d017b50d..50d22702a0 100644 --- a/addons/refuel/functions/fnc_canDisconnect.sqf +++ b/addons/refuel/functions/fnc_canDisconnect.sqf @@ -3,27 +3,27 @@ * Check if a unit can disconnect a fuel nozzle * * Arguments: - * 0: The unit - * 1: The object holding the nozzle + * 0: Unit + * 1: Nozzle * * Return Value: * Can disconnect * * Example: - * [player, truck] call ace_refuel_fnc_canDisconnect + * [player, nozzle] call ace_refuel_fnc_canDisconnect * * Public: No */ #include "script_component.hpp" -private ["_nozzle", "_sink"]; -params ["_unit", "_nozzleHolder"]; +private ["_sink"]; +params ["_unit", "_nozzle"]; -if (isNull _unit || {!(_unit isKindOf "CAManBase")} || {!local _unit} || {(_nozzleHolder distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false}; - -_nozzle = _nozzleHolder getVariable [QGVAR(nozzle), objNull]; -if (isNull _nozzle) exitWith {false}; +if (isNull _unit || + {isNull _nozzle} || + {!(_unit isKindOf "CAManBase")} || + {!local _unit} || + {(_nozzle distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false}; _sink = _nozzle getVariable [QGVAR(sink), objNull]; - -!((isNull _sink) || {_nozzle getVariable [QGVAR(isRefueling), false]}); +!((isNull _sink) || {_nozzle getVariable [QGVAR(isRefueling), false]}) diff --git a/addons/refuel/functions/fnc_canRefuel.sqf b/addons/refuel/functions/fnc_canRefuel.sqf deleted file mode 100644 index 47ef651f88..0000000000 --- a/addons/refuel/functions/fnc_canRefuel.sqf +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Author: GitHawk - * Check if a unit can refuel - * - * Arguments: - * 0: The target - * - * Return Value: - * Can refuel - * - * Example: - * [unit, target] call ace_refuel_fnc_canRefuel - * - * Public: No - */ -#include "script_component.hpp" -private ["_fuel"]; -params ["_unit", "_target"]; - -if (isNull _unit || {!(_unit isKindOf "CAManBase")} || {!local _unit} || {(_target distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false}; - -_fuel = [_target] call FUNC(getFuel); - -(_fuel > 0 || {_fuel == -1}) diff --git a/addons/refuel/functions/fnc_canReturnNozzle.sqf b/addons/refuel/functions/fnc_canReturnNozzle.sqf new file mode 100644 index 0000000000..f3cb2a65e7 --- /dev/null +++ b/addons/refuel/functions/fnc_canReturnNozzle.sqf @@ -0,0 +1,24 @@ +/* + * Author: GitHawk + * Check if a unit can return a fuel nozzle + * + * Arguments: + * 0: Unit + * 1: Target + * + * Return Value: + * Can Return Nozzle + * + * Example: + * [unit, tank] call ace_refuel_fnc_canReturnNozzle + * + * Public: No + */ +#include "script_component.hpp" + +private ["_nozzle"]; +params ["_unit", "_target"]; + +_nozzle = _unit getVariable QGVAR(nozzle); + +(_this call FUNC(canConnectNozzle)) && {_target == (_nozzle getVariable [QGVAR(source), objNull])} diff --git a/addons/refuel/functions/fnc_canTakeNozzle.sqf b/addons/refuel/functions/fnc_canTakeNozzle.sqf index 7e1ad25c3f..85f5b815a5 100644 --- a/addons/refuel/functions/fnc_canTakeNozzle.sqf +++ b/addons/refuel/functions/fnc_canTakeNozzle.sqf @@ -3,14 +3,14 @@ * Check if a unit can take a fuel nozzle * * Arguments: - * 0: The unit - * 1: The target + * 0: Unit + * 1: Fuel Station or Nozzle * * Return Value: * Can connect * * Example: - * [player, target] call ace_refuel_fnc_canTakeNozzle + * [player, nozzle] call ace_refuel_fnc_canTakeNozzle * * Public: No */ diff --git a/addons/refuel/functions/fnc_canTurnOff.sqf b/addons/refuel/functions/fnc_canTurnOff.sqf index 4ed1b1aa3b..7d2d3652e0 100644 --- a/addons/refuel/functions/fnc_canTurnOff.sqf +++ b/addons/refuel/functions/fnc_canTurnOff.sqf @@ -3,24 +3,25 @@ * Check if a unit can turn off a fuel nozzle * * Arguments: - * 0: The unit - * 1: The object holding the nozzle + * 0: Unit + * 1: Nozzle * * Return Value: * Can turn off * * Example: - * [player, truck] call ace_refuel_fnc_canTurnOff + * [player, nozzle] call ace_refuel_fnc_canTurnOff * * Public: No */ #include "script_component.hpp" -params ["_unit", "_nozzleHolder"]; +params ["_unit", "_nozzle"]; if (isNull _unit || + {isNull _nozzle} || {!(_unit isKindOf "CAManBase")} || {!local _unit} || - {(_nozzleHolder distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false}; + {(_nozzle distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false}; -!(isNull (_nozzleHolder getVariable [QGVAR(nozzle), objNull])) && {(_nozzleHolder getVariable QGVAR(nozzle)) getVariable [QGVAR(isRefueling), false]} +(_nozzle getVariable [QGVAR(isRefueling), false]) diff --git a/addons/refuel/functions/fnc_canTurnOn.sqf b/addons/refuel/functions/fnc_canTurnOn.sqf index 1f81b31ba9..3053e699a2 100644 --- a/addons/refuel/functions/fnc_canTurnOn.sqf +++ b/addons/refuel/functions/fnc_canTurnOn.sqf @@ -3,29 +3,28 @@ * Check if a unit can turn on a fuel nozzle * * Arguments: - * 0: The unit - * 1: The object holding the nozzle + * 0: Unit + * 1: Nozzle * * Return Value: * Can turn on * * Example: - * [player, truck] call ace_refuel_fnc_canTurnOn + * [player, nozzle] call ace_refuel_fnc_canTurnOn * * Public: No */ #include "script_component.hpp" -params ["_unit", "_nozzleHolder"]; +params ["_unit", "_nozzle"]; if (isNull _unit || + {isNull _nozzle} || {!(_unit isKindOf "CAManBase")} || {!local _unit} || - {(_nozzleHolder distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false}; + {(_nozzle distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false}; -private "_nozzle"; - -_nozzle = _nozzleHolder getVariable [QGVAR(nozzle), objNull]; -(!isNull _nozzle) && - {!(_nozzle getVariable [QGVAR(isRefueling), false])} && - {[_nozzle getVariable QGVAR(source)] call FUNC(getFuel) != 0} +!(_nozzle getVariable [QGVAR(isRefueling), false]) && + {[_nozzle getVariable QGVAR(source)] call FUNC(getFuel) != 0} && + {!isNull (_nozzle getVariable [QGVAR(sink), objNull])} && + {(fuel (_nozzle getVariable QGVAR(sink))) < 1} diff --git a/addons/refuel/functions/fnc_checkFuel.sqf b/addons/refuel/functions/fnc_checkFuel.sqf index 51af1f8df4..0f26453920 100644 --- a/addons/refuel/functions/fnc_checkFuel.sqf +++ b/addons/refuel/functions/fnc_checkFuel.sqf @@ -3,8 +3,8 @@ * Get the remaining fuel amount * * Arguments: - * 0: The unit - * 1: The target + * 0: Unit + * 1: Fuel Truck * * Return Value: * None diff --git a/addons/refuel/functions/fnc_connectNozzle.sqf b/addons/refuel/functions/fnc_connectNozzle.sqf index 2f17584882..261527bc3f 100644 --- a/addons/refuel/functions/fnc_connectNozzle.sqf +++ b/addons/refuel/functions/fnc_connectNozzle.sqf @@ -1,18 +1,17 @@ /* * Author: GitHawk et.al. - * Connect a fuel nozzle + * Connect a fuel nozzle. * With code from ace_attach * * Arguments: - * 0: The unit - * 1: The target - * 2: The nozzle (optional) + * 0: Unit + * 1: Target * * Return Value: * None * * Example: - * [unit, target, nozzle] call ace_refuel_fnc_connectNozzle + * [unit, target] call ace_refuel_fnc_connectNozzle * * Public: No */ @@ -35,21 +34,21 @@ _unit setVariable [QGVAR(placeActionEH), [_unit, "DefaultAction", {true}, {GVAR( _actionID = _unit addAction [format ["%1", localize LSTRING(Cancel)], {GVAR(placeAction) = PLACE_CANCEL;}]; -[{ +[{ private["_virtualPos", "_virtualPosASL", "_lineInterection"]; params ["_args","_pfID"]; _args params ["_unit", "_target", "_nozzle", "_actionID"]; - + _virtualPosASL = (eyePos _unit) vectorAdd (positionCameraToWorld [0,0,0.6]) vectorDiff (positionCameraToWorld [0,0,0]); if (cameraView == "EXTERNAL") then { _virtualPosASL = _virtualPosASL vectorAdd ((positionCameraToWorld [0.3,0,0]) vectorDiff (positionCameraToWorld [0,0,0])); }; _virtualPos = _virtualPosASL call EFUNC(common,ASLToPosition); _lineInterection = lineIntersects [eyePos ace_player, _virtualPosASL, ace_player]; - + //Don't allow placing in a bad position: if (_lineInterection && {GVAR(placeAction) == PLACE_APPROVE}) then {GVAR(placeAction) = PLACE_WAITING;}; - + if ((GVAR(placeAction) != PLACE_WAITING) || {_unit != ace_player} || {!([_unit, _target, []] call EFUNC(common,canInteractWith))}) then { @@ -58,9 +57,9 @@ _actionID = _unit addAction [format ["%1", localize LSTRI [] call EFUNC(interaction,hideMouseHint); [_unit, "DefaultAction", (_unit getVariable [QGVAR(placeActionEH), -1])] call EFUNC(common,removeActionEventHandler); _unit removeAction _actionID; - + if (GVAR(placeAction) == PLACE_APPROVE) then { [_unit, _target, _virtualPos, _nozzle] call FUNC(ConnectNozzleAction); }; }; // TODO add model like in attach/functions/fnc_attach -}, 0, [_unit, _target, _nozzle, _actionID] ] call cba_fnc_addPerFrameHandler; \ No newline at end of file +}, 0, [_unit, _target, _nozzle, _actionID] ] call cba_fnc_addPerFrameHandler; diff --git a/addons/refuel/functions/fnc_connectNozzleAction.sqf b/addons/refuel/functions/fnc_connectNozzleAction.sqf index bd7cce74ac..44d0f4ebf4 100644 --- a/addons/refuel/functions/fnc_connectNozzleAction.sqf +++ b/addons/refuel/functions/fnc_connectNozzleAction.sqf @@ -1,13 +1,13 @@ /* - * Author: GitHawk et.al - * Calculates a connection for tilting + * Author: GitHawk et.al. + * Calculates a connection for refueling. * With code from ace_attach * * Arguments: - * 0: The player - * 1: The target - * 2: The visual position - * 3: The nozzle + * 0: Unit + * 1: Target + * 2: Visual Position + * 3: Nozzle * * Return Value: * None @@ -74,18 +74,14 @@ _endPosTestOffset set [2, (_startingOffset select 2)]; // TODO put animation and delayed connect ? _unit setVariable [QGVAR(nozzle), nil]; -detach _nozzle; -[_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); - -_weaponSelect = _unit getVariable QGVAR(selectedWeaponOnRefuel); -_unit selectWeapon _weaponSelect; -_unit setVariable [QGVAR(selectedWeaponOnRefuel), nil]; _unit setVariable [QGVAR(isRefueling), false]; +[_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); +REFUEL_UNHOLSTER_WEAPON +detach _nozzle; _nozzle attachTo [_target, _endPosTestOffset]; _nozzle setVariable [QGVAR(sink), _target, true]; -_nozzle setVariable [QGVAR(isRefueling), true, true]; _nozzle setVariable [QGVAR(isConnected), true, true]; _target setVariable [QGVAR(nozzle), _nozzle, true]; -[_unit, _target, _nozzle] call FUNC(refuel); +[_unit, _target, _nozzle, _endPosTestOffset] call FUNC(refuel); diff --git a/addons/refuel/functions/fnc_disconnect.sqf b/addons/refuel/functions/fnc_disconnect.sqf index 1290d90091..69205d13e4 100644 --- a/addons/refuel/functions/fnc_disconnect.sqf +++ b/addons/refuel/functions/fnc_disconnect.sqf @@ -1,10 +1,10 @@ /* * Author: GitHawk - * Disconnect a fuel nozzle + * Disconnect a fuel nozzle. * * Arguments: - * 0: The unit - * 1: The object holding the nozzle + * 0: Unit + * 1: Nozzle * * Return Value: * None @@ -16,14 +16,15 @@ */ #include "script_component.hpp" -private ["_nozzle"]; -params ["_unit", "_nozzleHolder"]; +private ["_sink"]; +params ["_unit", "_nozzle"]; -_nozzle = _nozzleHolder getVariable QGVAR(nozzle); +_sink = _nozzle getVariable [QGVAR(sink), objNull]; +if (isNull _sink) exitWith {}; -detach _nozzle; +_sink setVariable [QGVAR(nozzle), objNull, true]; _nozzle setVariable [QGVAR(sink), objNull, true]; -_nozzleHolder setVariable [QGVAR(nozzle), objNull, true]; +REFUEL_DROP_NOZZLE(_nozzle) _unit setVariable [QGVAR(nozzle), _nozzle]; -[_unit, _nozzleHolder, _nozzle] call FUNC(takeNozzle); +[_unit, objNull, _nozzle] call FUNC(takeNozzle); diff --git a/addons/refuel/functions/fnc_handleKilled.sqf b/addons/refuel/functions/fnc_handleKilled.sqf index 7fd8247aab..ab1ee8a132 100644 --- a/addons/refuel/functions/fnc_handleKilled.sqf +++ b/addons/refuel/functions/fnc_handleKilled.sqf @@ -20,7 +20,7 @@ params ["_unit"]; if (!local _unit) exitWith {}; _unit setVariable [QGVAR(selectedWeaponOnRefuel), nil]; -_nozzle = _unit setVariable [QGVAR(nozzle), objNull]; +_nozzle = _unit getVariable [QGVAR(nozzle), objNull]; if !(isNull _nozzle) then { REFUEL_UNIT_DROP_NOZZLE }; diff --git a/addons/refuel/functions/fnc_handleUnconscious.sqf b/addons/refuel/functions/fnc_handleUnconscious.sqf index 0a331bb337..65c47b2610 100644 --- a/addons/refuel/functions/fnc_handleUnconscious.sqf +++ b/addons/refuel/functions/fnc_handleUnconscious.sqf @@ -23,7 +23,7 @@ if (!local _unit || {!_isUnconscious}) exitWith {}; private "_nozzle"; [_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); -_nozzle = _unit setVariable [QGVAR(nozzle), objNull]; +_nozzle = _unit getVariable [QGVAR(nozzle), objNull]; if !(isNull _nozzle) then { REFUEL_UNIT_DROP_NOZZLE }; diff --git a/addons/refuel/functions/fnc_moduleRefuelSettings.sqf b/addons/refuel/functions/fnc_moduleRefuelSettings.sqf index d71c35e3d2..3a6faeeab6 100644 --- a/addons/refuel/functions/fnc_moduleRefuelSettings.sqf +++ b/addons/refuel/functions/fnc_moduleRefuelSettings.sqf @@ -1,6 +1,6 @@ /* * Author: GitHawk - * Module for adjusting the refuel settings + * Module for adjusting the refuel settings. * * Arguments: * 0: The module logic diff --git a/addons/refuel/functions/fnc_refuel.sqf b/addons/refuel/functions/fnc_refuel.sqf index 37990c7f16..2b33784aa1 100644 --- a/addons/refuel/functions/fnc_refuel.sqf +++ b/addons/refuel/functions/fnc_refuel.sqf @@ -1,11 +1,12 @@ /* * Author: GitHawk - * Refuels the vehicle + * Refuels the vehicle. * * Arguments: - * 0: The unit - * 1: The target - * 2: The nozzle + * 0: Unit + * 1: Target + * 2: Nozzle + * 3: Connection Point * * Return Value: * None @@ -15,35 +16,28 @@ #include "script_component.hpp" -private ["_sink", "_rate", "_maxFuel"]; -params ["_unit", "_target", "_nozzle"]; +#define PFH_STEPSIZE 0.1 -_sink = _nozzle getVariable [QGVAR(sink), objNull]; -if (isNull _sink) exitWith {}; +private ["_rate", "_maxFuel"]; +params ["_unit", "_target", "_nozzle", "_connectToPoint"]; -_rate = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(flowRate)) * GVAR(rate); +_rate = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(flowRate)) * GVAR(rate) * PFH_STEPSIZE; _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(fuelCapacity)); [{ - private ["_source", "_sink", "_tooFar", "_fuelInSource", "_fuelInSink", "_finished", "_fueling"]; + private ["_source", "_tooFar", "_fuelInSource", "_fuelInSink", "_finished", "_fueling"]; params ["_args", "_pfID"]; - _args params ["_unit", "_nozzle", "_rate", "_startFuel", "_maxFuel"]; + _args params ["_source", "_sink", "_unit", "_nozzle", "_rate", "_startFuel", "_maxFuel", "_connectFromPoint", "_connectToPoint"]; _fueling = _nozzle getVariable [QGVAR(isRefueling), false]; - - _source = _nozzle getVariable [QGVAR(source), objNull]; - _sink = _nozzle getVariable [QGVAR(sink), objNull]; - if (isNull _source || - {!alive _source} || - {isNull _sink} || - {!alive _sink}) exitWith { + if (!alive _source || {!alive _sink}) exitWith { REFUEL_DROP_NOZZLE(_nozzle) _nozzle setVariable [QGVAR(isConnected), false, true]; _nozzle setVariable [QGVAR(sink), objNull, true]; _sink setVariable [QGVAR(nozzle), objNull, true]; [_pfID] call cba_fnc_removePerFrameHandler; }; - _tooFar = (_sink distance (_source modelToWorld (_nozzle getVariable [QGVAR(attachPos), [0,0,0]]))) > 10; + _tooFar = ((_sink modelToWorld _connectToPoint) distance (_source modelToWorld _connectFromPoint)) > 10; if (_tooFar) exitWith { [LSTRING(Hint_TooFar), 2, _unit] call EFUNC(common,displayTextStructured); @@ -84,10 +78,18 @@ _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(f [_unit, _source, _fuelInSource] call FUNC(setFuel); }; - if (_finished || {!_fueling}) exitWith { - if !(_fueling) then { - [LSTRING(Hint_Stopped), 2, _unit] call EFUNC(common,displayTextStructured); - }; + if (_finished) exitWith { _nozzle setVariable [QGVAR(isRefueling), false, true]; }; -}, 1, [_unit, _nozzle, _rate, fuel _target, _maxFuel]] call cba_fnc_addPerFrameHandler; +}, +PFH_STEPSIZE, +[_nozzle getVariable QGVAR(source), + _target, + _unit, + _nozzle, + _rate, + fuel _target, + _maxFuel, + _nozzle getVariable [QGVAR(attachPos), [0,0,0]], + _connectToPoint] +] call cba_fnc_addPerFrameHandler; diff --git a/addons/refuel/functions/fnc_returnNozzle.sqf b/addons/refuel/functions/fnc_returnNozzle.sqf index 0423574576..a167d308c0 100644 --- a/addons/refuel/functions/fnc_returnNozzle.sqf +++ b/addons/refuel/functions/fnc_returnNozzle.sqf @@ -3,7 +3,7 @@ * Returns the nozzle back to source vehicle. * * Arguments: - * 0: Player + * 0: Unit * 1: Target * * Return Value: @@ -34,4 +34,7 @@ _target setVariable [QGVAR(isConnected), false, true]; ropeDestroy (_nozzle getVariable QGVAR(rope)); deleteVehicle _nozzle; +_target setHitPointDamage ["HitEngine", _target getVariable [QGVAR(engineHit), 0]]; +_target setVariable [QGVAR(engineHit), nil, true]; + true diff --git a/addons/refuel/functions/fnc_setFuel.sqf b/addons/refuel/functions/fnc_setFuel.sqf index 8e6aadc0f7..2e0608e573 100644 --- a/addons/refuel/functions/fnc_setFuel.sqf +++ b/addons/refuel/functions/fnc_setFuel.sqf @@ -1,11 +1,11 @@ /* * Author: GitHawk - * Set the remaining fuel amount + * Set the remaining fuel amount. * * Arguments: - * 0: The unit - * 1: The target - * 2: The amout + * 0: Unit + * 1: Target + * 2: Amount (in liters) * * Return Value: * None diff --git a/addons/refuel/functions/fnc_takeNozzle.sqf b/addons/refuel/functions/fnc_takeNozzle.sqf index 27234239b8..615b24d073 100644 --- a/addons/refuel/functions/fnc_takeNozzle.sqf +++ b/addons/refuel/functions/fnc_takeNozzle.sqf @@ -1,11 +1,11 @@ /* * Author: GitHawk - * Take a fuel nozzle + * Take a fuel nozzle either from a fuel truck/station or from the ground. * * Arguments: - * 0: The unit - * 1: The target - * 2: The nozzle (optional) + * 0: Unit + * 1: Target + * 2: Nozzle (optional) * * Return Value: * None @@ -18,13 +18,20 @@ #include "script_component.hpp" private ["_endPosOffset"], -params ["_unit", "_target", "_nozzle"]; +params ["_unit", "_target", ["_nozzle", objNull]]; [_unit, QGVAR(vehAttach), true] call EFUNC(common,setForceWalkStatus); REFUEL_HOLSTER_WEAPON +// TODO add pickup animation + +_endPosOffset = [0, 0, 0]; if (isNull _nozzle) then { // func is called on fuel truck + _target setVariable [QGVAR(engineHit), _target getHitPointDamage "HitEngine", true]; + _target setHitPointDamage ["HitEngine", 1]; + + _target setVariable [QGVAR(isConnected), true, true]; _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 { @@ -36,8 +43,6 @@ if (isNull _nozzle) then { // func is called on fuel truck _endPosOffset = _endPosOffset select 0; }; - // TODO add pickup animation ? - [{ params ["_unit", "_target", "_endPosOffset"]; _newNozzle = "ACE_refuel_fuelNozzle" createVehicle position _unit; @@ -48,37 +53,33 @@ if (isNull _nozzle) then { // func is called on fuel truck _newNozzle setVariable [QGVAR(attachPos), _endPosOffset, true]; _newNozzle setVariable [QGVAR(source), _target, true]; _newNozzle setVariable [QGVAR(rope), _rope, true]; - _target setVariable [QGVAR(isConnected), true, true]; }, [_unit, _target, _endPosOffset], 2, 0] call EFUNC(common,waitAndExecute); - - [{ - private ["_nozzle"]; - params ["_args", "_pfID"]; - _args params ["_unit", "_source", "_endPosOffset"]; - - if (_unit distance (_source modelToWorld _endPosOffset) > 10) exitWith { - _nozzle = _unit getVariable [QGVAR(nozzle), objNull]; - if !(isNull _nozzle) then { - REFUEL_UNIT_DROP_NOZZLE - REFUEL_UNHOLSTER_WEAPON - - [_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); - [LSTRING(Hint_TooFar), 2, _unit] call EFUNC(common,displayTextStructured); - }; - [_pfID] call cba_fnc_removePerFrameHandler; - }; - }, 0, [_unit, _target, _endPosOffset]] call cba_fnc_addPerFrameHandler; - - _unit setVariable [QGVAR(isRefueling), true]; } else { // func is called in muzzle either connected or on ground - // TODO add pickup animation ? - [{ - params ["_unit", "_target", "_nozzle"]; - - detach _nozzle; - _target setVariable [QGVAR(nozzle), objNull, true]; + params ["_unit", "_nozzle"]; _nozzle attachTo [_unit, [-0.02,-0.05,0], "righthandmiddle1"]; // TODO replace with right coordinates for real model _unit setVariable [QGVAR(nozzle), _nozzle]; - }, [_unit, _target, _nozzle], 2, 0] call EFUNC(common,waitAndExecute); + }, [_unit, _nozzle], 2, 0] call EFUNC(common,waitAndExecute); + + _target = _nozzle getVariable QGVAR(source); + _endPosOffset = _nozzle getVariable QGVAR(attachPos); }; +[{ + private ["_nozzle"]; + params ["_args", "_pfID"]; + _args params ["_unit", "_source", "_endPosOffset"]; + + if (_unit distance (_source modelToWorld _endPosOffset) > 10) exitWith { + _nozzle = _unit getVariable [QGVAR(nozzle), objNull]; + if !(isNull _nozzle) then { + REFUEL_UNIT_DROP_NOZZLE + REFUEL_UNHOLSTER_WEAPON + + [_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); + [LSTRING(Hint_TooFar), 2, _unit] call EFUNC(common,displayTextStructured); + }; + [_pfID] call cba_fnc_removePerFrameHandler; + }; +}, 0, [_unit, _target, _endPosOffset]] call cba_fnc_addPerFrameHandler; + +_unit setVariable [QGVAR(isRefueling), true]; diff --git a/addons/refuel/functions/fnc_turnOff.sqf b/addons/refuel/functions/fnc_turnOff.sqf index 8600b22646..aae508ab3c 100644 --- a/addons/refuel/functions/fnc_turnOff.sqf +++ b/addons/refuel/functions/fnc_turnOff.sqf @@ -1,20 +1,22 @@ /* * Author: GitHawk - * Turn off a fuel nozzle + * Turn off a fuel nozzle. * * Arguments: - * 0: The object holding the nozzle + * 0: Unit + * 1: Nozzle * * Return Value: * None * * Example: - * [tank] call ace_refuel_fnc_turnOff + * [nozzle] call ace_refuel_fnc_turnOff * * Public: No */ #include "script_component.hpp" -params ["_nozzleHolder"]; +params ["_unit", "_nozzle"]; -(_nozzleHolder getVariable QGVAR(nozzle)) setVariable [QGVAR(isRefueling), false, true]; +_nozzle setVariable [QGVAR(isRefueling), false, true]; +[LSTRING(Hint_Stopped), 1.5, _unit] call EFUNC(common,displayTextStructured); diff --git a/addons/refuel/functions/fnc_turnOn.sqf b/addons/refuel/functions/fnc_turnOn.sqf index 8492540cbd..2cba278ed8 100644 --- a/addons/refuel/functions/fnc_turnOn.sqf +++ b/addons/refuel/functions/fnc_turnOn.sqf @@ -1,20 +1,22 @@ /* * Author: GitHawk - * Turn on a fuel nozzle + * Turn on a fuel nozzle. * * Arguments: - * 0: The object holding the nozzle + * 0: Unit + * 1: Nozzle * * Return Value: * None * * Example: - * [tank] call ace_refuel_fnc_turnOn + * [nozzle] call ace_refuel_fnc_turnOn * * Public: No */ #include "script_component.hpp" -params ["_nozzleHolder"]; +params ["_unit", "_nozzle"]; -(_nozzleHolder getVariable QGVAR(nozzle)) setVariable [QGVAR(isRefueling), true, true]; +_nozzle setVariable [QGVAR(isRefueling), true, true]; +[LSTRING(Hint_Started), 1.5, _unit] call EFUNC(common,displayTextStructured); diff --git a/addons/refuel/stringtable.xml b/addons/refuel/stringtable.xml index 276771f669..85e1df86bb 100644 --- a/addons/refuel/stringtable.xml +++ b/addons/refuel/stringtable.xml @@ -3,7 +3,7 @@ Refuel Settings - Betankung + Betankungseinst. Flow Rate @@ -13,14 +13,6 @@ How fast should a vehicle be refueled? Wie schnell soll ein Fahrzeug aufgetankt sein? - - Fast - Schnell - - - Realistic - Realistisch - Refuel Betankung @@ -89,6 +81,10 @@ Fueling stopped Betankung angehalten + + Fueling started + Betankung begonnen + Return fuel nozzle Zapfpistole zurückstecken From 22576f938ef21c39280180b3375880439fa585be Mon Sep 17 00:00:00 2001 From: IngoKauffmann Date: Fri, 21 Aug 2015 22:43:45 +0200 Subject: [PATCH 20/25] Added dropping and progress bars --- addons/refuel/CfgVehicles.hpp | 30 ++++-- addons/refuel/XEH_preInit.sqf | 2 + addons/refuel/functions/fnc_canCheckFuel.sqf | 2 +- .../refuel/functions/fnc_canConnectNozzle.sqf | 2 +- .../refuel/functions/fnc_canReturnNozzle.sqf | 4 +- addons/refuel/functions/fnc_checkFuel.sqf | 4 +- addons/refuel/functions/fnc_connectNozzle.sqf | 2 +- .../functions/fnc_connectNozzleAction.sqf | 40 +++++--- addons/refuel/functions/fnc_disconnect.sqf | 5 +- addons/refuel/functions/fnc_getFuel.sqf | 2 +- addons/refuel/functions/fnc_handleKilled.sqf | 2 +- .../functions/fnc_handleUnconscious.sqf | 2 +- addons/refuel/functions/fnc_makeJerryCan.sqf | 89 ++++++++++++++++++ .../functions/fnc_moduleRefuelSettings.sqf | 2 + .../refuel/functions/fnc_readFuelCounter.sqf | 37 ++++++++ addons/refuel/functions/fnc_refuel.sqf | 6 +- addons/refuel/functions/fnc_returnNozzle.sqf | 44 ++++++--- addons/refuel/functions/fnc_setFuel.sqf | 18 ++-- addons/refuel/functions/fnc_takeNozzle.sqf | 93 ++++++++++++++----- addons/refuel/functions/fnc_turnOff.sqf | 16 +++- addons/refuel/functions/fnc_turnOn.sqf | 22 ++++- addons/refuel/script_component.hpp | 10 +- addons/refuel/stringtable.xml | 40 +++++++- 23 files changed, 378 insertions(+), 96 deletions(-) create mode 100644 addons/refuel/functions/fnc_makeJerryCan.sqf create mode 100644 addons/refuel/functions/fnc_readFuelCounter.sqf diff --git a/addons/refuel/CfgVehicles.hpp b/addons/refuel/CfgVehicles.hpp index 94c8632ee2..91947db0d6 100644 --- a/addons/refuel/CfgVehicles.hpp +++ b/addons/refuel/CfgVehicles.hpp @@ -16,6 +16,20 @@ exceptions[] = {"isNotInside"}; \ icon = PATHTOF(ui\icon_refuel_interact.paa); \ }; \ + class GVAR(CheckFuelCounter) { \ + displayName = CSTRING(CheckFuelCounter); \ + condition = "true"; \ + statement = QUOTE([ARR_2(_player,_target)] call FUNC(readFuelCounter)); \ + exceptions[] = {"isNotInside"}; \ + icon = PATHTOF(ui\icon_refuel_interact.paa); \ + }; \ + class GVAR(CheckFuel) { \ + displayName = CSTRING(CheckFuel); \ + condition = QUOTE([ARR_2(_player,_target)] call FUNC(canCheckFuel)); \ + statement = QUOTE([ARR_2(_player,_target)] call FUNC(checkFuel)); \ + exceptions[] = {"isNotInside"}; \ + icon = PATHTOF(ui\icon_refuel_interact.paa); \ + }; \ class GVAR(Connect) { \ displayName = CSTRING(Connect); \ condition = QUOTE([ARR_2(_player,_target)] call FUNC(canConnectNozzle)); \ @@ -30,13 +44,6 @@ exceptions[] = {"isNotInside"}; \ icon = PATHTOF(ui\icon_refuel_interact.paa); \ }; \ - class GVAR(CheckFuel) { \ - displayName = CSTRING(CheckFuel); \ - condition = QUOTE([ARR_2(_player,_target)] call FUNC(canCheckFuel)); \ - statement = QUOTE([ARR_2(_player,_target)] call FUNC(checkFuel)); \ - exceptions[] = {"isNotInside"}; \ - icon = PATHTOF(ui\icon_refuel_interact.paa); \ - }; \ }; \ }; \ }; @@ -76,7 +83,7 @@ class GVAR(PickUpNozzle) { \ displayName = CSTRING(TakeNozzle); \ condition = QUOTE([ARR_2(_player,_target)] call FUNC(canTakeNozzle)); \ - statement = QUOTE([ARR_3(_player,_target,_target)] call FUNC(TakeNozzle)); \ + statement = QUOTE([ARR_3(_player,objNull,_target)] call FUNC(TakeNozzle)); \ exceptions[] = {"isNotInside"}; \ icon = PATHTOF(ui\icon_refuel_interact.paa); \ }; \ @@ -203,16 +210,19 @@ class CfgVehicles { class Ship_F : Ship { MACRO_CONNECT_ACTIONS GVAR(fuelCapacity) = 2000; + GVAR(flowRate) = 4; }; class Boat_Civil_01_base_F : Ship_F { GVAR(fuelCapacity) = 200; }; - class Boat_F : Ship_F {}; + class Boat_F : Ship_F { + GVAR(flowRate) = 1; + }; class Boat_Armed_01_base_F : Boat_F { - GVAR(fuelCapacity) = 1000; + GVAR(fuelCapacity) = 300; }; class Rubber_duck_base_F : Boat_F { GVAR(fuelCapacity) = 30; diff --git a/addons/refuel/XEH_preInit.sqf b/addons/refuel/XEH_preInit.sqf index bc9caebd86..9ed818f046 100644 --- a/addons/refuel/XEH_preInit.sqf +++ b/addons/refuel/XEH_preInit.sqf @@ -16,7 +16,9 @@ PREP(disconnect); PREP(getFuel); PREP(handleKilled); PREP(handleUnconscious); +PREP(makeJerryCan); PREP(moduleRefuelSettings); +PREP(readFuelCounter); PREP(refuel); PREP(returnNozzle); PREP(setFuel); diff --git a/addons/refuel/functions/fnc_canCheckFuel.sqf b/addons/refuel/functions/fnc_canCheckFuel.sqf index bc29c23bf4..a1584ea333 100644 --- a/addons/refuel/functions/fnc_canCheckFuel.sqf +++ b/addons/refuel/functions/fnc_canCheckFuel.sqf @@ -10,7 +10,7 @@ * Can Check Fuel * * Example: - * [unit, target] call ace_refuel_fnc_canCheckFuel + * [player, truck] call ace_refuel_fnc_canCheckFuel * * Public: No */ diff --git a/addons/refuel/functions/fnc_canConnectNozzle.sqf b/addons/refuel/functions/fnc_canConnectNozzle.sqf index b87cb88237..5c6bdce502 100644 --- a/addons/refuel/functions/fnc_canConnectNozzle.sqf +++ b/addons/refuel/functions/fnc_canConnectNozzle.sqf @@ -10,7 +10,7 @@ * Can Connect Nozzle * * Example: - * [unit, tank] call ace_refuel_fnc_canConnectNozzle + * [player, tank] call ace_refuel_fnc_canConnectNozzle * * Public: No */ diff --git a/addons/refuel/functions/fnc_canReturnNozzle.sqf b/addons/refuel/functions/fnc_canReturnNozzle.sqf index f3cb2a65e7..139c921d34 100644 --- a/addons/refuel/functions/fnc_canReturnNozzle.sqf +++ b/addons/refuel/functions/fnc_canReturnNozzle.sqf @@ -4,13 +4,13 @@ * * Arguments: * 0: Unit - * 1: Target + * 1: Fuel truck * * Return Value: * Can Return Nozzle * * Example: - * [unit, tank] call ace_refuel_fnc_canReturnNozzle + * [player, fuelTruck] call ace_refuel_fnc_canReturnNozzle * * Public: No */ diff --git a/addons/refuel/functions/fnc_checkFuel.sqf b/addons/refuel/functions/fnc_checkFuel.sqf index 0f26453920..b50e9a8171 100644 --- a/addons/refuel/functions/fnc_checkFuel.sqf +++ b/addons/refuel/functions/fnc_checkFuel.sqf @@ -10,7 +10,7 @@ * None * * Example: - * [unit, target] call ace_refuel_fnc_checkFuel + * [player, fuelTruck] call ace_refuel_fnc_checkFuel * * Public: No */ @@ -34,7 +34,7 @@ _fuel = [_target] call FUNC(getFuel); true }, {true}, - localize LSTRING(CheckFuel), + localize LSTRING(CheckFuelAction), {true}, ["isnotinside"] ] call EFUNC(common,progressBar); diff --git a/addons/refuel/functions/fnc_connectNozzle.sqf b/addons/refuel/functions/fnc_connectNozzle.sqf index 261527bc3f..6f87c70303 100644 --- a/addons/refuel/functions/fnc_connectNozzle.sqf +++ b/addons/refuel/functions/fnc_connectNozzle.sqf @@ -11,7 +11,7 @@ * None * * Example: - * [unit, target] call ace_refuel_fnc_connectNozzle + * [player, tank] call ace_refuel_fnc_connectNozzle * * Public: No */ diff --git a/addons/refuel/functions/fnc_connectNozzleAction.sqf b/addons/refuel/functions/fnc_connectNozzleAction.sqf index 44d0f4ebf4..74bbe5b506 100644 --- a/addons/refuel/functions/fnc_connectNozzleAction.sqf +++ b/addons/refuel/functions/fnc_connectNozzleAction.sqf @@ -71,17 +71,33 @@ _closeInDistance = (_closeInDistance - 0.0085); _endPosTestOffset = _startingOffset vectorAdd (_closeInUnitVector vectorMultiply _closeInDistance); _endPosTestOffset set [2, (_startingOffset select 2)]; -// TODO put animation and delayed connect ? +[ + 2, + [_unit, _nozzle, _target, _endPosTestOffset], + { + private "_actionID"; + params ["_args"]; + _args params ["_unit", "_nozzle", "_target", "_endPosTestOffset"]; + _unit setVariable [QGVAR(nozzle), nil]; + _unit setVariable [QGVAR(isRefueling), false]; + [_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); + REFUEL_UNHOLSTER_WEAPON + _actionID = _unit getVariable [QGVAR(ReleaseActionID), -1]; + if (_actionID != -1) then { + _unit removeAction _actionID; + _unit setVariable [QGVAR(ReleaseActionID), nil]; + }; -_unit setVariable [QGVAR(nozzle), nil]; -_unit setVariable [QGVAR(isRefueling), false]; -[_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); -REFUEL_UNHOLSTER_WEAPON + detach _nozzle; + _nozzle attachTo [_target, _endPosTestOffset]; + _nozzle setVariable [QGVAR(sink), _target, true]; + _nozzle setVariable [QGVAR(isConnected), true, true]; + _target setVariable [QGVAR(nozzle), _nozzle, true]; -detach _nozzle; -_nozzle attachTo [_target, _endPosTestOffset]; -_nozzle setVariable [QGVAR(sink), _target, true]; -_nozzle setVariable [QGVAR(isConnected), true, true]; -_target setVariable [QGVAR(nozzle), _nozzle, true]; - -[_unit, _target, _nozzle, _endPosTestOffset] call FUNC(refuel); + [_unit, _target, _nozzle, _endPosTestOffset] call FUNC(refuel); + }, + "", + localize LSTRING(ConnectAction), + {true}, + ["isnotinside"] +] call EFUNC(common,progressBar); diff --git a/addons/refuel/functions/fnc_disconnect.sqf b/addons/refuel/functions/fnc_disconnect.sqf index 69205d13e4..d529b0f821 100644 --- a/addons/refuel/functions/fnc_disconnect.sqf +++ b/addons/refuel/functions/fnc_disconnect.sqf @@ -10,7 +10,7 @@ * None * * Example: - * [unit, truck] call ace_refuel_fnc_disconnect + * [player, nozzle] call ace_refuel_fnc_disconnect * * Public: No */ @@ -24,7 +24,6 @@ if (isNull _sink) exitWith {}; _sink setVariable [QGVAR(nozzle), objNull, true]; _nozzle setVariable [QGVAR(sink), objNull, true]; -REFUEL_DROP_NOZZLE(_nozzle) -_unit setVariable [QGVAR(nozzle), _nozzle]; +REFUEL_DETACH_NOZZLE [_unit, objNull, _nozzle] call FUNC(takeNozzle); diff --git a/addons/refuel/functions/fnc_getFuel.sqf b/addons/refuel/functions/fnc_getFuel.sqf index 038119bd46..9bbb4987be 100644 --- a/addons/refuel/functions/fnc_getFuel.sqf +++ b/addons/refuel/functions/fnc_getFuel.sqf @@ -9,7 +9,7 @@ * Fuel left (in liters) * * Example: - * [target] call ace_refuel_fnc_getFuel + * [fuelTruck] call ace_refuel_fnc_getFuel * * Public: No */ diff --git a/addons/refuel/functions/fnc_handleKilled.sqf b/addons/refuel/functions/fnc_handleKilled.sqf index ab1ee8a132..f61f4c0eae 100644 --- a/addons/refuel/functions/fnc_handleKilled.sqf +++ b/addons/refuel/functions/fnc_handleKilled.sqf @@ -9,7 +9,7 @@ * None * * Example: - * [unit] call ace_refuel_fnc_handleKilled + * [player] call ace_refuel_fnc_handleKilled * * Public: No */ diff --git a/addons/refuel/functions/fnc_handleUnconscious.sqf b/addons/refuel/functions/fnc_handleUnconscious.sqf index 65c47b2610..0fc66288e8 100644 --- a/addons/refuel/functions/fnc_handleUnconscious.sqf +++ b/addons/refuel/functions/fnc_handleUnconscious.sqf @@ -10,7 +10,7 @@ * None * * Example: - * [unit, true] call ace_refuel_fnc_handleUnconscious + * [player, true] call ace_refuel_fnc_handleUnconscious * * Public: No */ diff --git a/addons/refuel/functions/fnc_makeJerryCan.sqf b/addons/refuel/functions/fnc_makeJerryCan.sqf new file mode 100644 index 0000000000..3df209196d --- /dev/null +++ b/addons/refuel/functions/fnc_makeJerryCan.sqf @@ -0,0 +1,89 @@ +/* + * Author: GitHawk + * Makes an object into a jerry can. + * + * Arguments: + * 0: Target + * 1: Fuel amount (in liters) + * + * Return Value: + * None + * + * Example: + * [can] call ace_refuel_fnc_makeJerryCan + * + * Public: No + */ +#include "script_component.hpp" + +private ["_actions", "_action"]; +params ["_target", ["_fuelAmount", 20]]; + +if (isNull _target || + {_target isKindOf "AllVehicles"}) exitWith {}; + +[_target, _fuelAmount] call FUNC(setFuel); +_target setVariable [QGVAR(source), _target, true]; + +_actions = []; +// Add pickup +_action = [QGVAR(PickUpNozzle), + localize LSTRING(TakeNozzle), + QUOTE(PATHTOF(ui\icon_refuel_interact.paa)), + {[_player, objNull, _target] call FUNC(TakeNozzle)}, + {[_player, _target] call FUNC(canTakeNozzle)}, + {}, + [], + [0, 0, 0], + REFUEL_ACTION_DISTANCE] call EFUNC(interact_menu,createAction); +_actions pushBack [_action, [], _target]; + +// Add turnOn +_action = [QGVAR(TurnOn), + localize LSTRING(TurnOn), + QUOTE(PATHTOF(ui\icon_refuel_interact.paa)), + {[_player, _target] call FUNC(turnOn)}, + {[_player, _target] call FUNC(canTurnOn)}, + {}, + [], + [0, 0, 0], + REFUEL_ACTION_DISTANCE] call EFUNC(interact_menu,createAction); +_actions pushBack [_action, [], _target]; + +// Add turnOff +_action = [QGVAR(TurnOff), + localize LSTRING(TurnOff), + QUOTE(PATHTOF(ui\icon_refuel_interact.paa)), + {[_player, _target] call FUNC(turnOff)}, + {[_player, _target] call FUNC(canTurnOff)}, + {}, + [], + [0, 0, 0], + REFUEL_ACTION_DISTANCE] call EFUNC(interact_menu,createAction); +_actions pushBack [_action, [], _target]; + +// Add disconnect +_action = [QGVAR(Disconnect), + localize LSTRING(Disconnect), + QUOTE(PATHTOF(ui\icon_refuel_interact.paa)), + {[_player, _target] call FUNC(disconnect)}, + {[_player, _target] call FUNC(canDisconnect)}, + {}, + [], + [0, 0, 0], + REFUEL_ACTION_DISTANCE] call EFUNC(interact_menu,createAction); +_actions pushBack [_action, [], _target]; + +// Main Action +_action = [QGVAR(Refuel), + localize LSTRING(Refuel), + QUOTE(PATHTOF(ui\icon_refuel_interact.paa)), + {}, + {true}, + {}, + [], + [0, 0, 0], + REFUEL_ACTION_DISTANCE] call EFUNC(interact_menu,createAction); + +[_target, 0] call EFUNC(interact_menu,addMainAction); +[_target, 0, ["ACE_MainActions"], [_action, _actions, _target]] call EFUNC(interact_menu,addActionToObject); diff --git a/addons/refuel/functions/fnc_moduleRefuelSettings.sqf b/addons/refuel/functions/fnc_moduleRefuelSettings.sqf index 3a6faeeab6..6cdc78b9f7 100644 --- a/addons/refuel/functions/fnc_moduleRefuelSettings.sqf +++ b/addons/refuel/functions/fnc_moduleRefuelSettings.sqf @@ -20,3 +20,5 @@ params ["_logic", "_units", "_activated"]; if !(_activated) exitWith {}; [_logic, QGVAR(rate), "rate"] call EFUNC(common,readSettingFromModule); + +diag_log text format ["[ACE]: Refuel Module Initialized with flow rate: %1", GVAR(rate)]; diff --git a/addons/refuel/functions/fnc_readFuelCounter.sqf b/addons/refuel/functions/fnc_readFuelCounter.sqf new file mode 100644 index 0000000000..af95c044e3 --- /dev/null +++ b/addons/refuel/functions/fnc_readFuelCounter.sqf @@ -0,0 +1,37 @@ +/* + * Author: GitHawk + * Reads the fuel counter. + * + * Arguments: + * 0: Unit + * 1: Fuel Truck + * + * Return Value: + * None + * + * Example: + * [player, fuelTruck] call ace_refuel_fnc_readFuelCounter + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit", "_target"]; + +[ + 2, + [_unit, _target], + { + private ["_currentFuel", "_fuelCounter"]; + params ["_args"]; + _args params ["_unit", "_target"]; + + _currentFuel = [_target] call FUNC(getFuel); + _fuelCounter = 0.01 * round (100 * ((_target getVariable [QGVAR(fuelCounter), _currentFuel]) - _currentFuel)); + [[LSTRING(Hint_FuelCounter), _fuelCounter], 1.5, _unit] call EFUNC(common,displayTextStructured); + }, + "", + localize LSTRING(CheckFuelCounterAction), + {true}, + ["isnotinside"] +] call EFUNC(common,progressBar); diff --git a/addons/refuel/functions/fnc_refuel.sqf b/addons/refuel/functions/fnc_refuel.sqf index 2b33784aa1..4993ad4758 100644 --- a/addons/refuel/functions/fnc_refuel.sqf +++ b/addons/refuel/functions/fnc_refuel.sqf @@ -31,7 +31,7 @@ _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(f _fueling = _nozzle getVariable [QGVAR(isRefueling), false]; if (!alive _source || {!alive _sink}) exitWith { - REFUEL_DROP_NOZZLE(_nozzle) + REFUEL_DROP_NOZZLE _nozzle setVariable [QGVAR(isConnected), false, true]; _nozzle setVariable [QGVAR(sink), objNull, true]; _sink setVariable [QGVAR(nozzle), objNull, true]; @@ -41,7 +41,7 @@ _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(f if (_tooFar) exitWith { [LSTRING(Hint_TooFar), 2, _unit] call EFUNC(common,displayTextStructured); - REFUEL_DROP_NOZZLE(_nozzle) + REFUEL_DROP_NOZZLE _nozzle setVariable [QGVAR(isConnected), false, true]; _nozzle setVariable [QGVAR(sink), objNull, true]; _sink setVariable [QGVAR(nozzle), objNull, true]; @@ -75,7 +75,7 @@ _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(f } else { _sink setFuel _fuelInSink; }; - [_unit, _source, _fuelInSource] call FUNC(setFuel); + [_source, _fuelInSource] call FUNC(setFuel); }; if (_finished) exitWith { diff --git a/addons/refuel/functions/fnc_returnNozzle.sqf b/addons/refuel/functions/fnc_returnNozzle.sqf index a167d308c0..8a9916c39e 100644 --- a/addons/refuel/functions/fnc_returnNozzle.sqf +++ b/addons/refuel/functions/fnc_returnNozzle.sqf @@ -4,19 +4,19 @@ * * Arguments: * 0: Unit - * 1: Target + * 1: Fuel Truck * * Return Value: * Returned Nozzle * * Example: - * [player] call ace_refuel_fnc_returnNozzle + * [player, fuelTruck] call ace_refuel_fnc_returnNozzle * * Public: No */ #include "script_component.hpp" -private ["_nozzle", "_dummy"]; +private ["_nozzle", "_dummy", "_actionID"]; params ["_unit", "_target"]; _nozzle = _unit getVariable QGVAR(nozzle); @@ -24,17 +24,35 @@ _source = _nozzle getVariable QGVAR(source); if (isNil "_nozzle" || {_source != _target}) exitWith {false}; -_unit setVariable [QGVAR(nozzle), nil]; -detach _nozzle; -[_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); -REFUEL_UNHOLSTER_WEAPON +[ + 2, + [_unit, _nozzle, _target], + { + private "_actionID"; + params ["_args"]; + _args params ["_unit", "_nozzle", "_target"]; + _unit setVariable [QGVAR(nozzle), nil]; + detach _nozzle; + [_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); + REFUEL_UNHOLSTER_WEAPON + _unit setVariable [QGVAR(isRefueling), false]; + _actionID = _unit getVariable [QGVAR(ReleaseActionID), -1]; + if (_actionID != -1) then { + _unit removeAction _actionID; + _unit setVariable [QGVAR(ReleaseActionID), nil]; + }; -_unit setVariable [QGVAR(isRefueling), false]; -_target setVariable [QGVAR(isConnected), false, true]; -ropeDestroy (_nozzle getVariable QGVAR(rope)); -deleteVehicle _nozzle; + _target setVariable [QGVAR(isConnected), false, true]; + ropeDestroy (_nozzle getVariable QGVAR(rope)); + deleteVehicle _nozzle; -_target setHitPointDamage ["HitEngine", _target getVariable [QGVAR(engineHit), 0]]; -_target setVariable [QGVAR(engineHit), nil, true]; + _target setHitPointDamage ["HitEngine", _target getVariable [QGVAR(engineHit), 0]]; + _target setVariable [QGVAR(engineHit), nil, true]; + }, + "", + localize LSTRING(ConnectAction), + {true}, + ["isnotinside"] +] call EFUNC(common,progressBar); true diff --git a/addons/refuel/functions/fnc_setFuel.sqf b/addons/refuel/functions/fnc_setFuel.sqf index 2e0608e573..a182d463ae 100644 --- a/addons/refuel/functions/fnc_setFuel.sqf +++ b/addons/refuel/functions/fnc_setFuel.sqf @@ -3,26 +3,22 @@ * Set the remaining fuel amount. * * Arguments: - * 0: Unit - * 1: Target - * 2: Amount (in liters) + * 0: Fuel Truck + * 1: Amount (in liters) * * Return Value: * None * * Example: - * [unit, target] call ace_refuel_fnc_getFuel + * [fuelTruck, 42] call ace_refuel_fnc_setFuel * * Public: No */ #include "script_component.hpp" private ["_maxFuel"]; -params ["_unit", "_target", "_fuel"]; +params ["_target", "_fuel"]; -if (isNull _unit || - {isNull _target} || - {!(_unit isKindOf "CAManBase")} || - {!local _unit} || - {(_target distance _unit) > 7}) exitWith {}; +if (isNull _target || + {isNil "_fuel"}) exitWith {}; -_target setVariable [QGVAR(currentFuelCargo), (getNumber (configFile >> "CfgVehicles" >> typeOf _target >> QGVAR(fuelCargo))) min _fuel, true]; +_target setVariable [QGVAR(currentFuelCargo), _fuel, true]; diff --git a/addons/refuel/functions/fnc_takeNozzle.sqf b/addons/refuel/functions/fnc_takeNozzle.sqf index 615b24d073..99557a5842 100644 --- a/addons/refuel/functions/fnc_takeNozzle.sqf +++ b/addons/refuel/functions/fnc_takeNozzle.sqf @@ -4,14 +4,15 @@ * * Arguments: * 0: Unit - * 1: Target + * 1: Fuel Truck * 2: Nozzle (optional) * * Return Value: * None * * Example: - * [unit, target, truck] call ace_refuel_fnc_takeNozzle + * [player, fuelTruck] call ace_refuel_fnc_takeNozzle + * [player, objNull, nozzle] call ace_refuel_fnc_takeNozzle * * Public: No */ @@ -24,8 +25,6 @@ params ["_unit", "_target", ["_nozzle", objNull]]; REFUEL_HOLSTER_WEAPON -// TODO add pickup animation - _endPosOffset = [0, 0, 0]; if (isNull _nozzle) then { // func is called on fuel truck _target setVariable [QGVAR(engineHit), _target getHitPointDamage "HitEngine", true]; @@ -42,24 +41,78 @@ if (isNull _nozzle) then { // func is called on fuel truck } else { _endPosOffset = _endPosOffset select 0; }; + [ + 2, + [_unit, _target, _endPosOffset], + { + private ["_newNozzle", "_rope", "_actionID"]; + params ["_args"]; + _args params ["_unit", "_target", "_endPosOffset"]; - [{ - 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]; + _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]; - _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]; - }, [_unit, _target, _endPosOffset], 2, 0] call EFUNC(common,waitAndExecute); + _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]; + + _unit setVariable [QGVAR(isRefueling), true]; + _actionID = _unit getVariable [QGVAR(ReleaseActionID), -1]; + if (_actionID != -1) then { + _unit removeAction _actionID; + }; + _actionID = _unit addAction [ + format ["%1", localize ELSTRING(dragging,Drop)], + 'params ["_unit"]; _nozzle = _unit getVariable QGVAR(nozzle); REFUEL_UNIT_DROP_NOZZLE', + nil, + 20, + false, + true, + "", + '!isNull (_target getVariable [QGVAR(nozzle), objNull])' + ]; + _unit setVariable [QGVAR(ReleaseActionID), _actionID]; + }, + "", + localize LSTRING(TakeNozzleAction), + {true}, + ["isnotinside"] + ] call EFUNC(common,progressBar); } else { // func is called in muzzle either connected or on ground - [{ - params ["_unit", "_nozzle"]; - _nozzle attachTo [_unit, [-0.02,-0.05,0], "righthandmiddle1"]; // TODO replace with right coordinates for real model - _unit setVariable [QGVAR(nozzle), _nozzle]; - }, [_unit, _nozzle], 2, 0] call EFUNC(common,waitAndExecute); + [ + 2, + [_unit, _nozzle], + { + private ["_actionID"]; + params ["_args"]; + _args params ["_unit", "_nozzle"]; + _nozzle attachTo [_unit, [-0.02,-0.05,0], "righthandmiddle1"]; // TODO replace with right coordinates for real model + _unit setVariable [QGVAR(nozzle), _nozzle]; + + _unit setVariable [QGVAR(isRefueling), true]; + _actionID = _unit getVariable [QGVAR(ReleaseActionID), -1]; + if (_actionID != -1) then { + _unit removeAction _actionID; + }; + _actionID = _unit addAction [ + format ["%1", localize ELSTRING(dragging,Drop)], + 'params ["_unit"]; _nozzle = _unit getVariable QGVAR(nozzle); REFUEL_UNIT_DROP_NOZZLE', + nil, + 20, + false, + true, + "", + '!isNull (_target getVariable [QGVAR(nozzle), objNull])' + ]; + _unit setVariable [QGVAR(ReleaseActionID), _actionID]; + }, + "", + localize LSTRING(TakeNozzleAction), + {true}, + ["isnotinside"] + ] call EFUNC(common,progressBar); _target = _nozzle getVariable QGVAR(source); _endPosOffset = _nozzle getVariable QGVAR(attachPos); @@ -81,5 +134,3 @@ if (isNull _nozzle) then { // func is called on fuel truck [_pfID] call cba_fnc_removePerFrameHandler; }; }, 0, [_unit, _target, _endPosOffset]] call cba_fnc_addPerFrameHandler; - -_unit setVariable [QGVAR(isRefueling), true]; diff --git a/addons/refuel/functions/fnc_turnOff.sqf b/addons/refuel/functions/fnc_turnOff.sqf index aae508ab3c..115c1eabe2 100644 --- a/addons/refuel/functions/fnc_turnOff.sqf +++ b/addons/refuel/functions/fnc_turnOff.sqf @@ -18,5 +18,17 @@ params ["_unit", "_nozzle"]; -_nozzle setVariable [QGVAR(isRefueling), false, true]; -[LSTRING(Hint_Stopped), 1.5, _unit] call EFUNC(common,displayTextStructured); +[ + 2, + [_unit, _nozzle], + { + params ["_args"]; + _args params ["_unit", "_nozzle"]; + _nozzle setVariable [QGVAR(isRefueling), false, true]; + [LSTRING(Hint_Stopped), 1.5, _unit] call EFUNC(common,displayTextStructured); + }, + "", + localize LSTRING(TurnOffAction), + {true}, + ["isnotinside"] +] call EFUNC(common,progressBar); diff --git a/addons/refuel/functions/fnc_turnOn.sqf b/addons/refuel/functions/fnc_turnOn.sqf index 2cba278ed8..819fad4529 100644 --- a/addons/refuel/functions/fnc_turnOn.sqf +++ b/addons/refuel/functions/fnc_turnOn.sqf @@ -10,7 +10,7 @@ * None * * Example: - * [nozzle] call ace_refuel_fnc_turnOn + * [player, nozzle] call ace_refuel_fnc_turnOn * * Public: No */ @@ -18,5 +18,21 @@ params ["_unit", "_nozzle"]; -_nozzle setVariable [QGVAR(isRefueling), true, true]; -[LSTRING(Hint_Started), 1.5, _unit] call EFUNC(common,displayTextStructured); +[ + 2, + [_unit, _nozzle], + { + private "_source"; + params ["_args"]; + _args params ["_unit", "_nozzle"]; + _nozzle setVariable [QGVAR(isRefueling), true, true]; + [LSTRING(Hint_Started), 1.5, _unit] call EFUNC(common,displayTextStructured); + + _source = _nozzle getVariable QGVAR(source); + _source setVariable [QGVAR(fuelCounter), [_source] call FUNC(getFuel)]; + }, + "", + localize LSTRING(TurnOnAction), + {true}, + ["isnotinside"] +] call EFUNC(common,progressBar); diff --git a/addons/refuel/script_component.hpp b/addons/refuel/script_component.hpp index f30389ba72..dc701cd00a 100644 --- a/addons/refuel/script_component.hpp +++ b/addons/refuel/script_component.hpp @@ -14,15 +14,17 @@ #define REFUEL_INFINITE_FUEL -1 #define REFUEL_ACTION_DISTANCE 7 -#define REFUEL_DROP_NOZZLE(obj) \ +#define REFUEL_DETACH_NOZZLE \ detach _nozzle; \ - _nozzle setPosATL [(getPosATL obj) select 0,(getPosATL obj) select 1, 0]; \ - _nozzle setVelocity [0,0,0]; \ _nozzle setVariable [QGVAR(isRefueling), false, true]; +#define REFUEL_DROP_NOZZLE \ + REFUEL_DETACH_NOZZLE \ + _nozzle setPosATL [(getPosATL _nozzle) select 0, (getPosATL _nozzle) select 1, 0];\ + _nozzle setVelocity [0, 0, 0]; #define REFUEL_UNIT_DROP_NOZZLE \ - REFUEL_DROP_NOZZLE(_unit) \ + REFUEL_DROP_NOZZLE \ _unit setVariable [QGVAR(isRefueling), false]; \ _unit setVariable [QGVAR(nozzle), objNull]; diff --git a/addons/refuel/stringtable.xml b/addons/refuel/stringtable.xml index 85e1df86bb..ec4c57f76e 100644 --- a/addons/refuel/stringtable.xml +++ b/addons/refuel/stringtable.xml @@ -21,10 +21,18 @@ Take fuel nozzle Zapfpistole nehmen + + Taking fuel nozzle ... + Nehme Zapfpistole ... + Connect fuel nozzle Zapfpistole anschließen + + Connecting fuel nozzle ... + Zapfpistole anschließen ... + Disconnect fuel nozzle Zapfpistole entfernen @@ -34,8 +42,12 @@ Anschließen - Check remaining fuel ... - Verbleibenden Kraftstoff überprüfen ... + Check remaining fuel + Verbleibenden Kraftstoff überprüfen + + + Checking remaining fuel ... + Überprüfe verbleibenden Kraftstoff ... There are %1 liters left. @@ -43,7 +55,7 @@ There is no fuel left. - Es ist kein Treibstoff übrig. + Es ist kein Kraftstoff übrig. Cancel @@ -55,12 +67,20 @@ Stop fueling - Betankung anhalten + Betankung stoppen + + + Stopping fueling ... + Stoppe Betankung ... Start fueling Betankung beginnen + + Starting fueling ... + Beginne Betankung ... + %1 Liters fueled %1 Liters getankt @@ -89,5 +109,17 @@ Return fuel nozzle Zapfpistole zurückstecken + + Check fuel counter + Tankuhr ansehen + + + >Checking fuel counter ... + Betrachte Tankuhr ... + + + %1 liters have been fueled. + %1 Liter wurden getankt. + From 8b53b4f0d06306ff7ea8e846315aa34f28f9e0f9 Mon Sep 17 00:00:00 2001 From: IngoKauffmann Date: Sat, 22 Aug 2015 13:34:24 +0200 Subject: [PATCH 21/25] Fixes Moved macros to function Fixed MP bugs Changed class history of nozzle --- addons/refuel/CfgVehicles.hpp | 8 +++-- addons/refuel/XEH_preInit.sqf | 1 + .../refuel/functions/fnc_canConnectNozzle.sqf | 4 +-- addons/refuel/functions/fnc_connectNozzle.sqf | 4 +-- .../functions/fnc_connectNozzleAction.sqf | 3 ++ addons/refuel/functions/fnc_disconnect.sqf | 3 +- addons/refuel/functions/fnc_dropNozzle.sqf | 32 +++++++++++++++++++ addons/refuel/functions/fnc_handleKilled.sqf | 2 +- .../functions/fnc_handleUnconscious.sqf | 2 +- addons/refuel/functions/fnc_refuel.sqf | 12 ++++--- addons/refuel/functions/fnc_returnNozzle.sqf | 12 ++++--- addons/refuel/functions/fnc_takeNozzle.sqf | 12 ++++--- addons/refuel/functions/fnc_turnOn.sqf | 3 -- addons/refuel/script_component.hpp | 14 -------- addons/refuel/stringtable.xml | 4 +++ 15 files changed, 78 insertions(+), 38 deletions(-) create mode 100644 addons/refuel/functions/fnc_dropNozzle.sqf diff --git a/addons/refuel/CfgVehicles.hpp b/addons/refuel/CfgVehicles.hpp index 91947db0d6..7d8b7111c2 100644 --- a/addons/refuel/CfgVehicles.hpp +++ b/addons/refuel/CfgVehicles.hpp @@ -133,10 +133,14 @@ class CfgVehicles { }; }; - class Sign_Sphere10cm_F; - class ACE_refuel_fuelNozzle : Sign_Sphere10cm_F { + class ThingX; + class ACE_refuel_fuelNozzle : ThingX { XEH_ENABLED; MACRO_NOZZLE_ACTIONS + displayName = QGVAR(fuelNozzle); + scope = 2; + scopeCurator = 2; + model = "\A3\Structures_F_Heli\VR\Helpers\Sign_sphere10cm_F.p3d"; }; class All; diff --git a/addons/refuel/XEH_preInit.sqf b/addons/refuel/XEH_preInit.sqf index 9ed818f046..7fd31122d6 100644 --- a/addons/refuel/XEH_preInit.sqf +++ b/addons/refuel/XEH_preInit.sqf @@ -13,6 +13,7 @@ PREP(checkFuel); PREP(connectNozzle); PREP(connectNozzleAction); PREP(disconnect); +PREP(dropNozzle); PREP(getFuel); PREP(handleKilled); PREP(handleUnconscious); diff --git a/addons/refuel/functions/fnc_canConnectNozzle.sqf b/addons/refuel/functions/fnc_canConnectNozzle.sqf index 5c6bdce502..812234818e 100644 --- a/addons/refuel/functions/fnc_canConnectNozzle.sqf +++ b/addons/refuel/functions/fnc_canConnectNozzle.sqf @@ -19,8 +19,8 @@ private ["_nozzle"]; params ["_unit", "_target"]; -_nozzle = _unit getVariable QGVAR(nozzle); +_nozzle = _unit getVariable [QGVAR(nozzle), objNull]; -!(isNil "_nozzle" || +!(isNull _nozzle || {(_target distance _unit) > REFUEL_ACTION_DISTANCE} || {!isNull (_target getVariable [QGVAR(nozzle), objNull])}) // TODO verify cant connect multiple fuel lines diff --git a/addons/refuel/functions/fnc_connectNozzle.sqf b/addons/refuel/functions/fnc_connectNozzle.sqf index 6f87c70303..f5d8d35759 100644 --- a/addons/refuel/functions/fnc_connectNozzle.sqf +++ b/addons/refuel/functions/fnc_connectNozzle.sqf @@ -24,8 +24,8 @@ private ["_nozzle", "_actionID"]; params ["_unit", "_target"]; -_nozzle = _unit getVariable QGVAR(nozzle); -if (isNil "_nozzle") exitWith {}; +_nozzle = _unit getVariable [QGVAR(nozzle), objNull]; +if (isNull _nozzle) exitWith {}; GVAR(placeAction) = PLACE_WAITING; diff --git a/addons/refuel/functions/fnc_connectNozzleAction.sqf b/addons/refuel/functions/fnc_connectNozzleAction.sqf index 74bbe5b506..2c35296b9e 100644 --- a/addons/refuel/functions/fnc_connectNozzleAction.sqf +++ b/addons/refuel/functions/fnc_connectNozzleAction.sqf @@ -94,6 +94,9 @@ _endPosTestOffset set [2, (_startingOffset select 2)]; _nozzle setVariable [QGVAR(isConnected), true, true]; _target setVariable [QGVAR(nozzle), _nozzle, true]; + _source = _nozzle getVariable QGVAR(source); + _source setVariable [QGVAR(fuelCounter), [_source] call FUNC(getFuel)]; + [_unit, _target, _nozzle, _endPosTestOffset] call FUNC(refuel); }, "", diff --git a/addons/refuel/functions/fnc_disconnect.sqf b/addons/refuel/functions/fnc_disconnect.sqf index d529b0f821..e007ddf05f 100644 --- a/addons/refuel/functions/fnc_disconnect.sqf +++ b/addons/refuel/functions/fnc_disconnect.sqf @@ -24,6 +24,7 @@ if (isNull _sink) exitWith {}; _sink setVariable [QGVAR(nozzle), objNull, true]; _nozzle setVariable [QGVAR(sink), objNull, true]; -REFUEL_DETACH_NOZZLE +_nozzle setVariable [QGVAR(isConnected), false, true]; +[objNull, _nozzle, true] call FUNC(dropNozzle); [_unit, objNull, _nozzle] call FUNC(takeNozzle); diff --git a/addons/refuel/functions/fnc_dropNozzle.sqf b/addons/refuel/functions/fnc_dropNozzle.sqf new file mode 100644 index 0000000000..c44c20c059 --- /dev/null +++ b/addons/refuel/functions/fnc_dropNozzle.sqf @@ -0,0 +1,32 @@ +/* + * Author: GitHawk + * Detaches the fuel nozzle, drops it and removes player variables. + * + * Arguments: + * 0: Unit (optional) + * 1: Nozzle + * 2: Disconnect Only + * + * Return Value: + * None + * + * Example: + * [player, nozzle, false] call ace_refuel_fnc_dropNozzle + * [objNull, nozzle, false] call ace_refuel_fnc_dropNozzle + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit", "_nozzle", ["_disconnectOnly", false]]; + +detach _nozzle; +_nozzle setVariable [QGVAR(isRefueling), false, true]; + +if (_disconnectOnly) exitWith {}; +_nozzle setVelocity [0, 0, 0]; +_nozzle setPosATL [(getPosATL _nozzle) select 0, (getPosATL _nozzle) select 1, 0.05]; + +if (isNull _unit) exitWith {}; +_unit setVariable [QGVAR(isRefueling), false, true]; +_unit setVariable [QGVAR(nozzle), objNull, true]; diff --git a/addons/refuel/functions/fnc_handleKilled.sqf b/addons/refuel/functions/fnc_handleKilled.sqf index f61f4c0eae..897337c062 100644 --- a/addons/refuel/functions/fnc_handleKilled.sqf +++ b/addons/refuel/functions/fnc_handleKilled.sqf @@ -22,5 +22,5 @@ if (!local _unit) exitWith {}; _unit setVariable [QGVAR(selectedWeaponOnRefuel), nil]; _nozzle = _unit getVariable [QGVAR(nozzle), objNull]; if !(isNull _nozzle) then { - REFUEL_UNIT_DROP_NOZZLE + [_unit, _nozzle] call FUNC(dropNozzle); }; diff --git a/addons/refuel/functions/fnc_handleUnconscious.sqf b/addons/refuel/functions/fnc_handleUnconscious.sqf index 0fc66288e8..6a6e561230 100644 --- a/addons/refuel/functions/fnc_handleUnconscious.sqf +++ b/addons/refuel/functions/fnc_handleUnconscious.sqf @@ -25,5 +25,5 @@ private "_nozzle"; [_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); _nozzle = _unit getVariable [QGVAR(nozzle), objNull]; if !(isNull _nozzle) then { - REFUEL_UNIT_DROP_NOZZLE + [_unit, _nozzle] call FUNC(dropNozzle); }; diff --git a/addons/refuel/functions/fnc_refuel.sqf b/addons/refuel/functions/fnc_refuel.sqf index 4993ad4758..c69f3f84cf 100644 --- a/addons/refuel/functions/fnc_refuel.sqf +++ b/addons/refuel/functions/fnc_refuel.sqf @@ -31,7 +31,7 @@ _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(f _fueling = _nozzle getVariable [QGVAR(isRefueling), false]; if (!alive _source || {!alive _sink}) exitWith { - REFUEL_DROP_NOZZLE + [objNull, _nozzle] call FUNC(dropNozzle); _nozzle setVariable [QGVAR(isConnected), false, true]; _nozzle setVariable [QGVAR(sink), objNull, true]; _sink setVariable [QGVAR(nozzle), objNull, true]; @@ -41,7 +41,7 @@ _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(f if (_tooFar) exitWith { [LSTRING(Hint_TooFar), 2, _unit] call EFUNC(common,displayTextStructured); - REFUEL_DROP_NOZZLE + [objNull, _nozzle] call FUNC(dropNozzle); _nozzle setVariable [QGVAR(isConnected), false, true]; _nozzle setVariable [QGVAR(sink), objNull, true]; _sink setVariable [QGVAR(nozzle), objNull, true]; @@ -64,18 +64,22 @@ _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(f [LSTRING(Hint_SourceEmpty), 2, _unit] call EFUNC(common,displayTextStructured); }; - _fuelInSink = fuel _sink + ( _rate / _maxFuel); + _fuelInSink = (_unit getVariable [QGVAR(tempFuel), _startFuel]) + ( _rate / _maxFuel); if (_fuelInSink > 1) then { _fuelInSink = 1; _finished = true; [LSTRING(Hint_Completed), 2, _unit] call EFUNC(common,displayTextStructured); }; + _unit setVariable [QGVAR(tempFuel), _fuelInSink]; + if !(local _sink) then { - [[_sink, _fuelInSink], QUOTE({(_this select 0) setFuel (_this select 1)}), _sink] call EFUNC(common,execRemoteFnc); + [[_sink, _fuelInSink], "{(_this select 0) setFuel (_this select 1)}", _sink] call EFUNC(common,execRemoteFnc); } else { _sink setFuel _fuelInSink; }; [_source, _fuelInSource] call FUNC(setFuel); + } else { + _unit setVariable [QGVAR(tempFuel), fuel _sink]; }; if (_finished) exitWith { diff --git a/addons/refuel/functions/fnc_returnNozzle.sqf b/addons/refuel/functions/fnc_returnNozzle.sqf index 8a9916c39e..429dd9666c 100644 --- a/addons/refuel/functions/fnc_returnNozzle.sqf +++ b/addons/refuel/functions/fnc_returnNozzle.sqf @@ -19,10 +19,10 @@ private ["_nozzle", "_dummy", "_actionID"]; params ["_unit", "_target"]; -_nozzle = _unit getVariable QGVAR(nozzle); +_nozzle = _unit getVariable [QGVAR(nozzle), objNull]; _source = _nozzle getVariable QGVAR(source); -if (isNil "_nozzle" || {_source != _target}) exitWith {false}; +if (isNull _nozzle || {_source != _target}) exitWith {false}; [ 2, @@ -46,11 +46,15 @@ if (isNil "_nozzle" || {_source != _target}) exitWith {false}; ropeDestroy (_nozzle getVariable QGVAR(rope)); deleteVehicle _nozzle; - _target setHitPointDamage ["HitEngine", _target getVariable [QGVAR(engineHit), 0]]; + if !(local _target) then { + [[_target, ["HitEngine", _target getVariable [QGVAR(engineHit), 0]]], "{(_this select 0) setHitPointDamage (_this select 1)}", _sink] call EFUNC(common,execRemoteFnc); + } else { + _target setHitPointDamage ["HitEngine", _target getVariable [QGVAR(engineHit), 0]]; + }; _target setVariable [QGVAR(engineHit), nil, true]; }, "", - localize LSTRING(ConnectAction), + localize LSTRING(ReturnAction), {true}, ["isnotinside"] ] call EFUNC(common,progressBar); diff --git a/addons/refuel/functions/fnc_takeNozzle.sqf b/addons/refuel/functions/fnc_takeNozzle.sqf index 99557a5842..70fcb43dc0 100644 --- a/addons/refuel/functions/fnc_takeNozzle.sqf +++ b/addons/refuel/functions/fnc_takeNozzle.sqf @@ -28,7 +28,11 @@ REFUEL_HOLSTER_WEAPON _endPosOffset = [0, 0, 0]; if (isNull _nozzle) then { // func is called on fuel truck _target setVariable [QGVAR(engineHit), _target getHitPointDamage "HitEngine", true]; - _target setHitPointDamage ["HitEngine", 1]; + if !(local _target) then { + [[_target, ["HitEngine", 1]], "{(_this select 0) setHitPointDamage (_this select 1)}", _sink] call EFUNC(common,execRemoteFnc); + } else { + _target setHitPointDamage ["HitEngine", 1]; + }; _target setVariable [QGVAR(isConnected), true, true]; _endPosOffset = getArray (configFile >> "CfgVehicles" >> typeOf _target >> "ace_refuel_hooks"); @@ -65,7 +69,7 @@ if (isNull _nozzle) then { // func is called on fuel truck }; _actionID = _unit addAction [ format ["%1", localize ELSTRING(dragging,Drop)], - 'params ["_unit"]; _nozzle = _unit getVariable QGVAR(nozzle); REFUEL_UNIT_DROP_NOZZLE', + '_unit = _this select 0; _nozzle = _unit getVariable QGVAR(nozzle); [_unit, _nozzle] call FUNC(dropNozzle); [_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); REFUEL_UNHOLSTER_WEAPON', nil, 20, false, @@ -98,7 +102,7 @@ if (isNull _nozzle) then { // func is called on fuel truck }; _actionID = _unit addAction [ format ["%1", localize ELSTRING(dragging,Drop)], - 'params ["_unit"]; _nozzle = _unit getVariable QGVAR(nozzle); REFUEL_UNIT_DROP_NOZZLE', + '_unit = _this select 0; _nozzle = _unit getVariable QGVAR(nozzle); [_unit, _nozzle] call FUNC(dropNozzle); [_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); REFUEL_UNHOLSTER_WEAPON', nil, 20, false, @@ -125,7 +129,7 @@ if (isNull _nozzle) then { // func is called on fuel truck if (_unit distance (_source modelToWorld _endPosOffset) > 10) exitWith { _nozzle = _unit getVariable [QGVAR(nozzle), objNull]; if !(isNull _nozzle) then { - REFUEL_UNIT_DROP_NOZZLE + [_unit, _nozzle] call FUNC(dropNozzle); REFUEL_UNHOLSTER_WEAPON [_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); diff --git a/addons/refuel/functions/fnc_turnOn.sqf b/addons/refuel/functions/fnc_turnOn.sqf index 819fad4529..017a8ee021 100644 --- a/addons/refuel/functions/fnc_turnOn.sqf +++ b/addons/refuel/functions/fnc_turnOn.sqf @@ -27,9 +27,6 @@ params ["_unit", "_nozzle"]; _args params ["_unit", "_nozzle"]; _nozzle setVariable [QGVAR(isRefueling), true, true]; [LSTRING(Hint_Started), 1.5, _unit] call EFUNC(common,displayTextStructured); - - _source = _nozzle getVariable QGVAR(source); - _source setVariable [QGVAR(fuelCounter), [_source] call FUNC(getFuel)]; }, "", localize LSTRING(TurnOnAction), diff --git a/addons/refuel/script_component.hpp b/addons/refuel/script_component.hpp index dc701cd00a..9027c22fae 100644 --- a/addons/refuel/script_component.hpp +++ b/addons/refuel/script_component.hpp @@ -14,20 +14,6 @@ #define REFUEL_INFINITE_FUEL -1 #define REFUEL_ACTION_DISTANCE 7 -#define REFUEL_DETACH_NOZZLE \ - detach _nozzle; \ - _nozzle setVariable [QGVAR(isRefueling), false, true]; - -#define REFUEL_DROP_NOZZLE \ - REFUEL_DETACH_NOZZLE \ - _nozzle setPosATL [(getPosATL _nozzle) select 0, (getPosATL _nozzle) select 1, 0];\ - _nozzle setVelocity [0, 0, 0]; - -#define REFUEL_UNIT_DROP_NOZZLE \ - REFUEL_DROP_NOZZLE \ - _unit setVariable [QGVAR(isRefueling), false]; \ - _unit setVariable [QGVAR(nozzle), objNull]; - #define REFUEL_HOLSTER_WEAPON \ _unit setVariable [QGVAR(selectedWeaponOnRefuel), currentWeapon _unit]; \ _unit action ["SwitchWeapon", _unit, _unit, 99]; diff --git a/addons/refuel/stringtable.xml b/addons/refuel/stringtable.xml index ec4c57f76e..c530501346 100644 --- a/addons/refuel/stringtable.xml +++ b/addons/refuel/stringtable.xml @@ -109,6 +109,10 @@ Return fuel nozzle Zapfpistole zurückstecken + + Returning fuel nozzle ... + Stecke Zapfpistole zurück ... + Check fuel counter Tankuhr ansehen From 113ac0f370033359a7c899629584dcf856e3ec00 Mon Sep 17 00:00:00 2001 From: IngoKauffmann Date: Sat, 21 Nov 2015 23:24:24 +0100 Subject: [PATCH 22/25] Minor improvements fnc_reset is still WIP --- addons/refuel/XEH_preInit.sqf | 1 + addons/refuel/functions/fn_reset.sqf | 51 +++++++++++++++++++ .../functions/fnc_connectNozzleAction.sqf | 2 +- addons/refuel/functions/fnc_returnNozzle.sqf | 1 + addons/refuel/functions/fnc_takeNozzle.sqf | 1 + 5 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 addons/refuel/functions/fn_reset.sqf diff --git a/addons/refuel/XEH_preInit.sqf b/addons/refuel/XEH_preInit.sqf index 7fd31122d6..5250f09f11 100644 --- a/addons/refuel/XEH_preInit.sqf +++ b/addons/refuel/XEH_preInit.sqf @@ -21,6 +21,7 @@ PREP(makeJerryCan); PREP(moduleRefuelSettings); PREP(readFuelCounter); PREP(refuel); +PREP(reset); PREP(returnNozzle); PREP(setFuel); PREP(takeNozzle); diff --git a/addons/refuel/functions/fn_reset.sqf b/addons/refuel/functions/fn_reset.sqf new file mode 100644 index 0000000000..f27e0e9613 --- /dev/null +++ b/addons/refuel/functions/fn_reset.sqf @@ -0,0 +1,51 @@ +/* + * Author: GitHawk + * Resets a fuel vehicle in case is got bugged + * + * Arguments: + * 0: Fuel truck + * + * Return Value: + * None + * + * Example: + * [truck] call ace_refuel_fnc_reset + * + * Public: No + */ +#include "script_component.hpp" + +params ["_target"]; + +if !(local _target) then { + [[_target, ["HitEngine", _target getVariable [QGVAR(engineHit), 0]]], "{(_this select 0) setHitPointDamage (_this select 1)}", _sink] call EFUNC(common,execRemoteFnc); +} else { + _target setHitPointDamage ["HitEngine", _target getVariable [QGVAR(engineHit), 0]]; +}; +_target setVariable [QGVAR(engineHit), nil, true]; +_target setVariable [QGVAR(isConnected), false, true]; + +_nozzle = _target getVariable [QGVAR(nozzle), nil]; +if !(isNil "_nozzle") then { + _nozzleTarget = _nozzle getVariable [QGVAR(sink), nil]; + if !(isNil "_nozzleTarget") then { + _nozzleTarget setVariable [QGVAR(nozzle), nil, true]; + }; + + _rope = _nozzle getVariable [QGVAR(rope), nil]; + if !(isNil "_rope") then { + ropeDestroy _rope; + }; + + { + // FIXME needs to be done locally + _actionID = _x getVariable [QGVAR(ReleaseActionID), -1]; + if (_actionID != -1) then { + _x removeAction _actionID; + _x setVariable [QGVAR(isRefueling), false, true]; + _x setVariable [QGVAR(ReleaseActionID), nil]; + }; + } count allPlayers; + deleteVehicle _nozzle; +}; +_target getVariable [QGVAR(nozzle), nil, true]; diff --git a/addons/refuel/functions/fnc_connectNozzleAction.sqf b/addons/refuel/functions/fnc_connectNozzleAction.sqf index 2c35296b9e..42190aacc6 100644 --- a/addons/refuel/functions/fnc_connectNozzleAction.sqf +++ b/addons/refuel/functions/fnc_connectNozzleAction.sqf @@ -95,7 +95,7 @@ _endPosTestOffset set [2, (_startingOffset select 2)]; _target setVariable [QGVAR(nozzle), _nozzle, true]; _source = _nozzle getVariable QGVAR(source); - _source setVariable [QGVAR(fuelCounter), [_source] call FUNC(getFuel)]; + _source setVariable [QGVAR(fuelCounter), [_source] call FUNC(getFuel), true]; [_unit, _target, _nozzle, _endPosTestOffset] call FUNC(refuel); }, diff --git a/addons/refuel/functions/fnc_returnNozzle.sqf b/addons/refuel/functions/fnc_returnNozzle.sqf index 429dd9666c..6de80a8468 100644 --- a/addons/refuel/functions/fnc_returnNozzle.sqf +++ b/addons/refuel/functions/fnc_returnNozzle.sqf @@ -43,6 +43,7 @@ if (isNull _nozzle || {_source != _target}) exitWith {false}; }; _target setVariable [QGVAR(isConnected), false, true]; + _target setVariable [QGVAR(nozzle), nil, true]; ropeDestroy (_nozzle getVariable QGVAR(rope)); deleteVehicle _nozzle; diff --git a/addons/refuel/functions/fnc_takeNozzle.sqf b/addons/refuel/functions/fnc_takeNozzle.sqf index 70fcb43dc0..221984ba77 100644 --- a/addons/refuel/functions/fnc_takeNozzle.sqf +++ b/addons/refuel/functions/fnc_takeNozzle.sqf @@ -61,6 +61,7 @@ if (isNull _nozzle) then { // func is called on fuel truck _newNozzle setVariable [QGVAR(attachPos), _endPosOffset, true]; _newNozzle setVariable [QGVAR(source), _target, true]; _newNozzle setVariable [QGVAR(rope), _rope, true]; + _target setVariable [QGVAR(nozzle), _newNozzle, true]; _unit setVariable [QGVAR(isRefueling), true]; _actionID = _unit getVariable [QGVAR(ReleaseActionID), -1]; From 931c6830fc12b7159e573676d7485050a3e3f756 Mon Sep 17 00:00:00 2001 From: IngoKauffmann Date: Mon, 23 Nov 2015 19:28:51 +0100 Subject: [PATCH 23/25] Added reset It's now possible to reset a fuel truck by console command: [fuel_truck] call ace_refuel_fnc_reset --- addons/refuel/CfgVehicles.hpp | 2 +- addons/refuel/XEH_preInit.sqf | 1 + addons/refuel/functions/fnc_refuel.sqf | 2 +- .../functions/{fn_reset.sqf => fnc_reset.sqf} | 21 +++++------ addons/refuel/functions/fnc_resetLocal.sqf | 37 +++++++++++++++++++ addons/refuel/functions/fnc_returnNozzle.sqf | 2 +- addons/refuel/functions/fnc_takeNozzle.sqf | 6 +-- addons/refuel/script_component.hpp | 3 +- 8 files changed, 56 insertions(+), 18 deletions(-) rename addons/refuel/functions/{fn_reset.sqf => fnc_reset.sqf} (67%) create mode 100644 addons/refuel/functions/fnc_resetLocal.sqf diff --git a/addons/refuel/CfgVehicles.hpp b/addons/refuel/CfgVehicles.hpp index 7d8b7111c2..8e57bf1f63 100644 --- a/addons/refuel/CfgVehicles.hpp +++ b/addons/refuel/CfgVehicles.hpp @@ -74,7 +74,7 @@ class ACE_Actions { \ class ACE_MainActions { \ displayName = CSTRING(Refuel); \ - distance = 3; \ + distance = REFUEL_ACTION_DISTANCE; \ condition = "true"; \ statement = ""; \ showDisabled = 0; \ diff --git a/addons/refuel/XEH_preInit.sqf b/addons/refuel/XEH_preInit.sqf index 5250f09f11..691df0478d 100644 --- a/addons/refuel/XEH_preInit.sqf +++ b/addons/refuel/XEH_preInit.sqf @@ -22,6 +22,7 @@ PREP(moduleRefuelSettings); PREP(readFuelCounter); PREP(refuel); PREP(reset); +PREP(resetLocal); PREP(returnNozzle); PREP(setFuel); PREP(takeNozzle); diff --git a/addons/refuel/functions/fnc_refuel.sqf b/addons/refuel/functions/fnc_refuel.sqf index c69f3f84cf..ed6eb257cf 100644 --- a/addons/refuel/functions/fnc_refuel.sqf +++ b/addons/refuel/functions/fnc_refuel.sqf @@ -37,7 +37,7 @@ _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(f _sink setVariable [QGVAR(nozzle), objNull, true]; [_pfID] call cba_fnc_removePerFrameHandler; }; - _tooFar = ((_sink modelToWorld _connectToPoint) distance (_source modelToWorld _connectFromPoint)) > 10; + _tooFar = ((_sink modelToWorld _connectToPoint) distance (_source modelToWorld _connectFromPoint)) > (REFUEL_HOSE_LENGTH - 2); if (_tooFar) exitWith { [LSTRING(Hint_TooFar), 2, _unit] call EFUNC(common,displayTextStructured); diff --git a/addons/refuel/functions/fn_reset.sqf b/addons/refuel/functions/fnc_reset.sqf similarity index 67% rename from addons/refuel/functions/fn_reset.sqf rename to addons/refuel/functions/fnc_reset.sqf index f27e0e9613..f235180b0e 100644 --- a/addons/refuel/functions/fn_reset.sqf +++ b/addons/refuel/functions/fnc_reset.sqf @@ -15,17 +15,18 @@ */ #include "script_component.hpp" +private ["_nozzle", "_nozzleTarget", "_rope"]; params ["_target"]; -if !(local _target) then { - [[_target, ["HitEngine", _target getVariable [QGVAR(engineHit), 0]]], "{(_this select 0) setHitPointDamage (_this select 1)}", _sink] call EFUNC(common,execRemoteFnc); -} else { +if (local _target) then { _target setHitPointDamage ["HitEngine", _target getVariable [QGVAR(engineHit), 0]]; +} else { + [[_target, ["HitEngine", _target getVariable [QGVAR(engineHit), 0]]], "{(_this select 0) setHitPointDamage (_this select 1)}", _target] call EFUNC(common,execRemoteFnc); }; _target setVariable [QGVAR(engineHit), nil, true]; _target setVariable [QGVAR(isConnected), false, true]; -_nozzle = _target getVariable [QGVAR(nozzle), nil]; +_nozzle = _target getVariable [QGVAR(ownedNozzle), nil]; if !(isNil "_nozzle") then { _nozzleTarget = _nozzle getVariable [QGVAR(sink), nil]; if !(isNil "_nozzleTarget") then { @@ -38,14 +39,12 @@ if !(isNil "_nozzle") then { }; { - // FIXME needs to be done locally - _actionID = _x getVariable [QGVAR(ReleaseActionID), -1]; - if (_actionID != -1) then { - _x removeAction _actionID; - _x setVariable [QGVAR(isRefueling), false, true]; - _x setVariable [QGVAR(ReleaseActionID), nil]; + if (local _x) then { + [_x, _nozzle] call FUNC(resetLocal); + } else { + [[_x, _nozzle], "{_this call FUNC(resetLocal)}", _x] call EFUNC(common,execRemoteFnc); }; } count allPlayers; deleteVehicle _nozzle; }; -_target getVariable [QGVAR(nozzle), nil, true]; +_target setVariable [QGVAR(ownedNozzle), nil, true]; diff --git a/addons/refuel/functions/fnc_resetLocal.sqf b/addons/refuel/functions/fnc_resetLocal.sqf new file mode 100644 index 0000000000..a8b0c184cc --- /dev/null +++ b/addons/refuel/functions/fnc_resetLocal.sqf @@ -0,0 +1,37 @@ +/* + * Author: GitHawk + * Resets a player + * + * Arguments: + * 0: Fuel nozzle + * + * Return Value: + * None + * + * Example: + * [nozzle] call ace_refuel_fnc_resetLocal + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit", "_nozzle"]; + + +if (isNull _unit || + {isNull _nozzle} || + {!(_unit isKindOf "CAManBase")} || + {!local _unit}) exitWith {}; +private ["_attachedNozzle", "_actionID"]; +_attachedNozzle = _unit getVariable [QGVAR(nozzle), nil]; +if (isNil "_attachedNozzle") exitWith {}; + +if (_nozzle != _attachedNozzle) exitWith {}; + +_actionID = _unit getVariable [QGVAR(ReleaseActionID), -1]; +if (_actionID != -1) then { + _unit removeAction _actionID; + _unit setVariable [QGVAR(isRefueling), false, true]; + _unit setVariable [QGVAR(ReleaseActionID), nil]; + _unit setVariable [QGVAR(nozzle), nil]; +}; diff --git a/addons/refuel/functions/fnc_returnNozzle.sqf b/addons/refuel/functions/fnc_returnNozzle.sqf index 6de80a8468..d3fca33021 100644 --- a/addons/refuel/functions/fnc_returnNozzle.sqf +++ b/addons/refuel/functions/fnc_returnNozzle.sqf @@ -43,7 +43,7 @@ if (isNull _nozzle || {_source != _target}) exitWith {false}; }; _target setVariable [QGVAR(isConnected), false, true]; - _target setVariable [QGVAR(nozzle), nil, true]; + _target setVariable [QGVAR(ownedNozzle), nil, true]; ropeDestroy (_nozzle getVariable QGVAR(rope)); deleteVehicle _nozzle; diff --git a/addons/refuel/functions/fnc_takeNozzle.sqf b/addons/refuel/functions/fnc_takeNozzle.sqf index 221984ba77..f6d953cecc 100644 --- a/addons/refuel/functions/fnc_takeNozzle.sqf +++ b/addons/refuel/functions/fnc_takeNozzle.sqf @@ -57,11 +57,11 @@ if (isNull _nozzle) then { // func is called on fuel truck _newNozzle attachTo [_unit, [-0.02,-0.05,0], "righthandmiddle1"]; // TODO replace with right coordinates for real model _unit setVariable [QGVAR(nozzle), _newNozzle]; - _rope = ropeCreate [_target, _endPosOffset, _newNozzle, [0, 0, 0], 12]; + _rope = ropeCreate [_target, _endPosOffset, _newNozzle, [0, 0, 0], REFUEL_HOSE_LENGTH]; _newNozzle setVariable [QGVAR(attachPos), _endPosOffset, true]; _newNozzle setVariable [QGVAR(source), _target, true]; _newNozzle setVariable [QGVAR(rope), _rope, true]; - _target setVariable [QGVAR(nozzle), _newNozzle, true]; + _target setVariable [QGVAR(ownedNozzle), _newNozzle, true]; _unit setVariable [QGVAR(isRefueling), true]; _actionID = _unit getVariable [QGVAR(ReleaseActionID), -1]; @@ -127,7 +127,7 @@ if (isNull _nozzle) then { // func is called on fuel truck params ["_args", "_pfID"]; _args params ["_unit", "_source", "_endPosOffset"]; - if (_unit distance (_source modelToWorld _endPosOffset) > 10) exitWith { + if (_unit distance (_source modelToWorld _endPosOffset) > (REFUEL_HOSE_LENGTH - 2)) exitWith { _nozzle = _unit getVariable [QGVAR(nozzle), objNull]; if !(isNull _nozzle) then { [_unit, _nozzle] call FUNC(dropNozzle); diff --git a/addons/refuel/script_component.hpp b/addons/refuel/script_component.hpp index 9027c22fae..28e6fb7931 100644 --- a/addons/refuel/script_component.hpp +++ b/addons/refuel/script_component.hpp @@ -12,7 +12,8 @@ #include "\z\ace\addons\main\script_macros.hpp" #define REFUEL_INFINITE_FUEL -1 -#define REFUEL_ACTION_DISTANCE 7 +#define REFUEL_ACTION_DISTANCE 37 +#define REFUEL_HOSE_LENGTH 12 #define REFUEL_HOLSTER_WEAPON \ _unit setVariable [QGVAR(selectedWeaponOnRefuel), currentWeapon _unit]; \ From d4c708e73125c763840e76b0b9ec8bbb8696d36d Mon Sep 17 00:00:00 2001 From: IngoKauffmann Date: Tue, 24 Nov 2015 17:33:33 +0100 Subject: [PATCH 24/25] Missing ; --- addons/refuel/CfgVehicles.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/refuel/CfgVehicles.hpp b/addons/refuel/CfgVehicles.hpp index 8e57bf1f63..7550484b23 100644 --- a/addons/refuel/CfgVehicles.hpp +++ b/addons/refuel/CfgVehicles.hpp @@ -427,7 +427,7 @@ class CfgVehicles { class Plane_CAS_01_base_F : Plane_Base_F { // Assuming similar to A10 GVAR(fuelCapacity) = 6223; - } + }; class Plane_CAS_02_base_F : Plane_Base_F { // Yak-130 From f9266764fb4934c990046f07b24b8ba30c0965f6 Mon Sep 17 00:00:00 2001 From: IngoKauffmann Date: Tue, 24 Nov 2015 21:33:38 +0100 Subject: [PATCH 25/25] Moved module to ACE_Logistics --- addons/refuel/CfgVehicles.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/refuel/CfgVehicles.hpp b/addons/refuel/CfgVehicles.hpp index 7550484b23..7294ed0695 100644 --- a/addons/refuel/CfgVehicles.hpp +++ b/addons/refuel/CfgVehicles.hpp @@ -117,7 +117,7 @@ class CfgVehicles { scope = 2; displayName = CSTRING(RefuelSettings_Module_DisplayName); icon = QUOTE(PATHTOF(ui\icon_module_refuel.paa)); - category = "ACE"; + category = "ACE_Logistics"; function = QFUNC(moduleRefuelSettings); functionPriority = 1; isGlobal = 0;