|
18 | 18 |
|
19 | 19 | params ["_interactionType"];
|
20 | 20 |
|
21 |
| -// Ignore when self-interaction, mounted vehicle interaction, or water source actions are disabled |
| 21 | +// Ignore during self-interaction or when water source actions are disabled |
22 | 22 | if (
|
23 | 23 | _interactionType != 0
|
24 |
| - || {!isNull objectParent ACE_player} |
25 | 24 | || {XGVAR(waterSourceActions) == 0}
|
26 | 25 | ) exitWith {};
|
27 | 26 |
|
@@ -49,13 +48,30 @@ TRACE_1("Starting interact PFH",_interactionType);
|
49 | 48 |
|
50 | 49 | if (_waterRemaining != REFILL_WATER_DISABLED) then {
|
51 | 50 | private _offset = [_x] call FUNC(getActionOffset);
|
52 |
| - private _helper = QGVAR(helper) createVehicleLocal [0, 0, 0]; |
53 |
| - _helper setVariable [QGVAR(waterSource), _x]; |
54 |
| - _helper attachTo [_x, _offset]; |
| 51 | + if (_offset isEqualTo [0,0,0]) then { |
| 52 | + if !(_x getVariable [QGVAR(waterSourceActionsAdded), false]) then { |
| 53 | + private _vehicle = _x; |
| 54 | + _vehicle setVariable [QGVAR(waterSource), _vehicle]; |
| 55 | + _sourcesHelped pushBack _vehicle; |
| 56 | + // Add water source actions to the vehicle itself |
| 57 | + private _mainAction = [_vehicle, 0, ["ACE_MainActions"], GVAR(mainAction)] call EFUNC(interact_menu,addActionToObject); |
| 58 | + private _selfAction = [_vehicle, 1, ["ACE_SelfActions"], GVAR(mainAction)] call EFUNC(interact_menu,addActionToObject); |
| 59 | + { |
| 60 | + [_vehicle, 0, _mainAction, _x] call EFUNC(interact_menu,addActionToObject); |
| 61 | + [_vehicle, 1, _selfAction, _x] call EFUNC(interact_menu,addActionToObject); |
| 62 | + } forEach GVAR(subActions); |
| 63 | + _vehicle setVariable [QGVAR(waterSourceActionsAdded), true]; |
| 64 | + TRACE_3("Added interaction to vehicle",_x,typeOf _x,_waterRemaining); |
| 65 | + }; |
| 66 | + } else { |
| 67 | + private _helper = QGVAR(helper) createVehicleLocal [0, 0, 0]; |
| 68 | + _helper setVariable [QGVAR(waterSource), _x]; |
| 69 | + _helper attachTo [_x, _offset]; |
55 | 70 |
|
56 |
| - _addedHelpers pushBack _helper; |
57 |
| - _sourcesHelped pushBack _x; |
58 |
| - TRACE_3("Added interaction helper",_x,typeOf _x,_waterRemaining); |
| 71 | + _addedHelpers pushBack _helper; |
| 72 | + _sourcesHelped pushBack _x; |
| 73 | + TRACE_3("Added interaction helper",_x,typeOf _x,_waterRemaining); |
| 74 | + }; |
59 | 75 | };
|
60 | 76 | };
|
61 | 77 | } forEach nearestObjects [ACE_player, [], 15];
|
|
0 commit comments