Browse Source

Add personal shield

m3ales 4 years ago
parent
commit
6c4ef2c845

+ 3 - 0
addons - Copy/RD501_Main/XEH_postinit.sqf

@@ -90,6 +90,9 @@ if(isServer) then {
 	["rd501_fired_deployable_deployServer", {
 		_this call rd501_fnc_fired_deployable_deployServer
 	}] call CBA_fnc_addEventHandler;
+	["rd501_fired_deployable_personalShieldDeployServer", {
+		_this call rd501_fnc_fired_deployable_personalShieldDeployServer
+	}] call CBA_fnc_addEventHandler;
 };
 
 if(hasInterface) then {

+ 1 - 0
addons - Copy/RD501_Main/XEH_preInit.sqf

@@ -154,6 +154,7 @@ macro_prep_xeh(fired_deployable\fnc_fired_deployable_firedHandler.sqf,fired_depl
 macro_prep_xeh(fired_deployable\fnc_fired_deployable_deployServer.sqf,fired_deployable_deployServer)
 macro_prep_xeh(fired_deployable\fnc_fired_deployable_loopSoundLocal.sqf,fired_deployable_loopSoundLocal)
 macro_prep_xeh(fired_deployable\fnc_fired_deployable_endSoundLocal.sqf,fired_deployable_endSoundLocal)
+macro_prep_xeh(fired_deployable\fnc_fired_deployable_personalShieldDeployServer.sqf,fired_deployable_personalShieldDeployServer)
 
 // Droideka Shield
 macro_prep_xeh(init\deka_shield_init.sqf,deka_shield_init)

+ 5 - 0
addons - Copy/RD501_Main/functions/fired_deployable/fnc_fired_deployable_firedHandler.sqf

@@ -7,9 +7,14 @@ if (isNull _projectile) then {
 };
 private _config = configFile >> "CfgAmmo" >> _ammo;
 private _deployable = getNumber (_config >> "rd501_fired_deployable");
+private _personal = getNumber (_config >> "rd501_fired_deployable_personal");
 private _direction = direction _unit;
 
 if (_deployable == 1) then {
+	if(_personal == 1) exitWith {
+		["rd501_fired_deployable_personalShieldDeployServer", [_unit, _ammo]] call CBA_fnc_serverEvent;
+		deleteVehicle _projectile;
+	};
 	[
 		{
 			params["_projectile"];

+ 29 - 0
addons - Copy/RD501_Main/functions/fired_deployable/fnc_fired_deployable_personalShieldDeployServer.sqf

@@ -0,0 +1,29 @@
+params["_unit", "_ammo"];
+
+// TODO: Merge with fired_deployable_deployServer
+
+private _config = configFile >> "CfgAmmo" >> _ammo; 
+if!(isClass _config) exitWith {
+	diag_log format["Unable to find class '%1' in CfgAmmo", _ammo]; 
+};
+
+private _isValid = getNumber (_config >> "rd501_fired_deployable") == 1;
+private _deployable = getText (_config >> "rd501_fired_deployable_object");
+private _timeToLive = getNumber (_config >> "rd501_fired_deployable_timeToLive");
+private _offset = getArray (_config >> "rd501_fired_deployable_personal_offset");
+private _bone = getText (_config >> "rd501_fired_deployable_personal_bone");
+
+private _deployed = createVehicle [_deployable, [0, 0, 0], [], 0, "CAN_COLLIDE"];
+_deployed attachTo [_unit, _offset, _bone, false];
+
+if(_timeToLive > 0) then {
+	[
+		{
+			params["_deployable"];
+			detach _deployable;
+			deleteVehicle _deployable;
+		},
+		[_deployed],
+		_timeToLive
+	] call CBA_fnc_waitAndExecute;
+};

+ 26 - 1
addons - Copy/RD501_Vehicles/static/shields/config.cpp

@@ -20,7 +20,8 @@ class CfgPatches
 		{
 			"RD501_Squad_Shield",
 			"RD501_Squad_Shield_trench",
-			"RD501_Droideka_Shield"
+			"RD501_Droideka_Shield",
+			"RD501_Personal_Shield"
 		};
 		weapons[]=
 		{
@@ -106,6 +107,30 @@ class CfgVehicles
 		editorCategory =  macro_editor_cat(statics)
 		editorSubcategory = macro_editor_cat(static_msc)
 	};
+	
+	class RD501_Personal_Shield: Land_House_Small_03_V1_ruins_F
+	{
+		author="$STR_A3_Bohemia_Interactive";
+		mapSize=21.1;
+		class SimpleObject
+		{
+			eden=0;
+			animate[]={};
+			hide[]={};
+			verticalOffset=-0.023;
+			verticalOffsetWorld=0;
+			init="''";
+		};
+		editorPreview="\A3\EditorPreviews_F\Data\CfgVehicles\Land_House_Small_03_V1_ruins_F.jpg";
+		scope=2;
+		scopeCurator=2;
+		displayName="Trench Shield";
+		model="\RD501_Vehicles\static\shields\personal\personal_shield.p3d";
+		icon="iconObject_1x1";
+		vehicleClass = macro_editor_vehicle_type(statics)
+		editorCategory =  macro_editor_cat(statics)
+		editorSubcategory = macro_editor_cat(static_msc)
+	};
 };
 class CfgSounds
 {

BIN
addons - Copy/RD501_Vehicles/static/shields/personal/personal_shield.p3d


BIN
addons - Copy/RD501_Vehicles/static/shields/personal/personal_shield.paa


+ 5 - 1
addons - Copy/RD501_Weapons/Grenades/config.cpp

@@ -98,7 +98,7 @@ class CfgWeapons
 	};
 	class Throw: GrenadeLauncher
 	{
-		muzzles[] += {"Shadow_Muzzle","Imploder_Muzzle","Thermaldet_Muzzle","Squad_Shield_Muzzle","Squad_Shield_Trench_Muzzle","Throwable_C_Type_Muzzle"};
+		muzzles[] += {"Shadow_Muzzle","Imploder_Muzzle","Thermaldet_Muzzle","Squad_Shield_Muzzle","Squad_Shield_Trench_Muzzle","Personal_Shield_Muzzle", "Throwable_C_Type_Muzzle"};
 		class Shadow_Muzzle: ThrowMuzzle
 		{
 			magazines[] = {"RD501_BlueShadow_Grenade"};
@@ -119,6 +119,10 @@ class CfgWeapons
 		{
 			magazines[] = {macro_new_mag(squad_shield_alpha,1)};
 		};
+		class Personal_Shield_Muzzle: ThrowMuzzle
+		{
+			magazines[] = {macro_new_mag(personal_shield,1)};
+		};
 		class Throwable_C_Type_Muzzle: ThrowMuzzle
 		{
 			magazines[] = {macro_new_mag(throwable_c_type,1)};

+ 15 - 2
addons - Copy/RD501_Weapons/_ammo/config.cpp

@@ -316,6 +316,20 @@ class CfgAmmo
         rd501_fired_deployable_timeToLive = 120;
 		simulation="shotShell";
 	}
+	class macro_new_ammo(personal_shield) : 3AS_CoreDetonator_1RND
+	{
+		hit=0;
+		indirectHit=0;
+		indirectHitRange=0;
+		model="\RD501_Weapons\Grenades\data\icecream.p3d";
+		rd501_fired_deployable = 1;
+        rd501_fired_deployable_object = "RD501_Personal_Shield";
+        rd501_fired_deployable_timeToLive = 120;
+        rd501_fired_deployable_personal = 1;
+        rd501_fired_deployable_personal_offset[] = {0.1, 0.9, 0.4};
+        rd501_fired_deployable_personal_bone = "pelvis";
+		simulation="shotShell";
+	}
 ///////////////////////////////////////////////////////////////////////
 /////////////////////////Shotgun///////////////////////////////////////
 //////////////////////////////////////////////////////////////////////
@@ -490,5 +504,4 @@ class CfgAmmo
 		indirectHit=8;
 		indirectHitRange=8;
 	};
-};
-	
+};

+ 11 - 0
addons - Copy/RD501_Weapons/_mag/config.cpp

@@ -381,6 +381,17 @@ class CfgMagazines
 		descriptionShort = "Republic Thermal Imploder";
 		picture="\RD501_Weapons\_mag\data\rd501_icon_mag_imploder.paa";
 	};
+	class macro_new_mag(personal_shield,1):3AS_BaridumCore
+	{
+		author="RD501";
+		scope=2;
+		displayName = "Republic Personal Shield";
+		displayNameShort = "Personal Shield";
+		count=1;
+		ammo = macro_new_ammo(personal_shield)
+		descriptionShort = "Personal Shield";
+		picture="\RD501_Weapons\_mag\data\rd501_icon_mag_imploder.paa";
+	};
 
 	////////////////////////////////////////////////////
 	/////////////Missile  Magazines/////////////////////