Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
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 }
40 }
41
42}
43
45{
47 {
48 m_CallbackClass = ActionUncoverHeadSelfCB;
49 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_COVERHEAD_SELF;
50 m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT | DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_PRONE;
51
52 m_Text = "#uncover_head";
53 }
54
56 {
57 m_ConditionItem = new CCINone;
58 m_ConditionTarget = new CCTNone;
59 }
60
61 override bool HasTarget()
62 {
63 return false;
64 }
65
66 override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
67 {
68 if ( IsWearingBurlap(player) )
69 return true;
70
71 return false;
72 }
73
74 override void OnFinishProgressServer( ActionData action_data )
75 {
76 UncoverHead(action_data.m_Player, action_data.m_Player);
77 }
78
79
81 {
82 EntityAI attachment;
83 Class.CastTo(attachment, player.GetInventory().FindAttachment(InventorySlots.HEADGEAR));
84 if ( attachment && attachment.IsInherited(BurlapSackCover) )
85 {
86 return true;
87 }
88 return false;
89 }
90};
int m_CommandUID
Definition actionbase.c:31
int m_StanceMask
Definition actionbase.c:33
bool IsWearingBurlap(PlayerBase player)
ActionUncoverHeadBase ActionContinuousBase ActionUncoverHeadSelf()
void UncoverHead(PlayerBase target, PlayerBase source)
override void CreateConditionComponents()
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
override bool HasTarget()
const int ECE_IN_INVENTORY
const int RF_DEFAULT
ActionData m_ActionData
void OnFinishProgressServer(ActionData action_data)
Super root of all classes in Enforce script.
Definition enscript.c:11
script counterpart to engine's class Inventory
Definition inventory.c:79
static proto native EntityAI LocationCreateEntity(notnull InventoryLocation inv_loc, string type, int iSetupFlags, int iRotation)
creates new item directly at location
inventory for plain man/human
InventoryLocation.
provides access to slot configuration
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602