Reworked cfgServicePoint to allow inherits

This commit is contained in:
He-Man 2019-09-20 16:05:43 +02:00
parent 0ee6cfca57
commit e5dbae7c5c
2 changed files with 135 additions and 220 deletions

View File

@ -14,7 +14,7 @@
*/
//[[[cog import generate_private_arrays ]]]
private ["_Ignatz_SP_Array","_VehiclesAndAmmo","_actionName","_actionTitle","_ammocount","_ammotype","_cost","_costs","_costsFree","_costsText","_fnc_actionTitle","_fnc_getCosts","_magname","_maxammototal","_maxmags","_missingammo","_ownedcompletemags","_refuel_amount","_refuel_costs","_refuel_updateInterval","_reloagmags","_repairTime","_repair_costs","_totalammocount","_turret","_typeName","_vehicle"];
private ["_Ignatz_SP_Array","_AmmoConfig","_VehiclesWithAmmo","_VehicleAmmo","_actionName","_actionTitle","_ammocount","_ammotype","_cost","_costs","_costsFree","_costsText","_fnc_actionTitle","_fnc_getCosts","_magname","_maxammototal","_maxmags","_missingammo","_ownedcompletemags","_refuel_amount","_refuel_costs","_refuel_updateInterval","_reloagmags","_repairTime","_repair_costs","_totalammocount","_turret","_typeName","_vehicle"];
//[[[end]]]
Ignatz_Refuel = nil;
Ignatz_Repair = nil;
@ -31,7 +31,8 @@ _refuel_costs = ["CfgServicePoint", "refuel_costs", []] call EPOCH_fnc_return
_refuel_updateInterval = ["CfgServicePoint", "refuel_updateInterval", 1] call EPOCH_fnc_returnConfigEntryV2;
_refuel_amount = ["CfgServicePoint", "refuel_amount", 0.1] call EPOCH_fnc_returnConfigEntryV2;
_repairTime = ["CfgServicePoint", "repairTime", 1.2] call EPOCH_fnc_returnConfigEntryV2;
_VehiclesAndAmmo = ["CfgServicePoint", "VehiclesAndAmmo", []] call EPOCH_fnc_returnConfigEntryV2;
_AmmoConfig = (missionconfigfile >> "CfgServicePoint" >> "VehiclesAndAmmo");
_VehiclesWithAmmo = ("true" configClasses _AmmoConfig) apply {configname _x};
_Ignatz_SP_Array = [];
_costsFree = 'free';
@ -63,7 +64,8 @@ _fnc_actionTitle = {
};
{
if ((typeof _vehicle) == _x select 0) exitwith {
if ((tolower (typeof _vehicle)) == (tolower _x)) exitwith {
_VehicleAmmo = getArray (_AmmoConfig >> _x >> "MagsTurrets");
{
_x params ["_ammotype","_turret","_maxmags","_costs",["_ammocount",getNumber (configfile >> "CfgMagazines" >> (_x select 0) >> "count")]];
if (_myturret isequalto _turret) then {
@ -91,9 +93,9 @@ _fnc_actionTitle = {
_Ignatz_SP_Array pushback [_actionTitle,[_vehicle,_ammotype,_turret,_reloagmags,_ammocount,_costs]];
};
};
} foreach (_x select 1);
} foreach _VehicleAmmo;
};
} foreach _VehiclesAndAmmo;
} foreach _VehiclesWithAmmo;
if (player == driver _vehicle) then {
_costs = [_vehicle, _refuel_costs] call _fnc_getCosts;

View File

@ -98,262 +98,175 @@ class CfgServicePoint {
{"Landvehicle",0}
};
/* Get all Weapons and Turrets with "magazinesAllTurrets vehicle" -> https://community.bistudio.com/wiki/magazinesAllTurrets */
VehiclesAndAmmo[] = {
class VehiclesAndAmmo {
/*
{
"typeof vehicle",
{
class VehicleType {
MagsTurrets[] = {
{"Ammoclass",{Turretpath},MaxMagsCount,PricePerMag,Bullets per mag (optional, if you want to reduce bullets per mag)},
{"Ammoclass",{Turretpath},MaxMagsCount,PricePerMag,Bullets per mag (optional, if you want to reduce bullets per mag)}
}
},
};
};
*/
{
"a2_ch47f_armed_EPOCH",
{
class a2_ch47f_armed_EPOCH {
MagsTurrets[] = {
{"200Rnd_65x39_Belt",{1},3,200},
{"200Rnd_65x39_Belt",{2},3,200}
}
},
{
"a2_ch47f_armed_plus_EPOCH",
{
};
};
class a2_ch47f_armed_plus_EPOCH {
MagsTurrets[] = {
{"200Rnd_762x51_Belt",{0},3,200},
{"200Rnd_762x51_Belt",{1},3,200}
}
},
{
"uh1h_armed_EPOCH",
{
};
};
class uh1h_armed_EPOCH {
MagsTurrets[] = {
{"200Rnd_65x39_Belt",{1},3,200},
{"200Rnd_65x39_Belt",{2},3,200}
}
},
{
"uh1h_armed_plus_EPOCH",
{
};
};
class uh1h_armed_plus_EPOCH {
MagsTurrets[] = {
{"200Rnd_762x51_Belt",{0},3,200},
{"200Rnd_762x51_Belt",{1},3,200}
}
},
{
"C_Heli_Light_01_armed_EPOCH",
{
};
};
class C_Heli_Light_01_armed_EPOCH {
MagsTurrets[] = {
{"200Rnd_65x39_Belt",{-1},3,200}
}
},
{
"C_Heli_Light_01_armed_plus_EPOCH",
{
};
};
class C_Heli_Light_01_armed_plus_EPOCH {
MagsTurrets[] = {
{"200Rnd_762x51_Belt",{-1},3,200}
}
},
{
"A2_SUV_armed_EPOCH",
{
};
};
class A2_SUV_armed_EPOCH {
MagsTurrets[] = {
{"200Rnd_762x51_Belt",{0},3,200}
}
},
{
"B_G_Offroad_01_armed_F",
{
};
};
class B_G_Offroad_01_armed_F {
MagsTurrets[] = {
{"100Rnd_127x99_mag_Tracer_Yellow",{0},4,200}
}
},
{
"O_G_Offroad_01_armed_F",
{
{"100Rnd_127x99_mag_Tracer_Yellow",{0},4,200}
}
},
{
"I_G_Offroad_01_armed_F",
{
{"100Rnd_127x99_mag_Tracer_Yellow",{0},4,200}
}
},
{
"I_MRAP_03",
{
};
};
class O_G_Offroad_01_armed_F : B_G_Offroad_01_armed_F {};
class I_G_Offroad_01_armed_F : B_G_Offroad_01_armed_F {};
class I_MRAP_03 {
MagsTurrets[] = {
{"SmokeLauncherMag",{0},1,150}
}
},
{
"I_MRAP_03_EPOCH",
{
}
},
{
"O_MRAP_02_F",
{
};
};
class I_MRAP_03_EPOCH {
MagsTurrets[] = {
};
};
class O_MRAP_02_F {
MagsTurrets[] = {
{"SmokeLauncherMag",{-1},1,150}
}
},
{
"B_LSV_01_armed_olive_F",
{
};
};
class B_LSV_01_armed_olive_F {
MagsTurrets[] = {
{"100Rnd_127x99_mag_Tracer_Red",{0},3,200},
{"130Rnd_338_Mag",{1},3,260}
}
},
{
"B_LSV_01_armed_black_F",
{
{"100Rnd_127x99_mag_Tracer_Red",{0},3,200},
{"130Rnd_338_Mag",{1},3,260}
}
},
{
"O_T_LSV_02_armed_black_F",
{
};
};
class B_LSV_01_armed_black_F : B_LSV_01_armed_olive_F {};
class O_T_LSV_02_armed_black_F {
MagsTurrets[] = {
{"500Rnd_65x39_Belt_Tracer_Green_Splash",{0},3,500}
}
},
{
"O_T_LSV_02_armed_ghex_F",
{
{"500Rnd_65x39_Belt_Tracer_Green_Splash",{0},3,500}
}
},
{
"B_SDV_01_EPOCH",
{
}
},
{
"B_Heli_Light_01_armed_F",
{
};
};
class O_T_LSV_02_armed_ghex_F : O_T_LSV_02_armed_black_F {};
class B_SDV_01_EPOCH {
MagsTurrets[] = {
};
};
class B_Heli_Light_01_armed_F {
MagsTurrets[] = {
{"5000Rnd_762x51_Belt",{-1},1,1600}
}
},
{
"O_Heli_Light_02_unarmed_EPOCH",
{
};
};
class O_Heli_Light_02_unarmed_EPOCH {
MagsTurrets[] = {
{"168Rnd_CMFlare_Chaff_Magazine",{-1},1,150}
}
},
{
"O_Heli_Light_02_v2_F",
{
};
};
class O_Heli_Light_02_v2_F {
MagsTurrets[] = {
{"2000Rnd_65x39_Belt_Tracer_Green_Splash",{-1},1,1200},
{"168Rnd_CMFlare_Chaff_Magazine",{-1},1,150}
}
},
{
"B_Heli_Transport_01_EPOCH",
{
};
};
class B_Heli_Transport_01_EPOCH {
MagsTurrets[] = {
{"168Rnd_CMFlare_Chaff_Magazine",{-1},1,150},
{"2000Rnd_65x39_Belt_Tracer_Red",{1},1,1200},
{"2000Rnd_65x39_Belt_Tracer_Red",{2},1,1200}
}
},
{
"I_Heli_Transport_02_F",
{
};
};
class I_Heli_Transport_02_F {
MagsTurrets[] = {
{"168Rnd_CMFlare_Chaff_Magazine",{-1},1,150}
}
},
{
"I_Heli_Transport_02_EPOCH",
{
{"168Rnd_CMFlare_Chaff_Magazine",{-1},1,150}
}
},
{
"B_Heli_Transport_03_F",
{
};
};
class I_Heli_Transport_02_EPOCH : I_Heli_Transport_02_F {};
class B_Heli_Transport_03_F {
MagsTurrets[] = {
{"168Rnd_CMFlare_Chaff_Magazine",{-1},1,150},
{"2000Rnd_65x39_Belt_Tracer_Red",{1},1,1200},
{"2000Rnd_65x39_Belt_Tracer_Red",{2},1,1200}
}
},
{
"B_Heli_Transport_03_black_F",
{
{"168Rnd_CMFlare_Chaff_Magazine",{-1},1,150},
{"2000Rnd_65x39_Belt_Tracer_Red",{1},1,1200},
{"2000Rnd_65x39_Belt_Tracer_Red",{2},1,1200}
}
},
{
"B_Heli_Transport_03_unarmed_EPOCH",
{
};
};
class B_Heli_Transport_03_black_F : B_Heli_Transport_03_F {};
class B_Heli_Transport_03_unarmed_EPOCH {
MagsTurrets[] = {
{"168Rnd_CMFlare_Chaff_Magazine",{-1},1,150}
}
},
{
"I_Heli_light_03_unarmed_EPOCH",
{
};
};
class I_Heli_light_03_unarmed_EPOCH {
MagsTurrets[] = {
{"168Rnd_CMFlare_Chaff_Magazine",{-1},1,150}
}
},
{
"B_T_VTOL_01_vehicle_blue_F",
{
};
};
class B_T_VTOL_01_vehicle_blue_F {
MagsTurrets[] = {
{"240Rnd_CMFlare_Chaff_Magazine",{-1},1,150}
}
},
{
"B_T_VTOL_01_infantry_olive_F",
{
{"240Rnd_CMFlare_Chaff_Magazine",{-1},1,150}
}
},
{
"B_T_VTOL_01_infantry_blue_F",
{
{"240Rnd_CMFlare_Chaff_Magazine",{-1},1,150}
}
},
{
"O_T_VTOL_02_vehicle_F",
{
};
};
class B_T_VTOL_01_infantry_olive_F : B_T_VTOL_01_vehicle_blue_F {};
class B_T_VTOL_01_infantry_blue_F : B_T_VTOL_01_vehicle_blue_F {};
class O_T_VTOL_02_vehicle_F {
MagsTurrets[] = {
{"168Rnd_CMFlare_Chaff_Magazine",{-1},1,150}
}
},
{
"O_T_VTOL_02_vehicle_grey_F",
{
{"168Rnd_CMFlare_Chaff_Magazine",{-1},1,150}
}
},
{
"O_T_VTOL_02_infantry_F",
{
{"168Rnd_CMFlare_Chaff_Magazine",{-1},1,150}
}
},
{
"B_Heli_Attack_01_F",
{
};
};
class O_T_VTOL_02_vehicle_grey_F : O_T_VTOL_02_vehicle_F {};
class O_T_VTOL_02_infantry_F : O_T_VTOL_02_vehicle_F {};
class B_Heli_Attack_01_F {
MagsTurrets[] = {
{"240Rnd_CMFlare_Chaff_Magazine",{-1},1,150}
}
},
{
"O_Heli_Attack_02_black_F",
{
};
};
class O_Heli_Attack_02_black_F {
MagsTurrets[] = {
{"192Rnd_CMFlare_Chaff_Magazine",{-1},1,150}
}
},
{
"O_Heli_Attack_02_F",
{
{"192Rnd_CMFlare_Chaff_Magazine",{-1},1,150}
}
},
{
"O_Boat_Armed_01_hmg_F",
{
};
};
class O_Heli_Attack_02_F : O_Heli_Attack_02_black_F {};
class O_Boat_Armed_01_hmg_F {
MagsTurrets[] = {
{"SmokeLauncherMag_boat",{-1},1,100},
{"200Rnd_127x99_mag_Tracer_Green",{1},3,300}
}
},
{
"mosquito_epoch_armedG",
{
};
};
class mosquito_epoch_armedG {
MagsTurrets[] = {
{"3Rnd_MosquitoGrenade",{-1},1,60}
}
}
};
};
};
};