DayZ 1.26
DayZ Explorer by KGB
Загрузка...
Поиск...
Не найдено
Класс PoweredOptic_Base

Защищенные члены

void Rangefinder ()
 
float GetMeasurementUpdateInterval ()
 
override void OnWorkStart ()
 
override void OnWorkStop ()
 
void StartPeriodicMeasurement ()
 
void StopPeriodicMeasurement ()
 
void DoMeasurement ()
 
override void SetActions ()
 
override void OnDebugSpawn ()
 

Защищенные данные

ref Timer m_Timer
 
TextWidget m_RangeText
 

Закрытые члены

void NVGoggles ()
 
override void SetActions ()
 
override void EEItemAttached (EntityAI item, string slot_name)
 
override void EEItemDetached (EntityAI item, string slot_name)
 
override void OnWasAttached (EntityAI parent, int slot_id)
 
override void OnWasDetached (EntityAI parent, int slot_id)
 
override void OnWorkStart ()
 
override void OnWorkStop ()
 
override void OnWork (float consumed_energy)
 
void LoweredCheck ()
 
void RotateGoggles (bool state)
 
void SwitchOnNVGCheck ()
 
override int GetCurrentNVType ()
 
override bool IsNVG ()
 

Закрытые данные

bool m_IsLowered
 
Clothing m_Strap
 
ref Timer m_WorkCheckTimer
 

Закрытые статические данные

static const float RANGEFINDER_MAX_DISTANCE = 913.4856
 

Подробное описание

Методы

◆ DoMeasurement()

void DoMeasurement ( )
inlineprotected
73 {
75
76 if ( player )
77 {
78 vector from = GetGame().GetCurrentCameraPosition();
79 vector to = from + (GetGame().GetCurrentCameraDirection() * RANGEFINDER_MAX_DISTANCE);
83
85
86 // Generate result
89
91 {
92 if( dist < 10 )
93 m_RangeText.SetText( "00" + dist.ToString() );
94 else if( dist < 100 )
95 m_RangeText.SetText( "0" + dist.ToString() );
96 else
97 m_RangeText.SetText( dist.ToString() );
98 }
99 else
100 {
101 m_RangeText.SetText( "- - -" );
102 }
103 }
104 }
PlayerBase GetPlayer()
Definition ModifierBase.c:51
Definition DayZPhysics.c:124
static proto bool RaycastRV(vector begPos, vector endPos, out vector contactPos, out vector contactDir, out int contactComponent, set< Object > results=NULL, Object with=NULL, Object ignore=NULL, bool sorted=false, bool ground_only=false, int iType=ObjIntersectView, float radius=0.0, CollisionFlags flags=CollisionFlags.NEARESTCONTACT)
Raycasts world by given parameters.
Definition EnMath.c:7
Definition EntityAI.c:95
Definition PlayerBaseClient.c:2
static const float RANGEFINDER_MAX_DISTANCE
Definition Rangefinder.c:3
TextWidget m_RangeText
Definition Rangefinder.c:6
Definition EnConvert.c:106
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
proto native CGame GetGame()
static proto float Round(float f)
Returns mathematical round of value.

Перекрестные ссылки vector::Distance(), GetGame(), GetPlayer(), RANGEFINDER_MAX_DISTANCE, DayZPhysics::RaycastRV() и Math::Round().

◆ EEItemAttached()

override void EEItemAttached ( EntityAI item,
string slot_name )
inlineprivate
22 {
23 super.EEItemAttached( item, slot_name );
24
25 if ( GetCompEM().CanWork() && m_IsLowered )
26 m_WorkCheckTimer.Run(0.1,this,"SwitchOnNVGCheck",null,true);
27 //GetCompEM().SwitchOn();
28 }
bool m_IsLowered
Definition NVGoggles.c:3
ref Timer m_WorkCheckTimer
Definition NVGoggles.c:5

◆ EEItemDetached()

override void EEItemDetached ( EntityAI item,
string slot_name )
inlineprivate
31 {
32 super.EEItemDetached( item, slot_name );
33
34 GetCompEM().SwitchOff();
35 }

◆ GetCurrentNVType()

override int GetCurrentNVType ( )
inlineprivate
182 {
183 if (IsWorking())
184 {
185 //m_CurrentOpticMode
186 switch (m_CurrentOpticMode)
187 {
188 /*case GameConstants.OPTICS_STATE_DAY:
189 return NVTypes.NV_GOGGLES_WHATEVER;
190
191 case GameConstants.OPTICS_STATE_NIGHTVISION:
192 return NVTypes.NV_GOGGLES;*/
193 default:
194 return NVTypes.NV_GOGGLES;
195 }
196 Error("Undefined optic mode of " + this);
197 return NVTypes.NONE;
198 }
199 else
200 {
201 return NVTypes.NV_GOGGLES_OFF;
202 }
203 }
NVTypes
Definition DayZPlayerCamera_Base.c:55
void Error(string err)
Messagebox with error message.
Definition EnDebug.c:90

Перекрестные ссылки Error().

◆ GetMeasurementUpdateInterval()

float GetMeasurementUpdateInterval ( )
inlineprotected
14 {
15 return 0.5;
16 }

Используется в StartPeriodicMeasurement().

◆ IsNVG()

override bool IsNVG ( )
inlineprivate
206 {
207 return true;
208 }

◆ LoweredCheck()

void LoweredCheck ( )
inlineprivate
138 {
139 if ( GetAnimationPhase("rotate") != m_IsLowered )
140 {
141 m_IsLowered = GetAnimationPhase("rotate");
142 }
143 }

◆ NVGoggles()

void NVGoggles ( )
inlineprivate
8 {
9 RotateGoggles(true);
11 }
void RotateGoggles(bool state)
Definition NVGoggles.c:145
Definition DayZPlayerImplement.c:63

Перекрестные ссылки RotateGoggles().

◆ OnDebugSpawn()

override void OnDebugSpawn ( )
inlineprotected
115 {
116 GetInventory().CreateInInventory( "Battery9V" );
117 }

◆ OnWasAttached()

override void OnWasAttached ( EntityAI parent,
int slot_id )
inlineprivate
38 {
39 super.OnWasAttached(parent, slot_id);
40 RotateGoggles(true);
41
42 m_Strap = Clothing.Cast(parent);
43 /*if (m_Strap)
44 SetPlayer(PlayerBase.Cast(m_Strap.GetHierarchyParent()));*/
45 }
Definition Armband_ColorBase.c:2
Clothing m_Strap
Definition NVGoggles.c:4

Перекрестные ссылки RotateGoggles().

◆ OnWasDetached()

override void OnWasDetached ( EntityAI parent,
int slot_id )
inlineprivate
48 {
49 super.OnWasDetached(parent, slot_id);
50 RotateGoggles(true);
51
53 if ( m_Strap == parent && PlayerBase.CastTo(player, parent.GetHierarchyRootPlayer()) )
54 {
55 if ( parent && Clothing.Cast(parent) )
56 {
57 Clothing.Cast(parent).UpdateNVGStatus(player,false,true);
58 }
59 }
60
61 m_Strap = null;
62 //SetPlayer(null);
63 }

Перекрестные ссылки RotateGoggles().

◆ OnWork()

override void OnWork ( float consumed_energy)
inlineprivate
112 {
113 //adjust on load - ComponentEnergyManager stores the 'working' state independently
114 if ( !m_IsLowered )
115 {
116 RotateGoggles(false);
117 }
118
122 if ( m_Strap && PlayerBase.CastTo(player, m_Strap.GetHierarchyParent()) )
123 {
124 headgear = player.FindAttachmentBySlotName("Headgear");
125 glasses = player.FindAttachmentBySlotName("Eyewear");
126
127 if ( !GetGame().IsServer() || !GetGame().IsMultiplayer() ) // Client side
128 {
129 if ( (headgear == m_Strap || glasses == m_Strap) && player.IsControlledPlayer() )
130 {
131 player.AddActiveNV(NVTypes.NV_GOGGLES);
132 }
133 }
134 }
135 }
Definition Building.c:6

Перекрестные ссылки GetGame() и RotateGoggles().

◆ OnWorkStart() [1/2]

override void OnWorkStart ( )
inlineprivate
66 {
70 if ( m_Strap && PlayerBase.CastTo(player, m_Strap.GetHierarchyParent()) )
71 {
72 headgear = player.FindAttachmentBySlotName("Headgear");
73 glasses = player.FindAttachmentBySlotName("Eyewear");
74
75 //adjust on load - ComponentEnergyManager stores the 'working' state independently
76 if ( !m_IsLowered )
77 {
78 RotateGoggles(false);
79 }
80
81 if ( !GetGame().IsServer() || !GetGame().IsMultiplayer() ) // Client side
82 {
83 if ( (headgear == m_Strap || glasses == m_Strap) && player.IsControlledPlayer() )
84 {
85 player.AddActiveNV(NVTypes.NV_GOGGLES);
86 }
87 }
88 }
89 }

Перекрестные ссылки GetGame() и RotateGoggles().

◆ OnWorkStart() [2/2]

override void OnWorkStart ( )
inlineprotected
19 {
20 if( !GetGame().IsDedicatedServer())
21 {
23 PlayerBase player_owner = PlayerBase.Cast( GetHierarchyRootPlayer() );
24
26 {
28 }
29 }
30 }
void StartPeriodicMeasurement()
Definition Rangefinder.c:46

Перекрестные ссылки GetGame(), GetPlayer() и StartPeriodicMeasurement().

◆ OnWorkStop() [1/2]

override void OnWorkStop ( )
inlineprivate
92 {
96 if ( m_Strap && PlayerBase.CastTo(player, m_Strap.GetHierarchyParent()) )
97 {
98 headgear = player.FindAttachmentBySlotName("Headgear");
99 glasses = player.FindAttachmentBySlotName("Eyewear");
100
101 if ( !GetGame().IsServer() || !GetGame().IsMultiplayer() ) // Client side
102 {
103 if ( (headgear == m_Strap || glasses == m_Strap) && player.IsControlledPlayer() )
104 {
105 player.RemoveActiveNV(NVTypes.NV_GOGGLES);
106 }
107 }
108 }
109 }

Перекрестные ссылки GetGame().

◆ OnWorkStop() [2/2]

override void OnWorkStop ( )
inlineprotected
33 {
34 if( !GetGame().IsDedicatedServer())
35 {
37 PlayerBase player_owner = PlayerBase.Cast( GetHierarchyRootPlayer() );
38
40 {
42 }
43 }
44 }
void StopPeriodicMeasurement()
Definition Rangefinder.c:58

Перекрестные ссылки GetGame(), GetPlayer() и StopPeriodicMeasurement().

◆ Rangefinder()

void Rangefinder ( )
inlineprotected
9 {
10 }

◆ RotateGoggles()

void RotateGoggles ( bool state)
inlineprivate
146 {
147 if (!m_Strap && !state) // disable non default rotation while not strapped
148 return;
149
150 //if ( GetAnimationPhase("rotate") != state ) //useless?
151 SetAnimationPhase("rotate",!state);
153
155 int slot_id;
156 string slot_name;
157 if ( m_Strap && m_Strap.GetInventory().GetCurrentAttachmentSlotInfo(slot_id,slot_name) && PlayerBase.CastTo(player, m_Strap.GetHierarchyParent())/*&& slot_id == InventorySlots.EYEWEAR*/ )
158 {
159 player.SetNVGLowered(m_IsLowered);
160 }
161
162 if ( GetCompEM() )
163 {
164 if ( !state && GetCompEM().CanWork() )
165 GetCompEM().SwitchOn();
166 else
167 GetCompEM().SwitchOff();
168 }
169 }

Используется в NVGoggles(), OnWasAttached(), OnWasDetached(), OnWork() и OnWorkStart().

◆ SetActions() [1/2]

override void SetActions ( )
inlineprivate
14 {
15 super.SetActions();
16
19 }
void AddAction(typename actionName)
Definition AdvancedCommunication.c:220
void RemoveAction(typename actionName)
Definition AdvancedCommunication.c:252
Definition ActionViewBinoculars.c:2
Definition ActionViewOptics.c:2

Перекрестные ссылки AddAction() и RemoveAction().

◆ SetActions() [2/2]

override void SetActions ( )
inlineprotected
107 {
108 super.SetActions();
109
112 }

Перекрестные ссылки AddAction() и RemoveAction().

◆ StartPeriodicMeasurement()

void StartPeriodicMeasurement ( )
inlineprotected
47 {
48 if( !m_Timer )
49 {
51 }
52
53 m_RangeText = TextWidget.Cast( GetGame().GetWorkspace().CreateWidgets( "gui/layouts/gameplay/rangefinder_hud.layout" ) );
54
55 m_Timer.Run( GetMeasurementUpdateInterval(), this, "DoMeasurement", null, true );
56 }
float GetMeasurementUpdateInterval()
Definition Rangefinder.c:13
ref Timer m_Timer
Definition Rangefinder.c:5
Definition EnWidgets.c:220
const int CALL_CATEGORY_GAMEPLAY
Definition tools.c:10

Перекрестные ссылки CALL_CATEGORY_GAMEPLAY, GetGame(), GetMeasurementUpdateInterval() и m_Timer.

Используется в OnWorkStart().

◆ StopPeriodicMeasurement()

void StopPeriodicMeasurement ( )
inlineprotected
59 {
60 if( m_Timer )
61 {
62 m_Timer.Stop();
63 }
64
65 if (m_RangeText)
66 {
67 delete m_RangeText;
68 }
69 }

Перекрестные ссылки m_RangeText и m_Timer.

Используется в OnWorkStop().

◆ SwitchOnNVGCheck()

void SwitchOnNVGCheck ( )
inlineprivate
172 {
173 //Print("SwitchOnNVGCheck");
174 GetCompEM().SwitchOn();
175 if (GetCompEM().IsSwitchedOn())
176 {
177 m_WorkCheckTimer.Stop();
178 }
179 }

Поля

◆ m_IsLowered

bool m_IsLowered
private

◆ m_RangeText

TextWidget m_RangeText
protected

Используется в StopPeriodicMeasurement().

◆ m_Strap

Clothing m_Strap
private

◆ m_Timer

ref Timer m_Timer
protected

◆ m_WorkCheckTimer

ref Timer m_WorkCheckTimer
private

◆ RANGEFINDER_MAX_DISTANCE

const float RANGEFINDER_MAX_DISTANCE = 913.4856
staticprivate

Используется в DoMeasurement().


Объявления и описания членов классов находятся в файлах: