Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[ SUPER SORTER ]]--
- -- Super Sorter doesn't do much sorting currently.
- -- It's current functions are
- -- Automatically repairing items that come out of mob grinders
- -- Broadcasting fully repaired / miscellaneous items for base monitoring purposes
- -- It's not plug and play, there will be configuration, however it should work in other people's set ups
- -- I just don't feel like documenting the configuration process so...
- --[[ CONFIGURATION ]]--
- -- TODO: better document configuration
- local broadcastChannel = "mobmon-eg"
- local repairChest = "back"
- local repairPos = "north" -- turtle relative to the repair chest
- local repairables = {
- "minecraft:iron_sword",
- "minecraft:iron_pickaxe",
- "minecraft:iron_axe",
- "minecraft:iron_shovel",
- "minecraft:iron_helmet",
- "minecraft:iron_chestplate",
- "minecraft:iron_leggings",
- "minecraft:iron_boots",
- "minecraft:diamond_sword",
- "minecraft:diamond_pickaxe",
- "minecraft:diamond_axe",
- "minecraft:diamond_shovel",
- "minecraft:diamond_helmet",
- "minecraft:diamond_chestplate",
- "minecraft:diamond_leggings",
- "minecraft:diamond_boots",
- "minecraft:stone_sword",
- "minecraft:stone_pickaxe",
- "minecraft:stone_axe",
- "minecraft:stone_shovel",
- "minecraft:chainmail_helmet",
- "minecraft:chainmail_chestplate",
- "minecraft:chainmail_leggings",
- "minecraft:chainmail_boots",
- "minecraft:wooden_sword",
- "minecraft:wooden_pickaxe",
- "minecraft:wooden_axe",
- "minecraft:wooden_shovel",
- "minecraft:leather_helmet",
- "minecraft:leather_chestplate",
- "minecraft:leather_leggings",
- "minecraft:leather_boots",
- "minecraft:golden_sword",
- "minecraft:golden_pickaxe",
- "minecraft:golden_axe",
- "minecraft:golden_shovel",
- "minecraft:golden_helmet",
- "minecraft:golden_chestplate",
- "minecraft:golden_leggings",
- "minecraft:golden_boots",
- "minecraft:bow",
- "minecraft:shield",
- "botania:manaweaveboots",
- "botania:manaweavelegs",
- "botania:manaweavechest",
- "botania:manaweavehelm",
- "botania:manasteelboots",
- "botania:manasteellegs",
- "botania:manasteelchest",
- "botania:manasteelhelm",
- "botania:elementiumboots",
- "botania:elementiumlegs",
- "botania:elementiumchest",
- "botania:elementiumhelm",
- "twilightforest:fiery_boots",
- "twilightforest:fiery_leggings",
- "twilightforest:fiery_chestplate",
- "twilightforest:fiery_helmet",
- "twilightforest:knightmetal_boots",
- "twilightforest:knightmetal_leggings",
- "twilightforest:knightmetal_chestplate",
- "twilightforest:knightmetal_helmet",
- "twilightforest:ironwood_boots",
- "twilightforest:ironwood_leggings",
- "twilightforest:ironwood_chestplate",
- "twilightforest:ironwood_helmet",
- "twilightforest:steeleaf_boots",
- "twilightforest:steeleaf_leggings",
- "twilightforest:steeleaf_chestplate",
- "twilightforest:steeleaf_helmet",
- "mysticalagriculture:prudentium_boots",
- "mysticalagriculture:prudentium_leggings",
- "mysticalagriculture:prudentium_chestplate",
- "mysticalagriculture:prudentium_helmet",
- "mysticalagriculture:inferium_boots",
- "mysticalagriculture:inferium_leggings",
- "mysticalagriculture:inferium_chestplate",
- "mysticalagriculture:inferium_helmet",
- "mysticalagriculture:intermedium_boots",
- "mysticalagriculture:intermedium_leggings",
- "mysticalagriculture:intermedium_chestplate",
- "mysticalagriculture:intermedium_helmet",
- "mysticalagriculture:superium_boots",
- "mysticalagriculture:superium_leggings",
- "mysticalagriculture:superium_chestplate",
- "mysticalagriculture:superium_helmet",
- "nuclearcraft:boots_boron",
- "nuclearcraft:legs_boron",
- "nuclearcraft:chest_boron",
- "nuclearcraft:helm_boron",
- "nuclearcraft:boots_tough",
- "nuclearcraft:legs_tough",
- "nuclearcraft:chest_tough",
- "nuclearcraft:helm_tough",
- "psi:psimetal_exosuit_boots",
- "psi:psimetal_exosuit_leggings",
- "psi:psimetal_exosuit_chestplate",
- "psi:psimetal_exosuit_helmet",
- "immersiveengineering:faraday_suit_feet",
- "immersiveengineering:faraday_suit_legs",
- "immersiveengineering:faraday_suit_chest",
- "immersiveengineering:faraday_suit_head",
- "botania:terrasteelboots",
- "botania:terrasteellegs",
- "botania:terrasteelchest",
- "botania:terrasteelhelm",
- "thermalfoundation:tool.sword_invar",
- "botania:elementiumsword",
- "nuclearcraft:boots_hard_carbon",
- "nuclearcraft:legs_hard_carbon",
- "nuclearcraft:chest_hard_carbon",
- "nuclearcraft:helm_hard_carbon",
- "mysticalagriculture:intermedium_sword"
- }
- local meltables = {
- "minecraft:iron_sword",
- "minecraft:iron_pickaxe",
- "minecraft:iron_axe",
- "minecraft:iron_shovel",
- "minecraft:iron_shovel",
- "minecraft:iron_helmet",
- "minecraft:iron_chestplate",
- "minecraft:iron_leggings",
- "minecraft:iron_boots",
- "minecraft:gold_sword",
- "minecraft:golden_pickaxe",
- "minecraft:golden_axe",
- "minecraft:golden_shovel",
- "minecraft:golden_helmet",
- "minecraft:golden_chestplate",
- "minecraft:golden_leggings",
- "minecraft:golden_boots"
- }
- --[[ PROGRAM ]]--
- rednet.open("left")
- function table.contains(array, element)
- for key, value in pairs(array) do
- if value == element then
- return key
- end
- end
- return nil
- end
- -- Seems to fix a problem for some reason, perhaps refreshing peripherals
- peripheral.getNames()
- local repair = peripheral.wrap(repairChest)
- -- Main program
- print("Starting super sorter...")
- while true do
- turtle.select(1)
- local status = 0;
- -- Grab an item from input
- while not turtle.suck() do -- nothing
- end
- local itemData = turtle.getItemDetail()
- print ("Found "..itemData.name)
- local containment = table.contains(repairables, itemData.name)
- if containment then
- if itemData.damage > 0 then
- -- Repair
- local repairable = repair.pushItems(repairPos, containment)
- if repairable == 1 then
- print("Repairing...")
- turtle.craft()
- itemData = turtle.getItemDetail()
- end
- end
- if itemData.damage == 0 then
- if table.contains(meltables, itemData.name) then
- -- Melt
- turtle.dropUp()
- print("Melting.")
- status = 2
- else
- -- Put in output
- turtle.dropDown()
- print("Saving for later.")
- status = 1
- end
- else
- -- Put aside for repairing
- repair.pullItems(repairPos, 1, 1, containment)
- print("Saving for later repairs.")
- status = 0
- end
- else
- -- Put in output chest
- turtle.dropDown()
- print("Saving for later")
- end
- itemData.status = status
- rednet.broadcast(itemData, broadcastChannel)
- print("Processed "..itemData.name)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement