From 0cc1a0a5aefd9392dc30d00989158a90064f370f Mon Sep 17 00:00:00 2001 From: LinkIsGrim Date: Mon, 15 Jan 2024 15:32:10 -0300 Subject: [PATCH 1/4] change config lookups to unitIsUAV --- addons/common/functions/fnc_getVehicleUAVCrew.sqf | 2 +- addons/dragging/functions/fnc_canCarry.sqf | 2 +- addons/dragging/functions/fnc_canDrag.sqf | 2 +- addons/gforces/XEH_postInit.sqf | 2 +- addons/medical_engine/XEH_postInit.sqf | 2 +- addons/medical_status/XEH_preInit.sqf | 5 ++--- 6 files changed, 7 insertions(+), 8 deletions(-) diff --git a/addons/common/functions/fnc_getVehicleUAVCrew.sqf b/addons/common/functions/fnc_getVehicleUAVCrew.sqf index 0ac91e644a4..0ab24b59da8 100644 --- a/addons/common/functions/fnc_getVehicleUAVCrew.sqf +++ b/addons/common/functions/fnc_getVehicleUAVCrew.sqf @@ -17,4 +17,4 @@ params [["_vehicle", objNull, [objNull]]]; -crew _vehicle select {getText (configOf _x >> "simulation") == "UAVPilot"} // return +crew _vehicle select {unitIsUAV _x} // return diff --git a/addons/dragging/functions/fnc_canCarry.sqf b/addons/dragging/functions/fnc_canCarry.sqf index caea20fb8a4..be3015868b5 100644 --- a/addons/dragging/functions/fnc_canCarry.sqf +++ b/addons/dragging/functions/fnc_canCarry.sqf @@ -28,7 +28,7 @@ if ((_unit getHitPointDamage "HitLegs") >= 0.5) exitWith {false}; // Static weapons need to be empty for carrying (ignore UAV AI) if (_target isKindOf "StaticWeapon") exitWith { - (crew _target) findIf {getText (configOf _x >> "simulation") != "UAVPilot"} == -1 + (crew _target) findIf {!unitIsUAV _x} == -1 }; // Units need to be unconscious or limping; Units also need to not be in ragdoll, as that causes desync issues diff --git a/addons/dragging/functions/fnc_canDrag.sqf b/addons/dragging/functions/fnc_canDrag.sqf index 33dcd134b60..586e23feaf8 100644 --- a/addons/dragging/functions/fnc_canDrag.sqf +++ b/addons/dragging/functions/fnc_canDrag.sqf @@ -24,7 +24,7 @@ if !([_unit, _target, ["isNotSwimming"]] call EFUNC(common,canInteractWith)) exi // Static weapons need to be empty for dragging (ignore UAV AI) if (_target isKindOf "StaticWeapon") exitWith { - (crew _target) findIf {getText (configOf _x >> "simulation") != "UAVPilot"} == -1 + (crew _target) findIf {!unitIsUAV _x} == -1 }; // Units need to be unconscious or limping; Units also need to not be in ragdoll, as that causes desync issues diff --git a/addons/gforces/XEH_postInit.sqf b/addons/gforces/XEH_postInit.sqf index a2f69dd6085..f667d565454 100644 --- a/addons/gforces/XEH_postInit.sqf +++ b/addons/gforces/XEH_postInit.sqf @@ -13,7 +13,7 @@ GVAR(playerIsVirtual) = false; ["unit", { // Add unit changed EH to check if player is either virtual (logic) or a UAV AI params ["_unit"]; GVAR(playerIsVirtual) = ((getNumber (configOf _unit >> "isPlayableLogic")) == 1) || - {(getText (configOf _unit >> "simulation")) == "UAVPilot"}; + {unitIsUAV _unit}; TRACE_3("unit changed",_unit,typeOf _unit,GVAR(playerIsVirtual)); }, true] call CBA_fnc_addPlayerEventHandler; diff --git a/addons/medical_engine/XEH_postInit.sqf b/addons/medical_engine/XEH_postInit.sqf index 6455904f95e..5e7e34e5122 100644 --- a/addons/medical_engine/XEH_postInit.sqf +++ b/addons/medical_engine/XEH_postInit.sqf @@ -16,8 +16,8 @@ while {(_allHitPoints param [0, ""]) select [0,1] == "#"} do { WARNING_1("Ignoring Reflector hitpoint %1", _allHitPoints deleteAt 0); }; if (_allHitPoints param [0, ""] != "ACE_HDBracket") then { + if (unitIsUAV _unit) exitWith {TRACE_1("ignore UAV AI",typeOf _unit);}; private _config = configOf _unit; - if (getText (_config >> "simulation") == "UAVPilot") exitWith {TRACE_1("ignore UAV AI",typeOf _unit);}; if (getNumber (_config >> "isPlayableLogic") == 1) exitWith {TRACE_1("ignore logic unit",typeOf _unit)}; ERROR_1("Bad hitpoints for unit type ""%1""",typeOf _unit); } else { diff --git a/addons/medical_status/XEH_preInit.sqf b/addons/medical_status/XEH_preInit.sqf index e3c82d5788b..82146d82e13 100644 --- a/addons/medical_status/XEH_preInit.sqf +++ b/addons/medical_status/XEH_preInit.sqf @@ -12,9 +12,8 @@ PREP_RECOMPILE_END; ["CAManBase", "init", { params ["_unit"]; - private _config = configOf _unit; - if (getText (_config >> "simulation") == "UAVPilot") exitWith {TRACE_1("ignore UAV AI",typeOf _unit);}; - if (getNumber (_config >> "isPlayableLogic") == 1) exitWith {TRACE_1("ignore logic unit",typeOf _unit)}; + if (unitIsUAV _unit) exitWith {TRACE_1("ignore UAV AI",typeOf _unit);}; + if (getNumber ((configOf _unit) >> "isPlayableLogic") == 1) exitWith {TRACE_1("ignore logic unit",typeOf _unit)}; // Hopefully this EH gets added first as it can only effect other EH called after it private _ehIndex = _unit addEventHandler ["Killed", {_this call FUNC(handleKilled)}]; From 4013db4601fa5a0775df3f5fd80f87bfde8d1dde Mon Sep 17 00:00:00 2001 From: LinkIsGrim Date: Mon, 15 Jan 2024 15:33:31 -0300 Subject: [PATCH 2/4] configOf --- addons/medical_engine/XEH_postInit.sqf | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/medical_engine/XEH_postInit.sqf b/addons/medical_engine/XEH_postInit.sqf index 5e7e34e5122..81de63775bf 100644 --- a/addons/medical_engine/XEH_postInit.sqf +++ b/addons/medical_engine/XEH_postInit.sqf @@ -17,8 +17,7 @@ if (_allHitPoints param [0, ""] != "ACE_HDBracket") then { if (unitIsUAV _unit) exitWith {TRACE_1("ignore UAV AI",typeOf _unit);}; - private _config = configOf _unit; - if (getNumber (_config >> "isPlayableLogic") == 1) exitWith {TRACE_1("ignore logic unit",typeOf _unit)}; + if (getNumber ((configOf _unit) >> "isPlayableLogic") == 1) exitWith {TRACE_1("ignore logic unit",typeOf _unit)}; ERROR_1("Bad hitpoints for unit type ""%1""",typeOf _unit); } else { // Calling this function inside curly brackets allows the usage of From 84e040923c6ff9cef358a55cf71611de4a0294aa Mon Sep 17 00:00:00 2001 From: Grim <69561145+LinkIsGrim@users.noreply.github.com> Date: Mon, 15 Jan 2024 17:16:07 -0300 Subject: [PATCH 3/4] Update addons/common/functions/fnc_getVehicleUAVCrew.sqf Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> --- addons/common/functions/fnc_getVehicleUAVCrew.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/common/functions/fnc_getVehicleUAVCrew.sqf b/addons/common/functions/fnc_getVehicleUAVCrew.sqf index 0ab24b59da8..f991e08d570 100644 --- a/addons/common/functions/fnc_getVehicleUAVCrew.sqf +++ b/addons/common/functions/fnc_getVehicleUAVCrew.sqf @@ -17,4 +17,4 @@ params [["_vehicle", objNull, [objNull]]]; -crew _vehicle select {unitIsUAV _x} // return +(crew _vehicle) select {unitIsUAV _x} // return From b40c25a36afd0ed229e7a1a3f6a329bcf1bbc7a8 Mon Sep 17 00:00:00 2001 From: Grim <69561145+LinkIsGrim@users.noreply.github.com> Date: Mon, 15 Jan 2024 18:08:19 -0300 Subject: [PATCH 4/4] Update XEH_postInit.sqf --- addons/gforces/XEH_postInit.sqf | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/gforces/XEH_postInit.sqf b/addons/gforces/XEH_postInit.sqf index f667d565454..d0d58488d30 100644 --- a/addons/gforces/XEH_postInit.sqf +++ b/addons/gforces/XEH_postInit.sqf @@ -12,8 +12,7 @@ GVAR(playerIsVirtual) = false; ["unit", { // Add unit changed EH to check if player is either virtual (logic) or a UAV AI params ["_unit"]; - GVAR(playerIsVirtual) = ((getNumber (configOf _unit >> "isPlayableLogic")) == 1) || - {unitIsUAV _unit}; + GVAR(playerIsVirtual) = unitIsUAV _unit || {(getNumber (configOf _unit >> "isPlayableLogic")) == 1}; TRACE_3("unit changed",_unit,typeOf _unit,GVAR(playerIsVirtual)); }, true] call CBA_fnc_addPlayerEventHandler;