public override void AreaChange(AreaInstance area) { try { EntityAddedQueue.Clear(); NearbyPaths.Clear(); } catch { } }
public override void EntityAdded(Entity Entity) { if (!Settings.Enable.Value) { return; } if (Entity.Type == EntityType.Monster) { EntityAddedQueue.Enqueue(Entity); } }
private void TickLogic() { while (EntityAddedQueue.Count > 0) { var entity = EntityAddedQueue.Dequeue(); if (entity.IsValid && !entity.IsAlive) { continue; } if (!entity.IsHostile || !entity.IsValid) { continue; } if (!Settings.ShowModAlerts) { continue; } try { var rarity = entity.Rarity; var color = Color.Red; if (entity.HasComponent <ObjectMagicProperties>() && entity.IsAlive) { var mods = entity.GetComponent <ObjectMagicProperties>().Mods; if (mods != null) { string modMatch = mods.FirstOrDefault(x => ModDict.ContainsKey(x)); var filter = ModDict[modMatch]; if (filter != null) { entity.SetHudComponent(new ProximityAlert(entity, filter.Color, filter.Distance, filter.SoundFile)); lock (_locker) PlaySound(filter.SoundFile); } else { return; } } } } catch { } } // Update valid foreach (var entity in GameController.EntityListWrapper.ValidEntitiesByType[EntityType.Monster]) { var drawCmd = entity.GetHudComponent <ProximityAlert>(); drawCmd?.Update(); } // Nearby debug stuff /* * if (Settings.ShowNearbyKey.PressedOnce()) * { * if (NearbyPaths.Count > 0) NearbyPaths.Clear(); * else * { * NearbyPaths.Clear(); * foreach (var entity in GameController.EntityListWrapper.ValidEntitiesByType[EntityType.Monster]) * { * * if (entity.DistancePlayer < 200 && entity.IsAlive) * { * NearbyPaths.Add(new StaticEntity(entity.Path, entity.Pos)); * } * } * } * } */ }