5 ref
Timer m_WorkCheckTimer;
10 m_WorkCheckTimer =
new Timer;
23 super.EEItemAttached( item, slot_name );
25 if ( GetCompEM().CanWork() && m_IsLowered )
26 m_WorkCheckTimer.Run(0.1,
this,
"SwitchOnNVGCheck",
null,
true);
32 super.EEItemDetached( item, slot_name );
34 GetCompEM().SwitchOff();
39 super.OnWasAttached(parent, slot_id);
49 super.OnWasDetached(parent, slot_id);
53 if ( m_Strap == parent &&
PlayerBase.CastTo(player, parent.GetHierarchyRootPlayer()) )
55 if ( parent &&
Clothing.Cast(parent) )
57 Clothing.Cast(parent).UpdateNVGStatus(player,
false,
true);
70 if ( m_Strap &&
PlayerBase.CastTo(player, m_Strap.GetHierarchyParent()) )
72 headgear = player.FindAttachmentBySlotName(
"Headgear");
73 glasses = player.FindAttachmentBySlotName(
"Eyewear");
83 if ( (headgear == m_Strap || glasses == m_Strap) && player.IsControlledPlayer() )
85 player.AddActiveNV(
NVTypes.NV_GOGGLES);
96 if ( m_Strap &&
PlayerBase.CastTo(player, m_Strap.GetHierarchyParent()) )
98 headgear = player.FindAttachmentBySlotName(
"Headgear");
99 glasses = player.FindAttachmentBySlotName(
"Eyewear");
103 if ( (headgear == m_Strap || glasses == m_Strap) && player.IsControlledPlayer() )
105 player.RemoveActiveNV(
NVTypes.NV_GOGGLES);
111 override void OnWork(
float consumed_energy )
116 RotateGoggles(
false);
122 if ( m_Strap &&
PlayerBase.CastTo(player, m_Strap.GetHierarchyParent()) )
124 headgear = player.FindAttachmentBySlotName(
"Headgear");
125 glasses = player.FindAttachmentBySlotName(
"Eyewear");
129 if ( (headgear == m_Strap || glasses == m_Strap) && player.IsControlledPlayer() )
131 player.AddActiveNV(
NVTypes.NV_GOGGLES);
139 if ( GetAnimationPhase(
"rotate") != m_IsLowered )
141 m_IsLowered = GetAnimationPhase(
"rotate");
145 void RotateGoggles(
bool state)
148 SetAnimationPhase(
"rotate",!state);
149 m_IsLowered = !state;
154 if ( m_Strap && m_Strap.GetInventory().GetCurrentAttachmentSlotInfo(slot_id,slot_name) &&
PlayerBase.CastTo(player, m_Strap.GetHierarchyParent()) )
156 player.SetNVGLowered(m_IsLowered);
161 if ( !state && GetCompEM().CanWork() )
162 GetCompEM().SwitchOn();
164 GetCompEM().SwitchOff();
168 void SwitchOnNVGCheck()
171 GetCompEM().SwitchOn();
172 if (GetCompEM().IsSwitchedOn())
174 m_WorkCheckTimer.Stop();
178 override int GetCurrentNVType()
183 switch (m_CurrentOpticMode)
193 Error(
"Undefined optic mode of " +
this);
202 override bool IsNVG()