DayZ 1.26
DayZ Explorer by KGB
Загрузка...
Поиск...
Не найдено
Класс ActionEnterLadder
+ Граф наследования:ActionEnterLadder:

Закрытые члены

void ActionEnterLadder ()
 
override void CreateConditionComponents ()
 
override bool ActionCondition (PlayerBase player, ActionTarget target, ItemBase item)
 
override void Start (ActionData action_data)
 
override bool IsLockTargetOnUse ()
 
override bool IsInstant ()
 
override bool CanBeUsedSwimming ()
 

Закрытые данные

const string GEOM_LOD_NAME = LOD.NAME_GEOMETRY
 
const string MEM_LOD_NAME = LOD.NAME_MEMORY
 

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

Конструктор(ы)

◆ ActionEnterLadder()

void ActionEnterLadder ( )
inlineprivate
8 {
9 m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_ERECT;
10 m_Text = "#enter_ladder";
11 }
string m_Text
Definition ActionBase.c:58
int m_StanceMask
Definition ActionBase.c:62
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602

Перекрестные ссылки ActionBase::m_StanceMask и ActionBase::m_Text.

Методы

◆ ActionCondition()

override bool ActionCondition ( PlayerBase player,
ActionTarget target,
ItemBase item )
inlineprivate

is action_data.m_Target ? not on ladder and not falling ?

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 // TODO: direction tests
30 // Get memory LOD from p3d and save all its selections
31 LOD lod = building.GetLODByName(MEM_LOD_NAME);
32 if(lod == NULL)
33 return false;
34
36 if(!lod.GetSelections(memSelection))
37 return false;
38
40 string compName = building.GetActionComponentName( target.GetComponentIndex() );
41 if( compName.Length() < 6 || compName.Substring(0,6) != "ladder" )
42 {
43 return false;
44 }
45
46 // ze stringu compName dostat posledni cislo a to je index zebriku
47
48 //building.GetActionComponentNameList( action_data.m_Target.GetComponentIndex(), components );
49
50 string condCompName = string.Format("%1_con", compName);
51 vector pos = player.GetPosition();
52 //Print(w);
53 bool found = false;
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 {
63 {
64
65 for( int j = 0; j < memSelection[i].GetVertexCount(); j++ )
66 {
67 ladderEnterPointGlobal = building.ModelToWorld( memSelection[i].GetVertexPosition(lod, j) );
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 {
83 {
84 for( int l = 0; l < memSelection[k].GetVertexCount(); l++ )
85 {
86 vector dirPoint = building.ModelToWorld( memSelection[k].GetVertexPosition(lod, l) );
88 if( dst < minDistanceSq)
89 {
92 //HumanCommandLadder.DebugDrawLadder(building, HumanCommandLadder.DebugGetLadderIndex(compName));
93 //found = true;
94 }
95 }
96 }
97 }
98
99 pos = pos - ladderEnterPointGlobal;
101
102 float angle = Math.AbsFloat(pos.VectorToAngles()[0] - ladderDirPointGlobal.VectorToAngles()[0]);
103
104 if ( angle < 90 || angle > 270)
105 {
106 return true;
107 }
108 }
109
110 return false;
111 }
const string MEM_LOD_NAME
Definition ActionEnterLadder.c:5
Super root of all classes in Enforce script.
Definition EnScript.c:11
Definition human.c:645
proto static native int DebugGetLadderIndex(string pComponentName)
proto static native bool DebugDrawLadder(Building pBuilding, int pLadderIndex)
debug draws any ladder
LOD class.
Definition gameplay.c:203
Definition EnMath.c:7
Definition EntityAI.c:95
Definition ActionConstants.c:106
const float LADDERS
Definition ActionConstants.c:111
Definition EnConvert.c:106
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
proto vector VectorToAngles()
Converts vector to spherical coordinates with radius = 1.
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static proto float AbsFloat(float f)
Returns absolute value.
proto native owned string GetName()
Definition SyncedValue.c:119

Перекрестные ссылки Math::AbsFloat(), Class::CastTo(), HumanCommandLadder::DebugDrawLadder(), HumanCommandLadder::DebugGetLadderIndex(), vector::DistanceSq(), GetName(), UAMaxDistances::LADDERS, MEM_LOD_NAME и vector::VectorToAngles().

◆ CanBeUsedSwimming()

override bool CanBeUsedSwimming ( )
inlineprivate
211 {
212 return true;
213 }

◆ CreateConditionComponents()

override void CreateConditionComponents ( )
inlineprivate
14 {
17 }
ref CCIBase m_ConditionItem
Definition ActionBase.c:64
ref CCTBase m_ConditionTarget
Definition ActionBase.c:65
Definition CCINone.c:2
Definition CCTCursor.c:2

Перекрестные ссылки ActionBase::m_ConditionItem и ActionBase::m_ConditionTarget.

◆ IsInstant()

override bool IsInstant ( )
inlineprivate
205 {
206 return true;
207
208 }

◆ IsLockTargetOnUse()

override bool IsLockTargetOnUse ( )
inlineprivate
200 {
201 return false;
202 }

◆ Start()

override void Start ( ActionData action_data)
inlineprivate
114 {
115 super.Start( action_data );
116 Building b;
117 Class.CastTo(b, action_data.m_Target.GetObject());
118
119 if (b)
120 {
121 string compName = b.GetActionComponentName( action_data.m_Target.GetComponentIndex() );
123
124 LOD geomLod = action_data.m_Target.GetObject().GetLODByName(GEOM_LOD_NAME);
125 string ladderType = "metal";
126
127 for (int i = 0; i < geomLod.GetPropertyCount(); ++i)
128 {
129 if (geomLod.GetPropertyName(i) == "laddertype")
130 {
131 ladderType = geomLod.GetPropertyValue(i);
132 break;
133 }
134 }
135
136 action_data.m_Player.SetClimbingLadderType(ladderType);
137 action_data.m_Player.StartCommand_Ladder(b, ladderIndex );
138 }
139
140
141 /* if( GetGame().IsServer() )
142 {
143 OnStartServer(action_data);
144 }
145 else
146 {
147 OnStartClient(action_data);
148 }*/
149 }
const string GEOM_LOD_NAME
Definition ActionEnterLadder.c:4

Перекрестные ссылки Class::CastTo(), HumanCommandLadder::DebugGetLadderIndex() и GEOM_LOD_NAME.

Поля

◆ GEOM_LOD_NAME

const string GEOM_LOD_NAME = LOD.NAME_GEOMETRY
private

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

◆ MEM_LOD_NAME

const string MEM_LOD_NAME = LOD.NAME_MEMORY
private

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


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