From 4092dddcbe9543ad689484740ed84be226bff2ea Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Tue, 10 Sep 2024 09:25:36 +0200 Subject: [PATCH 001/188] SPE Compat - Make 50Rnd M1919 & M2 100Rnd belts linkable (#10301) Tweaked SPE belts --- addons/compat_spe/CfgMagazines/csw.hpp | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/addons/compat_spe/CfgMagazines/csw.hpp b/addons/compat_spe/CfgMagazines/csw.hpp index 404156bd8f8..9fa46140899 100644 --- a/addons/compat_spe/CfgMagazines/csw.hpp +++ b/addons/compat_spe/CfgMagazines/csw.hpp @@ -2,43 +2,29 @@ class CA_Magazine; // M1919A4/A6 class SPE_50Rnd_762x63: CA_Magazine { - ACE_isBelt = 0; -}; - -class SPE_100Rnd_762x63: SPE_50Rnd_762x63 { ACE_isBelt = 1; }; -class SPE_100Rnd_762x63_M1: SPE_100Rnd_762x63 { +// M2 +class VehicleMagazine; +class SPE_100Rnd_127x99_M2: VehicleMagazine { ACE_isBelt = 1; }; -class SPE_100Rnd_762x63_M2_AP: SPE_100Rnd_762x63 { - ACE_isBelt = 1; -}; - -//MG34/42 - +// MG34/42 class SPE_50Rnd_792x57: CA_Magazine { ACE_isBelt = 0; }; - -class SPE_50Rnd_792x57_sS: SPE_50Rnd_792x57 { - ACE_isBelt = 0; -}; - -class SPE_50Rnd_792x57_SMK: SPE_50Rnd_792x57_sS { - ACE_isBelt = 0; -}; - class SPE_100Rnd_792x57: SPE_50Rnd_792x57 { ACE_isBelt = 1; }; +class SPE_50Rnd_792x57_sS; class SPE_100Rnd_792x57_sS: SPE_50Rnd_792x57_sS { ACE_isBelt = 1; }; +class SPE_50Rnd_792x57_SMK; class SPE_100Rnd_792x57_SMK: SPE_50Rnd_792x57_SMK { ACE_isBelt = 1; }; From 4abae0fcb53b2a48c8794faeaca20e0e7d6b45f1 Mon Sep 17 00:00:00 2001 From: OverlordZorn <56258612+OverlordZorn@users.noreply.github.com> Date: Wed, 11 Sep 2024 23:43:20 +0200 Subject: [PATCH 002/188] Nightvision - Fixes Exploit with FogScaling (#10299) Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> --- addons/nightvision/functions/fnc_pfeh.sqf | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/nightvision/functions/fnc_pfeh.sqf b/addons/nightvision/functions/fnc_pfeh.sqf index dbd101631cd..9d5f6e93bb8 100644 --- a/addons/nightvision/functions/fnc_pfeh.sqf +++ b/addons/nightvision/functions/fnc_pfeh.sqf @@ -163,7 +163,9 @@ if (CBA_missionTime < GVAR(nextEffectsUpdate)) then { }; _fogApply = linearConversion [0, 1, GVAR(priorFog) select 0, (GVAR(fogScaling) * _fogApply), 1]; // mix in old fog if present - GVAR(nvgFog) = [_fogApply, 0, 0]; + GVAR(nvgFog) = fogParams; + GVAR(nvgFog) set [0, _fogApply]; + 0 setFog GVAR(nvgFog) }; From 5d4f1cd1c7f172d0bfab4abfa748930cdc46d375 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Wed, 11 Sep 2024 16:43:31 -0500 Subject: [PATCH 003/188] General - Optimize some if statements (#10302) --- addons/common/functions/fnc_claim.sqf | 6 +++--- addons/common/functions/fnc_getDeathAnim.sqf | 6 +++--- .../functions/fnc_getActionOffset.sqf | 8 ++++---- .../functions/fnc_getRemainingWater.sqf | 8 ++++---- .../functions/fnc_applyRotorWashEffect.sqf | 10 +++++----- addons/interact_menu/functions/fnc_keyDown.sqf | 14 +++++++------- .../functions/fnc_renderActionPoints.sqf | 15 ++++++++------- addons/laser/XEH_postInit.sqf | 6 +++--- .../medical_engine/functions/fnc_handleDamage.sqf | 10 +++++----- .../functions/fnc_showApplicationPage.sqf | 2 +- addons/missileguidance/functions/fnc_checkLos.sqf | 6 +++--- .../functions/fnc_seekerType_SACLOS.sqf | 8 ++++---- addons/nametags/functions/fnc_drawNameTagIcon.sqf | 6 +++--- addons/nametags/functions/fnc_onDraw3d.sqf | 6 +++--- .../functions/fnc_addFreeSeatsActions.sqf | 8 ++++---- .../fnc_calculateZeroAngleCorrection.sqf | 6 +++--- addons/spectator/functions/fnc_cam_tick.sqf | 6 +++--- .../functions/fnc_handleVehicleDamage.sqf | 6 +++--- addons/volume/XEH_postInitClient.sqf | 6 +++--- 19 files changed, 72 insertions(+), 71 deletions(-) diff --git a/addons/common/functions/fnc_claim.sqf b/addons/common/functions/fnc_claim.sqf index 997d54f33b8..170c2c6a8f3 100644 --- a/addons/common/functions/fnc_claim.sqf +++ b/addons/common/functions/fnc_claim.sqf @@ -30,10 +30,10 @@ _target setVariable [QGVAR(owner), _unit, true]; // lock target object if (_lockTarget) then { - if (!isNull _unit) then { - [QGVAR(lockVehicle), _target, _target] call CBA_fnc_targetEvent; - } else { + if (isNull _unit) then { [QGVAR(unlockVehicle), _target, _target] call CBA_fnc_targetEvent; + } else { + [QGVAR(lockVehicle), _target, _target] call CBA_fnc_targetEvent; }; }; diff --git a/addons/common/functions/fnc_getDeathAnim.sqf b/addons/common/functions/fnc_getDeathAnim.sqf index 18c6c93c074..4e0b0578729 100644 --- a/addons/common/functions/fnc_getDeathAnim.sqf +++ b/addons/common/functions/fnc_getDeathAnim.sqf @@ -29,7 +29,9 @@ private _unitActionsCfg = configFile >> "CfgMovesBasic" >> "Actions" >> getText TRACE_2("Animation/Action",configName _unitAnimationCfg,configName _unitActionsCfg); -if (!isNull objectParent _unit) then { +if (isNull objectParent _unit) then { + _returnAnimation = getText (_unitActionsCfg >> "die"); +} else { private _interpolateArray = getArray (_unitAnimationCfg >> "interpolateTo"); for "_index" from 0 to (count _interpolateArray - 1) step 2 do { @@ -42,8 +44,6 @@ if (!isNull objectParent _unit) then { _returnAnimation = _indexAnimation; }; }; -} else { - _returnAnimation = getText (_unitActionsCfg >> "die"); }; //Fallback if nothing valid found: diff --git a/addons/field_rations/functions/fnc_getActionOffset.sqf b/addons/field_rations/functions/fnc_getActionOffset.sqf index dd7658dfda1..763654c6559 100644 --- a/addons/field_rations/functions/fnc_getActionOffset.sqf +++ b/addons/field_rations/functions/fnc_getActionOffset.sqf @@ -18,11 +18,11 @@ params ["_object"]; private _configOf = configOf _object; -if !(isNull _configOf) then { +if (isNull _configOf) then { + // Check for offset corresponding to p3d list + GVAR(waterSourceOffsets) param [GVAR(waterSourceP3ds) find (getModelInfo _object select 0), [0, 0, 0], [[]]]; +} else { // Check for offset in config since we have valid typeOf private _offset = getArray (_configOf >> QXGVAR(offset)); if (_offset isEqualTo []) then {[0, 0, 0]} else {_offset}; -} else { - // Check for offset corresponding to p3d list - GVAR(waterSourceOffsets) param [GVAR(waterSourceP3ds) find (getModelInfo _object select 0), [0, 0, 0], [[]]]; }; diff --git a/addons/field_rations/functions/fnc_getRemainingWater.sqf b/addons/field_rations/functions/fnc_getRemainingWater.sqf index 253fd62285d..1011136e0ce 100644 --- a/addons/field_rations/functions/fnc_getRemainingWater.sqf +++ b/addons/field_rations/functions/fnc_getRemainingWater.sqf @@ -23,7 +23,10 @@ private _water = _source getVariable QGVAR(currentWaterSupply); if (isNil "_water") then { private _configOf = configOf _source; - if !(isNull _configOf) then { + if (isNull _configOf) then { + // Check the p3d name against list + _water = if ((getModelInfo _source select 0) in GVAR(waterSourceP3ds)) then {REFILL_WATER_INFINITE} else {REFILL_WATER_DISABLED}; + } else { // Check for waterSupply entry since we have valid typeOf _water = getNumber (_configOf >> QXGVAR(waterSupply)); if (_water == 0) then {_water = REFILL_WATER_DISABLED}; @@ -35,9 +38,6 @@ if (isNil "_water") then { _source setVariable [QGVAR(currentWaterSupply), _water, true]; }; }; - } else { - // Check the p3d name against list - _water = if ((getModelInfo _source select 0) in GVAR(waterSourceP3ds)) then {REFILL_WATER_INFINITE} else {REFILL_WATER_DISABLED}; }; }; diff --git a/addons/goggles/functions/fnc_applyRotorWashEffect.sqf b/addons/goggles/functions/fnc_applyRotorWashEffect.sqf index 341adcecdde..5a77a16ce91 100644 --- a/addons/goggles/functions/fnc_applyRotorWashEffect.sqf +++ b/addons/goggles/functions/fnc_applyRotorWashEffect.sqf @@ -64,14 +64,14 @@ if !(_safe) then { if !([_unit] call FUNC(isGogglesVisible)) exitWith {}; if (GETDUSTT(DAMOUNT) < 2) then { - if !(GETDUSTT(DACTIVE)) then { - SETDUST(DACTIVE,true); - - call FUNC(applyDustEffect); - } else { + if (GETDUSTT(DACTIVE)) then { if (_rotorWash select 1 > 0.5) then { call FUNC(applyDustEffect); }; + } else { + SETDUST(DACTIVE,true); + + call FUNC(applyDustEffect); }; }; diff --git a/addons/interact_menu/functions/fnc_keyDown.sqf b/addons/interact_menu/functions/fnc_keyDown.sqf index 2d15715b953..d87f6cfa3ba 100644 --- a/addons/interact_menu/functions/fnc_keyDown.sqf +++ b/addons/interact_menu/functions/fnc_keyDown.sqf @@ -116,13 +116,7 @@ GVAR(selfMenuOffset) = (AGLToASL (positionCameraToWorld [0, 0, 2])) vectorDiff ( //Auto expand the first level when self, mounted vehicle or zeus (skips the first animation as there is only one choice) if (GVAR(openedMenuType) == 0) then { if (isNull curatorCamera) then { - if !(isNull (ACE_controlledUAV select 0)) then { - GVAR(menuDepthPath) = [["ACE_SelfActions", (ACE_controlledUAV select 0)]]; - GVAR(expanded) = true; - GVAR(expandedTime) = diag_tickTime; - GVAR(lastPath) = +GVAR(menuDepthPath); - GVAR(startHoverTime) = -1000; - } else { + if (isNull (ACE_controlledUAV select 0)) then { if (vehicle ACE_player != ACE_player) then { GVAR(menuDepthPath) = [["ACE_SelfActions", (vehicle ACE_player)]]; GVAR(expanded) = true; @@ -130,6 +124,12 @@ if (GVAR(openedMenuType) == 0) then { GVAR(lastPath) = +GVAR(menuDepthPath); GVAR(startHoverTime) = -1000; }; + } else { + GVAR(menuDepthPath) = [["ACE_SelfActions", (ACE_controlledUAV select 0)]]; + GVAR(expanded) = true; + GVAR(expandedTime) = diag_tickTime; + GVAR(lastPath) = +GVAR(menuDepthPath); + GVAR(startHoverTime) = -1000; }; } else { GVAR(menuDepthPath) = [["ACE_ZeusActions", (getAssignedCuratorLogic player)]]; diff --git a/addons/interact_menu/functions/fnc_renderActionPoints.sqf b/addons/interact_menu/functions/fnc_renderActionPoints.sqf index 492f8b73c9a..502e4de6f94 100644 --- a/addons/interact_menu/functions/fnc_renderActionPoints.sqf +++ b/addons/interact_menu/functions/fnc_renderActionPoints.sqf @@ -97,11 +97,11 @@ private _fnc_renderSelfActions = { // Iterate through base level class actions and render them if appropiate private _classActions = GVAR(ActSelfNamespace) get typeOf _target; - private _pos = if !(GVAR(useCursorMenu)) then { + private _pos = if (GVAR(useCursorMenu)) then { + [0.5, 0.5] + } else { //Convert to ASL, add offset and then convert back to AGL (handles waves when over water) ASLToAGL ((AGLToASL (positionCameraToWorld [0, 0, 0])) vectorAdd GVAR(selfMenuOffset)); - } else { - [0.5, 0.5] }; { @@ -123,10 +123,7 @@ GVAR(collectedActionPoints) resize 0; // Render nearby actions, unit self actions or vehicle self actions as appropiate if (GVAR(openedMenuType) == 0) then { if (isNull curatorCamera) then { - if !(isNull (ACE_controlledUAV select 0)) then { - // Render UAV self actions when in control of UAV AI - (ACE_controlledUAV select 0) call _fnc_renderSelfActions; - } else { + if (isNull (ACE_controlledUAV select 0)) then { if (vehicle ACE_player == ACE_player) then { if (diag_tickTime > GVAR(lastTimeSearchedActions) + 0.20) then { // Once every 0.2 secs, collect nearby objects active and visible action points and render them @@ -139,6 +136,10 @@ if (GVAR(openedMenuType) == 0) then { // Render vehicle self actions when in vehicle (vehicle ACE_player) call _fnc_renderSelfActions; }; + } else { + // Render UAV self actions when in control of UAV AI + (ACE_controlledUAV select 0) call _fnc_renderSelfActions; + }; } else { // Render zeus actions when zeus open diff --git a/addons/laser/XEH_postInit.sqf b/addons/laser/XEH_postInit.sqf index 768752bee2e..eb4cb247ed7 100644 --- a/addons/laser/XEH_postInit.sqf +++ b/addons/laser/XEH_postInit.sqf @@ -21,10 +21,10 @@ if (hasInterface) then { ["ACE_controlledUAV", { params ["_UAV", "_seatAI", "_turret", "_position"]; TRACE_4("ACE_controlledUAV EH",_UAV,_seatAI,_turret,_position); - if (!isNull _seatAI) then { - [_seatAI] call FUNC(showVehicleHud); - } else { + if (isNull _seatAI) then { [ace_player] call FUNC(showVehicleHud); + } else { + [_seatAI] call FUNC(showVehicleHud); }; }] call CBA_fnc_addEventHandler; }] call CBA_fnc_addEventHandler; diff --git a/addons/medical_engine/functions/fnc_handleDamage.sqf b/addons/medical_engine/functions/fnc_handleDamage.sqf index 95e48fcc3e4..591e68e2533 100644 --- a/addons/medical_engine/functions/fnc_handleDamage.sqf +++ b/addons/medical_engine/functions/fnc_handleDamage.sqf @@ -165,7 +165,11 @@ if (_context == 2) then { if (_environmentDamage) then { // Any collision with terrain/vehicle/object has a shooter // Check this first because burning can happen at any velocity - if !(isNull _shooter) then { + if (isNull _shooter) then { + // Anything else is almost guaranteed to be fire damage + _ammo = "fire"; + TRACE_5("Fire Damage",_unit,_shooter,_instigator,_damage,_allDamages); + } else { /* If shooter != unit then they hit unit, otherwise it could be: - Unit hitting anything at speed @@ -180,10 +184,6 @@ if (_context == 2) then { _ammo = "collision"; TRACE_5("Collision",_unit,_shooter,_instigator,_damage,_allDamages); }; - } else { - // Anything else is almost guaranteed to be fire damage - _ammo = "fire"; - TRACE_5("Fire Damage",_unit,_shooter,_instigator,_damage,_allDamages); }; }; diff --git a/addons/microdagr/functions/fnc_showApplicationPage.sqf b/addons/microdagr/functions/fnc_showApplicationPage.sqf index 75f817ad3f3..e150bf2261a 100644 --- a/addons/microdagr/functions/fnc_showApplicationPage.sqf +++ b/addons/microdagr/functions/fnc_showApplicationPage.sqf @@ -57,7 +57,7 @@ if (GVAR(currentApplicationPage) == APP_MODE_INFODISPLAY) then { (_display displayCtrl IDC_MAPDETAILS) ctrlShow ((GVAR(currentApplicationPage) == APP_MODE_MAP) && {GVAR(mapShowTexture)}); if (GVAR(currentApplicationPage) == APP_MODE_MAP) then { - _theMap = if (!GVAR(mapShowTexture)) then {_display displayCtrl IDC_MAPPLAIN} else {_display displayCtrl IDC_MAPDETAILS}; + _theMap = if (GVAR(mapShowTexture)) then {_display displayCtrl IDC_MAPDETAILS} else {_display displayCtrl IDC_MAPPLAIN}; _mapSize = (ctrlPosition _theMap) select 3; _theMap ctrlMapAnimAdd [0, (GVAR(mapZoom) / _mapSize), GVAR(mapPosition)]; ctrlMapAnimCommit _theMap; diff --git a/addons/missileguidance/functions/fnc_checkLos.sqf b/addons/missileguidance/functions/fnc_checkLos.sqf index 242b595ab8f..152c7c24074 100644 --- a/addons/missileguidance/functions/fnc_checkLos.sqf +++ b/addons/missileguidance/functions/fnc_checkLos.sqf @@ -34,12 +34,12 @@ private _targetAimPos = aimPos _target; private _seekerPos = getPosASL _seeker; private _return = true; -if (!((terrainIntersectASL [_seekerPos, _targetPos]) && {terrainIntersectASL [_seekerPos, _targetAimPos]})) then { +if ((terrainIntersectASL [_seekerPos, _targetPos]) && {terrainIntersectASL [_seekerPos, _targetAimPos]}) then { + _return = false; +} else { if (lineIntersects [_seekerPos, _targetPos, _seeker, _target]) then { _return = false; }; -} else { - _return = false; }; _return diff --git a/addons/missileguidance/functions/fnc_seekerType_SACLOS.sqf b/addons/missileguidance/functions/fnc_seekerType_SACLOS.sqf index 1641ff4a7df..d9fd444043f 100644 --- a/addons/missileguidance/functions/fnc_seekerType_SACLOS.sqf +++ b/addons/missileguidance/functions/fnc_seekerType_SACLOS.sqf @@ -25,7 +25,10 @@ _seekerStateParams params ["_memoryPointGunnerOptics", "_animationSourceBody", " private _shooterPos = AGLToASL (_shooter modelToWorldVisual (_shooter selectionPosition _memoryPointGunnerOptics)); private _projPos = getPosASL _projectile; -private _lookDirection = if !(_shooter isKindOf "CAManBase" || {_shooter isKindOf "StaticWeapon"}) then { +private _lookDirection = if (_shooter isKindOf "CAManBase" || {_shooter isKindOf "StaticWeapon"}) then { + _shooterPos = eyePos _shooter; + _shooter weaponDirection _weapon +} else { private _finalLookDirection = if (_usePilotCamera) then { _shooterPos = _shooter modelToWorldVisualWorld getPilotCameraPosition _shooter; private _trackingTarget = getPilotCameraTarget _shooter; @@ -43,9 +46,6 @@ private _lookDirection = if !(_shooter isKindOf "CAManBase" || {_shooter isKindO _shooter vectorModelToWorldVisual ([1, _gBody, _gGun] call CBA_fnc_polar2vect); }; _finalLookDirection -} else { - _shooterPos = eyePos _shooter; - _shooter weaponDirection _weapon }; private _distanceToProj = _shooterPos vectorDistance _projPos; diff --git a/addons/nametags/functions/fnc_drawNameTagIcon.sqf b/addons/nametags/functions/fnc_drawNameTagIcon.sqf index efe0c6bf157..26ef2584ead 100644 --- a/addons/nametags/functions/fnc_drawNameTagIcon.sqf +++ b/addons/nametags/functions/fnc_drawNameTagIcon.sqf @@ -44,11 +44,11 @@ _fnc_parameters = { private _targetFaction = _target getVariable [QGVAR(faction), faction _target]; private _customRankIcons = GVAR(factionRanks) get _targetFaction; - if (!isNil "_customRankIcons") then { - _customRankIcons param [ALL_RANKS find rank _target, ""] // return - } else { + if (isNil "_customRankIcons") then { // default rank icons format ["\A3\Ui_f\data\GUI\Cfg\Ranks\%1_gs.paa", rank _target] // return + } else { + _customRankIcons param [ALL_RANKS find rank _target, ""] // return }; }; }; diff --git a/addons/nametags/functions/fnc_onDraw3d.sqf b/addons/nametags/functions/fnc_onDraw3d.sqf index 4fbbc7ee1c7..e169eb72692 100644 --- a/addons/nametags/functions/fnc_onDraw3d.sqf +++ b/addons/nametags/functions/fnc_onDraw3d.sqf @@ -44,10 +44,10 @@ if (_enabledTagsCursor) then { private _target = cursorTarget; if !(_target isKindOf "CAManBase") then { // When cursorTarget is on a vehicle show the nametag for the commander. - if !(_target in allUnitsUAV) then { - _target = effectiveCommander _target; - } else { + if (_target in allUnitsUAV) then { _target = objNull; + } else { + _target = effectiveCommander _target; }; }; if (isNull _target) exitWith {}; diff --git a/addons/quickmount/functions/fnc_addFreeSeatsActions.sqf b/addons/quickmount/functions/fnc_addFreeSeatsActions.sqf index 0a3a7a2dc1a..efb40d2ac1a 100644 --- a/addons/quickmount/functions/fnc_addFreeSeatsActions.sqf +++ b/addons/quickmount/functions/fnc_addFreeSeatsActions.sqf @@ -202,15 +202,15 @@ private _cargoNumber = -1; if (_vehicle lockedTurret _turretPath) then {breakTo "crewLoop"}; if (_role == "gunner" && {unitIsUAV _vehicle}) then {breakTo "crewLoop"}; private _turretConfig = [_vehicleConfig, _turretPath] call CBA_fnc_getTurret; - if (!_isInVehicle) then { - _params = ["GetInTurret", _vehicle, _turretPath]; - _statement = {_player action (_this select 2)}; - } else { + if (_isInVehicle) then { private _gunnerCompartments = (_turretConfig >> "gunnerCompartments") call BIS_fnc_getCfgData; TO_COMPARTMENT_STRING(_gunnerCompartments); if (_compartment != _gunnerCompartments) then {breakTo "crewLoop"}; _params = [{MOVE_IN_CODE(moveInTurret)}, [_vehicle, _turretPath], _currentTurret, _moveBackCode, _moveBackParams]; _statement = _fnc_move; + } else { + _params = ["GetInTurret", _vehicle, _turretPath]; + _statement = {_player action (_this select 2)}; }; _name = getText (_turretConfig >> "gunnerName"); _icon = switch true do { diff --git a/addons/scopes/functions/fnc_calculateZeroAngleCorrection.sqf b/addons/scopes/functions/fnc_calculateZeroAngleCorrection.sqf index ed1222e3bbc..670a119f839 100644 --- a/addons/scopes/functions/fnc_calculateZeroAngleCorrection.sqf +++ b/addons/scopes/functions/fnc_calculateZeroAngleCorrection.sqf @@ -42,9 +42,7 @@ private _vanillaZero = parseNumber (("ace" callExtension ["ballistics:replicate_ _vanillaZero = 0; #endif -private _trueZero = if (!_advancedBallistics) then { - parseNumber (("ace" callExtension ["ballistics:zero_vanilla", [_newZeroRange, _initSpeed, _airFriction, _boreHeight]]) select 0) -} else { +private _trueZero = if (_advancedBallistics) then { // Get Weapon and Ammo Configurations private _AmmoCacheEntry = uiNamespace getVariable format[QEGVAR(advanced_ballistics,%1), _ammo]; if (isNil "_AmmoCacheEntry") then { @@ -81,6 +79,8 @@ private _trueZero = if (!_advancedBallistics) then { _atmosphereModel ]]) select 0 ) +} else { + parseNumber (("ace" callExtension ["ballistics:zero_vanilla", [_newZeroRange, _initSpeed, _airFriction, _boreHeight]]) select 0) }; private _zeroAngleCorrection = _trueZero - _vanillaZero; diff --git a/addons/spectator/functions/fnc_cam_tick.sqf b/addons/spectator/functions/fnc_cam_tick.sqf index 1e7e1b99137..11f257b7d5a 100644 --- a/addons/spectator/functions/fnc_cam_tick.sqf +++ b/addons/spectator/functions/fnc_cam_tick.sqf @@ -58,7 +58,9 @@ if (_cameraMode != MODE_FREE) then { _camTarget = GVAR(camFocus); // Focus get in / out of vehicle state -if !(isNull _camTarget) then { +if (isNull _camTarget) then { + GVAR(camTargetInVehicle) = false; +} else { private _targetInVeh = GVAR(camTargetInVehicle); if (GVAR(camHasTarget)) then { @@ -72,8 +74,6 @@ if !(isNull _camTarget) then { GVAR(camTargetInVehicle) = false; }; }; -} else { - GVAR(camTargetInVehicle) = false; }; // Camera lights diff --git a/addons/vehicle_damage/functions/fnc_handleVehicleDamage.sqf b/addons/vehicle_damage/functions/fnc_handleVehicleDamage.sqf index 4654b616d06..b0540de484f 100644 --- a/addons/vehicle_damage/functions/fnc_handleVehicleDamage.sqf +++ b/addons/vehicle_damage/functions/fnc_handleVehicleDamage.sqf @@ -75,14 +75,14 @@ if (isNil "_multHit") then { _ignoreHit = true; } else { // If the hitpoint isnt in the old array then that means that the time expired and a new array should be generated - if (!_hitPointInOldArray) then { + if (_hitPointInOldArray) then { + _vehicle setVariable [QGVAR(hitTime), [CBA_missionTime, _source, [_hitPoint]]]; + } else { private _oldHitPoints = _multHit select 2; _oldHitPoints pushBack _hitPoint; _vehicle setVariable [QGVAR(hitTime), [CBA_missionTime, _source, _oldHitPoints]]; _ignoreBailCheck = true; - } else { - _vehicle setVariable [QGVAR(hitTime), [CBA_missionTime, _source, [_hitPoint]]]; }; }; }; diff --git a/addons/volume/XEH_postInitClient.sqf b/addons/volume/XEH_postInitClient.sqf index 896bb718f8d..ae774f2f51d 100644 --- a/addons/volume/XEH_postInitClient.sqf +++ b/addons/volume/XEH_postInitClient.sqf @@ -23,10 +23,10 @@ if (!hasInterface) exitWith {}; if (!XGVAR(lowerInVehicles)) exitWith {}; - if (!isNull objectParent _unit) then { - call FUNC(lowerVolume); - } else { + if (isNull objectParent _unit) then { call FUNC(restoreVolume); + } else { + call FUNC(lowerVolume); }; }] call CBA_fnc_addPlayerEventHandler; From 07f10b976a73bd23b52e7c87229bf28d70f18f5f Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Wed, 11 Sep 2024 23:43:50 +0200 Subject: [PATCH 004/188] Medical Engine - Fix limping not applying with open wounds (#10307) --- addons/medical_engine/functions/fnc_updateDamageEffects.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical_engine/functions/fnc_updateDamageEffects.sqf b/addons/medical_engine/functions/fnc_updateDamageEffects.sqf index 7dc73e04f47..f4a18094a60 100644 --- a/addons/medical_engine/functions/fnc_updateDamageEffects.sqf +++ b/addons/medical_engine/functions/fnc_updateDamageEffects.sqf @@ -67,7 +67,7 @@ if (!_isLimping && {EGVAR(medical,limping) > 0}) then { (_xAmountOf > 0) && {_xDamage > LIMPING_DAMAGE_THRESHOLD} // select _causeLimping from woundDetails - && {(EGVAR(medical_damage,woundDetails) get (_xClassID / 10)) select 3} + && {(EGVAR(medical_damage,woundDetails) get (floor (_xClassID / 10))) select 3} ) exitWith { TRACE_1("limping because of wound",_x); _isLimping = true; From 39ad959ad545c4098a2060eb1a3e39f3c1195815 Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Wed, 11 Sep 2024 23:46:07 +0200 Subject: [PATCH 005/188] CSW - Take individual components into account for disassembly (#10300) --- addons/csw/functions/fnc_assemble_deployWeapon.sqf | 11 ++++++----- addons/csw/functions/fnc_assemble_pickupWeapon.sqf | 10 +++++++--- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/addons/csw/functions/fnc_assemble_deployWeapon.sqf b/addons/csw/functions/fnc_assemble_deployWeapon.sqf index f852a1954af..a0cdc102ca8 100644 --- a/addons/csw/functions/fnc_assemble_deployWeapon.sqf +++ b/addons/csw/functions/fnc_assemble_deployWeapon.sqf @@ -49,7 +49,7 @@ private _onFinish = { params ["_args"]; - _args params ["_tripod", "_player", "_assembledClassname", "", "_carryWeaponInfo"]; + _args params ["_tripod", "_player", "_assembledClassname", "_tripodClassname", "_carryWeaponClassname", "_carryWeaponInfo"]; TRACE_3("deployWeapon finish",_tripod,_player,_assembledClassname); private _secondaryWeaponMagazines = _tripod getVariable [QGVAR(secondaryWeaponMagazines), []]; @@ -61,10 +61,11 @@ _tripodPos set [2, (_tripodPos select 2) + 0.1]; // Delay a frame so tripod has a chance to be deleted [{ - params ["_assembledClassname", "_tripodDir", "_tripodPos", "_player", "_carryWeaponInfo", "_secondaryWeaponMagazines"]; + params ["_assembledClassname", "_componentClasses", "_tripodDir", "_tripodPos", "_player", "_carryWeaponInfo", "_secondaryWeaponMagazines"]; private _csw = createVehicle [_assembledClassname, [0, 0, 0], [], 0, "NONE"]; // Assembly mode: [0=disabled, 1=enabled, 2=enabled&unload, 3=default] _csw setVariable [QGVAR(assemblyMode), 2, true]; // Explicitly set advanced assembly mode + unload, and broadcast + _csw setVariable [QGVAR(componentClasses), _componentClasses, true]; { // Magazines @@ -91,12 +92,12 @@ }; [QGVAR(deployWeaponSucceeded), [_csw]] call CBA_fnc_localEvent; TRACE_2("csw placed",_csw,_assembledClassname); - }, [_assembledClassname, _tripodDir, _tripodPos, _player, _carryWeaponInfo, _secondaryWeaponMagazines]] call CBA_fnc_execNextFrame; + }, [_assembledClassname, [_tripodClassname, _carryWeaponClassname], _tripodDir, _tripodPos, _player, _carryWeaponInfo, _secondaryWeaponMagazines]] call CBA_fnc_execNextFrame; }; private _onFailure = { params ["_args"]; - _args params ["", "_player", "", "_carryWeaponClassname", "_carryWeaponInfo"]; + _args params ["", "_player", "", "", "_carryWeaponClassname", "_carryWeaponInfo"]; TRACE_2("deployWeapon failure",_player,_carryWeaponClassname); // Add weapon back @@ -115,5 +116,5 @@ alive _tripod }; - [TIME_PROGRESSBAR(_deployTime), [_tripod, _player, _assembledClassname, _carryWeaponClassname, _carryWeaponInfo], _onFinish, _onFailure, LLSTRING(AssembleCSW_progressBar), _condition] call EFUNC(common,progressBar); + [TIME_PROGRESSBAR(_deployTime), [_tripod, _player, _assembledClassname, _tripodClassname, _carryWeaponClassname, _carryWeaponInfo], _onFinish, _onFailure, LLSTRING(AssembleCSW_progressBar), _condition] call EFUNC(common,progressBar); }, _this] call CBA_fnc_execNextFrame; diff --git a/addons/csw/functions/fnc_assemble_pickupWeapon.sqf b/addons/csw/functions/fnc_assemble_pickupWeapon.sqf index 867c151d278..023143710b6 100644 --- a/addons/csw/functions/fnc_assemble_pickupWeapon.sqf +++ b/addons/csw/functions/fnc_assemble_pickupWeapon.sqf @@ -21,14 +21,18 @@ TRACE_2("assemble_pickupWeapon",_vehicle,_player); private _weaponConfig = configOf _vehicle >> QUOTE(ADDON); - private _carryWeaponClassname = getText (_weaponConfig >> "disassembleWeapon"); + private _componentClasses = _vehicle getVariable QGVAR(componentClasses); + + (if (!isNil "_componentClasses") then { + _componentClasses + } else { + [getText (_weaponConfig >> "disassembleTurret"), getText (_weaponConfig >> "disassembleWeapon")] + }) params ["_turretClassname", "_carryWeaponClassname"]; if (!isClass (configFile >> "CfgWeapons" >> _carryWeaponClassname)) exitWith { ERROR_1("bad weapon classname [%1]",_carryWeaponClassname); }; - private _turretClassname = getText (_weaponConfig >> "disassembleTurret"); - // Turret classname can equal nothing if the deploy bag is the "whole" weapon. e.g Kornet, Metis, other ATGMs if ((_turretClassname != "") && {!isClass (configFile >> "CfgVehicles" >> _turretClassname)}) exitWith { ERROR_1("bad turret classname [%1]",_turretClassname); From 0f756dc18a2c161e08de5445156a8deffe191fbf Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Wed, 11 Sep 2024 23:46:37 +0200 Subject: [PATCH 006/188] SPE Compat - Make all German belts linkable (#10305) --- addons/compat_spe/CfgMagazines/csw.hpp | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/addons/compat_spe/CfgMagazines/csw.hpp b/addons/compat_spe/CfgMagazines/csw.hpp index 9fa46140899..6b4c385a42a 100644 --- a/addons/compat_spe/CfgMagazines/csw.hpp +++ b/addons/compat_spe/CfgMagazines/csw.hpp @@ -13,18 +13,5 @@ class SPE_100Rnd_127x99_M2: VehicleMagazine { // MG34/42 class SPE_50Rnd_792x57: CA_Magazine { - ACE_isBelt = 0; -}; -class SPE_100Rnd_792x57: SPE_50Rnd_792x57 { - ACE_isBelt = 1; -}; - -class SPE_50Rnd_792x57_sS; -class SPE_100Rnd_792x57_sS: SPE_50Rnd_792x57_sS { - ACE_isBelt = 1; -}; - -class SPE_50Rnd_792x57_SMK; -class SPE_100Rnd_792x57_SMK: SPE_50Rnd_792x57_SMK { ACE_isBelt = 1; }; From c5935dc843d04718e94b975f699f53afe9210bdb Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Wed, 11 Sep 2024 23:49:22 +0200 Subject: [PATCH 007/188] CSW - Rework settings (#9901) --- addons/csw/XEH_postInit.sqf | 24 +++++++++--- addons/csw/functions/fnc_ai_handleFired.sqf | 2 + addons/csw/functions/fnc_ai_handleGetIn.sqf | 2 + addons/csw/functions/fnc_initVehicle.sqf | 12 +++++- addons/csw/initSettings.inc.sqf | 43 ++++++++++----------- 5 files changed, 53 insertions(+), 30 deletions(-) diff --git a/addons/csw/XEH_postInit.sqf b/addons/csw/XEH_postInit.sqf index 87196f33772..419e7013809 100644 --- a/addons/csw/XEH_postInit.sqf +++ b/addons/csw/XEH_postInit.sqf @@ -8,18 +8,32 @@ GVAR(vehicleMagCache) = createHashMap; // needs a small delay for network syncing, or we end up with duplicate mags with ammo handling [LINKFUNC(initVehicle), _this, 1] call CBA_fnc_waitAndExecute; }, true, [], true] call CBA_fnc_addClassEventHandler; - - GVAR(quickmountEnabled) = ( - missionNamespace getVariable [QEGVAR(quickmount,enabled), false] && - {(missionNamespace getVariable [QEGVAR(quickmount,enableMenu), -1]) in [1,3]} - ); }] call CBA_fnc_addEventHandler; +// Also triggered at mission start ["CBA_SettingChanged", { GVAR(quickmountEnabled) = ( missionNamespace getVariable [QEGVAR(quickmount,enabled), false] && {(missionNamespace getVariable [QEGVAR(quickmount,enableMenu), -1]) in [1,3]} ); + + // Do not allow no ammo handling when advanced assembly is enabled + // Reason: When using advanced assembly, the amount of ammo is not stored anywhere, so when you reassemble a static, it will spawn full ammo + if (GVAR(defaultAssemblyMode) && GVAR(ammoHandling) == 0) then { + if (isServer) then { + [QGVAR(ammoHandling), 2, 2, "server"] call CBA_settings_fnc_set; + }; + + // Notify everyone about change + [QEGVAR(common,displayTextStructured), [composeText [ + lineBreak, + parseText format [ + "%1", format ["%1 requires %2 to be set higher than 0.", QGVAR(defaultAssemblyMode), QGVAR(ammoHandling)] + ], + lineBreak, + parseText format ["%1", "No mission restart is required."] + ], 4]] call CBA_fnc_localEvent; + }; }] call CBA_fnc_addEventHandler; // Event handlers: diff --git a/addons/csw/functions/fnc_ai_handleFired.sqf b/addons/csw/functions/fnc_ai_handleFired.sqf index 6f7a6452579..4a6615f4043 100644 --- a/addons/csw/functions/fnc_ai_handleFired.sqf +++ b/addons/csw/functions/fnc_ai_handleFired.sqf @@ -12,6 +12,8 @@ * Public: No */ +if (GVAR(ammoHandling) != 2) exitWith {}; + params ["_vehicle", "_weapon", "", "", "", "_magazine", "", "_gunner"]; TRACE_4("firedEH:",_vehicle,_weapon,_magazine,_gunner); diff --git a/addons/csw/functions/fnc_ai_handleGetIn.sqf b/addons/csw/functions/fnc_ai_handleGetIn.sqf index 14b4453f530..bbbddaf537f 100644 --- a/addons/csw/functions/fnc_ai_handleGetIn.sqf +++ b/addons/csw/functions/fnc_ai_handleGetIn.sqf @@ -12,6 +12,8 @@ * Public: No */ +if (GVAR(ammoHandling) != 2) exitWith {}; + params ["_vehicle", "", "_gunner"]; TRACE_2("getInEH:",_vehicle,_gunner); diff --git a/addons/csw/functions/fnc_initVehicle.sqf b/addons/csw/functions/fnc_initVehicle.sqf index bde31b41d06..f9cd10dbb1c 100644 --- a/addons/csw/functions/fnc_initVehicle.sqf +++ b/addons/csw/functions/fnc_initVehicle.sqf @@ -97,9 +97,17 @@ if (hasInterface && {!(_typeOf in GVAR(initializedStaticTypes))}) then { }; if (["ace_reload"] call EFUNC(common,isModLoaded)) then { - // move reload's check ammo action to the ammo handling point (remove and re-add) [_typeOf, 0, ["ACE_MainActions", QEGVAR(reload,CheckAmmo)]] call EFUNC(interact_menu,removeActionFromClass); - private _checkAmmoAction = [QGVAR(checkAmmo), LELSTRING(reload,checkAmmo), "", EFUNC(reload,checkAmmo), EFUNC(reload,canCheckAmmo)] call EFUNC(interact_menu,createAction); + + // Replace existing check ammo interaction with one that takes into account if the magazine actions are available + private _checkAmmoAction = [QEGVAR(reload,CheckAmmo), LELSTRING(reload,checkAmmo), "", EFUNC(reload,checkAmmo), { + if !((GVAR(ammoHandling) == 0) && {!([false, true, true, GVAR(defaultAssemblyMode)] select (_target getVariable [QGVAR(assemblyMode), 3]))}) exitWith { false }; + _this call EFUNC(reload,canCheckAmmo) + }] call ace_interact_menu_fnc_createAction; + [_typeOf, 0, ["ACE_MainActions"], _checkAmmoAction] call EFUNC(interact_menu,addActionToClass); + + // Add another check ammo action to the ammo handling point + _checkAmmoAction = [QGVAR(checkAmmo), LELSTRING(reload,checkAmmo), "", EFUNC(reload,checkAmmo), EFUNC(reload,canCheckAmmo)] call EFUNC(interact_menu,createAction); [_typeOf, 0, _ammoActionPath, _checkAmmoAction] call EFUNC(interact_menu,addActionToClass); }; }; diff --git a/addons/csw/initSettings.inc.sqf b/addons/csw/initSettings.inc.sqf index bc157e1164b..4a58ed80b03 100644 --- a/addons/csw/initSettings.inc.sqf +++ b/addons/csw/initSettings.inc.sqf @@ -1,56 +1,53 @@ -private _categoryArray = [format ["ACE %1", localize LSTRING(DisplayName)]]; +private _categoryArray = [format ["ACE %1", LLSTRING(DisplayName)]]; [ - QGVAR(defaultAssemblyMode), "CHECKBOX", + QGVAR(defaultAssemblyMode), + "CHECKBOX", [LSTRING(defaultAssemblyMode_displayName), LSTRING(defaultAssemblyMode_description)], _categoryArray, false, // default value - true, // isGlobal - {[QGVAR(defaultAssemblyMode), _this] call EFUNC(common,cbaSettings_settingChanged)}, - true // Needs mission restart + 1 // isGlobal ] call CBA_fnc_addSetting; [ - QGVAR(handleExtraMagazines), "CHECKBOX", + QGVAR(handleExtraMagazines), + "CHECKBOX", [LSTRING(handleExtraMagazines_displayName), LSTRING(handleExtraMagazines_description)], _categoryArray, true, // default value - true, // isGlobal - {[QGVAR(handleExtraMagazines), _this] call EFUNC(common,cbaSettings_settingChanged)}, - true // Needs mission restart + 1 // isGlobal ] call CBA_fnc_addSetting; [ - QGVAR(handleExtraMagazinesType), "LIST", + QGVAR(handleExtraMagazinesType), + "LIST", [LSTRING(handleExtraMagazinesType_displayName), LSTRING(handleExtraMagazinesType_description)], _categoryArray, [[0, 1], [LSTRING(handleExtraMagazinesType_weaponHolder), LSTRING(handleExtraMagazinesType_ammoBox)], 0], - true, // isGlobal - {[QGVAR(handleExtraMagazinesType), _this] call EFUNC(common,cbaSettings_settingChanged)}, - true // Needs mission restart + 1 // isGlobal ] call CBA_fnc_addSetting; [ - QGVAR(ammoHandling), "LIST", + QGVAR(ammoHandling), + "LIST", [LSTRING(ammoHandling_displayName), LSTRING(ammoHandling_description)], _categoryArray, [[0, 1, 2], [LELSTRING(common,Disabled), LELSTRING(common,playerOnly), LELSTRING(common,playersAndAI)], 2], // [_values, _valueTitles, _defaultIndex] - true, // isGlobal - {[QGVAR(ammoHandling), _this] call EFUNC(common,cbaSettings_settingChanged)}, - true // Needs mission restart + 1 // isGlobal ] call CBA_fnc_addSetting; [ - QGVAR(progressBarTimeCoefficent), "SLIDER", + QGVAR(progressBarTimeCoefficent), + "SLIDER", [LSTRING(progressBarTimeCoefficent_displayName), LSTRING(progressBarTimeCoefficent_description)], _categoryArray, - [0,2,1,2], // [min, max, default value, trailing decimals (-1 for whole numbers only)] - true // isGlobal + [0, 2, 1, 2], // [min, max, default value, trailing decimals (-1 for whole numbers only)] + 1 // isGlobal ] call CBA_fnc_addSetting; [ - QGVAR(dragAfterDeploy), "CHECKBOX", + QGVAR(dragAfterDeploy), + "CHECKBOX", [LSTRING(dragAfterDeploy_displayName), LSTRING(dragAfterDeploy_description)], - _categoryArray, - false // default value + _categoryArray ] call CBA_fnc_addSetting; From d4d87a13cecfa666c11f80e5350b61c66fa91b35 Mon Sep 17 00:00:00 2001 From: Fabio Schick <58027418+mrschick@users.noreply.github.com> Date: Wed, 11 Sep 2024 23:57:14 +0200 Subject: [PATCH 008/188] Scopes - Setting to show Adjustment UI while sighted in (#10241) --- .../functions/fnc_applyScopeAdjustment.sqf | 4 ++++ addons/scopes/initSettings.inc.sqf | 16 ++++++++++++---- addons/scopes/stringtable.xml | 5 +++++ 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/addons/scopes/functions/fnc_applyScopeAdjustment.sqf b/addons/scopes/functions/fnc_applyScopeAdjustment.sqf index b813dde9ef8..d356343099d 100644 --- a/addons/scopes/functions/fnc_applyScopeAdjustment.sqf +++ b/addons/scopes/functions/fnc_applyScopeAdjustment.sqf @@ -43,6 +43,10 @@ if (cameraView == "GUNNER") then { _yaw = _yaw + _windageDifference; [_unit, _pitch, _bank, _yaw] call EFUNC(common,setPitchBankYaw); }; + + if (GVAR(inScopeAdjustment)) then { + [] call FUNC(showZeroing); + }; } else { [] call FUNC(showZeroing); }; diff --git a/addons/scopes/initSettings.inc.sqf b/addons/scopes/initSettings.inc.sqf index 40ed62cbcc2..e74bcb4c073 100644 --- a/addons/scopes/initSettings.inc.sqf +++ b/addons/scopes/initSettings.inc.sqf @@ -76,18 +76,26 @@ private _category = format ["ACE %1", localize LSTRING(DisplayName)]; true // Needs mission restart ] call CBA_fnc_addSetting; +[ + QGVAR(simplifiedZeroing), "CHECKBOX", + [LSTRING(simplifiedZeroing_displayName), LSTRING(simplifiedZeroing_description)], + _category, + false, + 1 +] call CBA_fnc_addSetting; + [ QGVAR(useLegacyUI), "CHECKBOX", [LSTRING(useLegacyUI_displayName), LSTRING(useLegacyUI_description)], _category, false, - 0 + 2 ] call CBA_fnc_addSetting; [ - QGVAR(simplifiedZeroing), "CHECKBOX", - [LSTRING(simplifiedZeroing_displayName), LSTRING(simplifiedZeroing_description)], + QGVAR(inScopeAdjustment), "CHECKBOX", + LSTRING(inScopeAdjustment_displayName), _category, false, - 1 + 0 ] call CBA_fnc_addSetting; diff --git a/addons/scopes/stringtable.xml b/addons/scopes/stringtable.xml index 9a47f657cc0..4174a91d02e 100644 --- a/addons/scopes/stringtable.xml +++ b/addons/scopes/stringtable.xml @@ -347,6 +347,11 @@ Replikuje systém naměřování puškohledů ze základní hry. Replica en los visores el sistema de homogeneizado de vanilla + + Show adjustment UI in scope + Zeige Absehenverstellungs-UI im Zielfernrohr + Mostra UI delle manopole nel mirino + Minor adjustment up Kleine Korrektur hoch From fdf3198855eab9387b5f525027d1412fbb1aeb57 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Wed, 11 Sep 2024 17:36:42 -0500 Subject: [PATCH 009/188] Advanced Fatigue - Fix stamina costs when not touching ground (#10297) --- .../advanced_fatigue/functions/fnc_mainLoop.sqf | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/addons/advanced_fatigue/functions/fnc_mainLoop.sqf b/addons/advanced_fatigue/functions/fnc_mainLoop.sqf index 16d355a424d..e6327a3fa56 100644 --- a/addons/advanced_fatigue/functions/fnc_mainLoop.sqf +++ b/addons/advanced_fatigue/functions/fnc_mainLoop.sqf @@ -27,9 +27,18 @@ if (!alive ACE_player) exitWith { 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 _sideAngle = if ((getPosATL ACE_player) select 2 > 0.01) then { + 0 // ignore terrain normal if not touching it +} else { + private _sideVector = vectorNormalized (_movementVector vectorCrossProduct _normal); + asin (_sideVector select 2); +}; +if (GVAR(isSwimming)) then { // ignore when floating + _fwdAngle = 0; + _sideAngle = 0; +}; + private _currentWork = REE; private _currentSpeed = (vectorMagnitude _velocity) min 6; @@ -62,7 +71,7 @@ if (isNull objectParent ACE_player && {_currentSpeed > 0.1} && {isTouchingGround }; // Used to simulate the unevenness/roughness of the terrain - if ((getPosATL ACE_player) select 2 < 0.01) then { + if (_sideAngle != 0) then { private _sideGradient = abs (_sideAngle / 45) min 1; _terrainFactor = 1 + _sideGradient ^ 4; From 33f2143019588d54c17d671fa45d9257866f3769 Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Thu, 12 Sep 2024 00:54:19 +0200 Subject: [PATCH 010/188] Docs - Update CSW proxy weapon information (#10309) --- docs/wiki/framework/crew-served-weapons-framework.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/wiki/framework/crew-served-weapons-framework.md b/docs/wiki/framework/crew-served-weapons-framework.md index a2f8e74ae65..0213e42a5e9 100644 --- a/docs/wiki/framework/crew-served-weapons-framework.md +++ b/docs/wiki/framework/crew-served-weapons-framework.md @@ -16,7 +16,7 @@ version: To convert a static weapon into a crew served weapon, you need to create the following: -- A proxy weapon +- A proxy weapon (optional) - A carryable weapon that can be mounted on a tripod - Carryable weapon magazines - The CSW config in the static weapon @@ -27,6 +27,8 @@ For the following examples, we are going to assume you are modifying your existi Because the magazine loading time is already handled by the ACE interaction, a proxy weapon with a very low loading time is used. It automatically replaces the default weapon of the turret when CSW is enabled. +A proxy weapon isn't required for a CSW to work. If a CSW uses the default weapons, the reload times will just be longer. + ```cpp class CfgWeapons { class prefix_hmg_weapon; @@ -136,7 +138,7 @@ class CfgVehicles { class prefix_hmg: StaticMGWeapon { class ACE_CSW { enabled = 1; // Enables ACE CSW for this weapon - proxyWeapon = "prefix_hmg_weapon_proxy"; // The proxy weapon created above + proxyWeapon = "prefix_hmg_weapon_proxy"; // The proxy weapon created above. This can also be a function name that returns a proxy weapon - passed [_vehicle, _turret, _currentWeapon, _needed, _emptyWeapon] magazineLocation = "_target selectionPosition 'magazine'"; // Ammo handling interaction point location disassembleWeapon = "prefix_hmg_carry"; // Carryable weapon created above disassembleTurret = "ace_csw_m3Tripod"; // Which static tripod will appear when weapon is disassembled From fef34a82dc51d640ba3df82ccfcb228647998cb4 Mon Sep 17 00:00:00 2001 From: some-evil-kitty <106408180+some-evil-kitty@users.noreply.github.com> Date: Wed, 11 Sep 2024 19:54:51 -0400 Subject: [PATCH 011/188] Carrying - Add hookable events to dropping objects (#10304) Co-authored-by: PabstMirror Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> --- addons/dragging/functions/fnc_carryObject.sqf | 3 +++ addons/dragging/functions/fnc_dragObject.sqf | 3 +++ addons/dragging/functions/fnc_dropObject.sqf | 3 +++ addons/dragging/functions/fnc_dropObject_carry.sqf | 6 ++++++ addons/dragging/functions/fnc_startCarryLocal.sqf | 3 +++ addons/dragging/functions/fnc_startDragLocal.sqf | 3 +++ docs/wiki/framework/events-framework.md | 6 ++++++ 7 files changed, 27 insertions(+) diff --git a/addons/dragging/functions/fnc_carryObject.sqf b/addons/dragging/functions/fnc_carryObject.sqf index 7b2b4faa6b0..d765020f96e 100644 --- a/addons/dragging/functions/fnc_carryObject.sqf +++ b/addons/dragging/functions/fnc_carryObject.sqf @@ -71,3 +71,6 @@ if (_UAVCrew isNotEqualTo []) then { // Check everything [LINKFUNC(carryObjectPFH), 0.5, [_unit, _target, CBA_missionTime]] call CBA_fnc_addPerFrameHandler; + +// API +[QGVAR(startedCarry), [_unit, _target]] call CBA_fnc_localEvent; diff --git a/addons/dragging/functions/fnc_dragObject.sqf b/addons/dragging/functions/fnc_dragObject.sqf index a8053b8dfee..3169db26795 100644 --- a/addons/dragging/functions/fnc_dragObject.sqf +++ b/addons/dragging/functions/fnc_dragObject.sqf @@ -87,3 +87,6 @@ if (_UAVCrew isNotEqualTo []) then { // Fixes not being able to move when in combat pace [_unit, "forceWalk", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set); + +// API +[QGVAR(startedDrag), [_unit, _target]] call CBA_fnc_localEvent; diff --git a/addons/dragging/functions/fnc_dropObject.sqf b/addons/dragging/functions/fnc_dropObject.sqf index 965e3b9efa3..049f8228168 100644 --- a/addons/dragging/functions/fnc_dropObject.sqf +++ b/addons/dragging/functions/fnc_dropObject.sqf @@ -107,3 +107,6 @@ private _mass = _target getVariable [QGVAR(originalMass), 0]; if (_mass != 0) then { [QEGVAR(common,setMass), [_target, _mass]] call CBA_fnc_globalEvent; // Force global sync }; + +// API +[QGVAR(stoppedDrag), [_unit, _target]] call CBA_fnc_localEvent; diff --git a/addons/dragging/functions/fnc_dropObject_carry.sqf b/addons/dragging/functions/fnc_dropObject_carry.sqf index ba8cbd09f12..525a150bcff 100644 --- a/addons/dragging/functions/fnc_dropObject_carry.sqf +++ b/addons/dragging/functions/fnc_dropObject_carry.sqf @@ -129,6 +129,12 @@ if (_loadCargo) then { } else { [_unit, _target, _cursorObject] call EFUNC(common,loadPerson); }; + + // Repurpose variable for flag used in event below + _loadCargo = true; }; }; }; + +// API +[QGVAR(stoppedCarry), [_unit, _target, _loadCargo]] call CBA_fnc_localEvent; diff --git a/addons/dragging/functions/fnc_startCarryLocal.sqf b/addons/dragging/functions/fnc_startCarryLocal.sqf index e7d102825aa..cf17dfb311d 100644 --- a/addons/dragging/functions/fnc_startCarryLocal.sqf +++ b/addons/dragging/functions/fnc_startCarryLocal.sqf @@ -99,3 +99,6 @@ if (_mass > 1) then { _target setVariable [QGVAR(originalMass), _mass, true]; [QEGVAR(common,setMass), [_target, 1e-12]] call CBA_fnc_globalEvent; // Force global sync }; + +// API +[QGVAR(setupCarry), [_unit, _target]] call CBA_fnc_localEvent; diff --git a/addons/dragging/functions/fnc_startDragLocal.sqf b/addons/dragging/functions/fnc_startDragLocal.sqf index 3abcef44305..f0468f133ba 100644 --- a/addons/dragging/functions/fnc_startDragLocal.sqf +++ b/addons/dragging/functions/fnc_startDragLocal.sqf @@ -116,3 +116,6 @@ if (_mass > 1) then { _target setVariable [QGVAR(originalMass), _mass, true]; [QEGVAR(common,setMass), [_target, 1e-12]] call CBA_fnc_globalEvent; // Force global sync }; + +// API +[QGVAR(setupDrag), [_unit, _target]] call CBA_fnc_localEvent; diff --git a/docs/wiki/framework/events-framework.md b/docs/wiki/framework/events-framework.md index c0aa43a5739..b531387ee79 100644 --- a/docs/wiki/framework/events-framework.md +++ b/docs/wiki/framework/events-framework.md @@ -173,6 +173,12 @@ MenuType: 0 = Interaction, 1 = Self Interaction |---------- |------------|----------|------|-------------| | `ace_dragging_cloneCreated` | [_clone, _corpse] | Local | Listen | Called when a clone used for dragging/carrying corpses is created | `ace_dragging_cloneDeleted` | [_clone, _corpse] | Local | Listen | Called when a clone used for dragging/carrying corpses is deleted +| `ace_dragging_setupCarry` | [_unit, _target] | Local | Listen | Called when the unit starts the carrying animation for the target +| `ace_dragging_startedCarry` | [_unit, _target] | Local | Listen | Called when the unit starts successfully carrying the target. This event is called after `ace_dragging_setupCarry`. +| `ace_dragging_stoppedCarry` | [_unit, _target, _loadCargo] | Local | Listen | Called when the unit stops carrying the target. `_loadCargo` says if the target is being loaded as cargo/person or not. +| `ace_dragging_setupDrag` | [_unit, _target] | Local | Listen | Called when the unit starts the dragging animation for the target +| `ace_dragging_startedDrag` | [_unit, _target] | Local | Listen | Called when the unit starts successfully dragging the target. This event is called after `ace_dragging_setupDrag`. +| `ace_dragging_stoppedDrag` | [_unit, _target] | Local | Listen | Called when the unit stops dragging the target ### 2.19 HuntIR (`ace_huntir`) From fcb6b00ceb48df512f6d45b096874eae1caf4f24 Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Tue, 17 Sep 2024 18:56:58 +0200 Subject: [PATCH 012/188] General - Make `ace_csw` config names lowercase (#10316) --- .../compat_rhs_afrf3_csw/CfgVehicles.hpp | 18 +++--- .../compat_rhs_afrf3_csw/CfgWeapons.hpp | 16 ++--- .../compat_rhs_gref3_csw/CfgVehicles.hpp | 4 +- .../compat_rhs_gref3_csw/CfgWeapons.hpp | 2 +- .../compat_rhs_usf3_csw/CfgVehicles.hpp | 10 +-- .../compat_rhs_usf3_csw/CfgWeapons.hpp | 8 +-- addons/compat_sog/CfgVehicles/turrets.hpp | 64 +++++++++---------- addons/compat_sog/CfgWeapons/csw.hpp | 34 +++++----- addons/dragon/CfgVehicles.hpp | 2 +- addons/dragon/CfgWeapons.hpp | 4 +- 10 files changed, 81 insertions(+), 81 deletions(-) diff --git a/addons/compat_rhs_afrf3/compat_rhs_afrf3_csw/CfgVehicles.hpp b/addons/compat_rhs_afrf3/compat_rhs_afrf3_csw/CfgVehicles.hpp index 6a3bb0a083e..fb52cc6373c 100644 --- a/addons/compat_rhs_afrf3/compat_rhs_afrf3_csw/CfgVehicles.hpp +++ b/addons/compat_rhs_afrf3/compat_rhs_afrf3_csw/CfgVehicles.hpp @@ -5,7 +5,7 @@ class CfgVehicles { class StaticGrenadeLauncher; class rhs_SPG9_base: AT_01_base_F { - class ACE_CSW { + class ace_csw { enabled = 1; proxyWeapon = QGVAR(rhs_weap_SPG9); magazineLocation = "_target selectionPosition 'breach'"; @@ -18,14 +18,14 @@ class CfgVehicles { }; class rhs_SPG9M_base: rhs_SPG9_base { - class ACE_CSW: ACE_CSW { + class ace_csw: ace_csw { enabled = 1; disassembleWeapon = QGVAR(spg9m_carry); }; }; class rhs_Kornet_Base: AT_01_base_F { - class ACE_CSW { + class ace_csw { enabled = 1; proxyWeapon = QGVAR(rhs_weap_9K133_launcher); magazineLocation = "_target selectionPosition 'gun'"; @@ -38,7 +38,7 @@ class CfgVehicles { }; class rhs_Metis_Base: AT_01_base_F { - class ACE_CSW { + class ace_csw { enabled = 1; proxyWeapon = QGVAR(rhs_weap_9K115_2_launcher); magazineLocation = "_target selectionPosition 'gun'"; @@ -51,7 +51,7 @@ class CfgVehicles { }; class rhs_2b14_82mm_Base: StaticMortar { - class ACE_CSW { + class ace_csw { enabled = 1; magazineLocation = ""; proxyWeapon = QGVAR(rhs_weap_2b14); @@ -64,7 +64,7 @@ class CfgVehicles { }; class rhs_nsv_tripod_base: StaticMGWeapon { - class ACE_CSW { + class ace_csw { enabled = 1; proxyWeapon = QGVAR(rhs_weap_nsvt_effects); magazineLocation = "_target selectionPosition 'magazine'"; @@ -77,7 +77,7 @@ class CfgVehicles { }; class RHS_KORD_Base: rhs_nsv_tripod_base { - class ACE_CSW: ACE_CSW { + class ace_csw: ace_csw { enabled = 1; proxyWeapon = QGVAR(rhs_weap_KORD); disassembleWeapon = QGVAR(kord_carry); @@ -86,7 +86,7 @@ class CfgVehicles { }; class RHS_KORD_high_base: RHS_KORD_Base { - class ACE_CSW: ACE_CSW { + class ace_csw: ace_csw { enabled = 1; proxyWeapon = QGVAR(rhs_weap_KORD); disassembleWeapon = QGVAR(kord_carry); @@ -95,7 +95,7 @@ class CfgVehicles { }; class RHS_AGS30_TriPod_base: StaticGrenadeLauncher { - class ACE_CSW { + class ace_csw { enabled = 1; proxyWeapon = QGVAR(rhs_weap_AGS30); magazineLocation = "_target selectionPosition 'magazine'"; diff --git a/addons/compat_rhs_afrf3/compat_rhs_afrf3_csw/CfgWeapons.hpp b/addons/compat_rhs_afrf3/compat_rhs_afrf3_csw/CfgWeapons.hpp index 1e8f4dbdfd1..e444a2aa32f 100644 --- a/addons/compat_rhs_afrf3/compat_rhs_afrf3_csw/CfgWeapons.hpp +++ b/addons/compat_rhs_afrf3/compat_rhs_afrf3_csw/CfgWeapons.hpp @@ -14,7 +14,7 @@ class CfgWeapons { class GVAR(2b14_carry): Launcher_Base_F { dlc = "ace"; - class ACE_CSW { + class ace_csw { type = "weapon"; deployTime = 20; pickupTime = 25; @@ -40,7 +40,7 @@ class CfgWeapons { class GVAR(nsv_carry): Launcher_Base_F { dlc = "ace"; - class ACE_CSW { + class ace_csw { type = "weapon"; deployTime = 4; pickupTime = 4; @@ -64,7 +64,7 @@ class CfgWeapons { class GVAR(kord_carry): Launcher_Base_F { dlc = "ace"; - class ACE_CSW { + class ace_csw { type = "weapon"; deployTime = 4; pickupTime = 4; @@ -89,7 +89,7 @@ class CfgWeapons { class GVAR(ags30_carry): Launcher_Base_F { dlc = "ace"; - class ACE_CSW { + class ace_csw { type = "weapon"; deployTime = 4; pickupTime = 4; @@ -113,7 +113,7 @@ class CfgWeapons { class GVAR(spg9_carry): Launcher_Base_F { dlc = "ace"; - class ACE_CSW { + class ace_csw { type = "weapon"; deployTime = 4; pickupTime = 4; @@ -136,7 +136,7 @@ class CfgWeapons { }; class GVAR(spg9m_carry): GVAR(spg9_carry) { - class ACE_CSW: ACE_CSW { + class ace_csw: ace_csw { class assembleTo { EGVAR(csw,spg9Tripod) = "rhs_SPG9M_MSV"; }; @@ -147,7 +147,7 @@ class CfgWeapons { class GVAR(metis_carry): Launcher_Base_F { dlc = "ace"; - class ACE_CSW { + class ace_csw { type = "mount"; deployTime = 4; pickupTime = 4; @@ -169,7 +169,7 @@ class CfgWeapons { class GVAR(kornet_carry): Launcher_Base_F { dlc = "ace"; - class ACE_CSW { + class ace_csw { type = "mount"; deployTime = 4; pickupTime = 4; diff --git a/addons/compat_rhs_gref3/compat_rhs_gref3_csw/CfgVehicles.hpp b/addons/compat_rhs_gref3/compat_rhs_gref3_csw/CfgVehicles.hpp index 7e58387dabc..1a15fc03f40 100644 --- a/addons/compat_rhs_gref3/compat_rhs_gref3_csw/CfgVehicles.hpp +++ b/addons/compat_rhs_gref3/compat_rhs_gref3_csw/CfgVehicles.hpp @@ -1,7 +1,7 @@ class CfgVehicles { class StaticMGWeapon; class rhs_DSHKM_base: StaticMGWeapon { - class ACE_CSW { + class ace_csw { enabled = 1; proxyWeapon = QGVAR(rhs_weap_DSHKM); magazineLocation = "_target selectionPosition 'otocvez'"; @@ -13,7 +13,7 @@ class CfgVehicles { }; }; class rhs_DSHkM_Mini_TriPod_base: rhs_DSHKM_base { - class ACE_CSW: ACE_CSW { + class ace_csw: ace_csw { enabled = 1; disassembleTurret = QEGVAR(csw,kordTripodLow); }; diff --git a/addons/compat_rhs_gref3/compat_rhs_gref3_csw/CfgWeapons.hpp b/addons/compat_rhs_gref3/compat_rhs_gref3_csw/CfgWeapons.hpp index 15ff9488cad..279ec98eaa4 100644 --- a/addons/compat_rhs_gref3/compat_rhs_gref3_csw/CfgWeapons.hpp +++ b/addons/compat_rhs_gref3/compat_rhs_gref3_csw/CfgWeapons.hpp @@ -7,7 +7,7 @@ class CfgWeapons { }; class GVAR(dshkm_carry): Launcher_Base_F { - class ACE_CSW { + class ace_csw { type = "weapon"; deployTime = 4; pickupTime = 4; diff --git a/addons/compat_rhs_usf3/compat_rhs_usf3_csw/CfgVehicles.hpp b/addons/compat_rhs_usf3/compat_rhs_usf3_csw/CfgVehicles.hpp index cbca20cce76..bfe157c6099 100644 --- a/addons/compat_rhs_usf3/compat_rhs_usf3_csw/CfgVehicles.hpp +++ b/addons/compat_rhs_usf3/compat_rhs_usf3_csw/CfgVehicles.hpp @@ -14,7 +14,7 @@ class CfgVehicles { }; }; - class ACE_CSW { + class ace_csw { enabled = 1; magazineLocation = ""; proxyWeapon = QGVAR(rhs_mortar_81mm); @@ -28,7 +28,7 @@ class CfgVehicles { class StaticMGWeapon; class rhs_m2staticmg_base: StaticMGWeapon { - class ACE_CSW { + class ace_csw { enabled = 1; proxyWeapon = QGVAR(rhs_M2); magazineLocation = "_target selectionPosition 'magazine'"; @@ -41,7 +41,7 @@ class CfgVehicles { }; class RHS_M2StaticMG_MiniTripod_base: rhs_m2staticmg_base { - class ACE_CSW: ACE_CSW { + class ace_csw: ace_csw { enabled = 1; disassembleTurret = QEGVAR(csw,m3TripodLow); }; @@ -49,7 +49,7 @@ class CfgVehicles { class StaticGrenadeLauncher; class RHS_MK19_TriPod_base: StaticGrenadeLauncher { - class ACE_CSW { + class ace_csw { enabled = 1; proxyWeapon = QGVAR(rhs_MK19); magazineLocation = "_target selectionPosition 'magazine'"; @@ -63,7 +63,7 @@ class CfgVehicles { class StaticATWeapon; class RHS_TOW_TriPod_base: StaticATWeapon { - class ACE_CSW { + class ace_csw { enabled = 1; proxyWeapon = QGVAR(rhs_weap_TOW_Launcher_static); magazineLocation = "_target selectionPosition 'tube'"; diff --git a/addons/compat_rhs_usf3/compat_rhs_usf3_csw/CfgWeapons.hpp b/addons/compat_rhs_usf3/compat_rhs_usf3_csw/CfgWeapons.hpp index d373e7fe673..fa939ea80e0 100644 --- a/addons/compat_rhs_usf3/compat_rhs_usf3_csw/CfgWeapons.hpp +++ b/addons/compat_rhs_usf3/compat_rhs_usf3_csw/CfgWeapons.hpp @@ -11,7 +11,7 @@ class CfgWeapons { class GVAR(m252_carry): Launcher_Base_F { dlc = "ace"; - class ACE_CSW { + class ace_csw { type = "weapon"; deployTime = 20; pickupTime = 25; @@ -37,7 +37,7 @@ class CfgWeapons { class GVAR(m2_carry): Launcher_Base_F { dlc = "ace"; - class ACE_CSW { + class ace_csw { type = "weapon"; deployTime = 4; pickupTime = 4; @@ -62,7 +62,7 @@ class CfgWeapons { class GVAR(mk19_carry): Launcher_Base_F { dlc = "ace"; - class ACE_CSW { + class ace_csw { type = "weapon"; deployTime = 4; pickupTime = 4; @@ -86,7 +86,7 @@ class CfgWeapons { class GVAR(tow_carry): Launcher_Base_F { dlc = "ace"; - class ACE_CSW { + class ace_csw { type = "weapon"; deployTime = 4; pickupTime = 4; diff --git a/addons/compat_sog/CfgVehicles/turrets.hpp b/addons/compat_sog/CfgVehicles/turrets.hpp index 6142a018e81..928b80716a4 100644 --- a/addons/compat_sog/CfgVehicles/turrets.hpp +++ b/addons/compat_sog/CfgVehicles/turrets.hpp @@ -17,7 +17,7 @@ class vn_static_m2_high_base: StaticMGWeapon { }; }; - class ACE_CSW { + class ace_csw { enabled = 1; proxyWeapon = "vn_m2_v_01"; magazineLocation = "_target selectionPosition 'mg1_magazine'"; @@ -31,7 +31,7 @@ class vn_static_m2_high_base: StaticMGWeapon { // M2 Browning - Low class vn_static_m2_low_base: vn_static_m2_high_base { - class ACE_CSW: ACE_CSW { + class ace_csw: ace_csw { disassembleTurret = QEGVAR(csw,m3TripodLow); }; }; @@ -45,7 +45,7 @@ class vn_static_m1919a6_base: vn_static_m2_low_base { }; }; - class ACE_CSW: ACE_CSW { + class ace_csw: ace_csw { enabled = 1; proxyWeapon = "vn_m1919_v_01"; magazineLocation = "_target selectionPosition 'mg1_magazine' vectorAdd [-0.3, 0, 0]"; @@ -66,7 +66,7 @@ class vn_static_m1919a4_high_base: vn_static_m1919a6_base { }; }; - class ACE_CSW: ACE_CSW { + class ace_csw: ace_csw { enabled = 1; proxyWeapon = "vn_m1919_v_01"; magazineLocation = "_target selectionPosition 'mg1_magazine'"; @@ -80,7 +80,7 @@ class vn_static_m1919a4_high_base: vn_static_m1919a6_base { // M1919A4 - Low class vn_static_m1919a4_low_base: vn_static_m1919a4_high_base { - class ACE_CSW: ACE_CSW { + class ace_csw: ace_csw { disassembleTurret = QEGVAR(csw,m3TripodLow); }; }; @@ -93,7 +93,7 @@ class vn_static_m60_high_base: vn_static_m2_low_base { }; }; - class ACE_CSW: ACE_CSW { + class ace_csw: ace_csw { enabled = 1; proxyWeapon = "vn_m60_v_01"; magazineLocation = "_target selectionPosition 'mg1_trigger'"; @@ -113,7 +113,7 @@ class vn_static_m60_low_base: vn_static_m60_high_base { }; }; - class ACE_CSW: ACE_CSW { + class ace_csw: ace_csw { magazineLocation = "_target selectionPosition 'mg1_otochlaven_recoil'"; disassembleTurret = QEGVAR(csw,m3TripodLow); }; @@ -131,7 +131,7 @@ class vn_static_tow_base: vn_static_at3_base { }; }; - class ACE_CSW { + class ace_csw { enabled = 1; proxyWeapon = "vn_missile_tow_launcher"; magazineLocation = "_target selectionPosition 'magazine'"; @@ -145,7 +145,7 @@ class vn_static_tow_base: vn_static_at3_base { // DShKM - High class vn_static_dp28_high_base: vn_static_m2_high_base { - class ACE_CSW: ACE_CSW { + class ace_csw: ace_csw { enabled = 0; }; }; @@ -156,7 +156,7 @@ class vn_static_dshkm_high_01_base: vn_static_dp28_high_base { }; }; - class ACE_CSW: ACE_CSW { + class ace_csw: ace_csw { enabled = 1; proxyWeapon = "vn_dshkm_v_01"; magazineLocation = "_target selectionPosition 'mg1_boxmag'"; @@ -170,7 +170,7 @@ class vn_static_dshkm_high_01_base: vn_static_dp28_high_base { // DShKM - High, with AA sight class vn_static_dshkm_high_02_base: vn_static_dshkm_high_01_base { - class ACE_CSW: ACE_CSW { + class ace_csw: ace_csw { disassembleWeapon = QGVAR(dshkm_AA_carry); }; }; @@ -185,7 +185,7 @@ class vn_static_dshkm_low_01_base: vn_static_dshkm_high_01_base { }; }; - class ACE_CSW: ACE_CSW { + class ace_csw: ace_csw { disassembleWeapon = QGVAR(dshkm_shield_carry); disassembleTurret = QEGVAR(csw,kordTripodLow); }; @@ -193,7 +193,7 @@ class vn_static_dshkm_low_01_base: vn_static_dshkm_high_01_base { // DShKM - Low class vn_static_dshkm_low_02_base: vn_static_dshkm_low_01_base { - class ACE_CSW: ACE_CSW { + class ace_csw: ace_csw { disassembleWeapon = QGVAR(dshkm_carry); }; }; @@ -206,7 +206,7 @@ class vn_static_rpd_high_base: vn_static_dp28_high_base { }; }; - class ACE_CSW: ACE_CSW { + class ace_csw: ace_csw { enabled = 1; proxyWeapon = "vn_rpd_v_01"; magazineLocation = "_target selectionPosition 'mg1_otochlaven_recoil'"; @@ -226,7 +226,7 @@ class vn_static_pk_high_base: vn_static_rpd_high_base { }; }; - class ACE_CSW: ACE_CSW { + class ace_csw: ace_csw { enabled = 1; proxyWeapon = "vn_pk_v_01"; magazineLocation = "_target selectionPosition 'mg1_otochlaven_recoil'"; @@ -246,7 +246,7 @@ class vn_static_pk_low_base: vn_static_pk_high_base { }; }; - class ACE_CSW: ACE_CSW { + class ace_csw: ace_csw { disassembleTurret = QEGVAR(csw,kordTripodLow); }; }; @@ -259,7 +259,7 @@ class vn_static_mg42_high_base: vn_static_rpd_high_base { }; }; - class ACE_CSW { + class ace_csw { enabled = 1; proxyWeapon = "vn_mg42_v_01"; magazineLocation = "_target selectionPosition 'mg1_otochlaven_recoil'"; @@ -278,7 +278,7 @@ class vn_static_mg42_low_base: vn_static_mg42_high_base { }; }; - class ACE_CSW: ACE_CSW { + class ace_csw: ace_csw { disassembleTurret = ""; }; }; @@ -294,7 +294,7 @@ class vn_static_sgm_high_base: vn_static_sgm_base { }; }; - class ACE_CSW { + class ace_csw { enabled = 1; proxyWeapon = "vn_sgm_v_01"; magazineLocation = "_target selectionPosition 'mg1_otochlaven_recoil'"; @@ -308,7 +308,7 @@ class vn_static_sgm_high_base: vn_static_sgm_base { // SGM - Low class vn_static_sgm_low_base: vn_static_sgm_high_base { - class ACE_CSW: ACE_CSW { + class ace_csw: ace_csw { disassembleWeapon = QGVAR(sgm_carry); disassembleTurret = QEGVAR(csw,kordTripodLow); }; @@ -316,25 +316,25 @@ class vn_static_sgm_low_base: vn_static_sgm_high_base { // SGM - Shield class vn_o_pl_static_sgm_low_01: vn_static_sgm_low_base { - class ACE_CSW: ACE_CSW { + class ace_csw: ace_csw { disassembleWeapon = QGVAR(sgm_shield_carry); disassembleTurret = QEGVAR(csw,kordTripodLow); }; }; class vn_o_nva_65_static_sgm_low_01: vn_static_sgm_low_base { - class ACE_CSW: ACE_CSW { + class ace_csw: ace_csw { disassembleWeapon = QGVAR(sgm_shield_carry); disassembleTurret = QEGVAR(csw,kordTripodLow); }; }; class vn_o_nva_static_sgm_low_01: vn_static_sgm_low_base { - class ACE_CSW: ACE_CSW { + class ace_csw: ace_csw { disassembleWeapon = QGVAR(sgm_shield_carry); disassembleTurret = QEGVAR(csw,kordTripodLow); }; }; class vn_o_nva_navy_static_sgm_low_01: vn_static_sgm_low_base { - class ACE_CSW: ACE_CSW { + class ace_csw: ace_csw { disassembleWeapon = QGVAR(sgm_shield_carry); disassembleTurret = QEGVAR(csw,kordTripodLow); }; @@ -351,7 +351,7 @@ class vn_static_mk18_base: StaticCannon { }; }; - class ACE_CSW { + class ace_csw { enabled = 1; proxyWeapon = "vn_mk18_v_01"; magazineLocation = "_target selectionPosition 'mg1_magazine'"; @@ -378,7 +378,7 @@ class vn_static_mortar_m29_base: Mortar_01_base_F { }; }; - class ACE_CSW { + class ace_csw { enabled = 1; proxyWeapon = QGVAR(vn_mortar_m29); magazineLocation = "_target selectionPosition 'pohon'"; @@ -392,7 +392,7 @@ class vn_static_mortar_m29_base: Mortar_01_base_F { // M2 / Type 63 Mortar class vn_static_mortar_m2_base: vn_static_mortar_m29_base { - class ACE_CSW: ACE_CSW { + class ace_csw: ace_csw { enabled = 1; proxyWeapon = QGVAR(vn_mortar_m2); magazineLocation = "_target selectionPosition 'pohon'"; @@ -406,7 +406,7 @@ class vn_static_mortar_m2_base: vn_static_mortar_m29_base { // Type 53 Mortar class vn_static_mortar_type53_base: vn_static_mortar_m29_base { - class ACE_CSW: ACE_CSW { + class ace_csw: ace_csw { enabled = 1; proxyWeapon = QGVAR(vn_mortar_type53); magazineLocation = "_target selectionPosition 'pohon'"; @@ -430,7 +430,7 @@ class vn_static_h12_base: Mortar_01_base_F { }; }; - class ACE_CSW { + class ace_csw { enabled = 0; }; }; @@ -441,7 +441,7 @@ class vn_static_m45_base: vn_static_m2_high_base { EGVAR(dragging,canCarry) = 0; EGVAR(dragging,canDrag) = 0; - class ACE_CSW: ACE_CSW { + class ace_csw: ace_csw { enabled = 0; }; }; @@ -450,7 +450,7 @@ class vn_static_zpu4_base: vn_static_m2_high_base { EGVAR(dragging,canCarry) = 0; EGVAR(dragging,canDrag) = 0; - class ACE_CSW: ACE_CSW { + class ace_csw: ace_csw { enabled = 0; }; }; @@ -466,7 +466,7 @@ class vn_o_static_rsna75: StaticMGWeapon { }; }; - class ACE_CSW { + class ace_csw { enabled = 0; }; }; diff --git a/addons/compat_sog/CfgWeapons/csw.hpp b/addons/compat_sog/CfgWeapons/csw.hpp index 87b1b16c5ec..b5ca942f6e8 100644 --- a/addons/compat_sog/CfgWeapons/csw.hpp +++ b/addons/compat_sog/CfgWeapons/csw.hpp @@ -20,7 +20,7 @@ class GVAR(m2_carry): Launcher_Base_F { modes[] = {}; picture = QPATHTOF(UI\csw_m2b_ca.paa); - class ACE_CSW { + class ace_csw { type = "weapon"; deployTime = 4; pickupTime = 4; @@ -48,7 +48,7 @@ class GVAR(m1919a4_carry): Launcher_Base_F { modes[] = {}; picture = QPATHTOF(UI\csw_m1919a4_ca.paa); - class ACE_CSW { + class ace_csw { type = "weapon"; deployTime = 4; pickupTime = 4; @@ -76,7 +76,7 @@ class GVAR(m1919a6_carry): Launcher_Base_F { modes[] = {}; picture = QPATHTOF(UI\csw_m1919a6_ca.paa); - class ACE_CSW { + class ace_csw { type = "mount"; deployTime = 2; pickupTime = 2; @@ -100,7 +100,7 @@ class GVAR(m60_carry): Launcher_Base_F { modes[] = {}; picture = QPATHTOF(UI\csw_m60_ca.paa); - class ACE_CSW { + class ace_csw { type = "weapon"; deployTime = 4; pickupTime = 4; @@ -128,7 +128,7 @@ class GVAR(tow_carry): Launcher_Base_F { modes[] = {}; picture = QPATHTOF(UI\csw_tow_ca.paa); - class ACE_CSW { + class ace_csw { type = "weapon"; deployTime = 4; pickupTime = 4; @@ -155,7 +155,7 @@ class GVAR(dshkm_carry): Launcher_Base_F { modes[] = {}; picture = QPATHTOF(UI\csw_dshkm_ca.paa); - class ACE_CSW { + class ace_csw { type = "weapon"; deployTime = 4; pickupTime = 4; @@ -183,7 +183,7 @@ class GVAR(dshkm_shield_carry): Launcher_Base_F { modes[] = {}; picture = QPATHTOF(UI\csw_dshkm_shield_ca.paa); - class ACE_CSW { + class ace_csw { type = "weapon"; deployTime = 4; pickupTime = 4; @@ -210,7 +210,7 @@ class GVAR(dshkm_AA_carry): Launcher_Base_F { modes[] = {}; picture = QPATHTOF(UI\csw_dshkm_aa_ca.paa); - class ACE_CSW { + class ace_csw { type = "weapon"; deployTime = 4; pickupTime = 4; @@ -237,7 +237,7 @@ class GVAR(rpd_carry): Launcher_Base_F { modes[] = {}; picture = QPATHTOF(UI\csw_rpd_ca.paa); - class ACE_CSW { + class ace_csw { type = "weapon"; deployTime = 4; pickupTime = 4; @@ -264,7 +264,7 @@ class GVAR(pk_carry): Launcher_Base_F { modes[] = {}; picture = QPATHTOF(UI\csw_pk_ca.paa); - class ACE_CSW { + class ace_csw { type = "weapon"; deployTime = 4; pickupTime = 4; @@ -292,7 +292,7 @@ class GVAR(mortar_m29_carry): Launcher_Base_F { modes[] = {}; picture = QPATHTOF(UI\csw_m29_ca.paa); - class ACE_CSW { + class ace_csw { type = "weapon"; deployTime = 20; pickupTime = 25; @@ -319,7 +319,7 @@ class GVAR(mg42_carry): Launcher_Base_F { modes[] = {}; picture = QPATHTOF(UI\csw_mg42_ca.paa); - class ACE_CSW { + class ace_csw { type = "mount"; deployTime = 4; pickupTime = 4; @@ -347,7 +347,7 @@ class GVAR(sgm_carry): Launcher_Base_F { modes[] = {}; picture = QPATHTOF(UI\csw_sgm_ca.paa); - class ACE_CSW { + class ace_csw { type = "weapon"; deployTime = 4; pickupTime = 4; @@ -374,7 +374,7 @@ class GVAR(sgm_shield_carry): Launcher_Base_F { modes[] = {}; picture = QPATHTOF(UI\csw_sgm_shield_ca.paa); - class ACE_CSW { + class ace_csw { type = "weapon"; deployTime = 4; pickupTime = 4; @@ -401,7 +401,7 @@ class GVAR(mk18_carry): Launcher_Base_F { modes[] = {}; picture = QPATHTOF(UI\csw_mk18_ca.paa); - class ACE_CSW { + class ace_csw { type = "weapon"; deployTime = 4; pickupTime = 4; @@ -430,7 +430,7 @@ class GVAR(mortar_m2_carry): Launcher_Base_F { modes[] = {}; picture = QPATHTOF(UI\csw_m2_ca.paa); - class ACE_CSW { + class ace_csw { type = "weapon"; deployTime = 20; pickupTime = 25; @@ -457,7 +457,7 @@ class GVAR(mortar_type53_carry): Launcher_Base_F { modes[] = {}; picture = QPATHTOF(UI\csw_type53_ca.paa); - class ACE_CSW { + class ace_csw { type = "weapon"; deployTime = 20; pickupTime = 25; diff --git a/addons/dragon/CfgVehicles.hpp b/addons/dragon/CfgVehicles.hpp index 13441c6c26a..9cc60771b51 100644 --- a/addons/dragon/CfgVehicles.hpp +++ b/addons/dragon/CfgVehicles.hpp @@ -107,7 +107,7 @@ class CfgVehicles { soundGetIn[] = {"A3\sounds_f\dummysound",0.00031622776,1,5}; armorStructural = 10.0; - class ACE_CSW { + class ace_csw { disassembleTo = QGVAR(super); }; diff --git a/addons/dragon/CfgWeapons.hpp b/addons/dragon/CfgWeapons.hpp index 9cb58e2c1f4..0bdd53e34f2 100644 --- a/addons/dragon/CfgWeapons.hpp +++ b/addons/dragon/CfgWeapons.hpp @@ -19,7 +19,7 @@ class CfgWeapons { descriptionShort = CSTRING(dragonDescription); scope = 2; - class ACE_CSW { + class ace_csw { type = "mount"; deployTime = 2; pickupTime = 2; @@ -75,7 +75,7 @@ class CfgWeapons { opticsZoomMin = 0.055; opticsZoomMax = 0.055; scope = 2; - class ACE_CSW { + class ace_csw { type = "weapon"; deployTime = 2; pickupTime = 1; From 8e15525f6a7ffbaf55521a679a499997b1f4d2c1 Mon Sep 17 00:00:00 2001 From: Fabio Schick <58027418+mrschick@users.noreply.github.com> Date: Tue, 17 Sep 2024 18:57:43 +0200 Subject: [PATCH 013/188] Aircraft - Fix Drone "Loiter" Waypoint Action (#10319) --- addons/aircraft/functions/fnc_droneSetWaypoint.sqf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/aircraft/functions/fnc_droneSetWaypoint.sqf b/addons/aircraft/functions/fnc_droneSetWaypoint.sqf index 953b99a357a..45c18c63da2 100644 --- a/addons/aircraft/functions/fnc_droneSetWaypoint.sqf +++ b/addons/aircraft/functions/fnc_droneSetWaypoint.sqf @@ -62,6 +62,8 @@ if (_type == "FOLLOW" && {["CAManBase", "LandVehicle", "Ship"] findIf {_target i _waypoint setWaypointPosition [getPosASL _target, -1]; }; }, 3, [_vehicle, _group, _waypoint, _target]] call CBA_fnc_addPerFrameHandler; +} else { + _waypoint setWaypointType _type; }; TRACE_3("",_currentHeight,_currentLoiterRadius,_currentLoiterType); From a8302ac20a0437c90c9761b818f0492c9617499c Mon Sep 17 00:00:00 2001 From: Drofseh Date: Tue, 17 Sep 2024 09:58:37 -0700 Subject: [PATCH 014/188] Overheating - Set ammo to ambientTemperature on reload (#10320) --- addons/overheating/XEH_postInit.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/overheating/XEH_postInit.sqf b/addons/overheating/XEH_postInit.sqf index a49030b1adb..4abe8d93ee5 100644 --- a/addons/overheating/XEH_postInit.sqf +++ b/addons/overheating/XEH_postInit.sqf @@ -71,7 +71,7 @@ if (hasInterface) then { ["CAManBase", "Reloaded", { params ["_unit", "_weapon", "_muzzle"]; if (_muzzle == _weapon) then { - _unit setVariable [format [QGVAR(%1_ammoTemp), _weapon], 0]; + _unit setVariable [format [QGVAR(%1_ammoTemp), _weapon], ambientTemperature select 0]; }; }] call CBA_fnc_addClassEventHandler; }; From 6c2eacc95416351e8ec0f4eeab7142692771cb4d Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Tue, 17 Sep 2024 18:59:11 +0200 Subject: [PATCH 015/188] CUP Weapons Compat - Use macros for CSW (#10317) --- .../compat_cup_weapons_csw/CfgVehicles.hpp | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/addons/compat_cup_weapons/compat_cup_weapons_csw/CfgVehicles.hpp b/addons/compat_cup_weapons/compat_cup_weapons_csw/CfgVehicles.hpp index 752745fb35e..c96253ec51c 100644 --- a/addons/compat_cup_weapons/compat_cup_weapons_csw/CfgVehicles.hpp +++ b/addons/compat_cup_weapons/compat_cup_weapons_csw/CfgVehicles.hpp @@ -19,7 +19,7 @@ class CfgVehicles { magazineLocation = "_target selectionPosition 'otochlaven'"; proxyWeapon = "CUP_proxy_mortar_82mm"; disassembleWeapon = "CUP_2b14_carry"; - disassembleTurret = "ace_csw_mortarBaseplate"; + disassembleTurret = QEGVAR(csw,mortarBaseplate); desiredAmmo = 1; ammoLoadTime = 3; ammoUnloadTime = 3; @@ -29,14 +29,14 @@ class CfgVehicles { class CUP_M252_base: CUP_2b14_82mm_Base { class ace_csw: ace_csw { disassembleWeapon = "CUP_m252_carry"; - disassembleTurret = "ace_csw_mortarBaseplate"; + disassembleTurret = QEGVAR(csw,mortarBaseplate); }; }; class CUP_L16A2_base: CUP_M252_base { class ace_csw: ace_csw { disassembleWeapon = "CUP_l16a2_carry"; - disassembleTurret = "ace_csw_mortarBaseplate"; + disassembleTurret = QEGVAR(csw,mortarBaseplate); }; }; @@ -47,7 +47,7 @@ class CfgVehicles { proxyWeapon = "CUP_proxy_m2"; magazineLocation = "_target selectionPosition 'magazine'"; disassembleWeapon = "CUP_m2_carry"; - disassembleTurret = "ace_csw_m3Tripod"; + disassembleTurret = QEGVAR(csw,m3Tripod); desiredAmmo = 100; ammoLoadTime = 10; ammoUnloadTime = 8; @@ -57,7 +57,7 @@ class CfgVehicles { class CUP_M2StaticMG_MiniTripod_base: CUP_M2StaticMG_base { class ace_csw: ace_csw { enabled = 1; - disassembleTurret = "ace_csw_m3TripodLow"; + disassembleTurret = QEGVAR(csw,m3TripodLow); }; }; @@ -67,7 +67,7 @@ class CfgVehicles { proxyWeapon = "CUP_proxy_DSHKM"; magazineLocation = "_target selectionPosition 'otocvez'"; disassembleWeapon = "CUP_DSHKM_carry"; - disassembleTurret = "ace_csw_kordTripod"; + disassembleTurret = QEGVAR(csw,kordTripod); desiredAmmo = 100; ammoLoadTime = 10; ammoUnloadTime = 8; @@ -87,7 +87,7 @@ class CfgVehicles { proxyWeapon = "CUP_proxy_KORD"; magazineLocation = "_target selectionPosition 'magazine'"; disassembleWeapon = "CUP_KORD_carry"; - disassembleTurret = "ace_csw_kordTripod"; + disassembleTurret = QEGVAR(csw,kordTripod); desiredAmmo = 100; ammoLoadTime = 10; ammoUnloadTime = 8; @@ -97,7 +97,7 @@ class CfgVehicles { class CUP_KORD_MiniTripod_Base: CUP_KORD_Base { class ace_csw: ace_csw { enabled = 1; - disassembleTurret = "ace_csw_kordTripodLow"; + disassembleTurret = QEGVAR(csw,kordTripodLow); }; }; @@ -108,7 +108,7 @@ class CfgVehicles { proxyWeapon = "CUP_proxy_AGS30"; magazineLocation = "_target selectionPosition 'otochlaven'"; disassembleWeapon = "CUP_AGS30_carry"; - disassembleTurret = "ace_csw_sag30Tripod"; + disassembleTurret = QEGVAR(csw,sag30Tripod); desiredAmmo = 29; ammoLoadTime = 10; ammoUnloadTime = 8; @@ -121,7 +121,7 @@ class CfgVehicles { proxyWeapon = "CUP_proxy_MK19"; magazineLocation = "_target selectionPosition 'otochlaven'"; disassembleWeapon = "CUP_MK19_carry"; - disassembleTurret = "ace_csw_m3TripodLow"; + disassembleTurret = QEGVAR(csw,m3TripodLow); desiredAmmo = 48; ammoLoadTime = 10; ammoUnloadTime = 8; @@ -148,7 +148,7 @@ class CfgVehicles { proxyWeapon = "CUP_proxy_TOW"; magazineLocation = "_target selectionPosition 'otochlaven'"; disassembleWeapon = "CUP_TOW_carry"; - disassembleTurret = "ace_csw_m220Tripod"; + disassembleTurret = QEGVAR(csw,m220Tripod); desiredAmmo = 1; ammoLoadTime = 8; ammoUnloadTime = 5; @@ -167,7 +167,7 @@ class CfgVehicles { proxyWeapon = "CUP_proxy_SPG9"; magazineLocation = "_target selectionPosition 'handle'"; disassembleWeapon = "CUP_SPG9_carry"; - disassembleTurret = "ace_csw_spg9Tripod"; + disassembleTurret = QEGVAR(csw,spg9Tripod); desiredAmmo = 1; ammoLoadTime = 5; ammoUnloadTime = 3; From 038dce8b3acb935a13fec9b3c9a79a039c971699 Mon Sep 17 00:00:00 2001 From: Bailey Danyluk Date: Tue, 17 Sep 2024 10:59:33 -0600 Subject: [PATCH 016/188] Cargo - Add object variable for custom interaction delay (#10308) --- addons/cargo/XEH_PREP.hpp | 1 + addons/cargo/functions/fnc_deployConfirm.sqf | 2 +- addons/cargo/functions/fnc_getDelayItem.sqf | 26 ++++++++++++++++++++ addons/cargo/functions/fnc_startLoadIn.sqf | 2 +- addons/cargo/functions/fnc_startUnload.sqf | 4 +-- docs/wiki/framework/cargo-framework.md | 20 +++++++++++---- 6 files changed, 46 insertions(+), 9 deletions(-) create mode 100644 addons/cargo/functions/fnc_getDelayItem.sqf diff --git a/addons/cargo/XEH_PREP.hpp b/addons/cargo/XEH_PREP.hpp index 10281e29674..4632a401f17 100644 --- a/addons/cargo/XEH_PREP.hpp +++ b/addons/cargo/XEH_PREP.hpp @@ -5,6 +5,7 @@ PREP(canUnloadItem); PREP(deployCancel); PREP(deployConfirm); PREP(getCargoSpaceLeft); +PREP(getDelayItem); PREP(getNameItem); PREP(getSelectedItem); PREP(getSizeItem); diff --git a/addons/cargo/functions/fnc_deployConfirm.sqf b/addons/cargo/functions/fnc_deployConfirm.sqf index 27674b0515b..e4c87342f04 100644 --- a/addons/cargo/functions/fnc_deployConfirm.sqf +++ b/addons/cargo/functions/fnc_deployConfirm.sqf @@ -24,7 +24,7 @@ if (!isNull GVAR(itemPreviewObject) && {[GVAR(selectedItem), GVAR(interactionVeh // Position is AGL for unloading event private _position = ASLToAGL getPosASL GVAR(itemPreviewObject); private _direction = getDir GVAR(itemPreviewObject); - private _duration = GVAR(loadTimeCoefficient) * (GVAR(selectedItem) call FUNC(getSizeItem)); + private _duration = [GVAR(selectedItem), false] call FUNC(getDelayItem); // If unload time is 0, don't show a progress bar if (_duration <= 0) exitWith { diff --git a/addons/cargo/functions/fnc_getDelayItem.sqf b/addons/cargo/functions/fnc_getDelayItem.sqf new file mode 100644 index 00000000000..7f1d6b4d401 --- /dev/null +++ b/addons/cargo/functions/fnc_getDelayItem.sqf @@ -0,0 +1,26 @@ +#include "..\script_component.hpp" +/* + * Author: tcvm + * Gets the delay duration an item should take to load/unload. + * + * Arguments: + * 0: Item or + * 1: If delay is for paradrop context + * + * Return Value: + * Item load/unload duration + * + * Example: + * [cursorObject, false] call ace_cargo_fnc_getDelayItem + * + * Public: No + */ + +params ["_item", "_isParadrop"]; + +if ((_item isEqualType objNull) && {_item getVariable [QGVAR(delay), -1] >= 0}) exitWith { + _item getVariable QGVAR(delay) // return +}; + +([GVAR(loadTimeCoefficient), GVAR(paradropTimeCoefficent)] select _isParadrop) * (_item call FUNC(getSizeItem)) // return + diff --git a/addons/cargo/functions/fnc_startLoadIn.sqf b/addons/cargo/functions/fnc_startLoadIn.sqf index 7212d89c229..23d62c7c01b 100644 --- a/addons/cargo/functions/fnc_startLoadIn.sqf +++ b/addons/cargo/functions/fnc_startLoadIn.sqf @@ -36,7 +36,7 @@ if (isNull _vehicle) exitWith { // Start progress bar if ([_item, _vehicle] call FUNC(canLoadItemIn)) then { - private _duration = GVAR(loadTimeCoefficient) * (_item call FUNC(getSizeItem)); + private _duration = [_item, false] call FUNC(getDelayItem); // If load time is 0, don't show a progress bar if (_duration <= 0) exitWith { diff --git a/addons/cargo/functions/fnc_startUnload.sqf b/addons/cargo/functions/fnc_startUnload.sqf index 39dbf59f48a..e5eaab76dc7 100644 --- a/addons/cargo/functions/fnc_startUnload.sqf +++ b/addons/cargo/functions/fnc_startUnload.sqf @@ -26,7 +26,7 @@ if (GVAR(interactionParadrop)) exitWith { // Close the cargo menu closeDialog 0; - private _duration = GVAR(paradropTimeCoefficent) * (_item call FUNC(getSizeItem)); + private _duration = [_item, true] call FUNC(getDelayItem); // If drop time is 0, don't show a progress bar if (_duration <= 0) exitWith { @@ -81,7 +81,7 @@ if ([_item, GVAR(interactionVehicle), _unit] call FUNC(canUnloadItem)) then { // Close the cargo menu closeDialog 0; - private _duration = GVAR(loadTimeCoefficient) * (_item call FUNC(getSizeItem)); + private _duration = [_item, false] call FUNC(getDelayItem); // If unload time is 0, don't show a progress bar if (_duration <= 0) exitWith { diff --git a/docs/wiki/framework/cargo-framework.md b/docs/wiki/framework/cargo-framework.md index a1d810ce9c4..2e3e695e688 100644 --- a/docs/wiki/framework/cargo-framework.md +++ b/docs/wiki/framework/cargo-framework.md @@ -114,7 +114,17 @@ Note that this function can be used to make objects loadable/unloadable (set to * [object, 3] call ace_cargo_fnc_setSize ``` -### 4.3 Adjusting cargo space of a vehicle +### 4.3 Setting Custom Load/Unload Time + +```sqf +object setVariable ["ace_cargo_delay",