DayZ 1.24
Loading...
Searching...
No Matches
ActionEnterLadder Class Reference
Inheritance diagram for ActionEnterLadder:
[legend]
Collaboration diagram for ActionEnterLadder:
[legend]

Private Member Functions

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

Private Attributes

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

Detailed Description

Definition at line 2 of file ActionEnterLadder.c.

Constructor & Destructor Documentation

◆ ActionEnterLadder()

void ActionEnterLadder::ActionEnterLadder ( )
inlineprivate

Definition at line 7 of file ActionEnterLadder.c.

8 {
9 m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_ERECT;
10 m_Text = "#enter_ladder";
11 }
string m_Text
Definition ActionBase.c:49
int m_StanceMask
Definition ActionBase.c:53
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597

References m_StanceMask, and m_Text.

Member Function Documentation

◆ ActionCondition()

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

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

Definition at line 19 of file ActionEnterLadder.c.

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 return false;
43
44 // ze stringu compName dostat posledni cislo a to je index zebriku
45
46 //building.GetActionComponentNameList( action_data.m_Target.GetComponentIndex(), components );
47
48 string condCompName = string.Format("%1_con", compName);
49 vector pos = player.GetPosition();
50 //Print(w);
51 bool found = false;
54 float minDistanceSq = 100.0;
55
56 string dirCompName = string.Format("%1_con_dir", compName);
57
58 for (int i = 0; i < memSelection.Count(); i++)
59 {
61 {
62
63 for (int j = 0; j < memSelection[i].GetVertexCount(); j++)
64 {
65 ladderEnterPointGlobal = building.ModelToWorld(memSelection[i].GetVertexPosition(lod, j));
67 {
69 found = true;
70 break;
71 }
72 }
73 }
74 }
75
76 if (found)
77 {
78 for (int k = 0; k < memSelection.Count(); k++)
79 {
81 {
82 for (int l = 0; l < memSelection[k].GetVertexCount(); l++)
83 {
84 vector dirPoint = building.ModelToWorld(memSelection[k].GetVertexPosition(lod, l));
86 if (dst < minDistanceSq)
87 {
90 //HumanCommandLadder.DebugDrawLadder(building, HumanCommandLadder.DebugGetLadderIndex(compName));
91 //found = true;
92 }
93 }
94 }
95 }
96
97 pos = pos - ladderEnterPointGlobal;
99
100 float angle = Math.AbsFloat(pos.VectorToAngles()[0] - ladderDirPointGlobal.VectorToAngles()[0]);
101
102 if (angle < 90 || angle > 270)
103 return true;
104 }
105
106 return false;
107 }
const string MEM_LOD_NAME
Super root of all classes in Enforce script.
Definition EnScript.c:11
proto static native bool DebugDrawLadder(Building pBuilding, int pLadderIndex)
debug draws any ladder
proto static native int DebugGetLadderIndex(string pComponentName)
LOD class.
Definition gameplay.c:203
Definition EnMath.c:7
const float LADDERS
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()

References Math::AbsFloat(), Class::CastTo(), HumanCommandLadder::DebugDrawLadder(), HumanCommandLadder::DebugGetLadderIndex(), vector::DistanceSq(), GetName(), UAMaxDistances::LADDERS, MEM_LOD_NAME, and vector::VectorToAngles().

◆ CanBeUsedSwimming()

override bool ActionEnterLadder::CanBeUsedSwimming ( )
inlineprivate

Definition at line 205 of file ActionEnterLadder.c.

206 {
207 return true;
208 }

◆ CreateConditionComponents()

override void ActionEnterLadder::CreateConditionComponents ( )
inlineprivate

Definition at line 13 of file ActionEnterLadder.c.

14 {
17 }
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56

References m_ConditionItem, and m_ConditionTarget.

◆ IsInstant()

override bool ActionEnterLadder::IsInstant ( )
inlineprivate

Definition at line 195 of file ActionEnterLadder.c.

196 {
197 return true;
198 }

◆ Start()

override void ActionEnterLadder::Start ( ActionData action_data)
inlineprivate

Definition at line 109 of file ActionEnterLadder.c.

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

References Class::CastTo(), HumanCommandLadder::DebugGetLadderIndex(), and GEOM_LOD_NAME.

◆ UseAcknowledgment()

override bool ActionEnterLadder::UseAcknowledgment ( )
inlineprivate

Definition at line 200 of file ActionEnterLadder.c.

201 {
202 return false;
203 }

Member Data Documentation

◆ GEOM_LOD_NAME

const string ActionEnterLadder::GEOM_LOD_NAME = LOD.NAME_GEOMETRY
private

Definition at line 4 of file ActionEnterLadder.c.

Referenced by Start().

◆ MEM_LOD_NAME

const string ActionEnterLadder::MEM_LOD_NAME = LOD.NAME_MEMORY
private

Definition at line 5 of file ActionEnterLadder.c.

Referenced by ActionCondition().


The documentation for this class was generated from the following file: