Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- pastebin get hVaGS1K6
- local distanceWeight = -2
- local blockScoreWeight = 1
- local controllerID = os.getComputerID()
- local commands = {
- ["default"] = {
- ["minY"] = 2,
- ["maxY"] = 12,
- ["blockScores"] = {
- --["minecraft:andesite"] = 100,
- ["minecraft:diamond_ore"] = 10,
- ["minecraft:gold_ore"] = 8,
- ["minecraft:iron_ore"] = 5,
- ["minecraft:coal_ore"] = 16,
- ["minecraft:redstone_ore"] = 0.1,
- ["minecraft:lapis_ore"] = 0.15,
- ["minecraft:emerald_ore"] = 50,
- ["minecraft:oak_log"] = 9,
- ["minecraft:dark_oak_log"] = 9,
- ["minecraft:birch_log"] = 9,
- ["minecraft:jungle_log"] = 9,
- ["minecraft:acaia_log"] = 9,
- ["minecraft:nether_gold_ore"] = 5,
- ["minecraft:nether_quartz_ore"] = 5,
- ["minecraft:ancient_debris"] = 30,
- ["minecraft:crying_obsidian"] = 31,
- ["minecraft:obsidian"] = 1,
- ["minecraft:glowstone"] = 15,
- ["minecraft:sand"] = 3,
- ["minecraft:soul_sand"] = 3
- }
- },
- ["desertSand"] = {
- ["minY"] = 80,
- ["maxY"] = 120,
- ["blockScores"] = {
- ["minecraft:sand"] = 100
- }
- },
- ["tree"] = {
- ["minY"] = 60,
- ["maxY"] = 100,
- ["blockScores"] = {
- ["minecraft:oak_log"] = 20,
- ["minecraft:dark_oak_log"] = 20,
- ["minecraft:birch_log"] = 20,
- ["minecraft:jungle_log"] = 20,
- ["minecraft:acaia_log"] = 20
- }
- }
- }
- local IDs = {
- [21] = "desertSand",
- [19] = "tree"
- }
- rednet.open("top")
- local lastSeen = {}
- print("Started controller")
- while true do
- local id, message = rednet.receive()
- print("-----------------------------")
- print("[" .. tostring(os.date()) .. "] Message from " .. id .. ": ")--textutils.formatTime
- print(textutils.serialize(message))
- print("-----------------------------")
- lastSeen[id] = message
- local file = fs.open("lastSeen", "w")
- file.write(textutils.serialize(lastSeen))
- file.close()
- local toSend = commands["default"]
- if IDs[id] ~= nil then
- toSend = commands[IDs[id]]
- end
- toSend["timestamp"] = os.time()
- rednet.send(id, toSend)
- end
Add Comment
Please, Sign In to add comment