DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
BleedingSourcesManagerRemote.c
См. документацию.
1//this is instantiated on the client for both the controlled character, as well as the remote characters
2class BleedingSourcesManagerRemote extends BleedingSourcesManagerBase
3{
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 {
24 super.RegisterBleedingZoneEx(name,max_time,bone,orientation,offset,flow_modifier,particle_name,inv_location);
25
26 if (GetGame().GetMission().GetEffectWidgets()/* && m_Player.IsControlledPlayer()*/)
27 {
28 Param3<bool,int,float> par = new Param3<bool,int,float>(false,m_Bit,flow_modifier);
29 GetGame().GetMission().GetEffectWidgets().RegisterGameplayEffectData(EffectWidgetsTypes.BLEEDING_LAYER,par);
30 }
31 }
32
33 void OnVariablesSynchronized(int current_bits)
34 {
35 if (current_bits != m_BleedingBits)
36 {
37 if (m_BleedingBits == 0)
38 {
39 m_Player.OnBleedingBegin();
40 }
42 m_BleedingBits = current_bits;
43 if (m_BleedingBits == 0)
44 {
45 m_Player.OnBleedingEnd();
46 }
47 }
48 }
49
50 void Reload()
51 {
53 m_BitOffset = 0;
54 Init();
55 int bit_offset = 0;
56
57 for (int i = 0; i < BIT_INT_SIZE; i++)
58 {
59 int bit = 1 << bit_offset;
60 bit_offset++;
61 if ( (bit & m_BleedingBits) != 0 )
62 {
65 }
66 }
67 }
68
69
70 override protected void AddBleedingSource(int bit)
71 {
72 super.AddBleedingSource(bit);
73 if (GetGame().IsMultiplayer())
74 m_Player.OnBleedingSourceAdded();
75 }
76
77 override protected bool RemoveBleedingSource(int bit)
78 {
79 if (super.RemoveBleedingSource(bit))
80 {
81 if (GetGame().IsMultiplayer())
82 m_Player.OnBleedingSourceRemovedEx(m_Item);
83 return true;
84 }
85 return false;
86 }
87
88 void OnBleedingBitsUpdate(int old_mask, int new_mask)
89 {
90 for (int i = 0; i < 32; i++)
91 {
92 int compare_bit = 1 << i;
93 int new_compare_result_bit = compare_bit & new_mask;
94 int old_compare_result_bit = compare_bit & old_mask;
95
96 if ( new_compare_result_bit )
97 {
98 if ( !(new_compare_result_bit & old_mask))
99 {
100 //a different active bit in the new mask
101 AddBleedingSource(new_compare_result_bit);
102 }
103 }
104 else
105 {
106 if ( new_compare_result_bit != old_compare_result_bit )
107 {
108 RemoveBleedingSource(old_compare_result_bit);
109 }
110 }
111 }
112 }
113
115 {
116 int bleeding_source_count = 0;
117 int pow = 0;
118
119 for (int i = 0; i < BIT_INT_SIZE ; i++)
120 {
121 int bit = Math.Pow(2, pow);
122 pow++;
123 if ( (m_BleedingBits & bit) != 0)
124 {
125 bleeding_source_count++;
126 }
127 }
128
129 return bleeding_source_count;
130 }
131
132 void SetDiag(bool value)
133 {
134 m_ShowDiag = value;
135 return;
136
137 int boneIdx = m_Player.GetBoneIndexByName("RightArmExtra");
138
139 if ( boneIdx != -1 )
140 {
141 Object linkedObject = GetGame().CreateObject("Ammo_ArrowBolt", "0 0 0");
142
143 //linkedObject.SetPosition("0 1 0");
144 //linkedObject.SetOrientation("0 90 0");
145 /*
146
147 Set local space transform for linked object
148
149 */
150
152 eff.SetAutodestroy(true);
153 SEffectManager.PlayInWorld( eff, "0 0 0" );
154 Particle p = eff.GetParticle();
155 //p.SetOrientation("0 90 0");
156 m_Player.AddChild(p, boneIdx);
157
158 m_Player.AddChild(linkedObject, boneIdx);
159 }
160
161 }
162
163 void OnUpdate()
164 {
165 #ifndef NO_GUI
166 if (m_ShowDiag)
167 {
168 DisplayDebug();
170 }
171 else if ( m_ShowingDiag || m_ShowingDiagDraw )
172 {
173 if (m_ShowingDiag)
174 CleanDebug();
177 }
178 #endif
179 }
180
182 {
183 m_ShowingDiag = true;
184
186 DbgUI.Begin("Bleeding Sources", 50, 50);
187
188 int pow = 0;
189
190 bool anyBleedingSourceActive = false;
191
192 for (int i = 0; i < BIT_INT_SIZE ; i++)
193 {
194 int bit = Math.Pow(2, pow);
195 pow++;
196 if ( (m_BleedingBits & bit) != 0)
197 {
199
200 string name = GetSelectionNameFromBit(bit);
201 string slot_name = InventorySlots.GetSlotName(bsz.GetInvLocation());
202 DbgUI.Text(name + "| slot name: "+ slot_name);
203 anyBleedingSourceActive = true;
204 }
205 }
206
207 if (!anyBleedingSourceActive)
208 {
209 DbgUI.Text("Currently no bleeding sources are active.");
210 }
211
212 DbgUI.End();
214 }
215
217 {
218 m_ShowingDiag = false;
219
221 DbgUI.Begin("Bleeding Sources", 50, 50);
222 DbgUI.End();
224 }
225
227 {
228 /*
229 if(m_Point)
230 {
231 Debug.RemoveShape(m_Point);
232 }
233
234 int boneIdx = m_Player.GetBoneIndexByName("LeftKneeExtra");
235 int pointIdx = m_Player.GetMemoryPointIndex("lknee");
236
237 vector posLS = DayZPlayerUtils.GetMemoryPointPositionBoneRelative(m_Player, boneIdx, pointIdx);
238
239 vector pTm[4];
240 m_Player.GetBoneTransformMS(boneIdx, pTm);
241 vector posMS = posLS.Multiply4(pTm);
242
243 vector pos = m_Player.ModelToWorld(posMS);
244 m_Point = Debug.DrawSphere(pos, 0.1, COLOR_RED);
245 */
246
247 m_ShowingDiagDraw = true;
248
249 int bsCount = m_BleedingSources.Count();
250 for (int i = 0; i < bsCount; ++i)
251 {
252 m_BleedingSources.GetElement(i).DrawDebugShape();
253 }
254 }
255
257 {
258 m_ShowingDiagDraw = false;
259
260 int bsCount = m_BleedingSources.Count();
261 for (int i = 0; i < bsCount; ++i)
262 {
263 m_BleedingSources.GetElement(i).RemoveDebugShape();
264 }
265 }
266}
void BleedingSourceEffect()
Определения BleedingSource.c:12
const int BIT_INT_SIZE
Определения BitArray.c:4
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
int GetInvLocation()
Определения BleedingSourceZone.c:31
void OnVariablesSynchronized(int current_bits)
Определения BleedingSourcesManagerRemote.c:33
void AddBleedingSource(int bit)
Определения BleedingSourcesManagerBase.c:260
BleedingSourceZone GetBleedingSourceMeta(int bit)
Определения BleedingSourcesManagerBase.c:127
string GetSelectionNameFromBit(int bit)
Определения BleedingSourcesManagerBase.c:189
ref map< int, ref BleedingSource > m_BleedingSources
Определения BleedingSourcesManagerBase.c:3
bool RemoveBleedingSource(int bit)
Определения BleedingSourcesManagerBase.c:308
void SetDiag(bool value)
Определения BleedingSourcesManagerRemote.c:132
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)
Определения BleedingSourcesManagerRemote.c:22
ref map< string, ref BleedingSourceZone > m_BleedingSourceZone
Определения BleedingSourcesManagerBase.c:4
void OnBleedingBitsUpdate(int old_mask, int new_mask)
Определения BleedingSourcesManagerRemote.c:88
proto native Object CreateObject(string type, vector pos, bool create_local=false, bool init_ai=false, bool create_physics=true)
Creates object of certain type.
proto native Mission GetMission()
Определения DbgUI.c:60
Particle GetParticle()
Gets the main particle which this Effect is managing.
Определения EffectParticle.c:162
override void RegisterGameplayEffectData(int id, Param p)
Определения GameplayEffectWidgets.c:107
static proto native owned string GetSlotName(int id)
converts slot_id to string
provides access to slot configuration
Определения InventorySlots.c:6
Определения EnMath.c:7
GameplayEffectWidgets_base GetEffectWidgets()
Определения ObjectTyped.c:2
Определения EntityAI.c:95
Legacy way of using particles in the game.
Определения Particle.c:7
static int PlayInWorld(notnull Effect eff, vector pos)
Play an Effect.
Определения EffectManager.c:47
Manager class for managing Effect (EffectParticle, EffectSound)
Определения EffectManager.c:6
Определения EnConvert.c:106
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.