DayZ 1.24
Loading...
Searching...
No Matches
GiftBox_Base.c
Go to the documentation of this file.
1class GiftBox_Base extends Container_Base
2{
3 protected vector m_HalfExtents; // The Y value contains a heightoffset and not the halfextent !!!
5
7 {
9 m_Openable = new OpenableBehaviour(false);
10
11 RegisterNetSyncVariableBool("m_Openable.m_IsOpened");
12 }
13
15 {
16 if (!super.CanReceiveItemIntoCargo(item))
17 return false;
18
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 {
56 if (Class.CastTo(entity, this))
57 entity.GetInventory().CreateInInventory("Chemlight_Green");
58 }
59
60 override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
61 {
62 super.EEHealthLevelChanged(oldLevel, newLevel, zone);
63
64 if (newLevel == GameConstants.STATE_RUINED && GetGame().IsServer())
65 {
66 MiscGameplayFunctions.DropAllItemsInInventoryInBounds(this, m_HalfExtents);
67 DeleteSafe();
68 }
69 }
70}
71
72class GiftBox_Small extends GiftBox_Base {}
73class GiftBox_Medium extends GiftBox_Base {}
74class GiftBox_Large extends GiftBox_Base {}
InventoryCheckContext
Definition Inventory.c:58
void AddAction(typename actionName)
Container_Base m_HalfExtents
Super root of all classes in Enforce script.
Definition EnScript.c:11
void GiftBox_Base()
Definition GiftBox_Base.c:6
override bool CanReceiveItemIntoCargo(EntityAI item)
override void OnDebugSpawn()
ref OpenableBehaviour m_Openable
Definition GiftBox_Base.c:4
override void Open()
override void SetActions()
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
vector m_HalfExtents
Definition GiftBox_Base.c:3
override void Close()
override bool IsOpen()
script counterpart to engine's class Inventory
Definition Inventory.c:79
static int GetInventoryCheckContext()
Definition Inventory.c:373
static const vector Zero
Definition EnConvert.c:110
proto native CGame GetGame()
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
const int STATE_RUINED
Definition constants.c:757