Skip to content

Commit

Permalink
General - Update miscellaneous to use 2.18 commands (#10404)
Browse files Browse the repository at this point in the history
* Update misc to use 2.18 commands

* Update addons/common/functions/fnc_adjustMagazineAmmo.sqf
  • Loading branch information
johnb432 authored Oct 15, 2024
1 parent a9d4bc3 commit 5792eb2
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 31 deletions.
2 changes: 1 addition & 1 deletion addons/common/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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]}];
Expand Down
2 changes: 1 addition & 1 deletion addons/common/functions/fnc_adjustMagazineAmmo.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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}} do {
_x addMagazineAmmoCargo [_magazine, 1, _count];

_count = _count - _maxMagazineAmmo;
Expand Down
16 changes: 7 additions & 9 deletions addons/csw/functions/fnc_reload_loadMagazine.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};


Expand Down
14 changes: 2 additions & 12 deletions addons/grenades/functions/fnc_incendiary.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 2 additions & 8 deletions addons/interact_menu/functions/fnc_splitPath.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* 1: Action name <STRING>
*
* Example:
* [[path]] call ACE_interact_menu_fnc_splitPath
* ["ACE_TapShoulderRight", "VulcanPinch"] call ace_interact_menu_fnc_splitPath
*
* Public: No
*/
Expand All @@ -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]

0 comments on commit 5792eb2

Please sign in to comment.