optimized to no longer send classes

Also added support for UID or ID maintain as well as a damage >= 10%
check
This commit is contained in:
[VB]AWOL
2014-01-22 09:32:07 -06:00
parent 054ab1ef45
commit 3e5790dbb5

View File

@@ -3,31 +3,45 @@ private ["_player","_ObjArray","_uniqueID","_objects","_key"];
_player = _this select 0; _player = _this select 0;
_option = _this select 1; _option = _this select 1;
/* /*
1: PVDZE_maintainArea = [player,1,[_target, _objectClasses, _range],_uniqueID]; 1: PVDZE_maintainArea = [player,1,_target];
2: PVDZE_maintainArea = [player,2,[_object],_uniqueID]; 2: PVDZE_maintainArea = [player,2,_object];
*/ */
_ObjArray = _this select 2; _targetObj = _this select 2;
_uniqueID = _this select 3;
if (_uniqueID in DZEMaintainCache) exitWith { }; //Just do it only one time
DZEMaintainCache = DZEMaintainCache + [_uniqueID];
if (_option == 1) then { if (_option == 1) then {
_objects = nearestObjects _ObjArray; _objects = nearestObjects [_targetObj, DZE_maintainClasses, DZE_maintainRange];
{ {
_objectID = _x getVariable ["ObjectID","0"]; if (damage _x >= 0.1) then {
//_objectUID = _x getVariable ["ObjectUID","0"]; // repair object also removes maintain option
_x setDamage 0;
_key = format["CHILD:396:%1:", _objectID]; //Use ID instead of UID because ID is shorter _objectID = _x getVariable ["ObjectID","0"];
_key call server_maintainObj; if (_objectID == "0") then {
_objectUID = _x getVariable ["ObjectUID","0"];
if (_objectUID != "0") then {
_key = format["CHILD:397:%1:", _objectUID]; // use UID if not "0" and ID is "0"
_key call server_maintainObj;
};
} else {
_key = format["CHILD:396:%1:", _objectID]; //Use ID instead of UID because ID is shorter
_key call server_maintainObj;
};
};
} forEach _objects; } forEach _objects;
diag_log format ["MAINTAIN AREA BY %1 - %2 Objects at %3", name _player, count _objects, position _player]; diag_log format ["MAINTAIN AREA BY %1 - %2 Objects at %3", name _player, count _objects, position _player];
}; };
if (_option == 2) then { if (_option == 2) then {
_objectID = _ObjArray getVariable ["ObjectID","0"]; if (damage _targetObj >= 0.1) then {
_key = format["CHILD:396:%1:", _objectID]; //Use ID instead of UID because ID is shorter _objectID = _targetObj getVariable ["ObjectID","0"];
_key call server_maintainObj; if (_objectID == "0") then {
_objectUID = _targetObj getVariable ["ObjectUID","0"];
if (_objectUID != "0") then {
_key = format["CHILD:397:%1:", _objectUID]; // use UID if not "0" and ID is "0"
_key call server_maintainObj;
};
} else {
_key = format["CHILD:396:%1:", _objectID]; //Use ID instead of UID because ID is shorter
_key call server_maintainObj;
};
};
}; };