Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
burlapsackcover.c
Go to the documentation of this file.
1 class BurlapSackCover extends HeadGear_Base
2 {
4 
5  void ~BurlapSackCover()
6  {
7  if (m_Player)
8  {
9  OnRemovedFromHead(m_Player);
10  }
11  }
12 
13  override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
14  {
15  super.EEItemLocationChanged(oldLoc,newLoc);
16 
17  if (GetGame().IsDedicatedServer() && newLoc.GetType() == InventoryLocationType.GROUND)
18  {
19  EntityAI newItem = EntityAI.Cast(GetGame().CreateObjectEx("BurlapSack",newLoc.GetPos(),ECE_PLACE_ON_SURFACE,RF_DEFAULT));
20  MiscGameplayFunctions.TransferItemProperties(this,newItem);
21  DeleteSafe();
22  }
23  }
24 
25  override void OnWasAttached(EntityAI parent, int slot_id)
26  {
27  super.OnWasAttached(parent, slot_id);
28 
29  Class.CastTo(m_Player, parent.GetHierarchyRootPlayer());
30 
31  if ((!GetGame().IsDedicatedServer()) && m_Player && m_Player.IsControlledPlayer() && slot_id == InventorySlots.HEADGEAR)
32  {
33  PPERequesterBank.GetRequester(PPERequester_BurlapSackEffects).Start();
34  m_Player.SetInventorySoftLock(true);
35  m_Player.SetMasterAttenuation("BurlapSackAttenuation");
36 
37  if (GetGame().GetUIManager().IsMenuOpen(MENU_INVENTORY))
38  {
39  GetGame().GetMission().HideInventory();
40  }
41  }
42  SetInvisibleRecursive(true,m_Player,{InventorySlots.MASK,InventorySlots.EYEWEAR});
43  }
44 
45  override bool CanPutInCargo( EntityAI parent )
46  {
47  if (!super.CanPutInCargo(parent))
48  return false;
49 
50  if (parent && parent != this)
51  return true;
52 
53  return false;
54  }
55 
56  override bool CanDetachAttachment( EntityAI parent )
57  {
58  return false;
59  }
60 
61  void OnRemovedFromHead(PlayerBase player)
62  {
63  if (player.IsControlledPlayer())
64  {
65  PPERequesterBank.GetRequester(PPERequester_BurlapSackEffects).Stop();
66  player.SetInventorySoftLock(false);
67  player.SetMasterAttenuation("");
68  }
69  SetInvisibleRecursive(false,player,{InventorySlots.MASK,InventorySlots.EYEWEAR});
70  }
71 
72  override protected set<int> GetAttachmentExclusionInitSlotValue(int slotId)
73  {
74  set<int> ret = super.GetAttachmentExclusionInitSlotValue(slotId);
75  if (slotId == InventorySlots.HEADGEAR)
76  {
77  ret.Insert(EAttExclusions.SHAVING_HEADGEAR_ATT_0);
78  }
79  return ret;
80  }
81 }
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
InventorySlots
provides access to slot configuration
Definition: inventoryslots.c:5
EEItemLocationChanged
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Definition: remotedetonator.c:72
InventoryLocation
InventoryLocation.
Definition: inventorylocation.c:27
ECE_PLACE_ON_SURFACE
const int ECE_PLACE_ON_SURFACE
Definition: centraleconomy.c:37
HeadGear_Base
hard helmet base
Definition: baseballcap_colorbase.c:1
MENU_INVENTORY
const int MENU_INVENTORY
Definition: constants.c:170
PlayerBase
Definition: playerbaseclient.c:1
CanPutInCargo
override bool CanPutInCargo(EntityAI parent)
Definition: explosivesbase.c:247
InventoryLocationType
InventoryLocationType
types of Inventory Location
Definition: inventorylocation.c:3
m_Player
DayZPlayer m_Player
Definition: hand_events.c:42
Class
Super root of all classes in Enforce script.
Definition: enscript.c:10
EntityAI
Definition: building.c:5