From 0856e58ae9ffcacf0caccb95fcab4efc453ca06d Mon Sep 17 00:00:00 2001
From: johnb432 <58661205+johnb432@users.noreply.github.com>
Date: Mon, 18 Mar 2024 18:16:34 +0100
Subject: [PATCH 01/11] Dragging - Release ownership when target is too heavy
to drag/carry (#9858)
Release ownership when target is too heavy to drag/carry
---
addons/dragging/functions/fnc_startCarryLocal.sqf | 3 +++
addons/dragging/functions/fnc_startDragLocal.sqf | 3 +++
2 files changed, 6 insertions(+)
diff --git a/addons/dragging/functions/fnc_startCarryLocal.sqf b/addons/dragging/functions/fnc_startCarryLocal.sqf
index 15101e2950..2fc0af5e24 100644
--- a/addons/dragging/functions/fnc_startCarryLocal.sqf
+++ b/addons/dragging/functions/fnc_startCarryLocal.sqf
@@ -31,6 +31,9 @@ if !(_target getVariable [QGVAR(ignoreWeightCarry), false]) then {
// Exit if object weight is over global var value
if (_weight > GETMVAR(ACE_maxWeightCarry,1E11)) exitWith {
+ // Release claim on object
+ [objNull, _target, true] call EFUNC(common,claim);
+
[LLSTRING(UnableToDrag)] call EFUNC(common,displayTextStructured);
};
diff --git a/addons/dragging/functions/fnc_startDragLocal.sqf b/addons/dragging/functions/fnc_startDragLocal.sqf
index b656c8ce5a..fe5f29fa61 100644
--- a/addons/dragging/functions/fnc_startDragLocal.sqf
+++ b/addons/dragging/functions/fnc_startDragLocal.sqf
@@ -31,6 +31,9 @@ if !(_target getVariable [QGVAR(ignoreWeightDrag), false]) then {
// Exit if object weight is over global var value
if (_weight > GETMVAR(ACE_maxWeightDrag,1E11)) exitWith {
+ // Release claim on object
+ [objNull, _target, true] call EFUNC(common,claim);
+
[LLSTRING(UnableToDrag)] call EFUNC(common,displayTextStructured);
};
From 11844ef05eb3fb5198bfeaa3d94fe1d398439415 Mon Sep 17 00:00:00 2001
From: johnb432 <58661205+johnb432@users.noreply.github.com>
Date: Mon, 18 Mar 2024 18:17:05 +0100
Subject: [PATCH 02/11] Dragging - Fix dropping incorrect object when carrying
fails (#9860)
Update fnc_startCarryPFH.sqf
---
addons/dragging/functions/fnc_startCarryPFH.sqf | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/addons/dragging/functions/fnc_startCarryPFH.sqf b/addons/dragging/functions/fnc_startCarryPFH.sqf
index ca34275a2c..e8b864f260 100644
--- a/addons/dragging/functions/fnc_startCarryPFH.sqf
+++ b/addons/dragging/functions/fnc_startCarryPFH.sqf
@@ -55,8 +55,8 @@ if (_target isKindOf "CAManBase") then {
TRACE_4("timeout",_unit,_target,_timeOut,CBA_missionTime);
_idPFH call CBA_fnc_removePerFrameHandler;
- private _draggedObject = _unit getVariable [QGVAR(draggedObject), objNull];
- [_unit, _draggedObject] call FUNC(dropObject_carry);
+ private _carriedObject = _unit getVariable [QGVAR(carriedObject), objNull];
+ [_unit, _carriedObject] call FUNC(dropObject_carry);
};
// Wait for the unit to stand up
From e7827813eec33c3da5a83384476ed585313203d1 Mon Sep 17 00:00:00 2001
From: Apricot <50947830+Apricot-ale@users.noreply.github.com>
Date: Tue, 19 Mar 2024 11:59:54 +0900
Subject: [PATCH 03/11] Translations - Improve Japanese localization 3 (#9864)
Japanese
---
addons/csw/stringtable.xml | 4 ++--
addons/dogtags/stringtable.xml | 12 ++++++------
addons/medical_treatment/stringtable.xml | 2 +-
addons/repair/stringtable.xml | 8 ++++----
4 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/addons/csw/stringtable.xml b/addons/csw/stringtable.xml
index b6f8ecb47e..4aea2a24b4 100644
--- a/addons/csw/stringtable.xml
+++ b/addons/csw/stringtable.xml
@@ -179,7 +179,7 @@
Scorta di munizioni
탄약 보관
Magazyn amunicji
- 弾薬の格納場所
+ 弾薬保管位置
弹药存储
Хранилище боеприпасов
Almacenamiento de munición
@@ -192,7 +192,7 @@
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
diff --git a/addons/dogtags/stringtable.xml b/addons/dogtags/stringtable.xml
index d48fcac9ce..d19c61f505 100644
--- a/addons/dogtags/stringtable.xml
+++ b/addons/dogtags/stringtable.xml
@@ -6,7 +6,7 @@
Nieśmiertelnik
Жетон
Identifikační známka
- 認識票
+ ドッグタグ
Erkennungsmarke
군번줄
Plaque d'identification
@@ -22,7 +22,7 @@
Sprawdź nieśmiertelnik
Проверить жетон
Zkontrolovat známku
- 認識票を確認
+ ドッグタグを確認
Erkennungsmarke prüfen
군번줄 확인
Vérifier la plaque d'identification
@@ -54,7 +54,7 @@
Zabierz
Взять
Vezmi
- 取る
+ 拾う
Nehmen
회수
Prendre
@@ -70,7 +70,7 @@
Zabrałeś nieśmiertelnik %1...
Жетон снят с %1...
Sebral jsem známku od %1...
- %1 から認識票を取っています・・・
+ %1 からドッグタグを回収しています・・・
Erkennungsmarke von %1 genommen...
%1(으)로부터 군번줄을 회수했습니다...
Plaque d'identification prise sur %1...
@@ -86,7 +86,7 @@
Ktoś już zabrał ten nieśmiertelnik...
Кто-то уже забрал жетон...
Někdo jiný už vzal identifikační známku...
- 誰かが既に認識票を取ったようだ・・・
+ 既に誰かがドッグタグを回収したようだ・・・
Jemand anderes hat bereits die Erkennungsmarke genommen...
누군가 이미 군번줄을 회수해갔습니다...
Quelqu'un d'autre a déjà pris la plaque d'identification...
@@ -102,7 +102,7 @@
Anzeige um Erkennungsmarke zu überprüfen
在畫面中顯示檢查兵籍牌
在画面中显示检查兵籍牌
- 確認中の認識票を画面上に表示します
+ 確認中のドッグタグを画面上に表示します
Indicatore su schermo per il controllo delle piastrine
Wyświetlacz ekranowy dla sprawdzania nieśmiertelników
Экран для проверки жетонов
diff --git a/addons/medical_treatment/stringtable.xml b/addons/medical_treatment/stringtable.xml
index 2ac957589c..c9925768d2 100644
--- a/addons/medical_treatment/stringtable.xml
+++ b/addons/medical_treatment/stringtable.xml
@@ -957,7 +957,7 @@
Locations IV Transfusion
- IV 輸液の場所制限
+ IV輸液の可能な場所
Ubicación para transfusiones IV
Lieux perfusions IV
Места введения пакетов внутривенного переливания
diff --git a/addons/repair/stringtable.xml b/addons/repair/stringtable.xml
index 2e1e3ba546..4d2f84eea5 100644
--- a/addons/repair/stringtable.xml
+++ b/addons/repair/stringtable.xml
@@ -314,7 +314,7 @@
Lugares de reparación completa
Luoghi Riparazione Completa
Endroits pour réparation complète
- 完全修理できる場所
+ 完全修理可能な場所
완전수리 구역
完整维修地点
完整維修地點
@@ -2225,7 +2225,7 @@
Maximum damage to which a wheel can be patched.\n0% means all damage can be repaired.
- タイヤを補修できる最大の度合い。/n 0% は、すべてのダメージが修復可能であることを意味します
+ タイヤをのダメージ補修できる最大の度合い。/n 0%は、すべてのダメージが修復可能であることを意味します。
Maksymalny poziom, do którego koło może zostać załatane.\n0% oznacza że każde uszkodzenia mogą być naprawione.
Livello di integrità massimo di una ruota rattoppata.
Maximales Level, bis zu dem ein Rad geflickt werden kann.\n0% bedeutet, dass das Rad vollständig repariert werden kann.
@@ -2235,7 +2235,7 @@
Wheel Patch Location
- タイヤ補修場所
+ タイヤ補修可能な場所
Miejsce Łatania Koła
Luoghi rattoppamento ruote
Räder Flick Ort
@@ -2245,7 +2245,7 @@
Where the wheel can be patched.
- タイヤを補修できる場所。
+ タイヤを補修することが出来る場所。
Gdzie można załatać koło.
In quali luoghi è possibile rattoppare una ruota?
Wo das Rad geflickt werden kann.
From c5b54c65a8d4fa7f6b7319b966578bf4a9768bc1 Mon Sep 17 00:00:00 2001
From: BrettMayson
Date: Tue, 19 Mar 2024 01:56:05 -0600
Subject: [PATCH 04/11] Medical Treatment - Fix bandage effectiveness (#9865)
* fix broken bandages
* update params
---
addons/medical_treatment/functions/fnc_bandage.sqf | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/addons/medical_treatment/functions/fnc_bandage.sqf b/addons/medical_treatment/functions/fnc_bandage.sqf
index 80475fa2c3..2152e81a3b 100644
--- a/addons/medical_treatment/functions/fnc_bandage.sqf
+++ b/addons/medical_treatment/functions/fnc_bandage.sqf
@@ -8,7 +8,9 @@
* 1: Patient
* 2: Body Part
* 3: Treatment
- * 4: Bandage effectiveness coefficient (default: 1)
+ * 4: Item User
+ * 5: Used Item
+ * 6: Bandage effectiveness coefficient (default: 1)
*
* Return Value:
* None
@@ -19,10 +21,10 @@
* Public: No
*/
-_this set [4, _this param [4, 1]]; // set default Bandage effectiveness coefficient
+_this set [6, _this param [6, 1]]; // set default Bandage effectiveness coefficient
[QGVAR(bandaged), _this] call CBA_fnc_localEvent; // Raise event with reference so mods can modify this
-params ["_medic", "_patient", "_bodyPart", "_classname", "_bandageEffectiveness"];
+params ["_medic", "_patient", "_bodyPart", "_classname", "", "", "_bandageEffectiveness"];
[_patient, "activity", LSTRING(Activity_bandagedPatient), [[_medic, false, true] call EFUNC(common,getName)]] call FUNC(addToLog);
From 017d47f8c90e69ff522b22f546edc8b8dd4fb36e Mon Sep 17 00:00:00 2001
From: johnb432 <58661205+johnb432@users.noreply.github.com>
Date: Tue, 19 Mar 2024 08:57:09 +0100
Subject: [PATCH 05/11] Fortify - Skip placement animation for no cost
fortifications (#9861)
Skip placement animation for no cost fortifications
---
addons/fortify/functions/fnc_deployConfirm.sqf | 3 +--
docs/wiki/framework/fortify-framework.md | 8 ++++----
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/addons/fortify/functions/fnc_deployConfirm.sqf b/addons/fortify/functions/fnc_deployConfirm.sqf
index 37e0d4fb9d..b0105a7919 100644
--- a/addons/fortify/functions/fnc_deployConfirm.sqf
+++ b/addons/fortify/functions/fnc_deployConfirm.sqf
@@ -38,7 +38,7 @@ private _perframeCheck = {
_args params ["_unit", "_side", "_typeOf", "_posASL", "_vectorDir", "_vectorUp", "_cost"];
// Animation loop (required for longer constructions)
- if (animationState _unit isNotEqualTo "AinvPknlMstpSnonWnonDnon_medic4") then {
+ if (_totalTime != 0 && {animationState _unit != "AinvPknlMstpSnonWnonDnon_medic4"}) then {
// Perform animation
[_unit, "AinvPknlMstpSnonWnonDnon_medic4"] call EFUNC(common,doAnimation);
};
@@ -55,4 +55,3 @@ private _perframeCheck = {
LLSTRING(progressBarTitle),
_perframeCheck
] call EFUNC(common,progressBar);
-
diff --git a/docs/wiki/framework/fortify-framework.md b/docs/wiki/framework/fortify-framework.md
index 3f6619a746..14d48532b5 100644
--- a/docs/wiki/framework/fortify-framework.md
+++ b/docs/wiki/framework/fortify-framework.md
@@ -116,8 +116,8 @@ The Fortify budget can be updated for any side using the function.
Event Name | Passed Parameter(s) | Locality | Description
---------- | ----------- | ------------------- | --------
-`acex_fortify_objectPlaced` | [player, side, objectPlaced] | Global | Foritfy object placed
-`acex_fortify_objectDeleted` | [player, side, objectDeleted] | Global | Foritfy object deleted
+`acex_fortify_objectPlaced` | [player, side, objectPlaced] | Global | Fortify object placed
+`acex_fortify_objectDeleted` | [player, side, objectDeleted] | Global | Fortify object deleted
`acex_fortify_onDeployStart` | [player, object, cost] | Local | Player starts placing object
-`ace_fortify_deployFinished` | [player, side, configName, posASL, vectorDir, vectorUp] | Local | Player successfully finishes building object
-`ace_fortify_deployCanceled` | [player, side, configName, posASL, vectorDir, vectorUp] | Local | Player cancels building object
+`ace_fortify_deployFinished` | [[player, side, configName, posASL, vectorDir, vectorUp, cost], elapsedTime, totalTime, errorCode] | Local | Player successfully finishes building object
+`ace_fortify_deployCanceled` | [[player, side, configName, posASL, vectorDir, vectorUp, cost], elapsedTime, totalTime, errorCode] | Local | Player cancels building object
From 8c69bd25ea7f965a830f985c28ed9da576ceb17a Mon Sep 17 00:00:00 2001
From: Cyruz
Date: Wed, 20 Mar 2024 12:06:45 +0000
Subject: [PATCH 06/11] Rearm - Show distance to target on actions (#9866)
* Show rearm distance in action
* Update addons/rearm/functions/fnc_addRearmActions.sqf
---------
Co-authored-by: Cyruz143
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
---
addons/rearm/functions/fnc_addRearmActions.sqf | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/addons/rearm/functions/fnc_addRearmActions.sqf b/addons/rearm/functions/fnc_addRearmActions.sqf
index e71cab8f0c..200dd2f2b4 100644
--- a/addons/rearm/functions/fnc_addRearmActions.sqf
+++ b/addons/rearm/functions/fnc_addRearmActions.sqf
@@ -30,7 +30,9 @@ private _cswCarryMagazines = [];
private _vehicleActions = [];
{
private _vehicle = _x;
-
+ private _displayName = getText (configOf _vehicle >> "displayName");
+ private _distanceStr = (ACE_player distance _vehicle) toFixed 1;
+ private _actionName = format ["%1 (%2m)", _displayName, _distanceStr];
// Array of magazines that can be rearmed in the vehicle
private _needRearmMags = ([_vehicle] call FUNC(getNeedRearmMagazines)) apply {_x select 0};
@@ -57,7 +59,7 @@ private _vehicleActions = [];
// [Level 0] adds a single action to rearm the entire vic
private _action = [
_vehicle,
- getText(configOf _vehicle >> "displayName"),
+ _actionName,
_icon,
{_this call FUNC(rearmEntireVehicle)},
{true},
@@ -84,7 +86,7 @@ private _vehicleActions = [];
private _action = [
_vehicle,
- getText(configOf _vehicle >> "displayName"),
+ _actionName,
_icon,
{},
{true},
From af3c95a5a623bb5c61d9011eb19fa9fde879ebfe Mon Sep 17 00:00:00 2001
From: Dart <59131299+DartRuffian@users.noreply.github.com>
Date: Thu, 21 Mar 2024 14:20:23 -0500
Subject: [PATCH 07/11] Fire - Add ability to disable screams for individual
units (#9863)
* Disable screams for individual units
* Update addons/fire/XEH_postInit.sqf
* Changed wording
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
* isGlobal instead of true
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
---------
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
---
addons/fire/XEH_postInit.sqf | 5 ++---
docs/wiki/framework/fire-framework.md | 9 +++++++++
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/addons/fire/XEH_postInit.sqf b/addons/fire/XEH_postInit.sqf
index 382c06293b..ec40646ca9 100644
--- a/addons/fire/XEH_postInit.sqf
+++ b/addons/fire/XEH_postInit.sqf
@@ -3,8 +3,8 @@
[QGVAR(burn), FUNC(burn)] call CBA_fnc_addEventHandler;
[QGVAR(playScream), {
params ["_scream", "_source"];
- // only play sound if enabled in settings
- if (GVAR(enableScreams)) then {
+ // only play sound if enabled in settings and enabled for the unit
+ if (GVAR(enableScreams) && {_source getVariable [QGVAR(enableScreams), true]}) then {
_source say3D _scream;
};
}] call CBA_fnc_addEventHandler;
@@ -35,4 +35,3 @@
GVAR(fireSources) = [[], nil] call CBA_fnc_hashCreate;
};
}] call CBA_fnc_addEventHandler;
-
diff --git a/docs/wiki/framework/fire-framework.md b/docs/wiki/framework/fire-framework.md
index 2236c5a1c8..4f9ecdfdd3 100644
--- a/docs/wiki/framework/fire-framework.md
+++ b/docs/wiki/framework/fire-framework.md
@@ -37,3 +37,12 @@ Use `CBA_fnc_serverEvent` to use the following features. Events are defined only
| Arguments | Type | Optional (default value)
---| --------- | ---- | ------------------------
0 | Fire source ID | Any | Required
+
+
+## 2. Variables
+
+Screams can be disabled for an individual unit by setting the `ace_fire_enableScreams` variable on the unit, which can be synced across machines.
+
+```sqf
+_unit setVariable ["ace_fire_enableScreams", false, _isGlobal];
+```
From b4eaa1e27049280d940a0c9aa32bda9310b89302 Mon Sep 17 00:00:00 2001
From: johnb432 <58661205+johnb432@users.noreply.github.com>
Date: Thu, 21 Mar 2024 20:24:49 +0100
Subject: [PATCH 08/11] Advanced Fatigue - Disable sway when Advanced Fatigue
is off (#9867)
Disabled sway when advanced fatigue is off
---
addons/advanced_fatigue/XEH_postInit.sqf | 58 ++++++++++++------------
1 file changed, 29 insertions(+), 29 deletions(-)
diff --git a/addons/advanced_fatigue/XEH_postInit.sqf b/addons/advanced_fatigue/XEH_postInit.sqf
index db4a9d9c5e..ff09464901 100644
--- a/addons/advanced_fatigue/XEH_postInit.sqf
+++ b/addons/advanced_fatigue/XEH_postInit.sqf
@@ -2,35 +2,6 @@
if (!hasInterface) exitWith {};
-["baseline", {
- private _fatigue = ACE_player getVariable [QGVAR(aimFatigue), 0];
- switch (stance ACE_player) do {
- case ("CROUCH"): {
- (1.0 + _fatigue ^ 2 * 0.1)
- };
- case ("PRONE"): {
- (1.0 + _fatigue ^ 2 * 2.0)
- };
- default {
- (1.5 + _fatigue ^ 2 * 3.0)
- };
- };
-}, QUOTE(ADDON)] call EFUNC(common,addSwayFactor);
-
-["multiplier", {
- switch (true) do {
- case (isWeaponRested ACE_player): {
- GVAR(swayFactor) * GVAR(restedSwayFactor)
- };
- case (isWeaponDeployed ACE_player): {
- GVAR(swayFactor) * GVAR(deployedSwayFactor)
- };
- default {
- GVAR(swayFactor)
- };
- };
-}, QUOTE(ADDON)] call EFUNC(common,addSwayFactor);
-
// recheck weapon inertia after weapon swap, change of attachments or switching unit
["weapon", {[ACE_player] call FUNC(getWeaponInertia)}, true] call CBA_fnc_addPlayerEventHandler;
["loadout", {[ACE_player] call FUNC(getWeaponInertia)}, true] call CBA_fnc_addPlayerEventHandler;
@@ -39,6 +10,35 @@ if (!hasInterface) exitWith {};
["CBA_settingsInitialized", {
if (!GVAR(enabled)) exitWith {};
+ ["baseline", {
+ private _fatigue = ACE_player getVariable [QGVAR(aimFatigue), 0];
+ switch (stance ACE_player) do {
+ case ("CROUCH"): {
+ (1.0 + _fatigue ^ 2 * 0.1)
+ };
+ case ("PRONE"): {
+ (1.0 + _fatigue ^ 2 * 2.0)
+ };
+ default {
+ (1.5 + _fatigue ^ 2 * 3.0)
+ };
+ };
+ }, QUOTE(ADDON)] call EFUNC(common,addSwayFactor);
+
+ ["multiplier", {
+ switch (true) do {
+ case (isWeaponRested ACE_player): {
+ GVAR(swayFactor) * GVAR(restedSwayFactor)
+ };
+ case (isWeaponDeployed ACE_player): {
+ GVAR(swayFactor) * GVAR(deployedSwayFactor)
+ };
+ default {
+ GVAR(swayFactor)
+ };
+ };
+ }, QUOTE(ADDON)] call EFUNC(common,addSwayFactor);
+
// - Post process effect ------------------------------------------------------
GVAR(ppeBlackout) = ppEffectCreate ["ColorCorrections", 4220];
GVAR(ppeBlackout) ppEffectEnable true;
From 50978efa460b33c10fc26e6de705708b34cc6c93 Mon Sep 17 00:00:00 2001
From: johnb432 <58661205+johnb432@users.noreply.github.com>
Date: Thu, 21 Mar 2024 20:26:46 +0100
Subject: [PATCH 09/11] Hearing - Removed `remoteExec` & added
microoptimisations (#9853)
* Removed remoteExec. added microoptimisations
* Update addons/hearing/XEH_preInit.sqf
Co-authored-by: PabstMirror
* move EH to after !hasInterface
---------
Co-authored-by: PabstMirror
---
addons/hearing/XEH_postInit.sqf | 2 ++
addons/hearing/XEH_preInit.sqf | 3 ++-
addons/hearing/functions/fnc_addEarPlugs.sqf | 26 +++++++++++---------
3 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/addons/hearing/XEH_postInit.sqf b/addons/hearing/XEH_postInit.sqf
index c387ed04d8..f8f5c2938f 100644
--- a/addons/hearing/XEH_postInit.sqf
+++ b/addons/hearing/XEH_postInit.sqf
@@ -23,6 +23,8 @@ GVAR(lastPlayerVehicle) = objNull;
// Spawn volume updating process
[LINKFUNC(updateVolume), 1, [false]] call CBA_fnc_addPerFrameHandler;
+ [QGVAR(updateVolume), LINKFUNC(updateVolume)] call CBA_fnc_addEventHandler;
+
// Update veh attunation when player veh changes
["vehicle", {
params ["_player", "_vehicle"];
diff --git a/addons/hearing/XEH_preInit.sqf b/addons/hearing/XEH_preInit.sqf
index 2ab07c31e6..7a6195ec46 100644
--- a/addons/hearing/XEH_preInit.sqf
+++ b/addons/hearing/XEH_preInit.sqf
@@ -12,7 +12,8 @@ PREP_RECOMPILE_END;
params ["_unit", "_loadout", "_extendedInfo"];
if (_extendedInfo getOrDefault ["ace_earplugs", false]) then {
_unit setVariable ["ACE_hasEarPlugsIn", true, true];
- [[true]] remoteExec [QFUNC(updateVolume), _unit];
+
+ [QGVAR(updateVolume), [[true]], _unit] call CBA_fnc_targetEvent;
};
}] call CBA_fnc_addEventHandler;
diff --git a/addons/hearing/functions/fnc_addEarPlugs.sqf b/addons/hearing/functions/fnc_addEarPlugs.sqf
index f467352410..c541d78618 100644
--- a/addons/hearing/functions/fnc_addEarPlugs.sqf
+++ b/addons/hearing/functions/fnc_addEarPlugs.sqf
@@ -15,14 +15,14 @@
* Public: No
*/
-params ["_unit"];
-TRACE_2("params",_unit,typeOf _unit);
-
// only run this after the settings are initialized
if !(EGVAR(common,settingsInitFinished)) exitWith {
EGVAR(common,runAtSettingsInitialized) pushBack [FUNC(addEarPlugs), _this];
};
+params ["_unit"];
+TRACE_2("params",_unit,typeOf _unit);
+
// Exit if hearing is disabled OR autoAdd is disabled OR soldier has earplugs already in (persistence scenarios)
if (!GVAR(enableCombatDeafness) || {!GVAR(autoAddEarplugsToUnits)} || {[_unit] call FUNC(hasEarPlugsIn)}) exitWith {};
@@ -38,16 +38,20 @@ if ((primaryWeapon _unit) == "") exitWith {};
(primaryWeaponMagazine _unit) params [["_magazine", ""]];
if (_magazine == "") exitWith {};
-private _initSpeed = getNumber (configFile >> "CfgMagazines" >> _magazine >> "initSpeed");
-private _ammo = getText (configFile >> "CfgMagazines" >> _magazine >> "ammo");
-private _count = getNumber (configFile >> "CfgMagazines" >> _magazine >> "count");
+private _cfgMagazine = configFile >> "CfgMagazines" >> _magazine;
-private _caliber = getNumber (configFile >> "CfgAmmo" >> _ammo >> "ACE_caliber");
+private _initSpeed = getNumber (_cfgMagazine >> "initSpeed");
+private _ammo = getText (_cfgMagazine >> "ammo");
+private _count = getNumber (_cfgMagazine >> "count");
+
+private _cfgAmmo = configFile >> "CfgAmmo";
+
+private _caliber = getNumber (_cfgAmmo >> _ammo >> "ACE_caliber");
_caliber = call {
- if (_ammo isKindOf ["ShellBase", (configFile >> "CfgAmmo")]) exitWith { 80 };
- if (_ammo isKindOf ["RocketBase", (configFile >> "CfgAmmo")]) exitWith { 200 };
- if (_ammo isKindOf ["MissileBase", (configFile >> "CfgAmmo")]) exitWith { 600 };
- if (_ammo isKindOf ["SubmunitionBase", (configFile >> "CfgAmmo")]) exitWith { 80 };
+ if (_ammo isKindOf ["ShellBase", _cfgAmmo]) exitWith { 80 };
+ if (_ammo isKindOf ["RocketBase", _cfgAmmo]) exitWith { 200 };
+ if (_ammo isKindOf ["MissileBase", _cfgAmmo]) exitWith { 600 };
+ if (_ammo isKindOf ["SubmunitionBase", _cfgAmmo]) exitWith { 80 };
[_caliber, 6.5] select (_caliber <= 0);
};
private _loudness = (_caliber ^ 1.25 / 10) * (_initspeed / 1000) / 5;
From 3c5b46c42dd2f269ac8f52548d65ce0ed14e9ced Mon Sep 17 00:00:00 2001
From: BrettMayson
Date: Thu, 21 Mar 2024 15:56:24 -0600
Subject: [PATCH 10/11] Medical - Support Magazine Treatment Items (#9816)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* count treatment items
* getCountofItem
Co-Authored-By: Blue
* getCountofItem fix
Co-Authored-By: Blue
* convert painkillers to magazine
* use isclass
Co-Authored-By: johnb432 <58661205+johnb432@users.noreply.github.com>
* forget to change variable
* Update addons/medical_treatment/functions/fnc_hasItem.sqf
Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com>
* better magazine adjustment
* Update addons/common/functions/fnc_adjustMagazineAmmo.sqf
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
* Update addons/medical_treatment/functions/fnc_medication.sqf
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
* Update addons/medical_treatment/functions/fnc_treatmentFailure.sqf
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
* Update docs/wiki/framework/arsenal-framework.md
Co-authored-by: Jouni Järvinen
* Update addons/common/functions/fnc_adjustMagazineAmmo.sqf
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
* Header
* use switch statement in fnc_useItem
* Update addons/common/functions/fnc_adjustMagazineAmmo.sqf
* Update addons/common/functions/fnc_adjustMagazineAmmo.sqf
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
* only check adding to mags that are not full
Co-Authored-By: LinkIsGrim
* Update addons/common/functions/fnc_adjustMagazineAmmo.sqf
* Update fnc_getCountOfItem.sqf
* Optimisations & header fix
* Update addons/common/functions/fnc_adjustMagazineAmmo.sqf
* Fixed vehicle implementation
---------
Co-authored-by: Blue
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com>
Co-authored-by: Jouni Järvinen
Co-authored-by: LinkIsGrim
---
.../functions/fnc_addRightPanelButton.sqf | 3 +-
addons/arsenal/functions/fnc_scanConfig.sqf | 2 +-
addons/common/XEH_PREP.hpp | 1 +
.../functions/fnc_adjustMagazineAmmo.sqf | 107 ++++++++++++++++++
.../common/functions/fnc_getCountOfItem.sqf | 22 ++--
addons/common/functions/fnc_uniqueItems.sqf | 73 +++++++++---
.../functions/fnc_countTreatmentItems.sqf | 23 +++-
addons/medical_treatment/CfgMagazines.hpp | 16 +++
addons/medical_treatment/CfgVehicles.hpp | 12 +-
addons/medical_treatment/CfgWeapons.hpp | 13 ---
addons/medical_treatment/config.cpp | 1 +
.../functions/fnc_hasItem.sqf | 3 +-
.../functions/fnc_medication.sqf | 3 +-
.../functions/fnc_treatmentFailure.sqf | 6 +-
.../functions/fnc_useItem.sqf | 31 +++--
docs/wiki/framework/arsenal-framework.md | 3 +-
16 files changed, 261 insertions(+), 58 deletions(-)
create mode 100644 addons/common/functions/fnc_adjustMagazineAmmo.sqf
create mode 100644 addons/medical_treatment/CfgMagazines.hpp
diff --git a/addons/arsenal/functions/fnc_addRightPanelButton.sqf b/addons/arsenal/functions/fnc_addRightPanelButton.sqf
index 6e1035a86a..a1bdb09d1d 100644
--- a/addons/arsenal/functions/fnc_addRightPanelButton.sqf
+++ b/addons/arsenal/functions/fnc_addRightPanelButton.sqf
@@ -66,7 +66,8 @@ _items = _items select {
_x isKindOf ["CBA_MiscItem", _cfgWeapons] && {getNumber (_configItemInfo >> "type") in [TYPE_MUZZLE, TYPE_OPTICS, TYPE_FLASHLIGHT, TYPE_BIPOD]} ||
{getNumber (_configItemInfo >> "type") in [TYPE_FIRST_AID_KIT, TYPE_MEDIKIT, TYPE_TOOLKIT]} ||
{getText (_cfgWeapons >> _x >> "simulation") == "ItemMineDetector"} ||
- {getNumber (_cfgMagazines >> _x >> "ACE_isUnique") == 1}
+ {getNumber (_cfgMagazines >> _x >> "ACE_isUnique") == 1} ||
+ {getNumber (_cfgMagazines >> _x >> "ACE_asItem") == 1}
};
GVAR(customRightPanelButtons) set [_position, [_items apply {_x call EFUNC(common,getConfigName)}, _picture, _tooltip, _moveOnOverwrite]];
diff --git a/addons/arsenal/functions/fnc_scanConfig.sqf b/addons/arsenal/functions/fnc_scanConfig.sqf
index 105eb3479a..fef97e8bd8 100644
--- a/addons/arsenal/functions/fnc_scanConfig.sqf
+++ b/addons/arsenal/functions/fnc_scanConfig.sqf
@@ -160,7 +160,7 @@ private _magazineMiscItems = createHashMap;
{
_magazineMiscItems set [configName _x, nil];
-} forEach ((toString {getNumber (_x >> "ACE_isUnique") == 1}) configClasses _cfgMagazines);
+} forEach ((toString {getNumber (_x >> "ACE_isUnique") == 1 || getNumber (_x >> "ACE_asItem") == 1}) configClasses _cfgMagazines);
// Remove invalid/non-existent entries
_grenadeList deleteAt "";
diff --git a/addons/common/XEH_PREP.hpp b/addons/common/XEH_PREP.hpp
index ce6ac334ee..fb64d464df 100644
--- a/addons/common/XEH_PREP.hpp
+++ b/addons/common/XEH_PREP.hpp
@@ -13,6 +13,7 @@ PREP(addLineToDebugDraw);
PREP(addSwayFactor);
PREP(addToInventory);
PREP(addWeapon);
+PREP(adjustMagazineAmmo);
PREP(assignedItemFix);
PREP(assignObjectsInList);
PREP(ambientBrightness);
diff --git a/addons/common/functions/fnc_adjustMagazineAmmo.sqf b/addons/common/functions/fnc_adjustMagazineAmmo.sqf
new file mode 100644
index 0000000000..87d5b9e899
--- /dev/null
+++ b/addons/common/functions/fnc_adjustMagazineAmmo.sqf
@@ -0,0 +1,107 @@
+#include "..\script_component.hpp"
+/*
+ * Author: Katalam, Blue, Brett Mayson, johnb43
+ * Handle adjusting a magazine's ammo
+ *
+ * Arguments:
+ * 0: Vehicle or Unit
+ * 1: Item
+ * 2: Ammo to adjust by (default: -1)
+ *
+ * Return Value:
+ * How much the ammo was adjusted by
+ *
+ * Example:
+ * [player, "30Rnd_556x45_Stanag", 1] call ace_common_fnc_adjustMagazineAmmo;
+ *
+ * Public: No
+ */
+
+params ["_unit", "_magazine", ["_count", -1]];
+
+if (_count == 0) exitWith {0};
+
+private _containers = if (_unit isKindOf "CAManBase") then {
+ [uniformContainer _unit, vestContainer _unit, backpackContainer _unit]
+} else {
+ [_unit]
+};
+
+scopeName "main";
+
+private _originalCount = _count;
+private _container = objNull;
+private _magazinesContainer = [];
+private _newAmmoCount = 0;
+private _removeAmmo = _count < 0;
+private _maxMagazineAmmo = getNumber (configFile >> "CfgMagazines" >> _magazine >> "count");
+
+{
+ _container = _x;
+
+ // Get all magazines of _magazine type
+ _magazinesContainer = (magazinesAmmoCargo _container) select {_x select 0 == _magazine};
+
+ // Get the ammo count, filter out magazines with 0 ammo
+ _magazinesContainer = (_magazinesContainer apply {_x select 1}) select {_x != 0};
+
+ // If there are none, skip to next container
+ if (_magazinesContainer isEqualTo []) then {
+ continue;
+ };
+
+ // Sort, smallest first when removing, largest first when adding
+ _magazinesContainer sort _removeAmmo;
+
+ if (_removeAmmo) then {
+ {
+ _count = _x + _count;
+
+ _container addMagazineAmmoCargo [_magazine, -1, _x];
+
+ if (_count >= 0) then {
+ // Only add magazine back if it's not empty
+ if (_count != 0) then {
+ _container addMagazineAmmoCargo [_magazine, 1, _count];
+ };
+
+ _originalCount breakOut "main";
+ };
+ } forEach _magazinesContainer;
+ } else {
+ // This loop only fills up partially filled magazines
+ {
+ // Fill the magazine to either its max or until all ammo has been added
+ _newAmmoCount = (_x + _count) min _maxMagazineAmmo;
+
+ if (_newAmmoCount <= _maxMagazineAmmo) then {
+ _container addMagazineAmmoCargo [_magazine, -1, _x];
+ _container addMagazineAmmoCargo [_magazine, 1, _newAmmoCount];
+ };
+
+ // Remove the ammo that was added
+ _count = _count - (_newAmmoCount - _x);
+
+ if (_count <= 0) then {
+ _originalCount breakOut "main";
+ };
+ } forEach (_magazinesContainer select {_x < _maxMagazineAmmo});
+ };
+} forEach _containers;
+
+// If there is still remaining ammo to add, try add it after having iterated through all containers
+if (!_removeAmmo && _count > 0) then {
+ {
+ while {_count > 0 && {_x canAdd [_magazine, 1/* 2.18 , true*/]}} do {
+ _x addMagazineAmmoCargo [_magazine, 1, _count];
+
+ _count = _count - _maxMagazineAmmo;
+ };
+ } forEach _containers;
+
+ if (_count <= 0) then {
+ _originalCount breakOut "main";
+ };
+};
+
+_originalCount - _count
diff --git a/addons/common/functions/fnc_getCountOfItem.sqf b/addons/common/functions/fnc_getCountOfItem.sqf
index 5667b6c980..5114f375d2 100644
--- a/addons/common/functions/fnc_getCountOfItem.sqf
+++ b/addons/common/functions/fnc_getCountOfItem.sqf
@@ -1,6 +1,6 @@
#include "..\script_component.hpp"
/*
- * Author: Dedmen
+ * Author: Dedmen, Blue, johnb43
* Return how many items of type _itemType the player has in his containers (Uniform, Vest, Backpack)
* Doesn't count assignedItems, weapons, weapon attachments, magazines in weapons
*
@@ -19,13 +19,17 @@
params ["_unit", "_itemType"];
-private _countItemsInContainer = {
- (getItemCargo _this) params ["_itemTypes", "_itemCounts"];
+private _count = 0;
+private _isMagazine = isClass (configFile >> "CfgMagazines" >> _itemType);
- private _index = _itemTypes find _itemType;
- _itemCounts param [_index, 0]
-};
+{
+ (if (_isMagazine) then {
+ getMagazineCargo _x
+ } else {
+ getItemCargo _x
+ }) params ["_itemTypes", "_itemCounts"];
-((uniformContainer _unit) call _countItemsInContainer) +
-((vestContainer _unit) call _countItemsInContainer) +
-((backpackContainer _unit) call _countItemsInContainer)
+ _count = _count + (_itemCounts param [_itemTypes find _itemType, 0]);
+} forEach [uniformContainer _unit, vestContainer _unit, backpackContainer _unit];
+
+_count
diff --git a/addons/common/functions/fnc_uniqueItems.sqf b/addons/common/functions/fnc_uniqueItems.sqf
index dc783ebbea..204501ca3f 100644
--- a/addons/common/functions/fnc_uniqueItems.sqf
+++ b/addons/common/functions/fnc_uniqueItems.sqf
@@ -1,37 +1,84 @@
#include "..\script_component.hpp"
/*
- * Author: mharis001
- * Returns list of unique items in a unit's inventory.
- * Items are cached if unit is ACE_player.
+ * Author: mharis001, Blue, Brett Mayson
+ * Returns list of unique items in the target's inventory.
*
* Arguments:
- * 0: Unit
+ * 0: Target
+ * 1: Include magazines
+ * 0: No (default)
+ * 1: Yes
+ * 2: Only magazines
*
* Return Value:
* Items
*
* Example:
- * [player] call ace_common_fnc_uniqueItems
+ * [player, 2] call ace_common_fnc_uniqueItems
*
* Public: No
*/
-params ["_unit"];
+params ["_target", ["_includeMagazines", 0]];
private _fnc_getItems = {
- private _items = (getItemCargo uniformContainer _unit) select 0;
- _items append ((getItemCargo vestContainer _unit) select 0);
- _items append ((getItemCargo backpackContainer _unit) select 0);
+ private _items = [];
+
+ private _inventoryItems = (getItemCargo uniformContainer _target) select 0;
+ _inventoryItems append ((getItemCargo vestContainer _target) select 0);
+ _inventoryItems append ((getItemCargo backpackContainer _target) select 0);
+
+ _items set [0, _inventoryItems];
+ _items set [1, magazines _target];
_items arrayIntersect _items
};
-// Use cached items list if unit is ACE_player
-if (_unit isEqualTo ACE_player) then {
+// Cache items list if unit is ACE_player
+if (_target isEqualTo ACE_player) then {
if (isNil QGVAR(uniqueItemsCache)) then {
GVAR(uniqueItemsCache) = call _fnc_getItems;
};
- +GVAR(uniqueItemsCache)
+
+ switch (_includeMagazines) do {
+ case 0: {
+ GVAR(uniqueItemsCache) select 0
+ };
+ case 1: {
+ (GVAR(uniqueItemsCache) select 1) + (GVAR(uniqueItemsCache) select 0)
+ };
+ case 2: {
+ GVAR(uniqueItemsCache) select 1
+ };
+ };
} else {
- call _fnc_getItems;
+ if (_target isKindOf "CAManBase") then {
+ private _items = call _fnc_getItems;
+
+ switch (_includeMagazines) do {
+ case 0: {
+ _items select 0
+ };
+ case 1: {
+ (_items select 1) + (_items select 0)
+ };
+ case 2: {
+ _items select 1
+ };
+ };
+ } else {
+ private _items = switch (_includeMagazines) do {
+ case 0: {
+ itemCargo _target
+ };
+ case 1: {
+ (magazineCargo _target) + (itemCargo _target)
+ };
+ case 2: {
+ magazineCargo _target
+ };
+ };
+
+ _items arrayIntersect _items
+ };
};
diff --git a/addons/medical_gui/functions/fnc_countTreatmentItems.sqf b/addons/medical_gui/functions/fnc_countTreatmentItems.sqf
index 6e8394c82f..ac7c4857e6 100644
--- a/addons/medical_gui/functions/fnc_countTreatmentItems.sqf
+++ b/addons/medical_gui/functions/fnc_countTreatmentItems.sqf
@@ -42,12 +42,27 @@ private _vehicle = [_patientVehicle, _medicVehicle] select (!isNull _medicVehicl
if (!isNull _vehicle) then {
_vehicleCount = 0;
- (getItemCargo _vehicle) params ["_itemTypes", "_itemCounts"];
+ private _magazineItems = [];
+ private _itemItems = [];
{
- private _item = _x;
- private _index = _itemTypes find _item;
- _vehicleCount = _vehicleCount + (_itemCounts param [_index, 0]);
+ if (isClass (configFile >> "CfgMagazines" >> _x)) then {
+ _magazineItems pushBack _x;
+ } else {
+ _itemItems pushBack _x;
+ };
} forEach _items;
+ if (_magazineItems isNotEqualTo []) then {
+ (getMagazineCargo _vehicle) params ["_itemTypes", "_itemCounts"];
+ {
+ _vehicleCount = _vehicleCount + (_itemCounts param [_itemTypes find _x, 0]);
+ } forEach _magazineItems;
+ };
+ if (_itemItems isNotEqualTo []) then {
+ (getItemCargo _vehicle) params ["_itemTypes", "_itemCounts"];
+ {
+ _vehicleCount = _vehicleCount + (_itemCounts param [_itemTypes find _x, 0]);
+ } forEach _itemItems;
+ };
};
[_medicCount, _patientCount, _vehicleCount]
diff --git a/addons/medical_treatment/CfgMagazines.hpp b/addons/medical_treatment/CfgMagazines.hpp
new file mode 100644
index 0000000000..c4daafab76
--- /dev/null
+++ b/addons/medical_treatment/CfgMagazines.hpp
@@ -0,0 +1,16 @@
+class CfgMagazines {
+ class CA_Magazine;
+ class ACE_painkillers: CA_Magazine {
+ scope = 2;
+ author = ECSTRING(common,ACETeam);
+ displayName = CSTRING(painkillers_Display);
+ model = "\A3\Structures_F_EPA\Items\Medical\PainKillers_F.p3d";
+ picture = QPATHTOF(ui\painkillers_ca.paa);
+ descriptionShort = CSTRING(painkillers_Desc_Short);
+ descriptionUse = CSTRING(painkillers_Desc_Use);
+ ACE_isMedicalItem = 1;
+ ACE_asItem = 1;
+ count = 10;
+ mass = 1;
+ };
+};
diff --git a/addons/medical_treatment/CfgVehicles.hpp b/addons/medical_treatment/CfgVehicles.hpp
index bcecdb155e..4f922eb199 100644
--- a/addons/medical_treatment/CfgVehicles.hpp
+++ b/addons/medical_treatment/CfgVehicles.hpp
@@ -290,8 +290,8 @@ class CfgVehicles {
displayName = CSTRING(painkillers_Display);
author = "Alganthe";
vehicleClass = "Items";
- class TransportItems {
- MACRO_ADDITEM(ACE_painkillers,1);
+ class TransportMagazines {
+ MACRO_ADDMAGAZINE(ACE_painkillers,1);
};
};
@@ -313,9 +313,11 @@ class CfgVehicles {
model = QPATHTOF(data\ace_medcrate.p3d);
editorPreview = QPATHTOF(data\ACE_medicalSupplyCrate.jpg);
author = ECSTRING(common,ACETeam);
+ class TransportMagazines {
+ MACRO_ADDMAGAZINE(ACE_painkillers,25);
+ };
class TransportItems {
MACRO_ADDITEM(ACE_fieldDressing,50);
- MACRO_ADDITEM(ACE_painkillers,25);
MACRO_ADDITEM(ACE_morphine,25);
MACRO_ADDITEM(ACE_epinephrine,25);
MACRO_ADDITEM(ACE_bloodIV,15);
@@ -357,13 +359,15 @@ class CfgVehicles {
};
class ACE_medicalSupplyCrate_advanced: ACE_medicalSupplyCrate {
displayName = CSTRING(medicalSupplyCrate_advanced);
+ class TransportMagazines {
+ MACRO_ADDMAGAZINE(ACE_painkillers,15);
+ };
class TransportItems {
MACRO_ADDITEM(ACE_fieldDressing,25);
MACRO_ADDITEM(ACE_packingBandage,25);
MACRO_ADDITEM(ACE_elasticBandage,25);
MACRO_ADDITEM(ACE_tourniquet,15);
MACRO_ADDITEM(ACE_splint,15);
- MACRO_ADDITEM(ACE_painkillers,15);
MACRO_ADDITEM(ACE_morphine,15);
MACRO_ADDITEM(ACE_adenosine,15);
MACRO_ADDITEM(ACE_epinephrine,15);
diff --git a/addons/medical_treatment/CfgWeapons.hpp b/addons/medical_treatment/CfgWeapons.hpp
index 31b98bd843..7b31e10bee 100644
--- a/addons/medical_treatment/CfgWeapons.hpp
+++ b/addons/medical_treatment/CfgWeapons.hpp
@@ -310,17 +310,4 @@ class CfgWeapons {
hiddenSelectionsTextures[] = {QPATHTOF(data\bodybagItem_white_co.paa)};
GVAR(bodyBagObject) = "ACE_bodyBagObject_white";
};
- class ACE_painkillers: ACE_ItemCore {
- scope = 2;
- author = "Alganthe";
- displayName = CSTRING(painkillers_Display);
- model = "\A3\Structures_F_EPA\Items\Medical\PainKillers_F.p3d";
- picture = QPATHTOF(ui\painkillers_ca.paa);
- descriptionShort = CSTRING(painkillers_Desc_Short);
- descriptionUse = CSTRING(painkillers_Desc_Use);
- ACE_isMedicalItem = 1;
- class ItemInfo: CBA_MiscItem_ItemInfo {
- mass = 1;
- };
- };
};
diff --git a/addons/medical_treatment/config.cpp b/addons/medical_treatment/config.cpp
index 75166a0f0c..3782645019 100644
--- a/addons/medical_treatment/config.cpp
+++ b/addons/medical_treatment/config.cpp
@@ -30,5 +30,6 @@ class CfgPatches {
#include "CfgVehicles.hpp"
#include "CfgWeapons.hpp"
#include "Cfg3DEN.hpp"
+#include "CfgMagazines.hpp"
#endif
diff --git a/addons/medical_treatment/functions/fnc_hasItem.sqf b/addons/medical_treatment/functions/fnc_hasItem.sqf
index e84a79f142..e0ef4c8a4f 100644
--- a/addons/medical_treatment/functions/fnc_hasItem.sqf
+++ b/addons/medical_treatment/functions/fnc_hasItem.sqf
@@ -25,10 +25,11 @@ params ["_medic", "_patient", "_items"];
private _fnc_checkItems = {
params ["_unit"];
- private _unitItems = _unit call EFUNC(common,uniqueItems);
+ private _unitItems = [_unit, 1] call EFUNC(common,uniqueItems);
private _unitVehicle = objectParent _unit;
if (!isNull _unitVehicle) then {
_unitItems append (itemCargo _unitVehicle);
+ _unitItems append (magazineCargo _unitVehicle);
};
_items findIf {_x in _unitItems} != -1
};
diff --git a/addons/medical_treatment/functions/fnc_medication.sqf b/addons/medical_treatment/functions/fnc_medication.sqf
index b69a63e994..dfd08d4de2 100644
--- a/addons/medical_treatment/functions/fnc_medication.sqf
+++ b/addons/medical_treatment/functions/fnc_medication.sqf
@@ -23,6 +23,7 @@
params ["_medic", "_patient", "_bodyPart", "_classname", "", "_usedItem"];
[_patient, _usedItem] call FUNC(addToTriageCard);
-[_patient, "activity", LSTRING(Activity_usedItem), [[_medic, false, true] call EFUNC(common,getName), getText (configFile >> "CfgWeapons" >> _usedItem >> "displayName")]] call FUNC(addToLog);
+private _cfg = ["CfgWeapons", "CfgMagazines"] select (isClass (configFile >> "CfgMagazines" >> _usedItem));
+[_patient, "activity", LSTRING(Activity_usedItem), [[_medic, false, true] call EFUNC(common,getName), getText (configFile >> _cfg >> _usedItem >> "displayName")]] call FUNC(addToLog);
[QGVAR(medicationLocal), [_patient, _bodyPart, _classname], _patient] call CBA_fnc_targetEvent;
diff --git a/addons/medical_treatment/functions/fnc_treatmentFailure.sqf b/addons/medical_treatment/functions/fnc_treatmentFailure.sqf
index 64d18fa830..42323922a3 100644
--- a/addons/medical_treatment/functions/fnc_treatmentFailure.sqf
+++ b/addons/medical_treatment/functions/fnc_treatmentFailure.sqf
@@ -23,7 +23,11 @@ _args params ["_medic", "_patient", "_bodyPart", "_classname", "_itemUser", "_us
// Return used item to user (if used)
if (!isNull _itemUser) then {
- [_itemUser, _usedItem] call EFUNC(common,addToInventory);
+ if (isClass (configFile >> "CfgMagazines" >> _usedItem)) then {
+ [_itemUser, _usedItem, 1] call EFUNC(common,adjustMagazineAmmo);
+ } else {
+ [_itemUser, _usedItem] call EFUNC(common,addToInventory);
+ };
};
// Switch medic to end animation immediately
diff --git a/addons/medical_treatment/functions/fnc_useItem.sqf b/addons/medical_treatment/functions/fnc_useItem.sqf
index 1f1d7c8355..9bba3d1c90 100644
--- a/addons/medical_treatment/functions/fnc_useItem.sqf
+++ b/addons/medical_treatment/functions/fnc_useItem.sqf
@@ -29,18 +29,31 @@ scopeName "Main";
private _useOrder = [[_patient, _medic], [_medic, _patient], [_medic]] select GVAR(allowSharedEquipment);
{
- private _unit = _x;
+ private _unit = _x;
private _unitVehicle = objectParent _unit;
- private _unitItems = _x call EFUNC(common,uniqueItems);
+ private _unitItems = [_x, 0] call EFUNC(common,uniqueItems);
+ private _unitMagazines = [_x, 2] call EFUNC(common,uniqueItems);
+ private _vehicleItems = itemCargo _unitVehicle; // [] for objNull
+ private _vehicleMagazines = magazineCargo _unitVehicle; // same
{
- if (!isNull _unitVehicle && {_x in (itemCargo _unitVehicle)}) then {
- _unitVehicle addItemCargoGlobal [_x, -1];
- [_unit, _x] breakOut "Main";
- };
- if (_x in _unitItems) then {
- _unit removeItem _x;
- [_unit, _x] breakOut "Main";
+ switch (true) do {
+ case (_x in _vehicleItems): {
+ _unitVehicle addItemCargoGlobal [_x, -1];
+ [_unit, _x] breakOut "Main";
+ };
+ case (_x in _vehicleMagazines): {
+ [_unitVehicle, _x] call EFUNC(common,adjustMagazineAmmo);
+ [_unit, _x] breakOut "Main";
+ };
+ case (_x in _unitItems): {
+ _unit removeItem _x;
+ [_unit, _x] breakOut "Main";
+ };
+ case (_x in _unitMagazines): {
+ [_unit, _x] call EFUNC(common,adjustMagazineAmmo);
+ [_unit, _x] breakOut "Main";
+ };
};
} forEach _items;
} forEach _useOrder;
diff --git a/docs/wiki/framework/arsenal-framework.md b/docs/wiki/framework/arsenal-framework.md
index 4691483e80..273a70836f 100644
--- a/docs/wiki/framework/arsenal-framework.md
+++ b/docs/wiki/framework/arsenal-framework.md
@@ -138,6 +138,7 @@ ACE Arsenal uses 2 existing config entries to sort and display items.
- `baseWeapon`: Class name that is used to display an item in the arsenal, used for weapon/attachment variants that are not normally shown to the player (AI variants, PIP optics, and so on). This property can be applied to any weapon or weapon attachment in `CfgWeapons`. Items using CBA or RHS' Scripted Optics systems, or CBA Switchable Attachments do not need this property explictly set, and will automatically use their player-accessible class.
- `ACE_isUnique`: Classes in `CfgMagazines` with this property set to `1` will be treated and shown by the Arsenal as Misc. Items. Used for items with attached data that needs to be kept track of, such as Notepads or Spare Barrels.
+- `ACE_asItem`: Classes in `CfgMagazines` with this property set to `1` will be treated and shown by the Arsenal as Items. Used for magazines that are not meant to be used in a weapon, such as Painkillers.
### 3.2 New config entries
@@ -159,7 +160,7 @@ ACE Medical Treatment and ACE Field Rations also add their own sub-categories, i
- `ACE_isMedicalItem`: Items with this property set to `1` will be sorted to the ACE Medical Tab.
- `ACE_isFieldRationItem`: Items with this property set to `1` will be sorted to the ACE Field Rations Tab.
-Only Misc. Items will be checked for these properties. Magazines must have ACE_isUnique property.
+Only Misc. Items will be checked for these properties. Magazines must have `ACE_isUnique` or `ACE_asItem` property.
## 4. Default loadouts
From 9a5cb8bd910bb3abc1401188c0e19632be5e2810 Mon Sep 17 00:00:00 2001
From: PabstMirror
Date: Thu, 21 Mar 2024 16:56:44 -0500
Subject: [PATCH 11/11] Maverick - Cleanup config (#9868)
---
addons/maverick/config.cpp | 4 ----
1 file changed, 4 deletions(-)
diff --git a/addons/maverick/config.cpp b/addons/maverick/config.cpp
index 6d5837f87d..d25878d004 100644
--- a/addons/maverick/config.cpp
+++ b/addons/maverick/config.cpp
@@ -9,10 +9,6 @@ class CfgPatches {
authors[] = {"xrufix"};
url = ECSTRING(main,URL);
VERSION_CONFIG;
- ammo[] = {
- QGVAR(L),
- "ace_kh25ml"
- };
magazines[] = {
QGVAR(L_magazine_x1),
QGVAR(L_pylonmissile_x1),