From 80773daac119ba9bce02f0e67cff941d7ecd3329 Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Sun, 13 Oct 2024 11:22:02 +0200 Subject: [PATCH 1/2] Update misc to use 2.18 commands --- addons/common/XEH_postInit.sqf | 2 +- .../common/functions/fnc_adjustMagazineAmmo.sqf | 2 +- addons/csw/functions/fnc_reload_loadMagazine.sqf | 16 +++++++--------- addons/grenades/functions/fnc_incendiary.sqf | 14 ++------------ addons/interact_menu/functions/fnc_splitPath.sqf | 10 ++-------- 5 files changed, 13 insertions(+), 31 deletions(-) diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index 98520aef937..26b05beca85 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -137,7 +137,7 @@ params ["_unit", "_disable"]; if (_disable) then { - private _features = ["AUTOTARGET", "TARGET", "WEAPONAIM"/*, "FIREWEAPON"*/, "RADIOPROTOCOL"]; // TODO: Uncomment in 2.18 + private _features = ["AUTOTARGET", "TARGET", "WEAPONAIM", "FIREWEAPON", "RADIOPROTOCOL"]; // Save current status _unit setVariable [QGVAR(featuresAiUAV), _features apply {[_x, _unit checkAIFeature _x]}]; diff --git a/addons/common/functions/fnc_adjustMagazineAmmo.sqf b/addons/common/functions/fnc_adjustMagazineAmmo.sqf index 87d5b9e899c..11b582a14c1 100644 --- a/addons/common/functions/fnc_adjustMagazineAmmo.sqf +++ b/addons/common/functions/fnc_adjustMagazineAmmo.sqf @@ -92,7 +92,7 @@ private _maxMagazineAmmo = getNumber (configFile >> "CfgMagazines" >> _magazine // If there is still remaining ammo to add, try add it after having iterated through all containers if (!_removeAmmo && _count > 0) then { { - while {_count > 0 && {_x canAdd [_magazine, 1/* 2.18 , true*/]}} do { + while {_count > 0 && {_x canAdd [_magazine, 1, true]}} do { _x addMagazineAmmoCargo [_magazine, 1, _count]; _count = _count - _maxMagazineAmmo; diff --git a/addons/csw/functions/fnc_reload_loadMagazine.sqf b/addons/csw/functions/fnc_reload_loadMagazine.sqf index a5a3e07c06e..4ceb042b818 100644 --- a/addons/csw/functions/fnc_reload_loadMagazine.sqf +++ b/addons/csw/functions/fnc_reload_loadMagazine.sqf @@ -54,17 +54,15 @@ private _onFinish = { // Workaround for removeSpecificMagazine and WeaponHolders being deleted when empty, give back to the unit if the weapon holder was deleted // TODO: Pass type and position of deleted object to create a new one - // TODO: Use '_magSource getEntityInfo 14' in 2.18 and the isSetForDeletion flag to execute in same frame - [{ - params ["_magSource", "_unit", "_args"]; + private _args = [_vehicle, _turret, _magSource, _carryMag, _bestAmmoToSend]; - if (isNull _magSource) then { - _args pushBack _unit; - }; + // If the source is set for deletion, give mag back to unit + if (_magSource getEntityInfo 14) then { + _args pushBack _unit; + }; - TRACE_1("calling addTurretMag event",_args); - [QGVAR(addTurretMag), _args] call CBA_fnc_globalEvent; - }, [_magSource, _unit, [_vehicle, _turret, _magSource, _carryMag, _bestAmmoToSend]]] call CBA_fnc_execNextFrame; + TRACE_1("calling addTurretMag event",_args); + [QGVAR(addTurretMag), _args] call CBA_fnc_globalEvent; }; diff --git a/addons/grenades/functions/fnc_incendiary.sqf b/addons/grenades/functions/fnc_incendiary.sqf index 9d416c5e115..3976d1b5ff5 100644 --- a/addons/grenades/functions/fnc_incendiary.sqf +++ b/addons/grenades/functions/fnc_incendiary.sqf @@ -44,21 +44,11 @@ if (isNull _projectile) exitWith {TRACE_1("null",_projectile);}; private _position = position _projectile; // Alert nearby hostile AI -private _nearLocalEnemies = []; - -{ - { - if (local _x && {[_center, side group _x] call BIS_fnc_sideIsEnemy}) then { // WE WANT THE OBJECT'S SIDE HERE! - _nearLocalEnemies pushBackUnique _x; - }; - } forEach crew _x; -} forEach (_position nearObjects ALERT_NEAR_ENEMY_RANGE); //@todo replace with nearEntities in 2.18 - { - if (behaviour _x in ["SAFE", "AWARE"]) then { + if (local _x && {[_center, side group _x] call BIS_fnc_sideIsEnemy} && {behaviour _x in ["SAFE", "AWARE"]}) then { // WE WANT THE OBJECT'S SIDE HERE! _x setBehaviour "COMBAT"; }; -} forEach _nearLocalEnemies; +} forEach ([_position, ALERT_NEAR_ENEMY_RANGE, ALERT_NEAR_ENEMY_RANGE, 0, false] nearEntities [["CAManBase"], false, true, true]); // Fire particles private _fire = "#particlesource" createVehicleLocal _position; diff --git a/addons/interact_menu/functions/fnc_splitPath.sqf b/addons/interact_menu/functions/fnc_splitPath.sqf index 8fabaca5a56..ae90f38dbe8 100644 --- a/addons/interact_menu/functions/fnc_splitPath.sqf +++ b/addons/interact_menu/functions/fnc_splitPath.sqf @@ -11,7 +11,7 @@ * 1: Action name * * Example: - * [[path]] call ACE_interact_menu_fnc_splitPath + * ["ACE_TapShoulderRight", "VulcanPinch"] call ace_interact_menu_fnc_splitPath * * Public: No */ @@ -20,12 +20,6 @@ private _parentPath = []; _parentPath append _this; -private _count = count _this; - -private _actionName = if (_count > 0) then { - _parentPath deleteAt (_count - 1) // TODO: replace with _parentPath deleteAt [-1] and drop _count in 2.18 -} else { - "" -}; +private _actionName = (_parentPath deleteAt [-1]) param [0, ""]; [_parentPath, _actionName] From 6708a4be4fadea260e2839943f58866330e892e2 Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Sun, 13 Oct 2024 10:41:23 -0700 Subject: [PATCH 2/2] Update addons/common/functions/fnc_adjustMagazineAmmo.sqf --- addons/common/functions/fnc_adjustMagazineAmmo.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/common/functions/fnc_adjustMagazineAmmo.sqf b/addons/common/functions/fnc_adjustMagazineAmmo.sqf index 11b582a14c1..062ee3dea90 100644 --- a/addons/common/functions/fnc_adjustMagazineAmmo.sqf +++ b/addons/common/functions/fnc_adjustMagazineAmmo.sqf @@ -92,7 +92,7 @@ private _maxMagazineAmmo = getNumber (configFile >> "CfgMagazines" >> _magazine // If there is still remaining ammo to add, try add it after having iterated through all containers if (!_removeAmmo && _count > 0) then { { - while {_count > 0 && {_x canAdd [_magazine, 1, true]}} do { + while {_count > 0 && {_x canAdd _magazine}} do { _x addMagazineAmmoCargo [_magazine, 1, _count]; _count = _count - _maxMagazineAmmo;