Minor improvements

fnc_reset is still WIP
This commit is contained in:
IngoKauffmann 2015-11-21 23:24:24 +01:00
parent b5568ca0db
commit 113ac0f370
5 changed files with 55 additions and 1 deletions

View File

@ -21,6 +21,7 @@ PREP(makeJerryCan);
PREP(moduleRefuelSettings);
PREP(readFuelCounter);
PREP(refuel);
PREP(reset);
PREP(returnNozzle);
PREP(setFuel);
PREP(takeNozzle);

View File

@ -0,0 +1,51 @@
/*
* Author: GitHawk
* Resets a fuel vehicle in case is got bugged
*
* Arguments:
* 0: Fuel truck <OBJECT>
*
* Return Value:
* None
*
* Example:
* [truck] call ace_refuel_fnc_reset
*
* Public: No
*/
#include "script_component.hpp"
params ["_target"];
if !(local _target) then {
[[_target, ["HitEngine", _target getVariable [QGVAR(engineHit), 0]]], "{(_this select 0) setHitPointDamage (_this select 1)}", _sink] call EFUNC(common,execRemoteFnc);
} else {
_target setHitPointDamage ["HitEngine", _target getVariable [QGVAR(engineHit), 0]];
};
_target setVariable [QGVAR(engineHit), nil, true];
_target setVariable [QGVAR(isConnected), false, true];
_nozzle = _target getVariable [QGVAR(nozzle), nil];
if !(isNil "_nozzle") then {
_nozzleTarget = _nozzle getVariable [QGVAR(sink), nil];
if !(isNil "_nozzleTarget") then {
_nozzleTarget setVariable [QGVAR(nozzle), nil, true];
};
_rope = _nozzle getVariable [QGVAR(rope), nil];
if !(isNil "_rope") then {
ropeDestroy _rope;
};
{
// FIXME needs to be done locally
_actionID = _x getVariable [QGVAR(ReleaseActionID), -1];
if (_actionID != -1) then {
_x removeAction _actionID;
_x setVariable [QGVAR(isRefueling), false, true];
_x setVariable [QGVAR(ReleaseActionID), nil];
};
} count allPlayers;
deleteVehicle _nozzle;
};
_target getVariable [QGVAR(nozzle), nil, true];

View File

@ -95,7 +95,7 @@ _endPosTestOffset set [2, (_startingOffset select 2)];
_target setVariable [QGVAR(nozzle), _nozzle, true];
_source = _nozzle getVariable QGVAR(source);
_source setVariable [QGVAR(fuelCounter), [_source] call FUNC(getFuel)];
_source setVariable [QGVAR(fuelCounter), [_source] call FUNC(getFuel), true];
[_unit, _target, _nozzle, _endPosTestOffset] call FUNC(refuel);
},

View File

@ -43,6 +43,7 @@ if (isNull _nozzle || {_source != _target}) exitWith {false};
};
_target setVariable [QGVAR(isConnected), false, true];
_target setVariable [QGVAR(nozzle), nil, true];
ropeDestroy (_nozzle getVariable QGVAR(rope));
deleteVehicle _nozzle;

View File

@ -61,6 +61,7 @@ if (isNull _nozzle) then { // func is called on fuel truck
_newNozzle setVariable [QGVAR(attachPos), _endPosOffset, true];
_newNozzle setVariable [QGVAR(source), _target, true];
_newNozzle setVariable [QGVAR(rope), _rope, true];
_target setVariable [QGVAR(nozzle), _newNozzle, true];
_unit setVariable [QGVAR(isRefueling), true];
_actionID = _unit getVariable [QGVAR(ReleaseActionID), -1];