Browse Source

Add events to all vic types

m3ales 3 years ago
parent
commit
5fe2fdd875

+ 18 - 1
addons - Copy/RD501_Main/XEH_postinit.sqf

@@ -153,4 +153,21 @@ if(hasInterface) then {
 
 ["rd501_shield_normalHealth", {
 	_this call rd501_fnc_shield_onNormalHealth;
-}] call CBA_fnc_addEventHandler;
+}] call CBA_fnc_addEventHandler;
+
+// Vehicle EMP
+["Car", "HitPart", {
+	_this call rd501_fnc_emp_hitHandler;
+}] call CBA_fnc_addClassEventHandler;
+
+["Tank", "HitPart", {
+	_this call rd501_fnc_emp_hitHandler;
+}] call CBA_fnc_addClassEventHandler;
+
+["Ship", "HitPart", {
+	_this call rd501_fnc_emp_hitHandler;
+}] call CBA_fnc_addClassEventHandler;
+
+["Air", "HitPart", {
+	_this call rd501_fnc_emp_hitHandler;
+}] call CBA_fnc_addClassEventHandler;

+ 5 - 0
addons - Copy/RD501_Main/functions/emp_vehicle/fnc_emp_hitHandler.sqf

@@ -0,0 +1,5 @@
+(_this select 0) params ["_target", "_shooter", "_projectile", "_position", "_velocity", "_selection", "_ammo", "_vector", "_radius", "_surfaceType", "_isDirect"];
+
+if(_target isEqualTo objNull) exitWith { systemChat "Target is null idk why, hi random citizen <3"; }; 
+
+[_ammo, _target] call rd501_fnc_emp_hitVehicle;

+ 1 - 1
addons - Copy/RD501_Main/functions/emp_vehicle/fnc_emp_hitVehicle.sqf

@@ -19,7 +19,7 @@ if(isNumber (_config >> "rd501_emp_vehicle_resistance_percent")) then {
 	_empResistancePercent = _empResistancePercent max 100;
 };
 
-private _effectiveDuration = _empDuration * (1 + ((- _empResistancePercent)/100));
+private _effectiveDuration = _empDuration * (1 + ((-_empResistancePercent)/100));
 
 if(_effectiveDuration <= 1) exitWith { diag_log "[RD501][Vehicle EMP] Effective EMP Duration too low, not worth setting. Skipped." };