Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
giftbox_base.c
Go to the documentation of this file.
1 class GiftBox_Base extends Container_Base
2 {
3  protected vector m_HalfExtents; // The Y value contains a heightoffset and not the halfextent !!!
4  protected ref OpenableBehaviour m_Openable;
5 
6  void GiftBox_Base()
7  {
8  m_HalfExtents = vector.Zero;
9  m_Openable = new OpenableBehaviour(false);
10 
11  RegisterNetSyncVariableBool("m_Openable.m_IsOpened");
12  }
13 
14  override bool CanReceiveItemIntoCargo(EntityAI item)
15  {
16  if (!super.CanReceiveItemIntoCargo(item))
17  return false;
18 
19  if (GameInventory.GetInventoryCheckContext() == InventoryCheckContext.DEFAULT)
20  {
21  if (!GetGame().IsDedicatedServer())
22  return IsOpen();
23  }
24 
25  return true;
26  }
27 
28 
29  override void Open()
30  {
31  m_Openable.Open();
32  SetSynchDirty();
33  }
34 
35  override void Close()
36  {
37  m_Openable.Close();
38  SetSynchDirty();
39  }
40 
41  override bool IsOpen()
42  {
43  return m_Openable.IsOpened();
44  }
45 
46  override void SetActions()
47  {
48  super.SetActions();
49 
51  }
52 
53  override void OnDebugSpawn()
54  {
55  EntityAI entity;
56  if (Class.CastTo(entity, this))
57  {
58  entity.GetInventory().CreateInInventory("Chemlight_Green");
59  }
60  }
61 
62  override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
63  {
64  super.EEHealthLevelChanged(oldLevel,newLevel,zone);
65 
66  if (newLevel == GameConstants.STATE_RUINED && GetGame().IsServer())
67  {
68  MiscGameplayFunctions.DropAllItemsInInventoryInBounds(this, m_HalfExtents);
69  DeleteSafe();
70  }
71  }
72 }
73 
74 class GiftBox_Small extends GiftBox_Base {}
75 class GiftBox_Medium extends GiftBox_Base {}
76 class GiftBox_Large extends GiftBox_Base {}
GetGame
proto native CGame GetGame()
CanReceiveItemIntoCargo
override bool CanReceiveItemIntoCargo(EntityAI item)
Definition: container_base.c:72
m_HalfExtents
Container_Base m_HalfExtents
Close
void Close()
IsOpen
override bool IsOpen()
Definition: fireplacebase.c:2395
OnDebugSpawn
class Hatchback_02_Blue extends Hatchback_02 OnDebugSpawn
Definition: hatchback_02.c:404
Open
override void Open()
Implementations only.
Definition: cannedfood.c:2
vector
Definition: enconvert.c:105
AddAction
void AddAction(typename actionName)
Definition: advancedcommunication.c:86
SetActions
void SetActions()
Definition: advancedcommunication.c:79
OpenableBehaviour
Definition: openablebehaviour.c:1
EEHealthLevelChanged
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
Definition: basebuildingbase.c:463
GameConstants
Definition: constants.c:612
Container_Base
Definition: anniversarybox.c:1
Class
Super root of all classes in Enforce script.
Definition: enscript.c:10
EntityAI
Definition: building.c:5
ActionUnpackGift
Definition: actionunpackgift.c:9
GameInventory
script counterpart to engine's class Inventory
Definition: inventory.c:78
InventoryCheckContext
InventoryCheckContext
Definition: inventory.c:57