internal void PlayParticleEvent(EventTriggers eventTrigger, bool active, double distance, HashSet <string> muzzles) { if (ParticleEvents.ContainsKey(eventTrigger)) { for (int i = 0; i < ParticleEvents[eventTrigger].Length; i++) { var particle = ParticleEvents[eventTrigger][i]; if (active && particle.Restart && particle.Triggered) { continue; } var obb = particle.MyDummy.Entity.PositionComp.WorldAABB; //var inView = Comp.Session.Camera.IsInFrustum(ref obb); var canPlay = true; if (muzzles != null) { for (int j = 0; j < particle.MuzzleNames.Length; j++) { if (particle.MuzzleNames[j] == "Any" || muzzles.Contains(particle.MuzzleNames[j])) { canPlay = true; break; } } } else { canPlay = true; } if (!canPlay) { return; } if (active && !particle.Playing && distance <= particle.Distance) { particle.PlayTick = Comp.Session.Tick + particle.StartDelay; Comp.Session.Av.ParticlesToProcess.Add(particle); particle.Playing = true; particle.Triggered = true; } else if (!active) { if (particle.Playing) { particle.Stop = true; } particle.Triggered = false; } } } }