Skip to content

Commit

Permalink
Merge branch 'acemod:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
VyMajoris authored Oct 23, 2023
2 parents 05259e7 + 58e4476 commit 3731264
Show file tree
Hide file tree
Showing 112 changed files with 844 additions and 15,755 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/arma.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ jobs:
run: python3 tools/check_strings.py
- name: Check for BOM
uses: arma-actions/bom-check@master
with:
path: 'addons'
- name: Validate function headers
run: python3 docs/tools/document_functions.py --debug

Expand Down
9 changes: 9 additions & 0 deletions .hemtt/project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,12 @@ workshop = [
dlc = [
"Western Sahara",
]

[hemtt.launch.rhs]
workshop = [
"450814997", # CBA_A3's Workshop ID
"843425103", # RHS AFRF Workshop ID
"843577117", # RHS USAF Workshop ID
"843593391", # RHS GREF Workshop ID
"843632231", # RHS SAF Workshop ID
]
14 changes: 13 additions & 1 deletion addons/advanced_fatigue/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,19 @@ if (!hasInterface) exitWith {};
};
}, QUOTE(ADDON)] call EFUNC(common,addSwayFactor);

["multiplier", {GVAR(swayFactor)}, 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;
Expand Down
18 changes: 18 additions & 0 deletions addons/advanced_fatigue/initSettings.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,21 @@
[0, 5, 1, 1],
true
] call CBA_fnc_addSetting;

[
QGVAR(restedSwayFactor),
"SLIDER",
[LSTRING(RestedSwayFactor), LSTRING(RestedSwayFactor_Description)],
LSTRING(DisplayName),
[0, 5, 1, 2],
true
] call CBA_fnc_addSetting;

[
QGVAR(deployedSwayFactor),
"SLIDER",
[LSTRING(DeployedSwayFactor), LSTRING(DeployedSwayFactor_Description)],
LSTRING(DisplayName),
[0, 5, 1, 2],
true
] call CBA_fnc_addSetting;
16 changes: 16 additions & 0 deletions addons/advanced_fatigue/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,22 @@
<Czech>Ovlivňuje množství kývání zbraní. Vyšší znamená více kývání.</Czech>
<Korean>손떨림의 정도를 정합니다. 높을 수록 많이 휘적입니다.</Korean>
</Key>
<Key ID="STR_ACE_Advanced_Fatigue_RestedSwayFactor">
<English>Rested sway factor</English>
<French>Facteur de balancement au repos</French>
</Key>
<Key ID="STR_ACE_Advanced_Fatigue_RestedSwayFactor_Description">
<English>Influences the amount of weapon sway while weapon is rested.</English>
<French>Influence le degré de balancement de l'arme au repos.</French>
</Key>
<Key ID="STR_ACE_Advanced_Fatigue_DeployedSwayFactor">
<English>Deployed sway factor</English>
<French>Facteur de balancement déployé</French>
</Key>
<Key ID="STR_ACE_Advanced_Fatigue_DeployedSwayFactor_Description">
<English>Influences the amount of weapon sway while weapon is deployed.</English>
<French>Influence le degré de balancement de l'arme déployée.</French>
</Key>
<Key ID="STR_ACE_Advanced_Fatigue_Enabled">
<English>Enabled</English>
<Spanish>Activada</Spanish>
Expand Down
1 change: 1 addition & 0 deletions addons/advanced_throwing/XEH_postInit.sqf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "script_component.hpp"

// Fired XEH
GVAR(ammoEventHandlers) = createHashMap;
[QGVAR(throwFiredXEH), FUNC(throwFiredXEH)] call CBA_fnc_addEventHandler;

// Exit on HC
Expand Down
17 changes: 14 additions & 3 deletions addons/advanced_throwing/functions/fnc_throwFiredXEH.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,25 @@
*
* Public: No
*/

params ["_unit", "", "_muzzle", "", "_ammo"];
TRACE_1("Fired",_this);

{
_this call _x;
} forEach ((_this select 0) getVariable "cba_xeh_fired");
} forEach (_unit getVariable "cba_xeh_fired");

// Call muzzle fired EH
{
_this call compile getText (_x >> "fired");
} forEach (configProperties [configFile >> "CfgWeapons" >> "Throw" >> (_this select 2) >> "EventHandlers", "isClass _x", true]);
} forEach (configProperties [configFile >> "CfgWeapons" >> "Throw" >> _muzzle >> "EventHandlers", "isClass _x", true]);

// Call ammo fired EH
{ _this call _x } forEach (GVAR(ammoEventHandlers) getOrDefaultCall [_ammo, {
private _cfg = configFile >> "CfgAmmo" >> _ammo >> "EventHandlers";
private _eventHandlers = [];
{
private _eh = getText (_x >> "fired");
if (_eh != "") then { _eventHandlers pushBack compile _eh };
} forEach ([_cfg] + configProperties [_cfg, "isClass _x", true]);
_eventHandlers
}, true]);
9 changes: 9 additions & 0 deletions addons/arsenal/ACE_Arsenal_Stats.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,13 @@ class GVAR(stats) {
textStatement = QUOTE(call FUNC(statTextStatement_magCount));
tabs[] = {{}, {4}};
};
class ACE_illuminators: statBase {
scope = 2;
priority = 1;
stats[] = {};
displayName = CSTRING(statIlluminators);
showText = 1;
textStatement = QUOTE(call FUNC(statTextStatement_illuminators));
tabs[] = {{}, {1}};
};
};
2 changes: 2 additions & 0 deletions addons/arsenal/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ PREP(statBarStatement_impact);
PREP(statBarStatement_rateOfFIre);
PREP(statTextStatement_accuracy);
PREP(statTextStatement_explosionTime);
PREP(statTextStatement_illuminators);
PREP(statTextStatement_magCount);
PREP(statTextStatement_mass);
PREP(statTextStatement_rateOfFire);
Expand All @@ -103,4 +104,5 @@ PREP(updateCamPos);
PREP(updateRightPanel);
PREP(updateCurrentItemsList);
PREP(updateUniqueItemsList);
PREP(updateVirtualItemsFlat);
PREP(verifyLoadout);
5 changes: 5 additions & 0 deletions addons/arsenal/functions/fnc_addVirtualItems.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,8 @@ if (_items isEqualType true) then {
};

_object setVariable [QGVAR(virtualItems), _cargo, _global];

// If the arsenal is already open, refresh arsenal display
if (!isNil QGVAR(currentBox) && {GVAR(currentBox) isEqualTo _object}) then {
[true, true] call FUNC(refresh);
};
9 changes: 5 additions & 4 deletions addons/arsenal/functions/fnc_attributeAddItems.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
params ["_controlsGroup"];

private _category = lbCurSel (_controlsGroup controlsGroupCtrl IDC_ATTRIBUTE_CATEGORY);
private _filter = ctrlText (_controlsGroup controlsGroupCtrl IDC_ATTRIBUTE_SEARCHBAR);
// Have to use toLower here and displayName to handle non-ANSI characters
private _filter = toLower ctrlText (_controlsGroup controlsGroupCtrl IDC_ATTRIBUTE_SEARCHBAR);
private _configItems = uiNamespace getVariable QGVAR(configItems);
private _magazineMiscItems = uiNamespace getVariable QGVAR(magazineMiscItems);
private _attributeValue = uiNamespace getVariable [QGVAR(attributeValue), [[], 0]];
Expand All @@ -28,7 +29,7 @@ _attributeValue params ["_attributeItems", "_attributeMode"];
TRACE_3("Populating list",_category,_filter,_attributeValue);
if (_filter != "") then {
_filter = _filter call EFUNC(common,escapeRegex);
_filter = ".*?" + (_filter splitString " " joinString ".*?" + ".*?/io");
_filter = ".*?" + (_filter splitString " " joinString ".*?") + ".*?/io";
} else {
_filter = ".*?/io";
};
Expand Down Expand Up @@ -63,7 +64,7 @@ if (_category == IDX_CAT_ALL) exitWith {
default {_cfgWeapons >> _x};
};

_displayName = getText (_config >> "displayName");
_displayName = toLower getText (_config >> "displayName");

// Add item if not filtered
if (_displayName regexMatch _filter || {_x regexMatch _filter}) then {
Expand Down Expand Up @@ -115,7 +116,7 @@ private _config = _cfgClass;
_config = [_cfgClass, _cfgMagazines] select (_x in _magazineMiscItems);
};

_displayName = getText (_config >> _x >> "displayName");
_displayName = toLower getText (_config >> _x >> "displayName");

// Add item if not filtered
if (_displayName regexMatch _filter || {_x regexMatch _filter}) then {
Expand Down
26 changes: 14 additions & 12 deletions addons/arsenal/functions/fnc_handleSearchbar.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,25 @@

params ["_display", "_control"];

private _searchString = ctrlText _control;
// Have to use toLower here and displayName to handle non-ANSI characters
private _searchString = toLower ctrlText _control;
private _searchPattern = "";
if (_searchString != "") then {
_searchString = _searchString call EFUNC(common,escapeRegex);
_searchString = ".*?" + (_searchString splitString " " joinString ".*?") + ".*?/io";
_searchPattern = _searchString call EFUNC(common,escapeRegex);
_searchPattern = ".*?" + (_searchPattern splitString " " joinString ".*?") + ".*?/io";
};

// Right panel search bar
if ((ctrlIDC _control) == IDC_rightSearchbar) then {
// Don't refill if there is no need
if (GVAR(lastSearchTextRight) != "" && {GVAR(lastSearchTextRight) isNotEqualTo _searchString}) then {
if (GVAR(lastSearchTextRight) != "" && {(_searchString find GVAR(lastSearchTextRight)) != 0}) then {
[_display, _display displayCtrl GVAR(currentRightPanel)] call FUNC(fillRightPanel);
};

GVAR(lastSearchTextRight) = _searchString;

// If nothing searched, quit here
if (_searchString == "") exitWith {};
if (_searchPattern == "") exitWith {};

private _rightPanelState = GVAR(currentLeftPanel) in [IDC_buttonPrimaryWeapon, IDC_buttonHandgun, IDC_buttonSecondaryWeapon, IDC_buttonBinoculars];
private _rightPanelCtrl = [_display displayCtrl IDC_rightTabContentListnBox, _display displayCtrl IDC_rightTabContent] select _rightPanelState;
Expand All @@ -53,11 +55,11 @@ if ((ctrlIDC _control) == IDC_rightSearchbar) then {

// Go through all items in panel and see if they need to be deleted or not
for "_lbIndex" from (lbSize _rightPanelCtrl) - 1 to 0 step -1 do {
_currentDisplayName = _rightPanelCtrl lbText _lbIndex;
_currentDisplayName = toLower (_rightPanelCtrl lbText _lbIndex);
_currentClassname = _rightPanelCtrl lbData _lbIndex;

// Remove item in panel if it doesn't match search, skip otherwise
if ((_currentDisplayName == "") || {!(_currentDisplayName regexMatch _searchString) && {!(_currentClassname regexMatch _searchString)}}) then {
if ((_currentDisplayName == "") || {!(_currentDisplayName regexMatch _searchPattern) && {!(_currentClassname regexMatch _searchPattern)}}) then {
_rightPanelCtrl lbDelete _lbIndex;
};
};
Expand Down Expand Up @@ -97,7 +99,7 @@ if ((ctrlIDC _control) == IDC_rightSearchbar) then {
_currentClassname = _rightPanelCtrl lnbData [_lbIndex, 0];

// Remove item in panel if it doesn't match search, skip otherwise
if ((_currentDisplayName == "") || {!(_currentDisplayName regexMatch _searchString) && {!(_currentClassname regexMatch _searchString)}}) then {
if ((_currentDisplayName == "") || {!(_currentDisplayName regexMatch _searchPattern) && {!(_currentClassname regexMatch _searchPattern)}}) then {
_rightPanelCtrl lnbDeleteRow _lbIndex;
};
};
Expand All @@ -124,14 +126,14 @@ if ((ctrlIDC _control) == IDC_rightSearchbar) then {
} else {
// Left panel search bar
// Don't refill if there is no need
if (GVAR(lastSearchTextLeft) != "" && {GVAR(lastSearchTextLeft) isNotEqualTo _searchString}) then {
if (GVAR(lastSearchTextLeft) != "" && {(_searchString find GVAR(lastSearchTextRight)) != 0}) then {
[_display, _display displayCtrl GVAR(currentLeftPanel)] call FUNC(fillLeftPanel);
};

GVAR(lastSearchTextLeft) = _searchString;

// If nothing searched, quit here
if (_searchString == "") exitWith {};
if (_searchPattern == "") exitWith {};

private _leftPanelCtrl = _display displayCtrl IDC_leftTabContent;

Expand All @@ -149,11 +151,11 @@ if ((ctrlIDC _control) == IDC_rightSearchbar) then {

// Go through all items in panel and see if they need to be deleted or not
for "_lbIndex" from (lbSize _leftPanelCtrl) - 1 to 0 step -1 do {
_currentDisplayName = _leftPanelCtrl lbText _lbIndex;
_currentDisplayName = toLower (_leftPanelCtrl lbText _lbIndex);
_currentClassname = _leftPanelCtrl lbData _lbIndex;

// Remove item in panel if it doesn't match search, skip otherwise
if ((_currentDisplayName == "") || {!(_currentDisplayName regexMatch _searchString) && {!(_currentClassname regexMatch _searchString)}}) then {
if ((_currentDisplayName == "") || {!(_currentDisplayName regexMatch _searchPattern) && {!(_currentClassname regexMatch _searchPattern)}}) then {
_leftPanelCtrl lbDelete _lbIndex;
};
};
Expand Down
19 changes: 2 additions & 17 deletions addons/arsenal/functions/fnc_onArsenalOpen.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -61,25 +61,10 @@ if (isNil QGVAR(virtualItems)) then {
GVAR(virtualItems) = _virtualItems;

// Flatten out hashmaps for easy checking later
private _virtualItemsFlat = +_virtualItems;
private _weapons = _virtualItemsFlat deleteAt IDX_VIRT_WEAPONS;
private _attachments = _virtualItemsFlat deleteAt IDX_VIRT_ATTACHMENTS;

for "_index" from IDX_VIRT_ITEMS_ALL to IDX_VIRT_MISC_ITEMS do {
_virtualItemsFlat merge [_virtualItemsFlat deleteAt _index, true];
};

for "_index" from IDX_VIRT_PRIMARY_WEAPONS to IDX_VIRT_HANDGUN_WEAPONS do {
_virtualItemsFlat merge [_weapons deleteAt _index, true];
};

for "_index" from IDX_VIRT_OPTICS_ATTACHMENTS to IDX_VIRT_BIPOD_ATTACHMENTS do {
_virtualItemsFlat merge [_attachments deleteAt _index, true];
};

GVAR(virtualItemsFlat) = _virtualItemsFlat;
call FUNC(updateVirtualItemsFlat);
};

// Includes items not in the arsenal but equipped on player
GVAR(virtualItemsFlatAll) = +GVAR(virtualItemsFlat);

GVAR(currentFace) = face GVAR(center);
Expand Down
18 changes: 1 addition & 17 deletions addons/arsenal/functions/fnc_openBox.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -72,23 +72,7 @@ if (_mode) then {
};

// Flatten out hashmaps for easy checking later
private _virtualItemsFlat = +_virtualItems;
private _weapons = _virtualItemsFlat deleteAt IDX_VIRT_WEAPONS;
private _attachments = _virtualItemsFlat deleteAt IDX_VIRT_ATTACHMENTS;

for "_index" from IDX_VIRT_ITEMS_ALL to IDX_VIRT_MISC_ITEMS do {
_virtualItemsFlat merge [_virtualItemsFlat deleteAt _index, true];
};

for "_index" from IDX_VIRT_PRIMARY_WEAPONS to IDX_VIRT_HANDGUN_WEAPONS do {
_virtualItemsFlat merge [_weapons deleteAt _index, true];
};

for "_index" from IDX_VIRT_OPTICS_ATTACHMENTS to IDX_VIRT_BIPOD_ATTACHMENTS do {
_virtualItemsFlat merge [_attachments deleteAt _index, true];
};

GVAR(virtualItemsFlat) = _virtualItemsFlat;
call FUNC(updateVirtualItemsFlat);
};

GVAR(center) = _center;
Expand Down
27 changes: 26 additions & 1 deletion addons/arsenal/functions/fnc_refresh.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*
* Arguments:
* 0: Update current and unique items lists <BOOL> (default: true)
* 1: Update virtual items list <BOOL> (default: false)
*
* Return Value:
* None
Expand All @@ -15,13 +16,37 @@
*
* Public: Yes
*/
params [["_updateItems", true, [true]]];
params [["_updateItems", true, [true]], ["_updateVirtualItems", false, [false]]];

TRACE_2("",_updateItems,_updateVirtualItems);

// Don't execute in scheduled environment
if (canSuspend) exitWith {
[{_this call FUNC(refresh)}, _this] call CBA_fnc_directCall;
};

if (_updateItems) then {
// Update current item list
call FUNC(updateCurrentItemsList);

// This takes care of unique inventory items (arsenal doesn't have it whitelisted)
if (!_updateVirtualItems) then {
call FUNC(updateUniqueItemsList);
};
};

private _virtualItems = GVAR(currentBox) getVariable QGVAR(virtualItems);
if (isNil "_virtualItems") exitWith {
[LLSTRING(noVirtualItems), false, 5, 1] call EFUNC(common,displayText);
// Delay a frame in case this is running on display open
[{(findDisplay IDD_ace_arsenal) closeDisplay 0}] call CBA_fnc_execNextFrame;
};

if (_updateVirtualItems) then {
GVAR(virtualItems) = +_virtualItems;
call FUNC(updateVirtualItemsFlat);

// Gotta update this regardless of condition to prevent desync
call FUNC(updateUniqueItemsList);
};

Expand Down
Loading

0 comments on commit 3731264

Please sign in to comment.