|
|
| Строка 92: |
Строка 92: |
|
| |
|
| return "Не имеет пополнителя." | | return "Не имеет пополнителя." |
| end
| |
|
| |
| -- Получение данных о доступах
| |
| local function getAccessOutput(id)
| |
| local vendingMachines = loadData("User:IanComradeBot/prototypes/vending machines.json")
| |
|
| |
| -- Поиск автомата по ID
| |
| local vendingMachine = findDataById(vendingMachines, id)
| |
|
| |
| -- Получение доступа из данных автомата
| |
| local access = vendingMachine.AccessReader and vendingMachine.AccessReader.access
| |
|
| |
| if not access then
| |
| return "Доступ не требуется."
| |
| end
| |
|
| |
| -- Формируем строку для вызова шаблона
| |
| local templateCall = "{{#invoke:Prototypes/Механика/Доступ|parse|" .. access .. "}}"
| |
|
| |
| -- Обрабатываем шаблон и возвращаем результат
| |
| return mw.getCurrentFrame():preprocess(templateCall)
| |
| end | | end |
|
| |
|
| Строка 127: |
Строка 106: |
| elseif mode == "restock" then | | elseif mode == "restock" then |
| return getRestockOutput(id) | | return getRestockOutput(id) |
| elseif mode == "access" then
| |
| return getAccessOutput(id)
| |
| else | | else |
| return "" | | return "" |