DayZ 1.24
Loading...
Searching...
No Matches
BleedingSourcesManagerBase Class Reference
Collaboration diagram for BleedingSourcesManagerBase:
[legend]

Protected Member Functions

void BleedingSourcesManagerBase (PlayerBase player)
 
void Init ()
 
void SetItem (ItemBase item)
 
set< intGetBleedingSourcesLocations ()
 
int GetBleedingSourceBitsByInvLocation (int inv_location)
 
int GetFreeBleedingSourceBitsByInvLocation (int inv_location)
 
bool IsBleedingSourceActive (string name)
 
int GetBitFromSelectionID (int id)
 
BleedingSourceZone GetBleedingSourceMeta (int bit)
 
int GetRegisteredSourcesCount ()
 
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 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")
 
void RemoveAllSources ()
 
int GetBitFromSelectionName (string name)
 
string GetSelectionNameFromBit (int bit)
 
bool AttemptAddBleedingSource (int component)
 
bool AttemptAddBleedingSourceBySelection (string selection_name)
 
bool AttemptAddBleedingSourceDirectly (int bit, eBleedingSourceType type=eBleedingSourceType.NORMAL, int context=0)
 
bool CanAddBleedingSource (int bit)
 
void AddBleedingSourceEx (int bit, eBleedingSourceType type=eBleedingSourceType.NORMAL, int context=0)
 
void AddBleedingSource (int bit)
 
int GetBleedingSourceActiveTime (int bit)
 
void SetBleedingSourceActiveTime (int bit, int time)
 
void SetBleedingSourceType (int bit, eBleedingSourceType type)
 
eBleedingSourceType GetBleedingSourceType (int bit)
 
bool RemoveBleedingSource (int bit)
 
int GetBleedingSourcesCount ()
 
void Init ()
 
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 OnVariablesSynchronized (int current_bits)
 
void Reload ()
 
void AddBleedingSource (int bit)
 
bool RemoveBleedingSource (int bit)
 
void OnBleedingBitsUpdate (int old_mask, int new_mask)
 
int GetBleedingSourceCountRemote ()
 
void SetDiag (bool value)
 
void OnUpdate ()
 
void DisplayDebug ()
 
void CleanDebug ()
 
void DisplayVisualDebug ()
 
void CleanVisualDebug ()
 
BleedingSourceZone GetBleedingSourceZone (int bit)
 
int GetStorageVersion ()
 
void RequestDeletion (int bit)
 
void AddBleedingSource (int bit)
 
bool RemoveBleedingSource (int bit)
 
void RemoveAnyBleedingSource ()
 
void RemoveMostSignificantBleedingSource ()
 
void RemoveMostSignificantBleedingSourceEx (ItemBase item)
 
int GetMostSignificantBleedingSource ()
 
void OnTick (float delta_time)
 
void ActivateAllBS ()
 
void ProcessHit (float damage, EntityAI source, int component, string zone, string ammo, vector modelPos)
 
void DebugActivateBleedingSource (int source)
 
void SetBloodLoss (bool status)
 
void OnStoreSave (ParamsWriteContext ctx)
 
bool OnStoreLoad (ParamsReadContext ctx, int version)
 
void ~BleedingSourcesManagerServer ()
 

Protected Attributes

int m_Bit
 
int m_BitOffset = 0
 

Private Attributes

ref map< int, ref BleedingSourcem_BleedingSources = new map<int, ref BleedingSource>
 
ref map< string, ref BleedingSourceZonem_BleedingSourceZone = new map<string, ref BleedingSourceZone>
 
ref map< int, intm_BleedingSourcesByLocation = new map<int, int>
 
ItemBase m_Item
 
PlayerBase m_Player
 
ref map< int, stringm_BitToFireGeom = new map<int, string>
 
int m_BleedingBits
 
bool m_ShowDiag
 
bool m_ShowingDiag
 
bool m_ShowingDiagDraw
 
Shape m_Point
 
bool m_EnableHitIndication = false
 
const float TICK_INTERVAL_SEC = 3
 
float m_Tick
 
bool m_DisableBloodLoss = false
 
ref array< intm_DeleteList = new array<int>
 
const int STORAGE_VERSION = 103
 

Static Private Attributes

static ref map< int, intm_BleedingSourcesZonesMaskByLocation = new map<int, int>
 
static ref set< intm_BleedingSourcesLocationsList = new set<int>
 

Detailed Description

Definition at line 1 of file BleedingSourcesManagerBase.c.

Constructor & Destructor Documentation

◆ BleedingSourcesManagerBase()

void BleedingSourcesManagerBase::BleedingSourcesManagerBase ( PlayerBase player)
inlineprotected

Definition at line 15 of file BleedingSourcesManagerBase.c.

References Init(), and m_Player.

◆ ~BleedingSourcesManagerServer()

void BleedingSourcesManagerBase::~BleedingSourcesManagerServer ( )
inlineprotected

Definition at line 257 of file BleedingSourcesManagerServer.c.

258 {
259 if (m_Player && !m_Player.IsAlive())
261 }

References m_Player.

Member Function Documentation

◆ ActivateAllBS()

void BleedingSourcesManagerBase::ActivateAllBS ( )
inlineprotected

Definition at line 135 of file BleedingSourcesManagerServer.c.

136 {
137 for (int i = 0; i < m_BleedingSourceZone.Count(); i++)
138 {
139 int bit = m_BleedingSourceZone.GetElement(i).GetBit();
142 }
143 }
ref map< string, ref BleedingSourceZone > m_BleedingSourceZone

◆ AddBleedingSource() [1/3]

void BleedingSourcesManagerBase::AddBleedingSource ( int bit)
inlineprotected

Definition at line 242 of file BleedingSourcesManagerBase.c.

243 {
245 vector orientation = bsz.GetOrientation();
246 vector offset = bsz.GetOffset();
247 string bone_name = bsz.GetBoneName();
248 float flow_modifier = bsz.GetFlowModifier();
249 int max_time = bsz.GetMaxTime();
250 string particle_name = bsz.GetParticleName();
251 int inventory_loc = bsz.GetInvLocation();
254 }
void BleedingSource(PlayerBase player, int bit, string bone, vector orientation, vector offset, int max_time, float flow_modifier, string particle_name)
BleedingSourceZone GetBleedingSourceMeta(int bit)
ref map< int, ref BleedingSource > m_BleedingSources
ref map< int, int > m_BleedingSourcesByLocation

References BleedingSource(), GetBleedingSourceMeta(), m_BleedingSources, m_BleedingSourcesByLocation, and m_Player.

Referenced by AddBleedingSourceEx(), AttemptAddBleedingSource(), and AttemptAddBleedingSourceBySelection().

◆ AddBleedingSource() [2/3]

void BleedingSourcesManagerBase::AddBleedingSource ( int bit)
inlineprotected

Definition at line 66 of file BleedingSourcesManagerRemote.c.

67 {
68 super.AddBleedingSource(bit);
69 if (GetGame().IsMultiplayer())
70 m_Player.OnBleedingSourceAdded();
71 }
proto native CGame GetGame()

References GetGame(), and m_Player.

◆ AddBleedingSource() [3/3]

void BleedingSourcesManagerBase::AddBleedingSource ( int bit)
inlineprotected

Definition at line 25 of file BleedingSourcesManagerServer.c.

26 {
27#ifdef DEVELOPER
28 if (m_Player && !m_Player.GetAllowDamage())//full invincibility prevents bleeding source creation
29 return;
30#endif
31
32 m_Player.SetBleedingBits(m_Player.GetBleedingBits() | bit);
33 super.AddBleedingSource(bit);
34 m_Player.OnBleedingSourceAdded();
35 }

References m_Player.

◆ AddBleedingSourceEx()

void BleedingSourcesManagerBase::AddBleedingSourceEx ( int bit,
eBleedingSourceType type = eBleedingSourceType.NORMAL,
int context = 0 )
inlineprotected

Definition at line 236 of file BleedingSourcesManagerBase.c.

237 {
239 m_BleedingSources.Get(bit).SetType(type);
240 }

References AddBleedingSource(), and m_BleedingSources.

Referenced by AttemptAddBleedingSourceDirectly().

◆ AttemptAddBleedingSource()

bool BleedingSourcesManagerBase::AttemptAddBleedingSource ( int component)
inlineprotected

Definition at line 184 of file BleedingSourcesManagerBase.c.

185 {
187
188 if (bit == 0)
189 return false;
190
192 {
194 return true;
195 }
196 return false;
197 }
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.

References AddBleedingSource(), CanAddBleedingSource(), component, and GetBitFromSelectionID().

◆ AttemptAddBleedingSourceBySelection()

bool BleedingSourcesManagerBase::AttemptAddBleedingSourceBySelection ( string selection_name)
inlineprotected

Definition at line 199 of file BleedingSourcesManagerBase.c.

200 {
201 selection_name.ToLower();
203
204 if (bit == 0)
205 return false;
206
208 {
210 return true;
211 }
212 return false;
213 }

References AddBleedingSource(), CanAddBleedingSource(), and GetBitFromSelectionName().

◆ AttemptAddBleedingSourceDirectly()

bool BleedingSourcesManagerBase::AttemptAddBleedingSourceDirectly ( int bit,
eBleedingSourceType type = eBleedingSourceType.NORMAL,
int context = 0 )
inlineprotected

Definition at line 216 of file BleedingSourcesManagerBase.c.

217 {
219 {
221 return true;
222 }
223 return false;
224 }
void AddBleedingSourceEx(int bit, eBleedingSourceType type=eBleedingSourceType.NORMAL, int context=0)

References AddBleedingSourceEx(), and CanAddBleedingSource().

◆ CanAddBleedingSource()

bool BleedingSourcesManagerBase::CanAddBleedingSource ( int bit)
inlineprotected

Definition at line 227 of file BleedingSourcesManagerBase.c.

228 {
230 return false;
231 if ((m_Player.GetBleedingBits() & bit) == 0)
232 return true;
233 return false;
234 }

References GetBleedingSourceMeta(), and m_Player.

Referenced by AttemptAddBleedingSource(), AttemptAddBleedingSourceBySelection(), and AttemptAddBleedingSourceDirectly().

◆ CleanDebug()

void BleedingSourcesManagerBase::CleanDebug ( )
inlineprotected

Definition at line 206 of file BleedingSourcesManagerRemote.c.

207 {
208 m_ShowingDiag = false;
209
211 DbgUI.Begin("Bleeding Sources", 50, 50);
212 DbgUI.End();
214 }
Definition DbgUI.c:60
static proto native void End()
static proto native void Begin(string windowTitle, float x=0, float y=0)
static proto void BeginCleanupScope()
static proto native void EndCleanupScope()

References DbgUI::Begin(), DbgUI::BeginCleanupScope(), DbgUI::End(), and DbgUI::EndCleanupScope().

◆ CleanVisualDebug()

void BleedingSourcesManagerBase::CleanVisualDebug ( )
inlineprotected

Definition at line 244 of file BleedingSourcesManagerRemote.c.

245 {
246 m_ShowingDiagDraw = false;
247
248 int bsCount = m_BleedingSources.Count();
249 for (int i = 0; i < bsCount; ++i)
250 m_BleedingSources.GetElement(i).RemoveDebugShape();
251 }

◆ DebugActivateBleedingSource()

void BleedingSourcesManagerBase::DebugActivateBleedingSource ( int source)
inlineprotected

Definition at line 185 of file BleedingSourcesManagerServer.c.

186 {
188
189 if (source >= m_BleedingSourceZone.Count() || !m_BleedingSourceZone.GetElement(source)) return;
190
191 int bit = m_BleedingSourceZone.GetElement(source).GetBit();
192
195 }

◆ DisplayDebug()

void BleedingSourcesManagerBase::DisplayDebug ( )
inlineprotected

Definition at line 173 of file BleedingSourcesManagerRemote.c.

174 {
175 m_ShowingDiag = true;
176
178 DbgUI.Begin("Bleeding Sources", 50, 50);
179
180 int pow = 0;
181
182 bool anyBleedingSourceActive = false;
183
184 for (int i = 0; i < BIT_INT_SIZE ; i++)
185 {
186 int bit = Math.Pow(2, pow);
187 pow++;
188 if ((m_BleedingBits & bit) != 0)
189 {
191
193 string slot_name = InventorySlots.GetSlotName(bsz.GetInvLocation());
194 DbgUI.Text(name + "| slot name: " + slot_name);
196 }
197 }
198
200 DbgUI.Text("Currently no bleeding sources are active.");
201
202 DbgUI.End();
204 }
const int BIT_INT_SIZE
Definition BitArray.c:4
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
provides access to slot configuration
static proto native owned string GetSlotName(int id)
converts slot_id to string
Definition EnMath.c:7
static proto native void Text(string label)
static proto float Pow(float v, float power)
Return power of v ^ power.

References DbgUI::Begin(), DbgUI::BeginCleanupScope(), BIT_INT_SIZE, DbgUI::End(), DbgUI::EndCleanupScope(), InventorySlots::GetSlotName(), name, Math::Pow(), and DbgUI::Text().

◆ DisplayVisualDebug()

void BleedingSourcesManagerBase::DisplayVisualDebug ( )
inlineprotected

Definition at line 216 of file BleedingSourcesManagerRemote.c.

217 {
218 /*
219 if(m_Point)
220 {
221 Debug.RemoveShape(m_Point);
222 }
223
224 int boneIdx = m_Player.GetBoneIndexByName("LeftKneeExtra");
225 int pointIdx = m_Player.GetMemoryPointIndex("lknee");
226
227 vector posLS = DayZPlayerUtils.GetMemoryPointPositionBoneRelative(m_Player, boneIdx, pointIdx);
228
229 vector pTm[4];
230 m_Player.GetBoneTransformMS(boneIdx, pTm);
231 vector posMS = posLS.Multiply4(pTm);
232
233 vector pos = m_Player.ModelToWorld(posMS);
234 m_Point = Debug.DrawSphere(pos, 0.1, COLOR_RED);
235 */
236
237 m_ShowingDiagDraw = true;
238
239 int bsCount = m_BleedingSources.Count();
240 for (int i = 0; i < bsCount; ++i)
241 m_BleedingSources.GetElement(i).DrawDebugShape();
242 }

◆ GetBitFromSelectionID()

int BleedingSourcesManagerBase::GetBitFromSelectionID ( int id)
inlineprotected

Definition at line 105 of file BleedingSourcesManagerBase.c.

106 {
108 m_Player.GetActionComponentNameList(id, CachedObjectsArrays.ARRAY_STRING, "fire");
109
110 for (int i = 0; i < CachedObjectsArrays.ARRAY_STRING.Count(); i++)
111 {
112 /*
113 string name = CachedObjectsArrays.ARRAY_STRING.Get(i);
114 PrintString(name);
115 */
117 if (bit != 0)
118 return bit;
119 }
120 return 0;
121 }
static ref TStringArray ARRAY_STRING

References CachedObjectsArrays::ARRAY_STRING, GetBitFromSelectionName(), and m_Player.

Referenced by AttemptAddBleedingSource().

◆ GetBitFromSelectionName()

int BleedingSourcesManagerBase::GetBitFromSelectionName ( string name)
inlineprotected

Definition at line 172 of file BleedingSourcesManagerBase.c.

173 {
174 if (!m_BleedingSourceZone.Get(name))
175 return 0;
176 return m_BleedingSourceZone.Get(name).GetBit();
177 }

References m_BleedingSourceZone, and name.

Referenced by AttemptAddBleedingSourceBySelection(), GetBitFromSelectionID(), and IsBleedingSourceActive().

◆ GetBleedingSourceActiveTime()

int BleedingSourcesManagerBase::GetBleedingSourceActiveTime ( int bit)
inlineprotected

Definition at line 256 of file BleedingSourcesManagerBase.c.

257 {
258 int time = -1;
259 if (m_BleedingSources.Contains(bit))
260 time = m_BleedingSources.Get(bit).GetActiveTime();
261 return time;
262 }

References m_BleedingSources.

◆ GetBleedingSourceBitsByInvLocation()

int BleedingSourcesManagerBase::GetBleedingSourceBitsByInvLocation ( int inv_location)
inlineprotected

Definition at line 77 of file BleedingSourcesManagerBase.c.

78 {
81
82 return 0;
83 }

References m_BleedingSourcesByLocation.

Referenced by GetFreeBleedingSourceBitsByInvLocation().

◆ GetBleedingSourceCountRemote()

int BleedingSourcesManagerBase::GetBleedingSourceCountRemote ( )
inlineprotected

Definition at line 108 of file BleedingSourcesManagerRemote.c.

109 {
110 int bleeding_source_count = 0;
111 int pow = 0;
112
113 for (int i = 0; i < BIT_INT_SIZE ; i++)
114 {
115 int bit = Math.Pow(2, pow);
116 pow++;
117 if ((m_BleedingBits & bit) != 0)
119 }
120
122 }

References BIT_INT_SIZE, and Math::Pow().

◆ GetBleedingSourceMeta()

BleedingSourceZone BleedingSourcesManagerBase::GetBleedingSourceMeta ( int bit)
inlineprotected

◆ GetBleedingSourcesCount()

int BleedingSourcesManagerBase::GetBleedingSourcesCount ( )
inlineprotected

Definition at line 295 of file BleedingSourcesManagerBase.c.

296 {
297 return m_BleedingSources.Count();
298 }

References m_BleedingSources.

◆ GetBleedingSourcesLocations()

set< int > BleedingSourcesManagerBase::GetBleedingSourcesLocations ( )
inlineprotected

Definition at line 70 of file BleedingSourcesManagerBase.c.

71 {
73 }
static ref set< int > m_BleedingSourcesLocationsList

References m_BleedingSourcesLocationsList.

◆ GetBleedingSourceType()

eBleedingSourceType BleedingSourcesManagerBase::GetBleedingSourceType ( int bit)
inlineprotected

Definition at line 275 of file BleedingSourcesManagerBase.c.

276 {
277 if (m_BleedingSources.Contains(bit))
278 return m_BleedingSources.Get(bit).GetType();
279 return -1;
280 }

References m_BleedingSources.

◆ GetBleedingSourceZone()

BleedingSourceZone BleedingSourcesManagerBase::GetBleedingSourceZone ( int bit)
inlineprotected

Definition at line 10 of file BleedingSourcesManagerServer.c.

11 {
13 }

◆ GetFreeBleedingSourceBitsByInvLocation()

int BleedingSourcesManagerBase::GetFreeBleedingSourceBitsByInvLocation ( int inv_location)
inlineprotected

Definition at line 86 of file BleedingSourcesManagerBase.c.

87 {
89 {
91 }
92
93 return 0;
94 }
int GetBleedingSourceBitsByInvLocation(int inv_location)
static ref map< int, int > m_BleedingSourcesZonesMaskByLocation

References GetBleedingSourceBitsByInvLocation(), and m_BleedingSourcesZonesMaskByLocation.

◆ GetMostSignificantBleedingSource()

int BleedingSourcesManagerBase::GetMostSignificantBleedingSource ( )
inlineprotected

Definition at line 85 of file BleedingSourcesManagerServer.c.

86 {
87 int bleeding_sources_bits = m_Player.GetBleedingBits();
88
89 float highest_flow;
91 int bit_offset;
92
93 for (int i = 0; i < BIT_INT_SIZE; i++)
94 {
95 int bit = 1 << bit_offset;
96
97 if ((bit & bleeding_sources_bits) != 0)
98 {
100 if (meta)
101 {
102 if (meta.GetFlowModifier() > highest_flow)
103 {
104 highest_flow = meta.GetFlowModifier();
106 //Print(meta.GetSelectionName());
107 }
108 }
109 }
110 bit_offset++;
111 }
112 return highest_flow_bit;
113 }

References BIT_INT_SIZE, and m_Player.

◆ GetRegisteredSourcesCount()

int BleedingSourcesManagerBase::GetRegisteredSourcesCount ( )
inlineprotected

Definition at line 128 of file BleedingSourcesManagerBase.c.

References m_BitOffset.

◆ GetSelectionNameFromBit()

string BleedingSourcesManagerBase::GetSelectionNameFromBit ( int bit)
inlineprotected

Definition at line 179 of file BleedingSourcesManagerBase.c.

180 {
181 return m_BitToFireGeom.Get(bit);
182 }

References m_BitToFireGeom.

Referenced by GetBleedingSourceMeta().

◆ GetStorageVersion()

int BleedingSourcesManagerBase::GetStorageVersion ( )
inlineprotected

Definition at line 15 of file BleedingSourcesManagerServer.c.

16 {
17 return STORAGE_VERSION;
18 }

References STORAGE_VERSION.

◆ Init() [1/2]

void BleedingSourcesManagerBase::Init ( )
inlineprotected

Definition at line 21 of file BleedingSourcesManagerBase.c.

22 {
23 //dmgZone_head
25 //dmgZone_torso
26 RegisterBleedingZoneEx("Neck", PlayerConstants.BLEEDING_SOURCE_DURATION_NORMAL, "", "-180 0 0", "0.02 -0.05 0.05", PlayerConstants.BLEEDING_SOURCE_FLOW_MODIFIER_HIGH, "BleedingSourceEffect", InventorySlots.HEADGEAR);
32 //dmgZone_leftArm
37 //dmgZone_rightArm
42 //dmgZone_leftHand
43 RegisterBleedingZoneEx("LeftForeArmRoll", PlayerConstants.BLEEDING_SOURCE_DURATION_NORMAL, "", "0 90 0", "0.1 0 0", PlayerConstants.BLEEDING_SOURCE_FLOW_MODIFIER_LOW, "BleedingSourceEffectLight", InventorySlots.GLOVES);
44 //dmgZone_rightHand
45 RegisterBleedingZoneEx("RightForeArmRoll", PlayerConstants.BLEEDING_SOURCE_DURATION_NORMAL, "", "0 90 0", "-0.1 0 0", PlayerConstants.BLEEDING_SOURCE_FLOW_MODIFIER_LOW, "BleedingSourceEffectLight", InventorySlots.GLOVES);
46 //dmgZone_leftLeg
51 //dmgZone_rightLeg
56 //dmgZone_leftFoot
57 RegisterBleedingZoneEx("LeftFoot", PlayerConstants.BLEEDING_SOURCE_DURATION_NORMAL, "", "0 180 0", "0 0 0.035", PlayerConstants.BLEEDING_SOURCE_FLOW_MODIFIER_LOW, "BleedingSourceEffectLight", InventorySlots.LEGS);
59 //dmgZone_rightFoot
60 RegisterBleedingZoneEx("RightFoot", PlayerConstants.BLEEDING_SOURCE_DURATION_NORMAL, "", "0 0 0", "0 0 -0.035", PlayerConstants.BLEEDING_SOURCE_FLOW_MODIFIER_LOW, "BleedingSourceEffectLight", InventorySlots.LEGS);
62 }
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)
static const float BLEEDING_SOURCE_FLOW_MODIFIER_LOW
static const float BLEEDING_SOURCE_FLOW_MODIFIER_HIGH
static const float BLEEDING_SOURCE_FLOW_MODIFIER_MEDIUM
static const int BLEEDING_SOURCE_DURATION_NORMAL

References PlayerConstants::BLEEDING_SOURCE_DURATION_NORMAL, PlayerConstants::BLEEDING_SOURCE_FLOW_MODIFIER_HIGH, PlayerConstants::BLEEDING_SOURCE_FLOW_MODIFIER_LOW, PlayerConstants::BLEEDING_SOURCE_FLOW_MODIFIER_MEDIUM, and RegisterBleedingZoneEx().

Referenced by BleedingSourcesManagerBase().

◆ Init() [2/2]

void BleedingSourcesManagerBase::Init ( )
inlineprotected

Definition at line 11 of file BleedingSourcesManagerRemote.c.

12 {
13 super.Init();
14
15 if (GetGame().GetMission().GetEffectWidgets()/* && m_Player.IsControlledPlayer()*/)
16 {
18 GetGame().GetMission().GetEffectWidgets().RegisterGameplayEffectData(EffectWidgetsTypes.BLEEDING_LAYER, par);
19 }
20 }

References GetGame().

◆ IsBleedingSourceActive()

bool BleedingSourcesManagerBase::IsBleedingSourceActive ( string name)
inlineprotected

Definition at line 96 of file BleedingSourcesManagerBase.c.

97 {
98 name.ToLower();
100
101 return m_Player.GetBleedingBits() & bit;
102 }

References GetBitFromSelectionName(), m_Player, and name.

◆ OnBleedingBitsUpdate()

void BleedingSourcesManagerBase::OnBleedingBitsUpdate ( int old_mask,
int new_mask )
inlineprotected

Definition at line 84 of file BleedingSourcesManagerRemote.c.

85 {
86 for (int i = 0; i < 32; i++)
87 {
88 int compare_bit = 1 << i;
91
93 {
95 {
96 //a different active bit in the new mask
98 }
99 }
100 else
101 {
104 }
105 }
106 }

◆ OnStoreLoad()

bool BleedingSourcesManagerBase::OnStoreLoad ( ParamsReadContext ctx,
int version )
inlineprotected

Definition at line 224 of file BleedingSourcesManagerServer.c.

225 {
226 int active_bits;
227 if (!ctx.Read(active_bits))
228 return false;
229
230 int bit_offset = 0;
231 for (int i = 0; i < BIT_INT_SIZE; i++)
232 {
233 int bit = 1 << bit_offset;
234 if ((bit & active_bits) != 0 && CanAddBleedingSource(bit))
235 {
237 int active_time = 0;
238 if (!ctx.Read(active_time))
239 return false;
240 else
242 if (version >= 121) //type was added in this version
243 {
245 if (!ctx.Read(type))
246 return false;
247 else
249 }
250 }
251 bit_offset++;
252 }
253 return true;
254 }
eBleedingSourceType
void SetBleedingSourceActiveTime(int bit, int time)
void SetBleedingSourceType(int bit, eBleedingSourceType type)

References BIT_INT_SIZE.

◆ OnStoreSave()

void BleedingSourcesManagerBase::OnStoreSave ( ParamsWriteContext ctx)
inlineprotected

Definition at line 202 of file BleedingSourcesManagerServer.c.

203 {
204 //int count = m_BleedingSources.Count();
205 int active_bits = m_Player.GetBleedingBits();
206 ctx.Write(active_bits);
207
208 int bit_offset = 0;
209 for (int i = 0; i < BIT_INT_SIZE; i++)
210 {
211 int bit = 1 << bit_offset;
212 if ((bit & active_bits) != 0)
213 {
216
217 ctx.Write(active_time);
218 ctx.Write(type);
219 }
220 bit_offset++;
221 }
222 }
eBleedingSourceType GetBleedingSourceType(int bit)

References BIT_INT_SIZE, and m_Player.

◆ OnTick()

void BleedingSourcesManagerBase::OnTick ( float delta_time)
inlineprotected

Definition at line 115 of file BleedingSourcesManagerServer.c.

116 {
119 {
120 while (m_DeleteList.Count() > 0)
121 {
123 m_DeleteList.Remove(0);
124 }
125
128
129 for (int i = 0; i < m_BleedingSources.Count(); i++)
130 m_BleedingSources.GetElement(i).OnUpdateServer(m_Tick, blood_scale, m_DisableBloodLoss);
131 m_Tick = 0;
132 }
133 }
static const float BLEEDING_LOW_PRESSURE_MIN_MOD
static const float BLEEDING_LOW_PRESSURE_BLOOD
static const int BLOOD_THRESHOLD_FATAL
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'.
static proto float InverseLerp(float a, float b, float value)
Calculates the linear value that produces the interpolant value within the range [a,...

References PlayerConstants::BLEEDING_LOW_PRESSURE_BLOOD, PlayerConstants::BLEEDING_LOW_PRESSURE_MIN_MOD, PlayerConstants::BLOOD_THRESHOLD_FATAL, Math::Clamp(), Math::InverseLerp(), m_Player, and m_Tick.

◆ OnUpdate()

void BleedingSourcesManagerBase::OnUpdate ( )
inlineprotected

◆ OnVariablesSynchronized()

void BleedingSourcesManagerBase::OnVariablesSynchronized ( int current_bits)
inlineprotected

Definition at line 33 of file BleedingSourcesManagerRemote.c.

34 {
36 {
37 if (m_BleedingBits == 0)
38 m_Player.OnBleedingBegin();
41 if (m_BleedingBits == 0)
42 m_Player.OnBleedingEnd();
43 }
44 }
void OnBleedingBitsUpdate(int old_mask, int new_mask)

References m_Player.

◆ ProcessHit()

void BleedingSourcesManagerBase::ProcessHit ( float damage,
EntityAI source,
int component,
string zone,
string ammo,
vector modelPos )
inlineprotected

Definition at line 146 of file BleedingSourcesManagerServer.c.

147 {
148 float dmg_max = m_Player.GetMaxHealth(zone, "Blood");
149 float bleed_threshold = GetGame().ConfigGetFloat("CfgAmmo " + ammo + " DamageApplied bleedThreshold");
150 string damageTypeString = GetGame().ConfigGetTextOut("CfgAmmo " + ammo + " DamageApplied type");
152 float bleedingChance;
153 bool createBleedingSource = false;
154
155 // 'true' only when the damageTypeString is handled there
157 {
158 float roll = Math.RandomFloat01();
160
161#ifdef DEVELOPER
163 Debug.BleedingChancesLog(roll.ToString(), "BleedingSourcesManagerServer", "n/a", "bleeding random roll:");
164#endif
165 }
166 else if (source && source.IsZombie())
167 {
168 int chance = Math.RandomInt(0, 100);
169 if (chance <= damage)
171 }
172 else if (damage > (dmg_max * (1 - bleed_threshold)))
174
176 {
177#ifdef DEVELOPER
179 Debug.BleedingChancesLog("true", "BleedingSourcesManagerServer", "n/a", "Attempting to create bleeding source");
180#endif
182 }
183 }
Static data of bleeding chance probabilities; currently used for melee only.
static bool CalculateBleedChance(string damageType, float bloodDamage, float bleedThreshold, out float bleedChance)
returns 'false' when damageType is unhandled
Definition Debug.c:14
static void BleedingChancesLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Definition Debug.c:213
static bool IsBleedingChancesLogEnable()
Definition Debug.c:814
static float RandomFloat01()
Returns a random float number between and min [inclusive] and max [inclusive].
Definition EnMath.c:126
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].

References Debug::BleedingChancesLog(), BleedChanceData::CalculateBleedChance(), Math::Clamp(), component, GetGame(), LogManager::IsBleedingChancesLogEnable(), m_Player, Math::RandomFloat01(), and Math::RandomInt().

◆ RegisterBleedingZone()

void BleedingSourcesManagerBase::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" )
inlineprotected

◆ RegisterBleedingZoneEx() [1/2]

void BleedingSourcesManagerBase::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 )
inlineprotected

Definition at line 133 of file BleedingSourcesManagerBase.c.

134 {
136 Error("Too many bleeding sources, max is " + BIT_INT_SIZE.ToString());
137 else
138 {
139 name.ToLower();
140 //PrintString(name);
141 //int bit = Math.Pow(2, m_BitOffset);
142 m_Bit = 1 << m_BitOffset;
143 //PrintString(bit.ToString());
144 string bone_name = bone;
145
146 if (bone_name == "")
147 bone_name = name;
148
150 m_BleedingSourceZone.Get(name).SetInvLocation(inv_location);
151 m_BitToFireGeom.Insert(m_Bit, name);
152 m_BleedingSourcesZonesMaskByLocation.Set(inv_location, m_BleedingSourcesZonesMaskByLocation.Get(inv_location) | m_Bit); //set a bit to 1 to already existing bitmask for that location
154 m_BitOffset++;
155 }
156 }
void Error(string err)
Messagebox with error message.
Definition EnDebug.c:90

References BIT_INT_SIZE, Error(), m_Bit, m_BitOffset, m_BitToFireGeom, m_BleedingSourcesLocationsList, m_BleedingSourcesZonesMaskByLocation, m_BleedingSourceZone, and name.

Referenced by Init(), and RegisterBleedingZone().

◆ RegisterBleedingZoneEx() [2/2]

void BleedingSourcesManagerBase::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 )
inlineprotected

Definition at line 22 of file BleedingSourcesManagerRemote.c.

23 {
25
26 if (GetGame().GetMission().GetEffectWidgets()/* && m_Player.IsControlledPlayer()*/)
27 {
29 GetGame().GetMission().GetEffectWidgets().RegisterGameplayEffectData(EffectWidgetsTypes.BLEEDING_LAYER, par);
30 }
31 }

References GetGame(), m_Bit, and name.

◆ Reload()

void BleedingSourcesManagerBase::Reload ( )
inlineprotected

Definition at line 46 of file BleedingSourcesManagerRemote.c.

47 {
49 m_BitOffset = 0;
50 Init();
51 int bit_offset = 0;
52
53 for (int i = 0; i < BIT_INT_SIZE; i++)
54 {
55 int bit = 1 << bit_offset;
56 bit_offset++;
57 if ((bit & m_BleedingBits) != 0)
58 {
61 }
62 }
63 }

References BIT_INT_SIZE, and Init().

◆ RemoveAllSources()

void BleedingSourcesManagerBase::RemoveAllSources ( )
inlineprotected

Definition at line 162 of file BleedingSourcesManagerBase.c.

163 {
164 //int count = m_BleedingSources.Count();
165 while (m_BleedingSources.Count() > 0)
166 {
167 int bit = m_BleedingSources.GetKey(0);
169 }
170 }

References m_BleedingSources, and RemoveBleedingSource().

◆ RemoveAnyBleedingSource()

void BleedingSourcesManagerBase::RemoveAnyBleedingSource ( )
inlineprotected

Definition at line 64 of file BleedingSourcesManagerServer.c.

References m_Player.

◆ RemoveBleedingSource() [1/3]

bool BleedingSourcesManagerBase::RemoveBleedingSource ( int bit)
inlineprotected

Definition at line 282 of file BleedingSourcesManagerBase.c.

283 {
284 if (m_BleedingSources.Contains(bit))
285 {
287 int inventory_loc = bsz.GetInvLocation();
289 m_BleedingSources.Remove(bit);
290 return true;
291 }
292 return false;
293 }

References GetBleedingSourceMeta(), m_BleedingSources, and m_BleedingSourcesByLocation.

Referenced by RemoveAllSources().

◆ RemoveBleedingSource() [2/3]

bool BleedingSourcesManagerBase::RemoveBleedingSource ( int bit)
inlineprotected

Definition at line 73 of file BleedingSourcesManagerRemote.c.

74 {
75 if (super.RemoveBleedingSource(bit))
76 {
77 if (GetGame().IsMultiplayer())
78 m_Player.OnBleedingSourceRemovedEx(m_Item);
79 return true;
80 }
81 return false;
82 }

References GetGame(), m_Item, and m_Player.

◆ RemoveBleedingSource() [3/3]

bool BleedingSourcesManagerBase::RemoveBleedingSource ( int bit)
inlineprotected

Definition at line 37 of file BleedingSourcesManagerServer.c.

38 {
39 if (!super.RemoveBleedingSource(bit))
40 Error("Failed to remove bleeding source:" + bit);
41 else
42 m_Player.OnBleedingSourceRemovedEx(m_Item);
43
45 m_Player.SetBleedingBits(m_Player.GetBleedingBits() & inverse_bit_mask);
46
47
48 //infection moved here to allow proper working in singleplayer
49 float chanceToInfect;
50
51 if (m_Item)
53 else
55 float diceRoll = Math.RandomFloat01();
57 m_Player.InsertAgent(eAgents.WOUND_AGENT);
58
59 m_Item = null;//reset, so that next call, if induced by self-healing, will have no item
60
61 return true;
62 }
eAgents
Definition EAgents.c:3
static ref Param1< bool > PARAM1_BOOL
override float GetInfectionChance(int system=0, Param param=null)
static const float BLEEDING_SOURCE_CLOSE_INFECTION_CHANCE

References PlayerConstants::BLEEDING_SOURCE_CLOSE_INFECTION_CHANCE, Error(), ItemBase::GetInfectionChance(), m_Item, m_Player, CachedObjectsParams::PARAM1_BOOL, and Math::RandomFloat01().

◆ RemoveMostSignificantBleedingSource()

void BleedingSourcesManagerBase::RemoveMostSignificantBleedingSource ( )
inlineprotected

Definition at line 72 of file BleedingSourcesManagerServer.c.

◆ RemoveMostSignificantBleedingSourceEx()

void BleedingSourcesManagerBase::RemoveMostSignificantBleedingSourceEx ( ItemBase item)
inlineprotected

◆ RequestDeletion()

void BleedingSourcesManagerBase::RequestDeletion ( int bit)
inlineprotected

Definition at line 20 of file BleedingSourcesManagerServer.c.

21 {
22 m_DeleteList.Insert(bit);
23 }

◆ SetBleedingSourceActiveTime()

void BleedingSourcesManagerBase::SetBleedingSourceActiveTime ( int bit,
int time )
inlineprotected

Definition at line 264 of file BleedingSourcesManagerBase.c.

265 {
266 if (m_BleedingSources.Contains(bit))
267 m_BleedingSources.Get(bit).SetActiveTime(time);
268 }

References m_BleedingSources.

◆ SetBleedingSourceType()

void BleedingSourcesManagerBase::SetBleedingSourceType ( int bit,
eBleedingSourceType type )
inlineprotected

Definition at line 270 of file BleedingSourcesManagerBase.c.

271 {
272 if (m_BleedingSources.Contains(bit))
273 m_BleedingSources.Get(bit).SetType(type);
274 }

References m_BleedingSources.

◆ SetBloodLoss()

void BleedingSourcesManagerBase::SetBloodLoss ( bool status)
inlineprotected

Definition at line 197 of file BleedingSourcesManagerServer.c.

198 {
200 }

◆ SetDiag()

void BleedingSourcesManagerBase::SetDiag ( bool value)
inlineprotected

Definition at line 124 of file BleedingSourcesManagerRemote.c.

125 {
127 return;
128
129 int boneIdx = m_Player.GetBoneIndexByName("RightArmExtra");
130
131 if (boneIdx != -1)
132 {
133 Object linkedObject = GetGame().CreateObject("Ammo_ArrowBolt", "0 0 0");
134
135 //linkedObject.SetPosition("0 1 0");
136 //linkedObject.SetOrientation("0 90 0");
137 /*
138
139 Set local space transform for linked object
140
141 */
142
144 eff.SetAutodestroy(true);
146 Particle p = eff.GetParticle();
147 //p.SetOrientation("0 90 0");
148 m_Player.AddChild(p, boneIdx);
149
150 m_Player.AddChild(linkedObject, boneIdx);
151 }
152
153 }
void BleedingSourceEffect()
Legacy way of using particles in the game.
Definition Particle.c:7
Manager class for managing Effect (EffectParticle, EffectSound)
static int PlayInWorld(notnull Effect eff, vector pos)
Play an Effect.

References BleedingSourceEffect(), GetGame(), m_Player, and SEffectManager::PlayInWorld().

◆ SetItem()

void BleedingSourcesManagerBase::SetItem ( ItemBase item)
inlineprotected

Definition at line 64 of file BleedingSourcesManagerBase.c.

65 {
66 m_Item = item;
67 }

References m_Item.

Member Data Documentation

◆ m_Bit

int BleedingSourcesManagerBase::m_Bit
protected

Definition at line 12 of file BleedingSourcesManagerBase.c.

Referenced by RegisterBleedingZoneEx().

◆ m_BitOffset

int BleedingSourcesManagerBase::m_BitOffset = 0
protected

◆ m_BitToFireGeom

ref map<int, string> BleedingSourcesManagerBase::m_BitToFireGeom = new map<int, string>
private

Definition at line 11 of file BleedingSourcesManagerBase.c.

Referenced by GetSelectionNameFromBit(), and RegisterBleedingZoneEx().

◆ m_BleedingBits

int BleedingSourcesManagerBase::m_BleedingBits
private

Definition at line 4 of file BleedingSourcesManagerRemote.c.

◆ m_BleedingSources

◆ m_BleedingSourcesByLocation

ref map<int, int> BleedingSourcesManagerBase::m_BleedingSourcesByLocation = new map<int, int>
private

◆ m_BleedingSourcesLocationsList

ref set<int> BleedingSourcesManagerBase::m_BleedingSourcesLocationsList = new set<int>
staticprivate

◆ m_BleedingSourcesZonesMaskByLocation

ref map<int, int> BleedingSourcesManagerBase::m_BleedingSourcesZonesMaskByLocation = new map<int, int>
staticprivate

◆ m_BleedingSourceZone

ref map<string, ref BleedingSourceZone> BleedingSourcesManagerBase::m_BleedingSourceZone = new map<string, ref BleedingSourceZone>
private

◆ m_DeleteList

ref array<int> BleedingSourcesManagerBase::m_DeleteList = new array<int>
private

Definition at line 6 of file BleedingSourcesManagerServer.c.

◆ m_DisableBloodLoss

bool BleedingSourcesManagerBase::m_DisableBloodLoss = false
private

Definition at line 5 of file BleedingSourcesManagerServer.c.

◆ m_EnableHitIndication

bool BleedingSourcesManagerBase::m_EnableHitIndication = false
private

Definition at line 9 of file BleedingSourcesManagerRemote.c.

◆ m_Item

ItemBase BleedingSourcesManagerBase::m_Item
private

Definition at line 8 of file BleedingSourcesManagerBase.c.

Referenced by SetItem().

◆ m_Player

PlayerBase BleedingSourcesManagerBase::m_Player
private

◆ m_Point

Shape BleedingSourcesManagerBase::m_Point
private

Definition at line 8 of file BleedingSourcesManagerRemote.c.

◆ m_ShowDiag

bool BleedingSourcesManagerBase::m_ShowDiag
private

Definition at line 5 of file BleedingSourcesManagerRemote.c.

◆ m_ShowingDiag

bool BleedingSourcesManagerBase::m_ShowingDiag
private

Definition at line 6 of file BleedingSourcesManagerRemote.c.

◆ m_ShowingDiagDraw

bool BleedingSourcesManagerBase::m_ShowingDiagDraw
private

Definition at line 7 of file BleedingSourcesManagerRemote.c.

◆ m_Tick

float BleedingSourcesManagerBase::m_Tick
private

Definition at line 4 of file BleedingSourcesManagerServer.c.

◆ STORAGE_VERSION

const int BleedingSourcesManagerBase::STORAGE_VERSION = 103
private

Definition at line 8 of file BleedingSourcesManagerServer.c.

◆ TICK_INTERVAL_SEC

const float BleedingSourcesManagerBase::TICK_INTERVAL_SEC = 3
private

Definition at line 3 of file BleedingSourcesManagerServer.c.


The documentation for this class was generated from the following files: