mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Changed how spall hold off is calculated to avoid repeated unneeded computations
This commit is contained in:
parent
9178611a16
commit
769bb29342
@ -9,7 +9,7 @@ PREP_RECOMPILE_END;
|
|||||||
GVAR(spallMaterialCache) = createHashMap;
|
GVAR(spallMaterialCache) = createHashMap;
|
||||||
GVAR(spallInfoCache) = createHashMap;
|
GVAR(spallInfoCache) = createHashMap;
|
||||||
GVAR(shouldSpallCache) = createHashMap;
|
GVAR(shouldSpallCache) = createHashMap;
|
||||||
GVAR(lastSpallTime) = -2;
|
GVAR(nextSpallAllowTime) = -2;
|
||||||
|
|
||||||
GVAR(shouldFragCache) = createHashMap;
|
GVAR(shouldFragCache) = createHashMap;
|
||||||
GVAR(fragInfoCache) = createHashMap;
|
GVAR(fragInfoCache) = createHashMap;
|
||||||
|
@ -28,11 +28,11 @@ params [
|
|||||||
["_vectorUp", [0,0,1]]
|
["_vectorUp", [0,0,1]]
|
||||||
];
|
];
|
||||||
|
|
||||||
if (CBA_missionTime - GVAR(lastSpallTime) < ACE_FRAG_SPALL_HOLDOFF ||
|
if (CBA_missionTime < GVAR(nextSpallAllowTime)||
|
||||||
_lastPosASL isEqualTo [0,0,0] ||
|
_lastPosASL isEqualTo [0,0,0] ||
|
||||||
{isNull _objectHit || {_objectHit isKindOf "man" ||
|
{_ammo isEqualTo "" || {!isNull _objectHit &&
|
||||||
{_ammo isEqualTo ""}}}) exitWith {
|
{objectHit isKindOf "man"}}}) exitWith {
|
||||||
TRACE_4("time/invldHit",CBA_missionTime,GVAR(lastSpallTime),_objectHit,_lastPosASL);
|
TRACE_4("time/invldHit",CBA_missionTime,GVAR(nextSpallAllowTime),_objectHit,_lastPosASL);
|
||||||
};
|
};
|
||||||
|
|
||||||
private _material = [_surfaceType] call FUNC(getMaterialInfo);
|
private _material = [_surfaceType] call FUNC(getMaterialInfo);
|
||||||
@ -90,20 +90,20 @@ if (120 > acos ( _lastVelocityUnit vectorDotProduct _surfaceNorm)) then {
|
|||||||
private _insideObject = true;
|
private _insideObject = true;
|
||||||
for "_i" from 2 to 21 do
|
for "_i" from 2 to 21 do
|
||||||
{
|
{
|
||||||
private _nPos = _spallPosASL vectorAdd _deltaStep;
|
private _nextPos = _spallPosASL vectorAdd _deltaStep;
|
||||||
if (!lineIntersects [_spallPosASL, _nPos]) then {
|
if (!lineIntersects [_spallPosASL, _nextPos]) then {
|
||||||
_spallPosASL = _nPos vectorAdd (_deltaStep vectorMultiply 2);
|
_spallPosASL = _nextPos vectorAdd (_deltaStep vectorMultiply 2);
|
||||||
_insideObject = false;
|
_insideObject = false;
|
||||||
break
|
break
|
||||||
};
|
};
|
||||||
_spallPosASL = _nPos;
|
_spallPosASL = _nextPos;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (_insideObject) exitWith {
|
if (_insideObject) exitWith {
|
||||||
TRACE_3("insideObj",_lastPosASL,_spallPosASL,alive _projectile);
|
TRACE_3("insideObj",_lastPosASL,_spallPosASL,alive _projectile);
|
||||||
};
|
};
|
||||||
// Passed all exitWiths
|
// Passed all exitWiths
|
||||||
GVAR(lastSpallTime) = CBA_missionTime;
|
GVAR(nextSpallAllowTime) = CBA_missionTime + ACE_FRAG_SPALL_HOLDOFF;
|
||||||
|
|
||||||
#ifdef DEBUG_MODE_DRAW
|
#ifdef DEBUG_MODE_DRAW
|
||||||
if GVAR(dbgSphere) then {
|
if GVAR(dbgSphere) then {
|
||||||
|
Loading…
Reference in New Issue
Block a user