DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
PumpkinHelmet.c
См. документацию.
1// Have a spooky Halloween everyone!
2
4{
6 {
7 SetEventMask(EntityEvent.INIT); // Enable EOnInit event
8 }
9
10 override void OnMovedInsideCargo(EntityAI container)
11 {
13 }
14
15 override void OnMovedWithinCargo(EntityAI container)
16 {
18 }
19
20 override void OnRemovedFromCargo(EntityAI container)
21 {
23 }
24
25 override void EOnInit( IEntity other, int extra)
26 {
28 }
29
30 override void OnItemLocationChanged( EntityAI old_owner, EntityAI new_owner)
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
50 if ( IsDamageDestroyed() )
51 {
52 do_glow = false;
53 }
54 else
55 {
56 int id = InventorySlots.HEADGEAR;
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 ( !GetGame().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!
NVTypes
Определения DayZPlayerCamera_Base.c:55
Определения Building.c:6
Определения GreatHelm.c:2
Определения EnEntity.c:165
proto native int GetSlot()
returns slot id if current type is Attachment
proto native int GetIdx()
returns index of cargo if current type is Cargo / ProxyCargo
InventoryLocation.
Определения InventoryLocation.c:29
provides access to slot configuration
Определения InventorySlots.c:6
Определения PlayerBaseClient.c:2
override void OnRemovedFromCargo(EntityAI container)
Определения PumpkinHelmet.c:20
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
Определения PumpkinHelmet.c:30
override void OnMovedWithinCargo(EntityAI container)
Определения PumpkinHelmet.c:15
void UpdateGlowState()
Определения PumpkinHelmet.c:44
void PumpkinHelmet()
Определения PumpkinHelmet.c:5
override void OnMovedInsideCargo(EntityAI container)
Определения PumpkinHelmet.c:10
set< int > GetAttachmentExclusionInitSlotValue(int slotId)
Определения PumpkinHelmet.c:95
override void EOnInit(IEntity other, int extra)
Определения PumpkinHelmet.c:25
override void UpdateNVGStatus(PlayerBase player, bool attaching=false, bool force_disable=false)
Определения PumpkinHelmet.c:73
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
Определения PumpkinHelmet.c:37
proto native CGame GetGame()
EntityEvent
Entity events for event-mask, or throwing event from code.
Определения EnEntity.c:45