Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
nail.c
Go to the documentation of this file.
1
class
Nails
extends
Inventory_Base
2
{
3
override
bool
CanPutAsAttachment
(
EntityAI
parent )
4
{
5
if
(!super.CanPutAsAttachment(parent)) {
return
false
;}
6
const
int
SLOTS_ARRAY = 8;
7
bool
is_barrel =
false
;
8
bool
is_opened_barrel =
false
;
9
bool
slot_test =
true
;
10
string
slot_names[SLOTS_ARRAY] = {
"BerryR"
,
"BerryB"
,
"Plant"
,
"OakBark"
,
"BirchBark"
,
"Lime"
,
"Disinfectant"
,
"Guts"
};
11
12
13
// is barrel
14
if
( parent.IsKindOf(
"Barrel_ColorBase"
) )
15
{
16
is_barrel =
true
;
17
}
18
19
// is opened barrel
20
if
( is_barrel && parent.GetAnimationPhase(
"Lid"
) == 1 )
21
{
22
is_opened_barrel =
true
;
23
}
24
25
// all of the barrel slots are empty
26
for
(
int
i = 0; i < SLOTS_ARRAY ; i++ )
27
{
28
if
( parent.FindAttachmentBySlotName(slot_names[i]) != NULL )
29
{
30
slot_test =
false
;
31
break
;
32
}
33
}
34
35
if
( ( is_opened_barrel && slot_test ) || !is_barrel )
36
{
37
return
true
;
38
}
39
return
false
;
40
}
41
42
override
bool
CanDetachAttachment
(
EntityAI
parent )
43
{
44
45
bool
is_barrel =
false
;
46
bool
is_opened_barrel =
false
;
47
48
// is barrel
49
if
( parent.IsKindOf(
"Barrel_ColorBase"
) )
50
{
51
is_barrel =
true
;
52
}
53
54
// is opened barrel
55
if
( is_barrel && parent.GetAnimationPhase(
"Lid"
) == 1 )
56
{
57
is_opened_barrel =
true
;
58
}
59
60
if
( is_opened_barrel || !is_barrel )
61
{
62
return
true
;
63
}
64
return
false
;
65
}
66
}
EntityAI
Definition
inventoryitem.c:2
Inventory_Base
Definition
barbedbaseballbat.c:2
Inventory_Base::CanPutAsAttachment
override bool CanPutAsAttachment(EntityAI parent)
Definition
nail.c:3
Inventory_Base::CanDetachAttachment
override bool CanDetachAttachment(EntityAI parent)
Definition
nail.c:42
Games
Dayz
scripts
4_world
entities
itembase
inventory_base
nail.c
Generated by
1.17.0