mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Small cleanup and tweaks
This commit is contained in:
parent
301489bc58
commit
da210890ac
@ -7,16 +7,16 @@ INFO("Checking static weapons");
|
||||
|
||||
private _staticWeaponConfigs = configProperties [configFile >> "CfgVehicles", "(isClass _x) && {(configName _x) isKindOf 'StaticWeapon'}", true];
|
||||
private _staticPublic = _staticWeaponConfigs select {(getNumber (_x >> "scope")) == 2};
|
||||
INFO_2("Static Weapons [%1] - CSW Enabled [%2]",count _staticPublic, {(getNumber (_x >> "ace_csw" >> "enabled")) == 1} count _staticPublic);
|
||||
INFO_2("Static Weapons [%1] - CSW Enabled [%2]",count _staticPublic,{(getNumber (_x >> QUOTE(ADDON) >> "enabled")) == 1} count _staticPublic);
|
||||
|
||||
INFO("------ Checking static weapons inheritance ------");
|
||||
private _explicitBases = [];
|
||||
private _inherited = [];
|
||||
{
|
||||
private _config = _x;
|
||||
private _configEnabled = (getNumber (_config >> "ace_csw" >> "enabled")) == 1;
|
||||
private _configEnabled = (getNumber (_config >> QUOTE(ADDON) >> "enabled")) == 1;
|
||||
if (_configEnabled) then {
|
||||
private _configExplicit = (count configProperties [_config, "configName _x == 'ace_csw'", false]) == 1;
|
||||
private _configExplicit = (count configProperties [_config, toString {configName _x == QUOTE(ADDON)}, false]) == 1;
|
||||
if (_configExplicit) then {
|
||||
_explicitBases pushBack (configName _config);
|
||||
_inherited pushBack [];
|
||||
@ -43,8 +43,8 @@ private _inherited = [];
|
||||
|
||||
INFO("------ Logging static magazines with no carry version -------");
|
||||
private _hash = createHashMap;
|
||||
// private _logAll = true; // logs all possible weapon magazines (even if not used in a static weapon)
|
||||
private _logAll = false;
|
||||
private _logAll = false; // logs all possible weapon magazines (even if not used in a static weapon) when set to true
|
||||
|
||||
{
|
||||
private _vehicleType = configName _x;
|
||||
private _turretConfig = [_vehicleType, [0]] call CBA_fnc_getTurret;
|
||||
@ -69,7 +69,7 @@ private _logAll = false;
|
||||
|
||||
{
|
||||
//IGNORE_PRIVATE_WARNING ["_x", "_y"];
|
||||
INFO_2("[%1] has no carry varient - Used in %2",_x,_y);
|
||||
INFO_2("[%1] has no carry variant - Used in %2",_x,_y);
|
||||
} forEach _hash;
|
||||
|
||||
INFO("------ End -------");
|
||||
|
@ -40,7 +40,7 @@
|
||||
_cswTripod setVariable [QGVAR(secondaryWeaponMagazine), _secondaryWeaponMagazine];
|
||||
};
|
||||
if (!GVAR(defaultAssemblyMode)) then {
|
||||
[_cswTripod, "disableWeaponAssembly", "ace_csw", true] call EFUNC(common,statusEffect_set);
|
||||
[_cswTripod, "disableWeaponAssembly", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set);
|
||||
};
|
||||
|
||||
private _posATL = _player getRelPos [2, 0];
|
||||
|
@ -7,7 +7,7 @@
|
||||
* 0: CSW <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Compatible Magazines <HashMap>
|
||||
* Compatible Magazines <HASHMAP>
|
||||
* Magazine classname <STRING>
|
||||
* Nothing
|
||||
*
|
||||
@ -23,7 +23,7 @@ if !((typeOf _csw) in GVAR(initializedStaticTypes)) exitWith {createHashMap};
|
||||
|
||||
// fast exit for csw with single weapon, most common scenario
|
||||
if (count allTurrets _csw isEqualTo 1 && {count weapons _csw isEqualTo 1}) exitWith {
|
||||
GVAR(compatibleMagsCache) get ((weapons _csw) select 0) // return
|
||||
+(GVAR(compatibleMagsCache) get ((weapons _csw) select 0)) // return
|
||||
};
|
||||
|
||||
private _weapons = [];
|
||||
@ -44,4 +44,4 @@ private _carryMagazines = createHashMap; // hashmap for constant lookup
|
||||
_carryMagazines merge [GVAR(compatibleMagsCache) get _weapon, true];
|
||||
} forEach _weapons;
|
||||
|
||||
_carryMagazines // return
|
||||
+_carryMagazines // return
|
||||
|
@ -10,7 +10,7 @@
|
||||
* 3: Include CSW crew <BOOL> (default: true)
|
||||
*
|
||||
* Return Value:
|
||||
* Available Ammo <HashMap>
|
||||
* Available Ammo <HASHMAP>
|
||||
* Magazine classname <STRING>
|
||||
* Total Ammo <NUMBER>
|
||||
*
|
||||
|
@ -23,7 +23,7 @@ TRACE_4("proxyWeapon",_vehicle,_turret,_needed,_emptyWeapon);
|
||||
|
||||
if (_vehicle getVariable [format [QGVAR(proxyHandled_%1), _turret], false]) exitWith { TRACE_1("already handled",typeOf _vehicle); };
|
||||
|
||||
private _proxyWeapon = getText (configOf _vehicle >> "ace_csw" >> "proxyWeapon");
|
||||
private _proxyWeapon = getText (configOf _vehicle >> QUOTE(ADDON) >> "proxyWeapon");
|
||||
|
||||
TRACE_2("",typeOf _vehicle,_proxyWeapon);
|
||||
if (_proxyWeapon isEqualTo "") exitWith {};
|
||||
|
@ -47,12 +47,18 @@ if (_canAdd) then {
|
||||
TRACE_2("Setting mag ammo",_loadedMag,_currentAmmo);
|
||||
// _vehicle setMagazineTurretAmmo [_loadedMag, _currentAmmo, _turret];
|
||||
|
||||
// setMagazineTurretAmmo is broken on split locality, use setAmmo for now (this may not work for multi turret vehicles)
|
||||
// setMagazineTurretAmmo is broken on split locality and if there are multiple magazines of the same class (valid 20/12/2023, Arma 2.14)
|
||||
// use setAmmo for now (this may not work for multi turret vehicles)
|
||||
private _weapon = (_vehicle weaponsTurret _turret) param [0, ""];
|
||||
TRACE_3("setAmmo",_vehicle,_weapon, _currentAmmo);
|
||||
_vehicle setAmmo [_weapon, _currentAmmo];
|
||||
private _currentAmmo = _vehicle magazineTurretAmmo [_loadedMag, _turret];
|
||||
if ((_weapon == "") || {_currentAmmo != _currentAmmo}) then { ERROR_1("failed to setAmmo - %1", _this); };
|
||||
if ((_weapon == "") || {_currentAmmo != _currentAmmo}) then {
|
||||
// Don't remove ammo if it failed to load
|
||||
_ammoRemaining = _ammoRemaining + _ammoUsed;
|
||||
|
||||
ERROR_1("failed to setAmmo - %1",_this);
|
||||
};
|
||||
} else {
|
||||
if (_loadedMag != "") then {
|
||||
TRACE_1("Removing emtpy mag",_loadedMag);
|
||||
|
Loading…
Reference in New Issue
Block a user