From da9c0c4fd46186c68ddac226f346c22c748433f3 Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Wed, 8 May 2024 09:58:12 +0200 Subject: [PATCH 01/17] Update fnc_replaceMagazineCargo.sqf --- addons/disposable/fnc_replaceMagazineCargo.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/disposable/fnc_replaceMagazineCargo.sqf b/addons/disposable/fnc_replaceMagazineCargo.sqf index 89e3da9e6..147d0413c 100644 --- a/addons/disposable/fnc_replaceMagazineCargo.sqf +++ b/addons/disposable/fnc_replaceMagazineCargo.sqf @@ -50,7 +50,7 @@ if (magazineCargo _box arrayIntersect GVAR(magazines) isEqualTo []) exitWith {}; private _magazines = magazinesAmmoCargo _box; clearMagazineCargoGlobal _box; -private _isBackpack = getNumber (configOf _box >> "isBackpack") != -1; +private _isBackpack = getNumber (configOf _box >> "isBackpack") == 1; { _x params ["_magazine", "_ammo"]; From 7e418dec791cb71ec4fcf50cf6988fe57077dceb Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Wed, 8 May 2024 10:04:02 +0200 Subject: [PATCH 02/17] Update fnc_replaceMagazineCargo.sqf --- addons/disposable/fnc_replaceMagazineCargo.sqf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/disposable/fnc_replaceMagazineCargo.sqf b/addons/disposable/fnc_replaceMagazineCargo.sqf index 147d0413c..023c3e87d 100644 --- a/addons/disposable/fnc_replaceMagazineCargo.sqf +++ b/addons/disposable/fnc_replaceMagazineCargo.sqf @@ -57,6 +57,8 @@ private _isBackpack = getNumber (configOf _box >> "isBackpack") == 1; if (_magazine in GVAR(magazines)) then { private _loadedLauncher = GVAR(MagazineLaunchers) getVariable _magazine; + + // As addWeaponCargoGlobal ignores allowedSlots, check here if launcher is allowed to be placed in a backpack if (!_isBackpack || {_loadedLauncher in GVAR(BackpackLaunchers)}) then { _box addWeaponCargoGlobal [_loadedLauncher, 1]; }; From f15eabdc7b0763f91ab8f07bf9af790790debc1d Mon Sep 17 00:00:00 2001 From: Hypoxic Date: Thu, 30 May 2024 00:06:26 -0400 Subject: [PATCH 03/17] Added "turretOpticsMode" player event handler Adds a player event handler to detect when the player changes turret zoom (FOV)- --- addons/events/fnc_addPlayerEventHandler.sqf | 36 +++++++++++++-------- addons/events/fnc_playerEvent.sqf | 9 ++++-- 2 files changed, 29 insertions(+), 16 deletions(-) diff --git a/addons/events/fnc_addPlayerEventHandler.sqf b/addons/events/fnc_addPlayerEventHandler.sqf index 7e3aebc74..7fd5b1b29 100644 --- a/addons/events/fnc_addPlayerEventHandler.sqf +++ b/addons/events/fnc_addPlayerEventHandler.sqf @@ -6,20 +6,21 @@ Description: Adds a player event handler. Possible events: - "unit" - player controlled unit changed - "weapon" - currently selected weapon change - "turretweapon" - currently selected turret weapon change - "muzzle" - currently selected muzzle change - "weaponMode" - currently selected weapon mode change - "loadout" - players loadout changed - "vehicle" - players current vehicle changed - "turret" - position in vehicle changed - "visionMode" - player changed to normal/night/thermal view - "cameraView" - camera mode changed ("Internal", "External", "Gunner" etc.) - "featureCamera" - camera changed (Curator, Arsenal, Spectator etc.) - "visibleMap" - opened or closed map - "group" - player group changes - "leader" - leader of player changes + "unit" - player controlled unit changed + "weapon" - currently selected weapon change + "turretweapon" - currently selected turret weapon change + "muzzle" - currently selected muzzle change + "weaponMode" - currently selected weapon mode change + "loadout" - players loadout changed + "vehicle" - players current vehicle changed + "turret" - position in vehicle changed + "turretOpticsMode" - turret zoom (FOV) changed + "visionMode" - player changed to normal/night/thermal view + "cameraView" - camera mode changed ("Internal", "External", "Gunner" etc.) + "featureCamera" - camera changed (Curator, Arsenal, Spectator etc.) + "visibleMap" - opened or closed map + "group" - player group changes + "leader" - leader of player changes Parameters: _type - Event handler type. @@ -103,6 +104,12 @@ private _id = switch (_type) do { }; [QGVAR(turretEvent), _function] call CBA_fnc_addEventHandler // return id }; + case "turretopticsmode": { + if (_applyRetroactively) then { + [GVAR(oldUnit), getTurretOpticsMode GVAR(oldUnit)] call _function; + }; + [QGVAR(turretOpticsModeEvent), _function] call CBA_fnc_addEventHandler; + }; case "visionmode": { if (_applyRetroactively) then { [GVAR(oldUnit), currentVisionMode GVAR(oldUnit), -1] call _function; @@ -158,6 +165,7 @@ if (_id != -1) then { GVAR(oldLoadoutNoAmmo) = []; GVAR(oldVehicle) = objNull; GVAR(oldTurret) = []; + GVAR(oldTurretOpticsMode) = -1; GVAR(oldVisionMode) = -1; GVAR(oldCameraView) = ""; GVAR(oldFeatureCamera) = ""; diff --git a/addons/events/fnc_playerEvent.sqf b/addons/events/fnc_playerEvent.sqf index 4bb8011f4..f3c35adab 100644 --- a/addons/events/fnc_playerEvent.sqf +++ b/addons/events/fnc_playerEvent.sqf @@ -44,7 +44,7 @@ private _state = [ _unit, group _unit, leader _unit, currentWeapon _unit, currentMuzzle _unit, currentWeaponMode _unit, getUnitLoadout _unit, _vehicle, _turret, _vehicle currentWeaponTurret _turret, - currentVisionMode _controlledEntity, cameraView + currentVisionMode _controlledEntity, cameraView, getTurretOpticsMode _unit ]; if (_state isNotEqualTo GVAR(oldState)) then { @@ -54,7 +54,7 @@ if (_state isNotEqualTo GVAR(oldState)) then { "", "_newGroup", "_newLeader", "_newWeapon", "_newMuzzle", "_newWeaponMode", "_newLoadout", "", "", "_newTurretWeapon", - "_newVisionMode", "_newCameraView" + "_newVisionMode", "_newCameraView", "_newTurretOpticsMode" ]; // These events should fire if the context of the state has changed. @@ -137,4 +137,9 @@ if (_state isNotEqualTo GVAR(oldState)) then { [QGVAR(cameraViewEvent), [_unit, _newCameraView, GVAR(oldCameraView)]] call CBA_fnc_localEvent; GVAR(oldCameraView) = _newCameraView; // This assignment may be returned. }; + + if (_newTurretOpticsMode isNotEqualTo GVAR(oldTurretOpticsMode)) then { + [QGVAR(turretOpticsModeEvent), [_unit, _newTurretOpticsMode, GVAR(oldTurretOpticsMode)]] call CBA_fnc_localEvent; + GVAR(oldTurretOpticsMode) = _newTurretOpticsMode; + }; }; From b328751a5e34e40b0cc8debba753da5b65509859 Mon Sep 17 00:00:00 2001 From: Hypoxic <60307173+hypoxia125@users.noreply.github.com> Date: Thu, 30 May 2024 00:31:22 -0400 Subject: [PATCH 04/17] Update addons/events/fnc_addPlayerEventHandler.sqf Co-authored-by: PabstMirror --- addons/events/fnc_addPlayerEventHandler.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/events/fnc_addPlayerEventHandler.sqf b/addons/events/fnc_addPlayerEventHandler.sqf index 7fd5b1b29..7f7c3d83b 100644 --- a/addons/events/fnc_addPlayerEventHandler.sqf +++ b/addons/events/fnc_addPlayerEventHandler.sqf @@ -106,7 +106,7 @@ private _id = switch (_type) do { }; case "turretopticsmode": { if (_applyRetroactively) then { - [GVAR(oldUnit), getTurretOpticsMode GVAR(oldUnit)] call _function; + [GVAR(oldUnit), getTurretOpticsMode GVAR(oldUnit), -1] call _function; }; [QGVAR(turretOpticsModeEvent), _function] call CBA_fnc_addEventHandler; }; From 9c1b977aaf0f55af8cc7b2a375e1ead486a8b389 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Mon, 10 Jun 2024 21:22:51 -0500 Subject: [PATCH 05/17] General - Cleanup event capitalization --- addons/keybinding/fnc_gui_editKey.sqf | 2 +- addons/ui/flexiMenu/fnc_list.sqf | 4 ++-- addons/ui/flexiMenu/fnc_menu.sqf | 4 ++-- addons/ui/fnc_initDisplayInventory.sqf | 2 +- addons/ui/fnc_initDisplayRemoteMissions.sqf | 2 +- addons/xeh/fnc_init.sqf | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/addons/keybinding/fnc_gui_editKey.sqf b/addons/keybinding/fnc_gui_editKey.sqf index 5b4988aeb..c1f1e4028 100644 --- a/addons/keybinding/fnc_gui_editKey.sqf +++ b/addons/keybinding/fnc_gui_editKey.sqf @@ -350,7 +350,7 @@ _ctrlButtonUndo ctrlAddEventHandler ["ButtonClick", { }]; // --- update parent display if this one is closed -_display displayAddEventHandler ["unload", { +_display displayAddEventHandler ["Unload", { [] call FUNC(gui_update); }]; diff --git a/addons/ui/flexiMenu/fnc_list.sqf b/addons/ui/flexiMenu/fnc_list.sqf index 21dd92419..afda3206d 100644 --- a/addons/ui/flexiMenu/fnc_list.sqf +++ b/addons/ui/flexiMenu/fnc_list.sqf @@ -8,10 +8,10 @@ private _menuDefs = _this call FUNC(getMenuDef); // replace primary menu's key EH and menuDefs with same key EH but using secondary menu's menuDefs private _disp = uiNamespace getVariable QGVAR(display); -_disp displayRemoveEventHandler ["keyDown", GVAR(keyDownEHID)]; +_disp displayRemoveEventHandler ["KeyDown", GVAR(keyDownEHID)]; params ["", "_menuSources"]; -GVAR(keyDownEHID) = _disp displayAddEventHandler ["keyDown", +GVAR(keyDownEHID) = _disp displayAddEventHandler ["KeyDown", format ["[_this, [%1, %2]] call %3", QGVAR(target), _menuSources, QUOTE(FUNC(menuShortcut))]]; private _caption = if (count (_menuDefs select 0) > _flexiMenu_menuProperty_ID_menuDesc) then {_menuDefs select 0 select _flexiMenu_menuProperty_ID_menuDesc} else {""}; diff --git a/addons/ui/flexiMenu/fnc_menu.sqf b/addons/ui/flexiMenu/fnc_menu.sqf index 8809ff986..7f292e168 100644 --- a/addons/ui/flexiMenu/fnc_menu.sqf +++ b/addons/ui/flexiMenu/fnc_menu.sqf @@ -138,9 +138,9 @@ IfCountDefault(_caption,(_menuDefs select 0),_flexiMenu_menuProperty_ID_menuDesc (_disp displayCtrl _flexiMenu_IDC_listMenuDesc) ctrlShow false; _menuSources = _this select 1; -GVAR(keyDownEHID) = _disp displayAddEventHandler ["keyDown", format ["[_this, [%1, %2]] call %3", QGVAR(target), _menuSources, QUOTE(FUNC(menuShortcut))]]; +GVAR(keyDownEHID) = _disp displayAddEventHandler ["KeyDown", format ["[_this, [%1, %2]] call %3", QGVAR(target), _menuSources, QUOTE(FUNC(menuShortcut))]]; -_disp displayAddEventHandler ["mouseButtonDown", format ["_this call %1", QUOTE(FUNC(mouseButtonDown))]]; +_disp displayAddEventHandler ["MouseButtonDown", format ["_this call %1", QUOTE(FUNC(mouseButtonDown))]]; _idcIndex = 0; diff --git a/addons/ui/fnc_initDisplayInventory.sqf b/addons/ui/fnc_initDisplayInventory.sqf index 239297f0c..577e27bde 100644 --- a/addons/ui/fnc_initDisplayInventory.sqf +++ b/addons/ui/fnc_initDisplayInventory.sqf @@ -229,7 +229,7 @@ _vestItems setVariable [QGVAR(containerType), "VEST_CONTAINER"]; _backpackItems setVariable [QGVAR(containerType), "BACKPACK_CONTAINER"]; { - _x ctrlAddEventHandler ["lbDblClick", { + _x ctrlAddEventHandler ["LBDblClick", { params ["_control", "_index"]; private _unit = call CBA_fnc_currentUnit; diff --git a/addons/ui/fnc_initDisplayRemoteMissions.sqf b/addons/ui/fnc_initDisplayRemoteMissions.sqf index e39703e9b..7e1951c32 100644 --- a/addons/ui/fnc_initDisplayRemoteMissions.sqf +++ b/addons/ui/fnc_initDisplayRemoteMissions.sqf @@ -124,7 +124,7 @@ private _fnc_storeMapMissions = {_this spawn {isNil { // delay a frame }}}; _ctrlMaps call _fnc_storeMapMissions; -_ctrlMaps ctrlAddEventHandler ["lbSelChanged", _fnc_storeMapMissions]; +_ctrlMaps ctrlAddEventHandler ["LBSelChanged", _fnc_storeMapMissions]; // filter out missions we don't want _display setVariable [QFUNC(filter), { diff --git a/addons/xeh/fnc_init.sqf b/addons/xeh/fnc_init.sqf index dccb12ce8..45db4f488 100644 --- a/addons/xeh/fnc_init.sqf +++ b/addons/xeh/fnc_init.sqf @@ -47,7 +47,7 @@ if !(ISINITIALIZED(_this)) then { }; // fix for respawnVehicle clearing the object namespace - _this addEventHandler ["respawn", { + _this addEventHandler ["Respawn", { params ["_vehicle", "_wreck"]; if (ISINITIALIZED(_vehicle)) exitWith {}; // Exit if unit respawned normaly with copied variables (e.g. humans) From eedb28607471436b72da4e4f8cfe31cf2800eca1 Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Thu, 13 Jun 2024 14:16:02 +0200 Subject: [PATCH 06/17] General - Fix missing `ADDON` variable (#1660) --- addons/accessory/XEH_preInit.sqf | 8 +++++++- addons/diagnostic/XEH_preInit.sqf | 4 ++-- addons/disposable/XEH_preInit.sqf | 4 +++- addons/events/XEH_preInit.sqf | 7 +++++-- addons/help/XEH_preInit.sqf | 6 ++++-- addons/keybinding/XEH_preInit.sqf | 8 +++++--- addons/optics/XEH_preInit.sqf | 8 ++++++-- 7 files changed, 32 insertions(+), 13 deletions(-) diff --git a/addons/accessory/XEH_preInit.sqf b/addons/accessory/XEH_preInit.sqf index 68e45359e..e8248dc77 100644 --- a/addons/accessory/XEH_preInit.sqf +++ b/addons/accessory/XEH_preInit.sqf @@ -1,6 +1,10 @@ #include "script_component.hpp" -if (!hasInterface) exitWith {}; +ADDON = false; + +if (!hasInterface) exitWith { + ADDON = true; +}; #include "XEH_PREP.hpp" @@ -41,3 +45,5 @@ GVAR(usageHash) = createHashMap; false } ] call CBA_fnc_addItemContextMenuOption; + +ADDON = true; diff --git a/addons/diagnostic/XEH_preInit.sqf b/addons/diagnostic/XEH_preInit.sqf index f72820637..3f09384da 100644 --- a/addons/diagnostic/XEH_preInit.sqf +++ b/addons/diagnostic/XEH_preInit.sqf @@ -17,8 +17,6 @@ GVAR(projectileMaxLines) = 20; GVAR(projectileStartedDrawing) = false; GVAR(projectileTrackedUnits) = []; -ADDON = true; - if (getMissionConfigValue ["EnableTargetDebug", 0] == 1 || {getNumber (configFile >> "EnableTargetDebug") == 1}) then { INFO("EnableTargetDebug is enabled."); @@ -71,3 +69,5 @@ if (getMissionConfigValue ["EnableTargetDebug", 0] == 1 || {getNumber (configFil }]; }; }; + +ADDON = true; diff --git a/addons/disposable/XEH_preInit.sqf b/addons/disposable/XEH_preInit.sqf index fd5954f11..3ee47c035 100644 --- a/addons/disposable/XEH_preInit.sqf +++ b/addons/disposable/XEH_preInit.sqf @@ -4,7 +4,9 @@ ADDON = false; #include "initSettings.inc.sqf" -if (configProperties [configFile >> "CBA_DisposableLaunchers"] isEqualTo []) exitWith {}; +if (configProperties [configFile >> "CBA_DisposableLaunchers"] isEqualTo []) exitWith { + ADDON = true; +}; #include "XEH_PREP.hpp" diff --git a/addons/events/XEH_preInit.sqf b/addons/events/XEH_preInit.sqf index ddfec7216..f3009be70 100644 --- a/addons/events/XEH_preInit.sqf +++ b/addons/events/XEH_preInit.sqf @@ -30,9 +30,10 @@ if (isServer) then { #include "backwards_comp.inc.sqf" #include "initSettings.inc.sqf" -ADDON = true; +if (!hasInterface) exitWith { + ADDON = true; +}; -if (!hasInterface) exitWith {}; PREP(playerEvent); GVAR(skipCheckingUserActions) = true; @@ -95,3 +96,5 @@ GVAR(alt) = false; private _states = []; _states resize 20; GVAR(userKeyStates) = _states apply {false}; + +ADDON = true; diff --git a/addons/help/XEH_preInit.sqf b/addons/help/XEH_preInit.sqf index 7130d8ddb..1e4c3a98c 100644 --- a/addons/help/XEH_preInit.sqf +++ b/addons/help/XEH_preInit.sqf @@ -1,10 +1,12 @@ //#define DEBUG_MODE_FULL #include "script_component.hpp" -if (!hasInterface) exitWith {}; - ADDON = false; +if (!hasInterface) exitWith { + ADDON = true; +}; + // bwc FUNC(help) = BIS_fnc_help; diff --git a/addons/keybinding/XEH_preInit.sqf b/addons/keybinding/XEH_preInit.sqf index ac5d3e7aa..488c8e76f 100644 --- a/addons/keybinding/XEH_preInit.sqf +++ b/addons/keybinding/XEH_preInit.sqf @@ -1,11 +1,13 @@ #include "script_component.hpp" SCRIPT(XEH_preInit); -if (!hasInterface) exitWith {}; +ADDON = false; -#include "XEH_PREP.hpp" +if (!hasInterface) exitWith { + ADDON = true; +}; -ADDON = false; +#include "XEH_PREP.hpp" // Load DIK to string conversion table. with uiNamespace do { diff --git a/addons/optics/XEH_preInit.sqf b/addons/optics/XEH_preInit.sqf index c0297a706..9d3caf567 100644 --- a/addons/optics/XEH_preInit.sqf +++ b/addons/optics/XEH_preInit.sqf @@ -6,11 +6,15 @@ ADDON = false; if (configProperties [configFile >> "CBA_PIPItems"] isEqualTo [] && { configProperties [configFile >> "CBA_CarryHandleTypes"] isEqualTo [] -}) exitWith {}; +}) exitWith { + ADDON = true; +}; #include "XEH_PREP.hpp" -if (!hasInterface) exitWith {}; +if (!hasInterface) exitWith { + ADDON = true; +}; #include "initKeybinds.inc.sqf" From 5b56c962ffa73ba988bc381b4227b917391a7af7 Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Sat, 15 Jun 2024 10:10:43 +0200 Subject: [PATCH 07/17] Throw errors for invalid config entries for disposable launchers --- addons/disposable/XEH_preInit.sqf | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/addons/disposable/XEH_preInit.sqf b/addons/disposable/XEH_preInit.sqf index 3ee47c035..c6786d7a0 100644 --- a/addons/disposable/XEH_preInit.sqf +++ b/addons/disposable/XEH_preInit.sqf @@ -38,7 +38,27 @@ private _cfgMagazines = configFile >> "CfgMagazines"; { private _launcher = configName _x; private _magazine = configName (_cfgMagazines >> (getArray (_cfgWeapons >> _launcher >> "magazines") select 0)); - getArray _x params ["_loadedLauncher", "_usedLauncher"]; + + if (_magazine == "") then { + ERROR_1("Launcher %1 has an undefined magazine.",_launcher); + + continue; + }; + + (getArray _x) params [["_loadedLauncher", "", [""]], ["_usedLauncher", "", [""]]; + + if (_loadedLauncher == "") then { + ERROR_1("Launcher %1 has an undefined loaded launcher.",_launcher); + + continue; + }; + + if (_usedLauncher == "") then { + ERROR_1("Launcher %1 has an undefined used launcher.",_launcher); + + continue; + }; + private _fitsInBackpacks = TYPE_BACKPACK in getArray (configFile >> "CfgWeapons" >> _loadedLauncher >> "WeaponSlotsInfo" >> "allowedSlots"); GVAR(LoadedLaunchers) setVariable [_launcher, _loadedLauncher]; From 728336df4c54737cb2bd7336436a8c06ef8d5ef7 Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Sat, 15 Jun 2024 23:37:02 -0700 Subject: [PATCH 08/17] Update addons/disposable/XEH_preInit.sqf Co-authored-by: PabstMirror --- addons/disposable/XEH_preInit.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/disposable/XEH_preInit.sqf b/addons/disposable/XEH_preInit.sqf index c6786d7a0..8f642fded 100644 --- a/addons/disposable/XEH_preInit.sqf +++ b/addons/disposable/XEH_preInit.sqf @@ -45,7 +45,7 @@ private _cfgMagazines = configFile >> "CfgMagazines"; continue; }; - (getArray _x) params [["_loadedLauncher", "", [""]], ["_usedLauncher", "", [""]]; + (getArray _x) params [["_loadedLauncher", "", [""]], ["_usedLauncher", "", [""]]]; if (_loadedLauncher == "") then { ERROR_1("Launcher %1 has an undefined loaded launcher.",_launcher); From f6760dc33c532b1c84d6f402d4f8dd4408fdea11 Mon Sep 17 00:00:00 2001 From: LinkIsGrim <69561145+LinkIsGrim@users.noreply.github.com> Date: Tue, 18 Jun 2024 18:15:53 -0300 Subject: [PATCH 09/17] update player event loop to use new getters --- addons/events/fnc_playerEvent.sqf | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/addons/events/fnc_playerEvent.sqf b/addons/events/fnc_playerEvent.sqf index 4bb8011f4..2ced07558 100644 --- a/addons/events/fnc_playerEvent.sqf +++ b/addons/events/fnc_playerEvent.sqf @@ -21,20 +21,12 @@ Author: ---------------------------------------------------------------------------- */ SCRIPT(playerEvent); -private _unit = missionNamespace getVariable ["bis_fnc_moduleRemoteControl_unit", player]; +private _unit = focusOn; private _vehicle = vehicle _unit; -private _controlledEntity = _unit; -if (!isNull getConnectedUAV _unit) then { - private _uavControl = UAVControl getConnectedUAV _unit; - _uavControl = _uavControl param [(_uavControl find _unit) + 1, ""]; // Will be position STRING if actively controlling, or OBJECT if not. - if (_uavControl isEqualTo "DRIVER") exitWith { - _controlledEntity = driver getConnectedUAV _unit; - }; - - if (_uavControl isEqualTo "GUNNER") exitWith { - _controlledEntity = gunner getConnectedUAV _unit; - }; +private _controlledEntity = getConnectedUAVUnit _unit; +if (isNull _controlledEntity) then { + _controlledEntity = _unit; }; // Unlike CBA_fnc_turretPath, this will return [-1] when player is driver From 19176e16cb796bf513f01aa2efd9e8767f644e75 Mon Sep 17 00:00:00 2001 From: LinkIsGrim <69561145+LinkIsGrim@users.noreply.github.com> Date: Tue, 18 Jun 2024 18:19:22 -0300 Subject: [PATCH 10/17] update REQUIRED_VERSION --- addons/main/script_mod.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/main/script_mod.hpp b/addons/main/script_mod.hpp index 2ae052a28..4b4dcf598 100644 --- a/addons/main/script_mod.hpp +++ b/addons/main/script_mod.hpp @@ -10,7 +10,7 @@ #define VERSION_AR MAJOR,MINOR,PATCHLVL,BUILD // MINIMAL required version for the Mod. Components can specify others.. -#define REQUIRED_VERSION 2.14 +#define REQUIRED_VERSION 2.16 /* // Defined DEBUG_MODE_NORMAL in a few CBA_fncs to prevent looped logging :) From dc3d2cf46381a8b24cabae0b17996eee44f6ed96 Mon Sep 17 00:00:00 2001 From: Grim <69561145+LinkIsGrim@users.noreply.github.com> Date: Tue, 18 Jun 2024 19:27:36 -0300 Subject: [PATCH 11/17] drop uav AI getter, not needed (hooray) --- addons/events/fnc_playerEvent.sqf | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/addons/events/fnc_playerEvent.sqf b/addons/events/fnc_playerEvent.sqf index 2ced07558..e7a8fcc2e 100644 --- a/addons/events/fnc_playerEvent.sqf +++ b/addons/events/fnc_playerEvent.sqf @@ -24,11 +24,6 @@ SCRIPT(playerEvent); private _unit = focusOn; private _vehicle = vehicle _unit; -private _controlledEntity = getConnectedUAVUnit _unit; -if (isNull _controlledEntity) then { - _controlledEntity = _unit; -}; - // Unlike CBA_fnc_turretPath, this will return [-1] when player is driver private _turret = _vehicle unitTurret _unit; @@ -36,7 +31,7 @@ private _state = [ _unit, group _unit, leader _unit, currentWeapon _unit, currentMuzzle _unit, currentWeaponMode _unit, getUnitLoadout _unit, _vehicle, _turret, _vehicle currentWeaponTurret _turret, - currentVisionMode _controlledEntity, cameraView + currentVisionMode _unit, cameraView ]; if (_state isNotEqualTo GVAR(oldState)) then { From 0a84eb127a31e6f2ee63608acc59c766aa65a21f Mon Sep 17 00:00:00 2001 From: Grim <69561145+LinkIsGrim@users.noreply.github.com> Date: Wed, 19 Jun 2024 08:44:55 -0300 Subject: [PATCH 12/17] Update addons/events/fnc_playerEvent.sqf Co-authored-by: PabstMirror --- addons/events/fnc_playerEvent.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/events/fnc_playerEvent.sqf b/addons/events/fnc_playerEvent.sqf index e7a8fcc2e..467fb1f6f 100644 --- a/addons/events/fnc_playerEvent.sqf +++ b/addons/events/fnc_playerEvent.sqf @@ -31,7 +31,7 @@ private _state = [ _unit, group _unit, leader _unit, currentWeapon _unit, currentMuzzle _unit, currentWeaponMode _unit, getUnitLoadout _unit, _vehicle, _turret, _vehicle currentWeaponTurret _turret, - currentVisionMode _unit, cameraView + currentVisionMode focusOn, cameraView ]; if (_state isNotEqualTo GVAR(oldState)) then { From 35f4a92415f84f0ec7de43828fa494e9da084f45 Mon Sep 17 00:00:00 2001 From: Grim <69561145+LinkIsGrim@users.noreply.github.com> Date: Wed, 19 Jun 2024 08:45:01 -0300 Subject: [PATCH 13/17] Update addons/events/fnc_playerEvent.sqf Co-authored-by: PabstMirror --- addons/events/fnc_playerEvent.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/events/fnc_playerEvent.sqf b/addons/events/fnc_playerEvent.sqf index 467fb1f6f..1cd83b81b 100644 --- a/addons/events/fnc_playerEvent.sqf +++ b/addons/events/fnc_playerEvent.sqf @@ -21,7 +21,7 @@ Author: ---------------------------------------------------------------------------- */ SCRIPT(playerEvent); -private _unit = focusOn; +private _unit = missionNamespace getVariable ["bis_fnc_moduleRemoteControl_unit", player]; private _vehicle = vehicle _unit; // Unlike CBA_fnc_turretPath, this will return [-1] when player is driver From 47e1ae78244c8c37072cca8c59c2cce1c2716e03 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Fri, 19 Jul 2024 22:49:53 -0500 Subject: [PATCH 14/17] Common - Fix `CBA_fnc_canAddItem` when item mass is 0 --- addons/common/fnc_canAddItem.sqf | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/addons/common/fnc_canAddItem.sqf b/addons/common/fnc_canAddItem.sqf index cd7ac35e4..c3eacbb57 100644 --- a/addons/common/fnc_canAddItem.sqf +++ b/addons/common/fnc_canAddItem.sqf @@ -102,10 +102,12 @@ if (_unit isKindOf "CAManBase") then { _checkUniform && {TYPE_UNIFORM in _allowedSlots} && { + private _maxLoad = maxLoad uniformContainer _unit; + if (_maxLoad == 0) exitWith { false }; _mass == 0 || { // each time subtract whole number of items which can be put in container - _count = _count - floor (maxLoad uniformContainer _unit * (1 - loadUniform _unit) / _mass); + _count = _count - floor (_maxLoad * (1 - loadUniform _unit) / _mass); _count <= 0 } } @@ -115,9 +117,11 @@ if (_unit isKindOf "CAManBase") then { _checkVest && {TYPE_VEST in _allowedSlots} && { + private _maxLoad = maxLoad vestContainer _unit; + if (_maxLoad == 0) exitWith { false }; _mass == 0 || { - _count = _count - floor (maxLoad vestContainer _unit * (1 - loadVest _unit) / _mass); + _count = _count - floor (_maxLoad * (1 - loadVest _unit) / _mass); _count <= 0 } } @@ -127,9 +131,11 @@ if (_unit isKindOf "CAManBase") then { _checkBackpack && {TYPE_BACKPACK in _allowedSlots} && { + private _maxLoad = maxLoad backpackContainer _unit; + if (_maxLoad == 0) exitWith { false }; _mass == 0 || { - _count = _count - floor (maxLoad backpackContainer _unit * (1 - loadBackpack _unit) / _mass); + _count = _count - floor (_maxLoad * (1 - loadBackpack _unit) / _mass); _count <= 0 } } @@ -138,9 +144,11 @@ if (_unit isKindOf "CAManBase") then { false } else { // is a vehicle, crate etc. + private _maxLoad = maxLoad _unit; + if (_maxLoad == 0) exitWith { false }; _mass == 0 || { - _count = _count - floor (maxLoad _unit * (1 - load _unit) / _mass); + _count = _count - floor (_maxLoad * (1 - load _unit) / _mass); _count <= 0 } }; From 2fd98071ad1c452a373b52b6622e60bcb84e5c3f Mon Sep 17 00:00:00 2001 From: Dart <59131299+DartRuffian@users.noreply.github.com> Date: Sun, 21 Jul 2024 17:46:08 -0500 Subject: [PATCH 15/17] Update fnc_uniqueUnitItems.sqf --- addons/common/fnc_uniqueUnitItems.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/common/fnc_uniqueUnitItems.sqf b/addons/common/fnc_uniqueUnitItems.sqf index ff3777c61..9dce23db5 100644 --- a/addons/common/fnc_uniqueUnitItems.sqf +++ b/addons/common/fnc_uniqueUnitItems.sqf @@ -3,7 +3,7 @@ Function: CBA_fnc_uniqueUnitItems Description: - Retrievs a unique list of items in the units inventory. + Retrieves a unique list of items in the units inventory. Parameters: _unit - Unit to retrieve the items from From 7f1d498022372f144913ff7b59ab40cd21343df6 Mon Sep 17 00:00:00 2001 From: Dart <59131299+DartRuffian@users.noreply.github.com> Date: Sun, 21 Jul 2024 17:49:17 -0500 Subject: [PATCH 16/17] Fix formatting --- addons/common/fnc_uniqueUnitItems.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/common/fnc_uniqueUnitItems.sqf b/addons/common/fnc_uniqueUnitItems.sqf index 9dce23db5..cad1b65b4 100644 --- a/addons/common/fnc_uniqueUnitItems.sqf +++ b/addons/common/fnc_uniqueUnitItems.sqf @@ -16,7 +16,7 @@ Parameters: Example: (begin example) - _allItems = [player, true, false] call CBA_fnc_uniqueUnitItems + _allItems = [player, true, false] call CBA_fnc_uniqueUnitItems (end) Returns: From 9d0083c82a742a4ede56d1bfa1f1cdd8002e9a86 Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Thu, 25 Jul 2024 08:55:35 +0200 Subject: [PATCH 17/17] Make muzzles configcase --- addons/common/fnc_getMuzzles.sqf | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/addons/common/fnc_getMuzzles.sqf b/addons/common/fnc_getMuzzles.sqf index d6a7b8d7c..77811b20e 100644 --- a/addons/common/fnc_getMuzzles.sqf +++ b/addons/common/fnc_getMuzzles.sqf @@ -13,23 +13,34 @@ Returns: Examples: (begin example) - _muzzles = "M4A1_RCO_GL" call CBA_fnc_getMuzzles - -> ["M4_ACOG_Muzzle", "M203Muzzle"] + _muzzles = "arifle_AK12_GL_F" call CBA_fnc_getMuzzles + -> ["arifle_AK12_GL_F","EGLM"] (end) Author: - commy2 + commy2, johnb43 ---------------------------------------------------------------------------- */ SCRIPT(getMuzzles); params [["_weapon", "", [""]]]; -private _muzzles = getArray (configFile >> "CfgWeapons" >> _weapon >> "muzzles"); +private _config = configFile >> "CfgWeapons" >> _weapon; +if (!isClass _config) exitWith { + [] // return +}; + +private _muzzles = []; + +// Get config case muzzle names { if (_x == "this") then { - _muzzles set [_forEachIndex, _weapon]; + _muzzles pushBack (configName _config); + } else { + if (isClass (_config >> _x)) then { + _muzzles pushBack (configName (_config >> _x)); + }; }; -} forEach _muzzles; +} forEach getArray (_config >> "muzzles"); -_muzzles +_muzzles // return