mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
a687c49d2a
* Interconnects the rangecard and scopes modules * Hides the zeroing text when the vanilla zeroing is overwritten * Makes the scopes module fully compatible with any 3rd party weapon pack without the need for addition compat pbos (though their use is still recommended)
52 lines
1.5 KiB
Plaintext
52 lines
1.5 KiB
Plaintext
/*
|
|
* Authors: Ruthberg
|
|
* Updates the ammo and weapon class names
|
|
*
|
|
* Arguments:
|
|
* unit <OBJECT>
|
|
*
|
|
* Return Value:
|
|
* Update successful? <BOOLEAN>
|
|
*
|
|
* Example:
|
|
* unit call ace_rangecard_fnc_updateClassNames
|
|
*
|
|
* Public: No
|
|
*/
|
|
#include "script_component.hpp"
|
|
|
|
private ["_unit", "_ammoClass", "_magazineClass", "_weaponClass", "_ammo", "_ammoConfig", "_parentClasses"];
|
|
_unit = _this;
|
|
|
|
_ammoClass = "";
|
|
_magazineClass = "";
|
|
_weaponClass = primaryWeapon _unit;
|
|
|
|
if (_weaponClass == "") exitWith { (GVAR(ammoClass) != "" && GVAR(magazineClass) != "" && GVAR(weaponClass) != "") };
|
|
|
|
{
|
|
_ammo = getText (configFile >> "CfgMagazines" >> _x >> "ammo");
|
|
_ammoConfig = (configFile >> "CfgAmmo" >> _ammo);
|
|
_parentClasses = [_ammoConfig, true] call BIS_fnc_returnParents;
|
|
if ("BulletBase" in _parentClasses) exitWith {
|
|
_ammoClass = _ammo;
|
|
_magazineClass = _x;
|
|
};
|
|
} forEach (primaryWeaponMagazine _unit);
|
|
|
|
if (_ammoClass == "") exitWith { (GVAR(ammoClass) != "" && GVAR(magazineClass) != "" && GVAR(weaponClass) != "") };
|
|
|
|
if (_unit == ACE_player) then {
|
|
GVAR(zeroRange) = [_unit] call EFUNC(scopes,getCurrentZeroRange);
|
|
GVAR(ammoClass) = _ammoClass;
|
|
GVAR(magazineClass) = _magazineClass;
|
|
GVAR(weaponClass) = _weaponClass;
|
|
} else {
|
|
GVAR(zeroRangeCopy) = [_unit] call EFUNC(scopes,getCurrentZeroRange);
|
|
GVAR(ammoClassCopy) = _ammoClass;
|
|
GVAR(magazineClassCopy) = _magazineClass;
|
|
GVAR(weaponClassCopy) = _weaponClass;
|
|
};
|
|
|
|
true
|