Browse Source

More logging, fix emp, make it work on all or something

m3ales 3 years ago
parent
commit
d2c1464070

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

@@ -156,18 +156,6 @@ if(hasInterface) then {
 }] call CBA_fnc_addEventHandler;
 
 // Vehicle EMP
-["Car", "HitPart", {
+["All", "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;

+ 2 - 1
addons - Copy/RD501_Main/functions/emp_vehicle/fnc_emp_disableVehicle.sqf

@@ -1,6 +1,7 @@
 params["_vehicle"];
 
 if!(local _vehicle) exitWith { };
+diag_log format["[RD501][Vehicle EMP] Disabling Vehicle '%1'", _vehicle];
 
 _vehicle allowCrewInImmobile true;
 _vehicle lock 2;
@@ -14,7 +15,7 @@ _vehicle lock 2;
 	_x disableAI "FSM";
 } forEach crew _vehicle;
 
-(getAllHitPointsDamage _vehicle) params [["_allHitPoints", []], ["", []], ["", []]];
+(getAllHitPointsDamage _vehicle) params [["_allHitPoints", []]];
 
 {
 	private _isEngineLower = (_x find "engine") != -1;

+ 2 - 1
addons - Copy/RD501_Main/functions/emp_vehicle/fnc_emp_enableVehicle.sqf

@@ -1,6 +1,7 @@
 params["_vehicle"];
 
 if!(local _vehicle) exitWith { };
+diag_log format["[RD501][Vehicle EMP] Enabling Vehicle '%1'", _vehicle];
 
 _vehicle allowCrewInImmobile false;
 _vehicle lock 0;
@@ -14,7 +15,7 @@ _vehicle lock 0;
 	_x enableAI "FSM";
 } forEach crew _vehicle;
 
-(getAllHitPointsDamage _vehicle) params [["_allHitPoints", []], ["_allHitPointsSelections", []], ["_allHitPointDamages", []]];
+(getAllHitPointsDamage _vehicle) params [["_allHitPoints", []]];
 
 {
 	private _isEngineLower = (_x find "engine") != -1;

+ 2 - 2
addons - Copy/RD501_Main/functions/emp_vehicle/fnc_emp_hitHandler.sqf

@@ -1,5 +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;
+private _ammoClass = _ammo select 4;
+[_ammoClass, _target] call rd501_fnc_emp_hitVehicle;

+ 7 - 3
addons - Copy/RD501_Main/functions/emp_vehicle/fnc_emp_hitVehicle.sqf

@@ -2,11 +2,13 @@ params["_ammo", "_vehicle"];
 
 private _config = configFile >> "CfgAmmo" >> _ammo;
 
-private _empEnabled = 10;
-if(isNumber (_config >> "rd501_emp_vehicle_duration")) then {
-	_empEnabled = getNumber (_config >> "rd501_emp_vehicle_duration");
+private _empEnabled = 0;
+if(isNumber (_config >> "rd501_emp_vehicle_enabled")) then {
+	_empEnabled = getNumber (_config >> "rd501_emp_vehicle_enabled");
 };
 
+if(_empEnabled != 1) exitWith { };
+
 private _empDuration = 10;
 if(isNumber (_config >> "rd501_emp_vehicle_duration")) then {
 	_empDuration = getNumber (_config >> "rd501_emp_vehicle_duration");
@@ -20,9 +22,11 @@ if(isNumber (_config >> "rd501_emp_vehicle_resistance_percent")) then {
 };
 
 private _effectiveDuration = _empDuration * (1 + ((-_empResistancePercent)/100));
+diag_log format["[RD501][Vehicle EMP] Effective Duration = %1 seconds", _effectiveDuration];
 
 if(_effectiveDuration <= 1) exitWith { diag_log "[RD501][Vehicle EMP] Effective EMP Duration too low, not worth setting. Skipped." };
 
+diag_log format["[RD501][Vehicle EMP] Enabling %1", _vehicle];
 [_vehicle] call rd501_fnc_emp_disableVehicle;
 [
 	{

+ 2 - 1
addons - Copy/RD501_Main/functions/fired_deployable/fnc_fired_deployable_firedHandler.sqf

@@ -44,4 +44,5 @@ if (_deployable == 1) then {
 			] call CBA_fnc_waitAndExecute;
 		}
 	] call CBA_fnc_waitUntilAndExecute;
-};
+};
+