4 private const string GEOM_LOD_NAME =
LOD.NAME_GEOMETRY;
5 private const string MEM_LOD_NAME =
LOD.NAME_MEMORY;
13 override void CreateConditionComponents()
22 if (!target || !target.GetObject() || player.GetCommand_Ladder() || player.GetCommand_Fall() )
26 if (!
Class.CastTo(building, target.GetObject()))
31 LOD lod = building.GetLODByName(MEM_LOD_NAME);
36 if(!lod.GetSelections(memSelection))
40 string compName = building.GetActionComponentName( target.GetComponentIndex() );
41 if( compName.Length() < 6 || compName.Substring(0,6) !=
"ladder" )
50 string condCompName =
string.Format(
"%1_con", compName);
51 vector pos = player.GetPosition();
54 vector ladderEnterPointGlobal;
55 vector ladderDirPointGlobal;
56 float minDistanceSq = 100.0;
58 string dirCompName =
string.Format(
"%1_con_dir", compName);
60 for (
int i = 0; i < memSelection.Count(); i++ )
62 if ( memSelection[i].
GetName() == condCompName )
65 for(
int j = 0; j < memSelection[i].GetVertexCount(); j++ )
67 ladderEnterPointGlobal = building.ModelToWorld( memSelection[i].GetVertexPosition(lod, j) );
80 for (
int k = 0; k < memSelection.Count(); k++)
82 if( memSelection[k].
GetName() == dirCompName )
84 for(
int l = 0; l < memSelection[k].GetVertexCount(); l++ )
86 vector dirPoint = building.ModelToWorld( memSelection[k].GetVertexPosition(lod, l) );
87 float dst =
vector.DistanceSq(ladderEnterPointGlobal,dirPoint);
88 if( dst < minDistanceSq)
91 ladderDirPointGlobal = dirPoint;
99 pos = pos - ladderEnterPointGlobal;
100 ladderDirPointGlobal = ladderDirPointGlobal - ladderEnterPointGlobal;
102 float angle =
Math.AbsFloat(pos.VectorToAngles()[0] - ladderDirPointGlobal.VectorToAngles()[0]);
104 if ( angle < 90 || angle > 270)
115 super.Start( action_data );
117 Class.CastTo(b, action_data.m_Target.GetObject());
121 string compName = b.GetActionComponentName( action_data.m_Target.GetComponentIndex() );
124 LOD geomLod = action_data.m_Target.GetObject().GetLODByName(GEOM_LOD_NAME);
125 string ladderType =
"metal";
127 for (
int i = 0; i < geomLod.GetPropertyCount(); ++i)
129 if (geomLod.GetPropertyName(i) ==
"laddertype")
131 ladderType = geomLod.GetPropertyValue(i);
136 action_data.m_Player.SetClimbingLadderType(ladderType);
137 action_data.m_Player.StartCommand_Ladder(b, ladderIndex );
199 override bool IsInstant()
204 override bool UseAcknowledgment()
209 override bool CanBeUsedSwimming()