DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
ActionRepackTent.c
См. документацию.
2{
3 override void CreateActionComponent()
4 {
5 m_ActionData.m_ActionComponent = new CAContinuousTime( UATimeSpent.UNPACK );
6 }
7
9 {
10 vector orientation = m_ActionData.m_Player.GetOrientation();
11 vector position = m_ActionData.m_Player.GetPosition() + m_ActionData.m_Player.GetDirection();
12 vector rotation_matrix[3];
13 float direction[4];
15 InventoryLocation destination = new InventoryLocation;
16
17 Math3D.YawPitchRollMatrix( orientation, rotation_matrix );
18 Math3D.MatrixToQuat( rotation_matrix, direction );
19
20 vector ground_position = position;
21 ground_position[1] = GetGame().SurfaceY(ground_position[0],ground_position[2]);
22
23 if ( vector.DistanceSq( m_ActionData.m_Player.GetPosition(), ground_position ) > UAMaxDistances.DEFAULT * UAMaxDistances.DEFAULT)
24 {
25 if ( m_ActionData.m_MainItem.GetInventory().GetCurrentInventoryLocation( source ) )
26 {
27 destination.SetGroundEx( m_ActionData.m_MainItem, position, direction );
28 m_ActionData.m_Player.PredictiveTakeToDst(source, destination);
29 }
30 }
31 else
32 {
33 if ( m_ActionData.m_MainItem.GetInventory().GetCurrentInventoryLocation( source ) )
34 {
35 destination.SetGroundEx( m_ActionData.m_MainItem, ground_position, direction );
36 m_ActionData.m_Player.PredictiveTakeToDst(source, destination);
37 }
38 }
39 }
40};
41
44{
47
49 {
51 m_SpecialtyWeight = UASoftSkillsWeight.PRECISE_LOW;
52 m_CommandUID = 0;
53 m_FullBody = true;
54 m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_ERECT;
55 m_Text = "#repack_tent";
56 }
57
59 {
62 }
63
64 override bool HasTarget()
65 {
66 return false;
67 }
68
69 override bool HasProgress()
70 {
71 return true;
72 }
73
74 override bool ActionConditionContinue( ActionData action_data )
75 {
76 return true;
77 }
78
80 {
81 return true;
82 }
83
84 override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
85 {
86 if ( !player.IsPlacingLocal() )
87 {
88 return true;
89 }
90 return false;
91 }
92
93 override bool SetupAction(PlayerBase player, ActionTarget target, ItemBase item, out ActionData action_data, Param extra_data = NULL)
94 {
95 SetupAnimation( item );
96
97 if ( super.SetupAction(player, target, item, action_data, extra_data ))
98 {
99 return true;
100 }
101 return false;
102 }
103
104 override void OnStartServer( ActionData action_data )
105 {
106 super.OnStartServer(action_data);
107
108 m_RepackedEntity = null;
109 m_IsFinished = false;
110 }
111
112 override void OnFinishProgressServer( ActionData action_data )
113 {
114 Param1<bool> play = new Param1<bool>( false );
115 GetGame().RPCSingleParam( action_data.m_MainItem, SoundTypeTent.REPACK, play, true );
116
117 m_IsFinished = true;
118 }
119
120 override void OnEndServer( ActionData action_data )
121 {
122 super.OnEndServer(action_data);
123
124 if ( m_IsFinished )
125 {
126 if ( action_data.m_MainItem.IsInherited( TentBase ) )
127 {
128 RepackLambda lambda_back_pack = new RepackLambda(action_data.m_MainItem, "LargeTentBackPack", action_data.m_Player);
129 action_data.m_Player.ServerReplaceItemElsewhereWithNewInHands(lambda_back_pack);
130 }
131
132 if ( action_data.m_MainItem.IsInherited( Clothing ) )
133 {
134 RepackLambda lambda_tent = new RepackLambda(action_data.m_MainItem, "LargeTent", action_data.m_Player);
135 action_data.m_Player.ServerReplaceItemElsewhereWithNewInHands(lambda_tent);
136 }
137 }
138 else
139 {
140 if ( GetGame().IsMultiplayer() )
141 {
142 if ( action_data.m_MainItem )
143 {
144 action_data.m_Player.ServerTakeEntityToHands( action_data.m_MainItem );
145 }
146 }
147 else
148 {
149 if ( action_data.m_MainItem )
150 {
151 action_data.m_Player.LocalTakeEntityToHands( action_data.m_MainItem );
152 }
153 }
154 }
155 }
156
158 {
159 if ( item.IsHeavyBehaviour() )
160 {
161 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_DEPLOY_HEAVY;
162 }
163 else if ( item.IsOneHandedBehaviour() )
164 {
165 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_DEPLOY_1HD;
166 }
167 else if ( item.IsTwoHandedBehaviour() )
168 {
169 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_DEPLOY_2HD;
170 }
171 else
172 {
173 Print("Error: check " + item + " behaviour");
174 }
175 }
176
177 override void OnStartAnimationLoopClient( ActionData action_data )
178 {
179 if ( action_data.m_Player.GetItemInHands() )
180 ActionRepackTentCB.Cast(action_data.m_Callback).DropDuringRepacking();
181 }
182
183 override void OnStartAnimationLoopServer( ActionData action_data )
184 {
185 Param1<bool> play = new Param1<bool>( false );
186 if ( !GetGame().IsMultiplayer() )
187 {
188 if ( action_data.m_Player.GetItemInHands() )
189 ActionRepackTentCB.Cast(action_data.m_Callback).DropDuringRepacking();
190 }
191
192 if ( action_data.m_Player.GetItemInHands() )
193 {
194 play = new Param1<bool>( true );
195 GetGame().RPCSingleParam( action_data.m_MainItem, SoundTypeTent.REPACK, play, true );
196 }
197 }
198
199 override void OnEndAnimationLoop( ActionData action_data )
200 {
201 if ( !GetGame().IsMultiplayer() || GetGame().IsServer() )
202 {
203 Param1<bool> play = new Param1<bool>( false );
204 GetGame().RPCSingleParam( action_data.m_MainItem, SoundTypeTent.REPACK, play, true );
205 }
206 }
207
208 override string GetAdminLogMessage(ActionData action_data)
209 {
210 return " re-packed " + action_data.m_Target.GetObject().GetDisplayName() + " with Hands ";
211 }
212};
213
215{
217
218 void RepackLambda (EntityAI old_item, string new_item_type, PlayerBase player)
219 {
221 hands.SetHands( player, null );
222 OverrideNewLocation( hands );
223 }
224};
ActionBase ActionData
Определения ActionBase.c:30
class ActionTargets ActionTarget
SoundTypeTent
Определения LargeTent.c:2
float m_SpecialtyWeight
Определения ActionBase.c:77
int m_StanceMask
Определения ActionBase.c:62
string m_Text
Определения ActionBase.c:58
ref CCIBase m_ConditionItem
Определения ActionBase.c:64
bool m_FullBody
Определения ActionBase.c:61
ref CCTBase m_ConditionTarget
Определения ActionBase.c:65
ActionData m_ActionData
Определения AnimatedActionBase.c:3
void ActionContinuousBase()
Определения ActionContinuousBase.c:124
override string GetAdminLogMessage(ActionData action_data)
Определения ActionRepackTent.c:208
void ActionRepackTent()
Определения ActionRepackTent.c:48
override bool SetupAction(PlayerBase player, ActionTarget target, ItemBase item, out ActionData action_data, Param extra_data=NULL)
Определения ActionRepackTent.c:93
override void OnFinishProgressServer(ActionData action_data)
Определения ActionRepackTent.c:112
override void OnStartAnimationLoopClient(ActionData action_data)
Определения ActionRepackTent.c:177
override void OnStartAnimationLoopServer(ActionData action_data)
Определения ActionRepackTent.c:183
bool m_IsFinished
Определения ActionRepackTent.c:46
override void CreateConditionComponents()
Определения ActionRepackTent.c:58
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Определения ActionRepackTent.c:84
override void OnStartServer(ActionData action_data)
Определения ActionRepackTent.c:104
void SetupAnimation(ItemBase item)
Определения ActionRepackTent.c:157
override bool HasTarget()
Определения ActionRepackTent.c:64
override bool ActionConditionContinue(ActionData action_data)
Определения ActionRepackTent.c:74
override bool HasAlternativeInterrupt()
Определения ActionRepackTent.c:79
override void OnEndServer(ActionData action_data)
Определения ActionRepackTent.c:120
override void OnEndAnimationLoop(ActionData action_data)
Определения ActionRepackTent.c:199
EntityAI m_RepackedEntity
Определения ActionRepackTent.c:45
override bool HasProgress()
Определения ActionRepackTent.c:69
void DropDuringRepacking()
Определения ActionRepackTent.c:8
override void CreateActionComponent()
Определения ActionRepackTent.c:3
int m_CommandUID
Определения AnimatedActionBase.c:143
Определения CCINone.c:2
Определения CCTNone.c:2
proto native float SurfaceY(float x, float z)
proto native void RPCSingleParam(Object target, int rpc_type, Param param, bool guaranteed, PlayerIdentity recipient=null)
see CGame.RPC
Определения Armband_ColorBase.c:2
Определения Building.c:6
proto native void SetHands(notnull EntityAI parent, EntityAI e)
sets current inventory location type to Hands
proto native void SetGroundEx(EntityAI e, vector pos, float dir[4])
sets current inventory location type to Ground with transformation mat
InventoryLocation.
Определения InventoryLocation.c:29
Определения InventoryItem.c:731
Определения EnMath3D.c:28
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Определения param.c:12
Определения PlayerBaseClient.c:2
EntityAI m_RepackedNewEntity
Определения ActionRepackTent.c:216
void RepackLambda(EntityAI old_item, string new_item_type, PlayerBase player)
Определения ActionRepackTent.c:218
Определения ActionRepackTent.c:215
Определения CarTent.c:2
const float DEFAULT
Определения ActionConstants.c:112
const float UNPACK
Определения ActionConstants.c:86
Определения ActionConstants.c:28
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
Определения EnConvert.c:106
DayZPlayerConstants
defined in C++
Определения dayzplayer.c:602
proto native CGame GetGame()
proto void Print(void var)
Prints content of variable to console/log.
static proto void MatrixToQuat(vector mat[3], out float d[4])
Converts rotation matrix to quaternion.
static proto void YawPitchRollMatrix(vector ang, out vector mat[3])
Creates rotation matrix from angles.