mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Refuel - Add enable setting (#7613)
* Add enable setting * Exclude man class init * Fix multiplayer terrain pump fuel sync * Add terrain pumps positions * Add vanilla fuel cargo restoring before destroying * Add Livonia positions by bux * Fix terrain pumps destruction * Improve settings init * Fix double settings category * Check enabled var in public functions * Fix fnc_makeSource * Handle recent CUP Terrains changes * Update includes * Fix issues introduced in #9133 * Change warning Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> * Optimisations and cleanup - Use hashmaps wherever possible - Reduced pump search radius by ~30% - Sorted pumps alphabetically and sorted positions by "smallest" first, for consistency * Add init debug trace * compileScript in dev * yoda conditions & DFUNC macro * Wait until CBA settings are ready * Update Chernarus 2020 and add more maps configs * Remove vanilla fuel cargo restoring before destroying --------- Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com>
This commit is contained in:
parent
f97f11d224
commit
7c65f8503d
90
addons/refuel/ACE_Refuel_Positions.hpp
Normal file
90
addons/refuel/ACE_Refuel_Positions.hpp
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
class GVAR(positions) {
|
||||||
|
Altis[] = { /* Altis */ {"Land_fs_feed_F", {{3757,13478,0},{4001,12592,0},{5023,14430,0},{5769,20086,0},{6199,15081,0},{6798,15561,0},{8482,18261,0},{9026,15729,0},{9206,12112,0},{11832,14156,0},{12025,15830,0},{14173,16542,0},{14221,18303,0},{15297,17566,0},{15781,17453,0},{16751,12513,0},{16875,15469,0},{17417,13937,0},{19961,11454,0},{20785,16666,0},{21231,7117,0},{23379,19799,0},{25701,21373,0}}}};
|
||||||
|
Stratis[] = { /* Stratis */ {"Land_FuelStation_Feed_F", {{2708,5788,0}}}};
|
||||||
|
VR[] = {};
|
||||||
|
Malden[] = { /* Malden 2035 */
|
||||||
|
{"Land_fs_feed_F", {{3227,6291,0},{5111,9062,0},{5504,3500,0},{6633,8807,0},{7047,7052,0}}},
|
||||||
|
{"Land_FuelStation_01_pump_malevil_F", {{7224,7772,0},{8047,4023,0}}},
|
||||||
|
{"Land_FuelStation_Feed_F", {{10063,3988,0},{11600,4477,0}}}
|
||||||
|
};
|
||||||
|
Tanoa[] = { /* Tanoa */
|
||||||
|
{"Land_fs_feed_F", {{2132,3360,0},{2452,7435,0},{3030,11316,0},{5174,8806,0},{5380,4093,0},{5594,12508,0},{7978,7419,0},{8319,9709,0},{8494,12432,0},{8954,13678,0},{8970,10332,0},{10827,6490,0},{10941,9855,0},{11146,5152,0},{11631,2999,0},{14261,11513,0},{14365,8743,0}}},
|
||||||
|
{"Land_FuelStation_01_pump_F", {{1865,12128,0},{5409,9905,0},{5682,10165,0},{5776,4222,0},{5793,10825,0},{6592,13080,0},{6887,7491,0},{7359,7998,0},{9954,13467,0},{11635,13047,0},{11694,2271,0},{12613,7583,0}}}
|
||||||
|
};
|
||||||
|
Enoch[] = { /* Livonia */
|
||||||
|
{"Land_FuelStation_03_pump_F", {{2008,7365,0},{6259,3949,0}}},
|
||||||
|
{"Land_FuelStation_Feed_F", {{10208,2173,0}}}
|
||||||
|
};
|
||||||
|
|
||||||
|
Bootcamp_ACR[] = { /* CUP Bukovina */ {"Land_A_FuelStation_Feed", {{652,473,0},{2849,1612,0}}}};
|
||||||
|
Woodland_ACR[] = { /* CUP Bystrica */ {"Land_A_FuelStation_Feed", {{447,1381,0},{1302,2185,0},{1855,6852,0},{4102,1195,0},{4755,4499,0}}}};
|
||||||
|
chernarus[] = { /* CUP Chernarus (Autumn) */ {"Land_A_FuelStation_Feed", {{2021,2242,0},{2692,5602,0},{2997,7471,0},{3648,8968,0},{4733,6381,0},{5847,2191,0},{5849,10112,0},{6705,2996,0},{7255,7662,0},{9502,2005,0},{10154,5300,0},{10446,8866,0},{10726,10786,0},{12988,10076,0},{13385,6603,0}}}};
|
||||||
|
chernarus_summer[] = { /* CUP Chernarus (Summer) */ {"Land_A_FuelStation_Feed", {{2021,2242,0},{2685,5606,0},{2998,7473,0},{3652,8973,0},{4733,6381,0},{5854,2193,0},{5849,10112,0},{6702,2995,0},{7255,7662,0},{9502,2005,0},{10154,5300,0},{10452,8869,0},{10726,10786,0},{13001,10074,0},{13398,6606,0}}}};
|
||||||
|
Chernarus_Winter[] = { /* CUP Chernarus (Winter) */ {"Land_A_FuelStation_Feed", {{2021,2242,0},{2685,5604,0},{2997,7471,0},{3657,8979,0},{4733,6381,0},{5854,2193,0},{5849,10112,0},{6702,2995,0},{7255,7662,0},{9503,2019,0},{10155,5309,0},{10452,8869,0},{10726,10786,0},{12994,10075,0},{13385,6603,0}}}};
|
||||||
|
cup_chernarus_A3[] = { /* CUP Chernarus 2020 */
|
||||||
|
{"Land_fs_feed_F", {{2511,5279,0}}},
|
||||||
|
{"Land_FuelStation_03_pump_F", {{313,9385,0},{1129,2400,0},{2021,2242,0},{2692,5602,0},{2991,7471,1},{3007,12654,0},{3648,8968,0},{4328,13081,0},{4733,6381,0},{5847,2191,0},{5849,10112,0},{6699,3001,0},{7255,7662,0},{7494,12662,0},{9502,2005,0},{10155,5309,0},{10452,8869,0},{10726,10786,0},{13001,10074,0},{13398,6606,0},{13569,13329,0}}}
|
||||||
|
};
|
||||||
|
Desert_E[] = { /* CUP Desert */ };
|
||||||
|
porto[] = { /* CUP Porto */ };
|
||||||
|
ProvingGrounds_PMC[] = { /* CUP Proving Grounds */ {"Land_FuelStation_Feed_PMC", {{698,1208,0}}}};
|
||||||
|
intro[] = { /* CUP Rahmadi */ };
|
||||||
|
sara[] = { /* CUP Sahrani */
|
||||||
|
{"Land_Benzina_schnell", {{8473,9423,0},{9227,5840,0},{9433,5187,0},{10168,6423,0},{10932,9475,0},{11233,6114,0},{11756,10227,0},{12289,6833,0}}},
|
||||||
|
{"Land_Fuelstation_army", {{9568,9819,0},{19294,13879,0}}},
|
||||||
|
};
|
||||||
|
sara_dbe1[] = { /* CUP United Sahrani */
|
||||||
|
{"Land_Benzina_schnell", {{8473,9423,0},{9227,5840,0},{9433,5187,0},{10168,6423,0},{10932,9475,0},{11233,6114,0},{11756,10227,0},{12289,6833,0}}},
|
||||||
|
{"Land_Fuelstation_army", {{9568,9819,0},{19294,13879,0}}}
|
||||||
|
};
|
||||||
|
saralite[] = { /* CUP Southern Sahrani */
|
||||||
|
{"Land_Benzina_schnell", {{3593,6663,0},{4347,3080,0},{4553,2427,0},{5288,3663,0},{6052,6715,0},{6353,3354,0},{6876,7467,0},{7409,4073,0}}},
|
||||||
|
{"Land_Fuelstation_army", {{4688,7059,0}}}
|
||||||
|
};
|
||||||
|
Shapur_BAF[] = { /* CUP Shapur */ {"Land_Ind_FuelStation_Feed_EP1", {{1512,1298,0}}}};
|
||||||
|
takistan[] = { /* CUP Takistan */ {"Land_Ind_FuelStation_Feed_EP1", {{2004,11720,0},{3081,9848,0},{3549,4197,0},{5538,9284,0},{5836,5771,0},{7497,1818,0},{8248,7800,0},{10422,6328,0},{10647,11021,0}}}};
|
||||||
|
Mountains_ACR[] = { /* CUP Takistan Mountains */ {"Land_Ind_FuelStation_Feed_EP1", {{2962,4197,0},{5249,5771,0}}}};
|
||||||
|
utes[] = { /* CUP Utes */ };
|
||||||
|
zargabad[] = { /* CUP Zargabad */ {"Land_Ind_FuelStation_Feed_EP1", {{3736,2784,0},{3867,4208,0},{3871,5980,0},{5027,1906,0}}}};
|
||||||
|
|
||||||
|
pja310[] = { /* G.O.S Al Rayak */ {"Land_Ind_FuelStation_Feed_EP1", {{887,18588,0},{964,18356,0},{1196,18463,0},{1872,8754,0},{2051,8437,0},{2125,8238,0},{2240,8584,0},{2310,8566,0},{2366,3901,0},{2879,13142,0},{3880,10361,0},{4056,13261,0},{4122,13487,0},{4302,13628,0},{4475,13377,0},{4556,13742,0},{6461,3372,0},{7216,6059,0},{7228,6344,0},{7416,6099,0},{7472,6838,0},{7591,6081,0},{11650,3536,0},{14863,7292,0},{16466,18897,0},{16476,19116,0},{16642,18994,0},{16676,19199,0},{16858,10558,0},{16908,9959,0},{17120,3706,0},{17100,4375,0},{18056,4133,0},{18229,4066,0},{18235,4571,0},{18814,5010,0}}}};
|
||||||
|
australia[] = { /* Aussie Australia v5.09 */
|
||||||
|
{"Land_fs_feed_F", {{4614,16978,0},{5509,19273,0},{5487,19276,0},{5508,19330,0},{5540,19357,0},{5564,19377,0},{5623,19376,0},{5643,19352,0},{6355,17860,0},{12811,27772,0},{15837,33438,0},{16335,33436,0},{16367,33436,0},{17127,33902,0},{20754,12737,0},{20874,12793,0},{20901,12793,1},{22127,25635,0},{22127,25666,0},{22162,25712,0},{22194,25712,0},{22213,25630,0},{22315,19235,0},{22595,24757,0},{24909,13855,0},{25050,12786,0},{25071,12786,0},{26085,11260,1},{26212,11174,0},{26824,28005,0},{27719,17108,0},{27757,12033,0},{28473,35132,0},{30707,11879,0},{31091,5370,0},{31096,10918,0},{31096,10945,0},{31165,10914,0},{31165,10958,0},{31313,16763,0},{31515,9673,0},{31515,9652,0},{31758,4861,0},{32224,2736,0},{33919,13364,0},{33936,13350,0},{34789,26383,0},{35274,26021,2},{35786,12148,0},{35765,12170,0},{35835,12145,0},{35833,12188,0},{35812,12210,0},{36199,16479,0},{36399,13140,0},{36593,12065,0},{36574,13089,0},{36595,13089,0},{36597,13282,0},{38153,14544,0},{38520,18891,0},{38515,20173,0},{38535,20198,0},{38565,20198,0}}},
|
||||||
|
{"Land_FuelStation_01_pump_F", {{5495,18693,0},{32067,29608,0},{32087,29611,0},{33215,4147,0},{37293,13172,0},{37293,13193,0}}},
|
||||||
|
{"Land_FuelStation_Feed_F", {{19303,16449,0},{31064,20116,0}}}
|
||||||
|
};
|
||||||
|
Farabad[] = { /* Farabad */
|
||||||
|
{"Land_Benzina_schnell", {{592,7505,0},{804,1445,0},{3132,3129,0}}},
|
||||||
|
{"Land_fs_feed_F", {{1920,4960,0},{5052,4703,1},{9456,9277,0}}},
|
||||||
|
{"Land_FuelStation_01_pump_F", {{2378,6248,0},{7092,534,0}}},
|
||||||
|
{"Land_Ind_FuelStation_Feed_EP1", {{4788,5525,0}}}
|
||||||
|
};
|
||||||
|
IslaPera[] = { /* Isla Pera */
|
||||||
|
{"Land_fs_feed_F", {{1855,2866,0}}},
|
||||||
|
{"Land_FuelStation_01_pump_malevil_F", {{3981,2065,0},{5306,8796,0},{9236,4287,0}}}
|
||||||
|
};
|
||||||
|
VTF_Lybor[] = { /* Lybor */
|
||||||
|
{"Land_FuelStation_03_pump_F", {{3879,3823,0}}},
|
||||||
|
{"Land_FuelStation_Feed_F", {{1831,2694,0},{2175,3323,0},{3304,2981,0},{4271,3024,0}}}
|
||||||
|
};
|
||||||
|
rof_mok[] = { /* Mull of Kintyre, Scotland */
|
||||||
|
{"Land_A_FuelStation_Feed", {{12837,5124,1},{15271,17533,0},{19453,21896,0}}},
|
||||||
|
{"Land_fs_feed_F", {{7492,17369,0}}},
|
||||||
|
{"Land_Fuelstation", {{10284,18679,0}}},
|
||||||
|
{"Land_Ind_FuelStation_Feed_EP1", {{9762,16325,0}}}
|
||||||
|
};
|
||||||
|
pulau[] = { /* Pulau */
|
||||||
|
{"Land_fs_feed_F", {{2368,3128,0},{4891,7168,0},{7358,7368,0}}},
|
||||||
|
{"Land_FuelStation_Feed_F", {{5994,5789,0}}}
|
||||||
|
};
|
||||||
|
WL_Rosche[] = { /* Rosche, Germany (2.0) */
|
||||||
|
{"Land_fs_feed_F", {{693,4803,0},{12059,6700,0},{13320,14822,0}}},
|
||||||
|
{"Land_FuelStation_01_pump_F", {{447,6859,0}}},
|
||||||
|
{"Land_Ind_FuelStation_Feed_EP1", {{1437,5455,0}}}
|
||||||
|
};
|
||||||
|
Kapaulio[] = { /* Saint Kapaulio */
|
||||||
|
{"Land_fs_feed_F", {{931,7647,0},{958,6796,0},{2034,9426,0},{2563,9427,0},{3500,8110,0},{3602,6082,0},{4222,6308,0},{4561,693,0},{8077,5906,0},{8434,13145,0},{8525,17299,0},{9265,7155,0},{10527,18267,0},{12078,1846,0},{12833,6464,0},{13433,6327,0},{14084,6308,0},{14172,7786,0},{14831,4649,0},{16080,14743,0},{17356,2312,0},{18047,5254,0},{18318,5042,0}}},
|
||||||
|
{"Land_FuelStation_01_pump_malevil_F", {{18039,18139,0}}},
|
||||||
|
{"Land_FuelStation_Feed_F", {{756,12133,0},{1239,7346,0},{1726,17469,0},{3113,10070,0},{3828,8362,0},{5668,16967,0},{7435,14185,0},{7543,12107,0},{8366,6086,0},{9672,9586,0},{11749,12255,0},{12802,10022,0},{13989,3591,0},{15198,10900,0},{19063,1654,0},{19378,18517,0}}}
|
||||||
|
};
|
||||||
|
};
|
@ -1,7 +1,4 @@
|
|||||||
#define GET_NUMBER(config,default) (if (isNumber (config)) then {getNumber (config)} else {default})
|
|
||||||
#define GET_1ST_ARRAY(config) (if (isArray (config)) then {getArray (config) select 0} else {[ARR_3(0,0,0)]})
|
#define GET_1ST_ARRAY(config) (if (isArray (config)) then {getArray (config) select 0} else {[ARR_3(0,0,0)]})
|
||||||
|
|
||||||
#define DEFAULT_FUELCARGO GET_NUMBER(configOf _this >> QQGVAR(fuelCargo),REFUEL_DISABLED_FUEL)
|
|
||||||
#define DEFAULT_HOOKS GET_1ST_ARRAY(configOf _this >> QQGVAR(hooks))
|
#define DEFAULT_HOOKS GET_1ST_ARRAY(configOf _this >> QQGVAR(hooks))
|
||||||
|
|
||||||
class Cfg3DEN {
|
class Cfg3DEN {
|
||||||
@ -14,8 +11,8 @@ class Cfg3DEN {
|
|||||||
tooltip = CSTRING(fuelCargo_edenDesc);
|
tooltip = CSTRING(fuelCargo_edenDesc);
|
||||||
property = QGVAR(fuelCargo);
|
property = QGVAR(fuelCargo);
|
||||||
control = "EditShort";
|
control = "EditShort";
|
||||||
expression = QUOTE(if (_value != DEFAULT_FUELCARGO) then {[ARR_2(_this,_value)] call DFUNC(makeSource)});
|
expression = QUOTE(if (_value != (_this call FUNC(getFuelCargo))) then {[ARR_2(_this,_value)] call FUNC(makeSource)});
|
||||||
defaultValue = QUOTE(DEFAULT_FUELCARGO);
|
defaultValue = QUOTE(_this call FUNC(getFuelCargo));
|
||||||
validate = "number";
|
validate = "number";
|
||||||
condition = "(1-objectBrain)*(1-objectAgent)";
|
condition = "(1-objectBrain)*(1-objectAgent)";
|
||||||
typeName = "NUMBER";
|
typeName = "NUMBER";
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#define XEH_INHERITED class EventHandlers {class CBA_Extended_EventHandlers: CBA_Extended_EventHandlers {};}
|
||||||
|
|
||||||
class CBA_Extended_EventHandlers;
|
class CBA_Extended_EventHandlers;
|
||||||
|
|
||||||
class CfgNonAIVehicles {
|
class CfgNonAIVehicles {
|
||||||
@ -45,9 +47,7 @@ class CfgVehicles {
|
|||||||
|
|
||||||
class ThingX;
|
class ThingX;
|
||||||
class GVAR(fuelNozzle): ThingX {
|
class GVAR(fuelNozzle): ThingX {
|
||||||
class EventHandlers {
|
XEH_INHERITED;
|
||||||
class CBA_Extended_EventHandlers: CBA_Extended_EventHandlers {};
|
|
||||||
};
|
|
||||||
|
|
||||||
displayName = QGVAR(fuelNozzle);
|
displayName = QGVAR(fuelNozzle);
|
||||||
scope = 1;
|
scope = 1;
|
||||||
@ -275,12 +275,6 @@ class CfgVehicles {
|
|||||||
GVAR(hooks)[] = {{0.38,-3.17,-0.7},{-0.41,-3.17,-0.7}};
|
GVAR(hooks)[] = {{0.38,-3.17,-0.7},{-0.41,-3.17,-0.7}};
|
||||||
GVAR(fuelCargo) = 2000;
|
GVAR(fuelCargo) = 2000;
|
||||||
};
|
};
|
||||||
class C_Van_01_fuel_F: Van_01_fuel_base_F {
|
|
||||||
transportFuel = 0; //1k
|
|
||||||
};
|
|
||||||
class I_G_Van_01_fuel_F: Van_01_fuel_base_F {
|
|
||||||
transportFuel = 0; //1k
|
|
||||||
};
|
|
||||||
|
|
||||||
class Tank_F: Tank {
|
class Tank_F: Tank {
|
||||||
GVAR(fuelCapacity) = 1200;
|
GVAR(fuelCapacity) = 1200;
|
||||||
@ -295,7 +289,6 @@ class CfgVehicles {
|
|||||||
class B_APC_Tracked_01_base_F: APC_Tracked_01_base_F {};
|
class B_APC_Tracked_01_base_F: APC_Tracked_01_base_F {};
|
||||||
|
|
||||||
class B_APC_Tracked_01_CRV_F: B_APC_Tracked_01_base_F {
|
class B_APC_Tracked_01_CRV_F: B_APC_Tracked_01_base_F {
|
||||||
transportFuel = 0; //3k
|
|
||||||
GVAR(hooks)[] = {{-1.08,-4.81,-0.8}};
|
GVAR(hooks)[] = {{-1.08,-4.81,-0.8}};
|
||||||
GVAR(fuelCargo) = 1000;
|
GVAR(fuelCargo) = 1000;
|
||||||
};
|
};
|
||||||
@ -407,7 +400,6 @@ class CfgVehicles {
|
|||||||
|
|
||||||
// Vanilla fuel vehicles
|
// Vanilla fuel vehicles
|
||||||
class Truck_02_fuel_base_F: Truck_02_base_F {
|
class Truck_02_fuel_base_F: Truck_02_base_F {
|
||||||
transportFuel = 0; //3k
|
|
||||||
GVAR(hooks)[] = {{0.99,-3.47,-0.67},{-1.04,-3.47,-0.67}};
|
GVAR(hooks)[] = {{0.99,-3.47,-0.67},{-1.04,-3.47,-0.67}};
|
||||||
GVAR(fuelCargo) = 10000;
|
GVAR(fuelCargo) = 10000;
|
||||||
};
|
};
|
||||||
@ -416,13 +408,11 @@ class CfgVehicles {
|
|||||||
};
|
};
|
||||||
|
|
||||||
class B_Truck_01_fuel_F: B_Truck_01_mover_F {
|
class B_Truck_01_fuel_F: B_Truck_01_mover_F {
|
||||||
transportFuel = 0; //3k
|
|
||||||
GVAR(hooks)[] = {{0.28,-4.99,-0.3},{-0.25,-4.99,-0.3}};
|
GVAR(hooks)[] = {{0.28,-4.99,-0.3},{-0.25,-4.99,-0.3}};
|
||||||
GVAR(fuelCargo) = 10000;
|
GVAR(fuelCargo) = 10000;
|
||||||
};
|
};
|
||||||
|
|
||||||
class O_Truck_03_fuel_F: Truck_03_base_F {
|
class O_Truck_03_fuel_F: Truck_03_base_F {
|
||||||
transportFuel = 0; //3k
|
|
||||||
GVAR(hooks)[] = {{1.3,-1.59,-0.62},{-1.16,-1.59,-0.62}};
|
GVAR(hooks)[] = {{1.3,-1.59,-0.62},{-1.16,-1.59,-0.62}};
|
||||||
GVAR(fuelCargo) = 10000;
|
GVAR(fuelCargo) = 10000;
|
||||||
};
|
};
|
||||||
@ -436,20 +426,17 @@ class CfgVehicles {
|
|||||||
|
|
||||||
class Pod_Heli_Transport_04_base_F: Slingload_base_F {};
|
class Pod_Heli_Transport_04_base_F: Slingload_base_F {};
|
||||||
class Land_Pod_Heli_Transport_04_fuel_F: Pod_Heli_Transport_04_base_F {
|
class Land_Pod_Heli_Transport_04_fuel_F: Pod_Heli_Transport_04_base_F {
|
||||||
transportFuel = 0; //3k
|
|
||||||
GVAR(hooks)[] = {{-1.49,1.41,-0.3}};
|
GVAR(hooks)[] = {{-1.49,1.41,-0.3}};
|
||||||
GVAR(fuelCargo) = 10000;
|
GVAR(fuelCargo) = 10000;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Slingload_01_Base_F: Slingload_base_F {};
|
class Slingload_01_Base_F: Slingload_base_F {};
|
||||||
class B_Slingload_01_Fuel_F: Slingload_01_Base_F {
|
class B_Slingload_01_Fuel_F: Slingload_01_Base_F {
|
||||||
transportFuel = 0; //3k
|
|
||||||
GVAR(hooks)[] = {{0.55,3.02,-0.5},{-0.52,3.02,-0.5}};
|
GVAR(hooks)[] = {{0.55,3.02,-0.5},{-0.52,3.02,-0.5}};
|
||||||
GVAR(fuelCargo) = 10000;
|
GVAR(fuelCargo) = 10000;
|
||||||
};
|
};
|
||||||
|
|
||||||
class O_Heli_Transport_04_fuel_F: Heli_Transport_04_base_F {
|
class O_Heli_Transport_04_fuel_F: Heli_Transport_04_base_F {
|
||||||
transportFuel = 0; //3k
|
|
||||||
GVAR(hooks)[] = {{-1.52,1.14,-1.18}};
|
GVAR(hooks)[] = {{-1.52,1.14,-1.18}};
|
||||||
GVAR(fuelCargo) = 10000;
|
GVAR(fuelCargo) = 10000;
|
||||||
};
|
};
|
||||||
@ -466,11 +453,7 @@ class CfgVehicles {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
class Land_StorageBladder_01_F: StorageBladder_base_F {
|
class Land_StorageBladder_01_F: StorageBladder_base_F {
|
||||||
class EventHandlers {
|
XEH_INHERITED;
|
||||||
class CBA_Extended_EventHandlers: CBA_Extended_EventHandlers {};
|
|
||||||
};
|
|
||||||
|
|
||||||
transportFuel = 0; //60k
|
|
||||||
GVAR(hooks)[] = {{-3.35,2.45,0.17}};
|
GVAR(hooks)[] = {{-3.35,2.45,0.17}};
|
||||||
GVAR(fuelCargo) = 60000;
|
GVAR(fuelCargo) = 60000;
|
||||||
};
|
};
|
||||||
@ -486,36 +469,35 @@ class CfgVehicles {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
class Land_FlexibleTank_01_F: FlexibleTank_base_F {
|
class Land_FlexibleTank_01_F: FlexibleTank_base_F {
|
||||||
transportFuel = 0; //300
|
|
||||||
GVAR(hooks)[] = {{0, 0, 0.5}};
|
GVAR(hooks)[] = {{0, 0, 0.5}};
|
||||||
GVAR(fuelCargo) = 300;
|
GVAR(fuelCargo) = 300;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Vanilla buildings
|
// Vanilla buildings
|
||||||
class Land_Fuelstation_Feed_F: House_Small_F {
|
class Land_Fuelstation_Feed_F: House_Small_F {
|
||||||
transportFuel = 0; //50k
|
XEH_INHERITED;
|
||||||
GVAR(hooks)[] = {{0,0,-0.5}};
|
GVAR(hooks)[] = {{0,0,-0.5}};
|
||||||
GVAR(fuelCargo) = REFUEL_INFINITE_FUEL;
|
GVAR(fuelCargo) = REFUEL_INFINITE_FUEL;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Land_fs_feed_F: House_Small_F {
|
class Land_fs_feed_F: House_Small_F {
|
||||||
transportFuel = 0; //50k
|
XEH_INHERITED;
|
||||||
GVAR(hooks)[] = {{-0.4,0.022,-0.23}};
|
GVAR(hooks)[] = {{-0.4,0.022,-0.23}};
|
||||||
GVAR(fuelCargo) = REFUEL_INFINITE_FUEL;
|
GVAR(fuelCargo) = REFUEL_INFINITE_FUEL;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Land_FuelStation_01_pump_F: House_F {
|
class Land_FuelStation_01_pump_F: House_F {
|
||||||
transportFuel = 0; //50k
|
XEH_INHERITED;
|
||||||
GVAR(hooks)[] = {{0, 0.4, -0.5}, {0, -0.4, -0.5}};
|
GVAR(hooks)[] = {{0, 0.4, -0.5}, {0, -0.4, -0.5}};
|
||||||
GVAR(fuelCargo) = REFUEL_INFINITE_FUEL;
|
GVAR(fuelCargo) = REFUEL_INFINITE_FUEL;
|
||||||
};
|
};
|
||||||
class Land_FuelStation_01_pump_malevil_F: House_F {
|
class Land_FuelStation_01_pump_malevil_F: House_F {
|
||||||
transportFuel = 0; //50k
|
XEH_INHERITED;
|
||||||
GVAR(hooks)[] = {{0, 0.4, -0.5}, {0, -0.4, -0.5}};
|
GVAR(hooks)[] = {{0, 0.4, -0.5}, {0, -0.4, -0.5}};
|
||||||
GVAR(fuelCargo) = REFUEL_INFINITE_FUEL;
|
GVAR(fuelCargo) = REFUEL_INFINITE_FUEL;
|
||||||
};
|
};
|
||||||
class Land_FuelStation_03_pump_F: House_F { // Enoch
|
class Land_FuelStation_03_pump_F: House_F { // Enoch
|
||||||
transportFuel = 0; //50k
|
XEH_INHERITED;
|
||||||
GVAR(hooks)[] = {{0, 0.4, -0.5}, {0, -0.4, -0.5}};
|
GVAR(hooks)[] = {{0, 0.4, -0.5}, {0, -0.4, -0.5}};
|
||||||
GVAR(fuelCargo) = REFUEL_INFINITE_FUEL;
|
GVAR(fuelCargo) = REFUEL_INFINITE_FUEL;
|
||||||
};
|
};
|
||||||
|
@ -11,6 +11,7 @@ PREP(disconnect);
|
|||||||
PREP(dropNozzle);
|
PREP(dropNozzle);
|
||||||
PREP(getCapacity);
|
PREP(getCapacity);
|
||||||
PREP(getFuel);
|
PREP(getFuel);
|
||||||
|
PREP(getFuelCargo);
|
||||||
PREP(handleDisconnect);
|
PREP(handleDisconnect);
|
||||||
PREP(handleRespawn);
|
PREP(handleRespawn);
|
||||||
PREP(initSource);
|
PREP(initSource);
|
||||||
|
@ -1,95 +1,151 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
if (isServer) then {
|
["CBA_settingsInitialized", {
|
||||||
addMissionEventHandler ["HandleDisconnect", {call FUNC(handleDisconnect)}];
|
if (!GVAR(enabled)) exitWith {};
|
||||||
};
|
|
||||||
|
|
||||||
[QGVAR(initSource), LINKFUNC(initSource)] call CBA_fnc_addEventHandler;
|
["All", "InitPost", {
|
||||||
|
params ["_vehicle"];
|
||||||
|
if (getFuelCargo _vehicle <= 0) exitWith {};
|
||||||
|
TRACE_1("initPost",_vehicle);
|
||||||
|
|
||||||
if (!hasInterface) exitWith {};
|
if (local _vehicle) then {
|
||||||
|
_vehicle setFuelCargo 0;
|
||||||
|
LOG("initPost setFuelCargo");
|
||||||
|
};
|
||||||
|
}, true, ["Man"], true] call CBA_fnc_addClassEventHandler;
|
||||||
|
|
||||||
["isNotRefueling", {!((_this select 0) getVariable [QGVAR(isRefueling), false])}] call EFUNC(common,addCanInteractWithCondition);
|
if (isServer) then {
|
||||||
|
addMissionEventHandler ["HandleDisconnect", {call FUNC(handleDisconnect)}];
|
||||||
|
};
|
||||||
|
|
||||||
["MouseButtonDown", LINKFUNC(onMouseButtonDown)] call CBA_fnc_addDisplayHandler;
|
private _cfgPositions = configFile >> QGVAR(positions) >> worldName;
|
||||||
|
if (isArray _cfgPositions) then {
|
||||||
|
{
|
||||||
|
_x params ["_class", "_positions"];
|
||||||
|
{
|
||||||
|
private _objects = _x nearObjects [_class, 30];
|
||||||
|
if (_objects isEqualTo []) then {
|
||||||
|
WARNING_3("no pumps %1 found near %2 %3",_class,worldName,_x);
|
||||||
|
} else {
|
||||||
|
{
|
||||||
|
// terrain fuel pumps don't trigger init and must setFuelCargo on each client
|
||||||
|
_x setFuelCargo 0;
|
||||||
|
} forEach _objects;
|
||||||
|
};
|
||||||
|
} forEach _positions;
|
||||||
|
} forEach getArray _cfgPositions;
|
||||||
|
|
||||||
GVAR(mainAction) = [
|
// placed in editor static objects don't trigger init but synchronize fuel cargo
|
||||||
QGVAR(Refuel),
|
// placed in editor vehicles both trigger init and synchronize fuel cargo
|
||||||
localize LSTRING(Refuel),
|
{
|
||||||
QPATHTOF(ui\icon_refuel_interact.paa),
|
if (getFuelCargo _x > 0 && {local _x}) then {
|
||||||
{},
|
TRACE_1("allMissionObjects",_x);
|
||||||
{
|
_x setFuelCargo 0;
|
||||||
alive _target
|
};
|
||||||
&& {[_player, _target, [INTERACT_EXCEPTIONS]] call EFUNC(common,canInteractWith)}
|
} forEach allMissionObjects "";
|
||||||
&& {REFUEL_DISABLED_FUEL != ([_target] call FUNC(getCapacity))}
|
} else {
|
||||||
},
|
// here are both terrain and editor static objects
|
||||||
{}, [], [0,0,0],
|
WARNING_2("World %1: %2 is not configured; can load slower",worldName,QGVAR(positions));
|
||||||
REFUEL_ACTION_DISTANCE
|
private _halfWorldSize = worldSize / 2;
|
||||||
] call EFUNC(interact_menu,createAction);
|
private _worldCenter = [_halfWorldSize, _halfWorldSize];
|
||||||
|
_halfWorldSize = _halfWorldSize * sqrt 2;
|
||||||
|
private _refuelMissionObjects = allMissionObjects "" select {getFuelCargo _x > 0};
|
||||||
|
private _baseStaticClasses = keys (uiNamespace getVariable QGVAR(cacheRefuelClassesBaseStatic));
|
||||||
|
|
||||||
GVAR(actions) = [
|
{
|
||||||
[QGVAR(TakeNozzle),
|
{
|
||||||
localize LSTRING(TakeNozzle),
|
_x setFuelCargo 0;
|
||||||
|
} forEach (_worldCenter nearObjects [_x, _halfWorldSize]);
|
||||||
|
} forEach _baseStaticClasses;
|
||||||
|
};
|
||||||
|
|
||||||
|
[QGVAR(initSource), LINKFUNC(initSource)] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
|
if (!hasInterface) exitWith {};
|
||||||
|
|
||||||
|
["isNotRefueling", {!((_this select 0) getVariable [QGVAR(isRefueling), false])}] call EFUNC(common,addCanInteractWithCondition);
|
||||||
|
|
||||||
|
["MouseButtonDown", LINKFUNC(onMouseButtonDown)] call CBA_fnc_addDisplayHandler;
|
||||||
|
|
||||||
|
GVAR(mainAction) = [
|
||||||
|
QGVAR(Refuel),
|
||||||
|
localize LSTRING(Refuel),
|
||||||
QPATHTOF(ui\icon_refuel_interact.paa),
|
QPATHTOF(ui\icon_refuel_interact.paa),
|
||||||
{[_player, _target] call FUNC(TakeNozzle)},
|
{},
|
||||||
{[_player, _target] call FUNC(canTakeNozzle)},
|
{
|
||||||
|
alive _target
|
||||||
|
&& {[_player, _target, [INTERACT_EXCEPTIONS]] call EFUNC(common,canInteractWith)}
|
||||||
|
&& {REFUEL_DISABLED_FUEL != ([_target] call FUNC(getCapacity))}
|
||||||
|
},
|
||||||
{}, [], [0,0,0],
|
{}, [], [0,0,0],
|
||||||
REFUEL_ACTION_DISTANCE
|
REFUEL_ACTION_DISTANCE
|
||||||
] call EFUNC(interact_menu,createAction),
|
] call EFUNC(interact_menu,createAction);
|
||||||
[QGVAR(CheckFuelCounter),
|
|
||||||
localize LSTRING(CheckFuelCounter),
|
|
||||||
QPATHTOF(ui\icon_refuel_interact.paa),
|
|
||||||
{[_player, _target] call FUNC(readFuelCounter)},
|
|
||||||
{true},
|
|
||||||
{}, [], [0,0,0],
|
|
||||||
REFUEL_ACTION_DISTANCE
|
|
||||||
] call EFUNC(interact_menu,createAction),
|
|
||||||
[QGVAR(CheckFuel),
|
|
||||||
localize LSTRING(CheckFuel),
|
|
||||||
QPATHTOF(ui\icon_refuel_interact.paa),
|
|
||||||
{[_player, _target] call FUNC(checkFuel)},
|
|
||||||
{[_player, _target] call FUNC(canCheckFuel)},
|
|
||||||
{}, [], [0,0,0],
|
|
||||||
REFUEL_ACTION_DISTANCE
|
|
||||||
] call EFUNC(interact_menu,createAction),
|
|
||||||
[QGVAR(Return),
|
|
||||||
localize LSTRING(Return),
|
|
||||||
QPATHTOF(ui\icon_refuel_interact.paa),
|
|
||||||
{[_player, _target] call FUNC(returnNozzle)},
|
|
||||||
{[_player, _target] call FUNC(canReturnNozzle)},
|
|
||||||
{}, [], [0,0,0],
|
|
||||||
REFUEL_ACTION_DISTANCE
|
|
||||||
] call EFUNC(interact_menu,createAction)
|
|
||||||
];
|
|
||||||
|
|
||||||
// init menu for config refuel vehicles
|
GVAR(actions) = [
|
||||||
private _cacheRefuelClasses = call (uiNamespace getVariable [QGVAR(cacheRefuelClasses), {[[],[]]}]);
|
[QGVAR(TakeNozzle),
|
||||||
_cacheRefuelClasses params [["_staticClasses", [], [[]]], ["_dynamicClasses", [], [[]]]];
|
localize LSTRING(TakeNozzle),
|
||||||
|
QPATHTOF(ui\icon_refuel_interact.paa),
|
||||||
|
{[_player, _target] call FUNC(TakeNozzle)},
|
||||||
|
{[_player, _target] call FUNC(canTakeNozzle)},
|
||||||
|
{}, [], [0,0,0],
|
||||||
|
REFUEL_ACTION_DISTANCE
|
||||||
|
] call EFUNC(interact_menu,createAction),
|
||||||
|
[QGVAR(CheckFuelCounter),
|
||||||
|
localize LSTRING(CheckFuelCounter),
|
||||||
|
QPATHTOF(ui\icon_refuel_interact.paa),
|
||||||
|
{[_player, _target] call FUNC(readFuelCounter)},
|
||||||
|
{true},
|
||||||
|
{}, [], [0,0,0],
|
||||||
|
REFUEL_ACTION_DISTANCE
|
||||||
|
] call EFUNC(interact_menu,createAction),
|
||||||
|
[QGVAR(CheckFuel),
|
||||||
|
localize LSTRING(CheckFuel),
|
||||||
|
QPATHTOF(ui\icon_refuel_interact.paa),
|
||||||
|
{[_player, _target] call FUNC(checkFuel)},
|
||||||
|
{[_player, _target] call FUNC(canCheckFuel)},
|
||||||
|
{}, [], [0,0,0],
|
||||||
|
REFUEL_ACTION_DISTANCE
|
||||||
|
] call EFUNC(interact_menu,createAction),
|
||||||
|
[QGVAR(Return),
|
||||||
|
localize LSTRING(Return),
|
||||||
|
QPATHTOF(ui\icon_refuel_interact.paa),
|
||||||
|
{[_player, _target] call FUNC(returnNozzle)},
|
||||||
|
{[_player, _target] call FUNC(canReturnNozzle)},
|
||||||
|
{}, [], [0,0,0],
|
||||||
|
REFUEL_ACTION_DISTANCE
|
||||||
|
] call EFUNC(interact_menu,createAction)
|
||||||
|
];
|
||||||
|
|
||||||
{
|
private _staticClasses = keys (uiNamespace getVariable QGVAR(cacheRefuelClassesStatic));
|
||||||
private _className = _x;
|
private _baseDynamicClasses = keys (uiNamespace getVariable QGVAR(cacheRefuelClassesBaseDynamic));
|
||||||
[_className, 0, ["ACE_MainActions"], GVAR(mainAction)] call EFUNC(interact_menu,addActionToClass);
|
|
||||||
|
// init menu for config refuel vehicles
|
||||||
{
|
{
|
||||||
[_className, 0, ["ACE_MainActions", QGVAR(Refuel)], _x] call EFUNC(interact_menu,addActionToClass);
|
private _className = _x;
|
||||||
} forEach GVAR(actions);
|
[_className, 0, ["ACE_MainActions"], GVAR(mainAction)] call EFUNC(interact_menu,addActionToClass);
|
||||||
TRACE_1("add menu to static",_x);
|
{
|
||||||
} forEach _staticClasses;
|
[_className, 0, ["ACE_MainActions", QGVAR(Refuel)], _x] call EFUNC(interact_menu,addActionToClass);
|
||||||
|
} forEach GVAR(actions);
|
||||||
|
TRACE_1("add menu to static",_x);
|
||||||
|
} forEach _staticClasses;
|
||||||
|
|
||||||
{
|
|
||||||
private _className = _x;
|
|
||||||
[_className, 0, ["ACE_MainActions"], GVAR(mainAction), true] call EFUNC(interact_menu,addActionToClass);
|
|
||||||
{
|
{
|
||||||
[_className, 0, ["ACE_MainActions", QGVAR(Refuel)], _x, true] call EFUNC(interact_menu,addActionToClass);
|
private _className = _x;
|
||||||
} forEach GVAR(actions);
|
[_className, 0, ["ACE_MainActions"], GVAR(mainAction), true] call EFUNC(interact_menu,addActionToClass);
|
||||||
TRACE_1("add menu to dynamic",_x);
|
{
|
||||||
} forEach _dynamicClasses;
|
[_className, 0, ["ACE_MainActions", QGVAR(Refuel)], _x, true] call EFUNC(interact_menu,addActionToClass);
|
||||||
|
} forEach GVAR(actions);
|
||||||
|
TRACE_1("add menu to dynamic",_x);
|
||||||
|
} forEach _baseDynamicClasses;
|
||||||
|
|
||||||
#ifdef DRAW_HOOKS_POS
|
#ifdef DRAW_HOOKS_POS
|
||||||
addMissionEventHandler ["Draw3D", {
|
addMissionEventHandler ["Draw3D", {
|
||||||
private _source = cursorObject;
|
private _source = cursorObject;
|
||||||
private _cfgPos = getArray (configOf _source >> QGVAR(hooks));
|
private _cfgPos = getArray (configOf _source >> QGVAR(hooks));
|
||||||
private _dynPos = _source getVariable [QGVAR(hooks), []];
|
private _dynPos = _source getVariable [QGVAR(hooks), _cfgPos];
|
||||||
{
|
{
|
||||||
drawIcon3D ["\a3\ui_f\data\gui\cfg\hints\icon_text\group_1_ca.paa", [1,1,1,1], _source modelToWorldVisual _x, 1, 1, 0, format ["Hook %1", _forEachIndex]];
|
drawIcon3D ["\a3\ui_f\data\gui\cfg\hints\icon_text\group_1_ca.paa", [1,1,1,1], _source modelToWorldVisual _x, 1, 1, 0, format ["Hook %1", _forEachIndex]];
|
||||||
} forEach ([_dynPos, _cfgPos] select (_dynPos isEqualTo []));
|
} forEach _dynPos;
|
||||||
}];
|
}];
|
||||||
#endif
|
#endif
|
||||||
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
@ -4,27 +4,44 @@
|
|||||||
|
|
||||||
// cache refuel vehicles, see XEH_postInit.sqf
|
// cache refuel vehicles, see XEH_postInit.sqf
|
||||||
private _staticClasses = [];
|
private _staticClasses = [];
|
||||||
private _dynamicClasses = [];
|
private _baseStaticClasses = [];
|
||||||
|
private _baseDynamicClasses = [];
|
||||||
|
private _cacheRefuelCargo = createHashMap;
|
||||||
|
|
||||||
{
|
{
|
||||||
private _fuelCargo = getNumber (_x >> QGVAR(fuelCargo));
|
private _transportFuel = getNumber (_x >> "transportFuel");
|
||||||
|
private _fuelCargo = [_x >> QGVAR(fuelCargo), "NUMBER", _transportFuel] call CBA_fnc_getConfigEntry;
|
||||||
if (_fuelCargo > 0 || {_fuelCargo == REFUEL_INFINITE_FUEL}) then {
|
if (_fuelCargo > 0 || {_fuelCargo == REFUEL_INFINITE_FUEL}) then {
|
||||||
private _sourceClass = configName _x;
|
private _sourceClass = configName _x;
|
||||||
|
private _noXEH = !isText (_x >> "EventHandlers" >> "CBA_Extended_EventHandlers" >> "init");
|
||||||
|
private _isPublic = getNumber (_x >> "scope") == 2;
|
||||||
// check if we can use actions with inheritance
|
// check if we can use actions with inheritance
|
||||||
if (
|
if (
|
||||||
!isText (_x >> "EventHandlers" >> "CBA_Extended_EventHandlers" >> "init") // addActionToClass relies on XEH init
|
_noXEH // addActionToClass relies on XEH init
|
||||||
|| {configName _x isKindOf "Static"} // CBA_fnc_addClassEventHandler doesn't support "Static" class
|
|| {_sourceClass isKindOf "Static"} // CBA_fnc_addClassEventHandler doesn't support "Static" class
|
||||||
) then {
|
) then {
|
||||||
if (2 == getNumber (_x >> "scope")) then {
|
if (_isPublic) then {
|
||||||
_staticClasses pushBackUnique _sourceClass;
|
if (_noXEH) then {
|
||||||
|
WARNING_3("Class %1: %2 [%3] needs XEH",_sourceClass,configName inheritsFrom _x,configSourceMod _x);
|
||||||
|
};
|
||||||
|
_staticClasses pushBack _sourceClass;
|
||||||
|
if (_baseStaticClasses findIf {_sourceClass isKindOf _x} == -1) then {
|
||||||
|
_baseStaticClasses pushBack _sourceClass;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
if (-1 == _dynamicClasses findIf {_sourceClass isKindOf _x}) then {
|
if (_baseDynamicClasses findIf {_sourceClass isKindOf _x} == -1) then {
|
||||||
_dynamicClasses pushBackUnique _sourceClass;
|
_baseDynamicClasses pushBack _sourceClass;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
if (_isPublic) then {
|
||||||
|
_cacheRefuelCargo set [_sourceClass, _fuelCargo];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
} forEach ('true' configClasses (configFile >> "CfgVehicles"));
|
} forEach ("true" configClasses (configFile >> "CfgVehicles"));
|
||||||
|
|
||||||
TRACE_2("compiled",count _staticClasses,count _dynamicClasses);
|
TRACE_3("found",count _staticClasses,count _baseStaticClasses,count _baseDynamicClasses);
|
||||||
uiNamespace setVariable [QGVAR(cacheRefuelClasses), compileFinal str [_staticClasses, _dynamicClasses]];
|
uiNamespace setVariable [QGVAR(cacheRefuelClassesStatic), compileFinal (_staticClasses createHashMapFromArray [])];
|
||||||
|
uiNamespace setVariable [QGVAR(cacheRefuelClassesBaseStatic), compileFinal (_baseStaticClasses createHashMapFromArray [])];
|
||||||
|
uiNamespace setVariable [QGVAR(cacheRefuelClassesBaseDynamic), compileFinal (_baseDynamicClasses createHashMapFromArray [])];
|
||||||
|
uiNamespace setVariable [QGVAR(cacheRefuelCargo), compileFinal _cacheRefuelCargo];
|
||||||
|
@ -14,6 +14,7 @@ class CfgPatches {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#include "ACE_Refuel_Positions.hpp"
|
||||||
#include "ACE_Settings.hpp"
|
#include "ACE_Settings.hpp"
|
||||||
#include "Cfg3DEN.hpp"
|
#include "Cfg3DEN.hpp"
|
||||||
#include "CfgEventHandlers.hpp"
|
#include "CfgEventHandlers.hpp"
|
||||||
|
84
addons/refuel/dev/exportTerrainRefuelPositions.sqf
Normal file
84
addons/refuel/dev/exportTerrainRefuelPositions.sqf
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
// call compileScript ["z\ace\addons\refuel\dev\exportTerrainRefuelPositions.sqf"]
|
||||||
|
// can be run in Eden Editor console
|
||||||
|
|
||||||
|
#include "\z\ace\addons\refuel\script_component.hpp"
|
||||||
|
|
||||||
|
private _basePumps = [];
|
||||||
|
private _totalCount = 0;
|
||||||
|
private _posCount = 0;
|
||||||
|
private _message = "";
|
||||||
|
private _halfWorldSize = worldSize / 2;
|
||||||
|
private _worldCenter = [_halfWorldSize, _halfWorldSize];
|
||||||
|
_halfWorldSize = _halfWorldSize * sqrt 2;
|
||||||
|
|
||||||
|
private _baseStaticClasses = keys (uiNamespace getVariable QGVAR(cacheRefuelClassesBaseStatic));
|
||||||
|
private _class = "";
|
||||||
|
private _objects = [];
|
||||||
|
private _positions = [];
|
||||||
|
private _object = objNull;
|
||||||
|
private _pos = [];
|
||||||
|
|
||||||
|
{
|
||||||
|
_class = _x;
|
||||||
|
_objects = _worldCenter nearObjects [_class, _halfWorldSize];
|
||||||
|
if (_objects isEqualTo []) then {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
ADD(_totalCount,count _objects);
|
||||||
|
_positions = [];
|
||||||
|
{
|
||||||
|
_object = _x;
|
||||||
|
_pos = ASLToAGL getPosASL _object;
|
||||||
|
if (-1 < _positions findIf {60 > _x distance _pos && {20 < _x distance _pos}}) then {
|
||||||
|
_message = "INCREASE DISTANCE " + str _pos;
|
||||||
|
};
|
||||||
|
if (-1 == _positions findIf {20 > _x distance _pos}) then {
|
||||||
|
_positions pushBack (_pos apply {round _x});
|
||||||
|
INC(_posCount);
|
||||||
|
};
|
||||||
|
} forEach _objects;
|
||||||
|
_positions sort true; // sort positions by smallest first
|
||||||
|
_basePumps pushBack [_class, _positions];
|
||||||
|
} forEach _baseStaticClasses;
|
||||||
|
|
||||||
|
_basePumps sort true; // sort pump classes alphabetically
|
||||||
|
|
||||||
|
// check final array as it's calculated in postInit
|
||||||
|
private _checkCount = 0;
|
||||||
|
{
|
||||||
|
_x params ["_class", "_positions"];
|
||||||
|
{
|
||||||
|
_checkCount = _checkCount + count (_x nearObjects [_class, 30]);
|
||||||
|
} forEach _positions;
|
||||||
|
} forEach _basePumps;
|
||||||
|
if (_checkCount != _totalCount) then {
|
||||||
|
_message = "WRONG COUNT " + str _checkCount;
|
||||||
|
};
|
||||||
|
|
||||||
|
// export text
|
||||||
|
private _nl = toString [10];
|
||||||
|
private _multipleBasePumps = 1 < count _basePumps;
|
||||||
|
private _output = [format [" %1[] = { /* %2 */", worldName, getText (configfile >> "CfgWorlds" >> worldName >> "description")]];
|
||||||
|
{
|
||||||
|
if (_forEachIndex > 0) then {_output pushBack ","};
|
||||||
|
_x params ["_class", "_positions"];
|
||||||
|
if (_multipleBasePumps) then {
|
||||||
|
_output pushBack (_nl + " ");
|
||||||
|
} else {
|
||||||
|
_output pushBack " ";
|
||||||
|
};
|
||||||
|
_output pushBack format ["{""%1"", {", _class];
|
||||||
|
{
|
||||||
|
if (_forEachIndex > 0) then {_output pushBack ","};
|
||||||
|
_output pushBack format ["{%1,%2,%3}", _x#0, _x#1, _x#2];
|
||||||
|
} forEach _positions;
|
||||||
|
_output pushBack "}}";
|
||||||
|
} forEach _basePumps;
|
||||||
|
if (_multipleBasePumps) then {_output pushBack (_nl + " ")};
|
||||||
|
if (_basePumps isEqualTo []) then {_output pushBack " "};
|
||||||
|
_output pushBack ("};" + _nl);
|
||||||
|
|
||||||
|
_output = _output joinString "";
|
||||||
|
|
||||||
|
copyToClipboard _output;
|
||||||
|
[_totalCount, _posCount, _message, _output]
|
@ -5,14 +5,14 @@
|
|||||||
|
|
||||||
private _testPass = true;
|
private _testPass = true;
|
||||||
|
|
||||||
diag_log text format ["[ACE-refuel] Showing CfgVehicles with vanilla transportFuel"];
|
INFO("Showing CfgVehicles with transportFuel and without XEH");
|
||||||
private _fuelTrucks = configProperties [configFile >> "CfgVehicles", "(isClass _x) && {(getNumber (_x >> 'transportFuel')) > 0}", true];
|
private _badCfgVehicles = '
|
||||||
|
2 == getNumber (_x >> "scope")
|
||||||
|
&& {0 < getNumber (_x >> "transportFuel")}
|
||||||
|
&& {!isText (_x >> "EventHandlers" >> "CBA_Extended_EventHandlers" >> "init")}
|
||||||
|
' configClasses (configFile >> "CfgVehicles");
|
||||||
{
|
{
|
||||||
if ((configName _x) isKindOf "Car") then {
|
diag_log text format ["Class %1: %2 [%3] needs XEH", configName _x, configName inheritsFrom _x, configSourceMod _x];
|
||||||
diag_log text format ["Car [%1] needs config [transportFuel: %2]", configName _x, getNumber (_x >> 'transportFuel')];
|
} forEach _badCfgVehicles;
|
||||||
} else {
|
|
||||||
diag_log text format ["Non-car? [%1] needs config [transportFuel: %2]", configName _x, getNumber (_x >> 'transportFuel')];
|
|
||||||
};
|
|
||||||
} forEach _fuelTrucks;
|
|
||||||
|
|
||||||
_testPass
|
_testPass
|
||||||
|
20
addons/refuel/functions/fnc_getFuelCargo.sqf
Normal file
20
addons/refuel/functions/fnc_getFuelCargo.sqf
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
/*
|
||||||
|
* Author: Dystopian
|
||||||
|
* Returns vehicle fuel amount from config (cached).
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Fuel Source <OBJECT>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* Fuel amount from config <NUMBER>
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* cursorObject call ace_refuel_fnc_getFuelCargo
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
|
||||||
|
params ["_source"];
|
||||||
|
|
||||||
|
(uiNamespace getVariable QGVAR(cacheRefuelCargo)) getOrDefault [typeOf _source, REFUEL_DISABLED_FUEL]
|
@ -16,6 +16,13 @@
|
|||||||
* Public: Yes
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Only run this after the settings are initialized
|
||||||
|
if !(EGVAR(common,settingsInitFinished)) exitWith {
|
||||||
|
EGVAR(common,runAtSettingsInitialized) pushBack [FUNC(makeJerryCan), _this];
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!GVAR(enabled)) exitWith {};
|
||||||
|
|
||||||
params [["_target", objNull, [objNull]], ["_fuelAmount", 20, [0]]];
|
params [["_target", objNull, [objNull]], ["_fuelAmount", 20, [0]]];
|
||||||
|
|
||||||
if (isNull _target ||
|
if (isNull _target ||
|
||||||
|
@ -25,19 +25,22 @@ if !(EGVAR(common,settingsInitFinished)) exitWith {
|
|||||||
EGVAR(common,runAtSettingsInitialized) pushBack [FUNC(makeSource), _this];
|
EGVAR(common,runAtSettingsInitialized) pushBack [FUNC(makeSource), _this];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (!GVAR(enabled)) exitWith {};
|
||||||
|
|
||||||
params [
|
params [
|
||||||
["_source", objNull, [objNull]],
|
["_source", objNull, [objNull]],
|
||||||
["_fuelCargo", 0, [0]],
|
["_fuelCargo", 0, [0]],
|
||||||
["_hooks", nil, [[]]]
|
["_hooks", nil, [[]]]
|
||||||
];
|
];
|
||||||
TRACE_3("makeSource",_source,_fuelCargo,_hooks);
|
|
||||||
|
|
||||||
private _fuelCargoConfig = getNumber (configOf _source >> QGVAR(fuelCargo));
|
private _fuelCargoConfig = _source call FUNC(getFuelCargo);
|
||||||
|
|
||||||
|
TRACE_4("makeSource",_source,_fuelCargo,_hooks,_fuelCargoConfig);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
isNull _source
|
isNull _source
|
||||||
|| {_fuelCargo < 0 && {!(_fuelCargo in [REFUEL_INFINITE_FUEL, REFUEL_DISABLED_FUEL])}}
|
|| {_fuelCargo < 0 && {!(_fuelCargo in [REFUEL_INFINITE_FUEL, REFUEL_DISABLED_FUEL])}}
|
||||||
|| {_fuelCargo != 0 && {_fuelCargo == _fuelCargoConfig}}
|
|| {_fuelCargo == REFUEL_DISABLED_FUEL && {_fuelCargoConfig == REFUEL_DISABLED_FUEL}}
|
||||||
) exitWith {};
|
) exitWith {};
|
||||||
|
|
||||||
private _capacity = if (_fuelCargo < 0) then {_fuelCargo} else {_fuelCargoConfig max _fuelCargo};
|
private _capacity = if (_fuelCargo < 0) then {_fuelCargo} else {_fuelCargoConfig max _fuelCargo};
|
||||||
@ -57,10 +60,10 @@ if (
|
|||||||
};
|
};
|
||||||
|
|
||||||
// only add if menu doesn't already exist
|
// only add if menu doesn't already exist
|
||||||
if (!(_fuelCargoConfig != 0 && {!isNil {_source getVariable QGVAR(initSource_jipID)}})) then {
|
if (_fuelCargoConfig != REFUEL_DISABLED_FUEL || {!isNil {_source getVariable QGVAR(initSource_jipID)}}) exitWith {};
|
||||||
private _jipID = [QGVAR(initSource), [_source]] call CBA_fnc_globalEventJIP;
|
|
||||||
[_jipID, _source] call CBA_fnc_removeGlobalEventJIP;
|
private _jipID = [QGVAR(initSource), [_source]] call CBA_fnc_globalEventJIP;
|
||||||
_source setVariable [QGVAR(initSource_jipID), _jipID];
|
[_jipID, _source] call CBA_fnc_removeGlobalEventJIP;
|
||||||
};
|
_source setVariable [QGVAR(initSource_jipID), _jipID];
|
||||||
|
|
||||||
[QGVAR(sourceInitialized), [_source]] call CBA_fnc_globalEvent;
|
[QGVAR(sourceInitialized), [_source]] call CBA_fnc_globalEvent;
|
||||||
|
@ -1,5 +1,15 @@
|
|||||||
private _category = [ELSTRING(main,Category_Logistics), "str_state_refuel"];
|
private _category = [ELSTRING(main,Category_Logistics), "str_state_refuel"];
|
||||||
|
|
||||||
|
[
|
||||||
|
QGVAR(enabled), "CHECKBOX",
|
||||||
|
ELSTRING(common,Enabled),
|
||||||
|
_category,
|
||||||
|
true,
|
||||||
|
1,
|
||||||
|
{[QGVAR(enabled), _this] call EFUNC(common,cbaSettings_settingChanged)},
|
||||||
|
true // Needs mission restart
|
||||||
|
] call CBA_fnc_addSetting;
|
||||||
|
|
||||||
[
|
[
|
||||||
QGVAR(rate), "SLIDER",
|
QGVAR(rate), "SLIDER",
|
||||||
[LSTRING(RefuelSettings_speed_DisplayName), LSTRING(RefuelSettings_speed_Description)],
|
[LSTRING(RefuelSettings_speed_DisplayName), LSTRING(RefuelSettings_speed_Description)],
|
||||||
|
@ -134,5 +134,5 @@ The jerry can will now have a volume of 200 liters.
|
|||||||
|
|
||||||
| Name | Arguments | Global? | Added in |
|
| Name | Arguments | Global? | Added in |
|
||||||
| ------------- | ------------- | ----- | ------------- |
|
| ------------- | ------------- | ----- | ------------- |
|
||||||
| ace_refuel_sourceInitialized | Fuel source (OBJECT), items (BOOL or ARRAY) | Yes | 3.16.0 |
|
| ace_refuel_sourceInitialized | Fuel source (OBJECT) | Yes | 3.16.0 |
|
||||||
| ace_refuel_jerryCanInitalized | Jerry can (OBJECT) | Yes | 3.16.0 |
|
| ace_refuel_jerryCanInitalized | Jerry can (OBJECT) | Yes | 3.16.0 |
|
||||||
|
Loading…
Reference in New Issue
Block a user