Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
anniversarybox.c
Go to the documentation of this file.
1 class AnniversaryBox extends Container_Base
2 {
3  private const int SPAWN_SHIRTS_MAX = 60;
4 
5  #ifndef SERVER
6  protected AnniversaryBoxLight m_Light;
7  #endif
8 
9  override void DeferredInit()
10  {
11  super.DeferredInit();
12 
13  #ifndef SERVER
14  m_Light = AnniversaryBoxLight.Cast(ScriptedLightBase.CreateLight(AnniversaryBoxLight, "0 0 0"));
15  if (m_Light)
16  m_Light.AttachOnMemoryPoint(this, "light");
17  #endif
18 
19  }
20 
21  override void EEDelete(EntityAI parent)
22  {
23  super.EEDelete(parent);
24 
25  #ifndef SERVER
26  if (m_Light)
27  m_Light.Destroy();
28  #endif
29  }
30 
31  override bool IsContainer()
32  {
33  return true;
34  }
35 
36  override bool IsTakeable()
37  {
38  return false;
39  }
40 
41  override bool CanSwapEntities(EntityAI otherItem, InventoryLocation otherDestination, InventoryLocation destination)
42  {
43  return false;
44  }
45 
46  override bool CanPutInCargo(EntityAI parent)
47  {
48  return false;
49  }
50 
51  override bool DisableVicinityIcon()
52  {
53  if (GetAnimationPhase("lidclosing") == 1)
54  {
55  return true;
56  }
57  else
58  return false;
59  }
60 
61  override bool CanDisplayCargo()
62  {
63  if (GetAnimationPhase("lidclosing") == 1)
64  {
65  return false;
66  }
67  else
68  return true;
69  }
70 
71  void EmtpyInventory()
72  {
73  if (GetGame().IsServer())//server or single player
74  {
75  for ( int j = 0; j < GetInventory().GetCargo().GetItemCount(); j++ )
76  {
77  GetInventory().GetCargo().GetItem(j).Delete();
78  }
79  }
80  }
81 
82  void FillInventory()
83  {
84  if (GetGame().IsServer())//server or single player
85  {
86  EntityAI ent = GetInventory().CreateInInventory("TShirt_10thAnniversary");
87 
88  for (int i = 0; ent && i < SPAWN_SHIRTS_MAX - 1; i++)
89  {
90  ent = GetInventory().CreateInInventory("TShirt_10thAnniversary");
91  }
92  }
93  }
94 }
GetGame
proto native CGame GetGame()
InventoryLocation
InventoryLocation.
Definition: inventorylocation.c:27
IsTakeable
override bool IsTakeable()
Definition: explosivesbase.c:197
m_Light
protected ExplosiveLight m_Light
light
Definition: explosivesbase.c:31
EEDelete
override void EEDelete(EntityAI parent)
Definition: contaminatedarea.c:69
CanPutInCargo
override bool CanPutInCargo(EntityAI parent)
Definition: explosivesbase.c:247
ScriptedLightBase
Definition: pointlightbase.c:1
CanSwapEntities
override bool CanSwapEntities(EntityAI otherItem, InventoryLocation otherDestination, InventoryLocation destination)
Definition: fireplacebase.c:2491
Container_Base
Definition: anniversarybox.c:1
CanDisplayCargo
override bool CanDisplayCargo()
Definition: itembase.c:3998
EntityAI
Definition: building.c:5