DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ Start()

override void GetLowerSoundsetVariant::Start ( )
protected

См. определение в файле DustEffectCeilingHandler.c строка 183

184{
185 protected static int RANGE_MIN_DEFAULT = 4;
186 protected static int RANGE_MAX_DEFAULT = 8;
187 protected static float FLOOR_THICKNESS_DEFAULT = 0.4;
188
189 protected EntityAI m_Owner;
190 protected int m_StepCounter;
191 protected int m_NextEffectStepIdx;
192
194 {
195 m_Owner = owner;
196 m_StepCounter = 0;
197 }
198
199 protected void CalculateNextEffect(string surfaceType, int particleID)
200 {
201 int rangeMin = RANGE_MIN_DEFAULT;
202 int rangeMax = RANGE_MAX_DEFAULT;
203 DustEffectManager.AdjustCeilingDustEffectFrequency(surfaceType, particleID, rangeMin, rangeMax);
204 m_NextEffectStepIdx = Math.RandomIntInclusive(rangeMin,rangeMax);
205 }
206
207 void OnStepUpdate(SurfaceInfo surfaceInfo, string boneName = "")
208 {
209 int ceilingParticleID = surfaceInfo.GetCeilingDustParticleId();
210 if (ceilingParticleID <= 0)
211 return;
212
214
216 {
217 vector pos = GetBonePosition(boneName);
218 AdjustBySurfaceThickness(pos, surfaceInfo);
219 CreateEffects(ceilingParticleID, pos);
220 m_StepCounter = 0;
221 CalculateNextEffect(surfaceInfo.GetSurfaceType(), ceilingParticleID);
222 }
223 }
224
225 protected vector GetBonePosition(string boneName)
226 {
227 DayZCreature creature;
228 DayZPlayerImplement player;
229
230 vector ownerPos = m_Owner.GetPosition();
231 if (boneName == "")
232 return ownerPos;
233
234 int boneIdx = -1;
235 if (Class.CastTo(creature, m_Owner))
236 boneIdx = creature.GetBoneIndexByName(boneName);
237 if (Class.CastTo(player, m_Owner))
238 boneIdx = player.GetBoneIndexByName(boneName);
239
240 if (boneIdx == -1)
241 return ownerPos;
242
243 vector bonePos = m_Owner.GetBonePositionWS(boneIdx);
244 bonePos[1] = ownerPos[1]; //equalize Y to allow for consistent height adjustment later
245 return bonePos;
246 }
247
248 protected void AdjustBySurfaceThickness(inout vector pos, SurfaceInfo surfaceInfo)
249 {
250 float thicc = surfaceInfo.GetThickness(); //returns '-1' if not defined, for reasons
251 if (thicc < 0)
253 pos[1] = pos[1] - thicc;
254 }
255
256 protected void CreateEffects(int ceilingParticleID, vector position);
257}
258
259class DustEffectCeilingHandlerLocal : DustEffectCeilingHandlerBase
260{
261 override protected void CreateEffects(int ceilingParticleID, vector position)
262 {
263 if (DustEffectManager.GetDustEffectManager().IsCeilingDustEffectEnabled())
264 {
265 CeilingDustEffectBase effect = CeilingDustEffectBase.Cast(DustEffectManager.GetCeilingEffectType(ceilingParticleID).ToType().Spawn());
266 effect.SetParticle(ceilingParticleID);
267 effect.SetAutodestroy(true);
268 SEffectManager.PlayInWorld(effect, position);
269 }
270 }
271}
272
275{
277 override protected void CreateEffects(int ceilingParticleID, vector position)
278 {
279 //'spam' variant of effecters solution
280 SEffectManager.CreateParticleServer(position, new ParticleEffecterParameters("CeilingDustEffecter", 2.0, ceilingParticleID));
281 }
282}
283
285//effecter
286
287class CeilingDustEffecter : ParticleEffecter
288{
289 override protected typename GetEffectTypename()
290 {
291 return DustEffectManager.GetCeilingEffectType(m_ParticleEffectIDSync).ToType();
292 }
293}
294
296//effect class
297
299{
301 {
303 }
304
306 {
308 }
309
310 protected void PlayCeilingDustSound()
311 {
312 SEffectManager.PlaySound(GetAdjustedSoundSet(m_Position), m_Position).SetAutodestroy(true);
313 }
314
315 override void Start()
316 {
317 if (!DustEffectManager.GetDustEffectManager().IsCeilingDustEffectEnabled())
318 return;
319
320 super.Start();
321 }
322
323 protected string GetAdjustedSoundSet(vector effectPos)
324 {
325 vector playerPos = g_Game.GetPlayer().GetPosition();
326 bool upperVariant = effectPos[1] < playerPos[1];
327
328 if (upperVariant)
331 }
332
334 //methods to override in children classes
335
336 protected string GetLowerSoundsetVariant()
337 {
338 return "";
339 }
340
341 protected string GetUpperSoundsetVariant()
342 {
343 return "";
344 }
345}
346
347class CeilingDustEffectWood : CeilingDustEffectBase
348{
349 override protected string GetLowerSoundsetVariant()
350 {
351 return "CeilingDustEffect_SoundSet";
352 }
353
354 override protected string GetUpperSoundsetVariant()
355 {
356 return "CeilingDustEffectTop_SoundSet";
357 }
358}
DayZGame g_Game
Определения DayZGame.c:4074
class DustEffectCeilingHandlerBase CreateEffects(int ceilingParticleID, vector position)
Request from server, effecter handles the rest.
Определения DustEffectCeilingHandler.c:79
static float FLOOR_THICKNESS_DEFAULT
Определения DustEffectCeilingHandler.c:82
static int RANGE_MAX_DEFAULT
Определения DustEffectCeilingHandler.c:81
vector GetBonePosition(string boneName)
Определения DustEffectCeilingHandler.c:120
int m_StepCounter
Определения DustEffectCeilingHandler.c:85
void AdjustBySurfaceThickness(inout vector pos, SurfaceInfo surfaceInfo)
Определения DustEffectCeilingHandler.c:143
static int RANGE_MIN_DEFAULT
Определения DustEffectCeilingHandler.c:80
void CalculateNextEffect(string surfaceType, int particleID)
Определения DustEffectCeilingHandler.c:94
void CeilingDustEffectBase()
Определения DustEffectCeilingHandler.c:168
void OnStepUpdate(SurfaceInfo surfaceInfo, string boneName="")
Определения DustEffectCeilingHandler.c:102
void DustEffectCeilingHandlerBase(EntityAI owner)
Определения DustEffectCeilingHandler.c:88
int m_NextEffectStepIdx
Определения DustEffectCeilingHandler.c:86
vector position
Определения DustKickupEffects.c:20
ref ScriptInvoker Event_OnEffectStarted
Event used when the actual effect started playing.
Определения Effect.c:24
vector m_Position
Cached world position.
Определения Effect.c:43
void EffectParticleGeneral()
Определения EffectManager.c:871
enum ProcessDirectDamageFlags m_Owner
void ~CeilingDustEffectBase()
Определения DustEffectCeilingHandler.c:123
void CeilingDustEffectBase()
Определения DustEffectCeilingHandler.c:118
string GetAdjustedSoundSet(vector effectPos)
Определения DustEffectCeilingHandler.c:141
override void Start()
Определения DustEffectCeilingHandler.c:133
string GetUpperSoundsetVariant()
Определения DustEffectCeilingHandler.c:159
string GetLowerSoundsetVariant()
Определения DustEffectCeilingHandler.c:154
void PlayCeilingDustSound()
Определения DustEffectCeilingHandler.c:128
Super root of all classes in Enforce script.
Определения EnScript.c:11
Определения DayZAnimal.c:192
Определения ManBase.c:2
void CreateEffects(int ceilingParticleID, vector position)
void CreateEffects(int ceilingParticleID, vector position)
Request from server, effecter handles the rest.
Определения DustEffectCeilingHandler.c:95
Generic synced solution.
Определения DustEffectCeilingHandler.c:93
static void AdjustCeilingDustEffectFrequency(string surfaceType, int particleID, inout int min, inout int max)
optional adjustment of frequency by particleID
Определения DustEffectsManager.c:706
Определения EnMath.c:7
GetEffectTypename()
Определения EffectManager.c:857
proto bool Remove(func fn, int flags=EScriptInvokerRemoveFlags.ALL)
remove specific call from list
proto bool Insert(func fn, int flags=EScriptInvokerInsertFlags.IMMEDIATE)
insert method to list
proto float GetThickness()
proto string GetSurfaceType()
proto int GetCeilingDustParticleId()
Определения SurfaceInfo.c:9
Определения EnConvert.c:119
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static int RandomIntInclusive(int min, int max)
Returns a random int number between and min [inclusive] and max [inclusive].
Определения EnMath.c:54