Skip to content

Commit

Permalink
Merge branch 'master' into gradual-ammo-cookoff
Browse files Browse the repository at this point in the history
  • Loading branch information
johnb432 committed Oct 23, 2024
2 parents 4422dd5 + c87e2cb commit 540ed27
Show file tree
Hide file tree
Showing 75 changed files with 148 additions and 172 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 <blackpixxel96@gmail.com>
BlackQwar
Bluefield <tatsuyahayami1@gmail.com>
Brakoviejo
Brisse <brisse@outlook.com>
Brostrom.A | Evul <andreas.brostrom.ce@gmail.com>
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
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
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
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,19 @@
* Arguments:
* 0: Initial Muzzle velocity; meters/second <NUMBER>
* 1: Temperature; degrees Celsius <NUMBER>
* 2: Atmospheric Density; kg/(meters^3) <NUMBER>
*
* Return Value:
* Adjusted Muzzle Velocity; Meters <NUMBER>
*
* Example:
* [200, 15, 1.225] call ace_artilleryTables_fnc_calculateMuzzleVelocity
* [200, 15] call ace_artilleryTables_fnc_calculateMuzzleVelocity
*
* Public: No
*/

params ["_muzzleVelocity", "_temperature", "_airDensity"];
params ["_muzzleVelocity", "_temperature"];

// Calculate air density
private _relativeDensity = _airDensity / 1.225;
private _newMuzzleVelocityCoefficient = (((_temperature + 273.13) / 288.13 - 1) / 40 + 1);

private _newMuzzleVelocity = _muzzleVelocity * _newMuzzleVelocityCoefficient;
Expand Down
2 changes: 1 addition & 1 deletion addons/artillerytables/functions/fnc_simulateShot.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ params ["_angle", "_targetHeight", "_muzzleVelocity", ["_airFriction", 0], ["_cr
//MK6_82mm_AIR_FRICTION == -0.0001

if (_airFriction != 0) then {
_muzzleVelocity = [_muzzleVelocity, _temperature, _atmosphericDensity] call FUNC(calculateMuzzleVelocity);
_muzzleVelocity = [_muzzleVelocity, _temperature] call FUNC(calculateMuzzleVelocity);
};

private _atmosphericDensityRatio = _atmosphericDensity / 1.225;
Expand Down
4 changes: 1 addition & 3 deletions addons/cargo/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,11 @@ GVAR(objectActions) = [
] call EFUNC(interact_menu,createAction),
[QGVAR(checkSize), LLSTRING(checkSize), "\a3\ui_f\data\igui\cfg\simpletasks\types\box_ca.paa",
{
//IGNORE_PRIVATE_WARNING ["_target", "_player"];
[format [LLSTRING(SizeMenu), _target call FUNC(getSizeItem)], 3] call EFUNC(common,displayTextStructured);
},
{
//IGNORE_PRIVATE_WARNING ["_target", "_player"];
(GVAR(enable) && GVAR(checkSizeInteraction)) && {
{alive _target} &&
(alive _target) &&
{_target getVariable [QGVAR(canLoad), getNumber (configOf _target >> QGVAR(canLoad)) == 1]} &&
{[_player, _target, ["isNotSwimming"]] call EFUNC(common,canInteractWith)} &&
{[_player, _target] call EFUNC(interaction,canInteractWithVehicleCrew)}
Expand Down
8 changes: 4 additions & 4 deletions addons/common/functions/fnc_canGetInPosition.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ private _turret = [];

private _radius = 0;

private _enemiesInVehicle = false; //Possible Side Restriction
{
if (side _unit getFriend side _x < 0.6) exitWith {_enemiesInVehicle = true};
} forEach crew _vehicle;
// private _enemiesInVehicle = false; //Possible Side Restriction
// {
// if (side _unit getFriend side _x < 0.6) exitWith {_enemiesInVehicle = true};
// } forEach crew _vehicle;

private _return = false;
switch (_position) do {
Expand Down
2 changes: 1 addition & 1 deletion addons/common/functions/fnc_cbaSettings_loadFromConfig.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if (_typeName == "") then {
WARNING_1("Setting [%1] Has no typeName",_varName);
_typeName = "SCALAR";
};
TRACE_3("loadFromConfig",_var,_typeName,_config);
TRACE_3("loadFromConfig",_varName,_typeName,_config);

private _isClientSettable = (getNumber (_config >> "isClientSettable")) > 0;
private _localizedName = getText (_config >> "displayName");
Expand Down
1 change: 0 additions & 1 deletion addons/common/functions/fnc_errorMessage.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ if (!hasInterface) exitWith {};
_ctrlButtonCancel
];

private _ctrlRscMessageBoxPos = ctrlPosition _ctrlRscMessageBox;
private _ctrlRscMessageBoxPosH = _bottomPosY + (_ctrlButtonOKPos select 3);

_ctrlRscMessageBox ctrlSetPosition [
Expand Down
2 changes: 1 addition & 1 deletion addons/common/functions/fnc_getMapGridData.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ GVAR(mapGridData) = [];
//--- Extract grid values from world config (Borrowed from BIS_fnc_gridToPos)
private _cfgGrid = configFile >> "CfgWorlds" >> worldName >> "Grid";
private _offsetX = getNumber (_cfgGrid >> "offsetX");
private _offsetY = getNumber (_cfgGrid >> "offsetY");
// private _offsetY = getNumber (_cfgGrid >> "offsetY");
private _zoomMax = 1e38;
private _formatX = "";
private _formatY = "";
Expand Down
2 changes: 1 addition & 1 deletion addons/common/functions/fnc_statusEffect_get.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ if (_effectNumber == 0) exitWith { //empty array - false effect

//if no change: skip sending publicVar and events
private _effectBoolArray = [_effectNumber, count _statusReasons] call FUNC(binarizeNumber);
TRACE_2("bitArray",_statusIndex,_effectBoolArray);
TRACE_1("bitArray",_effectBoolArray);

private _activeEffects = [];
{
Expand Down
2 changes: 1 addition & 1 deletion addons/common/functions/fnc_watchVariable.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ if (isNull (findDisplay 46)) exitWith {
[{!isNull (findDisplay 46)}, {_this call FUNC(watchVariable);}, _this] call CBA_fnc_waitUntilAndExecute;
};

if (_code isEqualTo {}) then {TRACE_1("using title as code",_title); _code = compile _name;};
if (_code isEqualTo {}) then {TRACE_1("using name as code",_name); _code = compile _name;};

private _trackedDisplay = uiNamespace getVariable [QGVAR(watchVariableUI), displayNull];
if (isNull _trackedDisplay) then {
Expand Down
1 change: 0 additions & 1 deletion addons/concertina_wire/functions/fnc_dismount.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ if (uiNamespace getVariable [QEGVAR(interact_menu,cursorMenuOpened),false]) exit
};
params ["_wire", "_unit"];

private _config = (configOf _unit);
private _delay = [45, 30] select ([_unit] call EFUNC(common,isEngineer) || {[_unit] call EFUNC(common,isEOD)});

// TODO: Animation?
Expand Down
1 change: 0 additions & 1 deletion addons/concertina_wire/functions/fnc_vehicleDamage.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ if (_mode == -1) exitWith {};
//9.78744 (10)

_type = typeOf _wire;
private _anim = _wire animationPhase "wire_2";
private _pos_w = getPos _wire;
private _dir_w = getDir _wire;

Expand Down
13 changes: 12 additions & 1 deletion addons/cookoff/functions/fnc_handleDamageBox.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,24 @@
// If cookoff for boxes is disabled, exit
if (!GVAR(enableAmmobox) || {GVAR(ammoCookoffDuration) == 0}) exitWith {};

params ["_box", "", "_damage", "_source", "_ammo", "", "_instigator", "_hitPoint"];
params ["_box", "_selection", "_damage", "_source", "_ammo", "_hitIndex", "_instigator", "_hitPoint", "", "_context"];

if (!local _box) exitWith {};

// If it's already dead, ignore
if (!alive _box) exitWith {};

private _currentDamage = if (_selection != "") then {
_box getHitIndex _hitIndex
} else {
damage _box
};

// Killing units via End key is an edge case (#10375)
// This didn't matter pre-Arma 3 2.18 but now this goes through the event handler
// TODO: Structural fire damage >= 1 in a single damage event could still be caught here and we don't want that, but we haven't found a better way to catch this, fire damage should be small most of the time anyway
if (_context == 0 && {(abs (_damage - _currentDamage - 1)) < 0.001 && _ammo == "" && isNull _source && isNull _instigator}) exitWith {_damage};

if !(_box getVariable [QGVAR(enableAmmoCookoff), true]) exitWith {};

if !(_hitPoint == "" && {_damage > 0.5}) exitWith {}; // "" means structural damage
Expand Down
2 changes: 1 addition & 1 deletion addons/dagr/functions/fnc_outputData.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ GVAR(outputPFH) = [{
private _speed = speed (vehicle ACE_player);
_speed = floor (_speed * 10) / 10;
_speed = abs(_speed);
_dagrspeed = str _speed + "kph";
private _dagrspeed = str _speed + "kph";

// Elevation
private _elevation = getPosASL ACE_player;
Expand Down
2 changes: 1 addition & 1 deletion addons/dagr/functions/fnc_outputWP.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ GVAR(outputPFH) = [{
default { "000" + str(_yGrid2) };
};

_dagrGrid2 = _xCoord2 + " " + _yCoord2;
private _dagrGrid2 = _xCoord2 + " " + _yCoord2;

// Distance
private _WPpos = [_dagrGrid2, true] call EFUNC(common,getMapPosFromGrid);
Expand Down
Loading

0 comments on commit 540ed27

Please sign in to comment.