diff --git a/addons/pylons/XEH_postInit.sqf b/addons/pylons/XEH_postInit.sqf
index ff3d4f83d6..cee9eda0fd 100644
--- a/addons/pylons/XEH_postInit.sqf
+++ b/addons/pylons/XEH_postInit.sqf
@@ -43,4 +43,6 @@
addMissionEventHandler ["HandleDisconnect", LINKFUNC(handleDisconnect)];
};
+
+ GVAR(searchDistanceSqr) = GVAR(searchDistance) ^ 2;
}] call CBA_fnc_addEventHandler;
diff --git a/addons/pylons/functions/fnc_canConfigurePylons.sqf b/addons/pylons/functions/fnc_canConfigurePylons.sqf
index d4ee2d9684..c679b9592d 100644
--- a/addons/pylons/functions/fnc_canConfigurePylons.sqf
+++ b/addons/pylons/functions/fnc_canConfigurePylons.sqf
@@ -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)
diff --git a/addons/pylons/functions/fnc_configurePylons.sqf b/addons/pylons/functions/fnc_configurePylons.sqf
index 665f7ccdbc..2fbc91e949 100644
--- a/addons/pylons/functions/fnc_configurePylons.sqf
+++ b/addons/pylons/functions/fnc_configurePylons.sqf
@@ -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);
diff --git a/addons/pylons/functions/fnc_handleDisconnect.sqf b/addons/pylons/functions/fnc_handleDisconnect.sqf
index c53d0ada17..f255b36535 100644
--- a/addons/pylons/functions/fnc_handleDisconnect.sqf
+++ b/addons/pylons/functions/fnc_handleDisconnect.sqf
@@ -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
};
diff --git a/addons/pylons/functions/fnc_onButtonClose.sqf b/addons/pylons/functions/fnc_onButtonClose.sqf
index ef93f3f1bf..fa06f3d506 100644
--- a/addons/pylons/functions/fnc_onButtonClose.sqf
+++ b/addons/pylons/functions/fnc_onButtonClose.sqf
@@ -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;
diff --git a/addons/pylons/functions/fnc_showDialog.sqf b/addons/pylons/functions/fnc_showDialog.sqf
index 3e2cf8a4a8..b0f9b6c271 100644
--- a/addons/pylons/functions/fnc_showDialog.sqf
+++ b/addons/pylons/functions/fnc_showDialog.sqf
@@ -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;
+};
diff --git a/addons/pylons/stringtable.xml b/addons/pylons/stringtable.xml
index dbb42f3734..241b358b04 100644
--- a/addons/pylons/stringtable.xml
+++ b/addons/pylons/stringtable.xml
@@ -64,6 +64,9 @@
已停止在%1號派龍架!
已停止在%1号派龙架!
+
+ Vehicle too far
+
Enable Pylons Menu
パイロン メニューを有効化
diff --git a/addons/rearm/functions/fnc_rearm.sqf b/addons/rearm/functions/fnc_rearm.sqf
index bca193f621..e9d65c43b4 100644
--- a/addons/rearm/functions/fnc_rearm.sqf
+++ b/addons/rearm/functions/fnc_rearm.sqf
@@ -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);
diff --git a/addons/rearm/functions/fnc_rearmEntireVehicle.sqf b/addons/rearm/functions/fnc_rearmEntireVehicle.sqf
index b0fe9f7ccf..47dde150e6 100644
--- a/addons/rearm/functions/fnc_rearmEntireVehicle.sqf
+++ b/addons/rearm/functions/fnc_rearmEntireVehicle.sqf
@@ -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);
diff --git a/addons/rearm/script_component.hpp b/addons/rearm/script_component.hpp
index 92e279950c..a80dab55b2 100644
--- a/addons/rearm/script_component.hpp
+++ b/addons/rearm/script_component.hpp
@@ -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]
diff --git a/addons/refuel/functions/fnc_canTurnOn.sqf b/addons/refuel/functions/fnc_canTurnOn.sqf
index e9de5c205c..98173e0fa4 100644
--- a/addons/refuel/functions/fnc_canTurnOn.sqf
+++ b/addons/refuel/functions/fnc_canTurnOn.sqf
@@ -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}
diff --git a/addons/refuel/functions/fnc_refuel.sqf b/addons/refuel/functions/fnc_refuel.sqf
index e294a43497..f23e0aae5b 100644
--- a/addons/refuel/functions/fnc_refuel.sqf
+++ b/addons/refuel/functions/fnc_refuel.sqf
@@ -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);