예제 #1
0
        public void listProperties(Sandbox.ModAPI.Ingame.IMyTerminalBlock block, Logger log, Config config)
        {
            List <ITerminalProperty> properties = new List <ITerminalProperty>();

            block.GetProperties(properties);
            for (int i = 0; i < properties.Count; i++)
            {
                log.log(config.statusPanel, properties[i].Id, ErrorSeverity.Notice);
            }
        }
예제 #2
0
        internal static List <Control.Event> getSensorStatusChanges(Dictionary <IMySensorBlock, bool> sensorStatus, Config config)
        {
            List <Control.Event> currentEvents = new List <Control.Event>();

            foreach (IMySensorBlock sensor in config.sensors1)
            {
                bool oldStatus = sensorStatus.GetValueOrDefault(sensor, false);
                if (!oldStatus.Equals(sensor.IsActive) || sensor.IsActive)
                {
                    currentEvents.Add(sensor.IsActive ? Control.Event.InEnter : Control.Event.InLeave);
                }
                if (sensorStatus.ContainsKey(sensor))
                {
                    sensorStatus.Remove(sensor);
                }
                sensorStatus.Add(sensor, sensor.IsActive);
            }
            foreach (IMySensorBlock sensor in config.sluiceSensors)
            {
                bool oldStatus = sensorStatus.GetValueOrDefault(sensor, false);
                if (!oldStatus.Equals(sensor.IsActive) || sensor.IsActive)
                {
                    currentEvents.Add(sensor.IsActive ? Control.Event.SEnter : Control.Event.SLeave);
                }
                if (sensorStatus.ContainsKey(sensor))
                {
                    sensorStatus.Remove(sensor);
                }
                sensorStatus.Add(sensor, sensor.IsActive);
            }
            foreach (IMySensorBlock sensor in config.sensors2)
            {
                bool oldStatus = sensorStatus.GetValueOrDefault(sensor, false);
                if (!oldStatus.Equals(sensor.IsActive) || sensor.IsActive)
                {
                    currentEvents.Add(sensor.IsActive ? Control.Event.OutEnter : Control.Event.OutLeave);
                }
                if (sensorStatus.ContainsKey(sensor))
                {
                    sensorStatus.Remove(sensor);
                }
                sensorStatus.Add(sensor, sensor.IsActive);
            }
            List <IMySensorBlock> sensorsToDelete = new List <IMySensorBlock>();

            foreach (IMySensorBlock sensor in sensorStatus.Keys)
            {
                if (!config.sensors1.Contains(sensor) && !config.sluiceSensors.Contains(sensor) && !config.sensors2.Contains(sensor))
                {
                    sensorsToDelete.Add(sensor);
                }
            }
            foreach (IMySensorBlock sensor in sensorsToDelete)
            {
                sensorStatus.Remove(sensor);
            }
            return(currentEvents);
        }
예제 #3
0
        public void listActions(Sandbox.ModAPI.Ingame.IMyTerminalBlock block, Logger log, Config config)
        {
            List <ITerminalAction> actions = new List <ITerminalAction>();

            block.GetActions(actions);
            for (int i = 0; i < actions.Count; i++)
            {
                log.log(config.statusPanel, actions[i].Name.ToString() + "(" + actions[i].Id + ")", ErrorSeverity.Notice);
            }
        }