DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
ActionUncoverHeadSelf.c
Go to the documentation of this file.
2{
3 override void CreateActionComponent()
4 {
6 }
7};
8
9
11{
12 void UncoverHead(PlayerBase target, PlayerBase source)
13 {
14 EntityAI attachment;
15 if( !source.GetHumanInventory().GetEntityInHands() )
16 {
17 ItemBase item = ItemBase.Cast(HumanInventory.Cast(source.GetInventory()).CreateInHands("BurlapSack"));
18 }
19 else
20 {
21 EntityAI entity = source.GetInventory().CreateInInventory("BurlapSack");
22
23 if( !entity )//full inventory
24 {
25 vector m4[4];
26 source.GetTransformWS(m4);
27 InventoryLocation target_gnd = new InventoryLocation;
28 target_gnd.SetGround(null, m4);
29 entity = GameInventory.LocationCreateEntity(target_gnd, "BurlapSack",ECE_IN_INVENTORY,RF_DEFAULT);
30 }
31
32 ItemBase new_item = ItemBase.Cast(entity);
33
34 }
35
36 Class.CastTo(attachment, target.GetInventory().FindAttachment(InventorySlots.HEADGEAR));
37 if ( attachment && attachment.GetType() == "BurlapSackCover" )
38 {
39 if (new_item)
40 MiscGameplayFunctions.TransferItemProperties(attachment,new_item,true,false,true);
41
42 attachment.Delete();
43 }
44
45 source.GetSoftSkillsManager().AddSpecialty( m_SpecialtyWeight );
46 }
47
48}
49
51{
53 {
54 m_CallbackClass = ActionUncoverHeadSelfCB;
55 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_COVERHEAD_SELF;
56 m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT | DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_PRONE;
57
58 m_Text = "#uncover_head";
59 }
60
62 {
65 }
66
67 override bool HasTarget()
68 {
69 return false;
70 }
71
72 override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
73 {
74 if ( IsWearingBurlap(player) )
75 return true;
76
77 return false;
78 }
79
80 override void OnFinishProgressServer( ActionData action_data )
81 {
82 UncoverHead(action_data.m_Player, action_data.m_Player);
83
84 }
85
86
88 {
89 EntityAI attachment;
90 Class.CastTo(attachment, player.GetInventory().FindAttachment(InventorySlots.HEADGEAR));
91 if ( attachment && attachment.IsInherited(BurlapSackCover) )
92 {
93 return true;
94 }
95 return false;
96 }
97};
protected float m_SpecialtyWeight
Definition ActionBase.c:68
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
protected string m_Text
Definition ActionBase.c:49
protected int m_StanceMask
Definition ActionBase.c:53
class ActionTargets ActionTarget
bool IsWearingBurlap(PlayerBase player)
ActionUncoverHeadBase ActionContinuousBase ActionUncoverHeadSelf()
override void CreateConditionComponents()
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
override bool HasTarget()
const int ECE_IN_INVENTORY
const int RF_DEFAULT
protected ActionData m_ActionData
protected void OnFinishProgressServer(ActionData action_data)
PlayerBase m_Player
Definition ActionBase.c:33
ref CABase m_ActionComponent
Definition ActionBase.c:30
void UncoverHead(PlayerBase target, PlayerBase source)
override void CreateActionComponent()
Super root of all classes in Enforce script.
Definition EnScript.c:11
script counterpart to engine's class Inventory
Definition Inventory.c:77
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
proto native EntityAI CreateInHands(string typeName)
creates new entity in hands
InventoryLocation.
proto native void SetGround(EntityAI e, vector mat[4])
sets current inventory location type to Ground with transformation mat
provides access to slot configuration
const float COVER_HEAD
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.