DayZ 1.26
DayZ Explorer by KGB
Загрузка...
Поиск...
Не найдено
Класс VicinityItemManager

Закрытые члены

void Init ()
 
array< EntityAIGetVicinityItems ()
 
void AddVicinityItems (Object object)
 
array< CargoBaseGetVicinityCargos ()
 
void AddVicinityCargos (CargoBase object)
 
void ResetRefreshCounter ()
 
void Update (float delta_time)
 
bool ExcludeFromContainer_Phase1 (Object actor_in_radius)
 
bool ExcludeFromContainer_Phase2 (Object object_in_radius)
 
bool ExcludeFromContainer_Phase3 (Object object_in_cone)
 
bool CanIgnoreDistanceCheck (EntityAI entity_ai)
 
void RefreshVicinityItems ()
 
bool IsObstructed (Object filtered_object)
 

Закрытые статические члены

static VicinityItemManager GetInstance ()
 

Закрытые данные

const float UPDATE_FREQUENCY = 0.25
 
const float VICINITY_DISTANCE = 0.5
 
const float VICINITY_ACTOR_DISTANCE = 2.0
 
const float VICINITY_LARGE_ACTOR_DISTANCE = 3.0
 
const float VICINITY_CONE_DISTANCE = 2.0
 
const float VICINITY_CONE_REACH_DISTANCE = 2.0
 
const float VICINITY_CONE_ANGLE = 30
 
const float VICINITY_CONE_RADIANS = 0.5
 
const string CE_CENTER = "ce_center"
 
const float HEIGHT_OFFSET = 0.2
 
const int OBJECT_OBSTRUCTION_WEIGHT = 10000
 
const float CONE_HEIGHT_MIN = -0.5
 
const float CONE_HEIGHT_MAX = 3.0
 
ref array< EntityAIm_VicinityItems = new array<EntityAI>()
 
ref array< CargoBasem_VicinityCargos = new array<CargoBase>()
 
float m_RefreshCounter
 

Закрытые статические данные

static ref VicinityItemManager s_Instance
 

Подробное описание

Методы

◆ AddVicinityCargos()

void AddVicinityCargos ( CargoBase object)
inlineprivate
69 {
70 if (m_VicinityCargos.Find(object) == INDEX_NOT_FOUND)
71 {
72 m_VicinityCargos.Insert(object);
73 }
74 }
ref array< CargoBase > m_VicinityCargos
Definition VicinityItemManager.c:18
const int INDEX_NOT_FOUND
Definition gameplay.c:13

Перекрестные ссылки INDEX_NOT_FOUND и m_VicinityCargos.

Используется в RefreshVicinityItems().

◆ AddVicinityItems()

void AddVicinityItems ( Object object)
inlineprivate
40 {
41 EntityAI entity = EntityAI.Cast(object);
42 if (!entity)
43 {
44 return;
45 }
46
48 {
49 return;
50 }
51
53 {
54 if (!FreeDebugCamera.GetInstance() || FreeDebugCamera.GetInstance().IsActive() == false)
55 {
56 return;
57 }
58 }
59
60 m_VicinityItems.Insert(entity);
61 }
PlayerBase GetPlayer()
Definition ModifierBase.c:51
Definition Building.c:6
script counterpart to engine's class Inventory
Definition Inventory.c:79
static proto native bool CheckManipulatedObjectsDistances(notnull EntityAI e0, notnull EntityAI e1, float radius)
Definition EntityAI.c:95
const float VICINITY_CONE_REACH_DISTANCE
Definition VicinityItemManager.c:8
ref array< EntityAI > m_VicinityItems
Definition VicinityItemManager.c:17
proto native CGame GetGame()

Перекрестные ссылки GameInventory::CheckManipulatedObjectsDistances(), GetGame(), GetPlayer(), INDEX_NOT_FOUND, m_VicinityItems и VICINITY_CONE_REACH_DISTANCE.

Используется в RefreshVicinityItems().

◆ CanIgnoreDistanceCheck()

bool CanIgnoreDistanceCheck ( EntityAI entity_ai)
inlineprivate
204 {
205 return MiscGameplayFunctions.CanIgnoreDistanceCheck(entity_ai);
206 }

Используется в RefreshVicinityItems().

◆ ExcludeFromContainer_Phase1()

bool ExcludeFromContainer_Phase1 ( Object actor_in_radius)
inlineprivate

If in free camera, allow viewing of inventory

93 {
96 return true;
97
99 if (entity == player)
100 return true;
101 if (entity.IsParticle())
102 return true;
103 if (entity.IsScriptedLight())
104 return true;
105 if (entity.IsBeingPlaced())
106 return true;
107 if (entity.IsHologram())
108 return true;
109 if (entity.IsMan() || entity.IsZombie() || entity.IsZombieMilitary())
110 {
111 //visibility cone check
112 vector entityPosition = entity.GetPosition();
113
114 if (entity && entity.IsMan())
115 {
117 if (vicinityPlayer)
118 {
119 entityPosition = vicinityPlayer.GetBonePositionWS(vicinityPlayer.GetBoneIndexByName("spine3"));
120 }
121 }
122 else if (entity && (entity.IsZombie() || entity.IsZombieMilitary()))
123 {
125 if (zombie)
126 {
127 entityPosition = zombie.GetBonePositionWS(zombie.GetBoneIndexByName("spine3"));
128 }
129 }
130
132 if (FreeDebugCamera.GetInstance() && FreeDebugCamera.GetInstance().IsActive())
133 {
134 return false;
135 }
136
138 entityDirection.Normalize();
139 entityDirection[1] = 0; //ignore height
140
142 playerDirection.Normalize();
143 playerDirection[1] = 0; //ignore height
144
146 if (dotRadians > -0.5)
147 return true;
148 }
149
150 return false;
151 }
Super root of all classes in Enforce script.
Definition EnScript.c:11
Definition PlayerBaseClient.c:2
Definition ZombieFemaleBase.c:2
Definition EnConvert.c:106
static float Dot(vector v1, vector v2)
Returns Dot product of vector v1 and vector v2.
Definition EnConvert.c:271
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.

Перекрестные ссылки Class::CastTo(), vector::Dot(), GetGame() и GetPlayer().

Используется в RefreshVicinityItems().

◆ ExcludeFromContainer_Phase2()

bool ExcludeFromContainer_Phase2 ( Object object_in_radius)
inlineprivate
154 {
156
158 return true;
159 if (entity == PlayerBase.Cast(GetGame().GetPlayer()))
160 return true;
161 if (entity.IsParticle())
162 return true;
163 if (entity.IsScriptedLight())
164 return true;
165 if (entity.IsBeingPlaced())
166 return true;
167 if (entity.IsHologram())
168 return true;
169
172 return true;
173
174 return false;
175 }
Definition InventoryItem.c:731

Перекрестные ссылки Class::CastTo(), GetGame() и GetPlayer().

Используется в RefreshVicinityItems().

◆ ExcludeFromContainer_Phase3()

bool ExcludeFromContainer_Phase3 ( Object object_in_cone)
inlineprivate
178 {
181
182 //Print("---object in cone: " + object_in_cone);
184 return true;
185 if (entity == player)
186 return true;
187 if (entity.IsParticle())
188 return true;
189 if (entity.IsScriptedLight())
190 return true;
191 if (entity.IsBeingPlaced())
192 return true;
193 if (entity.IsHologram())
194 return true;
195
198 return true;
199
200 return false;
201 }
Definition Land_Radio_PanelPAS.c:2

Перекрестные ссылки Class::CastTo(), GetGame() и GetPlayer().

Используется в RefreshVicinityItems().

◆ GetInstance()

static VicinityItemManager GetInstance ( )
inlinestaticprivate
23 {
24 if (!s_Instance)
26
27 return s_Instance;
28 }
Definition VicinityItemManager.c:2
static ref VicinityItemManager s_Instance
Definition VicinityItemManager.c:20

Перекрестные ссылки s_Instance.

Используется в MissionBase::HideInventory(), OnShow() и VicinityContainer::UpdateInterval().

◆ GetVicinityCargos()

array< CargoBase > GetVicinityCargos ( )
inlineprivate
64 {
65 return m_VicinityCargos;
66 }

Перекрестные ссылки m_VicinityCargos.

◆ GetVicinityItems()

array< EntityAI > GetVicinityItems ( )
inlineprivate
35 {
36 return m_VicinityItems;
37 }

Перекрестные ссылки m_VicinityItems.

◆ Init()

void Init ( )
inlineprivate
31 {
32 }

◆ IsObstructed()

bool IsObstructed ( Object filtered_object)
inlineprivate
405 {
406 return MiscGameplayFunctions.IsObjectObstructed(filtered_object);
407 }

Используется в RefreshVicinityItems().

◆ RefreshVicinityItems()

void RefreshVicinityItems ( )
inlineprivate

If in free camera, override the position that the inventory gets generated from

If in free camera, don't worry about obstructed objects if there are any

210 {
212
217 vector playerPosition = player.GetPosition();
221
223 bool cameraActive = FreeDebugCamera.GetInstance() && FreeDebugCamera.GetInstance().IsActive();
224 if (cameraActive)
225 {
226 playerPosition = FreeDebugCamera.GetInstance().GetPosition();
228
229 float headingAngle = FreeDebugCamera.GetInstance().GetOrientation()[0] * Math.DEG2RAD;
230
232 headingDirection[1] = 0;
234 headingDirection.Normalize();
235 }
236
237 if (m_VicinityItems)
238 m_VicinityItems.Clear();
239
241 m_VicinityCargos.Clear();
242
243 //1. GetAll actors in VICINITY_ACTOR_DISTANCE
244 //DebugActorsSphereDraw(VICINITY_ACTOR_DISTANCE);
246
247 // no filtering for cargo (initial implementation)
250
251 //filter unnecessary and duplicate objects beforehand
253 {
256
258 continue;
259
262 }
263
265 objectsInVicinity.Clear();
266
267 //2. GetAll Objects in VICINITY_DISTANCE
269 //DebugObjectsSphereDraw(VICINITY_DISTANCE);
270
271 //filter unnecessary and duplicate objects beforehand
273 {
276
278 continue;
279
282 }
283
285 objectsInVicinity.Clear();
286
287 //3. Add objects from GetEntitiesInCone
289 //DebugConeDraw(playerPosition, VICINITY_CONE_ANGLE);
290
293 //filter unnecessary and duplicate objects beforehand
295 {
298
300 continue;
301
303 {
304 //Test distance to closest component first
306 rayInput.flags = CollisionFlags.NEARESTCONTACT;
308 rayInput.radius = 0.1;
310
312 {
314 continue;
315
316 if (result.hierLevel > 0 && result.parent == objectInCone)
318 else if (result.hierLevel == 0 && result.obj == objectInCone)
320 }
321 }
322 }
323
324 //4. Add large objects - particularly buildings and BaseBuildingBase
330 };
331
332 params.SetParams(playerPosition, headingDirection.VectorToAngles(), boxEdgeLength * 2, ObjIntersect.View, ObjIntersect.Fire, true);
334 if (GetGame().IsBoxCollidingGeometryProxy(params, {player}, results))
335 {
337 {
338 if (bResult.obj && (bResult.obj.CanObstruct() || bResult.obj.CanProxyObstruct()))
339 {
340 if (allFoundObjects.Find(bResult.obj) == INDEX_NOT_FOUND)
341 {
342 allFoundObjects.Insert(bResult.obj);
343 }
344 }
345
346 if (bResult.parent && (bResult.parent.CanObstruct() || bResult.parent.CanProxyObstruct()))
347 {
348 if (allFoundObjects.Find(bResult.parent) == INDEX_NOT_FOUND)
349 {
350 allFoundObjects.Insert(bResult.parent);
351 }
352 }
353 }
354 }
355
356 //5. Filter filtered objects with RayCast from the player ( head bone )
359
361 if (obstructingObjects.Count() > 0 && !cameraActive)
362 {
363 if (filteredObjects.Count() > 10)
364 {
366 MiscGameplayFunctions.GetHeadBonePos(player, rayStart);
367
370
371 foreach (Object object: filteredObjectsGrouped)
373 }
374 else
375 {
377 {
380
381 //distance check
383 {
385 {
386 continue;
387 }
388 }
389
391 {
393 }
394 }
395 }
396 }
397 else
398 {
401 }
402 }
void DayZPlayerUtils()
cannot be instantiated
Definition DayZPlayerUtils.c:465
Class that holds parameters to feed into CGame.IsBoxCollidingGeometryProxy.
Definition IsBoxCollidingGeometryProxyClasses.c:3
represents base for cargo storage for entities
Definition Cargo.c:7
Definition DayZPhysics.c:124
static proto bool RaycastRVProxy(notnull RaycastRVParams in, out notnull array< ref RaycastRVResult > results, array< Object > excluded=null)
Definition EnMath.c:7
Definition ObjectTyped.c:2
Definition DayZPhysics.c:50
Definition DayZPhysics.c:99
const float VICINITY_ACTOR_DISTANCE
Definition VicinityItemManager.c:5
bool IsObstructed(Object filtered_object)
Definition VicinityItemManager.c:404
bool ExcludeFromContainer_Phase3(Object object_in_cone)
Definition VicinityItemManager.c:177
bool ExcludeFromContainer_Phase2(Object object_in_radius)
Definition VicinityItemManager.c:153
void AddVicinityItems(Object object)
Definition VicinityItemManager.c:39
void AddVicinityCargos(CargoBase object)
Definition VicinityItemManager.c:68
bool ExcludeFromContainer_Phase1(Object actor_in_radius)
Definition VicinityItemManager.c:92
const float VICINITY_DISTANCE
Definition VicinityItemManager.c:4
const float VICINITY_CONE_ANGLE
Definition VicinityItemManager.c:9
const float VICINITY_LARGE_ACTOR_DISTANCE
Definition VicinityItemManager.c:6
const float VICINITY_CONE_DISTANCE
Definition VicinityItemManager.c:7
const float CONE_HEIGHT_MAX
Definition VicinityItemManager.c:15
const float CONE_HEIGHT_MIN
Definition VicinityItemManager.c:14
bool CanIgnoreDistanceCheck(EntityAI entity_ai)
Definition VicinityItemManager.c:203
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
CollisionFlags
Definition EnDebug.c:141
static proto float Cos(float angle)
Returns cosinus of angle in radians.
static const float DEG2RAD
Definition EnMath.c:17
static proto float Sin(float angle)
Returns sinus of angle in radians.

Перекрестные ссылки AddVicinityCargos(), AddVicinityItems(), CanIgnoreDistanceCheck(), Class::CastTo(), CONE_HEIGHT_MAX, CONE_HEIGHT_MIN, Math::Cos(), DayZPlayerUtils(), Math::DEG2RAD, vector::DistanceSq(), ExcludeFromContainer_Phase1(), ExcludeFromContainer_Phase2(), ExcludeFromContainer_Phase3(), GetGame(), GetPlayer(), INDEX_NOT_FOUND, IsObstructed(), m_VicinityCargos, m_VicinityItems, DayZPhysics::RaycastRVProxy(), Math::Sin(), VICINITY_ACTOR_DISTANCE, VICINITY_CONE_ANGLE, VICINITY_CONE_DISTANCE, VICINITY_CONE_REACH_DISTANCE, VICINITY_DISTANCE и VICINITY_LARGE_ACTOR_DISTANCE.

Используется в Update().

◆ ResetRefreshCounter()

void ResetRefreshCounter ( )
inlineprivate
77 {
79 }
float m_RefreshCounter
Definition VicinityItemManager.c:19

Перекрестные ссылки m_RefreshCounter.

◆ Update()

void Update ( float delta_time)
inlineprivate
82 {
84
86 {
89 }
90 }
void RefreshVicinityItems()
Definition VicinityItemManager.c:209
const float UPDATE_FREQUENCY
Definition VicinityItemManager.c:3

Перекрестные ссылки m_RefreshCounter, RefreshVicinityItems() и UPDATE_FREQUENCY.

Поля

◆ CE_CENTER

const string CE_CENTER = "ce_center"
private

◆ CONE_HEIGHT_MAX

const float CONE_HEIGHT_MAX = 3.0
private

Используется в RefreshVicinityItems().

◆ CONE_HEIGHT_MIN

const float CONE_HEIGHT_MIN = -0.5
private

Используется в RefreshVicinityItems().

◆ HEIGHT_OFFSET

const float HEIGHT_OFFSET = 0.2
private

◆ m_RefreshCounter

float m_RefreshCounter
private

Используется в ResetRefreshCounter() и Update().

◆ m_VicinityCargos

ref array<CargoBase> m_VicinityCargos = new array<CargoBase>()
private

◆ m_VicinityItems

ref array<EntityAI> m_VicinityItems = new array<EntityAI>()
private

◆ OBJECT_OBSTRUCTION_WEIGHT

const int OBJECT_OBSTRUCTION_WEIGHT = 10000
private

◆ s_Instance

ref VicinityItemManager s_Instance
staticprivate

Используется в GetInstance().

◆ UPDATE_FREQUENCY

const float UPDATE_FREQUENCY = 0.25
private

Используется в Update().

◆ VICINITY_ACTOR_DISTANCE

const float VICINITY_ACTOR_DISTANCE = 2.0
private

Используется в RefreshVicinityItems().

◆ VICINITY_CONE_ANGLE

const float VICINITY_CONE_ANGLE = 30
private

Используется в RefreshVicinityItems().

◆ VICINITY_CONE_DISTANCE

const float VICINITY_CONE_DISTANCE = 2.0
private

Используется в RefreshVicinityItems().

◆ VICINITY_CONE_RADIANS

const float VICINITY_CONE_RADIANS = 0.5
private

◆ VICINITY_CONE_REACH_DISTANCE

const float VICINITY_CONE_REACH_DISTANCE = 2.0
private

Используется в AddVicinityItems() и RefreshVicinityItems().

◆ VICINITY_DISTANCE

const float VICINITY_DISTANCE = 0.5
private

Используется в RefreshVicinityItems().

◆ VICINITY_LARGE_ACTOR_DISTANCE

const float VICINITY_LARGE_ACTOR_DISTANCE = 3.0
private

Используется в RefreshVicinityItems().


Объявления и описания членов класса находятся в файле: