mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #1117 from acemod/waveHeightAtFunc
Added: waveHeightAt Function
This commit is contained in:
commit
ed2f73d4d9
@ -183,6 +183,7 @@ PREP(unmuteUnit);
|
||||
PREP(useItem);
|
||||
PREP(useMagazine);
|
||||
PREP(waitAndExecute);
|
||||
PREP(waveHeightAt);
|
||||
|
||||
PREP(translateToWeaponSpace);
|
||||
PREP(translateToModelSpace);
|
||||
|
20
addons/common/functions/fnc_waveHeightAt.sqf
Normal file
20
addons/common/functions/fnc_waveHeightAt.sqf
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Author: jaynus
|
||||
*
|
||||
* Gets the wave height at a specific location. Uses a logic, so may be performance iffy
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Position ASL to get height at
|
||||
*
|
||||
* Return Value:
|
||||
* Wave height in meters
|
||||
*
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
if(isNil QGVAR(waveHeightLogic)) then {
|
||||
GVAR(waveHeightLogic) = "Logic" createVehicleLocal [0,0,0];
|
||||
};
|
||||
GVAR(waveHeightLogic) setPosASL (_this select 0);
|
||||
|
||||
(((getPosASLW GVAR(waveHeightLogic)) select 2) - ((getPosASL GVAR(waveHeightLogic)) select 2))
|
@ -64,6 +64,13 @@ if (GVAR(useCursorMenu)) then {
|
||||
GVAR(selfMenuOffset) = ((positionCameraToWorld [0, 0, 2]) call EFUNC(common,positionToASL)) vectorDiff
|
||||
((positionCameraToWorld [0, 0, 0]) call EFUNC(common,positionToASL));
|
||||
|
||||
private ["_wavesAtOrigin", "_wavesAtVirtualPoint"];
|
||||
|
||||
_wavesAtOrigin = [(positionCameraToWorld [0, 0, 0])] call EFUNC(common,waveHeightAt);
|
||||
_wavesAtVirtualPoint = [(positionCameraToWorld [0, 0, 2])] call EFUNC(common,waveHeightAt);
|
||||
GVAR(selfMenuOffset) set [2, ((GVAR(selfMenuOffset) select 2) + _wavesAtOrigin - _wavesAtVirtualPoint)];
|
||||
|
||||
|
||||
["interactMenuOpened", [_menuType]] call EFUNC(common,localEvent);
|
||||
|
||||
true
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
GVAR(currentOptions) = [];
|
||||
|
||||
private ["_player","_numInteractObjects","_numInteractions","_actionsVarName","_classActions","_target","_player","_action","_cameraPos","_cameraDir", "_lambda", "_nearestObjects", "_pos"];
|
||||
private ["_player","_numInteractObjects","_numInteractions","_actionsVarName","_classActions","_target","_player","_action","_cameraPos","_cameraDir", "_lambda", "_nearestObjects", "_pos", "_virtualPoint", "_wavesAtOrigin", "_wavesAtVirtualPoint"];
|
||||
_player = ACE_player;
|
||||
|
||||
_fnc_renderNearbyActions = {
|
||||
@ -101,14 +101,19 @@ _fnc_renderSelfActions = {
|
||||
// Iterate through base level class actions and render them if appropiate
|
||||
_actionsVarName = format [QGVAR(SelfAct_%1), typeOf _target];
|
||||
_classActions = missionNamespace getVariable [_actionsVarName, []];
|
||||
{
|
||||
_action = _x;
|
||||
|
||||
_pos = if !(GVAR(useCursorMenu)) then {
|
||||
(((positionCameraToWorld [0, 0, 0]) call EFUNC(common,positionToASL)) vectorAdd GVAR(selfMenuOffset)) call EFUNC(common,ASLToPosition)
|
||||
_virtualPoint = (((positionCameraToWorld [0, 0, 0]) call EFUNC(common,positionToASL)) vectorAdd GVAR(selfMenuOffset)) call EFUNC(common,ASLToPosition);
|
||||
_wavesAtOrigin = [(positionCameraToWorld [0, 0, 0])] call EFUNC(common,waveHeightAt);
|
||||
_wavesAtVirtualPoint = [_virtualPoint] call EFUNC(common,waveHeightAt);
|
||||
_virtualPoint set [2, ((_virtualPoint select 2) - _wavesAtOrigin + _wavesAtVirtualPoint)];
|
||||
_virtualPoint
|
||||
} else {
|
||||
[0.5, 0.5]
|
||||
};
|
||||
|
||||
{
|
||||
_action = _x;
|
||||
[_target, _action, _pos] call FUNC(renderBaseMenu);
|
||||
} forEach _classActions;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user