Fragmentation enabled.

This commit is contained in:
Nou 2015-03-21 21:22:16 -07:00
parent 08eb40a606
commit 12cadc603f
14 changed files with 29 additions and 31 deletions

View File

@ -26,7 +26,7 @@ class CfgAmmo {
ACE_FRAG_SKIP = 0; ACE_FRAG_SKIP = 0;
ACE_FRAG_FORCE = 1; ACE_FRAG_FORCE = 1;
// This is a good high-drag frag type for grenades. // This is a good high-drag frag type for grenades.
ACE_FRAG_CLASSES[] = {"ACE_frag_medium_HD"}; ACE_FRAG_CLASSES[] = {"ACE_frag_tiny_HD"};
/* /*
These values are based on the M67 Grenade, should be tweaked for These values are based on the M67 Grenade, should be tweaked for
individual grenades. individual grenades.

View File

@ -1,8 +1,8 @@
#include "script_component.hpp" #include "script_component.hpp"
[QUOTE(ffsBIS), "oneachframe", QUOTE(FUNC(onFrame))] call BIS_fnc_addStackedEventHandler;
if(isServer) then { if(isServer) then {
[QGVAR(frag_eh), { _this call FUNC(frago); }] call CBA_fnc_addClientToServerEventhandler; [QGVAR(frag_eh), { _this call FUNC(frago); }] call ace_common_fnc_addEventHandler;
}; };
/*
GVAR(replacedBisArtyWrapper) = false; GVAR(replacedBisArtyWrapper) = false;
[] spawn { [] spawn {
waitUntil { waitUntil {
@ -15,3 +15,4 @@ GVAR(replacedBisArtyWrapper) = false;
GVAR(replacedBisArtyWrapper) GVAR(replacedBisArtyWrapper)
}; };
}; };
*/

View File

@ -1,6 +1,6 @@
#include "script_component.hpp" #include "script_component.hpp"
#define ACE_TRACE_DRAW_INC 1
ADDON = false; ADDON = false;
PREP(fired); PREP(fired);
@ -14,7 +14,7 @@ GVAR(trackedObjects) = [];
GVAR(blackList) = []; GVAR(blackList) = [];
GVAR(traceFrags) = false; GVAR(traceFrags) = false;
GVAR(replacedBisArtyWrapper) = false; GVAR(replacedBisArtyWrapper) = true;
GVAR(TOTALFRAGS) = 0; GVAR(TOTALFRAGS) = 0;

View File

@ -3,5 +3,5 @@ private ["_round"];
_round = _this select 0; _round = _this select 0;
if(alive _round) then { if(alive _round) then {
GVAR(trackedObjects) set[(count GVAR(trackedObjects)), _round]; GVAR(trackedObjects) set[(count GVAR(trackedObjects)), _round];
[FUNC(trackFragRound), 0, [_round, (getPosASL _round), (velocity _round), (typeOf _round), time, objNull, false, 0, 0]] call cba_fnc_addPerFrameHandler; [DFUNC(trackFragRound), 0, [_round, (getPosASL _round), (velocity _round), (typeOf _round), time, objNull, false, 0, 0]] call cba_fnc_addPerFrameHandler;
}; };

View File

@ -17,4 +17,4 @@ _objTVel = sqrt((_objVel select 0)^2 + (_objVel select 1)^2 + (_objVel select 2)
_positions set[(count _positions), [(getPos _obj), _objTVel]]; _positions set[(count _positions), [(getPos _obj), _objTVel]];
_data = [_origin, typeOf _origin, typeOf _obj, _objTVel, _positions, _color]; _data = [_origin, typeOf _origin, typeOf _obj, _objTVel, _positions, _color];
GVAR(traces) set[_index, _data]; GVAR(traces) set[_index, _data];
[FUNC(trackTrace), 0, [_obj, _index, time]] call cba_fnc_addPerFrameHandler; [DFUNC(trackTrace), 0, [_obj, _index, time]] call cba_fnc_addPerFrameHandler;

View File

@ -44,13 +44,12 @@ if(_alive || {_caliber >= 2.5} || {(_explosive > 0 && {_idh >= 1})}) then {
_exit = false; _exit = false;
_vm = 1; _vm = 1;
_velocity = _initialData select 5; _velocity = _initialData select 5;
_unitDir = _velocity call BIS_fnc_unitVector;
_oldVelocity = _velocity call BIS_fnc_magnitude; _oldVelocity = _velocity call BIS_fnc_magnitude;
_curVelocity = (velocity _round) call BIS_fnc_magnitude; _curVelocity = (velocity _round) call BIS_fnc_magnitude;
if(alive _round) then { if(alive _round) then {
_diff = [_velocity, (velocity _round)] call FUNC(vectorDiffFast); _diff = _velocity vectorDiff (velocity _round);
_polar = _diff call CBA_fnc_vect2polar; _polar = _diff call CBA_fnc_vect2polar;
// player sideChat format["polar: %1", _polar]; // player sideChat format["polar: %1", _polar];
if((abs(_polar select 1) > 45 || abs(_polar select 2) > 45)) then { if((abs(_polar select 1) > 45 || abs(_polar select 2) > 45)) then {
@ -63,7 +62,7 @@ if(_alive || {_caliber >= 2.5} || {(_explosive > 0 && {_idh >= 1})}) then {
}; };
}; };
if(!_exit) then { if(!_exit) then {
_unitDir = _velocity call BIS_fnc_unitVector; _unitDir = vectorNormalized _velocity;
_pos = _hpData select 3; _pos = _hpData select 3;
_spallPos = nil; _spallPos = nil;
for "_i" from 0 to 100 do { for "_i" from 0 to 100 do {
@ -137,7 +136,6 @@ if(_alive || {_caliber >= 2.5} || {(_explosive > 0 && {_idh >= 1})}) then {
_fragment = (_fragTypes select _fragType) createVehicleLocal [0,0,10000]; _fragment = (_fragTypes select _fragType) createVehicleLocal [0,0,10000];
_fragment setPosASL _spallPos; _fragment setPosASL _spallPos;
_fragment setVelocity _spallFragVect; _fragment setVelocity _spallFragVect;
// [fnc_spallTrackPFH, 0, [_fragment, diag_tickTime]] call cba_fnc_addPerFrameHandler;
if(GVAR(traceFrags)) then { if(GVAR(traceFrags)) then {
[player, _fragment, [1,0.5,0,1]] call FUNC(addTrack); [player, _fragment, [1,0.5,0,1]] call FUNC(addTrack);
}; };
@ -159,7 +157,6 @@ if(_alive || {_caliber >= 2.5} || {(_explosive > 0 && {_idh >= 1})}) then {
_fragment = (_fragTypes select _fragType) createVehicleLocal [0,0,10000]; _fragment = (_fragTypes select _fragType) createVehicleLocal [0,0,10000];
_fragment setPosASL _spallPos; _fragment setPosASL _spallPos;
_fragment setVelocity _spallFragVect; _fragment setVelocity _spallFragVect;
// [fnc_spallTrackPFH, 0, [_fragment, diag_tickTime]] call cba_fnc_addPerFrameHandler;
if(GVAR(traceFrags)) then { if(GVAR(traceFrags)) then {
[player, _fragment, [1,0,0,1]] call FUNC(addTrack); [player, _fragment, [1,0,0,1]] call FUNC(addTrack);
}; };

View File

@ -1,5 +1,4 @@
#include "script_component.hpp" #include "script_component.hpp"
/*
private ["_gun", "_type", "_round", "_doFragTrack", "_doSpall"]; private ["_gun", "_type", "_round", "_doFragTrack", "_doSpall"];
if !(isNil QGVAR(enabled) && {GVAR(enabled)}) exitWith {}; if !(isNil QGVAR(enabled) && {GVAR(enabled)}) exitWith {};
@ -23,7 +22,7 @@ if(_gun == player) then {
}; };
}; };
}; };
_doSpall = true; _doSpall = false;
if(_doSpall) then { if(_doSpall) then {
if(GVAR(spallIsTrackingCount) <= 0) then { if(GVAR(spallIsTrackingCount) <= 0) then {
GVAR(spallHPData) = []; GVAR(spallHPData) = [];
@ -36,15 +35,14 @@ if(_doSpall) then {
}; };
}; };
// player sideChat format["c: %1", GVAR(spallIsTrackingCount)]; // player sideChat format["c: %1", GVAR(spallIsTrackingCount)];
[player, _round, [1,0,0,1]] call FUNC(addTrack); [player, _round, [1,0,0,1]] call nou_fnc_addTrack;
if(_doFragTrack && alive _round) then { if(_doFragTrack && alive _round) then {
GVAR(trackedObjects) set[(count GVAR(trackedObjects)), _round]; GVAR(trackedObjects) pushBack _round;
_spallTrack = []; _spallTrack = [];
_spallTrackID = []; _spallTrackID = [];
[FUNC(trackFragRound), 0, [_round, (getPosASL _round), (velocity _round), _type, time, _gun, _doSpall, _spallTrack, _spallTrackID]] call cba_fnc_addPerFrameHandler; [DFUNC(trackFragRound), 0, [_round, (getPosASL _round), (velocity _round), _type, time, _gun, _doSpall, _spallTrack, _spallTrackID]] call cba_fnc_addPerFrameHandler;
if(_doSpall) then { if(_doSpall) then {
[_round, 2, _spallTrack, _spallTrackID] call FUNC(spallTrack); [_round, 2, _spallTrack, _spallTrackID] call FUNC(spallTrack);
}; };
// player sideChat "WTF2"; // player sideChat "WTF2";
}; };
*/

View File

@ -6,5 +6,5 @@ _shell = _params select 0;
if(alive _shell) then { if(alive _shell) then {
drop ["\Ca\Data\Cl_basic","","Billboard",1,30,(getPos _shell),[0,0,0],1,1.275,1.0,0.0,[0.5],[[0,1,0,1]],[0],0.0,2.0,"","",""]; drop ["\Ca\Data\Cl_basic","","Billboard",1,30,(getPos _shell),[0,0,0],1,1.275,1.0,0.0,[0.5],[[0,1,0,1]],[0],0.0,2.0,"","",""];
} else { } else {
[_this select 1] call FUNC(removeBISPFH); [_this select 1] call cba_fnc_removePerFrameHandler;
}; };

View File

@ -130,11 +130,12 @@ if(_isArmed && (count _objects) > 0) then {
_targetVel = (velocity _target); _targetVel = (velocity _target);
_targetPos set[2, (_targetPos select 2)+_add];
_targetPos set[0, (_targetPos select 0)+((_targetVel select 0)*(_distance/_fragPower))]; _targetPos set[0, (_targetPos select 0)+((_targetVel select 0)*(_distance/_fragPower))];
_targetPos set[1, (_targetPos select 1)+((_targetVel select 1)*(_distance/_fragPower))]; _targetPos set[1, (_targetPos select 1)+((_targetVel select 1)*(_distance/_fragPower))];
_targetPos set[2, (_targetPos select 2)+_add];
_baseVec = [_lastPos, _targetPos] call BIS_fnc_vectorFromXToY; _baseVec = _lastPos vectorFromTo _targetPos;
_dir = floor(_baseVec call CBA_fnc_vectDir); _dir = floor(_baseVec call CBA_fnc_vectDir);
_currentCount = _fragArcs select _dir; _currentCount = _fragArcs select _dir;
@ -213,7 +214,6 @@ if(_isArmed && (count _objects) > 0) then {
_fragObj setVelocity _vel; _fragObj setVelocity _vel;
#ifdef DEBUG_MODE_FULL #ifdef DEBUG_MODE_FULL
GVAR(TOTALFRAGS) = GVAR(TOTALFRAGS) + 1; GVAR(TOTALFRAGS) = GVAR(TOTALFRAGS) + 1;
// [FUNC(frag_trace), 0, [_fragObj]] call cba_fnc_addPerFrameHandler;
GVAR(traceFrags) = true; GVAR(traceFrags) = true;
#endif #endif
if(GVAR(traceFrags)) then { if(GVAR(traceFrags)) then {

View File

@ -21,7 +21,7 @@ if((_this select 0) <= (count GVAR(spallHPData))) then {
// diag_log text format["%1: %2", _forEachIndex, _x]; // diag_log text format["%1: %2", _forEachIndex, _x];
// } forEach _hp; // } forEach _hp;
// } forEach (_this select 1); // } forEach (_this select 1);
[FUNC(doSpall), 0, [_this, _forEachIndex]] call cba_fnc_addPerFrameHandler; [DFUNC(doSpall), 0, [_this, _forEachIndex]] call cba_fnc_addPerFrameHandler;
// player sideChat "WEEE"; // player sideChat "WEEE";
} forEach (_this select 1); } forEach (_this select 1);
}; };

View File

@ -1,5 +1,5 @@
#include "script_component.hpp" #include "script_component.hpp"
if(GVAR(tracesStarted)) then { if(GVAR(tracesStarted)) then {
GVAR(tracesStarted) = false; GVAR(tracesStarted) = false;
[GVAR(traceID)] call FUNC(removeBISPFH); [GVAR(traceID)] call cba_fnc_removePerFrameHandler;
}; };

View File

@ -12,7 +12,7 @@ _spallTrack = _params select 7;
_foundObjectHPIds = _params select 8; _foundObjectHPIds = _params select 8;
if (!alive _round) then { if (!alive _round) then {
[_this select 1] call FUNC(removeBISPFH); [_this select 1] call cba_fnc_removePerFrameHandler;
if(_time != time && {_round in GVAR(trackedObjects)} && {!(_round in GVAR(blackList))}) then { if(_time != time && {_round in GVAR(trackedObjects)} && {!(_round in GVAR(blackList))}) then {
GVAR(trackedObjects) = GVAR(trackedObjects) - [_round]; GVAR(trackedObjects) = GVAR(trackedObjects) - [_round];
_skip = getNumber (configFile >> "CfgAmmo" >> _type >> "ACE_FRAG_SKIP"); _skip = getNumber (configFile >> "CfgAmmo" >> _type >> "ACE_FRAG_SKIP");
@ -22,7 +22,7 @@ if (!alive _round) then {
_force = getNumber (configFile >> "CfgAmmo" >> _type >> "ACE_FRAG_FORCE"); _force = getNumber (configFile >> "CfgAmmo" >> _type >> "ACE_FRAG_FORCE");
_fragPower = getNumber(configFile >> "CfgAmmo" >> _type >> "indirecthit")*(sqrt(_indirectRange)); _fragPower = getNumber(configFile >> "CfgAmmo" >> _type >> "indirecthit")*(sqrt(_indirectRange));
if((_explosive > 0.5 && {_indirectRange >= 4.5} && {_fragPower >= 35}) || {_force == 1} ) then { if((_explosive > 0.5 && {_indirectRange >= 4.5} && {_fragPower >= 35}) || {_force == 1} ) then {
[QGVAR(frag_eh), _params] call CBA_fnc_clientToServerEvent; [QGVAR(frag_eh), _params] call ace_common_fnc_serverEvent;
GVAR(trackedObjects) = GVAR(trackedObjects) - [_round]; GVAR(trackedObjects) = GVAR(trackedObjects) - [_round];
}; };
}; };
@ -38,7 +38,7 @@ if (!alive _round) then {
}; };
} else { } else {
if(!(_round in GVAR(trackedObjects)) || {_round in GVAR(blackList)}) then { if(!(_round in GVAR(trackedObjects)) || {_round in GVAR(blackList)}) then {
[_this select 1] call FUNC(removeBISPFH); [_this select 1] call cba_fnc_removePerFrameHandler;
if(_round in GVAR(blackList)) then { if(_round in GVAR(blackList)) then {
GVAR(blackList) = GVAR(blackList) - [_round]; GVAR(blackList) = GVAR(blackList) - [_round];
}; };

View File

@ -10,5 +10,5 @@ if(alive _tracerObj && (count GVAR(traces)) > 0) then {
_objTVel = sqrt((_objVel select 0)^2 + (_objVel select 1)^2 + (_objVel select 2)^2); _objTVel = sqrt((_objVel select 0)^2 + (_objVel select 1)^2 + (_objVel select 2)^2);
_positions set[(count _positions), [(getPos _tracerObj), _objTVel]]; _positions set[(count _positions), [(getPos _tracerObj), _objTVel]];
} else { } else {
[(_this select 1)] call FUNC(removeBISPFH); [(_this select 1)] call cba_fnc_removePerFrameHandler;
}; };

View File

@ -1,7 +1,7 @@
#define COMPONENT frag #define COMPONENT frag
#include "\z\ace\Addons\main\script_mod.hpp" #include "\z\ace\Addons\main\script_mod.hpp"
#define DEBUG_ENABLED_FRAG //#define DEBUG_ENABLED_FRAG
#ifdef DEBUG_ENABLED_FRAG #ifdef DEBUG_ENABLED_FRAG
#define DEBUG_MODE_FULL #define DEBUG_MODE_FULL
@ -12,3 +12,5 @@
#endif #endif
#include "\z\ace\Addons\main\script_macros.hpp" #include "\z\ace\Addons\main\script_macros.hpp"
#define ACE_TRACE_DRAW_INC 1