mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #4063 from acemod/gunbag-assault-rifles-cherry-pick
enable gunbag for all non-machinegun primary weapons
This commit is contained in:
commit
17f848fba9
@ -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;
|
||||
};
|
||||
};
|
@ -7,3 +7,4 @@ PREP(status);
|
||||
PREP(canInteract);
|
||||
PREP(calculateMass);
|
||||
PREP(hasGunbag);
|
||||
PREP(isMachineGun);
|
||||
|
@ -16,4 +16,3 @@ class CfgPatches {
|
||||
|
||||
#include "CfgEventHandlers.hpp"
|
||||
#include "CfgVehicles.hpp"
|
||||
#include "CfgWeapons.hpp"
|
||||
|
@ -20,12 +20,13 @@ params ["_unit", "_target"];
|
||||
|
||||
private _result = -1;
|
||||
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;
|
||||
};
|
||||
|
||||
if (!((_gunbag getVariable [QGVAR(gunbagWeapon), []]) isEqualTo []) && {primaryWeapon _unit == ""}) then {
|
||||
if (!((_gunbag getVariable [QGVAR(gunbagWeapon), []]) isEqualTo []) && {_weapon == ""}) then {
|
||||
_result = 1;
|
||||
};
|
||||
|
||||
|
29
addons/gunbag/functions/fnc_isMachineGun.sqf
Normal file
29
addons/gunbag/functions/fnc_isMachineGun.sqf
Normal 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"
|
Loading…
Reference in New Issue
Block a user