Frag - Fix fuse-arming distance calculation (#8628)

This commit is contained in:
GhostIsSpooky 2021-11-07 20:20:57 -03:00 committed by GitHub
parent fc6b1b7fa1
commit 76524f7c26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 9 deletions

View File

@ -60,7 +60,7 @@ if (alive _round) then {
private _spallTrackID = []; private _spallTrackID = [];
private _args = [ private _args = [
_round, getPosASL _round, velocity _round, _type, diag_frameno, _gun, _doSpall, _spallTrack, _spallTrackID, _round, getPosASL _round, velocity _round, _type, diag_frameno, getPosASL _round, _doSpall, _spallTrack, _spallTrackID,
getNumber (configFile >> "CfgAmmo" >> _type >> QGVAR(skip)), getNumber (configFile >> "CfgAmmo" >> _type >> QGVAR(skip)),
getNumber (configFile >> "CfgAmmo" >> _type >> "explosive"), getNumber (configFile >> "CfgAmmo" >> _type >> "explosive"),
getNumber (configFile >> "CfgAmmo" >> _type >> "indirectHitRange"), getNumber (configFile >> "CfgAmmo" >> _type >> "indirectHitRange"),

View File

@ -15,7 +15,7 @@
* Public: No * Public: No
*/ */
params ["_round", "_lastPos", "_lastVel", "_shellType", "_firedFrame", "_gun", "_doSpall", "_spallTrack", "_foundObjectHPIds", "_skip", "_explosive", "_indirectRange", "_force", "_fragPower"]; params ["_round", "_lastPos", "_lastVel", "_shellType", "_firedFrame", "_firedPos", "_doSpall", "_spallTrack", "_foundObjectHPIds", "_skip", "_explosive", "_indirectRange", "_force", "_fragPower"];
if (_round in GVAR(blackList)) exitWith { if (_round in GVAR(blackList)) exitWith {
false false
@ -26,13 +26,10 @@ if (!alive _round) exitWith {
if (_skip == 0) then { if (_skip == 0) then {
if ((_explosive > 0.5 && {_indirectRange >= 4.5} && {_fragPower >= 35}) || {_force == 1}) then { if ((_explosive > 0.5 && {_indirectRange >= 4.5} && {_fragPower >= 35}) || {_force == 1}) then {
// shotbullet, shotShell don't seem to explode when touching water, so don't create frags // shotbullet, shotShell don't seem to explode when touching water, so don't create frags
if (((_lastPos select 2) < 0) && {(toLower getText (configFile >> "CfgAmmo" >> _shellType >> "simulation")) in ["shotbullet", "shotshell"]}) exitWith {}; if ((surfaceIsWater _lastPos) && {(toLower getText (configFile >> "CfgAmmo" >> _shellType >> "simulation")) in ["shotbullet", "shotshell"]}) exitWith {};
private _isArmed = true; private _fuseDist = getNumber(configFile >> "CfgAmmo" >> _shellType >> "fuseDistance");
if (!isNil "_gun") then { private _isArmed = _firedPos vectorDistance _lastPos >= _fuseDist; // rounds explode at exactly fuseDistance, so check inclusive
private _fuseDist = getNumber(configFile >> "CfgAmmo" >> _shellType >> "fuseDistance"); TRACE_2("",_fuseDist,_isArmed);
_isArmed = ((getPosASL _gun) distance _lastPos > _fuseDist);
TRACE_2("",_fuseDist,_isArmed);
};
if (!_isArmed) exitWith {TRACE_1("round not armed",_this);}; if (!_isArmed) exitWith {TRACE_1("round not armed",_this);};
TRACE_3("Sending frag event to server",_lastPos,_lastVel,_shellType); TRACE_3("Sending frag event to server",_lastPos,_lastVel,_shellType);
[QGVAR(frag_eh), [_lastPos,_lastVel,_shellType]] call CBA_fnc_serverEvent; [QGVAR(frag_eh), [_lastPos,_lastVel,_shellType]] call CBA_fnc_serverEvent;