mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Unified fired event handler
This commit is contained in:
parent
d69af47030
commit
89354e25c8
@ -59,3 +59,8 @@ class Extended_Local_EventHandlers {
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_FiredBIS_EventHandlers {
|
||||
class All {
|
||||
ADDON = QUOTE(_this call FUNC(firedEH));
|
||||
};
|
||||
};
|
||||
|
@ -47,6 +47,7 @@ PREP(execRemoteFnc);
|
||||
PREP(executePersistent);
|
||||
PREP(filter);
|
||||
PREP(findUnloadPosition);
|
||||
PREP(firedEH);
|
||||
PREP(fixCollision);
|
||||
PREP(fixFloating);
|
||||
PREP(fixLoweredRifleAnimation);
|
||||
|
51
addons/common/functions/fnc_firedEH.sqf
Normal file
51
addons/common/functions/fnc_firedEH.sqf
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Author: esteldunedain
|
||||
* Unfied handling of weapon fire
|
||||
*
|
||||
* Argument:
|
||||
* 0: unit - Object the event handler is assigned to <OBJECT>
|
||||
* 1: weapon - Fired weapon <STRING>
|
||||
* 2: muzzle - Muzzle that was used <STRING>
|
||||
* 3: mode - Current mode of the fired weapon <STRING>
|
||||
* 4: ammo - Ammo used <STRING>
|
||||
* 5: magazine - magazine name which was used <STRING>
|
||||
* 6: projectile - Object of the projectile that was shot <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
BEGIN_COUNTER(firedEH);
|
||||
|
||||
params ["_firedEHUnit", "_firedEHWeapon", "_firedEHMuzzle", "_firedEHMode", "_firedEHAmmo", "_firedEHMagazine", "_firedEHProjectile"];
|
||||
TRACE_5("firedEH:",_firedEHUnit, _firedEHWeapon, _firedEHMuzzle, _firedEHMode, _firedEHAmmo, _firedEHMagazine, _firedEHProjectile);
|
||||
|
||||
if (_firedEHUnit isKindOf "CAManBase") then {
|
||||
// The unit it on foot
|
||||
if (_firedEHUnit == ACE_player) then {
|
||||
["firedPlayer", this] call FUNC(localEvent);
|
||||
} else {
|
||||
if ([_firedEHUnit] call EFUNC(common,isPlayer)) then {
|
||||
["firedPlayerNonLocal", this] call FUNC(localEvent);
|
||||
} else {
|
||||
["firedNonPlayer", this] call FUNC(localEvent);
|
||||
};
|
||||
};
|
||||
} else {
|
||||
// The unit is a vehicle
|
||||
private _firedEHGunner = [_firedEHUnit, _firedEHWeapon] call EFUNC(common,getGunner);
|
||||
if (_firedEHGunner == ACE_player) then {
|
||||
["firedPlayerVehicle", this] call FUNC(localEvent);
|
||||
} else {
|
||||
if ([_firedEHGunner] call EFUNC(common,isPlayer)) then {
|
||||
["firedPlayerVehicleNonLocal", this] call FUNC(localEvent);
|
||||
} else {
|
||||
["firedNonPlayerVehicle", this] call FUNC(localEvent);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
END_COUNTER(firedEH);
|
Loading…
Reference in New Issue
Block a user