2018-09-17 19:19:29 +00:00
|
|
|
#include "script_component.hpp"
|
2017-03-15 15:11:37 +00:00
|
|
|
/*
|
|
|
|
* Author: Ruthberg, commy2
|
|
|
|
* Checks if the player can dig on the surface below (enough dust).
|
|
|
|
*
|
|
|
|
* Arguments:
|
2023-02-09 19:16:42 +00:00
|
|
|
* 0: Unit or Position (2d/3d) <OBJECT><ARRAY>
|
2017-03-15 15:11:37 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* Can Dig <BOOL>
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [ACE_player] call ace_common_fnc_canDig
|
2023-02-09 19:16:42 +00:00
|
|
|
* [[1000,2000]] call ace_common_fnc_canDig
|
2017-03-15 15:11:37 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
2023-02-09 19:16:42 +00:00
|
|
|
params ["_input"];
|
2017-03-15 15:11:37 +00:00
|
|
|
|
2023-02-09 19:16:42 +00:00
|
|
|
private _posASL = _input;
|
2017-03-15 15:11:37 +00:00
|
|
|
|
2023-02-09 19:16:42 +00:00
|
|
|
if ((_input isEqualType objNull) && {
|
|
|
|
_posASL = getPosASL _input;
|
2023-08-13 19:13:02 +00:00
|
|
|
(getPosATL _input) select 2 > 0.05 || // Walking on objects, such as buildings, pavements, etc.
|
|
|
|
{surfaceIsWater _posASL} // posATL in low water (not as low to allow walking) is negative
|
2023-02-09 19:16:42 +00:00
|
|
|
}) exitWith {false};
|
2017-03-15 15:11:37 +00:00
|
|
|
|
|
|
|
private _surfaceClass = (surfaceType _posASL) select [1];
|
2017-12-20 21:41:50 +00:00
|
|
|
private _config = configFile >> "CfgSurfaces" >> _surfaceClass;
|
|
|
|
|
2023-02-09 19:16:42 +00:00
|
|
|
TRACE_3("",_surfaceClass,getText (_config >> "soundEnviron"),getNumber (_config >> "dust"));
|
2017-03-15 15:11:37 +00:00
|
|
|
|
2017-12-20 21:41:50 +00:00
|
|
|
if (isNumber (_config >> "ACE_canDig")) then {
|
2020-02-09 01:43:42 +00:00
|
|
|
(getNumber (_config >> "ACE_canDig")) == 1 // return
|
2017-12-20 21:41:50 +00:00
|
|
|
} else {
|
2023-02-09 19:16:42 +00:00
|
|
|
private _surfaceType = getText (_config >> "soundEnviron");
|
|
|
|
GVAR(canDigSurfaces) getOrDefault [_surfaceType, getNumber (_config >> "dust") >= 0.1, true] // return
|
2017-12-20 21:41:50 +00:00
|
|
|
};
|