Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSW - Remove 'Disabled' option from Ammo Handling #9322

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions addons/csw/functions/fnc_aceRearmGetCarryMagazines.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ params ["_vehicle", ["_targetTurret", true, [[], true]]];
private _return = [[], []];

if !(_vehicle isKindOf "StaticWeapon") exitWith {_return}; // limit to statics for now
// Assembly mode: [0=disabled, 1=enabled, 2=enabled&unload, 3=default]
if ((GVAR(ammoHandling) == 0) && {!([false, true, true, GVAR(defaultAssemblyMode)] select (_vehicle getVariable [QGVAR(assemblyMode), 3]))}) exitWith {_return};
// Skip if CSW is explicitly disabled (assemblyMode = 0)
if ((_vehicle getVariable [QGVAR(assemblyMode), 3]) == 0) exitWith {_return};
Comment on lines +24 to +25
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Skip if CSW is explicitly disabled (assemblyMode = 0)
if ((_vehicle getVariable [QGVAR(assemblyMode), 3]) == 0) exitWith {_return};
// Skip if CSW reload is explicitly disabled
if (_vehicle getVariable [QGVAR(reloadDisabled), false]) exitWith {_return};


private _turretMagsCSW = _return select 0;
private _allCarryMags = _return select 1;
Expand Down
8 changes: 4 additions & 4 deletions addons/csw/functions/fnc_staticWeaponInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ 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 };
[_player, _target, ["isNotSwimming", "isNotSitting"]] call EFUNC(common,canInteractWith)
// If CSW isn't disabled for this static we enable ammo handling
((_target getVariable [QGVAR(assemblyMode), 3]) != 0) &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
((_target getVariable [QGVAR(assemblyMode), 3]) != 0) &&
(!(_target getVariable [QGVAR(reloadDisabled), false])) &&

{[_player, _target, ["isNotSwimming", "isNotSitting"]] call EFUNC(common,canInteractWith)}
};
private _childenCode = {
BEGIN_COUNTER(getActions); // can remove for final release
Expand All @@ -88,7 +88,7 @@ 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) && {(_target getVariable [QGVAR(assemblyMode), 3]) != 0}) then {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (["ACE_reload"] call EFUNC(common,isModLoaded) && {(_target getVariable [QGVAR(assemblyMode), 3]) != 0}) then {
if (["ACE_reload"] call EFUNC(common,isModLoaded) && {!(_target getVariable [QGVAR(reloadDisabled), false])}) 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);
Expand Down
2 changes: 1 addition & 1 deletion addons/csw/initSettings.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ private _categoryArray = [format ["ACE %1", localize LSTRING(DisplayName)]];
QGVAR(ammoHandling), "LIST",
[LSTRING(ammoHandling_displayName), LSTRING(ammoHandling_description)],
_categoryArray,
[[0, 1, 2], [LELSTRING(common,Disabled), LELSTRING(common,playerOnly), LELSTRING(common,playersAndAI)], 2], // [_values, _valueTitles, _defaultIndex]
[[1, 2], [LELSTRING(common,playerOnly), LELSTRING(common,playersAndAI)], 2], // [_values, _valueTitles, _defaultIndex]
true, // isGlobal
{[QGVAR(ammoHandling), _this] call EFUNC(common,cbaSettings_settingChanged)},
true // Needs mission restart
Expand Down
4 changes: 2 additions & 2 deletions docs/wiki/feature/crew-served-weapons.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ Static weapons are assembled when a tripod is placed down, and the weapon mounte

### 3.2 handleExtraMagazines

- Enables/Disables the magazines in the CSW will appear next to the gun on weapon initialization when using defaultAssemblyMode and you have a pre-placed static weapon
- Controls whether magazines in pre-placed or vanilla assembled CSWs will be unloaded next to the weapon, or just deleted. Has no effect for CSW assembled through the ACE gunbags.
- Default: On

### 3.3 ammoHandling

- Whether or not you want to handle ammo using the CSW way. Does nothing if using defaultAssemblyMode
- Whether or not AI can reload a CSW.
- Default: On