DayZ 1.24
Loading...
Searching...
No Matches
PlayerBaseClient.c
Go to the documentation of this file.
2{
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 m_PersonalLight = ScriptedLightBase.CreateLight(PersonalLight, "0 0 0");
13 }
14
15 /*
16 override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
17 {
18 super.OnRPC(sender, rpc_type, ctx);
19
20 switch( rpc_type )
21 {
22 case ERPCs.RPC_TOGGLE_PERSONAL_LIGHT:
23 {
24 Param1<bool> is_enabled = new Param1<bool>(false);
25
26 if (ctx.Read(is_enabled))
27 {
28 m_PersonalLightEnabledOnCurrentServer = is_enabled.param1;
29 UpdatePersonalLight();
30 }
31
32 break;
33 }
34 }
35 }*/
36
38 {
39 super.OnGameplayDataHandlerSync();
40 m_PersonalLightEnabledOnCurrentServer = !CfgGameplayHandler.GetDisablePersonalLight();
41 UpdatePersonalLight();
42 UpdateHitDirectionValues();
43 }
44
45
47 static void SwitchPersonalLight(bool state)
48 {
49 if (!GetGame().IsServer() || !GetGame().IsMultiplayer())
50 {
51 m_PersonalLightIsSwitchedOn = state;
52 UpdatePersonalLight();
53 }
54 }
55
57 static void UpdatePersonalLight()
58 {
59 string param;
60
61 CreatePersonalLight();
62
63 // Allow PL unless it's disabled by debug or client-side starting parameter
64 if (!GetCLIParam("disablePersonalLight", param) && !m_PersonalLightDisabledByDebug && m_PersonalLightIsSwitchedOn)
65 m_PersonalLight.SetEnabled(m_PersonalLightEnabledOnCurrentServer);
66 else
67 m_PersonalLight.SetEnabled(false);
68 }
69
74}
static bool GetDisablePersonalLight()
static void CheckValues()
range 0..180, randomized offset of direction to make it less acurate
static void CreatePersonalLight()
Creates PL if it doesn't exist already.
static void UpdateHitDirectionValues()
static void SwitchPersonalLight(bool state)
Controls the ON/OFF switch of the Personal Light. PL will still shine only if the server allows it.
override void OnGameplayDataHandlerSync()
static ScriptedLightBase m_PersonalLight
static void UpdatePersonalLight()
Updates state of PL.
proto native CGame GetGame()
proto bool GetCLIParam(string param, out string val)
Returns command line argument.