mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
6ca9d59443
* Merge ACEX - first attempt Backwards compatibility with XGVAR set of macros used on all settings and config entries Public API functions not taken into account yet, many other things probably still missed * Resolve issues * Switch to addSetting, backward compatible CfgPatches, missed XGVAR. * Remove unnecessary backwards compat * Convert ACEX Categorised settings to initSettings / Fix Intel items magazine * Apply suggestions from code review Co-authored-by: PabstMirror <pabstmirror@gmail.com> * Remove maintainers from merged ACEX components * Cleanup unused module and faction classes * Sitting - Add more object configs by @Dystopian https://github.com/acemod/ACEX/pull/255 * Translations - Add Japanese by @classicarma https://github.com/acemod/ACEX/pull/259 * Kill Tracker - Add killtracker.inc public include file by @Freddo3000" https://github.com/acemod/ACEX/pull/251 * Add ACEX authors and sort authors file * acex - final tweaks (#8513) * acex - handle old funcs * replace thirst/hunger setvars to acex naming fix macro Revert "fix macro" This reverts commit d807e5e804c43916eaa42d34a89af94c6d9a48ad. Revert "replace thirst/hunger setvars to acex naming" This reverts commit bafc607884932d6e339daedc7c22e25dddbdd868. x Co-authored-by: TyroneMF <TyroneMF@hotmail.com> Co-authored-by: PabstMirror <pabstmirror@gmail.com>
69 lines
2.4 KiB
Plaintext
69 lines
2.4 KiB
Plaintext
#include "script_component.hpp"
|
|
/*
|
|
* Author: PabstMirror, mharis001
|
|
* Dynamically adds actions to nearby water sources when interact_menu is opened.
|
|
* Called by the "ace_interactMenuOpened" event.
|
|
*
|
|
* Arguments:
|
|
* Interact Menu Type (0 - World, 1 - Self) <NUMBER>
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Example:
|
|
* [0] call ace_field_rations_fnc_addWaterSourceInteractions
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
params ["_interactionType"];
|
|
|
|
// Ignore when self-interaction, mounted vehicle interaction, or water source actions are disabled
|
|
if (
|
|
_interactionType != 0
|
|
|| {vehicle ACE_player != ACE_player}
|
|
|| {XGVAR(waterSourceActions) == 0}
|
|
) exitWith {};
|
|
|
|
TRACE_1("Starting interact PFH",_interactionType);
|
|
|
|
[{
|
|
BEGIN_COUNTER(interactEH);
|
|
params ["_args", "_pfhID"];
|
|
_args params ["_setPosition", "_addedHelpers", "_sourcesHelped"];
|
|
|
|
if (!EGVAR(interact_menu,keyDown)) then {
|
|
TRACE_1("Ending interact PFH",_pfhID);
|
|
{detach _x; deleteVehicle _x} forEach _addedHelpers;
|
|
[_pfhID] call CBA_fnc_removePerFrameHandler;
|
|
} else {
|
|
// Prevent rare error when ending mission with interact key down
|
|
if (isNull ACE_player) exitWith {};
|
|
|
|
// Rescan if player has moved more than 5 meters from last position
|
|
if (getPosASL ACE_player distanceSqr _setPosition > 25) then {
|
|
BEGIN_COUNTER(updatePosition);
|
|
{
|
|
if (!(_x in _sourcesHelped) && {XGVAR(terrainObjectActions) || {!(_x call CBA_fnc_isTerrainObject)}}) then {
|
|
private _waterRemaining = [_x] call FUNC(getRemainingWater);
|
|
|
|
if (_waterRemaining != REFILL_WATER_DISABLED) then {
|
|
private _offset = [_x] call FUNC(getActionOffset);
|
|
private _helper = QGVAR(helper) createVehicleLocal [0, 0, 0];
|
|
_helper setVariable [QXGVAR(waterSource), _x];
|
|
_helper attachTo [_x, _offset];
|
|
|
|
_addedHelpers pushBack _helper;
|
|
_sourcesHelped pushBack _x;
|
|
TRACE_3("Added interaction helper",_x,typeOf _x,_waterRemaining);
|
|
};
|
|
};
|
|
} forEach nearestObjects [ACE_player, [], 15];
|
|
|
|
_args set [0, getPosASL ACE_player];
|
|
END_COUNTER(updatePosition);
|
|
};
|
|
};
|
|
END_COUNTER(interactEH);
|
|
}, 0.5, [getPosASL ACE_player vectorAdd [-100, 0, 0], [], []]] call CBA_fnc_addPerFrameHandler;
|