ARK: Survival Evolved Wiki
Регистрация
Advertisement
Template-info Документация

Отображает список необходимых станций для создания требуемого ресурса.

Параметр[]

  • craftedin: станция которая нужная для создания предмета
  • Список необходимых ресурсов разделяется знаком |

Использование[]

{{RequiredCraftingStations|<resources>}}
{{RequiredCraftingStations|craftedin=<station>|<resources>}}

Пример[]

{{RequiredCraftingStations|Наркотик|Слиток Металла}}

Ступка и Пестик Ступка и Пестик
Плавильная Печь Плавильная Печь

{{RequiredCraftingStations|craftedin=Станок|Наркотик|Слиток Металла}}

Ступка и Пестик Ступка и Пестик
Плавильная Печь Плавильная Печь
Станок Станок


local p = {}
function p.neededstations( f )
  local args = f:getParent().args
  local stations = {["Костёр"] = false, ["Ступка и Пестик"] = false, ["Плавильная Печь"] = false, ["Preserving Bin"] = false, ["Верстак"] = false, ["Станок"] = false}
  local dependencies = {
    ["Костёр"] = {
      "Уголь",
      "Жареное Мясо",
      "Жареное Первосортное Мясо",
      "Порох"
    },
    ["Ступка и Пестик"] = {
      "Селитра",
      "Наркотик",
      "Порох",
      "Стимулятор",
      "Цементная Паста",
      "Средство от Насекомых",
      "Полимер",
      "Глина (Scorched Earth)",
      "Пропеллент"
    },
    ["Плавильная Печь"] = {
      "Слиток Металла",
      "Бензин",
      "Электроника",
      "Кирпич",
      "Стекло",
      "Железный Слиток",
      "Стальной Слиток"
    },
    ["Preserving Bin"] = {
      "Вяленое Мясо",
      "Вяленое Первосортное Мясо"
    },
    ["Верстак"] = {
      "Транквилизирующий Дротик"
    },
    ["Станок"] = {
      "Электроника",
      "Полимер"
    },
    ["Химический Стол"] = {
      "Absorbent Substrate"
    },
  --Primitive Plus
    ["Apiary"] = {
      "Honey",
      "Beeswax"
    },
    ["Cauldron"] = {
      "Natural Yeast",
      "Cashew Milk"
    },
    ["Cement Mixer"] = {
      "Fresh Cement"
    },
    ["Cooking Table"] = {
      "Fresh Dough"
    },
    ["Handmill"] = {
      "Clay (Primitive+)",
      "Sack of Flour",
      "Salt"
    },
    ["Lumber Station"] = {
      "Wood Plank"
    },
    ["Preserving Campfire"] = {
      "Dried Barley",
      "Dried Tea Bags",
      "Dried Wheat"
    },
    ["Sugar Press"] = {
      "Fresh Sugar Juice Bucket"
    },
    ["Tanning Rack"] = {
      "Leather"
    }
  }

  -- check if item itself needs a station to be crafted in. if yes, set to true
  if args.craftedin ~= nil and stations[args.craftedin] ~= nil then
    stations[args.craftedin] = true
  end
  -- get iconsize
  local iconsize = '20px'
  if args.iconsize ~= nil then
    iconsize = args.iconsize
  end

  -- test all given resources and set station to true if needed and station is not already on true
  for _,res in ipairs(args) do
    if res ~= '' then
      for station,_ in pairs(dependencies) do
        if not stations[station] and p.inTable(dependencies[station], res) then
          stations[station] = true
        end
      end
    end
  end

  local returnTable = {}
  for station, needed in pairs(stations) do
    if needed then
      table.insert(returnTable,'[[File:'..station..'.png|'..iconsize..']] [['..station..']]')
    end
  end

  return table.concat(returnTable,'<br/>')
end

function p.inTable(tbl, item)
  for _, value in pairs(tbl) do
    if string.lower(value) == string.lower(item) then return true end
  end
  return false
end

return p
Advertisement