Updated spall to use material

This commit is contained in:
lambdatiger 2024-01-09 21:07:01 -06:00
parent acb7249039
commit 71f26f5df6
2 changed files with 136 additions and 31 deletions

View File

@ -1,5 +1,4 @@
class GVAR(spallBase) : B_65x39_Caseless
{
class GVAR(spallBase) : B_65x39_Caseless {
access = 3;
submunitionAmmo[] = {QGVAR(small),4,QGVAR(medium),3,QGVAR(large),2,QGVAR(huge),1};
submunitionConeType[] = {"random", 20};
@ -14,37 +13,137 @@ class GVAR(spallBase) : B_65x39_Caseless
ACE_FRAG_RM_EH;
};
class GVAR(spall_tiny) : GVAR(spallBase)
{
submunitionAmmo[] = {QGVAR(small), 4, QGVAR(medium), 1};
submunitionConeType[] = {"poissondisccenter", 5};
submunitionConeAngle = 40;
//**** ground ****//
class GVAR(ground_spall_tiny) : GVAR(spallBase) {
submunitionAmmo[] = {QGVAR(tiny), 9, QGVAR(small), 1};
submunitionConeType[] = {"poissondisccenter", 4};
};
class GVAR(spall_small) : GVAR(spallBase)
{
class GVAR(ground_spall_small) : GVAR(spallBase) {
submunitionAmmo[] = {QGVAR(small), 4,QGVAR(medium), 1};
submunitionConeType[] = {"poissondisccenter", 10};
submunitionConeAngle = 40;
submunitionConeType[] = {"poissondisccenter", 6};
};
class GVAR(spall_medium) : GVAR(spallBase)
{
class GVAR(ground_spall_medium) : GVAR(spallBase) {
submunitionAmmo[] = {QGVAR(small), 2, QGVAR(small_HD), 1,QGVAR(medium), 3, QGVAR(medium_HD), 1, QGVAR(large), 2};
submunitionConeType[] = {"poissondisccenter", 15};
submunitionConeAngle = 40;
};
class GVAR(spall_large) : GVAR(spallBase)
{
class GVAR(ground_spall_large) : GVAR(spallBase) {
submunitionAmmo[] = {QGVAR(tiny), 3, QGVAR(tiny_HD), 3, QGVAR(small), 4, QGVAR(small_HD), 4, QGVAR(medium_HD), 5, QGVAR(large), 1, QGVAR(large_HD), 2};
submunitionConeType[] = {"poissondisccenter", 15};
submunitionConeAngle = 40;
};
class GVAR(spall_huge) : GVAR(spallBase)
{
class GVAR(ground_spall_huge) : GVAR(spallBase) {
submunitionAmmo[] = {QGVAR(tiny), 3, QGVAR(tiny_HD), 3, QGVAR(small), 4, QGVAR(small_HD), 4, QGVAR(medium), 5, QGVAR(large), 1, QGVAR(large_HD), 2};
submunitionConeType[] = {"poissondisccenter", 20};
submunitionConeAngle = 40;
};
//**** rock ****//
class GVAR(rock_spall_tiny) : GVAR(spallBase) {
submunitionAmmo[] = {QGVAR(small), 4, QGVAR(medium_HD), 1};
submunitionConeType[] = {"poissondisccenter", 4};
};
class GVAR(rock_spall_small) : GVAR(spallBase) {
submunitionAmmo[] = {QGVAR(small), 4, QGVAR(medium), 1};
submunitionConeType[] = {"poissondisccenter", 5};
};
class GVAR(rock_spall_medium) : GVAR(spallBase) {
submunitionAmmo[] = {QGVAR(small), 4, QGVAR(medium), 1, QGVAR(medium_HD), 2, QGVAR(large_HD), 1};
submunitionConeType[] = {"poissondisccenter", 7};
};
class GVAR(rock_spall_large) : GVAR(spallBase) {
submunitionAmmo[] = {QGVAR(small), 5, QGVAR(medium), 2, QGVAR(large), 1};
submunitionConeType[] = {"poissondisccenter", 10};
};
class GVAR(rock_spall_huge) : GVAR(spallBase) {
submunitionAmmo[] = {QGVAR(small), 5, QGVAR(medium), 2, QGVAR(large), 1, QGVAR(huge_HD), 1};
submunitionConeType[] = {"poissondisccenter", 13};
};
//**** wood ****//
class GVAR(wood_spall_tiny) : GVAR(spallBase) {
submunitionAmmo[] = {QGVAR(tiny), 2, QGVAR(small), 4};
submunitionConeType[] = {"poissondisccenter", 4};
};
class GVAR(wood_spall_small) : GVAR(spallBase) {
submunitionAmmo[] = {QGVAR(tiny), 2, QGVAR(small), 4, QGVAR(medium), 1};
submunitionConeType[] = {"poissondisccenter", 6};
};
class GVAR(wood_spall_medium) : GVAR(spallBase) {
submunitionAmmo[] = {QGVAR(tiny), 2, QGVAR(small), 2, QGVAR(medium), 2, QGVAR(medium_HD), 1, QGVAR(large_HD), 1};
submunitionConeType[] = {"poissondisccenter", 8};
};
class GVAR(wood_spall_large) : GVAR(spallBase) {
submunitionAmmo[] = {QGVAR(tiny), 1, QGVAR(small), 3, QGVAR(medium), 2, QGVAR(large_HD), 2, QGVAR(huge_HD), 1};
submunitionConeType[] = {"poissondisccenter", 10};
};
class GVAR(wood_spall_huge) : GVAR(spallBase) {
submunitionAmmo[] = {QGVAR(tiny), 1, QGVAR(small), 3, QGVAR(medium), 2, QGVAR(large_HD), 2, QGVAR(huge_HD), 1};
submunitionConeType[] = {"poissondisccenter", 12};
};
//**** concrete ****//
class GVAR(concrete_spall_tiny) : GVAR(spallBase) {
submunitionAmmo[] = {QGVAR(tiny), 6, QGVAR(tiny_HD), 3, QGVAR(small), 1};
submunitionConeType[] = {"poissondisccenter", 4};
};
class GVAR(concrete_spall_small) : GVAR(spallBase) {
submunitionAmmo[] = {QGVAR(tiny), 4, QGVAR(tiny_HD), 2, QGVAR(small), 2, QGVAR(medium), 1};
submunitionConeType[] = {"poissondisccenter", 6};
};
class GVAR(concrete_spall_medium) : GVAR(spallBase) {
submunitionAmmo[] = {QGVAR(tiny), 6, QGVAR(tiny_HD), 1, QGVAR(small), 4, QGVAR(medium), 5, QGVAR(large_HD), 1};
submunitionConeType[] = {"poissondisccenter", 9};
};
class GVAR(concrete_spall_large) : GVAR(spallBase) {
submunitionAmmo[] = {QGVAR(tiny), 6, QGVAR(small), 4, QGVAR(medium), 3, QGVAR(large), 1, QGVAR(large_HD), 2};
submunitionConeType[] = {"poissondisccenter", 12};
};
class GVAR(concrete_spall_huge) : GVAR(spallBase) {
submunitionAmmo[] = {QGVAR(tiny), 8, QGVAR(small), 4, QGVAR(medium), 3, QGVAR(large), 1, QGVAR(large_HD), 1, QGVAR(huge_HD), 1};
submunitionConeType[] = {"poissondisccenter", 18};
};
//**** metal ****//
class GVAR(metal_spall_tiny) : GVAR(spallBase) {
submunitionAmmo[] = {QGVAR(tiny), 9, QGVAR(small), 1};
submunitionConeType[] = {"poissondisccenter", 4};
};
class GVAR(metal_spall_small) : GVAR(spallBase) {
submunitionAmmo[] = {QGVAR(tiny), 4, QGVAR(small), 2, QGVAR(medium), 1};
submunitionConeType[] = {"poissondisccenter", 6};
};
class GVAR(metal_metal_spall_medium) : GVAR(spallBase) {
submunitionAmmo[] = {QGVAR(tiny), 5, QGVAR(small), 4, QGVAR(medium), 2, QGVAR(large), 1};
submunitionConeType[] = {"poissondisccenter", 8};
};
class GVAR(metal_spall_large) : GVAR(spallBase) {
submunitionAmmo[] = {QGVAR(tiny), 4, QGVAR(small), 3, QGVAR(medium), 2, QGVAR(large), 1, QGVAR(huge), 1};
submunitionConeType[] = {"poissondisccenter", 12};
};
class GVAR(metal_spall_huge) : GVAR(spallBase) {
submunitionAmmo[] = {QGVAR(tiny), 8, QGVAR(small), 3, QGVAR(medium), 2, QGVAR(large), 3, QGVAR(huge), 1};
submunitionConeType[] = {"poissondisccenter", 18};
};

View File

@ -54,8 +54,7 @@ private _vel = if (alive _projectile) then {
private _dV = vectorMagnitude _lVel - vectorMagnitude _vel;
private _caliber = getNumber (configFile >> "cfgAmmo" >> _ammo >> "caliber"); // !*! optimize this later?
// scaled momentum change made on caliber-mass assumption ~sqrt(2)/20 * caliber ~= mass
private _deltaMomentum = 0.07071 * _caliber * sqrt( _dV );
private _deltaMomentum = 0.0707 * _caliber * sqrt( _dV );
TRACE_3("found speed",_dV,_caliber,_deltaMomentum);
if (_deltaMomentum < 2) exitWith {
@ -63,7 +62,6 @@ if (_deltaMomentum < 2) exitWith {
};
private _material = [_surfaceType] call FUNC(getMaterialInfo);
TRACE_1("materialCacheRetrieved",_material);
//** start calculating where the spalling should come !*! could be better **//
private _lVelUnit = vectorNormalized _lVel;
@ -102,23 +100,31 @@ GVAR(lastSpallTime) = CBA_missionTime;
//***** Select spalled fragment spawner **//
private _fragSpawnType = switch (true) do
private _spawnSize = switch (true) do
{
case (_deltaMomentum < 3): { QGVAR(spall_tiny) };
case (_deltaMomentum < 5): { QGVAR(spall_small) };
case (_deltaMomentum < 8): { QGVAR(spall_medium) };
case (_deltaMomentum < 11): { QGVAR(spall_large) };
default { QGVAR(spall_huge) };
case (_deltaMomentum < 3): { "_spall_tiny" };
case (_deltaMomentum < 5): { "_spall_small" };
case (_deltaMomentum < 8): { "_spall_medium" };
case (_deltaMomentum < 12): { "_spall_large" };
default { "_spall_huge" };
};
//***** Spawn spalled fragments
private _spallSpawner = createVehicleLocal [_fragSpawnType, ASLToATL _spallPos, [], 0, "CAN_COLLIDE"];
private _spallSpawner = createVehicleLocal [
QUOTE(ADDON##_) + _material + _spawnSize,
ASLToATL _spallPos,
[],
0,
"CAN_COLLIDE"
];
_spallSpawner setVectorDirandUp [_lVelUnit, _vUp];
_spallSpawner setVelocity (_lVelUnit vectorMultiply (_dV/2));
_spallSpawner setShotParents _shotParents;
#ifdef DEBUG_MODE_FULL
if (_material isEqualTo "ground") then {
systemChat "ground spall"; // really shouldn't happen
};
systemChat ("bSpd: " + str speed _spallSpawner + ", frag: " + _fragSpawnType + ", dm: " + str _deltaMomentum);
_spallSpawner addEventHandler [
"SubmunitionCreated",