abort if stuff changes

This commit is contained in:
commy2 2015-04-22 21:31:42 +02:00
parent f72e171247
commit 6d92a0fe88
4 changed files with 18 additions and 11 deletions

View File

@ -13,25 +13,32 @@
*/
#include "script_component.hpp"
private ["_unit", "_target", "_hitPoint"];
private ["_unit", "_target", "_hitPoint", "_wheel"];
_unit = _this select 0;
_target = _this select 1;
_hitPoint = _this select 2;
_wheel = ARR_SELECT(_this,3,false);
if !([_unit, _target, []] call EFUNC(common,canInteractWith)) exitWith {false};
if !([_unit, GVAR(engineerSetting_Wheel)] call FUNC(isEngineer)) exitWith {false};
// check for a near wheel
private "_wheel";
_wheel = objNull;
{
if ([_unit, _x, ["isNotDragging", "isNotCarrying"]] call EFUNC(common,canInteractWith)) exitWith {
_wheel = _x;
if (typeName _wheel == "OBJECT") then {
// not near interpret as objNull
if !(_wheel in nearestObjects [_unit, ["ACE_Wheel"], 5]) then {
_wheel = objNull;
};
} forEach nearestObjects [_unit, ["ACE_Wheel"], 5];
} else {
_wheel = objNull;
{
if ([_unit, _x, ["isNotDragging", "isNotCarrying"]] call EFUNC(common,canInteractWith)) exitWith {
_wheel = _x;
};
} forEach nearestObjects [_unit, ["ACE_Wheel"], 5];
};
if (isNull _wheel) exitWith {false};

View File

@ -27,7 +27,7 @@ private "_time";
_time = 10;
// open the loading bar
[_time, [_unit, _vehicle, _hitPoint], {(_this select 0) call DFUNC(doRemoveWheel)}, {[localize "STR_ACE_Common_ActionAborted"] call EFUNC(common,displayTextStructured);}, localize "STR_ACE_Repair_RemovingWheel", {true}, []] call EFUNC(common,progressBar);
[_time, [_unit, _vehicle, _hitPoint], {(_this select 0) call DFUNC(doRemoveWheel)}, {[localize "STR_ACE_Common_ActionAborted"] call EFUNC(common,displayTextStructured);}, localize "STR_ACE_Repair_RemovingWheel", {(_this select 0) call DFUNC(canRemoveWheel)}, []] call EFUNC(common,progressBar);
// do animation
[_unit] call EFUNC(common,goKneeling);

View File

@ -40,7 +40,7 @@ if (isLocalized _text) then {
};
// open the loading bar
[_time, [_unit, _vehicle, _hitPoint], {_this call DFUNC(doRepair)}, {_this call DFUNC(doRepair)}, _text, {true}, []] call EFUNC(common,progressBar);
[_time, [_unit, _vehicle, _hitPoint], {_this call DFUNC(doRepair)}, {_this call DFUNC(doRepair)}, _text, {(_this select 0) call DFUNC(canRepair)}, []] call EFUNC(common,progressBar);
// do animation
[_unit] call EFUNC(common,goKneeling);

View File

@ -41,7 +41,7 @@ private "_time";
_time = 10;
// open the loading bar
[_time, [_unit, _vehicle, _hitPoint, _wheel], {(_this select 0) call DFUNC(doReplaceWheel)}, {[objNull, _this select 0 select 3] call DEFUNC(common,claim); [localize "STR_ACE_Common_ActionAborted"] call EFUNC(common,displayTextStructured);}, localize "STR_ACE_Repair_ReplacingWheel", {true}, []] call EFUNC(common,progressBar);
[_time, [_unit, _vehicle, _hitPoint, _wheel], {(_this select 0) call DFUNC(doReplaceWheel)}, {[objNull, _this select 0 select 3] call DEFUNC(common,claim); [localize "STR_ACE_Common_ActionAborted"] call EFUNC(common,displayTextStructured);}, localize "STR_ACE_Repair_ReplacingWheel", {(_this select 0) call DFUNC(canReplaceWheel)}, []] call EFUNC(common,progressBar);
// do animation
[_unit] call EFUNC(common,goKneeling);