Merge pull request #1 from jonpas/refuelFixes

Refuel Fixes and Additions
Thx @jonpas
This commit is contained in:
Hawk 2015-08-17 16:03:43 +02:00
commit 1bba0681c8
18 changed files with 299 additions and 259 deletions

View File

@ -1,51 +1,59 @@
#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"}; \
icon = PATHTOF(ui\icon_refuel_interact.paa); \
}; \
class GVAR(Return) { \
displayName = CSTRING(Return); \
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); \
}; \
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(canCheckFuel)); \
statement = QUOTE([ARR_2(_player,_target)] call FUNC(checkFuel)); \
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 \
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; \
condition = QUOTE([ARR_1(_player)] call FUNC(canConnectNozzle)); \
statement = ""; \
showDisabled = 0; \
priority = 2; \
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(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 +61,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)); \
statement = QUOTE([_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 +113,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 +135,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 +160,7 @@ class CfgVehicles {
class Tank : LandVehicle {
MACRO_CONNECT_ACTIONS
};
class StaticWeapon : LandVehicle {
MACRO_CONNECT_ACTIONS
};
@ -166,14 +168,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 +185,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 +198,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 +211,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 +254,7 @@ class CfgVehicles {
// Fennek
GVAR(fuelCapacity) = 230;
};
class APC_Wheeled_01_base_F: Wheeled_APC_F {
// Patria = LAV
GVAR(fuelCapacity) = 269;
@ -261,72 +263,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 +339,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 +438,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 +503,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 +572,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 +587,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 +600,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 +619,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 +636,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 +664,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 +672,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 +803,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;

View File

@ -2,6 +2,7 @@
ADDON = false;
PREP(canCheckFuel);
PREP(canConnectNozzle);
PREP(canDisconnect);
PREP(canRefuel);
@ -13,9 +14,10 @@ PREP(connectNozzleAction);
PREP(disconnect);
PREP(getFuel);
PREP(moduleRefuelSettings);
PREP(refuel);
PREP(returnNozzle);
PREP(setFuel);
PREP(takeNozzle);
PREP(turnOff);
PREP(refuel);
ADDON = true;

View File

@ -0,0 +1,23 @@
/*
* Author: Jonpas
* Checks if unit can check fuel.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Target <OBJECT>
*
* Return Value:
* Can Check Fuel <BOOL>
*
* 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

View File

@ -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
true

View File

@ -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};
@ -30,4 +30,4 @@ if (isNull _sink) exitWith {false};
_fueling = _nozzle getVariable [QGVAR(fueling), 0];
if (_fueling == 1) exitWith {false};
true
true

View File

@ -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);
_fuel = [_target] call FUNC(getFuel);
if (_fuel > 0 || {_fuel == -1}) exitWith {true};
false
false

View File

@ -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])}

View File

@ -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};

View File

@ -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);

View File

@ -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
true

View File

@ -1,28 +1,26 @@
/*
* Author: GitHawk
* Get the remaining fuel amount
* Author: GitHawk, Jonpas
* Get the remaining fuel amount.
*
* Arguments:
* 0: The unit <OBJECT>
* 1: The target <OBJECT>
* 0: Target <OBJECT>
*
* Return Value:
* Fuel left (in liters) <NUMBER>
*
* 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];
};

View File

@ -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;

View File

@ -0,0 +1,39 @@
/*
* Author: GitHawk et.al., Jonpas
* Returns the nozzle back to source vehicle.
*
* Arguments:
* 0: Player <OBJECT>
* 1: Target <OBJECT>
*
* Return Value:
* Returned Nozzle <BOOL>
*
* 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};
_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

View File

@ -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

View File

@ -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 <OBJECT>
* 1: The object holding the nozzle <OBJECT>
* 0: The object holding the nozzle <OBJECT>
*
* Return Value:
* Can turn off <BOOL>
* 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
(_nozzleHolder getVariable QGVAR(nozzle)) setVariable [QGVAR(fueling), 0];

View File

@ -1,3 +1 @@
#include "\z\ace\addons\refuel\script_component.hpp"
#define REFUEL_ACTION_DISTANCE 4.5

View File

@ -10,3 +10,6 @@
#endif
#include "\z\ace\addons\main\script_macros.hpp"
#define REFUEL_ACTION_DISTANCE 7

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project name="ACE">
<Package name="Refuel">
<Key ID="STR_ACE_Refuel_RefuelSettings_Module_DisplayName">
@ -45,15 +45,18 @@
<English>How many liters does a stationary object e.g. a fuel station hold? -1 is infinite.</English>
<German>Wieviele Liter enthält ein stationäres Objekt z.B. eine Tankstelle? -1 bedeutet unendlich.</German>
</Key>
<Key ID="STR_ACE_Refuel_TakeNozzle">
<Key ID="STR_ACE_Refuel_Refuel">
<English>Refuel</English>
</Key>
<Key ID="STR_ACE_Refuel_TakeNozzle">
<English>Take fuel nozzle</English>
<German>Zapfpistole nehmen</German>
</Key>
<Key ID="STR_ACE_Refuel_Connect">
<Key ID="STR_ACE_Refuel_Connect">
<English>Connect fuel nozzle</English>
<German>Zapfpistole anschließen</German>
</Key>
<Key ID="STR_ACE_Refuel_Disconnect">
<Key ID="STR_ACE_Refuel_Disconnect">
<English>Disconnect fuel nozzle</English>
<German>Zapfpistole entfernen</German>
</Key>
@ -72,7 +75,7 @@
<Key ID="STR_ACE_Refuel_Hint_Empty">
<English>There is no fuel left.</English>
<German>Es ist kein Treibstoff übrig.</German>
</Key>
</Key>
<Key ID="STR_ACE_Refuel_Cancel">
<English>Cancel</English>
<German>Abbrechen</German>