Skip to content

Commit

Permalink
Use engine command to select weighted spall size (#5985)
Browse files Browse the repository at this point in the history
* Use engine command to select weighted spall size

* Remove multi-line macro
  • Loading branch information
kymckay authored and PabstMirror committed Dec 29, 2017
1 parent 07e1482 commit 81722ab
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions addons/frag/functions/fnc_doSpall.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@
*
* Public: No
*/

//fnc_doSpall.sqf
#include "script_component.hpp"
// ACE_player sideChat "WAAAAAAAAAAAAAAAAAAAAA";

#define WEIGHTED_SIZE [QGVAR(spall_small), 4, QGVAR(spall_medium), 3, QGVAR(spall_large), 2, QGVAR(spall_huge), 1]

params ["_hitData", "_hitPartDataIndex"];
private _initialData = GVAR(spallHPData) select (_hitData select 0);
Expand Down Expand Up @@ -51,6 +50,7 @@ if (alive _round) then {
};
};
if (_exit) exitWith {};

private _unitDir = vectorNormalized _velocity;
private _pos = _hpData select 3;
private _spallPos = [];
Expand Down Expand Up @@ -88,14 +88,6 @@ if (_explosive > 0) then {
_spallPolar set [0, _fragPower * 0.66];
};

private _fragTypes = [
QGVAR(spall_small), QGVAR(spall_small), QGVAR(spall_small),
QGVAR(spall_small),QGVAR(spall_medium),QGVAR(spall_medium),QGVAR(spall_medium),
QGVAR(spall_medium), QGVAR(spall_large), QGVAR(spall_large), QGVAR(spall_huge),
QGVAR(spall_huge)

];

// diag_log text format ["SPALL POWER: %1", _spallPolar select 0];
private _spread = 15 + (random 25);
private _spallCount = 5 + (random 10);
Expand All @@ -110,8 +102,7 @@ for "_i" from 1 to _spallCount do {
_vel = (_vel - (_vel * 0.25)) + (random (_vel * 0.5));

private _spallFragVect = [_vel, _dir, _elev] call CBA_fnc_polar2vect;
private _fragType = round (random ((count _fragTypes) - 1));
private _fragment = (_fragTypes select _fragType) createVehicleLocal [0,0,10000];
private _fragment = (selectRandomWeighted WEIGHTED_SIZE) createVehicleLocal [0,0,10000];
_fragment setPosASL _spallPos;
_fragment setVelocity _spallFragVect;

Expand All @@ -133,8 +124,7 @@ for "_i" from 1 to _spallCount do {
_vel = (_vel - (_vel * 0.25)) + (random (_vel * 0.5));

private _spallFragVect = [_vel, _dir, _elev] call CBA_fnc_polar2vect;
private _fragType = round (random ((count _fragTypes) - 1));
private _fragment = (_fragTypes select _fragType) createVehicleLocal [0, 0, 10000];
private _fragment = (selectRandomWeighted WEIGHTED_SIZE) createVehicleLocal [0, 0, 10000];
_fragment setPosASL _spallPos;
_fragment setVelocity _spallFragVect;

Expand Down

0 comments on commit 81722ab

Please sign in to comment.