Quellcode durchsuchen

move to copied scripts

Florian Steinschorn vor 3 Jahren
Ursprung
Commit
87ecff7689

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

@@ -0,0 +1,40 @@
+#include "../RD501_main/config_macros.hpp"
+
+class CfgPatches
+{
+	class macro_patch_name(emp)
+	{
+		author=DANKAUTHORS;
+		requiredAddons[]=
+		{
+			macro_root_req
+		};
+		requiredVersion=0.1;
+		units[]={};
+		weapons[]={};
+	};
+};
+
+class CfgFunctions
+{
+	class RD501
+	{
+		class Weapons
+		{
+			file="\RD501_EMP";
+			class onHit
+			{
+			};
+			class onHitEMP
+			{
+			};
+		};
+	};
+};
+class Extended_HitPart_EventHandlers
+{
+	class CAManBase
+	{
+		JLTS_weapons_core="if (JLTS_settings_EMP_mainSwitch == 1 || JLTS_settings_Stun_mainSwitch == 1) then {(_this select 0) call RD501_fnc_onHit}";
+	};
+};

+ 28 - 0
addons - Copy/RD501_EMP/fn_onhit.sqf

@@ -0,0 +1,28 @@
+/*
+ * Author: MrClock
+ * HitPart XEH function
+ *
+ *
+ * Arguments:
+ * Inherited from HitPart XEH
+ *
+ * Example:
+ * (_this select 0) call JLTS_fnc_onHit;
+ *
+ * Return Value:
+ * None
+ *
+ */
+
+params["_target", "_shooter", "_projectile", "_position", "_velocity", "_selection", "_ammo", "_vector", "_radius", "_surfaceType", "_isDirect"];
+
+//if (!hasInterface) exitWith {};
+
+if (isNil{_ammo select 4}) exitWith {/*systemChat "Fall damage"*/};
+
+if (!alive _target) exitWith {};
+
+private _ammoUsed = _ammo select 4;
+
+if (getNumber(configFile >> "CfgAmmo" >> _ammoUsed >> "JLTS_isEMPAmmo") == 1) then {[_target,_shooter,_ammoUsed,_projectile] call RD501_fnc_onHitEMP};
+if (getNumber(configFile >> "CfgAmmo" >> _ammoUsed >> "JLTS_isStunAmmo") == 1) then {[_target,_shooter,_ammoUsed] call JLTS_fnc_onHitStun};

+ 165 - 0
addons - Copy/RD501_EMP/fn_onhitemp.sqf

@@ -0,0 +1,165 @@
+/*
+ * Author: MrClock
+ * EMP ammo hit handler
+ *
+ *
+ * Arguments:
+ * 0: Unit <OBJECT>
+ * 1: Unit <OBJECT>
+ * 2: Ammo <STRING>
+ * 3: Projectile <OBJECT>
+ *
+ * Example:
+ * [Bob,Jack,"GrenadeHand",objNull] call JLTS_fnc_onHitEMP;
+ *
+ * Return Value:
+ * None
+ *
+ */
+ 
+#define COOLDOWN 2
+
+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;
+
+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 
+				{
+					private _friedWeapon = getText(configFile >> "CfgWeapons" >> _x >> "JLTS_friedItem");
+					switch (true) do {
+						case (_x in uniformItems _target): {
+							_target removeItemFromUniform _x;
+							_target addItemToUniform _friedWeapon;
+						};
+						case (_x in vestItems _target): {
+							_target removeItemFromVest _x;
+							_target addItemToVest _friedWeapon;
+						};
+						case (_x in backpackItems _target): {
+							_target removeItemFromBackpack _x;
+							_target addItemToBackpack _friedWeapon;
+						};
+						default {
+							switch (true) do {
+								case (_x in weapons _target): {
+									[_x,_target,"FRY"] call JLTS_fnc_weaponEMPEffect;
+								};
+								default {};
+							};
+						};
+					};
+				};
+			};
+		} forEach _weaponsTarget;
+
+		if (JLTS_settings_EMP_EMPEffectScope > 1) then {
+			{
+				if (getNumber(configFile >> "CfgMagazines" >> _x >> "JLTS_hasElectronics") == 1 && getNumber(configFile >> "CfgMagazines" >> _x >> "JLTS_hasEMPProtection") != 1) then {
+					_target removeMagazines _x;
+				};
+			} forEach magazines _target;
+		};
+		
+		if (JLTS_settings_EMP_EMPEffectScope > 2) then {
+			{
+				if (getNumber(configFile >> "CfgWeapons" >> _x >> "JLTS_hasElectronics") == 1 && getNumber(configFile >> "CfgWeapons" >> _x >> "JLTS_hasEMPProtection") != 1) then {
+					_target unassignItem _x;
+				};
+			} forEach assignedItems _target;
+			{
+				if (getNumber(configFile >> "CfgWeapons" >> _x >> "JLTS_hasElectronics") == 1 && getNumber(configFile >> "CfgWeapons" >> _x >> "JLTS_hasEMPProtection") != 1) then {
+					_target removeItem _x;
+				};
+			} forEach items _target;
+		};
+	};
+	
+	playSound3D[
+		selectRandom [
+			"MRC\JLTS\weapons\Core\sounds\fried_weapon\1.wss",
+			"MRC\JLTS\weapons\Core\sounds\fried_weapon\2.wss",
+			"MRC\JLTS\weapons\Core\sounds\fried_weapon\3.wss",
+			"MRC\JLTS\weapons\Core\sounds\fried_weapon\4.wss",
+			"MRC\JLTS\weapons\Core\sounds\fried_weapon\5.wss"
+		],
+		_target,
+		false,
+		getPosASL _target,
+		5,
+		1,
+		0
+	];
+	
+	_target setVariable["JLTS_EMPCooldown",CBA_missionTime + COOLDOWN,true];
+	
+	private _uniform = uniform _target;
+	private _isDroid = getNumber(configFile >> "CfgWeapons" >> _uniform >> "JLTS_isDroid");
+	private _affectedUniforms = missionNamespace getVariable["JLTS_emp_affectedUniforms",[]];
+	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 {
+		if ((_isDroid == 1 || _uniform in _affectedUniforms) && {!(_uniform in _protectedUniforms)} && {alive _target}) then {
+			_toFry = true;
+		};
+	} else {
+		if (_uniform in _affectedUniforms && {alive _target}) then {
+			_toFry = true;
+		};
+	};
+
+	if (_toFry) then {
+		
+		[_target] spawn {
+			private _timeOfHit = CBA_missionTime;
+			private _useDefaultSounds = missionNamespace getVariable["JLTS_emp_useDefaultSounds",true];
+
+			
+			params ["_target"];
+			private _uniform = uniform _target;
+			_target stop true;
+
+			waitUntil {_timeOfHit + 1 < CBA_missionTime};
+			_target disableAI "all";
+			[_target,"DROID"] remoteExec ["JLTS_fnc_showHintEMP",0,true];
+			private _delay = _timeOfHit + random[1,5,10];
+			waitUntil {_delay < CBA_missionTime};
+			
+			if (getText(configFile >> "CfgWeapons" >> _uniform >> "JLTS_deathSounds") != "") then {
+				private _deathSoundClass = getText(configFile >> "CfgWeapons" >> _uniform >> "JLTS_deathSounds");
+				private _friedSound = selectRandom getArray(configFile >> "CfgJLTSDeathSounds" >> _deathSoundClass >> "emp");
+				playSound3D[_friedSound,_target,false,getPosASL _target,2,1,0];
+			} else {
+				if (_useDefaultSounds) then {
+					private _friedSound = selectRandom getArray(configFile >> "CfgJLTSDeathSounds" >> "DeathDroid" >> "emp");
+					playSound3D[_friedSound,_target,false,getPosASL _target,2,1,0];
+				};
+			};
+			
+
+			if (alive _target) then {
+				_target setDamage 1;
+			};
+			
+			_target setVariable ["JLTS_EMPCooldown",nil, true];
+		};
+	} else {
+		[_target,"HUMAN"] remoteExec ["JLTS_fnc_showHintEMP",0,true];
+	};
+} else {
+	//systemChat "EMP cooldown"
+};

+ 1 - 1
addons - Copy/RD501_Main/config_macros.hpp

@@ -77,9 +77,9 @@
 	#define macro_patch_name(component) MODNAME##_patch_##component
 	#define macro_A3_patch "A3_Data_F_Tank_Loadorder"
 	#define macro_root_req macro_patch_name(main)
-	#define macro_lvl1_req macro_patch_name(particle_effects),RD501_patch_Airborne_Helmet_Model,RD501_patch_VenatorMK2
 	#define macro_lvl2_req macro_patch_name(weapons),macro_patch_name(jumppack),macro_patch_name(helmets),macro_patch_name(vehicle_weapons)
 	#define macro_lvl3_req macro_patch_name(units),macro_patch_name(vehicles),macro_patch_name(zeus)
+	#define macro_lvl1_req macro_patch_name(particle_effects),RD501_patch_Airborne_Helmet_Model,RD501_patch_VenatorMK2,macro_patch_name(emp)
 	#define macro_lvl4_req macro_patch_name(droids_config),macro_patch_name(laat_variants)
 	#define macro_lvl5_req macro_patch_name(legacy_classnames)
 	#define macro_end_patches macro_lvl5_req

+ 27 - 0
addons - Copy/RD501_Vehicles/land/camonet_changer.hpp

@@ -0,0 +1,27 @@
+#define macro_camonet_changer(texture_index) class ACE_SelfActions;\
+class ACE_SelfActions: ACE_SelfActions\
+{\
+	class RD501_Camonet_Changer\
+		{\
+		displayName="Change Camonet";\
+		exceptions[]={"isNotInside","isNotSwimming","isNotSitting"};\
+		condition="!(isNull objectParent player) && (driver (vehicle player)==player)";\
+		showDisabled=0;\
+		priority=2;\
+		class RD501_Camonet_desert\
+		{\
+			displayName="Desert";\
+			exceptions[]={"isNotInside","isNotSwimming","isNotSitting"};\
+			condition="!(isNull objectParent player)";\
+			statement="_target setObjectTextureGlobal [" texture_index ",'a3\Armor_F\Data\camonet_NATO_Desert_CO.paa']";\
+			showDisabled=0;\
+			runOnHover=1;\
+			priority=2.5;\
+		};\
+		class RD501_Camonet_green: RD501_Camonet_desert\
+		{\
+			displayName="Green";\
+			statement="_target setObjectTextureGlobal [" texture_index ", 'A3\Armor_F\Data\camonet_AAF_Digi_Green_CO.paa']";\
+		};\
+	};\
+};