Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
plugindoorruler.c
Go to the documentation of this file.
1 class PluginDoorRuler extends PluginBase
2 {
3  PluginDeveloper m_ModuleDeveloper;
4  ItemBase m_Ruler;
5  ref Timer m_Timer;
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 }
ItemBase
Definition: inventoryitem.c:730
GetGame
proto native CGame GetGame()
m_Timer
ref Timer m_Timer
Definition: dayzgame.c:690
PluginBase
Definition: pluginadminlog.c:1
vector
Definition: enconvert.c:105
Init
class InventoryGridController extends ScriptedWidgetEventHandler Init
Definition: uihintpanel.c:46
OnUpdate
proto native void OnUpdate()
Definition: tools.c:349
m_Initialized
protected bool m_Initialized
Definition: uihintpanel.c:23
Timer
Definition: dayzplayerimplement.c:62