mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge branch 'master' into pr/7002
This commit is contained in:
commit
314d19ed56
4
.github/ISSUE_TEMPLATE/bug_report.md
vendored
4
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@ -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 ..._
|
||||
|
@ -28,7 +28,7 @@ exclude = [
|
||||
"zeus/functions/fnc_zeusAttributes.sqf",
|
||||
]
|
||||
|
||||
[hemtt.launch]
|
||||
[hemtt.launch.default]
|
||||
workshop = [
|
||||
"450814997", # CBA_A3
|
||||
]
|
||||
|
@ -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 {};
|
||||
|
||||
|
@ -40,7 +40,7 @@ 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");
|
||||
|
@ -9,3 +9,4 @@ PREP(handleStaminaBar);
|
||||
PREP(mainLoop);
|
||||
PREP(moduleSettings);
|
||||
PREP(removeDutyFactor);
|
||||
PREP(renderDebugLines);
|
||||
|
@ -2,6 +2,10 @@
|
||||
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
#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;
|
||||
["loadout", {[ACE_player] call FUNC(getWeaponInertia)}, true] call CBA_fnc_addPlayerEventHandler;
|
||||
@ -33,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 (GVAR(medicalLoaded)) 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 {
|
||||
@ -62,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);
|
||||
};
|
||||
|
||||
|
@ -13,6 +13,5 @@ GVAR(dutyList) = createHashMap;
|
||||
GVAR(setAnimExclusions) = [];
|
||||
GVAR(inertia) = 0;
|
||||
GVAR(inertiaCache) = createHashMap;
|
||||
GVAR(medicalLoaded) = ["ace_medical"] call EFUNC(common,isModLoaded);
|
||||
|
||||
ADDON = true;
|
||||
|
@ -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>
|
||||
|
@ -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
|
||||
};
|
||||
|
@ -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);
|
||||
};
|
||||
};
|
||||
|
@ -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;
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "..\script_component.hpp"
|
||||
/*
|
||||
* Author: BaerMitUmlaut
|
||||
* Author: BaerMitUmlaut, ulteq
|
||||
* Main looping function that updates fatigue values.
|
||||
*
|
||||
* Arguments:
|
||||
@ -17,73 +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 _oxygen = 0.9; // Default AF oxygen saturation
|
||||
if (GVAR(medicalLoaded) && {EGVAR(medical_vitals,simulateSpo2)}) then {
|
||||
_oxygen = (ACE_player getVariable [QEGVAR(medical,spo2), 97]) / 100;
|
||||
};
|
||||
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;
|
||||
|
||||
// Respiratory rate decrease
|
||||
GVAR(respiratoryRate) = GVAR(respiratoryRate) * GVAR(respiratoryBufferDivisor);
|
||||
|
||||
// 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));
|
||||
|
||||
[ACE_player, _perceivedFatigue, _currentSpeed, GVAR(anReserve) == 0] call FUNC(handleEffects);
|
||||
#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;
|
||||
|
40
addons/advanced_fatigue/functions/fnc_renderDebugLines.sqf
Normal file
40
addons/advanced_fatigue/functions/fnc_renderDebugLines.sqf
Normal 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]];
|
||||
}];
|
@ -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,6 +87,6 @@
|
||||
"SLIDER",
|
||||
[LSTRING(TerrainGradientFactor), LSTRING(TerrainGradientFactor_Description)],
|
||||
LSTRING(DisplayName),
|
||||
[0, 5, 1, 1],
|
||||
true
|
||||
[0, 5, 1, 2],
|
||||
1
|
||||
] call CBA_fnc_addSetting;
|
||||
|
@ -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
|
||||
|
@ -10,21 +10,10 @@ if (!hasInterface) exitWith {};
|
||||
// Temporary Wind Info indication
|
||||
GVAR(tempWindInfo) = false;
|
||||
|
||||
// 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");
|
||||
|
||||
|
||||
// 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
|
||||
|
@ -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];
|
||||
|
@ -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
|
||||
|
@ -18,19 +18,10 @@
|
||||
params ["_unit"];
|
||||
TRACE_1("params",_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;
|
||||
};
|
||||
|
||||
// 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)
|
||||
@ -44,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];
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
};
|
||||
|
||||
|
@ -191,6 +191,9 @@
|
||||
<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>
|
||||
@ -198,6 +201,9 @@
|
||||
<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>
|
||||
|
@ -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);
|
||||
};
|
||||
|
@ -91,6 +91,7 @@
|
||||
<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>
|
||||
@ -102,6 +103,7 @@
|
||||
<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>
|
||||
|
@ -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]
|
||||
}
|
||||
|
@ -28,8 +28,8 @@ _item = configName _config;
|
||||
|
||||
// If the switch config entries are inherited, ignore
|
||||
if (
|
||||
(inheritsFrom (_config >> "MRT_SwitchItemNextClass") isNotEqualTo (_config >> "MRT_SwitchItemNextClass")) ||
|
||||
{inheritsFrom (_config >> "MRT_SwitchItemPrevClass") isNotEqualTo (_config >> "MRT_SwitchItemPrevClass")}
|
||||
(inheritsFrom (_config >> "MRT_SwitchItemNextClass") isNotEqualTo _config) ||
|
||||
{inheritsFrom (_config >> "MRT_SwitchItemPrevClass") isNotEqualTo _config}
|
||||
) exitWith {
|
||||
_item // return
|
||||
};
|
||||
|
@ -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);
|
||||
|
@ -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)}];
|
||||
|
@ -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
|
||||
|
@ -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 {
|
||||
|
@ -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
|
||||
};
|
||||
|
@ -22,6 +22,10 @@ private _extendedInfo = createHashMap;
|
||||
// Check if the provided loadout is a CBA extended loadout
|
||||
if (count _loadout == 2) then {
|
||||
_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;
|
||||
};
|
||||
|
||||
|
@ -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
|
||||
|
@ -1244,6 +1244,9 @@
|
||||
<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 & Primary integrated</English>
|
||||
@ -1251,6 +1254,9 @@
|
||||
<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>
|
||||
@ -1607,6 +1613,7 @@
|
||||
<French>Décroissant</French>
|
||||
<Portuguese>Decrescente</Portuguese>
|
||||
<Russian>Нисходящий</Russian>
|
||||
<Spanish>Descendiente</Spanish>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Arsenal_sortAscending">
|
||||
<English>Ascending</English>
|
||||
@ -1618,6 +1625,7 @@
|
||||
<French>Croissant</French>
|
||||
<Portuguese>Crescente</Portuguese>
|
||||
<Russian>Восходящий</Russian>
|
||||
<Spanish>Ascendiente</Spanish>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Arsenal_toolsTab">
|
||||
<English>Tools</English>
|
||||
@ -1645,6 +1653,7 @@
|
||||
<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>
|
||||
@ -1655,6 +1664,7 @@
|
||||
<Portuguese>Iluminadores</Portuguese>
|
||||
<Japanese>イルミネーター</Japanese>
|
||||
<Russian>Осветители</Russian>
|
||||
<Spanish>Iluminadores</Spanish>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Arsenal_defaultToFavoritesSetting">
|
||||
<English>Default to Favorites</English>
|
||||
@ -1666,6 +1676,7 @@
|
||||
<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>
|
||||
@ -1677,6 +1688,7 @@
|
||||
<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>
|
||||
@ -1688,6 +1700,7 @@
|
||||
<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>
|
||||
@ -1699,6 +1712,7 @@
|
||||
<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>
|
||||
@ -1710,6 +1724,7 @@
|
||||
<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>
|
||||
@ -1719,6 +1734,7 @@
|
||||
<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>
|
||||
|
@ -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"];
|
||||
|
@ -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), []];
|
||||
|
@ -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]
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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)];
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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 {
|
||||
|
@ -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;
|
||||
};
|
||||
|
@ -3540,6 +3540,7 @@
|
||||
<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>
|
||||
@ -3551,6 +3552,7 @@
|
||||
<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>
|
||||
@ -3562,6 +3564,7 @@
|
||||
<French>Fumigènes</French>
|
||||
<Portuguese>Fumígenas</Portuguese>
|
||||
<Russian>Дым</Russian>
|
||||
<Spanish>Humo</Spanish>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Ballistics_ammoUsageShort_infantry">
|
||||
<English>Inf</English>
|
||||
@ -3573,6 +3576,7 @@
|
||||
<French>Infanterie</French>
|
||||
<Portuguese>Infantaria</Portuguese>
|
||||
<Russian>Пехота</Russian>
|
||||
<Spanish>Infantería</Spanish>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Ballistics_ammoUsageShort_lightVehicle">
|
||||
<English>Veh</English>
|
||||
@ -3584,6 +3588,7 @@
|
||||
<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>
|
||||
@ -3595,6 +3600,7 @@
|
||||
<French>Blindage</French>
|
||||
<Portuguese>Blindagem</Portuguese>
|
||||
<Russian>Бронетехника</Russian>
|
||||
<Spanish>Blindados</Spanish>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Ballistics_ammoUsageShort_aircraft">
|
||||
<English>Air</English>
|
||||
@ -3606,6 +3612,7 @@
|
||||
<French>Aviation</French>
|
||||
<Portuguese>Aeronaves</Portuguese>
|
||||
<Russian>Авиация</Russian>
|
||||
<Spanish>Aeronaves</Spanish>
|
||||
</Key>
|
||||
</Package>
|
||||
</Project>
|
||||
|
@ -24,7 +24,7 @@ if (isServer) then {
|
||||
}];
|
||||
};
|
||||
|
||||
["unit", FUNC(handlePlayerChanged)] call CBA_fnc_addPlayerEventHandler;
|
||||
["unit", LINKFUNC(handlePlayerChanged)] call CBA_fnc_addPlayerEventHandler;
|
||||
[QGVAR(moveInCaptive), LINKFUNC(vehicleCaptiveMoveIn)] call CBA_fnc_addEventHandler;
|
||||
[QGVAR(moveOutCaptive), LINKFUNC(vehicleCaptiveMoveOut)] call CBA_fnc_addEventHandler;
|
||||
|
||||
|
@ -44,7 +44,7 @@ if (_state) then {
|
||||
};
|
||||
};
|
||||
|
||||
if (!(_unit getVariable [QGVAR(isEscorting), false])) then {
|
||||
if !(_unit getVariable [QGVAR(isEscorting), false]) then {
|
||||
[(_this select 1)] call CBA_fnc_removePerFrameHandler;
|
||||
[objNull, _target, false] call EFUNC(common,claim);
|
||||
detach _target;
|
||||
|
@ -58,7 +58,7 @@ if (_state) then {
|
||||
// fix anim on mission start (should work on dedicated servers)
|
||||
[{
|
||||
params ["_unit"];
|
||||
if (!(_unit getVariable [QGVAR(isHandcuffed), false])) exitWith {};
|
||||
if !(_unit getVariable [QGVAR(isHandcuffed), false]) exitWith {};
|
||||
|
||||
if ((vehicle _unit) == _unit) then {
|
||||
[_unit] call EFUNC(common,fixLoweredRifleAnimation);
|
||||
|
@ -81,7 +81,7 @@ if (_state) then {
|
||||
|
||||
if (_unit == ACE_player) then {
|
||||
//only re-enable HUD if not handcuffed
|
||||
if (!(_unit getVariable [QGVAR(isHandcuffed), false])) then {
|
||||
if !(_unit getVariable [QGVAR(isHandcuffed), false]) then {
|
||||
["captive", []] call EFUNC(common,showHud); //same as showHud true;
|
||||
};
|
||||
};
|
||||
|
@ -146,6 +146,7 @@
|
||||
<Korean>포로 눈 가리기</Korean>
|
||||
<Japanese>目隠しをする</Japanese>
|
||||
<Russian>Завязать глаза пленному</Russian>
|
||||
<Spanish>Vendar ojos al prisionero</Spanish>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Captives_RemoveBlindfoldCaptive">
|
||||
<English>Remove blindfold</English>
|
||||
@ -156,6 +157,7 @@
|
||||
<Korean>눈가리개 풀기</Korean>
|
||||
<Japanese>目隠しを外す</Japanese>
|
||||
<Russian>Снять повязку с глаз</Russian>
|
||||
<Spanish>Quitar vendas de los ojos</Spanish>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Captives_CableTie">
|
||||
<English>Cable Tie</English>
|
||||
|
@ -48,15 +48,7 @@ class CfgVehicles {
|
||||
class Car: LandVehicle {
|
||||
GVAR(space) = 4;
|
||||
GVAR(hasCargo) = 1;
|
||||
class ACE_Cargo {
|
||||
/*
|
||||
class Cargo {
|
||||
class ACE_medicalSupplyCrate {
|
||||
type = "ACE_medicalSupplyCrate";
|
||||
amount = 1;
|
||||
};
|
||||
};*/
|
||||
};
|
||||
class ADDON {};
|
||||
};
|
||||
|
||||
class Tank: LandVehicle {
|
||||
@ -75,7 +67,7 @@ class CfgVehicles {
|
||||
GVAR(hasCargo) = 1;
|
||||
};
|
||||
|
||||
// HEMTTs - Default at 10, some variants are altered based on model size and/or expected level of free space inside.
|
||||
// HEMTTs - Default at 30, some variants are altered based on model size and/or expected level of free space inside.
|
||||
class Truck_01_base_F: Truck_F {
|
||||
GVAR(space) = 30;
|
||||
};
|
||||
@ -510,7 +502,7 @@ class CfgVehicles {
|
||||
};
|
||||
|
||||
GVAR(space) = 2;
|
||||
GVAR(hasCargo) = 2;
|
||||
GVAR(hasCargo) = 1;
|
||||
GVAR(size) = 3;
|
||||
GVAR(canLoad) = 1;
|
||||
|
||||
@ -523,8 +515,9 @@ class CfgVehicles {
|
||||
class EventHandlers {
|
||||
class CBA_Extended_EventHandlers: CBA_Extended_EventHandlers {};
|
||||
};
|
||||
|
||||
GVAR(space) = 3;
|
||||
GVAR(hasCargo) = 3;
|
||||
GVAR(hasCargo) = 1;
|
||||
GVAR(size) = 3;
|
||||
GVAR(canLoad) = 1;
|
||||
|
||||
|
@ -86,7 +86,7 @@ GVAR(vehicleAction) = [
|
||||
GVAR(enable) &&
|
||||
{alive _target} &&
|
||||
{locked _target < 2} &&
|
||||
{(_target getVariable [QGVAR(hasCargo), getNumber (configOf _target >> QGVAR(hasCargo)) == 1])} &&
|
||||
{_target getVariable [QGVAR(hasCargo), getNumber (configOf _target >> QGVAR(hasCargo)) == 1]} &&
|
||||
{[_player, _target, ["isNotSwimming"]] call EFUNC(common,canInteractWith)} &&
|
||||
{[_player, _target] call EFUNC(interaction,canInteractWithVehicleCrew)} &&
|
||||
{([_player, _target] call EFUNC(interaction,getInteractionDistance)) < MAX_LOAD_DISTANCE}
|
||||
|
@ -7,9 +7,10 @@
|
||||
* 0: Item to be loaded <STRING> or <OBJECT>
|
||||
* 1: Holder object (vehicle) <OBJECT>
|
||||
* 2: Amount <NUMBER> (default: 1)
|
||||
* 3: Ignore interaction distance and stability checks <BOOL> (default: false)
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
* Objects loaded <NUMBER>
|
||||
*
|
||||
* Example:
|
||||
* ["ACE_Wheel", cursorObject] call ace_cargo_fnc_addCargoItem
|
||||
@ -17,21 +18,31 @@
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
params ["_item", "_vehicle", ["_amount", 1]];
|
||||
TRACE_3("params",_item,_vehicle,_amount);
|
||||
params ["_item", "_vehicle", ["_amount", 1], ["_ignoreInteraction", false]];
|
||||
TRACE_4("params",_item,_vehicle,_amount,_ignoreInteraction);
|
||||
|
||||
private _loaded = 0;
|
||||
|
||||
// Get config sensitive case name
|
||||
if (_item isEqualType "") then {
|
||||
_item = _item call EFUNC(common,getConfigName);
|
||||
|
||||
for "_i" from 1 to _amount do {
|
||||
[_item, _vehicle] call FUNC(loadItem);
|
||||
if !([_item, _vehicle, _ignoreInteraction] call FUNC(loadItem)) exitWith {};
|
||||
|
||||
_loaded = _loaded + 1;
|
||||
};
|
||||
} else {
|
||||
[_item, _vehicle] call FUNC(loadItem);
|
||||
_loaded = parseNumber ([_item, _vehicle, _ignoreInteraction] call FUNC(loadItem));
|
||||
|
||||
_item = typeOf _item;
|
||||
};
|
||||
|
||||
TRACE_1("loaded",_loaded);
|
||||
|
||||
// Invoke listenable event
|
||||
["ace_cargoAdded", [_item, _vehicle, _amount]] call CBA_fnc_globalEvent;
|
||||
if (_loaded > 0) then {
|
||||
["ace_cargoAdded", [_item, _vehicle, _loaded]] call CBA_fnc_globalEvent;
|
||||
};
|
||||
|
||||
_loaded // return
|
||||
|
@ -23,7 +23,7 @@ private _config = configOf _vehicle;
|
||||
|
||||
// If vehicle had space given to it via eden/public, then override config hasCargo setting
|
||||
private _hasCargoPublic = _vehicle getVariable QGVAR(hasCargo);
|
||||
private _hasCargoPublicDefined = !isNil "_canLoadPublic";
|
||||
private _hasCargoPublicDefined = !isNil "_hasCargoPublic";
|
||||
|
||||
if (_hasCargoPublicDefined && {!(_hasCargoPublic isEqualType false)}) then {
|
||||
WARNING_4("%1[%2] - Variable %3 is %4 - Should be bool",_vehicle,_type,QGVAR(hasCargo),_hasCargoPublic);
|
||||
@ -52,14 +52,21 @@ if (isServer) then {
|
||||
|
||||
private _cargoClassname = "";
|
||||
private _cargoCount = 0;
|
||||
private _loaded = 0;
|
||||
|
||||
{
|
||||
_cargoClassname = getText (_x >> "type");
|
||||
_cargoCount = getNumber (_x >> "amount");
|
||||
|
||||
TRACE_3("adding ACE_Cargo",configName _x,_cargoClassname,_cargoCount);
|
||||
TRACE_3("adding ace_cargo",configName _x,_cargoClassname,_cargoCount);
|
||||
|
||||
["ace_addCargo", [_cargoClassname, _vehicle, _cargoCount]] call CBA_fnc_localEvent;
|
||||
// Ignore stability check (distance check is also ignored with this, but it's ignored by default if item is a string)
|
||||
_loaded = [_cargoClassname, _vehicle, _cargoCount, true] call FUNC(addCargoItem);
|
||||
|
||||
// Let loop continue until the end, so that it prints everything into the rpt (there might be smaller items that could still fit in cargo)
|
||||
if (_loaded != _cargoCount) then {
|
||||
WARNING_5("%1 (%2) could not fit %3 %4 inside its cargo, only %5 were loaded.",_vehicle,_type,_cargoCount,_cargoClassname,_loaded);
|
||||
};
|
||||
} forEach ("true" configClasses (_config >> QUOTE(ADDON) >> "cargo"));
|
||||
};
|
||||
|
||||
|
@ -6,8 +6,7 @@ private _category = [ELSTRING(main,Category_Logistics), LSTRING(openMenu)];
|
||||
[LSTRING(ModuleSettings_enable), LSTRING(ModuleSettings_enable_Description)],
|
||||
_category,
|
||||
true,
|
||||
1,
|
||||
{[QGVAR(enable), _this] call EFUNC(common,cbaSettings_settingChanged)}
|
||||
1
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
@ -16,8 +15,7 @@ private _category = [ELSTRING(main,Category_Logistics), LSTRING(openMenu)];
|
||||
[LSTRING(loadTimeCoefficient), LSTRING(loadTimeCoefficient_description)],
|
||||
_category,
|
||||
[0, 10, 5, 1],
|
||||
1,
|
||||
{[QGVAR(loadTimeCoefficient), _this, true] call EFUNC(common,cbaSettings_settingChanged)}
|
||||
1
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
@ -26,8 +24,7 @@ private _category = [ELSTRING(main,Category_Logistics), LSTRING(openMenu)];
|
||||
[LSTRING(paradropTimeCoefficent), LSTRING(paradropTimeCoefficent_description)],
|
||||
_category,
|
||||
[0, 10, 2.5, 1],
|
||||
1,
|
||||
{[QGVAR(paradropTimeCoefficent), _this, true] call EFUNC(common,cbaSettings_settingChanged)}
|
||||
1
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
@ -35,9 +32,7 @@ private _category = [ELSTRING(main,Category_Logistics), LSTRING(openMenu)];
|
||||
"LIST",
|
||||
[LSTRING(openAfterUnload), LSTRING(openAfterUnload_description)],
|
||||
_category,
|
||||
[[0, 1, 2, 3], [ELSTRING(common,never), LSTRING(unloadObject), LSTRING(paradropButton), ELSTRING(common,both)], 0],
|
||||
0,
|
||||
{[QGVAR(openAfterUnload), _this, true] call EFUNC(common,cbaSettings_settingChanged)}
|
||||
[[0, 1, 2, 3], [ELSTRING(common,never), LSTRING(unloadObject), LSTRING(paradropButton), ELSTRING(common,both)], 0]
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
@ -45,9 +40,7 @@ private _category = [ELSTRING(main,Category_Logistics), LSTRING(openMenu)];
|
||||
"CHECKBOX",
|
||||
[LSTRING(carryAfterUnload), LSTRING(carryAfterUnload_description)],
|
||||
_category,
|
||||
true,
|
||||
0,
|
||||
{[QGVAR(carryAfterUnload), _this] call EFUNC(common,cbaSettings_settingChanged)}
|
||||
true
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
@ -56,8 +49,7 @@ private _category = [ELSTRING(main,Category_Logistics), LSTRING(openMenu)];
|
||||
[LSTRING(enableDeploy), LSTRING(enableDeploy_description)],
|
||||
_category,
|
||||
true,
|
||||
1,
|
||||
{[QGVAR(enableDeploy), _this] call EFUNC(common,cbaSettings_settingChanged)}
|
||||
1
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
@ -65,7 +57,5 @@ private _category = [ELSTRING(main,Category_Logistics), LSTRING(openMenu)];
|
||||
"CHECKBOX",
|
||||
[LSTRING(ModuleSettings_enableRename), LSTRING(ModuleSettings_enableRename_Description)],
|
||||
_category,
|
||||
true,
|
||||
0,
|
||||
{[QGVAR(enableRename), _this, true] call EFUNC(common,cbaSettings_settingChanged)}
|
||||
true
|
||||
] call CBA_fnc_addSetting;
|
||||
|
@ -40,6 +40,8 @@
|
||||
<Japanese>配置する</Japanese>
|
||||
<Korean>배치하기</Korean>
|
||||
<French>Déployer</French>
|
||||
<German>Aufstellen</German>
|
||||
<Spanish>Desplegar</Spanish>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Cargo_ScrollAction">
|
||||
<English>Raise/Lower | (Ctrl + Scroll) Rotate</English>
|
||||
@ -287,6 +289,7 @@
|
||||
<Russian>Загружаем %1 в %2...</Russian>
|
||||
<Korean>%1을(를) %2에 싣는 중...</Korean>
|
||||
<French>Chargement %1 dans %2...</French>
|
||||
<German>%1 wird in %2 geladen...</German>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Cargo_UnloadingItem">
|
||||
<English>Unloading %1 from %2...</English>
|
||||
@ -296,6 +299,7 @@
|
||||
<Russian>Выгружаем %1 из %2...</Russian>
|
||||
<Korean>%1을(를) %2(으)로부터 내리는 중...</Korean>
|
||||
<French>Déchargement %1 de %2...</French>
|
||||
<German>%1 wird von %2 entladen...</German>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Cargo_LoadingFailed">
|
||||
<English>%1<br/>could not be loaded</English>
|
||||
@ -337,6 +341,7 @@
|
||||
<Japanese>荷降ろし不可能です</Japanese>
|
||||
<Korean>하역할 수가 없습니다</Korean>
|
||||
<Russian>Не может быть выгружен</Russian>
|
||||
<Spanish>No puede ser descargado</Spanish>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Cargo_SizeMenu">
|
||||
<English>Cargo Size: %1</English>
|
||||
@ -346,6 +351,7 @@
|
||||
<Japanese>貨物のサイズ: %1</Japanese>
|
||||
<Korean>화물 크기: %1</Korean>
|
||||
<Russian>Размер груза: %1</Russian>
|
||||
<Spanish>Tamaño de carga: %1</Spanish>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Cargo_customName_edenName">
|
||||
<English>Custom Name</English>
|
||||
@ -500,7 +506,7 @@
|
||||
<German>Ladezeitmultiplikator</German>
|
||||
<Japanese>積載の所要時間係数</Japanese>
|
||||
<Polish>Współczynnik czasu załadowania</Polish>
|
||||
<Italian>Coefficente Tempo Caricamento</Italian>
|
||||
<Italian>Coefficiente Tempo Caricamento</Italian>
|
||||
<Russian>Коэф. времени погрузки</Russian>
|
||||
<Portuguese>Fator de tempo para carregar</Portuguese>
|
||||
<French>Coefficient du temps de chargement</French>
|
||||
@ -513,7 +519,7 @@
|
||||
<Key ID="STR_ACE_Cargo_loadTimeCoefficient_description">
|
||||
<English>Modifies how long it takes to load/unload items.\nTime, in seconds, is the size of the item multiplied by this value.</English>
|
||||
<German>Gibt an, wie lange das Laden / Entladen von Gegenständen dauern soll.\nZeit in Sekunden, die mit der Größe des Gegenstandes multipliziert wird.</German>
|
||||
<Japanese>貨物の積み込み/積み下ろしに掛かる時間を変更します。\n時間 (秒) は、貨物のサイズにこの値を掛けたものです。</Japanese>
|
||||
<Japanese>貨物の積み込み/積み下ろしに掛かる時間を変更します。\n時間 (秒単位) は、貨物のサイズにこの値を掛けたものです。</Japanese>
|
||||
<Polish>Modyfikuje, jak długo zajmuje załadowywanie/wyładowywanie przedmiotów. \nCzasem, w sekundach, jest wielkość przedmiotu razy jego wartość.</Polish>
|
||||
<Italian>Modifica il tempo impiegato per caricare o scaricare gli oggetti.\nIl tempo, in secondi, equivale alla dimensione dell'oggetto moltiplicata per questo valore</Italian>
|
||||
<Russian>Изменяет время для загрузки/выгрузки предметов. \nВремя (сек) - это размер предмета, умноженный на это значение.</Russian>
|
||||
@ -584,6 +590,8 @@
|
||||
<Japanese>配置機能を有効化</Japanese>
|
||||
<Korean>배치 활성화</Korean>
|
||||
<French>Permettre le placement</French>
|
||||
<German>Aktiviere Aufbauen</German>
|
||||
<Spanish>Habilitar despliegue</Spanish>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Cargo_enableDeploy_description">
|
||||
<English>Controls whether cargo items can be unloaded via the deploy method.</English>
|
||||
@ -592,6 +600,8 @@
|
||||
<Japanese>配置機能を介して貨物アイテムを降ろすことが出来るかどうかを制御します。</Japanese>
|
||||
<Korean>배치 방법을 통해 화물 아이템을 내릴 수 있는지 여부를 제어합니다.</Korean>
|
||||
<French>Contrôler si les éléments de cargaison peuvent être déchargés via la méthode de déploiement.</French>
|
||||
<German>Steuert, ob Frachtgegenstände über die Aufbaumethode entladen werden können.</German>
|
||||
<Spanish>Controla si los objetos de la carga pueden ser descargados mediante el método de despliegue.</Spanish>
|
||||
</Key>
|
||||
</Package>
|
||||
</Project>
|
||||
|
6
addons/casings/CfgVehicles.hpp
Normal file
6
addons/casings/CfgVehicles.hpp
Normal file
@ -0,0 +1,6 @@
|
||||
class CfgVehicles {
|
||||
class FxCartridge;
|
||||
class FxCartridge_65_caseless: FxCartridge {
|
||||
GVAR(model) = ""; // note: the vanilla 6.5 caseless don't actually use this, just being safe
|
||||
};
|
||||
};
|
@ -15,3 +15,4 @@ class CfgPatches {
|
||||
};
|
||||
|
||||
#include "CfgEventHandlers.hpp"
|
||||
#include "CfgVehicles.hpp"
|
||||
|
@ -20,33 +20,30 @@ params ["_unit", "", "", "", "_ammo"];
|
||||
|
||||
if (!isNull objectParent _unit) exitWith {};
|
||||
|
||||
private _modelPath = GVAR(cachedCasings) get _ammo;
|
||||
|
||||
if (isNil "_modelPath") then {
|
||||
private _modelPath = GVAR(cachedCasings) getOrDefaultCall [_ammo, {
|
||||
private _cartridge = getText (configFile >> "CfgAmmo" >> _ammo >> "cartridge");
|
||||
//Default cartridge is a 5.56mm model
|
||||
_modelPath = switch (_cartridge) do {
|
||||
case "FxCartridge_9mm": { "A3\Weapons_f\ammo\cartridge_small.p3d" };
|
||||
case "FxCartridge_65": { "A3\weapons_f\ammo\cartridge_65.p3d" };
|
||||
case "FxCartridge_762": { "A3\weapons_f\ammo\cartridge_762.p3d" };
|
||||
case "FxCartridge_762x39": { "A3\weapons_f_enoch\ammo\cartridge_762x39.p3d" };
|
||||
case "FxCartridge_93x64_Ball": { "A3\Weapons_F_Mark\Ammo\cartridge_93x64.p3d" };
|
||||
case "FxCartridge_338_Ball": { "A3\Weapons_F_Mark\Ammo\cartridge_338_LM.p3d" };
|
||||
case "FxCartridge_338_NM": { "A3\Weapons_F_Mark\Ammo\cartridge_338_NM.p3d" };
|
||||
case "FxCartridge_127": { "A3\weapons_f\ammo\cartridge_127.p3d" };
|
||||
case "FxCartridge_127x54": { "A3\Weapons_F_Mark\Ammo\cartridge_127x54.p3d" };
|
||||
case "FxCartridge_slug": { "A3\weapons_f\ammo\cartridge_slug.p3d" };
|
||||
case "FxCartridge_12Gauge_HE_lxWS": { "lxWS\weapons_1_f_lxws\Ammo\cartridge_he_lxws.p3d" };
|
||||
case "FxCartridge_12Gauge_Slug_lxWS": { "lxWS\weapons_1_f_lxws\Ammo\cartridge_slug_lxws.p3d" };
|
||||
case "FxCartridge_12Gauge_Smoke_lxWS": { "lxWS\weapons_1_f_lxws\Ammo\cartridge_smoke_lxws.p3d" };
|
||||
case "FxCartridge_12Gauge_Pellet_lxWS": { "lxWS\weapons_1_f_lxws\Ammo\cartridge_pellet_lxws.p3d" };
|
||||
case "CUP_FxCartridge_545": { "CUP\Weapons\CUP_Weapons_Ammunition\magazines\cartridge545.p3d" };
|
||||
case "CUP_FxCartridge_939": { "CUP\Weapons\CUP_Weapons_Ammunition\magazines\cartridge939.p3d" };
|
||||
case "": { "" };
|
||||
default { "A3\Weapons_f\ammo\cartridge.p3d" };
|
||||
if (_cartridge == "") then { // return (note: can't use exitWith)
|
||||
""
|
||||
} else {
|
||||
private _cartridgeConfig = configFile >> "CfgVehicles" >> _cartridge;
|
||||
|
||||
// if explicitly defined, use ACE's config
|
||||
if (isText (_cartridgeConfig >> QGVAR(model))) exitWith {
|
||||
getText (_cartridgeConfig >> QGVAR(model))
|
||||
};
|
||||
// use casing's default model
|
||||
private _model = getText (_cartridgeConfig >> "model");
|
||||
if ("a3\weapons_f\empty" in toLowerANSI _model) exitWith { "" };
|
||||
|
||||
// Add file extension if missing (fileExists needs file extension)
|
||||
if ((_model select [count _model - 4]) != ".p3d") then {
|
||||
_model = _model + ".p3d";
|
||||
};
|
||||
|
||||
["", _model] select (fileExists _model)
|
||||
};
|
||||
GVAR(cachedCasings) set [_ammo, _modelPath];
|
||||
};
|
||||
}, true];
|
||||
|
||||
if (_modelPath isEqualTo "") exitWith {};
|
||||
|
||||
|
@ -355,7 +355,7 @@
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Chemlights_HiGreen_DisplayName">
|
||||
<English>Chemlight (Hi Green)</English>
|
||||
<French>Cyalume HL (vert)</French>
|
||||
<French>Cyalume HL (Vert)</French>
|
||||
<German>Knicklicht (Grün, Hell)</German>
|
||||
<Japanese>ケミカルライト(高輝度 緑)</Japanese>
|
||||
<Polish>Świetlik (jaskrawy zielony)</Polish>
|
||||
@ -533,9 +533,9 @@
|
||||
<English>Chemlight Shield (Green)</English>
|
||||
<Japanese>ケミカルライト シールド(緑)</Japanese>
|
||||
<Polish>Osłona na świetlik (zielona)</Polish>
|
||||
<German>Knicklicht-Abschirmung (grün)</German>
|
||||
<German>Knicklicht-Abschirmung (Grün)</German>
|
||||
<Korean>화학조명 가림막 (초록)</Korean>
|
||||
<French>Etui avec cyalume (vert)</French>
|
||||
<French>Etui avec cyalume (Vert)</French>
|
||||
<Italian>Scudo Luce Chimica (Verde)</Italian>
|
||||
<Chinese>螢光棒保護殼 (綠色)</Chinese>
|
||||
<Chinesesimp>荧光棒保护壳(绿色)</Chinesesimp>
|
||||
|
@ -1,8 +1,5 @@
|
||||
class CfgMovesBasic {
|
||||
// Idle affects legs when weapon switching - fixes units sliding when holstering weapons
|
||||
class Default {
|
||||
idle = "";
|
||||
};
|
||||
class Default;
|
||||
|
||||
// From ACRE
|
||||
class ManActions {
|
||||
@ -86,5 +83,14 @@ class CfgMovesMaleSdr: CfgMovesBasic {
|
||||
class AinvPknlMstpSnonWnonDnon_medic0: HealBase {
|
||||
variantsPlayer[] = {};
|
||||
};
|
||||
|
||||
// Idle affects legs when weapon switching - fixes units sliding when holstering weapons
|
||||
class AmovPercMstpSnonWnonDnon: StandBase {
|
||||
idle = "";
|
||||
};
|
||||
// Need to reset idle, as it breaks animations otherwise
|
||||
class CutSceneAnimationBase: AmovPercMstpSnonWnonDnon {
|
||||
idle = "idleDefault";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -30,6 +30,7 @@ PREP(changeProjectileDirection);
|
||||
PREP(checkFiles);
|
||||
PREP(checkFiles_diagnoseACE);
|
||||
PREP(checkPBOs);
|
||||
PREP(checkVersionNumber);
|
||||
PREP(claim);
|
||||
PREP(claimSafeServer);
|
||||
PREP(codeToString);
|
||||
@ -103,6 +104,7 @@ PREP(getWeaponAzimuthAndInclination);
|
||||
PREP(getWeaponIndex);
|
||||
PREP(getWeaponState);
|
||||
PREP(getWeight);
|
||||
PREP(getWheelHitPointsWithSelections);
|
||||
PREP(getWindDirection);
|
||||
PREP(getZoom);
|
||||
PREP(goKneeling);
|
||||
@ -161,6 +163,7 @@ PREP(sendRequest);
|
||||
PREP(serverLog);
|
||||
PREP(setAimCoef);
|
||||
PREP(setApproximateVariablePublic);
|
||||
PREP(setDead);
|
||||
PREP(setDefinedVariable);
|
||||
PREP(setDisableUserInputStatus);
|
||||
PREP(setHearingCapability);
|
||||
@ -264,6 +267,7 @@ PREP(_handleRequestAllSyncedEvents);
|
||||
PREP(addActionEventHandler);
|
||||
PREP(addActionMenuEventHandler);
|
||||
PREP(addMapMarkerCreatedEventHandler);
|
||||
PREP(addPlayerEH);
|
||||
|
||||
PREP(removeActionEventHandler);
|
||||
PREP(removeActionMenuEventHandler);
|
||||
|
@ -145,8 +145,7 @@ if (isServer) then {
|
||||
INFO_3("[%1] DC - Was Zeus [%2] while controlling unit [%3] - manually clearing `bis_fnc_moduleRemoteControl_owner`",[_x] call FUNC(getName),_dcPlayer,_x);
|
||||
_x setVariable ["bis_fnc_moduleRemoteControl_owner", nil, true];
|
||||
};
|
||||
nil
|
||||
} count (curatorEditableObjects _zeusLogic);
|
||||
} forEach (curatorEditableObjects _zeusLogic);
|
||||
};
|
||||
}];
|
||||
};
|
||||
@ -192,6 +191,7 @@ if (isServer) then {
|
||||
[QGVAR(switchMove), {(_this select 0) switchMove (_this select 1)}] call CBA_fnc_addEventHandler;
|
||||
[QGVAR(setVectorDirAndUp), {(_this select 0) setVectorDirAndUp (_this select 1)}] call CBA_fnc_addEventHandler;
|
||||
[QGVAR(addWeaponItem), {(_this select 0) addWeaponItem [(_this select 1), (_this select 2)]}] call CBA_fnc_addEventHandler;
|
||||
[QGVAR(removeMagazinesTurret), {(_this select 0) removeMagazinesTurret [_this select 1, _this select 2]}] call CBA_fnc_addEventHandler;
|
||||
|
||||
[QGVAR(setVanillaHitPointDamage), {
|
||||
params ["_object", "_hitPointAnddamage"];
|
||||
@ -223,6 +223,9 @@ if (isServer) then {
|
||||
[QGVAR(claimSafe), LINKFUNC(claimSafeServer)] call CBA_fnc_addEventHandler;
|
||||
};
|
||||
|
||||
["CBA_SettingChanged", {
|
||||
["ace_settingChanged", _this] call CBA_fnc_localEvent;
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// Set up remote execution
|
||||
|
@ -10,6 +10,7 @@ PREP_RECOMPILE_END;
|
||||
GVAR(syncedEvents) = createHashMap;
|
||||
GVAR(showHudHash) = createHashMap;
|
||||
GVAR(vehicleIconCache) = createHashMap; // for getVehicleIcon
|
||||
GVAR(wheelSelections) = createHashMap;
|
||||
|
||||
GVAR(blockItemReplacement) = false;
|
||||
|
||||
|
@ -50,7 +50,7 @@ private _allWeapons = [];
|
||||
private _vics = "(configName _x) select [0,3] == 'ace'" configClasses (configFile >> "CfgVehicles");
|
||||
{
|
||||
if (((getNumber (_x >> "scope")) == 2) || {((getNumber (_x >> "scopeCurator")) == 2)}) then {
|
||||
if (!((toLowerANSI configName _x) in _allUnits)) then {
|
||||
if !((toLowerANSI configName _x) in _allUnits) then {
|
||||
WARNING_2("Not in any units[] - %1 from %2",configName _x,configSourceMod _x);
|
||||
_testPass = false;
|
||||
};
|
||||
@ -62,7 +62,7 @@ private _weapons = "(configName _x) select [0,3] == 'ace'" configClasses (config
|
||||
{
|
||||
private _type = toLowerANSI configName _x;
|
||||
if (((getNumber (_x >> "scope")) == 2) || {((getNumber (_x >> "scopeCurator")) == 2)}) then {
|
||||
if (!((toLowerANSI configName _x) in _allWeapons)) then {
|
||||
if !((toLowerANSI configName _x) in _allWeapons) then {
|
||||
WARNING_2("Not in any weapons[] - %1 from %2",configName _x,configSourceMod _x);
|
||||
_testPass = false;
|
||||
};
|
||||
|
@ -43,8 +43,7 @@ if (isServer) then {
|
||||
{
|
||||
_x params ["", "_eventArgs","_ttl"];
|
||||
[_eventName, _eventArgs, _ttl] call FUNC(_handleSyncedEvent);
|
||||
false
|
||||
} count _eventLog;
|
||||
} forEach _eventLog;
|
||||
|
||||
INFO_1("[%1] synchronized",_eventName);
|
||||
};
|
||||
|
@ -43,10 +43,10 @@ if (isNil "_keyTable") then {
|
||||
};
|
||||
};
|
||||
|
||||
private _keyCache = uiNamespace getVariable [QGVAR(keyNameCache), locationNull];
|
||||
private _keyCache = uiNamespace getVariable QGVAR(keyNameCache); // @TODO: Move cache creation to preStart/somewhere else
|
||||
|
||||
if (isNull _keyCache) then {
|
||||
_keyCache = call CBA_fnc_createNamespace;
|
||||
if (isNil "_keyCache") then {
|
||||
_keyCache = createHashMap;
|
||||
uiNamespace setVariable [QGVAR(keyNameCache), _keyCache];
|
||||
};
|
||||
|
||||
@ -54,7 +54,7 @@ params [["_action", "", [""]]];
|
||||
|
||||
private _keybinds = actionKeysNamesArray _action apply {
|
||||
private _keyName = _x;
|
||||
private _keybind = _keyCache getVariable _keyName;
|
||||
private _keybind = _keyCache get _keyName;
|
||||
|
||||
if (isNil "_keybind") then {
|
||||
private _key = -1;
|
||||
@ -101,7 +101,7 @@ private _keybinds = actionKeysNamesArray _action apply {
|
||||
|
||||
// cache
|
||||
_keybind = [_key, _shift, _ctrl, _alt];
|
||||
_keyCache setVariable [_keyName, _keybind];
|
||||
_keyCache set [_keyName, _keybind];
|
||||
};
|
||||
|
||||
_keybind
|
||||
|
63
addons/common/functions/fnc_addPlayerEH.sqf
Normal file
63
addons/common/functions/fnc_addPlayerEH.sqf
Normal file
@ -0,0 +1,63 @@
|
||||
#include "..\script_component.hpp"
|
||||
/*
|
||||
* Author: PabstMirror
|
||||
* Adds event handler just to ACE_player
|
||||
* Can be removed after cba 3.18 is released for CBA_fnc_addBISPlayerEventHandler
|
||||
* This never was public in a release
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Key <STRING>
|
||||
* 1: Event Type <STRING>
|
||||
* 2: Event Code <CODE>
|
||||
* 3: Ignore Virtual Units (spectators, virtual zeus, uav RC) <BOOL> (default: true)
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* ["example", "FiredNear", {systemChat str _this}] call ace_common_fnc_addPlayerEH
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
params [["_key", "", [""]], ["_type", "", [""]], ["_code", {}, [{}]], ["_ignoreVirtual", true, [true]]];
|
||||
TRACE_3("addPlayerEH",_key,_type,_ignoreVirtual);
|
||||
|
||||
if (isNil QGVAR(playerEventsHash)) then { // first-run init
|
||||
GVAR(playerEventsHash) = createHashMap;
|
||||
["unit", {
|
||||
params ["_newPlayer", "_oldPlayer"];
|
||||
// uav check only applies to direct controlling UAVs from zeus, no effect on normal UAV operation
|
||||
private _isVirutal = (unitIsUAV _newPlayer) || {getNumber (configOf _newPlayer >> "isPlayableLogic") == 1};
|
||||
|
||||
TRACE_4("",_newPlayer,_oldPlayer,_isVirutal,count GVAR(playerEventsHash));
|
||||
{
|
||||
_y params ["_type", "_code", "_ignoreVirtual"];
|
||||
|
||||
private _oldEH = _oldPlayer getVariable [_x, -1];
|
||||
if (_oldEH != -1) then {
|
||||
_oldPlayer removeEventHandler [_type, _oldEH];
|
||||
_oldPlayer setVariable [_x, nil];
|
||||
};
|
||||
|
||||
_oldEH = _newPlayer getVariable [_x, -1];
|
||||
if (_oldEH != -1) then { continue }; // if respawned then var and EH already exists
|
||||
if (_ignoreVirtual && _isVirutal) then { continue };
|
||||
|
||||
private _newEH = _newPlayer addEventHandler [_type, _code];
|
||||
_newPlayer setVariable [_x, _newEH];
|
||||
} forEach GVAR(playerEventsHash);
|
||||
}, false] call CBA_fnc_addPlayerEventHandler;
|
||||
};
|
||||
|
||||
|
||||
_key = format [QGVAR(playerEvents_%1), toLower _key];
|
||||
if (_key in GVAR(playerEventsHash)) exitWith { ERROR_1("bad key %1",_this); };
|
||||
|
||||
GVAR(playerEventsHash) set [_key, [_type, _code, _ignoreVirtual]];
|
||||
|
||||
if (isNull ACE_player) exitWith {};
|
||||
if (_ignoreVirtual && {(unitIsUAV ACE_player) || {getNumber (configOf ACE_player >> "isPlayableLogic") == 1}}) exitWith {};
|
||||
|
||||
// Add event now
|
||||
private _newEH = ACE_player addEventHandler [_type, _code];
|
||||
ACE_player setVariable [_key, _newEH];
|
@ -59,6 +59,21 @@ switch (_container) do {
|
||||
};
|
||||
};
|
||||
|
||||
if (_type select 0 == "magazine") then {
|
||||
private _configAmmoCount = getNumber (configFile >> "CfgMagazines" >> _classname >> "count");
|
||||
|
||||
// https://feedback.bistudio.com/T74244
|
||||
// When adding throwables with the addXXXCargo(Global) commands, they don't show up in the throwables list
|
||||
// If a throwable has more than 1 ammo count, adding it with addItem(XXX) commands also renders the throwable unusable
|
||||
if (_configAmmoCount == 1 && {_ammoCount in [-1, 1]} && {_classname call BIS_fnc_isThrowable}) then { // TODO: replace with https://community.bistudio.com/wiki/isThrowable in 2.18
|
||||
_type set [0, "item"];
|
||||
};
|
||||
|
||||
if (_ammoCount == -1) then {
|
||||
_ammoCount = _configAmmoCount;
|
||||
};
|
||||
};
|
||||
|
||||
switch (_type select 0) do {
|
||||
case "weapon": {
|
||||
if (_canAdd || {_canFitWeaponSlot}) then {
|
||||
@ -106,10 +121,6 @@ switch (_type select 0) do {
|
||||
};
|
||||
|
||||
case "magazine": {
|
||||
if (_ammoCount == -1) then {
|
||||
_ammoCount = getNumber (configFile >> "CfgMagazines" >> _classname >> "count");
|
||||
};
|
||||
|
||||
if (_canAdd) then {
|
||||
_addedToUnit = true;
|
||||
|
||||
|
@ -2,22 +2,33 @@
|
||||
/*
|
||||
* Author: commy2, johnb43
|
||||
* Adds weapon to unit without taking a magazine.
|
||||
* Same as CBA_fnc_addWeaponWithoutItems, but doesn't remove linked items.
|
||||
* Same as CBA_fnc_addWeaponWithoutItems, but doesn't remove linked items by default.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit to add the weapon to <OBEJCT>
|
||||
* 0: Unit to add the weapon to <OBJECT>
|
||||
* 1: Weapon to add <STRING>
|
||||
* 2: If linked items should be removed or not <BOOL> (default: false)
|
||||
* 3: Magazines that should be added to the weapon <ARRAY> (default: [])
|
||||
* - 0: Magazine classname <STRING>
|
||||
* - 1: Ammo count <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [player, "arifle_AK12_F"] call ace_common_fnc_addWeapon
|
||||
* [player, "arifle_MX_GL_F", true, [["30Rnd_65x39_caseless_mag", 30], ["1Rnd_HE_Grenade_shell", 1]]] call ace_common_fnc_addWeapon
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
||||
params ["_unit", "_weapon"];
|
||||
params [
|
||||
["_unit", objNull, [objNull]],
|
||||
["_weapon", "", [""]],
|
||||
["_removeLinkedItems", false, [false]],
|
||||
["_magazines", [], [[]]]
|
||||
];
|
||||
|
||||
if (isNull _unit || {_weapon == ""}) exitWith {};
|
||||
|
||||
// Config case
|
||||
private _compatibleMagazines = compatibleMagazines _weapon;
|
||||
@ -45,6 +56,35 @@ private _backpackMagazines = (magazinesAmmoCargo _backpack) select {
|
||||
// Add weapon
|
||||
_unit addWeapon _weapon;
|
||||
|
||||
// This doesn't remove magazines, but linked items can't be magazines, so it's fine
|
||||
if (_removeLinkedItems) then {
|
||||
switch (_weapon call FUNC(getConfigName)) do {
|
||||
case (primaryWeapon _unit): {
|
||||
removeAllPrimaryWeaponItems _unit;
|
||||
};
|
||||
case (secondaryWeapon _unit): {
|
||||
removeAllSecondaryWeaponItems _unit;
|
||||
};
|
||||
case (handgunWeapon _unit): {
|
||||
removeAllHandgunItems _unit;
|
||||
};
|
||||
case (binocular _unit): {
|
||||
removeAllBinocularItems _unit;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
// Add magazines directly now, so that AI don't reload
|
||||
if (_magazines isNotEqualTo []) then {
|
||||
{
|
||||
_x params [["_magazine", "", [""]], ["_ammoCount", -1, [0]]];
|
||||
|
||||
if (_magazine != "" && {_ammoCount > -1}) then {
|
||||
_unit addWeaponItem [_weapon, [_magazine, _ammoCount], true];
|
||||
};
|
||||
} forEach _magazines;
|
||||
};
|
||||
|
||||
// Add all magazines back
|
||||
{
|
||||
_uniform addMagazineAmmoCargo [_x select 0, 1, _x select 1];
|
||||
|
@ -28,18 +28,13 @@ if (_list isEqualType "") then {
|
||||
};
|
||||
|
||||
{
|
||||
if (!isNil "_x") then {
|
||||
if (_x isEqualType objNull) then {
|
||||
if (local _x) then {
|
||||
if (_vehicle) then {
|
||||
(vehicle _x) setVariable [_variable, _setting, _global];
|
||||
TRACE_6("Set variable vehicle",_x,vehicle _x,typeOf (vehicle _x),_variable,_setting,_global);
|
||||
} else {
|
||||
_x setVariable [_variable, _setting, _global];
|
||||
TRACE_5("Set variable",_x,typeOf _x,_variable,_setting,_global);
|
||||
};
|
||||
};
|
||||
if (!isNil "_x" && {_x isEqualType objNull} && {local _x}) then {
|
||||
if (_vehicle) then {
|
||||
(vehicle _x) setVariable [_variable, _setting, _global];
|
||||
TRACE_6("Set variable vehicle",_x,vehicle _x,typeOf (vehicle _x),_variable,_setting,_global);
|
||||
} else {
|
||||
_x setVariable [_variable, _setting, _global];
|
||||
TRACE_5("Set variable",_x,typeOf _x,_variable,_setting,_global);
|
||||
};
|
||||
};
|
||||
false
|
||||
} count _list;
|
||||
} forEach _list;
|
||||
|
@ -66,8 +66,7 @@ GVAR(settingsMovedToSQF) = [];
|
||||
INFO_1("%1 delayed functions running.",count GVAR(runAtSettingsInitialized));
|
||||
{
|
||||
(_x select 1) call (_x select 0);
|
||||
false
|
||||
} count GVAR(runAtSettingsInitialized);
|
||||
} forEach GVAR(runAtSettingsInitialized);
|
||||
GVAR(runAtSettingsInitialized) = nil; //cleanup
|
||||
|
||||
#ifdef DEBUG_MODE_FULL
|
||||
|
@ -1,8 +1,8 @@
|
||||
#include "..\script_component.hpp"
|
||||
/*
|
||||
* Author: PabstMirror
|
||||
* Function for handeling a cba setting being changed.
|
||||
* Adds warning if global setting is changed after ace_settingsInitialized
|
||||
* Function for handling a cba setting being changed.
|
||||
* Adds warning if global setting is changed after ace_settingsInitialized.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Setting Name <STRING>
|
||||
@ -21,9 +21,7 @@
|
||||
params ["_settingName", "_newValue", ["_canBeChanged", false]];
|
||||
TRACE_2("",_settingName,_newValue);
|
||||
|
||||
["ace_settingChanged", [_settingName, _newValue]] call CBA_fnc_localEvent;
|
||||
|
||||
if (!((toLower _settingName) in CBA_settings_needRestart)) exitWith {};
|
||||
if !((toLower _settingName) in CBA_settings_needRestart) exitWith {};
|
||||
if (_canBeChanged) exitWith {WARNING_1("update cba setting [%1] to use correct Need Restart param",_settingName);};
|
||||
if (!GVAR(settingsInitFinished)) exitWith {}; // Ignore changed event before CBA_settingsInitialized
|
||||
|
||||
|
@ -15,15 +15,20 @@
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
///////////////
|
||||
// check addons
|
||||
///////////////
|
||||
private _mainCfg = configFile >> "CfgPatches" >> "ace_main";
|
||||
private _mainVersion = getText (_mainCfg >> "versionStr");
|
||||
private _mainSource = configSourceMod _mainCfg;
|
||||
// Don't execute in scheduled environment
|
||||
if (canSuspend) exitWith {
|
||||
[FUNC(checkFiles), nil] call CBA_fnc_directCall;
|
||||
};
|
||||
|
||||
//CBA Versioning check - close main display if using incompatible version
|
||||
private _cbaVersionAr = getArray (configFile >> "CfgPatches" >> "cba_main" >> "versionAr");
|
||||
///////////////
|
||||
// Check addons
|
||||
///////////////
|
||||
private _cfgPatches = configFile >> "CfgPatches";
|
||||
private _mainVersion = getText (_cfgPatches >> "ace_main" >> "versionStr");
|
||||
private _mainSource = configSourceMod (_cfgPatches >> "ace_main");
|
||||
|
||||
// CBA Versioning check - close main display if using incompatible version
|
||||
private _cbaVersionAr = getArray (_cfgPatches >> "cba_main" >> "versionAr");
|
||||
private _cbaRequiredAr = getArray (configFile >> "CfgSettings" >> "CBA" >> "Versioning" >> "ACE" >> "dependencies" >> "CBA") select 1;
|
||||
|
||||
private _cbaVersionStr = _cbaVersionAr joinString ".";
|
||||
@ -31,53 +36,62 @@ private _cbaRequiredStr = _cbaRequiredAr joinString ".";
|
||||
|
||||
INFO_3("ACE is version %1 - CBA is version %2 (min required %3)",_mainVersion,_cbaVersionStr,_cbaRequiredStr);
|
||||
|
||||
if ([_cbaRequiredAr, _cbaVersionAr] call cba_versioning_fnc_version_compare) then {
|
||||
if ([_cbaRequiredAr, _cbaVersionAr] call CBA_versioning_fnc_version_compare) then {
|
||||
private _errorMsg = format ["CBA version %1 is outdated (required %2)", _cbaVersionStr, _cbaRequiredStr];
|
||||
ERROR(_errorMsg);
|
||||
|
||||
if (hasInterface) then {
|
||||
["[ACE] ERROR", _errorMsg, {findDisplay 46 closeDisplay 0}] call FUNC(errorMessage);
|
||||
["[ACE] ERROR", _errorMsg] call FUNC(errorMessage);
|
||||
};
|
||||
};
|
||||
|
||||
//private _addons = activatedAddons; // broken with High-Command module, see #2134
|
||||
private _addons = (cba_common_addons select {(_x select [0,4]) == "ace_"}) apply {toLowerANSI _x};
|
||||
//private _addons = activatedAddons; // Broken with High-Command module, see #2134
|
||||
private _addons = (CBA_common_addons select {(_x select [0, 4]) == "ace_"}) apply {toLowerANSI _x};
|
||||
|
||||
private _oldAddons = [];
|
||||
private _oldSources = [];
|
||||
private _oldCompats = [];
|
||||
|
||||
{
|
||||
private _addonCfg = configFile >> "CfgPatches" >> _x;
|
||||
private _addonVersion = getText (_addonCfg >> "versionStr");
|
||||
|
||||
if (_addonVersion != _mainVersion) then {
|
||||
private _addonSource = configSourceMod _addonCfg;
|
||||
|
||||
_oldSources pushBackUnique _addonSource;
|
||||
|
||||
// Check ACE install
|
||||
call FUNC(checkFiles_diagnoseACE);
|
||||
|
||||
// Don't block game if it's just an old compat pbo
|
||||
if ((_x select [0, 10]) != "ace_compat") then {
|
||||
if (hasInterface) then {
|
||||
_oldAddons pushBack _x;
|
||||
};
|
||||
_oldAddons pushBack _x;
|
||||
} else {
|
||||
_oldCompats pushBack [_x, _addonVersion]; // Don't block game if it's just an old compat pbo
|
||||
_oldCompats pushBack [_x, _addonVersion];
|
||||
};
|
||||
};
|
||||
} forEach _addons;
|
||||
|
||||
if (_oldAddons isNotEqualTo []) then {
|
||||
_oldAddons = _oldAddons apply { format ["%1.pbo", _x] };
|
||||
private _errorMsg = "";
|
||||
if (count _oldAddons > 3) then {
|
||||
_errorMsg = format ["The following files are outdated: %1, and %2 more.<br/>ACE Main version is %3 from %4.<br/>Loaded mods with outdated ACE files: %5", (_oldAddons select [0, 3]) joinString ", ", (count _oldAddons) -3, _mainVersion, _mainSource, (_oldSources joinString ", ")];
|
||||
_oldAddons = _oldAddons apply {format ["%1.pbo", _x]};
|
||||
|
||||
private _errorMsg = if (count _oldAddons > 3) then {
|
||||
format ["The following files are outdated: %1, and %2 more.<br/>ACE Main version is %3 from %4.<br/>Loaded mods with outdated ACE files: %5", (_oldAddons select [0, 3]) joinString ", ", (count _oldAddons) - 3, _mainVersion, _mainSource, _oldSources joinString ", "];
|
||||
} else {
|
||||
_errorMsg = format ["The following files are outdated: %1.<br/>ACE Main version is %2 from %3.<br/>Loaded mods with outdated ACE files: %4", (_oldAddons) joinString ", ", _mainVersion, _mainSource, (_oldSources) joinString ", "];
|
||||
format ["The following files are outdated: %1.<br/>ACE Main version is %2 from %3.<br/>Loaded mods with outdated ACE files: %4", _oldAddons joinString ", ", _mainVersion, _mainSource, _oldSources joinString ", "];
|
||||
};
|
||||
|
||||
if (hasInterface) then {
|
||||
["[ACE] ERROR", _errorMsg, {findDisplay 46 closeDisplay 0}] call FUNC(errorMessage);
|
||||
["[ACE] ERROR", _errorMsg] call FUNC(errorMessage);
|
||||
};
|
||||
|
||||
ERROR(_errorMsg);
|
||||
};
|
||||
|
||||
if (_oldCompats isNotEqualTo []) then {
|
||||
_oldCompats = _oldCompats apply {format ["%1 (%2)", _x select 0, _x select 1]};
|
||||
|
||||
[{
|
||||
// Lasts for ~10 seconds
|
||||
ERROR_WITH_TITLE_3("The following ACE compatiblity PBOs are outdated","%1. ACE Main version is %2 from %3.",_this select 0,_this select 1,_this select 2);
|
||||
@ -85,9 +99,10 @@ if (_oldCompats isNotEqualTo []) then {
|
||||
};
|
||||
|
||||
///////////////
|
||||
// check extensions
|
||||
// Check extensions
|
||||
///////////////
|
||||
private _platform = toLowerANSI (productVersion select 6);
|
||||
|
||||
if (!isServer && {_platform in ["linux", "osx"]}) then {
|
||||
// Linux and OSX client ports do not support extensions at all
|
||||
INFO("Operating system does not support extensions");
|
||||
@ -101,8 +116,10 @@ if (!isServer && {_platform in ["linux", "osx"]}) then {
|
||||
|
||||
if ((_isWindows || _isLinux) && {_isClient || _isServer}) then {
|
||||
private _versionEx = _extension callExtension "version";
|
||||
|
||||
if (_versionEx == "") then {
|
||||
private _extensionFile = _extension;
|
||||
|
||||
if (productVersion select 7 == "x64") then {
|
||||
_extensionFile = format ["%1_x64", _extensionFile];
|
||||
};
|
||||
@ -114,7 +131,7 @@ if (!isServer && {_platform in ["linux", "osx"]}) then {
|
||||
ERROR(_errorMsg);
|
||||
|
||||
if (hasInterface) then {
|
||||
["[ACE] ERROR", _errorMsg, {findDisplay 46 closeDisplay 0}] call FUNC(errorMessage);
|
||||
["[ACE] ERROR", _errorMsg] call FUNC(errorMessage);
|
||||
};
|
||||
} else {
|
||||
// Print the current extension version
|
||||
@ -123,54 +140,66 @@ if (!isServer && {_platform in ["linux", "osx"]}) then {
|
||||
};
|
||||
} forEach ("true" configClasses (configFile >> "ACE_Extensions"));
|
||||
};
|
||||
|
||||
if (isArray (configFile >> "ACE_Extensions" >> "extensions")) then {
|
||||
WARNING("extensions[] array no longer supported");
|
||||
};
|
||||
|
||||
///////////////
|
||||
// check server version/addons
|
||||
// Check server version/addons
|
||||
///////////////
|
||||
if (isMultiplayer) then {
|
||||
// don't check optional addons
|
||||
_addons = _addons select {getNumber (configFile >> "CfgPatches" >> _x >> "ACE_isOptional") != 1};
|
||||
// Don't check optional addons
|
||||
_addons = _addons select {getNumber (_cfgPatches >> _x >> "ACE_isOptional") != 1};
|
||||
|
||||
if (isServer) then {
|
||||
// send servers version of ACE to all clients
|
||||
GVAR(ServerVersion) = _mainVersion;
|
||||
GVAR(ServerAddons) = _addons;
|
||||
publicVariable QGVAR(ServerVersion);
|
||||
publicVariable QGVAR(ServerAddons);
|
||||
// Send server's version of ACE to all clients
|
||||
GVAR(serverVersion) = _mainVersion;
|
||||
GVAR(serverAddons) = _addons;
|
||||
GVAR(serverSource) = _mainSource;
|
||||
|
||||
publicVariable QGVAR(serverVersion);
|
||||
publicVariable QGVAR(serverAddons);
|
||||
publicVariable QGVAR(serverSource);
|
||||
} else {
|
||||
// clients have to wait for the variables
|
||||
[{
|
||||
if (isNil QGVAR(ServerVersion) || isNil QGVAR(ServerAddons)) exitWith {};
|
||||
GVAR(clientVersion) = _version;
|
||||
GVAR(clientAddons) = _addons;
|
||||
|
||||
(_this select 0) params ["_mainVersion", "_addons"];
|
||||
|
||||
if (_mainVersion != GVAR(ServerVersion)) then {
|
||||
private _errorMsg = format ["Client/Server Version Mismatch. Server: %1, Client: %2.", GVAR(ServerVersion), _mainVersion];
|
||||
private _fnc_check = {
|
||||
if (GVAR(clientVersion) != GVAR(serverVersion)) then {
|
||||
private _errorMsg = format ["Client/Server Version Mismatch. Server: %1, Client: %2. Server modDir: %3", GVAR(serverVersion), GVAR(clientVersion), GVAR(serverSource)];
|
||||
|
||||
// Check ACE install
|
||||
call FUNC(checkFiles_diagnoseACE);
|
||||
|
||||
ERROR(_errorMsg);
|
||||
|
||||
if (hasInterface) then {
|
||||
["[ACE] ERROR", _errorMsg, {findDisplay 46 closeDisplay 0}] call FUNC(errorMessage);
|
||||
["[ACE] ERROR", _errorMsg] call FUNC(errorMessage);
|
||||
};
|
||||
};
|
||||
|
||||
_addons = _addons - GVAR(ServerAddons);
|
||||
private _addons = GVAR(clientAddons) - GVAR(serverAddons);
|
||||
|
||||
if (_addons isNotEqualTo []) then {
|
||||
private _errorMsg = format ["Client/Server Addon Mismatch. Client has extra addons: %1.",_addons];
|
||||
private _errorMsg = format ["Client/Server Addon Mismatch. Client has additional addons: %1. Server modDir: %2", _addons, GVAR(serverSource)];
|
||||
|
||||
// Check ACE install
|
||||
call FUNC(checkFiles_diagnoseACE);
|
||||
|
||||
ERROR(_errorMsg);
|
||||
|
||||
if (hasInterface) then {
|
||||
["[ACE] ERROR", _errorMsg, {findDisplay 46 closeDisplay 0}] call FUNC(errorMessage);
|
||||
["[ACE] ERROR", _errorMsg] call FUNC(errorMessage);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
}, 1, [_mainVersion,_addons]] call CBA_fnc_addPerFrameHandler;
|
||||
// Clients have to wait for the variables
|
||||
if (isNil QGVAR(serverVersion) || isNil QGVAR(serverAddons)) then {
|
||||
GVAR(serverVersion) addPublicVariableEventHandler _fnc_check;
|
||||
} else {
|
||||
call _fnc_check;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -1,13 +1,13 @@
|
||||
#include "..\script_component.hpp"
|
||||
/*
|
||||
* Author: PabstMirror
|
||||
* Diagnose ACE install problems, this will only be called if there is a known problem
|
||||
* Diagnoses ACE install problems, this will only be called if there is a known problem.
|
||||
*
|
||||
* Arguments:
|
||||
* None
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
* ACE addons' WS IDs <HASHMAP>
|
||||
*
|
||||
* Example:
|
||||
* [] call ace_common_fnc_checkFiles_diagnoseACE
|
||||
@ -16,43 +16,59 @@
|
||||
*/
|
||||
|
||||
// Only run once
|
||||
if (missionNameSpace getVariable [QGVAR(checkFiles_diagnoseACE), false]) exitWith {};
|
||||
if (missionNameSpace getVariable [QGVAR(checkFiles_diagnoseACE), false]) exitWith {
|
||||
createHashMap // return
|
||||
};
|
||||
|
||||
GVAR(checkFiles_diagnoseACE) = true;
|
||||
|
||||
private _addons = cba_common_addons select {(_x select [0,4]) == "ace_"};
|
||||
private _addons = CBA_common_addons select {(_x select [0, 4]) == "ace_"};
|
||||
private _cfgPatches = configFile >> "CfgPatches";
|
||||
private _allMods = createHashMap;
|
||||
private _getLoadedModsInfo = getLoadedModsInfo;
|
||||
|
||||
// Check ACE_ADDONs are in expected mod DIR
|
||||
// Check if ACE_ADDONs are in expected mod DIR
|
||||
{
|
||||
private _cfg = (_cfgPatches >> _x);
|
||||
private _cfg = _cfgPatches >> _x;
|
||||
private _actualModDir = configSourceMod _cfg;
|
||||
private _expectedModDir = getText (_cfg >> "ACE_expectedModDir");
|
||||
if (_expectedModDir == "") then { _expectedModDir = "@ace" };
|
||||
|
||||
if (_expectedModDir == "") then {
|
||||
_expectedModDir = "@ace";
|
||||
};
|
||||
|
||||
private _expectedSteamID = getText (_cfg >> "ACE_expectedSteamID");
|
||||
if (_expectedSteamID == "") then { _expectedSteamID = "463939057" };
|
||||
|
||||
if (_expectedSteamID == "") then {
|
||||
_expectedSteamID = "463939057"
|
||||
};
|
||||
|
||||
(_allMods getOrDefault [_actualModDir, [], true]) pushBackUnique _expectedSteamID;
|
||||
|
||||
if (_actualModDir != _expectedModDir) then {
|
||||
private _errorMsg = format ["%1 loading from unexpected modDir [%2]",_x,_actualModDir];
|
||||
private _errorMsg = format ["%1 loading from unexpected modDir [%2]", _x, _actualModDir];
|
||||
systemChat _errorMsg;
|
||||
WARNING_1("%1",_errorMsg);
|
||||
};
|
||||
} forEach _addons;
|
||||
|
||||
// Check all ACE ModDirs have expected steam WS ID
|
||||
// Check if all ACE ModDirs have expected steam WS ID
|
||||
{
|
||||
private _modDir = _x;
|
||||
if ((count _y) != 1) then { ERROR_2("Unexpected multiple steamIDs %1 - %2",_modDir,_y) };
|
||||
private _expectedSteamID = _y # 0;
|
||||
private _index = getLoadedModsInfo findIf {_x#1 == _modDir};
|
||||
(getLoadedModsInfo param [_index, []]) params [["_modName", "$Error$"], "", "", "", "", "", "", ["_actualID", ""]];
|
||||
|
||||
if (count _y != 1) then {
|
||||
ERROR_2("Unexpected multiple steamIDs %1 - %2",_modDir,_y);
|
||||
};
|
||||
|
||||
private _expectedSteamID = _y select 0;
|
||||
private _index = _getLoadedModsInfo findIf {_x select 1 == _modDir};
|
||||
(_getLoadedModsInfo param [_index, []]) params [["_modName", "$Error$"], "", "", "", "", "", "", ["_actualID", ""]];
|
||||
|
||||
if (_actualID != _expectedSteamID) then {
|
||||
private _errorMsg = format ["%1 [%2] unexpected workshopID [%3]",_modDir,_modName,_actualID];
|
||||
private _errorMsg = format ["%1 [%2] unexpected workshopID [%3]", _modDir, _modName, _actualID];
|
||||
systemChat _errorMsg;
|
||||
WARNING_1("%1",_errorMsg);
|
||||
};
|
||||
} forEach _allMods;
|
||||
|
||||
_allMods
|
||||
_allMods // return
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "..\script_component.hpp"
|
||||
/*
|
||||
* Author: commy2
|
||||
* Author: commy2, johnb43
|
||||
* Used to execute the checkPBOs module without placing the module. Don't use this together with the module.
|
||||
* Checks PBO versions and compares to the one running on server.
|
||||
*
|
||||
@ -9,8 +9,8 @@
|
||||
* 0 = Warn once
|
||||
* 1 = Warn permanently
|
||||
* 2 = Kick
|
||||
* 1: Check all PBOs? (default: false) <BOOL>
|
||||
* 2: Whitelist (default: "") <STRING>
|
||||
* 1: Check all PBOs? <BOOL> (default: false)
|
||||
* 2: Whitelist <STRING> (default: "")
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
@ -24,7 +24,7 @@
|
||||
params ["_mode", ["_checkAll", false], ["_whitelist", "", [""]]];
|
||||
TRACE_3("params",_mode,_checkAll,_whitelist);
|
||||
|
||||
//lowercase and convert whiteList String into array of strings:
|
||||
// Lowercase and convert whiteList string into array of strings
|
||||
_whitelist = toLowerANSI _whitelist;
|
||||
_whitelist = _whitelist splitString "[,""']";
|
||||
TRACE_1("Array",_whitelist);
|
||||
@ -32,75 +32,67 @@ TRACE_1("Array",_whitelist);
|
||||
ACE_Version_CheckAll = _checkAll;
|
||||
ACE_Version_Whitelist = _whitelist;
|
||||
|
||||
if (!_checkAll) exitWith {}; //ACE is checked by FUNC(checkFiles)
|
||||
// ACE is checked by FUNC(checkFiles)
|
||||
if (!_checkAll) exitWith {};
|
||||
|
||||
if (!isServer) then {
|
||||
[{
|
||||
if (isNil "ACE_Version_ClientErrors") exitWith {};
|
||||
["ace_versioning_clientCheckDone", {
|
||||
// Don't let this event get triggered again
|
||||
[_thisType, _thisId] call CBA_fnc_removeEventHandler;
|
||||
|
||||
ACE_Version_ClientErrors params ["_missingAddon", "_missingAddonServer", "_oldVersionClient", "_oldVersionServer"];
|
||||
params ["_clientErrors"];
|
||||
_clientErrors params ["_missingAddonClient", "_additionalAddonClient", "_olderVersionClient", "_newerVersionClient"];
|
||||
_thisArgs params ["_mode"];
|
||||
|
||||
(_this select 0) params ["_mode", "_checkAll", "_whitelist"];
|
||||
// Display error message(s)
|
||||
if (_missingAddonClient || {_additionalAddonClient} || {_olderVersionClient} || {_newerVersionClient}) then {
|
||||
private _errorMsg = "[ACE] Version mismatch:<br/><br/>";
|
||||
private _error = [];
|
||||
|
||||
// Display error message.
|
||||
if (_missingAddon || {_missingAddonServer} || {_oldVersionClient} || {_oldVersionServer}) then {
|
||||
private _text = "[ACE] Version mismatch:<br/><br/>";
|
||||
private _error = format ["ACE version mismatch: %1: ", profileName];
|
||||
|
||||
if (_missingAddon) then {
|
||||
_text = _text + "Detected missing addon on client<br/>";
|
||||
_error = _error + "Missing file(s); ";
|
||||
};
|
||||
if (_missingAddonServer) then {
|
||||
_text = _text + "Detected missing addon on server<br/>";
|
||||
_error = _error + "Additional file(s); ";
|
||||
};
|
||||
if (_oldVersionClient) then {
|
||||
_text = _text + "Detected old client version<br/>";
|
||||
_error = _error + "Older version; ";
|
||||
};
|
||||
if (_oldVersionServer) then {
|
||||
_text = _text + "Detected old server version<br/>";
|
||||
_error = _error + "Newer version; ";
|
||||
if (_missingAddonClient) then {
|
||||
_errorMsg = _errorMsg + "Detected missing addon on client<br/>";
|
||||
_error pushBack "Missing file(s)";
|
||||
};
|
||||
|
||||
//[QGVAR(systemChatGlobal), _error] call CBA_fnc_globalEvent;
|
||||
if (_additionalAddonClient) then {
|
||||
_errorMsg = _errorMsg + "Detected additional addon on client<br/>";
|
||||
_error pushBack "Additional file(s)";
|
||||
};
|
||||
|
||||
ERROR(_error);
|
||||
if (_olderVersionClient) then {
|
||||
_errorMsg = _errorMsg + "Detected older client version<br/>";
|
||||
_error pushBack "Older version";
|
||||
};
|
||||
|
||||
if (_newerVersionClient) then {
|
||||
_errorMsg = _errorMsg + "Detected newer client version<br/>";
|
||||
_error pushBack "Newer version";
|
||||
};
|
||||
|
||||
ERROR_2("[ACE] Version mismatch: %1: %2",profileName,_error joinString ", ");
|
||||
|
||||
_errorMsg = parseText format ["<t align='center'>%1</t>", _errorMsg];
|
||||
|
||||
// Warn
|
||||
if (_mode < 2) then {
|
||||
_text = composeText [lineBreak, parseText format ["<t align='center'>%1</t>", _text]];
|
||||
|
||||
private _rscLayer = "ACE_RscErrorHint" call BIS_fnc_rscLayer;
|
||||
_rscLayer cutRsc ["ACE_RscErrorHint", "PLAIN", 0, true];
|
||||
|
||||
disableSerialization;
|
||||
private _ctrlHint = uiNamespace getVariable "ACE_ctrlErrorHint";
|
||||
_ctrlHint ctrlSetStructuredText _text;
|
||||
(uiNamespace getVariable "ACE_ctrlErrorHint") ctrlSetStructuredText composeText [lineBreak, _errorMsg];
|
||||
|
||||
if (_mode == 0) then {
|
||||
[{
|
||||
params ["_rscLayer"];
|
||||
TRACE_2("Hiding Error message after 10 seconds",time,_rscLayer);
|
||||
_rscLayer cutFadeOut 0.2;
|
||||
}, [_rscLayer], 10] call CBA_fnc_waitAndExecute;
|
||||
TRACE_2("Hiding Error message after 10 seconds",time,_this);
|
||||
_this cutFadeOut 0.2;
|
||||
}, _rscLayer, 10] call CBA_fnc_waitAndExecute;
|
||||
};
|
||||
};
|
||||
|
||||
if (_mode == 2) then {
|
||||
[{alive player}, { // To be able to show list if using checkAll
|
||||
params ["_text"];
|
||||
TRACE_2("Player is alive, showing msg and exiting",time,_text);
|
||||
_text = composeText [parseText format ["<t align='center'>%1</t>", _text]];
|
||||
["[ACE] ERROR", _text, {findDisplay 46 closeDisplay 0}] call FUNC(errorMessage);
|
||||
}, [_text]] call CBA_fnc_waitUntilAndExecute;
|
||||
} else {
|
||||
// Kick
|
||||
["[ACE] ERROR", composeText [_errorMsg]] call FUNC(errorMessage);
|
||||
};
|
||||
};
|
||||
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
}, 1, [_mode, _checkAll, _whitelist]] call CBA_fnc_addPerFrameHandler;
|
||||
}, [_mode]] call CBA_fnc_addEventHandlerArgs;
|
||||
};
|
||||
|
||||
if (_checkAll) then {
|
||||
0 spawn COMPILE_FILE(scripts\checkVersionNumber); // @todo
|
||||
};
|
||||
// Check file version numbers
|
||||
[_whitelist] call FUNC(checkVersionNumber);
|
||||
|
161
addons/common/functions/fnc_checkVersionNumber.sqf
Normal file
161
addons/common/functions/fnc_checkVersionNumber.sqf
Normal file
@ -0,0 +1,161 @@
|
||||
#include "..\script_component.hpp"
|
||||
/*
|
||||
* Author: commy2, johnb43
|
||||
* Compares version numbers from loaded addons.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Lowercase addon whitelist <ARRAY> (default: missionNamespace getVariable ["ACE_Version_Whitelist", []])
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* call ace_common_fnc_checkVersionNumber
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
// Don't execute in scheduled environment
|
||||
if (canSuspend) exitWith {
|
||||
[FUNC(checkVersionNumber), _this] call CBA_fnc_directCall;
|
||||
};
|
||||
|
||||
params [["_whitelist", missionNamespace getVariable ["ACE_Version_Whitelist", []]]];
|
||||
|
||||
private _files = CBA_common_addons select {
|
||||
(_x select [0, 3] != "a3_") &&
|
||||
{_x select [0, 4] != "ace_"} &&
|
||||
{!((toLowerANSI _x) in _whitelist)}
|
||||
};
|
||||
|
||||
private _cfgPatches = configFile >> "CfgPatches";
|
||||
private _versions = [];
|
||||
|
||||
{
|
||||
(getText (_cfgPatches >> _x >> "version") splitString ".") params [["_major", "0"], ["_minor", "0"]];
|
||||
private _version = parseNumber _major + parseNumber _minor / 100;
|
||||
_versions pushBack _version;
|
||||
} forEach _files;
|
||||
|
||||
if (isServer) exitWith {
|
||||
ACE_Version_ServerVersions = [_files, _versions];
|
||||
publicVariable "ACE_Version_ServerVersions";
|
||||
|
||||
// Raise event when done
|
||||
["ace_versioning_serverCheckDone", [+ACE_Version_ServerVersions]] call CBA_fnc_localEvent;
|
||||
};
|
||||
|
||||
// Begin client version check
|
||||
ACE_Version_ClientVersions = [_files, _versions];
|
||||
|
||||
private _fnc_check = {
|
||||
ACE_Version_ClientVersions params [["_files", []], ["_versions", []]];
|
||||
ACE_Version_ServerVersions params [["_serverFiles", []], ["_serverVersions", []]];
|
||||
|
||||
// Compare client and server files and versions
|
||||
private _client = profileName;
|
||||
private _missingAddonsClient = [];
|
||||
private _olderVersionsClient = [];
|
||||
private _newerVersionsClient = [];
|
||||
|
||||
{
|
||||
private _serverVersion = _serverVersions select _forEachIndex;
|
||||
|
||||
private _index = _files find _x;
|
||||
|
||||
if (_index == -1) then {
|
||||
if (_x != "ace_server") then {
|
||||
_missingAddonsClient pushBack _x;
|
||||
};
|
||||
} else {
|
||||
private _clientVersion = _versions select _index;
|
||||
|
||||
if (_clientVersion < _serverVersion) then {
|
||||
_olderVersionsClient pushBack [_x, _clientVersion, _serverVersion];
|
||||
};
|
||||
|
||||
if (_clientVersion > _serverVersion) then {
|
||||
_newerVersionsClient pushBack [_x, _clientVersion, _serverVersion];
|
||||
};
|
||||
};
|
||||
} forEach _serverFiles;
|
||||
|
||||
// Find client files which the server doesn't have
|
||||
private _additionalAddonsClient = _files select {!(_x in _serverFiles)};
|
||||
|
||||
// Check for client missing addons, server missing addons, client outdated addons and server outdated addons
|
||||
private _clientErrors = [];
|
||||
|
||||
#define DISPLAY_NUMBER_ADDONS (10 + 1) // +1 to account for header
|
||||
|
||||
{
|
||||
_x params ["_items", "_string"];
|
||||
|
||||
// Check if something is either missing or outdated
|
||||
private _isMissingItems = _items isNotEqualTo [];
|
||||
|
||||
if (_isMissingItems) then {
|
||||
// Generate error message
|
||||
private _errorLog = +_items;
|
||||
private _header = format ["[ACE] %1: ERROR %2 addon(s): ", _client, _string];
|
||||
|
||||
// Don't display all missing items, as they are logged
|
||||
private _errorMsg = _header + ((_errorLog select [0, DISPLAY_NUMBER_ADDONS]) joinString ", ");
|
||||
_errorLog = _header + (_errorLog joinString ", ");
|
||||
|
||||
private _count = count _items;
|
||||
|
||||
if (_count > DISPLAY_NUMBER_ADDONS) then {
|
||||
_errorMsg = _errorMsg + format [", and %1 more.", _count - DISPLAY_NUMBER_ADDONS];
|
||||
};
|
||||
|
||||
// Wait until in briefing screen
|
||||
[{
|
||||
getClientStateNumber >= 9 // "BRIEFING SHOWN"
|
||||
}, {
|
||||
params ["_errorLog", "_errorMsg"];
|
||||
|
||||
// Log and display error messages
|
||||
diag_log text _errorLog;
|
||||
[QGVAR(serverLog), _errorLog] call CBA_fnc_serverEvent;
|
||||
[QGVAR(systemChatGlobal), _errorMsg] call CBA_fnc_globalEvent;
|
||||
|
||||
// Wait until after map screen
|
||||
[{
|
||||
!isNull (call BIS_fnc_displayMission)
|
||||
}, {
|
||||
params ["_errorMsg", "_timeOut"];
|
||||
|
||||
// If the briefing screen was shown for less than 5 seconds, display the error message again, but locally
|
||||
if (_timeOut < CBA_missionTime) exitWith {};
|
||||
|
||||
// Make sure systemChat is ready by waiting a bit
|
||||
[{
|
||||
systemChat _this;
|
||||
}, _errorMsg, 1] call CBA_fnc_waitAndExecute;
|
||||
}, [_errorMsg, CBA_missionTime + 5]] call CBA_fnc_waitUntilAndExecute;
|
||||
}, [_errorLog, _errorMsg]] call CBA_fnc_waitUntilAndExecute;
|
||||
};
|
||||
|
||||
_clientErrors pushBack _isMissingItems;
|
||||
} forEach [
|
||||
[_missingAddonsClient, "client missing"],
|
||||
[_additionalAddonsClient, "client additional"],
|
||||
[_olderVersionsClient, "older client"],
|
||||
[_newerVersionsClient, "newer client"]
|
||||
];
|
||||
|
||||
TRACE_4("",_missingAddonsClient,_additionalAddonsClient,_olderVersionsClient,_newerVersionsClient);
|
||||
|
||||
ACE_Version_ClientErrors = _clientErrors;
|
||||
|
||||
// Raise event when done
|
||||
["ace_versioning_clientCheckDone", [+ACE_Version_ClientErrors]] call CBA_fnc_localEvent;
|
||||
};
|
||||
|
||||
// Wait for server to send the servers files and version numbers
|
||||
if (isNil "ACE_Version_ServerVersions") then {
|
||||
ACE_Version_ServerVersions addPublicVariableEventHandler _fnc_check;
|
||||
} else {
|
||||
call _fnc_check;
|
||||
};
|
@ -24,7 +24,7 @@ params ["_name", "_value", "_defaultGlobal", "_category", ["_code", 0], ["_persi
|
||||
|
||||
if (isNil "_defaultGlobal") exitWith {};
|
||||
|
||||
if (!(_name isEqualType "")) exitwith {
|
||||
if !(_name isEqualType "") exitwith {
|
||||
[format ["Tried to the deinfe a variable with an invalid name: %1 Arguments: %2", _name, _this]] call FUNC(debug);
|
||||
};
|
||||
|
||||
|
@ -143,11 +143,7 @@ if (_state) then {
|
||||
_ctrl ctrlSetEventHandler ["ButtonClick", toString {
|
||||
closeDialog 0;
|
||||
|
||||
if (["ace_medical"] call FUNC(isModLoaded)) then {
|
||||
[player, "respawn_button"] call EFUNC(medical_status,setDead);
|
||||
} else {
|
||||
player setDamage 1;
|
||||
};
|
||||
[player, "respawn_button"] call FUNC(setDead);
|
||||
|
||||
[false] call FUNC(disableUserInput);
|
||||
}];
|
||||
|
@ -53,8 +53,7 @@ private _refresh = {
|
||||
|
||||
{
|
||||
ctrlDelete _x;
|
||||
false
|
||||
} count _allControls;
|
||||
} forEach _allControls;
|
||||
|
||||
_allControls = [];
|
||||
|
||||
@ -80,7 +79,6 @@ private _refresh = {
|
||||
_ctrl ctrlSetTextColor _xcolor;
|
||||
_ctrl ctrlCommit 0;
|
||||
_allControls pushBack _ctrl;
|
||||
false
|
||||
} forEach (missionNamespace getVariable [QGVAR(displayIconList),[]]);
|
||||
};
|
||||
|
||||
@ -116,8 +114,7 @@ if (_show) then {
|
||||
if (_x select 0 != _iconId) then {
|
||||
_newList pushBack _x;
|
||||
};
|
||||
false
|
||||
} count _list;
|
||||
} forEach _list;
|
||||
|
||||
missionNamespace setVariable [QGVAR(displayIconList), _newList];
|
||||
call _refresh;
|
||||
|
@ -34,8 +34,7 @@ if (IS_ARRAY(_var)) then {
|
||||
|
||||
{
|
||||
[_x, _depth] call FUNC(dumpArray);
|
||||
false
|
||||
} count _var;
|
||||
} forEach _var;
|
||||
|
||||
diag_log text format ["%1],", _pad];
|
||||
};
|
||||
|
@ -25,8 +25,7 @@ if (!isNil "ACE_PFH_COUNTER") then {
|
||||
private _isActive = ["ACTIVE", "REMOVED"] select isNil {CBA_common_PFHhandles select (_pfh select 0)};
|
||||
|
||||
diag_log text format ["Registered PFH: id=%1 [%2, delay %3], %4:%5", _pfh select 0, _isActive, _parameters select 1, _pfh select 1, _pfh select 2];
|
||||
false
|
||||
} count ACE_PFH_COUNTER;
|
||||
} forEach ACE_PFH_COUNTER;
|
||||
};
|
||||
|
||||
diag_log text format ["ACE COUNTER RESULTS"];
|
||||
@ -50,8 +49,7 @@ diag_log text format ["-------------------------------------------"];
|
||||
};
|
||||
|
||||
_iter = _iter + 1;
|
||||
false
|
||||
} count _counterEntry;
|
||||
} forEach _counterEntry;
|
||||
|
||||
// results
|
||||
_averageResult = (_total / _count) * 1000;
|
||||
@ -61,8 +59,7 @@ diag_log text format ["-------------------------------------------"];
|
||||
} else {
|
||||
diag_log text format ["%1: No results", _counterEntry select 0];
|
||||
};
|
||||
false
|
||||
} count ACE_COUNTERS;
|
||||
} forEach ACE_COUNTERS;
|
||||
|
||||
/*
|
||||
// Dump PFH Trackers
|
||||
|
@ -1,147 +1,141 @@
|
||||
#include "..\script_component.hpp"
|
||||
#include "\a3\ui_f\hpp\defineResincl.inc"
|
||||
#include "\a3\ui_f\hpp\defineDIKCodes.inc"
|
||||
/*
|
||||
* Author: commy2, based on BIS_fnc_errorMsg and BIS_fnc_guiMessage by Karel Moricky (BI)
|
||||
* Stops simulation and opens a textbox with error message.
|
||||
* Author: commy2, johnb43, based on BIS_fnc_errorMsg and BIS_fnc_guiMessage by Karel Moricky (BI)
|
||||
* Opens a textbox with an error message, used for PBO checking.
|
||||
*
|
||||
* Arguments:
|
||||
* ?
|
||||
* 0: Header <STRING>
|
||||
* 1: Text <STRING|TEXT>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* call ace_common_fnc_errorMessage
|
||||
* ["[ACE] ERROR", "Test"] call ace_common_fnc_errorMessage
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
disableSerialization;
|
||||
// Force stop any loading screens
|
||||
endLoadingScreen;
|
||||
|
||||
// no message without player possible
|
||||
// No message without interface possible
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
// wait for display
|
||||
if (isNull (call BIS_fnc_displayMission)) exitWith {
|
||||
[{
|
||||
if (isNull (call BIS_fnc_displayMission)) exitWith {};
|
||||
[{
|
||||
!isNull (call BIS_fnc_displayMission)
|
||||
}, {
|
||||
params ["_textHeader", "_textMessage"];
|
||||
|
||||
(_this select 0) call FUNC(errorMessage);
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
disableSerialization;
|
||||
|
||||
}, 1, _this] call CBA_fnc_addPerFrameHandler;
|
||||
};
|
||||
// Use curator display if present
|
||||
private _curatorDisplay = findDisplay 312;
|
||||
|
||||
params ["_textHeader", "_textMessage", ["_onOK", {}], ["_onCancel", {}]];
|
||||
private _mainDisplay = if (!isNull _curatorDisplay) then {
|
||||
_curatorDisplay
|
||||
} else {
|
||||
call BIS_fnc_displayMission
|
||||
};
|
||||
|
||||
if (_textMessage isEqualType "") then {
|
||||
_textMessage = parseText _textMessage;
|
||||
};
|
||||
if (_textMessage isEqualType "") then {
|
||||
_textMessage = parseText _textMessage;
|
||||
};
|
||||
|
||||
ARR_SELECT(_this,4,call BIS_fnc_displayMission) createDisplay "RscDisplayCommonMessagePause";
|
||||
private _display = _mainDisplay createDisplay "RscDisplayCommonMessagePause";
|
||||
|
||||
private _display = uiNamespace getVariable "RscDisplayCommonMessage_display";
|
||||
private _ctrlRscMessageBox = _display displayCtrl 2351;
|
||||
private _ctrlBcgCommonTop = _display displayCtrl 235100;
|
||||
private _ctrlBcgCommon = _display displayCtrl 235101;
|
||||
private _ctrlText = _display displayCtrl 235102;
|
||||
private _ctrlBackgroundButtonOK = _display displayCtrl 235103;
|
||||
private _ctrlBackgroundButtonMiddle = _display displayCtrl 235104;
|
||||
private _ctrlBackgroundButtonCancel = _display displayCtrl 235105;
|
||||
private _ctrlButtonOK = _display displayCtrl 235106;
|
||||
private _ctrlButtonCancel = _display displayCtrl 235107;
|
||||
if (isNull _display) exitWith {};
|
||||
|
||||
_ctrlBcgCommonTop ctrlSetText _textHeader;
|
||||
private _ctrlRscMessageBox = _display displayCtrl 2351;
|
||||
private _ctrlBcgCommonTop = _display displayCtrl 235100;
|
||||
private _ctrlBcgCommon = _display displayCtrl 235101;
|
||||
private _ctrlText = _display displayCtrl 235102;
|
||||
private _ctrlBackgroundButtonOK = _display displayCtrl 235103;
|
||||
private _ctrlBackgroundButtonMiddle = _display displayCtrl 235104;
|
||||
private _ctrlBackgroundButtonCancel = _display displayCtrl 235105;
|
||||
private _ctrlButtonOK = _display displayCtrl 235106;
|
||||
private _ctrlButtonCancel = _display displayCtrl 235107;
|
||||
|
||||
private _ctrlButtonOKPos = ctrlPosition _ctrlButtonOK;
|
||||
private _ctrlBcgCommonPos = ctrlPosition _ctrlBcgCommon;
|
||||
private _bottomSpaceY = (_ctrlButtonOKPos select 1) - ((_ctrlBcgCommonPos select 1) + (_ctrlBcgCommonPos select 3));
|
||||
_ctrlBcgCommonTop ctrlSetText _textHeader;
|
||||
|
||||
private _ctrlTextPos = ctrlPosition _ctrlText;
|
||||
private _marginX = (_ctrlTextPos select 0) - (_ctrlBcgCommonPos select 0);
|
||||
private _marginY = (_ctrlTextPos select 1) - (_ctrlBcgCommonPos select 1);
|
||||
private _ctrlButtonOKPos = ctrlPosition _ctrlButtonOK;
|
||||
private _ctrlBcgCommonPos = ctrlPosition _ctrlBcgCommon;
|
||||
private _bottomSpaceY = (_ctrlButtonOKPos select 1) - ((_ctrlBcgCommonPos select 1) + (_ctrlBcgCommonPos select 3));
|
||||
|
||||
_ctrlText ctrlSetStructuredText _textMessage;
|
||||
private _ctrlTextPosH = ctrlTextHeight _ctrlText;
|
||||
private _ctrlTextPos = ctrlPosition _ctrlText;
|
||||
private _marginX = (_ctrlTextPos select 0) - (_ctrlBcgCommonPos select 0);
|
||||
private _marginY = (_ctrlTextPos select 1) - (_ctrlBcgCommonPos select 1);
|
||||
|
||||
_ctrlBcgCommon ctrlSetPosition [
|
||||
_ctrlBcgCommonPos select 0,
|
||||
_ctrlBcgCommonPos select 1,
|
||||
_ctrlBcgCommonPos select 2,
|
||||
_ctrlTextPosH + _marginY * 2
|
||||
];
|
||||
_ctrlBcgCommon ctrlCommit 0;
|
||||
_ctrlText ctrlSetStructuredText _textMessage;
|
||||
private _ctrlTextPosH = ctrlTextHeight _ctrlText;
|
||||
|
||||
_ctrlText ctrlSetPosition [
|
||||
(_ctrlBcgCommonPos select 0) + _marginX,
|
||||
(_ctrlBcgCommonPos select 1) + _marginY,
|
||||
(_ctrlBcgCommonPos select 2) - _marginX * 2,
|
||||
_ctrlTextPosH
|
||||
];
|
||||
_ctrlText ctrlCommit 0;
|
||||
_ctrlBcgCommon ctrlSetPosition [
|
||||
_ctrlBcgCommonPos select 0,
|
||||
_ctrlBcgCommonPos select 1,
|
||||
_ctrlBcgCommonPos select 2,
|
||||
_ctrlTextPosH + _marginY * 2
|
||||
];
|
||||
_ctrlBcgCommon ctrlCommit 0;
|
||||
|
||||
private _bottomPosY = (_ctrlBcgCommonPos select 1) + _ctrlTextPosH + (_marginY * 2) + _bottomSpaceY;
|
||||
_ctrlText ctrlSetPosition [
|
||||
(_ctrlBcgCommonPos select 0) + _marginX,
|
||||
(_ctrlBcgCommonPos select 1) + _marginY,
|
||||
(_ctrlBcgCommonPos select 2) - _marginX * 2,
|
||||
_ctrlTextPosH
|
||||
];
|
||||
_ctrlText ctrlCommit 0;
|
||||
|
||||
{
|
||||
private _xPos = ctrlPosition _x;
|
||||
private _bottomPosY = (_ctrlBcgCommonPos select 1) + _ctrlTextPosH + (_marginY * 2) + _bottomSpaceY;
|
||||
|
||||
_xPos set [1, _bottomPosY];
|
||||
_x ctrlSetPosition _xPos;
|
||||
_x ctrlCommit 0;
|
||||
} forEach [
|
||||
_ctrlBackgroundButtonOK,
|
||||
_ctrlBackgroundButtonMiddle,
|
||||
_ctrlBackgroundButtonCancel,
|
||||
_ctrlButtonOK,
|
||||
_ctrlButtonCancel
|
||||
];
|
||||
{
|
||||
private _xPos = ctrlPosition _x;
|
||||
|
||||
private _ctrlRscMessageBoxPos = ctrlPosition _ctrlRscMessageBox;
|
||||
private _ctrlRscMessageBoxPosH = _bottomPosY + (_ctrlButtonOKPos select 3);
|
||||
_xPos set [1, _bottomPosY];
|
||||
_x ctrlSetPosition _xPos;
|
||||
_x ctrlCommit 0;
|
||||
} forEach [
|
||||
_ctrlBackgroundButtonOK,
|
||||
_ctrlBackgroundButtonMiddle,
|
||||
_ctrlBackgroundButtonCancel,
|
||||
_ctrlButtonOK,
|
||||
_ctrlButtonCancel
|
||||
];
|
||||
|
||||
_ctrlRscMessageBox ctrlSetPosition [
|
||||
0.5 - (_ctrlBcgCommonPos select 2) / 2,
|
||||
0.5 - _ctrlRscMessageBoxPosH / 2,
|
||||
(_ctrlBcgCommonPos select 2) + 0.5,
|
||||
_ctrlRscMessageBoxPosH
|
||||
];
|
||||
private _ctrlRscMessageBoxPos = ctrlPosition _ctrlRscMessageBox;
|
||||
private _ctrlRscMessageBoxPosH = _bottomPosY + (_ctrlButtonOKPos select 3);
|
||||
|
||||
_ctrlRscMessageBox ctrlEnable true;
|
||||
_ctrlRscMessageBox ctrlCommit 0;
|
||||
_ctrlRscMessageBox ctrlSetPosition [
|
||||
0.5 - (_ctrlBcgCommonPos select 2) / 2,
|
||||
0.5 - _ctrlRscMessageBoxPosH / 2,
|
||||
(_ctrlBcgCommonPos select 2) + 0.5,
|
||||
_ctrlRscMessageBoxPosH
|
||||
];
|
||||
|
||||
if (_onOK isEqualTo {}) then {
|
||||
_ctrlButtonOK ctrlEnable false;
|
||||
_ctrlButtonOK ctrlSetFade 0;
|
||||
_ctrlButtonOK ctrlSetText "";
|
||||
_ctrlButtonOK ctrlCommit 0;
|
||||
} else {
|
||||
_ctrlRscMessageBox ctrlEnable true;
|
||||
_ctrlRscMessageBox ctrlCommit 0;
|
||||
|
||||
// Enable ok button
|
||||
_ctrlButtonOK ctrlEnable true;
|
||||
_ctrlButtonOK ctrlSetFade 0;
|
||||
_ctrlButtonOK ctrlSetText localize "STR_DISP_OK";
|
||||
_ctrlButtonOK ctrlCommit 0;
|
||||
|
||||
ctrlSetFocus _ctrlButtonOK;
|
||||
};
|
||||
|
||||
if (_onCancel isEqualTo {}) then {
|
||||
// Disable cancel button
|
||||
_ctrlButtonCancel ctrlEnable false;
|
||||
_ctrlButtonCancel ctrlSetFade 0;
|
||||
_ctrlButtonCancel ctrlSetText "";
|
||||
_ctrlButtonCancel ctrlCommit 0;
|
||||
} else {
|
||||
_ctrlButtonCancel ctrlEnable true;
|
||||
_ctrlButtonCancel ctrlSetFade 0;
|
||||
_ctrlButtonCancel ctrlSetText localize "STR_DISP_CANCEL";
|
||||
_ctrlButtonCancel ctrlCommit 0;
|
||||
|
||||
ctrlSetFocus _ctrlButtonCancel;
|
||||
};
|
||||
_ctrlButtonOK ctrlAddEventHandler ["ButtonClick", {(ctrlParent (_this select 0)) closeDisplay IDC_OK; true}];
|
||||
|
||||
_ctrlButtonOK ctrlAddEventHandler ["buttonClick", {(ctrlParent (_this select 0)) closeDisplay 1; true}];
|
||||
_ctrlButtonCancel ctrlAddEventHandler ["buttonClick", {(ctrlParent (_this select 0)) closeDisplay 2; true}];
|
||||
// Intercept all keystrokes except the enter keys
|
||||
_display displayAddEventHandler ["KeyDown", {!((_this select 1) in [DIK_RETURN, DIK_NUMPADENTER])}];
|
||||
|
||||
GVAR(errorOnOK) = _onOK;
|
||||
GVAR(errorOnCancel) = _onCancel;
|
||||
|
||||
_display displayAddEventHandler ["unload", {call ([{}, GVAR(errorOnOK), GVAR(errorOnCancel)] select (_this select 1))}];
|
||||
_display displayAddEventHandler ["keyDown", {_this select 1 == 1}];
|
||||
// Close curator and mission displays (because of the message display, it doesn't quit the mission yet)
|
||||
findDisplay 312 closeDisplay 0;
|
||||
findDisplay 46 closeDisplay 0;
|
||||
}, _this] call CBA_fnc_waitUntilAndExecute;
|
||||
|
@ -50,8 +50,7 @@ if (_unit isKindOf "CAManBase") then {
|
||||
_gunner = _unit turretUnit _x;
|
||||
_turret = _x;
|
||||
};
|
||||
false
|
||||
} count allTurrets [_unit, true];
|
||||
} forEach allTurrets [_unit, true];
|
||||
// Ensure that at least the pilot is returned if there is no gunner
|
||||
if (isManualFire _unit && {isNull _gunner}) then {
|
||||
_gunner = effectiveCommander _unit;
|
||||
|
@ -35,7 +35,6 @@ private _return = [];
|
||||
_return pushBack [_x select 0, typeName _val, _val, _x select 2, _x select 5];
|
||||
};
|
||||
};
|
||||
false
|
||||
} count GVAR(OBJECT_VARIABLES_STORAGE);
|
||||
} forEach GVAR(OBJECT_VARIABLES_STORAGE);
|
||||
|
||||
_return
|
||||
|
@ -29,7 +29,6 @@ private _doorTurrets = [];
|
||||
if (((getNumber (_config >> "isCopilot")) == 0) && {count getArray (_config >> "weapons") > 0}) then {
|
||||
_doorTurrets pushBack _x;
|
||||
};
|
||||
false
|
||||
} count _turrets;
|
||||
} forEach _turrets;
|
||||
|
||||
_doorTurrets
|
||||
|
@ -28,8 +28,7 @@ private _gunner = objNull;
|
||||
if (_weapon in (_vehicle weaponsTurret _x)) exitWith {
|
||||
_gunner = _vehicle turretUnit _x;
|
||||
};
|
||||
false
|
||||
} count allTurrets [_vehicle, true];
|
||||
} forEach allTurrets [_vehicle, true];
|
||||
|
||||
// ensure that at least the pilot is returned if there is no gunner
|
||||
if (isManualFire _vehicle && {isNull _gunner}) then {
|
||||
|
@ -38,8 +38,7 @@ private _enemiesInVehicle = false; //Possible Side Restriction
|
||||
|
||||
{
|
||||
if (side _unit getFriend side _x < 0.6) exitWith {_enemiesInVehicle = true};
|
||||
false
|
||||
} count crew _vehicle;
|
||||
} forEach crew _vehicle;
|
||||
|
||||
switch (_position) do {
|
||||
case "driver" : {
|
||||
|
@ -38,8 +38,7 @@ private _stepY = 1e10;
|
||||
_stepX = getNumber (_x >> "stepX");
|
||||
_stepY = getNumber (_x >> "stepY");
|
||||
};
|
||||
false
|
||||
} count configProperties [_cfgGrid, "isClass _x", false];
|
||||
} forEach configProperties [_cfgGrid, "isClass _x", false];
|
||||
|
||||
private _letterGrid = false;
|
||||
|
||||
|
@ -25,8 +25,7 @@ if (_unit isKindOf "CAManBase") then {
|
||||
} else {
|
||||
{
|
||||
_return = _return + ({_x == _magazine} count magazines _x);
|
||||
false
|
||||
} count crew _unit;
|
||||
} forEach crew _unit;
|
||||
|
||||
(getMagazineCargo _unit) params [["_magNames", []], ["_magCount", []]];
|
||||
{
|
||||
|
@ -32,7 +32,6 @@ scopeName "main";
|
||||
if (_x select 0 == _name) then {
|
||||
_x breakOut "main";
|
||||
};
|
||||
false
|
||||
} count GVAR(settings);
|
||||
} forEach GVAR(settings);
|
||||
|
||||
[]
|
||||
|
@ -24,7 +24,6 @@ scopeName "main";
|
||||
|
||||
{
|
||||
if (_unit == (_vehicle turretUnit _x)) then {_x breakOut "main"};
|
||||
nil
|
||||
} count allTurrets [_vehicle, true];
|
||||
} forEach allTurrets [_vehicle, true];
|
||||
|
||||
[]
|
||||
|
@ -33,7 +33,6 @@ private _crew = [];
|
||||
_crew pushBack (_x select 0);
|
||||
};
|
||||
};
|
||||
false
|
||||
} count fullCrew _vehicle;
|
||||
} forEach fullCrew _vehicle;
|
||||
|
||||
_crew
|
||||
|
@ -29,7 +29,6 @@ private _modes = [];
|
||||
if (_x == "this") then {
|
||||
_modes pushBack _weapon;
|
||||
};
|
||||
false
|
||||
} count getArray (_config >> "modes");
|
||||
} forEach getArray (_config >> "modes");
|
||||
|
||||
_modes
|
||||
|
@ -42,7 +42,6 @@ private _ammo = _muzzles apply {0};
|
||||
_ammo set [_index, _x select 1];
|
||||
};
|
||||
};
|
||||
false
|
||||
} count magazinesAmmoFull _unit;
|
||||
} forEach magazinesAmmoFull _unit;
|
||||
|
||||
[_attachments, _muzzles, _magazines, _ammo];
|
||||
|
104
addons/common/functions/fnc_getWheelHitPointsWithSelections.sqf
Normal file
104
addons/common/functions/fnc_getWheelHitPointsWithSelections.sqf
Normal file
@ -0,0 +1,104 @@
|
||||
#include "..\script_component.hpp"
|
||||
/*
|
||||
* Author: commy2, johnb43
|
||||
* Returns the wheel hitpoints and their selections.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Vehicle <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* 0: Wheel hitpoints <ARRAY>
|
||||
* 1: Wheel hitpoint selections <ARRAY>
|
||||
*
|
||||
* Example:
|
||||
* cursorObject call ace_common_fnc_getWheelHitPointsWithSelections
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
params ["_vehicle"];
|
||||
TRACE_1("params",_vehicle);
|
||||
|
||||
// TODO: Fix for GM vehicles
|
||||
GVAR(wheelSelections) getOrDefaultCall [typeOf _vehicle, {
|
||||
// Get the vehicles wheel config
|
||||
private _wheels = configOf _vehicle >> "Wheels";
|
||||
|
||||
if (isClass _wheels) then {
|
||||
// Get all hitpoints and selections
|
||||
(getAllHitPointsDamage _vehicle) params ["_hitPoints", "_hitPointSelections"];
|
||||
|
||||
// Get all wheels and read selections from config
|
||||
_wheels = "true" configClasses _wheels;
|
||||
|
||||
private _wheelHitPoints = [];
|
||||
private _wheelHitPointSelections = [];
|
||||
|
||||
{
|
||||
private _wheelName = configName _x;
|
||||
private _wheelCenter = getText (_x >> "center");
|
||||
private _wheelBone = getText (_x >> "boneName");
|
||||
private _wheelBoneNameResized = _wheelBone select [0, 9]; // Count "wheel_X_Y"; // this is a requirement for physx. Should work for all addon vehicles.
|
||||
|
||||
TRACE_4("",_wheelName,_wheelCenter,_wheelBone,_wheelBoneNameResized);
|
||||
|
||||
private _wheelHitPoint = "";
|
||||
private _wheelHitPointSelection = "";
|
||||
|
||||
// Commy's orginal method
|
||||
{
|
||||
if ((_wheelBoneNameResized != "") && {_x find _wheelBoneNameResized == 0}) exitWith { // same as above. Requirement for physx.
|
||||
_wheelHitPoint = _hitPoints select _forEachIndex;
|
||||
_wheelHitPointSelection = _hitPointSelections select _forEachIndex;
|
||||
TRACE_2("wheel found [Orginal]",_wheelName,_wheelHitPoint);
|
||||
};
|
||||
} forEach _hitPointSelections;
|
||||
|
||||
|
||||
if (_vehicle isKindOf "Car") then {
|
||||
// Backup method, search for the closest hitpoint to the wheel's center selection pos.
|
||||
// Ref #2742 - RHS's HMMWV
|
||||
if (_wheelHitPoint == "") then {
|
||||
private _wheelCenterPos = _vehicle selectionPosition _wheelCenter;
|
||||
if (_wheelCenterPos isEqualTo [0, 0, 0]) exitWith {TRACE_1("no center?",_wheelCenter);};
|
||||
|
||||
|
||||
private _bestDist = 99;
|
||||
private _bestIndex = -1;
|
||||
{
|
||||
if (_x != "") then {
|
||||
// Filter out things that definitly aren't wheeels (#3759)
|
||||
if ((toLowerANSI (_hitPoints select _forEachIndex)) in ["hitengine", "hitfuel", "hitbody"]) exitWith {TRACE_1("filter",_x)};
|
||||
private _xPos = _vehicle selectionPosition _x;
|
||||
if (_xPos isEqualTo [0, 0, 0]) exitWith {};
|
||||
private _xDist = _wheelCenterPos distance _xPos;
|
||||
if (_xDist < _bestDist) then {
|
||||
_bestIndex = _forEachIndex;
|
||||
_bestDist = _xDist;
|
||||
};
|
||||
};
|
||||
} forEach _hitPointSelections;
|
||||
|
||||
TRACE_2("closestPoint",_bestDist,_bestIndex);
|
||||
if (_bestIndex != -1) then {
|
||||
_wheelHitPoint = _hitPoints select _bestIndex;
|
||||
_wheelHitPointSelection = _hitPointSelections select _bestIndex;
|
||||
TRACE_2("wheel found [Backup]",_wheelName,_wheelHitPoint);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
if ((_wheelHitPoint != "") && {_wheelHitPointSelection != ""}) then {
|
||||
_wheelHitPoints pushBack _wheelHitPoint;
|
||||
_wheelHitPointSelections pushBack _wheelHitPointSelection;
|
||||
};
|
||||
} forEach _wheels;
|
||||
|
||||
[_wheelHitPoints, _wheelHitPointSelections]
|
||||
} else {
|
||||
// Exit with nothing if the vehicle has no wheels class
|
||||
TRACE_1("No Wheels",_wheels);
|
||||
|
||||
[[], []]
|
||||
}
|
||||
}, true] // return
|
@ -28,8 +28,7 @@ if (isNil QGVAR(LSD_Vehicles)) then {
|
||||
if (_hSCount > 0) then {
|
||||
GVAR(LSD_Vehicles) pushBack [_x, _hSCount];
|
||||
};
|
||||
nil
|
||||
} count _units;
|
||||
} forEach _units;
|
||||
|
||||
if (isNil QGVAR(LSD_Colors)) then {
|
||||
GVAR(LSD_Colors) = [
|
||||
@ -51,8 +50,7 @@ if (isNil QGVAR(LSD_PFH)) then {
|
||||
for "_i" from 0 to (_hSCount - 1) do {
|
||||
_vehicle setObjectTexture [_i, GVAR(LSD_Colors) select _index];
|
||||
};
|
||||
nil
|
||||
} count GVAR(LSD_Vehicles);
|
||||
} forEach GVAR(LSD_Vehicles);
|
||||
|
||||
_index = ((_index + 1) % 7) mod count GVAR(LSD_Colors);
|
||||
(_this select 0) set [0, _index];
|
||||
|
@ -32,8 +32,7 @@ private _whitespaceList = [];
|
||||
} else {
|
||||
_whitespaceList pushBack ([_x] call CBA_fnc_trim);
|
||||
};
|
||||
false
|
||||
} count _list;
|
||||
} forEach _list;
|
||||
|
||||
_list = _whitespaceList;
|
||||
TRACE_1("Whitespace List",_list);
|
||||
@ -46,8 +45,7 @@ if (_checkNil) then {
|
||||
if (!isNil _x) then {
|
||||
_nilCheckedList pushBack (missionNamespace getVariable _x);
|
||||
};
|
||||
false
|
||||
} count _list;
|
||||
} forEach _list;
|
||||
|
||||
_list = _nilCheckedList;
|
||||
};
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user