DayZ 1.24
Loading...
Searching...
No Matches
MapNavigationBehaviour.c
Go to the documentation of this file.
2{
3 BASIC = 0,
4 COMPASS = 1,
5 GPS = 2,
6 ALL = 4
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
35
40
45
50
52 {
53 if (item.IsInherited(ItemGPS))
54 {
56 {
59 }
60 }
61
62 if (item.IsInherited(ItemCompass))
63 {
65 {
68 }
69 }
70 }
71
73 {
74 if (item.IsInherited(ItemGPS))
75 {
76 m_GPSInPossessionArr.RemoveItem(item);
77 if (m_GPSInPossessionArr.Count() == 0)
79 }
80
81 if (item.IsInherited(ItemCompass))
82 {
84 if (m_CompassInPossessionArr.Count() == 0)
86 }
87 }
88
94
103
111
113 {
114 return m_Player.GetPosition();
115 }
116
118 {
119 float gridSize = GetGame().ConfigGetFloat(string.Format(GRID_SIZE_CFG_PATH, GetGame().GetWorldName()));
120 int gridX, gridZ;
121 GetGame().GetWorld().GetGridCoords(pEntity.GetPosition(), gridSize, gridX, gridZ);
122
125
127 string gridXStr = gridX.ToStringLen(DISPLAY_GRID_POS_MAX_CHARS_COUNT);
128 string gridZStr = gridZ.ToStringLen(DISPLAY_GRID_POS_MAX_CHARS_COUNT);
129
130 int i = 0;
131 int gridCoordNumber;
132 for (i = 0; i < gridXStr.Length(); ++i)
133 {
134 gridCoordNumber = gridXStr.Get(i).ToInt();
135 if (IsOutOfMap(pEntity))
136 gridCoordNumber = -1;
137
139 }
140
141 for (i = 0; i < gridZStr.Length(); ++i)
142 {
143 gridCoordNumber = gridZStr.Get(i).ToInt();
144 if (IsOutOfMap(pEntity))
145 gridCoordNumber = -1;
146
148 }
149
150 return positions;
151 }
152
154 {
156 float altF = pEntity.GetPosition()[1];
157 int altI = Math.Round(altF);
158 string altString = altI.ToStringLen(DISPLAY_ALT_MAX_CHARS_COUNT);
159
160 for (int i = 0; i < altString.Length(); ++i)
161 altArray.Insert(altString.Get(i).ToInt());
162
163 return altArray;
164 }
165
167 {
168 vector worldPos = pEntity.GetPosition();
169
170 if (worldPos[0] < 0 || worldPos[0] > GetGame().GetWorld().GetWorldSize() || worldPos[2] < 0 || worldPos[2] > GetGame().GetWorld().GetWorldSize())
171 return true;
172
173 return false;
174 }
175}
DayZPlayer m_Player
Definition Hand_Events.c:42
vector GetPositionRandomized()
EMapNavigationType m_NavigationType
int m_RandomPositionDeviationZ
void OnItemNotInPlayerPossession(EntityAI item)
static const string GRID_SIZE_CFG_PATH
void SetNavigationType(EMapNavigationType pType)
int m_RandomPositionDeviationX
float RandomizedDeviation()
static array< int > OrderedPositionNumbersFromGridCoords(EntityAI pEntity)
void RandomizePosition()
void UnsetNavigationType(EMapNavigationType pType)
static bool IsOutOfMap(EntityAI pEntity)
static array< int > OrderedAltitudeNumbersPosition(EntityAI pEntity)
void OnItemInPlayerPossession(EntityAI item)
ref array< EntityAI > m_GPSInPossessionArr
vector GetPositionReal()
void MapNavigationBehaviour(PlayerBase pPlayer, EMapNavigationType pNavigationType=EMapNavigationType.BASIC)
static const int DISPLAY_GRID_POS_MAX_CHARS_COUNT
enum EMapNavigationType RANDOM_DEVIATION_MIN
static const int DISPLAY_ALT_MAX_CHARS_COUNT
const int RANDOM_DEVIATION_MAX
EMapNavigationType GetNavigationType()
ref array< EntityAI > m_CompassInPossessionArr
Definition EnMath.c:7
const int INDEX_NOT_FOUND
Definition gameplay.c:13
proto native CGame GetGame()
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].
Definition EnMath.c:54
proto native float GetWorldTime()