20 {
22 if (!target || !target.GetObject() || player.GetCommand_Ladder() || player.GetCommand_Fall() )
23 return false;
24
25 Building building;
26 if (!Class.CastTo(building, target.GetObject()))
27 return false;
28
29
30
32 if(lod == NULL)
33 return false;
34
35 array<Selection> memSelection = new array<Selection>();
37 return false;
38
40 string compName = building.GetActionComponentName( target.GetComponentIndex() );
42 {
43 return false;
44 }
45
46
47
48
49
50 string condCompName = string.Format("%1_con", compName);
51 vector pos = player.GetPosition();
52
53 bool found = false;
54 vector ladderEnterPointGlobal;
55 vector ladderDirPointGlobal;
56 float minDistanceSq = 100.0;
57
58 string dirCompName = string.Format("%1_con_dir", compName);
59
60 for ( int i = 0; i < memSelection.Count(); i++ )
61 {
62 if ( memSelection[i].
GetName() == condCompName )
63 {
64
65 for( int j = 0; j < memSelection[i].GetVertexCount(); j++ )
66 {
67 ladderEnterPointGlobal = building.ModelToWorld( memSelection[i].GetVertexPosition(lod, j) );
68 if( vector.DistanceSq(ladderEnterPointGlobal,pos) < UAMaxDistances.LADDERS * UAMaxDistances.LADDERS)
69 {
71 found = true;
72 break;
73 }
74 }
75 }
76 }
77
78 if (found)
79 {
80 for (int k = 0; k < memSelection.Count(); k++)
81 {
82 if( memSelection[k].
GetName() == dirCompName )
83 {
84 for( int l = 0; l < memSelection[k].GetVertexCount(); l++ )
85 {
86 vector dirPoint = building.ModelToWorld( memSelection[k].GetVertexPosition(lod, l) );
87 float dst = vector.DistanceSq(ladderEnterPointGlobal,dirPoint);
88 if( dst < minDistanceSq)
89 {
90 minDistanceSq = dst;
91 ladderDirPointGlobal = dirPoint;
92
93
94 }
95 }
96 }
97 }
98
99 pos = pos - ladderEnterPointGlobal;
100 ladderDirPointGlobal = ladderDirPointGlobal - ladderEnterPointGlobal;
101
103
104 if ( angle < 90 || angle > 270)
105 {
106 return true;
107 }
108 }
109
110 return false;
111 }
const string MEM_LOD_NAME
proto native bool GetSelections(notnull out array< Selection > selections)
proto vector VectorToAngles()
Converts vector to spherical coordinates with radius = 1.
proto native int Length()
Returns length of string.
proto string Substring(int start, int len)
Substring of 'str' from 'start' position 'len' number of characters.
void HumanCommandLadder()