This repository has been archived by the owner on May 24, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9500715
commit 5c769a1
Showing
15 changed files
with
145 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,3 @@ | ||
#include "script_component.hpp" | ||
|
||
#include "XEH_PREP.hpp" | ||
|
||
// Compile list of water sources from config | ||
private _filter = QUOTE(getNumber (_x >> 'scope') == 2 && {getNumber (_x >> QQGVAR(waterSupply)) > 0 || {getNumber (_x >> QQGVAR(waterSupply)) == REFILL_WATER_INFINITE}}); | ||
private _waterSources = (_filter configClasses (configFile >> "CfgVehicles")) apply {configName _x}; | ||
SETUVAR(GVAR(waterSources),_waterSources); |
63 changes: 63 additions & 0 deletions
63
addons/field_rations/functions/fnc_addWaterSourceInteractions.sqf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* Author: PabstMirror, mharis001 | ||
* Dynamically adds water actions to nearby water objects 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 acex_field_rations_fnc_addWaterSourceInteractions | ||
* | ||
* Public: No | ||
*/ | ||
#include "script_component.hpp" | ||
|
||
params ["_interactionType"]; | ||
TRACE_1("addWaterSourceInteractions",_interactionType); | ||
|
||
// Ignore self-interaction menu or mounted vehicle interaction | ||
if (_interactionType != 0 || {vehicle ACE_player != ACE_player}) exitWith {}; | ||
TRACE_1("Starting interact PFH",_interactionType); | ||
|
||
[{ | ||
BEGIN_COUNTER(interactEH); | ||
params ["_args", "_pfhID"]; | ||
_args params ["_setPosition", "_addedHelpers", "_fencesHelped"]; | ||
|
||
if (!ACEGVAR(interact_menu,keyDown)) then { | ||
TRACE_1("Ending interact PFH",_pfhID); | ||
{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 _fencesHelped)) then { | ||
private _waterRemaining = [_x] call FUNC(getRemainingWater); | ||
if ((_waterRemaining == REFILL_WATER_INFINITE) || {_waterRemaining > 0}) then { | ||
_fencesHelped pushBack _x; | ||
private _helper = QGVAR(helper) createVehicleLocal [0, 0, 0]; | ||
_helper setVariable [QGVAR(waterSource), _x]; | ||
// private _offset = getArray (configFile >> "CfgVehicles" >> (typeOf _x) >> QGVAR(offset)); | ||
// if (_offset isEqualTo []) then {_offset = [0,0,0]}; | ||
_helper setPosASL AGLtoASL (_x modelToWorld [0,0,0]); | ||
_addedHelpers pushBack _helper; | ||
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters