DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
CCTWaterSurface.c
См. документацию.
2[Obsolete("1.30: replaced by CCTLiquid")]
4{
5 protected const int HEIGHT_DIFF_LIMIT_METERS = 1.0;
6
7 protected float m_MaximalActionDistanceSq;
8 protected string m_SurfaceType;
10
11 void CCTWaterSurface(float maximal_target_distance = UAMaxDistances.DEFAULT, string surfaceType = "")
12 {
13 m_MaximalActionDistanceSq = maximal_target_distance * maximal_target_distance;
14 m_SurfaceType = surfaceType;
15
17 surfaceType.Split("|", m_AllowedSurfaceList);
18 }
19
20 override bool Can(PlayerBase player, ActionTarget target)
21 {
22 if (!target || (target && target.GetObject()))
23 return false;
24
26 vector hitPosition = target.GetCursorHitPos();
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)
33 return Surface.AllowedWaterSurface(hitPosition[1] + waterLevel, surfaceType, m_AllowedSurfaceList);
34
35 float surfaceHeight = g_Game.SurfaceY(hitPosition[0], hitPosition[2]);
37 if (!surfaceType)
38 {
39 surfaceHeight = hitPosition[1];
40 }
41
42 float heightDiff = Math.AbsFloat(hitPosition[1] - surfaceHeight);
43 if (surfaceType != "" && heightDiff > HEIGHT_DIFF_LIMIT_METERS)
44 return false;
45
46 float distSq = vector.DistanceSq(player.GetPosition(), hitPosition);
47 if (distSq > m_MaximalActionDistanceSq)
48 return false;
49
50 return Surface.AllowedWaterSurface(hitPosition[1], surfaceType, m_AllowedSurfaceList);
51 }
52
53 override bool CanContinue(PlayerBase player, ActionTarget target)
54 {
55 return true;
56 }
57}
58
59[Obsolete("1.30: replaced by CCTLiquid")]
60class CCTWaterSurfaceEx : CCTBase
61{
63 protected int m_AllowedLiquidSource;
65 void CCTWaterSurfaceEx(float maximal_target_distance, int allowedLiquidSource)
66 {
67 m_MaximalActionDistanceSq = maximal_target_distance * maximal_target_distance;
68 m_AllowedLiquidSource = allowedLiquidSource;
69 }
70
71 override bool Can(PlayerBase player, ActionTarget target)
72 {
73 if (!target || (target && target.GetObject()))
74 return false;
76 vector hitPosition = target.GetCursorHitPos();
77 string surfaceType;
78 g_Game.SurfaceGetType3D(hitPosition[0], hitPosition[1], hitPosition[2], surfaceType);
79
80 float distSq = vector.DistanceSq(player.GetPosition(), hitPosition);
81 if (distSq > m_MaximalActionDistanceSq)
82 return false;
83
84 if(surfaceType == "" && hitPosition[1] > g_Game.SurfaceGetSeaLevelMax())
85 return false;
86
87 return Surface.CheckLiquidSource(hitPosition[1], surfaceType, m_AllowedLiquidSource);
88 }
89
90 override bool CanContinue(PlayerBase player, ActionTarget target)
91 {
92 return true;
93 }
94}
void ActionTarget(Object object, Object parent, int componentIndex, vector cursorHitPos, float utility, string surfaceName="")
Определения ActionTargets.c:125
CCTObject m_MaximalActionDistanceSq
CCTWaterSurface CCTBase Obsolete("1.30: replaced by CCTLiquid")
Определения CCTWaterSurface.c:59
DayZGame g_Game
Определения DayZGame.c:4074
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:7
override bool CanContinue(PlayerBase player, ActionTarget target)
Определения CCTWaterSurface.c:53
override bool Can(PlayerBase player, ActionTarget target)
Определения CCTWaterSurface.c:20
void CCTWaterSurface(float maximal_target_distance=UAMaxDistances.DEFAULT, string surfaceType="")
Определения CCTWaterSurface.c:11
const int HEIGHT_DIFF_LIMIT_METERS
Определения CCTWaterSurface.c:5
string m_SurfaceType
Определения CCTWaterSurface.c:8
ref array< string > m_AllowedSurfaceList
DEPRECATED.
Определения CCTWaterSurface.c:9
Определения EnMath.c:7
Определения PlayerBaseClient.c:2
static bool AllowedWaterSurface(float pHeight, string pSurface, array< string > pAllowedSurfaceList)
Определения Surface.c:21
static bool CheckLiquidSource(float pHeight, string pSurface, int allowedWaterSourceMask)
Определения Surface.c:44
Определения Surface.c:2
const float DEFAULT
Определения ActionConstants.c:114
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:119
static proto float AbsFloat(float f)
Returns absolute value.