Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
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
(!
g_Game
.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
50
AddAction
(
ActionUnpackGift
);
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
&&
g_Game
.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 {}
InventoryCheckContext
InventoryCheckContext
Definition
inventory.c:60
AddAction
void AddAction(typename actionName)
Definition
advancedcommunication.c:220
ActionUnpackGift
Definition
actionunpackgift.c:10
Class
Super root of all classes in Enforce script.
Definition
enscript.c:11
Container_Base
Definition
container_base.c:2
Container_Base::IsOpen
override bool IsOpen()
Definition
giftbox_base.c:41
Container_Base::OnDebugSpawn
override void OnDebugSpawn()
Definition
giftbox_base.c:53
Container_Base::CanReceiveItemIntoCargo
override bool CanReceiveItemIntoCargo(EntityAI item)
Definition
giftbox_base.c:14
Container_Base::EEHealthLevelChanged
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
Definition
giftbox_base.c:62
Container_Base::m_Openable
ref OpenableBehaviour m_Openable
Definition
giftbox_base.c:4
Container_Base::GiftBox_Base
void GiftBox_Base()
Definition
giftbox_base.c:6
Container_Base::Close
override void Close()
Definition
giftbox_base.c:35
Container_Base::m_HalfExtents
vector m_HalfExtents
Definition
giftbox_base.c:3
Container_Base::Open
override void Open()
Definition
giftbox_base.c:29
Container_Base::SetActions
override void SetActions()
Definition
giftbox_base.c:46
EntityAI
Definition
inventoryitem.c:2
GameConstants
Definition
constants.c:664
GameInventory
script counterpart to engine's class Inventory
Definition
inventory.c:81
GameInventory::GetInventoryCheckContext
static int GetInventoryCheckContext()
Definition
inventory.c:375
OpenableBehaviour
Definition
openablebehaviour.c:2
vector
Definition
enconvert.c:119
vector::Zero
static const vector Zero
Definition
enconvert.c:123
g_Game
DayZGame g_Game
Definition
dayzgame.c:3942
Class::CastTo
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
GameConstants::STATE_RUINED
const int STATE_RUINED
Definition
constants.c:851
Games
Dayz
scripts
4_world
entities
itembase
giftbox_base.c
Generated by
1.17.0