示例#1
0
        /// <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);
            }
        }
示例#2
0
文件: IsVisibleTo.cs 项目: SinaC/RMUD
        /// <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));
        }
示例#3
0
文件: SendMessage.cs 项目: SinaC/RMUD
        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)));
                }
            }
        }