Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actionungagtarget.c
Go to the documentation of this file.
2 {
3  void ActionUngagTarget()
4  {
5  m_CallbackClass = ActionUncoverHeadTargetCB;
6  m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_COVERHEAD_TARGET;
7  //m_FullBody = true;
8  m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT | DayZPlayerConstants.STANCEMASK_CROUCH;
9  m_Text = "#ungag_person";
10  }
11 
12  override void CreateConditionComponents()
13  {
14 
16  m_ConditionTarget = new CCTMan(UAMaxDistances.DEFAULT,false);
17  }
18 
19  override typename GetInputType()
20  {
22  }
23 
24  override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
25  {
26  PlayerBase targetPlayer;
27  if (Class.CastTo(targetPlayer, target.GetObject()))
28  {
29  if (IsWearingGag(targetPlayer) && null == player.GetHumanInventory().GetEntityInHands())
30  {
31  return true;
32  }
33  }
34  return false;
35  }
36 
37  override void OnFinishProgressServer(ActionData action_data)
38  {
39  PlayerBase ntarget = PlayerBase.Cast(action_data.m_Target.GetObject());
40  if (CanReceiveAction(action_data.m_Target))
41  {
42  EntityAI attachment;
43  Class.CastTo(attachment, ntarget.GetInventory().FindAttachment(InventorySlots.MASK));
44 
45  if (attachment && attachment.GetType() == "MouthRag")
46  {
47  UngagSelfLambda lamb = new UngagSelfLambda(attachment, "Rag", action_data.m_Player);
48  lamb.SetTransferParams(true, true, true, false, 1);
49  action_data.m_Player.ServerReplaceItemElsewhereWithNewInHands(lamb);
50  }
51  }
52  }
53 
54  bool IsWearingGag(PlayerBase player)
55  {
56  EntityAI attachment;
57  Class.CastTo(attachment, player.GetInventory().FindAttachment(InventorySlots.MASK));
58  if (attachment && attachment.GetType() == "MouthRag")
59  {
60  return true;
61  }
62  return false;
63  }
64 };
ItemBase
Definition: inventoryitem.c:730
UngagSelfLambda
Definition: actionungagself.c:54
InventorySlots
provides access to slot configuration
Definition: inventoryslots.c:5
ContinuousInteractActionInput
Definition: actioninput.c:521
CCTMan
Definition: cctman.c:1
CCINone
Definition: ccinone.c:1
ActionUngagTarget
Definition: actionungagtarget.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
m_ConditionTarget
ref CCTBase m_ConditionTarget
Definition: actionbase.c:56
Class
Super root of all classes in Enforce script.
Definition: enscript.c:10
ActionUncoverHeadTargetCB
Definition: actionuncoverheadtarget.c:1
m_StanceMask
protected int m_StanceMask
Definition: actionbase.c:53
EntityAI
Definition: building.c:5
CanReceiveAction
bool CanReceiveAction(ActionTarget target)
Definition: actionbase.c:638