remove disabled var

This commit is contained in:
Salluci 2023-07-13 20:56:09 +03:00
parent ddf1f1149d
commit d221755915
7 changed files with 13 additions and 15 deletions

View File

@ -16,7 +16,6 @@ params ["_staticWeapon", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_
TRACE_8("firedEH:",_staticWeapon,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile,_gunner);
if ((!local _gunner) || {[_gunner] call EFUNC(common,isPlayer)}) exitWith {};
if (_staticWeapon getVariable [QGVAR(disabled), false]) exitWith {};
if (someAmmo _staticWeapon) exitWith {};
TRACE_2("need ammo",someAmmo _staticWeapon,magazinesAllTurrets _staticWeapon);

View File

@ -32,8 +32,7 @@ private _condition = {
params ["_target", "_player", "_params"];
_params params ["_carryMag", "_turretPath", "", "_magSource"];
!(_target getVariable [QGVAR(disabled), false]) &&
{([_target, _turretPath, _carryMag, _magSource] call FUNC(reload_canLoadMagazine)) select 0}
([_target, _turretPath, _carryMag, _magSource] call FUNC(reload_canLoadMagazine)) select 0
};
private _cfgMagazines = configFile >> "CfgMagazines"; // micro-optimization

View File

@ -46,8 +46,7 @@ private _statement = {
private _condition = {
params ["_target", "_player", "_params"];
_params params ["_vehMag", "_turretPath", "_carryMag"];
!(_target getVariable [QGVAR(disabled), false]) &&
{[_target, _turretPath, _player, _carryMag, _vehMag] call FUNC(reload_canUnloadMagazine)}
[_target, _turretPath, _player, _carryMag, _vehMag] call FUNC(reload_canUnloadMagazine)
};
private _actions = [];

View File

@ -69,8 +69,8 @@ if (hasInterface && {!(_typeOf in GVAR(initializedStaticTypes))}) then {
private _ammoActionPath = [];
private _magazineLocation = getText (_configOf >> QUOTE(ADDON) >> "magazineLocation");
private _condition = { //IGNORE_PRIVATE_WARNING ["_target", "_player"];
// If magazine handling is enabled or weapon assembly/disassembly is enabled we enable ammo handling
if ((GVAR(ammoHandling) == 0) && {!([false, true, true, GVAR(defaultAssemblyMode)] select (_target getVariable [QGVAR(assemblyMode), 3]))}) exitWith { false };
// If magazine handling and weapon assembly/disassembly are enabled we enable ammo handling
if ((GVAR(ammoHandling) == 0) || {!([false, true, true, GVAR(defaultAssemblyMode)] select (_target getVariable [QGVAR(assemblyMode), 3]))}) exitWith { false };
[_player, _target, ["isNotSwimming", "isNotSitting"]] call EFUNC(common,canInteractWith)
};
private _childenCode = {
@ -88,7 +88,11 @@ if (hasInterface && {!(_typeOf in GVAR(initializedStaticTypes))}) then {
_ammoActionPath = [_typeOf, 0, ["ACE_MainActions"], _ammoAction] call EFUNC(interact_menu,addActionToClass);
};
if (["ACE_reload"] call EFUNC(common,isModLoaded)) then {
if (
["ACE_reload"] call EFUNC(common,isModLoaded) &&
{GVAR(ammoHandling) isNotEqualTo 0} &&
{([false, true, true, GVAR(defaultAssemblyMode)] select (_staticWeapon getVariable [QGVAR(assemblyMode), 3]))}
) then {
// move reload's check ammo action to the ammo handling point (remove and re-add)
[_typeOf, 0, ["ACE_MainActions", QEGVAR(reload,CheckAmmo)]] call EFUNC(interact_menu,removeActionFromClass);
private _checkAmmoAction = [QGVAR(checkAmmo), localize ELSTRING(reload,checkAmmo), "", EFUNC(reload,checkAmmo), EFUNC(reload,canCheckAmmo)] call EFUNC(interact_menu,createAction);

View File

@ -19,7 +19,6 @@
params ["_staticWeapon", "_assemblyMode", "_emptyWeapon"];
TRACE_3("staticWeaponInit_unloadExtraMags",_staticWeapon,_assemblyMode,_emptyWeapon);
if (!_assemblyMode) exitWith {};
if (_staticWeapon getVariable [QGVAR(disabled), false]) exitWith {};
private _desiredAmmo = getNumber (configOf _staticWeapon >> QUOTE(ADDON) >> "desiredAmmo");
private _storeExtraMagazines = GVAR(handleExtraMagazines);

View File

@ -10,7 +10,7 @@ PREP_RECOMPILE_END;
["Mortar_01_base_F", "Init", { // override CSW's ammo handling with Mk6 setting
params ["_mortar"];
_mortar setVariable [QEGVAR(csw,disabled), !GVAR(useAmmoHandling)];
_mortar setVariable [QEGVAR(csw,assemblyMode), [0, 3] select GVAR(useAmmoHandling)];
}] call CBA_fnc_addClassEventHandler;
GVAR(ammoHandlingMagazineReplacement) = createHashMapFromArray [

View File

@ -149,15 +149,13 @@ class CfgVehicles {
};
```
### 1.5 Custom Ammo Handling
### 1.5 Disabling CSW for a single weapon
ACE's ammo handling (including AI reloading, and initial unloading and conversion of the weapon's magazines) can be blocked by setting the `ace_csw_disabled` variable on init.
This will also block reloading and unloading the weapon manually through ACE.
This variable needs to be set globally.
The entirety of CSW's systems can be disabled by setting the `ace_csw_assemblyMode` variable to `0` on init.
```sqf
myCustomStaticWeapon = createVehicle ["B_Mortar_01_F", [0, 0, 0]];
myCustomStaticWeapon setVariable ["ace_csw_disabled", true, true]; // blocks ammo handling
myCustomStaticWeapon setVariable ["ace_csw_assemblyMode", 0, true]; // disable CSW
```
## 2. Making a new Tripod