From adc7db9ae9b9e3c457726a5b234edd32900b3d4a Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Fri, 10 Apr 2015 15:02:36 -0500 Subject: [PATCH] #456 - Fix AI rotating while dead (disableAI func) Still some small head movements, but I don't know how to fix that. --- addons/common/functions/fnc_disableAI.sqf | 42 ++++++++++++------- .../medical/functions/fnc_setUnconscious.sqf | 2 +- 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/addons/common/functions/fnc_disableAI.sqf b/addons/common/functions/fnc_disableAI.sqf index 9e1bf59a6f..92ad35c0f9 100644 --- a/addons/common/functions/fnc_disableAI.sqf +++ b/addons/common/functions/fnc_disableAI.sqf @@ -1,23 +1,37 @@ -/** - * fn_disableAI_f.sqf - * @Descr: N/A - * @Author: Glowbal +/* + * Author: Glowbal, KoffeinFlummi + * Disables/Enables AI * - * @Arguments: [] - * @Return: - * @PublicAPI: false + * Arguments: + * 0: Unit + * 1: Disable AI + * + * Return Value: + * None + * + * Example: + * [bob, true] call ace_common_fnc_disableAI; + * + * Public: No */ #include "script_component.hpp" -private ["_unit","_disable"]; -_unit = [_this, 0,ObjNull,[ObjNull]] call BIS_fnc_Param; -_disable = [_this, 1,false,[false]] call BIS_fnc_Param; -if (local _unit && !(IsPlayer _unit)) then { +PARAMS_2(_unit,_disable); + +if ((local _unit) && {!([_unit] call EFUNC(common,isPlayer))}) then { if (_disable) then { - _unit disableAI "Move"; + _unit disableAI "MOVE"; _unit disableAI "TARGET"; + _unit disableAI "AUTOTARGET"; + _unit disableAI "FSM"; + _unit disableConversation true; } else { - _unit enableAI "Move"; + //Sanity check to make sure we don't enable unconsious AI + if (_unit getVariable ["ace_isunconscious", false]) exitWith {ERROR("Enabling AI for unconsious unit");}; + _unit enableAI "MOVE"; _unit enableAI "TARGET"; + _unit enableAI "AUTOTARGET"; + _unit enableAI "FSM"; + _unit disableConversation false; }; -}; \ No newline at end of file +}; diff --git a/addons/medical/functions/fnc_setUnconscious.sqf b/addons/medical/functions/fnc_setUnconscious.sqf index c518b93a97..e373901610 100644 --- a/addons/medical/functions/fnc_setUnconscious.sqf +++ b/addons/medical/functions/fnc_setUnconscious.sqf @@ -116,7 +116,7 @@ _startingTime = time; // Swhich the unit back to its original group [_unit, false, "ACE_isUnconscious", side group _unit] call EFUNC(common,switchToGroupSide); - [_unit, false] call EFUNC(common,disableAI_F); + [_unit, false] call EFUNC(common,disableAI); _unit setUnitPos _originalPos; // This is not position but stance (DOWN, MIDDLE, UP) _unit setUnconscious false;