Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
playerbaseclient.c
Go to the documentation of this file.
2 {
3  static ScriptedLightBase m_PersonalLight;
4  static bool m_PersonalLightEnabledOnCurrentServer = false; // "disablePersonalLight" in server.cfg decides if this is true or false
5  static bool m_PersonalLightDisabledByDebug = false;
6  static bool m_PersonalLightIsSwitchedOn = true;
7 
9  static void CreatePersonalLight()
10  {
11  if (!m_PersonalLight && ( !GetGame().IsServer() || !GetGame().IsMultiplayer() ))
12  {
13  m_PersonalLight = ScriptedLightBase.CreateLight(PersonalLight, "0 0 0");
14  }
15  }
16 
17  /*
18  override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
19  {
20  super.OnRPC(sender, rpc_type, ctx);
21 
22  switch( rpc_type )
23  {
24  case ERPCs.RPC_TOGGLE_PERSONAL_LIGHT:
25  {
26  Param1<bool> is_enabled = new Param1<bool>(false);
27 
28  if (ctx.Read(is_enabled))
29  {
30  m_PersonalLightEnabledOnCurrentServer = is_enabled.param1;
31  UpdatePersonalLight();
32  }
33 
34  break;
35  }
36  }
37  }*/
38 
39  override void OnGameplayDataHandlerSync()
40  {
41  super.OnGameplayDataHandlerSync();
42  m_PersonalLightEnabledOnCurrentServer = !CfgGameplayHandler.GetDisablePersonalLight();
43  UpdatePersonalLight();
44  UpdateHitDirectionValues();
45  }
46 
47 
49  static void SwitchPersonalLight(bool state)
50  {
51  if ( !GetGame().IsServer() || !GetGame().IsMultiplayer() )
52  {
53  m_PersonalLightIsSwitchedOn = state;
54  UpdatePersonalLight();
55  }
56  }
57 
59  static void UpdatePersonalLight()
60  {
61  string param;
62 
63  CreatePersonalLight();
64 
65  // Allow PL unless it's disabled by debug or client-side starting parameter
66  if ( !GetCLIParam("disablePersonalLight", param) && !m_PersonalLightDisabledByDebug && m_PersonalLightIsSwitchedOn )
67  {
68  m_PersonalLight.SetEnabled(m_PersonalLightEnabledOnCurrentServer);
69  }
70  else
71  {
72  m_PersonalLight.SetEnabled(false);
73  }
74  }
75 
76  static void UpdateHitDirectionValues()
77  {
78  HitDirectionEffectBase.CheckValues();
79  }
80 }
GetGame
proto native CGame GetGame()
GetCLIParam
proto bool GetCLIParam(string param, out string val)
Returns command line argument.
PlayerBase
Definition: playerbaseclient.c:1
ScriptedLightBase
Definition: pointlightbase.c:1
CfgGameplayHandler
Definition: cfggameplayhandler.c:1
HitDirectionEffectBase
Definition: hitdirectionarrow.c:2
PlayerBaseClient
Definition: survivorbase.c:1