2024-01-09 00:06:57 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
/*
|
|
|
|
* Author: Lambda.Tiger
|
2024-01-09 03:38:15 +00:00
|
|
|
* This function adds rounds using their config init EH
|
|
|
|
|
2024-01-09 00:06:57 +00:00
|
|
|
* Arguments:
|
2024-01-09 03:38:15 +00:00
|
|
|
* 0: _projectile <OBJECT> - The object created
|
2024-01-09 00:06:57 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
2024-01-09 03:38:15 +00:00
|
|
|
* None
|
2024-01-09 00:06:57 +00:00
|
|
|
*
|
|
|
|
* Example:
|
2024-01-09 03:38:15 +00:00
|
|
|
* [_proj] call ace_frag_fnc_initRound;
|
2024-01-09 00:06:57 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
2024-01-09 03:55:02 +00:00
|
|
|
params [
|
|
|
|
["_projectile", objNull, [objNull]]
|
|
|
|
];
|
2024-01-09 03:38:15 +00:00
|
|
|
|
|
|
|
private _ammo = typeOf _projectile;
|
2024-01-09 03:55:02 +00:00
|
|
|
if (_ammo isEqualTo "" || {isNull _projectile}) exitWith {
|
2024-01-09 03:38:15 +00:00
|
|
|
TRACE_2("bad ammo or projectile",_ammo,_projectile);
|
2024-01-09 00:06:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
private _shouldFrag = _ammo call FUNC(shouldFrag);
|
2024-01-09 03:38:15 +00:00
|
|
|
_shouldFrag params ["_doFrag"];
|
2024-01-09 00:06:57 +00:00
|
|
|
|
|
|
|
if (_doFrag) then {
|
|
|
|
// wait for frag damage to kill units before spawning fragments
|
2024-01-09 03:55:02 +00:00
|
|
|
_projectile addEventHandler [
|
|
|
|
"Explode",
|
|
|
|
{
|
2024-01-09 00:06:57 +00:00
|
|
|
if (isServer) then {
|
|
|
|
[FUNC(doFrag), [_this]] call CBA_fnc_execNextFrame;
|
|
|
|
} else {
|
|
|
|
[QGVAR(frag_eh), [_this]] call CBA_fnc_serverEvent;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
private _shouldSpall = _ammo call FUNC(shouldSpall);
|
|
|
|
|
|
|
|
if (GVAR(spallEnabled) && {_shouldSpall}) then
|
2024-01-09 03:38:15 +00:00
|
|
|
{
|
|
|
|
_projectile addEventHandler [
|
2024-01-09 00:06:57 +00:00
|
|
|
"HitPart",
|
|
|
|
{
|
2024-01-09 03:38:15 +00:00
|
|
|
if (isServer) then {
|
|
|
|
[LINKFUNC(doSpallMomentum), _this] call CBA_fnc_execNextFrame;
|
|
|
|
} else {
|
|
|
|
[QGVAR(spall_eh), [_this]] call CBA_fnc_serverEvent;
|
|
|
|
};
|
2024-01-09 00:06:57 +00:00
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|