Browse Source

jam weapons on emp
adjust hint to jam
add readme

Florian Steinschorn 3 years ago
parent
commit
87911855c4

BIN
@501st Community Auxiliary Mod/addons/VenMK2.pbo.RD501_Aux_Mod.bisign


+ 29 - 0
addons - Copy/RD501_EMP/config.cpp

@@ -28,6 +28,9 @@ class CfgFunctions
 			class onHitEMP
 			{
 			};
+			class showHintEMP
+			{
+			};
 		};
 	};
 };
@@ -37,4 +40,30 @@ class Extended_HitPart_EventHandlers
 	{
 		JLTS_weapons_core="if (JLTS_settings_EMP_mainSwitch == 1 || JLTS_settings_Stun_mainSwitch == 1) then {(_this select 0) call RD501_fnc_onHit}";
 	};
+};
+class CfgHints
+{
+	class RD501_ordnance
+	{
+		displayName="$STR_JLTS_names_HintCatOrdnance";
+		category="JLTS";
+		logicalOrder=2;
+		class EMP
+		{
+			displayName="$STR_JLTS_names_HintEMPEffect";
+			description="$STR_JLTS_descs_HintEMPEffect";
+			tip="$STR_JLTS_tips_HintEMPEffect";
+			arguments[]={};
+			image="\MRC\JLTS\weapons\Core\data\ui\hint_emp_ca.paa";
+			logicalOrder=1;
+			class EMP_sub_fry
+			{
+				displayName="Weapon Jammed";
+				description="You have been struck by EMP which may have damaged the circuits of some of your weapons and inventory items. Use the 'Clear Jam' keybind to fix your weapon.";
+				tip="$STR_JLTS_tips_HintEMPEffect";
+				arguments[]={};
+				image="\MRC\JLTS\weapons\Core\data\ui\hint_emp_fry_ca.paa";
+			};
+		};
+	};
 };

+ 22 - 9
addons - Copy/RD501_EMP/fn_onhitemp.sqf

@@ -24,17 +24,17 @@ params["_target", "_shooter", "_ammo","_projectile"];
 if ((getText(configFile >> "CfgAmmo" >> _ammo >> "simulation") != "shotBullet") && ((_projectile distance _target) > getNumber(configFile >> "CfgAmmo" >> _ammo >> "indirectHitRange"))) exitWith {/*systemChat "Out of range"*/}; 
 
 private _weaponsTarget = weapons _target;
+private _fryOnEMP = false;
 
 if (_target getVariable["JLTS_EMPCooldown",CBA_missionTime - 1] < CBA_missionTime) then {
-	
+
 	if (JLTS_settings_EMP_EMPEffectScope > 0) then {
 		{
-			
 			if (getNumber(configFile >> "CfgWeapons" >> _x >> "JLTS_isFried") == 1) then {} else 
 			{
-				
-				if (getNumber(configFile >> "CfgWeapons" >> _x >> "JLTS_hasElectronics") == 1 && getNumber(configFile >> "CfgWeapons" >> _x >> "JLTS_hasEMPProtection") != 1) then 
-				{
+				if (getNumber(configFile >> "CfgWeapons" >> _x >> "JLTS_hasElectronics") == 1 &&
+				    getNumber(configFile >> "CfgWeapons" >> _x >> "JLTS_hasEMPProtection") != 1 &&
+				    getNumber(configFile >> "CfgWeapons" >> _x >> "RD501_fryOnEMP") != 1) then {
 					private _friedWeapon = getText(configFile >> "CfgWeapons" >> _x >> "JLTS_friedItem");
 					switch (true) do {
 						case (_x in uniformItems _target): {
@@ -58,6 +58,13 @@ if (_target getVariable["JLTS_EMPCooldown",CBA_missionTime - 1] < CBA_missionTim
 							};
 						};
 					};
+					_fryOnEMP = true;
+				} else {
+				    if (getNumber(configFile >> "CfgWeapons" >> _x >> "JLTS_hasEMPProtection") != 1 &&
+                    	getNumber(configFile >> "CfgWeapons" >> _x >> "RD501_fryOnEMP") != 1) then
+                    {
+                        [_target, currentWeapon _target] call ace_overheating_fnc_jamWeapon;
+                    };
 				};
 			};
 		} forEach _weaponsTarget;
@@ -108,8 +115,6 @@ if (_target getVariable["JLTS_EMPCooldown",CBA_missionTime - 1] < CBA_missionTim
 	private _protectedUniforms = missionNamespace getVariable["JLTS_emp_protectedUniforms",[]];
 	private _useConfig = missionNamespace getVariable["JLTS_emp_useConfig",true];
 
-	//if ((_isDroid != 1 || (_uniform in _protectedUniforms)) && !(_uniform in _affectedUniforms)) exitWith {[_target,"HUMAN"] remoteExec ["JLTS_fnc_showHintEMP",0,true];};
-	
 	_toFry = false;
 	
 	if (_useConfig) then {
@@ -135,7 +140,11 @@ if (_target getVariable["JLTS_EMPCooldown",CBA_missionTime - 1] < CBA_missionTim
 
 			waitUntil {_timeOfHit + 1 < CBA_missionTime};
 			_target disableAI "all";
-			[_target,"DROID"] remoteExec ["JLTS_fnc_showHintEMP",0,true];
+            if (_fryOnEMP) then {
+                [_target,"DROID"] remoteExec ["JLTS_fnc_showHintEMP",0,true];
+            } else {
+                [_target,"DROID"] remoteExec ["RD501_fnc_showHintEMP",0,true];
+            };
 			private _delay = _timeOfHit + random[1,5,10];
 			waitUntil {_delay < CBA_missionTime};
 			
@@ -158,7 +167,11 @@ if (_target getVariable["JLTS_EMPCooldown",CBA_missionTime - 1] < CBA_missionTim
 			_target setVariable ["JLTS_EMPCooldown",nil, true];
 		};
 	} else {
-		[_target,"HUMAN"] remoteExec ["JLTS_fnc_showHintEMP",0,true];
+    	if (_fryOnEMP) then {
+		    [_target,"HUMAN"] remoteExec ["JLTS_fnc_showHintEMP",0,true];
+		} else {
+		    [_target,"HUMAN"] remoteExec ["RD501_fnc_showHintEMP",0,true];
+		};
 	};
 } else {
 	//systemChat "EMP cooldown"

+ 52 - 0
addons - Copy/RD501_EMP/fn_showhintemp.sqf

@@ -0,0 +1,52 @@
+/*
+ * Author: MrClock
+ *
+ * Arguments:
+ * 0: Unit <OBJECT>
+ * 1: Type <STRING>
+ *
+ * Example:
+ * [Bob,"HUMAN"] call JLTS_fnc_showHintEMP;
+ *
+ * Return Value:
+ * true - if completed without errors
+ */
+
+if (!hasInterface) exitWith {};
+
+params["_unit","_type"];
+
+private _player = JLTS_playerControlled;
+
+
+if (_unit == _player) then {
+	if (JLTS_settings_EMP_notifyPlayer) then {
+		if (toUpper _type == "DROID") then {
+			[
+				["JLTS_ordnance","EMP","EMP_sub_droid"], 
+				20, 
+				nil, 
+				30, 
+				nil, 
+				true, 
+				true, 
+				false, 
+				true
+			] call BIS_fnc_advHint;
+		} else {
+			if (toUpper _type == "HUMAN" && JLTS_settings_EMP_EMPEffectScope > 0) then {
+				[
+					["RD501_ordnance","EMP","EMP_sub_fry"],
+					20, 
+					nil, 
+					30, 
+					nil, 
+					true, 
+					true, 
+					false, 
+					true
+				] call BIS_fnc_advHint;
+			} else {};
+		};
+	};
+};

+ 18 - 0
addons - Copy/RD501_EMP/readme.md

@@ -0,0 +1,18 @@
+##RD501 EMP adjustments
+
+###Goal
+
+While JLTS' EMP system works great, its weapon swap feature was deemed to taxing on the servers, especially considering the possibility of cluster-EMP that might hit hundreds of units.
+
+To still have EMP effect guns, but avoid the switching, all guns not configured otherwise will jam when hit by EMP.
+
+###Config
+
+Default (no config params): Gun jams on EMP
+
+To go back to JLTS behaviour:
+* JLTS_hasElectronics = 1
+* JLTS_hasEMPProtection = 0
+* **RD501_fryOnEMP = 1**
+
+If RD501_fryOnEMP is not set to 1, the gun will still jam, thus having the desired behaviour on default JLTS guns without having to edit their config.