Skip to content

Commit

Permalink
Merge branch 'master' into pr/1665
Browse files Browse the repository at this point in the history
  • Loading branch information
PabstMirror committed Jul 28, 2024
2 parents b328751 + 6b21914 commit c2c0621
Show file tree
Hide file tree
Showing 19 changed files with 98 additions and 51 deletions.
8 changes: 7 additions & 1 deletion addons/accessory/XEH_preInit.sqf
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#include "script_component.hpp"

if (!hasInterface) exitWith {};
ADDON = false;

if (!hasInterface) exitWith {
ADDON = true;
};

#include "XEH_PREP.hpp"

Expand Down Expand Up @@ -41,3 +45,5 @@ GVAR(usageHash) = createHashMap;
false
}
] call CBA_fnc_addItemContextMenuOption;

ADDON = true;
16 changes: 12 additions & 4 deletions addons/common/fnc_canAddItem.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand All @@ -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
}
}
Expand All @@ -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
}
}
Expand All @@ -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
}
};
25 changes: 18 additions & 7 deletions addons/common/fnc_getMuzzles.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions addons/common/fnc_uniqueUnitItems.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions addons/diagnostic/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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.");

Expand Down Expand Up @@ -71,3 +69,5 @@ if (getMissionConfigValue ["EnableTargetDebug", 0] == 1 || {getNumber (configFil
}];
};
};

ADDON = true;
26 changes: 24 additions & 2 deletions addons/disposable/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -36,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];
Expand Down
4 changes: 3 additions & 1 deletion addons/disposable/fnc_replaceMagazineCargo.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,15 @@ 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"];

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];
};
Expand Down
7 changes: 5 additions & 2 deletions addons/events/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -95,3 +96,5 @@ GVAR(alt) = false;
private _states = [];
_states resize 20;
GVAR(userKeyStates) = _states apply {false};

ADDON = true;
15 changes: 1 addition & 14 deletions addons/events/fnc_playerEvent.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,14 @@ SCRIPT(playerEvent);
private _unit = missionNamespace getVariable ["bis_fnc_moduleRemoteControl_unit", player];
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;
};
};

// Unlike CBA_fnc_turretPath, this will return [-1] when player is driver
private _turret = _vehicle unitTurret _unit;

private _state = [
_unit, group _unit, leader _unit,
currentWeapon _unit, currentMuzzle _unit, currentWeaponMode _unit,
getUnitLoadout _unit, _vehicle, _turret, _vehicle currentWeaponTurret _turret,
currentVisionMode _controlledEntity, cameraView, getTurretOpticsMode _unit
currentVisionMode focusOn, cameraView, getTurretOpticsMode _unit
];

if (_state isNotEqualTo GVAR(oldState)) then {
Expand Down
6 changes: 4 additions & 2 deletions addons/help/XEH_preInit.sqf
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
8 changes: 5 additions & 3 deletions addons/keybinding/XEH_preInit.sqf
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion addons/keybinding/fnc_gui_editKey.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}];

Expand Down
2 changes: 1 addition & 1 deletion addons/main/script_mod.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 :)
Expand Down
8 changes: 6 additions & 2 deletions addons/optics/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
4 changes: 2 additions & 2 deletions addons/ui/flexiMenu/fnc_list.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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 {""};
Expand Down
4 changes: 2 additions & 2 deletions addons/ui/flexiMenu/fnc_menu.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion addons/ui/fnc_initDisplayInventory.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion addons/ui/fnc_initDisplayRemoteMissions.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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), {
Expand Down
2 changes: 1 addition & 1 deletion addons/xeh/fnc_init.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c2c0621

Please sign in to comment.