only setdamage 0 if building has UID or ID

This commit is contained in:
[VB]AWOL
2014-01-22 09:34:47 -06:00
parent ea43bbd0fc
commit 1485569af3

View File

@@ -12,16 +12,16 @@ if (_option == 1) then {
_objects = nearestObjects [_targetObj, DZE_maintainClasses, DZE_maintainRange]; _objects = nearestObjects [_targetObj, DZE_maintainClasses, DZE_maintainRange];
{ {
if (damage _x >= 0.1) then { if (damage _x >= 0.1) then {
// repair object also removes maintain option
_x setDamage 0;
_objectID = _x getVariable ["ObjectID","0"]; _objectID = _x getVariable ["ObjectID","0"];
if (_objectID == "0") then { if (_objectID == "0") then {
_objectUID = _x getVariable ["ObjectUID","0"]; _objectUID = _x getVariable ["ObjectUID","0"];
if (_objectUID != "0") then { if (_objectUID != "0") then {
_x setDamage 0;
_key = format["CHILD:397:%1:", _objectUID]; // use UID if not "0" and ID is "0" _key = format["CHILD:397:%1:", _objectUID]; // use UID if not "0" and ID is "0"
_key call server_maintainObj; _key call server_maintainObj;
}; };
} else { } else {
_x setDamage 0;
_key = format["CHILD:396:%1:", _objectID]; //Use ID instead of UID because ID is shorter _key = format["CHILD:396:%1:", _objectID]; //Use ID instead of UID because ID is shorter
_key call server_maintainObj; _key call server_maintainObj;
}; };
@@ -36,12 +36,15 @@ if (_option == 2) then {
if (_objectID == "0") then { if (_objectID == "0") then {
_objectUID = _targetObj getVariable ["ObjectUID","0"]; _objectUID = _targetObj getVariable ["ObjectUID","0"];
if (_objectUID != "0") then { if (_objectUID != "0") then {
_targetObj setDamage 0;
_key = format["CHILD:397:%1:", _objectUID]; // use UID if not "0" and ID is "0" _key = format["CHILD:397:%1:", _objectUID]; // use UID if not "0" and ID is "0"
_key call server_maintainObj; _key call server_maintainObj;
}; };
} else { } else {
_targetObj setDamage 0;
_key = format["CHILD:396:%1:", _objectID]; //Use ID instead of UID because ID is shorter _key = format["CHILD:396:%1:", _objectID]; //Use ID instead of UID because ID is shorter
_key call server_maintainObj; _key call server_maintainObj;
}; };
}; };
}; };