mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Added init event handlers instead of fired
This commit is contained in:
parent
14e7ef7cba
commit
596240a57d
@ -17,16 +17,11 @@
|
|||||||
|
|
||||||
// Debug info
|
// Debug info
|
||||||
#ifdef DEBUG_MODE_FULL
|
#ifdef DEBUG_MODE_FULL
|
||||||
if (hasInterface && GVAR(debugOptions)) then
|
if (hasInterface && GVAR(debugOptions)) then {
|
||||||
{
|
private _h = [LINKFUNC(dev_drawTrace), 0] call CBA_fnc_addPerFrameHandler;
|
||||||
private _h = [LINKFUNC(dev_drawTrace), 0] call CBA_fnc_addPerFrameHandler;
|
missionNamespace setVariable [QGVAR(dev_drawPFEH), _h];
|
||||||
missionNamespace setVariable [QGVAR(dev_drawPFEH), _h];
|
["unit", LINKFUNC(dev_switchUnitHandle), true] call CBA_fnc_addPlayerEventHandler;
|
||||||
["unit", LINKFUNC(dev_switchUnitHandle), true] call CBA_fnc_addPlayerEventHandler;
|
[objNull, ace_player] call FUNC(dev_switchUnitHandle);
|
||||||
[objNull, ace_player] call FUNC(dev_switchUnitHandle);
|
|
||||||
["ace_firedPlayer", LINKFUNC(fired)] call CBA_fnc_addEventHandler;
|
|
||||||
["ace_firedNonPlayer", LINKFUNC(fired)] call CBA_fnc_addEventHandler;
|
|
||||||
["ace_firedPlayerVehicle", LINKFUNC(fired)] call CBA_fnc_addEventHandler;
|
|
||||||
["ace_firedNonPlayerVehicle", LINKFUNC(fired)] call CBA_fnc_addEventHandler;
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
}] call CBA_fnc_addEventHandler;
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#define ACE_FRAG_ADD_EH class EventHandlers {\
|
#define ACE_FRAG_ADD_EH class EventHandlers {\
|
||||||
class ADDON {\
|
class ADDON {\
|
||||||
init = QUOTE(_this call FUNC(initRound));\
|
init = QUOTE(_this call FUNC(initRound););\
|
||||||
};\
|
};\
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9,7 +9,8 @@ class Bo_Mk82: BombCore {
|
|||||||
ACE_FRAG_ADD_EH;
|
ACE_FRAG_ADD_EH;
|
||||||
};
|
};
|
||||||
|
|
||||||
class BulletCore;
|
// We need this since autocannons generally inherit from BulletBase
|
||||||
|
class BulletCore;
|
||||||
class BulletBase: BulletCore {
|
class BulletBase: BulletCore {
|
||||||
ACE_FRAG_ADD_EH;
|
ACE_FRAG_ADD_EH;
|
||||||
};
|
};
|
||||||
|
@ -1,37 +1,32 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: Lambda.Tiger
|
* Author: Lambda.Tiger
|
||||||
* This function checks whether an ammunition type should cause fragmentation
|
* This function adds rounds using their config init EH
|
||||||
* and whether any submunitions exist
|
|
||||||
*
|
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: _ammo <STRING> - cfgAmmo type of ammo to check
|
* 0: _projectile <OBJECT> - The object created
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* _shouldFrag <ARRAY>
|
* None
|
||||||
* 0 - Should the specific round fragment
|
|
||||||
* 1 - Does the munition have a child submunition
|
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* ["B_556x45_Ball"] call ace_frag_fnc_shouldFrag;
|
* [_proj] call ace_frag_fnc_initRound;
|
||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
params ["_projectile"];
|
params ["_projectile"];
|
||||||
private _ammo = typeOf _proj;
|
|
||||||
systemChat (str _ammo + " " + str _projectile);
|
private _ammo = typeOf _projectile;
|
||||||
if (isNil "_ammo" ||
|
if (isNil "_ammo" ||
|
||||||
{_ammo isEqualTo "" ||
|
{_ammo isEqualTo "" ||
|
||||||
{isNil "_projectile" ||
|
{isNil "_projectile" ||
|
||||||
{isNull _projectile}}}) exitWith {
|
{isNull _projectile}}}) exitWith {
|
||||||
WARNING("bad ammo or projectile");
|
TRACE_2("bad ammo or projectile",_ammo,_projectile);
|
||||||
};
|
};
|
||||||
|
|
||||||
/******* _shouldFrag format *****/
|
|
||||||
// 0: doFragmnent - will the piece fragment
|
|
||||||
// 1: hasSubmuntion - will the round create submunitions
|
|
||||||
private _shouldFrag = _ammo call FUNC(shouldFrag);
|
private _shouldFrag = _ammo call FUNC(shouldFrag);
|
||||||
_shouldFrag params ["_doFrag", "_doSubmunit"];
|
_shouldFrag params ["_doFrag"];
|
||||||
|
|
||||||
if (_doFrag) then {
|
if (_doFrag) then {
|
||||||
// wait for frag damage to kill units before spawning fragments
|
// wait for frag damage to kill units before spawning fragments
|
||||||
@ -45,18 +40,19 @@ if (_doFrag) then {
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
if (_doSubmunit && {GVAR(enSubMunit)> 0}) then {
|
|
||||||
_projectile addEventHandler ["SubmunitionCreated", {_this call FUNC(submunition)}];
|
|
||||||
};
|
|
||||||
|
|
||||||
private _shouldSpall = _ammo call FUNC(shouldSpall);
|
private _shouldSpall = _ammo call FUNC(shouldSpall);
|
||||||
|
|
||||||
if (GVAR(spallEnabled) && {_shouldSpall}) then
|
if (GVAR(spallEnabled) && {_shouldSpall}) then
|
||||||
{_projectile addEventHandler [
|
{
|
||||||
|
_projectile addEventHandler [
|
||||||
"HitPart",
|
"HitPart",
|
||||||
{
|
{
|
||||||
[LINKFUNC(doSpallMomentum), _this] call CBA_fnc_execNextFrame;
|
if (isServer) then {
|
||||||
[QGVAR(spall_eh), [_this]] call CBA_fnc_serverEvent;
|
[LINKFUNC(doSpallMomentum), _this] call CBA_fnc_execNextFrame;
|
||||||
|
} else {
|
||||||
|
[QGVAR(spall_eh), [_this]] call CBA_fnc_serverEvent;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
Loading…
Reference in New Issue
Block a user