mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Use engine command to select weighted spall size (#5985)
* Use engine command to select weighted spall size * Remove multi-line macro
This commit is contained in:
parent
07e1482719
commit
81722abeac
@ -13,10 +13,9 @@
|
|||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//fnc_doSpall.sqf
|
|
||||||
#include "script_component.hpp"
|
#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"];
|
params ["_hitData", "_hitPartDataIndex"];
|
||||||
private _initialData = GVAR(spallHPData) select (_hitData select 0);
|
private _initialData = GVAR(spallHPData) select (_hitData select 0);
|
||||||
@ -51,6 +50,7 @@ if (alive _round) then {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
if (_exit) exitWith {};
|
if (_exit) exitWith {};
|
||||||
|
|
||||||
private _unitDir = vectorNormalized _velocity;
|
private _unitDir = vectorNormalized _velocity;
|
||||||
private _pos = _hpData select 3;
|
private _pos = _hpData select 3;
|
||||||
private _spallPos = [];
|
private _spallPos = [];
|
||||||
@ -88,14 +88,6 @@ if (_explosive > 0) then {
|
|||||||
_spallPolar set [0, _fragPower * 0.66];
|
_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];
|
// diag_log text format ["SPALL POWER: %1", _spallPolar select 0];
|
||||||
private _spread = 15 + (random 25);
|
private _spread = 15 + (random 25);
|
||||||
private _spallCount = 5 + (random 10);
|
private _spallCount = 5 + (random 10);
|
||||||
@ -110,8 +102,7 @@ for "_i" from 1 to _spallCount do {
|
|||||||
_vel = (_vel - (_vel * 0.25)) + (random (_vel * 0.5));
|
_vel = (_vel - (_vel * 0.25)) + (random (_vel * 0.5));
|
||||||
|
|
||||||
private _spallFragVect = [_vel, _dir, _elev] call CBA_fnc_polar2vect;
|
private _spallFragVect = [_vel, _dir, _elev] call CBA_fnc_polar2vect;
|
||||||
private _fragType = round (random ((count _fragTypes) - 1));
|
private _fragment = (selectRandomWeighted WEIGHTED_SIZE) createVehicleLocal [0,0,10000];
|
||||||
private _fragment = (_fragTypes select _fragType) createVehicleLocal [0,0,10000];
|
|
||||||
_fragment setPosASL _spallPos;
|
_fragment setPosASL _spallPos;
|
||||||
_fragment setVelocity _spallFragVect;
|
_fragment setVelocity _spallFragVect;
|
||||||
|
|
||||||
@ -133,8 +124,7 @@ for "_i" from 1 to _spallCount do {
|
|||||||
_vel = (_vel - (_vel * 0.25)) + (random (_vel * 0.5));
|
_vel = (_vel - (_vel * 0.25)) + (random (_vel * 0.5));
|
||||||
|
|
||||||
private _spallFragVect = [_vel, _dir, _elev] call CBA_fnc_polar2vect;
|
private _spallFragVect = [_vel, _dir, _elev] call CBA_fnc_polar2vect;
|
||||||
private _fragType = round (random ((count _fragTypes) - 1));
|
private _fragment = (selectRandomWeighted WEIGHTED_SIZE) createVehicleLocal [0, 0, 10000];
|
||||||
private _fragment = (_fragTypes select _fragType) createVehicleLocal [0, 0, 10000];
|
|
||||||
_fragment setPosASL _spallPos;
|
_fragment setPosASL _spallPos;
|
||||||
_fragment setVelocity _spallFragVect;
|
_fragment setVelocity _spallFragVect;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user