DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
Battery9V.c
См. документацию.
2{
3 static int SLOT_ID = InventorySlots.GetSlotIdFromString("BatteryD");
4
5 private int m_Efficiency0To10; // Synchronized variable
6 static private float m_EfficiencyDecayStart = 0.1; // At this % of maximum energy the output of the battery starts to weaken.
7
8 void Battery9V()
9 {
11 RegisterNetSyncVariableInt("m_Efficiency0To10");
12 }
13
16 {
17 return m_Efficiency0To10 / 10;
18 }
19
22 {
24 }
25
26
27 override void OnEnergyConsumed()
28 {
29 super.OnEnergyConsumed();
30
31 if (g_Game.IsServer())
32 {
33 float energyCoef = GetCompEM().GetEnergy0To1();
34
35 if (energyCoef < m_EfficiencyDecayStart && m_EfficiencyDecayStart > 0)
36 {
38 SetSynchDirty();
39 }
40 }
41 }
42
43 // Not needed right now, but it will be useful if we add rechargable batteries.
44 override void OnEnergyAdded()
45 {
46 super.OnEnergyAdded();
47
48 if (g_Game.IsServer())
49 {
50 float energyCoef = GetCompEM().GetEnergy0To1();
51 if (energyCoef < m_EfficiencyDecayStart && m_EfficiencyDecayStart > 0)
52 {
54 SetSynchDirty();
55 }
56 else
57 {
59 SetSynchDirty();
60 }
61 }
62 }
63
64 override void SetActions()
65 {
66 super.SetActions();
67
70 }
71}
void AddAction(typename actionName)
Определения AdvancedCommunication.c:220
DayZGame g_Game
Определения DayZGame.c:4074
override void OnEnergyConsumed()
Определения Battery9V.c:27
override void OnEnergyAdded()
Определения Battery9V.c:44
override void SetActions()
Определения Battery9V.c:64
void Battery9V()
Определения Battery9V.c:8
float m_EfficiencyDecayStart
Определения Battery9V.c:6
int m_Efficiency0To10
Определения Battery9V.c:5
float GetEfficiency0To1()
Returns efficiency of this battery. The value is synchronized from server to all clients and is accur...
Определения Battery9V.c:15
float GetEfficiencyDecayStart()
Returns efficiency of this battery. The value is synchronized from server to all clients and is accur...
Определения Battery9V.c:21
static int SLOT_ID
Определения Battery9V.c:3
static proto native int GetSlotIdFromString(string slot_name)
converts string to slot_id
provides access to slot configuration
Определения InventorySlots.c:6
Определения EnMath.c:7
static proto float Round(float f)
Returns mathematical round of value.