Esempio n. 1
0
        public Message(Builder_Message builder)
        {
            this.Content = builder.Content;
            this.SourceGridName = builder.SourceGridName;
            this.SourceBlockName = builder.SourceBlockName;

            IMyEntity entity;
            if (!MyAPIGateway.Entities.TryGetEntityById(builder.DestCubeBlock, out entity) || !(entity is IMyCubeBlock))
            {
                (new Logger(GetType().Name)).alwaysLog("Entity does not exist in world: " + builder.DestCubeBlock, Logger.severity.WARNING);
                return;
            }
            this.DestCubeBlock = (IMyCubeBlock)entity;
            if (!MyAPIGateway.Entities.TryGetEntityById(builder.SourceCubeBlock, out entity) || !(entity is IMyCubeBlock))
            {
                (new Logger(GetType().Name)).alwaysLog("Entity does not exist in world: " + builder.SourceCubeBlock, Logger.severity.WARNING);
                return;
            }
            this.SourceCubeBlock = (IMyCubeBlock)entity;

            this.created = builder.created.ToTimeSpan();
            this.destOwnerID = builder.destOwnerID;
        }
Esempio n. 2
0
        public Message(Builder_Message builder)
        {
            this.Content         = builder.Content;
            this.SourceGridName  = builder.SourceGridName;
            this.SourceBlockName = builder.SourceBlockName;

            IMyEntity entity;

            if (!MyAPIGateway.Entities.TryGetEntityById(builder.DestCubeBlock, out entity) || !(entity is IMyCubeBlock))
            {
                Logger.AlwaysLog("Entity does not exist in world: " + builder.DestCubeBlock, Logger.severity.WARNING);
                return;
            }
            this.DestCubeBlock = (IMyCubeBlock)entity;
            if (!MyAPIGateway.Entities.TryGetEntityById(builder.SourceCubeBlock, out entity) || !(entity is IMyCubeBlock))
            {
                Logger.AlwaysLog("Entity does not exist in world: " + builder.SourceCubeBlock, Logger.severity.WARNING);
                return;
            }
            this.SourceCubeBlock = (IMyCubeBlock)entity;

            this.created     = builder.created.ToTimeSpan();
            this.destOwnerID = builder.destOwnerID;
        }