diff --git a/addons/csw/functions/fnc_initVehicle.sqf b/addons/csw/functions/fnc_initVehicle.sqf index bde31b41d06..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); }; @@ -77,8 +77,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 = { @@ -96,7 +96,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); diff --git a/addons/csw/stringtable.xml b/addons/csw/stringtable.xml index 5d11773490b..66a70d093b5 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. 対応している設置型火器に ACE の設置と解体を使用します。装填済みの弾倉は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. 追加の弾倉を固定火器の横に保管します。 在固定型武器旁存放額外彈匣 在固定式武器旁边存放额外的弹匣 - Conserva i caricatori extra accanto all'arma statica + Conserva 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. + Хранить дополнительные магазины рядом со статическим оружием. 공용화기 옆에 남은 탄들을 저장합니다. @@ -187,17 +187,8 @@ Armazenamento de Munição - 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 - Determina se ulteriori caricatori verranno stoccati sul suolo o in una cassa di munizioni. - 여분의 탄약을 지면 또는 탄약 상자에 넣을 지 결정합니다. - Decyduje, czy dodatkowe magazynki przechowywane są na ziemi, czy w skrzynce z amunicją. - 追加の弾倉を地面に直接配置するか、弾薬箱内に保管するかを設定します。 - 设置多余的弹夹是存放在地面上还是弹药箱内 - Определяет будут ли дополнительные магазины лежать на земле или внутри хранилища - Determina si los cargadores extra son almacenados en el suelo o en una caja de munición - Détermine si les chargeurs supplémentaires sont stockés par terre ou dans une caisse de munitions. - Determina se munições extras são armazenadas no chão ou dentro de uma caixa de munição + Determines whether extra magazines are stored on the ground or inside an ammo box, if the static weapon doesn't have a defined container. + 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. Ground @@ -226,9 +217,9 @@ Caixa de Munição - Ammo handling + Ammo Handling Munitionsmanagement - Manipulação de Munições + Manipulação de Munição Manipulation des munitions 弾薬の処理 彈藥處理 @@ -241,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. 弾薬の装填と除去を許可します。 允許裝填或卸載彈匣 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/XEH_preInit.sqf b/addons/mk6mortar/XEH_preInit.sqf index 894773534a4..2cb1bdf5dca 100644 --- a/addons/mk6mortar/XEH_preInit.sqf +++ b/addons/mk6mortar/XEH_preInit.sqf @@ -8,4 +8,13 @@ PREP_RECOMPILE_END; #include "initSettings.inc.sqf" +// Override CSW's ammo handling with Mk6 setting for non-advanced assembly mortars +["Mortar_01_base_F", "Init", { + params ["_mortar"]; + 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; diff --git a/addons/mk6mortar/functions/fnc_csw_getProxyWeapon.sqf b/addons/mk6mortar/functions/fnc_csw_getProxyWeapon.sqf deleted file mode 100644 index 663afa2cc76..00000000000 --- a/addons/mk6mortar/functions/fnc_csw_getProxyWeapon.sqf +++ /dev/null @@ -1,68 +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 (_proxyWeaponNeeded || 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 = 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 {""}; - }; - 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]; - }; - }; - } 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 diff --git a/addons/mk6mortar/stringtable.xml b/addons/mk6mortar/stringtable.xml index 186cd926849..f34b72827c5 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. + Removes mortar magazines, requiring individual rounds to be loaded by the gunner or loader. Requires CSW Ammo Handling. Enfernt das Magzin des Mörsers. Es ist nun erforderlich, die einzelnen Patronen manuell zu laden. Elimina los cargadores del mortero, requiriendo al artillero o cargador la carga manual de cada rondas. Usuwa magazynki moździerza, wymagając ładowania pojedynczych pocisków przez strzelca lub ładowniczego. diff --git a/docs/wiki/framework/crew-served-weapons-framework.md b/docs/wiki/framework/crew-served-weapons-framework.md index 9b3ef28d4fb..030ee1bf4e4 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,15 @@ class CfgVehicles { }; ``` +### 1.5 Disabling CSW for a single weapon + +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_assemblyMode", 0, true]; // disable CSW +``` + ## 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: