Parcourir la source

Merge branch 'fix-restricitons-z1000' of https://github.com/Zatama/Aux-Mod-501st into fix-restricitons-z1000

# Conflicts:
#	addons - Copy/RD501_Weapons/Z6/config.cpp
Erliens il y a 4 ans
Parent
commit
d8e470ddb1

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

@@ -93,4 +93,6 @@ macro_prep_xeh(infantry_uav\fnc_refuelUAVDrone.sqf,refuelUAVDrone)
 macro_prep_xeh(infantry_uav\fnc_canRefuel.sqf,canRefuel)
 
 macro_prep_xeh(heavy_weapon\fnc_heavyWeaponHandlePlayerWeaponChanged.sqf,heavyWeaponHandlePlayerWeaponChanged)
-macro_prep_xeh(reload_on_select\fnc_reloadWeaponOnFirstSelected.sqf,reloadWeaponOnFirstSelected)
+macro_prep_xeh(reload_on_select\fnc_reloadWeaponOnFirstSelected.sqf,reloadWeaponOnFirstSelected)
+macro_prep_xeh(reload_on_select\fnc_swapToEmptyWeapon.sqf,swapToEmptyWeapon)
+macro_prep_xeh(reload_on_select\fnc_onWeaponFiredSwapToEmpty.sqf,onWeaponFiredSwapToEmpty)

+ 8 - 0
addons - Copy/RD501_Main/functions/reload_on_select/fnc_onWeaponFiredSwapToEmpty.sqf

@@ -0,0 +1,8 @@
+#include "../../config_macros.hpp"
+params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo"];
+if(_unit ammo _muzzle > 0) exitWith
+{
+	systemChat format["fired skipped for %1", _muzzle];
+};
+systemChat format["Mag %1",_magazine];
+[_unit, _weapon] call macro_fnc_name(swapToEmptyWeapon);

+ 2 - 2
addons - Copy/RD501_Main/functions/reload_on_select/fnc_reloadWeaponOnFirstSelected.sqf

@@ -5,10 +5,10 @@ if(_weapon in RD501_AUTO_RELOAD_ON_EQUIP) then
 	systemChat "Weapon in list";
 	if(count (secondaryWeaponMagazine _unit) == 0) then {
 		systemChat "Weapon in list";
-		_magazineName = "rd501_z1000_x3000_mag";
+		_magazineName = getArray(configFile >> "CfgWeapons" >> currentWeapon _unit >> "magazines") select 0; // TODO: Cache in postInit
 		systemChat format["AutoReloading with %1", _magazineName]; 
 		_unit removeMagazines _magazineName;
-		_unit addMagazine _magazineName; 
+		_unit addMagazine _magazineName;
 		_unit removeSecondaryWeaponItem _magazineName;
 	};
 };

+ 4 - 0
addons - Copy/RD501_Main/functions/reload_on_select/fnc_swapToEmptyWeapon.sqf

@@ -0,0 +1,4 @@
+params["_unit", "_weapon"];
+ 
+_unit removeWeaponGlobal _weapon;
+_unit addWeaponGlobal getText(configFile >> "CfgWeapons" >> _weapon >> "RD501_Empty_Weapon"); // TODO: Cache during postInit

+ 5 - 3
addons - Copy/RD501_Weapons/Z6/config.cpp

@@ -146,19 +146,21 @@ class cfgWeapons
         scopeArsenal=2;
 		recoil="recoil_mmg_01";
         displayName="Republic Z1000 Chaingun";
-		picture = "\RD501_Weapons\Z6\chaingun_icon.paa";
+		RD501_Empty_Weapon = macro_quote(macro_new_weapon_nofam(z1000u));
 		magazines[]=
 		{
 			macro_new_mag(z1000,3000)
 		};
+		class EventHandlers {
+			fired = macro_quote(_this call macro_fnc_name(onWeaponFiredSwapToEmpty));
+		};
     };
 	class macro_new_weapon_nofam(z1000u): 3AS_Chaingun
     {
         scope=1;
         scopeArsenal=1;
-        displayName="Z1000 Chaingun(Used)";
+        displayName="Z1000 Chaingun (Used)";
         _generalMacro="launch_RPG32_F";
-		picture = "\RD501_Weapons\Z6\chaingun_icon.paa";
 		magazines[]=
 		{
 			"none"