Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
developerfreecamera.c
Go to the documentation of this file.
2 {
3  static void OnInit();
4 
6  static void FreeCameraToggle(PlayerBase player, bool teleport_player = false)
7  {
8  if (!IsFreeCameraEnabled())
9  {
10  EnableFreeCamera(player);
11  }
12  else
13  {
14  DisableFreeCamera(player, teleport_player);
15  }
16  }
17 
18  static void EnableFreeCameraSceneEditor(PlayerBase player)
19  {
20  EnableFreeCamera(player);
21  }
22 
23  static bool IsFreeCameraEnabled()
24  {
25  return FreeDebugCamera.GetInstance().IsActive();
26  }
27 
28  protected static void EnableFreeCamera(PlayerBase player)
29  {
30  if (player)
31  {
32  FreeDebugCamera.GetInstance().SetActive(true);
33 
34  #ifdef DEVELOPER
35  GetGame().GetMission().RefreshCrosshairVisibility();
36  #endif
37  }
38  else
39  {
40  Debug.LogError("EnableFreeCamera( PlayerBase player ) -> player is NULL", "DeveloperFreeCamera");
41  }
42  }
43 
44  static void DisableFreeCamera(PlayerBase player, bool teleport_player = false)
45  {
46  if (player)
47  {
48  if (FreeDebugCamera.GetInstance().IsActive())
49  {
50  if (teleport_player)
51  DeveloperTeleport.TeleportAtCursorEx();
52 
53  FreeDebugCamera.GetInstance().SetActive(false);
54 
55  #ifdef DEVELOPER
56  if (GetGame().GetMission())
57  GetGame().GetMission().RefreshCrosshairVisibility();
58  #endif
59  }
60  }
61  else
62  {
63  Debug.LogError("DisableFreeCamera( PlayerBase player, bool teleport_player ) -> player is NULL", "DeveloperFreeCamera");
64  }
65  }
66 
67  static void OnSetFreeCameraEvent(PlayerBase player, FreeDebugCamera camera)
68  {
69  if (player)
70  {
71  #ifdef DEVELOPER
72  if (!GetGame().IsMultiplayer())
73  {
74  PluginSceneManager sceneManager = PluginSceneManager.Cast(GetPlugin(PluginSceneManager));
75 
76  if (sceneManager.IsOpened())
77  sceneManager.EditorToggle();
78  }
79 
80  GetGame().GetMission().RefreshCrosshairVisibility();
81  #endif
82  }
83  }
84 }
GetGame
proto native CGame GetGame()
DeveloperFreeCamera
Definition: developerfreecamera.c:1
GetPlugin
PluginBase GetPlugin(typename plugin_type)
Definition: pluginmanager.c:316
PlayerBase
Definition: playerbaseclient.c:1
DeveloperTeleport
Definition: developerteleport.c:1
Debug
Definition: debug.c:13