6 {
7 if( !e.IgnoreOutOfReachCondition() )
8 {
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 }
static vector GetAttachmentPosition(EntityAI e, int slot_id)
proto native CGame GetGame()