Make 40mm Grenades Frag (#3679)

* Make 40mm Grenades Frag

* Just use existing force cfg instead of adding new

Add RHS compat entries
This commit is contained in:
PabstMirror 2016-05-07 15:35:39 -05:00
parent 4eb2ecb0b6
commit 9f6661f4db
4 changed files with 81 additions and 0 deletions

View File

@ -85,6 +85,7 @@ class CfgAmmo {
class G_40mm_HE: GrenadeBase { class G_40mm_HE: GrenadeBase {
// Source: http://www.inetres.com/gp/military/infantry/grenade/40mm_ammo.html#M441 // Source: http://www.inetres.com/gp/military/infantry/grenade/40mm_ammo.html#M441
GVAR(enabled) = 1; GVAR(enabled) = 1;
GVAR(force) = 1;
GVAR(classes)[] = {"ACE_frag_tiny_HD"}; GVAR(classes)[] = {"ACE_frag_tiny_HD"};
GVAR(metal) = 200; GVAR(metal) = 200;
@ -109,6 +110,7 @@ class CfgAmmo {
}; };
class ACE_G_40mm_Practice: ACE_G_40mm_HE { class ACE_G_40mm_Practice: ACE_G_40mm_HE {
GVAR(skip) = 1; GVAR(skip) = 1;
GVAR(force) = 0;
}; };
class ACE_G40mm_HE_VOG25P: G_40mm_HE { class ACE_G40mm_HE_VOG25P: G_40mm_HE {
GVAR(skip) = 0; GVAR(skip) = 0;

View File

@ -1,3 +1,4 @@
PREP(dev_debugAmmo);
PREP(doSpall); PREP(doSpall);
PREP(fired); PREP(fired);

View File

@ -0,0 +1,62 @@
#define DEBUG_MODE_FULL
#include "script_component.hpp"
params [["_debugMissing", true, [false]], ["_debugForce", false, [false]], ["_debugNonFrag", false, [false]]];
diag_log text format ["~~~~~~~~~~~~~Start [%1]~~~~~~~~~~~~~", _this];
private _allMagsConfigs = configProperties [configFile >> "CfgMagazines", "isClass _x", true];
private _processedCfgAmmos = [];
{
private _ammo = toLower getText (_x >> "ammo");
if ((_ammo != "") && {!(_ammo in _processedCfgAmmos)}) then {
_processedCfgAmmos pushBack _ammo;
//Ignore mines/bombs
if (_ammo isKindOf "TimeBombCore") exitWith {};
_ammoConfig = configFile >> "CfgAmmo" >> _ammo;
//Read configs and test if it would actually cause a frag, using same logic as FUNC(pfhRound)
private _skip = getNumber (_ammoConfig >> QGVAR(skip));
private _explosive = getNumber (_ammoConfig >> "explosive");
private _indirectRange = getNumber (_ammoConfig >> "indirectHitRange");
private _force = getNumber (_ammoConfig >> QGVAR(force));
private _fragPower = getNumber(_ammoConfig >> "indirecthit")*(sqrt((getNumber (_ammoConfig >> "indirectHitRange"))));
private _shouldAdd = (_skip == 0) && {(_force == 1) || {_explosive > 0.5 && {_indirectRange >= 4.5} && {_fragPower >= 35}}};
if (_shouldAdd) then {
if (_debugForce && {((getNumber(_ammoConfig >> "hit")) < 5) || {_fragPower < 10}}) then {
diag_log text format ["Ammo [%1] from Mag [%2] - Weak but will still frag!",_ammo,configName _x];
diag_log text format [" - _force=%1,_fragPower=%2",_force,_fragPower];
};
_warn = false;
_fragTypes = getArray (_ammoConfig >> "ACE_frag_CLASSES");
if(_fragTypes isEqualTo []) then {_warn = true;};
_c = getNumber(_ammoConfig >> "ACE_frag_CHARGE");
if(_c == 0) then {_warn = true;};
_m = getNumber(_ammoConfig >> "ACE_frag_METAL");
if(_m == 0) then {_warn = true;};
_k = getNumber(_ammoConfig >> "ACE_frag_GURNEY_K");
if(_k == 0) then {_warn = true;};
_gC = getNumber(_ammoConfig >> "ACE_frag_GURNEY_C");
if(_gC == 0) then { _warn = true;};
if(_debugMissing && _warn) then {
diag_log text format ["Ammo [%1] from Mag [%2] MISSING frag configs:",_ammo,configName _x];
diag_log text format [" - _c=%1,_m=%2,_k=%3,_gC=%4,_fragTypes=%5",_c,_m,_k,_gC,_fragTypes];
};
} else {
if (_debugNonFrag && {isArray (_ammoConfig >> "ACE_frag_CLASSES")}) then {
diag_log text format ["Ammo [%1] from Mag [%2] has frag configs but will NOT frag:",_ammo,configName _x];
diag_log text format ["- skip=%1,explosive=%2,indirectHitRange=%3,force=%4,fragPower=%5",_skip,_explosive,_indirectRange,_force,_fragPower];
};
};
};
} forEach _allMagsConfigs;
diag_log text format ["~~~~~~~~~~~~~End [%1-%2]~~~~~~~~~~~~~", count _allMagsConfigs, count _processedCfgAmmos];

View File

@ -202,4 +202,20 @@ class CfgAmmo {
ace_frag_skip = 1; ace_frag_skip = 1;
ace_frag_force = 0; ace_frag_force = 0;
}; };
class G_40mm_HE;
class rhs_g_vog25: G_40mm_HE {};
class rhs_g_vg40tb: rhs_g_vog25 { //Thermobaric
ace_frag_force = 0;
};
class rhs_g_vg40sz: rhs_g_vog25 { //Flashbang
ace_frag_force = 0;
};
class rhs_GDM40: rhs_g_vog25 { //Smoke
ace_frag_force = 0;
};
class rhs_g_vg40md_white: rhs_g_vog25 { //Smoke
ace_frag_force = 0;
};
}; };