7 bool m_ShowingDiagDraw;
9 bool m_EnableHitIndication =
false;
11 override protected void Init()
15 if (
GetGame().GetMission().GetEffectWidgets())
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)
24 super.RegisterBleedingZoneEx(
name,max_time,bone,orientation,offset,flow_modifier,particle_name,inv_location);
26 if (
GetGame().GetMission().GetEffectWidgets())
35 if (current_bits != m_BleedingBits)
37 if (m_BleedingBits == 0)
42 m_BleedingBits = current_bits;
43 if (m_BleedingBits == 0)
52 m_BleedingSourceZone.Clear();
59 int bit = 1 << bit_offset;
61 if ((bit & m_BleedingBits) != 0)
72 super.AddBleedingSource(bit);
74 m_BleedingSources.Get(bit).m_DiagTimeStart =
GetGame().GetTickTime();
82 if (super.RemoveBleedingSource(bit))
93 for (
int i = 0; i < 32; ++i)
95 int compare_bit = 1 << i;
96 int new_compare_result_bit = compare_bit & new_mask;
97 int old_compare_result_bit = compare_bit & old_mask;
99 if (new_compare_result_bit)
101 if (!(new_compare_result_bit & old_mask))
109 if (new_compare_result_bit != old_compare_result_bit)
119 int bleeding_source_count = 0;
124 int bit =
Math.Pow(2, pow);
126 if ((m_BleedingBits & bit) != 0)
128 bleeding_source_count++;
132 return bleeding_source_count;
148 else if (m_ShowingDiag || m_ShowingDiagDraw)
152 if (m_ShowingDiagDraw)
160 m_ShowingDiag =
true;
161 DbgUI.BeginCleanupScope();
162 DbgUI.Begin(
"Bleeding Sources", 50, 50);
165 bool anyBleedingSourceActive =
false;
169 int bit =
Math.Pow(2, pow);
171 if ((m_BleedingBits & bit) != 0)
175 string slot_name =
InventorySlots.GetSlotName(bsz.GetInvLocation());
176 float timeRemaining = -1;
178 #ifdef DIAG_DEVELOPER
180 timeRemaining = bsz.GetMaxTime() + bsi.m_DiagTimeStart -
GetGame().GetTickTime();
181 timeRemaining =
Math.Round(timeRemaining);
184 DbgUI.Text(
string.Format(
"zone: %1 | closest inv. slot: %2 | time remaining: %3",
name, slot_name, timeRemaining.ToString()));
185 anyBleedingSourceActive =
true;
189 if (!anyBleedingSourceActive)
191 DbgUI.Text(
"No bleeding sources are active.");
196 DbgUI.Text(
"Note: BleedingSourcesManagerServer only updates active sources every 3s, displayed times are client estimates.");
200 DbgUI.EndCleanupScope();
205 m_ShowingDiag =
false;
207 DbgUI.BeginCleanupScope();
208 DbgUI.Begin(
"Bleeding Sources", 50, 50);
210 DbgUI.EndCleanupScope();
234 m_ShowingDiagDraw =
true;
236 int bsCount = m_BleedingSources.Count();
237 for (
int i = 0; i < bsCount; ++i)
239 m_BleedingSources.GetElement(i).DrawDebugShape();
245 m_ShowingDiagDraw =
false;
247 int bsCount = m_BleedingSources.Count();
248 for (
int i = 0; i < bsCount; ++i)
250 m_BleedingSources.GetElement(i).RemoveDebugShape();
void BleedingSource(PlayerBase player, int bit, string bone, vector orientation, vector offset, int max_time, float flow_modifier, string particle_name)
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
void OnVariablesSynchronized(int current_bits)
int GetBleedingSourceCountRemote()
void AddBleedingSource(int bit)
BleedingSourceZone GetBleedingSourceMeta(int bit)
string GetSelectionNameFromBit(int bit)
void DisplayVisualDebug()
bool RemoveBleedingSource(int bit)
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)
void OnBleedingBitsUpdate(int old_mask, int new_mask)
provides access to slot configuration
proto native CGame GetGame()