Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
mouthrag.c
Go to the documentation of this file.
1 class MouthRag extends Mask_Base
2 {
3  bool m_IncomingLambdaChange;
4 
5  void MouthRag()
6  {
7  m_IncomingLambdaChange = false;
8  }
9 
10  override bool CanDetachAttachment(EntityAI parent)
11  {
12  return m_IncomingLambdaChange;
13  }
14 
15  override bool IsObstructingVoice()
16  {
17  return true;
18  }
19 
20  override int GetVoiceEffect()
21  {
22  return VoiceEffectObstruction;
23  }
24 
25  override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
26  {
27  super.EEItemLocationChanged(oldLoc,newLoc);
28 
29  if (GetGame().IsDedicatedServer())
30  {
31  PlayerBase playerOld;
32  PlayerBase playerNew;
33  if (oldLoc.GetParent())
34  Class.CastTo(playerOld,oldLoc.GetParent().GetHierarchyRootPlayer());
35  if (newLoc.GetParent())
36  Class.CastTo(playerNew,newLoc.GetParent().GetHierarchyRootPlayer());
37 
38  if (newLoc.GetType() == InventoryLocationType.GROUND)
39  {
40  ItemBase newItem;
41  if (Class.CastTo(newItem,GetGame().CreateObjectEx("Rag",newLoc.GetPos(),ECE_PLACE_ON_SURFACE,RF_DEFAULT)))
42  {
43  MiscGameplayFunctions.TransferItemProperties(this,newItem);
44  newItem.SetQuantity(1);
45  DeleteSafe();
46  }
47  }
48  }
49  }
50 
51  override void OnWasAttached(EntityAI parent, int slot_id)
52  {
53  super.OnWasAttached(parent, slot_id);
54 
55  if (parent.IsPlayer())
56  {
57  PlayerBase.Cast(parent).CheckForGag(); //gag removal action does check, since 'OnWasDetached' is not called on item destruction.
58  }
59  }
60 
61  void SetIncomingLambaBool(bool state)
62  {
63  m_IncomingLambdaChange = state;
64  }
65 
66  bool GetIncomingLambdaBool()
67  {
68  return m_IncomingLambdaChange;
69  }
70 };
ItemBase
Definition: inventoryitem.c:730
RF_DEFAULT
const int RF_DEFAULT
Definition: centraleconomy.c:65
GetGame
proto native CGame GetGame()
OnWasAttached
override void OnWasAttached(EntityAI parent, int slot_id)
Definition: torch.c:945
EEItemLocationChanged
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Definition: remotedetonator.c:72
Mask_Base
gas mask base
Definition: balaclava3holes_colorbase.c:1
InventoryLocation
InventoryLocation.
Definition: inventorylocation.c:27
ECE_PLACE_ON_SURFACE
const int ECE_PLACE_ON_SURFACE
Definition: centraleconomy.c:37
PlayerBase
Definition: playerbaseclient.c:1
InventoryLocationType
InventoryLocationType
types of Inventory Location
Definition: inventorylocation.c:3
Class
Super root of all classes in Enforce script.
Definition: enscript.c:10
EntityAI
Definition: building.c:5