First batch of fixes

This commit is contained in:
IngoKauffmann 2015-08-14 03:18:54 +02:00
parent 7d75f9cd2c
commit de500fb80b
20 changed files with 209 additions and 235 deletions

View File

@ -0,0 +1,9 @@
class ACE_Settings {
class GVAR(rate) {
displayName = LSTRING(RefuelSettings_speed_DisplayName);
description = LSTRING(RefuelSettings_speed_Description);
value = 1;
typeName = "SCALAR";
values[] = {LSTRING(RefuelSettings_basic), LSTRING(RefuelSettings_advanced)};
};
};

View File

@ -26,7 +26,7 @@
class GVAR(connect) { \
displayName = CSTRING(connect); \
distance = REFUEL_ACTION_DISTANCE; \
condition = QUOTE([ARR_2(_player,_target)] call FUNC(canConnectNozzle)); \
condition = QUOTE([ARR_1(_player)] call FUNC(canConnectNozzle)); \
statement = QUOTE([ARR_2(_player,_target)] call DFUNC(connectNozzle)); \
exceptions[] = {"isNotInside"}; \
icon = PATHTOF(ui\icon_refuel_interact.paa); \
@ -78,7 +78,7 @@ class CfgVehicles {
category = "ACE";
function = QUOTE(DFUNC(moduleRefuelSettings));
functionPriority = 1;
isGlobal = 1;
isGlobal = 0;
isTriggerActivated = 0;
author = ECSTRING(common,ACETeam);
class Arguments {
@ -98,24 +98,6 @@ class CfgVehicles {
};
};
};
class civ_fuel {
displayName = CSTRING(RefuelSettings_civ_fuel_DisplayName);
description = CSTRING(RefuelSettings_civ_fuel_Description);
typeName = "NUMBER";
defaultValue = 5000;
};
class mil_fuel {
displayName = CSTRING(RefuelSettings_mil_fuel_DisplayName);
description = CSTRING(RefuelSettings_mil_fuel_Description);
typeName = "NUMBER";
defaultValue = 20000;
};
class stationary_fuel {
displayName = CSTRING(RefuelSettings_stationary_fuel_DisplayName);
description = CSTRING(RefuelSettings_stationary_fuel_Description);
typeName = "NUMBER";
defaultValue = -1;
};
};
};
@ -155,17 +137,17 @@ class CfgVehicles {
class Car_F : Car {};
class Offroad_01_base_f : Car_F {};
class Truck_F : Car_F {};
class Truck_01_base_F: Truck_F {};
class Truck_02_base_F : Truck_F {};
class Truck_03_base_F : Truck_F {};
class Van_01_base_F : Truck_F {};
class Truck_01_base_F: Truck_F {};
class Truck_02_base_F : Truck_F {};
class Truck_03_base_F : Truck_F {};
class Van_01_base_F : Truck_F {};
class Van_01_fuel_base_F : Van_01_base_F {};
class Tank_F : Tank {};
class APC_Tracked_01_base_F: Tank_F {};
class B_APC_Tracked_01_base_F: APC_Tracked_01_base_F {};
class B_Truck_01_transport_F : Truck_01_base_F {};
class B_Truck_01_mover_F: B_Truck_01_transport_F {};
class Tank_F : Tank {};
class APC_Tracked_01_base_F: Tank_F {};
class B_APC_Tracked_01_base_F: APC_Tracked_01_base_F {};
class B_Truck_01_transport_F : Truck_01_base_F {};
class B_Truck_01_mover_F: B_Truck_01_transport_F {};
class ReammoBox_F;
class Slingload_01_Base_F : ReammoBox_F {
@ -182,69 +164,69 @@ class CfgVehicles {
class B_APC_Tracked_01_CRV_F : B_APC_Tracked_01_base_F {
transportFuel = 0; //3k
MACRO_REFUEL_ACTIONS
ace_refuel_hooks[] = {{0,0,0}};
ace_refuel_type = "mil";
GVAR(hooks[]) = {{0,0,0}};
GVAR(fuelCargo) = 20000;
};
class C_Van_01_fuel_F : Van_01_fuel_base_F {
transportFuel = 0; //1k
class C_Van_01_fuel_F : Van_01_fuel_base_F {
transportFuel = 0; //1k
MACRO_REFUEL_ACTIONS
ace_refuel_hooks[] = {{0,0,0}};
ace_refuel_type = "civ";
};
class I_G_Van_01_fuel_F : Van_01_fuel_base_F {
transportFuel = 0; //1k
GVAR(hooks[]) = {{0,0,0}};
GVAR(fuelCargo) = 5000;
};
class I_G_Van_01_fuel_F : Van_01_fuel_base_F {
transportFuel = 0; //1k
MACRO_REFUEL_ACTIONS
ace_refuel_hooks[] = {{0,0,0}};
ace_refuel_type = "civ";
GVAR(hooks[]) = {{0,0,0}};
GVAR(fuelCargo) = 5000;
};
class I_Truck_02_fuel_F : Truck_02_base_F {
transportFuel = 0; //3k
class I_Truck_02_fuel_F : Truck_02_base_F {
transportFuel = 0; //3k
MACRO_REFUEL_ACTIONS
ace_refuel_hooks[] = {{0,0,0}};
ace_refuel_type = "mil";
};
GVAR(hooks[]) = {{0,0,0}};
GVAR(fuelCargo) = 20000;
};
class O_Truck_02_fuel_F : Truck_02_base_F {
transportFuel = 0; //3k
transportFuel = 0; //3k
MACRO_REFUEL_ACTIONS
ace_refuel_hooks[] = {{0,0,0}};
ace_refuel_type = "mil";
};
GVAR(hooks[]) = {{0,0,0}};
GVAR(fuelCargo) = 20000;
};
class B_Truck_01_fuel_F : B_Truck_01_mover_F {
transportFuel = 0; //3k
class B_Truck_01_fuel_F : B_Truck_01_mover_F {
transportFuel = 0; //3k
MACRO_REFUEL_ACTIONS
ace_refuel_hooks[] = {{0,0,0}};
ace_refuel_type = "mil";
};
GVAR(hooks[]) = {{0,0,0}};
GVAR(fuelCargo) = 20000;
};
class O_Truck_03_fuel_F : Truck_03_base_F {
transportFuel = 0; //3k
class O_Truck_03_fuel_F : Truck_03_base_F {
transportFuel = 0; //3k
MACRO_REFUEL_ACTIONS
ace_refuel_hooks[] = {{0,0,0}};
ace_refuel_type = "mil";
};
GVAR(hooks[]) = {{0,0,0}};
GVAR(fuelCargo) = 20000;
};
class B_Slingload_01_Fuel_F : Slingload_01_Base_F {
transportFuel = 0; //3k
MACRO_REFUEL_ACTIONS
ace_refuel_hooks[] = {{0,0,0}};
ace_refuel_type = "mil";
GVAR(hooks[]) = {{0,0,0}};
GVAR(fuelCargo) = 20000;
};
class O_Heli_Transport_04_fuel_F : Heli_Transport_04_base_F {
transportFuel = 0; //3k
MACRO_REFUEL_ACTIONS
ace_refuel_hooks[] = {{0,0,0}};
ace_refuel_type = "mil";
GVAR(hooks[]) = {{0,0,0}};
GVAR(fuelCargo) = 20000;
};
class Land_Pod_Heli_Transport_04_fuel_F : Pod_Heli_Transport_04_base_F {
transportFuel = 0; //3k
MACRO_REFUEL_ACTIONS
ace_refuel_hooks[] = {{0,0,0}};
ace_refuel_type = "mil";
GVAR(hooks[]) = {{0,0,0}};
GVAR(fuelCargo) = 20000;
};
class Static;
@ -263,57 +245,57 @@ class CfgVehicles {
class Land_Fuelstation_Feed_F : House_Small_F {
transportFuel = 0; //50k
MACRO_REFUEL_ACTIONS
ace_refuel_hooks[] = {{0,0,0}};
ace_refuel_type = "stationary";
GVAR(hooks[]) = {{0,0,0}};
GVAR(fuelCargo) = -1;
};
class Land_fs_feed_F : House_Small_F {
transportFuel = 0; //50k
MACRO_REFUEL_ACTIONS
ace_refuel_hooks[] = {{0,0,0}};
ace_refuel_type = "stationary";
GVAR(hooks[]) = {{0,0,0}};
GVAR(fuelCargo) = -1;
};
class FuelStation : Strategic {
transportFuel = 0; //50k
MACRO_REFUEL_ACTIONS
ace_refuel_hooks[] = {{0,0,0}};
ace_refuel_type = "stationary";
GVAR(hooks[]) = {{0,0,0}};
GVAR(fuelCargo) = -1;
};
class Land_Fuelstation : Strategic {
transportFuel = 0; //50k
MACRO_REFUEL_ACTIONS
ace_refuel_hooks[] = {{0,0,0}};
ace_refuel_type = "stationary";
GVAR(hooks[]) = {{0,0,0}};
GVAR(fuelCargo) = -1;
};
class Land_Fuelstation_army : Strategic {
transportFuel = 0; //50k
MACRO_REFUEL_ACTIONS
ace_refuel_hooks[] = {{0,0,0}};
ace_refuel_type = "stationary";
GVAR(hooks[]) = {{0,0,0}};
GVAR(fuelCargo) = -1;
};
class Land_Benzina_schnell : Strategic {
transportFuel = 0; //50k
MACRO_REFUEL_ACTIONS
ace_refuel_hooks[] = {{0,0,0}};
ace_refuel_type = "stationary";
GVAR(hooks[]) = {{0,0,0}};
GVAR(fuelCargo) = -1;
};
class Land_A_FuelStation_Feed : Strategic {
transportFuel = 0; //50k
MACRO_REFUEL_ACTIONS
ace_refuel_hooks[] = {{0,0,0}};
ace_refuel_type = "stationary";
GVAR(hooks[]) = {{0,0,0}};
GVAR(fuelCargo) = -1;
};
class Land_Ind_FuelStation_Feed_EP1 : Strategic {
transportFuel = 0; //50k
MACRO_REFUEL_ACTIONS
ace_refuel_hooks[] = {{0,0,0}};
ace_refuel_type = "stationary";
GVAR(hooks[]) = {{0,0,0}};
GVAR(fuelCargo) = -1;
};
class Land_FuelStation_Feed_PMC : Strategic {
transportFuel = 0; //50k
MACRO_REFUEL_ACTIONS
ace_refuel_hooks[] = {{0,0,0}};
ace_refuel_type = "stationary";
GVAR(hooks[]) = {{0,0,0}};
GVAR(fuelCargo) = -1;
};
/* // Barrels from rhs?

View File

@ -14,3 +14,4 @@ class CfgPatches {
#include "CfgEventHandlers.hpp"
#include "CfgVehicles.hpp"
#include "ACE_Settings.hpp"

View File

@ -7,19 +7,19 @@
* 1: The target <OBJECT>
*
* Return Value:
* NIL
* Can Connect Nozzle <BOOL>
*
* Example:
* [unit, target, nozzle] call ace_refuel_fnc_connectNozzle
* [unit] call ace_refuel_fnc_canConnectNozzle
*
* Public: Yes
* Public: No
*/
#include "script_component.hpp"
private ["_nozzle"];
params ["_unit", "_target"];
params ["_unit"];
_nozzle = _unit getVariable [QGVAR(nozzle), nil];
_nozzle = _unit getVariable QGVAR(nozzle);
if (isNil "_nozzle") exitWith {false};
true

View File

@ -4,15 +4,15 @@
*
* Arguments:
* 0: The unit <OBJECT>
* 0: The object holding the nozzle <OBJECT>
* 1: The object holding the nozzle <OBJECT>
*
* Return Value:
* Can disconnect
* Can disconnect <BOOL>
*
* Example:
* [player, truck] call ace_refuel_fnc_canDisconnect
*
* Public: Yes
* Public: No
*/
#include "script_component.hpp"

View File

@ -6,12 +6,12 @@
* 0: The target <OBJECT>
*
* Return Value:
* Can refuel
* Can refuel <BOOL>
*
* Example:
* [unit, target] call ace_refuel_fnc_canRefuel
*
* Public: Yes
* Public: No
*/
#include "script_component.hpp"
private ["_fuel"];

View File

@ -7,26 +7,18 @@
* 1: The target <OBJECT>
*
* Return Value:
* Can connect
* Can connect <BOOL>
*
* Example:
* [player, target] call ace_refuel_fnc_canTakeNozzle
*
* Public: Yes
* Public: No
*/
#include "script_component.hpp"
private ["_connected"];
params ["_unit", "_target"];
if (isNull _unit || {!(_unit isKindOf "CAManBase")} || {!local _unit} || {(_target distance _unit) > 3.5}) exitWith {false};
if (isNull _unit || {!(_unit isKindOf "CAManBase")} || {!local _unit} || {(_target distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false};
// Check if the fuel source is already in use
_connected = _target getVariable [QGVAR(connected), nil];
if !(isNil "_connected") exitWith {false};
// Check if the player is already carrying another fuel nozzle
_connected = _unit getVariable [QGVAR(isRefueling), nil];
if !(isNil "_connected") exitWith {false};
true
!(_target getVariable [QGVAR(isConnected), false]) && {!(_unit getVariable [QGVAR(isRefueling), false])}

View File

@ -7,24 +7,18 @@
* 1: The object holding the nozzle <OBJECT>
*
* Return Value:
* Can turn off
* Can turn off <BOOL>
*
* Example:
* [player, truck] call ace_refuel_fnc_canTurnOff
*
* Public: Yes
* Public: No
*/
#include "script_component.hpp"
private ["_nozzle", "_fueling"];
params ["_unit", "_nozzleHolder"];
if (isNull _unit || {!(_unit isKindOf "CAManBase")} || {!local _unit} || { (_nozzleHolder distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false};
if (isNull _unit || {!(_unit isKindOf "CAManBase")} || {!local _unit} || {(_nozzleHolder distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false};
_nozzle = _nozzleHolder getVariable [QGVAR(nozzle), objNull];
if (isNull _nozzle) exitWith {false};
_fueling = _nozzle getVariable [QGVAR(fueling), 0];
if (_fueling == 0) exitWith {false};
true
!(isNull (_nozzleHolder getVariable [QGVAR(nozzle), objNull])) && {(_nozzleHolder getVariable QGVAR(nozzle)) getVariable [QGVAR(fueling), 0] != 0}

View File

@ -7,12 +7,12 @@
* 1: The target <OBJECT>
*
* Return Value:
* nil
* None
*
* Example:
* [unit, target] call ace_refuel_fnc_checkFuel
*
* Public: Yes
* Public: No
*/
#include "script_component.hpp"
private ["_fuel", "_type"];
@ -27,7 +27,7 @@ _fuel = [_unit, _target] call FUNC(getFuel);
[_unit, _target, _fuel],
{
params ["_args"];
EXPLODE_3_PVT(_args,_unit,_target,_fuel);
_args params ["_unit", "_target", "_fuel"];
if (_fuel > 0 ) then {
["displayTextStructured", [_unit], [[LSTRING(Hint_RemainingFuel), _fuel], 2, _unit]] call EFUNC(common,targetEvent);
} else {

View File

@ -9,12 +9,12 @@
* 2: The nozzle <OBJECT> (optional)
*
* Return Value:
* NIL
* None
*
* Example:
* [unit, target, nozzle] call ace_refuel_fnc_connectNozzle
*
* Public: Yes
* Public: No
*/
#include "script_component.hpp"
@ -25,7 +25,7 @@
private ["_nozzle", "_actionID"];
params ["_unit", "_target"];
_nozzle = _unit getVariable [QGVAR(nozzle), nil];
_nozzle = _unit getVariable QGVAR(nozzle);
if (isNil "_nozzle") exitWith {};
GVAR(placeAction) = PLACE_WAITING;
@ -38,7 +38,7 @@ _actionID = _unit addAction [format ["<t color='#FF0000'>%1</t>", localize LSTRI
[{
private["_virtualPos", "_virtualPosASL", "_lineInterection"];
params ["_args","_pfID"];
EXPLODE_4_PVT(_args,_unit,_target,_nozzle,_actionID);
_args params ["_unit", "_target", "_nozzle", "_actionID"];
_virtualPosASL = (eyePos _unit) vectorAdd (positionCameraToWorld [0,0,0.6]) vectorDiff (positionCameraToWorld [0,0,0]);
if (cameraView == "EXTERNAL") then {

View File

@ -10,17 +10,16 @@
* 3: The nozzle <OBJECT>
*
* Return Value:
* NIL
* None
*
* Example:
* [player, tank, [0,0,0], nozzle] call ace_refuel_fnc_connectNozzleAction
*
* Public: Yes
* Public: No
*/
#include "script_component.hpp"
#define FLOWRATE_GND 0.165 // TODO ace_vehicles messes with fuel capacity - why?
#define FLOWRATE_AIR 0.67
#define RATE 1 // FIXME use global var from module
private ["_startingOffset", "_startDistanceFromCenter", "_closeInUnitVector", "_closeInMax", "_closeInMin", "_closeInDistance", "_endPosTestOffset", "_endPosTest", "_doesIntersect", "_startingPosShifted", "_endASL", "_rate", "_maxFuel"];
@ -87,10 +86,10 @@ _unit setVariable [QGVAR(selectedWeaponOnRefuel), nil];
_source = _nozzle getVariable QGVAR(source);
if (_source == _target) exitWith {
_source setVariable [QGVAR(connected), nil, true];
_source setVariable [QGVAR(isConnected), false, true];
ropeDestroy (_nozzle getVariable QGVAR(rope));
deleteVehicle _nozzle;
_unit setVariable [QGVAR(isRefueling), nil];
_unit setVariable [QGVAR(isRefueling), false];
};
_nozzle attachTo [_target, _endPosTestOffset];
@ -98,9 +97,9 @@ _nozzle setVariable [QGVAR(sink), _target, true];
_nozzle setVariable [QGVAR(fueling), 1, true];
_target setVariable [QGVAR(nozzle), _nozzle, true];
_rate = if (_target isKindOf "Air") then { FLOWRATE_AIR * RATE
_rate = if (_target isKindOf "Air") then { FLOWRATE_AIR * GVAR(rate)
} else {
FLOWRATE_GND * RATE
FLOWRATE_GND * GVAR(rate)
};
_maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> "fuelCapacity");

View File

@ -1,34 +0,0 @@
/*
* Author: GitHawk
* Disconnects the tilting rope
*
* Arguments:
* 0: The target <OBJECT>
*
* Return Value:
* NIL
*
* Example:
* [player] call ace_logistics_fnc_cutTiltRope
*
* Public: Yes
*/
#include "script_component.hpp"
private ["_rope"];
params ["_unit"];
_rope = _unit getVariable [QGVAR(tiltRope), nil];
if !(isNil "_rope") then {
ropeDestroy _rope;
};
(_unit getVariable QGVAR(tiltVehicle)) setVariable [QGVAR(tiltUp), nil, true];
(_unit getVariable QGVAR(tiltVehicleTow)) setVariable [QGVAR(tiltUp), nil, true];
_unit setVariable [QGVAR(tiltVehicle), nil];
_unit setVariable [QGVAR(tiltVehicleTow), nil];
_unit setVariable [QGVAR(isTilting), nil];
_unit setVariable [QGVAR(tiltRope), nil];
true

View File

@ -7,12 +7,12 @@
* 1: The object holding the nozzle <OBJECT>
*
* Return Value:
* NIL
* None
*
* Example:
* [unit, truck] call ace_refuel_fnc_disconnect
*
* Public: Yes
* Public: No
*/
#include "script_component.hpp"

View File

@ -7,39 +7,24 @@
* 1: The target <OBJECT>
*
* Return Value:
* Number of liters left
* Fuel left (in liters) <NUMBER>
*
* Example:
* [unit, target] call ace_refuel_fnc_getFuel
*
* Public: Yes
* Public: No
*/
#include "script_component.hpp"
private ["_fuel", "_type"];
private ["_fuel"];
params ["_unit", "_target"];
if (isNull _unit || {!(_unit isKindOf "CAManBase")} || {!local _unit} || { (_target distance _unit) > 7}) exitWith {0};
if (isNull _unit || {!(_unit isKindOf "CAManBase")} || {!local _unit}) exitWith {0};
_fuel = _target getVariable [QGVAR(currentFuelCargo), -2];
_fuel = _target getVariable [QGVAR(fuel), -2];
if (_fuel == -2) then {
_type = getText (configFile >> "CfgVehicles" >> typeOf _target >> "ace_refuel_type");
if (_type == "mil") then {
//_fuel = GVAR(mil_fuel); // FIXME
_fuel = 20000; // FIXME
_target setVariable [QGVAR(fuel), _fuel, true];
} else {
if (_type == "civ") then {
_fuel = GVAR(civ_fuel);
_target setVariable [QGVAR(fuel), _fuel, true];
} else {
if (_type == "stationary") then {
_fuel = GVAR(stationary_fuel);
_target setVariable [QGVAR(fuel), _fuel, true];
} else {
_fuel = 0;
};
};
};
_fuel = getNumber (configFile >> "CfgVehicles" >> typeOf _target >> QGVAR(fuelCargo));
_target setVariable [QGVAR(currentFuelCargo), _fuel, true];
};
_fuel

View File

@ -8,7 +8,7 @@
* 2: activated <BOOL>
*
* Return Value:
* None <NIL>
* None
*
* Public: No
*/
@ -20,6 +20,3 @@ params ["_logic", "_units", "_activated"];
if !(_activated) exitWith {};
[_logic, QGVAR(rate), "rate"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(civ_fuel), "civ_fuel"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(mil_fuel), "mil_fuel"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(stationary_fuel), "stationary_fuel"] call EFUNC(common,readSettingFromModule);

View File

@ -3,11 +3,14 @@
* Refuels the vehicle
*
* Arguments:
* 0: The target <OBJECT>
* 1: The rate <NUMBER>
* 0: The unit <OBJECT>
* 1: The target <OBJECT>
* 2: The nozzle <OBJECT>
* 3: The rate <NUMBER>
* 4: The maximum fuel volume <NUMBER>
*
* Return Value:
* NIL
* None
*
* Public: No
*/
@ -20,21 +23,17 @@ params ["_unit", "_target", "_nozzle", "_rate", "_maxFuel"];
_sink = _nozzle getVariable [QGVAR(sink), objNull];
if (isNull _sink) exitWith {};
if !(local _sink) exitWith {
[_this, QUOTE(DFUNC(refuel)), _target] call EFUNC(common,execRemoteFnc);
};
[{
private ["_source", "_sink", "_fuelInSource", "_fuelInSink", "_finished", "_fueling"];
params ["_args", "_pfID"];
EXPLODE_5_PVT(_args,_unit,_nozzle,_rate,_startFuel,_maxFuel);
_args params ["_unit", "_nozzle", "_rate", "_startFuel", "_maxFuel"];
_fueling = _nozzle getVariable [QGVAR(fueling), 0];
_rate = _rate * 0.1;
_source = _nozzle getVariable [QGVAR(source), objNull];
_sink = _nozzle getVariable [QGVAR(sink), objNull];
if (isNull _source || {isNull _sink} || {(_source distance _sink) > 20}) exitWith {
if (isNull _source || {isNull _sink} || {(_source distance _sink) > 10}) exitWith {
[LSTRING(Hint_TooFar), 2, _unit] call EFUNC(common,displayTextStructured);
detach _nozzle;
_nozzle setPosATL [(getPosATL _nozzle) select 0,(getPosATL _nozzle) select 1, 0];
_nozzle setVariable [QGVAR(sink), objNull];
@ -42,6 +41,7 @@ if !(local _sink) exitWith {
};
_fuelInSource = [_unit, _source] call FUNC(getFuel);
if (_fuelInSource == 0) exitWith {
[LSTRING(Hint_SourceEmpty), 2, _unit] call EFUNC(common,displayTextStructured);
_nozzle setVariable [QGVAR(fueling), 0, true];
[_pfID] call cba_fnc_removePerFrameHandler;
};
@ -50,20 +50,31 @@ if !(local _sink) exitWith {
if (_fuelInSource < 0 && {_fuelInSource > -1}) then {
_fuelInSource = 0;
_finished = true;
[LSTRING(Hint_Empty), 2, _unit] call EFUNC(common,displayTextStructured);
};
_fuelInSink = fuel _sink + ( _rate / _maxFuel);
if (_fuelInSink > 1) then {
_fuelInSink = 1;
_finished = true;
[LSTRING(Hint_Completed), 2, _unit] call EFUNC(common,displayTextStructured);
};
if !(local _sink) then {
[[_sink, _fuelInSink], QUOTE({(_this select 0) setFuel (_this select 1)}), _sink] call EFUNC(common,execRemoteFnc);
} else {
_sink setFuel _fuelInSink;
};
_sink setFuel _fuelInSink;
[_unit, _source, _fuelInSource] call FUNC(setFuel);
if (_finished || {_fueling == 0}) exitWith {
if (_fueling == 0) then {
[LSTRING(Hint_Stopped), 2, _unit] call EFUNC(common,displayTextStructured);
};
_nozzle setVariable [QGVAR(fueling), 0, true];
[_pfID] call cba_fnc_removePerFrameHandler;
};
// TODO display ace hint how many liters were transfered
}, 0.1, [_unit, _nozzle, _rate, fuel _target, _maxFuel]] call cba_fnc_addPerFrameHandler;
// display flickers even at 1 second intervals
//["displayTextStructured", [_unit], [[localize LSTRING(Hint_FuelProgress), round((_fuelInSink - _startFuel) * _maxFuel)], 2, _unit]] call EFUNC(common,targetEvent);
//[[LSTRING(Hint_FuelProgress), round((_fuelInSink - _startFuel) * _maxFuel)], 2, _unit] call EFUNC(common,displayTextStructured);
}, 1, [_unit, _nozzle, _rate, fuel _target, _maxFuel]] call cba_fnc_addPerFrameHandler;

View File

@ -8,31 +8,17 @@
* 2: The amout <NUMBER>
*
* Return Value:
* Nil
* None
*
* Example:
* [unit, target] call ace_refuel_fnc_getFuel
*
* Public: Yes
* Public: No
*/
#include "script_component.hpp"
private ["_maxFuel", "_type"];
private ["_maxFuel"];
params ["_unit", "_target", "_fuel"];
if (isNull _unit || {isNull _target} || {!(_unit isKindOf "CAManBase")} || {!local _unit} || { (_target distance _unit) > 7}) exitWith {0};
_type = getText (configFile >> "CfgVehicles" >> typeOf _target >> "ace_refuel_type");
_maxFuel = 0;
if (_type == "mil") then {
//_maxFuel = GVAR(mil_fuel); // FIXME
_maxFuel = 20000; // FIXME
};
if (_type == "civ") then {
_maxFuel = GVAR(civ_Fuel);
};
if (_type == "stationary") then {
_maxFuel = GVAR(stationary_Fuel);
};
_target setVariable [QGVAR(fuel), _maxFuel min _fuel, true];
nil
_target setVariable [QGVAR(currentFuelCargo), (getNumber (configFile >> "CfgVehicles" >> typeOf _target >> QGVAR(fuelCargo))) min _fuel, true];

View File

@ -8,12 +8,12 @@
* 2: The nozzle <OBJECT> (optional)
*
* Return Value:
* NIL
* None
*
* Example:
* [unit, target, truck] call ace_refuel_fnc_takeNozzle
*
* Public: Yes
* Public: No
*/
#include "script_component.hpp"
@ -28,9 +28,6 @@ _unit action ["SwitchWeapon", _unit, _unit, 99];
if (isNull _nozzle) then { // func is called on fuel truck
_endPosOffset = getArray (configFile >> "CfgVehicles" >> typeOf _target >> "ace_refuel_hooks") select 0;
// TODO pfh to check distance between _unit und _target
// if too large cancel walk and drop nozzle
// TODO add pickup animation ?
[{
@ -39,16 +36,53 @@ if (isNull _nozzle) then { // func is called on fuel truck
_newNozzle attachTo [_unit, [-0.02,-0.05,0], "righthandmiddle1"]; // TODO replace with right coordinates for real model
_unit setVariable [QGVAR(nozzle), _newNozzle];
// TODO action is only local
_action = [QGVAR(TakeNozzleFromGround),
localize LSTRING(TakeNozzle),
QUOTE(PATHTOF(ui\icon_refuel_interact.paa)),
{params ["_nozzle", "_unit"]; [ARR_3(_unit,_nozzle,_nozzle)] call DFUNC(TakeNozzle); true},
{params ["_nozzle", "_unit"]; [ARR_2(_unit,_nozzle)] call FUNC(canTakeNozzle)},
{},
[]
] call EFUNC(interact_menu,createAction);
[_newNozzle, 0, [], _action] call EFUNC(interact_menu,addActionToObject);
_rope = ropeCreate [_target, _endPosTestOffset, _newNozzle, [0, 0, 0], 12];
_newNozzle setVariable [QGVAR(source), _target, true];
_newNozzle setVariable [QGVAR(rope), _rope, true];
_target setVariable [QGVAR(connected), _newNozzle, true];
_target setVariable [QGVAR(isConnected), true, true];
}, [_unit, _target, _endPosOffset], 2, 0] call EFUNC(common,waitAndExecute);
[{
private ["_nozzle"];
params ["_args", "_pfID"];
_args params ["_unit", "_target"];
if ((_unit distance _target) > 10) exitWith {
_nozzle = _unit getVariable [QGVAR(nozzle), objNull];
if !(isNull _nozzle) then {
detach _nozzle;
_nozzle setPosATL [(getPosATL _unit) select 0,(getPosATL _unit) select 1, 0];
_nozzle setVelocity [0,0,0];
_unit setVariable [QGVAR(isRefueling), false];
_unit setVariable [QGVAR(nozzle), objNull];
_weaponSelect = _unit getVariable QGVAR(selectedWeaponOnRefuel);
_unit selectWeapon _weaponSelect;
_unit setVariable [QGVAR(selectedWeaponOnRefuel), nil];
[_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus);
[LSTRING(Hint_TooFar), 2, _unit] call EFUNC(common,displayTextStructured);
};
[_pfID] call cba_fnc_removePerFrameHandler;
};
}, 0, [_unit, _target]] call cba_fnc_addPerFrameHandler;
_unit setVariable [QGVAR(isRefueling), 1];
_unit setVariable [QGVAR(isRefueling), true];
} else { // func is called in muzzle either connected or on ground
// TODO add pickup animation ?
[{
params ["_unit", "_target", "_nozzle"];
@ -58,5 +92,3 @@ if (isNull _nozzle) then { // func is called on fuel truck
_unit setVariable [QGVAR(nozzle), _nozzle];
}, [_unit, _target, _nozzle], 2, 0] call EFUNC(common,waitAndExecute);
};
true

View File

@ -12,7 +12,7 @@
* Example:
* [player, nozzle] call ace_refuel_fnc_canTurnOff
*
* Public: Yes
* Public: No
*/
#include "script_component.hpp"

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project name="ACE">
<Package name="Logistics">
<Package name="Refuel">
<Key ID="STR_ACE_Refuel_RefuelSettings_Module_DisplayName">
<English>Refuel Settings</English>
<German>Tankeinstellungen</German>
@ -85,6 +85,26 @@
<English>Close nozzle</English>
<German>Hahn zudrehen</German>
</Key>
<Key ID="STR_ACE_Refuel_Hint_FuelProgress">
<English>%1 Liters fueled</English>
<German>%1 Liters getankt</German>
</Key>
<Key ID="STR_ACE_Refuel_Hint_SourceEmpty">
<English>The fuel source is empty.</English>
<German>Die Treibstoffquelle ist leer.</German>
</Key>
<Key ID="STR_ACE_Refuel_Hint_TooFar">
<English>Maximum fuel hose length reached.</English>
<German>Maximale Schlauchlänge erreicht.</German>
</Key>
<Key ID="STR_ACE_Refuel_Hint_Completed">
<English>Fueling completed</English>
<German>Betankung abgeschlossen</German>
</Key>
<Key ID="STR_ACE_Refuel_Hint_Stopped">
<English>Fueling stopped</English>
<German>Betankung angehalten</German>
</Key>
<Key ID="STR_ACE_Refuel_">
<English></English>
<German></German>