Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actionuncoverheadself.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 
9 
11 {
12  void UncoverHead(PlayerBase target, PlayerBase source)
13  {
14  EntityAI attachment;
15  if (Class.CastTo(attachment, target.GetInventory().FindAttachment(InventorySlots.HEADGEAR)) && attachment.GetType() == "BurlapSackCover")
16  {
17  ItemBase new_item = null;
18  if (!source.GetHumanInventory().GetEntityInHands())
19  {
20  new_item = ItemBase.Cast(HumanInventory.Cast(source.GetInventory()).CreateInHands("BurlapSack"));
21  }
22  else
23  {
24  if (!Class.CastTo(new_item,source.GetInventory().CreateInInventory("BurlapSack")))//full inventory
25  {
26  vector m4[4];
27  source.GetTransformWS(m4);
28  InventoryLocation target_gnd = new InventoryLocation;
29  target_gnd.SetGround(null, m4);
30  new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(target_gnd, "BurlapSack",ECE_IN_INVENTORY,RF_DEFAULT));
31  }
32  }
33 
34  if (new_item)
35  {
36  MiscGameplayFunctions.TransferItemProperties(attachment,new_item,true,false,true);
37  attachment.Delete();
38 
39  source.GetSoftSkillsManager().AddSpecialty(m_SpecialtyWeight);
40  }
41  }
42  }
43 
44 }
45 
47 {
49  {
50  m_CallbackClass = ActionUncoverHeadSelfCB;
51  m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_COVERHEAD_SELF;
52  m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT | DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_PRONE;
53 
54  m_Text = "#uncover_head";
55  }
56 
57  override void CreateConditionComponents()
58  {
61  }
62 
63  override bool HasTarget()
64  {
65  return false;
66  }
67 
68  override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
69  {
70  if ( IsWearingBurlap(player) )
71  return true;
72 
73  return false;
74  }
75 
76  override void OnFinishProgressServer( ActionData action_data )
77  {
78  UncoverHead(action_data.m_Player, action_data.m_Player);
79  }
80 
81 
82  bool IsWearingBurlap( PlayerBase player )
83  {
84  EntityAI attachment;
85  Class.CastTo(attachment, player.GetInventory().FindAttachment(InventorySlots.HEADGEAR));
86  if ( attachment && attachment.IsInherited(BurlapSackCover) )
87  {
88  return true;
89  }
90  return false;
91  }
92 };
ItemBase
Definition: inventoryitem.c:730
RF_DEFAULT
const int RF_DEFAULT
Definition: centraleconomy.c:65
CAContinuousTime
Definition: cacontinuoustime.c:1
InventorySlots
provides access to slot configuration
Definition: inventoryslots.c:5
UncoverHead
void UncoverHead(PlayerBase target, PlayerBase source)
Definition: actionuncoverheadself.c:2
CCINone
Definition: ccinone.c:1
InventoryLocation
InventoryLocation.
Definition: inventorylocation.c:27
CCTNone
Definition: cctnone.c:1
OnFinishProgressServer
override void OnFinishProgressServer(ActionData action_data)
Definition: actionuncoverheadself.c:76
PlayerBase
Definition: playerbaseclient.c:1
vector
Definition: enconvert.c:105
ActionUncoverHeadSelf
ActionUncoverHeadBase ActionContinuousBase ActionUncoverHeadSelf()
Definition: actionuncoverheadself.c:48
ActionTarget
class ActionTargets ActionTarget
ActionData
Definition: actionbase.c:20
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition: dayzplayer.c:601
ActionUncoverHeadBase
Definition: actionuncoverheadself.c:10
CreateConditionComponents
override void CreateConditionComponents()
Definition: actionuncoverheadself.c:57
UATimeSpent
Definition: actionconstants.c:26
ActionContinuousBaseCB
Definition: actioncontinuousbase.c:1
ActionUncoverHeadSelfCB
Definition: actionuncoverheadself.c:1
ActionCondition
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Definition: actionuncoverheadself.c:68
HasTarget
override bool HasTarget()
Definition: actionuncoverheadself.c:63
m_Text
protected string m_Text
Definition: actionbase.c:49
m_ConditionItem
ref CCIBase m_ConditionItem
Definition: actionbase.c:55
HumanInventory
inventory for plain man/human
Definition: humaninventory.c:9
IsWearingBurlap
bool IsWearingBurlap(PlayerBase player)
Definition: actionuncoverheadself.c:82
ActionContinuousBase
Definition: actioncontinuousbase.c:132
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
EntityAI
Definition: building.c:5
GameInventory
script counterpart to engine's class Inventory
Definition: inventory.c:78
ECE_IN_INVENTORY
const int ECE_IN_INVENTORY
Definition: centraleconomy.c:36