DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
CCTWaterSurface.c
См. документацию.
2{
3 protected const int HEIGHT_DIFF_LIMIT_METERS = 1.0;
4
5 protected float m_MaximalActionDistanceSq;
6 protected string m_SurfaceType;
8
9 void CCTWaterSurface(float maximal_target_distance = UAMaxDistances.DEFAULT, string surfaceType = "")
10 {
11 m_MaximalActionDistanceSq = maximal_target_distance * maximal_target_distance;
12 m_SurfaceType = surfaceType;
13
15 surfaceType.Split("|", m_AllowedSurfaceList);
16 }
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
26 string surfaceType;
27 float waterLevel = player.GetCurrentWaterLevel();
28 g_Game.SurfaceGetType3D(hitPosition[0], hitPosition[1] + waterLevel, hitPosition[2], surfaceType);
29
30 if (waterLevel > 0.0)
31 return Surface.AllowedWaterSurface(hitPosition[1] + waterLevel, surfaceType, m_AllowedSurfaceList);
32
33 float surfaceHeight = g_Game.SurfaceY(hitPosition[0], hitPosition[2]);
35 if (!surfaceType)
36 {
37 surfaceHeight = hitPosition[1];
38 }
39
40 float heightDiff = Math.AbsFloat(hitPosition[1] - surfaceHeight);
41 if (surfaceType != "" && heightDiff > HEIGHT_DIFF_LIMIT_METERS)
42 return false;
43
44 float distSq = vector.DistanceSq(player.GetPosition(), hitPosition);
45 if (distSq > m_MaximalActionDistanceSq)
46 return false;
47
48 return Surface.AllowedWaterSurface(hitPosition[1], surfaceType, m_AllowedSurfaceList);
49 }
50
51 override bool CanContinue(PlayerBase player, ActionTarget target)
52 {
53 return true;
54 }
55}
56
58{
60 protected int m_AllowedLiquidSource;
61
62 void CCTWaterSurfaceEx(float maximal_target_distance, int allowedLiquidSource)
63 {
64 m_MaximalActionDistanceSq = maximal_target_distance * maximal_target_distance;
65 m_AllowedLiquidSource = allowedLiquidSource;
66 }
67
68 override bool Can(PlayerBase player, ActionTarget target)
69 {
70 if (!target || (target && target.GetObject()))
71 return false;
72
73 vector hitPosition = target.GetCursorHitPos();
74 string surfaceType;
75 g_Game.SurfaceGetType3D(hitPosition[0], hitPosition[1], hitPosition[2], surfaceType);
76
77 float distSq = vector.DistanceSq(player.GetPosition(), hitPosition);
78 if (distSq > m_MaximalActionDistanceSq)
79 return false;
80
81 return Surface.CheckLiquidSource(hitPosition[1], surfaceType, m_AllowedLiquidSource);
82 }
83
84 override bool CanContinue(PlayerBase player, ActionTarget target)
85 {
86 return true;
87 }
88}
class ActionTargets ActionTarget
int m_AllowedLiquidSource
Определения CCTWaterSurface.c:60
void CCTWaterSurfaceEx(float maximal_target_distance, int allowedLiquidSource)
Определения CCTWaterSurface.c:62
CCTWaterSurface m_MaximalActionDistanceSq
DayZGame g_Game
Определения DayZGame.c:3868
bool CanContinue(PlayerBase player, ActionTarget target)
Определения CCTBase.c:8
bool Can(PlayerBase player, ActionTarget target)
Определения CCTBase.c:3
Определения CCTBase.c:2
float m_MaximalActionDistanceSq
Определения CCTWaterSurface.c:5
override bool CanContinue(PlayerBase player, ActionTarget target)
Определения CCTWaterSurface.c:51
override bool Can(PlayerBase player, ActionTarget target)
Определения CCTWaterSurface.c:18
void CCTWaterSurface(float maximal_target_distance=UAMaxDistances.DEFAULT, string surfaceType="")
Определения CCTWaterSurface.c:9
const int HEIGHT_DIFF_LIMIT_METERS
Определения CCTWaterSurface.c:3
string m_SurfaceType
Определения CCTWaterSurface.c:6
ref array< string > m_AllowedSurfaceList
DEPRECATED.
Определения CCTWaterSurface.c:7
Определения EnMath.c:7
Определения PlayerBaseClient.c:2
static bool AllowedWaterSurface(float pHeight, string pSurface, array< string > pAllowedSurfaceList)
Определения Surface.c:31
static bool CheckLiquidSource(float pHeight, string pSurface, int allowedWaterSourceMask)
Определения Surface.c:54
Определения Surface.c:2
const float DEFAULT
Определения ActionConstants.c:112
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
Определения EnConvert.c:106
static proto float AbsFloat(float f)
Returns absolute value.