use master pfh for frag

This commit is contained in:
PabstMirror 2015-06-16 22:39:37 -05:00
parent 2afcf92643
commit ccb30e0a47
3 changed files with 23 additions and 81 deletions

View File

@ -1,58 +1,8 @@
#include "script_component.hpp"
private ["_enabled", "_gun", "_type", "_round", "_doFragTrack", "_doSpall", "_spallTrack", "_spallTrackID"];
if (!GVAR(enabled)) exitWith {};
private["_gun", "_type", "_round"];
_gun = _this select 0;
_type = _this select 4;
_round = _this select 6;
_enabled = getNumber (configFile >> "CfgAmmo" >> _type >> QGVAR(enabled));
if(_enabled < 1) exitWith {};
if(_round in GVAR(blackList)) exitWith {
GVAR(blackList) = GVAR(blackList) - [_round];
};
_doFragTrack = false;
if(_gun == ACE_player) then {
_doFragTrack = true;
} else {
if((gunner _gun) == ACE_player) then {
_doFragTrack = true;
} else {
if(local _gun && {!(isPlayer (gunner _gun))} && {!(isPlayer _gun)}) then {
_doFragTrack = true;
};
};
};
_doSpall = false;
if(_doSpall) then {
if(GVAR(spallIsTrackingCount) <= 0) then {
GVAR(spallHPData) = [];
};
if(GVAR(spallIsTrackingCount) > 5) then {
// ACE_player sideChat "LIMT!";
_doSpall = false;
} else {
GVAR(spallIsTrackingCount) = GVAR(spallIsTrackingCount) + 1;
};
};
// ACE_player sideChat format["c: %1", GVAR(spallIsTrackingCount)];
#ifdef DEBUG_MODE_FULL
[ACE_player, _round, [1,0,0,1]] call FUNC(addTrack);
#endif
if(_doFragTrack && alive _round) then {
GVAR(trackedObjects) pushBack _round;
_spallTrack = [];
_spallTrackID = [];
[DFUNC(trackFragRound), 0, [_round, (getPosASL _round), (velocity _round), _type, ACE_time, _gun, _doSpall, _spallTrack, _spallTrackID]] call cba_fnc_addPerFrameHandler;
if(_doSpall) then {
[_round, 2, _spallTrack, _spallTrackID] call FUNC(spallTrack);
};
// ACE_player sideChat "WTF2";
};
[_gun, _type, _round] call FUNC(addPfhRound);

View File

@ -4,7 +4,7 @@
* Master single PFH abstraction for all rounds being tracked by frag/spall
*
* Arguments:
*
*
*
* Return Value:
* None
@ -21,24 +21,16 @@ _gcIndex = [];
_iter = 0;
while { (count GVAR(objects)) > 0 && { _iter < GVAR(MaxTrackPerFrame) } } do {
private["_object", "_args"];
if(GVAR(lastIterationIndex) >= (count GVAR(objects))) then {
if(GVAR(lastIterationIndex) >= (count GVAR(objects))) exitWith {
GVAR(lastIterationIndex) = 0;
};
_object = GVAR(objects) select GVAR(lastIterationIndex);
if(!isNil "_object") then {
if(isNull _object) then {
_gcIndex pushBack GVAR(lastIterationIndex);
} else {
_args = GVAR(arguments) select GVAR(lastIterationIndex);
if(!(_args call FUNC(pfhRound))) then {
_gcIndex pushBack GVAR(lastIterationIndex); // Add it to the GC if it returns false
};
// If its not alive anymore, remove it from the queue, it already ran once on dead
if(!alive _object) then {
_gcIndex pushBack GVAR(lastIterationIndex);
};
_args = GVAR(arguments) select GVAR(lastIterationIndex);
if(!(_args call FUNC(pfhRound))) then {
_gcIndex pushBack GVAR(lastIterationIndex); // Add it to the GC if it returns false
};
};
_iter = _iter + 1;
@ -53,6 +45,6 @@ _deletionCount = 0;
_deleteIndex = _x - _deletionCount;
GVAR(objects) deleteAt _deleteIndex;
GVAR(arguments) deleteAt _deleteIndex;
_deletionCount = _deletionCount + 1;
} forEach _gcIndex;

View File

@ -14,12 +14,12 @@ _indirectRange = _this select 11;
_force = _this select 12;
_fragPower = _this select 13;
if(_round in GVAR(blackList)) exitWith {
if(_round in GVAR(blackList)) exitWith {
false
};
if (!alive _round) then {
if((diag_frameno - _firedFrame) > 1) then {
if (!alive _round) exitWith {
if((diag_frameno - _firedFrame) > 1) then { //skip if deleted within a single frame
if(_skip == 0) then {
if((_explosive > 0.5 && {_indirectRange >= 4.5} && {_fragPower >= 35}) || {_force == 1} ) then {
[QGVAR(frag_eh), _this] call ace_common_fnc_serverEvent;
@ -35,15 +35,15 @@ if (!alive _round) then {
};
} forEach _spallTrack;
};
} else {
_params set[1, (getPosASL _round)];
_params set[2, (velocity _round)];
if(_doSpall) then {
private["_scale"];
_scale = ( (count GVAR(objects)) / GVAR(MaxTrackPerFrame) ) max 0.1;
[_round, _scale, _spallTrack, _foundObjectHPIds] call FUNC(spallTrack);
};
false
};
true
_params set[1, (getPosASL _round)];
_params set[2, (velocity _round)];
if(_doSpall) then {
private["_scale"];
_scale = ( (count GVAR(objects)) / GVAR(MaxTrackPerFrame) ) max 0.1;
[_round, _scale, _spallTrack, _foundObjectHPIds] call FUNC(spallTrack);
};
true