Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actiongagself.c
Go to the documentation of this file.
2 {
3  void ActionGagSelf()
4  {
5  m_CallbackClass = ActionCoverHeadSelfCB;
6  m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_COVERHEAD_SELF;
7  //m_FullBody = true;
8  m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT | DayZPlayerConstants.STANCEMASK_CROUCH;
10  m_Text = "#gag_self";
11  }
12 
13  override void CreateConditionComponents()
14  {
17  }
18 
19  override bool HasTarget()
20  {
21  return false;
22  }
23 
24  override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
25  {
26  if (item.GetQuantity() > 1)
27  return false;
28 
29  if ( !IsWearingMask(player) )
30  {
31  ItemBase headgear = ItemBase.Cast(player.FindAttachmentBySlotName( "Headgear" ));
32  if ( headgear )
33  {
34  bool headgear_restricted;
35  headgear_restricted = headgear.ConfigGetBool( "noMask" );
36  if (headgear_restricted)
37  {
38  return false;
39  }
40  }
41  return true;
42  }
43 
44  return false;
45  }
46 
47  override void OnFinishProgressServer( ActionData action_data )
48  {
49  ItemBase new_item;
50  if (Class.CastTo(new_item,action_data.m_Player.GetInventory().CreateAttachmentEx("MouthRag",InventorySlots.MASK)))
51  {
52  MiscGameplayFunctions.TransferItemProperties(action_data.m_MainItem,new_item,true,false,true);
53 
54  action_data.m_MainItem.TransferModifiers(action_data.m_Player);
55  action_data.m_MainItem.Delete();
56  }
57  }
58 
59  bool IsWearingMask( PlayerBase player)
60  {
61  if ( player.GetInventory().FindAttachment(InventorySlots.MASK) )
62  {
63  return true;
64  }
65  return false;
66  }
67 };
ItemBase
Definition: inventoryitem.c:730
InventorySlots
provides access to slot configuration
Definition: inventoryslots.c:5
ActionGagSelf
Definition: actiongagself.c:1
UASoftSkillsWeight
Definition: actionconstants.c:118
PlayerBase
Definition: playerbaseclient.c:1
ActionTarget
class ActionTargets ActionTarget
ActionData
Definition: actionbase.c:20
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition: dayzplayer.c:601
CCTSelf
Definition: cctself.c:1
m_Text
protected string m_Text
Definition: actionbase.c:49
m_ConditionItem
ref CCIBase m_ConditionItem
Definition: actionbase.c:55
ActionCoverHeadSelfCB
Definition: actioncoverheadself.c:1
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