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

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

static bool IsAttachmentReachable (EntityAI e, string att_slot_name="", int slot_id=-1, float range=1.5)
 
static vector GetAttachmentPosition (EntityAI e, int slot_id)
 
map< int, vectorCreateAttachmentPosition (EntityAI entity)
 

Статические защищенные данные

static ref map< string, ref map< int, vector > > m_AttData
 

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

Методы

◆ CreateAttachmentPosition()

map< int, vector > CreateAttachmentPosition ( EntityAI entity)
inlinestaticprotected
81 {
83
84 string type_name = entity.GetType();
86
87 string cfg_path;
88
89 if ( GetGame().ConfigIsExisting(CFG_VEHICLESPATH+" "+type_name) )
90 {
91 cfg_path = CFG_VEHICLESPATH+" "+type_name+" attachments";
92 }
93 else if ( GetGame().ConfigIsExisting(CFG_WEAPONSPATH+" "+type_name) )
94 {
95 cfg_path = CFG_WEAPONSPATH+" "+type_name+" attachments";
96 }
97 else if ( GetGame().ConfigIsExisting(CFG_MAGAZINESPATH+" "+type_name) )
98 {
99 cfg_path = CFG_MAGAZINESPATH+" "+type_name+" attachments";
100 }
101
102 GetGame().ConfigGetTextArray(cfg_path, cfg_attachments);
103
104 int child_count = GetGame().ConfigGetChildrenCount("CfgNonAIVehicles");
105
106 for ( int x = 0; x < child_count; ++x )
107 {
108 string child_name;
109 GetGame().ConfigGetChildName("CfgNonAIVehicles",x , child_name);
110
111 string inventory_slot_name;
112 GetGame().ConfigGetText("CfgNonAIVehicles "+ child_name +" inventorySlot", inventory_slot_name);
113
114 if ( cfg_attachments.Find( inventory_slot_name ) > 0 )
115 {
116 string model_path;
117 GetGame().ConfigGetText("CfgNonAIVehicles "+ child_name +" model", model_path);
118
119 if ( model_path.Length() > 5 )
120 {
121 LOD lod = entity.GetLODByName(LOD.NAME_VIEW);
122
123 if ( lod )
124 {
125 model_path = model_path.Substring(0, model_path.Length() - 4);
126 model_path.ToLower();
127
129 lod.GetSelections(selections);
130
131 for ( int i = 0; i < selections.Count(); ++i )
132 {
133 string selection = selections[i].GetName();
134 selection.ToLower();
135
136 if ( selection.Contains(model_path) )
137 {
139 }
140 }
141 }
142 }
143 }
144 }
145
146 return ret_val;
147 }
Icon x
provides access to slot configuration
Definition InventorySlots.c:6
static proto native int GetSlotIdFromString(string slot_name)
converts string to slot_id
LOD class.
Definition gameplay.c:203
static const string NAME_VIEW
Definition gameplay.c:206
Definition EntityAI.c:95
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Definition IsBoxCollidingGeometryProxyClasses.c:28
proto native CGame GetGame()
array< string > TStringArray
Definition EnScript.c:685
const string CFG_VEHICLESPATH
Definition constants.c:217
const string CFG_WEAPONSPATH
Definition constants.c:218
const string CFG_MAGAZINESPATH
Definition constants.c:219
bool Contains(string sample)
Returns true if sample is substring of string.
Definition EnString.c:286
proto int ToLower()
Changes string to lowercase. Returns length.

Перекрестные ссылки CFG_MAGAZINESPATH, CFG_VEHICLESPATH, CFG_WEAPONSPATH, string::Contains(), GetGame(), InventorySlots::GetSlotIdFromString(), LOD::NAME_VIEW, string::ToLower() и x.

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

◆ GetAttachmentPosition()

static vector GetAttachmentPosition ( EntityAI e,
int slot_id )
inlinestaticprotected
62 {
63 if ( m_AttData == NULL )
64 {
66 }
67
68 string type_name = e.GetType();
69
70 if ( !m_AttData.Contains( type_name ) )
71 {
73
74 m_AttData.Insert( type_name, att );
75 }
76
77 return m_AttData.Get( type_name ).Get( slot_id );
78 }
static ref map< string, ref map< int, vector > > m_AttData
Definition AttachmentsOutOfReach.c:3
map< int, vector > CreateAttachmentPosition(EntityAI entity)
Definition AttachmentsOutOfReach.c:80

Перекрестные ссылки CreateAttachmentPosition() и m_AttData.

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

◆ IsAttachmentReachable()

static bool IsAttachmentReachable ( EntityAI e,
string att_slot_name = "",
int slot_id = -1,
float range = 1.5 )
inlinestaticprotected
6 {
7 if( !e.IgnoreOutOfReachCondition() )
8 {
10 if( player.IsInVehicle() )
11 {
12 return false;
13 }
14 else
15 {
16
18 if ( slot_id != -1 )
19 {
21 }
22 if( att_slot_name != "" )
23 {
24 if( e.MemoryPointExists(att_slot_name) )
25 {
26 vector mem_point = e.GetMemoryPointPos(att_slot_name);
27 pos_att = e.ModelToWorld(mem_point);
28 }
29 else
30 {
32 }
33
34 }
35
36 vector pos_player = player.GetPosition();
37
38 float height_diff = Math.AbsFloat( pos_player[1] - pos_att[1] );
39 if( height_diff < range )
40 {
41 pos_player[1] = 0;
42 pos_att[1] = 0;
44 {
45 return true;
46 }
47 return false;
48 }
49 else
50 {
51 return false;
52 }
53 }
54 }
55 else
56 {
57 return true;
58 }
59 }
PlayerBase GetPlayer()
Definition ModifierBase.c:51
static vector GetAttachmentPosition(EntityAI e, int slot_id)
Definition AttachmentsOutOfReach.c:61
static proto native owned string GetSlotName(int id)
converts slot_id to string
Definition EnMath.c:7
Definition PlayerBaseClient.c:2
Definition EnConvert.c:106
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
static proto float AbsFloat(float f)
Returns absolute value.

Перекрестные ссылки Math::AbsFloat(), vector::Distance(), GetAttachmentPosition(), GetGame(), GetPlayer(), InventorySlots::GetSlotIdFromString() и InventorySlots::GetSlotName().

Используется в Icon::MouseClick(), AttachmentCategoriesRow::RefreshSlot(), Attachments::Select(), UpdateConsoleToolbar() и Attachments::UpdateInterval().

Поля

◆ m_AttData

ref map<string, ref map<int, vector> > m_AttData
staticprotected

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


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