DayZ 1.24
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
3{
9 bool m_EnableHitIndication = false;
10
11 override protected void Init()
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 }
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 {
25
26 if (GetGame().GetMission().GetEffectWidgets()/* && m_Player.IsControlledPlayer()*/)
27 {
29 GetGame().GetMission().GetEffectWidgets().RegisterGameplayEffectData(EffectWidgetsTypes.BLEEDING_LAYER, par);
30 }
31 }
32
34 {
35 if (current_bits != m_BleedingBits)
36 {
37 if (m_BleedingBits == 0)
38 m_Player.OnBleedingBegin();
39 OnBleedingBitsUpdate(m_BleedingBits, current_bits);
40 m_BleedingBits = current_bits;
41 if (m_BleedingBits == 0)
42 m_Player.OnBleedingEnd();
43 }
44 }
45
46 void Reload()
47 {
48 m_BleedingSourceZone.Clear();
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 {
59 RemoveBleedingSource(bit);
60 AddBleedingSource(bit);
61 }
62 }
63 }
64
65
66 override protected void AddBleedingSource(int bit)
67 {
68 super.AddBleedingSource(bit);
69 if (GetGame().IsMultiplayer())
70 m_Player.OnBleedingSourceAdded();
71 }
72
73 override protected bool RemoveBleedingSource(int bit)
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 }
83
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
97 AddBleedingSource(new_compare_result_bit);
98 }
99 }
100 else
101 {
103 RemoveBleedingSource(old_compare_result_bit);
104 }
105 }
106 }
107
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 }
123
124 void SetDiag(bool value)
125 {
126 m_ShowDiag = value;
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 }
154
155 void OnUpdate()
156 {
157#ifndef NO_GUI
158 if (m_ShowDiag)
159 {
160 DisplayDebug();
161 DisplayVisualDebug();
162 }
163 else if (m_ShowingDiag || m_ShowingDiagDraw)
164 {
165 if (m_ShowingDiag)
166 CleanDebug();
167 if (m_ShowingDiagDraw)
168 CleanVisualDebug();
169 }
170#endif
171 }
172
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 {
190 BleedingSourceZone bsz = GetBleedingSourceMeta(bit);
191
192 string name = GetSelectionNameFromBit(bit);
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 }
205
207 {
208 m_ShowingDiag = false;
209
211 DbgUI.Begin("Bleeding Sources", 50, 50);
212 DbgUI.End();
214 }
215
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 }
243
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 }
252}
void BleedingSourceEffect()
int m_Bit
ItemBase m_Item
Definition ActionInput.c:16
const int BIT_INT_SIZE
Definition BitArray.c:4
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
override Widget Init()
Definition DayZGame.c:120
DayZPlayer m_Player
Definition Hand_Events.c:42
void OnVariablesSynchronized(int current_bits)
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)
Definition DbgUI.c:60
provides access to slot configuration
static proto native owned string GetSlotName(int id)
converts slot_id to string
Definition EnMath.c:7
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.
proto native CGame GetGame()
static proto native void End()
static proto native void Begin(string windowTitle, float x=0, float y=0)
static proto native void Text(string label)
static proto void BeginCleanupScope()
static proto native void EndCleanupScope()
class DiagMenu Shape
don't call destructor directly. Use Destroy() instead
static proto float Pow(float v, float power)
Return power of v ^ power.