From b5d6c0bd90e105b378c3a3837fd8a13cfde42d88 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Fri, 11 Oct 2024 19:20:03 -0500 Subject: [PATCH] Common - Use `objectParent` for vehicle detection (HEMTT L-S18) --- .hemtt/lints.toml | 5 +++++ addons/common/fnc_canUseWeapon.sqf | 2 +- addons/common/fnc_deleteEntity.sqf | 2 +- addons/common/fnc_getUnitAnim.sqf | 2 +- addons/common/fnc_getUnitDeathAnim.sqf | 2 +- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.hemtt/lints.toml b/.hemtt/lints.toml index 09ce4a7359..307aa7f4bc 100644 --- a/.hemtt/lints.toml +++ b/.hemtt/lints.toml @@ -2,3 +2,8 @@ options.ignore = [ "addPublicVariableEventHandler", # Alt syntax is broken, we are using main syntax ] + +[sqf.var_all_caps] +options.ignore = [ + "SLX_*" +] diff --git a/addons/common/fnc_canUseWeapon.sqf b/addons/common/fnc_canUseWeapon.sqf index 49653b41e7..1c8b4a2de3 100644 --- a/addons/common/fnc_canUseWeapon.sqf +++ b/addons/common/fnc_canUseWeapon.sqf @@ -23,7 +23,7 @@ SCRIPT(canUseWeapon); params [["_unit", objNull, [objNull]]]; -if (_unit == vehicle _unit) exitWith {true}; +if (isNull objectParent _unit) exitWith {true}; private _config = configFile >> "CfgMovesMaleSdr" >> "States" >> animationState _unit; diff --git a/addons/common/fnc_deleteEntity.sqf b/addons/common/fnc_deleteEntity.sqf index 69e18d6a84..ffb70f440f 100644 --- a/addons/common/fnc_deleteEntity.sqf +++ b/addons/common/fnc_deleteEntity.sqf @@ -30,7 +30,7 @@ switch (typeName _entity) do { } forEach _entity; }; case "OBJECT" : { - if (vehicle _entity != _entity) then { + if (!isNull objectParent _entity) then { unassignVehicle _entity; _entity setPosASL [0,0,0]; } else { diff --git a/addons/common/fnc_getUnitAnim.sqf b/addons/common/fnc_getUnitAnim.sqf index d8ee8ee07e..d0ca513662 100644 --- a/addons/common/fnc_getUnitAnim.sqf +++ b/addons/common/fnc_getUnitAnim.sqf @@ -32,7 +32,7 @@ private _anim = toArray(toLower(animationState _unit)); private _upos = "unknown"; private _umov = "stop"; -if (vehicle _unit!= _unit) then { +if (!isNull objectParent _unit) then { _upos = "vehicle"; } else { if (count _anim < 12) exitWith {}; diff --git a/addons/common/fnc_getUnitDeathAnim.sqf b/addons/common/fnc_getUnitDeathAnim.sqf index a664388483..69c315ccf5 100644 --- a/addons/common/fnc_getUnitDeathAnim.sqf +++ b/addons/common/fnc_getUnitDeathAnim.sqf @@ -27,7 +27,7 @@ private _deathAnim = ""; private _curAnim = (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState _unit)); if (isText (_curAnim >> "actions")) then { - if (vehicle _unit == _unit) then { + if (isNull objectParent _unit) then { private _deathAnimCfg = (configFile >> "CfgMovesBasic" >> "Actions" >> (getText (_curAnim >> "actions")) >> "die"); if (isText _deathAnimCfg) then { _deathAnim = getText _deathAnimCfg;