mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
SOG Compat - Fix remote punji traps not causing damage (#8755)
* Initial commit * derp * fix derp * fix derp again * don't code without coffee * damage locality is weird, bi pls fix * Update fnc_handlePunjiTrapTrigger.sqf Co-authored-by: PabstMirror <pabstmirror@gmail.com>
This commit is contained in:
parent
b1451d75f0
commit
3b62af6131
@ -42,7 +42,7 @@ class vn_mine_punji_01_ammo: APERSBoundingMine_Range_Ammo {
|
|||||||
|
|
||||||
class EventHandlers {
|
class EventHandlers {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
AmmoHit = QUOTE(call FUNC(handlePunjiTrapDamage));
|
AmmoHit = QUOTE(call FUNC(handlePunjiTrapTrigger));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -57,7 +57,7 @@ class vn_mine_punji_03_ammo: vn_mine_punji_01_ammo {
|
|||||||
|
|
||||||
class EventHandlers {
|
class EventHandlers {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
AmmoHit = QUOTE(call FUNC(handlePunjiTrapDamage));
|
AmmoHit = QUOTE(call FUNC(handlePunjiTrapTrigger));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -10,6 +10,12 @@ class Extended_PreInit_EventHandlers {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class Extended_PostInit_EventHandlers {
|
||||||
|
class ADDON {
|
||||||
|
init = QUOTE(call COMPILE_SCRIPT(XEH_postInit));
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
class Extended_InitPost_EventHandlers {
|
class Extended_InitPost_EventHandlers {
|
||||||
class GVAR(spiderhole_01_nogeo) {
|
class GVAR(spiderhole_01_nogeo) {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
|
@ -1,2 +1,3 @@
|
|||||||
PREP(disableCookoff);
|
PREP(disableCookoff);
|
||||||
PREP(handlePunjiTrapDamage);
|
PREP(handlePunjiTrapDamage);
|
||||||
|
PREP(handlePunjiTrapTrigger);
|
||||||
|
1
optionals/compat_sog/XEH_postInit.sqf
Normal file
1
optionals/compat_sog/XEH_postInit.sqf
Normal file
@ -0,0 +1 @@
|
|||||||
|
[QGVAR(handlePunjiTrapDamage), LINKFUNC(handlePunjiTrapDamage)] call CBA_fnc_addEventHandler;
|
@ -5,6 +5,7 @@
|
|||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Punji trap <OBJECT>
|
* 0: Punji trap <OBJECT>
|
||||||
|
* 1: Affected units <ARRAY of OBJECT>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
@ -14,16 +15,10 @@
|
|||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
params ["_trap"];
|
params ["_trap", "_affectedUnits"];
|
||||||
|
|
||||||
if (!(["ACE_Medical"] call EFUNC(common,isModLoaded))) exitWith {};
|
|
||||||
|
|
||||||
private _radius = getNumber (configOf _trap >> "indirectHitRange");
|
|
||||||
private _affectedUnits = (_trap nearEntities ["CAManBase", _radius]) select {local _x} select {isDamageAllowed _x};
|
|
||||||
(getShotParents _trap) params ["", "_instigator"];
|
(getShotParents _trap) params ["", "_instigator"];
|
||||||
|
|
||||||
if (_affectedUnits isEqualTo []) exitWith {};
|
|
||||||
|
|
||||||
private _bodyParts = [];
|
private _bodyParts = [];
|
||||||
private _stabCount = 0;
|
private _stabCount = 0;
|
||||||
|
|
||||||
@ -49,4 +44,4 @@ switch (typeOf _trap select [0, 16]) do {
|
|||||||
for "_i" from 0 to _stabCount do {
|
for "_i" from 0 to _stabCount do {
|
||||||
[_x, random [1, 2, 3], selectRandom _bodyParts, "stab", _instigator] call EFUNC(medical,addDamageToUnit);
|
[_x, random [1, 2, 3], selectRandom _bodyParts, "stab", _instigator] call EFUNC(medical,addDamageToUnit);
|
||||||
};
|
};
|
||||||
} forEach _affectedUnits;
|
} forEach _affectedUnits select {isDamageAllowed _x}; // isDamageAllowed already does local check
|
||||||
|
@ -0,0 +1,25 @@
|
|||||||
|
#include "script_component.hpp"
|
||||||
|
/*
|
||||||
|
* Author: GhostIsSpooky
|
||||||
|
* Handler for 'detonation' of a local punji trap. Workaround for local-only ammo hit event.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Punji trap <OBJECT>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [trap] call ace_compat_sog_fnc_handlePunjiTrapTrigger
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
params ["_trap"];
|
||||||
|
if (!(["ACE_Medical"] call EFUNC(common,isModLoaded))) exitWith {};
|
||||||
|
|
||||||
|
private _radius = getNumber (configOf _trap >> "indirectHitRange");
|
||||||
|
private _affectedUnits = (_trap nearEntities ["CAManBase", _radius]);
|
||||||
|
|
||||||
|
if (_affectedUnits isEqualTo []) exitWith {};
|
||||||
|
|
||||||
|
[QGVAR(handlePunjiTrapDamage), [_trap, _affectedUnits], _affectedUnits] call CBA_fnc_targetEvent;
|
Loading…
Reference in New Issue
Block a user