3 protected const int HEIGHT_DIFF_LIMIT_METERS = 1.0;
5 protected float m_MaximalActionDistanceSq;
6 protected string m_SurfaceType;
11 m_MaximalActionDistanceSq = maximal_target_distance * maximal_target_distance;
12 m_SurfaceType = surfaceType;
15 surfaceType.Split(
"|", m_AllowedSurfaceList);
20 if (!target || (target && target.GetObject()))
24 vector hitPosition = target.GetCursorHitPos();
25 if (hitPosition ==
vector.Zero)
26 hitPosition = player.GetPosition();
29 float waterLevel = player.GetCurrentWaterLevel();
30 g_Game.SurfaceGetType3D(hitPosition[0], hitPosition[1] + waterLevel, hitPosition[2], surfaceType);
33 return Surface.AllowedWaterSurface(hitPosition[1] + waterLevel, surfaceType, m_AllowedSurfaceList);
35 float surfaceHeight =
g_Game.SurfaceY(hitPosition[0], hitPosition[2]);
39 surfaceHeight = hitPosition[1];
42 float heightDiff =
Math.AbsFloat(hitPosition[1] - surfaceHeight);
43 if (surfaceType !=
"" && heightDiff > HEIGHT_DIFF_LIMIT_METERS)
46 float distSq =
vector.DistanceSq(player.GetPosition(), hitPosition);
47 if (distSq > m_MaximalActionDistanceSq)
50 return Surface.AllowedWaterSurface(hitPosition[1], surfaceType, m_AllowedSurfaceList);