DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
ActionBuildShelter.c
См. документацию.
1[Obsolete("1.30: driven by ActionBuildPart")]
3{
8
10 {
12 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_DEPLOY_2HD;
13 m_FullBody = true;
14 m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT | DayZPlayerConstants.STANCEMASK_CROUCH;
15 m_Text = "#build_shelter_leather";
16 }
17
22
24 {
27 }
28
29 override string GetText()
30 {
31 PlayerBase player = PlayerBase.Cast( GetGame().GetPlayer() );
32 if ( player )
33 {
34 ConstructionActionData construction_action_data = player.GetConstructionActionData();
35 ConstructionPart constrution_part = construction_action_data.GetBuildPartNoToolAtIndex(m_VariantID);
36
37 if ( constrution_part )
38 {
39 string ret = "";
40 switch (constrution_part.GetName())
41 {
42 case "leather":
43 ret = "#build_shelter_leather";
44 break;
45
46 case "fabric":
47 ret = "#build_shelter_fabric";
48 break;
49
50 case "stick":
51 ret = "#build_shelter_stick";
52 break;
53 }
54 }
55 }
56
57 return ret;
58 }
59
60 override void OnActionInfoUpdate( PlayerBase player, ActionTarget target, ItemBase item )
61 {
62 ConstructionActionData construction_action_data = player.GetConstructionActionData();
63 ConstructionPart constrution_part = construction_action_data.GetBuildPartNoToolAtIndex(m_VariantID);
64
65 if ( constrution_part )
66 {
67 switch (constrution_part.GetName())
68 {
69 case "leather":
70 m_Text = "#build_shelter_leather";
71 break;
72
73 case "fabric":
74 m_Text = "#build_shelter_fabric";
75 break;
76
77 case "stick":
78 m_Text = "#build_shelter_stick";
79 break;
80 }
81 }
82 }
83
84 override bool CanBeUsedLeaning()
85 {
86 return false;
87 }
88
89 override typename GetInputType()
90 {
92 }
93
94 override bool UseMainItem()
95 {
96 return false;
97 }
98
99 override bool HasProgress()
100 {
101 return true;
102 }
103
105 {
106 return false;
107 }
108
109 override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
110 {
111 //Action not allowed if player has broken legs
112 if (player.GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS)
113 return false;
114
115 if (target.GetObject() && !target.GetObject().CanUseConstructionBuild())
116 return false;
117 if ( player.IsPlacingLocal() || player.IsPlacingServer() )
118 return false;
119
120 if ( (!g_Game.IsDedicatedServer()) )
121 {
122 if ( MiscGameplayFunctions.ComplexBuildCollideCheckClient(player, target, item, m_VariantID ) )
123 {
124 return true;
125 }
126 return false;
127 }
128 return true;
129 }
130
131 //setup
132 override bool SetupAction( PlayerBase player, ActionTarget target, ItemBase item, out ActionData action_data, Param extra_data = NULL )
133 {
134 if ( super.SetupAction( player, target, item, action_data, extra_data ) )
135 {
136 if ( !g_Game.IsDedicatedServer() )
137 {
138 ConstructionActionData construction_action_data = action_data.m_Player.GetConstructionActionData();
139 BuildPartActionData.Cast(action_data).m_PartType = construction_action_data.GetBuildPartNoToolAtIndex(m_VariantID).GetPartName();
140 }
141 return true;
142 }
143
144 return false;
145 }
146
148 {
149 BuildPartActionData action_data = new BuildPartActionData;
150 return action_data;
151 }
152
153 override void WriteToContext(ParamsWriteContext ctx, ActionData action_data)
154 {
155 super.WriteToContext(ctx, action_data);
156
157 ctx.Write(BuildPartActionData.Cast(action_data).m_PartType);
158 }
159
160 override bool ReadFromContext(ParamsReadContext ctx, out ActionReciveData action_recive_data )
161 {
162 action_recive_data = new BuildPartActionReciveData;
163 super.ReadFromContext(ctx, action_recive_data);
164
165 string part_type;
166 if ( ctx.Read(part_type) )
167 {
168 BuildPartActionReciveData.Cast( action_recive_data ).m_PartType = part_type;
169 return true;
170 }
171 else
172 {
173 return false;
174 }
175 }
176
177 override void HandleReciveData(ActionReciveData action_recive_data, ActionData action_data)
178 {
179 super.HandleReciveData(action_recive_data, action_data);
180
181 BuildPartActionData.Cast(action_data).m_PartType = BuildPartActionReciveData.Cast( action_recive_data ).m_PartType;
182 }
183
184 override bool ActionConditionContinue( ActionData action_data )
185 {
186 BaseBuildingBase base_building = BaseBuildingBase.Cast( action_data.m_Target.GetObject() );
187 Construction construction = base_building.GetConstruction();
188 string part_name = BuildPartActionData.Cast(action_data).m_PartType;
189 CollisionCheckData check_data = new CollisionCheckData;
190
191 check_data.m_PartName = part_name;
192 check_data.m_AdditionalExcludes.Insert(action_data.m_Player);
193
194 return !construction.IsCollidingEx( check_data ) && construction.CanBuildPart( part_name, action_data.m_MainItem, false );
195 }
196
197 override void OnStart( ActionData action_data )
198 {
199 super.OnStart(action_data);
200 action_data.m_Player.TryHideItemInHands(true);
201 }
202
203 override void OnStartClient( ActionData action_data )
204 {
205 super.OnStartClient(action_data);
206
207 DetermineConstructionSounds(action_data);
208 PlayActionStartSound(action_data);
209 }
210
211 override void OnStartAnimationLoopClient( ActionData action_data )
212 {
213 super.OnStartAnimationLoopClient(action_data);
214
215 PlayActionLoopSound(action_data);
216 }
217
218 override void OnEnd( ActionData action_data )
219 {
220 super.OnEnd(action_data);
221 action_data.m_Player.TryHideItemInHands(false);
222 }
223
224 override void OnEndClient( ActionData action_data )
225 {
226 super.OnEndClient(action_data);
227
229 //DestroyActionLoopSound();
230 }
231
232 override void OnFinishProgressServer( ActionData action_data )
233 {
234 BaseBuildingBase base_building = BaseBuildingBase.Cast( action_data.m_Target.GetObject() );
235 Construction construction = base_building.GetConstruction();
236
237 string part_name = BuildPartActionData.Cast(action_data).m_PartType;
238
239 //build
240 construction.BuildPartServerEx( action_data.m_Player, part_name, AT_BUILD_PART );
241 }
242
243 override void OnFinishProgressClient( ActionData action_data )
244 {
245 super.OnFinishProgressClient(action_data);
246
247 PlayActionFinishSound(action_data);
248 }
249
251 {
252 ConstructionActionData construction_action_data = action_data.m_Player.GetConstructionActionData();
253 ConstructionPart constrution_part = construction_action_data.GetBuildPartNoToolAtIndex(m_VariantID);
254 if (constrution_part)
255 {
256 switch (constrution_part.GetName())
257 {
258 case "leather":
259 m_SoundsetBuildStart = "Shelter_Leather_Build_Start_SoundSet";
260 m_SoundsetBuildLoop = "Shelter_Leather_Build_Loop_SoundSet";
261 m_SoundsetBuildFinish = "Shelter_Leather_Build_Finish_SoundSet";
262 break;
263
264 case "fabric":
265 m_SoundsetBuildStart = "Shelter_Fabric_Build_Start_SoundSet";
266 m_SoundsetBuildLoop = "Shelter_Fabric_Build_Loop_SoundSet";
267 m_SoundsetBuildFinish = "Shelter_Fabric_Build_Finish_SoundSet";
268 break;
269
270 case "stick":
271 m_SoundsetBuildStart = "Shelter_Wooden_Stick_Build_Start_SoundSet";
272 m_SoundsetBuildLoop = "Shelter_Wooden_Stick_Build_Loop_SoundSet";
273 m_SoundsetBuildFinish = "Shelter_Wooden_Stick_Build_Finish_SoundSet";
274 break;
275
276 default:
280 break;
281 }
282 }
283 }
284
286 {
287 EffectSound sound = SEffectManager.PlaySound(m_SoundsetBuildStart, action_data.m_Target.GetObject().GetPosition());
288 sound.SetAutodestroy( true );
289 }
290
291 void PlayActionLoopSound( ActionData action_data )
292 {
293 if ( !m_BuildLoopSound || !m_BuildLoopSound.IsSoundPlaying() )
294 {
295 m_BuildLoopSound = SEffectManager.PlaySound( m_SoundsetBuildLoop, action_data.m_Target.GetObject().GetPosition(), 0, 0, true );
296 }
297 }
298
300 {
302 {
303 m_BuildLoopSound.SetSoundFadeOut(0.5);
304 m_BuildLoopSound.SoundStop();
305 }
306 }
307
312
314 {
315 EffectSound sound = SEffectManager.PlaySound(m_SoundsetBuildFinish, action_data.m_Target.GetObject().GetPosition());
316 sound.SetAutodestroy( true );
317 }
318
319 override string GetSoundCategory(ActionData action_data)
320 {
321 return "Base_building";
322 }
323}
324
326{
327 void BuildShelterFromShelterSiteLambda(EntityAI old_item, string new_item_type, PlayerBase player)
329 m_OldItem = old_item;
330 m_NewItemType = new_item_type;
332
333 override void CopyOldPropertiesToNew(notnull EntityAI old_item, EntityAI new_item)
334 {
335 super.CopyOldPropertiesToNew(old_item, new_item);
336
337 MiscGameplayFunctions.TransferItemProperties(old_item, new_item);
338 }
339}
class LogManager EntityAI
const int AT_BUILD_PART
bool m_FullBody
Определения ActionBase.c:60
string m_Text
Определения ActionBase.c:57
int m_VariantID
Определения ActionBase.c:67
ref CCIBase m_ConditionItem
Определения ActionBase.c:63
ref CCTBase m_ConditionTarget
Определения ActionBase.c:64
int m_StanceMask
Определения ActionBase.c:61
ActionBuildShelter ActionContinuousBase BuildShelterFromShelterSiteLambda(EntityAI old_item, string new_item_type, PlayerBase player)
Определения ActionBuildShelter.c:327
void ActionTarget(Object object, Object parent, int componentIndex, vector cursorHitPos, float utility, string surfaceName="")
Определения ActionTargets.c:125
void CollisionCheckData()
Определения ConstructionBase.c:1923
DayZGame g_Game
Определения DayZGame.c:4074
eBrokenLegs
Определения EBrokenLegs.c:2
PlayerBase GetPlayer()
Определения ModifierBase.c:51
void DetermineConstructionSounds(ActionData action_data)
Определения ActionBuildShelter.c:250
override bool UseMainItem()
Определения ActionBuildShelter.c:94
void StopActionLoopSound()
Определения ActionBuildShelter.c:299
void DestroyActionLoopSound()
Определения ActionBuildShelter.c:308
void PlayActionLoopSound(ActionData action_data)
Определения ActionBuildShelter.c:291
override string GetSoundCategory(ActionData action_data)
Определения ActionBuildShelter.c:319
override void WriteToContext(ParamsWriteContext ctx, ActionData action_data)
Определения ActionBuildShelter.c:153
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Определения ActionBuildShelter.c:109
string m_SoundsetBuildLoop
Определения ActionBuildShelter.c:5
override void OnEndClient(ActionData action_data)
Определения ActionBuildShelter.c:224
override void OnActionInfoUpdate(PlayerBase player, ActionTarget target, ItemBase item)
Определения ActionBuildShelter.c:60
void ~ActionBuildShelter()
Определения ActionBuildShelter.c:18
override bool ActionConditionContinue(ActionData action_data)
Определения ActionBuildShelter.c:184
string m_SoundsetBuildFinish
Определения ActionBuildShelter.c:6
override void OnStartAnimationLoopClient(ActionData action_data)
Определения ActionBuildShelter.c:211
override void OnEnd(ActionData action_data)
Определения ActionBuildShelter.c:218
override bool HasAlternativeInterrupt()
Определения ActionBuildShelter.c:104
override bool SetupAction(PlayerBase player, ActionTarget target, ItemBase item, out ActionData action_data, Param extra_data=NULL)
Определения ActionBuildShelter.c:132
override void OnStart(ActionData action_data)
Определения ActionBuildShelter.c:197
override void OnStartClient(ActionData action_data)
Определения ActionBuildShelter.c:203
override GetInputType()
Определения ActionBuildShelter.c:89
override bool CanBeUsedLeaning()
Определения ActionBuildShelter.c:84
void ActionBuildShelter()
Определения ActionBuildShelter.c:9
override void OnFinishProgressServer(ActionData action_data)
Определения ActionBuildShelter.c:232
override bool ReadFromContext(ParamsReadContext ctx, out ActionReciveData action_recive_data)
Определения ActionBuildShelter.c:160
void PlayActionStartSound(ActionData action_data)
Определения ActionBuildShelter.c:285
override void HandleReciveData(ActionReciveData action_recive_data, ActionData action_data)
Определения ActionBuildShelter.c:177
override void OnFinishProgressClient(ActionData action_data)
Определения ActionBuildShelter.c:243
override void CreateConditionComponents()
Определения ActionBuildShelter.c:23
override string GetText()
Определения ActionBuildShelter.c:29
EffectSound m_BuildLoopSound
Определения ActionBuildShelter.c:7
void PlayActionFinishSound(ActionData action_data)
Определения ActionBuildShelter.c:313
override ActionData CreateActionData()
Определения ActionBuildShelter.c:147
override bool HasProgress()
Определения ActionBuildShelter.c:99
string m_SoundsetBuildStart
Определения ActionBuildShelter.c:4
void ActionContinuousBase()
Определения ActionContinuousBase.c:124
PlayerBase m_Player
Определения ActionBase.c:40
ref ActionTarget m_Target
Определения ActionBase.c:39
ItemBase m_MainItem
Определения ActionBase.c:35
Определения ActionBase.c:22
int m_CommandUID
Определения AnimatedActionBase.c:147
Определения Fence.c:2
string m_PartType
Определения ActionBuildPart.c:3
Определения CCINone.c:2
Определения CCTCursor.c:2
override void BuildPartServerEx(Man player, string part_name, int action_id)
Определения Construction.c:52
ConstructionPart GetBuildPartNoToolAtIndex(int idx)
Определения ConstructionActionData.c:355
Used in BBB objects.
Определения Construction.c:3
string GetPartName()
Определения ConstructionPart.c:198
string GetName()
Определения ConstructionPart.c:193
Instanced construction part data classes for dynamic data, statics now stored on EntityType level in ...
Определения ConstructionPart.c:4
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
Определения EffectSound.c:607
Wrapper class for managing sound through SEffectManager.
Определения EffectSound.c:5
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Определения param.c:12
Определения PlayerBaseClient.c:2
void CopyOldPropertiesToNew(notnull EntityAI old_item, EntityAI new_item)
Step E. copy properties from old object to the created one.
Определения ReplaceItemWithNewLambdaBase.c:193
base class for transformation operations (creating one item from another)
Определения ReplaceItemWithNewLambdaBase.c:5
static EffectSound PlaySound(string sound_set, vector position, float play_fade_in=0, float stop_fade_out=0, bool loop=false)
Create and play an EffectSound.
Определения EffectManager.c:178
static void DestroyEffect(Effect effect)
Unregisters, stops and frees the Effect.
Определения EffectManager.c:280
Manager class for managing Effect (EffectParticle, EffectSound)
Определения EffectManager.c:6
proto bool Write(void value_out)
proto bool Read(void value_in)
DayZPlayerConstants
defined in C++
Определения dayzplayer.c:602
Serializer ParamsReadContext
Определения gameplay.c:15
Serializer ParamsWriteContext
Определения gameplay.c:16
DayZGame GetGame()
Определения gameplay.c:636
void Obsolete(string msg="")
Определения EnScript.c:371
proto void Insert(int index, string input)
Inserts a string into the n-th index, increasing the string length by the size of the input.