Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
huddebugwincharstomach.c
Go to the documentation of this file.
1
class
HudDebugWinCharStomach
extends
HudDebugWinBase
2
{
3
TextListboxWidget m_WgtValues;
4
TextWidget
m_WgtOverall
;
5
6
//============================================
7
// Constructor
8
//============================================
9
void
HudDebugWinCharStomach
(
Widget
widget_root)
10
{
11
m_WgtValues
= TextListboxWidget.Cast( widget_root.FindAnyWidget(
"txl_StomachContents"
) );
12
m_WgtOverall
=
TextWidget
.Cast( widget_root.FindAnyWidget(
"InfoOverall"
) );
13
//FitWindow();
14
}
15
16
//============================================
17
// Destructor
18
//============================================
19
void
~HudDebugWinCharStomach
()
20
{
21
SetUpdate
(
false
);
22
}
23
24
25
//============================================
26
// GetWinType
27
//============================================
28
override
int
GetType
()
29
{
30
return
HudDebug
.HUD_WIN_CHAR_STOMACH;
31
}
32
33
//============================================
34
// Show
35
//============================================
36
override
void
Show
()
37
{
38
super.Show();
39
40
//Print("Show()");
41
42
SetUpdate
(
true
);
43
}
44
45
//============================================
46
// Hide
47
//============================================
48
override
void
Hide
()
49
{
50
super.Hide();
51
52
//Print("Hide()");
53
54
SetUpdate
(
false
);
55
}
56
57
//============================================
58
// SetUpdate
59
//============================================
60
override
void
SetUpdate
(
bool
state )
61
{
62
//Disable update on server (PluginDeveloperSync)
63
PlayerBase
player =
PlayerBase
.Cast(
g_Game
.GetPlayer() );
64
65
PluginDeveloperSync developer_sync = PluginDeveloperSync.Cast(
GetPlugin
( PluginDeveloperSync ) );
66
67
//if client, send RPC
68
if
(
g_Game
.IsClient() )
69
{
70
ref Param1<bool> params =
new
Param1<bool>( state );
71
if
( player )
72
{
73
player.RPCSingleParam(
ERPCs
.DEV_STOMACH_UPDATE, params,
true
);
74
SetRPCSent
();
75
}
76
}
77
//else set directly
78
else
79
{
80
if
( developer_sync )
81
{
82
developer_sync.EnableUpdate( state,
ERPCs
.DEV_STOMACH_UPDATE, player );
83
}
84
}
85
}
86
87
88
override
void
Update
()
89
{
90
super.Update();
91
92
//Print("Update()");
93
94
//refresh notifiers
95
SetContentValues
();
96
}
97
98
99
void
SetContentValues
()
100
{
101
PluginDeveloperSync developer_sync = PluginDeveloperSync.Cast(
GetPlugin
( PluginDeveloperSync ) );
102
103
//clear window
104
ClearValues
();
105
int
count = developer_sync.m_PlayerStomachSynced.Count() - 2;
// dont iterate appended params (stomach volume and temperature)
106
107
for
(
int
i = 0; i < count; i++ )
108
{
109
//new Param5<int,int,int,float,float>(id, food_stage, agents, amount,temperature);
110
Param5<int,int,int,float, float> p5 = Param5<int,int,int,float,float>.Cast(developer_sync.m_PlayerStomachSynced.Get(i));
111
AddValue
(
PlayerStomach
.GetClassnameFromID(p5.param1), p5.param2, p5.param3, p5.param4, p5.param5);
112
}
113
114
if
( developer_sync.m_PlayerStomachSynced.Count() )
115
{
116
int
last_index = developer_sync.m_PlayerStomachSynced.Count() - 2;
117
Param1<float> p1 = Param1<float>.Cast(developer_sync.m_PlayerStomachSynced.Get(last_index));
118
119
last_index = developer_sync.m_PlayerStomachSynced.Count() - 1;
120
Param1<float> paramTemp = Param1<float>.Cast(developer_sync.m_PlayerStomachSynced.Get(last_index));
121
m_WgtOverall
.SetText(
"Overall volume:"
+ p1.param1.ToString() +
" "
+
"Average temperature:"
+ paramTemp.param1.ToString());
122
}
123
else
124
{
125
m_WgtOverall
.SetText(
"Overall volume: 0"
+
" "
+
"Average temperature: 0"
);
126
}
127
128
129
130
//fit to screen
131
//FitWindow();
132
}
133
134
void
AddValue
(
string
classname,
int
food_stage,
int
agents,
float
amount,
float
temperature)
135
{
136
int
index =
m_WgtValues
.AddItem( classname, NULL, 0 );
137
string
stage =
typename
.EnumToString(
FoodStageType
, food_stage) +
"("
+ food_stage.ToString()+
")"
;;
138
m_WgtValues
.SetItem( index, amount.
ToString
(), NULL, 1 );
139
m_WgtValues
.SetItem( index,stage , NULL, 2 );
140
m_WgtValues
.SetItem( index, temperature.
ToString
() , NULL, 3 );
141
array<string>
agent_list =
GetAgentsArray
(agents);
142
string
agent_line =
"("
+agents.ToString()+
") "
;
143
144
for
(
int
i = 0; i < agent_list.Count();i++)
145
{
146
agent_line +=
","
+agent_list.Get(i);
147
}
148
149
m_WgtValues
.SetItem( index, agent_line , NULL, 4);
150
}
151
152
array<string>
GetAgentsArray
(
int
agents)
153
{
154
array<string>
list =
new
array<string>
;
155
for
(
int
i = 0; i < 32; i++)
156
{
157
int
agent = agents & (1 << i);
158
if
(agent)
159
{
160
list.Insert(PluginTransmissionAgents.GetNameByID(agent));
161
}
162
}
163
return
list;
164
}
165
166
void
ClearValues
()
167
{
168
m_WgtValues
.ClearItems();
169
}
170
171
void
FitWindow
()
172
{
173
FitWindowByContent
(
m_WgtValues
);
174
}
175
}
HudDebugWinBase
Definition
huddebugwinbase.c:2
HudDebugWinBase::Hide
override void Hide()
Definition
huddebugwincharstomach.c:48
HudDebugWinBase::SetUpdate
override void SetUpdate(bool state)
Definition
huddebugwincharstomach.c:60
HudDebugWinBase::HudDebugWinCharStomach
void HudDebugWinCharStomach(Widget widget_root)
Definition
huddebugwincharstomach.c:9
HudDebugWinBase::m_WgtOverall
TextWidget m_WgtOverall
Definition
huddebugwincharstomach.c:4
HudDebugWinBase::SetRPCSent
void SetRPCSent()
Definition
huddebugwinbase.c:39
HudDebugWinBase::FitWindow
void FitWindow()
Definition
huddebugwincharstomach.c:171
HudDebugWinBase::m_WgtValues
TextListboxWidget m_WgtValues
Definition
huddebugwincharlevels.c:3
HudDebugWinBase::AddValue
void AddValue(string classname, int food_stage, int agents, float amount, float temperature)
Definition
huddebugwincharstomach.c:134
HudDebugWinBase::AddValue
void AddValue(string title, string value, string value2)
Definition
huddebugwincharlevels.c:118
HudDebugWinBase::Update
override void Update()
Definition
huddebugwincharstomach.c:88
HudDebugWinBase::~HudDebugWinCharStomach
void ~HudDebugWinCharStomach()
Definition
huddebugwincharstomach.c:19
HudDebugWinBase::GetType
override int GetType()
Definition
huddebugwincharstomach.c:28
HudDebugWinBase::SetUpdate
void SetUpdate(bool state)
HudDebugWinBase::SetContentValues
void SetContentValues()
Definition
huddebugwincharstomach.c:99
HudDebugWinBase::GetAgentsArray
array< string > GetAgentsArray(int agents)
Definition
huddebugwincharstomach.c:152
HudDebugWinBase::ClearValues
void ClearValues()
Definition
huddebugwincharlevels.c:125
HudDebugWinBase::Show
override void Show()
Definition
huddebugwincharstomach.c:36
HudDebugWinBase::FitWindowByContent
void FitWindowByContent(TextListboxWidget wgt)
Definition
huddebugwinbase.c:74
PlayerBase
Definition
playerbaseclient.c:2
TextWidget
Definition
enwidgets.c:220
Widget
Definition
enwidgets.c:190
array
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Definition
isboxcollidinggeometryproxyclasses.c:28
float::ToString
proto string ToString(bool simple=true)
g_Game
DayZGame g_Game
Definition
dayzgame.c:3942
ERPCs
ERPCs
Definition
erpcs.c:2
FoodStageType
FoodStageType
Definition
foodstage.c:2
HudDebug
void HudDebug()
Definition
huddebug.c:108
PlayerStomach
void PlayerStomach(PlayerBase player)
Definition
playerstomach.c:142
GetPlugin
PluginBase GetPlugin(typename plugin_type)
Definition
pluginmanager.c:325
Games
Dayz
scripts
5_mission
gui
scriptshuddebug
huddebugwincharstomach.c
Generated by
1.17.0