DayZ 1.24
Loading...
Searching...
No Matches
Battery9V.c
Go to the documentation of this file.
2{
3 private int m_Efficiency0To10; // Synchronized variable
4 static private float m_EfficiencyDecayStart = 0.1; // At this % of maximum energy the output of the battery starts to weaken.
5
6 void Battery9V()
7 {
9 RegisterNetSyncVariableInt("m_Efficiency0To10");
10 }
11
14 {
15 return m_Efficiency0To10 / 10;
16 }
17
20 {
22 }
23
24
25 override void OnEnergyConsumed()
26 {
27 super.OnEnergyConsumed();
28
29 if (GetGame().IsServer())
30 {
31 float energyCoef = GetCompEM().GetEnergy0To1();
32
34 {
36 SetSynchDirty();
37 }
38 }
39 }
40
41 // Not needed right now, but it will be useful if we add rechargable batteries.
42 override void OnEnergyAdded()
43 {
44 super.OnEnergyAdded();
45
46 if (GetGame().IsServer())
47 {
48 float energyCoef = GetCompEM().GetEnergy0To1();
50 {
52 SetSynchDirty();
53 }
54 else
55 {
57 SetSynchDirty();
58 }
59 }
60 }
61
62 override void SetActions()
63 {
64 super.SetActions();
65
67 }
68}
void AddAction(typename actionName)
override void OnEnergyConsumed()
Definition Battery9V.c:25
override void OnEnergyAdded()
Definition Battery9V.c:42
override void SetActions()
Definition Battery9V.c:62
void Battery9V()
Definition Battery9V.c:6
float m_EfficiencyDecayStart
Definition Battery9V.c:4
int m_Efficiency0To10
Definition Battery9V.c:3
float GetEfficiency0To1()
Returns efficiency of this battery. The value is synchronized from server to all clients and is accur...
Definition Battery9V.c:13
float GetEfficiencyDecayStart()
Returns efficiency of this battery. The value is synchronized from server to all clients and is accur...
Definition Battery9V.c:19
Definition EnMath.c:7
proto native CGame GetGame()
static proto float Round(float f)
Returns mathematical round of value.