Skip to content

Commit

Permalink
Merge branch 'master' into arsenal-medical-protection
Browse files Browse the repository at this point in the history
  • Loading branch information
LinkIsGrim authored Dec 26, 2024
2 parents 87618c8 + 12b1938 commit c0d17f7
Show file tree
Hide file tree
Showing 132 changed files with 2,187 additions and 448 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/arma.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ jobs:
uses: actions/checkout@v4
- name: Setup HEMTT
uses: arma-actions/hemtt@v1
with:
annotate: false
- name: Run HEMTT build
run: hemtt build
- name: Rename build folder
Expand Down
3 changes: 3 additions & 0 deletions .hemtt/lints.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[config.file_type]
options.allow_no_extension = true

[sqf.banned_commands]
options.ignore = [
"addPublicVariableEventHandler", # Alt syntax is broken, we are using main syntax
Expand Down
2 changes: 1 addition & 1 deletion addons/advanced_throwing/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
<Polish>Zezwól na podnoszenie przyczepionych obiektów miotanych</Polish>
<Portuguese>Permitir pegar arremessáveis fixados</Portuguese>
<Russian>Вкл. подбор прикрепленных гранат</Russian>
<German>Aktiviere erneute Aufnahme befestigter Wurfobjekte</German>
<German>Erlaube erneute Aufnahme befestigter Wurfobjekte</German>
<Korean>부착 투척물 줍기 활성화</Korean>
<Japanese>装着済の投擲物の拾い上げを有効化</Japanese>
<Chinese>啟用可撿取附著投擲物</Chinese>
Expand Down
2 changes: 1 addition & 1 deletion addons/arsenal/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1203,7 +1203,7 @@
<Polish>Rejestruj brakujące / niedostępne przedmioty</Polish>
<Portuguese>Registrar em log itens indisponíveis/não encontrados</Portuguese>
<Russian>Вести журнал недоступных предметов</Russian>
<German>Aktiviert die Aufzeichnung fehlender Gegenstände in der RPT</German>
<German>Aufzeichnung fehlender Gegenstände in der RPT</German>
<Korean>누락 된 항목 / 사용 할 수 없는 항목 기록</Korean>
<Japanese>欠落 / 利用不可アイテムを記録</Japanese>
<Chinese>記錄遺失/無法使用的項目</Chinese>
Expand Down
12 changes: 5 additions & 7 deletions addons/artillerytables/dev/showShotInfo.inc.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,9 @@ INFO("showing shot info");
}, {
params ["", "_shootPos", "_lastPos"];
private _mkrB = createMarker [format ["shotInfo-%1-%2",_shootPos,_lastPos], _lastPos];
_mkrB setMarkerType "mil_dot";
_mkrB setMarkerColor "ColorGreen";
_mkrB setMarkerSize [0.5,0.5];
private _diff = _lastPos vectorDiff _shootPos;
_mkrB setMarkerText format ["%1", _diff apply {round _x}];
_mkrB setMarkerTypeLocal "mil_dot";
_mkrB setMarkerColorLocal "ColorGreen";
_mkrB setMarkerSizeLocal [0.5,0.5];

private _dist2d = _shootPos distance2D _lastPos;
private _dir = _shootPos getDir _lastPos;
Expand All @@ -42,7 +40,7 @@ INFO("showing shot info");
}, [_proj, _shootPos, [0,0,0], _submunitionAmmo]] call CBA_fnc_waitUntilAndExecute;

private _mkrA = createMarker [format ["shotInfo-%1",_shootPos], _shootPos];
_mkrA setMarkerType "mil_dot";
_mkrA setMarkerColor "ColorRed";
_mkrA setMarkerTypeLocal "mil_dot";
_mkrA setMarkerColorLocal "ColorRed";
_mkrA setMarkerSize [0.5,0.5];
}] call CBA_fnc_addClassEventHandler;
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Text statement for the magazine ammo muzzle velocity stat.
*
* Arguments:
* 0: Type what it is here <TYPE> (unused)
* 0: Stats <ARRAY> (unused)
* 1: Item config path <CONFIG>
*
* Return Value:
Expand All @@ -13,47 +13,17 @@
* Public: No
*/

params ["", "_configMagazine"];
params ["_stats", "_configMagazine"];

if (EGVAR(arsenal,currentLeftPanel) == 2002) then {
private _primaryMag = primaryWeaponMagazine EGVAR(arsenal,center);
[primaryWeapon EGVAR(arsenal,center), _primaryMag param [0, ""]]
} else {
private _primaryMag = handgunMagazine EGVAR(arsenal,center);
[handgunWeapon EGVAR(arsenal,center), _primaryMag param [0, ""]]
} params ["_weapon", "_magazine"];
private _magClass = configName _configMagazine;
private _weapons = [primaryWeapon EGVAR(arsenal,center), handgunWeapon EGVAR(arsenal,center)];
private _weaponIndex = _weapons findIf {_x canAdd [_magClass, _x]};

// we might be looking at random mags not related to our weapon
private _magIsForCurrentWeapon = (configName _configMagazine == _magazine) && {_weapon != ""};
private _configWeapon = configNull;
// Defer to weapon stat if mag fits in the primary muzzle of an equipped weapon (except launchers)
if (_weaponIndex != -1) exitWith {
[_stats, configFile >> "CfgWeapons" >> _weapons select _weaponIndex, _configMagazine] call FUNC(statTextStatement_weaponMuzzleVelocity);
};

private _muzzleVelocity = getNumber (_configMagazine >> "initSpeed");
private _initSpeedCoef = 0;
if (_magIsForCurrentWeapon) then {
_configWeapon = configFile >> "CfgWeapons" >> _weapon;
_initSpeedCoef = getNumber (_configWeapon >> "initSpeed");
};
if (_initSpeedCoef < 0) then {
_muzzleVelocity = _muzzleVelocity * -_initSpeedCoef;
};
if (_initSpeedCoef > 0) then {
_muzzleVelocity = _initSpeedCoef;
};

private _abAdjustText = "";
if (
_magIsForCurrentWeapon &&
{missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]} &&
{missionNamespace getVariable [QEGVAR(advanced_ballistics,barrelLengthInfluenceEnabled), false]} // this can be on while AB is off or vice-versa
) then {
private _configAmmo = (configFile >> "CfgAmmo" >> (getText (_configMagazine >> "ammo")));
private _barrelLength = getNumber (_configWeapon >> "ACE_barrelLength");
private _muzzleVelocityTable = getArray (_configAmmo >> "ACE_muzzleVelocities");
private _barrelLengthTable = getArray (_configAmmo >> "ACE_barrelLengths");
private _abShift = [_barrelLength, _muzzleVelocityTable, _barrelLengthTable, 0] call EFUNC(advanced_ballistics,calculateBarrelLengthVelocityShift);
if (_abShift != 0) then {
_abAdjustText = " [AB]";
_muzzleVelocity = _abShift;
};
};
format ["%1 m/s (%2 ft/s)%3", _muzzleVelocity toFixed 0, (_muzzleVelocity * 3.28084) toFixed 0, _abAdjustText]
format ["%1 m/s (%2 ft/s)", _muzzleVelocity toFixed 0, (_muzzleVelocity * METERS_TO_FEET_MULT) toFixed 0]
Original file line number Diff line number Diff line change
Expand Up @@ -4,52 +4,49 @@
* Text statement for the weapon muzzle velocity stat.
*
* Arguments:
* 0: Type what it is here <TYPE> (unused)
* 1: Item config path <CONFIG>
* 0: Stats <ARRAY> (unused)
* 1: Weapon config path <CONFIG>
* 2: Magazine config path <CONFIG> (default: configNull)
*
* Return Value:
* Display text <STRING>
*
* Public: No
*/

params ["", "_configWeapon"];
params ["", "_configWeapon", ["_configMagazine", configNull]];

if (EGVAR(arsenal,currentLeftPanel) == 2002) then {
private _primaryMag = primaryWeaponMagazine EGVAR(arsenal,center);
[primaryWeapon EGVAR(arsenal,center), _primaryMag param [0, ""]]
} else {
private _primaryMag = handgunMagazine EGVAR(arsenal,center);
[handgunWeapon EGVAR(arsenal,center), _primaryMag param [0, ""]]
} params ["_weapon", "_magazine"];
if (isNull _configMagazine) then { // Get the current weapon's mag
_configMagazine = configFile >> "CfgMagazines" >> (weaponState EGVAR(arsenal,center)) select 3;;
};

if (_magazine isEqualTo "") then {
if (isNull _configMagazine) exitWith { // Nothing in the magwell
localize "str_empty";
};

private _muzzleVelocity = getNumber (_configMagazine >> "initSpeed");

private _abAdjustText = "";
private _useAB = missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false] && {EGVAR(advanced_ballistics,barrelLengthInfluenceEnabled)};

if (_useAB) then {
private _configAmmo = configFile >> "CfgAmmo" >> (getText (_configMagazine >> "ammo"));
private _barrelLength = getNumber (_configWeapon >> "ACE_barrelLength");
private _muzzleVelocityTable = getArray (_configAmmo >> "ACE_muzzleVelocities");
private _barrelLengthTable = getArray (_configAmmo >> "ACE_barrelLengths");
private _abShift = [_barrelLength, _muzzleVelocityTable, _barrelLengthTable, 0] call EFUNC(advanced_ballistics,calculateBarrelLengthVelocityShift);
if (_abShift != 0) then {
_abAdjustText = " [AB]";
_muzzleVelocity = _abShift;
};
} else {
private _configMagazine = configFile >> "CfgMagazines" >> _magazine;
private _muzzleVelocity = getNumber (_configMagazine >> "initSpeed");
private _initSpeedCoef = getNumber (_configWeapon >> "initSpeed");
if (_initSpeedCoef < 0) then {
_muzzleVelocity = _muzzleVelocity * -_initSpeedCoef;
};
if (_initSpeedCoef > 0) then {
_muzzleVelocity = _initSpeedCoef;
};

private _abAdjustText = "";
if (
missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false] &&
{missionNamespace getVariable [QEGVAR(advanced_ballistics,barrelLengthInfluenceEnabled), false]} // this can be on while AB is off or vice-versa
) then {
private _configAmmo = (configFile >> "CfgAmmo" >> (getText (_configMagazine >> "ammo")));
private _barrelLength = getNumber (_configWeapon >> "ACE_barrelLength");
private _muzzleVelocityTable = getArray (_configAmmo >> "ACE_muzzleVelocities");
private _barrelLengthTable = getArray (_configAmmo >> "ACE_barrelLengths");
private _abShift = [_barrelLength, _muzzleVelocityTable, _barrelLengthTable, 0] call EFUNC(advanced_ballistics,calculateBarrelLengthVelocityShift);
if (_abShift != 0) then {
_abAdjustText = " [AB]";
_muzzleVelocity = _abShift;
};
};
format ["%1 m/s (%2 ft/s)%3", _muzzleVelocity toFixed 0, (_muzzleVelocity * 3.28084) toFixed 0, _abAdjustText]
};

format ["%1 m/s (%2 ft/s)%3", _muzzleVelocity toFixed 0, (_muzzleVelocity * METERS_TO_FEET_MULT) toFixed 0, _abAdjustText]
2 changes: 2 additions & 0 deletions addons/ballistics/script_component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@
#endif

#include "\z\ace\addons\main\script_macros.hpp"

#define METERS_TO_FEET_MULT 3.28084
3 changes: 3 additions & 0 deletions addons/cargo/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -268,14 +268,17 @@
<English>Check Cargo Size</English>
<French>Vérifier la taille de la cargaison</French>
<Russian>Проверить размер груза</Russian>
<German>Prüfe Frachtgröße</German>
<Korean>화물 크기 확인</Korean>
<Japanese>貨物の大きさを確認</Japanese>
</Key>
<Key ID="STR_ACE_Cargo_checkSizeInteraction">
<English>Show Check Cargo Size Interaction</English>
<Russian>Вкл. проверку размера груза</Russian>
<German>Zeige Interaktion zum Prüfen der Frachtgröße</German>
<Japanese>貨物の大きさを確認のインタラクションを表示</Japanese>
<Korean>화물 크기 확인 상호작용 표시</Korean>
<French>Afficher l'interaction de confirmation de la taille de la cargaison</French>
</Key>
<Key ID="STR_ACE_Cargo_clearedCustomName">
<English>Custom name has been cleared.</English>
Expand Down
2 changes: 2 additions & 0 deletions addons/common/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ PREP(hideUnit);
PREP(interpolateFromArray);
PREP(inTransitionAnim);
PREP(isAwake);
PREP(isBeingCarried);
PREP(isBeingDragged);
PREP(isEngineer);
PREP(isEOD);
PREP(isInBuilding);
Expand Down
117 changes: 71 additions & 46 deletions addons/common/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -473,59 +473,84 @@ addMissionEventHandler ["PlayerViewChanged", {
//////////////////////////////////////////////////

GVAR(isReloading) = false;
GVAR(reloadMutex_lastMagazines) = [];
// When reloading, the new magazine is removed from inventory, an animation plays and then the old magazine is added
// If the animation is interrupted, the new magazine will be lost
["loadout", {
params ["_unit", "_newLoadout"];
private _mags = magazines _unit;
// if our magazine count dropped by 1, we might be reloading
if ((count GVAR(reloadMutex_lastMagazines)) - (count _mags) == 1) then {
private _weapon = currentWeapon _unit;
private _muzzle = currentMuzzle _unit;
if (_weapon == "") exitWith {};
private _wpnMzlConfig = configFile >> "CfgWeapons" >> _weapon;
if (_muzzle != _weapon) then { _wpnMzlConfig = _wpnMzlConfig >> _muzzle; };

private _compatMags = [_wpnMzlConfig] call CBA_fnc_compatibleMagazines;
private _lastCompatMagCount = {_x in _compatMags} count GVAR(reloadMutex_lastMagazines);
private _curCompatMagCount = {_x in _compatMags} count _mags;
TRACE_3("",_wpnMzlConfig,_lastCompatMagCount,_curCompatMagCount);
if (_lastCompatMagCount - _curCompatMagCount != 1) exitWith {}; // check if magazines for our specific muzzle dropped by 1

private _gesture = getText (_wpnMzlConfig >> "reloadAction");
if (_gesture == "") exitWith {}; //Ignore weapons with no reload gesture (binoculars)
private _isLauncher = _weapon isKindOf ["Launcher", configFile >> "CfgWeapons"];
private _duration = 0;
if (_isLauncher) then {
_duration = getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> _gesture >> "speed");
};
if (_duration == 0) then {
_duration = getNumber (configFile >> "CfgGesturesMale" >> "States" >> _gesture >> "speed");
};

if (_duration != 0) then {
_duration = if (_duration < 0) then { abs _duration } else { 1 / _duration };
} else {
_duration = 6;
};
["unit", {
params ["_newPlayer"];

// Catch the current unit reloading
private _weaponState = weaponState _newPlayer;
GVAR(isReloading) = (_weaponState select 6) != 0;

if (!GVAR(isReloading)) exitWith {};

TRACE_2("Reloading, blocking gestures",_weapon,_duration);
GVAR(reloadingETA) = CBA_missionTime + _duration;
GVAR(magazineReloadPhase) = 0;

if (!GVAR(isReloading)) then {
GVAR(isReloading) = true;
// Wait until reload animation has finished (if weapon is no longer available, it returns -1)
[{
private _magazineReloadingPhase = ((_this select 0) weaponState (_this select 1)) select 6;

// Need to check the reloading phase, as if you interrupt reloading with a gesture, the phase will remain stuck at a value > 0
if (GVAR(magazineReloadPhase) == _magazineReloadingPhase) exitWith {
TRACE_2("Interrupted magazine reloading",_this select 0,_this select 1);

[{
CBA_missionTime > GVAR(reloadingETA)
},{
GVAR(isReloading) = false;
}] call CBA_fnc_waitUntilAndExecute;
true
};
};
GVAR(reloadMutex_lastMagazines) = _mags;

GVAR(magazineReloadPhase) = _magazineReloadingPhase;

_magazineReloadingPhase <= 0
}, {
TRACE_2("End magazine reloading",_this select 0,_this select 1);

// Player might switch units before reload finishes
if ((_this select 0) isNotEqualTo ACE_player) exitWith {};

GVAR(isReloading) = false;
}, [_newPlayer, _weaponState select 1]] call CBA_fnc_waitUntilAndExecute;
}, true] call CBA_fnc_addPlayerEventHandler;

[QGVAR(magazineReloading), "MagazineReloading", {
params ["_unit", "", "_muzzle"];

TRACE_2("Init magazine reloading",_unit,_muzzle);

// Wait until reload animation has started
[{
((_this select 0) weaponState (_this select 1)) select 6 != 0
}, {
TRACE_2("Start magazine reloading",_this select 0,_this select 1);

// Player might switch units before reload starts
if ((_this select 0) isNotEqualTo ACE_player) exitWith {};

GVAR(isReloading) = true;
GVAR(magazineReloadPhase) = 0;

// Wait until reload animation has finished (if weapon is no longer available, it returns -1)
[{
private _magazineReloadingPhase = ((_this select 0) weaponState (_this select 1)) select 6;

// Need to check the reloading phase, as if you interrupt reloading with a gesture, the phase will remain stuck at a value > 0
if (GVAR(magazineReloadPhase) == _magazineReloadingPhase) exitWith {
TRACE_2("Interrupted magazine reloading",_this select 0,_this select 1);

true
};

GVAR(magazineReloadPhase) = _magazineReloadingPhase;

_magazineReloadingPhase <= 0
}, {
TRACE_2("End magazine reloading",_this select 0,_this select 1);

// Player might switch units before reload finishes
if ((_this select 0) isNotEqualTo ACE_player) exitWith {};

GVAR(isReloading) = false;
}, _this] call CBA_fnc_waitUntilAndExecute;
}, [_unit, _muzzle], 5] call CBA_fnc_waitUntilAndExecute;
}] call CBA_fnc_addBISPlayerEventHandler;

//////////////////////////////////////////////////
// Start the sway loop
//////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion addons/common/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ ACE_COUNTERS = [];

GVAR(statusEffects) = createHashMap;

GVAR(setHearingCapabilityMap) = [];
GVAR(setHearingCapabilityMap) = createHashMap;

[] call FUNC(setupLocalUnitsHandler); // Add local units event handlers (ace_common_localUnits)

Expand Down
Loading

0 comments on commit c0d17f7

Please sign in to comment.