DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
MapNavigationBehaviour.c
См. документацию.
2{
3 BASIC = 0,
4 COMPASS = 1,
5 GPS = 2,
6 ALL = 4
7}
8
10{
11 const int RANDOM_DEVIATION_MIN = 4;
12 const int RANDOM_DEVIATION_MAX = 15;
13
15 static const int DISPLAY_ALT_MAX_CHARS_COUNT = 4;
16
17 protected static const string GRID_SIZE_CFG_PATH = "CfgWorlds %1 Grid Zoom1 stepX";
18
23
26
28 {
29 m_Player = pPlayer;
30 m_NavigationType = pNavigationType;
31
34 }
35
37 {
39 }
40
42 {
44 }
45
50
52 {
53 if (item.IsInherited(ItemGPS))
54 {
55 if (m_GPSInPossessionArr.Find(item) == INDEX_NOT_FOUND)
56 {
57 m_GPSInPossessionArr.Insert(item);
59 }
60 }
61
62 if (item.IsInherited(ItemCompass))
63 {
65 {
66 m_CompassInPossessionArr.Insert(item);
68 }
69 }
70 }
71
73 {
74 if (item.IsInherited(ItemGPS))
75 {
76 m_GPSInPossessionArr.RemoveItem(item);
77 if (m_GPSInPossessionArr.Count() == 0)
78 {
80 }
81 }
82
83 if (item.IsInherited(ItemCompass))
84 {
85 m_CompassInPossessionArr.RemoveItem(item);
86 if (m_CompassInPossessionArr.Count() == 0)
87 {
89 }
90 }
91 }
92
98
99 protected float RandomizedDeviation()
100 {
102 if ((Math.RandomIntInclusive(0, 10) % 2) == 0)
103 {
105 }
106 else
107 {
109 }
110 }
111
113 {
114 vector realPosition = m_Player.GetPosition();
115 vector randomizedPosition = Vector(realPosition[0] + m_RandomPositionDeviationX, realPosition[1], realPosition[2] + m_RandomPositionDeviationZ);
116
117 return randomizedPosition;
118 }
119
121 {
122 return m_Player.GetPosition();
123 }
124
126 {
127 float gridSize = g_Game.ConfigGetFloat(string.Format(GRID_SIZE_CFG_PATH, g_Game.GetWorldName()));
128 int gridX, gridZ;
129 GetGame().GetWorld().GetGridCoords(pPosition, gridSize, gridX, gridZ);
130
131 gridX = Math.AbsInt(gridX);
132 gridZ = Math.AbsInt(gridZ);
133
134 array<int> positions = new array<int>();
135 string gridXStr = gridX.ToStringLen(DISPLAY_GRID_POS_MAX_CHARS_COUNT);
136 string gridZStr = gridZ.ToStringLen(DISPLAY_GRID_POS_MAX_CHARS_COUNT);
137
138 int i = 0;
139 int gridCoordNumber;
140 for (i = 0; i < gridXStr.Length(); ++i)
141 {
142 gridCoordNumber = gridXStr.Get(i).ToInt();
143 if (IsOutOfMap(pPosition))
144 {
145 gridCoordNumber = -1;
146 }
147
148 positions.Insert(gridCoordNumber);
149 }
150
151 for (i = 0; i < gridZStr.Length(); ++i)
152 {
153 gridCoordNumber = gridZStr.Get(i).ToInt();
154 if (IsOutOfMap(pPosition))
155 {
156 gridCoordNumber = -1;
157 }
158
159 positions.Insert(gridCoordNumber);
160 }
161
162 return positions;
163 }
164
166 {
167 vector position = pEntity.GetPosition();
169
170 return positions;
171 }
172
174 {
175 array<int> altArray = new array<int>();
176 float altF = pEntity.GetPosition()[1];
177 int altI = Math.Round(altF);
178 string altString = altI.ToStringLen(DISPLAY_ALT_MAX_CHARS_COUNT);
179
180 for (int i = 0; i < altString.Length(); ++i)
181 {
182 altArray.Insert(altString.Get(i).ToInt());
183 }
184
185 return altArray;
186 }
187
188 static bool IsOutOfMap(vector pPosition)
189 {
190 if (pPosition[0] < 0 || pPosition[0] > g_Game.GetWorld().GetWorldSize() || pPosition[2] < 0 || pPosition[2] > g_Game.GetWorld().GetWorldSize())
191 {
192 return true;
193 }
194
195 return false;
196 }
197
198 static bool IsOutOfMap(EntityAI pEntity)
199 {
200 vector worldPos = pEntity.GetPosition();
201
202 return IsOutOfMap(worldPos);
203 }
204}
DayZGame g_Game
Определения DayZGame.c:4074
vector position
Определения DustKickupEffects.c:20
DayZPlayer m_Player
Определения Hand_Events.c:42
vector GetPositionRandomized()
Определения MapNavigationBehaviour.c:112
EMapNavigationType m_NavigationType
Определения MapNavigationBehaviour.c:21
int m_RandomPositionDeviationZ
Определения MapNavigationBehaviour.c:20
void OnItemNotInPlayerPossession(EntityAI item)
Определения MapNavigationBehaviour.c:72
static const string GRID_SIZE_CFG_PATH
Определения MapNavigationBehaviour.c:17
void SetNavigationType(EMapNavigationType pType)
Определения MapNavigationBehaviour.c:36
int m_RandomPositionDeviationX
Определения MapNavigationBehaviour.c:19
float RandomizedDeviation()
Определения MapNavigationBehaviour.c:99
static array< int > OrderedPositionNumbersFromGridCoords(vector pPosition)
Определения MapNavigationBehaviour.c:125
void RandomizePosition()
Определения MapNavigationBehaviour.c:93
EMapNavigationType
Определения MapNavigationBehaviour.c:2
@ BASIC
Определения MapNavigationBehaviour.c:3
@ GPS
Определения MapNavigationBehaviour.c:5
@ COMPASS
Определения MapNavigationBehaviour.c:4
void UnsetNavigationType(EMapNavigationType pType)
Определения MapNavigationBehaviour.c:41
static array< int > OrderedAltitudeNumbersPosition(EntityAI pEntity)
Определения MapNavigationBehaviour.c:173
void OnItemInPlayerPossession(EntityAI item)
Определения MapNavigationBehaviour.c:51
ref array< EntityAI > m_GPSInPossessionArr
Определения MapNavigationBehaviour.c:24
vector GetPositionReal()
Определения MapNavigationBehaviour.c:120
void MapNavigationBehaviour(PlayerBase pPlayer, EMapNavigationType pNavigationType=EMapNavigationType.BASIC)
Определения MapNavigationBehaviour.c:27
static bool IsOutOfMap(vector pPosition)
Определения MapNavigationBehaviour.c:188
static const int DISPLAY_GRID_POS_MAX_CHARS_COUNT
Определения MapNavigationBehaviour.c:14
enum EMapNavigationType RANDOM_DEVIATION_MIN
static const int DISPLAY_ALT_MAX_CHARS_COUNT
Определения MapNavigationBehaviour.c:15
const int RANDOM_DEVIATION_MAX
Определения MapNavigationBehaviour.c:12
EMapNavigationType GetNavigationType()
Определения MapNavigationBehaviour.c:46
ref array< EntityAI > m_CompassInPossessionArr
Определения MapNavigationBehaviour.c:25
Определения EnMath.c:7
Определения PlayerBaseClient.c:2
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Определения EnConvert.c:119
const int INDEX_NOT_FOUND
Определения gameplay.c:13
DayZGame GetGame()
Определения gameplay.c:636
@ ALL
Mask of all events.
Определения EnEntity.c:110
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
static proto int Randomize(int seed)
Sets the seed for the random number generator.
static proto int AbsInt(int i)
Returns absolute value.
static proto float Round(float f)
Returns mathematical round of value.
static int RandomIntInclusive(int min, int max)
Returns a random int number between and min [inclusive] and max [inclusive].
Определения EnMath.c:54
proto native int Length()
Returns length of string.
proto string Get(int index)
Gets n-th character from string.
proto native int ToInt()
Converts string to integer.
proto native float GetWorldTime()