Skip to content

Commit cef9103

Browse files
authored
Replaced doMove with moveTo for better response
1 parent a7e92c2 commit cef9103

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

addons/AIO_AIMENU/mount.sqf

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,43 +29,45 @@ _getInFnc =
2929
private _cond = ((vehicle _unit) isKindOf "Air" && (getPos (vehicle _unit)) select 2 > 0);
3030
if (vehicle _unit == _target OR _cond) exitWith {_unit setVariable ["AIO_Mount_Canceled", 1]};
3131
if (vehicle _unit != _unit) then {doGetOut _unit; waitUntil {vehicle _unit == _unit OR !alive _unit OR !alive (vehicle _unit)};};
32+
doStop _unit;
33+
sleep 0.2;
3234
if (_getInAs == 1) then {
3335
_driver = getText (configfile >> "CfgVehicles" >> (typeOf _target) >> "memoryPointsGetInDriver");
34-
if (_driver == "") exitWith {_targetPos = getPos _target;_unit doMove _targetPos;};
36+
if (_driver == "") exitWith {_targetPos = getPos _target;_unit moveTo _targetPos;};
3537
_targetPos = (_target modelToWorld (_target selectionPosition _driver));
36-
_unit doMove _targetPos;
38+
_unit moveTo _targetPos;
3739
};
3840
if (_getInAs == 2) then {
3941
_commander = getText (configfile >> "CfgVehicles" >> (typeOf _target) >> "memoryPointsGetInCoDriver");
40-
if (_commander == "") exitWith {_targetPos = getPos _target;_unit doMove _targetPos;};
42+
if (_commander == "") exitWith {_targetPos = getPos _target;_unit moveTo _targetPos;};
4143
_targetPos = (_target modelToWorld (_target selectionPosition _commander));
42-
_unit doMove _targetPos;
44+
_unit moveTo _targetPos;
4345
};
4446
if (_getInAs == 3 OR _getInAs == 4) then {
4547
_cargo = getText (configfile >> "CfgVehicles" >> (typeOf _target) >> "memoryPointsGetInCargo");
46-
if (_cargo == "") exitWith {_targetPos = getPos _target;_unit doMove _targetPos;};
48+
if (_cargo == "") exitWith {_targetPos = getPos _target;_unit moveTo _targetPos;};
4749
_targetPos = (_target modelToWorld (_target selectionPosition _cargo));
48-
_unit doMove _targetPos;
50+
_unit moveTo _targetPos;
4951
};
5052
sleep 0.2;
5153
_lastPos = getPos _unit;
52-
while {currentCommand _unit == "MOVE" && !(unitReady _unit) && (alive _unit) && (alive _target)} do
54+
while {currentCommand _unit == "STOP" && !(moveToCompleted _unit) && (alive _unit) && (alive _target)} do
5355
{
5456
if ((_target distance _lastPos) > 2) then {
5557
if (_getInAs == 1) then {
56-
if (_driver == "") exitWith {_targetPos = getPos _target;_unit doMove _targetPos;};
58+
if (_driver == "") exitWith {_targetPos = getPos _target;_unit moveTo _targetPos;};
5759
_targetPos = (_target modelToWorld (_target selectionPosition _driver));
58-
_unit doMove _targetPos;
60+
_unit moveTo _targetPos;
5961
};
6062
if (_getInAs == 2) then {
61-
if (_commander == "") exitWith {_targetPos = getPos _target;_unit doMove _targetPos;};
63+
if (_commander == "") exitWith {_targetPos = getPos _target;_unit moveTo _targetPos;};
6264
_targetPos = (_target modelToWorld (_target selectionPosition _commander));
63-
_unit doMove _targetPos;
65+
_unit moveTo _targetPos;
6466
};
6567
if (_getInAs == 3 OR _getInAs == 4) then {
66-
if (_cargo == "") exitWith {_targetPos = getPos _target;_unit doMove _targetPos;};
68+
if (_cargo == "") exitWith {_targetPos = getPos _target;_unit moveTo _targetPos;};
6769
_targetPos = (_target modelToWorld (_target selectionPosition _cargo));
68-
_unit doMove _targetPos;
70+
_unit moveTo _targetPos;
6971
};
7072
};
7173
_lastPos = getPos _target;
@@ -162,6 +164,6 @@ AIO_selectedUnits = AIO_selectedUnits - (_unitsToMount apply {_x select 0});
162164
while {(vehicle _driver == _veh) && (alive _veh) && (alive _driver) && (alive _unit) && !(_unit in (crew _veh)) && (_unit getVariable ["AIO_Mount_Canceled", 0] != 1)} do {sleep 1};
163165
} forEach _unitsToMount;
164166
_driver enableAI "MOVE";
165-
if ((_veh isKindOf "Helicopter") && (_driver in (units group player))) then {_veh flyInHeight 50; _driver doMove (getPos _driver)};
167+
if ((_veh isKindOf "Helicopter") && (_driver in (units group player))) then {_veh flyInHeight 50; _driver moveTo (getPos _driver)};
166168
};
167169
};

0 commit comments

Comments
 (0)