using System; using System.Collections.Generic; using System.Linq; using System.Text; using VRage.Game; using VRage.Game.ObjectBuilders.Definitions; namespace Sandbox.ModAPI.Ingame { /// /// Determines the current mode of a conveyor sorter. /// public enum MyConveyorSorterMode { /// /// The items in the filter list are the only items allowed through this sorter. /// Whitelist, /// /// The items in the filter list are not allowed through this sorter. /// Blacklist } [Serializable] public struct MyInventoryItemFilter { public static implicit operator MyInventoryItemFilter(MyDefinitionId definitionId) { return new MyInventoryItemFilter(definitionId); } /// /// Determines whether all subtypes of the given item ID should pass this filter check. /// public readonly bool AllSubTypes; /// /// Specifies an item to filter. Set to true to only check the main type part of this ID. /// public readonly MyDefinitionId ItemId; public MyInventoryItemFilter(string itemId, bool allSubTypes = false) : this() { ItemId = MyDefinitionId.Parse(itemId); AllSubTypes = allSubTypes; } public MyInventoryItemFilter(MyDefinitionId itemId, bool allSubTypes = false) : this() { ItemId = itemId; AllSubTypes = allSubTypes; } } public interface IMyConveyorSorter : IMyFunctionalBlock { /// /// Determines whether the sorter should drain any inventories connected to it and push them to the other side - as long /// as the items passes the filtering as defined by the filter list () and . /// bool DrainAll { get; set; } /// /// Determines the current mode of this sorter. Use or to change the mode. /// MyConveyorSorterMode Mode { get; } /// /// Gets the items currently being allowed through or rejected, depending on the . /// /// void GetFilterList(List items); /// /// Adds a single item to the filter list. See to change the filter mode and/or fill /// the entire list in one go. /// /// void AddItem(MyInventoryItemFilter item); /// /// Removes a single item from the filter list. See to change the filter mode and/or clear /// the entire list in one go. /// /// void RemoveItem(MyInventoryItemFilter item); /// /// Determines whether a given item type is allowed through the sorter, depending on the filter list () and . /// /// /// bool IsAllowed(MyDefinitionId id); /// /// Changes the sorter to desired mode and filters the provided items. You can pass in null to empty the list. /// /// /// void SetFilter(MyConveyorSorterMode mode, List items); } }