added fnc_initRound

This commit is contained in:
lambdatiger 2024-01-08 18:06:57 -06:00
parent c6ba93a26d
commit bfb3fa851c
3 changed files with 68 additions and 5 deletions

View File

@ -10,10 +10,13 @@ PREP(dev_drawTrace);
PREP(dev_clearTraces);
PREP(dev_switchUnitHandle);
// Base
PREP(fired);
PREP(initRound);
// Frag
PREP(addBlackList);
PREP(initBlackList);
PREP(fired);
PREP(submunition);
PREP(shouldFrag);
PREP(fragInfo);
@ -25,8 +28,6 @@ PREP(doFragRandom);
PREP(shouldSpall);
PREP(doSpall);
PREP(doSpallMomentum);
// * Other */
//PREP(spallHP); Look at me !*!
// Explosive Reflection

View File

@ -7,13 +7,13 @@
[] call FUNC(initBlackList);
};
if (hasInterface) then {
/*if (hasInterface) then {
["ace_firedPlayer", LINKFUNC(fired)] call CBA_fnc_addEventHandler;
["ace_firedPlayerVehicle", LINKFUNC(fired)] call CBA_fnc_addEventHandler;
};
["ace_firedNonPlayer", LINKFUNC(fired)] call CBA_fnc_addEventHandler;
["ace_firedNonPlayerVehicle", LINKFUNC(fired)] call CBA_fnc_addEventHandler;
["ace_firedNonPlayerVehicle", LINKFUNC(fired)] call CBA_fnc_addEventHandler;*/
// Debug info
#ifdef DEBUG_MODE_FULL

View File

@ -0,0 +1,62 @@
#include "script_component.hpp"
/*
* Author: Lambda.Tiger
* This function checks whether an ammunition type should cause fragmentation
* and whether any submunitions exist
*
* Arguments:
* 0: _ammo <STRING> - cfgAmmo type of ammo to check
*
* Return Value:
* _shouldFrag <ARRAY>
* 0 - Should the specific round fragment
* 1 - Does the munition have a child submunition
*
* Example:
* ["B_556x45_Ball"] call ace_frag_fnc_shouldFrag;
*
* Public: No
*/
params ["_projectile"];
private _ammo = typeOf _proj;
systemChat (str _ammo + " " + str _projectile);
if (isNil "_ammo" ||
{_ammo isEqualTo "" ||
{isNil "_projectile" ||
{isNull _projectile}}}) exitWith {
WARNING("bad ammo or projectile");
};
/******* _shouldFrag format *****/
// 0: doFragmnent - will the piece fragment
// 1: hasSubmuntion - will the round create submunitions
private _shouldFrag = _ammo call FUNC(shouldFrag);
_shouldFrag params ["_doFrag", "_doSubmunit"];
if (_doFrag) then {
// wait for frag damage to kill units before spawning fragments
_projectile addEventHandler ["Explode", {
if (isServer) then {
[FUNC(doFrag), [_this]] call CBA_fnc_execNextFrame;
} else {
[QGVAR(frag_eh), [_this]] call CBA_fnc_serverEvent;
};
}
];
};
if (_doSubmunit && {GVAR(enSubMunit)> 0}) then {
_projectile addEventHandler ["SubmunitionCreated", {_this call FUNC(submunition)}];
};
private _shouldSpall = _ammo call FUNC(shouldSpall);
if (GVAR(spallEnabled) && {_shouldSpall}) then
{_projectile addEventHandler [
"HitPart",
{
[LINKFUNC(doSpallMomentum), _this] call CBA_fnc_execNextFrame;
[QGVAR(spall_eh), [_this]] call CBA_fnc_serverEvent;
}
];
};