2015-01-11 16:42:31 +00:00
|
|
|
// by commy2
|
2015-01-13 19:56:02 +00:00
|
|
|
#include "script_component.hpp"
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
private ["_unit", "_target", "_lockTarget", "_owner"];
|
|
|
|
|
|
|
|
_unit = _this select 0;
|
|
|
|
_target = _this select 1;
|
|
|
|
_lockTarget = _this select 2;
|
|
|
|
|
|
|
|
if (isNil "_lockTarget") then {_lockTarget = false};
|
|
|
|
|
2015-01-12 04:02:33 +00:00
|
|
|
_owner = _target getVariable ["ACE_isUsedBy", objNull];
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
if (!isNull _owner && {!isNull _unit} && {_unit != _owner}) then {
|
2015-01-12 04:02:33 +00:00
|
|
|
diag_log text "[ACE] ERROR: Claiming already owned object.";
|
2015-01-11 16:42:31 +00:00
|
|
|
};
|
|
|
|
|
2015-01-12 04:02:33 +00:00
|
|
|
_target setVariable ["ACE_isUsedBy", _unit, true];
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
if (_lockTarget) then {
|
|
|
|
if (!isNull _unit) then {
|
2015-01-12 04:02:33 +00:00
|
|
|
[_target, "{_locked = locked _this; _this setVariable ['ACE_lockStatus', _locked]; _this lock 2}", _target] call FUNC(execRemoteFnc);
|
2015-01-11 16:42:31 +00:00
|
|
|
} else {
|
2015-01-12 04:02:33 +00:00
|
|
|
[_target, "{_this lock (_this getVariable ['ACE_lockStatus', locked _this])}", _target] call FUNC(execRemoteFnc);
|
2015-01-11 16:42:31 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2015-01-12 04:02:33 +00:00
|
|
|
//systemChat str locked _target; systemChat str (_target getVariable ['ACE_lockStatus', locked _target]);
|