Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Скрипт для OpenComputers, для создания точек JourneyMap
- --Автор: aka_zaratustra осень 2020
- local ver = "1.2" -- версия программы
- local computer = require("computer")
- local component = require("component")
- local controller = component.inventory_controller
- --local json = require("json")
- local dim = "-9999" --дименшн в котором юзали проспектор
- --таблица с найденными рудами
- local oreX = {}
- local oreZ = {}
- local oreDim = {}
- local oreName = {}
- local veinName = {}
- local oreIndex = 0 --количество найденных записей о рудах
- --таблица с найденными жидкостями
- local oilX = {}
- local oilZ = {}
- local oilDim = {}
- local oilName = {}
- local oilSegmentNum = {} -- номер сегмента жижи в споте от 1 до 9
- local oilIndex = 0 --количество найденных записей о жижах
- --словарь руд
- local dict = {}
- --overworld
- dict["Graphite"] = {veinName = "Graphite", dim = "0"}
- dict["Diamond"] = {veinName = "Graphite", dim = "0"}
- dict["Redstone"] = {veinName = "Redstone", dim = "0"}
- dict["Ruby"] = {veinName = "Redstone", dim = "0"}
- dict["Cinnabar"] = {veinName = "Redstone", dim = "0"}
- dict["Pyrite"] = {veinName = "Chalcopyrite (Low)", dim = "0"}
- dict["Copper"] = {veinName = "Chalcopyrite (Low)", dim = "0"}
- dict["Brown Limonite"] = {veinName = "Brown Limonite", dim = "0"}
- dict["Yellow Limonite"] = {veinName = "Brown Limonite", dim = "0"}
- dict["Banded Iron"] = {veinName = "Brown Limonite", dim = "0"}
- dict["Malachite"] = {veinName = "Brown Limonite", dim = "0"}
- dict["Grossular"] = {veinName = "Grossular", dim = "0"}
- dict["Spessartine"] = {veinName = "Grossular", dim = "0"}
- dict["Pyrolusite"] = {veinName = "Grossular", dim = "0"}
- dict["Tantalite"] = {veinName = "Grossular", dim = "0"}
- dict["Kyanite"] = {veinName = "Kyanite", dim = "0"}
- dict["Mica"] = {veinName = "Kyanite", dim = "0"}
- dict["Pollucite"] = {veinName = "Kyanite", dim = "0"}
- dict["Lazurite"] = {veinName = "Lazurite", dim = "0"}
- dict["Sodalite"] = {veinName = "Lazurite", dim = "0"}
- dict["Lapis"] = {veinName = "Lazurite", dim = "0"}
- dict["Calcite"] = {veinName = "Lazurite", dim = "0"}
- dict["Soapstone"] = {veinName = "Soapstone", dim = "0"}
- dict["Talc"] = {veinName = "Soapstone", dim = "0"}
- dict["Glauconite"] = {veinName = "Soapstone", dim = "0"}
- dict["Pentlandite"] = {veinName = "Soapstone", dim = "0"}
- dict["Magnetite"] = {veinName = "Magnetite", dim = "0"}
- dict["Vanadium Magnetite"] = {veinName = "Magnetite", dim = "0"}
- dict["Gold"] = {veinName = "Magnetite", dim = "0"}
- dict["Lignite Coal"] = {veinName = "Coal", dim = "0"}
- dict["Apatite"] = {veinName = "Apatite", dim = "0"}
- dict["Tricalcium Phosphate"] = {veinName = "Apatite", dim = "0"}
- dict["Pyrochlore"] = {veinName = "Apatite", dim = "0"}
- dict["Cassiterite Sand"] = {veinName = "Cassiterite", dim = "0"}
- dict["Garnet Sand"] = {veinName = "Cassiterite", dim = "0"}
- dict["Asbestos"] = {veinName = "Cassiterite", dim = "0"}
- dict["Diatomite"] = {veinName = "Cassiterite", dim = "0"}
- dict["Basaltic Mineral Sand"] = {veinName = "Basaltic Mineral", dim = "0"}
- dict["Granitic Mineral Sand"] = {veinName = "Basaltic Mineral", dim = "0"}
- dict["Gypsum"] = {veinName = "Basaltic Mineral", dim = "0"}
- dict["Kaolinite"] = {veinName = "Kaolinite", dim = "0"}
- dict["Zeolite"] = {veinName = "Kaolinite", dim = "0"}
- dict["Glauconite Sand"] = {veinName = "Kaolinite", dim = "0"}
- dict["Rock Salt"] = {veinName = "Rock Salt", dim = "0"}
- dict["Salt"] = {veinName = "Rock Salt", dim = "0"}
- dict["Lepidolite"] = {veinName = "Rock Salt", dim = "0"}
- dict["Spodumene"] = {veinName = "Rock Salt", dim = "0"}
- dict["Oilsands"] = {veinName = "Oilsands", dim = "0"}
- dict["Tin"] = {veinName = "Tin", dim = "0"}
- dict["Vermiculite"] = {veinName = "Chalcopyrite (High)", dim = "0"}
- dict["Alunite"] = {veinName = "Chalcopyrite (High)", dim = "0"}
- dict["Dolomite"] = {veinName = "Dolomite", dim = "0"}
- dict["Wollastonite"] = {veinName = "Dolomite", dim = "0"}
- dict["Trona"] = {veinName = "Dolomite", dim = "0"}
- dict["Andradite"] = {veinName = "Dolomite", dim = "0"}
- --nether
- dict["Redstone"] = {veinName = "Redstone", dim = "-1"}
- dict["Ruby"] = {veinName = "Redstone", dim = "-1"}
- dict["Cinnabar"] = {veinName = "Redstone", dim = "-1"}
- dict["Chalcopyrite"] = {veinName = "Chalcopyrite (Low)", dim = "-1"}
- dict["Iron"] = {veinName = "Chalcopyrite (Low)", dim = "-1"}
- dict["Brown Limonite"] = {veinName = "Brown Limonite", dim = "-1"}
- dict["Yellow Limonite"] = {veinName = "Brown Limonite", dim = "-1"}
- dict["Banded Iron"] = {veinName = "Brown Limonite", dim = "-1"}
- dict["Malachite"] = {veinName = "Brown Limonite", dim = "-1"}
- dict["Grossular"] = {veinName = "Grossular", dim = "-1"}
- dict["Spessartine"] = {veinName = "Grossular", dim = "-1"}
- dict["Pyrolusite"] = {veinName = "Grossular", dim = "-1"}
- dict["Tantalite"] = {veinName = "Grossular", dim = "-1"}
- dict["Sulfur"] = {veinName = "Sulfur", dim = "-1"}
- dict["Sphalerite"] = {veinName = "Sulfur", dim = "-1"}
- dict["Beryllium"] = {veinName = "Beryllium", dim = "-1"}
- dict["Emerald"] = {veinName = "Beryllium", dim = "-1"}
- dict["Thorium"] = {veinName = "Beryllium", dim = "-1"}
- dict["Saltpeter"] = {veinName = "Saltpeter", dim = "-1"}
- dict["Diatomite"] = {veinName = "Saltpeter", dim = "-1"}
- dict["Electrotine"] = {veinName = "Saltpeter", dim = "-1"}
- dict["Alunite"] = {veinName = "Saltpeter", dim = "-1"}
- dict["Wulfenite"] = {veinName = "Wulfenite", dim = "-1"}
- dict["Molybdenite"] = {veinName = "Wulfenite", dim = "-1"}
- dict["Molybdenum"] = {veinName = "Wulfenite", dim = "-1"}
- dict["Powellite"] = {veinName = "Wulfenite", dim = "-1"}
- dict["Quartzite"] = {veinName = "Quartz", dim = "-1"}
- dict["Barite"] = {veinName = "Quartz", dim = "-1"}
- dict["Certus Quartz"] = {veinName = "Quartz", dim = "-1"}
- dict["Tetrahedrite"] = {veinName = "Tetrahedrite", dim = "-1"}
- dict["Stibnite"] = {veinName = "Tetrahedrite", dim = "-1"}
- --twilight
- dict["Graphite"] = {veinName = "Graphite", dim = "7"}
- dict["Diamond"] = {veinName = "Graphite", dim = "7"}
- dict["Brown Limonite"] = {veinName = "Brown Limonite", dim = "7"}
- dict["Yellow Limonite"] = {veinName = "Brown Limonite", dim = "7"}
- dict["Banded Iron"] = {veinName = "Brown Limonite", dim = "7"}
- dict["Malachite"] = {veinName = "Brown Limonite", dim = "7"}
- dict["Lazurite"] = {veinName = "Lazurite", dim = "7"}
- dict["Sodalite"] = {veinName = "Lazurite", dim = "7"}
- dict["Lapis"] = {veinName = "Lazurite", dim = "7"}
- dict["Calcite"] = {veinName = "Lazurite", dim = "7"}
- dict["Soapstone"] = {veinName = "Soapstone", dim = "7"}
- dict["Talc"] = {veinName = "Soapstone", dim = "7"}
- dict["Glauconite"] = {veinName = "Soapstone", dim = "7"}
- dict["Pentlandite"] = {veinName = "Soapstone", dim = "7"}
- dict["Magnetite"] = {veinName = "Magnetite", dim = "7"}
- dict["Vanadium Magnetite"] = {veinName = "Magnetite", dim = "7"}
- dict["Gold"] = {veinName = "Magnetite", dim = "7"}
- dict["Coal"] = {veinName = "Coal", dim = "7"}
- dict["Lignite Coal"] = {veinName = "Coal", dim = "7"}
- dict["Apatite"] = {veinName = "Apatite", dim = "7"}
- dict["Tricalcium Phosphate"] = {veinName = "Apatite", dim = "7"}
- dict["Pyrochlore"] = {veinName = "Apatite", dim = "7"}
- dict["Rock Salt"] = {veinName = "Rock Salt", dim = "7"}
- dict["Salt"] = {veinName = "Rock Salt", dim = "7"}
- dict["Lepidolite"] = {veinName = "Rock Salt", dim = "7"}
- dict["Spodumene"] = {veinName = "Rock Salt", dim = "7"}
- dict["Oilsands"] = {veinName = "Oilsands", dim = "7"}
- dict["Tin"] = {veinName = "Tin", dim = "7"}
- dict["Cassiterite"] = {veinName = "Tin", dim = "7"}
- dict["Wulfenite"] = {veinName = "Wulfenite", dim = "7"}
- dict["Molybdenite"] = {veinName = "Wulfenite", dim = "7"}
- dict["Molybdenum"] = {veinName = "Wulfenite", dim = "7"}
- dict["Powellite"] = {veinName = "Wulfenite", dim = "7"}
- dict["Perditio Infused Stone"] = {veinName = "Perditio Infused Stone", dim = "7"}
- dict["Ordo Infused Stone"] = {veinName = "Perditio Infused Stone", dim = "7"}
- dict["Terra Infused Stone"] = {veinName = "Terra Infused Stone", dim = "7"}
- dict["Aer Infused Stone"] = {veinName = "Terra Infused Stone", dim = "7"}
- dict["Aqua Infused Stone"] = {veinName = "Aqua Infused Stone", dim = "7"}
- dict["Ignis Infused Stone"] = {veinName = "Aqua Infused Stone", dim = "7"}
- dict["Galena"] = {veinName = "Galena", dim = "7"}
- dict["Silver"] = {veinName = "Galena", dim = "7"}
- dict["Lead"] = {veinName = "Galena", dim = "7"}
- dict["Almandine"] = {veinName = "Almandine", dim = "7"}
- dict["Pyrope"] = {veinName = "Almandine", dim = "7"}
- dict["Sapphire"] = {veinName = "Almandine", dim = "7"}
- dict["Green Sapphire"] = {veinName = "Almandine", dim = "7"}
- dict["Bentonite"] = {veinName = "Bentonite", dim = "7"}
- dict["Magnesite"] = {veinName = "Bentonite", dim = "7"}
- dict["Olivine"] = {veinName = "Bentonite", dim = "7"}
- dict["Glauconite"] = {veinName = "Bentonite", dim = "7"}
- dict["Garnierite"] = {veinName = "Garnierite", dim = "7"}
- dict["Nickel"] = {veinName = "Garnierite", dim = "7"}
- dict["Cobaltite"] = {veinName = "Garnierite", dim = "7"}
- dict["Pentlandite"] = {veinName = "Garnierite", dim = "7"}
- --moon
- dict["Chalcopyrite"] = {veinName = "Chalcopyrite (Low)", dim = "28"}
- dict["Iron"] = {veinName = "Chalcopyrite (Low)", dim = "28"}
- dict["Pyrite"] = {veinName = "Chalcopyrite (Low)", dim = "28"}
- dict["Copper"] = {veinName = "Chalcopyrite (Low)", dim = "28"}
- dict["Tin"] = {veinName = "Tin", dim = "28"}
- dict["Cassiterite"] = {veinName = "Tin", dim = "28"}
- dict["Wulfenite"] = {veinName = "Wulfenite", dim = "28"}
- dict["Molybdenite"] = {veinName = "Wulfenite", dim = "28"}
- dict["Molybdenum"] = {veinName = "Wulfenite", dim = "28"}
- dict["Powellite"] = {veinName = "Wulfenite", dim = "28"}
- dict["Galena"] = {veinName = "Galena", dim = "28"}
- dict["Silver"] = {veinName = "Galena", dim = "28"}
- dict["Lead"] = {veinName = "Galena", dim = "28"}
- dict["Chromite"] = {veinName = "Ilmenite", dim = "28"}
- dict["Uvarovite"] = {veinName = "Ilmenite", dim = "28"}
- dict["Perlite"] = {veinName = "Ilmenite", dim = "28"}
- dict["Bauxite"] = {veinName = "Bauxite", dim = "28"}
- dict["Aluminium"] = {veinName = "Bauxite", dim = "28"}
- dict["Bastnasite"] = {veinName = "Bastnasite", dim = "28"}
- dict["Monazite"] = {veinName = "Bastnasite", dim = "28"}
- dict["Neodymium"] = {veinName = "Bastnasite", dim = "28"}
- dict["Quartzite"] = {veinName = "Quartzite", dim = "28"}
- dict["Barite"] = {veinName = "Quartzite", dim = "28"}
- dict["Certus Quartz"] = {veinName = "Quartzite", dim = "28"}
- function getVeinName(sOre) --возвращает имя жилы по имени руды и дименшну
- for OreName, vein in pairs(dict) do
- if OreName == sOre then
- --print(dim, vein.dim)
- if vein.dim == dim then
- return vein.veinName
- end
- end
- end
- --print("Обнаружена неизвестная руда: "..sOre)
- return nil
- end
- function parseX(s) --парсит координату X
- -- -8,-104 has Banded Iron
- pos2 = string.find(s, ",") - 1
- return string.sub(s, 1 , pos2)
- end
- function parseZ(s) --парсит координату Z
- -- -8,-104 has Banded Iron
- pos1 = string.find(s, ",") + 1
- pos2 = string.find(s, "has")
- if pos2 == nil then
- pos2 = pos1
- else
- pos2 = pos2 - 2
- end
- return string.sub(s, pos1 , pos2)
- end
- function parseName(s) --парсит имя руды
- pos1 = string.find(s, "has") + 4
- return string.sub(s, pos1)
- end
- function processProspectionTable(tab) --Обработать данные таблицы
- Ores = false --признак, является ли эта таблица рудной
- Oils = false --признак, является ли эта таблица жидкостной
- OilsSum = false --признак, является ли эта таблица с итогами жиж
- for name, val in pairs(tab) do --просмотрим таблицу данных
- if type(name) == "number" then --интересуют только строчки с номером
- -------------------------------
- if name == 1 then
- --руды
- if string.find(val, "Ores Found") ~= nil then -- если встретили текст "Ores Found", значит перед нами таблица руд
- Ores = true
- --print ("Ores Found")
- end
- --жижи
- if string.find(val, "Oils") ~= nil then -- если встретили текст "Oils", значит перед нами таблица жидкостей
- Oils = true
- --print ("Oils")
- end
- --жижи итоги
- if string.find(val, "Corners") ~= nil then -- если встретили текст "Corners", значит перед нами таблица итогов жидкостей
- OilsSum = true
- --print ("Oils Sums")
- end
- end
- pos = string.find(val, "Dim:") -- если это строчка с дименшном типа "2 Dim: 0"
- if pos~= nil then
- dim = string.sub(val, pos + 5) --запомним дименшн
- end
- ---------------------------------
- --руды
- if Ores == true then -- если это таблица руд
- pos = string.find(val, "has") -- 6 72,24 has Banded Iron
- --print(val, pos)
- if pos ~= nil then --если есть имя руды
- oreIndex = oreIndex + 1
- oreX[oreIndex] = parseX(val)
- oreZ[oreIndex] = parseZ(val)
- oreDim[oreIndex] = dim
- oreName[oreIndex] = parseName(val)
- end
- end
- ---------------------------------
- --жидкости
- if Oils == true then -- если это таблица жидкостей
- if name ~= 1 and name ~= 2 then -- любая строчка кроме второй содержит запись о жиже
- oilIndex = oilIndex + 1
- oilX[oilIndex] = -9999 --актуальное значение мы получим в следующей таблице позже
- oilZ[oilIndex] = -9999
- oilDim[oilIndex] = dim
- oilName[oilIndex] = string.sub(val, 4) --1: 9-15L Heavy Oil
- oilSegmentNum[oilIndex] = name - 2
- --print(val)
- end
- end
- ---------------------------------
- --итоги жидкостей
- if OilsSum == true then -- если это таблица итогов жидкостей
- if name == 2 then --X: 0 Z: -128
- --print(val)
- --парсим координты сектора [5]
- Zpos = string.find(val, "Z")
- xc = string.sub(val, 4, Zpos - 2)
- zc = string.sub(val, Zpos + 3)
- --print(xc, zc)
- --на этом шаге у нас таблице жидкостей есть записи о жижах текущей флешки, но без координату
- --и есть координаты сектора [5]
- --проставим координаты каждого сектора
- -- [1][2][3]
- -- [4][5][6]
- -- [7][8][9]
- for i=1, oilIndex do
- if oilX[i] == -9999 then -- находим запись, которой еще не присвоены координаты
- if oilSegmentNum[i] == 1 then
- oilX[i] = tostring(math.floor(xc -8*16))
- oilZ[i] = tostring(math.floor(zc -8*16))
- elseif oilSegmentNum[i] == 2 then
- oilX[i] = tostring(math.floor(xc))
- oilZ[i] = tostring(math.floor(zc -8*16))
- elseif oilSegmentNum[i] == 3 then
- oilX[i] = tostring(math.floor(xc +8*16))
- oilZ[i] = tostring(math.floor(zc -8*16))
- elseif oilSegmentNum[i] == 4 then
- oilX[i] = tostring(math.floor(xc -8*16))
- oilZ[i] = tostring(math.floor(zc))
- elseif oilSegmentNum[i] == 5 then
- oilX[i] = tostring(math.floor(xc))
- oilZ[i] = tostring(math.floor(zc))
- elseif oilSegmentNum[i] == 6 then
- oilX[i] = tostring(math.floor(xc +8*16))
- oilZ[i] = tostring(math.floor(zc))
- elseif oilSegmentNum[i] == 7 then
- oilX[i] = tostring(math.floor(xc -8*16))
- oilZ[i] = tostring(math.floor(zc +8*16))
- elseif oilSegmentNum[i] == 8 then
- oilX[i] = tostring(math.floor(xc))
- oilZ[i] = tostring(math.floor(zc +8*16))
- elseif oilSegmentNum[i] == 9 then
- oilX[i] = tostring(math.floor(xc +8*16))
- oilZ[i] = tostring(math.floor(zc +8*16))
- end
- end
- end
- end
- end
- end
- --file:write(name .." ".. val)
- --file:write("\n")
- end
- end
- function processProspectionData(tab) --Обработать данные флешки
- for name, val in pairs(tab) do --просмотрим таблицу данных проспектора
- --print(name, val)
- --os.sleep(1)
- if name ~= "n" then
- processProspectionTable(val)
- end
- end
- end
- --Пример JSON
- -- {
- -- "id": "iron_168,83,984",
- -- "name": "iron",
- -- "icon": "waypoint-normal.png",
- -- "x": 168,
- -- "y": 83,
- -- "z": 984,
- -- "r": 255,
- -- "g": 255,
- -- "b": 255,
- -- "enable": false,
- -- "type": "Normal",
- -- "origin": "JourneyMap",
- -- "dimensions": [
- -- 0
- -- ]
- -- }
- function wlJSON(key, val)--запишем строчку в JSON файл
- file:write(" \"".. key.. "\": ".. val ..",")
- file:write("\n")
- end
- function generateOreJSON(i) -- генерирует точку JourneyMap (файл JSON) для жилы
- id = veinName[i].."_"..oreX[i]..",1,"..oreZ[i] -- пример Glauconite Sand_x,1,z
- fileName = id..".json" -- пример имени файла: "Glauconite Sand_x,1,z.json"
- file=io.open("waypoints".."/" .. fileName,"w")
- if file == nil then --если файл не удалось создать, значит нет папки. создадим
- os.execute("mkdir " .. "waypoints")
- file=io.open("waypoints".."/" .. fileName,"w")
- end
- --заполним тело JSON
- file:write("{") file:write("\n")
- wlJSON("id", "\""..id.."\"")
- wlJSON("name", "\""..veinName[i].."\"")
- wlJSON("icon", "\"".."waypoint-normal.png".."\"")
- wlJSON("x", oreX[i])
- wlJSON("y", "1")
- wlJSON("z", oreZ[i])
- wlJSON("r", "255")
- wlJSON("g", "255")
- wlJSON("b", "255")
- wlJSON("enable", "true")
- wlJSON("type", "\"".."Normal".."\"")
- wlJSON("origin", "\"".."JourneyMap".."\"")
- file:write(" \"dimensions\": [") file:write("\n")
- file:write(" ".. oreDim[i]) file:write("\n")
- file:write(" ]") file:write("\n")
- file:write("}")
- file:close()
- end
- function generateOilJSON(i) -- генерирует точку JourneyMap (файл JSON) ждя жидкости
- id = oilName[i].."_"..oilX[i]..",1,"..oilZ[i] -- пример 9-15L Heavy Oil_x,1,z
- fileName = id..".json" -- пример имени файла: "9-15L Heavy Oil_x,1,z.json"
- file=io.open("waypoints".."/" .. fileName,"w")
- if file == nil then --если файл не удалось создать, значит нет папки. создадим
- os.execute("mkdir " .. "waypoints")
- file=io.open("waypoints".."/" .. fileName,"w")
- end
- --заполним тело JSON
- file:write("{") file:write("\n")
- wlJSON("id", "\""..id.."\"")
- wlJSON("name", "\""..oilName[i].."\"")
- wlJSON("icon", "\"".."waypoint-normal.png".."\"")
- wlJSON("x", oilX[i])
- wlJSON("y", "1")
- wlJSON("z", oilZ[i])
- wlJSON("r", "127")
- wlJSON("g", "127")
- wlJSON("b", "127")
- wlJSON("enable", "true")
- wlJSON("type", "\"".."Normal".."\"")
- wlJSON("origin", "\"".."JourneyMap".."\"")
- file:write(" \"dimensions\": [") file:write("\n")
- file:write(" ".. oilDim[i]) file:write("\n")
- file:write(" ]") file:write("\n")
- file:write("}")
- file:close()
- end
- ----------------------------------------------------------------
- print ("Программа генерации точек JourneyMap запущена.")
- print ("Версия "..ver)
- print ("Ищем флешки с данными проспектора и просматриваем их...")
- --ищем флешки и сканируем их
- for i=1,5 do --цикл просмотра сторон адаптера
- slotNumbers = controller.getInventorySize(i) --получаем количество слотов инвентори в сундуке, в котором лежат флешки
- if slotNumbers ~= nil then --если вообще сундук там есть
- for slot=1, slotNumbers do --цикл по слотам сундука
- itemStack = controller.getStackInSlot(i, slot)
- if itemStack ~= nil then --если в слоте что-то есть
- --print(itemStack.label)
- --if itemStack.label == "Data Stick" then
- --print("Найдена флешка в слоте "..slot.."...")
- --print("Item hasTag: ", itemStack.hasTag)
- --nbt = item.readTag(itemStack)
- for name, val in pairs(itemStack) do --просмотрим таблицу реультата анализа предмета
- if name == "Analyzed Prospection Data" then
- --print(name, val)
- processProspectionData(val)
- end
- end
- --end
- end
- end
- end
- end
- --проставим имя жилы
- for i=1, oreIndex do
- sOre = oreName[i]
- veinName[i] = getVeinName(sOre)
- end
- --Пометим дубликаты, чтобы не создавать лишние точки. У дубликатов имя жилы приравнивается к nil
- for i=1, oreIndex do
- for j = i+1, oreIndex do
- if oreX[i] == oreX[j] and oreZ[i] == oreZ[j] and oreDim[i] == oreDim[j] and veinName[i] == veinName[j] then --если записи полностью одинаковые, то одну из них помечаем как дубликат
- veinName[j] = nil -- стираем имя жилы у второй записи
- end
- end
- end
- print("Ores")
- for i=1, oreIndex do
- if veinName[i] ~= nil then
- print("x: "..oreX[i], "z: "..oreZ[i], "d: "..oreDim[i], "vein: "..veinName[i])
- end
- end
- print("Oils")
- for i=1, oilIndex do
- print("x: "..oilX[i], "z: "..oilZ[i], "d: "..oilDim[i], "oil: "..oilName[i])
- end
- print("--------------")
- --Генерируем JSON файлы
- j1 = 0
- --для руд
- for i=1, oreIndex do
- if veinName[i] ~= nil then --если у записи не пустое имя жилы, то создаем точку
- generateOreJSON(i)
- j1=j1+1
- end
- end
- print("Созадно меток руды: "..j1..".")
- j2 = 0
- --для жидкостей
- for i=1, oilIndex do
- generateOilJSON(i)
- j2=j2+1
- end
- print("Создано меток жидкостей под бэдроком: "..j2..".")
- print("Итого в папке waypoints созадно файлов: "..j1+j2..".")
- os.exit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement