Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
pumpkinhelmet.c
Go to the documentation of this file.
1
// Have a spooky Halloween everyone!
2
3
class
PumpkinHelmet
:
HelmetBase
4
{
5
void
PumpkinHelmet
()
6
{
7
SetEventMask(
EntityEvent
.INIT);
// Enable EOnInit event
8
}
9
10
override
void
OnMovedInsideCargo
(
EntityAI
container)
11
{
12
UpdateGlowState
();
13
}
14
15
override
void
OnMovedWithinCargo
(
EntityAI
container)
16
{
17
UpdateGlowState
();
18
}
19
20
override
void
OnRemovedFromCargo
(
EntityAI
container)
21
{
22
UpdateGlowState
();
23
}
24
25
override
void
EOnInit
(
IEntity
other,
int
extra)
26
{
27
UpdateGlowState
();
28
}
29
30
override
void
OnItemLocationChanged
(
EntityAI
old_owner,
EntityAI
new_owner)
31
{
32
super.OnItemLocationChanged( old_owner, new_owner);
33
34
UpdateGlowState
();
35
}
36
37
override
void
EEHealthLevelChanged
(
int
oldLevel,
int
newLevel,
string
zone)
38
{
39
super.EEHealthLevelChanged(oldLevel,newLevel,zone);
40
41
UpdateGlowState
();
42
}
43
44
void
UpdateGlowState
()
45
{
46
// Makes sure PumpkinHelmet doesn't glow when it's attached on head, or it's inside cargo.
47
48
bool
do_glow =
true
;
49
50
if
( IsDamageDestroyed() )
51
{
52
do_glow =
false
;
53
}
54
else
55
{
56
int
id
=
InventorySlots
.HEADGEAR;
57
InventoryLocation
IL =
new
InventoryLocation
();
58
GetInventory().GetCurrentInventoryLocation( IL );
59
60
int
id_2 = IL.
GetSlot
();
61
int
id_cargo = IL.
GetIdx
();
62
63
if
(
id
== id_2)
// Pumpkin is attached on head
64
do_glow =
false
;
65
66
if
( id_cargo != -1 )
// Pumpkin is in cargo
67
do_glow =
false
;
68
}
69
70
SetPilotLight(do_glow);
71
}
72
73
override
void
UpdateNVGStatus
(
PlayerBase
player,
bool
attaching =
false
,
bool
force_disable =
false
)
74
{
75
if
( !
g_Game
.IsDedicatedServer() )
//SP only
76
{
77
if
(force_disable)
78
{
79
player.RemoveActiveNV(
NVTypes
.NV_PUMPKIN);
80
}
81
else
82
{
83
if
( attaching && (!player.IsNVGWorking() || player.GetNVType() !=
NVTypes
.NV_PUMPKIN) )
84
{
85
player.AddActiveNV(
NVTypes
.NV_PUMPKIN);
86
}
87
else
if
( !attaching && player.IsNVGWorking() )
88
{
89
player.RemoveActiveNV(
NVTypes
.NV_PUMPKIN);
90
}
91
}
92
}
93
}
94
95
override
protected
set<int>
GetAttachmentExclusionInitSlotValue
(
int
slotId)
96
{
97
set<int> ret = super.GetAttachmentExclusionInitSlotValue(slotId);
98
if
(slotId ==
InventorySlots
.HEADGEAR)
99
{
100
ret.Insert(EAttExclusions.EXCLUSION_HEADGEAR_HELMET_0);
101
102
ret.Insert(EAttExclusions.EXCLUSION_MASK_1);
103
ret.Insert(EAttExclusions.EXCLUSION_MASK_2);
104
ret.Insert(EAttExclusions.EXCLUSION_HEADSTRAP_0);
105
106
ret.Insert(EAttExclusions.SHAVING_HEADGEAR_ATT_0);
107
}
108
return
ret;
109
}
110
};
111
112
// boo!
EntityAI
Definition
inventoryitem.c:2
HelmetBase
Definition
greathelm.c:2
IEntity
Internal ancestor of all Entity implementations.
Definition
enentity.c:165
InventoryLocation
InventoryLocation.
Definition
inventorylocation.c:30
InventoryLocation::GetSlot
proto native int GetSlot()
returns slot id if current type is Attachment
InventoryLocation::GetIdx
proto native int GetIdx()
returns index of cargo if current type is Cargo / ProxyCargo
InventorySlots
provides access to slot configuration
Definition
inventoryslots.c:6
PlayerBase
Definition
playerbaseclient.c:2
PumpkinHelmet::OnItemLocationChanged
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
Definition
pumpkinhelmet.c:30
PumpkinHelmet::UpdateNVGStatus
override void UpdateNVGStatus(PlayerBase player, bool attaching=false, bool force_disable=false)
Definition
pumpkinhelmet.c:73
PumpkinHelmet::EEHealthLevelChanged
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
Definition
pumpkinhelmet.c:37
PumpkinHelmet::PumpkinHelmet
void PumpkinHelmet()
Definition
pumpkinhelmet.c:5
PumpkinHelmet::UpdateGlowState
void UpdateGlowState()
Definition
pumpkinhelmet.c:44
PumpkinHelmet::OnMovedInsideCargo
override void OnMovedInsideCargo(EntityAI container)
Definition
pumpkinhelmet.c:10
PumpkinHelmet::EOnInit
override void EOnInit(IEntity other, int extra)
Definition
pumpkinhelmet.c:25
PumpkinHelmet::GetAttachmentExclusionInitSlotValue
set< int > GetAttachmentExclusionInitSlotValue(int slotId)
Definition
pumpkinhelmet.c:95
PumpkinHelmet::OnRemovedFromCargo
override void OnRemovedFromCargo(EntityAI container)
Definition
pumpkinhelmet.c:20
PumpkinHelmet::OnMovedWithinCargo
override void OnMovedWithinCargo(EntityAI container)
Definition
pumpkinhelmet.c:15
g_Game
DayZGame g_Game
Definition
dayzgame.c:3942
NVTypes
NVTypes
Definition
dayzplayercamera_base.c:55
EntityEvent
EntityEvent
Entity events for event-mask, or throwing event from code.
Definition
enentity.c:45
Games
Dayz
scripts
4_world
entities
itembase
pumpkinhelmet.c
Generated by
1.17.0