2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2016-08-27 08:21:15 +00:00
|
|
|
/*
|
|
|
|
* Author: Grey-Soldierman
|
|
|
|
* Return true if player can swap barrel
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Player <OBJECT>
|
|
|
|
* 1: Weapon <STRING>
|
2017-06-08 13:31:51 +00:00
|
|
|
*
|
2016-08-27 08:21:15 +00:00
|
|
|
* Return Value:
|
2017-06-08 13:31:51 +00:00
|
|
|
* Bool <BOOL>
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [bob, "weapon"] call ace_overheating_fnc_canSwapBarrel
|
2016-08-27 08:21:15 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
2016-09-04 14:44:22 +00:00
|
|
|
params ["_unit","_weapon"];
|
2016-08-27 08:21:15 +00:00
|
|
|
|
|
|
|
//Check if weapon can have its barrel swapped. If not exit out of function
|
2021-10-14 15:47:52 +00:00
|
|
|
if ( !GVAR(enabled) || {getNumber (configFile >> 'CfgWeapons' >> _weapon >> QGVAR(allowSwapBarrel)) != 1}) exitWith{false};
|
2016-08-27 08:21:15 +00:00
|
|
|
|
|
|
|
//Get the classname of the spare barrel for the weapon
|
|
|
|
private _weaponBarrelClass = getText (configFile >> 'CfgWeapons' >> _weapon >> QGVAR(barrelClassname));
|
|
|
|
//If the weapon has no defined classname then use the ACE one
|
2021-10-14 15:47:52 +00:00
|
|
|
if (_weaponBarrelClass == "") then {
|
2016-08-27 08:21:15 +00:00
|
|
|
_weaponBarrelClass = "ACE_SpareBarrel";
|
|
|
|
};
|
|
|
|
//If the player has the spare barrel then it can be swapped
|
2017-06-08 13:31:51 +00:00
|
|
|
(_weaponBarrelClass in magazines _unit)
|