Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
outdoorthermometer.c
Go to the documentation of this file.
1
class
OutdoorThermometerManager
2
{
3
private
static
float
TIME_BETWEEN_UPDATE
= 1;
4
private
static
float
LIMIT_FOR_UPDATE_ALL_THERMOMETERS
= 100;
5
private
static
ref
array<OutdoorThermometer>
m_Thermometers
;
6
private
static
int
m_LastCheckIndex
;
7
private
static
float
m_TimeToUpdate
;
8
//How many thermomethers will be set per update.
9
private
static
int
m_NumUpdate
= 1;
10
11
static
void
Init
()
12
{
13
m_Thermometers
=
new
array<OutdoorThermometer>
;
14
m_LastCheckIndex
= 0;
15
m_TimeToUpdate
= 0;
16
}
17
18
static
void
Cleanup
()
19
{
20
m_Thermometers
= null;
21
m_LastCheckIndex
= 0;
22
}
23
24
static
void
Add
(
OutdoorThermometer
thermometer)
25
{
26
if
(
m_Thermometers
)
27
{
28
m_Thermometers
.Insert(thermometer);
29
30
m_NumUpdate
=
Math
.
Ceil
((
m_Thermometers
.Count() *
TIME_BETWEEN_UPDATE
) /
LIMIT_FOR_UPDATE_ALL_THERMOMETERS
);
31
}
32
}
33
34
static
void
Remove
(
OutdoorThermometer
thermometer)
35
{
36
if
(
m_Thermometers
)
37
{
38
m_Thermometers
.RemoveItem(thermometer);
39
40
m_NumUpdate
=
Math
.
Ceil
((
m_Thermometers
.Count() *
TIME_BETWEEN_UPDATE
) /
LIMIT_FOR_UPDATE_ALL_THERMOMETERS
);
41
}
42
}
43
44
static
void
Update
(
float
timeslice)
45
{
46
int
count =
m_Thermometers
.Count();
47
if
(count)
48
{
49
if
(
m_TimeToUpdate
< 0)
50
{
51
for
(
int
i = 0; i <
m_NumUpdate
; i++)
52
{
53
if
(
m_LastCheckIndex
>= count)
54
m_LastCheckIndex
= 0;
55
56
m_Thermometers
[
m_LastCheckIndex
].UpdateTemperature();
57
m_LastCheckIndex
++;
58
}
59
60
m_TimeToUpdate
=
TIME_BETWEEN_UPDATE
;
61
}
62
else
63
m_TimeToUpdate
-= timeslice;
64
}
65
}
66
}
67
68
class
OutdoorThermometer
:
House
69
{
70
protected
float
m_MaxValue
= 50;
71
protected
float
m_MinValue
= -20;
72
73
void
OutdoorThermometer
()
74
{
75
OutdoorThermometerManager
.
Add
(
this
);
76
77
g_Game
.GetCallQueue(
CALL_CATEGORY_SYSTEM
).CallLater(
LateInit
, 250);
78
}
79
80
void
~OutdoorThermometer
()
81
{
82
OutdoorThermometerManager
.
Remove
(
this
);
83
}
84
85
void
UpdateTemperature
()
86
{
87
float
temperature =
g_Game
.GetMission().GetWorldData().GetTemperature(
this
,
EEnvironmentTemperatureComponent
.ALTITUDE|
EEnvironmentTemperatureComponent
.OVERCAST|
EEnvironmentTemperatureComponent
.FOG);
88
float
temperature01 = (temperature -
m_MinValue
) / (
m_MaxValue
-
m_MinValue
);
89
90
temperature01 =
Math
.
Clamp
(temperature01, 0.0, 1.0);
91
92
SetAnimationPhase(
"ThermoGauge"
, temperature01);
93
}
94
95
private
void
LateInit
()
96
{
97
g_Game
.RegisterNetworkStaticObject(
this
);
98
UpdateTemperature
();
99
}
100
}
101
102
class
Land_OutsideThermometer
:
OutdoorThermometer
103
{
104
void
Land_OutsideThermometer
()
105
{
106
m_MinValue
= -40.0;
107
m_MaxValue
= 50.0;
108
}
109
}
110
111
class
Land_OutsideThermometer_1
:
OutdoorThermometer
112
{
113
void
Land_OutsideThermometer_1
()
114
{
115
m_MinValue
= -30.0;
116
m_MaxValue
= 50;
117
}
118
}
119
120
class
Land_OutsideThermometer_2
:
OutdoorThermometer
121
{
122
void
Land_OutsideThermometer_2
()
123
{
124
m_MinValue
= -35.0;
125
m_MaxValue
= 55.0;
126
}
127
}
128
129
class
Land_OutsideThermometer_2_wall :
Land_OutsideThermometer_2
130
{
131
}
House
Definition
crashbase.c:2
Land_OutsideThermometer_2
Definition
outdoorthermometer.c:121
Land_OutsideThermometer_2::Land_OutsideThermometer_2
void Land_OutsideThermometer_2()
Definition
outdoorthermometer.c:122
Land_OutsideThermometer::Land_OutsideThermometer
void Land_OutsideThermometer()
Definition
outdoorthermometer.c:104
Math
Definition
enmath.c:7
OutdoorThermometerManager
Definition
outdoorthermometer.c:2
OutdoorThermometerManager::Init
static void Init()
Definition
outdoorthermometer.c:11
OutdoorThermometerManager::m_TimeToUpdate
static float m_TimeToUpdate
Definition
outdoorthermometer.c:7
OutdoorThermometerManager::Cleanup
static void Cleanup()
Definition
outdoorthermometer.c:18
OutdoorThermometerManager::LIMIT_FOR_UPDATE_ALL_THERMOMETERS
static float LIMIT_FOR_UPDATE_ALL_THERMOMETERS
Definition
outdoorthermometer.c:4
OutdoorThermometerManager::Add
static void Add(OutdoorThermometer thermometer)
Definition
outdoorthermometer.c:24
OutdoorThermometerManager::Update
static void Update(float timeslice)
Definition
outdoorthermometer.c:44
OutdoorThermometerManager::m_LastCheckIndex
static int m_LastCheckIndex
Definition
outdoorthermometer.c:6
OutdoorThermometerManager::TIME_BETWEEN_UPDATE
static float TIME_BETWEEN_UPDATE
Definition
outdoorthermometer.c:3
OutdoorThermometerManager::Remove
static void Remove(OutdoorThermometer thermometer)
Definition
outdoorthermometer.c:34
OutdoorThermometerManager::m_Thermometers
static ref array< OutdoorThermometer > m_Thermometers
Definition
outdoorthermometer.c:5
OutdoorThermometerManager::m_NumUpdate
static int m_NumUpdate
Definition
outdoorthermometer.c:9
array
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Definition
isboxcollidinggeometryproxyclasses.c:28
g_Game
DayZGame g_Game
Definition
dayzgame.c:3942
EEnvironmentTemperatureComponent
EEnvironmentTemperatureComponent
Definition
eenvironmenttemperaturecomponent.c:2
Math::Clamp
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
Math::Ceil
static proto float Ceil(float f)
Returns ceil of value.
CALL_CATEGORY_SYSTEM
const int CALL_CATEGORY_SYSTEM
Definition
tools.c:8
~OutdoorThermometer
void ~OutdoorThermometer()
Definition
outdoorthermometer.c:80
UpdateTemperature
void UpdateTemperature()
Definition
outdoorthermometer.c:85
Land_OutsideThermometer_1
Land_OutsideThermometer OutdoorThermometer Land_OutsideThermometer_1()
Definition
outdoorthermometer.c:113
m_MinValue
float m_MinValue
Definition
outdoorthermometer.c:71
LateInit
void LateInit()
Definition
outdoorthermometer.c:95
m_MaxValue
class OutdoorThermometerManager m_MaxValue
OutdoorThermometer
void OutdoorThermometer()
Definition
outdoorthermometer.c:73
m_MinValue
class PlayerStatBase m_MinValue
m_MaxValue
T m_MaxValue
Definition
playerstatbase.c:35
Games
Dayz
scripts
4_world
entities
building
outdoorthermometer.c
Generated by
1.17.0