mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Refuel for non-AllVehicle objects (#5151)
* Enabled refuel for non-AllVehicles objects. Un-magic'd refuel progress timer. * Changed helper attach position to centre of object. Offset applied when rope attached. * Made fully compatible with non-thingX simulation types. Removed destruction effects of helper object. * Using arma model. Removed ACE_Actions from helper object. * Correct use of hideObjectGlobal * Remove actions, cargo, repair on helper * Switched helper to be setVar'd on the nozzle object
This commit is contained in:
parent
cd852477c8
commit
3b7a3047cd
@ -512,6 +512,22 @@ class CfgVehicles {
|
||||
GVAR(fuelCargo) = REFUEL_INFINITE_FUEL;
|
||||
};
|
||||
|
||||
// Helper object for non-AllVehicles objects
|
||||
class GVAR(helper): Helicopter_Base_F {
|
||||
scope = 1;
|
||||
displayName = "Refuel Helper";
|
||||
model = "\A3\Weapons_f\empty";
|
||||
class ACE_Actions {};
|
||||
class ACE_SelfActions {};
|
||||
EGVAR(cargo,hasCargo) = 0;
|
||||
EGVAR(cargo,space) = 0;
|
||||
damageEffect = "";
|
||||
destrType = "";
|
||||
class HitPoints {};
|
||||
class Turrets {};
|
||||
class TransportItems {};
|
||||
};
|
||||
|
||||
/* // Barrels found in config \
|
||||
BarrelHelper: Misc_thing 100
|
||||
BarrelBase: BarrelHelper 100
|
||||
|
@ -21,7 +21,7 @@ params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]]];
|
||||
private _fuel = [_target] call FUNC(getFuel);
|
||||
|
||||
[
|
||||
5,
|
||||
REFUEL_PROGRESS_DURATION * 2.5,
|
||||
[_unit, _target, _fuel],
|
||||
{
|
||||
params ["_args"];
|
||||
|
@ -72,7 +72,7 @@ _endPosTestOffset = _startingOffset vectorAdd (_closeInUnitVector vectorMultiply
|
||||
_endPosTestOffset set [2, (_startingOffset select 2)];
|
||||
|
||||
[
|
||||
2,
|
||||
REFUEL_PROGRESS_DURATION,
|
||||
[_unit, _nozzle, _target, _endPosTestOffset],
|
||||
{
|
||||
params ["_args"];
|
||||
|
@ -49,6 +49,10 @@ if (_nozzle getVariable [QGVAR(jerryCan), false]) exitWith {};
|
||||
if !(isNull _rope) then {
|
||||
ropeDestroy _rope;
|
||||
};
|
||||
private _helper = _nozzle getVariable [QGVAR(helper), objNull];
|
||||
if !(isNull _helper) then {
|
||||
deleteVehicle _helper;
|
||||
};
|
||||
deleteVehicle _nozzle;
|
||||
} else {
|
||||
[LSTRING(Hint_TooFar), 2, _unit] call EFUNC(common,displayTextStructured);
|
||||
|
@ -19,7 +19,7 @@
|
||||
params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]]];
|
||||
|
||||
[
|
||||
2,
|
||||
REFUEL_PROGRESS_DURATION,
|
||||
[_unit, _target],
|
||||
{
|
||||
params ["_args"];
|
||||
|
@ -31,6 +31,10 @@ if !(isNil "_nozzle") then {
|
||||
if !(isNull _rope) then {
|
||||
ropeDestroy _rope;
|
||||
};
|
||||
private _helper = _nozzle getVariable [QGVAR(helper), objNull];
|
||||
if !(isNull _helper) then {
|
||||
deleteVehicle _helper;
|
||||
};
|
||||
|
||||
{
|
||||
[QGVAR(resetLocal), [_x, _nozzle], _x] call CBA_fnc_targetEvent;
|
||||
|
@ -24,7 +24,7 @@ private _source = _nozzle getVariable QGVAR(source);
|
||||
if (isNull _nozzle || {_source != _target}) exitWith {false};
|
||||
|
||||
[
|
||||
2,
|
||||
REFUEL_PROGRESS_DURATION,
|
||||
[_unit, _nozzle, _target],
|
||||
{
|
||||
params ["_args"];
|
||||
@ -46,6 +46,10 @@ if (isNull _nozzle || {_source != _target}) exitWith {false};
|
||||
if !(isNull _rope) then {
|
||||
ropeDestroy _rope;
|
||||
};
|
||||
private _helper = _nozzle getVariable [QGVAR(helper), objNull];
|
||||
if !(isNull _helper) then {
|
||||
deleteVehicle _helper;
|
||||
};
|
||||
deleteVehicle _nozzle;
|
||||
|
||||
[_target, "blockEngine", "ACE_Refuel", false] call EFUNC(common,statusEffect_set);
|
||||
|
@ -39,7 +39,7 @@ if (isNull _nozzle) then { // func is called on fuel truck
|
||||
_endPosOffset = _endPosOffset select 0;
|
||||
};
|
||||
[
|
||||
2,
|
||||
REFUEL_PROGRESS_DURATION,
|
||||
[_unit, _target, _endPosOffset],
|
||||
{
|
||||
params ["_args"];
|
||||
@ -53,11 +53,22 @@ if (isNull _nozzle) then { // func is called on fuel truck
|
||||
_newNozzle attachTo [_unit, [-0.02,0.05,-0.12], "righthandmiddle1"];
|
||||
_unit setVariable [QGVAR(nozzle), _newNozzle, true];
|
||||
|
||||
if (_target isKindOf "AllVehicles") then {
|
||||
// Currently ropeCreate requires its first parameter to be a real vehicle
|
||||
private _rope = ropeCreate [_target, _endPosOffset, _newNozzle, [0, -0.20, 0.12], REFUEL_HOSE_LENGTH];
|
||||
_newNozzle setVariable [QGVAR(rope), _rope, true];
|
||||
private _ropeTarget = _target;
|
||||
if (!(_target isKindOf "AllVehicles")) then {
|
||||
private _helper = QGVAR(helper) createVehicle [0,0,0];
|
||||
[QEGVAR(common,hideObjectGlobal), [_helper, true]] call CBA_fnc_serverEvent;
|
||||
if ((getText (configFile >> "CfgVehicles" >> typeOf _target >> "simulation")) isEqualTo "thingX") then {
|
||||
_helper attachTo [_target, [0,0,0]];
|
||||
} else {
|
||||
_helper setPosWorld (getPosWorld _target);
|
||||
_helper setDir (getDir _target);
|
||||
_helper setVectorUp (vectorUp _target);
|
||||
};
|
||||
_newNozzle setVariable [QGVAR(helper), _helper, true];
|
||||
_ropeTarget = _helper;
|
||||
};
|
||||
private _rope = ropeCreate [_ropeTarget, _endPosOffset, _newNozzle, [0, -0.20, 0.12], REFUEL_HOSE_LENGTH];
|
||||
_newNozzle setVariable [QGVAR(rope), _rope, true];
|
||||
_newNozzle setVariable [QGVAR(attachPos), _endPosOffset, true];
|
||||
_newNozzle setVariable [QGVAR(source), _target, true];
|
||||
|
||||
@ -93,7 +104,7 @@ if (isNull _nozzle) then { // func is called on fuel truck
|
||||
] call EFUNC(common,progressBar);
|
||||
} else { // func is called on muzzle either connected or on ground
|
||||
[
|
||||
2,
|
||||
REFUEL_PROGRESS_DURATION,
|
||||
[_unit, _nozzle],
|
||||
{
|
||||
params ["_args"];
|
||||
|
@ -19,7 +19,7 @@
|
||||
params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]]];
|
||||
|
||||
[
|
||||
2,
|
||||
REFUEL_PROGRESS_DURATION,
|
||||
[_unit, _nozzle],
|
||||
{
|
||||
params ["_args"];
|
||||
|
@ -19,7 +19,7 @@
|
||||
params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]]];
|
||||
|
||||
[
|
||||
2,
|
||||
REFUEL_PROGRESS_DURATION,
|
||||
[_unit, _nozzle],
|
||||
{
|
||||
params ["_args"];
|
||||
|
@ -19,6 +19,7 @@
|
||||
#define REFUEL_INFINITE_FUEL -10
|
||||
#define REFUEL_ACTION_DISTANCE 7
|
||||
#define REFUEL_HOSE_LENGTH 12
|
||||
#define REFUEL_PROGRESS_DURATION 2
|
||||
|
||||
#define REFUEL_HOLSTER_WEAPON \
|
||||
_unit setVariable [QGVAR(selectedWeaponOnRefuel), currentWeapon _unit]; \
|
||||
|
@ -37,7 +37,7 @@ class Extended_InitPost_EventHandlers {
|
||||
class Helicopter {
|
||||
class ADDON {
|
||||
init = QUOTE(_this call DFUNC(addRepairActions));
|
||||
exclude[] = {QEGVAR(fastroping,helper), "ACE_friesBase"};
|
||||
exclude[] = {QEGVAR(fastroping,helper), "ACE_friesBase", QEGVAR(refuel,helper)};
|
||||
};
|
||||
};
|
||||
class Plane {
|
||||
|
Loading…
Reference in New Issue
Block a user