updated isPlayer v2

This commit is contained in:
AKALegman 2015-06-08 19:12:16 +01:00
parent 96fccbedf9
commit 1ae8e29ac2
6 changed files with 23 additions and 6 deletions

View File

@ -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)})

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -2847,6 +2847,12 @@
<Spanish>Permita a la IA caer inconsciente</Spanish>
<German>KI kann bewusstlos werden</German>
</Key>
<Key ID="STR_ACE_Medical_MedicalSettings_remoteControlledAI_DisplayName">
<English>Remote Controlled AI</English>
</Key>
<Key ID="STR_ACE_Medical_MedicalSettings_remoteControlledAI_Description">
<English>Treat remote controlled units as AI not players?</English>
</Key>
<Key ID="STR_ACE_Medical_disabled">
<English>Disabled</English>
<Russian>Отключено</Russian>