Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actiongagtarget.c
Go to the documentation of this file.
2 {
3  void ActionGagTarget()
4  {
5  m_CallbackClass = ActionCoverHeadTargetCB;
6  m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_COVERHEAD_TARGET;
7  //m_FullBody = true;
8  m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT | DayZPlayerConstants.STANCEMASK_CROUCH;
10  m_Text = "#gag_person";
11  }
12 
13  override void CreateConditionComponents()
14  {
15 
17  m_ConditionTarget = new CCTMan(UAMaxDistances.DEFAULT);
18  }
19 
20  override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
21  {
22  if (item.GetQuantity() > 1)
23  return false;
24 
25  PlayerBase targetPlayer;
26  Class.CastTo(targetPlayer, target.GetObject());
27  if ( !IsWearingMask(targetPlayer) )
28  {
29  ItemBase headgear = ItemBase.Cast(targetPlayer.FindAttachmentBySlotName( "Headgear" ));
30  if ( headgear )
31  {
32  bool headgear_restricted;
33  headgear_restricted = headgear.ConfigGetBool( "noMask" );
34  if (headgear_restricted)
35  {
36  return false;
37  }
38  }
39  return true;
40  }
41 
42  return false;
43  }
44 
45  override void OnFinishProgressServer( ActionData action_data )
46  {
47  PlayerBase ntarget;
48  Class.CastTo(ntarget, action_data.m_Target.GetObject());
49 
50  if (CanReceiveAction(action_data.m_Target))
51  {
52  ItemBase m_Gag;
53  if (Class.CastTo(m_Gag,ntarget.GetInventory().CreateAttachmentEx("MouthRag",InventorySlots.MASK)))
54  {
55  m_Gag.SetHealth01("", "", action_data.m_MainItem.GetHealth01("", ""));
56 
57  action_data.m_MainItem.TransferModifiers(ntarget);
58  action_data.m_MainItem.Delete();
59  }
60  }
61  }
62 
63  bool IsWearingMask( PlayerBase player)
64  {
65  if ( player.GetInventory().FindAttachment(InventorySlots.MASK) )
66  {
67  return true;
68  }
69  return false;
70  }
71 };
ItemBase
Definition: inventoryitem.c:730
InventorySlots
provides access to slot configuration
Definition: inventoryslots.c:5
CCTMan
Definition: cctman.c:1
UASoftSkillsWeight
Definition: actionconstants.c:118
ActionGagTarget
Definition: actiongagtarget.c:1
UAMaxDistances
Definition: actionconstants.c:104
PlayerBase
Definition: playerbaseclient.c:1
ActionTarget
class ActionTargets ActionTarget
ActionData
Definition: actionbase.c:20
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition: dayzplayer.c:601
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
ActionCoverHeadTargetCB
Definition: actioncoverheadtarget.c:1
CanReceiveAction
bool CanReceiveAction(ActionTarget target)
Definition: actionbase.c:638