Hot Resupply (#5639)

Allow rearm, refuel and pylons to function while vehicle engine is running
This commit is contained in:
Tim Beswick 2017-10-26 05:13:44 +01:00 committed by PabstMirror
parent 1a2e2848ad
commit c9f1719f5a
12 changed files with 31 additions and 15 deletions

View File

@ -43,4 +43,6 @@
addMissionEventHandler ["HandleDisconnect", LINKFUNC(handleDisconnect)];
};
GVAR(searchDistanceSqr) = GVAR(searchDistance) ^ 2;
}] call CBA_fnc_addEventHandler;

View File

@ -22,4 +22,6 @@ if (GVAR(requireEngineer) && {!([_unit] call EFUNC(common,isEngineer))}) exitWit
if (GVAR(requireToolkit) && {!([_unit, "ToolKit"] call EFUNC(common,hasItem))}) exitWith {false};
(!isEngineOn _aircraft && {[_unit, _aircraft] call EFUNC(common,canInteractWith)})
if ((_unit distanceSqr _aircraft) > GVAR(searchDistanceSqr)) exitWith {false};
[_unit, _aircraft] call EFUNC(common,canInteractWith)

View File

@ -69,6 +69,6 @@ if (_currentPylon == count _pylonsToConfigure) exitWith {};
[format [localize LSTRING(Stopped), _currentPylon + 1], false, 5] call EFUNC(common,displayText);
},
format [localize LSTRING(ReplacingPylon), _currentPylon + 1, count _pylonsToConfigure],
{true},
{GVAR(isCurator) || {(ace_player distanceSqr GVAR(currentAircraft)) <= GVAR(searchDistanceSqr)}},
["isNotInZeus"]
] call EFUNC(common,progressBar);

View File

@ -20,7 +20,6 @@ params ["", "", "_uid"];
private _aircraft = GVAR(currentAircraftNamespace) getVariable ["_uid", objNull];
if (!isNull _aircraft) then {
_aircraft setVariable [QGVAR(currentUser), objNull, true];
[_aircraft, "blockEngine", QUOTE(ADDON), false] call EFUNC(common,statusEffect_set);
GVAR(currentAircraftNamespace) setVariable [_uid, nil, true]; // Remove var from namespace, no need to keep objNull
};

View File

@ -17,5 +17,4 @@
GVAR(currentAircraft) setVariable [QGVAR(currentUser), objNull, true];
GVAR(currentAircraftNamespace) setVariable [getPlayerUID ace_player, nil, true]; // Remove var from namespace, no need to keep objNull
[GVAR(currentAircraft), "blockEngine", QUOTE(ADDON), false] call EFUNC(common,statusEffect_set);
closeDialog 2;

View File

@ -26,7 +26,6 @@ if (!isNull _currentUser) exitWith {
};
_aircraft setVariable [QGVAR(currentUser), ace_player, true];
GVAR(currentAircraftNamespace) setVariable [getPlayerUID ace_player, _aircraft, true];
[_aircraft, "blockEngine", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set);
GVAR(isCurator) = _isCurator;
GVAR(currentAircraft) = _aircraft;
@ -138,3 +137,13 @@ _edit ctrlAddEventHandler ["KeyDown", LINKFUNC(onNameChange)];
private _checkbox = _display displayCtrl ID_CHECKBOX_MIRROR;
_checkbox ctrlAddEventHandler ["CheckedChanged", {[(_this select 1) == 1] call FUNC(onPylonMirror)}];
if (!GVAR(isCurator)) then {
[{
isNull (GVAR(currentAircraft) getVariable [QGVAR(currentUser), objNull]) ||
{(ace_player distanceSqr GVAR(currentAircraft)) > GVAR(searchDistanceSqr)}
}, {
[localize LSTRING(TooFar), false, 5] call EFUNC(common,displayText);
call FUNC(onButtonClose);
}] call CBA_fnc_waitUntilAndExecute;
};

View File

@ -64,6 +64,9 @@
<Chinese>已停止在%1號派龍架!</Chinese>
<Chinesesimp>已停止在%1号派龙架!</Chinesesimp>
</Key>
<Key ID="STR_ACE_Pylons_TooFar">
<English>Vehicle too far</English>
</Key>
<Key ID="STR_ACE_Pylons_Enabled">
<English>Enable Pylons Menu</English>
<Japanese>パイロン メニューを有効化</Japanese>

View File

@ -48,6 +48,9 @@ if (_magazineDisplayName == "") then {
{(_this select 0) call FUNC(rearmSuccess)},
"",
format [localize LSTRING(RearmAction), getText(configFile >> "CfgVehicles" >> (typeOf _target) >> "displayName"), _magazineDisplayName],
{true},
{
param [0] params ["_target", "_unit"];
(_unit distanceSqr _target) <= REARM_ACTION_DISTANCE_SQR
},
["isnotinside"]
] call EFUNC(common,progressBar);

View File

@ -17,14 +17,17 @@
*/
#include "script_component.hpp"
params ["_truck", "", "_vehicle"];
params ["_truck", "_player", "_vehicle"];
[
TIME_PROGRESSBAR(10),
[_truck, _vehicle],
[_truck, _player, _vehicle],
FUNC(rearmEntireVehicleSuccess),
"",
format [localize LSTRING(BasicRearmAction), getText(configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "displayName")],
{true},
{
param [0] params ["", "_player", "_vehicle"];
(_player distanceSqr _vehicle) <= REARM_ACTION_DISTANCE_SQR
},
["isnotinside"]
] call EFUNC(common,progressBar);

View File

@ -19,6 +19,7 @@
#define REARM_ACTION_DISTANCE 7
#define REARM_ACTION_DISTANCE_SQR 49
#define REARM_CALIBERS [ 6, 7, 8, 13, 19, 20, 25, 30, 35, 39, 40, 60, 70, 80, 82, 100, 105, 120, 122, 125, 155, 230, 250]
#define REARM_DURATION_TAKE [ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 3, 3, 3, 3, 3, 4, 5, 5, 5, 5, 13, 10]

View File

@ -27,5 +27,4 @@ if (isNull _unit ||
!(_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} &&
{!(isEngineOn (_nozzle getVariable QGVAR(sink)))}
{(fuel (_nozzle getVariable QGVAR(sink))) < 1}

View File

@ -64,10 +64,6 @@ if (_maxFuel == 0) then {
private _finished = false;
private _fueling = _nozzle getVariable [QGVAR(isRefueling), false];
if (_fueling) then {
if (isEngineOn _sink) exitWith {
_nozzle setVariable [QGVAR(lastTickMissionTime), nil];
_nozzle setVariable [QGVAR(isRefueling), false, true];
};
private _fuelInSource = [_source] call FUNC(getFuel);
if (_fuelInSource == 0) exitWith {
[LSTRING(Hint_SourceEmpty), 2, _unit] call EFUNC(common,displayTextStructured);