mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Cleanup and improvements
This commit is contained in:
parent
f852eb5f4b
commit
f44060c6a0
@ -4,6 +4,5 @@ class ACE_Settings {
|
||||
description = CSTRING(RefuelSettings_speed_Description);
|
||||
value = 1;
|
||||
typeName = "SCALAR";
|
||||
values[] = {CSTRING(RefuelSettings_basic), CSTRING(RefuelSettings_advanced)};
|
||||
};
|
||||
};
|
||||
|
@ -16,9 +16,16 @@
|
||||
exceptions[] = {"isNotInside"}; \
|
||||
icon = PATHTOF(ui\icon_refuel_interact.paa); \
|
||||
}; \
|
||||
class GVAR(Connect) { \
|
||||
displayName = CSTRING(Connect); \
|
||||
condition = QUOTE([ARR_2(_player,_target)] call FUNC(canConnectNozzle)); \
|
||||
statement = QUOTE([ARR_2(_player,_target)] call DFUNC(connectNozzle)); \
|
||||
exceptions[] = {"isNotInside"}; \
|
||||
icon = PATHTOF(ui\icon_refuel_interact.paa); \
|
||||
}; \
|
||||
class GVAR(Return) { \
|
||||
displayName = CSTRING(Return); \
|
||||
condition = QUOTE([ARR_2(_player,_target)] call FUNC(canConnectNozzle)); \
|
||||
condition = QUOTE([ARR_2(_player,_target)] call FUNC(canReturnNozzle)); \
|
||||
statement = QUOTE([ARR_2(_player,_target)] call DFUNC(returnNozzle)); \
|
||||
exceptions[] = {"isNotInside"}; \
|
||||
icon = PATHTOF(ui\icon_refuel_interact.paa); \
|
||||
@ -52,27 +59,6 @@
|
||||
exceptions[] = {"isNotInside"}; \
|
||||
icon = PATHTOF(ui\icon_refuel_interact.paa); \
|
||||
}; \
|
||||
class GVAR(TurnOn) { \
|
||||
displayName = CSTRING(TurnOn); \
|
||||
condition = QUOTE([ARR_2(_player,_target)] call FUNC(canTurnOn)); \
|
||||
statement = QUOTE([_target] call DFUNC(turnOn)); \
|
||||
exceptions[] = {"isNotInside"}; \
|
||||
icon = PATHTOF(ui\icon_refuel_interact.paa); \
|
||||
}; \
|
||||
class GVAR(Disconnect) { \
|
||||
displayName = CSTRING(Disconnect); \
|
||||
condition = QUOTE([ARR_2(_player,_target)] call FUNC(canDisconnect)); \
|
||||
statement = QUOTE([ARR_2(_player,_target)] call DFUNC(disconnect)); \
|
||||
exceptions[] = {"isNotInside"}; \
|
||||
icon = PATHTOF(ui\icon_refuel_interact.paa); \
|
||||
}; \
|
||||
class GVAR(TurnOff) { \
|
||||
displayName = CSTRING(TurnOff); \
|
||||
condition = QUOTE([ARR_2(_player,_target)] call FUNC(canTurnOff)); \
|
||||
statement = QUOTE([_target] call DFUNC(turnOff)); \
|
||||
exceptions[] = {"isNotInside"}; \
|
||||
icon = PATHTOF(ui\icon_refuel_interact.paa); \
|
||||
}; \
|
||||
}; \
|
||||
}; \
|
||||
};
|
||||
@ -80,12 +66,41 @@
|
||||
#define MACRO_NOZZLE_ACTIONS \
|
||||
class ACE_Actions { \
|
||||
class ACE_MainActions { \
|
||||
displayName = CSTRING(TakeNozzle); \
|
||||
distance = 2; \
|
||||
condition = QUOTE([ARR_2(_player,_target)] call FUNC(canTakeNozzle)); \
|
||||
statement = QUOTE([ARR_3(_player,_target,_target)] call FUNC(TakeNozzle)); \
|
||||
exceptions[] = {"isNotInside"}; \
|
||||
displayName = CSTRING(Refuel); \
|
||||
distance = 3; \
|
||||
condition = "true"; \
|
||||
statement = ""; \
|
||||
showDisabled = 0; \
|
||||
priority = 2; \
|
||||
icon = PATHTOF(ui\icon_refuel_interact.paa); \
|
||||
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)); \
|
||||
exceptions[] = {"isNotInside"}; \
|
||||
icon = PATHTOF(ui\icon_refuel_interact.paa); \
|
||||
}; \
|
||||
class GVAR(TurnOn) { \
|
||||
displayName = CSTRING(TurnOn); \
|
||||
condition = QUOTE([ARR_2(_player,_target)] call FUNC(canTurnOn)); \
|
||||
statement = QUOTE([ARR_2(_player,_target)] call DFUNC(turnOn)); \
|
||||
exceptions[] = {"isNotInside"}; \
|
||||
icon = PATHTOF(ui\icon_refuel_interact.paa); \
|
||||
}; \
|
||||
class GVAR(TurnOff) { \
|
||||
displayName = CSTRING(TurnOff); \
|
||||
condition = QUOTE([ARR_2(_player,_target)] call FUNC(canTurnOff)); \
|
||||
statement = QUOTE([ARR_2(_player,_target)] call DFUNC(turnOff)); \
|
||||
exceptions[] = {"isNotInside"}; \
|
||||
icon = PATHTOF(ui\icon_refuel_interact.paa); \
|
||||
}; \
|
||||
class GVAR(Disconnect) { \
|
||||
displayName = CSTRING(Disconnect); \
|
||||
condition = QUOTE([ARR_2(_player,_target)] call FUNC(canDisconnect)); \
|
||||
statement = QUOTE([ARR_2(_player,_target)] call DFUNC(disconnect)); \
|
||||
exceptions[] = {"isNotInside"}; \
|
||||
icon = PATHTOF(ui\icon_refuel_interact.paa); \
|
||||
}; \
|
||||
}; \
|
||||
};
|
||||
|
||||
@ -106,17 +121,7 @@ class CfgVehicles {
|
||||
displayName = CSTRING(RefuelSettings_speed_DisplayName);
|
||||
description = CSTRING(RefuelSettings_speed_Description);
|
||||
typeName = "NUMBER";
|
||||
class values {
|
||||
class fast {
|
||||
name = CSTRING(RefuelSettings_basic);
|
||||
value = 10;
|
||||
};
|
||||
class realistic {
|
||||
name = CSTRING(RefuelSettings_advanced);
|
||||
value = 1;
|
||||
default = 1;
|
||||
};
|
||||
};
|
||||
defaultValue = 10;
|
||||
};
|
||||
};
|
||||
};
|
||||
@ -163,6 +168,7 @@ class CfgVehicles {
|
||||
|
||||
class Tank : LandVehicle {
|
||||
MACRO_CONNECT_ACTIONS
|
||||
GVAR(flowRate) = 4;
|
||||
};
|
||||
|
||||
class StaticWeapon : LandVehicle {
|
||||
@ -266,6 +272,7 @@ class CfgVehicles {
|
||||
|
||||
class Truck_F : Car_F {
|
||||
GVAR(fuelCapacity) = 400;
|
||||
GVAR(flowRate) = 2;
|
||||
};
|
||||
|
||||
class Truck_01_base_F: Truck_F {
|
||||
@ -499,7 +506,7 @@ class CfgVehicles {
|
||||
XEH_ENABLED;
|
||||
transportFuel = 0; //50k
|
||||
MACRO_REFUEL_ACTIONS
|
||||
GVAR(hooks[]) = {{0,0,-1}};
|
||||
GVAR(hooks[]) = {{0,0,-0.5}};
|
||||
GVAR(fuelCargo) = REFUEL_INFINITE_FUEL;
|
||||
};
|
||||
|
||||
@ -511,7 +518,7 @@ class CfgVehicles {
|
||||
GVAR(fuelCargo) = REFUEL_INFINITE_FUEL;
|
||||
};
|
||||
|
||||
/* // Barrels from rhs?
|
||||
/* // Barrels found in config \
|
||||
BarrelHelper : Misc_thing 100
|
||||
BarrelBase : BarrelHelper 100
|
||||
Barrels : BarrelBase 400
|
||||
|
@ -5,7 +5,7 @@ ADDON = false;
|
||||
PREP(canCheckFuel);
|
||||
PREP(canConnectNozzle);
|
||||
PREP(canDisconnect);
|
||||
PREP(canRefuel);
|
||||
PREP(canReturnNozzle);
|
||||
PREP(canTakeNozzle);
|
||||
PREP(canTurnOff);
|
||||
PREP(canTurnOn);
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Target <OBJECT>
|
||||
* 1: Fuel Truck/Station <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Can Check Fuel <BOOL>
|
||||
|
@ -3,14 +3,14 @@
|
||||
* Check if a unit can connect a fuel nozzle
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The unit <OBJECT>
|
||||
* 1: The target <OBJECT>
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Target <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Can Connect Nozzle <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* [unit] call ace_refuel_fnc_canConnectNozzle
|
||||
* [unit, tank] call ace_refuel_fnc_canConnectNozzle
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
@ -21,4 +21,6 @@ params ["_unit", "_target"];
|
||||
|
||||
_nozzle = _unit getVariable QGVAR(nozzle);
|
||||
|
||||
!(isNil "_nozzle" || {(_target distance _unit) > REFUEL_ACTION_DISTANCE})
|
||||
!(isNil "_nozzle" ||
|
||||
{(_target distance _unit) > REFUEL_ACTION_DISTANCE} ||
|
||||
{!isNull (_target getVariable [QGVAR(nozzle), objNull])}) // TODO verify cant connect multiple fuel lines
|
||||
|
@ -3,27 +3,27 @@
|
||||
* Check if a unit can disconnect a fuel nozzle
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The unit <OBJECT>
|
||||
* 1: The object holding the nozzle <OBJECT>
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Nozzle <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Can disconnect <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* [player, truck] call ace_refuel_fnc_canDisconnect
|
||||
* [player, nozzle] call ace_refuel_fnc_canDisconnect
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_nozzle", "_sink"];
|
||||
params ["_unit", "_nozzleHolder"];
|
||||
private ["_sink"];
|
||||
params ["_unit", "_nozzle"];
|
||||
|
||||
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};
|
||||
if (isNull _unit ||
|
||||
{isNull _nozzle} ||
|
||||
{!(_unit isKindOf "CAManBase")} ||
|
||||
{!local _unit} ||
|
||||
{(_nozzle distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false};
|
||||
|
||||
_sink = _nozzle getVariable [QGVAR(sink), objNull];
|
||||
|
||||
!((isNull _sink) || {_nozzle getVariable [QGVAR(isRefueling), false]});
|
||||
!((isNull _sink) || {_nozzle getVariable [QGVAR(isRefueling), false]})
|
||||
|
@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Author: GitHawk
|
||||
* Check if a unit can refuel
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The target <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Can refuel <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* [unit, target] call ace_refuel_fnc_canRefuel
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
private ["_fuel"];
|
||||
params ["_unit", "_target"];
|
||||
|
||||
if (isNull _unit || {!(_unit isKindOf "CAManBase")} || {!local _unit} || {(_target distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false};
|
||||
|
||||
_fuel = [_target] call FUNC(getFuel);
|
||||
|
||||
(_fuel > 0 || {_fuel == -1})
|
24
addons/refuel/functions/fnc_canReturnNozzle.sqf
Normal file
24
addons/refuel/functions/fnc_canReturnNozzle.sqf
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Author: GitHawk
|
||||
* Check if a unit can return a fuel nozzle
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Target <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Can Return Nozzle <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* [unit, tank] call ace_refuel_fnc_canReturnNozzle
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_nozzle"];
|
||||
params ["_unit", "_target"];
|
||||
|
||||
_nozzle = _unit getVariable QGVAR(nozzle);
|
||||
|
||||
(_this call FUNC(canConnectNozzle)) && {_target == (_nozzle getVariable [QGVAR(source), objNull])}
|
@ -3,14 +3,14 @@
|
||||
* Check if a unit can take a fuel nozzle
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The unit <OBJECT>
|
||||
* 1: The target <OBJECT>
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Fuel Station or Nozzle <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Can connect <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* [player, target] call ace_refuel_fnc_canTakeNozzle
|
||||
* [player, nozzle] call ace_refuel_fnc_canTakeNozzle
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
@ -3,24 +3,25 @@
|
||||
* Check if a unit can turn off a fuel nozzle
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The unit <OBJECT>
|
||||
* 1: The object holding the nozzle <OBJECT>
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Nozzle <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Can turn off <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* [player, truck] call ace_refuel_fnc_canTurnOff
|
||||
* [player, nozzle] call ace_refuel_fnc_canTurnOff
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_unit", "_nozzleHolder"];
|
||||
params ["_unit", "_nozzle"];
|
||||
|
||||
if (isNull _unit ||
|
||||
{isNull _nozzle} ||
|
||||
{!(_unit isKindOf "CAManBase")} ||
|
||||
{!local _unit} ||
|
||||
{(_nozzleHolder distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false};
|
||||
{(_nozzle distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false};
|
||||
|
||||
!(isNull (_nozzleHolder getVariable [QGVAR(nozzle), objNull])) && {(_nozzleHolder getVariable QGVAR(nozzle)) getVariable [QGVAR(isRefueling), false]}
|
||||
(_nozzle getVariable [QGVAR(isRefueling), false])
|
||||
|
@ -3,29 +3,28 @@
|
||||
* Check if a unit can turn on a fuel nozzle
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The unit <OBJECT>
|
||||
* 1: The object holding the nozzle <OBJECT>
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Nozzle <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Can turn on <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* [player, truck] call ace_refuel_fnc_canTurnOn
|
||||
* [player, nozzle] call ace_refuel_fnc_canTurnOn
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_unit", "_nozzleHolder"];
|
||||
params ["_unit", "_nozzle"];
|
||||
|
||||
if (isNull _unit ||
|
||||
{isNull _nozzle} ||
|
||||
{!(_unit isKindOf "CAManBase")} ||
|
||||
{!local _unit} ||
|
||||
{(_nozzleHolder distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false};
|
||||
{(_nozzle distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false};
|
||||
|
||||
private "_nozzle";
|
||||
|
||||
_nozzle = _nozzleHolder getVariable [QGVAR(nozzle), objNull];
|
||||
(!isNull _nozzle) &&
|
||||
{!(_nozzle getVariable [QGVAR(isRefueling), false])} &&
|
||||
{[_nozzle getVariable QGVAR(source)] call FUNC(getFuel) != 0}
|
||||
!(_nozzle getVariable [QGVAR(isRefueling), false]) &&
|
||||
{[_nozzle getVariable QGVAR(source)] call FUNC(getFuel) != 0} &&
|
||||
{!isNull (_nozzle getVariable [QGVAR(sink), objNull])} &&
|
||||
{(fuel (_nozzle getVariable QGVAR(sink))) < 1}
|
||||
|
@ -3,8 +3,8 @@
|
||||
* Get the remaining fuel amount
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The unit <OBJECT>
|
||||
* 1: The target <OBJECT>
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Fuel Truck <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
|
@ -1,18 +1,17 @@
|
||||
/*
|
||||
* Author: GitHawk et.al.
|
||||
* Connect a fuel nozzle
|
||||
* Connect a fuel nozzle.
|
||||
* With code from ace_attach
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The unit <OBJECT>
|
||||
* 1: The target <OBJECT>
|
||||
* 2: The nozzle <OBJECT> (optional)
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Target <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [unit, target, nozzle] call ace_refuel_fnc_connectNozzle
|
||||
* [unit, target] call ace_refuel_fnc_connectNozzle
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
@ -35,21 +34,21 @@ _unit setVariable [QGVAR(placeActionEH), [_unit, "DefaultAction", {true}, {GVAR(
|
||||
|
||||
_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"];
|
||||
|
||||
|
||||
_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];
|
||||
|
||||
|
||||
//Don't allow placing in a bad position:
|
||||
if (_lineInterection && {GVAR(placeAction) == PLACE_APPROVE}) then {GVAR(placeAction) = PLACE_WAITING;};
|
||||
|
||||
|
||||
if ((GVAR(placeAction) != PLACE_WAITING) ||
|
||||
{_unit != ace_player} ||
|
||||
{!([_unit, _target, []] call EFUNC(common,canInteractWith))}) then {
|
||||
@ -58,9 +57,9 @@ _actionID = _unit addAction [format ["<t color='#FF0000'>%1</t>", localize LSTRI
|
||||
[] call EFUNC(interaction,hideMouseHint);
|
||||
[_unit, "DefaultAction", (_unit getVariable [QGVAR(placeActionEH), -1])] call EFUNC(common,removeActionEventHandler);
|
||||
_unit removeAction _actionID;
|
||||
|
||||
|
||||
if (GVAR(placeAction) == PLACE_APPROVE) then {
|
||||
[_unit, _target, _virtualPos, _nozzle] call FUNC(ConnectNozzleAction);
|
||||
};
|
||||
}; // TODO add model like in attach/functions/fnc_attach
|
||||
}, 0, [_unit, _target, _nozzle, _actionID] ] call cba_fnc_addPerFrameHandler;
|
||||
}, 0, [_unit, _target, _nozzle, _actionID] ] call cba_fnc_addPerFrameHandler;
|
||||
|
@ -1,13 +1,13 @@
|
||||
/*
|
||||
* Author: GitHawk et.al
|
||||
* Calculates a connection for tilting
|
||||
* Author: GitHawk et.al.
|
||||
* Calculates a connection for refueling.
|
||||
* With code from ace_attach
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The player <OBJECT>
|
||||
* 1: The target <OBJECT>
|
||||
* 2: The visual position <ARRAY>
|
||||
* 3: The nozzle <OBJECT>
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Target <OBJECT>
|
||||
* 2: Visual Position <ARRAY>
|
||||
* 3: Nozzle <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
@ -74,18 +74,14 @@ _endPosTestOffset set [2, (_startingOffset select 2)];
|
||||
// TODO put animation and delayed connect ?
|
||||
|
||||
_unit setVariable [QGVAR(nozzle), nil];
|
||||
detach _nozzle;
|
||||
[_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus);
|
||||
|
||||
_weaponSelect = _unit getVariable QGVAR(selectedWeaponOnRefuel);
|
||||
_unit selectWeapon _weaponSelect;
|
||||
_unit setVariable [QGVAR(selectedWeaponOnRefuel), 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(isRefueling), true, true];
|
||||
_nozzle setVariable [QGVAR(isConnected), true, true];
|
||||
_target setVariable [QGVAR(nozzle), _nozzle, true];
|
||||
|
||||
[_unit, _target, _nozzle] call FUNC(refuel);
|
||||
[_unit, _target, _nozzle, _endPosTestOffset] call FUNC(refuel);
|
||||
|
@ -1,10 +1,10 @@
|
||||
/*
|
||||
* Author: GitHawk
|
||||
* Disconnect a fuel nozzle
|
||||
* Disconnect a fuel nozzle.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The unit <OBJECT>
|
||||
* 1: The object holding the nozzle <OBJECT>
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Nozzle <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
@ -16,14 +16,15 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_nozzle"];
|
||||
params ["_unit", "_nozzleHolder"];
|
||||
private ["_sink"];
|
||||
params ["_unit", "_nozzle"];
|
||||
|
||||
_nozzle = _nozzleHolder getVariable QGVAR(nozzle);
|
||||
_sink = _nozzle getVariable [QGVAR(sink), objNull];
|
||||
if (isNull _sink) exitWith {};
|
||||
|
||||
detach _nozzle;
|
||||
_sink setVariable [QGVAR(nozzle), objNull, true];
|
||||
_nozzle setVariable [QGVAR(sink), objNull, true];
|
||||
_nozzleHolder setVariable [QGVAR(nozzle), objNull, true];
|
||||
REFUEL_DROP_NOZZLE(_nozzle)
|
||||
_unit setVariable [QGVAR(nozzle), _nozzle];
|
||||
|
||||
[_unit, _nozzleHolder, _nozzle] call FUNC(takeNozzle);
|
||||
[_unit, objNull, _nozzle] call FUNC(takeNozzle);
|
||||
|
@ -20,7 +20,7 @@ params ["_unit"];
|
||||
if (!local _unit) exitWith {};
|
||||
|
||||
_unit setVariable [QGVAR(selectedWeaponOnRefuel), nil];
|
||||
_nozzle = _unit setVariable [QGVAR(nozzle), objNull];
|
||||
_nozzle = _unit getVariable [QGVAR(nozzle), objNull];
|
||||
if !(isNull _nozzle) then {
|
||||
REFUEL_UNIT_DROP_NOZZLE
|
||||
};
|
||||
|
@ -23,7 +23,7 @@ if (!local _unit || {!_isUnconscious}) exitWith {};
|
||||
private "_nozzle";
|
||||
|
||||
[_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus);
|
||||
_nozzle = _unit setVariable [QGVAR(nozzle), objNull];
|
||||
_nozzle = _unit getVariable [QGVAR(nozzle), objNull];
|
||||
if !(isNull _nozzle) then {
|
||||
REFUEL_UNIT_DROP_NOZZLE
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Author: GitHawk
|
||||
* Module for adjusting the refuel settings
|
||||
* Module for adjusting the refuel settings.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The module logic <LOGIC>
|
||||
|
@ -1,11 +1,12 @@
|
||||
/*
|
||||
* Author: GitHawk
|
||||
* Refuels the vehicle
|
||||
* Refuels the vehicle.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The unit <OBJECT>
|
||||
* 1: The target <OBJECT>
|
||||
* 2: The nozzle <OBJECT>
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Target <OBJECT>
|
||||
* 2: Nozzle <OBJECT>
|
||||
* 3: Connection Point <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
@ -15,35 +16,28 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_sink", "_rate", "_maxFuel"];
|
||||
params ["_unit", "_target", "_nozzle"];
|
||||
#define PFH_STEPSIZE 0.1
|
||||
|
||||
_sink = _nozzle getVariable [QGVAR(sink), objNull];
|
||||
if (isNull _sink) exitWith {};
|
||||
private ["_rate", "_maxFuel"];
|
||||
params ["_unit", "_target", "_nozzle", "_connectToPoint"];
|
||||
|
||||
_rate = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(flowRate)) * GVAR(rate);
|
||||
_rate = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(flowRate)) * GVAR(rate) * PFH_STEPSIZE;
|
||||
_maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(fuelCapacity));
|
||||
|
||||
[{
|
||||
private ["_source", "_sink", "_tooFar", "_fuelInSource", "_fuelInSink", "_finished", "_fueling"];
|
||||
private ["_source", "_tooFar", "_fuelInSource", "_fuelInSink", "_finished", "_fueling"];
|
||||
params ["_args", "_pfID"];
|
||||
_args params ["_unit", "_nozzle", "_rate", "_startFuel", "_maxFuel"];
|
||||
_args params ["_source", "_sink", "_unit", "_nozzle", "_rate", "_startFuel", "_maxFuel", "_connectFromPoint", "_connectToPoint"];
|
||||
|
||||
_fueling = _nozzle getVariable [QGVAR(isRefueling), false];
|
||||
|
||||
_source = _nozzle getVariable [QGVAR(source), objNull];
|
||||
_sink = _nozzle getVariable [QGVAR(sink), objNull];
|
||||
if (isNull _source ||
|
||||
{!alive _source} ||
|
||||
{isNull _sink} ||
|
||||
{!alive _sink}) exitWith {
|
||||
if (!alive _source || {!alive _sink}) exitWith {
|
||||
REFUEL_DROP_NOZZLE(_nozzle)
|
||||
_nozzle setVariable [QGVAR(isConnected), false, true];
|
||||
_nozzle setVariable [QGVAR(sink), objNull, true];
|
||||
_sink setVariable [QGVAR(nozzle), objNull, true];
|
||||
[_pfID] call cba_fnc_removePerFrameHandler;
|
||||
};
|
||||
_tooFar = (_sink distance (_source modelToWorld (_nozzle getVariable [QGVAR(attachPos), [0,0,0]]))) > 10;
|
||||
_tooFar = ((_sink modelToWorld _connectToPoint) distance (_source modelToWorld _connectFromPoint)) > 10;
|
||||
if (_tooFar) exitWith {
|
||||
[LSTRING(Hint_TooFar), 2, _unit] call EFUNC(common,displayTextStructured);
|
||||
|
||||
@ -84,10 +78,18 @@ _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(f
|
||||
[_unit, _source, _fuelInSource] call FUNC(setFuel);
|
||||
};
|
||||
|
||||
if (_finished || {!_fueling}) exitWith {
|
||||
if !(_fueling) then {
|
||||
[LSTRING(Hint_Stopped), 2, _unit] call EFUNC(common,displayTextStructured);
|
||||
};
|
||||
if (_finished) exitWith {
|
||||
_nozzle setVariable [QGVAR(isRefueling), false, true];
|
||||
};
|
||||
}, 1, [_unit, _nozzle, _rate, fuel _target, _maxFuel]] call cba_fnc_addPerFrameHandler;
|
||||
},
|
||||
PFH_STEPSIZE,
|
||||
[_nozzle getVariable QGVAR(source),
|
||||
_target,
|
||||
_unit,
|
||||
_nozzle,
|
||||
_rate,
|
||||
fuel _target,
|
||||
_maxFuel,
|
||||
_nozzle getVariable [QGVAR(attachPos), [0,0,0]],
|
||||
_connectToPoint]
|
||||
] call cba_fnc_addPerFrameHandler;
|
||||
|
@ -3,7 +3,7 @@
|
||||
* Returns the nozzle back to source vehicle.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Player <OBJECT>
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Target <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
@ -34,4 +34,7 @@ _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];
|
||||
|
||||
true
|
||||
|
@ -1,11 +1,11 @@
|
||||
/*
|
||||
* Author: GitHawk
|
||||
* Set the remaining fuel amount
|
||||
* Set the remaining fuel amount.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The unit <OBJECT>
|
||||
* 1: The target <OBJECT>
|
||||
* 2: The amout <NUMBER>
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Target <OBJECT>
|
||||
* 2: Amount (in liters)<NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
|
@ -1,11 +1,11 @@
|
||||
/*
|
||||
* Author: GitHawk
|
||||
* Take a fuel nozzle
|
||||
* Take a fuel nozzle either from a fuel truck/station or from the ground.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The unit <OBJECT>
|
||||
* 1: The target <OBJECT>
|
||||
* 2: The nozzle <OBJECT> (optional)
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Target <OBJECT>
|
||||
* 2: Nozzle <OBJECT> (optional)
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
@ -18,13 +18,20 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_endPosOffset"],
|
||||
params ["_unit", "_target", "_nozzle"];
|
||||
params ["_unit", "_target", ["_nozzle", objNull]];
|
||||
|
||||
[_unit, QGVAR(vehAttach), true] call EFUNC(common,setForceWalkStatus);
|
||||
|
||||
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];
|
||||
_target setHitPointDamage ["HitEngine", 1];
|
||||
|
||||
_target setVariable [QGVAR(isConnected), true, true];
|
||||
_endPosOffset = getArray (configFile >> "CfgVehicles" >> typeOf _target >> "ace_refuel_hooks");
|
||||
if (count _endPosOffset == 2) then {
|
||||
if (_unit distance (_target modelToWorld (_endPosOffset select 0)) < _unit distance (_target modelToWorld (_endPosOffset select 1))) then {
|
||||
@ -36,8 +43,6 @@ if (isNull _nozzle) then { // func is called on fuel truck
|
||||
_endPosOffset = _endPosOffset select 0;
|
||||
};
|
||||
|
||||
// TODO add pickup animation ?
|
||||
|
||||
[{
|
||||
params ["_unit", "_target", "_endPosOffset"];
|
||||
_newNozzle = "ACE_refuel_fuelNozzle" createVehicle position _unit;
|
||||
@ -48,37 +53,33 @@ if (isNull _nozzle) then { // func is called on fuel truck
|
||||
_newNozzle setVariable [QGVAR(attachPos), _endPosOffset, true];
|
||||
_newNozzle setVariable [QGVAR(source), _target, true];
|
||||
_newNozzle setVariable [QGVAR(rope), _rope, true];
|
||||
_target setVariable [QGVAR(isConnected), true, true];
|
||||
}, [_unit, _target, _endPosOffset], 2, 0] call EFUNC(common,waitAndExecute);
|
||||
|
||||
[{
|
||||
private ["_nozzle"];
|
||||
params ["_args", "_pfID"];
|
||||
_args params ["_unit", "_source", "_endPosOffset"];
|
||||
|
||||
if (_unit distance (_source modelToWorld _endPosOffset) > 10) exitWith {
|
||||
_nozzle = _unit getVariable [QGVAR(nozzle), objNull];
|
||||
if !(isNull _nozzle) then {
|
||||
REFUEL_UNIT_DROP_NOZZLE
|
||||
REFUEL_UNHOLSTER_WEAPON
|
||||
|
||||
[_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, _endPosOffset]] call cba_fnc_addPerFrameHandler;
|
||||
|
||||
_unit setVariable [QGVAR(isRefueling), true];
|
||||
} else { // func is called in muzzle either connected or on ground
|
||||
// TODO add pickup animation ?
|
||||
|
||||
[{
|
||||
params ["_unit", "_target", "_nozzle"];
|
||||
|
||||
detach _nozzle;
|
||||
_target setVariable [QGVAR(nozzle), objNull, true];
|
||||
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, _target, _nozzle], 2, 0] call EFUNC(common,waitAndExecute);
|
||||
}, [_unit, _nozzle], 2, 0] call EFUNC(common,waitAndExecute);
|
||||
|
||||
_target = _nozzle getVariable QGVAR(source);
|
||||
_endPosOffset = _nozzle getVariable QGVAR(attachPos);
|
||||
};
|
||||
[{
|
||||
private ["_nozzle"];
|
||||
params ["_args", "_pfID"];
|
||||
_args params ["_unit", "_source", "_endPosOffset"];
|
||||
|
||||
if (_unit distance (_source modelToWorld _endPosOffset) > 10) exitWith {
|
||||
_nozzle = _unit getVariable [QGVAR(nozzle), objNull];
|
||||
if !(isNull _nozzle) then {
|
||||
REFUEL_UNIT_DROP_NOZZLE
|
||||
REFUEL_UNHOLSTER_WEAPON
|
||||
|
||||
[_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, _endPosOffset]] call cba_fnc_addPerFrameHandler;
|
||||
|
||||
_unit setVariable [QGVAR(isRefueling), true];
|
||||
|
@ -1,20 +1,22 @@
|
||||
/*
|
||||
* Author: GitHawk
|
||||
* Turn off a fuel nozzle
|
||||
* Turn off a fuel nozzle.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The object holding the nozzle <OBJECT>
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Nozzle <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [tank] call ace_refuel_fnc_turnOff
|
||||
* [nozzle] call ace_refuel_fnc_turnOff
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_nozzleHolder"];
|
||||
params ["_unit", "_nozzle"];
|
||||
|
||||
(_nozzleHolder getVariable QGVAR(nozzle)) setVariable [QGVAR(isRefueling), false, true];
|
||||
_nozzle setVariable [QGVAR(isRefueling), false, true];
|
||||
[LSTRING(Hint_Stopped), 1.5, _unit] call EFUNC(common,displayTextStructured);
|
||||
|
@ -1,20 +1,22 @@
|
||||
/*
|
||||
* Author: GitHawk
|
||||
* Turn on a fuel nozzle
|
||||
* Turn on a fuel nozzle.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The object holding the nozzle <OBJECT>
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Nozzle <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [tank] call ace_refuel_fnc_turnOn
|
||||
* [nozzle] call ace_refuel_fnc_turnOn
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_nozzleHolder"];
|
||||
params ["_unit", "_nozzle"];
|
||||
|
||||
(_nozzleHolder getVariable QGVAR(nozzle)) setVariable [QGVAR(isRefueling), true, true];
|
||||
_nozzle setVariable [QGVAR(isRefueling), true, true];
|
||||
[LSTRING(Hint_Started), 1.5, _unit] call EFUNC(common,displayTextStructured);
|
||||
|
@ -3,7 +3,7 @@
|
||||
<Package name="Refuel">
|
||||
<Key ID="STR_ACE_Refuel_RefuelSettings_Module_DisplayName">
|
||||
<English>Refuel Settings</English>
|
||||
<German>Betankung</German>
|
||||
<German>Betankungseinst.</German>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Refuel_RefuelSettings_speed_DisplayName">
|
||||
<English>Flow Rate</English>
|
||||
@ -13,14 +13,6 @@
|
||||
<English>How fast should a vehicle be refueled?</English>
|
||||
<German>Wie schnell soll ein Fahrzeug aufgetankt sein?</German>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Refuel_RefuelSettings_basic">
|
||||
<English>Fast</English>
|
||||
<German>Schnell</German>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Refuel_RefuelSettings_advanced">
|
||||
<English>Realistic</English>
|
||||
<German>Realistisch</German>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Refuel_Refuel">
|
||||
<English>Refuel</English>
|
||||
<German>Betankung</German>
|
||||
@ -89,6 +81,10 @@
|
||||
<English>Fueling stopped</English>
|
||||
<German>Betankung angehalten</German>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Refuel_Hint_Started">
|
||||
<English>Fueling started</English>
|
||||
<German>Betankung begonnen</German>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Refuel_Return">
|
||||
<English>Return fuel nozzle</English>
|
||||
<German>Zapfpistole zurückstecken</German>
|
||||
|
Loading…
Reference in New Issue
Block a user