DayZ 1.24
Loading...
Searching...
No Matches
PumpkinHelmet.c
Go to the documentation of this file.
1// Have a spooky Halloween everyone!
2
4{
6 {
7 SetEventMask(EntityEvent.INIT); // Enable EOnInit event
8 }
9
11 {
13 }
14
16 {
18 }
19
21 {
23 }
24
25 override void EOnInit(IEntity other, int extra)
26 {
28 }
29
31 {
32 super.OnItemLocationChanged(old_owner, new_owner);
33
35 }
36
37 override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
38 {
39 super.EEHealthLevelChanged(oldLevel, newLevel, zone);
40
42 }
43
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
51 do_glow = false;
52 else
53 {
54 int id = InventorySlots.HEADGEAR;
56 GetInventory().GetCurrentInventoryLocation(IL);
57
58 int id_2 = IL.GetSlot();
59 int id_cargo = IL.GetIdx();
60
61 if (id == id_2) // Pumpkin is attached on head
62 do_glow = false;
63
64 if (id_cargo != -1) // Pumpkin is in cargo
65 do_glow = false;
66 }
67
68 SetPilotLight(do_glow);
69 }
70
71 override void UpdateNVGStatus(PlayerBase player, bool attaching = false, bool force_disable = false)
72 {
73 if (!GetGame().IsDedicatedServer()) //SP only
74 {
75 if (force_disable)
76 player.RemoveActiveNV(NVTypes.NV_PUMPKIN);
77 else
78 {
79 if (attaching && (!player.IsNVGWorking() || player.GetNVType() != NVTypes.NV_PUMPKIN))
80 player.AddActiveNV(NVTypes.NV_PUMPKIN);
81 else if (!attaching && player.IsNVGWorking())
82 player.RemoveActiveNV(NVTypes.NV_PUMPKIN);
83 }
84 }
85 }
86
88 {
89 set<int> ret = super.GetAttachmentExclusionInitSlotValue(slotId);
90 if (slotId == InventorySlots.HEADGEAR)
91 {
92 ret.Insert(EAttExclusions.EXCLUSION_HEADGEAR_HELMET_0);
93
94 ret.Insert(EAttExclusions.EXCLUSION_MASK_1);
95 ret.Insert(EAttExclusions.EXCLUSION_MASK_2);
96 ret.Insert(EAttExclusions.EXCLUSION_HEADSTRAP_0);
97
98 ret.Insert(EAttExclusions.SHAVING_HEADGEAR_ATT_0);
99 }
100 return ret;
101 }
102};
103
104// boo!
bool IsDamageDestroyed(ActionTarget target)
Definition ActionBase.c:841
InventoryLocation.
provides access to slot configuration
override void OnRemovedFromCargo(EntityAI container)
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
override void OnMovedWithinCargo(EntityAI container)
void UpdateGlowState()
void PumpkinHelmet()
override void OnMovedInsideCargo(EntityAI container)
set< int > GetAttachmentExclusionInitSlotValue(int slotId)
override void EOnInit(IEntity other, int extra)
override void UpdateNVGStatus(PlayerBase player, bool attaching=false, bool force_disable=false)
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
proto native CGame GetGame()
EntityEvent
Entity events for event-mask, or throwing event from code.
Definition EnEntity.c:44