mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Added dropping and progress bars
This commit is contained in:
parent
f44060c6a0
commit
22576f938e
@ -16,6 +16,20 @@
|
||||
exceptions[] = {"isNotInside"}; \
|
||||
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) { \
|
||||
displayName = CSTRING(Connect); \
|
||||
condition = QUOTE([ARR_2(_player,_target)] call FUNC(canConnectNozzle)); \
|
||||
@ -30,13 +44,6 @@
|
||||
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); \
|
||||
}; \
|
||||
}; \
|
||||
}; \
|
||||
};
|
||||
@ -76,7 +83,7 @@
|
||||
class GVAR(PickUpNozzle) { \
|
||||
displayName = CSTRING(TakeNozzle); \
|
||||
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"}; \
|
||||
icon = PATHTOF(ui\icon_refuel_interact.paa); \
|
||||
}; \
|
||||
@ -203,16 +210,19 @@ class CfgVehicles {
|
||||
class Ship_F : Ship {
|
||||
MACRO_CONNECT_ACTIONS
|
||||
GVAR(fuelCapacity) = 2000;
|
||||
GVAR(flowRate) = 4;
|
||||
};
|
||||
|
||||
class Boat_Civil_01_base_F : Ship_F {
|
||||
GVAR(fuelCapacity) = 200;
|
||||
};
|
||||
|
||||
class Boat_F : Ship_F {};
|
||||
class Boat_F : Ship_F {
|
||||
GVAR(flowRate) = 1;
|
||||
};
|
||||
|
||||
class Boat_Armed_01_base_F : Boat_F {
|
||||
GVAR(fuelCapacity) = 1000;
|
||||
GVAR(fuelCapacity) = 300;
|
||||
};
|
||||
class Rubber_duck_base_F : Boat_F {
|
||||
GVAR(fuelCapacity) = 30;
|
||||
|
@ -16,7 +16,9 @@ PREP(disconnect);
|
||||
PREP(getFuel);
|
||||
PREP(handleKilled);
|
||||
PREP(handleUnconscious);
|
||||
PREP(makeJerryCan);
|
||||
PREP(moduleRefuelSettings);
|
||||
PREP(readFuelCounter);
|
||||
PREP(refuel);
|
||||
PREP(returnNozzle);
|
||||
PREP(setFuel);
|
||||
|
@ -10,7 +10,7 @@
|
||||
* Can Check Fuel <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* [unit, target] call ace_refuel_fnc_canCheckFuel
|
||||
* [player, truck] call ace_refuel_fnc_canCheckFuel
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
@ -10,7 +10,7 @@
|
||||
* Can Connect Nozzle <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* [unit, tank] call ace_refuel_fnc_canConnectNozzle
|
||||
* [player, tank] call ace_refuel_fnc_canConnectNozzle
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
@ -4,13 +4,13 @@
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Target <OBJECT>
|
||||
* 1: Fuel truck <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Can Return Nozzle <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* [unit, tank] call ace_refuel_fnc_canReturnNozzle
|
||||
* [player, fuelTruck] call ace_refuel_fnc_canReturnNozzle
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
@ -10,7 +10,7 @@
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [unit, target] call ace_refuel_fnc_checkFuel
|
||||
* [player, fuelTruck] call ace_refuel_fnc_checkFuel
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
@ -34,7 +34,7 @@ _fuel = [_target] call FUNC(getFuel);
|
||||
true
|
||||
},
|
||||
{true},
|
||||
localize LSTRING(CheckFuel),
|
||||
localize LSTRING(CheckFuelAction),
|
||||
{true},
|
||||
["isnotinside"]
|
||||
] call EFUNC(common,progressBar);
|
||||
|
@ -11,7 +11,7 @@
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [unit, target] call ace_refuel_fnc_connectNozzle
|
||||
* [player, tank] call ace_refuel_fnc_connectNozzle
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
@ -71,17 +71,33 @@ _closeInDistance = (_closeInDistance - 0.0085);
|
||||
_endPosTestOffset = _startingOffset vectorAdd (_closeInUnitVector vectorMultiply _closeInDistance);
|
||||
_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(isRefueling), false];
|
||||
[_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus);
|
||||
REFUEL_UNHOLSTER_WEAPON
|
||||
_actionID = _unit getVariable [QGVAR(ReleaseActionID), -1];
|
||||
if (_actionID != -1) then {
|
||||
_unit removeAction _actionID;
|
||||
_unit setVariable [QGVAR(ReleaseActionID), nil];
|
||||
};
|
||||
|
||||
_unit setVariable [QGVAR(nozzle), nil];
|
||||
_unit setVariable [QGVAR(isRefueling), false];
|
||||
[_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus);
|
||||
REFUEL_UNHOLSTER_WEAPON
|
||||
detach _nozzle;
|
||||
_nozzle attachTo [_target, _endPosTestOffset];
|
||||
_nozzle setVariable [QGVAR(sink), _target, true];
|
||||
_nozzle setVariable [QGVAR(isConnected), true, true];
|
||||
_target setVariable [QGVAR(nozzle), _nozzle, true];
|
||||
|
||||
detach _nozzle;
|
||||
_nozzle attachTo [_target, _endPosTestOffset];
|
||||
_nozzle setVariable [QGVAR(sink), _target, true];
|
||||
_nozzle setVariable [QGVAR(isConnected), true, 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);
|
||||
|
@ -10,7 +10,7 @@
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [unit, truck] call ace_refuel_fnc_disconnect
|
||||
* [player, nozzle] call ace_refuel_fnc_disconnect
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
@ -24,7 +24,6 @@ if (isNull _sink) exitWith {};
|
||||
|
||||
_sink setVariable [QGVAR(nozzle), objNull, true];
|
||||
_nozzle setVariable [QGVAR(sink), objNull, true];
|
||||
REFUEL_DROP_NOZZLE(_nozzle)
|
||||
_unit setVariable [QGVAR(nozzle), _nozzle];
|
||||
REFUEL_DETACH_NOZZLE
|
||||
|
||||
[_unit, objNull, _nozzle] call FUNC(takeNozzle);
|
||||
|
@ -9,7 +9,7 @@
|
||||
* Fuel left (in liters) <NUMBER>
|
||||
*
|
||||
* Example:
|
||||
* [target] call ace_refuel_fnc_getFuel
|
||||
* [fuelTruck] call ace_refuel_fnc_getFuel
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
@ -9,7 +9,7 @@
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [unit] call ace_refuel_fnc_handleKilled
|
||||
* [player] call ace_refuel_fnc_handleKilled
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
@ -10,7 +10,7 @@
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [unit, true] call ace_refuel_fnc_handleUnconscious
|
||||
* [player, true] call ace_refuel_fnc_handleUnconscious
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
89
addons/refuel/functions/fnc_makeJerryCan.sqf
Normal file
89
addons/refuel/functions/fnc_makeJerryCan.sqf
Normal 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);
|
@ -20,3 +20,5 @@ params ["_logic", "_units", "_activated"];
|
||||
if !(_activated) exitWith {};
|
||||
|
||||
[_logic, QGVAR(rate), "rate"] call EFUNC(common,readSettingFromModule);
|
||||
|
||||
diag_log text format ["[ACE]: Refuel Module Initialized with flow rate: %1", GVAR(rate)];
|
||||
|
37
addons/refuel/functions/fnc_readFuelCounter.sqf
Normal file
37
addons/refuel/functions/fnc_readFuelCounter.sqf
Normal 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);
|
@ -31,7 +31,7 @@ _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(f
|
||||
|
||||
_fueling = _nozzle getVariable [QGVAR(isRefueling), false];
|
||||
if (!alive _source || {!alive _sink}) exitWith {
|
||||
REFUEL_DROP_NOZZLE(_nozzle)
|
||||
REFUEL_DROP_NOZZLE
|
||||
_nozzle setVariable [QGVAR(isConnected), false, true];
|
||||
_nozzle setVariable [QGVAR(sink), objNull, true];
|
||||
_sink setVariable [QGVAR(nozzle), objNull, true];
|
||||
@ -41,7 +41,7 @@ _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(f
|
||||
if (_tooFar) exitWith {
|
||||
[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(sink), objNull, true];
|
||||
_sink setVariable [QGVAR(nozzle), objNull, true];
|
||||
@ -75,7 +75,7 @@ _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(f
|
||||
} else {
|
||||
_sink setFuel _fuelInSink;
|
||||
};
|
||||
[_unit, _source, _fuelInSource] call FUNC(setFuel);
|
||||
[_source, _fuelInSource] call FUNC(setFuel);
|
||||
};
|
||||
|
||||
if (_finished) exitWith {
|
||||
|
@ -4,19 +4,19 @@
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Target <OBJECT>
|
||||
* 1: Fuel Truck <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Returned Nozzle <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* [player] call ace_refuel_fnc_returnNozzle
|
||||
* [player, fuelTruck] call ace_refuel_fnc_returnNozzle
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_nozzle", "_dummy"];
|
||||
private ["_nozzle", "_dummy", "_actionID"];
|
||||
params ["_unit", "_target"];
|
||||
|
||||
_nozzle = _unit getVariable QGVAR(nozzle);
|
||||
@ -24,17 +24,35 @@ _source = _nozzle getVariable QGVAR(source);
|
||||
|
||||
if (isNil "_nozzle" || {_source != _target}) exitWith {false};
|
||||
|
||||
_unit setVariable [QGVAR(nozzle), nil];
|
||||
detach _nozzle;
|
||||
[_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus);
|
||||
REFUEL_UNHOLSTER_WEAPON
|
||||
[
|
||||
2,
|
||||
[_unit, _nozzle, _target],
|
||||
{
|
||||
private "_actionID";
|
||||
params ["_args"];
|
||||
_args params ["_unit", "_nozzle", "_target"];
|
||||
_unit setVariable [QGVAR(nozzle), nil];
|
||||
detach _nozzle;
|
||||
[_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus);
|
||||
REFUEL_UNHOLSTER_WEAPON
|
||||
_unit setVariable [QGVAR(isRefueling), false];
|
||||
_actionID = _unit getVariable [QGVAR(ReleaseActionID), -1];
|
||||
if (_actionID != -1) then {
|
||||
_unit removeAction _actionID;
|
||||
_unit setVariable [QGVAR(ReleaseActionID), nil];
|
||||
};
|
||||
|
||||
_unit setVariable [QGVAR(isRefueling), false];
|
||||
_target setVariable [QGVAR(isConnected), false, true];
|
||||
ropeDestroy (_nozzle getVariable QGVAR(rope));
|
||||
deleteVehicle _nozzle;
|
||||
_target setVariable [QGVAR(isConnected), false, true];
|
||||
ropeDestroy (_nozzle getVariable QGVAR(rope));
|
||||
deleteVehicle _nozzle;
|
||||
|
||||
_target setHitPointDamage ["HitEngine", _target getVariable [QGVAR(engineHit), 0]];
|
||||
_target setVariable [QGVAR(engineHit), nil, true];
|
||||
_target setHitPointDamage ["HitEngine", _target getVariable [QGVAR(engineHit), 0]];
|
||||
_target setVariable [QGVAR(engineHit), nil, true];
|
||||
},
|
||||
"",
|
||||
localize LSTRING(ConnectAction),
|
||||
{true},
|
||||
["isnotinside"]
|
||||
] call EFUNC(common,progressBar);
|
||||
|
||||
true
|
||||
|
@ -3,26 +3,22 @@
|
||||
* Set the remaining fuel amount.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Target <OBJECT>
|
||||
* 2: Amount (in liters)<NUMBER>
|
||||
* 0: Fuel Truck <OBJECT>
|
||||
* 1: Amount (in liters)<NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [unit, target] call ace_refuel_fnc_getFuel
|
||||
* [fuelTruck, 42] call ace_refuel_fnc_setFuel
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
private ["_maxFuel"];
|
||||
params ["_unit", "_target", "_fuel"];
|
||||
params ["_target", "_fuel"];
|
||||
|
||||
if (isNull _unit ||
|
||||
{isNull _target} ||
|
||||
{!(_unit isKindOf "CAManBase")} ||
|
||||
{!local _unit} ||
|
||||
{(_target distance _unit) > 7}) exitWith {};
|
||||
if (isNull _target ||
|
||||
{isNil "_fuel"}) exitWith {};
|
||||
|
||||
_target setVariable [QGVAR(currentFuelCargo), (getNumber (configFile >> "CfgVehicles" >> typeOf _target >> QGVAR(fuelCargo))) min _fuel, true];
|
||||
_target setVariable [QGVAR(currentFuelCargo), _fuel, true];
|
||||
|
@ -4,14 +4,15 @@
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Target <OBJECT>
|
||||
* 1: Fuel Truck <OBJECT>
|
||||
* 2: Nozzle <OBJECT> (optional)
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
@ -24,8 +25,6 @@ params ["_unit", "_target", ["_nozzle", objNull]];
|
||||
|
||||
REFUEL_HOLSTER_WEAPON
|
||||
|
||||
// TODO add pickup animation
|
||||
|
||||
_endPosOffset = [0, 0, 0];
|
||||
if (isNull _nozzle) then { // func is called on fuel truck
|
||||
_target setVariable [QGVAR(engineHit), _target getHitPointDamage "HitEngine", true];
|
||||
@ -42,24 +41,78 @@ if (isNull _nozzle) then { // func is called on fuel truck
|
||||
} else {
|
||||
_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 attachTo [_unit, [-0.02,-0.05,0], "righthandmiddle1"]; // TODO replace with right coordinates for real model
|
||||
_unit setVariable [QGVAR(nozzle), _newNozzle];
|
||||
_newNozzle = "ACE_refuel_fuelNozzle" createVehicle position _unit;
|
||||
_newNozzle attachTo [_unit, [-0.02,-0.05,0], "righthandmiddle1"]; // TODO replace with right coordinates for real model
|
||||
_unit setVariable [QGVAR(nozzle), _newNozzle];
|
||||
|
||||
_rope = ropeCreate [_target, _endPosOffset, _newNozzle, [0, 0, 0], 12];
|
||||
_newNozzle setVariable [QGVAR(attachPos), _endPosOffset, true];
|
||||
_newNozzle setVariable [QGVAR(source), _target, true];
|
||||
_newNozzle setVariable [QGVAR(rope), _rope, true];
|
||||
}, [_unit, _target, _endPosOffset], 2, 0] call EFUNC(common,waitAndExecute);
|
||||
_rope = ropeCreate [_target, _endPosOffset, _newNozzle, [0, 0, 0], 12];
|
||||
_newNozzle setVariable [QGVAR(attachPos), _endPosOffset, true];
|
||||
_newNozzle setVariable [QGVAR(source), _target, true];
|
||||
_newNozzle setVariable [QGVAR(rope), _rope, true];
|
||||
|
||||
_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
|
||||
[{
|
||||
params ["_unit", "_nozzle"];
|
||||
_nozzle attachTo [_unit, [-0.02,-0.05,0], "righthandmiddle1"]; // TODO replace with right coordinates for real model
|
||||
_unit setVariable [QGVAR(nozzle), _nozzle];
|
||||
}, [_unit, _nozzle], 2, 0] call EFUNC(common,waitAndExecute);
|
||||
[
|
||||
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
|
||||
_unit setVariable [QGVAR(nozzle), _nozzle];
|
||||
|
||||
_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);
|
||||
_endPosOffset = _nozzle getVariable QGVAR(attachPos);
|
||||
@ -81,5 +134,3 @@ if (isNull _nozzle) then { // func is called on fuel truck
|
||||
[_pfID] call cba_fnc_removePerFrameHandler;
|
||||
};
|
||||
}, 0, [_unit, _target, _endPosOffset]] call cba_fnc_addPerFrameHandler;
|
||||
|
||||
_unit setVariable [QGVAR(isRefueling), true];
|
||||
|
@ -18,5 +18,17 @@
|
||||
|
||||
params ["_unit", "_nozzle"];
|
||||
|
||||
_nozzle setVariable [QGVAR(isRefueling), false, true];
|
||||
[LSTRING(Hint_Stopped), 1.5, _unit] call EFUNC(common,displayTextStructured);
|
||||
[
|
||||
2,
|
||||
[_unit, _nozzle],
|
||||
{
|
||||
params ["_args"];
|
||||
_args params ["_unit", "_nozzle"];
|
||||
_nozzle setVariable [QGVAR(isRefueling), false, true];
|
||||
[LSTRING(Hint_Stopped), 1.5, _unit] call EFUNC(common,displayTextStructured);
|
||||
},
|
||||
"",
|
||||
localize LSTRING(TurnOffAction),
|
||||
{true},
|
||||
["isnotinside"]
|
||||
] call EFUNC(common,progressBar);
|
||||
|
@ -10,7 +10,7 @@
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [nozzle] call ace_refuel_fnc_turnOn
|
||||
* [player, nozzle] call ace_refuel_fnc_turnOn
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
@ -18,5 +18,21 @@
|
||||
|
||||
params ["_unit", "_nozzle"];
|
||||
|
||||
_nozzle setVariable [QGVAR(isRefueling), true, true];
|
||||
[LSTRING(Hint_Started), 1.5, _unit] call EFUNC(common,displayTextStructured);
|
||||
[
|
||||
2,
|
||||
[_unit, _nozzle],
|
||||
{
|
||||
private "_source";
|
||||
params ["_args"];
|
||||
_args params ["_unit", "_nozzle"];
|
||||
_nozzle setVariable [QGVAR(isRefueling), true, true];
|
||||
[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);
|
||||
|
@ -14,15 +14,17 @@
|
||||
#define REFUEL_INFINITE_FUEL -1
|
||||
#define REFUEL_ACTION_DISTANCE 7
|
||||
|
||||
#define REFUEL_DROP_NOZZLE(obj) \
|
||||
#define REFUEL_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];
|
||||
|
||||
#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 \
|
||||
REFUEL_DROP_NOZZLE(_unit) \
|
||||
REFUEL_DROP_NOZZLE \
|
||||
_unit setVariable [QGVAR(isRefueling), false]; \
|
||||
_unit setVariable [QGVAR(nozzle), objNull];
|
||||
|
||||
|
@ -21,10 +21,18 @@
|
||||
<English>Take fuel nozzle</English>
|
||||
<German>Zapfpistole nehmen</German>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Refuel_TakeNozzleAction">
|
||||
<English>Taking fuel nozzle ...</English>
|
||||
<German>Nehme Zapfpistole ...</German>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Refuel_Connect">
|
||||
<English>Connect fuel nozzle</English>
|
||||
<German>Zapfpistole anschließen</German>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Refuel_ConnectAction">
|
||||
<English>Connecting fuel nozzle ...</English>
|
||||
<German>Zapfpistole anschließen ...</German>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Refuel_Disconnect">
|
||||
<English>Disconnect fuel nozzle</English>
|
||||
<German>Zapfpistole entfernen</German>
|
||||
@ -34,8 +42,12 @@
|
||||
<German>Anschließen</German>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Refuel_CheckFuel">
|
||||
<English>Check remaining fuel ...</English>
|
||||
<German>Verbleibenden Kraftstoff überprüfen ...</German>
|
||||
<English>Check remaining fuel</English>
|
||||
<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 ID="STR_ACE_Refuel_Hint_RemainingFuel">
|
||||
<English>There are %1 liters left.</English>
|
||||
@ -43,7 +55,7 @@
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Refuel_Hint_Empty">
|
||||
<English>There is no fuel left.</English>
|
||||
<German>Es ist kein Treibstoff übrig.</German>
|
||||
<German>Es ist kein Kraftstoff übrig.</German>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Refuel_Cancel">
|
||||
<English>Cancel</English>
|
||||
@ -55,12 +67,20 @@
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Refuel_TurnOff">
|
||||
<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 ID="STR_ACE_Refuel_TurnOn">
|
||||
<English>Start fueling</English>
|
||||
<German>Betankung beginnen</German>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Refuel_TurnOnAction">
|
||||
<English>Starting fueling ...</English>
|
||||
<German>Beginne Betankung ...</German>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Refuel_Hint_FuelProgress">
|
||||
<English>%1 Liters fueled</English>
|
||||
<German>%1 Liters getankt</German>
|
||||
@ -89,5 +109,17 @@
|
||||
<English>Return fuel nozzle</English>
|
||||
<German>Zapfpistole zurückstecken</German>
|
||||
</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>
|
||||
</Project>
|
||||
|
Loading…
Reference in New Issue
Block a user