using UnityEngine; namespace Oxide.Plugins { [Info("IndustrialCrafterFix", "diaolingtyp", "1.0.1")] [Description("Avoid Industrial Crafter output merge skined items.")] internal class IndustrialCrafterFix : RustPlugin { private void OnServerInitialized() { foreach (var item in BaseNetworkable.serverEntities) { if (item.prefabID == 273687723) { var crafter = item as IndustrialCrafter; crafter._inventory.canAcceptItem = CanAcceptItem; } } } private void OnEntitySpawned(IndustrialCrafter crafter) { crafter._inventory.canAcceptItem = CanAcceptItem; crafter.SendNetworkUpdateImmediate(); } private bool CanAcceptItem(Item item, int index) { if (index >= 0 && index <= 3 && !item.IsBlueprint()) { return false; } if (index >= 8 && item.skin != 0) { return false; } return true; } void Unload() { foreach (var item in BaseNetworkable.serverEntities) { if (item.prefabID == 273687723) { var crafter = item as IndustrialCrafter; crafter._inventory.canAcceptItem = CanAcceptItemDefault; } } } private bool CanAcceptItemDefault(Item item, int index) { if (index >= 0 && index <= 3 && !item.IsBlueprint()) { return false; } return true; } [ChatCommand("ForceDropSkinedItemFromCrafter")] private void RemoveSkinedItemFromCrafter(BasePlayer player) { if (player == null || !player.IsAdmin) return; int Removed = 0; foreach (var enitty in BaseNetworkable.serverEntities) { if (enitty.prefabID == 273687723) { var crafter = enitty as IndustrialCrafter; for (int i = 11; i >= 8; i--) { if (crafter._inventory.GetSlot(i) != null && crafter._inventory.GetSlot(i).skin != 0) { crafter._inventory.GetSlot(i).DropAndTossUpwards(crafter.transform.position); Removed++; } } } } PrintToChat(player, $"Force drop {Removed} skined items from Industrial Crafter."); } } }