Merge branch 'master' into pr/9234

This commit is contained in:
johnb432 2024-07-26 17:41:04 +02:00
commit 179d713473
1141 changed files with 17484 additions and 8287 deletions

View File

@ -23,14 +23,14 @@ All good? Then proceed and fill out the items below.
**Mods (complete and add to the following information):**
- **Arma 3:** `x.xx` [e.g. 1.00 stable, rc, dev]
- **CBA:** `3.x.x` [e.g. 3.0.0 stable, commit hash]
- **ACE3:** `3.x.x` [eg. 3.0.0 stable, commit hash]
- **ACE3:** `3.x.x` [e.g. 3.0.0 stable, commit hash]
<!-- Make sure to reproduce the issue with only CBA and ACE3 on a newly created mission! -->
**Description:**
A clear and concise description of what the bug is.
**Steps to reproduce:**
_Follow [https://ace3.acemod.org/img/wiki/user/issue_flowchart.webp](this flowchart)!_
_Follow [this flowchart](https://ace3.acemod.org/img/wiki/user/issue_flowchart.webp)!_
1. _Go to ..._
2. _Click ..._

View File

@ -11,11 +11,10 @@ sort-direction: ascending
categories:
- title: '**ADDED:**'
labels:
- 'kind/feature request'
- 'kind/added feature'
- 'kind/feature'
- title: '**FIXED:**'
labels:
- 'kind/bug fix'
- 'kind/bug-fix'
- title: '**IMPROVED:**'
labels:
- 'kind/enhancement'
@ -23,17 +22,16 @@ categories:
- title: '**CHANGED:**'
labels:
- 'kind/cleanup'
- 'area/compatibility'
- 'kind/change'
- title: '**SETTINGS:**'
labels:
- 'kind/setting'
- title: '**TRANSLATIONS:**'
labels:
- 'area/translations'
- 'kind/translation'
exclude-labels:
- 'ignore changelog'
- 'ignore-changelog'
- 'dependencies'
change-template: '- $TITLE (#$NUMBER)'

View File

@ -48,7 +48,7 @@ jobs:
- name: Rename build folder
run: mv .hemttout/build .hemttout/@ace
- name: Upload Artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ace3-${{ github.sha }}-nobin
path: .hemttout/@*

View File

@ -47,7 +47,7 @@ jobs:
destination: docs/_site/
- name: Upload Artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: jekyll-site
path: docs/_site/
@ -63,7 +63,7 @@ jobs:
steps:
- name: Download Artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: jekyll-site
path: _site/

View File

@ -23,7 +23,7 @@ jobs:
cd build
cmake .. && cmake --build .
- name: Upload Artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ace3_extensions-${{ matrix.os }}-debug
path: extensions/build

View File

@ -38,7 +38,7 @@ jobs:
- name: Rename build folder
run: mv .hemttout/build .hemttout/@ace
- name: Upload Artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ace3-${{ github.sha }}
path: .hemttout/@*

View File

@ -67,18 +67,19 @@ jobs:
xcopy /e /h /q z\ace\tools\pDummies\gm gm\
xcopy /e /h /q z\ace\tools\pDummies\vn vn\
xcopy /e /h /q z\ace\tools\pDummies\WW2 WW2\
xcopy /e /h /q z\ace\tools\pDummies\CUP CUP\
- name: Build
run: py P:\z\ace\tools\make.py ci
env:
PYTHONUNBUFFERED: 1
- name: Archive logs
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: logs
path: temp/*.log
- name: Archive @ace
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: '@ace3-${{ github.sha }}'
path: z\ace\release\@ace

View File

@ -11,6 +11,6 @@ jobs:
steps:
- name: Release Drafter
if: github.repository == 'acemod/ACE3'
uses: release-drafter/release-drafter@v5
uses: release-drafter/release-drafter@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -28,7 +28,7 @@ exclude = [
"zeus/functions/fnc_zeusAttributes.sqf",
]
[hemtt.launch]
[hemtt.launch.default]
workshop = [
"450814997", # CBA_A3
]

View File

@ -6,6 +6,7 @@
# request, preferably including an email address.
# CORE TEAM
BaerMitUmlaut
Brett Mayson
bux578 <github@jonathandavid.de>
commy2
@ -25,6 +26,7 @@ Kieran
kymckay
mharis001 <mhariszakar@gmail.com>
MikeMF
MiszczuZPolski
NouberNou
PabstMirror <pabstmirror@gmail.com>
Ruthberg <ulteq@web.de>
@ -56,7 +58,6 @@ Arcanum417 <lubos.len@gmail.com>
Arkhir <wonsz666@gmail.com >
ARV187 aka Spark23
Asgar Serran <piechottaf@web.de>
BaerMitUmlaut
Bamse <bamsis@gmail.com>
Barman75
Bla1337

View File

@ -5,7 +5,7 @@
<p align="center">
<a href="https://github.com/acemod/ACE3/releases/latest">
<img src="https://img.shields.io/badge/Version-3.16.3-blue.svg?style=flat-square" alt="ACE3 Version">
<img src="https://img.shields.io/github/release/acemod/ACE3.svg?style=flat-square&label=Version" alt="ACE3 Version">
</a>
<a href="https://github.com/acemod/ACE3/issues">
<img src="https://img.shields.io/github/issues-raw/acemod/ACE3.svg?style=flat-square&label=Issues" alt="ACE3 Issues">

View File

@ -1,7 +1,5 @@
#include "script_component.hpp"
#include "initKeybinds.inc.sqf"
GVAR(currentbulletID) = -1;
GVAR(Protractor) = false;
@ -11,6 +9,8 @@ GVAR(currentGrid) = 0;
if (!hasInterface) exitWith {};
#include "initKeybinds.inc.sqf"
["CBA_settingsInitialized", {
//If not enabled, dont't add PFEH
if (!GVAR(enabled)) exitWith {};
@ -19,11 +19,11 @@ if (!hasInterface) exitWith {};
[] call FUNC(initializeTerrainExtension);
// Register fire event handler
["ace_firedPlayer", DFUNC(handleFired)] call CBA_fnc_addEventHandler;
["ace_firedPlayerNonLocal", DFUNC(handleFired)] call CBA_fnc_addEventHandler;
["ace_firedPlayer", LINKFUNC(handleFired)] call CBA_fnc_addEventHandler;
["ace_firedPlayerNonLocal", LINKFUNC(handleFired)] call CBA_fnc_addEventHandler;
// Register Perframe Handler
[FUNC(handleFirePFH), GVAR(simulationInterval)] call CBA_fnc_addPerFrameHandler;
[LINKFUNC(handleFirePFH), GVAR(simulationInterval)] call CBA_fnc_addPerFrameHandler;
//Add warnings for missing compat PBOs (only if AB is on)
{

View File

@ -19,7 +19,7 @@
//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"];
TRACE_10("firedEH:",_unit,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile,_vehicle,_gunner,_turret);
if (!(_ammo isKindOf "BulletBase")) exitWith {};
if !(_ammo isKindOf "BulletBase") exitWith {};
if (!alive _projectile) exitWith {};
if (underwater _unit) exitWith {};

View File

@ -40,10 +40,13 @@ if (_transonicStabilityCoef == 0) then {
_transonicStabilityCoef = 0.5;
};
private _dragModel = getNumber(_ammoConfig >> "ACE_dragModel");
if (!(_dragModel in [1, 2, 5, 6, 7, 8])) then {
if !(_dragModel in [1, 2, 5, 6, 7, 8]) then {
_dragModel = 1;
};
private _ballisticCoefficients = getArray(_ammoConfig >> "ACE_ballisticCoefficients");
if (_ballisticCoefficients isEqualTo []) then {
_ballisticCoefficients = [0.5];
};
private _velocityBoundaries = getArray(_ammoConfig >> "ACE_velocityBoundaries");
private _atmosphereModel = getText(_ammoConfig >> "ACE_standardAtmosphere");
if (_atmosphereModel isEqualTo "") then {

View File

@ -9,3 +9,4 @@ PREP(handleStaminaBar);
PREP(mainLoop);
PREP(moduleSettings);
PREP(removeDutyFactor);
PREP(renderDebugLines);

View File

@ -2,34 +2,9 @@
if (!hasInterface) exitWith {};
["baseline", {
private _fatigue = ACE_player getVariable [QGVAR(aimFatigue), 0];
switch (stance ACE_player) do {
case ("CROUCH"): {
(1.0 + _fatigue ^ 2 * 0.1)
};
case ("PRONE"): {
(1.0 + _fatigue ^ 2 * 2.0)
};
default {
(1.5 + _fatigue ^ 2 * 3.0)
};
};
}, 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);
#ifdef DEBUG_MODE_FULL
call FUNC(renderDebugLines);
#endif
// recheck weapon inertia after weapon swap, change of attachments or switching unit
["weapon", {[ACE_player] call FUNC(getWeaponInertia)}, true] call CBA_fnc_addPlayerEventHandler;
@ -39,6 +14,21 @@ if (!hasInterface) exitWith {};
["CBA_settingsInitialized", {
if (!GVAR(enabled)) exitWith {};
["baseline", {
private _fatigue = ACE_player getVariable [QGVAR(aimFatigue), 0];
switch (stance ACE_player) do {
case ("CROUCH"): {
(1.0 + _fatigue ^ 2 * 0.1)
};
case ("PRONE"): {
(1.0 + _fatigue ^ 2 * 2.0)
};
default {
(1.5 + _fatigue ^ 2 * 3.0)
};
};
}, QUOTE(ADDON)] call EFUNC(common,addSwayFactor);
// - Post process effect ------------------------------------------------------
GVAR(ppeBlackout) = ppEffectCreate ["ColorCorrections", 4220];
GVAR(ppeBlackout) ppEffectEnable true;
@ -47,25 +37,23 @@ if (!hasInterface) exitWith {};
GVAR(ppeBlackout) ppEffectCommit 0.4;
// - GVAR updating and initialization -----------------------------------------
["unit", LINKFUNC(handlePlayerChanged), true] call CBA_fnc_addPlayerEventHandler;
["unit", LINKFUNC(handlePlayerChanged)] call CBA_fnc_addPlayerEventHandler;
["visibleMap", {
params ["", "_visibleMap"]; // command visibleMap is updated one frame later
private _staminaBarContainer = uiNamespace getVariable [QGVAR(staminaBarContainer), controlNull];
_staminaBarContainer ctrlShow ((!_visibleMap) && {(vehicle ACE_player) == ACE_player});
(uiNamespace getVariable [QGVAR(staminaBarContainer), controlNull]) ctrlShow (!_visibleMap && isNull objectParent ACE_player);
}, true] call CBA_fnc_addPlayerEventHandler;
["vehicle", {
private _staminaBarContainer = uiNamespace getVariable [QGVAR(staminaBarContainer), controlNull];
_staminaBarContainer ctrlShow ((!visibleMap) && {(vehicle ACE_player) == ACE_player});
(uiNamespace getVariable [QGVAR(staminaBarContainer), controlNull]) ctrlShow (!visibleMap && isNull objectParent ACE_player);
}, true] call CBA_fnc_addPlayerEventHandler;
// - Duty factors -------------------------------------------------------------
if (["ace_medical"] call EFUNC(common,isModLoaded)) then {
if (GETEGVAR(medical,enabled,false)) then {
[QEGVAR(medical,pain), { // 0->1.0, 0.5->1.05, 1->1.1
linearConversion [0, 1, (_this getVariable [QEGVAR(medical,pain), 0]), 1, 1.1, true];
linearConversion [0, 1, _this getVariable [QEGVAR(medical,pain), 0], 1, 1.1, true];
}] call FUNC(addDutyFactor);
[QEGVAR(medical,bloodVolume), { // 6->1.0, 5->1.167, 4->1.33
linearConversion [6, 0, (_this getVariable [QEGVAR(medical,bloodVolume), 6]), 1, 2, true];
linearConversion [6, 0, _this getVariable [QEGVAR(medical,bloodVolume), 6], 1, 2, true];
}] call FUNC(addDutyFactor);
};
if (["ace_dragging"] call EFUNC(common,isModLoaded)) then {
@ -76,7 +64,7 @@ if (!hasInterface) exitWith {};
// Weather has an off switch, Dragging & Medical don't.
if (missionNamespace getVariable [QEGVAR(weather,enabled), false]) then {
[QEGVAR(weather,temperature), { // 35->1, 45->2
linearConversion [35, 45, (missionNamespace getVariable [QEGVAR(weather,currentTemperature), 25]), 1, 2, true];
linearConversion [35, 45, missionNamespace getVariable [QEGVAR(weather,currentTemperature), 25], 1, 2, true];
}] call FUNC(addDutyFactor);
};

View File

@ -1,7 +1,7 @@
#include "..\script_component.hpp"
/*
* Author: BaerMitUmlaut
* Calculates the duty of the current animation.
* Calculates the duty ('postureWeight') of the current animation.
*
* Arguments:
* 0: Unit <OBJECT>

View File

@ -1,54 +1,74 @@
#include "..\script_component.hpp"
/*
* Author: BaerMitUmlaut
* Calculates the current metabolic costs for a unit.
* Author: BaerMitUmlaut, ulteq
* Calculates the current metabolic costs.
* Calculation is done according to the Pandolf/Wojtowicz formulas.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Speed <NUMBER>
* 0: Duty of animation
* 1: Mass of unit <NUMBER>
* 2: Terrain gradient <NUMBER>
* 3: Terrain factor <NUMBER>
* 4: Speed <NUMBER>
*
* Return Value:
* Metabolic cost <NUMBER>
*
* Example:
* [player, 3.3] call ace_advanced_fatigue_fnc_getMetabolicCosts
* [1, 840, 20, 1, 4] call ace_advanced_fatigue_fnc_getMetabolicCosts
*
* Public: No
*/
params ["_unit", "_velocity"];
private _gearMass = ((_unit getVariable [QEGVAR(movement,totalLoad), loadAbs _unit]) / 22.046) * GVAR(loadFactor);
private _terrainAngle = asin (1 - ((surfaceNormal getPosASL _unit) select 2));
private _terrainGradient = (_terrainAngle / 45 min 1) * 5 * GVAR(terrainGradientFactor);
private _duty = GVAR(animDuty);
{
if (_x isEqualType 0) then {
_duty = _duty * _x;
} else {
_duty = _duty * (_unit call _x);
};
} forEach (values GVAR(dutyList));
if (GVAR(isSwimming)) then {
_terrainGradient = 0;
};
params ["_duty", "_gearMass", "_terrainGradient", "_terrainFactor", "_speed"];
// Metabolic cost for walking and running is different
if (_velocity > 2) then {
if (_speed > 2) then {
// Running
#ifdef DEBUG_MODE_FULL
private _baseline = 2.1 * SIM_BODYMASS + 4 * (SIM_BODYMASS + _gearMass) * ((_gearMass / SIM_BODYMASS) ^ 2) + (SIM_BODYMASS + _gearMass) * 0.9 * (_speed ^ 2);
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,
_sideAngle toFixed 1,
_terrainFactor toFixed 2,
_terrainGradient toFixed 1,
_terrainImpact toFixed 2,
_speed toFixed 2,
_gearMass toFixed 1,
_duty toFixed 2,
round (_graded * BIOMECH_EFFICIENCY * _duty)
];
#endif
(
2.10 * SIM_BODYMASS
2.1 * SIM_BODYMASS
+ 4 * (SIM_BODYMASS + _gearMass) * ((_gearMass / SIM_BODYMASS) ^ 2)
+ (SIM_BODYMASS + _gearMass) * (0.9 * (_velocity ^ 2) + 0.66 * _velocity * _terrainGradient)
) * 0.23 * _duty
+ _terrainFactor * (SIM_BODYMASS + _gearMass) * (0.9 * (_speed ^ 2) + 0.66 * _speed * _terrainGradient)
) * BIOMECH_EFFICIENCY * _duty
} else {
// Walking
#ifdef DEBUG_MODE_FULL
private _baseline = 1.05 * SIM_BODYMASS + 2 * (SIM_BODYMASS + _gearMass) * ((_gearMass / SIM_BODYMASS) ^ 2) + (SIM_BODYMASS + _gearMass) * 1.15 * (_speed ^ 2);
private _graded = 1.05 * SIM_BODYMASS + 2 * (SIM_BODYMASS + _gearMass) * ((_gearMass / SIM_BODYMASS) ^ 2) + _terrainFactor * (SIM_BODYMASS + _gearMass) * (1.15 * (_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,
_sideAngle toFixed 1,
_terrainFactor toFixed 2,
_terrainGradient toFixed 1,
_terrainImpact toFixed 2,
_speed toFixed 2,
_gearMass toFixed 1,
_duty toFixed 2,
round (_graded * BIOMECH_EFFICIENCY * _duty)
];
#endif
(
1.05 * SIM_BODYMASS
+ 2 * (SIM_BODYMASS + _gearMass) * ((_gearMass / SIM_BODYMASS) ^ 2)
+ (SIM_BODYMASS + _gearMass) * (1.15 * (_velocity ^ 2) + 0.66 * _velocity * _terrainGradient)
) * 0.23 * _duty
+ _terrainFactor * (SIM_BODYMASS + _gearMass) * (1.15 * (_speed ^ 2) + 0.66 * _speed * _terrainGradient)
) * BIOMECH_EFFICIENCY * _duty
};

View File

@ -1,44 +1,44 @@
#include "..\script_component.hpp"
/*
* Author: BaerMitUmlaut
* Author: BaerMitUmlaut, ulteq
* Handles any audible, visual and physical effects of fatigue.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Fatigue <NUMBER>
* 2: Speed <NUMBER>
* 3: Overexhausted <BOOL>
* 2: Overexhausted <BOOL>
* 3: Forward Angle <NUMBER>
* 4: Side Angle <NUMBER>
*
* Return Value:
* None
*
* Example:
* [_player, 0.5, 3.3, true] call ace_advanced_fatigue_fnc_handleEffects
* [_player, 0.5, 3.3, true, 0, 0] call ace_advanced_fatigue_fnc_handleEffects
*
* Public: No
*/
params ["_unit", "_fatigue", "_speed", "_overexhausted"];
#ifdef DEBUG_MODE_FULL
systemChat str _fatigue;
systemChat str vectorMagnitude velocity _unit;
#endif
params ["_unit", "_fatigue", "_overexhausted", "_fwdAngle", "_sideAngle"];
// - Audible effects ----------------------------------------------------------
GVAR(lastBreath) = GVAR(lastBreath) + 1;
if (_fatigue > 0.4 && {GVAR(lastBreath) > (_fatigue * -10 + 9)} && {!underwater _unit}) then {
if (!isGameFocused) exitWith {};
switch (true) do {
case (_fatigue < 0.6): {
playSound (QGVAR(breathLow) + str(floor random 6));
playSound (QGVAR(breathLow) + str (floor random 6));
};
case (_fatigue < 0.85): {
playSound (QGVAR(breathMid) + str(floor random 6));
playSound (QGVAR(breathMid) + str (floor random 6));
};
default {
playSound (QGVAR(breathMax) + str(floor random 6));
playSound (QGVAR(breathMax) + str (floor random 6));
};
};
GVAR(lastBreath) = 0;
};
@ -62,31 +62,35 @@ if (GVAR(isSwimming)) exitWith {
if (GVAR(setAnimExclusions) isEqualTo []) then {
_unit setAnimSpeedCoef linearConversion [0.7, 0.9, _fatigue, 1, 0.5, true];
};
if ((isSprintAllowed _unit) && {_fatigue > 0.7}) then {
if (isSprintAllowed _unit && _fatigue > 0.7) then { // small checks like these are faster without lazy eval
[_unit, "blockSprint", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set);
} else {
if ((!isSprintAllowed _unit) && {_fatigue < 0.7}) then {
if (!isSprintAllowed _unit && _fatigue < 0.7) then {
[_unit, "blockSprint", QUOTE(ADDON), false] call EFUNC(common,statusEffect_set);
};
};
};
if ((getAnimSpeedCoef _unit) != 1) then {
if (GVAR(setAnimExclusions) isEqualTo []) then {
TRACE_1("reset",getAnimSpeedCoef _unit);
_unit setAnimSpeedCoef 1;
};
// If other components are setting setAnimSpeedCoef, do not change animSpeedCoef
if (getAnimSpeedCoef _unit != 1 && {GVAR(setAnimExclusions) isEqualTo []}) then {
TRACE_1("reset",getAnimSpeedCoef _unit);
_unit setAnimSpeedCoef 1;
};
if (_overexhausted) then {
if (!isForcedWalk _unit && _fatigue >= 1) then { // small checks like these are faster without lazy eval
[_unit, "forceWalk", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set);
[_unit, "blockSprint", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set);
} else {
if (isForcedWalk _unit && {_fatigue < 0.7}) then {
if (isForcedWalk _unit && _fatigue < 0.7) then {
[_unit, "forceWalk", QUOTE(ADDON), false] call EFUNC(common,statusEffect_set);
[_unit, "blockSprint", QUOTE(ADDON), false] call EFUNC(common,statusEffect_set);
} else {
if ((isSprintAllowed _unit) && {_fatigue > 0.7}) then {
// Forward angle is the slope of the terrain, side angle simulates the unevenness/roughness of the terrain
if (isSprintAllowed _unit && {_fatigue > 0.7 || abs _fwdAngle > 20 || abs _sideAngle > 20}) then {
[_unit, "blockSprint", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set);
} else {
if ((!isSprintAllowed _unit) && {_fatigue < 0.6}) then {
if (!isSprintAllowed _unit && _fatigue < 0.6 && abs _fwdAngle < 20 && abs _sideAngle < 20) then {
[_unit, "blockSprint", QUOTE(ADDON), false] call EFUNC(common,statusEffect_set);
};
};

View File

@ -1,7 +1,7 @@
#include "..\script_component.hpp"
/*
* Author: BaerMitUmlaut
* Handles switching units (once on init and afterwards via Zeus).
* Author: BaerMitUmlaut, ulteq
* Handles switching units (once on init and afterwards via Zeus). Also handles CBA setting change for performance factor.
*
* Arguments:
* 0: New Unit <OBJECT>
@ -15,20 +15,24 @@
*
* Public: No
*/
params ["_newUnit", "_oldUnit"];
TRACE_2("unit changed",_newUnit,_oldUnit);
if !(isNull _oldUnit) then {
if (!isNull _oldUnit) then {
TRACE_1("remove old",_oldUnit getVariable QGVAR(animHandler));
_oldUnit enableStamina true;
_oldUnit removeEventHandler ["AnimChanged", _oldUnit getVariable [QGVAR(animHandler), -1]];
_oldUnit setVariable [QGVAR(animHandler), nil];
TRACE_1("remove old",_oldUnit getVariable QGVAR(animHandler));
_oldUnit setVariable [QGVAR(ae1Reserve), GVAR(ae1Reserve)];
_oldUnit setVariable [QGVAR(ae2Reserve), GVAR(ae2Reserve)];
_oldUnit setVariable [QGVAR(anReserve), GVAR(anReserve)];
_oldUnit setVariable [QGVAR(anFatigue), GVAR(anFatigue)];
_oldUnit setVariable [QGVAR(muscleDamage), GVAR(muscleDamage)];
_oldUnit setVariable [QGVAR(respiratoryRate), GVAR(respiratoryRate)];
};
_newUnit enableStamina false;
@ -38,6 +42,7 @@ if (_newUnit getVariable [QGVAR(animHandler), -1] == -1) then {
private _animHandler = _newUnit addEventHandler ["AnimChanged", {
GVAR(animDuty) = _this call FUNC(getAnimDuty);
}];
TRACE_1("add new",_animHandler);
_newUnit setVariable [QGVAR(animHandler), _animHandler];
};
@ -47,18 +52,27 @@ GVAR(ae2Reserve) = _newUnit getVariable [QGVAR(ae2Reserve), AE2_MAXRESERVE]
GVAR(anReserve) = _newUnit getVariable [QGVAR(anReserve), AN_MAXRESERVE];
GVAR(anFatigue) = _newUnit getVariable [QGVAR(anFatigue), 0];
GVAR(muscleDamage) = _newUnit getVariable [QGVAR(muscleDamage), 0];
GVAR(respiratoryRate) = _newUnit getVariable [QGVAR(respiratoryRate), 0];
// Clean variables for respawning units
{
_newUnit setVariable [_x, nil];
} forEach [QGVAR(ae1Reserve), QGVAR(ae2Reserve), QGVAR(anReserve), QGVAR(anFatigue), QGVAR(muscleDamage)];
} forEach [QGVAR(ae1Reserve), QGVAR(ae2Reserve), QGVAR(anReserve), QGVAR(anFatigue), QGVAR(muscleDamage), QGVAR(respiratoryRate)];
GVAR(VO2Max) = 35 + 20 * (_newUnit getVariable [QGVAR(performanceFactor), GVAR(performanceFactor)]);
GVAR(VO2MaxPower) = GVAR(VO2Max) * SIM_BODYMASS * 0.23 * JOULES_PER_ML_O2 / 60;
GVAR(VO2MaxPower) = GVAR(VO2Max) * SIM_BODYMASS * BIOMECH_EFFICIENCY * JOULES_PER_ML_O2 / 60;
GVAR(peakPower) = VO2MAX_STRENGTH * GVAR(VO2MaxPower);
GVAR(ae1PathwayPower) = GVAR(peakPower) / (13.3 + 16.7 + 113.3) * 13.3 * ANTPERCENT ^ 1.28 * 1.362;
GVAR(ae2PathwayPower) = GVAR(peakPower) / (13.3 + 16.7 + 113.3) * 16.7 * ANTPERCENT ^ 1.28 * 1.362;
GVAR(ae1PathwayPower) = GVAR(peakPower) / (AE1_ATP_RELEASE_RATE + AE2_ATP_RELEASE_RATE + AN_ATP_RELEASE_RATE) * AE1_ATP_RELEASE_RATE * ANTPERCENT ^ 1.28 * 1.362;
GVAR(ae2PathwayPower) = GVAR(peakPower) / (AE1_ATP_RELEASE_RATE + AE2_ATP_RELEASE_RATE + AN_ATP_RELEASE_RATE) * AE2_ATP_RELEASE_RATE * ANTPERCENT ^ 1.28 * 1.362;
GVAR(aePathwayPower) = GVAR(ae1PathwayPower) + GVAR(ae2PathwayPower);
GVAR(anPathwayPower) = GVAR(peakPower) - GVAR(aePathwayPower);
GVAR(aeWattsPerATP) = GVAR(ae1PathwayPower) / AE1_ATP_RELEASE_RATE;
GVAR(anWattsPerATP) = GVAR(anPathwayPower) / AN_ATP_RELEASE_RATE;
GVAR(respiratoryBufferDivisor) = (RESPIRATORY_BUFFER - 1) / RESPIRATORY_BUFFER;
GVAR(maxPowerFatigueRatio) = 0.057 / GVAR(peakPower);
GVAR(ppeBlackoutLast) = 100;
GVAR(lastBreath) = 0;

View File

@ -1,6 +1,6 @@
#include "..\script_component.hpp"
/*
* Author: BaerMitUmlaut
* Author: BaerMitUmlaut, ulteq
* Main looping function that updates fatigue values.
*
* Arguments:
@ -17,67 +17,131 @@
// Dead people don't breathe, will also handle null (map intros)
if (!alive ACE_player) exitWith {
[FUNC(mainLoop), [], 1] call CBA_fnc_waitAndExecute;
[LINKFUNC(mainLoop), [], 1] call CBA_fnc_waitAndExecute;
private _staminaBarContainer = uiNamespace getVariable [QGVAR(staminaBarContainer), controlNull];
_staminaBarContainer ctrlSetFade 1;
_staminaBarContainer ctrlCommit 1;
};
private _velocity = velocity ACE_player;
private _normal = surfaceNormal (getPosWorld ACE_player);
private _movementVector = vectorNormalized _velocity;
private _sideVector = vectorNormalized (_movementVector vectorCrossProduct _normal);
private _fwdAngle = asin (_movementVector select 2);
private _sideAngle = asin (_sideVector select 2);
private _currentWork = REE;
private _currentSpeed = (vectorMagnitude (velocity ACE_player)) min 6;
private _currentSpeed = (vectorMagnitude _velocity) min 6;
// fix #4481. Diving to the ground is recorded as PRONE stance with running speed velocity. Cap maximum speed to fix.
if (GVAR(isProne)) then {
_currentSpeed = _currentSpeed min 1.5;
};
if ((vehicle ACE_player == ACE_player) && {_currentSpeed > 0.1} && {isTouchingGround ACE_player || {underwater ACE_player}}) then {
_currentWork = [ACE_player, _currentSpeed] call FUNC(getMetabolicCosts);
// 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));
if (isNull objectParent ACE_player && {_currentSpeed > 0.1} && {isTouchingGround ACE_player || {underwater ACE_player}}) then {
if (!GVAR(isSwimming)) then {
// If the unit is going downhill, it's much less demanding
if (_fwdAngle < 0) then {
_terrainGradient = 0.15 * _terrainGradient;
};
// Used to simulate the unevenness/roughness of the terrain
if ((getPosATL ACE_player) select 2 < 0.01) then {
private _sideGradient = abs (_sideAngle / 45) min 1;
_terrainFactor = 1 + _sideGradient ^ 4;
};
};
_currentWork = [_duty, _gearMass, _terrainGradient * GVAR(terrainGradientFactor), _terrainFactor, _currentSpeed] call FUNC(getMetabolicCosts);
_currentWork = _currentWork max REE;
};
// Oxygen calculation
private _oxygen = if (GETEGVAR(medical,enabled,false) && {EGVAR(medical_vitals,simulateSpo2)}) then { // Defer to medical
(ACE_player getVariable [QEGVAR(medical,spo2), 97]) / 100
} else {
1 - 0.131 * GVAR(respiratoryRate) ^ 2 // Default AF oxygen saturation
};
// Calculate muscle damage increase
// Note: Muscle damage recovery is ignored as it takes multiple days
GVAR(muscleDamage) = (GVAR(muscleDamage) + (_currentWork / GVAR(peakPower)) ^ 3.2 * 0.00004) min 1;
private _muscleIntegritySqrt = sqrt (1 - GVAR(muscleDamage));
GVAR(muscleDamage) = GVAR(muscleDamage) + (_currentWork / GVAR(peakPower)) ^ 3.2 * MUSCLE_TEAR_RATE;
// Calculate muscle damage recovery
GVAR(muscleDamage) = 0 max (GVAR(muscleDamage) - MUSCLE_RECOVERY * GVAR(recoveryFactor)) min 1;
private _muscleIntegrity = 1 - GVAR(muscleDamage);
private _muscleFactor = sqrt _muscleIntegrity;
// Calculate available power
private _ae1PathwayPowerFatigued = GVAR(ae1PathwayPower) * sqrt (GVAR(ae1Reserve) / AE1_MAXRESERVE) * OXYGEN * _muscleIntegritySqrt;
private _ae2PathwayPowerFatigued = GVAR(ae2PathwayPower) * sqrt (GVAR(ae2Reserve) / AE2_MAXRESERVE) * OXYGEN * _muscleIntegritySqrt;
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;
// Calculate how much power is consumed from each reserve
private _ae1Power = _currentWork min _ae1PathwayPowerFatigued;
private _ae2Power = ((_currentWork - _ae1Power) max 0) min _ae2PathwayPowerFatigued;
private _anPower = (_currentWork - _ae1Power - _ae2Power) max 0;
private _ae2Power = (_currentWork - _ae1Power) min _ae2PathwayPowerFatigued;
private _anPower = 0 max (_currentWork - _ae1Power - _ae2Power);
// Remove ATP from reserves for current work
GVAR(ae1Reserve) = GVAR(ae1Reserve) - _ae1Power / WATTSPERATP;
GVAR(ae2Reserve) = GVAR(ae2Reserve) - _ae2Power / WATTSPERATP;
GVAR(anReserve) = GVAR(anReserve) - _anPower / WATTSPERATP;
// Increase anearobic fatigue
GVAR(anFatigue) = GVAR(anFatigue) + _anPower * (0.057 / GVAR(peakPower)) * 1.1;
GVAR(ae1Reserve) = 0 max (GVAR(ae1Reserve) - _ae1Power / GVAR(aeWattsPerATP));
GVAR(ae2Reserve) = 0 max (GVAR(ae2Reserve) - _ae2Power / GVAR(aeWattsPerATP));
GVAR(anReserve) = 0 max (GVAR(anReserve) - _anPower / GVAR(anWattsPerATP));
// Acidosis accumulation
GVAR(anFatigue) = GVAR(anFatigue) + _anPower * GVAR(maxPowerFatigueRatio) * 1.1;
// Aerobic ATP reserve recovery
GVAR(ae1Reserve) = ((GVAR(ae1Reserve) + OXYGEN * 6.60 * (GVAR(ae1PathwayPower) - _ae1Power) / GVAR(ae1PathwayPower) * GVAR(recoveryFactor)) min AE1_MAXRESERVE) max 0;
GVAR(ae2Reserve) = ((GVAR(ae2Reserve) + OXYGEN * 5.83 * (GVAR(ae2PathwayPower) - _ae2Power) / GVAR(ae2PathwayPower) * GVAR(recoveryFactor)) min AE2_MAXRESERVE) max 0;
GVAR(ae1Reserve) = (GVAR(ae1Reserve) + _oxygen * GVAR(recoveryFactor) * AE1_ATP_RECOVERY * (GVAR(ae1PathwayPower) - _ae1Power) / GVAR(ae1PathwayPower)) min AE1_MAXRESERVE;
GVAR(ae2Reserve) = (GVAR(ae2Reserve) + _oxygen * GVAR(recoveryFactor) * AE2_ATP_RECOVERY * (GVAR(ae2PathwayPower) - _ae2Power) / GVAR(ae2PathwayPower)) min AE2_MAXRESERVE;
// Anaerobic ATP reserver and fatigue recovery
GVAR(anReserve) = ((GVAR(anReserve)
+ (_ae1PathwayPowerFatigued + _ae2PathwayPowerFatigued - _ae1Power - _ae2Power) / GVAR(VO2MaxPower) * 56.7 * GVAR(anFatigue) ^ 2 * GVAR(recoveryFactor)
) min AN_MAXRESERVE) max 0;
private _aeSurplus = _ae1PathwayPowerFatigued + _ae2PathwayPowerFatigued - _ae1Power - _ae2Power;
GVAR(anFatigue) = ((GVAR(anFatigue)
- (_ae1PathwayPowerFatigued + _ae2PathwayPowerFatigued - _ae1Power - _ae2Power) * (0.057 / GVAR(peakPower)) * GVAR(anFatigue) ^ 2 * GVAR(recoveryFactor)
) min 1) max 0;
// Anaerobic ATP reserve recovery
GVAR(anReserve) = 0 max (GVAR(anReserve) + _aeSurplus / GVAR(VO2MaxPower) * AN_ATP_RECOVERY * GVAR(recoveryFactor) * (GVAR(anFatigue) max linearConversion [AN_MAXRESERVE, 0, GVAR(anReserve), 0, 0.75, true]) ^ 2) min AN_MAXRESERVE; // max linearConversion ensures that if GVAR(anFatigue) is very low, it will still regenerate reserves
// Acidosis recovery
GVAR(anFatigue) = 0 max (GVAR(anFatigue) - _aeSurplus * GVAR(maxPowerFatigueRatio) * GVAR(recoveryFactor) * GVAR(anFatigue) ^ 2) min 1;
private _aeReservePercentage = (GVAR(ae1Reserve) / AE1_MAXRESERVE + GVAR(ae2Reserve) / AE2_MAXRESERVE) / 2;
private _anReservePercentage = GVAR(anReserve) / AN_MAXRESERVE;
private _perceivedFatigue = 1 - (_anReservePercentage min _aeReservePercentage);
// Respiratory rate decrease
GVAR(respiratoryRate) = GVAR(respiratoryRate) * GVAR(respiratoryBufferDivisor);
[ACE_player, _perceivedFatigue, _currentSpeed, GVAR(anReserve) == 0] call FUNC(handleEffects);
// Respiratory rate increase
private _aePowerRatio = (GVAR(aePathwayPower) / _aePathwayPowerFatigued) min 2;
private _respiratorySampleDivisor = 1 / (RESPIRATORY_BUFFER * 4.72 * GVAR(VO2Max));
GVAR(respiratoryRate) = (GVAR(respiratoryRate) + _currentWork * _respiratorySampleDivisor * _aePowerRatio) min 1;
// Calculate a pseudo-perceived fatigue, which is used for effects
GVAR(aeReservePercentage) = (GVAR(ae1Reserve) / AE1_MAXRESERVE + GVAR(ae2Reserve) / AE2_MAXRESERVE) / 2;
GVAR(anReservePercentage) = GVAR(anReserve) / AN_MAXRESERVE;
private _perceivedFatigue = 1 - (GVAR(anReservePercentage) min GVAR(aeReservePercentage));
#ifdef DEBUG_MODE_FULL
systemChat format ["---- muscleDamage: %1 ----", GVAR(muscleDamage) toFixed 8];
systemChat format ["---- ae2: %1 - an: %2 ----", (GVAR(ae2Reserve) / AE2_MAXRESERVE) toFixed 2, (GVAR(anReserve) / AN_MAXRESERVE) toFixed 2];
systemChat format ["---- anFatigue: %1 - perceivedFatigue: %2 ----", GVAR(anFatigue) toFixed 2, _perceivedFatigue toFixed 2];
systemChat format ["---- velocity %1 - respiratoryRate: %2 ----", (vectorMagnitude _velocity) toFixed 2, GVAR(respiratoryRate) toFixed 2];
// systemChat format ["---- aePower: %1 ----", _aePathwayPowerFatigued toFixed 1];
#endif
[ACE_player, _perceivedFatigue, GVAR(anReserve) == 0, _fwdAngle, _sideAngle] call FUNC(handleEffects);
if (GVAR(enableStaminaBar)) then {
[GVAR(anReserve) / AN_MAXRESERVE] call FUNC(handleStaminaBar);
};
[FUNC(mainLoop), [], 1] call CBA_fnc_waitAndExecute;
[LINKFUNC(mainLoop), [], 1] call CBA_fnc_waitAndExecute;

View File

@ -0,0 +1,40 @@
#include "..\script_component.hpp"
/*
* Author: ulteq
* Draw lines for debugging.
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* call ace_advanced_fatigue_fnc_renderDebugLines
*
* Public: No
*/
addMissionEventHandler ["Draw3D", {
private _normal = surfaceNormal (getPosWorld ACE_player);
private _beg = (getPosWorld ACE_player) vectorAdd (_normal vectorMultiply 0.5);
private _end = _beg vectorAdd (_normal vectorMultiply 2);
drawLine3D [ASLToATL _beg, ASLToATL _end, [0, 1, 0, 1]];
private _side = vectorNormalized (_normal vectorCrossProduct [0, 0, 1]);
private _end = _beg vectorAdd (_side vectorMultiply 2);
drawLine3D [ASLToATL _beg, ASLToATL _end, [0, 0, 1, 1]];
private _up = vectorNormalized (_normal vectorCrossProduct _side);
private _end = _beg vectorAdd (_up vectorMultiply 2);
drawLine3D [ASLToATL _beg, ASLToATL _end, [1, 0, 0, 1]];
private _movementVector = vectorNormalized (velocity ACE_player);
private _end = _beg vectorAdd (_movementVector vectorMultiply 2);
drawLine3D [ASLToATL _beg, ASLToATL _end, [1, 1, 0, 1]];
private _sideVector = vectorNormalized (_movementVector vectorCrossProduct _normal);
_sideVector set [2, 0];
private _end = _beg vectorAdd (_sideVector vectorMultiply 2);
drawLine3D [ASLToATL _beg, ASLToATL _end, [0, 1, 1, 1]];
}];

View File

@ -4,12 +4,14 @@
[LSTRING(Enabled), LSTRING(Enabled_Description)],
LSTRING(DisplayName),
true,
true, {
1,
{
if (!_this) then {
private _staminaBarContainer = uiNamespace getVariable [QGVAR(staminaBarContainer), controlNull];
_staminaBarContainer ctrlSetFade 1;
_staminaBarContainer ctrlCommit 0;
};
[QGVAR(enabled), _this] call EFUNC(common,cbaSettings_settingChanged)
},
true // Needs mission restart
@ -21,7 +23,8 @@
[LSTRING(EnableStaminaBar), LSTRING(EnableStaminaBar_Description)],
LSTRING(DisplayName),
true,
true, {
1,
{
if (!_this) then {
private _staminaBarContainer = uiNamespace getVariable [QGVAR(staminaBarContainer), controlNull];
_staminaBarContainer ctrlSetFade 1;
@ -36,7 +39,8 @@
[LSTRING(FadeStaminaBar), LSTRING(FadeStaminaBar_Description)],
LSTRING(DisplayName),
true,
false, {
0,
{
if (!_this && GVAR(enabled) && GVAR(enableStaminaBar)) then {
private _staminaBarContainer = uiNamespace getVariable [QGVAR(staminaBarContainer), controlNull];
_staminaBarContainer ctrlSetFade 0;
@ -50,8 +54,14 @@
"SLIDER",
[LSTRING(PerformanceFactor), LSTRING(PerformanceFactor_Description)],
LSTRING(DisplayName),
[0, 5, 1, 1],
true
[0, 10, 1, 2],
1,
{
// Recalculate values if the setting is changed mid-mission
if (GVAR(enabled) && hasInterface && !isNull ACE_player) then {
[ACE_player, ACE_player] call FUNC(handlePlayerChanged);
};
}
] call CBA_fnc_addSetting;
[
@ -59,8 +69,8 @@
"SLIDER",
[LSTRING(RecoveryFactor), LSTRING(RecoveryFactor_Description)],
LSTRING(DisplayName),
[0, 5, 1, 1],
true
[0, 10, 1, 2],
1
] call CBA_fnc_addSetting;
[
@ -68,8 +78,8 @@
"SLIDER",
[LSTRING(LoadFactor), LSTRING(LoadFactor_Description)],
LSTRING(DisplayName),
[0, 5, 1, 1],
true
[0, 5, 1, 2],
1
] call CBA_fnc_addSetting;
[
@ -77,33 +87,6 @@
"SLIDER",
[LSTRING(TerrainGradientFactor), LSTRING(TerrainGradientFactor_Description)],
LSTRING(DisplayName),
[0, 5, 1, 1],
true
] call CBA_fnc_addSetting;
[
QGVAR(swayFactor),
"SLIDER",
[LSTRING(SwayFactor), LSTRING(SwayFactor_Description)],
LSTRING(DisplayName),
[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
1
] call CBA_fnc_addSetting;

View File

@ -16,14 +16,28 @@
#include "\z\ace\addons\main\script_macros.hpp"
#define UNDERWEAR_WEIGHT 3.5
#define ANTPERCENT 0.8
#define SIM_BODYMASS 70
#define JOULES_PER_ML_O2 20.9
#define VO2MAX_STRENGTH 4.1
#define REE 18.83 //((0.5617 * SIM_BODYMASS + 42.57) * 0.23)
#define OXYGEN 0.9
#define WATTSPERATP 7
#define BIOMECH_EFFICIENCY 0.23
#define REE 18.83 // ((0.5617 * SIM_BODYMASS + 42.57) * BIOMECH_EFFICIENCY)
#define AE1_MAXRESERVE 4000000
#define AE2_MAXRESERVE 84000
#define AN_MAXRESERVE 2300
#define RESPIRATORY_BUFFER 60
#define MUSCLE_TEAR_RATE 0.00004
#define MUSCLE_RECOVERY 0.00000386
#define AE1_ATP_RELEASE_RATE 13.3 // mmol
#define AE2_ATP_RELEASE_RATE 16.7 // mmol
#define AN_ATP_RELEASE_RATE 113.3 // mmol
#define AE1_ATP_RECOVERY 6.60 // mmol
#define AE2_ATP_RECOVERY 5.83 // mmol
#define AN_ATP_RECOVERY 56.70 // mmol
#define AE1_MAXRESERVE 4000000 // mmol
#define AE2_MAXRESERVE 84000 // mmol
#define AN_MAXRESERVE 2300 // mmol

View File

@ -44,7 +44,7 @@
<Italian>Influenza la prestazione generale di tutti i giocatori smuniti di un fattore personalizzato. Maggiore significa migliore.</Italian>
<Chinese>影響所有玩家的體力表現,值越高代表體力越好</Chinese>
<Chinesesimp>影响所有玩家的体力表现,值越高代表体力越好</Chinesesimp>
<Russian>Влияет на общую производительность игроков, у которых не задано персональное значение.</Russian>
<Russian>Влияет на общую производительность игроков, у которых не задано персональное значение. Чем выше, тем лучше.</Russian>
<Portuguese>Influencia na performance geral de todos os jogadores sem nenhum fator personalizado. Quanto maior, melhor.</Portuguese>
<Czech>Ovlivňuje celkový výkon všech hráčů bez vlastního faktoru. Vyšší znamená lépe.</Czech>
</Key>
@ -59,7 +59,7 @@
<Italian>Influenza la prestazione personalizzata di questa unità. Maggiore significa migliore.</Italian>
<Chinese>影響這個單位的體力表現,值越高代表體力越好</Chinese>
<Chinesesimp>影响这个单位的体力表现,值越高代表体力越好</Chinesesimp>
<Russian>Влияет на общую производительность юнита.</Russian>
<Russian>Влияет на общую производительность юнита.Чем выше, тем лучше.</Russian>
<Portuguese>Influencia na performance geral dessa unidade. Quanto maior, melhor.</Portuguese>
<Czech>Ovlivňuje celkový výkon této jednotky. Vyšší znamená lépe.</Czech>
</Key>
@ -154,72 +154,6 @@
<Portuguese>Define o quanto que um terreno íngrime aumenta na perda de estamina. Quanto maior, maior a perda de estamina.</Portuguese>
<Czech>Nastavuje, o kolik strmý terén zvyšuje ztrátu výdrže. Vyšší znamená vyšší ztrátu výdrže.</Czech>
</Key>
<Key ID="STR_ACE_Advanced_Fatigue_SwayFactor">
<English>Sway factor</English>
<Spanish>Factor de balanceo de mira</Spanish>
<German>Verwacklungsfaktor</German>
<Japanese>手ぶれ因数</Japanese>
<Chinesesimp>抖动系数</Chinesesimp>
<Chinese>抖動因素</Chinese>
<French>Facteur de tremblement</French>
<Italian>Fattore di Oscillazione</Italian>
<Polish>Czynnik kołysania</Polish>
<Russian>Фактор колебания прицела</Russian>
<Portuguese>Fator de Balanço de Mira</Portuguese>
<Czech>Faktor kývání</Czech>
<Korean>손떨림 정도</Korean>
</Key>
<Key ID="STR_ACE_Advanced_Fatigue_SwayFactor_Description">
<English>Influences the amount of weapon sway. Higher means more sway.</English>
<Spanish>Afecta al la estabilidad de la mira. Más alto significa más balanceo</Spanish>
<German>Beeinflusst, wie ruhig man eine Waffe halten kann. Ein höherer Wert bedeutet weniger Stabilisierung.</German>
<Japanese>武器の手ぶれの量に影響します。値が高いほど、手ぶれが強くなります。</Japanese>
<Chinesesimp>影响手持武器的晃动程度,数值越高,抖动的越厉害。</Chinesesimp>
<Chinese>影響手持武器晃動程度,數值越高抖動越厲害</Chinese>
<French>Influe sur l'amplitude du tremblement de l'arme. Une valeur plus élevée signifie plus de tremblement.</French>
<Italian>Influenza l'aumento di oscillazione dell'arma quando affaticato. Maggiore significa più oscillazione.</Italian>
<Polish>Wpływa na poziom kołysania broni. Większa ilość znaczy większe kołysanie.</Polish>
<Russian>Влияет на колебания прицела оружия. Чем выше - тем больше.</Russian>
<Portuguese>Influencia a quantidade de balanço da mira da arma. Quanto maior, mais balanço.</Portuguese>
<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>
<Korean>휴식 시 손떨림 정도</Korean>
<Portuguese>Fator de balanço de mira em repouso</Portuguese>
<German>Verwacklungsfaktor, wenn aufgelegt</German>
<Italian>Fattore di Oscillazione Appoggiato</Italian>
<Japanese>静止時の手ぶれ係数</Japanese>
</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>
<Korean>무기가 아무런 행동도 하지 않는 동안 무기가 흔들리는 정도를 정합니다.</Korean>
<Portuguese>Influencia a quantidade de balanço de mira enquanto a arma está em repouso.</Portuguese>
<German>Beeinflusst, wie ruhig man die Waffe hält, während sie aufgelegt ist.</German>
<Italian>Determina la quantità di oscillazione dell'arma quando questa è appoggiata.</Italian>
<Japanese>静止している時の武器の手ぶれの量に影響します。</Japanese>
</Key>
<Key ID="STR_ACE_Advanced_Fatigue_DeployedSwayFactor">
<English>Deployed sway factor</English>
<French>Facteur de balancement déployé</French>
<Korean>거치 시 손떨림 정도</Korean>
<Portuguese>Fator de balanço de mira em posição de tiro</Portuguese>
<German>Verwacklungsfaktor, wenn Zweibein aufgestellt ist.</German>
<Italian>Fattore di Oscillazione su Bipode</Italian>
<Japanese>展開時の手ぶれ係数</Japanese>
</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>
<Korean>무기를 거치하는 동안 무기를 흔드는 정도를 정합니다.</Korean>
<Portuguese>Influencia a quantidade de balanço de mira enquanto a arma está em posição de tiro.</Portuguese>
<German>Beeinflusst, wie ruhig man die Waffen hält, während das Zweibein aufgestellt ist.</German>
<Italian>Determina la quantità di oscillazione dell'arma quando questa è stabilizzata usando il bipode.</Italian>
<Japanese>武器の展開(Cキー)時の武器の手ぶれの量に影響します。</Japanese>
</Key>
<Key ID="STR_ACE_Advanced_Fatigue_Enabled">
<English>Enabled</English>
<Spanish>Activada</Spanish>
@ -246,7 +180,7 @@
<Italian>Abilita/Disabilita la Fatica Avanzata.</Italian>
<Chinese>啟用/關閉進階體力.</Chinese>
<Chinesesimp>启用/关闭进阶体力。</Chinesesimp>
<Russian>Включает / Отключает Продвинутую усталость</Russian>
<Russian>Включает/отключает Продвинутую усталость</Russian>
<Portuguese>Ativa/Desativa Fadiga Avançada.</Portuguese>
<Czech>Aktivuje / deaktivuje Pokročilou únavu.</Czech>
</Key>

View File

@ -2,26 +2,18 @@
// Fired XEH
GVAR(ammoEventHandlers) = createHashMap;
[QGVAR(throwFiredXEH), FUNC(throwFiredXEH)] call CBA_fnc_addEventHandler;
[QGVAR(throwFiredXEH), LINKFUNC(throwFiredXEH)] call CBA_fnc_addEventHandler;
// Exit on HC
if (!hasInterface) exitWith {};
// Ammo/Magazines look-up hash for correctness of initSpeed
GVAR(ammoMagLookup) = call CBA_fnc_createNamespace;
{
{
private _ammo = getText (configFile >> "CfgMagazines" >> _x >> "ammo");
if (_ammo != "") then { GVAR(ammoMagLookup) setVariable [_ammo, _x]; };
} count (getArray (configFile >> "CfgWeapons" >> "Throw" >> _x >> "magazines"));
nil
} count getArray (configFile >> "CfgWeapons" >> "Throw" >> "muzzles");
// Temporary Wind Info indication
GVAR(tempWindInfo) = false;
// Add keybinds
["ACE3 Weapons", QGVAR(prepare), localize LSTRING(Prepare), {
// Condition
if (!([ACE_player] call FUNC(canPrepare))) exitWith {false};
if !([ACE_player] call FUNC(canPrepare)) exitWith {false};
if (EGVAR(common,isReloading)) exitWith {true};
// Statement

View File

@ -1,3 +1,21 @@
#include "script_component.hpp"
#include "XEH_PREP.hpp"
// Ammo/Magazines look-up hash for correctness of initSpeed
private _cfgMagazines = configFile >> "CfgMagazines";
private _cfgAmmo = configFile >> "CfgAmmo";
private _cfgThrow = configFile >> "CfgWeapons" >> "Throw";
private _ammoMagLookup = createHashMap;
{
{
private _ammo = getText (_cfgMagazines >> _x >> "ammo");
if (_ammo != "") then {
_ammoMagLookup set [configName (_cfgAmmo >> _ammo), _x];
};
} forEach (getArray (_cfgThrow >> _x >> "magazines"));
} forEach (getArray (_cfgThrow >> "muzzles"));
uiNamespace setVariable [QGVAR(ammoMagLookup), compileFinal _ammoMagLookup];

View File

@ -19,7 +19,7 @@ params ["_unit"];
if !(_unit getVariable [QGVAR(inHand), false]) exitWith {false};
if (vehicle _unit != _unit) exitWith {
if (!isNull objectParent _unit) exitWith {
private _startPos = eyePos _unit;
private _aimLinePos = AGLToASL (positionCameraToWorld [0, 0, 1]);
private _intersections = lineIntersectsSurfaces [_startPos, _aimLinePos, _unit, objNull, false];

View File

@ -43,13 +43,10 @@ if ((!_primed) && {!((_throwableMag in (uniformItems ACE_player)) || {_throwable
// Get correct throw power for primed grenade
if (_primed) then {
private _ammoType = typeOf _activeThrowable;
_throwableMag = GVAR(ammoMagLookup) getVariable _ammoType;
if (isNil "_throwableMag") then {
// What we're trying to throw must not be a normal throwable because it is not in our lookup hash (e.g. 40mm smoke)
// Just use HandGrenade as it has an average initSpeed value
_throwableMag = "HandGrenade";
};
// If ammo type is not found:
// What we're trying to throw must not be a normal throwable because it is not in our lookup hash (e.g. 40mm smoke)
// Just use HandGrenade as it has an average initSpeed value
_throwableMag = (uiNamespace getVariable QGVAR(ammoMagLookup)) getOrDefault [typeOf _activeThrowable, "HandGrenade"];
};
// Some throwables have different classname for magazine and ammo

View File

@ -53,6 +53,12 @@ _unit setVariable [QGVAR(dropDistance), DROP_DISTANCE_DEFAULT];
// Remove controls hint (check if ever enabled is inside the function)
call EFUNC(interaction,hideMouseHint);
// Hide wind info after throw, if it was temporarily enabled for the throw
if (GVAR(tempWindInfo)) then {
EGVAR(weather,WindInfo) = false;
GVAR(tempWindInfo) = false;
};
// Remove throw action
[_unit, "DefaultAction", _unit getVariable [QGVAR(throwAction), -1]] call EFUNC(common,removeActionEventHandler);

View File

@ -17,9 +17,9 @@
params ["_magazineClassname"];
_magazineClassname = toLower _magazineClassname;
_magazineClassname = toLowerANSI _magazineClassname;
private _throwMuzzles = getArray (configFile >> "CfgWeapons" >> "Throw" >> "muzzles");
_throwMuzzles = _throwMuzzles select {_magazineClassname in ((getArray (configFile >> "CfgWeapons" >> "Throw" >> _x >> "magazines")) apply {toLower _x})};
_throwMuzzles = _throwMuzzles select {_magazineClassname in ((getArray (configFile >> "CfgWeapons" >> "Throw" >> _x >> "magazines")) apply {toLowerANSI _x})};
[_throwMuzzles select 0, ""] select (_throwMuzzles isEqualTo [])

View File

@ -21,7 +21,7 @@ TRACE_1("params",_unit);
// Select next throwable if one already in hand
if (_unit getVariable [QGVAR(inHand), false]) exitWith {
TRACE_1("inHand",_unit);
if (!(_unit getVariable [QGVAR(primed), false])) then {
if !(_unit getVariable [QGVAR(primed), false]) then {
TRACE_1("not primed",_unit);
// Restore muzzle ammo (setAmmo 1 has no impact if no appliccable throwable in inventory)
// selectNextGrenade relies on muzzles array (setAmmo 0 removes the muzzle from the array and current can't be found, cycles between 0 and 1 muzzles)
@ -35,6 +35,11 @@ if (isNull (_unit getVariable [QGVAR(activeThrowable), objNull]) && {(currentThr
TRACE_1("no throwables",_unit);
};
// Temporarily enable wind info, to aid in throwing smoke grenades effectively
if (GVAR(enableTempWindInfo) && {!(missionNamespace getVariable [QEGVAR(weather,WindInfo), false])}) then {
[] call EFUNC(weather,displayWindInfo);
GVAR(tempWindInfo) = true;
};
_unit setVariable [QGVAR(inHand), true];

View File

@ -44,8 +44,7 @@
_addedPickUpHelpers pushBack _pickUpHelper;
_throwablesHelped pushBack _x;
};
nil
} count _nearThrowables;
} forEach _nearThrowables;
_args set [0, getPosASL ACE_player];
_args set [3, _nearThrowables];
@ -56,11 +55,10 @@
{
// Only handling with attachTo works nicely
_x attachTo [_x getVariable [QGVAR(throwable), objNull], [0, 0, 0]];
nil
} count _addedPickUpHelpers;
} forEach _addedPickUpHelpers;
} else {
TRACE_1("Cleaning Pick Up Helpers",count _addedPickUpHelpers);
{deleteVehicle _x} count _addedPickUpHelpers;
{deleteVehicle _x} forEach _addedPickUpHelpers;
[_idPFH] call CBA_fnc_removePerFrameHandler;
};
}, 0, [(getPosASL ACE_player) vectorAdd [-100, 0, 0], [], [], []]] call CBA_fnc_addPerFrameHandler;

View File

@ -20,7 +20,7 @@ TRACE_1("params",_unit);
// Prime the throwable if it hasn't been cooking already
// Next to proper simulation this also has to happen before delay for orientation of the throwable to be set
if (!(_unit getVariable [QGVAR(primed), false])) then {
if !(_unit getVariable [QGVAR(primed), false]) then {
[_unit] call FUNC(prime);
};
@ -45,7 +45,7 @@ if (!(_unit getVariable [QGVAR(primed), false])) then {
private _newVelocity = (_p1 vectorFromTo _p2) vectorMultiply _velocity;
// Adjust for throwing from inside vehicles, where we have a vehicle-based velocity that can't be compensated for by a human
if (vehicle _unit != _unit) then {
if (!isNull objectParent _unit) then {
_newVelocity = _newVelocity vectorAdd (velocity (vehicle _unit));
};

View File

@ -40,3 +40,11 @@ private _category = format ["ACE %1", localize LSTRING(Category)];
true,
1
] call CBA_fnc_addSetting;
[
QGVAR(enableTempWindInfo), "CHECKBOX",
[LSTRING(EnableTempWindInfo_DisplayName), LSTRING(EnableTempWindInfo_Description)],
_category,
true,
0
] call CBA_fnc_addSetting;

View File

@ -144,7 +144,7 @@
<English>Enables ability to pick up throwables from the ground.</English>
<Spanish>Activa la habilidad de coger objetos lanzados del suelo</Spanish>
<Russian>Включает возможность подбирать гранаты с земли.</Russian>
<Japanese>地面に落ちている投擲物を拾い上げる機能を有効化します。</Japanese>
<Japanese>地面に落ちている投擲物を拾機能を有効化します。</Japanese>
<Polish>Umożliwia podnoszenie obiektów miotanych z ziemi.</Polish>
<German>Aktiviert die Möglichkeit, geworfene Objekte wieder vom Boden aufzuheben.</German>
<Korean>땅에 떨어진 투척물을 주울 수 있게 해줍니다.</Korean>
@ -174,7 +174,7 @@
<English>Enables ability to pick up throwables from attached objects.</English>
<Spanish>Activa la habilidad de lanzar objetos enganchados</Spanish>
<Russian>Включает возможность подбирать гранаты, прикрепленные к объектам.</Russian>
<Japanese>オブジェクトに装着された投擲可能物を拾い上げる機能を有効化します。</Japanese>
<Japanese>オブジェクトに装着された投擲物を拾う機能を有効化します。</Japanese>
<Polish>Umożliwia podnoszenie obiektów miotanych przyczepionych do innych obiektów.</Polish>
<German>Aktiviert die Möglichkeit, befestigte Wurfobjekte erneut aufzunehmen.</German>
<Korean>부착된 투척물을 주울 수 있게 해줍니다.</Korean>
@ -185,6 +185,26 @@
<Portuguese>Permite que arremessáveis fixados em objetos sejam pegos.</Portuguese>
<Czech>Zapíná schopnost zvednutí předmětů z objektů ke kterým jsou připnuté.</Czech>
</Key>
<Key ID="STR_ACE_Advanced_Throwing_EnableTempWindInfo_DisplayName">
<English>Show Temporary Wind Info</English>
<German>Zeige temporäre Windinformationen</German>
<Italian>Mostra informazioni sul vento temporaneamente</Italian>
<Japanese>一時的に風の情報を表示</Japanese>
<Korean>바람 정보 임시로 표시</Korean>
<French>Afficher temporairement les informations sur le vent</French>
<Russian>Временно показать информацию о ветре</Russian>
<Spanish>Mostrar información del viento temporalmente</Spanish>
</Key>
<Key ID="STR_ACE_Advanced_Throwing_EnableTempWindInfo_Description">
<English>Temporarily display Wind Info while throwing, to aid in placing smoke grenades effectively.</English>
<German>Zeige während des werfens Windinformationen an, um Rauchgranaten effektiver zu platzieren.</German>
<Italian>Mostra le informazioni sul vento durante il lancio di granate, facilitando il piazzamento ottimale di fumogeni.</Italian>
<Japanese>投擲行動中に風向きの情報を一時的に表示し、発煙手榴弾の煙幕を効果的に展開しやすくします。</Japanese>
<Korean>연막탄을 효과적으로 배치하는 데 도움이 되도록 투척하는 동안 일시적으로 바람 정보를 표시합니다.</Korean>
<French>Affiche les informations sur le vent pendant le lancement pour placer les grenades fumigènes plus efficacement.</French>
<Russian>Временно отображайте информацию о ветре во время броска, чтобы помочь эффективно разместить дымовые шашки.</Russian>
<Spanish>Mostrar información del viento temporalmente mientras se lanza, para ayudar a lanzar las granadas de humo de forma efectiva.</Spanish>
</Key>
<Key ID="STR_ACE_Advanced_Throwing_Prepare">
<English>Prepare/Change Throwable</English>
<Spanish>Preparar/Cambiar objetos lanzables</Spanish>
@ -234,7 +254,7 @@
<English>Primed</English>
<Spanish>Preparado</Spanish>
<Russian>Подготовлена</Russian>
<Japanese>点火</Japanese>
<Japanese>点火した</Japanese>
<Polish>Odbezpieczony</Polish>
<German>Scharf gemacht</German>
<Korean>뇌관 작동</Korean>

View File

@ -16,7 +16,7 @@
} forEach _sections;
}] call CBA_fnc_addEventHandler;
[QGVAR(unGarrison), FUNC(unGarrison)] call CBA_fnc_addEventHandler;
[QGVAR(unGarrison), LINKFUNC(unGarrison)] call CBA_fnc_addEventHandler;
[QGVAR(doMove), {
params ["_unitsArray"];
@ -73,6 +73,6 @@
if (isServer) then {
["CAManBase", "init", {
// wait for HMD to be assigned so `hmd _unit` works
[FUNC(assignNVG), _this, 1] call CBA_fnc_waitAndExecute;
[LINKFUNC(assignNVG), _this, 1] call CBA_fnc_waitAndExecute;
}] call CBA_fnc_addClassEventHandler;
};

View File

@ -33,7 +33,7 @@ if (_startingPos isEqualTo [0,0,0]) exitWith {
[LSTRING(GarrisonInvalidPosition)] call EFUNC(common,displayTextStructured);
};
if (count _unitsArray == 0 || {isNull (_unitsArray select 0)}) exitWith {
if (_unitsArray isEqualTo [] || {isNull (_unitsArray select 0)}) exitWith {
TRACE_1("fnc_garrison: Units error",_unitsArray);
[LSTRING(GarrisonNoUnits)] call EFUNC(common,displayTextStructured);
};
@ -43,7 +43,7 @@ if (_fillingRadius >= 50) then {
_buildings = [_buildings] call CBA_fnc_shuffle;
};
if (count _buildings == 0) exitWith {
if (_buildings isEqualTo []) exitWith {
TRACE_1("fnc_garrison: Building error",_buildings);
[LSTRING(GarrisonNoBuilding)] call EFUNC(common,displayTextStructured);
};

View File

@ -90,6 +90,8 @@
<French>Equipement JVN automatique</French>
<Portuguese>Equipar NVGs automaticamente</Portuguese>
<Japanese>暗視装置の自動装備</Japanese>
<Russian>Автоматическое оснащение ПНВ</Russian>
<Spanish>Auto equipar gafas de visión nocturna</Spanish>
</Key>
<Key ID="STR_ACE_AI_AssignNVG_Description">
<English>Equips NVG in inventory during night time and unequips it during day time.\nDoes not add NVGs to inventory!</English>
@ -100,6 +102,8 @@
<French>Equipe des JVN pendant la nuit et les déséquipe le jour.\nN'ajoute pas les JVN dans l'intenvaire !</French>
<Portuguese>Equipa o NVG do inventário durante a noite e desequipa durante o dia.\nNão adiciona NVGs ao inventário!</Portuguese>
<Japanese>インベントリ内の暗視装置を夜間に装備し、日中は解除し収納します。\nこれはNVGをインベントリに追加しません。</Japanese>
<Russian>Экипирует ПНВ в ночное время и отключает его в дневное время.\nНе добавляет ПНВ в инвентарь!</Russian>
<Spanish>Equipa las gafas de visión nocturna en el inventario cuando es de noche, y las desequipa cuando es de día.\nNo añade las gafas al inventario!</Spanish>
</Key>
</Package>
</Project>

View File

@ -30,6 +30,6 @@ _vehicle == vehicle _unit
if (_unit == _x select FULLCREW_UNIT) exitWith {
_ejectVarName = format [QGVAR(ejectAction_%1_%2), _x select FULLCREW_ROLE, _x select FULLCREW_TURRETPATH];
};
} count fullCrew _vehicle;
} forEach fullCrew _vehicle;
_vehicle getVariable [_ejectVarName, false]
}

View File

@ -22,7 +22,7 @@ if (!alive _vehicle) exitWith {};
if (_vehicle getVariable [QGVAR(droneActionsAdded), false]) exitWith {};
_vehicle setVariable [QGVAR(droneActionsAdded), true];
// move to location
// Move to location
private _condition = {
params ["_vehicle"];
(missionNamespace getVariable [QGVAR(droneWaypoints), true]) && {waypointsEnabledUAV _vehicle} && {(ACE_controlledUAV select 2) isEqualTo [0]}
@ -37,14 +37,63 @@ private _action = [QGVAR(droneSetWaypointMove), localize "$STR_AC_MOVE",
"\a3\3DEN\Data\CfgWaypoints\Move_ca.paa", _statement, _condition] call EFUNC(interact_menu,createAction);
[_vehicle, 1, ["ACE_SelfActions"], _action] call EFUNC(interact_menu,addActionToObject);
// Follow unit/vehicle at turret location
_condition = {
params ["_vehicle"];
private _target = cursorTarget;
(missionNamespace getVariable [QGVAR(droneWaypoints), true]) && {waypointsEnabledUAV _vehicle} && {(ACE_controlledUAV select 2) isEqualTo [0]} && {!isNull _target} && {["CAManBase", "LandVehicle", "Ship"] findIf {_target isKindOf _x} != -1}
};
_statement = {
params ["_vehicle"];
private _group = group driver _vehicle;
private _pos = ([_vehicle, [0]] call FUNC(droneGetTurretTargetPos)) select 0;
[QGVAR(droneSetWaypoint), [_vehicle, _group, _pos, "FOLLOW", cursorTarget], _group] call CBA_fnc_targetEvent;
private _followDistance = _vehicle getVariable [QGVAR(wpFollowDistance), 0];
[[LLSTRING(DroneFollowHint), _followDistance], 3] call EFUNC(common,displayTextStructured);
};
_action = [QGVAR(droneSetWaypointFollow), localize "$STR_AC_FOLLOW", "\a3\3DEN\Data\CfgWaypoints\Follow_ca.paa", _statement, _condition] call EFUNC(interact_menu,createAction);
[_vehicle, 1, ["ACE_SelfActions"], _action] call EFUNC(interact_menu,addActionToObject);
// Set drone follow distance
_condition = {
params ["_vehicle"];
private _group = group driver _vehicle;
private _index = (currentWaypoint _group) min count waypoints _group;
private _waypoint = [_group, _index];
(missionNamespace getVariable [QGVAR(droneWaypoints), true]) && {waypointsEnabledUAV _vehicle} && {(ACE_controlledUAV select 2) isEqualTo [0]} && {(waypointType _waypoint) == "HOLD"}
};
_statement = {
params ["_vehicle", "", "_value"];
_vehicle setVariable [QGVAR(wpFollowDistance), _value];
[[LLSTRING(DroneFollowHint), _value], 3] call EFUNC(common,displayTextStructured);
};
_action = [QGVAR(droneSetFollowDistance), LLSTRING(DroneFollowDistance), "", {}, _condition] call EFUNC(interact_menu,createAction);
private _base = [_vehicle, 1, ["ACE_SelfActions"], _action] call EFUNC(interact_menu,addActionToObject);
private _followDistances = if (_vehicle isKindOf "Car_F") then {
[0, 25, 50, 100, 200]
} else {
[0, 100, 200, 300, 400, 500]
};
{
_action = [
QGVAR(droneSetFollowDistance_) + str _x,
str _x,
"",
_statement,
{true},
{},
_x
] call EFUNC(interact_menu,createAction);
[_vehicle, 1, _base, _action] call EFUNC(interact_menu,addActionToObject);
} forEach _followDistances;
if (_vehicle isKindOf "Air") then {
// loiter at location
// Loiter at location
_condition = {
params ["_vehicle"];
(missionNamespace getVariable [QGVAR(droneWaypoints), true]) && {waypointsEnabledUAV _vehicle} && {(ACE_controlledUAV select 2) isEqualTo [0]}
};
_statement = {
_statement = {
params ["_vehicle"];
private _group = group driver _vehicle;
private _pos = ([_vehicle, [0]] call FUNC(droneGetTurretTargetPos)) select 0;
@ -55,7 +104,7 @@ if (_vehicle isKindOf "Air") then {
[_vehicle, 1, ["ACE_SelfActions"], _action] call EFUNC(interact_menu,addActionToObject);
// set height
// Set height
_condition = {
params ["_vehicle"];
(missionNamespace getVariable [QGVAR(droneWaypoints), true]) && {waypointsEnabledUAV _vehicle} && {(ACE_controlledUAV select 2) isEqualTo [0]}
@ -74,7 +123,7 @@ if (_vehicle isKindOf "Air") then {
} forEach [20, 50, 200, 500, 2000];
// set loiter radius
// Set loiter radius
_condition = {
params ["_vehicle"];
private _group = group driver _vehicle;
@ -97,7 +146,7 @@ if (_vehicle isKindOf "Air") then {
} forEach [500, 750, 1000, 1250, 1500];
// set loiter direction
// Set loiter direction
_condition = {
params ["_vehicle", "", "_args"];
private _group = group driver _vehicle;

View File

@ -17,13 +17,13 @@
*
* Public: No
*/
params ["_vehicle", "_group", "_type", "_value"];
TRACE_4("droneModifyWaypoint",_vehicle,_group,_type,_value);
private _index = (currentWaypoint _group) min count waypoints _group;
private _waypoint = [_group, _index];
switch (toLower _type) do {
switch (toLowerANSI _type) do {
case ("height"): {
private _pos = waypointPosition _waypoint;
_pos set [2, _value];

View File

@ -8,6 +8,7 @@
* 1: Group <GROUP>
* 2: Pos 2D <ARRAY>
* 3: Type <STRING>
* 4: Target to follow <OBJECT> (default: objNull)
*
* Return Value:
* None
@ -18,7 +19,7 @@
* Public: No
*/
params ["_vehicle", "_group", "_pos", "_type"];
params ["_vehicle", "_group", "_pos", "_type", ["_target", objNull]];
TRACE_4("droneSetWaypoint",_vehicle,_group,_pos,_type);
private _index = (currentWaypoint _group) min count waypoints _group;
@ -34,9 +35,34 @@ _pos set [
[0, _currentHeight] select (_currentHeight >= 50)
];
// [_group] call CBA_fnc_clearWaypoints;
_waypoint = _group addWaypoint [_pos, 0];
_waypoint setWaypointType _type;
// The Vanilla "FOLLOW"-type waypoint is not used directly, due to 2 main issues (as of v2.16):
// - It does not work at all for UGVs, which is a known issue https://feedback.bistudio.com/T126283;
// - No clear scripting way was found to mimic the UAV Terminal's "Follow Distance" functionality;
// Instead, the solution for both UAV and UGV following consists of a CBA PFH that moves a "HOLD"-type Waypoint every 3 seconds.
// Either on the target itself, or on the Drone's current position if the target is within the desired follow distance.
if (_type == "FOLLOW" && {["CAManBase", "LandVehicle", "Ship"] findIf {_target isKindOf _x} != -1}) then {
_waypoint setWaypointType "HOLD";
[{
params ["_args", "_handle"];
_args params ["_vehicle", "_group", "_waypoint", "_target"];
if ( // Abort PFH if a new waypoint is created via UAV Terminal or ACE Interaction
_waypoint select 1 != currentWaypoint _group ||
{!alive _vehicle} || {isNull _target}
) exitWith {
deleteWaypoint _waypoint;
[_handle] call CBA_fnc_removePerFrameHandler;
};
private _followDistance = _vehicle getVariable [QGVAR(wpFollowDistance), 0];
if ((_vehicle distance2D _target) < _followDistance) then {
_waypoint setWaypointPosition [getPosASL _vehicle, -1];
} else {
_waypoint setWaypointPosition [getPosASL _target, -1];
};
}, 3, [_vehicle, _group, _waypoint, _target]] call CBA_fnc_addPerFrameHandler;
};
TRACE_3("",_currentHeight,_currentLoiterRadius,_currentLoiterType);
if (_currentHeight > 1) then { _vehicle flyInHeight _currentHeight; };

View File

@ -129,7 +129,7 @@
<Japanese>30mm コンバット ミックス 4:1 劣化ウラン徹甲弾:焼夷榴弾</Japanese>
<Czech>30mm Bojový Mix 4:1 DU:HEI</Czech>
<Russian>30мм Смешанное боепитание 4:1 ОУ:ОФЗ</Russian>
<Korean>30mm 4:1 열화:고폭소이</Korean>
<Korean>30mm 열화우라늄:고폭소이 4:1 혼합</Korean>
<Portuguese>30mm Mix de Combate 4:1 DU:AEI</Portuguese>
</Key>
<Key ID="STR_ACE_Aircraft_GatlingDescriptionShortCM41">
@ -145,7 +145,7 @@
<Japanese>30mm CM 4:1</Japanese>
<Czech>30mm BM 4:1</Czech>
<Russian>30мм СБ 4:1</Russian>
<Korean>30mm CM 4:1</Korean>
<Korean>30mm 4:1 혼합</Korean>
</Key>
<Key ID="STR_ACE_Aircraft_GatlingDescriptionCM51">
<English>30mm Combat Mix 5:1 DU:HEI</English>
@ -160,7 +160,7 @@
<Japanese>30mm コンバット ミックス 5:1 劣化ウラン徹甲弾:焼夷榴弾</Japanese>
<Czech>30mm Bojový Mix 5:1 DU:HEI</Czech>
<Russian>30мм Смешанное боепитание 5:1 ОУ:ОФЗ</Russian>
<Korean>30mm 5:1 열화:고폭소이</Korean>
<Korean>30mm 열화우라늄:고폭소이 5:1 혼합</Korean>
</Key>
<Key ID="STR_ACE_Aircraft_GatlingDescriptionShortCM51">
<English>30mm CM 5:1</English>
@ -175,7 +175,21 @@
<Japanese>30mm CM 5:1</Japanese>
<Czech>30mm BM 5:1</Czech>
<Russian>30мм СБ 5:1</Russian>
<Korean>30mm CM 5:1</Korean>
<Korean>30mm 5:1 혼합</Korean>
</Key>
<Key ID="STR_ACE_Aircraft_DroneFollowDistance">
<English>Follow Distance</English>
<Italian>Distanza di seguimento</Italian>
<German>Folge-Entfernung</German>
<Korean>따라가는 거리</Korean>
<Japanese>追跡距離</Japanese>
</Key>
<Key ID="STR_ACE_Aircraft_DroneFollowHint">
<English>Following unit within %1m</English>
<Italian>Seguendo unità entro %1m</Italian>
<German>Folgt Einheit bis zu %1m</German>
<Korean>%1m 이내로 유닛을 따라갑니다</Korean>
<Japanese>%1m 間隔で 目標を追跡します</Japanese>
</Key>
</Package>
</Project>

View File

@ -123,7 +123,9 @@ class GVAR(stats) {
stats[] = {"maximumLoad"};
displayName = "$STR_a3_rscdisplayarsenal_stat_load";
showBar = 1;
showText = 1;
barStatement = QUOTE([ARR_3((_this select 0) select 0,_this select 1,[ARR_3([ARR_2(0,500)],[ARR_2(0.01,1)],false)])] call FUNC(statBarStatement_default));
textStatement = QUOTE(call FUNC(statTextStatement_load));
tabs[] = {{3,4,5}, {}};
};
class ACE_smokeChemTTL: statBase {

View File

@ -110,7 +110,7 @@ class Cfg3DEN {
h = QUOTE(65 * ATTRIBUTE_H);
drawSideArrows = 1;
disableOverflow = 1;
columns[] = {0.05, 0.15, 0.85};
columns[] = {0.05, 0.15, 0.83, 0.87};
};
class ArrowLeft: ctrlButton {
idc = IDC_ATTRIBUTE_LIST_LEFT;

View File

@ -16,6 +16,8 @@ PREP(attributeKeyDown);
PREP(attributeLoad);
PREP(attributeMode);
PREP(attributeSelect);
PREP(baseAttachment);
PREP(baseOptic);
PREP(baseWeapon);
PREP(buttonActionsPage);
PREP(buttonCargo);
@ -96,6 +98,7 @@ PREP(statBarStatement_rateOfFIre);
PREP(statTextStatement_accuracy);
PREP(statTextStatement_explosionTime);
PREP(statTextStatement_illuminators);
PREP(statTextStatement_load);
PREP(statTextStatement_magCount);
PREP(statTextStatement_mass);
PREP(statTextStatement_rateOfFire);

View File

@ -70,7 +70,7 @@ GVAR(lastSortDirectionRight) = DESCENDING;
if (!isNil QGVAR(currentLoadoutsTab) && {GVAR(currentLoadoutsTab) == IDC_buttonSharedLoadouts}) then {
private _curSelData = _contentPanelCtrl lnbData [lnbCurSelRow _contentPanelCtrl, 1];
([_loadoutData] call FUNC(verifyLoadout)) params ["_extendedLoadout", "_nullItemsAmount", "_unavailableItemsAmount"];
([_loadoutData] call FUNC(verifyLoadout)) params ["_extendedLoadout", "_nullItemsList", "_unavailableItemsList"];
_extendedLoadout params ["_loadout"];
private _newRow = _contentPanelCtrl lnbAddRow [_playerName, _loadoutName];
@ -81,10 +81,10 @@ GVAR(lastSortDirectionRight) = DESCENDING;
_contentPanelCtrl lnbSetData [[_newRow, 1], _playerName + _loadoutName];
// Set color of row, depending if items are unavailable/missing
if (_nullItemsAmount > 0) then {
if (_nullItemsList isNotEqualTo []) then {
_contentPanelCtrl lnbSetColor [[_newRow, 1], [1, 0, 0, 0.8]];
} else {
if (_unavailableItemsAmount > 0) then {
if (_unavailableItemsList isNotEqualTo []) then {
_contentPanelCtrl lnbSetColor [[_newRow, 1], [1, 1, 1, 0.25]];
};
};
@ -108,24 +108,16 @@ GVAR(lastSortDirectionRight) = DESCENDING;
private _face = _extendedInfo getOrDefault [QGVAR(face), ""];
if (_face != "") then {
if (isMultiplayer) then {
private _id = [QGVAR(broadcastFace), [_unit, _face], QGVAR(centerFace_) + netId _unit] call CBA_fnc_globalEventJIP;
[_id, _unit] call CBA_fnc_removeGlobalEventJIP;
} else {
_unit setFace _face;
};
private _id = [QGVAR(broadcastFace), [_unit, _face], QGVAR(centerFace_) + hashValue _unit] call CBA_fnc_globalEventJIP;
[_id, _unit] call CBA_fnc_removeGlobalEventJIP;
};
// Set voice
private _voice = _extendedInfo getOrDefault [QGVAR(voice), ""];
if (_voice != "") then {
if (isMultiplayer) then {
private _id = [QGVAR(broadcastVoice), [_unit, _voice], QGVAR(centerVoice_) + netId _unit] call CBA_fnc_globalEventJIP;
[_id, _unit] call CBA_fnc_removeGlobalEventJIP;
} else {
_unit setSpeaker _voice;
};
private _id = [QGVAR(broadcastVoice), [_unit, _voice], QGVAR(centerVoice_) + hashValue _unit] call CBA_fnc_globalEventJIP;
[_id, _unit] call CBA_fnc_removeGlobalEventJIP;
};
// Set insignia
@ -147,7 +139,7 @@ GVAR(lastSortDirectionRight) = DESCENDING;
// Set voice if enabled
if (GVAR(loadoutsSaveVoice)) then {
_extendedInfo set [QGVAR(voice), speaker _unit];
_extendedInfo set [QGVAR(voice), (speaker _unit) call EFUNC(common,getConfigName)];
};
// Set insignia if enabled

View File

@ -48,4 +48,47 @@ call FUNC(compileStats);
// Setup Tools tab
[keys (uiNamespace getVariable [QGVAR(configItemsTools), createHashMap]), LLSTRING(toolsTab), TOOLS_TAB_ICON, -1, true] call FUNC(addRightPanelButton);
// TODO: make IDCs able to match IDX with simple math?
GVAR(idxMap) = createHashMapFromArray [
[IDC_buttonPrimaryWeapon, IDX_VIRT_PRIMARY_WEAPONS],
[IDC_buttonHandgun, IDX_VIRT_HANDGUN_WEAPONS],
[IDC_buttonSecondaryWeapon, IDX_VIRT_SECONDARY_WEAPONS],
[IDC_buttonHeadgear, IDX_VIRT_HEADGEAR],
[IDC_buttonUniform, IDX_VIRT_UNIFORM],
[IDC_buttonVest, IDX_VIRT_VEST],
[IDC_buttonBackpack, IDX_VIRT_BACKPACK],
[IDC_buttonGoggles, IDX_VIRT_GOGGLES],
[IDC_buttonNVG, IDX_VIRT_NVG],
[IDC_buttonBinoculars, IDX_VIRT_BINO],
[IDC_buttonMap, IDX_VIRT_MAP],
[IDC_buttonGPS, IDX_VIRT_COMMS],
[IDC_buttonRadio, IDX_VIRT_RADIO],
[IDC_buttonCompass, IDX_VIRT_COMPASS],
[IDC_buttonWatch, IDX_VIRT_WATCH]
];
// Make new hashmaps for face/voice/insignia so mission makers can disable them
// Copies of hashmaps aren't final
GVAR(faceCache) = +(uiNamespace getVariable QGVAR(faceCache));
GVAR(voiceCache) = +(uiNamespace getVariable QGVAR(voiceCache));
GVAR(insigniaCache) = +(uiNamespace getVariable QGVAR(insigniaCache));
// Get mission/campaign insignias
// BIS_fnc_setUnitInsignia will look in mission config, then campaign, then global config last, so overwrite accordingly
private _insigniaCondition = toString {
if (isNumber (_x >> "scope")) then {
getNumber (_x >> "scope") == 2
} else {
true
};
};
// Ref fnc_addListBoxItem, 0/nil = configFile, 1 = campaignConfigFile, 2 = missionConfigFile
{
GVAR(insigniaCache) set [configName _x, 1];
} forEach (_insigniaCondition configClasses (campaignConfigFile >> "CfgUnitInsignia"));
{
GVAR(insigniaCache) set [configName _x, 2];
} forEach (_insigniaCondition configClasses (missionConfigFile >> "CfgUnitInsignia"));
ADDON = true;

View File

@ -270,6 +270,7 @@
#define IDX_VIRT_UNIQUE_UNKNOWN_ITEMS 25
// Indexes of current items array
// Should match IDX_VIRT_X macros for any left panel tabs
#define IDX_CURR_PRIMARY_WEAPON 0
#define IDX_CURR_SECONDARY_WEAPON 1
#define IDX_CURR_HANDGUN_WEAPON 2
@ -489,3 +490,6 @@ if (!isNil QGVAR(customRightPanelButtons)) then {\
_contentPanelCtrl lnbSetPicture [[_newRow, 7], getText (configFile >> "CfgVehicles" >> (_loadout select IDX_LOADOUT_BACKPACK) select 0 >> "picture")];\
_contentPanelCtrl lnbSetPicture [[_newRow, 8], getText (_cfgWeapons >> _loadout select IDX_LOADOUT_HEADGEAR >> "picture")];\
_contentPanelCtrl lnbSetPicture [[_newRow, 9], getText (configFile >> "CfgGlasses" >> _loadout select IDX_LOADOUT_GOGGLES >> "picture")];
#define ACTION_TYPE_TEXT 0
#define ACTION_TYPE_BUTTON 1

View File

@ -1,4 +1,5 @@
#include "..\script_component.hpp"
#include "..\defines.hpp"
/*
* Author: johnb43
* Adds custom action buttons.

View File

@ -6,9 +6,10 @@
*
* Arguments:
* 0: Config category, must be "CfgWeapons", "CfgVehicles", "CfgMagazines", "CfgVoice" or "CfgUnitInsignia" <STRING>
* 1: Classname <STRING>
* 1: Classname (must be in config case) <STRING>
* 2: Panel control <CONTROL>
* 3: Name of the picture entry in that Cfg class <STRING> (default: "picture")
* 4: Config root <NUMBER> (default: 0 -> configFile)
*
* Return Value:
* None
@ -19,9 +20,9 @@
* Public: Yes
*/
params ["_configCategory", "_className", "_ctrlPanel", ["_pictureEntryName", "picture", [""]]];
params ["_configCategory", "_className", "_ctrlPanel", ["_pictureEntryName", "picture", [""]], ["_configRoot", 0, [0]]];
private _skip = GVAR(favoritesOnly) && {!(_className in GVAR(currentItems))} && {!((toLower _className) in GVAR(favorites))};
private _skip = GVAR(favoritesOnly) && {!(_className in GVAR(currentItems))} && {!((toLowerANSI _className) in GVAR(favorites))};
if (_skip) then {
switch (GVAR(currentLeftPanel)) do {
case IDC_buttonPrimaryWeapon: {
@ -41,10 +42,10 @@ if (_skip) then {
if (_skip) exitWith {};
// Sanitise key, as it's public; If not in cache, find info and cache it for later use
((uiNamespace getVariable QGVAR(addListBoxItemCache)) getOrDefaultCall [_configCategory + _className, {
// If not in cache, find info and cache it for later use
((uiNamespace getVariable QGVAR(addListBoxItemCache)) getOrDefaultCall [_configCategory + _className + str _configRoot, {
// Get classname (config case), display name, picture and DLC
private _configPath = configFile >> _configCategory >> _className;
private _configPath = ([configFile, campaignConfigFile, missionConfigFile] select _configRoot) >> _configCategory >> _className;
private _dlcName = _configPath call EFUNC(common,getAddon);
// If _pictureEntryName is empty, then this item has no picture (e.g. faces)
@ -57,7 +58,7 @@ _ctrlPanel lbSetPicture [_lbAdd, _itemPicture];
_ctrlPanel lbSetPictureRight [_lbAdd, ["", _modPicture] select GVAR(enableModIcons)];
_ctrlPanel lbSetTooltip [_lbAdd, format ["%1\n%2", _displayName, _className]];
if ((toLower _className) in GVAR(favorites)) then {
if ((toLowerANSI _className) in GVAR(favorites)) then {
_ctrlPanel lbSetColor [_lbAdd, FAVORITES_COLOR];
_ctrlPanel lbSetSelectColor [_lbAdd, FAVORITES_COLOR];
};

View File

@ -66,7 +66,8 @@ _items = _items select {
_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_isUnique") == 1} ||
{getNumber (_cfgMagazines >> _x >> "ACE_asItem") == 1}
};
GVAR(customRightPanelButtons) set [_position, [_items apply {_x call EFUNC(common,getConfigName)}, _picture, _tooltip, _moveOnOverwrite]];

View File

@ -46,6 +46,7 @@ private _cfgWeapons = configFile >> "CfgWeapons";
private _cfgMagazines = configFile >> "CfgMagazines";
private _cfgVehicles = configFile >> "CfgVehicles";
private _cfgGlasses = configFile >> "CfgGlasses";
private _dlcName = "";
// Exit with current items (no specific category)
if (_category == IDX_CAT_ALL) exitWith {
@ -73,6 +74,12 @@ if (_category == IDX_CAT_ALL) exitWith {
_listbox lnbSetData [[_index, 1], _x];
_listbox lnbSetPicture [[_index, 0], getText (_config >> "picture")];
_listbox lnbSetTooltip [[_index, 0], _x];
_dlcName = _config call EFUNC(common,getAddon);
if (_dlcName != "") then {
_listbox lnbSetPicture [[_index, 2], (modParams [_dlcName, ["logo"]]) param [0, ""]];
};
};
} forEach _attributeItems;
@ -130,12 +137,20 @@ private _config = _cfgClass;
_alpha = 0.5;
};
_index = _listbox lnbAddRow ["", _displayName, _symbol];
_index = _listbox lnbAddRow ["", _displayName, "", _symbol];
_listbox lnbSetData [[_index, 1], _x];
_listbox lnbSetPicture [[_index, 0], getText (_config >> _x >> "picture")];
_listbox lnbSetTooltip [[_index, 0], _x];
_listbox lnbSetColor [[_index, 1], [1, 1, 1, _alpha]];
_listbox lnbSetColor [[_index, 2], [1, 1, 1, _alpha]];
_listbox lnbSetColor [[_index, 3], [1, 1, 1, _alpha]];
// Mod icon is in column 2
_dlcName = (_config >> _x) call EFUNC(common,getAddon);
if (_dlcName != "") then {
_listbox lnbSetPicture [[_index, 2], (modParams [_dlcName, ["logo"]]) param [0, ""]];
_listbox lnbSetPictureColor [[_index, 2], [1, 1, 1, _alpha]];
};
};
} forEach (keys _categoryItems);

View File

@ -35,9 +35,10 @@ if (_addItem && {_itemIndex == -1}) exitWith {
_attributeItems pushBack _itemClassname;
// Change symbol and increase alpha
_listbox lnbSetText [[_currentRow, 2], [SYMBOL_ITEM_VIRTUAL, SYMBOL_ITEM_REMOVE] select _attributeMode];
_listbox lnbSetText [[_currentRow, 3], [SYMBOL_ITEM_VIRTUAL, SYMBOL_ITEM_REMOVE] select _attributeMode];
_listbox lnbSetColor [[_currentRow, 1], [1, 1, 1, 1]];
_listbox lnbSetColor [[_currentRow, 2], [1, 1, 1, 1]];
_listbox lnbSetPictureColor [[_currentRow, 2], [1, 1, 1, 1]]; // mod icon is in column 2
_listbox lnbSetColor [[_currentRow, 3], [1, 1, 1, 1]];
};
// Remove item if in list
@ -45,7 +46,8 @@ if (!_addItem && {_itemIndex != -1}) exitWith {
_attributeItems deleteAt _itemIndex;
// Change symbol and reduce alpha
_listbox lnbSetText [[_currentRow, 2], SYMBOL_ITEM_NONE];
_listbox lnbSetText [[_currentRow, 3], SYMBOL_ITEM_NONE];
_listbox lnbSetColor [[_currentRow, 1], [1, 1, 1, 0.5]];
_listbox lnbSetColor [[_currentRow, 2], [1, 1, 1, 0.5]];
_listbox lnbSetPictureColor [[_currentRow, 2], [1, 1, 1, 0.5]]; // mod icon is in column 2
_listbox lnbSetColor [[_currentRow, 3], [1, 1, 1, 0.5]];
};

View File

@ -0,0 +1,59 @@
#include "..\script_component.hpp"
/*
* Author: Jonpas, LinkIsGrim
* Returns base attachment for CBA scripted attachment
* Adapted from CBA_fnc_switchableAttachments
*
* Arguments:
* 0: Attachment <STRING>
*
* Return Value:
* Base attachment <STRING>
*
* Example:
* "ACE_acc_pointer_green_IR" call ace_arsenal_fnc_baseAttachment
*
* Public: Yes
*/
params [["_item", "", [""]]];
TRACE_1("looking up base attachment",_item);
private _switchableClasses = [];
private _cfgWeapons = configfile >> "CfgWeapons";
private _config = _cfgWeapons >> _item;
_item = configName _config;
// If the switch config entries are inherited, ignore
if (
(inheritsFrom (_config >> "MRT_SwitchItemNextClass") isNotEqualTo _config) ||
{inheritsFrom (_config >> "MRT_SwitchItemPrevClass") isNotEqualTo _config}
) exitWith {
_item // return
};
while {
_config = _cfgWeapons >> getText (_config >> "MRT_SwitchItemNextClass");
isClass _config && {_switchableClasses pushBackUnique configName _config != -1}
} do {};
_config = _cfgWeapons >> _item;
private _backward = [];
while {
_config = _cfgWeapons >> getText (_config >> "MRT_SwitchItemPrevClass");
isClass _config && {_backward pushBackUnique configName _config != -1}
} do {};
_switchableClasses append _backward;
_switchableClasses = _switchableClasses arrayIntersect _switchableClasses;
{
if (getNumber (_cfgWeapons >> _x >> "scope") == 2) exitWith {
TRACE_2("found class",_item,_x);
_item = _x;
};
} forEach _switchableClasses;
_item

View File

@ -0,0 +1,32 @@
#include "..\script_component.hpp"
/*
* Author: Jonpas, LinkIsGrim
* Returns base optic for CBA scripted optics (PIP and 2D)
*
* Arguments:
* 0: Optic <STRING>
*
* Return Value:
* Base optic <STRING>
*
* Example:
* "CUP_optic_Elcan_SpecterDR_black_PIP" call ace_arsenal_fnc_baseOptic
*
* Public: Yes
*/
params [["_optic", "", [""]]];
// PIP
private _baseClasses = configProperties [configFile >> "CBA_PIPItems", "getText _x == _optic"];
// Carry Handle
{
_baseClasses append (configProperties [_x, "getText _x == _optic"]);
} forEach configProperties [configFile >> "CBA_CarryHandleTypes"];
if (_baseClasses isNotEqualTo []) then {
_optic = configName (_baseClasses select 0);
};
_optic

View File

@ -19,7 +19,7 @@
params [["_weapon", "", [""]]];
// Check if item is cached
(uiNamespace getVariable QGVAR(baseWeaponNameCache)) getOrDefaultCall [toLower _weapon, {
(uiNamespace getVariable QGVAR(baseWeaponNameCache)) getOrDefaultCall [toLowerANSI _weapon, {
private _cfgWeapons = configfile >> "CfgWeapons";
private _config = _cfgWeapons >> _weapon;

View File

@ -1,4 +1,5 @@
#include "..\script_component.hpp"
#include "..\defines.hpp"
/*
* Author: Brett Mayson
* Create the internal actions arrays when needed for the first time.

View File

@ -1,7 +1,7 @@
#include "..\script_component.hpp"
#include "..\defines.hpp"
/*
* Author: Alganthe, johnb43
* Author: Alganthe, johnb43, LinkIsGrim
* Fills left panel.
*
* Arguments:
@ -17,21 +17,28 @@
params ["_display", "_control", ["_animate", true]];
private _ctrlIDC = ctrlIDC _control;
private _ctrlPanel = _display displayCtrl IDC_leftTabContent;
private _idxVirt = GVAR(idxMap) getOrDefault [_ctrlIDC, -1, true];
// Fade old control background
if (!isNil QGVAR(currentLeftPanel)) then {
private _previousCtrlBackground = _display displayCtrl (GVAR(currentLeftPanel) - 1);
_previousCtrlBackground ctrlSetFade 1;
_previousCtrlBackground ctrlCommit ([0, FADE_DELAY] select _animate);
// When switching tabs, clear searchbox
if (GVAR(currentLeftPanel) != _ctrlIDC) then {
(_display displayCtrl IDC_leftSearchbar) ctrlSetText "";
(_display displayCtrl IDC_rightSearchbar) ctrlSetText "";
};
};
// Show new control background
private _ctrlIDC = ctrlIDC _control;
private _ctrlBackground = _display displayCtrl (_ctrlIDC - 1);
_ctrlBackground ctrlSetFade 0;
_ctrlBackground ctrlCommit ([0, FADE_DELAY] select _animate);
private _ctrlPanel = _display displayCtrl IDC_leftTabContent;
// Force a "refresh" animation of the panel
if (_animate) then {
_ctrlPanel ctrlSetFade 1;
@ -41,212 +48,82 @@ if (_animate) then {
};
_ctrlPanel lbSetCurSel -1;
// Purge old data
lbClear _ctrlPanel;
// Handle icons and filling
private _selectedItem = switch (true) do {
// Primary weapons, secondary weapons, handgun weapons
case (_ctrlIDC in [IDC_buttonPrimaryWeapon, IDC_buttonHandgun, IDC_buttonSecondaryWeapon]): {
// Purge old data
lbClear _ctrlPanel;
// Add "Empty" entry
private _addEmpty = _ctrlPanel lbAdd format [" <%1>", localize "str_empty"];
_ctrlPanel lbSetValue [_addEmpty, -1];
// Add selected tab's weapons
private _index = [IDC_buttonPrimaryWeapon, IDC_buttonSecondaryWeapon, IDC_buttonHandgun] find _ctrlIDC;
{
["CfgWeapons", _x, _ctrlPanel] call FUNC(addListBoxItem);
} forEach (keys ((GVAR(virtualItems) get IDX_VIRT_WEAPONS) get _index));
GVAR(currentItems) select _index
};
// Uniforms, vests, backpacks
case (_ctrlIDC in [IDC_buttonUniform, IDC_buttonVest, IDC_buttonBackpack]): {
// Purge old data
lbClear _ctrlPanel;
// Add "Empty" entry
private _addEmpty = _ctrlPanel lbAdd format [" <%1>", localize "str_empty"];
_ctrlPanel lbSetValue [_addEmpty, -1];
switch (_ctrlIDC) do {
// Add uniforms
case IDC_buttonUniform: {
{
["CfgWeapons", _x, _ctrlPanel] call FUNC(addListBoxItem);
} forEach (keys (GVAR(virtualItems) get IDX_VIRT_UNIFORM));
GVAR(currentItems) select IDX_CURR_UNIFORM
};
// Add vests
case IDC_buttonVest: {
{
["CfgWeapons", _x, _ctrlPanel] call FUNC(addListBoxItem);
} forEach (keys (GVAR(virtualItems) get IDX_VIRT_VEST));
GVAR(currentItems) select IDX_CURR_VEST
};
// Add backpacks
case IDC_buttonBackpack: {
{
["CfgVehicles", _x, _ctrlPanel] call FUNC(addListBoxItem);
} forEach (keys (GVAR(virtualItems) get IDX_VIRT_BACKPACK));
GVAR(currentItems) select IDX_CURR_BACKPACK
};
};
};
// Other
default {
// Don't reset right panel selection if left tab is binos
if (_ctrlIDC != IDC_buttonBinoculars) then {
GVAR(currentRightPanel) = nil;
};
lbClear _ctrlPanel;
// For every left tab except faces and voices, add "Empty" entry
if !(_ctrlIDC in [IDC_buttonFace, IDC_buttonVoice]) then {
private _addEmpty = _ctrlPanel lbAdd format [" <%1>", localize "str_empty"];
_ctrlPanel lbSetValue [_addEmpty, -1];
};
switch (_ctrlIDC) do {
// Headgear
case IDC_buttonHeadgear: {
{
["CfgWeapons", _x, _ctrlPanel] call FUNC(addListBoxItem);
} forEach (keys (GVAR(virtualItems) get IDX_VIRT_HEADGEAR));
GVAR(currentItems) select IDX_CURR_HEADGEAR
};
// Facewear
case IDC_buttonGoggles: {
{
["CfgGlasses", _x, _ctrlPanel] call FUNC(addListBoxItem);
} forEach (keys (GVAR(virtualItems) get IDX_VIRT_GOGGLES));
GVAR(currentItems) select IDX_CURR_GOGGLES
};
// NVGs
case IDC_buttonNVG: {
{
["CfgWeapons", _x, _ctrlPanel] call FUNC(addListBoxItem);
} forEach (keys (GVAR(virtualItems) get IDX_VIRT_NVG));
GVAR(currentItems) select IDX_CURR_NVG
};
// Binoculars
case IDC_buttonBinoculars: {
{
["CfgWeapons", _x, _ctrlPanel] call FUNC(addListBoxItem);
} forEach (keys (GVAR(virtualItems) get IDX_VIRT_BINO));
GVAR(currentItems) select IDX_CURR_BINO
};
// Maps
case IDC_buttonMap: {
{
["CfgWeapons", _x, _ctrlPanel] call FUNC(addListBoxItem);
} forEach (keys (GVAR(virtualItems) get IDX_VIRT_MAP));
GVAR(currentItems) select IDX_CURR_MAP
};
// Compasses
case IDC_buttonCompass: {
{
["CfgWeapons", _x, _ctrlPanel] call FUNC(addListBoxItem);
} forEach (keys (GVAR(virtualItems) get IDX_VIRT_COMPASS));
GVAR(currentItems) select IDX_CURR_COMPASS
};
// Radios
case IDC_buttonRadio: {
{
["CfgWeapons", _x, _ctrlPanel] call FUNC(addListBoxItem);
} forEach (keys (GVAR(virtualItems) get IDX_VIRT_RADIO));
GVAR(currentItems) select IDX_CURR_RADIO
};
// Watches
case IDC_buttonWatch: {
{
["CfgWeapons", _x, _ctrlPanel] call FUNC(addListBoxItem);
} forEach (keys (GVAR(virtualItems) get IDX_VIRT_WATCH));
GVAR(currentItems) select IDX_CURR_WATCH
};
// GPS and UAV Terminals
case IDC_buttonGPS: {
{
["CfgWeapons", _x, _ctrlPanel] call FUNC(addListBoxItem);
} forEach (keys (GVAR(virtualItems) get IDX_VIRT_COMMS));
GVAR(currentItems) select IDX_CURR_COMMS
};
// Faces
case IDC_buttonFace: {
private _lbAdd = -1;
{
_y params ["_displayName", "_modPicture"];
_lbAdd = _ctrlPanel lbAdd _displayName;
_ctrlPanel lbSetData [_lbAdd, _x];
_ctrlPanel lbSetTooltip [_lbAdd, format ["%1\n%2", _displayName, _x]];
_ctrlPanel lbSetPictureRight [_lbAdd, ["", _modPicture] select GVAR(enableModIcons)];
} forEach (uiNamespace getVariable QGVAR(faceCache));
GVAR(currentFace)
};
// Voices
case IDC_buttonVoice: {
{
["CfgVoice", _x, _ctrlPanel, "icon"] call FUNC(addListBoxItem);
} forEach (uiNamespace getVariable QGVAR(voiceCache));
GVAR(currentVoice)
};
// Insignia
case IDC_buttonInsignia: {
// Insignia from config
{
["CfgUnitInsignia", _x, _ctrlPanel, "texture"] call FUNC(addListBoxItem);
} forEach (uiNamespace getVariable QGVAR(insigniaCache));
private _displayName = "";
private _className = "";
private _lbAdd = -1;
// Insignia from mission file
{
_className = configName _x;
_displayName = getText (_x >> "displayName");
_lbAdd = _ctrlPanel lbAdd _displayName;
_ctrlPanel lbSetData [_lbAdd, _className];
_ctrlPanel lbSetPicture [_lbAdd, getText (_x >> "texture")];
_ctrlPanel lbSetTooltip [_lbAdd, format ["%1\n%2", _displayName, _className]];
} forEach ("(if (isNumber (_x >> 'scope')) then {getNumber (_x >> 'scope')} else {2}) == 2" configClasses (missionConfigFile >> "CfgUnitInsignia"));
GVAR(currentInsignia)
};
// Unknown
default {""};
};
};
// For every left tab except faces and voices, add "Empty" entry
if !(_ctrlIDC in [IDC_buttonFace, IDC_buttonVoice]) then {
private _addEmpty = _ctrlPanel lbAdd format [" <%1>", localize "str_empty"];
_ctrlPanel lbSetValue [_addEmpty, -1];
};
// When switching tabs, clear searchbox
if (GVAR(currentLeftPanel) != _ctrlIDC) then {
(_display displayCtrl IDC_leftSearchbar) ctrlSetText "";
(_display displayCtrl IDC_rightSearchbar) ctrlSetText "";
// Don't reset the current right panel for weapons, binos and containers
if !(_idxVirt in [IDX_VIRT_PRIMARY_WEAPONS, IDX_VIRT_SECONDARY_WEAPONS, IDX_VIRT_HANDGUN_WEAPONS, IDX_VIRT_BINO, IDX_VIRT_UNIFORM, IDX_VIRT_VEST, IDX_VIRT_BACKPACK]) then {
GVAR(currentRightPanel) = nil;
};
GVAR(currentLeftPanel) = _ctrlIDC;
// Add items to the listbox
private _selectedItem = if (_idxVirt != -1) then { // Items
private _configParent = switch (_idxVirt) do {
case IDX_VIRT_GOGGLES: {"CfgGlasses"};
case IDX_VIRT_BACKPACK: {"CfgVehicles"};
default {"CfgWeapons"};
};
private _items = if (_idxVirt < IDX_VIRT_HEADGEAR) then {
keys ((GVAR(virtualItems) get IDX_VIRT_WEAPONS) get _idxVirt)
} else {
keys (GVAR(virtualItems) get _idxVirt)
};
{
[_configParent, _x, _ctrlPanel] call FUNC(addListBoxItem);
} forEach _items;
GVAR(currentItems) select _idxVirt
} else { // Special cases
switch (_ctrlIDC) do {
// Faces
case IDC_buttonFace: {
private _lbAdd = -1; // micro-optimization
// Faces need to be added like this because their config path is
// configFile >> "CfgFaces" >> face category >> className
{
_y params ["_displayName", "_modPicture"];
_lbAdd = _ctrlPanel lbAdd _displayName;
_ctrlPanel lbSetData [_lbAdd, _x];
_ctrlPanel lbSetTooltip [_lbAdd, format ["%1\n%2", _displayName, _x]];
_ctrlPanel lbSetPictureRight [_lbAdd, ["", _modPicture] select GVAR(enableModIcons)];
} forEach GVAR(faceCache); // HashMap, not array
GVAR(currentFace)
};
// Voices
case IDC_buttonVoice: {
{
["CfgVoice", _x, _ctrlPanel, "icon"] call FUNC(addListBoxItem);
} forEach (keys GVAR(voiceCache));
GVAR(currentVoice)
};
// Insignia
case IDC_buttonInsignia: {
{
["CfgUnitInsignia", _x, _ctrlPanel, "texture", _y] call FUNC(addListBoxItem);
} forEach GVAR(insigniaCache);
GVAR(currentInsignia)
};
// Unknown
default {
WARNING_1("Unknown arsenal left panel with IDC %1, update ace_arsenal_idxMap and relevant macros if adding a new tab",_ctrlIDC);
""
};
};
};
// Trigger event
GVAR(currentLeftPanel) = _ctrlIDC;
[QGVAR(leftPanelFilled), [_display, _ctrlIDC, GVAR(currentRightPanel)]] call CBA_fnc_localEvent;
// Sort

View File

@ -1,12 +1,16 @@
#include "..\script_component.hpp"
#include "..\defines.hpp"
/*
* Author: Alganthe, johnb43
* Fill loadouts list.
* Author: Alganthe, johnb43, LinkIsGrim
* Fill loadouts list over multiple frames. LOADOUTS_PER_FRAME macro does what it says on the tin.
* Should only ever be called by display load (with optional params as default) and by itself.
* Listen to ace_arsenal_loadoutsListFilled event if you need to iterate over the loadouts list.
*
* Arguments:
* 0: Loadouts display <DISPLAY>
* 1: Tab control <CONTROL>
* 2: Current frame filling loadouts list <NUMBER> (default: 0)
* 3: Frames necessary to fill loadouts list <NUMBER> (default: -1)
*
* Return Value:
* None
@ -14,29 +18,46 @@
* Public: No
*/
params ["_display", "_control"];
// Can just be modified directly, no further setup needed
#define LOADOUTS_PER_FRAME 10
(_display displayCtrl IDC_textEditBox) ctrlSetText "";
params ["_display", "_control", ["_currentFrame", 0], ["_framesToFill", -1]];
if (isNull _display) exitWith {
TRACE_2("display closed, aborting",_currentFrame,_framesToFill);
};
private _contentPanelCtrl = _display displayCtrl IDC_contentPanel;
if (_currentFrame == 0) then {
(_display displayCtrl IDC_textEditBox) ctrlSetText "";
// Force a "refresh" animation of the panel
_contentPanelCtrl ctrlSetFade 1;
_contentPanelCtrl ctrlCommit 0;
_contentPanelCtrl ctrlSetFade 0;
_contentPanelCtrl ctrlCommit FADE_DELAY;
// Force a "refresh" animation of the panel
_contentPanelCtrl ctrlSetFade 1;
_contentPanelCtrl ctrlCommit 0;
_contentPanelCtrl ctrlSetFade 0;
_contentPanelCtrl ctrlCommit FADE_DELAY;
_contentPanelCtrl lnbSetCurSelRow -1;
lnbClear _contentPanelCtrl;
_contentPanelCtrl lnbSetCurSelRow -1;
lnbClear _contentPanelCtrl;
};
private _sharedLoadoutsVars = GVAR(sharedLoadoutsNamespace) getVariable QGVAR(sharedLoadoutsVars);
private _cfgWeapons = configFile >> "CfgWeapons";
private _cfgWeapons = configFile >> "CfgWeapons"; // Used by ADD_LOADOUTS_LIST_PICTURES macro, do not remove
private _newRow = -1;
if (GVAR(currentLoadoutsTab) != IDC_buttonSharedLoadouts) then {
private _loadoutNameAndTab = "";
private _loadoutCachedInfo = "";
private _sharingEnabled = GVAR(allowSharedLoadouts) && {isMultiplayer};
private _loadouts = [
profileNamespace getVariable [QGVAR(saved_loadouts), []],
GVAR(defaultLoadoutsList)
] select (ctrlIDC _control == IDC_buttonDefaultLoadouts);
if (_currentFrame == 0) then {
_framesToFill = floor ((count _loadouts) / LOADOUTS_PER_FRAME);
TRACE_2("filling loadouts list",_currentFrame,_framesToFill);
_this set [3, _framesToFill];
};
// Add all loadouts to loadout list
{
@ -50,15 +71,16 @@ if (GVAR(currentLoadoutsTab) != IDC_buttonSharedLoadouts) then {
_loadoutCachedInfo = [_loadoutData] call FUNC(verifyLoadout);
_contentPanelCtrl setVariable [_loadoutNameAndTab, _loadoutCachedInfo];
_loadoutCachedInfo params ["", "_nullItemsAmount", "_unavailableItemsAmount", "_nullItemsList", "_unavailableItemsList"];
_loadoutCachedInfo params ["", "_nullItemsList", "_unavailableItemsList", "_missingExtendedInfo"];
// Log missing / nil items to RPT (only once per arsenal session)
if (GVAR(EnableRPTLog) && {(_nullItemsAmount > 0) || {_unavailableItemsAmount > 0}}) then {
if (GVAR(EnableRPTLog) && {(_nullItemsList isNotEqualTo []) || {_unavailableItemsList isNotEqualTo [] || {_missingExtendedInfo isNotEqualTo []}}}) then {
private _printComponent = "ACE_Arsenal - Loadout:";
private _printNullItemsList = ["Missing items:", str _nullItemsList] joinString " ";
private _printUnavailableItemsList = ["Unavailable items:", str _unavailableItemsList] joinString " ";
private _printMissingExtendedInfo = ["Missing extended loadout:", str _missingExtendedInfo] joinString " ";
diag_log text (format ["%1%5 %2%5 %3%5 %4", _printComponent, "Name: " + _loadoutName, _printNullItemsList, _printUnavailableItemsList, endl]);
diag_log text (format ["%1%6 %2%6 %3%6 %4%6 %5", _printComponent, "Name: " + _loadoutName, _printNullItemsList, _printUnavailableItemsList, _printMissingExtendedInfo, endl]);
};
};
@ -69,18 +91,18 @@ if (GVAR(currentLoadoutsTab) != IDC_buttonSharedLoadouts) then {
_contentPanelCtrl lnbSetColumnsPos [0, 0.05, 0.40, 0.50, 0.60, 0.70, 0.75, 0.80, 0.85, 0.90];
};
_loadoutCachedInfo params ["_extendedLoadout", "_nullItemsAmount", "_unavailableItemsAmount"];
_extendedLoadout params ["_loadout"];
_loadoutCachedInfo params ["_extendedLoadout", "_nullItemsList", "_unavailableItemsList"];
_extendedLoadout params ["_loadout"]; // Used by ADD_LOADOUTS_LIST_PICTURES macro, do not remove
_newRow = _contentPanelCtrl lnbAddRow ["", _loadoutName];
ADD_LOADOUTS_LIST_PICTURES
// Change color on loadout lines that have items that aren't available or don't exist
if (_nullItemsAmount > 0) then {
if (_nullItemsList isNotEqualTo []) then {
_contentPanelCtrl lnbSetColor [[_newRow, 1], [1, 0, 0, 0.8]]; // Red
} else {
if (_unavailableItemsAmount > 0) then {
if (_unavailableItemsList isNotEqualTo []) then {
_contentPanelCtrl lnbSetColor [[_newRow, 1], [1, 1, 1, 0.25]]; // Gray
};
};
@ -90,10 +112,16 @@ if (GVAR(currentLoadoutsTab) != IDC_buttonSharedLoadouts) then {
_contentPanelCtrl lnbSetPicture [[_newRow, 0], QPATHTOF(data\iconPublic.paa)];
_contentPanelCtrl lnbSetValue [[_newRow, 0], 1];
};
} forEach ([profileNamespace getVariable [QGVAR(saved_loadouts), []], GVAR(defaultLoadoutsList)] select (ctrlIDC _control == IDC_buttonDefaultLoadouts));
} forEach (_loadouts select [_currentFrame * LOADOUTS_PER_FRAME, [LOADOUTS_PER_FRAME, count _loadouts] select is3DEN]);
} else {
private _allPlayerNames = allPlayers apply {name _x};
private _loadouts = _sharedLoadoutsVars apply {GVAR(sharedLoadoutsNamespace) getVariable _x};
private _loadoutVar = "";
if (_currentFrame == 0) then {
_framesToFill = floor ((count _loadouts) / LOADOUTS_PER_FRAME);
TRACE_2("filling loadouts list",_currentFrame,_framesToFill);
_this set [3, _framesToFill];
};
{
_x params ["_playerName", "_loadoutName", "_loadoutData"];
@ -107,8 +135,8 @@ if (GVAR(currentLoadoutsTab) != IDC_buttonSharedLoadouts) then {
[QGVAR(loadoutUnshared), [_contentPanelCtrl, profileName, _loadoutName]] call CBA_fnc_remoteEvent;
} else {
([_loadoutData] call FUNC(verifyLoadout)) params ["_extendedLoadout", "_nullItemsAmount", "_unavailableItemsAmount"];
_extendedLoadout params ["_loadout"];
([_loadoutData] call FUNC(verifyLoadout)) params ["_extendedLoadout", "_nullItemsList", "_unavailableItemsList"];
_extendedLoadout params ["_loadout"]; // Used by ADD_LOADOUTS_LIST_PICTURES macro, do not remove
_contentPanelCtrl lnbSetColumnsPos [0, 0.15, 0.40, 0.50, 0.60, 0.70, 0.75, 0.80, 0.85, 0.90];
_newRow = _contentPanelCtrl lnbAddRow [_playerName, _loadoutName];
@ -118,17 +146,23 @@ if (GVAR(currentLoadoutsTab) != IDC_buttonSharedLoadouts) then {
_contentPanelCtrl lnbSetData [[_newRow, 1], _loadoutVar];
// Change color on loadout lines that have items that aren't available or don't exist
if (_nullItemsAmount > 0) then {
if (_nullItemsList isNotEqualTo []) then {
_contentPanelCtrl lnbSetColor [[_newRow, 1], [1, 0, 0, 0.8]]; // Red
} else {
if (_unavailableItemsAmount > 0) then {
if (_unavailableItemsList isNotEqualTo []) then {
_contentPanelCtrl lnbSetColor [[_newRow, 1], [1, 1, 1, 0.25]]; // Gray
};
};
};
} forEach (_sharedLoadoutsVars apply {GVAR(sharedLoadoutsNamespace) getVariable _x});
} forEach (_loadouts select [_currentFrame * LOADOUTS_PER_FRAME, [LOADOUTS_PER_FRAME, count _loadouts] select is3DEN]);
};
if (!is3DEN && _currentFrame != _framesToFill) exitWith {
_this set [2, _currentFrame + 1];
[FUNC(fillLoadoutsList), _this] call CBA_fnc_execNextFrame;
};
TRACE_3("finished",_currentFrame,_framesToFill,lnbSize _contentPanelCtrl);
[QGVAR(loadoutsListFilled), [_display, _control]] call CBA_fnc_localEvent;
// Sort loadouts alphabetically

View File

@ -53,7 +53,7 @@ if (GVAR(favoritesOnly)) then {
private _fnc_fillRightContainer = {
params ["_configCategory", "_className", ["_isUnique", false, [false]], ["_unknownOrigin", false, [false]]];
if (GVAR(favoritesOnly) && {!(_className in _currentCargo)} && {!((toLower _className) in GVAR(favorites))}) exitWith {};
if (GVAR(favoritesOnly) && {!(_className in _currentCargo)} && {!((toLowerANSI _className) in GVAR(favorites))}) exitWith {};
// If item is not in the arsenal, it must be unique
if (!_isUnique && {!(_className in GVAR(virtualItemsFlat))}) then {
@ -89,7 +89,7 @@ private _fnc_fillRightContainer = {
_ctrlPanel lnbSetPicture [[_lbAdd, 0], _picture];
_ctrlPanel lnbSetValue [[_lbAdd, 2], parseNumber _isUnique];
_ctrlPanel lnbSetTooltip [[_lbAdd, 0], format ["%1\n%2", _displayName, _className]];
if ((toLower _className) in GVAR(favorites)) then {
if ((toLowerANSI _className) in GVAR(favorites)) then {
_ctrlPanel lnbSetColor [[_lbAdd, 1], FAVORITES_COLOR];
_ctrlPanel lnbSetColorRight [[_lbAdd, 1], FAVORITES_COLOR];
};

View File

@ -47,7 +47,7 @@ private _groups = (GVAR(actionList) select _panel) select {
private _show = _groups isNotEqualTo [];
private _actionsBoxCtrl = _display displayCtrl IDC_actionsBox;
_actionsBoxCtrl ctrlShow _show;
_actionsBoxCtrl ctrlCommit 0.15;
_actionsBoxCtrl ctrlCommit FADE_DELAY;
if (!_show) exitWith {};
@ -77,7 +77,6 @@ private _items = _group select 3 select {
};
_actionsCurrentPageCtrl ctrlSetText (_group select 1);
_actionsCurrentPageCtrl ctrlSetFade 0;
_actionsCurrentPageCtrl ctrlShow true;
_actionsCurrentPageCtrl ctrlCommit 0;
@ -85,36 +84,22 @@ private _activeCtrls = [];
{
_x params ["", "_type", "_label", "_statement"];
private _idc = IDC_actionsText1 + _forEachIndex * 2;
private _actionTextCtrl = _display displayCtrl _idc;
private _actionButtonCtrl = _display displayCtrl (_idc + 1);
private _idc = IDC_actionsText1 + _type + _forEachIndex * 2;
private _actionCtrl = _display displayCtrl _idc;
switch (_type) do {
case ACTION_TYPE_BUTTON: {
_actionButtonCtrl ctrlRemoveAllEventHandlers "ButtonClick";
_actionButtonCtrl ctrlAddEventHandler ["ButtonClick", {
_actionCtrl ctrlRemoveAllEventHandlers "ButtonClick";
_actionCtrl ctrlAddEventHandler ["ButtonClick", {
if (is3DEN) exitWith {[true] call FUNC(refresh)};
[{
[true] call FUNC(refresh);
}] call CBA_fnc_execNextFrame;
}];
if (_activeCtrls isNotEqualTo []) then {
(ctrlPosition (_activeCtrls select -1)) params ["", "_lastPosY", "", "_lastPosH"];
_actionButtonCtrl ctrlSetPositionY (_lastPosY + _lastPosH + GRID_H);
} else {
_actionButtonCtrl ctrlSetPositionY (6 * GRID_H);
};
_actionButtonCtrl ctrlAddEventHandler ["ButtonClick", _statement];
_actionButtonCtrl ctrlSetText _label;
_actionButtonCtrl ctrlSetFade 0;
_actionButtonCtrl ctrlEnable true;
_actionButtonCtrl ctrlCommit 0;
_actionTextCtrl ctrlSetFade 1;
_actionTextCtrl ctrlEnable false;
_actionTextCtrl ctrlCommit 0;
_activeCtrls pushBack _actionButtonCtrl;
_actionCtrl ctrlAddEventHandler ["ButtonClick", _statement];
_actionCtrl ctrlSetText _label;
_actionCtrl ctrlEnable true;
};
case ACTION_TYPE_TEXT: {
private _text = call _statement;
@ -125,47 +110,35 @@ private _activeCtrls = [];
if (_text isEqualType []) then {
_text = _text joinString endl;
};
if (_activeCtrls isNotEqualTo []) then {
(ctrlPosition (_activeCtrls select -1)) params ["", "_lastPosY", "", "_lastPosH"];
_actionTextCtrl ctrlSetPositionY (_lastPosY + _lastPosH + GRID_H);
} else {
_actionTextCtrl ctrlSetPositionY (5 * GRID_H);
};
_actionTextCtrl ctrlSetText _text;
_actionTextCtrl ctrlSetPositionH (ctrlTextHeight _actionTextCtrl);
_actionTextCtrl ctrlSetFade 0;
_actionTextCtrl ctrlEnable false;
_actionTextCtrl ctrlCommit 0;
_actionButtonCtrl ctrlSetFade 1;
_actionButtonCtrl ctrlEnable false;
_actionButtonCtrl ctrlCommit 0;
_activeCtrls pushBack _actionTextCtrl;
};
default {
_actionTextCtrl ctrlSetFade 1;
_actionTextCtrl ctrlCommit 0;
_actionButtonCtrl ctrlSetFade 1;
_actionButtonCtrl ctrlEnable false;
_actionButtonCtrl ctrlCommit 0;
_actionCtrl ctrlSetText _text;
_actionCtrl ctrlSetPositionH (ctrlTextHeight _actionCtrl);
_actionCtrl ctrlEnable false;
};
};
if (_activeCtrls isNotEqualTo []) then {
(ctrlPosition (_activeCtrls select -1)) params ["", "_lastPosY", "", "_lastPosH"];
_actionCtrl ctrlSetPositionY (_lastPosY + _lastPosH + GRID_H);
} else {
_actionCtrl ctrlSetPositionY ((5 + _type) * GRID_H);
};
_actionCtrl ctrlShow true;
_actionCtrl ctrlCommit 0;
_activeCtrls pushBack _actionCtrl;
} forEach _items;
private _actionCount = count _items;
{
private _idc = IDC_actionsText1 + _x * 2;
private _actionTextCtrl = _display displayCtrl _idc;
private _actionButtonCtrl = _display displayCtrl (_idc + 1);
private _idc = ctrlIDC _x;
if (_idc < IDC_actionsText1 || _idc > IDC_actionsButton5) then {continue};
_actionTextCtrl ctrlSetFade 1;
_actionTextCtrl ctrlCommit 0;
_actionButtonCtrl ctrlSetFade 1;
_actionButtonCtrl ctrlCommit 0;
} forEach ([0, 1, 2, 3, 4] select [_actionCount, 5]);
_x ctrlShow false;
_x ctrlEnable false;
_x ctrlSetPositionY 0;
_x ctrlCommit 0;
} forEach ((allControls _actionsBoxCtrl) select {!(_x in _activeCtrls)});
private _pos = ctrlPosition _actionsBoxCtrl;
(ctrlPosition (_activeCtrls select -1)) params ["", "_lastPosY", "", "_lastPosH"];
private _actionsBoxHeight = _lastPosY + _lastPosH + GRID_H;
_actionsBoxCtrl ctrlSetPositionH _actionsBoxHeight;

View File

@ -18,7 +18,7 @@
(_this select 1) params ["", "_exitCode"];
[QGVAR(displayClosed), []] call CBA_fnc_localEvent;
removeMissionEventHandler ["draw3D", GVAR(camPosUpdateHandle)];
removeMissionEventHandler ["Draw3D", GVAR(camPosUpdateHandle)];
if (is3DEN) then {
private _centerOriginParent = objectParent GVAR(centerOrigin);
@ -78,10 +78,10 @@ if (!isNull curatorCamera) then {
// Make face and voice selection JIP compatible; 3DEN doesn't need this though
if (isMultiplayer && {!is3DEN}) then {
private _id = [QGVAR(broadcastFace), [GVAR(center), GVAR(currentFace)], QGVAR(centerFace_) + netId GVAR(center)] call CBA_fnc_globalEventJIP;
private _id = [QGVAR(broadcastFace), [GVAR(center), GVAR(currentFace)], QGVAR(centerFace_) + hashValue GVAR(center)] call CBA_fnc_globalEventJIP;
[_id, GVAR(center)] call CBA_fnc_removeGlobalEventJIP;
_id = [QGVAR(broadcastVoice), [GVAR(center), GVAR(currentVoice)], QGVAR(centerVoice_) + netId GVAR(center)] call CBA_fnc_globalEventJIP;
_id = [QGVAR(broadcastVoice), [GVAR(center), GVAR(currentVoice)], QGVAR(centerVoice_) + hashValue GVAR(center)] call CBA_fnc_globalEventJIP;
[_id, GVAR(center)] call CBA_fnc_removeGlobalEventJIP;
};

View File

@ -68,7 +68,7 @@ if (isNil QGVAR(virtualItems)) then {
GVAR(virtualItemsFlatAll) = +GVAR(virtualItemsFlat);
GVAR(currentFace) = face GVAR(center);
GVAR(currentVoice) = speaker GVAR(center);
GVAR(currentVoice) = (speaker GVAR(center)) call EFUNC(common,getConfigName);
GVAR(currentInsignia) = GVAR(center) call BIS_fnc_getUnitInsignia;
GVAR(currentAction) = "Stand";
@ -278,4 +278,4 @@ showCinemaBorder false;
//--------------- Reset camera pos
[nil, [controlNull, 0, 0]] call FUNC(handleMouse);
GVAR(camPosUpdateHandle) = addMissionEventHandler ["draw3D", {call FUNC(updateCamPos)}];
GVAR(camPosUpdateHandle) = addMissionEventHandler ["Draw3D", {call FUNC(updateCamPos)}];

View File

@ -27,9 +27,9 @@ private _favorited = false;
// Favorites/blacklist will always be lowercase to handle configCase changes
private _item = "";
if (_isLnB) then {
_item = toLower (_control lnbData [_curSel, 0]);
_item = toLowerANSI (_control lnbData [_curSel, 0]);
} else {
_item = toLower (_control lbData _curSel);
_item = toLowerANSI (_control lbData _curSel);
};
if (_item in GVAR(favorites)) then {

View File

@ -382,6 +382,9 @@ switch (GVAR(currentLeftPanel)) do {
};
GVAR(currentItems) set [IDX_CURR_VEST, _item];
[GVAR(center), ""] call BIS_fnc_setUnitInsignia;
[GVAR(center), GVAR(currentInsignia)] call BIS_fnc_setUnitInsignia;
};
TOGGLE_RIGHT_PANEL_CONTAINER
@ -420,6 +423,9 @@ switch (GVAR(currentLeftPanel)) do {
};
GVAR(currentItems) set [IDX_CURR_BACKPACK, _item];
[GVAR(center), ""] call BIS_fnc_setUnitInsignia;
[GVAR(center), GVAR(currentInsignia)] call BIS_fnc_setUnitInsignia;
};
TOGGLE_RIGHT_PANEL_CONTAINER
@ -683,14 +689,19 @@ switch (GVAR(currentLeftPanel)) do {
TOGGLE_RIGHT_PANEL_HIDE
private _unitInsigniaConfig = configFile >> "CfgUnitInsignia" >> _item;
// Check for correct config: First mission, then campaign and finally regular config
private _itemCfg = missionConfigFile >> "CfgUnitInsignia" >> _item;
if (isNull _itemCfg) then {
_itemCfg = campaignConfigFile >> "CfgUnitInsignia" >> _item;
};
if (isNull _itemCfg) then {
_itemCfg = configFile >> "CfgUnitInsignia" >> _item;
};
// Display new items's info on the bottom right
if (isNull _unitInsigniaConfig) then {
[_display, _control, _curSel, missionConfigFile >> "CfgUnitInsignia" >> _item] call FUNC(itemInfo);
} else {
[_display, _control, _curSel, _unitInsigniaConfig] call FUNC(itemInfo);
};
[_display, _control, _curSel, _itemCfg] call FUNC(itemInfo);
};
};

View File

@ -69,7 +69,14 @@ switch (_currentItemsIndex) do {
// Secondary weapon
case IDX_CURR_SECONDARY_WEAPON_ITEMS: {
private _currentItemInSlot = (GVAR(currentItems) select IDX_CURR_SECONDARY_WEAPON_ITEMS) select _itemIndex;
private _isDisposable = CBA_disposable_replaceDisposableLauncher && {!isNil {CBA_disposable_loadedLaunchers getVariable (secondaryWeapon GVAR(center))}};
private _isDisposable = CBA_disposable_replaceDisposableLauncher && {!isNil "CBA_disposable_loadedLaunchers"} &&
{
if (CBA_disposable_loadedLaunchers isEqualType createHashMap) then { // after CBA 3.18
(secondaryWeapon GVAR(center)) in CBA_disposable_loadedLaunchers
} else {
!isNil {CBA_disposable_loadedLaunchers getVariable (secondaryWeapon player)}
}
};
// If removal
if (_item == "") then {

View File

@ -31,7 +31,7 @@ private _tabToChange = [];
_stringCount = count _currentID;
// Make sure to keep at least 1 sort per category, so make default sort not deletable
if ("ace_alphabetically" in toLower (_currentID select [0, _stringCount - 3])) then {
if ("ace_alphabetically" in toLowerANSI (_currentID select [0, _stringCount - 3])) then {
continue;
};

View File

@ -25,7 +25,6 @@ if (count _loadout == 2) then {
if (count _loadout != 10) exitWith {[]};
private _weapon = "";
private _weaponsInfo = [];
private _uniqueBaseCfgText = "";
private _cfgWeapons = configFile >> "CfgWeapons";
@ -43,7 +42,7 @@ private _cfgVehicles = configFile >> "CfgVehicles";
// Check weapon & weapon attachments
{
// Magazines
// Magazines in weapons have 2 entries: Name and ammo count
if (_forEachIndex in [4, 5]) then {
_x params [["_magazine", ""], "_count"];
@ -69,23 +68,69 @@ private _cfgVehicles = configFile >> "CfgVehicles";
_x params [["_containerClass", ""], ["_items", []]];
if (_containerClass != "") then {
_uniqueBaseCfgText = (getText ([_cfgWeapons, _cfgVehicles] select (_forEachIndex == IDX_LOADOUT_BACKPACK) >> _containerClass >> QGVAR(uniqueBase))) call EFUNC(common,getConfigName);
if (_forEachIndex == IDX_LOADOUT_BACKPACK) then {
// Check for non-preset first
_uniqueBaseCfgText = [_containerClass, "CfgVehicles"] call CBA_fnc_getNonPresetClass;
if (_uniqueBaseCfgText != "") then {
(_x select 0) set [0, _uniqueBaseCfgText];
if (_uniqueBaseCfgText != "") then {
_containerClass = _uniqueBaseCfgText;
};
// Check if non-preset backpack has a unique base
_uniqueBaseCfgText = (getText (_cfgVehicles >> _containerClass >> QGVAR(uniqueBase))) call EFUNC(common,getConfigName);
if (_uniqueBaseCfgText != "") then {
_containerClass = _uniqueBaseCfgText;
};
_x set [0, _containerClass];
} else {
_uniqueBaseCfgText = (getText (_cfgWeapons >> _containerClass >> QGVAR(uniqueBase))) call EFUNC(common,getConfigName);
if (_uniqueBaseCfgText != "") then {
_x set [0, _uniqueBaseCfgText];
};
};
// Check if container has items that need replacing with a defined base
{
switch (true) do {
// Containers have 2 entries: Name and isBackpack
case (_x isEqualTypeArray ["", false]);
case (_x isEqualTypeArray ["", false]): {
_x params ["_containerClass", "_isBackpack"];
if (_containerClass != "") then {
if (_isBackpack) then {
// Check for non-preset first
_uniqueBaseCfgText = [_containerClass, "CfgVehicles"] call CBA_fnc_getNonPresetClass;
if (_uniqueBaseCfgText != "") then {
_containerClass = _uniqueBaseCfgText;
};
// Check if non-preset backpack has a unique base
_uniqueBaseCfgText = (getText (_cfgVehicles >> _containerClass >> QGVAR(uniqueBase))) call EFUNC(common,getConfigName);
if (_uniqueBaseCfgText != "") then {
_containerClass = _uniqueBaseCfgText;
};
_x set [0, _containerClass];
} else {
_uniqueBaseCfgText = (getText (_cfgWeapons >> _containerClass >> QGVAR(uniqueBase))) call EFUNC(common,getConfigName);
if (_uniqueBaseCfgText != "") then {
_x set [0, _uniqueBaseCfgText];
};
};
};
};
// Misc. items have 2 entries: Name and amount
case (_x isEqualTypeArray ["", 0]): {
_x params ["_item", "_arg"];
_x params ["_item"];
if (_item != "") then {
_uniqueBaseCfgText = (getText ([_cfgWeapons, _cfgVehicles] select ((_arg isEqualType false) && {_arg}) >> _item >> QGVAR(uniqueBase))) call EFUNC(common,getConfigName);
_uniqueBaseCfgText = (getText (_cfgWeapons >> _item >> QGVAR(uniqueBase))) call EFUNC(common,getConfigName);
if (_uniqueBaseCfgText != "") then {
_x set [0, _uniqueBaseCfgText];
@ -94,7 +139,7 @@ private _cfgVehicles = configFile >> "CfgVehicles";
};
// Weapons have 2 entries: Weapon info array and amount
case (_x isEqualTypeArray [[], 0]): {
_weaponsInfo = _x select 0;
_x params ["_weaponsInfo"];
// Check weapon & weapon attachments
{

View File

@ -160,7 +160,7 @@ private _magazineMiscItems = createHashMap;
{
_magazineMiscItems set [configName _x, nil];
} forEach ((toString {getNumber (_x >> "ACE_isUnique") == 1}) configClasses _cfgMagazines);
} forEach ((toString {getNumber (_x >> "ACE_isUnique") == 1 || getNumber (_x >> "ACE_asItem") == 1}) configClasses _cfgMagazines);
// Remove invalid/non-existent entries
_grenadeList deleteAt "";
@ -282,11 +282,42 @@ uiNamespace setVariable [QGVAR(CBAdisposableLaunchers), compileFinal _launchers]
uiNamespace setVariable [QGVAR(configItemsTools), compileFinal _toolList];
// Compatibility: Override baseWeapon for RHS optics
// No good way to do this via script for other attachments, needs manual compat
// No good way to do this via script for other RHS attachments, needs manual compat
private _baseWeaponCache = uiNamespace getVariable QGVAR(baseWeaponNameCache);
{
private _baseAttachment = configName (_cfgWeapons >> getText (_x >> "rhs_optic_base"));
if (_baseAttachment != "") then {
_baseWeaponCache set [toLower configName _x, _baseAttachment];
_baseWeaponCache set [toLowerANSI configName _x, _baseAttachment];
};
} forEach ("getText (_x >> 'rhs_optic_base') != ''" configClasses _cfgWeapons);
// Compatibility: Override baseWeapon for CBA Scripted Optics
// Adapted from https://github.com/Theseus-Aegis/Mods/blob/master/addons/armory/functions/fnc_getBaseVariant.sqf
private _isScriptedOptic = toString {
isClass (_x >> "CBA_ScriptedOptic") ||
{(getText (_x >> "weaponInfoType")) regexMatch "CBA_scriptedOptic.*?"}
};
{
private _xClass = toLowerANSI configName _x;
private _baseOptic = _xClass call FUNC(baseOptic);
if (_baseOptic != "" && {_baseOptic != _xClass}) then {
TRACE_2("updating baseOptic",_xClass,_baseOptic);
_baseWeaponCache set [_xClass, _baseOptic];
};
} forEach (_isScriptedOptic configClasses _cfgWeapons);
// Compatibility: Override baseWeapon for CBA Scripted Attachments
private _isScriptedAttachment = toString {
getText (_x >> "MRT_SwitchItemNextClass") != "" ||
{getText (_x >> "MRT_SwitchItemPrevClass") != ""}
};
{
private _xClass = toLowerANSI configName _x;
private _baseAttachment = _xClass call FUNC(baseAttachment);
if (_baseAttachment != "" && {_baseAttachment != _xClass}) then {
TRACE_2("updating baseAttachment",_xClass,_baseAttachment);
_baseWeaponCache set [_xClass, _baseAttachment];
};
} forEach (_isScriptedAttachment configClasses _cfgWeapons);

View File

@ -72,6 +72,6 @@ if (_nextAction != GVAR(currentAction)) then {
GVAR(currentAction) = _nextAction;
};
if (!(GVAR(currentAction) in ["Civil", "Salute"])) then {
if !(GVAR(currentAction) in ["Civil", "Salute"]) then {
GVAR(center) selectWeapon ([primaryWeapon GVAR(center), secondaryWeapon GVAR(center), handgunWeapon GVAR(center), binocular GVAR(center)] select GVAR(selectedWeaponType)); // select correct weapon, prevents floating weapons
};

View File

@ -15,6 +15,10 @@
params ["_control"];
// https://community.bistudio.com/wiki/toString, see comment
// However, using 55295 did not work as expected, 55291 was found by trial and error
#define HIGHEST_VALUE_CHAR 55291
// When filling the sorting panel, FUNC(sortPanel) is called twice, so ignore first call
if (GVAR(ignoreFirstSortPanelCall)) exitWith {
GVAR(ignoreFirstSortPanelCall) = false;
@ -29,6 +33,7 @@ private _sortDirectionCtrl = _display displayCtrl ([IDC_sortLeftTabDirection, ID
private _cfgMagazines = configFile >> "CfgMagazines";
private _cfgFaces = configFile >> "CfgFaces";
private _cfgUnitInsignia = configFile >> "CfgUnitInsignia";
private _cfgUnitInsigniaCampaign = campaignConfigFile >> "CfgUnitInsignia";
private _cfgUnitInsigniaMission = missionConfigFile >> "CfgUnitInsignia";
if (_rightSort) then {
@ -126,7 +131,6 @@ private _selected = if (_right) then {
_panel lbData _curSel
};
private _originalNames = createHashMap;
private _item = "";
private _quantity = "";
private _itemCfg = configNull;
@ -136,12 +140,8 @@ private _fillerChar = toString [1];
private _magazineMiscItems = uiNamespace getVariable QGVAR(magazineMiscItems);
private _sortCache = uiNamespace getVariable QGVAR(sortCache);
private _faceCache = if (_cfgClass == _cfgFaces) then {
uiNamespace getVariable [QGVAR(faceCache), createHashMap]
} else {
createHashMap
};
private _faceCache = uiNamespace getVariable QGVAR(faceCache);
private _insigniaCache = uiNamespace getVariable QGVAR(insigniaCache);
private _countColumns = if (_right) then {
count lnbGetColumnsPosition _panel
@ -150,9 +150,9 @@ private _countColumns = if (_right) then {
};
private _for = if (_right) then {
for '_i' from 0 to (lnbSize _panel select 0) - 1
for "_i" from 0 to (lnbSize _panel select 0) - 1
} else {
for '_i' from 0 to (lbSize _panel) - 1
for "_i" from 0 to (lbSize _panel) - 1
};
_for do {
@ -163,6 +163,14 @@ _for do {
_panel lbData _i
};
// Check if entry is "Empty"
if (!_right && {(_panel lbValue _i) == -1}) then {
// Set to lowest/highest lexicographical value, so that "Empty" is always at the top
_panel lbSetTextRight [_i, ["", toString [HIGHEST_VALUE_CHAR, HIGHEST_VALUE_CHAR, HIGHEST_VALUE_CHAR, HIGHEST_VALUE_CHAR, HIGHEST_VALUE_CHAR]] select (_sortDirection == ASCENDING)];
continue;
};
// Get item's count
_quantity = if (_right) then {
parseNumber (_panel lnbText [_i, 2])
@ -179,18 +187,22 @@ _for do {
_itemCfg = if !(_cfgClass in [_cfgFaces, _cfgUnitInsignia]) then {
_cfgClass >> _item
} else {
// If insignia, check both config and mission file
// If insignia, check for correct config: First mission, then campaign and finally regular config
if (_cfgClass == _cfgUnitInsignia) then {
_itemCfg = _cfgClass >> _item;
_itemCfg = _cfgUnitInsigniaMission >> _item;
if (isNull _itemCfg) then {
_itemCfg = _cfgUnitInsigniaMission >> _item;
_itemCfg = _cfgUnitInsigniaCampaign >> _item;
};
if (isNull _itemCfg) then {
_itemCfg = _cfgUnitInsignia >> _item;
};
_itemCfg
} else {
// If face, check correct category
_cfgClass >> (_faceCache get _item) param [2, "Man_A3"] >> _item
_cfgClass >> (_faceCache getOrDefault [_item, []]) param [2, "Man_A3"] >> _item
};
};
@ -216,37 +228,29 @@ _for do {
_value
}, true];
// Save the current row's item's name in a cache and set text to it's sorting value
// Set the right text temporarily, so it can be used for sorting
if (_right) then {
_name = _panel lnbText [_i, 1];
_originalNames set [_item, _name];
// Use value, display name and classname to sort, which means a fixed alphabetical order is guaranteed
// Filler char has lowest lexicographical order possible
_panel lnbSetText [[_i, 1], format ["%1%2%4%3", _value, _name, _item, _fillerChar]];
// Filler char has lowest lexicographical value possible
_panel lnbSetTextRight [[_i, 1], format ["%1%2%4%3", _value, _panel lnbText [_i, 1], _item, _fillerChar]];
} else {
if (_item != "") then {
_name = _panel lbText _i;
_originalNames set [_item, _name];
// Use value, display name and classname to sort, which means a fixed alphabetical order is guaranteed
// Filler char has lowest lexicographical order possible
_panel lbSetText [_i, format ["%1%2%4%3", _value, _name, _item, _fillerChar]];
// Filler char has lowest lexicographical value possible
_panel lbSetTextRight [_i, format ["%1%2%4%3", _value, _panel lbText _i, _item, _fillerChar]];
};
};
};
// Sort alphabetically, find the previously selected item, select it again and reset text to original text
// Sort alphabetically, find the previously selected item and select it again
if (_right) then {
_panel lnbSort [1, _sortDirection == ASCENDING];
[_panel, 1] lnbSortBy ["TEXT", _sortDirection == ASCENDING, false, true, true]; // do not support unicode, as it's much more performance intensive (~3x more)
_for do {
_item = _panel lnbData [_i, 0];
// Remove sorting text, as it blocks the item name otherwise
_panel lnbSetTextRight [[_i, 1], ""];
_panel lnbSetText [[_i, 1], _originalNames get _item];
// Set selection after text, otherwise item info box on the right side shows invalid name
if (_curSel != -1 && {_item == _selected}) then {
if (_curSel != -1 && {(_panel lnbData [_i, 0]) == _selected}) then {
_panel lnbSetCurSelRow _i;
// To avoid unnecessary checks after previsouly selected item was found
@ -254,17 +258,17 @@ if (_right) then {
};
};
} else {
lbSort [_panel, ["DESC", "ASC"] select _sortDirection];
_panel lbSortBy ["TEXT", _sortDirection == ASCENDING, false, true, true]; // do not support unicode, as it's much more performance intensive (~3x more)
_for do {
_item = _panel lbData _i;
// Check if valid item (problems can be caused when searching)
if (_item != "") then {
_panel lbSetText [_i, _originalNames get _item];
// Remove sorting text, as it blocks the item name otherwise
_panel lbSetTextRight [_i, ""];
};
// Set selection after text, otherwise item info box on the right side shows invalid name
if (_curSel != -1 && {_item == _selected}) then {
_panel lbSetCurSel _i;

View File

@ -17,7 +17,7 @@ params ["", "_config"];
TRACE_1("statTextStatement_binoVisionMode",_config);
private _text = [];
private _visionModes = getArray (_config >> "visionMode") apply {toLower _x};
private _visionModes = getArray (_config >> "visionMode") apply {toLowerANSI _x};
{
if (_x in _visionModes) then {
_text pushBack (localize ([LSTRING(VisionNormal), LSTRING(VisionNight), LSTRING(VisionThermal)] select _forEachIndex));

View File

@ -0,0 +1,26 @@
#include "..\script_component.hpp"
/*
* Author: PabstMirror
* Text statement for the load stat.
*
* Arguments:
* 0: Stats <ARRAY>
* 1: Item config path <CONFIG>
*
* Return Value:
* Stat Text <STRING>
*
* Public: No
*/
params ["_stats", "_config"];
TRACE_2("statTextStatement_load",_stats,_config);
if (!isNull (_config >> "ItemInfo" >> "containerClass")) then { // Uniform/Vest
_config = configfile >> "CfgVehicles" >> getText (_config >> "ItemInfo" >> "containerClass");
};
private _load = getNumber (_config >> (_stats # 0));
if (_load <= 0) exitWith { LELSTRING(common,none) };
format ["%1kg (%2lb)", (_load * 0.1 * (1 / 2.2046)) toFixed 2, (_load * 0.1) toFixed 2]

View File

@ -17,7 +17,7 @@ params ["", "_config"];
TRACE_1("statTextStatement_scopeVisionMode",_config);
private _opticsModes = ("true" configClasses (_config >> "ItemInfo" >> "OpticsModes")) apply {
private _visionMode = getArray (_x >> "visionMode") apply {toLower _x};
private _visionMode = getArray (_x >> "visionMode") apply {toLowerANSI _x};
[
getNumber (_x >> "useModelOptics") == 1, // Is in optics
_visionMode isEqualTo [], // Optional NVG

View File

@ -63,8 +63,12 @@ private _indexCurrentItems = -1;
};
// Backpack
case IDX_LOADOUT_BACKPACK: {
GVAR(currentItems) set [IDX_CURR_BACKPACK, _x param [0, ""]];
GVAR(currentItems) set [IDX_CURR_BACKPACK_ITEMS, _x param [1, []]];
_x params [["_backpack", ""], ["_items", []]];
if (_backpack != "") then {
_backpack = [_backpack, "CfgVehicles"] call CBA_fnc_getNonPresetClass;
};
GVAR(currentItems) set [IDX_CURR_BACKPACK, _backpack];
GVAR(currentItems) set [IDX_CURR_BACKPACK_ITEMS, _items];
};
// Helmet
case IDX_LOADOUT_HEADGEAR: {

View File

@ -101,6 +101,11 @@ private _fnc_uniqueEquipment = {
case IDX_LOADOUT_BACKPACK: {
_x params [["_containerClass", ""]];
// Handle preset (loaded/AI) backpacks
if (_containerClass != "" && _forEachIndex == IDX_LOADOUT_BACKPACK) then {
_containerClass = [_containerClass, "CfgVehicles"] call CBA_fnc_getNonPresetClass;
};
// Remove all unique equipment in tab; Add container as a unique equipment
[GVAR(virtualItems) get (_forEachIndex + 1), _containerClass] call _fnc_uniqueEquipment;
};

View File

@ -13,285 +13,97 @@
* Public: No
*/
#define NOT_IN_ARSENAL !(_name in GVAR(virtualItemsFlat))
params ["_loadout"];
private _extendedInfo = createHashMap;
// Check if the provided loadout is a CBA extended loadout
if (count _loadout == 2) then {
_extendedInfo = _loadout select 1;
_extendedInfo = +(_loadout select 1); // Copy the hashmap to prevent events from modifiyng the profileNamespace extendedInfo
if (_extendedInfo isEqualType []) then { // Hashmaps are serialized as arrays, convert back to hashmap
_extendedInfo = createHashMapFromArray _extendedInfo;
_loadout set [1, _extendedInfo]; // Also fix source variable, technically not needed but doesn't hurt
};
_loadout = _loadout select 0;
};
private _cfgWeapons = configFile >> "CfgWeapons";
private _cfgMagazines = configFile >> "CfgMagazines";
private _cfgVehicles = configFile >> "CfgVehicles";
private _cfgGlasses = configFile >> "CfgGlasses";
private _weapons = GVAR(virtualItems) get IDX_VIRT_WEAPONS;
private _attachments = GVAR(virtualItems) get IDX_VIRT_ATTACHMENTS;
private _name = "";
private _nullItemsAmount = 0;
private _unavailableItemsAmount = 0;
private _itemArray = [];
private _nullItemsList = [];
private _unavailableItemsList = [];
private _missingExtendedInfo = [];
// Search for all items and turn them into config case; Don't touch other value types
private _fnc_toConfigCase = {
// Search for all items and check their availability
private _fnc_filterLoadout = {
_this apply {
if (_x isEqualType "") then {
if (_x != "") then {
_name = _x call EFUNC(common,getConfigName);
if (_x isEqualType "" && {_x != ""}) then {
_name = _x call EFUNC(common,getConfigName);
// If item doesn't exist in config, "" is returned
// Just return unaltered item name in that case, so it can be documented as being unavailable
[_x, _name] select (_name != "");
// If item doesn't exist in config, "" is returned
if (_name == "") then {
_nullItemsList pushBack _x;
} else {
_x
// Check if item or its base weapon exist in the arsenal
if NOT_IN_ARSENAL then {
_name = _name call FUNC(baseWeapon);
if NOT_IN_ARSENAL then {
// This could be a backpack
private _temp = [_name, "CfgVehicles"] call CBA_fnc_getNonPresetClass;
if (_temp == "") then { // It's not
_unavailableItemsList pushBack _name;
_name = "";
} else { // It is
_name = _temp;
// Check if it's available again
if NOT_IN_ARSENAL then {
_unavailableItemsList pushBack _name;
_name = "";
};
};
};
};
};
_name
} else {
// Handle arrays
if (_x isEqualType []) then {
_x call _fnc_toConfigCase
_itemArray = _x call _fnc_filterLoadout;
// If "" is given as a container, an error is thrown, therefore, filter out all unavailable/null containers
if (count _itemArray == 2 && {(_itemArray select 0) isEqualTo ""} && {(_itemArray select 1) isEqualType []}) then {
_itemArray = [];
};
_itemArray
} else {
// All other types
// All other types and empty strings
_x
};
};
};
};
// Convert loadout to config case
// Convert loadout to config case and replace null/unavailable items
// Loadout might come from a different modpack, which might have different config naming
_loadout = _loadout call _fnc_toConfigCase;
_loadout = _loadout call _fnc_filterLoadout;
// Check a weapon, with its attachments and magazines, if items are available
private _fnc_weaponCheck = {
params ["_weaponArray", ["_index", -1]];
{
private _class = _extendedInfo getOrDefault [_x, ""];
private _cache = missionNamespace getVariable (_x + "Cache");
{
// Weapons and attachments
if (_x isEqualType "") then {
if (_x != "") then {
// Check if item exists
if (isClass (_cfgWeapons >> _x)) then {
// Get base weapon
_x = _x call FUNC(baseWeapon);
// Check if item is available in arsenal
if !(
// Weapon class name is at the very start of the array
if (_forEachIndex == 0) then {
// If the type of weapon is known, only look through that array
if (_index != -1) then {
// If binos, choose differently
if (_index == IDX_LOADOUT_BINO) then {
_x in (GVAR(virtualItems) get IDX_VIRT_BINO)
} else {
_x in (_weapons get _index)
};
} else {
_x in (_weapons get IDX_VIRT_PRIMARY_WEAPONS) ||
{_x in (_weapons get IDX_VIRT_SECONDARY_WEAPONS)} ||
{_x in (_weapons get IDX_VIRT_HANDGUN_WEAPONS)} ||
{_x in (GVAR(virtualItems) get IDX_VIRT_BINO)}
};
} else {
_x in (_attachments get IDX_VIRT_OPTICS_ATTACHMENTS) ||
{_x in (_attachments get IDX_VIRT_FLASHLIGHT_ATTACHMENTS)} ||
{_x in (_attachments get IDX_VIRT_MUZZLE_ATTACHMENTS)} ||
{_x in (_attachments get IDX_VIRT_BIPOD_ATTACHMENTS)}
}
) then {
_unavailableItemsList pushBackUnique _x;
_weaponArray set [_forEachIndex, ""];
INC(_unavailableItemsAmount);
};
} else {
_nullItemsList pushBackUnique _x;
_weaponArray set [_forEachIndex, ""];
INC(_nullItemsAmount);
};
};
} else {
// Magazines
if (_x isNotEqualTo []) then {
_x params ["_magazine"];
// Check if item exists
if (isClass (_cfgMagazines >> _magazine)) then {
// Check if item is available in arsenal
if !(_magazine in (GVAR(virtualItems) get IDX_VIRT_ITEMS_ALL)) then {
_unavailableItemsList pushBackUnique _magazine;
_weaponArray set [_forEachIndex, []];
INC(_unavailableItemsAmount);
};
} else {
_nullItemsList pushBackUnique _magazine;
_weaponArray set [_forEachIndex, []];
INC(_nullItemsAmount);
};
};
};
} forEach _weaponArray;
};
private _item = "";
// Go through entire loadout to check if items are available in current arsenal
for "_dataIndex" from IDX_LOADOUT_PRIMARY_WEAPON to IDX_LOADOUT_ASSIGNEDITEMS do {
switch (_dataIndex) do {
// Primary weapon, Secondary weapon, Handgun weapon, Binoculars
case IDX_LOADOUT_PRIMARY_WEAPON;
case IDX_LOADOUT_SECONDARY_WEAPON;
case IDX_LOADOUT_HANDGUN_WEAPON;
case IDX_LOADOUT_BINO: {
[_loadout select _dataIndex, _dataIndex] call _fnc_weaponCheck;
};
// Uniform, vest, backpack
case IDX_LOADOUT_UNIFORM;
case IDX_LOADOUT_VEST;
case IDX_LOADOUT_BACKPACK: {
(_loadout select _dataIndex) params [["_item", ""], ["_containerItems", []]];
if (_item != "") then {
// Check if item exists
if (isClass (_cfgVehicles >> _item) || {isClass (_cfgWeapons >> _item)}) then {
// Check if item is available in arsenal
if !(_item in (GVAR(virtualItems) get (_dataIndex + 1))) then {
_unavailableItemsList pushBackUnique _item;
_loadout set [_dataIndex, []];
INC(_unavailableItemsAmount);
} else {
{
switch (true) do {
// Magazines have each 3 entries: Name, number of magazines and ammo count
case (_x isEqualTypeArray ["", 0, 0]): {
_x params ["_item"];
// Check if item exists
if (isClass (_cfgMagazines >> _item)) then {
// Check if item is available in arsenal
if !(
_item in (GVAR(virtualItems) get IDX_VIRT_ITEMS_ALL) ||
{_item in (GVAR(virtualItems) get IDX_VIRT_GRENADES)} ||
{_item in (GVAR(virtualItems) get IDX_VIRT_EXPLOSIVES)} ||
{_item in (GVAR(virtualItems) get IDX_VIRT_MISC_ITEMS)}
) then {
_unavailableItemsList pushBackUnique _item;
((_loadout select _dataIndex) select 1) set [_forEachIndex, []];
INC(_unavailableItemsAmount);
};
} else {
_nullItemsList pushBackUnique _item;
((_loadout select _dataIndex) select 1) set [_forEachIndex, []];
INC(_nullItemsAmount);
};
};
// Weapons have 2 entries: Weapon info array and amount
case (_x isEqualTypeArray [[], 0]): {
[_x select 0] call _fnc_weaponCheck;
};
// Misc. items have 2 entries: Name and amount, containers have 2 entries: Name and isBackpack
default {
_x params ["_item"];
// Check if item exists
if (
isClass (_cfgWeapons >> _item) ||
{isClass (_cfgMagazines >> _item)} ||
{isClass (_cfgGlasses >> _item)} ||
{isClass (_cfgVehicles >> _item)}
) then {
// Check if item is available in arsenal
if !(_item in GVAR(virtualItemsFlat)) then {
_unavailableItemsList pushBackUnique _item;
((_loadout select _dataIndex) select 1) set [_forEachIndex, []];
INC(_unavailableItemsAmount);
};
} else {
_nullItemsList pushBackUnique _item;
((_loadout select _dataIndex) select 1) set [_forEachIndex, []];
INC(_nullItemsAmount);
};
};
};
} forEach _containerItems;
};
} else {
_nullItemsList pushBackUnique _item;
_loadout set [_dataIndex, []];
INC(_nullItemsAmount);
};
};
};
// Headgear
case IDX_LOADOUT_HEADGEAR: {
_item = _loadout select _dataIndex;
if (_item != "") then {
// Check if item exists
if (isClass (_cfgWeapons >> _item)) then {
// Check if item is available in arsenal
if !(_item in (GVAR(virtualItems) get IDX_VIRT_HEADGEAR)) then {
_unavailableItemsList pushBackUnique _item;
_loadout set [_dataIndex, ""];
INC(_unavailableItemsAmount);
};
} else {
_nullItemsList pushBackUnique _item;
_loadout set [_dataIndex, ""];
INC(_nullItemsAmount);
};
};
};
// Facewear
case IDX_LOADOUT_GOGGLES: {
_item = _loadout select _dataIndex;
if (_item != "") then {
// Check if item exists
if (isClass (_cfgGlasses >> _item)) then {
// Check if item is available in arsenal
if !(_item in (GVAR(virtualItems) get IDX_VIRT_GOGGLES)) then {
_unavailableItemsList pushBackUnique _item;
_loadout set [_dataIndex, ""];
INC(_unavailableItemsAmount);
};
} else {
_nullItemsList pushBackUnique _item;
_loadout set [_dataIndex, ""];
INC(_nullItemsAmount);
};
};
};
// Assigned items: Map, Compass, Watch, GPS / UAV Terminal, Radio, NVGs
case IDX_LOADOUT_ASSIGNEDITEMS: {
private _assignedItems = _loadout select _dataIndex;
for "_subIndex" from 0 to 5 do {
_item = _assignedItems select _subIndex;
if (_item != "") then {
// Check if item exists
if (isClass (_cfgWeapons >> _item)) then {
// Check if item is available in arsenal
if !(_item in (GVAR(virtualItems) get (IDX_VIRT_NVG + ([2, 6, 4, 3, 5, 0] select _subIndex)))) then {
_unavailableItemsList pushBackUnique _item;
_assignedItems set [_subIndex, ""];
INC(_unavailableItemsAmount);
};
} else {
_nullItemsList pushBackUnique _item;
_assignedItems set [_subIndex, ""];
INC(_nullItemsAmount);
};
};
};
};
// Previously voices were stored in lower case (speaker command returns lower case), so this is to make old loadouts compatible
if (_class != "" && {_x == QGVAR(voice)}) then {
_class = _class call EFUNC(common,getConfigName);
};
};
if (_class != "" && {!(_class in _cache)}) then {
_missingExtendedInfo pushBack [_x, _class];
_extendedInfo deleteAt _x;
};
} forEach [QGVAR(insignia), QGVAR(face), QGVAR(voice)];
[[_loadout, _extendedInfo], _nullItemsAmount, _unavailableItemsAmount, _nullItemsList, _unavailableItemsList]
// Raise event for 3rd party: mostly for handling extended info
// Pass all items, including duplicates
[QGVAR(loadoutVerified), [_loadout, _extendedInfo, _nullItemsList, _unavailableItemsList, _missingExtendedInfo]] call CBA_fnc_localEvent;
[[_loadout, _extendedInfo], _nullItemsList arrayIntersect _nullItemsList, _unavailableItemsList arrayIntersect _unavailableItemsList, _missingExtendedInfo]

View File

@ -63,7 +63,7 @@ _target switchMove "amovpercmstpslowwrfldnon";
_target setVariable ["origin", _position];
// When killed, respawn AI
_target addEventHandler ["killed", {
_target addEventHandler ["Killed", {
params ["_target"];
// Killed may fire twice, 2nd will be null - https://github.com/acemod/ACE3/pull/7561

View File

@ -15,6 +15,3 @@
#endif
#include "\z\ace\addons\main\script_macros.hpp"
#define ACTION_TYPE_BUTTON 0
#define ACTION_TYPE_TEXT 1

View File

@ -23,7 +23,7 @@
<French>Masque l'interface</French>
<German>Oberfläche verstecken</German>
<Polish>Ukryj interfejs</Polish>
<Japanese>インタフェースを隠す</Japanese>
<Japanese>インタフェースを隠す</Japanese>
<Italian>Nascondi interfaccia</Italian>
<Korean>인터페이스 숨기기</Korean>
<Chinese>隱藏介面</Chinese>
@ -1191,7 +1191,7 @@
<Chinesesimp>支持夜视仪</Chinesesimp>
<Czech>Podpora nočního vidění</Czech>
<Turkish>Gece Görüş Desteği</Turkish>
<Korean>야간투시 지원여부</Korean>
<Korean>야간투시 지원</Korean>
</Key>
<Key ID="STR_ACE_Arsenal_statVisionMode_supPrim">
<English>Primary supported</English>
@ -1206,7 +1206,7 @@
<Chinese>主武器支援</Chinese>
<Chinesesimp>主镜支持</Chinesesimp>
<Czech>Hlavní část hledí podporuje</Czech>
<Korean>주무기 지원여부</Korean>
<Korean>주무기 지원</Korean>
</Key>
<Key ID="STR_ACE_Arsenal_statVisionMode_supSec">
<English>Secondary supported</English>
@ -1221,7 +1221,7 @@
<Chinese>次要武器支援</Chinese>
<Chinesesimp>副镜支持</Chinesesimp>
<Czech>Vedlejší část hledí podporuje</Czech>
<Korean>보조무기 지원여부</Korean>
<Korean>보조무기 지원</Korean>
</Key>
<Key ID="STR_ACE_Arsenal_statVisionMode_intPrim">
<English>Primary integrated</English>
@ -1236,15 +1236,27 @@
<Chinese>整合主武器</Chinese>
<Chinesesimp>主镜内置</Chinesesimp>
<Czech>Integrováno do hlavní části hledí</Czech>
<Korean>주무기 내장여부</Korean>
<Korean>주무기 내장</Korean>
</Key>
<Key ID="STR_ACE_Arsenal_statVisionMode_ti">
<English>Thermal integrated</English>
<Italian>Termico integrato</Italian>
<Japanese>熱画像装置内蔵</Japanese>
<Russian>Интегрирован тепловизор.</Russian>
<Korean>열화상 내장</Korean>
<French>Thermique intégrée</French>
<German>Thermal integriert</German>
<Spanish>Térmica integrada</Spanish>
</Key>
<Key ID="STR_ACE_Arsenal_statVisionMode_intPrimTi">
<English>Thermal &amp; Primary integrated</English>
<Italian>Termico e Primario integrato</Italian>
<Japanese>熱画像装置内蔵・プライマリに内蔵</Japanese>
<Russian>Интегрирован тепловизор и осн.прицел.</Russian>
<Korean>열화상과 주무기 내장</Korean>
<French>Thermique et primaire intégrés</French>
<German>Thermal und in Primärwaffe integriert</German>
<Spanish>Térmica y Primaria integrada</Spanish>
</Key>
<Key ID="STR_ACE_Arsenal_statVisionMode_NoSup">
<English>Not Supported</English>
@ -1600,6 +1612,8 @@
<Korean>내림차순</Korean>
<French>Décroissant</French>
<Portuguese>Decrescente</Portuguese>
<Russian>Нисходящий</Russian>
<Spanish>Descendiente</Spanish>
</Key>
<Key ID="STR_ACE_Arsenal_sortAscending">
<English>Ascending</English>
@ -1610,6 +1624,8 @@
<Korean>오름차순</Korean>
<French>Croissant</French>
<Portuguese>Crescente</Portuguese>
<Russian>Восходящий</Russian>
<Spanish>Ascendiente</Spanish>
</Key>
<Key ID="STR_ACE_Arsenal_toolsTab">
<English>Tools</English>
@ -1636,6 +1652,8 @@
<Korean>장탄 수</Korean>
<French>Nombre de munitions</French>
<Portuguese>Quantidade de munição</Portuguese>
<Russian>Количество боеприпасов</Russian>
<Spanish>Cantidad de munición</Spanish>
</Key>
<Key ID="STR_ACE_Arsenal_statIlluminators">
<English>Illuminators</English>
@ -1645,6 +1663,8 @@
<Korean>조명</Korean>
<Portuguese>Iluminadores</Portuguese>
<Japanese>イルミネーター</Japanese>
<Russian>Осветители</Russian>
<Spanish>Iluminadores</Spanish>
</Key>
<Key ID="STR_ACE_Arsenal_defaultToFavoritesSetting">
<English>Default to Favorites</English>
@ -1655,6 +1675,8 @@
<Korean>즐겨찾기 기본값</Korean>
<French>Favoris par défaut</French>
<Portuguese>Favoritos por padrão</Portuguese>
<Russian>По умолчанию - Избранное</Russian>
<Spanish>Favoritos por defecto</Spanish>
</Key>
<Key ID="STR_ACE_Arsenal_defaultToFavoritesTooltip">
<English>Controls whether the ACE Arsenal defaults to showing all items or favorites.</English>
@ -1665,6 +1687,8 @@
<Korean>ACE 아스널이 기본적으로 모든 아이템 또는 즐겨찾기를 표시할 지 여부를 조정합니다.</Korean>
<French>Contrôle si l'arsenal ACE affiche par défaut tous les éléments ou les favoris.</French>
<Portuguese>Controla se o Arsenal ACE exibe por padrão todos os itens ou favoritos.</Portuguese>
<Russian>Определяет, будет ли в арсенале ACE по умолчанию отображаться все предметы или избранное.</Russian>
<Spanish>Controla si el Arsenal de ACE muestra por defecto todos los objetos o sólo los favoritos</Spanish>
</Key>
<Key ID="STR_ACE_Arsenal_favoritesColorSetting">
<English>Favorites Color</English>
@ -1675,6 +1699,8 @@
<Korean>즐겨찾기 색상</Korean>
<French>Couleurs favorites</French>
<Portuguese>Cor dos favoritos</Portuguese>
<Russian>Избранный цвет</Russian>
<Spanish>Color de Favoritos</Spanish>
</Key>
<Key ID="STR_ACE_Arsenal_favoritesColorTooltip">
<English>Highlight color for favorited items.</English>
@ -1685,6 +1711,8 @@
<Korean>즐겨찾기한 아이템을 색상으로 강조합니다.</Korean>
<French>Met en surbrillance les éléments favoris.</French>
<Portuguese>Cor de destaque para itens favoritados.</Portuguese>
<Russian>Выделите цветом любимые предметы.</Russian>
<Spanish>Color de marcado para los objetos favoritos</Spanish>
</Key>
<Key ID="STR_ACE_Arsenal_buttonFavoritesTooltip">
<English>Switch between displaying all items or your favorites.\nDouble click while holding Shift to add or remove an item.</English>
@ -1695,6 +1723,8 @@
<Korean>모든 아이템을 표시하거나 즐겨찾기를 표시할 때 전환합니다\nShift 키를 누른 상태에서 두 번 클릭하여 아이템을 추가하거나 제거합니다.</Korean>
<French>Change entre l'affichage de tous les éléments ou de vos favoris.\nDouble-cliquez en maintenant la touche Maj enfoncée pour ajouter ou supprimer un élément.</French>
<Portuguese>Alterna entre a exibição de todos os itens ou seus favoritos.\nClique duas vezes enquanto mantém pressionada a tecla Shift para adicionar ou remover um item.</Portuguese>
<Russian>Переключайтесь между отображением всех элементов или ваших избранных.\nДважды щелкните, удерживая Shift, чтобы добавить или удалить элемент.</Russian>
<Spanish>Alterna entre mostrar todos los objetos o sólo los favoritos.\nDoble click mientras se pulsa Shift para añadir o quitar un objeto.</Spanish>
</Key>
<Key ID="STR_ACE_Arsenal_buttonSearchTooltip">
<English>Search\nCTRL + Click to enable live results</English>
@ -1702,6 +1732,9 @@
<Italian>Cerca\nCTRL + Click per modificare i risultati mentre scrivi</Italian>
<Japanese>検索\nCTRL + クリックで検索結果の即時表示を有効化</Japanese>
<Korean>검색\nCtrl + 클릭으로 실시간 검색 결과를 활성화</Korean>
<Russian>Поиск\nCtrl + Click для включения результатов в реальном времени</Russian>
<French>Recherche\nCTRL + clic pour modifier les résultats tout en écrivant</French>
<Spanish>Buscar\nCTRL + Click habilita los objetos en directo</Spanish>
</Key>
</Package>
</Project>

View File

@ -467,7 +467,6 @@ class GVAR(display) {
};
class actionsText1: RscTextMulti {
idc = IDC_actionsText1;
fade = 1;
x = QUOTE(0 * GRID_W);
y = QUOTE(5 * GRID_H);
w = QUOTE(45 * GRID_W);
@ -479,8 +478,6 @@ class GVAR(display) {
};
class actionsButton1: ctrlButton {
idc = IDC_actionsButton1;
onMouseEnter = QUOTE(ctrlSetFocus (_this select 0));
fade = 1;
text = "";
x = QUOTE(1 * GRID_W);
y = QUOTE(6 * GRID_H);
@ -567,6 +564,7 @@ class GVAR(display) {
colorSelect[] = {1,1,1,1};
colorSelect2[] = {1,1,1,1};
colorPictureRightSelected[] = {1,1,1,1};
colorTextRight[] = {0.5, 0.5, 0.5, 0};
onLBSelChanged = QUOTE(_this call FUNC(onSelChangedLeft));
onLBDblClick = QUOTE(_this call FUNC(onPanelDblClick));
onSetFocus = QUOTE(GVAR(leftTabFocus) = true);
@ -597,6 +595,7 @@ class GVAR(display) {
colorSelect[] = {1,1,1,1};
colorSelect2[] = {1,1,1,1};
colorPictureRightSelected[] = {1,1,1,1};
colorTextRight[] = {0.5, 0.5, 0.5, 0};
columns[] = {0.07, 0.15, 0.75};
idcLeft = IDC_arrowMinus;
idcRIght = IDC_arrowPlus;

View File

@ -1 +0,0 @@
#include "..\script_component.hpp"

View File

@ -25,7 +25,7 @@
params ["_vehicle", "", "", "", "", "_magazine", "_projectile", "_gunner"];
TRACE_4("firedEH",_vehicle,_magazine,_projectile,_gunner);
if (!([_gunner] call EFUNC(common,isPlayer))) exitWith {}; // AI don't know how to use (this does give them more range than a player)
if !([_gunner] call EFUNC(common,isPlayer)) exitWith {}; // AI don't know how to use (this does give them more range than a player)
if ((gunner _vehicle) != _gunner) exitWith {}; // check if primaryGunner
@ -35,7 +35,7 @@ if (isNumber (configFile >> "CfgMagazines" >> _magazine >> QGVAR(airFriction)))
_airFriction = getNumber (configFile >> "CfgMagazines" >> _magazine >> QGVAR(airFriction));
};
TRACE_1("",_airFriction);
if (_airFriction >= 0) exitWith {}; // 0 disables everything, >0 makes no sense
if (_airFriction == 0) exitWith {}; // 0 disables everything
BEGIN_COUNTER(adjustmentsCalc);
@ -60,6 +60,7 @@ if (_newMuzzleVelocityCoefficent != 1) then {
_projectile setVelocity _bulletVelocity;
};
if (_airFriction > 0) exitWith {}; // positive value indicates it has vanilla airFriction, so we can just exit
[{
params ["_projectile", "_kFactor", "_time"];

View File

@ -19,7 +19,7 @@ params ["_menuType"];
TRACE_1("interactMenuOpened",_menuType);
if (_menuType != 1) exitWith {};
if (!("ACE_artilleryTable" in (ace_player call EFUNC(common,uniqueItems)))) exitWith {};
if !("ACE_artilleryTable" in (ace_player call EFUNC(common,uniqueItems))) exitWith {};
private _vehicleAdded = ace_player getVariable [QGVAR(vehiclesAdded), []];
private _rangeTablesShown = ace_player getVariable [QGVAR(rangeTablesShown), []];

View File

@ -41,8 +41,15 @@ _mags = _mags apply {
private _initSpeed = getNumber (_magCfg >> _x >> "initSpeed");
_magParamsArray pushBackUnique _initSpeed;
private _airFriction = 0;
if (_advCorrection) then {
_airFriction = if (isNumber (_magCfg >> _x >> QGVAR(airFriction))) then { getNumber (_magCfg >> _x >> QGVAR(airFriction)) } else { DEFAULT_AIR_FRICTION };
private _magAirFriction = getNumber (_magCfg >> _x >> QGVAR(airFriction));
if (_magAirFriction <= 0) then {
if (_advCorrection) then {
_airFriction = [DEFAULT_AIR_FRICTION, _magAirFriction] select (isNumber (_magCfg >> _x >> QGVAR(airFriction)));
};
} else {
// positive value, use ammo's airFriction (regardless of setting)
private _ammo = getText (_magCfg >> _x >> "ammo");
_airFriction = getNumber (configFile >> "CfgAmmo" >> _ammo >> "airFriction");
};
_magParamsArray pushBackUnique _airFriction;
[getText (_magCfg >> _x >> "displayNameShort"), getText (_magCfg >> _x >> "displayName"), _initSpeed, _airFriction]

View File

@ -22,10 +22,10 @@ private _ctrlElevationHigh = _dialog displayCtrl IDC_BUTTON_ELEV_HIGH;
private _ctrlElevationLow = _dialog displayCtrl IDC_BUTTON_ELEV_LOW;
GVAR(lastElevationMode) = param [0, GVAR(lastElevationMode)]; // update if passed a new value
GVAR(lastCharge) = lbCurSel _ctrlChargeList;
GVAR(lastTablePage) = lbCurSel _ctrlChargeList;
// get data for currently selected mag/mode combo:
(GVAR(magModeData) select GVAR(lastCharge)) params [["_muzzleVelocity", -1], ["_airFriction", 0]];
(GVAR(magModeData) select GVAR(lastTablePage)) params [["_muzzleVelocity", -1], ["_airFriction", 0]];
private _elevMin = _dialog getVariable [QGVAR(elevMin), 0];
private _elevMax = _dialog getVariable [QGVAR(elevMax), 0];
_ctrlElevationHigh ctrlSetTextColor ([[0.25,0.25,0.25,1],[1,1,1,1]] select GVAR(lastElevationMode));

View File

@ -15,7 +15,5 @@ private _categoryName = [format ["ACE %1", localize "str_a3_cfgmarkers_nato_art"
[LSTRING(disableArtilleryComputer_displayName), LSTRING(disableArtilleryComputer_description)],
_categoryName,
false, // default value
true, // isGlobal
{[QGVAR(disableArtilleryComputer), _this] call EFUNC(common,cbaSettings_settingChanged)},
false // Needs mission restart
true // isGlobal
] call CBA_fnc_addSetting;

View File

@ -1,8 +1,10 @@
#include "script_component.hpp"
if (!hasInterface) exitWith {};
#include "initKeybinds.inc.sqf"
GVAR(active) = false;
GVAR(initialised) = false;
[QEGVAR(vector,rangefinderData), {_this call FUNC(sord)}] call CBA_fnc_addEventHandler;
[QEGVAR(vector,rangefinderData), LINKFUNC(sord)] call CBA_fnc_addEventHandler;

View File

@ -23,7 +23,7 @@ if ((profileNamespace getVariable ["ACE_ATragMX_profileNamespaceVersion", 0]) ==
_resetGunList = false;
{
// Verify each gun has correct param type
if (!(_x isEqualTypeArray ["", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", [], [], false])) exitWith {
if !(_x isEqualTypeArray ["", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", [], [], false]) exitWith {
_resetGunList = true;
};
} forEach GVAR(gunList);

View File

@ -74,7 +74,7 @@ private _validate_preset = {
ERROR(_errorMsg);
_valid = false;
};
if (!((_this select 17) in ["ASM", "ICAO"])) then {
if !((_this select 17) in ["ASM", "ICAO"]) then {
private _errorMsg = format ["Invalid atmosphere model: %1", _this select 17];
ERROR(_errorMsg);
_valid = false;

View File

@ -26,7 +26,7 @@ if !(ctrlVisible 9000) then {
params ["_args"];
_args params ["_startTime"];
if (!(GVAR(speedAssistTimer))) exitWith {
if !(GVAR(speedAssistTimer)) exitWith {
GVAR(speedAssistTimer) = true;
ctrlSetText [8006, Str(Round((CBA_missionTime - _startTime) * 10) / 10)];

View File

@ -15,7 +15,7 @@
* Public: No
*/
if (!(missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false])) exitWith {};
if !(missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) exitWith {};
if (ctrlVisible 17000) then {
false call FUNC(show_c1_ballistic_coefficient_data);

View File

@ -15,7 +15,7 @@
* Public: No
*/
if (!(missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false])) exitWith {};
if !(missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) exitWith {};
if (ctrlVisible 16000) then {
false call FUNC(show_muzzle_velocity_data);

View File

@ -15,7 +15,7 @@
* Public: No
*/
if (!(missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false])) exitWith {};
if !(missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) exitWith {};
if (ctrlVisible 18000) then {
false call FUNC(show_truing_drop);

View File

@ -35,7 +35,7 @@ if (!GVAR(atmosphereModeTBH)) then {
_relativeHumidity = 0.5;
};
private _scopeBaseAngle = if (!(missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false])) then {
private _scopeBaseAngle = if !(missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then {
private _zeroAngle = "ace_advanced_ballistics" callExtension format ["calcZero:%1:%2:%3:%4", _zeroRange, _muzzleVelocity, _airFriction, _boreHeight];
(parseNumber _zeroAngle)
} else {

View File

@ -57,7 +57,7 @@ if (!_isChemlight) then {
_unit addItem _itemName;
};
if (toLower _itemName in ["b_ir_grenade", "o_ir_grenade", "i_ir_grenade"]) then {
if (toLowerANSI _itemName in ["b_ir_grenade", "o_ir_grenade", "i_ir_grenade"]) then {
// Hack for dealing with X_IR_Grenade effect not dissapearing on deleteVehicle
detach _attachedObject;
_attachedObject setPos ((getPos _unit) vectorAdd [0, 0, -1000]);

View File

@ -28,7 +28,7 @@ if (_attachedList isEqualTo []) exitWith {};
TRACE_2("detaching",_xObject,_deadUnit);
detach _xObject;
//If it's a vehicle, also delete the attached
if (!(_deadUnit isKindOf "CAManBase")) then {
if !(_deadUnit isKindOf "CAManBase") then {
_xObject setPos ((getPos _deadUnit) vectorAdd [0, 0, -1000]);
[{deleteVehicle (_this select 0)}, [_xObject], 2] call CBA_fnc_waitAndExecute;
};

View File

@ -1505,7 +1505,7 @@
<Portuguese>Carregador de 10 cartuchos 9.3 mm traçantes IR-DIM</Portuguese>
<Hungarian>9,3 mm 10-lövedékes infravörös nyomkövető tár</Hungarian>
<Japanese>9.3mm 10Rnd IR-DIM トレーサー マガジン</Japanese>
<Korean>10발들이 9.3mm IR-DIM 예광탄 탄창</Korean>
<Korean>10발 들이 9.3mm IR-DIM 예광탄 탄창</Korean>
<Chinese>9.3毫米 10發 低視度紅外線曳光彈 彈匣</Chinese>
<Chinesesimp>9.3 mm 10发 弹匣(红外曳光)</Chinesesimp>
<Turkish>9.3 mm 10Rnd Tracer IR-DIM Mag</Turkish>
@ -1608,7 +1608,7 @@
<Portuguese>Cinto de munição traçante 9.3 mm IR-DIM com 150 cartuchos</Portuguese>
<Hungarian>9,3 mm 150-lövedékes infravörös nyomkövető heveder</Hungarian>
<Japanese>9.3mm 150Rnd IR-DIM トレーサー ベルト</Japanese>
<Korean>150발들이 9.3mm IR-DIM 예광탄 벨트</Korean>
<Korean>150발 들이 9.3mm IR-DIM 예광탄 벨트</Korean>
<Chinese>9.3毫米 150發 低視度紅外線曳光彈 彈鏈</Chinese>
<Chinesesimp>9.3 mm 150发 弹链(红外曳光)</Chinesesimp>
<Turkish>9.3 mm 150Rnd Tracer IR-DIM Belt</Turkish>
@ -1659,7 +1659,7 @@
<Portuguese>Cinto de munição 9.3 mm AP com 150 cartuchos</Portuguese>
<Hungarian>9,3 mm 150-lövedékes páncéltörő heveder</Hungarian>
<Japanese>9.3mm 150Rnd 徹甲弾 ベルト</Japanese>
<Korean>150발들이 9.3mm 철갑탄 벨트</Korean>
<Korean>150발 들이 9.3mm 철갑탄 벨트</Korean>
<Chinese>9.3毫米 150發 穿甲彈 彈鏈</Chinese>
<Chinesesimp>9.3 mm 150发 弹链(穿甲)</Chinesesimp>
<Turkish>9.3 mm 150Rnd AP Belt</Turkish>
@ -1710,7 +1710,7 @@
<Portuguese>Carregador de 16 cartuchos 9x19 mm</Portuguese>
<Hungarian>9x19 mm 16-lövedékes tár</Hungarian>
<Japanese>9x19 mm 16Rnd マガジン</Japanese>
<Korean>17발들이 9x19mm 탄창</Korean>
<Korean>16발 들이 9x19mm 탄창</Korean>
<Chinese>9x19毫米 16發 彈匣</Chinese>
<Chinesesimp>9x19 mm 16发 弹匣</Chinesesimp>
<Turkish>9x19 mm 16Rnd Mag</Turkish>
@ -2016,7 +2016,7 @@
<Portuguese>Carregador 5.56 mm com 30 cartuchos (Mk318)</Portuguese>
<Hungarian>5,56 mm 30-lövedékes tár (Mk318)</Hungarian>
<Japanese>5.56mm 30Rnd マガジン (Mk318)</Japanese>
<Korean>30발들이 5.56mm 탄창 (Mk.318)</Korean>
<Korean>30발 들이 5.56mm 탄창 (Mk.318)</Korean>
<Chinese>5.56毫米 30發 彈匣 (Mk318 特戰專用彈)</Chinese>
<Chinesesimp>5.56 mm 30发 弹匣Mk318</Chinesesimp>
<Turkish>5.56 mm 30Rnd Mag (Mk318)</Turkish>
@ -2322,7 +2322,7 @@
<Portuguese>Carregador 7.62 mm com 10 cartuchos (Mk319 Mod 0)</Portuguese>
<Hungarian>7,62 mm 10-lövedékes tár (Mk319 Mod 0)</Hungarian>
<Japanese>7.62mm 10Rnd マガジン (Mk319 Mod 0)</Japanese>
<Korean>10발들이 7.62mm 탄창 (Mk.319 Mod 0)</Korean>
<Korean>10발 들이 7.62mm 탄창 (Mk.319 Mod 0)</Korean>
<Chinese>7.62毫米 10發 彈匣 (Mk319 Mod 0 特戰專用彈)</Chinese>
<Chinesesimp>7.62 mm 10发 弹匣Mk319 Mod 0</Chinesesimp>
<Turkish>7.62 mm 10Rnd Mag (Mk319 Mod 0)</Turkish>
@ -3344,7 +3344,7 @@
<Portuguese>Carregador 12.7x99 mm (AMAX) com 5 cartuchos </Portuguese>
<Hungarian>12,7x99 mm 5-lövedékes tár (AMAX)</Hungarian>
<Japanese>12.7x99mm 5Rnd マガジン (AMAX)</Japanese>
<Korean>5발들이 12.7x99mm 탄창 (AMAX)</Korean>
<Korean>5발 들이 12.7x99mm 탄창 (AMAX)</Korean>
<Chinese>12.7x99毫米 5發 彈匣 (AMAX 比賽專用彈)</Chinese>
<Chinesesimp>12.7x99 mm 5发 弹匣AMAX</Chinesesimp>
<Turkish>12.7x99 mm 5Rnd Şarjör (AMAX)</Turkish>
@ -3378,7 +3378,7 @@
<Portuguese>Carregador 12.7x99 mm (AMAX) com 10 cartuchos </Portuguese>
<Hungarian>12,7x99 mm 10-lövedékes tár (AMAX)</Hungarian>
<Japanese>12.7x99mm 10Rnd マガジン (AMAX)</Japanese>
<Korean>10발들이 12.7x99mm 탄창 (AMAX)</Korean>
<Korean>10발 들이 12.7x99mm 탄창 (AMAX)</Korean>
<Chinese>12.7x99毫米 10發 彈匣 (AMAX 比賽專用彈)</Chinese>
<Chinesesimp>12.7x99 mm 10发 弹匣AMAX</Chinesesimp>
<Turkish>12.7x99 mm 10Rnd Şarjör (AMAX)</Turkish>
@ -3539,6 +3539,8 @@
<Korean>인공지능 사용</Korean>
<French>Utilisation de l'IA</French>
<Portuguese>Utilização por IA</Portuguese>
<Russian>Использование ИИ</Russian>
<Spanish>Uso de la IA</Spanish>
</Key>
<Key ID="STR_ACE_Ballistics_ammoUsageShort_illumination">
<English>Illum</English>
@ -3549,6 +3551,8 @@
<Korean>조명탄</Korean>
<French>Fusées éclairantes</French>
<Portuguese>Sinalizadoras</Portuguese>
<Russian>Осветители</Russian>
<Spanish>Iluminación</Spanish>
</Key>
<Key ID="STR_ACE_Ballistics_ammoUsageShort_concealment">
<English>Smoke</English>
@ -3559,6 +3563,8 @@
<Korean>연막탄</Korean>
<French>Fumigènes</French>
<Portuguese>Fumígenas</Portuguese>
<Russian>Дым</Russian>
<Spanish>Humo</Spanish>
</Key>
<Key ID="STR_ACE_Ballistics_ammoUsageShort_infantry">
<English>Inf</English>
@ -3569,6 +3575,8 @@
<Korean>보병</Korean>
<French>Infanterie</French>
<Portuguese>Infantaria</Portuguese>
<Russian>Пехота</Russian>
<Spanish>Infantería</Spanish>
</Key>
<Key ID="STR_ACE_Ballistics_ammoUsageShort_lightVehicle">
<English>Veh</English>
@ -3579,6 +3587,8 @@
<Korean>차량</Korean>
<French>Véhicule</French>
<Portuguese>Veículo</Portuguese>
<Russian>Техника</Russian>
<Spanish>Vehículo</Spanish>
</Key>
<Key ID="STR_ACE_Ballistics_ammoUsageShort_armor">
<English>Armor</English>
@ -3589,6 +3599,8 @@
<Korean>기갑</Korean>
<French>Blindage</French>
<Portuguese>Blindagem</Portuguese>
<Russian>Бронетехника</Russian>
<Spanish>Blindados</Spanish>
</Key>
<Key ID="STR_ACE_Ballistics_ammoUsageShort_aircraft">
<English>Air</English>
@ -3599,6 +3611,8 @@
<Korean>항공</Korean>
<French>Aviation</French>
<Portuguese>Aeronaves</Portuguese>
<Russian>Авиация</Russian>
<Spanish>Aeronaves</Spanish>
</Key>
</Package>
</Project>

Some files were not shown because too many files have changed in this diff Show More