Merge pull request #4063 from acemod/gunbag-assault-rifles-cherry-pick

enable gunbag for all non-machinegun primary weapons
This commit is contained in:
commy2 2016-07-11 17:40:53 +02:00 committed by GitHub
commit 17f848fba9
5 changed files with 33 additions and 44 deletions

View File

@ -1,41 +0,0 @@
class CfgWeapons {
class Rifle_Long_Base_F;
/* Long Rifles */
class GM6_base_F: Rifle_Long_Base_F {
GVAR(allowGunbag) = 1;
};
class LRR_base_F: Rifle_Long_Base_F {
GVAR(allowGunbag) = 1;
};
class DMR_06_base_F: Rifle_Long_Base_F {
GVAR(allowGunbag) = 1;
};
class DMR_05_base_F: Rifle_Long_Base_F {
GVAR(allowGunbag) = 1;
};
class DMR_04_base_F: Rifle_Long_Base_F {
GVAR(allowGunbag) = 1;
};
class DMR_03_base_F: Rifle_Long_Base_F {
GVAR(allowGunbag) = 1;
};
class DMR_02_base_F: Rifle_Long_Base_F {
GVAR(allowGunbag) = 1;
};
class DMR_01_base_F: Rifle_Long_Base_F {
GVAR(allowGunbag) = 1;
};
class EBR_base_F: Rifle_Long_Base_F {
GVAR(allowGunbag) = 1;
};
};

View File

@ -7,3 +7,4 @@ PREP(status);
PREP(canInteract); PREP(canInteract);
PREP(calculateMass); PREP(calculateMass);
PREP(hasGunbag); PREP(hasGunbag);
PREP(isMachineGun);

View File

@ -16,4 +16,3 @@ class CfgPatches {
#include "CfgEventHandlers.hpp" #include "CfgEventHandlers.hpp"
#include "CfgVehicles.hpp" #include "CfgVehicles.hpp"
#include "CfgWeapons.hpp"

View File

@ -20,12 +20,13 @@ params ["_unit", "_target"];
private _result = -1; private _result = -1;
private _gunbag = backpackContainer _target; private _gunbag = backpackContainer _target;
private _weapon = primaryWeapon _unit;
if ((_gunbag getVariable [QGVAR(gunbagWeapon), []]) isEqualTo [] && {primaryWeapon _unit != ""} && {getNumber (configFile >> "CfgWeapons" >> primaryWeapon _unit >> QGVAR(allowGunbag)) == 1}) then { if ((_gunbag getVariable [QGVAR(gunbagWeapon), []]) isEqualTo [] && {_weapon != ""} && {!(_weapon call FUNC(isMachineGun))}) then {
_result = 0; _result = 0;
}; };
if (!((_gunbag getVariable [QGVAR(gunbagWeapon), []]) isEqualTo []) && {primaryWeapon _unit == ""}) then { if (!((_gunbag getVariable [QGVAR(gunbagWeapon), []]) isEqualTo []) && {_weapon == ""}) then {
_result = 1; _result = 1;
}; };

View File

@ -0,0 +1,29 @@
/*
* Author: commy2
* Reports true if a weapon is a machine gun.
*
* Arguments:
* 0: Weapon class name <STRING>
*
* Return Value:
* Is machine gun <BOOL>
*
* Example:
* (currentWeapon player) call ace_gunbag_fnc_isMachineGun
*
* Public: No
*/
#include "script_component.hpp"
params ["_weapon"];
private _config = _weapon call CBA_fnc_getItemConfig;
// definition of a machine gun by BIS_fnc_itemType
private _cursor = getText (_config >> "cursor");
if (toLower _cursor in ["", "emptycursor"]) then {
_cursor = getText (_config >> "cursorAim");
};
_cursor == "MG"