Merge pull request #3249 from GitHawk/refuel_nozzle

Added a real nozzle
This commit is contained in:
Thomas Kooi 2016-02-04 19:32:17 +01:00
commit 8034d91d76
38 changed files with 1534 additions and 113 deletions

View File

@ -140,7 +140,7 @@ class CfgVehicles {
displayName = QGVAR(fuelNozzle);
scope = 1;
scopeCurator = 1;
model = "\A3\Structures_F_Heli\VR\Helpers\Sign_sphere10cm_F.p3d";
model = PATHTOF(data\nozzle.p3d);
};
class All;

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -0,0 +1,73 @@
ambient[] = {1,1,1,1};
diffuse[] = {1,1,1,1};
forcedDiffuse[] = {0,0,0,0};
emmisive[] = {0,0,0,1};
specular[] = {0.16,0.16,0.16,0};
specularPower = 100;
PixelShaderID = "Super";
VertexShaderID = "Super";
class Stage1 {
texture = "z\ace\addons\refuel\data\nozzle_nohq.paa";
uvSource = "tex";
class uvTransform {
aside[] = {1,0,0};
up[] = {0,1,0};
dir[] = {0,0,0};
pos[] = {0,0,0};
};
};
class Stage2 {
texture = "#(argb,8,8,3)color(0.5,0.5,0.5,1,DT)";
uvSource = "tex";
class uvTransform {
aside[] = {1,0,0};
up[] = {0,1,0};
dir[] = {0,0,0};
pos[] = {0,0,0};
};
};
class Stage3 {
texture = "#(argb,8,8,3)color(0,0,0,0,MC)";
uvSource = "tex";
class uvTransform {
aside[] = {1,0,0};
up[] = {0,1,0};
dir[] = {0,0,0};
pos[] = {0,0,0};
};
};
class Stage4 {
texture = "z\ace\addons\refuel\data\nozzle_as.paa";
uvSource = "tex";
class uvTransform {
aside[] = {1,0,0};
up[] = {0,1,0};
dir[] = {0,0,0};
pos[] = {0,0,0};
};
};
class Stage5 {
texture = "z\ace\addons\refuel\data\nozzle_smdi.paa";
uvSource = "tex";
class uvTransform {
aside[] = {1,0,0};
up[] = {0,1,0};
dir[] = {0,0,0};
pos[] = {0,0,0};
};
};
class Stage6 {
texture = "#(ai,64,64,1)fresnel(1,0.7)";
uvSource = "none";
};
class Stage7 {
texture = "a3\data_f\env_co.paa";
useWorldEnvMap = "true";
uvSource = "tex";
class uvTransform {
aside[] = {1,0,0};
up[] = {0,1,0};
dir[] = {0,0,0};
pos[] = {0,0,0};
};
};

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 MiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 MiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 MiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 MiB

View File

@ -16,7 +16,7 @@
*/
#include "script_component.hpp"
params ["_unit", "_target"];
params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]]];
!(isNull _unit ||
{!(_unit isKindOf "CAManBase")} ||

View File

@ -16,10 +16,9 @@
*/
#include "script_component.hpp"
private ["_nozzle"];
params ["_unit", "_target"];
params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]]];
_nozzle = _unit getVariable [QGVAR(nozzle), objNull];
private _nozzle = _unit getVariable [QGVAR(nozzle), objNull];
!(isNull _nozzle ||
{(_target distance _unit) > REFUEL_ACTION_DISTANCE} ||

View File

@ -16,8 +16,7 @@
*/
#include "script_component.hpp"
private ["_sink"];
params ["_unit", "_nozzle"];
params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]]];
if (isNull _unit ||
{isNull _nozzle} ||
@ -25,5 +24,5 @@ if (isNull _unit ||
{!local _unit} ||
{(_nozzle distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false};
_sink = _nozzle getVariable [QGVAR(sink), objNull];
private _sink = _nozzle getVariable [QGVAR(sink), objNull];
!((isNull _sink) || {_nozzle getVariable [QGVAR(isRefueling), false]})

View File

@ -16,9 +16,8 @@
*/
#include "script_component.hpp"
private ["_nozzle"];
params ["_unit", "_target"];
params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]]];
_nozzle = _unit getVariable QGVAR(nozzle);
private _nozzle = _unit getVariable QGVAR(nozzle);
(_this call FUNC(canConnectNozzle)) && {_target == (_nozzle getVariable [QGVAR(source), objNull])}

View File

@ -16,7 +16,7 @@
*/
#include "script_component.hpp"
params ["_unit", "_target"];
params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]]];
if (isNull _unit ||
{!(_unit isKindOf "CAManBase")} ||

View File

@ -16,7 +16,7 @@
*/
#include "script_component.hpp"
params ["_unit", "_nozzle"];
params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]]];
if (isNull _unit ||
{isNull _nozzle} ||

View File

@ -16,7 +16,7 @@
*/
#include "script_component.hpp"
params ["_unit", "_nozzle"];
params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]]];
if (isNull _unit ||
{isNull _nozzle} ||

View File

@ -15,17 +15,17 @@
* Public: No
*/
#include "script_component.hpp"
private ["_fuel"];
params ["_unit", "_target"];
_fuel = [_target] call FUNC(getFuel);
params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]]];
private _fuel = [_target] call FUNC(getFuel);
[
5,
[_unit, _target, _fuel],
{
params ["_args"];
_args params ["_unit", "_target", "_fuel"];
_args params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]], ["_fuel", 0, [0]]];
if (_fuel > 0 ) then {
["displayTextStructured", [_unit], [[LSTRING(Hint_RemainingFuel), _fuel], 2, _unit]] call EFUNC(common,targetEvent);
} else {

View File

@ -21,10 +21,9 @@
#define PLACE_CANCEL 0
#define PLACE_APPROVE 1
private ["_nozzle", "_actionID"];
params ["_unit", "_target"];
params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]]];
_nozzle = _unit getVariable [QGVAR(nozzle), objNull];
private _nozzle = _unit getVariable [QGVAR(nozzle), objNull];
if (isNull _nozzle) exitWith {};
GVAR(placeAction) = PLACE_WAITING;
@ -32,19 +31,18 @@ GVAR(placeAction) = PLACE_WAITING;
[{[localize LSTRING(Connect_Action), ""] call EFUNC(interaction,showMouseHint)}, []] call EFUNC(common,execNextFrame);
_unit setVariable [QGVAR(placeActionEH), [_unit, "DefaultAction", {true}, {GVAR(placeAction) = PLACE_APPROVE;}] call EFUNC(common,AddActionEventHandler)];
_actionID = _unit addAction [format ["<t color='#FF0000'>%1</t>", localize LSTRING(Cancel)], {GVAR(placeAction) = PLACE_CANCEL;}];
private _actionID = _unit addAction [format ["<t color='#FF0000'>%1</t>", localize LSTRING(Cancel)], {GVAR(placeAction) = PLACE_CANCEL;}];
[{
private["_virtualPos", "_virtualPosASL", "_lineInterection"];
params ["_args","_pfID"];
_args params ["_unit", "_target", "_nozzle", "_actionID"];
_args params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]], ["_nozzle", objNull, [objNull]], ["_actionID", -1, [0]]];
_virtualPosASL = (eyePos _unit) vectorAdd (positionCameraToWorld [0,0,0.6]) vectorDiff (positionCameraToWorld [0,0,0]);
private _virtualPosASL = (eyePos _unit) vectorAdd (positionCameraToWorld [0,0,0.6]) vectorDiff (positionCameraToWorld [0,0,0]);
if (cameraView == "EXTERNAL") then {
_virtualPosASL = _virtualPosASL vectorAdd ((positionCameraToWorld [0.3,0,0]) vectorDiff (positionCameraToWorld [0,0,0]));
};
_virtualPos = _virtualPosASL call EFUNC(common,ASLToPosition);
_lineInterection = lineIntersects [eyePos ace_player, _virtualPosASL, ace_player];
private _virtualPos = _virtualPosASL call EFUNC(common,ASLToPosition);
private _lineInterection = lineIntersects [eyePos ace_player, _virtualPosASL, ace_player];
//Don't allow placing in a bad position:
if (_lineInterection && {GVAR(placeAction) == PLACE_APPROVE}) then {GVAR(placeAction) = PLACE_WAITING;};

View File

@ -18,31 +18,31 @@
* Public: No
*/
#include "script_component.hpp"
private ["_startingOffset", "_startDistanceFromCenter", "_closeInUnitVector", "_closeInMax", "_closeInMin", "_closeInDistance", "_endPosTestOffset", "_endPosTest", "_doesIntersect", "_startingPosShifted", "_endASL", "_rate", "_maxFuel"];
private ["_closeInDistance", "_endPosTestOffset"];
params ["_unit", "_target", "_startingPosition", "_nozzle"];
_startingOffset = _target worldToModel _startingPosition;
params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]], ["_startingPosition", [0,0,0], [[]], 3], ["_nozzle", objNull, [objNull]]];
private _startingOffset = _target worldToModel _startingPosition;
_startDistanceFromCenter = vectorMagnitude _startingOffset;
_closeInUnitVector = vectorNormalized (_startingOffset vectorFromTo [0,0,0]);
private _startDistanceFromCenter = vectorMagnitude _startingOffset;
private _closeInUnitVector = vectorNormalized (_startingOffset vectorFromTo [0,0,0]);
_closeInMax = _startDistanceFromCenter;
_closeInMin = 0;
private _closeInMax = _startDistanceFromCenter;
private _closeInMin = 0;
while {(_closeInMax - _closeInMin) > 0.01} do {
_closeInDistance = (_closeInMax + _closeInMin) / 2;
_endPosTestOffset = _startingOffset vectorAdd (_closeInUnitVector vectorMultiply _closeInDistance);
_endPosTestOffset set [2, (_startingOffset select 2)];
_endPosTest = _target modelToWorldVisual _endPosTestOffset;
private _endPosTest = _target modelToWorldVisual _endPosTestOffset;
_doesIntersect = false;
private _doesIntersect = false;
{
if (_doesIntersect) exitWith {};
_startingPosShifted = _startingPosition vectorAdd _x;
private _startingPosShifted = _startingPosition vectorAdd _x;
_startASL = if (surfaceIsWater _startingPosShifted) then {_startingPosShifted} else {ATLtoASL _startingPosShifted};
{
_endPosShifted = _endPosTest vectorAdd _x;
_endASL = if (surfaceIsWater _startingPosShifted) then {_endPosShifted} else {ATLtoASL _endPosShifted};
private _endASL = if (surfaceIsWater _startingPosShifted) then {_endPosShifted} else {ATLtoASL _endPosShifted};
//Uncomment to see the lazor show, and see how the scanning works:
// drawLine3D [_startingPosShifted, _endPosShifted, [1,0,0,1]];
@ -66,7 +66,7 @@ if (((_startDistanceFromCenter - _closeInDistance) < 0.1) || {!([_target, _unit,
};
//Move it out slightly, for visibility sake (better to look a little funny than be embedded//sunk in the hull and be useless)
_closeInDistance = (_closeInDistance - 0.0085);
_closeInDistance = (_closeInDistance - 0.05);
_endPosTestOffset = _startingOffset vectorAdd (_closeInUnitVector vectorMultiply _closeInDistance);
_endPosTestOffset set [2, (_startingOffset select 2)];
@ -75,14 +75,13 @@ _endPosTestOffset set [2, (_startingOffset select 2)];
2,
[_unit, _nozzle, _target, _endPosTestOffset],
{
private "_actionID";
params ["_args"];
_args params ["_unit", "_nozzle", "_target", "_endPosTestOffset"];
_args params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]], ["_target", objNull, [objNull]], ["_endPosTestOffset", [0,0,0], [[]], 3]];
_unit setVariable [QGVAR(nozzle), nil];
_unit setVariable [QGVAR(isRefueling), false];
[_unit, "forceWalk", "ACE_refuel", false] call EFUNC(common,statusEffect_set);
REFUEL_UNHOLSTER_WEAPON
_actionID = _unit getVariable [QGVAR(ReleaseActionID), -1];
private _actionID = _unit getVariable [QGVAR(ReleaseActionID), -1];
if (_actionID != -1) then {
_unit removeAction _actionID;
_unit setVariable [QGVAR(ReleaseActionID), nil];
@ -90,6 +89,37 @@ _endPosTestOffset set [2, (_startingOffset select 2)];
detach _nozzle;
_nozzle attachTo [_target, _endPosTestOffset];
_endPosTestOffset params ["_x", "_y"];
private _bb = boundingBoxReal _target;
_bb params ["_ll", "_rr"];
_ll set [2, 0];
_rr set [2, 0];
_ll params ["_x1", "_y1"];
_rr params ["_x2", "_y2"];
private _c1 = _ll vectorCos _endPosTestOffset;
private _c2 = _ll vectorCos [_x1, _y2, 0];
private _cn = (_ll vectorCrossProduct [0, 0, 1]) vectorCos _endPosTestOffset;
private _dirAndUp = [[1, 0, 0],[0, 0, 1]];
if (_c1 > _c2 && (_cn > 0)) then {
_dirAndUp = [[1, 0, 0.8],[0, 0, 1]];
} else {
_c1 = [_x1, _y2, 0] vectorCos _endPosTestOffset;
_c2 = [_x1, _y2, 0] vectorCos _rr;
_cn = ([_x1, _y2, 0] vectorCrossProduct [0, 0, 1]) vectorCos _endPosTestOffset;
if (_c1 > _c2 && (_cn > 0)) then {
_dirAndUp = [[0, -1, 0.8],[0, 0, 1]];
} else {
_c1 = _rr vectorCos _endPosTestOffset;
_c2 = _rr vectorCos [_x2, _y1, 0];
_cn = (_rr vectorCrossProduct [0, 0, 1]) vectorCos _endPosTestOffset;
if (_c1 > _c2 && (_cn > 0)) then {
_dirAndUp = [[-1, 0, 0.8],[0, 0, 1]];
} else {
_dirAndUp = [[0, 1, 0.8],[0, 0, 1]];
};
};
};
[[_nozzle, _dirAndUp], "{(_this select 0) setVectorDirAndUp (_this select 1)}", 2] call EFUNC(common,execRemoteFnc);
_nozzle setVariable [QGVAR(sink), _target, true];
_nozzle setVariable [QGVAR(isConnected), true, true];
_target setVariable [QGVAR(nozzle), _nozzle, true];

View File

@ -16,10 +16,9 @@
*/
#include "script_component.hpp"
private ["_sink"];
params ["_unit", "_nozzle"];
params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]]];
_sink = _nozzle getVariable [QGVAR(sink), objNull];
private _sink = _nozzle getVariable [QGVAR(sink), objNull];
if (isNull _sink) exitWith {};
_sink setVariable [QGVAR(nozzle), objNull, true];

View File

@ -18,7 +18,7 @@
*/
#include "script_component.hpp"
params ["_unit", "_nozzle", ["_disconnectOnly", false]];
params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]], ["_disconnectOnly", false, [false]]];
detach _nozzle;
_nozzle setVariable [QGVAR(isRefueling), false, true];

View File

@ -15,10 +15,9 @@
*/
#include "script_component.hpp"
private ["_fuel"];
params ["_target"];
params [["_target", objNull, [objNull]]];
_fuel = _target getVariable QGVAR(currentFuelCargo);
private _fuel = _target getVariable QGVAR(currentFuelCargo);
if (isNil "_fuel") then {
_fuel = getNumber (configFile >> "CfgVehicles" >> typeOf _target >> QGVAR(fuelCargo));

View File

@ -15,12 +15,12 @@
*/
#include "script_component.hpp"
params ["_unit"];
params [["_unit", objNull, [objNull]]];
if (!local _unit) exitWith {};
_unit setVariable [QGVAR(selectedWeaponOnRefuel), nil];
_nozzle = _unit getVariable [QGVAR(nozzle), objNull];
private _nozzle = _unit getVariable [QGVAR(nozzle), objNull];
if !(isNull _nozzle) then {
[_unit, _nozzle] call FUNC(dropNozzle);
};

View File

@ -16,14 +16,12 @@
*/
#include "script_component.hpp"
params ["_unit", "_isUnconscious"];
params [["_unit", objNull, [objNull]], ["_isUnconscious", false, [false]]];
if (!local _unit || {!_isUnconscious}) exitWith {};
private "_nozzle";
[_unit, "forceWalk", "ACE_refuel", false] call EFUNC(common,statusEffect_set);
_nozzle = _unit getVariable [QGVAR(nozzle), objNull];
private _nozzle = _unit getVariable [QGVAR(nozzle), objNull];
if !(isNull _nozzle) then {
[_unit, _nozzle] call FUNC(dropNozzle);
};

View File

@ -16,8 +16,7 @@
*/
#include "script_component.hpp"
private ["_actions", "_action"];
params ["_target", ["_fuelAmount", 20]];
params [["_target", objNull, [objNull]], ["_fuelAmount", 20, [0]]];
if (isNull _target ||
{_target isKindOf "AllVehicles"} ||
@ -28,7 +27,7 @@ _target setVariable [QGVAR(jerryCan), true, true];
_target setVariable [QGVAR(source), _target, true];
// Main Action
_action = [QGVAR(Refuel),
private _action = [QGVAR(Refuel),
localize LSTRING(Refuel),
QUOTE(PATHTOF(ui\icon_refuel_interact.paa)),
{},

View File

@ -15,7 +15,7 @@
#include "script_component.hpp"
params ["_logic", "_units", "_activated"];
params ["_logic", "", ["_activated", false, [false]]];
if !(_activated) exitWith {};

View File

@ -16,18 +16,17 @@
*/
#include "script_component.hpp"
params ["_unit", "_target"];
params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]]];
[
2,
[_unit, _target],
{
private ["_currentFuel", "_fuelCounter"];
params ["_args"];
_args params ["_unit", "_target"];
_args params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]]];
_currentFuel = [_target] call FUNC(getFuel);
_fuelCounter = 0.01 * round (100 * ((_target getVariable [QGVAR(fuelCounter), _currentFuel]) - _currentFuel));
private _currentFuel = [_target] call FUNC(getFuel);
private _fuelCounter = 0.01 * round (100 * ((_target getVariable [QGVAR(fuelCounter), _currentFuel]) - _currentFuel));
[[LSTRING(Hint_FuelCounter), _fuelCounter], 1.5, _unit] call EFUNC(common,displayTextStructured);
},
"",

View File

@ -6,7 +6,7 @@
* 0: Unit <OBJECT>
* 1: Target <OBJECT>
* 2: Nozzle <OBJECT>
* 3: Connection Point <OBJECT>
* 3: Connection Point <ARRAY>
*
* Return Value:
* None
@ -18,16 +18,14 @@
#define PFH_STEPSIZE 0.1
private ["_rate", "_maxFuel"];
params ["_unit", "_target", "_nozzle", "_connectToPoint"];
params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]], ["_nozzle", objNull, [objNull]], ["_connectToPoint", [0,0,0], [[]], 3]];
_rate = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(flowRate)) * GVAR(rate) * PFH_STEPSIZE;
_maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(fuelCapacity));
private _rate = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(flowRate)) * GVAR(rate) * PFH_STEPSIZE;
private _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(fuelCapacity));
[{
private ["_source", "_tooFar", "_fuelInSource", "_fuelInSink", "_finished", "_fueling"];
params ["_args", "_pfID"];
_args params ["_source", "_sink", "_unit", "_nozzle", "_rate", "_startFuel", "_maxFuel", "_connectFromPoint", "_connectToPoint"];
_args params [["_source", objNull, [objNull]], ["_sink", objNull, [objNull]], ["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]], ["_rate", 1, [0]], ["_startFuel", 0, [0]], ["_maxFuel", 0, [0]], ["_connectFromPoint", [0,0,0], [[]], 3], ["_connectToPoint", [0,0,0], [[]], 3]];
if (!alive _source || {!alive _sink}) exitWith {
[objNull, _nozzle] call FUNC(dropNozzle);
@ -36,7 +34,7 @@ _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(f
_sink setVariable [QGVAR(nozzle), objNull, true];
[_pfID] call cba_fnc_removePerFrameHandler;
};
_tooFar = ((_sink modelToWorld _connectToPoint) distance (_source modelToWorld _connectFromPoint)) > (REFUEL_HOSE_LENGTH - 2);
private _tooFar = ((_sink modelToWorld _connectToPoint) distance (_source modelToWorld _connectFromPoint)) > (REFUEL_HOSE_LENGTH - 2);
if (_tooFar && {!(_nozzle getVariable [QGVAR(jerryCan), false])}) exitWith {
[LSTRING(Hint_TooFar), 2, _unit] call EFUNC(common,displayTextStructured);
@ -47,10 +45,10 @@ _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(f
[_pfID] call cba_fnc_removePerFrameHandler;
};
_finished = false;
_fueling = _nozzle getVariable [QGVAR(isRefueling), false];
private _finished = false;
private _fueling = _nozzle getVariable [QGVAR(isRefueling), false];
if (_fueling) then {
_fuelInSource = [_source] call FUNC(getFuel);
private _fuelInSource = [_source] call FUNC(getFuel);
if (_fuelInSource == 0) exitWith {
[LSTRING(Hint_SourceEmpty), 2, _unit] call EFUNC(common,displayTextStructured);
_nozzle setVariable [QGVAR(isRefueling), false, true];
@ -64,7 +62,7 @@ _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(f
[LSTRING(Hint_SourceEmpty), 2, _unit] call EFUNC(common,displayTextStructured);
};
_fuelInSink = (_unit getVariable [QGVAR(tempFuel), _startFuel]) + ( _rate / _maxFuel);
private _fuelInSink = (_unit getVariable [QGVAR(tempFuel), _startFuel]) + ( _rate / _maxFuel);
if (_fuelInSink > 1) then {
_fuelInSink = 1;
_finished = true;

View File

@ -15,8 +15,7 @@
*/
#include "script_component.hpp"
private ["_nozzle", "_nozzleTarget", "_rope"];
params ["_target"];
params [["_target", objNull, [objNull]]];
if (local _target) then {
_target setHitPointDamage ["HitEngine", _target getVariable [QGVAR(engineHit), 0]];
@ -26,14 +25,14 @@ if (local _target) then {
_target setVariable [QGVAR(engineHit), nil, true];
_target setVariable [QGVAR(isConnected), false, true];
_nozzle = _target getVariable [QGVAR(ownedNozzle), nil];
private _nozzle = _target getVariable [QGVAR(ownedNozzle), nil];
if !(isNil "_nozzle") then {
_nozzleTarget = _nozzle getVariable [QGVAR(sink), nil];
private _nozzleTarget = _nozzle getVariable [QGVAR(sink), nil];
if !(isNil "_nozzleTarget") then {
_nozzleTarget setVariable [QGVAR(nozzle), nil, true];
};
_rope = _nozzle getVariable [QGVAR(rope), nil];
private _rope = _nozzle getVariable [QGVAR(rope), nil];
if !(isNil "_rope") then {
ropeDestroy _rope;
};

View File

@ -15,20 +15,19 @@
*/
#include "script_component.hpp"
params ["_unit", "_nozzle"];
params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]]];
if (isNull _unit ||
{isNull _nozzle} ||
{!(_unit isKindOf "CAManBase")} ||
{!local _unit}) exitWith {};
private ["_attachedNozzle", "_actionID"];
_attachedNozzle = _unit getVariable [QGVAR(nozzle), nil];
private _attachedNozzle = _unit getVariable [QGVAR(nozzle), nil];
if (isNil "_attachedNozzle") exitWith {};
if (_nozzle != _attachedNozzle) exitWith {};
_actionID = _unit getVariable [QGVAR(ReleaseActionID), -1];
private _actionID = _unit getVariable [QGVAR(ReleaseActionID), -1];
if (_actionID != -1) then {
_unit removeAction _actionID;
_unit setVariable [QGVAR(isRefueling), false, true];

View File

@ -16,11 +16,10 @@
*/
#include "script_component.hpp"
private ["_nozzle", "_dummy", "_actionID"];
params ["_unit", "_target"];
params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]]];
_nozzle = _unit getVariable [QGVAR(nozzle), objNull];
_source = _nozzle getVariable QGVAR(source);
private _nozzle = _unit getVariable [QGVAR(nozzle), objNull];
private _source = _nozzle getVariable QGVAR(source);
if (isNull _nozzle || {_source != _target}) exitWith {false};
@ -28,15 +27,14 @@ if (isNull _nozzle || {_source != _target}) exitWith {false};
2,
[_unit, _nozzle, _target],
{
private "_actionID";
params ["_args"];
_args params ["_unit", "_nozzle", "_target"];
_args params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]], ["_target", objNull, [objNull]]];
_unit setVariable [QGVAR(nozzle), nil];
detach _nozzle;
[_unit, "forceWalk", "ACE_refuel", false] call EFUNC(common,statusEffect_set);
REFUEL_UNHOLSTER_WEAPON
_unit setVariable [QGVAR(isRefueling), false];
_actionID = _unit getVariable [QGVAR(ReleaseActionID), -1];
private _actionID = _unit getVariable [QGVAR(ReleaseActionID), -1];
if (_actionID != -1) then {
_unit removeAction _actionID;
_unit setVariable [QGVAR(ReleaseActionID), nil];

View File

@ -15,8 +15,8 @@
* Public: No
*/
#include "script_component.hpp"
private ["_maxFuel"];
params ["_target", "_fuel"];
params [["_target", objNull, [objNull]], ["_fuel", nil, [0]]];
if (isNull _target ||
{isNil "_fuel"}) exitWith {};

View File

@ -18,14 +18,13 @@
*/
#include "script_component.hpp"
private ["_endPosOffset"],
params ["_unit", "_target", ["_nozzle", objNull]];
params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]], ["_nozzle", objNull, [objNull]]];
[_unit, "forceWalk", "ACE_refuel", true] call EFUNC(common,statusEffect_set);
REFUEL_HOLSTER_WEAPON
_endPosOffset = [0, 0, 0];
private _endPosOffset = [0, 0, 0];
if (isNull _nozzle) then { // func is called on fuel truck
_target setVariable [QGVAR(engineHit), _target getHitPointDamage "HitEngine", true];
if !(local _target) then {
@ -49,22 +48,21 @@ if (isNull _nozzle) then { // func is called on fuel truck
2,
[_unit, _target, _endPosOffset],
{
private ["_newNozzle", "_rope", "_actionID"];
params ["_args"];
_args params ["_unit", "_target", "_endPosOffset"];
_args params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]], ["_endPosOffset", [0,0,0], [[]], 3]];
_newNozzle = "ACE_refuel_fuelNozzle" createVehicle position _unit;
_newNozzle attachTo [_unit, [-0.02,-0.05,0], "righthandmiddle1"]; // TODO replace with right coordinates for real model
private _newNozzle = "ACE_refuel_fuelNozzle" createVehicle position _unit;
_newNozzle attachTo [_unit, [-0.02,0.05,-0.12], "righthandmiddle1"];
_unit setVariable [QGVAR(nozzle), _newNozzle];
_rope = ropeCreate [_target, _endPosOffset, _newNozzle, [0, 0, 0], REFUEL_HOSE_LENGTH];
private _rope = ropeCreate [_target, _endPosOffset, _newNozzle, [0, -0.20, 0.12], REFUEL_HOSE_LENGTH];
_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];
_actionID = _unit getVariable [QGVAR(ReleaseActionID), -1];
private _actionID = _unit getVariable [QGVAR(ReleaseActionID), -1];
if (_actionID != -1) then {
_unit removeAction _actionID;
};
@ -90,18 +88,17 @@ if (isNull _nozzle) then { // func is called on fuel truck
2,
[_unit, _nozzle],
{
private ["_actionID"];
params ["_args"];
_args params ["_unit", "_nozzle"];
_args params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]]];
if (_nozzle getVariable [QGVAR(jerryCan), false]) then {
_nozzle attachTo [_unit, [0,1,0], "pelvis"];
} else {
_nozzle attachTo [_unit, [-0.02,-0.05,0], "righthandmiddle1"]; // TODO replace with right coordinates for real model
_nozzle attachTo [_unit, [-0.02,0.05,-0.12], "righthandmiddle1"];
};
_unit setVariable [QGVAR(nozzle), _nozzle];
_unit setVariable [QGVAR(isRefueling), true];
_actionID = _unit getVariable [QGVAR(ReleaseActionID), -1];
private _actionID = _unit getVariable [QGVAR(ReleaseActionID), -1];
if (_actionID != -1) then {
_unit removeAction _actionID;
};

View File

@ -16,14 +16,14 @@
*/
#include "script_component.hpp"
params ["_unit", "_nozzle"];
params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]]];
[
2,
[_unit, _nozzle],
{
params ["_args"];
_args params ["_unit", "_nozzle"];
_args params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]]];
_nozzle setVariable [QGVAR(isRefueling), false, true];
[LSTRING(Hint_Stopped), 1.5, _unit] call EFUNC(common,displayTextStructured);
},

View File

@ -16,15 +16,14 @@
*/
#include "script_component.hpp"
params ["_unit", "_nozzle"];
params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]]];
[
2,
[_unit, _nozzle],
{
private "_source";
params ["_args"];
_args params ["_unit", "_nozzle"];
_args params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]]];
_nozzle setVariable [QGVAR(isRefueling), true, true];
[LSTRING(Hint_Started), 1.5, _unit] call EFUNC(common,displayTextStructured);
},