mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
updated isPlayer
This commit is contained in:
parent
d3eae58237
commit
96fccbedf9
@ -1,15 +1,21 @@
|
||||
/*
|
||||
* Author: bux578, commy2
|
||||
* Author: bux578, commy2, akalegman
|
||||
*
|
||||
* Checks if a unit is a player / curator controlled unit.
|
||||
* Currently returns false for non-local remote controlled zeus units. (Remotes from another zeus machine)
|
||||
*
|
||||
* Arguments:
|
||||
* 0: unit to be checked (object)
|
||||
* 1: exclude curator controlled units (boolean)
|
||||
*
|
||||
* Return Value:
|
||||
* Bool: is unit a player?
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
isPlayer (_this select 0) || {_this select 0 == call FUNC(player)}
|
||||
private ["_unit", "_excludeRemote"];
|
||||
|
||||
_unit = [_this, 0] call BIS_fnc_param;
|
||||
_excludeRemote = [_this, 1, false] call BIS_fnc_param;
|
||||
|
||||
isPlayer _unit || (!_excludeRemote && {_unit == call FUNC(player)})
|
||||
|
@ -46,11 +46,8 @@ if (_unit == ACE_player) then {
|
||||
};
|
||||
};
|
||||
|
||||
// check if Zeus is remote controlling AI and treat him like one
|
||||
_isRemoteControl = (_unit == ACE_player && !isNull (missionNamespace getVariable ["BIS_fnc_moduleRemoteControl_unit", objNull]));
|
||||
|
||||
// if we have unconsciousness for AI disabled, we will kill the unit instead
|
||||
if ((!([_unit] call EFUNC(common,isPlayer)) || _isRemoteControl) && !_force) then {
|
||||
if (!([_unit, true] 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);
|
||||
|
Loading…
Reference in New Issue
Block a user