DayZ 1.24
Loading...
Searching...
No Matches
PluginDoorRuler.c
Go to the documentation of this file.
1class PluginDoorRuler extends PluginBase
2{
3 PluginDeveloper m_ModuleDeveloper;
6 bool m_Initialized;
7
8 void CheckInit()
9 {
10 if (FreeDebugCamera.GetInstance().IsActive())
11 Init();
12 }
13
14 void Init()
15 {
16 if (m_Ruler)
17 m_Ruler.Delete();
18
19 m_Initialized = true;
20 m_Ruler = ItemBase.Cast(GetGame().CreateObject("DoorTestCamera", FreeDebugCamera.GetInstance().GetPosition(), false, false/*ai*/));
21 }
22
23 override void OnUpdate(float delta_time)
24 {
25 if (!m_Initialized) return;
26 if (!FreeDebugCamera.GetInstance().IsActive()) return;
27 if (!m_Ruler) return;
28 vector cam_pos = FreeDebugCamera.GetInstance().GetPosition();
29 vector ruler_pos = m_Ruler.GetPosition();
30 vector camera_dir = FreeDebugCamera.GetInstance().GetDirection();
31 camera_dir.Normalize();
32 m_Ruler.SetPosition(FreeDebugCamera.GetInstance().GetPosition() + (camera_dir * 2));
33 m_Ruler.SetAngles(FreeDebugCamera.GetInstance().GetAngles());
34 }
35}
override Widget Init()
Definition DayZGame.c:120
ref Timer m_Timer
Definition DayZGame.c:675
bool m_Initialized
void CheckInit()
ItemBase m_Ruler
override void OnUpdate(float delta_time)
proto native CGame GetGame()