From 1ae8e29ac2fa669a95007a01fded60be1fc72d4d Mon Sep 17 00:00:00 2001 From: AKALegman Date: Mon, 8 Jun 2015 19:12:16 +0100 Subject: [PATCH] updated isPlayer v2 --- addons/common/functions/fnc_isPlayer.sqf | 10 +++++----- addons/medical/ACE_Settings.hpp | 4 ++++ addons/medical/CfgVehicles.hpp | 6 ++++++ addons/medical/functions/fnc_moduleMedicalSettings.sqf | 1 + addons/medical/functions/fnc_setUnconscious.sqf | 2 +- addons/medical/stringtable.xml | 6 ++++++ 6 files changed, 23 insertions(+), 6 deletions(-) diff --git a/addons/common/functions/fnc_isPlayer.sqf b/addons/common/functions/fnc_isPlayer.sqf index 30ec465d84..91e54a51c1 100644 --- a/addons/common/functions/fnc_isPlayer.sqf +++ b/addons/common/functions/fnc_isPlayer.sqf @@ -6,16 +6,16 @@ * * Arguments: * 0: unit to be checked (object) - * 1: exclude curator controlled units (boolean) + * 1: exclude remote controlled units (boolean) * * Return Value: * Bool: is unit a player? */ #include "script_component.hpp" -private ["_unit", "_excludeRemote"]; +private ["_unit", "_excludeRemoteControlled"]; -_unit = [_this, 0] call BIS_fnc_param; -_excludeRemote = [_this, 1, false] call BIS_fnc_param; +_unit = _this select 0; +_excludeRemoteControlled = if (count _this > 1) then {_this select 1} else {false}; -isPlayer _unit || (!_excludeRemote && {_unit == call FUNC(player)}) +isPlayer _unit || (!_excludeRemoteControlled && {_unit == call FUNC(player)}) diff --git a/addons/medical/ACE_Settings.hpp b/addons/medical/ACE_Settings.hpp index 606b63dec8..f11d4a2767 100644 --- a/addons/medical/ACE_Settings.hpp +++ b/addons/medical/ACE_Settings.hpp @@ -59,6 +59,10 @@ class ACE_Settings { typeName = "SCALAR"; values[] = {"Disabled", "50/50", "Enabled"}; }; + class GVAR(remoteControlledAI) { + typeName = "BOOL"; + value = 1; + }; class GVAR(preventInstaDeath) { typeName = "BOOL"; value = 0; diff --git a/addons/medical/CfgVehicles.hpp b/addons/medical/CfgVehicles.hpp index ae7beadfda..e93048c752 100644 --- a/addons/medical/CfgVehicles.hpp +++ b/addons/medical/CfgVehicles.hpp @@ -106,6 +106,12 @@ class CfgVehicles { }; }; }; + class remoteControlledAI { + displayName = CSTRING(MedicalSettings_remoteControlledAI_DisplayName); + description = CSTRING(MedicalSettings_remoteControlledAI_Description); + typeName = "BOOL"; + defaultValue = 1; + }; class preventInstaDeath { displayName = CSTRING(MedicalSettings_preventInstaDeath_DisplayName); description = CSTRING(MedicalSettings_preventInstaDeath_Description); diff --git a/addons/medical/functions/fnc_moduleMedicalSettings.sqf b/addons/medical/functions/fnc_moduleMedicalSettings.sqf index 296b4f1d56..00b7a15fcf 100644 --- a/addons/medical/functions/fnc_moduleMedicalSettings.sqf +++ b/addons/medical/functions/fnc_moduleMedicalSettings.sqf @@ -30,6 +30,7 @@ if !(_activated) exitWith {}; [_logic, QGVAR(playerDamageThreshold), "playerDamageThreshold"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(AIDamageThreshold), "AIDamageThreshold"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(enableUnconsciousnessAI), "enableUnconsciousnessAI"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(remoteControlledAI), "remoteControlledAI"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(preventInstaDeath), "preventInstaDeath"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(bleedingCoefficient), "bleedingCoefficient"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(painCoefficient), "painCoefficient"] call EFUNC(common,readSettingFromModule); diff --git a/addons/medical/functions/fnc_setUnconscious.sqf b/addons/medical/functions/fnc_setUnconscious.sqf index a3e46d1661..7b234cff4c 100644 --- a/addons/medical/functions/fnc_setUnconscious.sqf +++ b/addons/medical/functions/fnc_setUnconscious.sqf @@ -47,7 +47,7 @@ if (_unit == ACE_player) then { }; // if we have unconsciousness for AI disabled, we will kill the unit instead -if (!([_unit, true] call EFUNC(common,isPlayer)) && !_force) then { +if (!([_unit, GVAR(remoteControlledAI)] call EFUNC(common,isPlayer)) && !_force) then { _enableUncon = _unit getVariable [QGVAR(enableUnconsciousnessAI), GVAR(enableUnconsciousnessAI)]; if (_enableUncon == 0 or {_enableUncon == 1 and (random 1) < 0.5}) exitWith { [_unit, true] call FUNC(setDead); diff --git a/addons/medical/stringtable.xml b/addons/medical/stringtable.xml index 8856a4e1da..ec1137d8a3 100644 --- a/addons/medical/stringtable.xml +++ b/addons/medical/stringtable.xml @@ -2847,6 +2847,12 @@ Permita a la IA caer inconsciente KI kann bewusstlos werden + + Remote Controlled AI + + + Treat remote controlled units as AI not players? + Disabled Отключено