diff --git a/addons/frag/XEH_preInit.sqf b/addons/frag/XEH_preInit.sqf index 99bb1e830b..8b91a18d18 100644 --- a/addons/frag/XEH_preInit.sqf +++ b/addons/frag/XEH_preInit.sqf @@ -9,7 +9,7 @@ PREP_RECOMPILE_END; GVAR(spallMaterialCache) = createHashMap; GVAR(spallInfoCache) = createHashMap; GVAR(shouldSpallCache) = createHashMap; -GVAR(lastSpallTime) = -2; +GVAR(nextSpallAllowTime) = -2; GVAR(shouldFragCache) = createHashMap; GVAR(fragInfoCache) = createHashMap; diff --git a/addons/frag/functions/fnc_doSpall.sqf b/addons/frag/functions/fnc_doSpall.sqf index 152533bfd5..4a069c5117 100644 --- a/addons/frag/functions/fnc_doSpall.sqf +++ b/addons/frag/functions/fnc_doSpall.sqf @@ -28,11 +28,11 @@ params [ ["_vectorUp", [0,0,1]] ]; -if (CBA_missionTime - GVAR(lastSpallTime) < ACE_FRAG_SPALL_HOLDOFF || +if (CBA_missionTime < GVAR(nextSpallAllowTime)|| _lastPosASL isEqualTo [0,0,0] || - {isNull _objectHit || {_objectHit isKindOf "man" || - {_ammo isEqualTo ""}}}) exitWith { - TRACE_4("time/invldHit",CBA_missionTime,GVAR(lastSpallTime),_objectHit,_lastPosASL); + {_ammo isEqualTo "" || {!isNull _objectHit && + {objectHit isKindOf "man"}}}) exitWith { + TRACE_4("time/invldHit",CBA_missionTime,GVAR(nextSpallAllowTime),_objectHit,_lastPosASL); }; private _material = [_surfaceType] call FUNC(getMaterialInfo); @@ -90,20 +90,20 @@ if (120 > acos ( _lastVelocityUnit vectorDotProduct _surfaceNorm)) then { private _insideObject = true; for "_i" from 2 to 21 do { - private _nPos = _spallPosASL vectorAdd _deltaStep; - if (!lineIntersects [_spallPosASL, _nPos]) then { - _spallPosASL = _nPos vectorAdd (_deltaStep vectorMultiply 2); + private _nextPos = _spallPosASL vectorAdd _deltaStep; + if (!lineIntersects [_spallPosASL, _nextPos]) then { + _spallPosASL = _nextPos vectorAdd (_deltaStep vectorMultiply 2); _insideObject = false; break }; - _spallPosASL = _nPos; + _spallPosASL = _nextPos; }; if (_insideObject) exitWith { TRACE_3("insideObj",_lastPosASL,_spallPosASL,alive _projectile); }; // Passed all exitWiths -GVAR(lastSpallTime) = CBA_missionTime; +GVAR(nextSpallAllowTime) = CBA_missionTime + ACE_FRAG_SPALL_HOLDOFF; #ifdef DEBUG_MODE_DRAW if GVAR(dbgSphere) then {