Initial pass

Unified ropeDestruction
Added check before ropeCreate
This commit is contained in:
GitHawk 2016-02-26 10:46:12 +01:00
parent 704e858d9c
commit 0b324336ee
3 changed files with 12 additions and 6 deletions

View File

@ -32,8 +32,8 @@ if !(isNil "_nozzle") then {
_nozzleTarget setVariable [QGVAR(nozzle), nil, true];
};
private _rope = _nozzle getVariable [QGVAR(rope), nil];
if !(isNil "_rope") then {
private _rope = _nozzle getVariable [QGVAR(rope), objNull];
if !(isNull _rope) then {
ropeDestroy _rope;
};

View File

@ -42,7 +42,10 @@ if (isNull _nozzle || {_source != _target}) exitWith {false};
_target setVariable [QGVAR(isConnected), false, true];
_target setVariable [QGVAR(ownedNozzle), nil, true];
ropeDestroy (_nozzle getVariable QGVAR(rope));
private _rope = _nozzle getVariable [QGVAR(rope), objNull];
if !(isNull _rope) then {
ropeDestroy _rope;
};
deleteVehicle _nozzle;
if !(local _target) then {

View File

@ -55,10 +55,13 @@ if (isNull _nozzle) then { // func is called on fuel truck
_newNozzle attachTo [_unit, [-0.02,0.05,-0.12], "righthandmiddle1"];
_unit setVariable [QGVAR(nozzle), _newNozzle, true];
private _rope = ropeCreate [_target, _endPosOffset, _newNozzle, [0, -0.20, 0.12], REFUEL_HOSE_LENGTH];
if (_target isKindOf "AllVehicles") then {
// Currently ropeCreate requires its first parameter to be a real vehicle
private _rope = ropeCreate [_target, _endPosOffset, _newNozzle, [0, -0.20, 0.12], REFUEL_HOSE_LENGTH];
_newNozzle setVariable [QGVAR(rope), _rope, true];
};
_newNozzle setVariable [QGVAR(attachPos), _endPosOffset, true];
_newNozzle setVariable [QGVAR(source), _target, true];
_newNozzle setVariable [QGVAR(rope), _rope, true];
_target setVariable [QGVAR(ownedNozzle), _newNozzle, true];
_unit setVariable [QGVAR(isRefueling), true];
@ -83,7 +86,7 @@ if (isNull _nozzle) then { // func is called on fuel truck
{true},
["isnotinside"]
] call EFUNC(common,progressBar);
} else { // func is called in muzzle either connected or on ground
} else { // func is called on muzzle either connected or on ground
[
2,
[_unit, _nozzle],