7 static ref set<int> m_BleedingSourcesLocationsList =
new set<int>;
43 RegisterBleedingZoneEx(
"LeftForeArmRoll",
PlayerConstants.BLEEDING_SOURCE_DURATION_NORMAL,
"",
"0 90 0" ,
"0.1 0 0",
PlayerConstants.BLEEDING_SOURCE_FLOW_MODIFIER_LOW,
"BleedingSourceEffectLight",
InventorySlots.GLOVES);
45 RegisterBleedingZoneEx(
"RightForeArmRoll",
PlayerConstants.BLEEDING_SOURCE_DURATION_NORMAL,
"",
"0 90 0" ,
"-0.1 0 0",
PlayerConstants.BLEEDING_SOURCE_FLOW_MODIFIER_LOW,
"BleedingSourceEffectLight",
InventorySlots.GLOVES);
64 protected void SetItem(
ItemBase item)
70 set<int> GetBleedingSourcesLocations()
72 return m_BleedingSourcesLocationsList;
77 int GetBleedingSourceBitsByInvLocation(
int inv_location)
79 if (m_BleedingSourcesByLocation.Contains(inv_location))
81 return m_BleedingSourcesByLocation.Get(inv_location);
88 int GetFreeBleedingSourceBitsByInvLocation(
int inv_location)
90 if (m_BleedingSourcesZonesMaskByLocation.Contains(inv_location))
92 return (~m_BleedingSourcesZonesMaskByLocation.Get(inv_location) & GetBleedingSourceBitsByInvLocation(inv_location)) | (m_BleedingSourcesZonesMaskByLocation.Get(inv_location) & ~GetBleedingSourceBitsByInvLocation(inv_location));
98 bool IsBleedingSourceActive(
string name)
101 int bit = GetBitFromSelectionName(
name);
103 return m_Player.GetBleedingBits() & bit;
107 protected int GetBitFromSelectionID(
int id)
129 return m_BleedingSourceZone.Get(GetSelectionNameFromBit(bit));
132 int GetRegisteredSourcesCount()
137 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)
148 m_Bit = 1 << m_BitOffset;
150 string bone_name = bone;
158 m_BleedingSourceZone.Get(
name).SetInvLocation(inv_location);
160 m_BleedingSourcesZonesMaskByLocation.Set( inv_location, m_BleedingSourcesZonesMaskByLocation.Get(inv_location) |
m_Bit);
161 m_BleedingSourcesLocationsList.Insert(inv_location);
165 protected void RegisterBleedingZone(
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")
167 RegisterBleedingZoneEx(
name, max_time, bone, orientation, offset, flow_modifier, particle_name);
170 void RemoveAllSources()
173 while (m_BleedingSources.Count() > 0 )
175 int bit = m_BleedingSources.GetKey(0);
176 RemoveBleedingSource(bit);
180 protected int GetBitFromSelectionName(
string name)
182 if (!m_BleedingSourceZone.Get(
name))
186 return m_BleedingSourceZone.Get(
name).GetBit();
189 protected string GetSelectionNameFromBit(
int bit)
191 return m_BitToFireGeom.Get(bit);
194 bool AttemptAddBleedingSource(
int component)
196 int bit = GetBitFromSelectionID(
component);
203 if ( CanAddBleedingSource(bit) )
205 AddBleedingSource(bit);
211 bool AttemptAddBleedingSourceBySelection(
string selection_name)
213 selection_name.ToLower();
214 int bit = GetBitFromSelectionName(selection_name);
221 if ( CanAddBleedingSource(bit) )
223 AddBleedingSource(bit);
232 if(CanAddBleedingSource(bit))
234 AddBleedingSourceEx(bit, type, context);
241 protected bool CanAddBleedingSource(
int bit)
243 if (!GetBleedingSourceMeta(bit))
247 if ((
m_Player.GetBleedingBits() & bit) == 0)
256 AddBleedingSource(bit);
257 m_BleedingSources.Get(bit).SetType(type);
260 protected void AddBleedingSource(
int bit)
263 vector orientation = bsz.GetOrientation();
264 vector offset = bsz.GetOffset();
265 string bone_name = bsz.GetBoneName();
266 float flow_modifier = bsz.GetFlowModifier();
267 int max_time = bsz.GetMaxTime();
268 string particle_name = bsz.GetParticleName();
269 int inventory_loc = bsz.GetInvLocation();
270 m_BleedingSourcesByLocation.Set(inventory_loc, (m_BleedingSourcesByLocation.Get(inventory_loc) | bit));
271 m_BleedingSources.Insert(bit,
new BleedingSource(
m_Player, bit,bone_name, orientation, offset, max_time, flow_modifier, particle_name) );
274 int GetBleedingSourceActiveTime(
int bit)
277 if (m_BleedingSources.Contains(bit))
279 time = m_BleedingSources.Get(bit).GetActiveTime();
284 void SetBleedingSourceActiveTime(
int bit,
int time)
286 if (m_BleedingSources.Contains(bit))
288 m_BleedingSources.Get(bit).SetActiveTime(time);
294 if (m_BleedingSources.Contains(bit))
296 m_BleedingSources.Get(bit).SetType(type);
301 if (m_BleedingSources.Contains(bit))
303 return m_BleedingSources.Get(bit).GetType();
308 protected bool RemoveBleedingSource(
int bit)
310 if (m_BleedingSources.Contains(bit))
313 int inventory_loc = bsz.GetInvLocation();
314 m_BleedingSourcesByLocation.Set(inventory_loc, (m_BleedingSourcesByLocation.Get(inventory_loc) & ~bit));
315 m_BleedingSources.Remove(bit);
321 int GetBleedingSourcesCount()
323 return m_BleedingSources.Count();