Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actionungagself.c
Go to the documentation of this file.
2 {
3  void ActionUngagSelf()
4  {
5  m_CallbackClass = ActionUncoverHeadSelfCB;
6  m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_COVERHEAD_SELF;
7  m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT | DayZPlayerConstants.STANCEMASK_CROUCH;
8  m_Text = "#ungag";
9  }
10 
11  override void CreateConditionComponents()
12  {
15  }
16 
17  override bool HasTarget()
18  {
19  return false;
20  }
21 
22  override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
23  {
24  if ( IsWearingGag(player) && null == player.GetHumanInventory().GetEntityInHands())
25  return true;
26 
27  return false;
28  }
29 
30  override void OnFinishProgressServer( ActionData action_data )
31  {
32  EntityAI attachment;
33  Class.CastTo(attachment, action_data.m_Player.GetInventory().FindAttachment(InventorySlots.MASK));
34  if ( attachment && attachment.GetType() == "MouthRag" )
35  {
36  UngagSelfLambda lamb = new UngagSelfLambda(attachment, "Rag", action_data.m_Player);
37  lamb.SetTransferParams(true, true, true, false, 1);
38  action_data.m_Player.ServerReplaceItemElsewhereWithNewInHands(lamb);
39  }
40  }
41 
42  bool IsWearingGag( PlayerBase player )
43  {
44  EntityAI attachment;
45  Class.CastTo(attachment, player.GetInventory().FindAttachment(InventorySlots.MASK));
46  if ( attachment && attachment.GetType() == "MouthRag" )
47  {
48  return true;
49  }
50  return false;
51  }
52 };
53 
55 {
56  MouthRag gag;
57  EntityAI m_OriginalOwner;
58 
59  void UngagSelfLambda (EntityAI old_item, string new_item_type, PlayerBase player)
60  {
61  gag = MouthRag.Cast(m_OldItem);
62  if (gag)
63  gag.SetIncomingLambaBool(true);
64  InventoryLocation targetHnd = new InventoryLocation;
65  targetHnd.SetHands(player, null);
66  OverrideNewLocation(targetHnd);
67  m_OriginalOwner = m_OldItem.GetHierarchyRoot();
68  }
69 
70  override void OnSuccess (EntityAI new_item)
71  {
72  super.OnSuccess(new_item);
73 
74  PlayerBase player;
75  if (Class.CastTo(player,m_OriginalOwner))
76  {
77  player.CheckForGag();
78  }
79  }
80 
81  override void OnAbort ()
82  {
83  if (gag)
84  gag.SetIncomingLambaBool(false);
85  }
86 };
ItemBase
Definition: inventoryitem.c:730
UngagSelfLambda
Definition: actionungagself.c:54
InventorySlots
provides access to slot configuration
Definition: inventoryslots.c:5
CCINone
Definition: ccinone.c:1
InventoryLocation
InventoryLocation.
Definition: inventorylocation.c:27
CCTNone
Definition: cctnone.c:1
PlayerBase
Definition: playerbaseclient.c:1
ActionTarget
class ActionTargets ActionTarget
ActionData
Definition: actionbase.c:20
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition: dayzplayer.c:601
ActionUncoverHeadSelfCB
Definition: actionuncoverheadself.c:1
ActionUngagSelf
Definition: actionungagself.c:1
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
m_StanceMask
protected int m_StanceMask
Definition: actionbase.c:53
TurnItemIntoItemLambda
Definition: miscgameplayfunctions.c:91
EntityAI
Definition: building.c:5