/// <summary> /// Find the locale of an object and mark it for update. /// </summary> /// <param name="Object">Reference point object</param> public static void MarkLocaleForUpdate(MudObject Object) { MudObject locale = MudObject.FindLocale(Object); if (locale != null && !MarkedObjects.Contains(locale)) { MarkedObjects.Add(locale); } }
/// <summary> /// Determine is an object is visible to another object. This is essentially a comparison of the /// locale of the two objects. However, some special cases must be accounted for. /// a) A closed container is visible to it's contents, despite having different locales, /// and the reverse. /// </summary> /// <param name="Actor">The reference point object</param> /// <param name="Object">The object to be tested</param> /// <returns>True if the reference point object can 'see' the tested object, false otherwise.</returns> public static bool IsVisibleTo(MudObject Actor, MudObject Object) { var actorLocale = MudObject.FindLocale(Actor); if (actorLocale == null) { return(false); } var objectLocale = MudObject.FindLocale(Object); return(System.Object.ReferenceEquals(actorLocale, objectLocale) || System.Object.ReferenceEquals(actorLocale, Object) || System.Object.ReferenceEquals(objectLocale, Actor)); }
public static void SendLocaleMessage(MudObject Object, String Message, params Object[] MentionedObjects) { if (String.IsNullOrEmpty(Message)) { return; } if (Core.SilentFlag) { return; } Core.OutputQueryTriggered = true; var container = MudObject.FindLocale(Object) as Container; if (container != null) { foreach (var actor in container.EnumerateObjects <Actor>().Where(a => a.ConnectedClient != null)) { Core.PendingMessages.Add(new PendingMessage(actor.ConnectedClient, Core.FormatMessage(actor, Message, MentionedObjects))); } } }