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

◆ IsAttachmentReachable()

static bool AttachmentsOutOfReach::IsAttachmentReachable ( EntityAI e,
string att_slot_name = "",
int slot_id = -1,
float range = 1.5 )
inlinestaticprotected

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

6 {
7 if( !e.IgnoreOutOfReachCondition() )
8 {
9 PlayerBase player = PlayerBase.Cast( GetGame().GetPlayer() );
10 if( player.IsInVehicle() )
11 {
12 return false;
13 }
14 else
15 {
16
17 vector pos_att;
18 if ( slot_id != -1 )
19 {
20 att_slot_name = InventorySlots.GetSlotName(slot_id);
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 {
31 pos_att = e.ModelToWorld(GetAttachmentPosition(e, InventorySlots.GetSlotIdFromString( att_slot_name ) ));
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;
43 if ( vector.Distance(pos_player, pos_att) <= range )
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()
Определения ModifierBase.c:51
static vector GetAttachmentPosition(EntityAI e, int slot_id)
Определения AttachmentsOutOfReach.c:61
proto native CGame GetGame()

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

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