Added dropping and progress bars

This commit is contained in:
IngoKauffmann 2015-08-21 22:43:45 +02:00
parent f44060c6a0
commit 22576f938e
23 changed files with 378 additions and 96 deletions

View File

@ -16,6 +16,20 @@
exceptions[] = {"isNotInside"}; \ exceptions[] = {"isNotInside"}; \
icon = PATHTOF(ui\icon_refuel_interact.paa); \ icon = PATHTOF(ui\icon_refuel_interact.paa); \
}; \ }; \
class GVAR(CheckFuelCounter) { \
displayName = CSTRING(CheckFuelCounter); \
condition = "true"; \
statement = QUOTE([ARR_2(_player,_target)] call FUNC(readFuelCounter)); \
exceptions[] = {"isNotInside"}; \
icon = PATHTOF(ui\icon_refuel_interact.paa); \
}; \
class GVAR(CheckFuel) { \
displayName = CSTRING(CheckFuel); \
condition = QUOTE([ARR_2(_player,_target)] call FUNC(canCheckFuel)); \
statement = QUOTE([ARR_2(_player,_target)] call FUNC(checkFuel)); \
exceptions[] = {"isNotInside"}; \
icon = PATHTOF(ui\icon_refuel_interact.paa); \
}; \
class GVAR(Connect) { \ class GVAR(Connect) { \
displayName = CSTRING(Connect); \ displayName = CSTRING(Connect); \
condition = QUOTE([ARR_2(_player,_target)] call FUNC(canConnectNozzle)); \ condition = QUOTE([ARR_2(_player,_target)] call FUNC(canConnectNozzle)); \
@ -30,13 +44,6 @@
exceptions[] = {"isNotInside"}; \ exceptions[] = {"isNotInside"}; \
icon = PATHTOF(ui\icon_refuel_interact.paa); \ icon = PATHTOF(ui\icon_refuel_interact.paa); \
}; \ }; \
class GVAR(CheckFuel) { \
displayName = CSTRING(CheckFuel); \
condition = QUOTE([ARR_2(_player,_target)] call FUNC(canCheckFuel)); \
statement = QUOTE([ARR_2(_player,_target)] call FUNC(checkFuel)); \
exceptions[] = {"isNotInside"}; \
icon = PATHTOF(ui\icon_refuel_interact.paa); \
}; \
}; \ }; \
}; \ }; \
}; };
@ -76,7 +83,7 @@
class GVAR(PickUpNozzle) { \ class GVAR(PickUpNozzle) { \
displayName = CSTRING(TakeNozzle); \ displayName = CSTRING(TakeNozzle); \
condition = QUOTE([ARR_2(_player,_target)] call FUNC(canTakeNozzle)); \ condition = QUOTE([ARR_2(_player,_target)] call FUNC(canTakeNozzle)); \
statement = QUOTE([ARR_3(_player,_target,_target)] call FUNC(TakeNozzle)); \ statement = QUOTE([ARR_3(_player,objNull,_target)] call FUNC(TakeNozzle)); \
exceptions[] = {"isNotInside"}; \ exceptions[] = {"isNotInside"}; \
icon = PATHTOF(ui\icon_refuel_interact.paa); \ icon = PATHTOF(ui\icon_refuel_interact.paa); \
}; \ }; \
@ -203,16 +210,19 @@ class CfgVehicles {
class Ship_F : Ship { class Ship_F : Ship {
MACRO_CONNECT_ACTIONS MACRO_CONNECT_ACTIONS
GVAR(fuelCapacity) = 2000; GVAR(fuelCapacity) = 2000;
GVAR(flowRate) = 4;
}; };
class Boat_Civil_01_base_F : Ship_F { class Boat_Civil_01_base_F : Ship_F {
GVAR(fuelCapacity) = 200; GVAR(fuelCapacity) = 200;
}; };
class Boat_F : Ship_F {}; class Boat_F : Ship_F {
GVAR(flowRate) = 1;
};
class Boat_Armed_01_base_F : Boat_F { class Boat_Armed_01_base_F : Boat_F {
GVAR(fuelCapacity) = 1000; GVAR(fuelCapacity) = 300;
}; };
class Rubber_duck_base_F : Boat_F { class Rubber_duck_base_F : Boat_F {
GVAR(fuelCapacity) = 30; GVAR(fuelCapacity) = 30;

View File

@ -16,7 +16,9 @@ PREP(disconnect);
PREP(getFuel); PREP(getFuel);
PREP(handleKilled); PREP(handleKilled);
PREP(handleUnconscious); PREP(handleUnconscious);
PREP(makeJerryCan);
PREP(moduleRefuelSettings); PREP(moduleRefuelSettings);
PREP(readFuelCounter);
PREP(refuel); PREP(refuel);
PREP(returnNozzle); PREP(returnNozzle);
PREP(setFuel); PREP(setFuel);

View File

@ -10,7 +10,7 @@
* Can Check Fuel <BOOL> * Can Check Fuel <BOOL>
* *
* Example: * Example:
* [unit, target] call ace_refuel_fnc_canCheckFuel * [player, truck] call ace_refuel_fnc_canCheckFuel
* *
* Public: No * Public: No
*/ */

View File

@ -10,7 +10,7 @@
* Can Connect Nozzle <BOOL> * Can Connect Nozzle <BOOL>
* *
* Example: * Example:
* [unit, tank] call ace_refuel_fnc_canConnectNozzle * [player, tank] call ace_refuel_fnc_canConnectNozzle
* *
* Public: No * Public: No
*/ */

View File

@ -4,13 +4,13 @@
* *
* Arguments: * Arguments:
* 0: Unit <OBJECT> * 0: Unit <OBJECT>
* 1: Target <OBJECT> * 1: Fuel truck <OBJECT>
* *
* Return Value: * Return Value:
* Can Return Nozzle <BOOL> * Can Return Nozzle <BOOL>
* *
* Example: * Example:
* [unit, tank] call ace_refuel_fnc_canReturnNozzle * [player, fuelTruck] call ace_refuel_fnc_canReturnNozzle
* *
* Public: No * Public: No
*/ */

View File

@ -10,7 +10,7 @@
* None * None
* *
* Example: * Example:
* [unit, target] call ace_refuel_fnc_checkFuel * [player, fuelTruck] call ace_refuel_fnc_checkFuel
* *
* Public: No * Public: No
*/ */
@ -34,7 +34,7 @@ _fuel = [_target] call FUNC(getFuel);
true true
}, },
{true}, {true},
localize LSTRING(CheckFuel), localize LSTRING(CheckFuelAction),
{true}, {true},
["isnotinside"] ["isnotinside"]
] call EFUNC(common,progressBar); ] call EFUNC(common,progressBar);

View File

@ -11,7 +11,7 @@
* None * None
* *
* Example: * Example:
* [unit, target] call ace_refuel_fnc_connectNozzle * [player, tank] call ace_refuel_fnc_connectNozzle
* *
* Public: No * Public: No
*/ */

View File

@ -71,12 +71,22 @@ _closeInDistance = (_closeInDistance - 0.0085);
_endPosTestOffset = _startingOffset vectorAdd (_closeInUnitVector vectorMultiply _closeInDistance); _endPosTestOffset = _startingOffset vectorAdd (_closeInUnitVector vectorMultiply _closeInDistance);
_endPosTestOffset set [2, (_startingOffset select 2)]; _endPosTestOffset set [2, (_startingOffset select 2)];
// TODO put animation and delayed connect ? [
2,
[_unit, _nozzle, _target, _endPosTestOffset],
{
private "_actionID";
params ["_args"];
_args params ["_unit", "_nozzle", "_target", "_endPosTestOffset"];
_unit setVariable [QGVAR(nozzle), nil]; _unit setVariable [QGVAR(nozzle), nil];
_unit setVariable [QGVAR(isRefueling), false]; _unit setVariable [QGVAR(isRefueling), false];
[_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); [_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus);
REFUEL_UNHOLSTER_WEAPON REFUEL_UNHOLSTER_WEAPON
_actionID = _unit getVariable [QGVAR(ReleaseActionID), -1];
if (_actionID != -1) then {
_unit removeAction _actionID;
_unit setVariable [QGVAR(ReleaseActionID), nil];
};
detach _nozzle; detach _nozzle;
_nozzle attachTo [_target, _endPosTestOffset]; _nozzle attachTo [_target, _endPosTestOffset];
@ -85,3 +95,9 @@ _nozzle setVariable [QGVAR(isConnected), true, true];
_target setVariable [QGVAR(nozzle), _nozzle, true]; _target setVariable [QGVAR(nozzle), _nozzle, true];
[_unit, _target, _nozzle, _endPosTestOffset] call FUNC(refuel); [_unit, _target, _nozzle, _endPosTestOffset] call FUNC(refuel);
},
"",
localize LSTRING(ConnectAction),
{true},
["isnotinside"]
] call EFUNC(common,progressBar);

View File

@ -10,7 +10,7 @@
* None * None
* *
* Example: * Example:
* [unit, truck] call ace_refuel_fnc_disconnect * [player, nozzle] call ace_refuel_fnc_disconnect
* *
* Public: No * Public: No
*/ */
@ -24,7 +24,6 @@ if (isNull _sink) exitWith {};
_sink setVariable [QGVAR(nozzle), objNull, true]; _sink setVariable [QGVAR(nozzle), objNull, true];
_nozzle setVariable [QGVAR(sink), objNull, true]; _nozzle setVariable [QGVAR(sink), objNull, true];
REFUEL_DROP_NOZZLE(_nozzle) REFUEL_DETACH_NOZZLE
_unit setVariable [QGVAR(nozzle), _nozzle];
[_unit, objNull, _nozzle] call FUNC(takeNozzle); [_unit, objNull, _nozzle] call FUNC(takeNozzle);

View File

@ -9,7 +9,7 @@
* Fuel left (in liters) <NUMBER> * Fuel left (in liters) <NUMBER>
* *
* Example: * Example:
* [target] call ace_refuel_fnc_getFuel * [fuelTruck] call ace_refuel_fnc_getFuel
* *
* Public: No * Public: No
*/ */

View File

@ -9,7 +9,7 @@
* None * None
* *
* Example: * Example:
* [unit] call ace_refuel_fnc_handleKilled * [player] call ace_refuel_fnc_handleKilled
* *
* Public: No * Public: No
*/ */

View File

@ -10,7 +10,7 @@
* None * None
* *
* Example: * Example:
* [unit, true] call ace_refuel_fnc_handleUnconscious * [player, true] call ace_refuel_fnc_handleUnconscious
* *
* Public: No * Public: No
*/ */

View File

@ -0,0 +1,89 @@
/*
* Author: GitHawk
* Makes an object into a jerry can.
*
* Arguments:
* 0: Target <OBJECT>
* 1: Fuel amount (in liters) <NUMBER>
*
* Return Value:
* None
*
* Example:
* [can] call ace_refuel_fnc_makeJerryCan
*
* Public: No
*/
#include "script_component.hpp"
private ["_actions", "_action"];
params ["_target", ["_fuelAmount", 20]];
if (isNull _target ||
{_target isKindOf "AllVehicles"}) exitWith {};
[_target, _fuelAmount] call FUNC(setFuel);
_target setVariable [QGVAR(source), _target, true];
_actions = [];
// Add pickup
_action = [QGVAR(PickUpNozzle),
localize LSTRING(TakeNozzle),
QUOTE(PATHTOF(ui\icon_refuel_interact.paa)),
{[_player, objNull, _target] call FUNC(TakeNozzle)},
{[_player, _target] call FUNC(canTakeNozzle)},
{},
[],
[0, 0, 0],
REFUEL_ACTION_DISTANCE] call EFUNC(interact_menu,createAction);
_actions pushBack [_action, [], _target];
// Add turnOn
_action = [QGVAR(TurnOn),
localize LSTRING(TurnOn),
QUOTE(PATHTOF(ui\icon_refuel_interact.paa)),
{[_player, _target] call FUNC(turnOn)},
{[_player, _target] call FUNC(canTurnOn)},
{},
[],
[0, 0, 0],
REFUEL_ACTION_DISTANCE] call EFUNC(interact_menu,createAction);
_actions pushBack [_action, [], _target];
// Add turnOff
_action = [QGVAR(TurnOff),
localize LSTRING(TurnOff),
QUOTE(PATHTOF(ui\icon_refuel_interact.paa)),
{[_player, _target] call FUNC(turnOff)},
{[_player, _target] call FUNC(canTurnOff)},
{},
[],
[0, 0, 0],
REFUEL_ACTION_DISTANCE] call EFUNC(interact_menu,createAction);
_actions pushBack [_action, [], _target];
// Add disconnect
_action = [QGVAR(Disconnect),
localize LSTRING(Disconnect),
QUOTE(PATHTOF(ui\icon_refuel_interact.paa)),
{[_player, _target] call FUNC(disconnect)},
{[_player, _target] call FUNC(canDisconnect)},
{},
[],
[0, 0, 0],
REFUEL_ACTION_DISTANCE] call EFUNC(interact_menu,createAction);
_actions pushBack [_action, [], _target];
// Main Action
_action = [QGVAR(Refuel),
localize LSTRING(Refuel),
QUOTE(PATHTOF(ui\icon_refuel_interact.paa)),
{},
{true},
{},
[],
[0, 0, 0],
REFUEL_ACTION_DISTANCE] call EFUNC(interact_menu,createAction);
[_target, 0] call EFUNC(interact_menu,addMainAction);
[_target, 0, ["ACE_MainActions"], [_action, _actions, _target]] call EFUNC(interact_menu,addActionToObject);

View File

@ -20,3 +20,5 @@ params ["_logic", "_units", "_activated"];
if !(_activated) exitWith {}; if !(_activated) exitWith {};
[_logic, QGVAR(rate), "rate"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(rate), "rate"] call EFUNC(common,readSettingFromModule);
diag_log text format ["[ACE]: Refuel Module Initialized with flow rate: %1", GVAR(rate)];

View File

@ -0,0 +1,37 @@
/*
* Author: GitHawk
* Reads the fuel counter.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Fuel Truck <OBJECT>
*
* Return Value:
* None
*
* Example:
* [player, fuelTruck] call ace_refuel_fnc_readFuelCounter
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit", "_target"];
[
2,
[_unit, _target],
{
private ["_currentFuel", "_fuelCounter"];
params ["_args"];
_args params ["_unit", "_target"];
_currentFuel = [_target] call FUNC(getFuel);
_fuelCounter = 0.01 * round (100 * ((_target getVariable [QGVAR(fuelCounter), _currentFuel]) - _currentFuel));
[[LSTRING(Hint_FuelCounter), _fuelCounter], 1.5, _unit] call EFUNC(common,displayTextStructured);
},
"",
localize LSTRING(CheckFuelCounterAction),
{true},
["isnotinside"]
] call EFUNC(common,progressBar);

View File

@ -31,7 +31,7 @@ _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(f
_fueling = _nozzle getVariable [QGVAR(isRefueling), false]; _fueling = _nozzle getVariable [QGVAR(isRefueling), false];
if (!alive _source || {!alive _sink}) exitWith { if (!alive _source || {!alive _sink}) exitWith {
REFUEL_DROP_NOZZLE(_nozzle) REFUEL_DROP_NOZZLE
_nozzle setVariable [QGVAR(isConnected), false, true]; _nozzle setVariable [QGVAR(isConnected), false, true];
_nozzle setVariable [QGVAR(sink), objNull, true]; _nozzle setVariable [QGVAR(sink), objNull, true];
_sink setVariable [QGVAR(nozzle), objNull, true]; _sink setVariable [QGVAR(nozzle), objNull, true];
@ -41,7 +41,7 @@ _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(f
if (_tooFar) exitWith { if (_tooFar) exitWith {
[LSTRING(Hint_TooFar), 2, _unit] call EFUNC(common,displayTextStructured); [LSTRING(Hint_TooFar), 2, _unit] call EFUNC(common,displayTextStructured);
REFUEL_DROP_NOZZLE(_nozzle) REFUEL_DROP_NOZZLE
_nozzle setVariable [QGVAR(isConnected), false, true]; _nozzle setVariable [QGVAR(isConnected), false, true];
_nozzle setVariable [QGVAR(sink), objNull, true]; _nozzle setVariable [QGVAR(sink), objNull, true];
_sink setVariable [QGVAR(nozzle), objNull, true]; _sink setVariable [QGVAR(nozzle), objNull, true];
@ -75,7 +75,7 @@ _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(f
} else { } else {
_sink setFuel _fuelInSink; _sink setFuel _fuelInSink;
}; };
[_unit, _source, _fuelInSource] call FUNC(setFuel); [_source, _fuelInSource] call FUNC(setFuel);
}; };
if (_finished) exitWith { if (_finished) exitWith {

View File

@ -4,19 +4,19 @@
* *
* Arguments: * Arguments:
* 0: Unit <OBJECT> * 0: Unit <OBJECT>
* 1: Target <OBJECT> * 1: Fuel Truck <OBJECT>
* *
* Return Value: * Return Value:
* Returned Nozzle <BOOL> * Returned Nozzle <BOOL>
* *
* Example: * Example:
* [player] call ace_refuel_fnc_returnNozzle * [player, fuelTruck] call ace_refuel_fnc_returnNozzle
* *
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_nozzle", "_dummy"]; private ["_nozzle", "_dummy", "_actionID"];
params ["_unit", "_target"]; params ["_unit", "_target"];
_nozzle = _unit getVariable QGVAR(nozzle); _nozzle = _unit getVariable QGVAR(nozzle);
@ -24,17 +24,35 @@ _source = _nozzle getVariable QGVAR(source);
if (isNil "_nozzle" || {_source != _target}) exitWith {false}; if (isNil "_nozzle" || {_source != _target}) exitWith {false};
[
2,
[_unit, _nozzle, _target],
{
private "_actionID";
params ["_args"];
_args params ["_unit", "_nozzle", "_target"];
_unit setVariable [QGVAR(nozzle), nil]; _unit setVariable [QGVAR(nozzle), nil];
detach _nozzle; detach _nozzle;
[_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); [_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus);
REFUEL_UNHOLSTER_WEAPON REFUEL_UNHOLSTER_WEAPON
_unit setVariable [QGVAR(isRefueling), false]; _unit setVariable [QGVAR(isRefueling), false];
_actionID = _unit getVariable [QGVAR(ReleaseActionID), -1];
if (_actionID != -1) then {
_unit removeAction _actionID;
_unit setVariable [QGVAR(ReleaseActionID), nil];
};
_target setVariable [QGVAR(isConnected), false, true]; _target setVariable [QGVAR(isConnected), false, true];
ropeDestroy (_nozzle getVariable QGVAR(rope)); ropeDestroy (_nozzle getVariable QGVAR(rope));
deleteVehicle _nozzle; deleteVehicle _nozzle;
_target setHitPointDamage ["HitEngine", _target getVariable [QGVAR(engineHit), 0]]; _target setHitPointDamage ["HitEngine", _target getVariable [QGVAR(engineHit), 0]];
_target setVariable [QGVAR(engineHit), nil, true]; _target setVariable [QGVAR(engineHit), nil, true];
},
"",
localize LSTRING(ConnectAction),
{true},
["isnotinside"]
] call EFUNC(common,progressBar);
true true

View File

@ -3,26 +3,22 @@
* Set the remaining fuel amount. * Set the remaining fuel amount.
* *
* Arguments: * Arguments:
* 0: Unit <OBJECT> * 0: Fuel Truck <OBJECT>
* 1: Target <OBJECT> * 1: Amount (in liters)<NUMBER>
* 2: Amount (in liters)<NUMBER>
* *
* Return Value: * Return Value:
* None * None
* *
* Example: * Example:
* [unit, target] call ace_refuel_fnc_getFuel * [fuelTruck, 42] call ace_refuel_fnc_setFuel
* *
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_maxFuel"]; private ["_maxFuel"];
params ["_unit", "_target", "_fuel"]; params ["_target", "_fuel"];
if (isNull _unit || if (isNull _target ||
{isNull _target} || {isNil "_fuel"}) exitWith {};
{!(_unit isKindOf "CAManBase")} ||
{!local _unit} ||
{(_target distance _unit) > 7}) exitWith {};
_target setVariable [QGVAR(currentFuelCargo), (getNumber (configFile >> "CfgVehicles" >> typeOf _target >> QGVAR(fuelCargo))) min _fuel, true]; _target setVariable [QGVAR(currentFuelCargo), _fuel, true];

View File

@ -4,14 +4,15 @@
* *
* Arguments: * Arguments:
* 0: Unit <OBJECT> * 0: Unit <OBJECT>
* 1: Target <OBJECT> * 1: Fuel Truck <OBJECT>
* 2: Nozzle <OBJECT> (optional) * 2: Nozzle <OBJECT> (optional)
* *
* Return Value: * Return Value:
* None * None
* *
* Example: * Example:
* [unit, target, truck] call ace_refuel_fnc_takeNozzle * [player, fuelTruck] call ace_refuel_fnc_takeNozzle
* [player, objNull, nozzle] call ace_refuel_fnc_takeNozzle
* *
* Public: No * Public: No
*/ */
@ -24,8 +25,6 @@ params ["_unit", "_target", ["_nozzle", objNull]];
REFUEL_HOLSTER_WEAPON REFUEL_HOLSTER_WEAPON
// TODO add pickup animation
_endPosOffset = [0, 0, 0]; _endPosOffset = [0, 0, 0];
if (isNull _nozzle) then { // func is called on fuel truck if (isNull _nozzle) then { // func is called on fuel truck
_target setVariable [QGVAR(engineHit), _target getHitPointDamage "HitEngine", true]; _target setVariable [QGVAR(engineHit), _target getHitPointDamage "HitEngine", true];
@ -42,9 +41,14 @@ if (isNull _nozzle) then { // func is called on fuel truck
} else { } else {
_endPosOffset = _endPosOffset select 0; _endPosOffset = _endPosOffset select 0;
}; };
[
2,
[_unit, _target, _endPosOffset],
{
private ["_newNozzle", "_rope", "_actionID"];
params ["_args"];
_args params ["_unit", "_target", "_endPosOffset"];
[{
params ["_unit", "_target", "_endPosOffset"];
_newNozzle = "ACE_refuel_fuelNozzle" createVehicle position _unit; _newNozzle = "ACE_refuel_fuelNozzle" createVehicle position _unit;
_newNozzle attachTo [_unit, [-0.02,-0.05,0], "righthandmiddle1"]; // TODO replace with right coordinates for real model _newNozzle attachTo [_unit, [-0.02,-0.05,0], "righthandmiddle1"]; // TODO replace with right coordinates for real model
_unit setVariable [QGVAR(nozzle), _newNozzle]; _unit setVariable [QGVAR(nozzle), _newNozzle];
@ -53,13 +57,62 @@ if (isNull _nozzle) then { // func is called on fuel truck
_newNozzle setVariable [QGVAR(attachPos), _endPosOffset, true]; _newNozzle setVariable [QGVAR(attachPos), _endPosOffset, true];
_newNozzle setVariable [QGVAR(source), _target, true]; _newNozzle setVariable [QGVAR(source), _target, true];
_newNozzle setVariable [QGVAR(rope), _rope, true]; _newNozzle setVariable [QGVAR(rope), _rope, true];
}, [_unit, _target, _endPosOffset], 2, 0] call EFUNC(common,waitAndExecute);
_unit setVariable [QGVAR(isRefueling), true];
_actionID = _unit getVariable [QGVAR(ReleaseActionID), -1];
if (_actionID != -1) then {
_unit removeAction _actionID;
};
_actionID = _unit addAction [
format ["<t color='#FF0000'>%1</t>", localize ELSTRING(dragging,Drop)],
'params ["_unit"]; _nozzle = _unit getVariable QGVAR(nozzle); REFUEL_UNIT_DROP_NOZZLE',
nil,
20,
false,
true,
"",
'!isNull (_target getVariable [QGVAR(nozzle), objNull])'
];
_unit setVariable [QGVAR(ReleaseActionID), _actionID];
},
"",
localize LSTRING(TakeNozzleAction),
{true},
["isnotinside"]
] call EFUNC(common,progressBar);
} else { // func is called in muzzle either connected or on ground } else { // func is called in muzzle either connected or on ground
[{ [
params ["_unit", "_nozzle"]; 2,
[_unit, _nozzle],
{
private ["_actionID"];
params ["_args"];
_args params ["_unit", "_nozzle"];
_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], "righthandmiddle1"]; // TODO replace with right coordinates for real model
_unit setVariable [QGVAR(nozzle), _nozzle]; _unit setVariable [QGVAR(nozzle), _nozzle];
}, [_unit, _nozzle], 2, 0] call EFUNC(common,waitAndExecute);
_unit setVariable [QGVAR(isRefueling), true];
_actionID = _unit getVariable [QGVAR(ReleaseActionID), -1];
if (_actionID != -1) then {
_unit removeAction _actionID;
};
_actionID = _unit addAction [
format ["<t color='#FF0000'>%1</t>", localize ELSTRING(dragging,Drop)],
'params ["_unit"]; _nozzle = _unit getVariable QGVAR(nozzle); REFUEL_UNIT_DROP_NOZZLE',
nil,
20,
false,
true,
"",
'!isNull (_target getVariable [QGVAR(nozzle), objNull])'
];
_unit setVariable [QGVAR(ReleaseActionID), _actionID];
},
"",
localize LSTRING(TakeNozzleAction),
{true},
["isnotinside"]
] call EFUNC(common,progressBar);
_target = _nozzle getVariable QGVAR(source); _target = _nozzle getVariable QGVAR(source);
_endPosOffset = _nozzle getVariable QGVAR(attachPos); _endPosOffset = _nozzle getVariable QGVAR(attachPos);
@ -81,5 +134,3 @@ if (isNull _nozzle) then { // func is called on fuel truck
[_pfID] call cba_fnc_removePerFrameHandler; [_pfID] call cba_fnc_removePerFrameHandler;
}; };
}, 0, [_unit, _target, _endPosOffset]] call cba_fnc_addPerFrameHandler; }, 0, [_unit, _target, _endPosOffset]] call cba_fnc_addPerFrameHandler;
_unit setVariable [QGVAR(isRefueling), true];

View File

@ -18,5 +18,17 @@
params ["_unit", "_nozzle"]; params ["_unit", "_nozzle"];
[
2,
[_unit, _nozzle],
{
params ["_args"];
_args params ["_unit", "_nozzle"];
_nozzle setVariable [QGVAR(isRefueling), false, true]; _nozzle setVariable [QGVAR(isRefueling), false, true];
[LSTRING(Hint_Stopped), 1.5, _unit] call EFUNC(common,displayTextStructured); [LSTRING(Hint_Stopped), 1.5, _unit] call EFUNC(common,displayTextStructured);
},
"",
localize LSTRING(TurnOffAction),
{true},
["isnotinside"]
] call EFUNC(common,progressBar);

View File

@ -10,7 +10,7 @@
* None * None
* *
* Example: * Example:
* [nozzle] call ace_refuel_fnc_turnOn * [player, nozzle] call ace_refuel_fnc_turnOn
* *
* Public: No * Public: No
*/ */
@ -18,5 +18,21 @@
params ["_unit", "_nozzle"]; params ["_unit", "_nozzle"];
[
2,
[_unit, _nozzle],
{
private "_source";
params ["_args"];
_args params ["_unit", "_nozzle"];
_nozzle setVariable [QGVAR(isRefueling), true, true]; _nozzle setVariable [QGVAR(isRefueling), true, true];
[LSTRING(Hint_Started), 1.5, _unit] call EFUNC(common,displayTextStructured); [LSTRING(Hint_Started), 1.5, _unit] call EFUNC(common,displayTextStructured);
_source = _nozzle getVariable QGVAR(source);
_source setVariable [QGVAR(fuelCounter), [_source] call FUNC(getFuel)];
},
"",
localize LSTRING(TurnOnAction),
{true},
["isnotinside"]
] call EFUNC(common,progressBar);

View File

@ -14,15 +14,17 @@
#define REFUEL_INFINITE_FUEL -1 #define REFUEL_INFINITE_FUEL -1
#define REFUEL_ACTION_DISTANCE 7 #define REFUEL_ACTION_DISTANCE 7
#define REFUEL_DROP_NOZZLE(obj) \ #define REFUEL_DETACH_NOZZLE \
detach _nozzle; \ detach _nozzle; \
_nozzle setPosATL [(getPosATL obj) select 0,(getPosATL obj) select 1, 0]; \
_nozzle setVelocity [0,0,0]; \
_nozzle setVariable [QGVAR(isRefueling), false, true]; _nozzle setVariable [QGVAR(isRefueling), false, true];
#define REFUEL_DROP_NOZZLE \
REFUEL_DETACH_NOZZLE \
_nozzle setPosATL [(getPosATL _nozzle) select 0, (getPosATL _nozzle) select 1, 0];\
_nozzle setVelocity [0, 0, 0];
#define REFUEL_UNIT_DROP_NOZZLE \ #define REFUEL_UNIT_DROP_NOZZLE \
REFUEL_DROP_NOZZLE(_unit) \ REFUEL_DROP_NOZZLE \
_unit setVariable [QGVAR(isRefueling), false]; \ _unit setVariable [QGVAR(isRefueling), false]; \
_unit setVariable [QGVAR(nozzle), objNull]; _unit setVariable [QGVAR(nozzle), objNull];

View File

@ -21,10 +21,18 @@
<English>Take fuel nozzle</English> <English>Take fuel nozzle</English>
<German>Zapfpistole nehmen</German> <German>Zapfpistole nehmen</German>
</Key> </Key>
<Key ID="STR_ACE_Refuel_TakeNozzleAction">
<English>Taking fuel nozzle ...</English>
<German>Nehme Zapfpistole ...</German>
</Key>
<Key ID="STR_ACE_Refuel_Connect"> <Key ID="STR_ACE_Refuel_Connect">
<English>Connect fuel nozzle</English> <English>Connect fuel nozzle</English>
<German>Zapfpistole anschließen</German> <German>Zapfpistole anschließen</German>
</Key> </Key>
<Key ID="STR_ACE_Refuel_ConnectAction">
<English>Connecting fuel nozzle ...</English>
<German>Zapfpistole anschließen ...</German>
</Key>
<Key ID="STR_ACE_Refuel_Disconnect"> <Key ID="STR_ACE_Refuel_Disconnect">
<English>Disconnect fuel nozzle</English> <English>Disconnect fuel nozzle</English>
<German>Zapfpistole entfernen</German> <German>Zapfpistole entfernen</German>
@ -34,8 +42,12 @@
<German>Anschließen</German> <German>Anschließen</German>
</Key> </Key>
<Key ID="STR_ACE_Refuel_CheckFuel"> <Key ID="STR_ACE_Refuel_CheckFuel">
<English>Check remaining fuel ...</English> <English>Check remaining fuel</English>
<German>Verbleibenden Kraftstoff überprüfen ...</German> <German>Verbleibenden Kraftstoff überprüfen</German>
</Key>
<Key ID="STR_ACE_Refuel_CheckFuelAction">
<English>Checking remaining fuel ...</English>
<German>Überprüfe verbleibenden Kraftstoff ...</German>
</Key> </Key>
<Key ID="STR_ACE_Refuel_Hint_RemainingFuel"> <Key ID="STR_ACE_Refuel_Hint_RemainingFuel">
<English>There are %1 liters left.</English> <English>There are %1 liters left.</English>
@ -43,7 +55,7 @@
</Key> </Key>
<Key ID="STR_ACE_Refuel_Hint_Empty"> <Key ID="STR_ACE_Refuel_Hint_Empty">
<English>There is no fuel left.</English> <English>There is no fuel left.</English>
<German>Es ist kein Treibstoff übrig.</German> <German>Es ist kein Kraftstoff übrig.</German>
</Key> </Key>
<Key ID="STR_ACE_Refuel_Cancel"> <Key ID="STR_ACE_Refuel_Cancel">
<English>Cancel</English> <English>Cancel</English>
@ -55,12 +67,20 @@
</Key> </Key>
<Key ID="STR_ACE_Refuel_TurnOff"> <Key ID="STR_ACE_Refuel_TurnOff">
<English>Stop fueling</English> <English>Stop fueling</English>
<German>Betankung anhalten</German> <German>Betankung stoppen</German>
</Key>
<Key ID="STR_ACE_Refuel_TurnOffAction">
<English>Stopping fueling ...</English>
<German>Stoppe Betankung ...</German>
</Key> </Key>
<Key ID="STR_ACE_Refuel_TurnOn"> <Key ID="STR_ACE_Refuel_TurnOn">
<English>Start fueling</English> <English>Start fueling</English>
<German>Betankung beginnen</German> <German>Betankung beginnen</German>
</Key> </Key>
<Key ID="STR_ACE_Refuel_TurnOnAction">
<English>Starting fueling ...</English>
<German>Beginne Betankung ...</German>
</Key>
<Key ID="STR_ACE_Refuel_Hint_FuelProgress"> <Key ID="STR_ACE_Refuel_Hint_FuelProgress">
<English>%1 Liters fueled</English> <English>%1 Liters fueled</English>
<German>%1 Liters getankt</German> <German>%1 Liters getankt</German>
@ -89,5 +109,17 @@
<English>Return fuel nozzle</English> <English>Return fuel nozzle</English>
<German>Zapfpistole zurückstecken</German> <German>Zapfpistole zurückstecken</German>
</Key> </Key>
<Key ID="STR_ACE_Refuel_CheckFuelCounter">
<English>Check fuel counter</English>
<German>Tankuhr ansehen</German>
</Key>
<Key ID="STR_ACE_Refuel_CheckFuelCounterAction">
<English>>Checking fuel counter ...</English>
<German>Betrachte Tankuhr ...</German>
</Key>
<Key ID="STR_ACE_Refuel_Hint_FuelCounter">
<English>%1 liters have been fueled.</English>
<German>%1 Liter wurden getankt.</German>
</Key>
</Package> </Package>
</Project> </Project>