DayZ 1.26
DayZ Explorer by KGB
Загрузка...
Поиск...
Не найдено
Файл ActionBuildPart.c

См. исходные тексты.

Структуры данных

class  BuildPartActionReciveData
 
class  ActionBuildPartCB
 
class  ActionBuildPart
 

Функции

ActionBuildPart ActionContinuousBase GetInputType ()
 
void ActionBuildPart ()
 
override void CreateConditionComponents ()
 
override void OnActionInfoUpdate (PlayerBase player, ActionTarget target, ItemBase item)
 
override bool CanBeUsedLeaning ()
 
override bool CanBeUsedInFreelook ()
 
override bool ActionCondition (PlayerBase player, ActionTarget target, ItemBase item)
 
override bool ActionConditionContinue (ActionData action_data)
 
override void OnFinishProgressServer (ActionData action_data)
 
override string GetSoundCategory (ActionData action_data)
 
override ActionData CreateActionData ()
 
override bool SetupAction (PlayerBase player, ActionTarget target, ItemBase item, out ActionData action_data, Param extra_data=NULL)
 
void SetBuildingAnimation (ItemBase item)
 
override void WriteToContext (ParamsWriteContext ctx, ActionData action_data)
 
override bool ReadFromContext (ParamsReadContext ctx, out ActionReciveData action_recive_data)
 
override void HandleReciveData (ActionReciveData action_recive_data, ActionData action_data)
 
override string GetAdminLogMessage (ActionData action_data)
 
override bool UseMainItem ()
 
override bool HasProgress ()
 
override bool HasAlternativeInterrupt ()
 

Переменные

BuildPartActionReciveData m_PartType
 

Функции

◆ ActionBuildPart()

void ActionBuildPart ( )
227 {
229 }
230
231 override bool UseMainItem()
232 {
233 return false;
234 }
235
236 override bool HasProgress()
override bool HasProgress()
Definition ActionBuildPart.c:236
override bool UseMainItem()
Definition ActionBuildPart.c:231
Definition ActionInput.c:522

◆ ActionCondition()

override bool ActionCondition ( PlayerBase player,
ActionTarget target,
ItemBase item )
265 : ActionReciveData
266{
267 string m_PartType;
268}
269
270class BuildPartActionData : ActionData
271{
272 string m_PartType;
273};
274
276{
277 override void CreateActionComponent()
278 {
279 float time = SetCallbackDuration(m_ActionData.m_MainItem);
280 m_ActionData.m_ActionComponent = new CAContinuousTime(time);
281 }
282
284 {
286 }
287};
288
290{
291 void ActionBuildPart()
292 {
294 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_ASSEMBLE;
295 m_FullBody = true;
296 m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT;
297
299 m_Text = "#build";
300 }
301
302 override void CreateConditionComponents()
303 {
306 }
307
308 override void OnActionInfoUpdate(PlayerBase player, ActionTarget target, ItemBase item)
309 {
310 ConstructionActionData construction_action_data = player.GetConstructionActionData();
312
314 {
315 m_Text = "#build " + constrution_part.GetName();
316 }
317 }
318
319 override bool CanBeUsedLeaning()
320 {
321 return false;
322 }
323
324 override bool CanBeUsedInFreelook()
325 {
326 return false;
327 }
328
329 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
330 {
331 if (player.IsPlacingLocal() || player.IsPlacingServer())
332 return false;
333
334 //Action not allowed if player has broken legs
335 if (player.GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS)
336 return false;
337
338 //gate..
339 if (target.GetObject() && (!target.GetObject().CanUseConstructionBuild() || target.GetObject().CanUseHandConstruction()))
340 return false;
341
342 if ((!GetGame().IsDedicatedServer()))
343 {
344 if (MiscGameplayFunctions.ComplexBuildCollideCheckClient(player, target, item, m_VariantID))
345 {
346 return true;
347 }
348 return false;
349 }
350 return true;
351 }
352
353 override bool ActionConditionContinue(ActionData action_data)
354 {
355 BaseBuildingBase base_building = BaseBuildingBase.Cast(action_data.m_Target.GetObject());
356 Construction construction = base_building.GetConstruction();
357 string part_name = BuildPartActionData.Cast(action_data).m_PartType;
359
360 check_data.m_PartName = part_name;
361 check_data.m_AdditionalExcludes.Insert(action_data.m_Player);
362
363 bool canBuild = construction.CanBuildPart(part_name, action_data.m_MainItem, true);
364 if (GetGame().IsServer())
365 {
366 bool collides = construction.IsCollidingEx(check_data);
367
368 return !collides && canBuild;
369 }
370 else
371 {
372 return canBuild;
373 }
374 }
375
376 override void OnFinishProgressServer(ActionData action_data)
377 {
378 BaseBuildingBase base_building = BaseBuildingBase.Cast(action_data.m_Target.GetObject());
379 Construction construction = base_building.GetConstruction();
380
381 string part_name = BuildPartActionData.Cast(action_data).m_PartType;
383
384 check_data.m_PartName = part_name;
385 check_data.m_AdditionalExcludes.Insert(action_data.m_Player);
386
387 if (!construction.IsCollidingEx(check_data) && construction.CanBuildPart(part_name, action_data.m_MainItem, true)) //redundant at this point?
388 {
389 //build
390 construction.BuildPartServer(action_data.m_Player, part_name, AT_BUILD_PART);
391 //add damage to tool
392 action_data.m_MainItem.DecreaseHealth(UADamageApplied.BUILD, false);
393 }
394 }
395
396 override string GetSoundCategory(ActionData action_data)
397 {
398 return "Base_building";
399 }
400
401 override ActionData CreateActionData()
402 {
404 return action_data;
405 }
406
407 //setup
408 override bool SetupAction(PlayerBase player, ActionTarget target, ItemBase item, out ActionData action_data, Param extra_data = NULL)
409 {
410 if (super.SetupAction(player, target, item, action_data, extra_data))
411 {
413
414 if (!GetGame().IsDedicatedServer())
415 {
416 ConstructionActionData construction_action_data = action_data.m_Player.GetConstructionActionData();
417 BuildPartActionData.Cast(action_data).m_PartType = construction_action_data.GetBuildPartAtIndex(m_VariantID).GetPartName();
418 }
419 return true;
420 }
421
422 return false;
423 }
424
425 protected void SetBuildingAnimation(ItemBase item)
426 {
427 switch (item.Type())
428 {
429 case Pickaxe:
430 case Shovel:
431 case FarmingHoe:
432 case FieldShovel:
433 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_DIG;
434 break;
435 case Pliers:
436 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_INTERACT;
437 break;
438 case SledgeHammer:
439 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_MINEROCK;
440 break;
441 default:
442 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_ASSEMBLE;
443 break;
444 }
445 }
446
447 override void WriteToContext(ParamsWriteContext ctx, ActionData action_data)
448 {
449 super.WriteToContext(ctx, action_data);
450
451 ctx.Write(BuildPartActionData.Cast(action_data).m_PartType);
452 }
453
454 override bool ReadFromContext(ParamsReadContext ctx, out ActionReciveData action_recive_data)
455 {
457 super.ReadFromContext(ctx, action_recive_data);
458
459 string part_type;
460 if (ctx.Read(part_type))
461 {
463 return true;
464 }
465 else
466 {
467 return false;
468 }
469 }
470
471 override void HandleReciveData(ActionReciveData action_recive_data, ActionData action_data)
472 {
473 super.HandleReciveData(action_recive_data, action_data);
474
476 }
477
478 override string GetAdminLogMessage(ActionData action_data)
479 {
480 ConstructionActionData construction_action_data = action_data.m_Player.GetConstructionActionData();
481 string partName = BuildPartActionData.Cast(action_data).m_PartType;
482
483 string message = string.Format("Built %1 on %2 with %3", partName, action_data.m_Target.GetObject().GetDisplayName(), action_data.m_MainItem.GetDisplayName());
484 return message;
485 }
486}
487
489{
490 override typename GetInputType()
491 {
493 }
494
495 override bool UseMainItem()
496 {
497 return false;
498 }
499
500 override bool HasProgress()
501 {
502 return true;
503 }
504
505 override bool HasAlternativeInterrupt()
506 {
507 return false;
508 }
509}
const int AT_BUILD_PART
Definition _constants.c:6
override bool HasProgress()
Definition ActionActivateTrap.c:41
BuildPartActionReciveData m_PartType
override bool HasAlternativeInterrupt()
Definition ActionBuildPart.c:241
override GetInputType()
Definition ActionSequentialBase.c:32
void CollisionCheckData()
Definition Construction.c:1312
void Construction(BaseBuildingBase parent)
Definition Construction.c:26
eBrokenLegs
Definition EBrokenLegs.c:2
ActionData m_ActionData
Definition AnimatedActionBase.c:3
bool m_FullBody
Definition ActionBase.c:61
string m_Text
Definition ActionBase.c:58
int m_VariantID
Definition ActionBase.c:68
ref CCIBase m_ConditionItem
Definition ActionBase.c:64
float m_SpecialtyWeight
Definition ActionBase.c:77
ref CCTBase m_ConditionTarget
Definition ActionBase.c:65
int m_StanceMask
Definition ActionBase.c:62
Definition ActionBuildPart.c:12
float SetCallbackDuration(ItemBase item)
Definition ActionBuildPart.c:19
override void CreateActionComponent()
Definition ActionBuildPart.c:13
Definition ActionBuildPart.c:26
override void OnFinishProgressServer(ActionData action_data)
Definition ActionBuildPart.c:112
override bool CanBeUsedLeaning()
Definition ActionBuildPart.c:55
override bool ActionConditionContinue(ActionData action_data)
Definition ActionBuildPart.c:89
override void OnActionInfoUpdate(PlayerBase player, ActionTarget target, ItemBase item)
Definition ActionBuildPart.c:44
void SetBuildingAnimation(ItemBase item)
Definition ActionBuildPart.c:161
override string GetAdminLogMessage(ActionData action_data)
Definition ActionBuildPart.c:214
override ActionData CreateActionData()
Definition ActionBuildPart.c:137
override bool CanBeUsedInFreelook()
Definition ActionBuildPart.c:60
override void CreateConditionComponents()
Definition ActionBuildPart.c:38
void ActionBuildPart()
Definition ActionBuildPart.c:27
override bool ReadFromContext(ParamsReadContext ctx, out ActionReciveData action_recive_data)
Definition ActionBuildPart.c:190
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Definition ActionBuildPart.c:65
override bool SetupAction(PlayerBase player, ActionTarget target, ItemBase item, out ActionData action_data, Param extra_data=NULL)
Definition ActionBuildPart.c:144
override void WriteToContext(ParamsWriteContext ctx, ActionData action_data)
Definition ActionBuildPart.c:183
override string GetSoundCategory(ActionData action_data)
Definition ActionBuildPart.c:132
override void HandleReciveData(ActionReciveData action_recive_data, ActionData action_data)
Definition ActionBuildPart.c:207
Definition ActionContinuousBase.c:2
Definition ActionContinuousBase.c:121
int m_CommandUID
Definition AnimatedActionBase.c:143
m_CallbackClass
Definition AnimatedActionBase.c:145
Definition Fence.c:2
Definition ActionBuildPart.c:2
string m_PartType
Definition ActionBuildPart.c:3
Definition CAContinuousTime.c:2
Definition CCINonRuined.c:2
Definition CCTNone.c:2
Definition ConstructionActionData.c:2
Definition ConstructionPart.c:2
Definition FarmingHoe.c:2
Definition InventoryItem.c:731
Definition EntityAI.c:95
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition param.c:12
Definition PlayerBaseClient.c:2
Serialization general interface. Serializer API works with:
Definition Serializer.c:56
Definition ActionConstants.c:142
const float BUILD
Definition ActionConstants.c:143
Definition ActionConstants.c:28
const float BASEBUILDING_CONSTRUCT_MEDIUM
Definition ActionConstants.c:61
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602
proto native CGame GetGame()

◆ ActionConditionContinue()

override bool ActionConditionContinue ( ActionData action_data)
289 : ActionReciveData
290{
291 string m_PartType;
292}
293
294class BuildPartActionData : ActionData
295{
296 string m_PartType;
297};
298
300{
301 override void CreateActionComponent()
302 {
303 float time = SetCallbackDuration(m_ActionData.m_MainItem);
304 m_ActionData.m_ActionComponent = new CAContinuousTime(time);
305 }
306
308 {
310 }
311};
312
314{
315 void ActionBuildPart()
316 {
318 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_ASSEMBLE;
319 m_FullBody = true;
320 m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT;
321
323 m_Text = "#build";
324 }
325
326 override void CreateConditionComponents()
327 {
330 }
331
332 override void OnActionInfoUpdate(PlayerBase player, ActionTarget target, ItemBase item)
333 {
334 ConstructionActionData construction_action_data = player.GetConstructionActionData();
336
338 {
339 m_Text = "#build " + constrution_part.GetName();
340 }
341 }
342
343 override bool CanBeUsedLeaning()
344 {
345 return false;
346 }
347
348 override bool CanBeUsedInFreelook()
349 {
350 return false;
351 }
352
353 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
354 {
355 if (player.IsPlacingLocal() || player.IsPlacingServer())
356 return false;
357
358 //Action not allowed if player has broken legs
359 if (player.GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS)
360 return false;
361
362 //gate..
363 if (target.GetObject() && (!target.GetObject().CanUseConstructionBuild() || target.GetObject().CanUseHandConstruction()))
364 return false;
365
366 if ((!GetGame().IsDedicatedServer()))
367 {
368 if (MiscGameplayFunctions.ComplexBuildCollideCheckClient(player, target, item, m_VariantID))
369 {
370 return true;
371 }
372 return false;
373 }
374 return true;
375 }
376
377 override bool ActionConditionContinue(ActionData action_data)
378 {
379 BaseBuildingBase base_building = BaseBuildingBase.Cast(action_data.m_Target.GetObject());
380 Construction construction = base_building.GetConstruction();
381 string part_name = BuildPartActionData.Cast(action_data).m_PartType;
383
384 check_data.m_PartName = part_name;
385 check_data.m_AdditionalExcludes.Insert(action_data.m_Player);
386
387 bool canBuild = construction.CanBuildPart(part_name, action_data.m_MainItem, true);
388 if (GetGame().IsServer())
389 {
390 bool collides = construction.IsCollidingEx(check_data);
391
392 return !collides && canBuild;
393 }
394 else
395 {
396 return canBuild;
397 }
398 }
399
400 override void OnFinishProgressServer(ActionData action_data)
401 {
402 BaseBuildingBase base_building = BaseBuildingBase.Cast(action_data.m_Target.GetObject());
403 Construction construction = base_building.GetConstruction();
404
405 string part_name = BuildPartActionData.Cast(action_data).m_PartType;
407
408 check_data.m_PartName = part_name;
409 check_data.m_AdditionalExcludes.Insert(action_data.m_Player);
410
411 if (!construction.IsCollidingEx(check_data) && construction.CanBuildPart(part_name, action_data.m_MainItem, true)) //redundant at this point?
412 {
413 //build
414 construction.BuildPartServer(action_data.m_Player, part_name, AT_BUILD_PART);
415 //add damage to tool
416 action_data.m_MainItem.DecreaseHealth(UADamageApplied.BUILD, false);
417 }
418 }
419
420 override string GetSoundCategory(ActionData action_data)
421 {
422 return "Base_building";
423 }
424
425 override ActionData CreateActionData()
426 {
428 return action_data;
429 }
430
431 //setup
432 override bool SetupAction(PlayerBase player, ActionTarget target, ItemBase item, out ActionData action_data, Param extra_data = NULL)
433 {
434 if (super.SetupAction(player, target, item, action_data, extra_data))
435 {
437
438 if (!GetGame().IsDedicatedServer())
439 {
440 ConstructionActionData construction_action_data = action_data.m_Player.GetConstructionActionData();
441 BuildPartActionData.Cast(action_data).m_PartType = construction_action_data.GetBuildPartAtIndex(m_VariantID).GetPartName();
442 }
443 return true;
444 }
445
446 return false;
447 }
448
449 protected void SetBuildingAnimation(ItemBase item)
450 {
451 switch (item.Type())
452 {
453 case Pickaxe:
454 case Shovel:
455 case FarmingHoe:
456 case FieldShovel:
457 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_DIG;
458 break;
459 case Pliers:
460 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_INTERACT;
461 break;
462 case SledgeHammer:
463 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_MINEROCK;
464 break;
465 default:
466 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_ASSEMBLE;
467 break;
468 }
469 }
470
471 override void WriteToContext(ParamsWriteContext ctx, ActionData action_data)
472 {
473 super.WriteToContext(ctx, action_data);
474
475 ctx.Write(BuildPartActionData.Cast(action_data).m_PartType);
476 }
477
478 override bool ReadFromContext(ParamsReadContext ctx, out ActionReciveData action_recive_data)
479 {
481 super.ReadFromContext(ctx, action_recive_data);
482
483 string part_type;
484 if (ctx.Read(part_type))
485 {
487 return true;
488 }
489 else
490 {
491 return false;
492 }
493 }
494
495 override void HandleReciveData(ActionReciveData action_recive_data, ActionData action_data)
496 {
497 super.HandleReciveData(action_recive_data, action_data);
498
500 }
501
502 override string GetAdminLogMessage(ActionData action_data)
503 {
504 ConstructionActionData construction_action_data = action_data.m_Player.GetConstructionActionData();
505 string partName = BuildPartActionData.Cast(action_data).m_PartType;
506
507 string message = string.Format("Built %1 on %2 with %3", partName, action_data.m_Target.GetObject().GetDisplayName(), action_data.m_MainItem.GetDisplayName());
508 return message;
509 }
510}
511
513{
514 override typename GetInputType()
515 {
517 }
518
519 override bool UseMainItem()
520 {
521 return false;
522 }
523
524 override bool HasProgress()
525 {
526 return true;
527 }
528
529 override bool HasAlternativeInterrupt()
530 {
531 return false;
532 }
533}

◆ CanBeUsedInFreelook()

override bool CanBeUsedInFreelook ( )
260 : ActionReciveData
261{
262 string m_PartType;
263}
264
265class BuildPartActionData : ActionData
266{
267 string m_PartType;
268};
269
271{
272 override void CreateActionComponent()
273 {
274 float time = SetCallbackDuration(m_ActionData.m_MainItem);
275 m_ActionData.m_ActionComponent = new CAContinuousTime(time);
276 }
277
279 {
281 }
282};
283
285{
286 void ActionBuildPart()
287 {
289 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_ASSEMBLE;
290 m_FullBody = true;
291 m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT;
292
294 m_Text = "#build";
295 }
296
297 override void CreateConditionComponents()
298 {
301 }
302
303 override void OnActionInfoUpdate(PlayerBase player, ActionTarget target, ItemBase item)
304 {
305 ConstructionActionData construction_action_data = player.GetConstructionActionData();
307
309 {
310 m_Text = "#build " + constrution_part.GetName();
311 }
312 }
313
314 override bool CanBeUsedLeaning()
315 {
316 return false;
317 }
318
319 override bool CanBeUsedInFreelook()
320 {
321 return false;
322 }
323
324 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
325 {
326 if (player.IsPlacingLocal() || player.IsPlacingServer())
327 return false;
328
329 //Action not allowed if player has broken legs
330 if (player.GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS)
331 return false;
332
333 //gate..
334 if (target.GetObject() && (!target.GetObject().CanUseConstructionBuild() || target.GetObject().CanUseHandConstruction()))
335 return false;
336
337 if ((!GetGame().IsDedicatedServer()))
338 {
339 if (MiscGameplayFunctions.ComplexBuildCollideCheckClient(player, target, item, m_VariantID))
340 {
341 return true;
342 }
343 return false;
344 }
345 return true;
346 }
347
348 override bool ActionConditionContinue(ActionData action_data)
349 {
350 BaseBuildingBase base_building = BaseBuildingBase.Cast(action_data.m_Target.GetObject());
351 Construction construction = base_building.GetConstruction();
352 string part_name = BuildPartActionData.Cast(action_data).m_PartType;
354
355 check_data.m_PartName = part_name;
356 check_data.m_AdditionalExcludes.Insert(action_data.m_Player);
357
358 bool canBuild = construction.CanBuildPart(part_name, action_data.m_MainItem, true);
359 if (GetGame().IsServer())
360 {
361 bool collides = construction.IsCollidingEx(check_data);
362
363 return !collides && canBuild;
364 }
365 else
366 {
367 return canBuild;
368 }
369 }
370
371 override void OnFinishProgressServer(ActionData action_data)
372 {
373 BaseBuildingBase base_building = BaseBuildingBase.Cast(action_data.m_Target.GetObject());
374 Construction construction = base_building.GetConstruction();
375
376 string part_name = BuildPartActionData.Cast(action_data).m_PartType;
378
379 check_data.m_PartName = part_name;
380 check_data.m_AdditionalExcludes.Insert(action_data.m_Player);
381
382 if (!construction.IsCollidingEx(check_data) && construction.CanBuildPart(part_name, action_data.m_MainItem, true)) //redundant at this point?
383 {
384 //build
385 construction.BuildPartServer(action_data.m_Player, part_name, AT_BUILD_PART);
386 //add damage to tool
387 action_data.m_MainItem.DecreaseHealth(UADamageApplied.BUILD, false);
388 }
389 }
390
391 override string GetSoundCategory(ActionData action_data)
392 {
393 return "Base_building";
394 }
395
396 override ActionData CreateActionData()
397 {
399 return action_data;
400 }
401
402 //setup
403 override bool SetupAction(PlayerBase player, ActionTarget target, ItemBase item, out ActionData action_data, Param extra_data = NULL)
404 {
405 if (super.SetupAction(player, target, item, action_data, extra_data))
406 {
408
409 if (!GetGame().IsDedicatedServer())
410 {
411 ConstructionActionData construction_action_data = action_data.m_Player.GetConstructionActionData();
412 BuildPartActionData.Cast(action_data).m_PartType = construction_action_data.GetBuildPartAtIndex(m_VariantID).GetPartName();
413 }
414 return true;
415 }
416
417 return false;
418 }
419
420 protected void SetBuildingAnimation(ItemBase item)
421 {
422 switch (item.Type())
423 {
424 case Pickaxe:
425 case Shovel:
426 case FarmingHoe:
427 case FieldShovel:
428 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_DIG;
429 break;
430 case Pliers:
431 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_INTERACT;
432 break;
433 case SledgeHammer:
434 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_MINEROCK;
435 break;
436 default:
437 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_ASSEMBLE;
438 break;
439 }
440 }
441
442 override void WriteToContext(ParamsWriteContext ctx, ActionData action_data)
443 {
444 super.WriteToContext(ctx, action_data);
445
446 ctx.Write(BuildPartActionData.Cast(action_data).m_PartType);
447 }
448
449 override bool ReadFromContext(ParamsReadContext ctx, out ActionReciveData action_recive_data)
450 {
452 super.ReadFromContext(ctx, action_recive_data);
453
454 string part_type;
455 if (ctx.Read(part_type))
456 {
458 return true;
459 }
460 else
461 {
462 return false;
463 }
464 }
465
466 override void HandleReciveData(ActionReciveData action_recive_data, ActionData action_data)
467 {
468 super.HandleReciveData(action_recive_data, action_data);
469
471 }
472
473 override string GetAdminLogMessage(ActionData action_data)
474 {
475 ConstructionActionData construction_action_data = action_data.m_Player.GetConstructionActionData();
476 string partName = BuildPartActionData.Cast(action_data).m_PartType;
477
478 string message = string.Format("Built %1 on %2 with %3", partName, action_data.m_Target.GetObject().GetDisplayName(), action_data.m_MainItem.GetDisplayName());
479 return message;
480 }
481}
482
484{
485 override typename GetInputType()
486 {
488 }
489
490 override bool UseMainItem()
491 {
492 return false;
493 }
494
495 override bool HasProgress()
496 {
497 return true;
498 }
499
500 override bool HasAlternativeInterrupt()
501 {
502 return false;
503 }
504}

◆ CanBeUsedLeaning()

override bool CanBeUsedLeaning ( )
255 : ActionReciveData
256{
257 string m_PartType;
258}
259
260class BuildPartActionData : ActionData
261{
262 string m_PartType;
263};
264
266{
267 override void CreateActionComponent()
268 {
269 float time = SetCallbackDuration(m_ActionData.m_MainItem);
270 m_ActionData.m_ActionComponent = new CAContinuousTime(time);
271 }
272
274 {
276 }
277};
278
280{
281 void ActionBuildPart()
282 {
284 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_ASSEMBLE;
285 m_FullBody = true;
286 m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT;
287
289 m_Text = "#build";
290 }
291
292 override void CreateConditionComponents()
293 {
296 }
297
298 override void OnActionInfoUpdate(PlayerBase player, ActionTarget target, ItemBase item)
299 {
300 ConstructionActionData construction_action_data = player.GetConstructionActionData();
302
304 {
305 m_Text = "#build " + constrution_part.GetName();
306 }
307 }
308
309 override bool CanBeUsedLeaning()
310 {
311 return false;
312 }
313
314 override bool CanBeUsedInFreelook()
315 {
316 return false;
317 }
318
319 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
320 {
321 if (player.IsPlacingLocal() || player.IsPlacingServer())
322 return false;
323
324 //Action not allowed if player has broken legs
325 if (player.GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS)
326 return false;
327
328 //gate..
329 if (target.GetObject() && (!target.GetObject().CanUseConstructionBuild() || target.GetObject().CanUseHandConstruction()))
330 return false;
331
332 if ((!GetGame().IsDedicatedServer()))
333 {
334 if (MiscGameplayFunctions.ComplexBuildCollideCheckClient(player, target, item, m_VariantID))
335 {
336 return true;
337 }
338 return false;
339 }
340 return true;
341 }
342
343 override bool ActionConditionContinue(ActionData action_data)
344 {
345 BaseBuildingBase base_building = BaseBuildingBase.Cast(action_data.m_Target.GetObject());
346 Construction construction = base_building.GetConstruction();
347 string part_name = BuildPartActionData.Cast(action_data).m_PartType;
349
350 check_data.m_PartName = part_name;
351 check_data.m_AdditionalExcludes.Insert(action_data.m_Player);
352
353 bool canBuild = construction.CanBuildPart(part_name, action_data.m_MainItem, true);
354 if (GetGame().IsServer())
355 {
356 bool collides = construction.IsCollidingEx(check_data);
357
358 return !collides && canBuild;
359 }
360 else
361 {
362 return canBuild;
363 }
364 }
365
366 override void OnFinishProgressServer(ActionData action_data)
367 {
368 BaseBuildingBase base_building = BaseBuildingBase.Cast(action_data.m_Target.GetObject());
369 Construction construction = base_building.GetConstruction();
370
371 string part_name = BuildPartActionData.Cast(action_data).m_PartType;
373
374 check_data.m_PartName = part_name;
375 check_data.m_AdditionalExcludes.Insert(action_data.m_Player);
376
377 if (!construction.IsCollidingEx(check_data) && construction.CanBuildPart(part_name, action_data.m_MainItem, true)) //redundant at this point?
378 {
379 //build
380 construction.BuildPartServer(action_data.m_Player, part_name, AT_BUILD_PART);
381 //add damage to tool
382 action_data.m_MainItem.DecreaseHealth(UADamageApplied.BUILD, false);
383 }
384 }
385
386 override string GetSoundCategory(ActionData action_data)
387 {
388 return "Base_building";
389 }
390
391 override ActionData CreateActionData()
392 {
394 return action_data;
395 }
396
397 //setup
398 override bool SetupAction(PlayerBase player, ActionTarget target, ItemBase item, out ActionData action_data, Param extra_data = NULL)
399 {
400 if (super.SetupAction(player, target, item, action_data, extra_data))
401 {
403
404 if (!GetGame().IsDedicatedServer())
405 {
406 ConstructionActionData construction_action_data = action_data.m_Player.GetConstructionActionData();
407 BuildPartActionData.Cast(action_data).m_PartType = construction_action_data.GetBuildPartAtIndex(m_VariantID).GetPartName();
408 }
409 return true;
410 }
411
412 return false;
413 }
414
415 protected void SetBuildingAnimation(ItemBase item)
416 {
417 switch (item.Type())
418 {
419 case Pickaxe:
420 case Shovel:
421 case FarmingHoe:
422 case FieldShovel:
423 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_DIG;
424 break;
425 case Pliers:
426 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_INTERACT;
427 break;
428 case SledgeHammer:
429 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_MINEROCK;
430 break;
431 default:
432 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_ASSEMBLE;
433 break;
434 }
435 }
436
437 override void WriteToContext(ParamsWriteContext ctx, ActionData action_data)
438 {
439 super.WriteToContext(ctx, action_data);
440
441 ctx.Write(BuildPartActionData.Cast(action_data).m_PartType);
442 }
443
444 override bool ReadFromContext(ParamsReadContext ctx, out ActionReciveData action_recive_data)
445 {
447 super.ReadFromContext(ctx, action_recive_data);
448
449 string part_type;
450 if (ctx.Read(part_type))
451 {
453 return true;
454 }
455 else
456 {
457 return false;
458 }
459 }
460
461 override void HandleReciveData(ActionReciveData action_recive_data, ActionData action_data)
462 {
463 super.HandleReciveData(action_recive_data, action_data);
464
466 }
467
468 override string GetAdminLogMessage(ActionData action_data)
469 {
470 ConstructionActionData construction_action_data = action_data.m_Player.GetConstructionActionData();
471 string partName = BuildPartActionData.Cast(action_data).m_PartType;
472
473 string message = string.Format("Built %1 on %2 with %3", partName, action_data.m_Target.GetObject().GetDisplayName(), action_data.m_MainItem.GetDisplayName());
474 return message;
475 }
476}
477
479{
480 override typename GetInputType()
481 {
483 }
484
485 override bool UseMainItem()
486 {
487 return false;
488 }
489
490 override bool HasProgress()
491 {
492 return true;
493 }
494
495 override bool HasAlternativeInterrupt()
496 {
497 return false;
498 }
499}

◆ CreateActionData()

override ActionData CreateActionData ( )
337 : ActionReciveData
338{
339 string m_PartType;
340}
341
342class BuildPartActionData : ActionData
343{
344 string m_PartType;
345};
346
348{
349 override void CreateActionComponent()
350 {
351 float time = SetCallbackDuration(m_ActionData.m_MainItem);
352 m_ActionData.m_ActionComponent = new CAContinuousTime(time);
353 }
354
356 {
358 }
359};
360
362{
363 void ActionBuildPart()
364 {
366 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_ASSEMBLE;
367 m_FullBody = true;
368 m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT;
369
371 m_Text = "#build";
372 }
373
374 override void CreateConditionComponents()
375 {
378 }
379
380 override void OnActionInfoUpdate(PlayerBase player, ActionTarget target, ItemBase item)
381 {
382 ConstructionActionData construction_action_data = player.GetConstructionActionData();
384
386 {
387 m_Text = "#build " + constrution_part.GetName();
388 }
389 }
390
391 override bool CanBeUsedLeaning()
392 {
393 return false;
394 }
395
396 override bool CanBeUsedInFreelook()
397 {
398 return false;
399 }
400
401 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
402 {
403 if (player.IsPlacingLocal() || player.IsPlacingServer())
404 return false;
405
406 //Action not allowed if player has broken legs
407 if (player.GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS)
408 return false;
409
410 //gate..
411 if (target.GetObject() && (!target.GetObject().CanUseConstructionBuild() || target.GetObject().CanUseHandConstruction()))
412 return false;
413
414 if ((!GetGame().IsDedicatedServer()))
415 {
416 if (MiscGameplayFunctions.ComplexBuildCollideCheckClient(player, target, item, m_VariantID))
417 {
418 return true;
419 }
420 return false;
421 }
422 return true;
423 }
424
425 override bool ActionConditionContinue(ActionData action_data)
426 {
427 BaseBuildingBase base_building = BaseBuildingBase.Cast(action_data.m_Target.GetObject());
428 Construction construction = base_building.GetConstruction();
429 string part_name = BuildPartActionData.Cast(action_data).m_PartType;
431
432 check_data.m_PartName = part_name;
433 check_data.m_AdditionalExcludes.Insert(action_data.m_Player);
434
435 bool canBuild = construction.CanBuildPart(part_name, action_data.m_MainItem, true);
436 if (GetGame().IsServer())
437 {
438 bool collides = construction.IsCollidingEx(check_data);
439
440 return !collides && canBuild;
441 }
442 else
443 {
444 return canBuild;
445 }
446 }
447
448 override void OnFinishProgressServer(ActionData action_data)
449 {
450 BaseBuildingBase base_building = BaseBuildingBase.Cast(action_data.m_Target.GetObject());
451 Construction construction = base_building.GetConstruction();
452
453 string part_name = BuildPartActionData.Cast(action_data).m_PartType;
455
456 check_data.m_PartName = part_name;
457 check_data.m_AdditionalExcludes.Insert(action_data.m_Player);
458
459 if (!construction.IsCollidingEx(check_data) && construction.CanBuildPart(part_name, action_data.m_MainItem, true)) //redundant at this point?
460 {
461 //build
462 construction.BuildPartServer(action_data.m_Player, part_name, AT_BUILD_PART);
463 //add damage to tool
464 action_data.m_MainItem.DecreaseHealth(UADamageApplied.BUILD, false);
465 }
466 }
467
468 override string GetSoundCategory(ActionData action_data)
469 {
470 return "Base_building";
471 }
472
473 override ActionData CreateActionData()
474 {
476 return action_data;
477 }
478
479 //setup
480 override bool SetupAction(PlayerBase player, ActionTarget target, ItemBase item, out ActionData action_data, Param extra_data = NULL)
481 {
482 if (super.SetupAction(player, target, item, action_data, extra_data))
483 {
485
486 if (!GetGame().IsDedicatedServer())
487 {
488 ConstructionActionData construction_action_data = action_data.m_Player.GetConstructionActionData();
489 BuildPartActionData.Cast(action_data).m_PartType = construction_action_data.GetBuildPartAtIndex(m_VariantID).GetPartName();
490 }
491 return true;
492 }
493
494 return false;
495 }
496
497 protected void SetBuildingAnimation(ItemBase item)
498 {
499 switch (item.Type())
500 {
501 case Pickaxe:
502 case Shovel:
503 case FarmingHoe:
504 case FieldShovel:
505 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_DIG;
506 break;
507 case Pliers:
508 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_INTERACT;
509 break;
510 case SledgeHammer:
511 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_MINEROCK;
512 break;
513 default:
514 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_ASSEMBLE;
515 break;
516 }
517 }
518
519 override void WriteToContext(ParamsWriteContext ctx, ActionData action_data)
520 {
521 super.WriteToContext(ctx, action_data);
522
523 ctx.Write(BuildPartActionData.Cast(action_data).m_PartType);
524 }
525
526 override bool ReadFromContext(ParamsReadContext ctx, out ActionReciveData action_recive_data)
527 {
529 super.ReadFromContext(ctx, action_recive_data);
530
531 string part_type;
532 if (ctx.Read(part_type))
533 {
535 return true;
536 }
537 else
538 {
539 return false;
540 }
541 }
542
543 override void HandleReciveData(ActionReciveData action_recive_data, ActionData action_data)
544 {
545 super.HandleReciveData(action_recive_data, action_data);
546
548 }
549
550 override string GetAdminLogMessage(ActionData action_data)
551 {
552 ConstructionActionData construction_action_data = action_data.m_Player.GetConstructionActionData();
553 string partName = BuildPartActionData.Cast(action_data).m_PartType;
554
555 string message = string.Format("Built %1 on %2 with %3", partName, action_data.m_Target.GetObject().GetDisplayName(), action_data.m_MainItem.GetDisplayName());
556 return message;
557 }
558}
559
561{
562 override typename GetInputType()
563 {
565 }
566
567 override bool UseMainItem()
568 {
569 return false;
570 }
571
572 override bool HasProgress()
573 {
574 return true;
575 }
576
577 override bool HasAlternativeInterrupt()
578 {
579 return false;
580 }
581}

◆ CreateConditionComponents()

override void CreateConditionComponents ( )
242 {

◆ GetAdminLogMessage()

override string GetAdminLogMessage ( ActionData action_data)
protected
414 : ActionReciveData
415{
416 string m_PartType;
417}
418
419class BuildPartActionData : ActionData
420{
421 string m_PartType;
422};
423
425{
426 override void CreateActionComponent()
427 {
428 float time = SetCallbackDuration(m_ActionData.m_MainItem);
429 m_ActionData.m_ActionComponent = new CAContinuousTime(time);
430 }
431
433 {
435 }
436};
437
439{
440 void ActionBuildPart()
441 {
443 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_ASSEMBLE;
444 m_FullBody = true;
445 m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT;
446
448 m_Text = "#build";
449 }
450
451 override void CreateConditionComponents()
452 {
455 }
456
457 override void OnActionInfoUpdate(PlayerBase player, ActionTarget target, ItemBase item)
458 {
459 ConstructionActionData construction_action_data = player.GetConstructionActionData();
461
463 {
464 m_Text = "#build " + constrution_part.GetName();
465 }
466 }
467
468 override bool CanBeUsedLeaning()
469 {
470 return false;
471 }
472
473 override bool CanBeUsedInFreelook()
474 {
475 return false;
476 }
477
478 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
479 {
480 if (player.IsPlacingLocal() || player.IsPlacingServer())
481 return false;
482
483 //Action not allowed if player has broken legs
484 if (player.GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS)
485 return false;
486
487 //gate..
488 if (target.GetObject() && (!target.GetObject().CanUseConstructionBuild() || target.GetObject().CanUseHandConstruction()))
489 return false;
490
491 if ((!GetGame().IsDedicatedServer()))
492 {
493 if (MiscGameplayFunctions.ComplexBuildCollideCheckClient(player, target, item, m_VariantID))
494 {
495 return true;
496 }
497 return false;
498 }
499 return true;
500 }
501
502 override bool ActionConditionContinue(ActionData action_data)
503 {
504 BaseBuildingBase base_building = BaseBuildingBase.Cast(action_data.m_Target.GetObject());
505 Construction construction = base_building.GetConstruction();
506 string part_name = BuildPartActionData.Cast(action_data).m_PartType;
508
509 check_data.m_PartName = part_name;
510 check_data.m_AdditionalExcludes.Insert(action_data.m_Player);
511
512 bool canBuild = construction.CanBuildPart(part_name, action_data.m_MainItem, true);
513 if (GetGame().IsServer())
514 {
515 bool collides = construction.IsCollidingEx(check_data);
516
517 return !collides && canBuild;
518 }
519 else
520 {
521 return canBuild;
522 }
523 }
524
525 override void OnFinishProgressServer(ActionData action_data)
526 {
527 BaseBuildingBase base_building = BaseBuildingBase.Cast(action_data.m_Target.GetObject());
528 Construction construction = base_building.GetConstruction();
529
530 string part_name = BuildPartActionData.Cast(action_data).m_PartType;
532
533 check_data.m_PartName = part_name;
534 check_data.m_AdditionalExcludes.Insert(action_data.m_Player);
535
536 if (!construction.IsCollidingEx(check_data) && construction.CanBuildPart(part_name, action_data.m_MainItem, true)) //redundant at this point?
537 {
538 //build
539 construction.BuildPartServer(action_data.m_Player, part_name, AT_BUILD_PART);
540 //add damage to tool
541 action_data.m_MainItem.DecreaseHealth(UADamageApplied.BUILD, false);
542 }
543 }
544
545 override string GetSoundCategory(ActionData action_data)
546 {
547 return "Base_building";
548 }
549
550 override ActionData CreateActionData()
551 {
553 return action_data;
554 }
555
556 //setup
557 override bool SetupAction(PlayerBase player, ActionTarget target, ItemBase item, out ActionData action_data, Param extra_data = NULL)
558 {
559 if (super.SetupAction(player, target, item, action_data, extra_data))
560 {
562
563 if (!GetGame().IsDedicatedServer())
564 {
565 ConstructionActionData construction_action_data = action_data.m_Player.GetConstructionActionData();
566 BuildPartActionData.Cast(action_data).m_PartType = construction_action_data.GetBuildPartAtIndex(m_VariantID).GetPartName();
567 }
568 return true;
569 }
570
571 return false;
572 }
573
574 protected void SetBuildingAnimation(ItemBase item)
575 {
576 switch (item.Type())
577 {
578 case Pickaxe:
579 case Shovel:
580 case FarmingHoe:
581 case FieldShovel:
582 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_DIG;
583 break;
584 case Pliers:
585 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_INTERACT;
586 break;
587 case SledgeHammer:
588 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_MINEROCK;
589 break;
590 default:
591 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_ASSEMBLE;
592 break;
593 }
594 }
595
596 override void WriteToContext(ParamsWriteContext ctx, ActionData action_data)
597 {
598 super.WriteToContext(ctx, action_data);
599
600 ctx.Write(BuildPartActionData.Cast(action_data).m_PartType);
601 }
602
603 override bool ReadFromContext(ParamsReadContext ctx, out ActionReciveData action_recive_data)
604 {
606 super.ReadFromContext(ctx, action_recive_data);
607
608 string part_type;
609 if (ctx.Read(part_type))
610 {
612 return true;
613 }
614 else
615 {
616 return false;
617 }
618 }
619
620 override void HandleReciveData(ActionReciveData action_recive_data, ActionData action_data)
621 {
622 super.HandleReciveData(action_recive_data, action_data);
623
625 }
626
627 override string GetAdminLogMessage(ActionData action_data)
628 {
629 ConstructionActionData construction_action_data = action_data.m_Player.GetConstructionActionData();
630 string partName = BuildPartActionData.Cast(action_data).m_PartType;
631
632 string message = string.Format("Built %1 on %2 with %3", partName, action_data.m_Target.GetObject().GetDisplayName(), action_data.m_MainItem.GetDisplayName());
633 return message;
634 }
635}
636
638{
639 override typename GetInputType()
640 {
642 }
643
644 override bool UseMainItem()
645 {
646 return false;
647 }
648
649 override bool HasProgress()
650 {
651 return true;
652 }
653
654 override bool HasAlternativeInterrupt()
655 {
656 return false;
657 }
658}

◆ GetInputType()

227 {
229 }

◆ GetSoundCategory()

override string GetSoundCategory ( ActionData action_data)
332 : ActionReciveData
333{
334 string m_PartType;
335}
336
337class BuildPartActionData : ActionData
338{
339 string m_PartType;
340};
341
343{
344 override void CreateActionComponent()
345 {
346 float time = SetCallbackDuration(m_ActionData.m_MainItem);
347 m_ActionData.m_ActionComponent = new CAContinuousTime(time);
348 }
349
351 {
353 }
354};
355
357{
358 void ActionBuildPart()
359 {
361 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_ASSEMBLE;
362 m_FullBody = true;
363 m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT;
364
366 m_Text = "#build";
367 }
368
369 override void CreateConditionComponents()
370 {
373 }
374
375 override void OnActionInfoUpdate(PlayerBase player, ActionTarget target, ItemBase item)
376 {
377 ConstructionActionData construction_action_data = player.GetConstructionActionData();
379
381 {
382 m_Text = "#build " + constrution_part.GetName();
383 }
384 }
385
386 override bool CanBeUsedLeaning()
387 {
388 return false;
389 }
390
391 override bool CanBeUsedInFreelook()
392 {
393 return false;
394 }
395
396 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
397 {
398 if (player.IsPlacingLocal() || player.IsPlacingServer())
399 return false;
400
401 //Action not allowed if player has broken legs
402 if (player.GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS)
403 return false;
404
405 //gate..
406 if (target.GetObject() && (!target.GetObject().CanUseConstructionBuild() || target.GetObject().CanUseHandConstruction()))
407 return false;
408
409 if ((!GetGame().IsDedicatedServer()))
410 {
411 if (MiscGameplayFunctions.ComplexBuildCollideCheckClient(player, target, item, m_VariantID))
412 {
413 return true;
414 }
415 return false;
416 }
417 return true;
418 }
419
420 override bool ActionConditionContinue(ActionData action_data)
421 {
422 BaseBuildingBase base_building = BaseBuildingBase.Cast(action_data.m_Target.GetObject());
423 Construction construction = base_building.GetConstruction();
424 string part_name = BuildPartActionData.Cast(action_data).m_PartType;
426
427 check_data.m_PartName = part_name;
428 check_data.m_AdditionalExcludes.Insert(action_data.m_Player);
429
430 bool canBuild = construction.CanBuildPart(part_name, action_data.m_MainItem, true);
431 if (GetGame().IsServer())
432 {
433 bool collides = construction.IsCollidingEx(check_data);
434
435 return !collides && canBuild;
436 }
437 else
438 {
439 return canBuild;
440 }
441 }
442
443 override void OnFinishProgressServer(ActionData action_data)
444 {
445 BaseBuildingBase base_building = BaseBuildingBase.Cast(action_data.m_Target.GetObject());
446 Construction construction = base_building.GetConstruction();
447
448 string part_name = BuildPartActionData.Cast(action_data).m_PartType;
450
451 check_data.m_PartName = part_name;
452 check_data.m_AdditionalExcludes.Insert(action_data.m_Player);
453
454 if (!construction.IsCollidingEx(check_data) && construction.CanBuildPart(part_name, action_data.m_MainItem, true)) //redundant at this point?
455 {
456 //build
457 construction.BuildPartServer(action_data.m_Player, part_name, AT_BUILD_PART);
458 //add damage to tool
459 action_data.m_MainItem.DecreaseHealth(UADamageApplied.BUILD, false);
460 }
461 }
462
463 override string GetSoundCategory(ActionData action_data)
464 {
465 return "Base_building";
466 }
467
468 override ActionData CreateActionData()
469 {
471 return action_data;
472 }
473
474 //setup
475 override bool SetupAction(PlayerBase player, ActionTarget target, ItemBase item, out ActionData action_data, Param extra_data = NULL)
476 {
477 if (super.SetupAction(player, target, item, action_data, extra_data))
478 {
480
481 if (!GetGame().IsDedicatedServer())
482 {
483 ConstructionActionData construction_action_data = action_data.m_Player.GetConstructionActionData();
484 BuildPartActionData.Cast(action_data).m_PartType = construction_action_data.GetBuildPartAtIndex(m_VariantID).GetPartName();
485 }
486 return true;
487 }
488
489 return false;
490 }
491
492 protected void SetBuildingAnimation(ItemBase item)
493 {
494 switch (item.Type())
495 {
496 case Pickaxe:
497 case Shovel:
498 case FarmingHoe:
499 case FieldShovel:
500 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_DIG;
501 break;
502 case Pliers:
503 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_INTERACT;
504 break;
505 case SledgeHammer:
506 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_MINEROCK;
507 break;
508 default:
509 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_ASSEMBLE;
510 break;
511 }
512 }
513
514 override void WriteToContext(ParamsWriteContext ctx, ActionData action_data)
515 {
516 super.WriteToContext(ctx, action_data);
517
518 ctx.Write(BuildPartActionData.Cast(action_data).m_PartType);
519 }
520
521 override bool ReadFromContext(ParamsReadContext ctx, out ActionReciveData action_recive_data)
522 {
524 super.ReadFromContext(ctx, action_recive_data);
525
526 string part_type;
527 if (ctx.Read(part_type))
528 {
530 return true;
531 }
532 else
533 {
534 return false;
535 }
536 }
537
538 override void HandleReciveData(ActionReciveData action_recive_data, ActionData action_data)
539 {
540 super.HandleReciveData(action_recive_data, action_data);
541
543 }
544
545 override string GetAdminLogMessage(ActionData action_data)
546 {
547 ConstructionActionData construction_action_data = action_data.m_Player.GetConstructionActionData();
548 string partName = BuildPartActionData.Cast(action_data).m_PartType;
549
550 string message = string.Format("Built %1 on %2 with %3", partName, action_data.m_Target.GetObject().GetDisplayName(), action_data.m_MainItem.GetDisplayName());
551 return message;
552 }
553}
554
556{
557 override typename GetInputType()
558 {
560 }
561
562 override bool UseMainItem()
563 {
564 return false;
565 }
566
567 override bool HasProgress()
568 {
569 return true;
570 }
571
572 override bool HasAlternativeInterrupt()
573 {
574 return false;
575 }
576}

◆ HandleReciveData()

override void HandleReciveData ( ActionReciveData action_recive_data,
ActionData action_data )
protected
407 : ActionReciveData
408{
409 string m_PartType;
410}
411
412class BuildPartActionData : ActionData
413{
414 string m_PartType;
415};
416
418{
419 override void CreateActionComponent()
420 {
421 float time = SetCallbackDuration(m_ActionData.m_MainItem);
422 m_ActionData.m_ActionComponent = new CAContinuousTime(time);
423 }
424
426 {
428 }
429};
430
432{
433 void ActionBuildPart()
434 {
436 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_ASSEMBLE;
437 m_FullBody = true;
438 m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT;
439
441 m_Text = "#build";
442 }
443
444 override void CreateConditionComponents()
445 {
448 }
449
450 override void OnActionInfoUpdate(PlayerBase player, ActionTarget target, ItemBase item)
451 {
452 ConstructionActionData construction_action_data = player.GetConstructionActionData();
454
456 {
457 m_Text = "#build " + constrution_part.GetName();
458 }
459 }
460
461 override bool CanBeUsedLeaning()
462 {
463 return false;
464 }
465
466 override bool CanBeUsedInFreelook()
467 {
468 return false;
469 }
470
471 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
472 {
473 if (player.IsPlacingLocal() || player.IsPlacingServer())
474 return false;
475
476 //Action not allowed if player has broken legs
477 if (player.GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS)
478 return false;
479
480 //gate..
481 if (target.GetObject() && (!target.GetObject().CanUseConstructionBuild() || target.GetObject().CanUseHandConstruction()))
482 return false;
483
484 if ((!GetGame().IsDedicatedServer()))
485 {
486 if (MiscGameplayFunctions.ComplexBuildCollideCheckClient(player, target, item, m_VariantID))
487 {
488 return true;
489 }
490 return false;
491 }
492 return true;
493 }
494
495 override bool ActionConditionContinue(ActionData action_data)
496 {
497 BaseBuildingBase base_building = BaseBuildingBase.Cast(action_data.m_Target.GetObject());
498 Construction construction = base_building.GetConstruction();
499 string part_name = BuildPartActionData.Cast(action_data).m_PartType;
501
502 check_data.m_PartName = part_name;
503 check_data.m_AdditionalExcludes.Insert(action_data.m_Player);
504
505 bool canBuild = construction.CanBuildPart(part_name, action_data.m_MainItem, true);
506 if (GetGame().IsServer())
507 {
508 bool collides = construction.IsCollidingEx(check_data);
509
510 return !collides && canBuild;
511 }
512 else
513 {
514 return canBuild;
515 }
516 }
517
518 override void OnFinishProgressServer(ActionData action_data)
519 {
520 BaseBuildingBase base_building = BaseBuildingBase.Cast(action_data.m_Target.GetObject());
521 Construction construction = base_building.GetConstruction();
522
523 string part_name = BuildPartActionData.Cast(action_data).m_PartType;
525
526 check_data.m_PartName = part_name;
527 check_data.m_AdditionalExcludes.Insert(action_data.m_Player);
528
529 if (!construction.IsCollidingEx(check_data) && construction.CanBuildPart(part_name, action_data.m_MainItem, true)) //redundant at this point?
530 {
531 //build
532 construction.BuildPartServer(action_data.m_Player, part_name, AT_BUILD_PART);
533 //add damage to tool
534 action_data.m_MainItem.DecreaseHealth(UADamageApplied.BUILD, false);
535 }
536 }
537
538 override string GetSoundCategory(ActionData action_data)
539 {
540 return "Base_building";
541 }
542
543 override ActionData CreateActionData()
544 {
546 return action_data;
547 }
548
549 //setup
550 override bool SetupAction(PlayerBase player, ActionTarget target, ItemBase item, out ActionData action_data, Param extra_data = NULL)
551 {
552 if (super.SetupAction(player, target, item, action_data, extra_data))
553 {
555
556 if (!GetGame().IsDedicatedServer())
557 {
558 ConstructionActionData construction_action_data = action_data.m_Player.GetConstructionActionData();
559 BuildPartActionData.Cast(action_data).m_PartType = construction_action_data.GetBuildPartAtIndex(m_VariantID).GetPartName();
560 }
561 return true;
562 }
563
564 return false;
565 }
566
567 protected void SetBuildingAnimation(ItemBase item)
568 {
569 switch (item.Type())
570 {
571 case Pickaxe:
572 case Shovel:
573 case FarmingHoe:
574 case FieldShovel:
575 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_DIG;
576 break;
577 case Pliers:
578 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_INTERACT;
579 break;
580 case SledgeHammer:
581 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_MINEROCK;
582 break;
583 default:
584 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_ASSEMBLE;
585 break;
586 }
587 }
588
589 override void WriteToContext(ParamsWriteContext ctx, ActionData action_data)
590 {
591 super.WriteToContext(ctx, action_data);
592
593 ctx.Write(BuildPartActionData.Cast(action_data).m_PartType);
594 }
595
596 override bool ReadFromContext(ParamsReadContext ctx, out ActionReciveData action_recive_data)
597 {
599 super.ReadFromContext(ctx, action_recive_data);
600
601 string part_type;
602 if (ctx.Read(part_type))
603 {
605 return true;
606 }
607 else
608 {
609 return false;
610 }
611 }
612
613 override void HandleReciveData(ActionReciveData action_recive_data, ActionData action_data)
614 {
615 super.HandleReciveData(action_recive_data, action_data);
616
618 }
619
620 override string GetAdminLogMessage(ActionData action_data)
621 {
622 ConstructionActionData construction_action_data = action_data.m_Player.GetConstructionActionData();
623 string partName = BuildPartActionData.Cast(action_data).m_PartType;
624
625 string message = string.Format("Built %1 on %2 with %3", partName, action_data.m_Target.GetObject().GetDisplayName(), action_data.m_MainItem.GetDisplayName());
626 return message;
627 }
628}
629
631{
632 override typename GetInputType()
633 {
635 }
636
637 override bool UseMainItem()
638 {
639 return false;
640 }
641
642 override bool HasProgress()
643 {
644 return true;
645 }
646
647 override bool HasAlternativeInterrupt()
648 {
649 return false;
650 }
651}

◆ HasAlternativeInterrupt()

override bool HasAlternativeInterrupt ( )
242 {
243 return false;
244 }

◆ HasProgress()

override bool HasProgress ( )
237 {
238 return true;
239 }

◆ OnActionInfoUpdate()

override void OnActionInfoUpdate ( PlayerBase player,
ActionTarget target,
ItemBase item )

◆ OnFinishProgressServer()

override void OnFinishProgressServer ( ActionData action_data)
312 : ActionReciveData
313{
314 string m_PartType;
315}
316
317class BuildPartActionData : ActionData
318{
319 string m_PartType;
320};
321
323{
324 override void CreateActionComponent()
325 {
326 float time = SetCallbackDuration(m_ActionData.m_MainItem);
327 m_ActionData.m_ActionComponent = new CAContinuousTime(time);
328 }
329
331 {
333 }
334};
335
337{
338 void ActionBuildPart()
339 {
341 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_ASSEMBLE;
342 m_FullBody = true;
343 m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT;
344
346 m_Text = "#build";
347 }
348
349 override void CreateConditionComponents()
350 {
353 }
354
355 override void OnActionInfoUpdate(PlayerBase player, ActionTarget target, ItemBase item)
356 {
357 ConstructionActionData construction_action_data = player.GetConstructionActionData();
359
361 {
362 m_Text = "#build " + constrution_part.GetName();
363 }
364 }
365
366 override bool CanBeUsedLeaning()
367 {
368 return false;
369 }
370
371 override bool CanBeUsedInFreelook()
372 {
373 return false;
374 }
375
376 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
377 {
378 if (player.IsPlacingLocal() || player.IsPlacingServer())
379 return false;
380
381 //Action not allowed if player has broken legs
382 if (player.GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS)
383 return false;
384
385 //gate..
386 if (target.GetObject() && (!target.GetObject().CanUseConstructionBuild() || target.GetObject().CanUseHandConstruction()))
387 return false;
388
389 if ((!GetGame().IsDedicatedServer()))
390 {
391 if (MiscGameplayFunctions.ComplexBuildCollideCheckClient(player, target, item, m_VariantID))
392 {
393 return true;
394 }
395 return false;
396 }
397 return true;
398 }
399
400 override bool ActionConditionContinue(ActionData action_data)
401 {
402 BaseBuildingBase base_building = BaseBuildingBase.Cast(action_data.m_Target.GetObject());
403 Construction construction = base_building.GetConstruction();
404 string part_name = BuildPartActionData.Cast(action_data).m_PartType;
406
407 check_data.m_PartName = part_name;
408 check_data.m_AdditionalExcludes.Insert(action_data.m_Player);
409
410 bool canBuild = construction.CanBuildPart(part_name, action_data.m_MainItem, true);
411 if (GetGame().IsServer())
412 {
413 bool collides = construction.IsCollidingEx(check_data);
414
415 return !collides && canBuild;
416 }
417 else
418 {
419 return canBuild;
420 }
421 }
422
423 override void OnFinishProgressServer(ActionData action_data)
424 {
425 BaseBuildingBase base_building = BaseBuildingBase.Cast(action_data.m_Target.GetObject());
426 Construction construction = base_building.GetConstruction();
427
428 string part_name = BuildPartActionData.Cast(action_data).m_PartType;
430
431 check_data.m_PartName = part_name;
432 check_data.m_AdditionalExcludes.Insert(action_data.m_Player);
433
434 if (!construction.IsCollidingEx(check_data) && construction.CanBuildPart(part_name, action_data.m_MainItem, true)) //redundant at this point?
435 {
436 //build
437 construction.BuildPartServer(action_data.m_Player, part_name, AT_BUILD_PART);
438 //add damage to tool
439 action_data.m_MainItem.DecreaseHealth(UADamageApplied.BUILD, false);
440 }
441 }
442
443 override string GetSoundCategory(ActionData action_data)
444 {
445 return "Base_building";
446 }
447
448 override ActionData CreateActionData()
449 {
451 return action_data;
452 }
453
454 //setup
455 override bool SetupAction(PlayerBase player, ActionTarget target, ItemBase item, out ActionData action_data, Param extra_data = NULL)
456 {
457 if (super.SetupAction(player, target, item, action_data, extra_data))
458 {
460
461 if (!GetGame().IsDedicatedServer())
462 {
463 ConstructionActionData construction_action_data = action_data.m_Player.GetConstructionActionData();
464 BuildPartActionData.Cast(action_data).m_PartType = construction_action_data.GetBuildPartAtIndex(m_VariantID).GetPartName();
465 }
466 return true;
467 }
468
469 return false;
470 }
471
472 protected void SetBuildingAnimation(ItemBase item)
473 {
474 switch (item.Type())
475 {
476 case Pickaxe:
477 case Shovel:
478 case FarmingHoe:
479 case FieldShovel:
480 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_DIG;
481 break;
482 case Pliers:
483 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_INTERACT;
484 break;
485 case SledgeHammer:
486 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_MINEROCK;
487 break;
488 default:
489 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_ASSEMBLE;
490 break;
491 }
492 }
493
494 override void WriteToContext(ParamsWriteContext ctx, ActionData action_data)
495 {
496 super.WriteToContext(ctx, action_data);
497
498 ctx.Write(BuildPartActionData.Cast(action_data).m_PartType);
499 }
500
501 override bool ReadFromContext(ParamsReadContext ctx, out ActionReciveData action_recive_data)
502 {
504 super.ReadFromContext(ctx, action_recive_data);
505
506 string part_type;
507 if (ctx.Read(part_type))
508 {
510 return true;
511 }
512 else
513 {
514 return false;
515 }
516 }
517
518 override void HandleReciveData(ActionReciveData action_recive_data, ActionData action_data)
519 {
520 super.HandleReciveData(action_recive_data, action_data);
521
523 }
524
525 override string GetAdminLogMessage(ActionData action_data)
526 {
527 ConstructionActionData construction_action_data = action_data.m_Player.GetConstructionActionData();
528 string partName = BuildPartActionData.Cast(action_data).m_PartType;
529
530 string message = string.Format("Built %1 on %2 with %3", partName, action_data.m_Target.GetObject().GetDisplayName(), action_data.m_MainItem.GetDisplayName());
531 return message;
532 }
533}
534
536{
537 override typename GetInputType()
538 {
540 }
541
542 override bool UseMainItem()
543 {
544 return false;
545 }
546
547 override bool HasProgress()
548 {
549 return true;
550 }
551
552 override bool HasAlternativeInterrupt()
553 {
554 return false;
555 }
556}

◆ ReadFromContext()

override bool ReadFromContext ( ParamsReadContext ctx,
out ActionReciveData action_recive_data )
protected
390 : ActionReciveData
391{
392 string m_PartType;
393}
394
395class BuildPartActionData : ActionData
396{
397 string m_PartType;
398};
399
401{
402 override void CreateActionComponent()
403 {
404 float time = SetCallbackDuration(m_ActionData.m_MainItem);
405 m_ActionData.m_ActionComponent = new CAContinuousTime(time);
406 }
407
409 {
411 }
412};
413
415{
416 void ActionBuildPart()
417 {
419 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_ASSEMBLE;
420 m_FullBody = true;
421 m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT;
422
424 m_Text = "#build";
425 }
426
427 override void CreateConditionComponents()
428 {
431 }
432
433 override void OnActionInfoUpdate(PlayerBase player, ActionTarget target, ItemBase item)
434 {
435 ConstructionActionData construction_action_data = player.GetConstructionActionData();
437
439 {
440 m_Text = "#build " + constrution_part.GetName();
441 }
442 }
443
444 override bool CanBeUsedLeaning()
445 {
446 return false;
447 }
448
449 override bool CanBeUsedInFreelook()
450 {
451 return false;
452 }
453
454 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
455 {
456 if (player.IsPlacingLocal() || player.IsPlacingServer())
457 return false;
458
459 //Action not allowed if player has broken legs
460 if (player.GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS)
461 return false;
462
463 //gate..
464 if (target.GetObject() && (!target.GetObject().CanUseConstructionBuild() || target.GetObject().CanUseHandConstruction()))
465 return false;
466
467 if ((!GetGame().IsDedicatedServer()))
468 {
469 if (MiscGameplayFunctions.ComplexBuildCollideCheckClient(player, target, item, m_VariantID))
470 {
471 return true;
472 }
473 return false;
474 }
475 return true;
476 }
477
478 override bool ActionConditionContinue(ActionData action_data)
479 {
480 BaseBuildingBase base_building = BaseBuildingBase.Cast(action_data.m_Target.GetObject());
481 Construction construction = base_building.GetConstruction();
482 string part_name = BuildPartActionData.Cast(action_data).m_PartType;
484
485 check_data.m_PartName = part_name;
486 check_data.m_AdditionalExcludes.Insert(action_data.m_Player);
487
488 bool canBuild = construction.CanBuildPart(part_name, action_data.m_MainItem, true);
489 if (GetGame().IsServer())
490 {
491 bool collides = construction.IsCollidingEx(check_data);
492
493 return !collides && canBuild;
494 }
495 else
496 {
497 return canBuild;
498 }
499 }
500
501 override void OnFinishProgressServer(ActionData action_data)
502 {
503 BaseBuildingBase base_building = BaseBuildingBase.Cast(action_data.m_Target.GetObject());
504 Construction construction = base_building.GetConstruction();
505
506 string part_name = BuildPartActionData.Cast(action_data).m_PartType;
508
509 check_data.m_PartName = part_name;
510 check_data.m_AdditionalExcludes.Insert(action_data.m_Player);
511
512 if (!construction.IsCollidingEx(check_data) && construction.CanBuildPart(part_name, action_data.m_MainItem, true)) //redundant at this point?
513 {
514 //build
515 construction.BuildPartServer(action_data.m_Player, part_name, AT_BUILD_PART);
516 //add damage to tool
517 action_data.m_MainItem.DecreaseHealth(UADamageApplied.BUILD, false);
518 }
519 }
520
521 override string GetSoundCategory(ActionData action_data)
522 {
523 return "Base_building";
524 }
525
526 override ActionData CreateActionData()
527 {
529 return action_data;
530 }
531
532 //setup
533 override bool SetupAction(PlayerBase player, ActionTarget target, ItemBase item, out ActionData action_data, Param extra_data = NULL)
534 {
535 if (super.SetupAction(player, target, item, action_data, extra_data))
536 {
538
539 if (!GetGame().IsDedicatedServer())
540 {
541 ConstructionActionData construction_action_data = action_data.m_Player.GetConstructionActionData();
542 BuildPartActionData.Cast(action_data).m_PartType = construction_action_data.GetBuildPartAtIndex(m_VariantID).GetPartName();
543 }
544 return true;
545 }
546
547 return false;
548 }
549
550 protected void SetBuildingAnimation(ItemBase item)
551 {
552 switch (item.Type())
553 {
554 case Pickaxe:
555 case Shovel:
556 case FarmingHoe:
557 case FieldShovel:
558 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_DIG;
559 break;
560 case Pliers:
561 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_INTERACT;
562 break;
563 case SledgeHammer:
564 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_MINEROCK;
565 break;
566 default:
567 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_ASSEMBLE;
568 break;
569 }
570 }
571
572 override void WriteToContext(ParamsWriteContext ctx, ActionData action_data)
573 {
574 super.WriteToContext(ctx, action_data);
575
576 ctx.Write(BuildPartActionData.Cast(action_data).m_PartType);
577 }
578
579 override bool ReadFromContext(ParamsReadContext ctx, out ActionReciveData action_recive_data)
580 {
582 super.ReadFromContext(ctx, action_recive_data);
583
584 string part_type;
585 if (ctx.Read(part_type))
586 {
588 return true;
589 }
590 else
591 {
592 return false;
593 }
594 }
595
596 override void HandleReciveData(ActionReciveData action_recive_data, ActionData action_data)
597 {
598 super.HandleReciveData(action_recive_data, action_data);
599
601 }
602
603 override string GetAdminLogMessage(ActionData action_data)
604 {
605 ConstructionActionData construction_action_data = action_data.m_Player.GetConstructionActionData();
606 string partName = BuildPartActionData.Cast(action_data).m_PartType;
607
608 string message = string.Format("Built %1 on %2 with %3", partName, action_data.m_Target.GetObject().GetDisplayName(), action_data.m_MainItem.GetDisplayName());
609 return message;
610 }
611}
612
614{
615 override typename GetInputType()
616 {
618 }
619
620 override bool UseMainItem()
621 {
622 return false;
623 }
624
625 override bool HasProgress()
626 {
627 return true;
628 }
629
630 override bool HasAlternativeInterrupt()
631 {
632 return false;
633 }
634}

◆ SetBuildingAnimation()

void SetBuildingAnimation ( ItemBase item)
protected
361 : ActionReciveData
362{
363 string m_PartType;
364}
365
366class BuildPartActionData : ActionData
367{
368 string m_PartType;
369};
370
372{
373 override void CreateActionComponent()
374 {
375 float time = SetCallbackDuration(m_ActionData.m_MainItem);
376 m_ActionData.m_ActionComponent = new CAContinuousTime(time);
377 }
378
380 {
382 }
383};
384
386{
387 void ActionBuildPart()
388 {
390 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_ASSEMBLE;
391 m_FullBody = true;
392 m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT;
393
395 m_Text = "#build";
396 }
397
398 override void CreateConditionComponents()
399 {
402 }
403
404 override void OnActionInfoUpdate(PlayerBase player, ActionTarget target, ItemBase item)
405 {
406 ConstructionActionData construction_action_data = player.GetConstructionActionData();
408
410 {
411 m_Text = "#build " + constrution_part.GetName();
412 }
413 }
414
415 override bool CanBeUsedLeaning()
416 {
417 return false;
418 }
419
420 override bool CanBeUsedInFreelook()
421 {
422 return false;
423 }
424
425 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
426 {
427 if (player.IsPlacingLocal() || player.IsPlacingServer())
428 return false;
429
430 //Action not allowed if player has broken legs
431 if (player.GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS)
432 return false;
433
434 //gate..
435 if (target.GetObject() && (!target.GetObject().CanUseConstructionBuild() || target.GetObject().CanUseHandConstruction()))
436 return false;
437
438 if ((!GetGame().IsDedicatedServer()))
439 {
440 if (MiscGameplayFunctions.ComplexBuildCollideCheckClient(player, target, item, m_VariantID))
441 {
442 return true;
443 }
444 return false;
445 }
446 return true;
447 }
448
449 override bool ActionConditionContinue(ActionData action_data)
450 {
451 BaseBuildingBase base_building = BaseBuildingBase.Cast(action_data.m_Target.GetObject());
452 Construction construction = base_building.GetConstruction();
453 string part_name = BuildPartActionData.Cast(action_data).m_PartType;
455
456 check_data.m_PartName = part_name;
457 check_data.m_AdditionalExcludes.Insert(action_data.m_Player);
458
459 bool canBuild = construction.CanBuildPart(part_name, action_data.m_MainItem, true);
460 if (GetGame().IsServer())
461 {
462 bool collides = construction.IsCollidingEx(check_data);
463
464 return !collides && canBuild;
465 }
466 else
467 {
468 return canBuild;
469 }
470 }
471
472 override void OnFinishProgressServer(ActionData action_data)
473 {
474 BaseBuildingBase base_building = BaseBuildingBase.Cast(action_data.m_Target.GetObject());
475 Construction construction = base_building.GetConstruction();
476
477 string part_name = BuildPartActionData.Cast(action_data).m_PartType;
479
480 check_data.m_PartName = part_name;
481 check_data.m_AdditionalExcludes.Insert(action_data.m_Player);
482
483 if (!construction.IsCollidingEx(check_data) && construction.CanBuildPart(part_name, action_data.m_MainItem, true)) //redundant at this point?
484 {
485 //build
486 construction.BuildPartServer(action_data.m_Player, part_name, AT_BUILD_PART);
487 //add damage to tool
488 action_data.m_MainItem.DecreaseHealth(UADamageApplied.BUILD, false);
489 }
490 }
491
492 override string GetSoundCategory(ActionData action_data)
493 {
494 return "Base_building";
495 }
496
497 override ActionData CreateActionData()
498 {
500 return action_data;
501 }
502
503 //setup
504 override bool SetupAction(PlayerBase player, ActionTarget target, ItemBase item, out ActionData action_data, Param extra_data = NULL)
505 {
506 if (super.SetupAction(player, target, item, action_data, extra_data))
507 {
509
510 if (!GetGame().IsDedicatedServer())
511 {
512 ConstructionActionData construction_action_data = action_data.m_Player.GetConstructionActionData();
513 BuildPartActionData.Cast(action_data).m_PartType = construction_action_data.GetBuildPartAtIndex(m_VariantID).GetPartName();
514 }
515 return true;
516 }
517
518 return false;
519 }
520
521 protected void SetBuildingAnimation(ItemBase item)
522 {
523 switch (item.Type())
524 {
525 case Pickaxe:
526 case Shovel:
527 case FarmingHoe:
528 case FieldShovel:
529 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_DIG;
530 break;
531 case Pliers:
532 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_INTERACT;
533 break;
534 case SledgeHammer:
535 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_MINEROCK;
536 break;
537 default:
538 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_ASSEMBLE;
539 break;
540 }
541 }
542
543 override void WriteToContext(ParamsWriteContext ctx, ActionData action_data)
544 {
545 super.WriteToContext(ctx, action_data);
546
547 ctx.Write(BuildPartActionData.Cast(action_data).m_PartType);
548 }
549
550 override bool ReadFromContext(ParamsReadContext ctx, out ActionReciveData action_recive_data)
551 {
553 super.ReadFromContext(ctx, action_recive_data);
554
555 string part_type;
556 if (ctx.Read(part_type))
557 {
559 return true;
560 }
561 else
562 {
563 return false;
564 }
565 }
566
567 override void HandleReciveData(ActionReciveData action_recive_data, ActionData action_data)
568 {
569 super.HandleReciveData(action_recive_data, action_data);
570
572 }
573
574 override string GetAdminLogMessage(ActionData action_data)
575 {
576 ConstructionActionData construction_action_data = action_data.m_Player.GetConstructionActionData();
577 string partName = BuildPartActionData.Cast(action_data).m_PartType;
578
579 string message = string.Format("Built %1 on %2 with %3", partName, action_data.m_Target.GetObject().GetDisplayName(), action_data.m_MainItem.GetDisplayName());
580 return message;
581 }
582}
583
585{
586 override typename GetInputType()
587 {
589 }
590
591 override bool UseMainItem()
592 {
593 return false;
594 }
595
596 override bool HasProgress()
597 {
598 return true;
599 }
600
601 override bool HasAlternativeInterrupt()
602 {
603 return false;
604 }
605}

◆ SetupAction()

override bool SetupAction ( PlayerBase player,
ActionTarget target,
ItemBase item,
out ActionData action_data,
Param extra_data = NULL )
344 : ActionReciveData
345{
346 string m_PartType;
347}
348
349class BuildPartActionData : ActionData
350{
351 string m_PartType;
352};
353
355{
356 override void CreateActionComponent()
357 {
358 float time = SetCallbackDuration(m_ActionData.m_MainItem);
359 m_ActionData.m_ActionComponent = new CAContinuousTime(time);
360 }
361
363 {
365 }
366};
367
369{
370 void ActionBuildPart()
371 {
373 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_ASSEMBLE;
374 m_FullBody = true;
375 m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT;
376
378 m_Text = "#build";
379 }
380
381 override void CreateConditionComponents()
382 {
385 }
386
387 override void OnActionInfoUpdate(PlayerBase player, ActionTarget target, ItemBase item)
388 {
389 ConstructionActionData construction_action_data = player.GetConstructionActionData();
391
393 {
394 m_Text = "#build " + constrution_part.GetName();
395 }
396 }
397
398 override bool CanBeUsedLeaning()
399 {
400 return false;
401 }
402
403 override bool CanBeUsedInFreelook()
404 {
405 return false;
406 }
407
408 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
409 {
410 if (player.IsPlacingLocal() || player.IsPlacingServer())
411 return false;
412
413 //Action not allowed if player has broken legs
414 if (player.GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS)
415 return false;
416
417 //gate..
418 if (target.GetObject() && (!target.GetObject().CanUseConstructionBuild() || target.GetObject().CanUseHandConstruction()))
419 return false;
420
421 if ((!GetGame().IsDedicatedServer()))
422 {
423 if (MiscGameplayFunctions.ComplexBuildCollideCheckClient(player, target, item, m_VariantID))
424 {
425 return true;
426 }
427 return false;
428 }
429 return true;
430 }
431
432 override bool ActionConditionContinue(ActionData action_data)
433 {
434 BaseBuildingBase base_building = BaseBuildingBase.Cast(action_data.m_Target.GetObject());
435 Construction construction = base_building.GetConstruction();
436 string part_name = BuildPartActionData.Cast(action_data).m_PartType;
438
439 check_data.m_PartName = part_name;
440 check_data.m_AdditionalExcludes.Insert(action_data.m_Player);
441
442 bool canBuild = construction.CanBuildPart(part_name, action_data.m_MainItem, true);
443 if (GetGame().IsServer())
444 {
445 bool collides = construction.IsCollidingEx(check_data);
446
447 return !collides && canBuild;
448 }
449 else
450 {
451 return canBuild;
452 }
453 }
454
455 override void OnFinishProgressServer(ActionData action_data)
456 {
457 BaseBuildingBase base_building = BaseBuildingBase.Cast(action_data.m_Target.GetObject());
458 Construction construction = base_building.GetConstruction();
459
460 string part_name = BuildPartActionData.Cast(action_data).m_PartType;
462
463 check_data.m_PartName = part_name;
464 check_data.m_AdditionalExcludes.Insert(action_data.m_Player);
465
466 if (!construction.IsCollidingEx(check_data) && construction.CanBuildPart(part_name, action_data.m_MainItem, true)) //redundant at this point?
467 {
468 //build
469 construction.BuildPartServer(action_data.m_Player, part_name, AT_BUILD_PART);
470 //add damage to tool
471 action_data.m_MainItem.DecreaseHealth(UADamageApplied.BUILD, false);
472 }
473 }
474
475 override string GetSoundCategory(ActionData action_data)
476 {
477 return "Base_building";
478 }
479
480 override ActionData CreateActionData()
481 {
483 return action_data;
484 }
485
486 //setup
487 override bool SetupAction(PlayerBase player, ActionTarget target, ItemBase item, out ActionData action_data, Param extra_data = NULL)
488 {
489 if (super.SetupAction(player, target, item, action_data, extra_data))
490 {
492
493 if (!GetGame().IsDedicatedServer())
494 {
495 ConstructionActionData construction_action_data = action_data.m_Player.GetConstructionActionData();
496 BuildPartActionData.Cast(action_data).m_PartType = construction_action_data.GetBuildPartAtIndex(m_VariantID).GetPartName();
497 }
498 return true;
499 }
500
501 return false;
502 }
503
504 protected void SetBuildingAnimation(ItemBase item)
505 {
506 switch (item.Type())
507 {
508 case Pickaxe:
509 case Shovel:
510 case FarmingHoe:
511 case FieldShovel:
512 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_DIG;
513 break;
514 case Pliers:
515 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_INTERACT;
516 break;
517 case SledgeHammer:
518 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_MINEROCK;
519 break;
520 default:
521 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_ASSEMBLE;
522 break;
523 }
524 }
525
526 override void WriteToContext(ParamsWriteContext ctx, ActionData action_data)
527 {
528 super.WriteToContext(ctx, action_data);
529
530 ctx.Write(BuildPartActionData.Cast(action_data).m_PartType);
531 }
532
533 override bool ReadFromContext(ParamsReadContext ctx, out ActionReciveData action_recive_data)
534 {
536 super.ReadFromContext(ctx, action_recive_data);
537
538 string part_type;
539 if (ctx.Read(part_type))
540 {
542 return true;
543 }
544 else
545 {
546 return false;
547 }
548 }
549
550 override void HandleReciveData(ActionReciveData action_recive_data, ActionData action_data)
551 {
552 super.HandleReciveData(action_recive_data, action_data);
553
555 }
556
557 override string GetAdminLogMessage(ActionData action_data)
558 {
559 ConstructionActionData construction_action_data = action_data.m_Player.GetConstructionActionData();
560 string partName = BuildPartActionData.Cast(action_data).m_PartType;
561
562 string message = string.Format("Built %1 on %2 with %3", partName, action_data.m_Target.GetObject().GetDisplayName(), action_data.m_MainItem.GetDisplayName());
563 return message;
564 }
565}
566
568{
569 override typename GetInputType()
570 {
572 }
573
574 override bool UseMainItem()
575 {
576 return false;
577 }
578
579 override bool HasProgress()
580 {
581 return true;
582 }
583
584 override bool HasAlternativeInterrupt()
585 {
586 return false;
587 }
588}

◆ UseMainItem()

override bool UseMainItem ( )
232 {
233 return false;
234 }

◆ WriteToContext()

override void WriteToContext ( ParamsWriteContext ctx,
ActionData action_data )
protected
383 : ActionReciveData
384{
385 string m_PartType;
386}
387
388class BuildPartActionData : ActionData
389{
390 string m_PartType;
391};
392
394{
395 override void CreateActionComponent()
396 {
397 float time = SetCallbackDuration(m_ActionData.m_MainItem);
398 m_ActionData.m_ActionComponent = new CAContinuousTime(time);
399 }
400
402 {
404 }
405};
406
408{
409 void ActionBuildPart()
410 {
412 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_ASSEMBLE;
413 m_FullBody = true;
414 m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT;
415
417 m_Text = "#build";
418 }
419
420 override void CreateConditionComponents()
421 {
424 }
425
426 override void OnActionInfoUpdate(PlayerBase player, ActionTarget target, ItemBase item)
427 {
428 ConstructionActionData construction_action_data = player.GetConstructionActionData();
430
432 {
433 m_Text = "#build " + constrution_part.GetName();
434 }
435 }
436
437 override bool CanBeUsedLeaning()
438 {
439 return false;
440 }
441
442 override bool CanBeUsedInFreelook()
443 {
444 return false;
445 }
446
447 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
448 {
449 if (player.IsPlacingLocal() || player.IsPlacingServer())
450 return false;
451
452 //Action not allowed if player has broken legs
453 if (player.GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS)
454 return false;
455
456 //gate..
457 if (target.GetObject() && (!target.GetObject().CanUseConstructionBuild() || target.GetObject().CanUseHandConstruction()))
458 return false;
459
460 if ((!GetGame().IsDedicatedServer()))
461 {
462 if (MiscGameplayFunctions.ComplexBuildCollideCheckClient(player, target, item, m_VariantID))
463 {
464 return true;
465 }
466 return false;
467 }
468 return true;
469 }
470
471 override bool ActionConditionContinue(ActionData action_data)
472 {
473 BaseBuildingBase base_building = BaseBuildingBase.Cast(action_data.m_Target.GetObject());
474 Construction construction = base_building.GetConstruction();
475 string part_name = BuildPartActionData.Cast(action_data).m_PartType;
477
478 check_data.m_PartName = part_name;
479 check_data.m_AdditionalExcludes.Insert(action_data.m_Player);
480
481 bool canBuild = construction.CanBuildPart(part_name, action_data.m_MainItem, true);
482 if (GetGame().IsServer())
483 {
484 bool collides = construction.IsCollidingEx(check_data);
485
486 return !collides && canBuild;
487 }
488 else
489 {
490 return canBuild;
491 }
492 }
493
494 override void OnFinishProgressServer(ActionData action_data)
495 {
496 BaseBuildingBase base_building = BaseBuildingBase.Cast(action_data.m_Target.GetObject());
497 Construction construction = base_building.GetConstruction();
498
499 string part_name = BuildPartActionData.Cast(action_data).m_PartType;
501
502 check_data.m_PartName = part_name;
503 check_data.m_AdditionalExcludes.Insert(action_data.m_Player);
504
505 if (!construction.IsCollidingEx(check_data) && construction.CanBuildPart(part_name, action_data.m_MainItem, true)) //redundant at this point?
506 {
507 //build
508 construction.BuildPartServer(action_data.m_Player, part_name, AT_BUILD_PART);
509 //add damage to tool
510 action_data.m_MainItem.DecreaseHealth(UADamageApplied.BUILD, false);
511 }
512 }
513
514 override string GetSoundCategory(ActionData action_data)
515 {
516 return "Base_building";
517 }
518
519 override ActionData CreateActionData()
520 {
522 return action_data;
523 }
524
525 //setup
526 override bool SetupAction(PlayerBase player, ActionTarget target, ItemBase item, out ActionData action_data, Param extra_data = NULL)
527 {
528 if (super.SetupAction(player, target, item, action_data, extra_data))
529 {
531
532 if (!GetGame().IsDedicatedServer())
533 {
534 ConstructionActionData construction_action_data = action_data.m_Player.GetConstructionActionData();
535 BuildPartActionData.Cast(action_data).m_PartType = construction_action_data.GetBuildPartAtIndex(m_VariantID).GetPartName();
536 }
537 return true;
538 }
539
540 return false;
541 }
542
543 protected void SetBuildingAnimation(ItemBase item)
544 {
545 switch (item.Type())
546 {
547 case Pickaxe:
548 case Shovel:
549 case FarmingHoe:
550 case FieldShovel:
551 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_DIG;
552 break;
553 case Pliers:
554 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_INTERACT;
555 break;
556 case SledgeHammer:
557 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_MINEROCK;
558 break;
559 default:
560 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_ASSEMBLE;
561 break;
562 }
563 }
564
565 override void WriteToContext(ParamsWriteContext ctx, ActionData action_data)
566 {
567 super.WriteToContext(ctx, action_data);
568
569 ctx.Write(BuildPartActionData.Cast(action_data).m_PartType);
570 }
571
572 override bool ReadFromContext(ParamsReadContext ctx, out ActionReciveData action_recive_data)
573 {
575 super.ReadFromContext(ctx, action_recive_data);
576
577 string part_type;
578 if (ctx.Read(part_type))
579 {
581 return true;
582 }
583 else
584 {
585 return false;
586 }
587 }
588
589 override void HandleReciveData(ActionReciveData action_recive_data, ActionData action_data)
590 {
591 super.HandleReciveData(action_recive_data, action_data);
592
594 }
595
596 override string GetAdminLogMessage(ActionData action_data)
597 {
598 ConstructionActionData construction_action_data = action_data.m_Player.GetConstructionActionData();
599 string partName = BuildPartActionData.Cast(action_data).m_PartType;
600
601 string message = string.Format("Built %1 on %2 with %3", partName, action_data.m_Target.GetObject().GetDisplayName(), action_data.m_MainItem.GetDisplayName());
602 return message;
603 }
604}
605
607{
608 override typename GetInputType()
609 {
611 }
612
613 override bool UseMainItem()
614 {
615 return false;
616 }
617
618 override bool HasProgress()
619 {
620 return true;
621 }
622
623 override bool HasAlternativeInterrupt()
624 {
625 return false;
626 }
627}

Переменные

◆ m_PartType