From b4a0771730ac2ea6829902d1eb714a525f4956e8 Mon Sep 17 00:00:00 2001 From: Salluci Date: Sun, 2 Jul 2023 22:10:22 +0300 Subject: [PATCH 01/16] add csw override --- addons/csw/functions/fnc_ai_handleFired.sqf | 1 + addons/csw/functions/fnc_ai_handleGetIn.sqf | 1 + .../csw/functions/fnc_reload_actionsLoad.sqf | 3 ++- .../functions/fnc_reload_actionsUnload.sqf | 3 ++- .../fnc_staticWeaponInit_unloadExtraMags.sqf | 1 + addons/mk6mortar/XEH_preInit.sqf | 13 +++++++++++ .../functions/fnc_csw_getProxyWeapon.sqf | 22 +++++-------------- addons/mk6mortar/stringtable.xml | 16 ++------------ .../crew-served-weapons-framework.md | 19 ++++++++++++---- 9 files changed, 43 insertions(+), 36 deletions(-) diff --git a/addons/csw/functions/fnc_ai_handleFired.sqf b/addons/csw/functions/fnc_ai_handleFired.sqf index 668a425b50f..bc34e1e6319 100644 --- a/addons/csw/functions/fnc_ai_handleFired.sqf +++ b/addons/csw/functions/fnc_ai_handleFired.sqf @@ -16,6 +16,7 @@ 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); diff --git a/addons/csw/functions/fnc_ai_handleGetIn.sqf b/addons/csw/functions/fnc_ai_handleGetIn.sqf index 2906a01d1e8..654a32e5557 100644 --- a/addons/csw/functions/fnc_ai_handleGetIn.sqf +++ b/addons/csw/functions/fnc_ai_handleGetIn.sqf @@ -15,6 +15,7 @@ params ["_staticWeapon", "_role", "_gunner"]; TRACE_3("getInEH:",_staticWeapon,_role,_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); diff --git a/addons/csw/functions/fnc_reload_actionsLoad.sqf b/addons/csw/functions/fnc_reload_actionsLoad.sqf index d141da3d93b..843f34019bf 100644 --- a/addons/csw/functions/fnc_reload_actionsLoad.sqf +++ b/addons/csw/functions/fnc_reload_actionsLoad.sqf @@ -32,7 +32,8 @@ private _condition = { params ["_target", "_player", "_params"]; _params params ["_carryMag", "_turretPath", "", "_magSource"]; - ([_target, _turretPath, _carryMag, _magSource] call FUNC(reload_canLoadMagazine)) select 0 + !(_target getVariable [QGVAR(disabled), false]) && + {([_target, _turretPath, _carryMag, _magSource] call FUNC(reload_canLoadMagazine)) select 0} }; private _cfgMagazines = configFile >> "CfgMagazines"; // micro-optimization diff --git a/addons/csw/functions/fnc_reload_actionsUnload.sqf b/addons/csw/functions/fnc_reload_actionsUnload.sqf index 0f4e9cb7ded..908c6b25b47 100644 --- a/addons/csw/functions/fnc_reload_actionsUnload.sqf +++ b/addons/csw/functions/fnc_reload_actionsUnload.sqf @@ -46,7 +46,8 @@ private _statement = { private _condition = { params ["_target", "_player", "_params"]; _params params ["_vehMag", "_turretPath", "_carryMag"]; - [_target, _turretPath, _player, _carryMag, _vehMag] call FUNC(reload_canUnloadMagazine) + !(_target getVariable [QGVAR(disabled), false]) && + {[_target, _turretPath, _player, _carryMag, _vehMag] call FUNC(reload_canUnloadMagazine)} }; private _actions = []; diff --git a/addons/csw/functions/fnc_staticWeaponInit_unloadExtraMags.sqf b/addons/csw/functions/fnc_staticWeaponInit_unloadExtraMags.sqf index 41845c0eb3c..374fe7873d9 100644 --- a/addons/csw/functions/fnc_staticWeaponInit_unloadExtraMags.sqf +++ b/addons/csw/functions/fnc_staticWeaponInit_unloadExtraMags.sqf @@ -19,6 +19,7 @@ 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); diff --git a/addons/mk6mortar/XEH_preInit.sqf b/addons/mk6mortar/XEH_preInit.sqf index 9361d05015e..100217ffe4e 100644 --- a/addons/mk6mortar/XEH_preInit.sqf +++ b/addons/mk6mortar/XEH_preInit.sqf @@ -8,4 +8,17 @@ PREP_RECOMPILE_END; #include "initSettings.sqf" +["Mortar_01_base_F", "Init", { // override CSW's ammo handling with Mk6 setting + params ["_mortar"]; + _mortar setVariable [QEGVAR(csw,disabled), !GVAR(useAmmoHandling)]; +}] call CBA_fnc_addClassEventHandler; + +GVAR(ammoHandlingMagazineReplacement) = createHashMapFromArray [ + ["8Rnd_82mm_Mo_shells", "ACE_1Rnd_82mm_Mo_HE"], + ["8Rnd_82mm_Mo_Smoke_white", "ACE_1Rnd_82mm_Mo_Smoke"], + ["8Rnd_82mm_Mo_Flare_white", "ACE_1Rnd_82mm_Mo_Illum"], + ["8Rnd_82mm_Mo_guided", "ACE_1Rnd_82mm_Mo_HE_Guided"], + ["8Rnd_82mm_Mo_LG", "ACE_1Rnd_82mm_Mo_HE_LaserGuided"] +]; + ADDON = true; diff --git a/addons/mk6mortar/functions/fnc_csw_getProxyWeapon.sqf b/addons/mk6mortar/functions/fnc_csw_getProxyWeapon.sqf index fd4804b98f6..bf4ed48f643 100644 --- a/addons/mk6mortar/functions/fnc_csw_getProxyWeapon.sqf +++ b/addons/mk6mortar/functions/fnc_csw_getProxyWeapon.sqf @@ -22,9 +22,9 @@ params ["_mortar", "_turret", "_currentWeapon", "_proxyWeaponNeeded"]; TRACE_4("csw_getProxyWeapon",_mortar,_turret,_currentWeapon,_proxyWeaponNeeded); -private _newWeapon = ""; +private _newWeapon = _currentWeapon; -if (_proxyWeaponNeeded || GVAR(useAmmoHandling)) then { +if (GVAR(useAmmoHandling)) then { if (_currentWeapon != "mortar_82mm") exitWith { ERROR_2("unknown weapon [%1 - %2]",typeOf _mortar,_currentWeapon); }; // Replace weapon with fast reloading version @@ -36,23 +36,13 @@ if (_proxyWeaponNeeded || GVAR(useAmmoHandling)) then { private _convertedMags = []; { _x params ["_xMag", "_xTurret", "_xAmmo"]; - if (_xTurret isEqualTo _turret) then { - private _replaceMag = switch (true) do { - case (_xMag == "8Rnd_82mm_Mo_shells"): {"ACE_1Rnd_82mm_Mo_HE"}; - case (_xMag == "8Rnd_82mm_Mo_Smoke_white"): {"ACE_1Rnd_82mm_Mo_Smoke"}; - case (_xMag == "8Rnd_82mm_Mo_Flare_white"): {"ACE_1Rnd_82mm_Mo_Illum"}; - case (_xMag == "8Rnd_82mm_Mo_guided"): {"ACE_1Rnd_82mm_Mo_HE_Guided"}; - case (_xMag == "8Rnd_82mm_Mo_LG"): {"ACE_1Rnd_82mm_Mo_HE_LaserGuided"}; - default {""}; - }; + private _replaceMag = GVAR(ammoHandlingMagazineReplacement) getOrDefault [_xMag, ""]; if (_replaceMag != "") then { _magsToRemove pushBackUnique [_xMag, _xTurret]; - if (!GVAR(useAmmoHandling)) then { - TRACE_3("replacing",_xMag,_replaceMag,_xAmmo); - for "_i" from 1 to _xAmmo do { - _convertedMags pushBack [_replaceMag, _xTurret, 1]; - }; + TRACE_3("replacing",_xMag,_replaceMag,_xAmmo); + for "_i" from 1 to _xAmmo do { + _convertedMags pushBack [_replaceMag, _xTurret, 1]; }; } else { WARNING_1("unknown mag %1", _xMag); diff --git a/addons/mk6mortar/stringtable.xml b/addons/mk6mortar/stringtable.xml index 464d6543462..26ef489f5e9 100644 --- a/addons/mk6mortar/stringtable.xml +++ b/addons/mk6mortar/stringtable.xml @@ -218,7 +218,7 @@ 這個模塊允許你設定MK6迫擊砲的相關功能 - Use Ammunition handling + Use Ammunition Handling Aktiviere Munitionshandhabung Usar manejo de munición. Aktywuj obsługę amunicji @@ -233,19 +233,7 @@ Používat ruční manipulaci s municí - Removes mortar magazines, requiring individual rounds to be loaded by the gunner or loader. Does not affect AI mortars. - Enfernt das Magzin des Mörsers. Es ist nun erforderlich, die einzelnen Patronen manuell zu laden. Dies beeinflusst nicht die KI-Truppen. - Elimina los cargadores del mortero, requiriendo al artillero o cargador la carga manual de cada rondas. No afecta morteros controlados por IA. - Usuwa magazynki moździerza, wymagając ładowania pojedynczych pocisków przez strzelca lub ładowniczego. Nie dotyczy moździerzy AI. - Enlève les chargeurs de mortier, ce qui oblige le tireur ou le servant à charger les obus manuellement. N'affecte pas les mortiers IA. - Toglie i proiettili dal mortaio. I colpi singoli devono essere caricati dall'operatore. Non cambia quado l'IA spara. - Elimina os carregadores do morteiro, requerendo que o atirador ou carregador utilize de forma individual a munição. Não afeta os morteiros controlados pela IA. - Удаляет артиллерийские магазины, требует загрузку отдельных снарядов стрелком или заряжающим. Не влияет на артиллерию ИИ. - 迫撃砲から弾薬を除去します。射手か装填手により予め装填されている必要があります。AI 迫撃砲へ影響を与えません。 - 박격포 탄창을 제거합니다, 사수나 장전수가 개별적으로 탄환을 넣어줘야 합니다. 인공지능은 영향을 받지 않습니다. - 开启此功能时。迫击炮的弹药需由炮手与装填手共同合作来进行装填。此功能并不影响由 AI 射击的迫击炮 - 開啟此功能時。迫擊砲的彈藥需由砲手與裝填手共同合作來進行裝填。此功能並不影響由AI射擊的迫擊砲 - Odstraní z minometu zásobník a vynucuje nabíjení po každém výstřelu buď mířičem nebo nabíječem. Tato možnost neovlivňuje AI posádky. + Converts mortar magazines into their single round versions, requiring individual rounds to be loaded by the crew.\nOverrides Crew Served Weapon's Ammo Handling. Remove Round diff --git a/docs/wiki/framework/crew-served-weapons-framework.md b/docs/wiki/framework/crew-served-weapons-framework.md index 9b3ef28d4fb..bc140286b45 100644 --- a/docs/wiki/framework/crew-served-weapons-framework.md +++ b/docs/wiki/framework/crew-served-weapons-framework.md @@ -102,12 +102,12 @@ class ACE_CSW_Groups { class prefix_100rnd_hmg_csw_mag { // Same name as the carryable magazine prefix_100rnd_hmg_mag = 1; // Vehicle magazine that will be loaded when loading this magazine }; - + // Using an existing CSW magazine class ace_csw_100Rnd_127x99_mag { banana_dummy_ammo = 1; }; - + /* Carryable magazines already defined by ACE: - ace_csw_100Rnd_127x99_mag @@ -134,12 +134,12 @@ class CfgVehicles { class StaticMGWeapon; class prefix_hmg: StaticMGWeapon { class ACE_CSW { - enabled = 1; // Enables ACE CSW for this weapon + enabled = 1; // Enables ACE CSW for this weapon proxyWeapon = "prefix_hmg_weapon_proxy"; // The proxy weapon created above magazineLocation = "_target selectionPosition 'magazine'"; // Ammo handling interaction point location disassembleWeapon = "prefix_hmg_carry"; // Carryable weapon created above disassembleTurret = "ace_csw_m3Tripod"; // Which static tripod will appear when weapon is disassembled - ammoLoadTime = 7; // How long it takes in seconds to load ammo into the weapon + ammoLoadTime = 7; // How long it takes in seconds to load ammo into the weapon ammoUnloadTime = 5; // How long it takes in seconds to unload ammo from the weapon desiredAmmo = 100; // When the weapon is reloaded it will try and reload to this ammo capacity // Optional callback function for when the CSW gets disassembled, called with [tripod, staticWeapon] @@ -149,6 +149,17 @@ class CfgVehicles { }; ``` +### 1.5 Custom Ammo Handling + +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 where the weapon is local. + +```sqf +myCustomStaticWeapon = createVehicle ["B_Mortar_01_F", [0, 0, 0]]; +myCustomStaticWeapon setVariable ["ace_csw_disabled", true, true]; // blocks ammo handling +``` + ## 2. Making a new Tripod If none of the existing ACE tripods fit your weapon, you can create your own. Creating a tripod is similar to creating a crew served weapon and consists of two parts: From 9fe3f8432f1b349d1e798dbcd7202e1c462fc3b2 Mon Sep 17 00:00:00 2001 From: Grim <69561145+LinkIsGrim@users.noreply.github.com> Date: Mon, 3 Jul 2023 04:26:03 +0300 Subject: [PATCH 02/16] Update docs/wiki/framework/crew-served-weapons-framework.md --- docs/wiki/framework/crew-served-weapons-framework.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/wiki/framework/crew-served-weapons-framework.md b/docs/wiki/framework/crew-served-weapons-framework.md index bc140286b45..6c5222fd4c2 100644 --- a/docs/wiki/framework/crew-served-weapons-framework.md +++ b/docs/wiki/framework/crew-served-weapons-framework.md @@ -153,7 +153,7 @@ class CfgVehicles { 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 where the weapon is local. +This variable needs to be set globally. ```sqf myCustomStaticWeapon = createVehicle ["B_Mortar_01_F", [0, 0, 0]]; From ddf1f1149dbd6f6ac9083e0a0687da08daffe5a4 Mon Sep 17 00:00:00 2001 From: Salluci Date: Thu, 13 Jul 2023 13:55:08 +0300 Subject: [PATCH 03/16] remove stupid --- addons/mk6mortar/functions/fnc_csw_getProxyWeapon.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mk6mortar/functions/fnc_csw_getProxyWeapon.sqf b/addons/mk6mortar/functions/fnc_csw_getProxyWeapon.sqf index bf4ed48f643..6b19dcf996f 100644 --- a/addons/mk6mortar/functions/fnc_csw_getProxyWeapon.sqf +++ b/addons/mk6mortar/functions/fnc_csw_getProxyWeapon.sqf @@ -22,7 +22,7 @@ params ["_mortar", "_turret", "_currentWeapon", "_proxyWeaponNeeded"]; TRACE_4("csw_getProxyWeapon",_mortar,_turret,_currentWeapon,_proxyWeaponNeeded); -private _newWeapon = _currentWeapon; +private _newWeapon = ""; if (GVAR(useAmmoHandling)) then { if (_currentWeapon != "mortar_82mm") exitWith { ERROR_2("unknown weapon [%1 - %2]",typeOf _mortar,_currentWeapon); }; From d2217559156494ba59bd7631feceafb364172b8e Mon Sep 17 00:00:00 2001 From: Salluci Date: Thu, 13 Jul 2023 20:56:09 +0300 Subject: [PATCH 04/16] remove disabled var --- addons/csw/functions/fnc_ai_handleFired.sqf | 1 - addons/csw/functions/fnc_reload_actionsLoad.sqf | 3 +-- addons/csw/functions/fnc_reload_actionsUnload.sqf | 3 +-- addons/csw/functions/fnc_staticWeaponInit.sqf | 10 +++++++--- .../functions/fnc_staticWeaponInit_unloadExtraMags.sqf | 1 - addons/mk6mortar/XEH_preInit.sqf | 2 +- docs/wiki/framework/crew-served-weapons-framework.md | 8 +++----- 7 files changed, 13 insertions(+), 15 deletions(-) diff --git a/addons/csw/functions/fnc_ai_handleFired.sqf b/addons/csw/functions/fnc_ai_handleFired.sqf index bc34e1e6319..668a425b50f 100644 --- a/addons/csw/functions/fnc_ai_handleFired.sqf +++ b/addons/csw/functions/fnc_ai_handleFired.sqf @@ -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); diff --git a/addons/csw/functions/fnc_reload_actionsLoad.sqf b/addons/csw/functions/fnc_reload_actionsLoad.sqf index 843f34019bf..d141da3d93b 100644 --- a/addons/csw/functions/fnc_reload_actionsLoad.sqf +++ b/addons/csw/functions/fnc_reload_actionsLoad.sqf @@ -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 diff --git a/addons/csw/functions/fnc_reload_actionsUnload.sqf b/addons/csw/functions/fnc_reload_actionsUnload.sqf index 908c6b25b47..0f4e9cb7ded 100644 --- a/addons/csw/functions/fnc_reload_actionsUnload.sqf +++ b/addons/csw/functions/fnc_reload_actionsUnload.sqf @@ -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 = []; diff --git a/addons/csw/functions/fnc_staticWeaponInit.sqf b/addons/csw/functions/fnc_staticWeaponInit.sqf index 6ddaa9d36a5..cf8f4875b91 100644 --- a/addons/csw/functions/fnc_staticWeaponInit.sqf +++ b/addons/csw/functions/fnc_staticWeaponInit.sqf @@ -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); diff --git a/addons/csw/functions/fnc_staticWeaponInit_unloadExtraMags.sqf b/addons/csw/functions/fnc_staticWeaponInit_unloadExtraMags.sqf index 374fe7873d9..41845c0eb3c 100644 --- a/addons/csw/functions/fnc_staticWeaponInit_unloadExtraMags.sqf +++ b/addons/csw/functions/fnc_staticWeaponInit_unloadExtraMags.sqf @@ -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); diff --git a/addons/mk6mortar/XEH_preInit.sqf b/addons/mk6mortar/XEH_preInit.sqf index 100217ffe4e..bab29375b22 100644 --- a/addons/mk6mortar/XEH_preInit.sqf +++ b/addons/mk6mortar/XEH_preInit.sqf @@ -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 [ diff --git a/docs/wiki/framework/crew-served-weapons-framework.md b/docs/wiki/framework/crew-served-weapons-framework.md index 6c5222fd4c2..030ee1bf4e4 100644 --- a/docs/wiki/framework/crew-served-weapons-framework.md +++ b/docs/wiki/framework/crew-served-weapons-framework.md @@ -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 From 5b3f77d756072edcb0586034c372a45d4b59a650 Mon Sep 17 00:00:00 2001 From: Salluci Date: Thu, 13 Jul 2023 21:01:02 +0300 Subject: [PATCH 05/16] remove proxy weapon function --- addons/mk6mortar/CfgVehicles.hpp | 2 +- addons/mk6mortar/XEH_PREP.hpp | 1 - .../functions/fnc_csw_getProxyWeapon.sqf | 58 ------------------- 3 files changed, 1 insertion(+), 60 deletions(-) delete mode 100644 addons/mk6mortar/functions/fnc_csw_getProxyWeapon.sqf diff --git a/addons/mk6mortar/CfgVehicles.hpp b/addons/mk6mortar/CfgVehicles.hpp index 41e45abf351..299b91192ac 100644 --- a/addons/mk6mortar/CfgVehicles.hpp +++ b/addons/mk6mortar/CfgVehicles.hpp @@ -27,7 +27,7 @@ class CfgVehicles { }; class Mortar_01_base_F: StaticMortar { class ace_csw { - proxyWeapon = QFUNC(csw_getProxyWeapon); + proxyWeapon = "ACE_mortar_82mm"; magazineLocation = "_target selectionPosition 'usti hlavne'"; }; class Turrets: Turrets { diff --git a/addons/mk6mortar/XEH_PREP.hpp b/addons/mk6mortar/XEH_PREP.hpp index dd052a993e5..efc6ce4219e 100644 --- a/addons/mk6mortar/XEH_PREP.hpp +++ b/addons/mk6mortar/XEH_PREP.hpp @@ -1,5 +1,4 @@ -PREP(csw_getProxyWeapon); PREP(handleFired); PREP(handlePlayerVehicleChanged); PREP(moduleInit); diff --git a/addons/mk6mortar/functions/fnc_csw_getProxyWeapon.sqf b/addons/mk6mortar/functions/fnc_csw_getProxyWeapon.sqf deleted file mode 100644 index 6b19dcf996f..00000000000 --- a/addons/mk6mortar/functions/fnc_csw_getProxyWeapon.sqf +++ /dev/null @@ -1,58 +0,0 @@ -#include "script_component.hpp" -/* - * Author: PabstMirror - * Compatibility With ACE_CSW (will be called by ace_csw, no dependency) - * Setting Init has finished, and this runs before csw attempts to unload weapon, should replicate functionality of mk6_fnc_mortarInit - * - * Arguments: - * 0: static - * 1: Turret - * 2: current weapon - * 3: need proxy weapon (either assembly mode is true, or weapon has been emptied and is being reloaded) - * - * Return Value: - * Proxy Weapon - * - * Example: - * [mortar, "mortar_82mm", true] call ace_mk6mortar_fnc_csw_getProxyWeapon - * - * Public: No - */ - -params ["_mortar", "_turret", "_currentWeapon", "_proxyWeaponNeeded"]; -TRACE_4("csw_getProxyWeapon",_mortar,_turret,_currentWeapon,_proxyWeaponNeeded); - -private _newWeapon = ""; - -if (GVAR(useAmmoHandling)) then { - if (_currentWeapon != "mortar_82mm") exitWith { ERROR_2("unknown weapon [%1 - %2]",typeOf _mortar,_currentWeapon); }; - - // Replace weapon with fast reloading version - _newWeapon = "ace_mortar_82mm"; - TRACE_1("replacing weapon",_newWeapon); - - // need to convert 8rnd mags to 1rnd mags for new weapon (we need to do this so the weapon is loaded with a compatible mag) - private _magsToRemove = []; - private _convertedMags = []; - { - _x params ["_xMag", "_xTurret", "_xAmmo"]; - if (_xTurret isEqualTo _turret) then { - private _replaceMag = GVAR(ammoHandlingMagazineReplacement) getOrDefault [_xMag, ""]; - if (_replaceMag != "") then { - _magsToRemove pushBackUnique [_xMag, _xTurret]; - TRACE_3("replacing",_xMag,_replaceMag,_xAmmo); - for "_i" from 1 to _xAmmo do { - _convertedMags pushBack [_replaceMag, _xTurret, 1]; - }; - } else { - WARNING_1("unknown mag %1", _xMag); - }; - }; - } forEach (magazinesAllTurrets _mortar); - - // remove orignal mags and add 1rnd versions: - { _mortar removeMagazinesTurret _x; } forEach _magsToRemove; - { _mortar addMagazineTurret _x; } forEach _convertedMags; -}; - -_newWeapon From 8b11253cf2922fddd3e1dbc9abf9d03d07786ee5 Mon Sep 17 00:00:00 2001 From: Salluci Date: Thu, 13 Jul 2023 21:02:53 +0300 Subject: [PATCH 06/16] missed one --- addons/csw/functions/fnc_ai_handleGetIn.sqf | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/csw/functions/fnc_ai_handleGetIn.sqf b/addons/csw/functions/fnc_ai_handleGetIn.sqf index 654a32e5557..2906a01d1e8 100644 --- a/addons/csw/functions/fnc_ai_handleGetIn.sqf +++ b/addons/csw/functions/fnc_ai_handleGetIn.sqf @@ -15,7 +15,6 @@ params ["_staticWeapon", "_role", "_gunner"]; TRACE_3("getInEH:",_staticWeapon,_role,_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); From effa6aea88daa1559a2d31091295912094915661 Mon Sep 17 00:00:00 2001 From: Salluci Date: Thu, 13 Jul 2023 21:04:02 +0300 Subject: [PATCH 07/16] stringtable --- addons/mk6mortar/stringtable.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mk6mortar/stringtable.xml b/addons/mk6mortar/stringtable.xml index 26ef489f5e9..7c2b52d54de 100644 --- a/addons/mk6mortar/stringtable.xml +++ b/addons/mk6mortar/stringtable.xml @@ -233,7 +233,7 @@ Používat ruční manipulaci s municí - Converts mortar magazines into their single round versions, requiring individual rounds to be loaded by the crew.\nOverrides Crew Served Weapon's Ammo Handling. + Converts mortar magazines into their single round versions, requiring individual rounds to be loaded by the crew.\nOverrides Crew Served Weapon's Advanced Assembly and Ammo Handling if disabled. Remove Round From 28458f90b05e38ab6c9bc0fd0c614747048e6147 Mon Sep 17 00:00:00 2001 From: Salluci Date: Fri, 14 Jul 2023 20:15:40 +0300 Subject: [PATCH 08/16] remove magazine replacement hashmap, unused --- addons/mk6mortar/XEH_preInit.sqf | 8 -------- 1 file changed, 8 deletions(-) diff --git a/addons/mk6mortar/XEH_preInit.sqf b/addons/mk6mortar/XEH_preInit.sqf index bab29375b22..712378d61a0 100644 --- a/addons/mk6mortar/XEH_preInit.sqf +++ b/addons/mk6mortar/XEH_preInit.sqf @@ -13,12 +13,4 @@ PREP_RECOMPILE_END; _mortar setVariable [QEGVAR(csw,assemblyMode), [0, 3] select GVAR(useAmmoHandling)]; }] call CBA_fnc_addClassEventHandler; -GVAR(ammoHandlingMagazineReplacement) = createHashMapFromArray [ - ["8Rnd_82mm_Mo_shells", "ACE_1Rnd_82mm_Mo_HE"], - ["8Rnd_82mm_Mo_Smoke_white", "ACE_1Rnd_82mm_Mo_Smoke"], - ["8Rnd_82mm_Mo_Flare_white", "ACE_1Rnd_82mm_Mo_Illum"], - ["8Rnd_82mm_Mo_guided", "ACE_1Rnd_82mm_Mo_HE_Guided"], - ["8Rnd_82mm_Mo_LG", "ACE_1Rnd_82mm_Mo_HE_LaserGuided"] -]; - ADDON = true; From 7b285906942ab092eb7e287ea549c8f58ece6725 Mon Sep 17 00:00:00 2001 From: Salluci Date: Fri, 14 Jul 2023 21:08:07 +0300 Subject: [PATCH 09/16] revert stringtable changes --- addons/mk6mortar/stringtable.xml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/addons/mk6mortar/stringtable.xml b/addons/mk6mortar/stringtable.xml index 7c2b52d54de..464d6543462 100644 --- a/addons/mk6mortar/stringtable.xml +++ b/addons/mk6mortar/stringtable.xml @@ -218,7 +218,7 @@ 這個模塊允許你設定MK6迫擊砲的相關功能 - Use Ammunition Handling + Use Ammunition handling Aktiviere Munitionshandhabung Usar manejo de munición. Aktywuj obsługę amunicji @@ -233,7 +233,19 @@ Používat ruční manipulaci s municí - Converts mortar magazines into their single round versions, requiring individual rounds to be loaded by the crew.\nOverrides Crew Served Weapon's Advanced Assembly and Ammo Handling if disabled. + Removes mortar magazines, requiring individual rounds to be loaded by the gunner or loader. Does not affect AI mortars. + Enfernt das Magzin des Mörsers. Es ist nun erforderlich, die einzelnen Patronen manuell zu laden. Dies beeinflusst nicht die KI-Truppen. + Elimina los cargadores del mortero, requiriendo al artillero o cargador la carga manual de cada rondas. No afecta morteros controlados por IA. + Usuwa magazynki moździerza, wymagając ładowania pojedynczych pocisków przez strzelca lub ładowniczego. Nie dotyczy moździerzy AI. + Enlève les chargeurs de mortier, ce qui oblige le tireur ou le servant à charger les obus manuellement. N'affecte pas les mortiers IA. + Toglie i proiettili dal mortaio. I colpi singoli devono essere caricati dall'operatore. Non cambia quado l'IA spara. + Elimina os carregadores do morteiro, requerendo que o atirador ou carregador utilize de forma individual a munição. Não afeta os morteiros controlados pela IA. + Удаляет артиллерийские магазины, требует загрузку отдельных снарядов стрелком или заряжающим. Не влияет на артиллерию ИИ. + 迫撃砲から弾薬を除去します。射手か装填手により予め装填されている必要があります。AI 迫撃砲へ影響を与えません。 + 박격포 탄창을 제거합니다, 사수나 장전수가 개별적으로 탄환을 넣어줘야 합니다. 인공지능은 영향을 받지 않습니다. + 开启此功能时。迫击炮的弹药需由炮手与装填手共同合作来进行装填。此功能并不影响由 AI 射击的迫击炮 + 開啟此功能時。迫擊砲的彈藥需由砲手與裝填手共同合作來進行裝填。此功能並不影響由AI射擊的迫擊砲 + Odstraní z minometu zásobník a vynucuje nabíjení po každém výstřelu buď mířičem nebo nabíječem. Tato možnost neovlivňuje AI posádky. Remove Round From 5efc2d06108c7a9ccb13f6ba8758a6d53839ec56 Mon Sep 17 00:00:00 2001 From: Salluci Date: Fri, 14 Jul 2023 21:10:48 +0300 Subject: [PATCH 10/16] don't unload mags if ammo handling is disabled --- addons/csw/functions/fnc_staticWeaponInit_unloadExtraMags.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/csw/functions/fnc_staticWeaponInit_unloadExtraMags.sqf b/addons/csw/functions/fnc_staticWeaponInit_unloadExtraMags.sqf index 41845c0eb3c..8201151712b 100644 --- a/addons/csw/functions/fnc_staticWeaponInit_unloadExtraMags.sqf +++ b/addons/csw/functions/fnc_staticWeaponInit_unloadExtraMags.sqf @@ -18,7 +18,7 @@ params ["_staticWeapon", "_assemblyMode", "_emptyWeapon"]; TRACE_3("staticWeaponInit_unloadExtraMags",_staticWeapon,_assemblyMode,_emptyWeapon); -if (!_assemblyMode) exitWith {}; +if !(_assemblyMode && {GVAR(ammoHandling) > 0}) exitWith {}; private _desiredAmmo = getNumber (configOf _staticWeapon >> QUOTE(ADDON) >> "desiredAmmo"); private _storeExtraMagazines = GVAR(handleExtraMagazines); From 0d19b994cac83b03da694130ae51d04ea9016591 Mon Sep 17 00:00:00 2001 From: Salluci Date: Sat, 22 Jul 2023 05:56:33 +0300 Subject: [PATCH 11/16] stringtable --- addons/csw/stringtable.xml | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/addons/csw/stringtable.xml b/addons/csw/stringtable.xml index 2782bad8500..89d29d45d1a 100644 --- a/addons/csw/stringtable.xml +++ b/addons/csw/stringtable.xml @@ -129,9 +129,9 @@ 고급 조립 - Use ACE for Assemble/Disassemble of supported static weapons. Loaded ammo is reduced to a single magazine. + Use ACE to Assemble/Disassemble supported static weapons. Benutze ACE um unterstützte statische Waffen zu montieren/demontieren. Geladene Munition ist auf ein einzelnes Magazin reduziert. - Usar o ACE para Montar/Desmontar armas estáticas suportadas. Munição carregada é reduzida para um único carregador. + Usar o ACE para Montar/Desmontar armas estáticas suportadas. Utilise ACE pour l'assemblage/le désassemblage des armes statiques supportées.\nLes munitions chargées sont réduites à un seul chargeur. 対応している設置型火器に ACE3 の設置と解体を使用します。装填済みの弾倉は 1 つの弾倉に減少します。 使用ACE來組裝/拆解固定型武器。上膛的限制為單個彈匣。 @@ -144,9 +144,9 @@ ACE의 조립/분해 기능을 사용하여 공용화기를 다룹니다. 장전된 탄은 한 탄창으로 제한됩니다. - Save Extra Ammo + Store Extra Ammo Spare extra Munition - Economizar munição extra + Guardar munição extra Conserver le surplus de munitions 過剰弾薬を保持 保存額外彈藥 @@ -159,18 +159,18 @@ 남은 탄약 저장 - Store extra magazines next to static weapon - Lager extra Magazine neben der statischen Waffe - Carregar munições extras próximo à arma estática + Store extra magazines next to the static weapon. + Lager extra Magazine neben der statischen Waffe. + Guardar munição extra próximo à arma estática. Range les chargeurs en surplus auprès de l'arme statique. 次の設置型火器用に過剰弾薬を保持します。 在固定型武器旁存放額外彈匣 在固定式武器旁边存放额外的弹匣 - Conservare i caricatori extra accanto all'arma statica + Conservare i caricatori extra accanto all'arma statica. Ukládat munici navíc vedle statické zbraně. - Dodatkowe magazynki przechowuj obok broni statycznej - Almacenar cargadores extra junto al arma estática - Хранить дополнительные магазины рядом со статическим оружием + Dodatkowe magazynki przechowuj obok broni statycznej. + Almacenar cargadores extra junto al arma estática. + Хранить дополнительные магазины рядом со статическим оружием. 공용화기 옆에 남은 탄들을 저장합니다. @@ -184,8 +184,9 @@ Almacenamiento de munición - Determines whether extra magazines are stored on the ground or inside an ammo box - Legt fest, ob zusätzliche Magazine auf dem Boden oder in einer Munitionskiste aufbewahrt werden + Determines whether extra magazines are stored on the ground or inside an ammo box, if the static weapon doesn't have a defined container. + Legt fest, ob zusätzliche Magazine auf dem Boden oder in einer Munitionskiste aufbewahrt werden. + Determina se a munição extra é guardada no chão ou dentro de uma caixa de munição, se a arma estática não tiver um recipiente definido. 여분의 탄약을 지면 또는 탄약 상자에 넣을지 결정합니다. Decyduje, czy dodatkowe magazynki przechowywane są na ziemi, czy w skrzynce z amunicją. 追加のマガジンを地面に設置するか、弾薬箱の中に保管するかを決定します @@ -196,6 +197,7 @@ Ground Boden + Chão 지면 Ziemia 地面 @@ -206,6 +208,7 @@ Ammo Box Munitionskiste + Caixa de munição 탄약 상자 Skrzynka amunicyjna 弾薬箱 @@ -214,9 +217,9 @@ Caja de munición - Ammo handling + Ammo Handling Munitionsmanagement - Manipulação de Munições + Manipulação de Munição Manipulation des munitions 弾薬の処理 彈藥處理 @@ -229,9 +232,9 @@ 탄약 취급 - Allow loading and unloading magazines + Allow loading and unloading magazines. Loaded ammo is reduced to a single magazine for static weapons using Advanced Assembly. Erlaubt es Magazine zu- und entladen. - Permite carregamento e descarregamento de munições + Permite carregar e descarregar munição. Munição carregada é reduzida para um único carregador em armas estáticas usando Montagem Avançada. Définit qui peut charger et décharger les chargeurs. 弾薬の装填と除去を許可します。 允許裝填或卸載彈匣 From 95a89f3bee55a914dcad788ab849c074380c7fee Mon Sep 17 00:00:00 2001 From: Salluci Date: Mon, 24 Jul 2023 01:55:32 +0300 Subject: [PATCH 12/16] empty ammo from advanced assembly mortars --- addons/mk6mortar/XEH_preInit.sqf | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/mk6mortar/XEH_preInit.sqf b/addons/mk6mortar/XEH_preInit.sqf index 712378d61a0..d44c40a7a04 100644 --- a/addons/mk6mortar/XEH_preInit.sqf +++ b/addons/mk6mortar/XEH_preInit.sqf @@ -8,9 +8,13 @@ PREP_RECOMPILE_END; #include "initSettings.sqf" -["Mortar_01_base_F", "Init", { // override CSW's ammo handling with Mk6 setting +// Override CSW's ammo handling with Mk6 setting for non-advanced assembly mortars +["Mortar_01_base_F", "Init", { params ["_mortar"]; - _mortar setVariable [QEGVAR(csw,assemblyMode), [0, 3] select GVAR(useAmmoHandling)]; + if (GVAR(useAmmoHandling)) exitWith {}; + if ((_mortar getVariable [QEGVAR(csw,assemblyMode), 3]) isEqualTo 3) then { + _mortar setVariable [QEGVAR(csw,assemblyMode), 0]; + }; }] call CBA_fnc_addClassEventHandler; ADDON = true; From 5bd35bdb0822af8e8d1f0d3f0df0628cd8f254e8 Mon Sep 17 00:00:00 2001 From: Salluci Date: Mon, 24 Jul 2023 01:57:13 +0300 Subject: [PATCH 13/16] stringtable --- addons/mk6mortar/stringtable.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mk6mortar/stringtable.xml b/addons/mk6mortar/stringtable.xml index 464d6543462..84eb48ab1a8 100644 --- a/addons/mk6mortar/stringtable.xml +++ b/addons/mk6mortar/stringtable.xml @@ -233,7 +233,7 @@ Používat ruční manipulaci s municí - Removes mortar magazines, requiring individual rounds to be loaded by the gunner or loader. Does not affect AI mortars. + Removes mortar magazines, requiring individual rounds to be loaded by the gunner or loader. Does not affect AI mortars. Requires CSW Ammo Handling. Enfernt das Magzin des Mörsers. Es ist nun erforderlich, die einzelnen Patronen manuell zu laden. Dies beeinflusst nicht die KI-Truppen. Elimina los cargadores del mortero, requiriendo al artillero o cargador la carga manual de cada rondas. No afecta morteros controlados por IA. Usuwa magazynki moździerza, wymagając ładowania pojedynczych pocisków przez strzelca lub ładowniczego. Nie dotyczy moździerzy AI. From ef773f158b29c729c0cd15bf20848d79b8f68481 Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Thu, 29 Aug 2024 09:24:59 +0200 Subject: [PATCH 14/16] Update fnc_initVehicle.sqf --- addons/csw/functions/fnc_initVehicle.sqf | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/addons/csw/functions/fnc_initVehicle.sqf b/addons/csw/functions/fnc_initVehicle.sqf index 80ff071f107..c616d53263d 100644 --- a/addons/csw/functions/fnc_initVehicle.sqf +++ b/addons/csw/functions/fnc_initVehicle.sqf @@ -74,8 +74,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 _childrenCode = { @@ -93,7 +93,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 (_vehicle 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), LELSTRING(reload,checkAmmo), "", EFUNC(reload,checkAmmo), EFUNC(reload,canCheckAmmo)] call EFUNC(interact_menu,createAction); From 0f8333c36e721766835ad7efc4c92bef648c55c2 Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Fri, 30 Aug 2024 17:43:44 +0200 Subject: [PATCH 15/16] Update fnc_initVehicle.sqf --- addons/csw/functions/fnc_initVehicle.sqf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/csw/functions/fnc_initVehicle.sqf b/addons/csw/functions/fnc_initVehicle.sqf index c616d53263d..807f6d0fa21 100644 --- a/addons/csw/functions/fnc_initVehicle.sqf +++ b/addons/csw/functions/fnc_initVehicle.sqf @@ -74,8 +74,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 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 }; + // 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 _childrenCode = { From bd1464ab73a556ba381ef95933fa73d44b7ee5f6 Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Fri, 30 Aug 2024 22:30:28 +0200 Subject: [PATCH 16/16] Update fnc_initVehicle.sqf --- addons/csw/functions/fnc_initVehicle.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/csw/functions/fnc_initVehicle.sqf b/addons/csw/functions/fnc_initVehicle.sqf index bff6fa44484..11e9e670f0c 100644 --- a/addons/csw/functions/fnc_initVehicle.sqf +++ b/addons/csw/functions/fnc_initVehicle.sqf @@ -50,7 +50,7 @@ if (_vehicle turretLocal [0]) then { [_vehicle, [0], _assemblyMode, _emptyWeapon] call FUNC(proxyWeapon); - if (!_assemblyMode) exitWith {}; + if !(_assemblyMode && {GVAR(ammoHandling) > 0}) exitWith {}; [_vehicle, _emptyWeapon] call FUNC(staticWeaponInit_unloadExtraMags); };