mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Fix water actions on vehicles with no waterActionOffset
This commit is contained in:
parent
de9c29d869
commit
c452f94779
@ -17,7 +17,7 @@ if !(hasInterface) exitWith {};
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Compile water source actions
|
// Compile water source actions
|
||||||
private _mainAction = [
|
GVAR(mainAction) = [
|
||||||
QGVAR(waterSource),
|
QGVAR(waterSource),
|
||||||
LLSTRING(WaterSource),
|
LLSTRING(WaterSource),
|
||||||
QPATHTOF(ui\icon_water_tap.paa),
|
QPATHTOF(ui\icon_water_tap.paa),
|
||||||
@ -40,7 +40,7 @@ if !(hasInterface) exitWith {};
|
|||||||
[false, false, false, false, true]
|
[false, false, false, false, true]
|
||||||
] call EFUNC(interact_menu,createAction);
|
] call EFUNC(interact_menu,createAction);
|
||||||
|
|
||||||
private _subActions = [
|
GVAR(subActions) = [
|
||||||
[
|
[
|
||||||
QGVAR(checkWater),
|
QGVAR(checkWater),
|
||||||
LLSTRING(CheckWater),
|
LLSTRING(CheckWater),
|
||||||
@ -70,10 +70,10 @@ if !(hasInterface) exitWith {};
|
|||||||
];
|
];
|
||||||
|
|
||||||
// Add water source actions to helper
|
// Add water source actions to helper
|
||||||
[QGVAR(helper), 0, [], _mainAction] call EFUNC(interact_menu,addActionToClass);
|
[QGVAR(helper), 0, [], GVAR(mainAction)] call EFUNC(interact_menu,addActionToClass);
|
||||||
{
|
{
|
||||||
[QGVAR(helper), 0, [QGVAR(waterSource)], _x] call EFUNC(interact_menu,addActionToClass);
|
[QGVAR(helper), 0, [QGVAR(waterSource)], _x] call EFUNC(interact_menu,addActionToClass);
|
||||||
} forEach _subActions;
|
} forEach GVAR(subActions);
|
||||||
|
|
||||||
// Add inventory context menu option to consume items
|
// Add inventory context menu option to consume items
|
||||||
["ACE_ItemCore", ["CONTAINER"], LSTRING(EatDrink), [], QPATHTOF(ui\icon_survival.paa),
|
["ACE_ItemCore", ["CONTAINER"], LSTRING(EatDrink), [], QPATHTOF(ui\icon_survival.paa),
|
||||||
|
@ -49,13 +49,28 @@ TRACE_1("Starting interact PFH",_interactionType);
|
|||||||
|
|
||||||
if (_waterRemaining != REFILL_WATER_DISABLED) then {
|
if (_waterRemaining != REFILL_WATER_DISABLED) then {
|
||||||
private _offset = [_x] call FUNC(getActionOffset);
|
private _offset = [_x] call FUNC(getActionOffset);
|
||||||
private _helper = QGVAR(helper) createVehicleLocal [0, 0, 0];
|
if (_offset isEqualTo [0,0,0]) then {
|
||||||
_helper setVariable [QGVAR(waterSource), _x];
|
if !(_x getVariable [QGVAR(waterSourceActionsAdded), false]) then {
|
||||||
_helper attachTo [_x, _offset];
|
private _vehicle = _x;
|
||||||
|
_vehicle setVariable [QGVAR(waterSource), _vehicle];
|
||||||
|
_sourcesHelped pushBack _vehicle;
|
||||||
|
// Add water source actions to the vehicle itself
|
||||||
|
private _mainAction = [_vehicle, 0, ["ACE_MainActions"], GVAR(mainAction)] call EFUNC(interact_menu,addActionToObject);
|
||||||
|
{
|
||||||
|
[_vehicle, 0, _mainAction, _x] call EFUNC(interact_menu,addActionToObject);
|
||||||
|
} forEach GVAR(subActions);
|
||||||
|
_vehicle setVariable [QGVAR(waterSourceActionsAdded), true];
|
||||||
|
TRACE_3("Added interaction to vehicle",_x,typeOf _x,_waterRemaining);
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
private _helper = QGVAR(helper) createVehicleLocal [0, 0, 0];
|
||||||
|
_helper setVariable [QGVAR(waterSource), _x];
|
||||||
|
_helper attachTo [_x, _offset];
|
||||||
|
|
||||||
_addedHelpers pushBack _helper;
|
_addedHelpers pushBack _helper;
|
||||||
_sourcesHelped pushBack _x;
|
_sourcesHelped pushBack _x;
|
||||||
TRACE_3("Added interaction helper",_x,typeOf _x,_waterRemaining);
|
TRACE_3("Added interaction helper",_x,typeOf _x,_waterRemaining);
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
} forEach nearestObjects [ACE_player, [], 15];
|
} forEach nearestObjects [ACE_player, [], 15];
|
||||||
|
Loading…
Reference in New Issue
Block a user