From e8ebe874508672a855dcdcb84dd4e3d55df6ad31 Mon Sep 17 00:00:00 2001 From: commy2 Date: Sun, 20 Sep 2015 15:52:40 +0200 Subject: [PATCH] more common code cleanup --- addons/common/XEH_preInit.sqf | 1 + .../functions/fnc_setHearingCapability.sqf | 2 + addons/common/functions/fnc_setName.sqf | 1 - addons/common/functions/fnc_setParameter.sqf | 3 +- .../common/functions/fnc_setVariableJIP.sqf | 1 - .../functions/fnc_setVariablePublic.sqf | 1 - .../functions/fnc_sortAlphabeticallyBy.sqf | 2 +- addons/common/functions/fnc_stringCompare.sqf | 38 +++++++----- .../functions/fnc_stringRemoveWhiteSpace.sqf | 12 +--- .../functions/fnc_stringToColoredText.sqf | 1 - addons/common/functions/fnc_syncedEvent.sqf | 32 ++++------ .../common/functions/fnc_syncedEventPFH.sqf | 62 ++++++++++++------- .../functions/fnc_throttledPublicVariable.sqf | 17 +++-- addons/common/functions/fnc_timePFH.sqf | 1 + addons/common/functions/fnc_toBitmask.sqf | 7 +-- addons/common/functions/fnc_toNumber.sqf | 1 - .../functions/fnc_translateToModelSpace.sqf | 1 - .../functions/fnc_translateToWeaponSpace.sqf | 1 - addons/common/functions/fnc_unhideUnit.sqf | 1 - .../common/functions/fnc_uniqueElements.sqf | 27 ++++++++ .../functions/fnc_uniqueElementsOnly.sqf | 33 ++++------ addons/common/functions/fnc_unmuteUnit.sqf | 1 - addons/common/functions/fnc_useItem.sqf | 41 ++++++------ addons/common/functions/fnc_useMagazine.sqf | 40 ++++++------ .../common/functions/fnc_waitAndExecute.sqf | 3 +- addons/common/functions/fnc_waveHeightAt.sqf | 1 + 26 files changed, 176 insertions(+), 155 deletions(-) create mode 100644 addons/common/functions/fnc_uniqueElements.sqf diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf index 9604941ab7..ee10806f39 100644 --- a/addons/common/XEH_preInit.sqf +++ b/addons/common/XEH_preInit.sqf @@ -179,6 +179,7 @@ PREP(toBitmask); PREP(toHex); PREP(toNumber); PREP(unhideUnit); +PREP(uniqueElements); PREP(uniqueElementsOnly); PREP(unloadPerson); PREP(unloadPersonLocal); diff --git a/addons/common/functions/fnc_setHearingCapability.sqf b/addons/common/functions/fnc_setHearingCapability.sqf index 9dea992e3e..d24f8d0d9d 100644 --- a/addons/common/functions/fnc_setHearingCapability.sqf +++ b/addons/common/functions/fnc_setHearingCapability.sqf @@ -11,6 +11,8 @@ * None * * Public: Yes + * + * Note: uses player */ #include "script_component.hpp" diff --git a/addons/common/functions/fnc_setName.sqf b/addons/common/functions/fnc_setName.sqf index 8a32dd669d..117445b561 100644 --- a/addons/common/functions/fnc_setName.sqf +++ b/addons/common/functions/fnc_setName.sqf @@ -1,6 +1,5 @@ /* * Author: commy2 - * * Sets the name variable of the object. Used to prevent issues with the name command. * * Arguments: diff --git a/addons/common/functions/fnc_setParameter.sqf b/addons/common/functions/fnc_setParameter.sqf index 6a1345479b..dd946f7bc5 100644 --- a/addons/common/functions/fnc_setParameter.sqf +++ b/addons/common/functions/fnc_setParameter.sqf @@ -1,6 +1,5 @@ /* * Author: esteldunedain - * * Sets the value of an ACE_Parameter and makes it public. * * Arguments: @@ -12,7 +11,7 @@ * * Public: Yes * - * Deprecated *@todo commy + * Deprecated */ #include "script_component.hpp" diff --git a/addons/common/functions/fnc_setVariableJIP.sqf b/addons/common/functions/fnc_setVariableJIP.sqf index 766a4d9f5b..d1bd27ea4e 100644 --- a/addons/common/functions/fnc_setVariableJIP.sqf +++ b/addons/common/functions/fnc_setVariableJIP.sqf @@ -1,6 +1,5 @@ /* * Author: commy2 - * * Sets a public object namespace variable that gets reset with the same value after respawn, so JIP clients keep the value. * * Arguments: diff --git a/addons/common/functions/fnc_setVariablePublic.sqf b/addons/common/functions/fnc_setVariablePublic.sqf index 2f6cd70f65..b6fb58b0f4 100644 --- a/addons/common/functions/fnc_setVariablePublic.sqf +++ b/addons/common/functions/fnc_setVariablePublic.sqf @@ -1,6 +1,5 @@ /* * Author: commy2 and joko // Jonas - * * Sets a public variable, but wait a certain amount of ACE_time to transfer the value over the network. Changing the value by calling this function again resets the windup timer. * * Arguments: diff --git a/addons/common/functions/fnc_sortAlphabeticallyBy.sqf b/addons/common/functions/fnc_sortAlphabeticallyBy.sqf index 3380b181c8..76082013ef 100644 --- a/addons/common/functions/fnc_sortAlphabeticallyBy.sqf +++ b/addons/common/functions/fnc_sortAlphabeticallyBy.sqf @@ -1,6 +1,6 @@ /* * Author: Glowbal - * ? deprecated + * ? * * Arguments: * ? diff --git a/addons/common/functions/fnc_stringCompare.sqf b/addons/common/functions/fnc_stringCompare.sqf index 2162f71fd0..da65c676f8 100644 --- a/addons/common/functions/fnc_stringCompare.sqf +++ b/addons/common/functions/fnc_stringCompare.sqf @@ -1,35 +1,41 @@ -/** - * fn_stringCompare.sqf - * @Descr: Determines whether one string matches another and how many characters match. Case insensitive. - * @Author: bovine3dom +/* + * Author: bovine3dom + * Determines whether one string matches another and how many characters match. Case insensitive. * - * @Arguments: [stringA STRING, stringB STRING] - * @Return: NUMBER Number of matching characters - * @PublicAPI: true + * Arguments: + * 0: stringA + * 1: stringB + * + * Return Value: + * Number of matching characters >NUMBER> + * + * Public: Yes */ - #include "script_component.hpp" -private ["_searchTerm", "_string", "_arraySearchTerm", "_arrayString", "_sizeSearchTerm", "_sizeString", "_matchingCharacters", "_searchIterator", "_targetIterator"]; -_string = toLower (_this select 0); // removes case sensitivity -_searchTerm = toLower (_this select 1); +params ["_string", "_searchTerm"]; +_string = toLower _string; // removes case sensitivity +_searchTerm = toLower _searchTerm; + +private ["_arraySearchTerm", "_arrayString", "_sizeSearchTerm", "_sizeString", "_matchingCharacters", "_searchIterator", "_targetIterator"]; _arraySearchTerm = toArray _searchTerm; // splits string into array of unicode decimals _arrayString = toArray _string; _sizeSearchTerm = count _arraySearchTerm; // We only measure the array once _sizeString = count _arrayString; - _matchingCharacters = 0; -_targetIterator = 0; _searchIterator = 0; -while {(_searchIterator < _sizeSearchTerm) && (_targetIterator < _sizeString)} do { // Prevents us from going out of bounds - if ((_arraySearchTerm select _searchIterator) == (_arrayString select _targetIterator)) then { // If we have a match, start looking for the next character in the search term +_targetIterator = 0; + +while {_searchIterator < _sizeSearchTerm && _targetIterator < _sizeString} do { // Prevents us from going out of bounds + if (_arraySearchTerm select _searchIterator == _arrayString select _targetIterator) then { // If we have a match, start looking for the next character in the search term _matchingCharacters = _matchingCharacters + 1; _searchIterator = _searchIterator + 1 }; + _targetIterator = _targetIterator + 1; // Look at the next character in the string }; -_matchingCharacters \ No newline at end of file +_matchingCharacters diff --git a/addons/common/functions/fnc_stringRemoveWhiteSpace.sqf b/addons/common/functions/fnc_stringRemoveWhiteSpace.sqf index 7caf8cdf9f..2121f69ef4 100644 --- a/addons/common/functions/fnc_stringRemoveWhiteSpace.sqf +++ b/addons/common/functions/fnc_stringRemoveWhiteSpace.sqf @@ -10,17 +10,9 @@ * copy of string * * Public: Yes - * - * Deprecated */ #include "script_component.hpp" -params ["_string", ""]; +params ["_string"]; -private ["_charArray", "_returnString"]; - -_charArray = toArray _string; -_charArray = _charArray - [((toArray " ") select 0)]; -_returnString = toString _charArray; - -_returnString +(_string splitString " ") joinString "" diff --git a/addons/common/functions/fnc_stringToColoredText.sqf b/addons/common/functions/fnc_stringToColoredText.sqf index 5cbf280320..e6e19e4869 100644 --- a/addons/common/functions/fnc_stringToColoredText.sqf +++ b/addons/common/functions/fnc_stringToColoredText.sqf @@ -1,6 +1,5 @@ /* * Author: commy2 - * * Create a centered, colored text. * * Arguments: diff --git a/addons/common/functions/fnc_syncedEvent.sqf b/addons/common/functions/fnc_syncedEvent.sqf index 42b2147f10..34043fa8ae 100644 --- a/addons/common/functions/fnc_syncedEvent.sqf +++ b/addons/common/functions/fnc_syncedEvent.sqf @@ -1,33 +1,27 @@ /* * Author: jaynus - * * Call and propegate a synced event * - * Argument: - * 0: Name (String) - * 1: Arguments (Array) - * 2: TTL (Number or Code) [Optional] for this specific event call + * Arguments: + * 0: Name + * 1: Arguments + * 2: TTL [Optional] for this specific event call * - * Return value: - * Boolean of success + * Return Value: + * Boolean of success + * + * Public: No */ -//#define DEBUG_MODE_FULL #include "script_component.hpp" -PARAMS_2(_name,_args); +params ["_name", "_args", ["_ttl", 0]]; -private["_ttl", "_eventData"]; - -if( (count _this) > 2) then { - _ttl = _this select 2; -} else { - _ttl = 0; -}; - -if(!HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith { +if (!HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith { ACE_LOGERROR("Synced event key not found."); false }; -_eventData = [_name, _args,_ttl]; +private "_eventData"; +_eventData = [_name, _args, _ttl]; + ["SEH", _eventData] call FUNC(globalEvent); diff --git a/addons/common/functions/fnc_syncedEventPFH.sqf b/addons/common/functions/fnc_syncedEventPFH.sqf index a5ec809706..923e445839 100644 --- a/addons/common/functions/fnc_syncedEventPFH.sqf +++ b/addons/common/functions/fnc_syncedEventPFH.sqf @@ -1,52 +1,66 @@ -//#define DEBUG_MODE_FULL +/* + * Author: ? + * + * ? + * + * Arguments: + * ? + * + * Return Value: + * ? + * + * Public: ? + */ #include "script_component.hpp" -if(!isServer) exitWith { false }; +if (!isServer) exitWith {false}; // Walk through the local synced events and clean up anything thats already EOL // @TODO: This should be iteration limited to prevent FPS lag -private["_data"]; + { - private["_data", "_eventLog", "_newEventLog", "_name", "_globalEventTTL"]; + private ["_name", "_data", "_newEventLog"]; + _name = _x; _data = HASH_GET(GVAR(syncedEvents),_name); - _eventLog = _data select 1; - _globalEventTTL = _data select 2; + _data params ["_eventTime", "_eventLog", "_globalEventTTL"]; + _newEventLog = []; - + // @TODO: This should be iteration limited to prevent FPS lag { - private["_eventEntry", "_ttlReturn"]; + private ["_eventEntry", "_ttlReturn"]; + _eventEntry = _x; - _ttlReturn = true; - if(typeName _globalEventTTL == "CODE") then { - _ttlReturn = [(_data select 0),_eventEntry] call _globalEventTTL; + + if (typeName _globalEventTTL == "CODE") then { + _ttlReturn = [_eventTime, _eventEntry] call _globalEventTTL; } else { - _ttlReturn = call { _globalEventTTL < 1 || {ACE_diagTime < (_eventEntry select 0) + _globalEventTTL} }; + _ttlReturn = call {_globalEventTTL < 1 || {ACE_diagTime < (_eventEntry select 0) + _globalEventTTL}}; }; - if(_ttlReturn) then { + if (_ttlReturn) then { // Do event based TTL check - private["_eventTTL"]; - _eventTTL = _eventEntry select 2; - - if(typeName _eventTTL == "CODE") then { - _ttlReturn = [(_data select 0),_eventEntry] call _eventTTL; + _eventEntry params ["_time", "", "_eventTTL"]; + + if (typeName _eventTTL == "CODE") then { + _ttlReturn = [_eventTime, _eventEntry] call _eventTTL; } else { - _ttlReturn = call { _eventTTL < 1 || {ACE_diagTime < (_eventEntry select 0) + _eventTTL} }; + _ttlReturn = call {_eventTTL < 1 || {ACE_diagTime < _time + _eventTTL}}; }; }; // Finally drop it if the TTL check fails - if(_ttlReturn) then { + if (_ttlReturn) then { _newEventLog pushBack _x; }; - } forEach _eventLog; - - _data set[1, _newEventLog]; -} forEach (GVAR(syncedEvents) select 0); + false + } count _eventLog; + _data set [1, _newEventLog]; + false +} count (GVAR(syncedEvents) select 0); // @TODO: Next, detect if we had a new request from a JIP player, and we need to continue syncing events diff --git a/addons/common/functions/fnc_throttledPublicVariable.sqf b/addons/common/functions/fnc_throttledPublicVariable.sqf index d43841146a..cdc72f4450 100644 --- a/addons/common/functions/fnc_throttledPublicVariable.sqf +++ b/addons/common/functions/fnc_throttledPublicVariable.sqf @@ -17,21 +17,20 @@ */ #include "script_component.hpp" -PARAMS_3(_unit,_varName,_maxDelay); +params ["_unit", "_varName", "_maxDelay"]; // Create the publish scheduler PFH the first ACE_time if (isNil QGVAR(publishSchedId)) then { - GVAR(publishVarNames) = []; GVAR(publishNextTime) = 1e7; GVAR(publishSchedId) = [{ - if (ACE_diagTime > GVAR(publishNextTime)) then { { - EXPLODE_2_PVT(_x,_unit,_varName); - _unit setVariable [_varName, (_unit getVariable _varName), true]; - } forEach GVAR(publishVarNames); + _x params [_unit, _varName]; + _unit setVariable [_varName, _unit getVariable _varName, true]; + false + } count GVAR(publishVarNames); GVAR(publishVarNames) = []; GVAR(publishNextTime) = 1e7; @@ -40,10 +39,10 @@ if (isNil QGVAR(publishSchedId)) then { }; // If the variable is not on the list -if (GVAR(publishVarNames) find [_unit,_varName] == -1) exitWith { - GVAR(publishVarNames) pushBack [_unit,_varName]; +if (GVAR(publishVarNames) find [_unit, _varName] == -1) exitWith { + GVAR(publishVarNames) pushBack [_unit, _varName]; GVAR(publishNextTime) = GVAR(publishNextTime) min (ACE_diagTime + _maxDelay); }; // If the variable is on the list -GVAR(publishNextTime) = GVAR(publishNextTime) min (ACE_diagTime + _maxDelay); \ No newline at end of file +GVAR(publishNextTime) = GVAR(publishNextTime) min (ACE_diagTime + _maxDelay); diff --git a/addons/common/functions/fnc_timePFH.sqf b/addons/common/functions/fnc_timePFH.sqf index 1c66974c0d..4f099ea68c 100644 --- a/addons/common/functions/fnc_timePFH.sqf +++ b/addons/common/functions/fnc_timePFH.sqf @@ -21,6 +21,7 @@ ACE_gameTime = time; ACE_diagTime = diag_tickTime; _delta = ACE_diagTime - _lastTickTime; + if (ACE_gameTime <= _lastGameTime) then { TRACE_1("paused",_delta); ACE_paused = true; diff --git a/addons/common/functions/fnc_toBitmask.sqf b/addons/common/functions/fnc_toBitmask.sqf index 7c6beba733..35b1e06f9f 100644 --- a/addons/common/functions/fnc_toBitmask.sqf +++ b/addons/common/functions/fnc_toBitmask.sqf @@ -12,14 +12,11 @@ */ #include "script_component.hpp" -private ["_array", "_result"]; - -_array = _this; - +private "_result"; _result = 0; { if (_x) then {_result = _result + 2 ^ _forEachIndex}; -} forEach _array; +} forEach _this; _result diff --git a/addons/common/functions/fnc_toNumber.sqf b/addons/common/functions/fnc_toNumber.sqf index 56d14f6d18..6b1aacde1e 100644 --- a/addons/common/functions/fnc_toNumber.sqf +++ b/addons/common/functions/fnc_toNumber.sqf @@ -1,6 +1,5 @@ /* * Author: Garth de Wet (LH) - * * Takes a string/number and returns the number. * * Arguments: diff --git a/addons/common/functions/fnc_translateToModelSpace.sqf b/addons/common/functions/fnc_translateToModelSpace.sqf index 578feb8d5b..b05a19bed6 100644 --- a/addons/common/functions/fnc_translateToModelSpace.sqf +++ b/addons/common/functions/fnc_translateToModelSpace.sqf @@ -1,6 +1,5 @@ /* * Author: ? - * * ? * * Arguments: diff --git a/addons/common/functions/fnc_translateToWeaponSpace.sqf b/addons/common/functions/fnc_translateToWeaponSpace.sqf index a226265987..db3a5eaf37 100644 --- a/addons/common/functions/fnc_translateToWeaponSpace.sqf +++ b/addons/common/functions/fnc_translateToWeaponSpace.sqf @@ -1,6 +1,5 @@ /* * Author: ? - * * ? * * Arguments: diff --git a/addons/common/functions/fnc_unhideUnit.sqf b/addons/common/functions/fnc_unhideUnit.sqf index 488c4475fd..5bcafc3509 100644 --- a/addons/common/functions/fnc_unhideUnit.sqf +++ b/addons/common/functions/fnc_unhideUnit.sqf @@ -1,6 +1,5 @@ /* * Author: SilentSpike (based on unmuteUnit) - * * Globally unhides a unit. Only unhides if the last reason was removed. * * Arguments: diff --git a/addons/common/functions/fnc_uniqueElements.sqf b/addons/common/functions/fnc_uniqueElements.sqf new file mode 100644 index 0000000000..812bf59dba --- /dev/null +++ b/addons/common/functions/fnc_uniqueElements.sqf @@ -0,0 +1,27 @@ +/* + * Author: Glowbal + * Make a copy of an array with only the unique elements. + * + * Arguments: + * 0: array + * + * Return Value: + * Copy of original array + * + * Public: Yes + */ +#include "script_component.hpp" + +params ["_array"]; + +private "_result"; +_result = []; + +{ + if !(_x in _result) then { + _result pushBack _x; + }; + false +} count _array; + +_result diff --git a/addons/common/functions/fnc_uniqueElementsOnly.sqf b/addons/common/functions/fnc_uniqueElementsOnly.sqf index c81efb8308..e8d469867e 100644 --- a/addons/common/functions/fnc_uniqueElementsOnly.sqf +++ b/addons/common/functions/fnc_uniqueElementsOnly.sqf @@ -1,24 +1,17 @@ -/** - * fn_uniqueElementsOnly.sqf - * @Descr: Make a copy of an array with only the unique elements. - * @Author: Glowbal +/* + * Author: Glowbal + * Make a copy of an array with only the unique elements. * - * @Arguments: [array ARRAY] - * @Return: ARRAY Copy of original array - * @PublicAPI: true + * Arguments: + * 0: array + * + * Return Value: + * Copy of original array + * + * Public: Yes + * + * Deprecated */ - #include "script_component.hpp" -private ["_result", "_value"]; -PARAMS_1(_array); - -_result = []; -{ - _value = _x; - if ({_x isEqualTo _value} count _result == 0) then { - _result pushback _x; - }; -} forEach _array; - -_result; \ No newline at end of file +_this call FUNC(uniqueElements) diff --git a/addons/common/functions/fnc_unmuteUnit.sqf b/addons/common/functions/fnc_unmuteUnit.sqf index e234cb80db..bf02fe676f 100644 --- a/addons/common/functions/fnc_unmuteUnit.sqf +++ b/addons/common/functions/fnc_unmuteUnit.sqf @@ -1,6 +1,5 @@ /* * Author: commy2 - * * Unmutes the unit. Only unmutes if the last reason was removed. * * Arguments: diff --git a/addons/common/functions/fnc_useItem.sqf b/addons/common/functions/fnc_useItem.sqf index 03589cd56d..acf359813c 100644 --- a/addons/common/functions/fnc_useItem.sqf +++ b/addons/common/functions/fnc_useItem.sqf @@ -1,36 +1,37 @@ -/** - * fn_useItem.sqf - * @Descr: - * @Author: Glowbal +/* + * Author: Glowbal + * Use item * - * @Arguments: [] - * @Return: - * @PublicAPI: true + * Arguments: + * 0: unit + * 1: item + * + * Return Value: + * if item has been used. + * + * Public: Yes */ - #include "script_component.hpp" -PARAMS_2(_unit,_item); - -private ["_return", "_vehicleUsage"]; - -_vehicleUsage = [_this, 2, false, [false]] call BIS_fnc_Param; +params ["_unit", "_item", ["_vehicleUsage", false]]; +private "_return"; _return = false; -if (!_vehicleUsage) then { + +if !(_vehicleUsage) then { if (_item != "") then { - if (_item in (items _unit)) then { + if (_item in items _unit) then { _unit removeItem _item; _return = true; } else { - if (_item in (assignedItems _unit)) then { - _unit unassignItem _item; - _unit removeItem _item; + if (_item in assignedItems _unit) then { + _unit unlinkItem _item; _return = true; }; }; }; +//} else { + // @todo implement shared item functionality for with vehicles. }; -// TODO implement shared item functionality for with vehicles. -_return; \ No newline at end of file +_return diff --git a/addons/common/functions/fnc_useMagazine.sqf b/addons/common/functions/fnc_useMagazine.sqf index f21a04d026..1a77d0b3f3 100644 --- a/addons/common/functions/fnc_useMagazine.sqf +++ b/addons/common/functions/fnc_useMagazine.sqf @@ -1,28 +1,32 @@ -/** - * fn_useMagazine.sqf - * @Descr: Use magazine - * @Author: Glowbal +/* + * Author: Glowbal + * Use magazine * - * @Arguments: [unit OBJECt, magazine STRING] - * @Return: BOOL True if magazine has been used. - * @PublicAPI: true + * Arguments: + * 0: unit + * 1: magazine + * + * Return Value: + * if magazine has been used. + * + * Public: Yes */ - #include "script_component.hpp" -private ["_return", "_vehicleUsage"]; -PARAMS_2(_unit,_magazine); -_vehicleUsage = [_this, 2, false, [false]] call BIS_fnc_Param; +params ["_unit", "_magazine", ["_vehicleUsage", false]]; -if (!_vehicleUsage) then { +private "_return"; +_return = false; + +if !(_vehicleUsage) then { if (_magazine != "") then { _unit removeMagazine _magazine; _return = true; - } else { - _return = false; }; - [format["fnc_useMagazine: %1 | %2",_this,_return]] call FUNC(debug); + + [format ["fnc_useMagazine: %1 | %2", _this, _return]] call FUNC(debug); +//} else { + // @todo implement shared magazine functionality +}; + _return -} else { - // TODO implement shared magazine functionality -}; \ No newline at end of file diff --git a/addons/common/functions/fnc_waitAndExecute.sqf b/addons/common/functions/fnc_waitAndExecute.sqf index 6fcf83a58f..c8f078854b 100644 --- a/addons/common/functions/fnc_waitAndExecute.sqf +++ b/addons/common/functions/fnc_waitAndExecute.sqf @@ -1,6 +1,5 @@ /* * Author: esteldunedain - * * Executes a code once with a given game ACE_time delay, using a PFH * * Arguments: @@ -20,5 +19,5 @@ params ["_func", "_params", "_delay"]; -GVAR(waitAndExecArray) pushBack [(ACE_time + _delay), _func, _params]; +GVAR(waitAndExecArray) pushBack [ACE_time + _delay, _func, _params]; GVAR(waitAndExecArray) sort true; diff --git a/addons/common/functions/fnc_waveHeightAt.sqf b/addons/common/functions/fnc_waveHeightAt.sqf index ac9eed10bb..a3f2447729 100644 --- a/addons/common/functions/fnc_waveHeightAt.sqf +++ b/addons/common/functions/fnc_waveHeightAt.sqf @@ -19,6 +19,7 @@ params ["_position"]; if (isNil QGVAR(waveHeightLogic)) then { GVAR(waveHeightLogic) = "Logic" createVehicleLocal [0,0,0]; }; + GVAR(waveHeightLogic) setPosASL _position; (getPosASLW GVAR(waveHeightLogic) select 2) - (getPosASL GVAR(waveHeightLogic) select 2)