Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
bleedingsourcesmanagerremote.c
Go to the documentation of this file.
1
//this is instantiated on the client for both the controlled character, as well as the remote characters
2
class
BleedingSourcesManagerRemote
extends
BleedingSourcesManagerBase
3
{
4
int
m_BleedingBits
;
5
bool
m_ShowDiag
;
6
bool
m_ShowingDiag
;
7
bool
m_ShowingDiagDraw
;
8
Shape
m_Point
;
9
bool
m_EnableHitIndication
=
false
;
10
11
override
protected
void
Init
()
12
{
13
super.Init();
14
15
if
(
g_Game
.GetMission().GetEffectWidgets()
/* && m_Player.IsControlledPlayer()*/
)
16
{
17
Param3<bool,int,float>
par =
new
Param3<bool,int,float>
(
true
,0,0);
18
g_Game
.GetMission().GetEffectWidgets().RegisterGameplayEffectData(EffectWidgetsTypes.BLEEDING_LAYER,par);
19
}
20
}
21
22
override
protected
void
RegisterBleedingZoneEx
(
string
name
,
int
max_time,
string
bone =
""
,
vector
orientation =
"0 0 0"
,
vector
offset =
"0 0 0"
,
float
flow_modifier = 1,
string
particle_name =
"BleedingSourceEffect"
,
int
inv_location = 0)
23
{
24
super.RegisterBleedingZoneEx(
name
,max_time,bone,orientation,offset,flow_modifier,particle_name,inv_location);
25
26
GameplayEffectWidgets_base
widgets =
g_Game
.GetMission().GetEffectWidgets();
27
if
(widgets
/* && m_Player.IsControlledPlayer()*/
)
28
{
29
Param3<bool,int,float>
par =
new
Param3<bool,int,float>
(
false
,
m_Bit
,flow_modifier);
30
widgets.
RegisterGameplayEffectData
(EffectWidgetsTypes.BLEEDING_LAYER,par);
31
}
32
}
33
34
void
OnVariablesSynchronized
(
int
current_bits)
35
{
36
if
(current_bits !=
m_BleedingBits
)
37
{
38
if
(
m_BleedingBits
== 0)
39
{
40
m_Player
.OnBleedingBegin();
41
}
42
OnBleedingBitsUpdate
(
m_BleedingBits
, current_bits);
43
m_BleedingBits
= current_bits;
44
if
(
m_BleedingBits
== 0)
45
{
46
m_Player
.OnBleedingEnd();
47
}
48
}
49
}
50
51
void
Reload
()
52
{
53
m_BleedingSourceZone
.Clear();
54
m_BitOffset
= 0;
55
Init
();
56
int
bit_offset = 0;
57
58
for
(
int
i = 0; i <
BIT_INT_SIZE
; ++i)
59
{
60
int
bit = 1 << bit_offset;
61
bit_offset++;
62
if
((bit &
m_BleedingBits
) != 0)
63
{
64
RemoveBleedingSource
(bit);
65
AddBleedingSource
(bit);
66
}
67
}
68
}
69
70
71
override
protected
void
AddBleedingSource
(
int
bit)
72
{
73
super.AddBleedingSource(bit);
74
#ifdef DIAG_DEVELOPER
75
m_BleedingSources
.Get(bit).m_DiagTimeStart =
g_Game
.GetTickTime();
76
#endif
77
if
(
g_Game
.IsMultiplayer())
78
m_Player
.OnBleedingSourceAdded();
79
}
80
81
override
protected
bool
RemoveBleedingSource
(
int
bit)
82
{
83
if
(super.RemoveBleedingSource(bit))
84
{
85
if
(
g_Game
.IsMultiplayer())
86
m_Player
.OnBleedingSourceRemovedEx(
m_Item
);
87
return
true
;
88
}
89
return
false
;
90
}
91
92
void
OnBleedingBitsUpdate
(
int
old_mask,
int
new_mask)
93
{
94
for
(
int
i = 0; i < 32; ++i)
95
{
96
int
compare_bit = 1 << i;
97
int
new_compare_result_bit = compare_bit & new_mask;
98
int
old_compare_result_bit = compare_bit & old_mask;
99
100
if
(new_compare_result_bit)
101
{
102
if
(!(new_compare_result_bit & old_mask))
103
{
104
//a different active bit in the new mask
105
AddBleedingSource
(new_compare_result_bit);
106
}
107
}
108
else
109
{
110
if
(new_compare_result_bit != old_compare_result_bit)
111
{
112
RemoveBleedingSource
(old_compare_result_bit);
113
}
114
}
115
}
116
}
117
118
int
GetBleedingSourceCountRemote
()
119
{
120
int
bleeding_source_count = 0;
121
int
pow = 0;
122
123
for
(
int
i = 0; i <
BIT_INT_SIZE
; ++i)
124
{
125
int
bit =
Math
.
Pow
(2, pow);
126
pow++;
127
if
((
m_BleedingBits
& bit) != 0)
128
{
129
bleeding_source_count++;
130
}
131
}
132
133
return
bleeding_source_count;
134
}
135
136
void
SetDiag
(
bool
value)
137
{
138
m_ShowDiag
= value;
139
}
140
141
void
OnUpdate
()
142
{
143
#ifndef NO_GUI
144
if
(
m_ShowDiag
)
145
{
146
DisplayDebug
();
147
DisplayVisualDebug
();
148
}
149
else
if
(
m_ShowingDiag
||
m_ShowingDiagDraw
)
150
{
151
if
(
m_ShowingDiag
)
152
CleanDebug
();
153
if
(
m_ShowingDiagDraw
)
154
CleanVisualDebug
();
155
}
156
#endif
157
}
158
159
void
DisplayDebug
()
160
{
161
m_ShowingDiag
=
true
;
162
DbgUI
.
BeginCleanupScope
();
163
DbgUI
.
Begin
(
"Bleeding Sources"
, 50, 50);
164
165
int
pow = 0;
166
bool
anyBleedingSourceActive =
false
;
167
168
for
(
int
i = 0; i <
BIT_INT_SIZE
; ++i)
169
{
170
int
bit =
Math
.
Pow
(2, pow);
171
pow++;
172
if
((
m_BleedingBits
& bit) != 0)
173
{
174
BleedingSourceZone
bsz =
GetBleedingSourceMeta
(bit);
175
string
name
=
GetSelectionNameFromBit
(bit);
176
string
slot_name =
InventorySlots
.
GetSlotName
(bsz.
GetInvLocation
());
177
float
timeRemaining = -1;
178
179
#ifdef DIAG_DEVELOPER
180
BleedingSource
bsi =
m_BleedingSources
.Get(bit);
181
timeRemaining = bsz.
GetMaxTime
() + bsi.m_DiagTimeStart -
g_Game
.GetTickTime();
182
timeRemaining =
Math
.
Round
(timeRemaining);
183
#endif
184
185
DbgUI
.
Text
(
string
.Format(
"zone: %1 | closest inv. slot: %2 | time remaining: %3"
,
name
, slot_name, timeRemaining.
ToString
()));
186
anyBleedingSourceActive =
true
;
187
}
188
}
189
190
if
(!anyBleedingSourceActive)
191
{
192
DbgUI
.
Text
(
"No bleeding sources are active."
);
193
}
194
else
195
{
196
DbgUI
.
Text
(
""
);
197
DbgUI
.
Text
(
"Note: BleedingSourcesManagerServer only updates active sources every 3s, displayed times are client estimates."
);
198
}
199
200
DbgUI
.
End
();
201
DbgUI
.
EndCleanupScope
();
202
}
203
204
void
CleanDebug
()
205
{
206
m_ShowingDiag
=
false
;
207
208
DbgUI
.
BeginCleanupScope
();
209
DbgUI
.
Begin
(
"Bleeding Sources"
, 50, 50);
210
DbgUI
.
End
();
211
DbgUI
.
EndCleanupScope
();
212
}
213
214
void
DisplayVisualDebug
()
215
{
216
/*
217
if (m_Point)
218
{
219
Debug.RemoveShape(m_Point);
220
}
221
222
int boneIdx = m_Player.GetBoneIndexByName("LeftKneeExtra");
223
int pointIdx = m_Player.GetMemoryPointIndex("lknee");
224
225
vector posLS = DayZPlayerUtils.GetMemoryPointPositionBoneRelative(m_Player, boneIdx, pointIdx);
226
227
vector pTm[4];
228
m_Player.GetBoneTransformMS(boneIdx, pTm);
229
vector posMS = posLS.Multiply4(pTm);
230
231
vector pos = m_Player.ModelToWorld(posMS);
232
m_Point = Debug.DrawSphere(pos, 0.1, COLOR_RED);
233
*/
234
235
m_ShowingDiagDraw
=
true
;
236
237
int
bsCount =
m_BleedingSources
.Count();
238
for
(
int
i = 0; i < bsCount; ++i)
239
{
240
m_BleedingSources
.GetElement(i).DrawDebugShape();
241
}
242
}
243
244
void
CleanVisualDebug
()
245
{
246
m_ShowingDiagDraw
=
false
;
247
248
int
bsCount =
m_BleedingSources
.Count();
249
for
(
int
i = 0; i < bsCount; ++i)
250
{
251
m_BleedingSources
.GetElement(i).RemoveDebugShape();
252
}
253
}
254
}
BleedingSource
void BleedingSource(PlayerBase player, int bit, string bone, vector orientation, vector offset, int max_time, float flow_modifier, string particle_name)
Definition
bleedingsource.c:31
BIT_INT_SIZE
const int BIT_INT_SIZE
Definition
bitarray.c:4
name
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
BleedingSourceZone
Definition
bleedingsourcezone.c:2
BleedingSourceZone::GetMaxTime
int GetMaxTime()
Definition
bleedingsourcezone.c:46
BleedingSourceZone::GetInvLocation
int GetInvLocation()
Definition
bleedingsourcezone.c:31
BleedingSourcesManagerBase
Definition
bleedingsourcesmanagerbase.c:2
BleedingSourcesManagerBase::SetDiag
void SetDiag(bool value)
Definition
bleedingsourcesmanagerremote.c:136
BleedingSourcesManagerBase::Init
void Init()
Definition
bleedingsourcesmanagerremote.c:11
BleedingSourcesManagerBase::OnVariablesSynchronized
void OnVariablesSynchronized(int current_bits)
Definition
bleedingsourcesmanagerremote.c:34
BleedingSourcesManagerBase::m_BleedingSources
ref map< int, ref BleedingSource > m_BleedingSources
Definition
bleedingsourcesmanagerbase.c:3
BleedingSourcesManagerBase::GetBleedingSourceCountRemote
int GetBleedingSourceCountRemote()
Definition
bleedingsourcesmanagerremote.c:118
BleedingSourcesManagerBase::DisplayDebug
void DisplayDebug()
Definition
bleedingsourcesmanagerremote.c:159
BleedingSourcesManagerBase::CleanVisualDebug
void CleanVisualDebug()
Definition
bleedingsourcesmanagerremote.c:244
BleedingSourcesManagerBase::m_Player
PlayerBase m_Player
Definition
bleedingsourcesmanagerbase.c:9
BleedingSourcesManagerBase::m_BleedingBits
int m_BleedingBits
Definition
bleedingsourcesmanagerremote.c:4
BleedingSourcesManagerBase::GetSelectionNameFromBit
string GetSelectionNameFromBit(int bit)
Definition
bleedingsourcesmanagerbase.c:189
BleedingSourcesManagerBase::OnUpdate
void OnUpdate()
Definition
bleedingsourcesmanagerremote.c:141
BleedingSourcesManagerBase::m_ShowDiag
bool m_ShowDiag
Definition
bleedingsourcesmanagerremote.c:5
BleedingSourcesManagerBase::Reload
void Reload()
Definition
bleedingsourcesmanagerremote.c:51
BleedingSourcesManagerBase::OnBleedingBitsUpdate
void OnBleedingBitsUpdate(int old_mask, int new_mask)
Definition
bleedingsourcesmanagerremote.c:92
BleedingSourcesManagerBase::m_BleedingSourceZone
ref map< string, ref BleedingSourceZone > m_BleedingSourceZone
Definition
bleedingsourcesmanagerbase.c:4
BleedingSourcesManagerBase::m_ShowingDiagDraw
bool m_ShowingDiagDraw
Definition
bleedingsourcesmanagerremote.c:7
BleedingSourcesManagerBase::m_BitOffset
int m_BitOffset
Definition
bleedingsourcesmanagerbase.c:13
BleedingSourcesManagerBase::m_ShowingDiag
bool m_ShowingDiag
Definition
bleedingsourcesmanagerremote.c:6
BleedingSourcesManagerBase::CleanDebug
void CleanDebug()
Definition
bleedingsourcesmanagerremote.c:204
BleedingSourcesManagerBase::RemoveBleedingSource
bool RemoveBleedingSource(int bit)
Definition
bleedingsourcesmanagerbase.c:308
BleedingSourcesManagerBase::DisplayVisualDebug
void DisplayVisualDebug()
Definition
bleedingsourcesmanagerremote.c:214
BleedingSourcesManagerBase::m_EnableHitIndication
bool m_EnableHitIndication
Definition
bleedingsourcesmanagerremote.c:9
BleedingSourcesManagerBase::GetBleedingSourceMeta
BleedingSourceZone GetBleedingSourceMeta(int bit)
Definition
bleedingsourcesmanagerbase.c:127
BleedingSourcesManagerBase::RegisterBleedingZoneEx
void RegisterBleedingZoneEx(string name, int max_time, string bone="", vector orientation="0 0 0", vector offset="0 0 0", float flow_modifier=1, string particle_name="BleedingSourceEffect", int inv_location=0)
Definition
bleedingsourcesmanagerremote.c:22
BleedingSourcesManagerBase::AddBleedingSource
void AddBleedingSource(int bit)
Definition
bleedingsourcesmanagerbase.c:260
BleedingSourcesManagerBase::m_Point
Shape m_Point
Definition
bleedingsourcesmanagerremote.c:8
BleedingSourcesManagerBase::m_Item
ItemBase m_Item
Definition
bleedingsourcesmanagerbase.c:8
BleedingSourcesManagerBase::m_Bit
int m_Bit
Definition
bleedingsourcesmanagerbase.c:12
DbgUI
Definition
dbgui.c:60
GameplayEffectWidgets_base
grouped gameplay effect widgets and their handling
Definition
gameplayeffectwidgets.c:7
GameplayEffectWidgets_base::RegisterGameplayEffectData
override void RegisterGameplayEffectData(int id, Param p)
Definition
gameplayeffectwidgets.c:126
InventorySlots
provides access to slot configuration
Definition
inventoryslots.c:6
InventorySlots::GetSlotName
static proto native owned string GetSlotName(int id)
Math
Definition
enmath.c:7
Param3
Definition
entityai.c:102
float::ToString
proto string ToString(bool simple=true)
vector
Definition
enconvert.c:119
g_Game
DayZGame g_Game
Definition
dayzgame.c:3942
DbgUI::Begin
static proto native void Begin(string windowTitle, float x=0, float y=0)
DbgUI::BeginCleanupScope
static proto void BeginCleanupScope()
DbgUI::Text
static proto native void Text(string label)
DbgUI::EndCleanupScope
static proto native void EndCleanupScope()
DbgUI::End
static proto native void End()
Shape
class DiagMenu Shape
Instance of created debug visualizer.
Math::Pow
static proto float Pow(float v, float power)
Return power of v ^ power.
Math::Round
static proto float Round(float f)
Returns mathematical round of value.
Games
Dayz
scripts
4_world
classes
bleedingsources
bleedingsourcesmanagerremote.c
Generated by
1.17.0