Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actioncoverheadtarget.c
Go to the documentation of this file.
2 {
3  override void CreateActionComponent()
4  {
5  m_ActionData.m_ActionComponent = new CAContinuousTime(UATimeSpent.COVER_HEAD);
6  }
7 };
8 
10 {
12  {
13  m_CallbackClass = ActionCoverHeadTargetCB;
14  m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_COVERHEAD_TARGET;
15  m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT | DayZPlayerConstants.STANCEMASK_CROUCH;
16  //m_Animation = "INJECTEPIPENS";
18  m_Text = "#put_on_targets_head";
19  }
20 
21  override void CreateConditionComponents()
22  {
23 
25  m_ConditionTarget = new CCTMan(UAMaxDistances.DEFAULT);
26  }
27 
28  override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
29  {
30  PlayerBase targetPlayer;
31  Class.CastTo(targetPlayer, target.GetObject());
32  if ( !IsWearingHeadgear(targetPlayer) )
33  {
34  return true;
35  }
36 
37  return false;
38  }
39 
40  override void OnFinishProgressServer( ActionData action_data )
41  {
42  PlayerBase ntarget;
43 
44  if (Class.CastTo(ntarget, action_data.m_Target.GetObject()) && CanReceiveAction(action_data.m_Target))
45  {
46  CoverHeadOfTargetPlayerLambda lambda = new CoverHeadOfTargetPlayerLambda(action_data.m_MainItem, "BurlapSackCover", ntarget);
47  action_data.m_Player.ServerReplaceItemInHandsWithNewElsewhere(lambda);
48 
49  action_data.m_Player.GetSoftSkillsManager().AddSpecialty( m_SpecialtyWeight );
50  }
51  }
52 
53  bool IsWearingHeadgear( PlayerBase player)
54  {
55  if ( player.GetInventory().FindAttachment(InventorySlots.HEADGEAR) )
56  {
57  return true;
58  }
59  return false;
60  }
61 };
62 
64 {
65  PlayerBase m_TargetPlayer;
66 
67  void CoverHeadOfTargetPlayerLambda (EntityAI old_item, string new_item_type, PlayerBase player)
68  {
69  m_TargetPlayer = player;
70 
71  InventoryLocation targetAtt = new InventoryLocation;
72  targetAtt.SetAttachment(m_TargetPlayer, NULL, InventorySlots.HEADGEAR);
73  OverrideNewLocation(targetAtt);
74  }
75 };
ItemBase
Definition: inventoryitem.c:730
CAContinuousTime
Definition: cacontinuoustime.c:1
InventorySlots
provides access to slot configuration
Definition: inventoryslots.c:5
CCTMan
Definition: cctman.c:1
UASoftSkillsWeight
Definition: actionconstants.c:118
InventoryLocation
InventoryLocation.
Definition: inventorylocation.c:27
UAMaxDistances
Definition: actionconstants.c:104
CoverHeadOfTargetPlayerLambda
Definition: actioncoverheadtarget.c:63
ActionCoverHeadTarget
Definition: actioncoverheadtarget.c:9
PlayerBase
Definition: playerbaseclient.c:1
ActionTarget
class ActionTargets ActionTarget
ActionData
Definition: actionbase.c:20
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition: dayzplayer.c:601
UATimeSpent
Definition: actionconstants.c:26
ActionContinuousBaseCB
Definition: actioncontinuousbase.c:1
m_TargetPlayer
ChainedDropAndRestrainLambda m_TargetPlayer
m_Text
protected string m_Text
Definition: actionbase.c:49
m_ConditionItem
ref CCIBase m_ConditionItem
Definition: actionbase.c:55
ActionContinuousBase
Definition: actioncontinuousbase.c:132
CCINonRuined
Definition: ccinonruined.c:1
m_ConditionTarget
ref CCTBase m_ConditionTarget
Definition: actionbase.c:56
Class
Super root of all classes in Enforce script.
Definition: enscript.c:10
m_SpecialtyWeight
protected float m_SpecialtyWeight
Definition: actionbase.c:68
m_StanceMask
protected int m_StanceMask
Definition: actionbase.c:53
TurnItemIntoItemLambda
Definition: miscgameplayfunctions.c:91
EntityAI
Definition: building.c:5
ActionCoverHeadTargetCB
Definition: actioncoverheadtarget.c:1
CanReceiveAction
bool CanReceiveAction(ActionTarget target)
Definition: actionbase.c:638