Exemple #1
0
        internal static void RemoveFromFilter(IMyTerminalBlock block)
        {
            FilteredContainer component = block?.GameLogic?.GetAs <FilteredContainer>();

            if (component.FilterController.ListToRemove.Count == 0)
            {
                return;
            }
            Filterdata filterdata = new Filterdata
            {
                id          = component.Entity.EntityId,
                FilterMode  = component.FilterController.FilterMode,
                FilterItems = component.FilterController.ListToRemove.ToArray(),
            };
            var metaData   = MyAPIGateway.Utilities.SerializeToBinary <Filterdata>(filterdata);
            var SendPacket = new MetaPacket
            {
                EntityId   = component.Entity.EntityId,
                PacketType = PacketType.FILTER_REMOVE,
                MetaData   = metaData,
            };

            MyAPIGateway.Multiplayer.SendMessageToServer(31875, MyAPIGateway.Utilities.SerializeToBinary <MetaPacket>(SendPacket));
            component.RemoveFromFilter(filterdata);
            component.FilterController.ListToRemove.Clear();
            ContainerControls.updateVisual("CurrentList");
        }
Exemple #2
0
        internal static void ClearFilter(IMyTerminalBlock block)
        {
            FilteredContainer component = block?.GameLogic?.GetAs <FilteredContainer>();
            var Sendpacket = new MetaPacket
            {
                EntityId   = component.Entity.EntityId,
                PacketType = PacketType.FILTER_CLEAR,
                MetaData   = MyAPIGateway.Utilities.SerializeToBinary <Filterdata>(new Filterdata()),
            };

            MyAPIGateway.Multiplayer.SendMessageToServer(31875, MyAPIGateway.Utilities.SerializeToBinary <MetaPacket>(Sendpacket));
            component.ClearFilter();
            ContainerControls.updateVisual("CurrentList");
        }