Merge pull request #2141 from GitHawk/refuel

Adding vehicle refueling
This commit is contained in:
Thomas Kooi 2015-11-26 16:16:13 +01:00
commit 581f71f8a1
48 changed files with 2239 additions and 15 deletions

View File

@ -0,0 +1 @@
z\ace\addons\refuel

View File

@ -0,0 +1,8 @@
class ACE_Settings {
class GVAR(rate) {
displayName = CSTRING(RefuelSettings_speed_DisplayName);
description = CSTRING(RefuelSettings_speed_Description);
value = 1;
typeName = "SCALAR";
};
};

View File

@ -0,0 +1,27 @@
class Extended_PreInit_EventHandlers {
class ADDON {
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));
};
};
};

View File

@ -0,0 +1,633 @@
#define MACRO_REFUEL_ACTIONS \
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); \
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(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)); \
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(canReturnNozzle)); \
statement = QUOTE([ARR_2(_player,_target)] call DFUNC(returnNozzle)); \
exceptions[] = {"isNotInside"}; \
icon = PATHTOF(ui\icon_refuel_interact.paa); \
}; \
}; \
}; \
};
#define MACRO_CONNECT_ACTIONS \
class ACE_Actions { \
class 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(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); \
}; \
}; \
}; \
};
#define MACRO_NOZZLE_ACTIONS \
class ACE_Actions { \
class ACE_MainActions { \
displayName = CSTRING(Refuel); \
distance = REFUEL_ACTION_DISTANCE; \
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,objNull,_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); \
}; \
}; \
};
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_Logistics";
function = QFUNC(moduleRefuelSettings);
functionPriority = 1;
isGlobal = 0;
isTriggerActivated = 0;
author = ECSTRING(common,ACETeam);
class Arguments {
class rate {
displayName = CSTRING(RefuelSettings_speed_DisplayName);
description = CSTRING(RefuelSettings_speed_Description);
typeName = "NUMBER";
defaultValue = 10;
};
};
};
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;
class Static : All {};
class Building : Static {};
class NonStrategic : Building {};
class House_Base : NonStrategic {};
class House : House_Base {};
class House_F : House {};
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;
};
class Land : AllVehicles {};
class LandVehicle : Land {};
class Car : LandVehicle {
MACRO_CONNECT_ACTIONS
};
class Tank : LandVehicle {
MACRO_CONNECT_ACTIONS
GVAR(flowRate) = 4;
};
class StaticWeapon : LandVehicle {
MACRO_CONNECT_ACTIONS
};
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 : AllVehicles {};
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 {
GVAR(flowRate) = 1;
};
class Boat_Armed_01_base_F : Boat_F {
GVAR(fuelCapacity) = 300;
};
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;
GVAR(flowRate) = 2;
};
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.38,-3.17,-.7},{-0.41,-3.17,-.7}};
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[]) = {{-1.08,-4.81,-.8}};
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 Truck_02_fuel_base_F : Truck_02_base_F {
transportFuel = 0; //3k
MACRO_REFUEL_ACTIONS
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[]) = {{.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[]) = {{1.3,-1.59,-.62},{-1.16,-1.59,-.62}};
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 {
XEH_ENABLED;
transportFuel = 0; //3k
MACRO_REFUEL_ACTIONS
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[]) = {{-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[]) = {{-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.5}};
GVAR(fuelCargo) = REFUEL_INFINITE_FUEL;
};
class Land_fs_feed_F : House_Small_F {
XEH_ENABLED;
transportFuel = 0; //50k
MACRO_REFUEL_ACTIONS
GVAR(hooks[]) = {{-0.4,0.022,-.23}};
GVAR(fuelCargo) = REFUEL_INFINITE_FUEL;
};
/* // Barrels found in config \
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
*/
// 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
};

11
addons/refuel/README.md Normal file
View File

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

View File

@ -0,0 +1,3 @@
#include "script_component.hpp"
["medical_onUnconscious", {_this call FUNC(handleOnUnconscious)}] call EFUNC(common,addEventHandler);

View File

@ -0,0 +1,32 @@
#include "script_component.hpp"
ADDON = false;
PREP(canCheckFuel);
PREP(canConnectNozzle);
PREP(canDisconnect);
PREP(canReturnNozzle);
PREP(canTakeNozzle);
PREP(canTurnOff);
PREP(canTurnOn);
PREP(checkFuel);
PREP(connectNozzle);
PREP(connectNozzleAction);
PREP(disconnect);
PREP(dropNozzle);
PREP(getFuel);
PREP(handleKilled);
PREP(handleUnconscious);
PREP(makeJerryCan);
PREP(moduleRefuelSettings);
PREP(readFuelCounter);
PREP(refuel);
PREP(reset);
PREP(resetLocal);
PREP(returnNozzle);
PREP(setFuel);
PREP(takeNozzle);
PREP(turnOff);
PREP(turnOn);
ADDON = true;

View File

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

17
addons/refuel/config.cpp Normal file
View File

@ -0,0 +1,17 @@
#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 "ACE_Settings.hpp"
#include "CfgEventHandlers.hpp"
#include "CfgVehicles.hpp"

View File

@ -0,0 +1,26 @@
/*
* Author: Jonpas, GitHawk
* Checks if unit can check fuel.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Fuel Truck/Station <OBJECT>
*
* Return Value:
* Can Check Fuel <BOOL>
*
* Example:
* [player, truck] call ace_refuel_fnc_canCheckFuel
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit", "_target"];
!(isNull _unit ||
{!(_unit isKindOf "CAManBase")} ||
{!local _unit} ||
{!alive _target} ||
{(_target distance _unit) > REFUEL_ACTION_DISTANCE} ||
{(_target call FUNC(getFuel) == REFUEL_INFINITE_FUEL)})

View File

@ -0,0 +1,26 @@
/*
* Author: GitHawk
* Check if a unit can connect a fuel nozzle
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Target <OBJECT>
*
* Return Value:
* Can Connect Nozzle <BOOL>
*
* Example:
* [player, tank] call ace_refuel_fnc_canConnectNozzle
*
* Public: No
*/
#include "script_component.hpp"
private ["_nozzle"];
params ["_unit", "_target"];
_nozzle = _unit getVariable [QGVAR(nozzle), objNull];
!(isNull _nozzle ||
{(_target distance _unit) > REFUEL_ACTION_DISTANCE} ||
{!isNull (_target getVariable [QGVAR(nozzle), objNull])}) // TODO verify cant connect multiple fuel lines

View File

@ -0,0 +1,29 @@
/*
* Author: GitHawk
* Check if a unit can disconnect a fuel nozzle
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Nozzle <OBJECT>
*
* Return Value:
* Can disconnect <BOOL>
*
* Example:
* [player, nozzle] call ace_refuel_fnc_canDisconnect
*
* Public: No
*/
#include "script_component.hpp"
private ["_sink"];
params ["_unit", "_nozzle"];
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]})

View File

@ -0,0 +1,24 @@
/*
* Author: GitHawk
* Check if a unit can return a fuel nozzle
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Fuel truck <OBJECT>
*
* Return Value:
* Can Return Nozzle <BOOL>
*
* Example:
* [player, fuelTruck] 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])}

View File

@ -0,0 +1,27 @@
/*
* Author: GitHawk
* Check if a unit can take a fuel nozzle
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Fuel Station or Nozzle <OBJECT>
*
* Return Value:
* Can connect <BOOL>
*
* Example:
* [player, nozzle] call ace_refuel_fnc_canTakeNozzle
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit", "_target"];
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])}

View File

@ -0,0 +1,27 @@
/*
* Author: GitHawk
* Check if a unit can turn off a fuel nozzle
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Nozzle <OBJECT>
*
* Return Value:
* Can turn off <BOOL>
*
* Example:
* [player, nozzle] call ace_refuel_fnc_canTurnOff
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit", "_nozzle"];
if (isNull _unit ||
{isNull _nozzle} ||
{!(_unit isKindOf "CAManBase")} ||
{!local _unit} ||
{(_nozzle distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false};
(_nozzle getVariable [QGVAR(isRefueling), false])

View File

@ -0,0 +1,30 @@
/*
* Author: GitHawk
* Check if a unit can turn on a fuel nozzle
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Nozzle <OBJECT>
*
* Return Value:
* Can turn on <BOOL>
*
* Example:
* [player, nozzle] call ace_refuel_fnc_canTurnOn
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit", "_nozzle"];
if (isNull _unit ||
{isNull _nozzle} ||
{!(_unit isKindOf "CAManBase")} ||
{!local _unit} ||
{(_nozzle distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false};
!(_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}

View File

@ -0,0 +1,40 @@
/*
* Author: GitHawk
* Get the remaining fuel amount
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Fuel Truck <OBJECT>
*
* Return Value:
* None
*
* Example:
* [player, fuelTruck] call ace_refuel_fnc_checkFuel
*
* Public: No
*/
#include "script_component.hpp"
private ["_fuel"];
params ["_unit", "_target"];
_fuel = [_target] call FUNC(getFuel);
[
5,
[_unit, _target, _fuel],
{
params ["_args"];
_args params ["_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(CheckFuelAction),
{true},
["isnotinside"]
] call EFUNC(common,progressBar);

View File

@ -0,0 +1,65 @@
/*
* Author: GitHawk et.al.
* Connect a fuel nozzle.
* With code from ace_attach
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Target <OBJECT>
*
* Return Value:
* None
*
* Example:
* [player, tank] call ace_refuel_fnc_connectNozzle
*
* Public: No
*/
#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), objNull];
if (isNull _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 ["<t color='#FF0000'>%1</t>", 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 {
[_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;

View File

@ -0,0 +1,106 @@
/*
* Author: GitHawk et.al.
* Calculates a connection for refueling.
* With code from ace_attach
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Target <OBJECT>
* 2: Visual Position <ARRAY>
* 3: Nozzle <OBJECT>
*
* Return Value:
* None
*
* Example:
* [player, tank, [0,0,0], nozzle] call ace_refuel_fnc_connectNozzleAction
*
* Public: No
*/
#include "script_component.hpp"
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)];
[
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];
};
detach _nozzle;
_nozzle attachTo [_target, _endPosTestOffset];
_nozzle setVariable [QGVAR(sink), _target, true];
_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), true];
[_unit, _target, _nozzle, _endPosTestOffset] call FUNC(refuel);
},
"",
localize LSTRING(ConnectAction),
{true},
["isnotinside"]
] call EFUNC(common,progressBar);

View File

@ -0,0 +1,30 @@
/*
* Author: GitHawk
* Disconnect a fuel nozzle.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Nozzle <OBJECT>
*
* Return Value:
* None
*
* Example:
* [player, nozzle] call ace_refuel_fnc_disconnect
*
* Public: No
*/
#include "script_component.hpp"
private ["_sink"];
params ["_unit", "_nozzle"];
_sink = _nozzle getVariable [QGVAR(sink), objNull];
if (isNull _sink) exitWith {};
_sink setVariable [QGVAR(nozzle), objNull, true];
_nozzle setVariable [QGVAR(sink), objNull, true];
_nozzle setVariable [QGVAR(isConnected), false, true];
[objNull, _nozzle, true] call FUNC(dropNozzle);
[_unit, objNull, _nozzle] call FUNC(takeNozzle);

View File

@ -0,0 +1,32 @@
/*
* Author: GitHawk
* Detaches the fuel nozzle, drops it and removes player variables.
*
* Arguments:
* 0: Unit <OBJECT> (optional)
* 1: Nozzle <OBJECT>
* 2: Disconnect Only <BOOL>
*
* 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];

View File

@ -0,0 +1,28 @@
/*
* Author: GitHawk, Jonpas
* Get the remaining fuel amount.
*
* Arguments:
* 0: Target <OBJECT>
*
* Return Value:
* Fuel left (in liters) <NUMBER>
*
* Example:
* [fuelTruck] call ace_refuel_fnc_getFuel
*
* Public: No
*/
#include "script_component.hpp"
private ["_fuel"];
params ["_target"];
_fuel = _target getVariable QGVAR(currentFuelCargo);
if (isNil "_fuel") then {
_fuel = getNumber (configFile >> "CfgVehicles" >> typeOf _target >> QGVAR(fuelCargo));
_target setVariable [QGVAR(currentFuelCargo), _fuel, true];
};
_fuel

View File

@ -0,0 +1,26 @@
/*
* Author: GitHawk, Jonpas
* Handles medical on set dead event.
*
* Arguments:
* 0: Unit <OBJECT>
*
* Return Value:
* None
*
* Example:
* [player] call ace_refuel_fnc_handleKilled
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit"];
if (!local _unit) exitWith {};
_unit setVariable [QGVAR(selectedWeaponOnRefuel), nil];
_nozzle = _unit getVariable [QGVAR(nozzle), objNull];
if !(isNull _nozzle) then {
[_unit, _nozzle] call FUNC(dropNozzle);
};

View File

@ -0,0 +1,29 @@
/*
* Author: GitHawk, Jonpas
* Handles medical on unconscious event.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Is Unconscious <BOOL>
*
* Return Value:
* None
*
* Example:
* [player, 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 getVariable [QGVAR(nozzle), objNull];
if !(isNull _nozzle) then {
[_unit, _nozzle] call FUNC(dropNozzle);
};

View File

@ -0,0 +1,89 @@
/*
* Author: GitHawk
* Makes an object into a jerry can.
*
* Arguments:
* 0: Target <OBJECT>
* 1: Fuel amount (in liters) <NUMBER>
*
* 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);

View File

@ -0,0 +1,24 @@
/*
* Author: GitHawk
* Module for adjusting the refuel settings.
*
* Arguments:
* 0: The module logic <LOGIC>
* 1: units <ARRAY>
* 2: activated <BOOL>
*
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp"
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)];

View File

@ -0,0 +1,37 @@
/*
* Author: GitHawk
* Reads the fuel counter.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Fuel Truck <OBJECT>
*
* 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);

View File

@ -0,0 +1,99 @@
/*
* Author: GitHawk
* Refuels the vehicle.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Target <OBJECT>
* 2: Nozzle <OBJECT>
* 3: Connection Point <OBJECT>
*
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp"
#define PFH_STEPSIZE 0.1
private ["_rate", "_maxFuel"];
params ["_unit", "_target", "_nozzle", "_connectToPoint"];
_rate = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(flowRate)) * GVAR(rate) * PFH_STEPSIZE;
_maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(fuelCapacity));
[{
private ["_source", "_tooFar", "_fuelInSource", "_fuelInSink", "_finished", "_fueling"];
params ["_args", "_pfID"];
_args params ["_source", "_sink", "_unit", "_nozzle", "_rate", "_startFuel", "_maxFuel", "_connectFromPoint", "_connectToPoint"];
_fueling = _nozzle getVariable [QGVAR(isRefueling), false];
if (!alive _source || {!alive _sink}) exitWith {
[objNull, _nozzle] call FUNC(dropNozzle);
_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 modelToWorld _connectToPoint) distance (_source modelToWorld _connectFromPoint)) > (REFUEL_HOSE_LENGTH - 2);
if (_tooFar) exitWith {
[LSTRING(Hint_TooFar), 2, _unit] call EFUNC(common,displayTextStructured);
[objNull, _nozzle] call FUNC(dropNozzle);
_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 (_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 = (_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], "{(_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 {
_nozzle setVariable [QGVAR(isRefueling), false, true];
};
},
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;

View File

@ -0,0 +1,50 @@
/*
* Author: GitHawk
* Resets a fuel vehicle in case is got bugged
*
* Arguments:
* 0: Fuel truck <OBJECT>
*
* Return Value:
* None
*
* Example:
* [truck] call ace_refuel_fnc_reset
*
* Public: No
*/
#include "script_component.hpp"
private ["_nozzle", "_nozzleTarget", "_rope"];
params ["_target"];
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(ownedNozzle), 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;
};
{
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 setVariable [QGVAR(ownedNozzle), nil, true];

View File

@ -0,0 +1,37 @@
/*
* Author: GitHawk
* Resets a player
*
* Arguments:
* 0: Fuel nozzle <OBJECT>
*
* 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];
};

View File

@ -0,0 +1,63 @@
/*
* Author: GitHawk, Jonpas
* Returns the nozzle back to source vehicle.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Fuel Truck <OBJECT>
*
* Return Value:
* Returned Nozzle <BOOL>
*
* Example:
* [player, fuelTruck] call ace_refuel_fnc_returnNozzle
*
* Public: No
*/
#include "script_component.hpp"
private ["_nozzle", "_dummy", "_actionID"];
params ["_unit", "_target"];
_nozzle = _unit getVariable [QGVAR(nozzle), objNull];
_source = _nozzle getVariable QGVAR(source);
if (isNull _nozzle || {_source != _target}) exitWith {false};
[
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];
};
_target setVariable [QGVAR(isConnected), false, true];
_target setVariable [QGVAR(ownedNozzle), nil, true];
ropeDestroy (_nozzle getVariable QGVAR(rope));
deleteVehicle _nozzle;
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(ReturnAction),
{true},
["isnotinside"]
] call EFUNC(common,progressBar);
true

View File

@ -0,0 +1,24 @@
/*
* Author: GitHawk
* Set the remaining fuel amount.
*
* Arguments:
* 0: Fuel Truck <OBJECT>
* 1: Amount (in liters)<NUMBER>
*
* Return Value:
* None
*
* Example:
* [fuelTruck, 42] call ace_refuel_fnc_setFuel
*
* Public: No
*/
#include "script_component.hpp"
private ["_maxFuel"];
params ["_target", "_fuel"];
if (isNull _target ||
{isNil "_fuel"}) exitWith {};
_target setVariable [QGVAR(currentFuelCargo), _fuel, true];

View File

@ -0,0 +1,141 @@
/*
* Author: GitHawk
* Take a fuel nozzle either from a fuel truck/station or from the ground.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Fuel Truck <OBJECT>
* 2: Nozzle <OBJECT> (optional)
*
* Return Value:
* None
*
* Example:
* [player, fuelTruck] call ace_refuel_fnc_takeNozzle
* [player, objNull, nozzle] call ace_refuel_fnc_takeNozzle
*
* Public: No
*/
#include "script_component.hpp"
private ["_endPosOffset"],
params ["_unit", "_target", ["_nozzle", objNull]];
[_unit, QGVAR(vehAttach), true] call EFUNC(common,setForceWalkStatus);
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];
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");
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;
};
[
2,
[_unit, _target, _endPosOffset],
{
private ["_newNozzle", "_rope", "_actionID"];
params ["_args"];
_args 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];
_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(ownedNozzle), _newNozzle, true];
_unit setVariable [QGVAR(isRefueling), true];
_actionID = _unit getVariable [QGVAR(ReleaseActionID), -1];
if (_actionID != -1) then {
_unit removeAction _actionID;
};
_actionID = _unit addAction [
format ["<t color='#FF0000'>%1</t>", localize ELSTRING(dragging,Drop)],
'_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,
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
[
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 ["<t color='#FF0000'>%1</t>", localize ELSTRING(dragging,Drop)],
'_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,
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);
};
[{
private ["_nozzle"];
params ["_args", "_pfID"];
_args params ["_unit", "_source", "_endPosOffset"];
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);
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;

View File

@ -0,0 +1,34 @@
/*
* Author: GitHawk
* Turn off a fuel nozzle.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Nozzle <OBJECT>
*
* Return Value:
* None
*
* Example:
* [nozzle] call ace_refuel_fnc_turnOff
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit", "_nozzle"];
[
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);

View File

@ -0,0 +1,35 @@
/*
* Author: GitHawk
* Turn on a fuel nozzle.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Nozzle <OBJECT>
*
* Return Value:
* None
*
* Example:
* [player, nozzle] call ace_refuel_fnc_turnOn
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit", "_nozzle"];
[
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);
},
"",
localize LSTRING(TurnOnAction),
{true},
["isnotinside"]
] call EFUNC(common,progressBar);

View File

@ -0,0 +1 @@
#include "\z\ace\addons\refuel\script_component.hpp"

View File

@ -0,0 +1,25 @@
#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"
#define REFUEL_INFINITE_FUEL -1
#define REFUEL_ACTION_DISTANCE 37
#define REFUEL_HOSE_LENGTH 12
#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];

View File

@ -0,0 +1,129 @@
<?xml version="1.0" encoding="utf-8"?>
<Project name="ACE">
<Package name="Refuel">
<Key ID="STR_ACE_Refuel_RefuelSettings_Module_DisplayName">
<English>Refuel Settings</English>
<German>Betankungseinst.</German>
</Key>
<Key ID="STR_ACE_Refuel_RefuelSettings_speed_DisplayName">
<English>Flow Rate</English>
<German>Fließrate</German>
</Key>
<Key ID="STR_ACE_Refuel_RefuelSettings_speed_Description">
<English>How fast should a vehicle be refueled?</English>
<German>Wie schnell soll ein Fahrzeug aufgetankt sein?</German>
</Key>
<Key ID="STR_ACE_Refuel_Refuel">
<English>Refuel</English>
<German>Betankung</German>
</Key>
<Key ID="STR_ACE_Refuel_TakeNozzle">
<English>Take fuel nozzle</English>
<German>Zapfpistole nehmen</German>
</Key>
<Key ID="STR_ACE_Refuel_TakeNozzleAction">
<English>Taking fuel nozzle ...</English>
<German>Nehme Zapfpistole ...</German>
</Key>
<Key ID="STR_ACE_Refuel_Connect">
<English>Connect fuel nozzle</English>
<German>Zapfpistole anschließen</German>
</Key>
<Key ID="STR_ACE_Refuel_ConnectAction">
<English>Connecting fuel nozzle ...</English>
<German>Zapfpistole anschließen ...</German>
</Key>
<Key ID="STR_ACE_Refuel_Disconnect">
<English>Disconnect fuel nozzle</English>
<German>Zapfpistole entfernen</German>
</Key>
<Key ID="STR_ACE_Refuel_Connect_Action">
<English>Connect</English>
<German>Anschließen</German>
</Key>
<Key ID="STR_ACE_Refuel_CheckFuel">
<English>Check remaining fuel</English>
<German>Verbleibenden Kraftstoff überprüfen</German>
</Key>
<Key ID="STR_ACE_Refuel_CheckFuelAction">
<English>Checking remaining fuel ...</English>
<German>Überprüfe verbleibenden Kraftstoff ...</German>
</Key>
<Key ID="STR_ACE_Refuel_Hint_RemainingFuel">
<English>There are %1 liters left.</English>
<German>Es sind noch %1 Liter übrig.</German>
</Key>
<Key ID="STR_ACE_Refuel_Hint_Empty">
<English>There is no fuel left.</English>
<German>Es ist kein Kraftstoff übrig.</German>
</Key>
<Key ID="STR_ACE_Refuel_Cancel">
<English>Cancel</English>
<German>Abbrechen</German>
</Key>
<Key ID="STR_ACE_Refuel_Failed">
<English>Failed</English>
<German>Gescheitert</German>
</Key>
<Key ID="STR_ACE_Refuel_TurnOff">
<English>Stop fueling</English>
<German>Betankung stoppen</German>
</Key>
<Key ID="STR_ACE_Refuel_TurnOffAction">
<English>Stopping fueling ...</English>
<German>Stoppe Betankung ...</German>
</Key>
<Key ID="STR_ACE_Refuel_TurnOn">
<English>Start fueling</English>
<German>Betankung beginnen</German>
</Key>
<Key ID="STR_ACE_Refuel_TurnOnAction">
<English>Starting fueling ...</English>
<German>Beginne Betankung ...</German>
</Key>
<Key ID="STR_ACE_Refuel_Hint_FuelProgress">
<English>%1 Liters fueled</English>
<German>%1 Liters getankt</German>
</Key>
<Key ID="STR_ACE_Refuel_Hint_SourceEmpty">
<English>The fuel source is empty.</English>
<German>Die Treibstoffquelle ist leer.</German>
</Key>
<Key ID="STR_ACE_Refuel_Hint_TooFar">
<English>Maximum fuel hose length reached.</English>
<German>Maximale Schlauchlänge erreicht.</German>
</Key>
<Key ID="STR_ACE_Refuel_Hint_Completed">
<English>Fueling completed</English>
<German>Betankung abgeschlossen</German>
</Key>
<Key ID="STR_ACE_Refuel_Hint_Stopped">
<English>Fueling stopped</English>
<German>Betankung angehalten</German>
</Key>
<Key ID="STR_ACE_Refuel_Hint_Started">
<English>Fueling started</English>
<German>Betankung begonnen</German>
</Key>
<Key ID="STR_ACE_Refuel_Return">
<English>Return fuel nozzle</English>
<German>Zapfpistole zurückstecken</German>
</Key>
<Key ID="STR_ACE_Refuel_ReturnAction">
<English>Returning fuel nozzle ...</English>
<German>Stecke Zapfpistole zurück ...</German>
</Key>
<Key ID="STR_ACE_Refuel_CheckFuelCounter">
<English>Check fuel counter</English>
<German>Tankuhr ansehen</German>
</Key>
<Key ID="STR_ACE_Refuel_CheckFuelCounterAction">
<English>>Checking fuel counter ...</English>
<German>Betrachte Tankuhr ...</German>
</Key>
<Key ID="STR_ACE_Refuel_Hint_FuelCounter">
<English>%1 liters have been fueled.</English>
<German>%1 Liter wurden getankt.</German>
</Key>
</Package>
</Project>

Binary file not shown.

Binary file not shown.

View File

@ -5,10 +5,11 @@ Adds keys as an item, to lock and unlock vehicles.
Primary target would be role play or TVT, but has uses in all game types, even co-ops (e.g.: DAC AI will steal unlocked vehicles) Primary target would be role play or TVT, but has uses in all game types, even co-ops (e.g.: DAC AI will steal unlocked vehicles)
Two key modes (can be used together): Two key modes (can be used together):
- Simple Side based keys (e.g. "ACE_key_west" works on any [WEST] vehicle like the M-ATV//hunter) * Simple Side based keys (e.g. "ACE_key_west" works on any [WEST] vehicle like the M-ATV//hunter)
- Custom keys (one key will only open a specific vehicle and nothing else) * Custom keys (one key will only open a specific vehicle and nothing else)
#### Items Added: #### Items Added:
`ACE_key_lockpick` `ACE_key_lockpick`
`ACE_key_master` `ACE_key_master`
`ACE_key_west` `ACE_key_west`
@ -19,21 +20,19 @@ Two key modes (can be used together):
#### Magazine added: #### Magazine added:
`ACE_key_customKeyMagazine` (should never be manualy added, needs to be "programed" to work on a vehicle, see `ACE_VehicleLock_fnc_addKeyForVehicle`) `ACE_key_customKeyMagazine` (should never be manualy added, needs to be "programed" to work on a vehicle, see `ACE_VehicleLock_fnc_addKeyForVehicle`)
## For Mission Makers: ## For Mission Makers:
#### Modules: #### Modules:
- Vehicle Lock Setup - Settings for locking inventory of locked vehicles, default lockpick time, and initial vehicle lock state. * Vehicle Lock Setup - Settings for locking inventory of locked vehicles, default lockpick time, and initial vehicle lock state.
- Vehicle Key Assign - Sync with vehicles and players. Will handout custom keys to players for every synced vehicle. Will NOT work for JIP units. * Vehicle Key Assign - Sync with vehicles and players. Will handout custom keys to players for every synced vehicle. Will NOT work for JIP units.
#### Vehicle setVariables: #### Vehicle setVariables:
- `ACE_VehicleLock_lockSide` - SIDE: overrides a vehicle's side, allows indfor to use little-bird's with indp keys * `ACE_VehicleLock_lockSide` - SIDE: overrides a vehicle's side, allows indfor to use little-bird's with indp keys
- `ACE_vehicleLock_lockpickStrength` - NUMBER: secons, determines how long lockpicking with take, overrides ACE_VehicleLock_DefaultLockpickStrength * `ACE_vehicleLock_lockpickStrength` - NUMBER: secons, determines how long lockpicking with take, overrides ACE_VehicleLock_DefaultLockpickStrength
#### Public Functions: #### Public Functions:
`[bob, car1, true] call ACE_VehicleLock_fnc_addKeyForVehicle;` - will add a `ACE_key_customKeyMagazine` to bob and program it to work on car1 `[bob, car1, true] call ACE_VehicleLock_fnc_addKeyForVehicle;` - will add a `ACE_key_customKeyMagazine` to bob and program it to work on car1
## Maintainers ## Maintainers
The people responsible for merging changes to this component or answering potential questions. The people responsible for merging changes to this component or answering potential questions.

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

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

View File

@ -28,6 +28,7 @@ class cfgVehicles {
class CommanderOptics; class CommanderOptics;
}; };
class rhs_bmd_base: Tank_F { class rhs_bmd_base: Tank_F {
EGVAR(refuel,fuelCapacity) = 300;
class Turrets: Turrets { class Turrets: Turrets {
class CommanderOptics: NewTurret { class CommanderOptics: NewTurret {
ace_fcs_Enabled = 0; ace_fcs_Enabled = 0;
@ -41,6 +42,7 @@ class cfgVehicles {
}; };
}; };
class rhs_bmp1tank_base: Tank_F { class rhs_bmp1tank_base: Tank_F {
EGVAR(refuel,fuelCapacity) = 460;
class Turrets: Turrets { class Turrets: Turrets {
class MainTurret: MainTurret { class MainTurret: MainTurret {
ace_fcs_Enabled = 0; ace_fcs_Enabled = 0;
@ -57,13 +59,14 @@ class cfgVehicles {
class MainTurret: MainTurret { class MainTurret: MainTurret {
class Turrets: Turrets { class Turrets: Turrets {
class CommanderOptics : CommanderOptics { class CommanderOptics : CommanderOptics {
ace_fcs_Enabled = 0; ace_fcs_Enabled = 0;
}; };
}; };
}; };
}; };
}; };
class rhs_bmp3tank_base: Tank_F { class rhs_bmp3tank_base: Tank_F {
EGVAR(refuel,fuelCapacity) = 460;
class Turrets: Turrets { class Turrets: Turrets {
class MainTurret: MainTurret { class MainTurret: MainTurret {
ace_fcs_Enabled = 0; ace_fcs_Enabled = 0;
@ -79,6 +82,7 @@ class cfgVehicles {
}; };
}; };
class rhs_btr_base: Wheeled_APC_F { class rhs_btr_base: Wheeled_APC_F {
EGVAR(refuel,fuelCapacity) = 300;
class Turrets: Turrets { class Turrets: Turrets {
class MainTurret: MainTurret { class MainTurret: MainTurret {
ace_fcs_Enabled = 0; ace_fcs_Enabled = 0;
@ -89,6 +93,7 @@ class cfgVehicles {
}; };
}; };
class rhs_a3spruttank_base: Tank_F { class rhs_a3spruttank_base: Tank_F {
EGVAR(refuel,fuelCapacity) = 400;
class Turrets: Turrets { class Turrets: Turrets {
class MainTurret: MainTurret { class MainTurret: MainTurret {
ace_fcs_Enabled = 0; ace_fcs_Enabled = 0;
@ -105,6 +110,7 @@ class cfgVehicles {
}; };
}; };
class rhs_a3t72tank_base: Tank_F { class rhs_a3t72tank_base: Tank_F {
EGVAR(refuel,fuelCapacity) = 1200;
class Turrets: Turrets { class Turrets: Turrets {
class MainTurret: MainTurret { class MainTurret: MainTurret {
ace_fcs_Enabled = 0; ace_fcs_Enabled = 0;
@ -133,6 +139,7 @@ class cfgVehicles {
}; };
}; };
class rhs_tank_base: Tank_F { class rhs_tank_base: Tank_F {
EGVAR(refuel,fuelCapacity) = 1200;
class Turrets: Turrets { class Turrets: Turrets {
class MainTurret: MainTurret { class MainTurret: MainTurret {
ace_fcs_Enabled = 0; ace_fcs_Enabled = 0;
@ -153,4 +160,71 @@ class cfgVehicles {
{ {
ace_gforcecoef = 0.55; ace_gforcecoef = 0.55;
}; };
};
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;
};
};

View File

@ -6,7 +6,7 @@ class CfgPatches {
weapons[] = {}; weapons[] = {};
requiredVersion = REQUIRED_VERSION; requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"rhs_c_weapons", "rhs_c_troops"}; requiredAddons[] = {"rhs_c_weapons", "rhs_c_troops"};
author[]={"Ruthberg"}; author[]={"Ruthberg", "GitHawk"};
VERSION_CONFIG; VERSION_CONFIG;
}; };
}; };
@ -14,4 +14,4 @@ class CfgPatches {
#include "CfgAmmo.hpp" #include "CfgAmmo.hpp"
#include "CfgMagazines.hpp" #include "CfgMagazines.hpp"
#include "CfgWeapons.hpp" #include "CfgWeapons.hpp"
#include "CfgVehicles.hpp" #include "CfgVehicles.hpp"

View File

@ -15,6 +15,7 @@ class cfgVehicles {
class MBT_01_base_F: Tank_F {}; class MBT_01_base_F: Tank_F {};
class rhsusf_m1a1tank_base: MBT_01_base_F { class rhsusf_m1a1tank_base: MBT_01_base_F {
EGVAR(refuel,fuelCapacity) = 1909;
class Turrets: Turrets { class Turrets: Turrets {
class MainTurret: MainTurret { class MainTurret: MainTurret {
ace_fcs_Enabled = 0; ace_fcs_Enabled = 0;
@ -29,4 +30,67 @@ class cfgVehicles {
}; };
}; };
}; };
};
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;
};
};

View File

@ -6,7 +6,7 @@ class CfgPatches {
weapons[] = {}; weapons[] = {};
requiredVersion = REQUIRED_VERSION; requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"rhsusf_c_weapons", "rhsusf_c_troops"}; requiredAddons[] = {"rhsusf_c_weapons", "rhsusf_c_troops"};
author[]={"Ruthberg"}; author[]={"Ruthberg", "GitHawk"};
VERSION_CONFIG; VERSION_CONFIG;
}; };
}; };
@ -14,4 +14,4 @@ class CfgPatches {
#include "CfgAmmo.hpp" #include "CfgAmmo.hpp"
#include "CfgMagazines.hpp" #include "CfgMagazines.hpp"
#include "CfgWeapons.hpp" #include "CfgWeapons.hpp"
#include "CfgVehicles.hpp" #include "CfgVehicles.hpp"