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

◆ ActionCondition()

override bool ActionDigInStash::ActionCondition ( PlayerBase player,
ActionTarget target,
ItemBase item )
inlineprivate

was initialized from inventory?

Check slope angle

См. определение в файле ActionDigInStash.c строка 37

38 {
39 ItemBase targetIB;
40 if (Class.CastTo(targetIB, target.GetObject()) && targetIB.CanBeDigged())
41 {
42 if (player.IsPlacingLocal())
43 {
44 return false;
45 }
46
47 if (targetIB.IsRuined() || targetIB.GetInventory().IsAttachment())
48 {
49 return false;
50 }
51
52 if (targetIB.GetInventory().IsAttachment())
53 {
54 return false;
55 }
56
57 if (targetIB.IsInherited(UndergroundStash))
58 {
59 return false;
60 }
61
63 EntityAI entityToCheck = targetIB;
64 if (targetIB.GetInventory().IsInCargo())
65 entityToCheck = player;
66
67 // here we check if a stash is nearby and block digging a new one in close proximity
68 array<Object> excludedObjects = new array<Object>();
69 excludedObjects.Insert(targetIB);
70 array<Object> nearbyObjects = new array<Object>();
71 // For now we exclude an area of 2 X 2 X 2 meters
72 if (GetGame().IsBoxColliding(entityToCheck.GetPosition(), entityToCheck.GetOrientation(), "2 2 2", excludedObjects, nearbyObjects))
73 {
74 foreach (Object nearbyObject : nearbyObjects)
75 {
76 if (nearbyObject.IsInherited(UndergroundStash))
77 return false;
78 }
79 }
80
81 // Check surface
82 int liquidType;
83 string surfaceType;
84 GetGame().SurfaceUnderObject(entityToCheck, surfaceType, liquidType);
85 if (!GetGame().IsSurfaceDigable(surfaceType))
86 {
87 return false;
88 }
89 else
90 {
92 vector position = entityToCheck.GetPosition();
93
94 array<vector> positions = new array<vector>;
95 positions.Insert(position + "0.5 0 0.5");
96 positions.Insert(position + "-0.5 0 0.5");
97 positions.Insert(position + "0.5 0 -0.5");
98 positions.Insert(position + "-0.5 0 -0.5");
99
100 float difference = GetGame().GetHighestSurfaceYDifference(positions);
101
102 return difference < m_DigStashSlopeTolerance;
103 }
104 }
105
106 return false;
107 }
class LogManager EntityAI
class GP5GasMask extends MaskBase ItemBase
static float m_DigStashSlopeTolerance
Определения ActionDigInStash.c:11
float GetHighestSurfaceYDifference(array< vector > positions)
Returns the largest height difference between the given positions.
Определения Game.c:1119
proto void SurfaceUnderObject(notnull Object object, out string type, out int liquidType)
class LOD Object
proto native CGame GetGame()

Перекрестные ссылки ActionTarget, Class::CastTo(), GetGame(), CGame::GetHighestSurfaceYDifference(), m_DigStashSlopeTolerance и CGame::SurfaceUnderObject().