Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/acemod/ACE3 into ehp
Browse files Browse the repository at this point in the history
  • Loading branch information
LinkIsGrim committed Nov 4, 2024
2 parents 6dd9bab + 1e80196 commit fd56f83
Show file tree
Hide file tree
Showing 112 changed files with 800 additions and 460 deletions.
14 changes: 14 additions & 0 deletions .hemtt/lints.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,17 @@ options.ignore = [
options.ignore = [
"SLX_*", "ACE_*"
]

[sqf.undefined]
enabled = true
options.check_orphan_code = true

[sqf.unused]
#enabled = true #many false positives without DEBUG_MODE_FULL
options.check_params = false

[sqf.shadowed]
enabled = false

[sqf.not_private]
enabled = true
1 change: 1 addition & 0 deletions AUTHORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ Barman75
Bla1337
BlackPixxel <[email protected]>
BlackQwar
Bluefield <[email protected]>
Brakoviejo
Brisse <[email protected]>
Brostrom.A | Evul <[email protected]>
Expand Down
7 changes: 0 additions & 7 deletions addons/advanced_ballistics/functions/fnc_diagnoseWeapons.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,6 @@ for "_i" from 0 to (count _cfgWeapons)-1 do {
_weaponInitSpeeds pushBack (_abInitialSpeed / _magSpeed);
};
} forEach _data;
{
_x params ["_magazineIndex", "_abInitialSpeed", "_magazine", "_weapon"];
private _magIndex = _magazines find _magazine;
private _magSpeed = _magazineInitSpeeds select _magIndex;
private _wepIndex = _weapons find _weapon;
_wepSpeed = _weaponInitSpeeds select _wepIndex;
} forEach _data;
{
diag_log text format ["AB_WeaponInitSpeed,%1,%2", _x, _weaponInitSpeeds select _forEachIndex];
} forEach _weapons;
Expand Down
1 change: 0 additions & 1 deletion addons/advanced_ballistics/functions/fnc_handleFirePFH.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
* Public: No
*/

private _deleted = false;
{
_y params ["_bullet","_caliber","_bulletTraceVisible"];

Expand Down
26 changes: 18 additions & 8 deletions addons/advanced_fatigue/functions/fnc_getMetabolicCosts.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,32 @@
* Calculation is done according to the Pandolf/Wojtowicz formulas.
*
* Arguments:
* 0: Duty of animation
* 1: Mass of unit <NUMBER>
* 2: Terrain gradient <NUMBER>
* 3: Terrain factor <NUMBER>
* 4: Speed <NUMBER>
* 0: Mass of unit <NUMBER>
* 1: Terrain gradient <NUMBER>
* 2: Terrain factor <NUMBER>
* 3: Speed <NUMBER>
*
* Return Value:
* Metabolic cost <NUMBER>
*
* Example:
* [1, 840, 20, 1, 4] call ace_advanced_fatigue_fnc_getMetabolicCosts
* [840, 20, 1, 4] call ace_advanced_fatigue_fnc_getMetabolicCosts
*
* Public: No
*/

params ["_duty", "_gearMass", "_terrainGradient", "_terrainFactor", "_speed"];
params ["_gearMass", "_terrainGradient", "_terrainFactor", "_speed"];

// Get the current duty
private _duty = GVAR(animDuty);

{
_duty = if (_x isEqualType 0) then {
_duty * _x
} else {
_duty * (ACE_player call _x)
};
} forEach (values GVAR(dutyList));

// Metabolic cost for walking and running is different
if (_speed > 2) then {
Expand All @@ -30,7 +40,7 @@ if (_speed > 2) then {
private _graded = 2.1 * SIM_BODYMASS + 4 * (SIM_BODYMASS + _gearMass) * ((_gearMass / SIM_BODYMASS) ^ 2) + _terrainFactor * (SIM_BODYMASS + _gearMass) * (0.9 * (_speed ^ 2) + 0.66 * _speed * _terrainGradient);
private _terrainImpact = abs ((_graded / _baseline) - 1);
hintSilent format ["FwdAngle: %1 | SideAngle: %2 \n TerrainFactor: %3 | TerrainGradient: %4 \n TerrainImpact: %5 \n Speed: %6 | CarriedLoad: %7 \n Duty: %8 | Work: %9",
_fwdAngle toFixed 1,
_fwdAngle toFixed 1, //IGNORE_PRIVATE_WARNING ["_fwdAngle", "_sideAngle"]; // from mainLoop
_sideAngle toFixed 1,
_terrainFactor toFixed 2,
_terrainGradient toFixed 1,
Expand Down
15 changes: 2 additions & 13 deletions addons/advanced_fatigue/functions/fnc_mainLoop.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,6 @@ if (GVAR(isProne)) then {
_currentSpeed = _currentSpeed min 1.5;
};

// Get the current duty
private _duty = GVAR(animDuty);

{
if (_x isEqualType 0) then {
_duty = _duty * _x;
} else {
_duty = _duty * (ACE_player call _x);
};
} forEach (values GVAR(dutyList));

private _terrainGradient = abs _fwdAngle;
private _terrainFactor = 1;
private _gearMass = 0 max (((ACE_player getVariable [QEGVAR(movement,totalLoad), loadAbs ACE_player]) / 22.046 - UNDERWEAR_WEIGHT) * GVAR(loadFactor));
Expand All @@ -79,7 +68,7 @@ if (isNull objectParent ACE_player && {_currentSpeed > 0.1} && {isTouchingGround
};

// Add a scaling factor of 0.1 to reduce excessive stamina consumption on default settings (see #10361)
_currentWork = [_duty, _gearMass, _terrainGradient * GVAR(terrainGradientFactor) * 0.1, _terrainFactor, _currentSpeed] call FUNC(getMetabolicCosts);
_currentWork = [_gearMass, _terrainGradient * GVAR(terrainGradientFactor) * 0.1, _terrainFactor, _currentSpeed] call FUNC(getMetabolicCosts);
_currentWork = _currentWork max REE;
};

Expand All @@ -101,7 +90,7 @@ private _muscleFactor = sqrt _muscleIntegrity;
private _ae1PathwayPowerFatigued = GVAR(ae1PathwayPower) * sqrt (GVAR(ae1Reserve) / AE1_MAXRESERVE) * _oxygen * _muscleFactor;
private _ae2PathwayPowerFatigued = GVAR(ae2PathwayPower) * sqrt (GVAR(ae2Reserve) / AE2_MAXRESERVE) * _oxygen * _muscleFactor;
private _aePathwayPowerFatigued = _ae1PathwayPowerFatigued + _ae2PathwayPowerFatigued;
private _anPathwayPowerFatigued = GVAR(anPathwayPower) * sqrt (GVAR(anReserve) / AN_MAXRESERVE) * _oxygen * _muscleIntegrity;
// private _anPathwayPowerFatigued = GVAR(anPathwayPower) * sqrt (GVAR(anReserve) / AN_MAXRESERVE) * _oxygen * _muscleIntegrity; // not used

// Calculate how much power is consumed from each reserve
private _ae1Power = _currentWork min _ae1PathwayPowerFatigued;
Expand Down
2 changes: 1 addition & 1 deletion addons/ai/functions/fnc_garrison.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

params [["_startingPos",[0,0,0], [[]], 3], ["_buildingTypes", ["Building"], [[]]], ["_unitsArray", [], [[]]], ["_fillingRadius", 50, [0]], ["_fillingType", 0, [0]], ["_topDownFilling", false, [true]], ["_teleport", false, [true]]];

TRACE_6("fnc_garrison: Start",_startingPos,_buldingTypes,count _unitsArray,_fillingRadius,_fillingTYpe,_topDownFilling);
TRACE_6("fnc_garrison: Start",_startingPos,_buildingTypes,count _unitsArray,_fillingRadius,_fillingTYpe,_topDownFilling);

_unitsArray = _unitsArray select {alive _x && {!isPlayer _x}};
private _currentUnitMoveList = missionNamespace getVariable [QGVAR(garrison_unitMoveList), []];
Expand Down
1 change: 1 addition & 0 deletions addons/ai/functions/fnc_garrisonMove.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ if (isNil QGVAR(garrison_moveUnitPFH)) then {
};

case ((_unitPosTimer + 5) < CBA_missionTime && {_unitOldPos distance _unitPos < 0.5}) : {
(_unit getVariable [QGVAR(garrisonMove_failSafe), [CBA_missionTime, 5]]) params ["_failSafeTimer", "_failSafeRemainingAttemps"];
call _fnc_attemptFailed;
};

Expand Down
6 changes: 6 additions & 0 deletions addons/arsenal/CfgWeapons.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ class CfgWeapons {
class ToolKit: ItemCore {
ACE_isTool = 1; // sort in Tools Tab
};

class ChemicalDetector_01_base_F: ItemCore {
ACE_asItem = 1;
ACE_isTool = 1; // sort in Tools Tab
};

class DetectorCore;
class MineDetector: DetectorCore {
ACE_isTool = 1; // sort in Tools Tab
Expand Down
1 change: 1 addition & 0 deletions addons/arsenal/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ PREP(handleSearchInputChanged);
PREP(handleSearchModeToggle);
PREP(handleStats);
PREP(initBox);
PREP(isMiscItem);
PREP(itemInfo);
PREP(loadoutsChangeTab);
PREP(message);
Expand Down
1 change: 1 addition & 0 deletions addons/arsenal/XEH_preStart.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ uiNamespace setVariable [QGVAR(baseWeaponNameCache), createHashMap];
uiNamespace setVariable [QGVAR(addListBoxItemCache), createHashMap];
uiNamespace setVariable [QGVAR(rightPanelCache), createHashMap];
uiNamespace setVariable [QGVAR(sortCache), createHashMap];
uiNamespace setVariable [QGVAR(isMiscItemCache), createHashMap];

call FUNC(scanConfig);
17 changes: 3 additions & 14 deletions addons/arsenal/functions/fnc_addRightPanelButton.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,9 @@ if (!isNil "_currentButtonInPosition") then {
};

// If spot found, add items and return position
private _cfgWeapons = configFile >> "CfgWeapons";
private _cfgMagazines = configFile >> "CfgMagazines";
private _configItemInfo = "";
// Sanitize to configCase and drop anything that's not a misc item
_items = _items apply {_x call EFUNC(common,getConfigName)} select {_x call FUNC(isMiscItem)};

_items = _items select {
_configItemInfo = _cfgWeapons >> _x >> "ItemInfo";

_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_asItem") == 1}
};

GVAR(customRightPanelButtons) set [_position, [_items apply {_x call EFUNC(common,getConfigName)}, _picture, _tooltip, _moveOnOverwrite]];
GVAR(customRightPanelButtons) set [_position, [_items, _picture, _tooltip, _moveOnOverwrite]];

_position
2 changes: 0 additions & 2 deletions addons/arsenal/functions/fnc_handleLoadoutsSearchbar.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ if (_searchString != "") then {
_searchString = toLower _searchString;

private _loadoutName = "";
private _loadout = [];
private _currentTab = str GVAR(currentLoadoutsTab);

// Go through all items in panel and see if they need to be deleted or not
for "_lbIndex" from (lnbSize _contentPanelCtrl select 0) - 1 to 0 step -1 do {
Expand Down
54 changes: 54 additions & 0 deletions addons/arsenal/functions/fnc_isMiscItem.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#include "..\script_component.hpp"
/*
* Author: DartRuffian, LinkIsGrim
* Determines if a class is a miscellaneous item or not.
*
* Arguments:
* 0: Item or magazine <STRING>
* 1: Item config <CONFIG> (default: nil)
* 2: Whether item is a magazine <BOOL> (default: false)
* 3: Skip setting false keys in the cache, mostly used for building it during preStart <BOOL> (default: false)
*
* Return Value:
* True if class is a misc item, otherwise false <BOOL>
*
* Example:
* "ACE_CableTie" call ace_arsenal_fnc_isMiscItem
*
* Public: No
*/

params ["_item", "_config", ["_isMag", false], ["_skipFalseKeys", false]];
TRACE_4("",_item,_config,_isMag,_skipFalseKeys);

private _cache = uiNamespace getVariable QGVAR(isMiscItemCache);
private _return = _cache get _item;

// Don't replace with getOrDefaultCall, we want the key to only be set if return is true or _skipFalseKeys is false
if (isNil "_return") then {
private _fnc_hasProperty = {getNumber (_config >> "ACE_asItem") == 1 || {getNumber (_config >> "ACE_isUnique") == 1}};

_return = switch (true) do {
case (_item isKindOf ["CBA_MiscItem", configFile >> "CfgWeapons"]): {true}; // CBA misc item, easy

if (isNil "_config") then {
_config = _item call CBA_fnc_getItemConfig;
};

case (_isMag): _fnc_hasProperty; // Magazine misc item, also easy

private _itemType = getNumber (_config >> "ItemInfo" >> "type");

case (_itemType in [TYPE_FIRST_AID_KIT, TYPE_MEDIKIT, TYPE_TOOLKIT]): {true}; // Special items: Med/Toolkits
case (_itemType in [TYPE_MUZZLE, TYPE_OPTICS, TYPE_FLASHLIGHT, TYPE_BIPOD]): _fnc_hasProperty; // "Forced" misc items
case ((getText (configFile >> "CfgWeapons" >> _item >> "simulation")) == "ItemMineDetector"): {true}; // Special items: mine detectors

default {false}
};

if (_return || !_skipFalseKeys) then {
_cache set [_item, _return];
};
};

_return
16 changes: 7 additions & 9 deletions addons/arsenal/functions/fnc_scanConfig.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ private _isTool = false;
_configItemInfo = _x >> "ItemInfo";
_hasItemInfo = isClass (_configItemInfo);
_itemInfoType = if (_hasItemInfo) then {getNumber (_configItemInfo >> "type")} else {0};
_isMiscItem = _className isKindOf ["CBA_MiscItem", _cfgWeapons];
_isMiscItem = [_className, _x, false, true] call FUNC(isMiscItem);
_isTool = getNumber (_x >> "ACE_isTool") isEqualTo 1;

switch (true) do {
Expand Down Expand Up @@ -127,13 +127,7 @@ private _isTool = false;
};
};
// Misc. items
case (
_hasItemInfo &&
{_isMiscItem &&
{_itemInfoType in [TYPE_OPTICS, TYPE_FLASHLIGHT, TYPE_MUZZLE, TYPE_BIPOD]}} ||
{_itemInfoType in [TYPE_FIRST_AID_KIT, TYPE_MEDIKIT, TYPE_TOOLKIT]} ||
{_simulationType == "ItemMineDetector"}
): {
case (_hasItemInfo && _isMiscItem): {
(_configItems get IDX_VIRT_MISC_ITEMS) set [_className, nil];
if (_isTool) then {_toolList set [_className, nil]};
};
Expand All @@ -160,7 +154,11 @@ private _magazineMiscItems = createHashMap;

{
_magazineMiscItems set [configName _x, nil];
} forEach ((toString {getNumber (_x >> "ACE_isUnique") == 1 || getNumber (_x >> "ACE_asItem") == 1}) configClasses _cfgMagazines);
} forEach ((toString {
with uiNamespace do { // configClasses runs in missionNamespace even if we're in preStart apparently
[configName _x, _x, true, true] call FUNC(isMiscItem);
};
}) configClasses _cfgMagazines);

// Remove invalid/non-existent entries
_grenadeList deleteAt "";
Expand Down
6 changes: 0 additions & 6 deletions addons/arsenal/functions/fnc_sortPanel.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,6 @@ private _sortCache = uiNamespace getVariable QGVAR(sortCache);
private _faceCache = uiNamespace getVariable QGVAR(faceCache);
private _insigniaCache = uiNamespace getVariable QGVAR(insigniaCache);

private _countColumns = if (_right) then {
count lnbGetColumnsPosition _panel
} else {
0
};

private _for = if (_right) then {
for "_i" from 0 to (lnbSize _panel select 0) - 1
} else {
Expand Down
2 changes: 0 additions & 2 deletions addons/arsenal/functions/fnc_updateRightPanel.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

params ["_control", "_container", "_hasItems"];

private _loadRemaining = maxLoad _container - loadAbs _container;

private _item = "";
private _color = [];
private _alpha = 1;
Expand Down
9 changes: 2 additions & 7 deletions addons/arsenal/functions/fnc_updateUniqueItemsList.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ private _attachments = GVAR(virtualItems) get IDX_VIRT_ATTACHMENTS;
_configItemInfo = _config >> "ItemInfo";
_hasItemInfo = isClass (_configItemInfo);
_itemInfoType = if (_hasItemInfo) then {getNumber (_configItemInfo >> "type")} else {0};
_isMiscItem = _x isKindOf ["CBA_MiscItem", _cfgWeapons];
_isMiscItem = _x call FUNC(isMiscItem);

_baseWeapon = if (!_isMiscItem) then {
_x call FUNC(baseWeapon)
Expand Down Expand Up @@ -263,12 +263,7 @@ private _attachments = GVAR(virtualItems) get IDX_VIRT_ATTACHMENTS;
// Misc. items
case (
!(_x in (GVAR(virtualItems) get IDX_VIRT_MISC_ITEMS)) && // misc. items don't use 'baseWeapon'
{_x in (_configItems get IDX_VIRT_MISC_ITEMS) ||
{_hasItemInfo &&
{_isMiscItem &&
{_itemInfoType in [TYPE_OPTICS, TYPE_FLASHLIGHT, TYPE_MUZZLE, TYPE_BIPOD]}} ||
{_itemInfoType in [TYPE_FIRST_AID_KIT, TYPE_MEDIKIT, TYPE_TOOLKIT]} ||
{_simulationType == "ItemMineDetector"}}}
{_x in (_configItems get IDX_VIRT_MISC_ITEMS) || {_hasItemInfo && _isMiscItem}}
): {
(GVAR(virtualItems) get IDX_VIRT_UNIQUE_MISC_ITEMS) set [_x, nil];
};
Expand Down
8 changes: 4 additions & 4 deletions addons/arsenal/missions/Arsenal.VR/initPlayerLocal.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ if (!isNil "_massDestructionAchieved" && {_massDestructionAchieved isEqualTo 1})
private _allDisabled = true;

{
_hitAlive = _x getVariable ["BIS_fnc_VRHitParts_hitalive", []];
private _hitAlive = _x getVariable ["BIS_fnc_VRHitParts_hitalive", []];
_allDisabled = _allDisabled && ({!_x} count _hitAlive >= 2);

sleep 0.1;
Expand Down Expand Up @@ -137,7 +137,7 @@ for "_i" from 5 to 11 do {
private _square = createVehicle ["VR_Area_01_square_1x1_grey_F", position _unit, [], 0, "NONE"];
_square setPosASL getPosASL _unit;

private _marker = createMarker [QGVAR(start), getPosWorld _unit];
private _marker = createMarkerLocal [QGVAR(start), getPosWorld _unit];
_marker setMarkerType "mil_start";

// Init Arsenal
Expand Down Expand Up @@ -165,8 +165,8 @@ _unit addEventHandler ["AnimChanged", {
private _markers = [];

{
private _marker = createMarker [vehicleVarName _x, position _x];
_marker setMarkerType "mil_dot";
private _marker = createMarkerLocal [vehicleVarName _x, position _x];
_marker setMarkerTypeLocal "mil_dot";
_marker setMarkerColor "ColorOrange";

_markers pushBack _marker;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ params ["_targetDistance", "_targetHeight", "_muzzleVelocity", ["_highArc", true
//MK6_82mm_AIR_FRICTION == -0.0001

if (_airFriction != 0) then {
_muzzleVelocity = [_muzzleVelocity, _temperature, _airDensity] call FUNC(calculateMuzzleVelocity);
_muzzleVelocity = [_muzzleVelocity, _temperature] call FUNC(calculateMuzzleVelocity);
};
private _maxResults = [_muzzleVelocity, _airFriction] call FUNC(calculateMaxAngle);

Expand Down
Loading

0 comments on commit fd56f83

Please sign in to comment.