/// <summary>
        /// Examines an IEntity instance to see if any feature will be interested in it.
        /// </summary>
        /// <param name="entity">The IEntity instance to be examined.</param>
        private void ProcessEntity(IEntity entity)
        {
            if (entity == null)
            {
                return;
            }

            EntityTokenizer entityTokens = null;

            // Process structure data of the entity.
            IStructure structure = entity.Structure;

            if (structure != null)
            {
                //DarkCity.LogDebug($"Processing structure {structure.Entity.Name}");

                if (EmpyrionExtension.LiveLcd &&
                    ((EmpyrionExtension.Application.Mode == ApplicationMode.PlayfieldServer) || (EmpyrionExtension.Application.Mode == ApplicationMode.SinglePlayer)))
                {
                    // Process LCD devices.
                    IDevicePosList list = structure.GetDevices(DeviceTypeName.LCD);
                    if (list != null)
                    {
                        for (int i = 0; i < list.Count; i++)
                        {
                            Eleon.Modding.VectorInt3 position = list.GetAt(i);
                            ILcd lcd = structure.GetDevice <ILcd>(position);
                            if (lcd != null)
                            {
                                // Prep structure tokens if not available yet.
                                if (entityTokens == null)
                                {
                                    entityTokens = new EntityTokenizer(entity);
                                }

                                // Hand off ILcd device to any potentially interested processors.
                                LiveLcd.Process(structure, lcd, position, entityTokens, this.PlayfieldTokens);
                            }
                        }
                    }
                }
            }
        }
Beispiel #2
0
        public void Add(IStructure structure)
        {
            if (structure == null)
            {
                return;
            }

            IDevicePosList containers = structure.GetDevices(DeviceTypeName.Container);

            if (containers != null)
            {
                for (int i = 0; i < containers.Count; i++)
                {
                    Eleon.Modding.VectorInt3 position = containers.GetAt(i);
                    IContainer container = structure.GetDevice <IContainer>(position);
                    if (container == null)
                    {
                        continue;
                    }
                    this.Add(container.GetContent());
                }
            }
        }