DayZ 1.24
Loading...
Searching...
No Matches
CCTWaterSurface.c
Go to the documentation of this file.
2{
3 protected const int HEIGHT_DIFF_LIMIT_METERS = 1.0;
4
5 protected float m_MaximalActionDistanceSq;
6 protected string m_SurfaceType;
8
17
18 override bool Can(PlayerBase player, ActionTarget target)
19 {
20 if (!target || (target && target.GetObject()))
21 return false;
22
24 vector hitPosition = target.GetCursorHitPos();
25 if (hitPosition == vector.Zero)
26 hitPosition = player.GetPosition();
27
28 string surfaceType;
29 float waterLevel = player.GetCurrentWaterLevel();
30 g_Game.SurfaceGetType3D(hitPosition[0], hitPosition[1] + waterLevel, hitPosition[2], surfaceType);
31
32 if (waterLevel > 0.0)
34
35 float surfaceHeight = g_Game.SurfaceY(hitPosition[0], hitPosition[2]);
37 if (!surfaceType)
39
42 return false;
43
44 float distSq = vector.DistanceSq(player.GetPosition(), hitPosition);
46 return false;
47
49 }
50
51 override bool CanContinue(PlayerBase player, ActionTarget target)
52 {
53 return true;
54 }
55}
DayZGame g_Game
Definition DayZGame.c:3528
float m_MaximalActionDistanceSq
override bool CanContinue(PlayerBase player, ActionTarget target)
override bool Can(PlayerBase player, ActionTarget target)
void CCTWaterSurface(float maximal_target_distance=UAMaxDistances.DEFAULT, string surfaceType="")
const int HEIGHT_DIFF_LIMIT_METERS
ref array< string > m_AllowedSurfaceList
DEPRECATED.
Definition EnMath.c:7
static bool AllowedWaterSurface(float pHeight, string pSurface, array< string > pAllowedSurfaceList)
Definition Surface.c:8
const float DEFAULT
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
static const vector Zero
Definition EnConvert.c:110
static proto float AbsFloat(float f)
Returns absolute value.