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

◆ PlayCeilingDustSound()

void GetLowerSoundsetVariant::PlayCeilingDustSound ( )
protected

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

179{
180 protected static int RANGE_MIN_DEFAULT = 4;
181 protected static int RANGE_MAX_DEFAULT = 8;
182 protected static float FLOOR_THICKNESS_DEFAULT = 0.4;
183
184 protected EntityAI m_Owner;
185 protected int m_StepCounter;
186 protected int m_NextEffectStepIdx;
187
189 {
190 m_Owner = owner;
191 m_StepCounter = 0;
192 }
193
194 protected void CalculateNextEffect(string surfaceType, int particleID)
195 {
196 int rangeMin = RANGE_MIN_DEFAULT;
197 int rangeMax = RANGE_MAX_DEFAULT;
198 DustEffectManager.AdjustCeilingDustEffectFrequency(surfaceType, particleID, rangeMin, rangeMax);
199 m_NextEffectStepIdx = Math.RandomIntInclusive(rangeMin,rangeMax);
200 }
201
202 void OnStepUpdate(SurfaceInfo surfaceInfo, string boneName = "")
203 {
204 int ceilingParticleID = surfaceInfo.GetCeilingDustParticleId();
205 if (ceilingParticleID <= 0)
206 return;
207
209
211 {
212 vector pos = GetBonePosition(boneName);
213 AdjustBySurfaceThickness(pos, surfaceInfo);
214 CreateEffects(ceilingParticleID, pos);
215 m_StepCounter = 0;
216 CalculateNextEffect(surfaceInfo.GetSurfaceType(), ceilingParticleID);
217 }
218 }
219
220 protected vector GetBonePosition(string boneName)
221 {
222 DayZCreature creature;
223 DayZPlayerImplement player;
224
225 vector ownerPos = m_Owner.GetPosition();
226 if (boneName == "")
227 return ownerPos;
228
229 int boneIdx = -1;
230 if (Class.CastTo(creature, m_Owner))
231 boneIdx = creature.GetBoneIndexByName(boneName);
232 if (Class.CastTo(player, m_Owner))
233 boneIdx = player.GetBoneIndexByName(boneName);
234
235 if (boneIdx == -1)
236 return ownerPos;
237
238 vector bonePos = m_Owner.GetBonePositionWS(boneIdx);
239 bonePos[1] = ownerPos[1]; //equalize Y to allow for consistent height adjustment later
240 return bonePos;
241 }
242
243 protected void AdjustBySurfaceThickness(inout vector pos, SurfaceInfo surfaceInfo)
244 {
245 float thicc = surfaceInfo.GetThickness(); //returns '-1' if not defined, for reasons
246 if (thicc < 0)
248 pos[1] = pos[1] - thicc;
249 }
250
251 protected void CreateEffects(int ceilingParticleID, vector position);
252}
253
254class DustEffectCeilingHandlerLocal : DustEffectCeilingHandlerBase
255{
256 override protected void CreateEffects(int ceilingParticleID, vector position)
257 {
258 if (DustEffectManager.GetDustEffectManager().IsCeilingDustEffectEnabled())
259 {
260 CeilingDustEffectBase effect = CeilingDustEffectBase.Cast(DustEffectManager.GetCeilingEffectType(ceilingParticleID).ToType().Spawn());
261 effect.SetParticle(ceilingParticleID);
262 effect.SetAutodestroy(true);
263 SEffectManager.PlayInWorld(effect, position);
264 }
265 }
266}
267
270{
272 override protected void CreateEffects(int ceilingParticleID, vector position)
273 {
274 //'spam' variant of effecters solution
275 SEffectManager.CreateParticleServer(position, new ParticleEffecterParameters("CeilingDustEffecter", 2.0, ceilingParticleID));
276 }
277}
278
280//effecter
281
282class CeilingDustEffecter : ParticleEffecter
283{
284 override protected typename GetEffectTypename()
285 {
286 return DustEffectManager.GetCeilingEffectType(m_ParticleEffectIDSync).ToType();
287 }
288}
289
291//effect class
292
294{
296 {
298 }
299
301 {
303 }
304
305 protected void PlayCeilingDustSound()
306 {
307 SEffectManager.PlaySound(GetAdjustedSoundSet(m_Position), m_Position).SetAutodestroy(true);
308 }
309
310 override void Start()
311 {
312 if (!DustEffectManager.GetDustEffectManager().IsCeilingDustEffectEnabled())
313 return;
314
315 super.Start();
316 }
317
318 protected string GetAdjustedSoundSet(vector effectPos)
319 {
320 vector playerPos = g_Game.GetPlayer().GetPosition();
321 bool upperVariant = effectPos[1] < playerPos[1];
322
323 if (upperVariant)
326 }
327
329 //methods to override in children classes
330
331 protected string GetLowerSoundsetVariant()
332 {
333 return "";
334 }
335
336 protected string GetUpperSoundsetVariant()
337 {
338 return "";
339 }
340}
341
342class CeilingDustEffectWood : CeilingDustEffectBase
343{
344 override protected string GetLowerSoundsetVariant()
345 {
346 return "CeilingDustEffect_SoundSet";
347 }
348
349 override protected string GetUpperSoundsetVariant()
350 {
351 return "CeilingDustEffectTop_SoundSet";
352 }
353}
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

Используется в GetBonePosition().