BloodCaster (обс. | вклад) Нет описания правки |
BloodCaster (обс. | вклад) мНет описания правки |
||
(не показаны 32 промежуточные версии 2 участников) | |||
Строка 1: | Строка 1: | ||
+ | -- Экспортируемые функции |
||
+ | local p = {} |
||
+ | |||
+ | p.interface = function(f) |
||
+ | |||
+ | local args = f |
||
+ | if f == mw.getCurrentFrame() then |
||
+ | args = f:getParent().args |
||
+ | else |
||
+ | f = mw.getCurrentFrame() |
||
+ | end |
||
+ | |||
+ | -- Контейнер интерфейса |
||
+ | local body = mw.html.create('div') |
||
+ | local recipe = body:tag('span'):addClass('gui-recipe') |
||
+ | |||
+ | -------------------------------------- Используемые функции --------------------------------------- |
||
+ | -- Добавление слота |
||
local slot = require('Модуль:Инвентарный слот').slot |
local slot = require('Модуль:Инвентарный слот').slot |
||
+ | local addSlot = function(args, mod, item, Back_ID, class, style) |
||
− | local text = require('Модуль:Анимация').text |
||
− | local addSlot = function( args, version, mod, item, CSS, class, prefix, default ) |
||
− | prefix = prefix or item |
||
return slot{ |
return slot{ |
||
− | args[item], ["мод"] = mod, [" |
+ | args[item], ["мод"] = mod, ["класс"] = class, ["Фон ИД"] = Back_ID, ["стиль"] = style |
− | ["назв"] = args[prefix .. 'Назв'], ["класс"] = class, ["умолчаниеCSS"] = CSS, ["Версия"] = version |
||
} |
} |
||
end |
end |
||
+ | -- Анимирование текста |
||
− | |||
− | -- Функция анимирования текста |
||
local animate = function(txt) |
local animate = function(txt) |
||
+ | if string.find(txt, ';') then |
||
− | return text{ txt } |
||
+ | local result = {} |
||
+ | for text in mw.text.gsplit( txt, '%s*;%s*' ) do |
||
+ | if text ~= '' then |
||
+ | table.insert( result, '<span>' .. text .. '</span>' ) |
||
+ | end |
||
+ | end |
||
+ | result[1] = result[1]:gsub( '^<span>', '<span class="active">' ) |
||
+ | txt = '<span class="animated">' .. table.concat( result ) .. '</span>' |
||
+ | end |
||
+ | return txt |
||
+ | end |
||
+ | -- Конструктор текста с подсказкой |
||
+ | local help_string = function (HBody, HTitle, HText) |
||
+ | HBody:css('border-bottom','1px dotted') |
||
+ | HBody:css('cursor','help') |
||
+ | HBody:attr('title', HText) |
||
+ | HBody:wikitext(HTitle) |
||
+ | return HBody |
||
+ | end |
||
+ | -- Конструктор строк потребления |
||
+ | local EString = function(EBody_Title, EBody_Help, arg, EBody_Unit) |
||
+ | if not EStrings then |
||
+ | EStrings = body:tag('div'):addClass('gui-energy-lines') |
||
+ | end |
||
+ | local EBody = EStrings:tag('div') |
||
+ | local EBody_Text = EBody:tag('span') |
||
+ | EBody_Text = help_string(EBody_Text, EBody_Title, EBody_Help) |
||
+ | EBody:wikitext(' ' .. animate(arg) .. ' ') |
||
+ | if EBody_Unit then |
||
+ | EBody:wikitext(EBody_Unit) |
||
+ | end |
||
+ | h_size = h_size + 22 |
||
+ | return EBody |
||
end |
end |
||
+ | --------------------------------------------------------------------------------------------------- |
||
+ | -- Параметры машины |
||
− | -- Экспортируемые функции |
||
− | local |
+ | local versions = { |
+ | ["GregTech 4"] = 'GregTech 4', |
||
+ | ["gt4"] = 'GregTech 4', |
||
+ | ["GT4"] = 'GregTech 4', |
||
+ | ["GregTech 5"] = 'GregTech 5', |
||
+ | ["gt5"] = 'GregTech 5', |
||
+ | ["GT5"] = 'GregTech 5', |
||
+ | ["GregTech 5 Unofficial"] = 'GregTech 5 Unofficial', |
||
+ | ["gt5u"] = 'GregTech 5 Unofficial', |
||
+ | ["GT5U"] = 'GregTech 5 Unofficial', |
||
+ | ["GregTech 6"] = 'GregTech 6', |
||
+ | ["gt6"] = 'GregTech 6', |
||
+ | ["GT6"] = 'GregTech 6', |
||
+ | ["IndustrialCraft 2"] = 'IndustrialCraft 2', |
||
+ | ["ic2"] = 'IndustrialCraft 2', |
||
+ | ["IC2"] = 'IndustrialCraft 2', |
||
+ | ["Metallurgy"] = 'Metallurgy', |
||
+ | '&4Неизвестна', |
||
+ | } |
||
+ | local progress = args["Прогресс"] |
||
+ | local machine_list = {} |
||
− | p.interface = function( f ) |
||
− | + | local machine = {} |
|
+ | local furnace_like = true |
||
− | if f == mw.getCurrentFrame() then |
||
+ | local class2 = 'invslot-large' |
||
− | args = f:getParent().args |
||
+ | if progress then |
||
− | else |
||
+ | version = args["Версия"] or mw.ustring.match(progress, ':%s*([a-zA-Zа-яА-ЯёЁ 0-9]+)') or args["Мод"] |
||
− | f = mw.getCurrentFrame() |
||
+ | progress = mw.ustring.match(progress, '([a-zA-Zа-яА-ЯёЁ 0-9]+):') or progress |
||
− | end |
||
− | |||
− | -- Параметры машины |
||
− | local machine_list = mw.loadData('Модуль:Обработка/Машины') |
||
− | local versions = { |
||
− | ["GregTech 4"] = 'GregTech 4', |
||
− | ["gt4"] = 'GregTech 4', |
||
− | ["GT4"] = 'GregTech 4', |
||
− | ["GregTech 5"] = 'GregTech 5', |
||
− | ["gt5"] = 'GregTech 5', |
||
− | ["GT5"] = 'GregTech 5', |
||
− | ["GregTech 5 Unofficial"] = 'GregTech 5 Unofficial', |
||
− | ["gt5u"] = 'GregTech 5 Unofficial', |
||
− | ["GT5U"] = 'GregTech 5 Unofficial', |
||
− | ["GregTech 6"] = 'GregTech 6', |
||
− | ["gt6"] = 'GregTech 6', |
||
− | ["GT6"] = 'GregTech 6', |
||
− | ["IndustrialCraft 2"] = 'IndustrialCraft 2', |
||
− | ["ic2"] = 'IndustrialCraft 2', |
||
− | ["IC2"] = 'IndustrialCraft 2', |
||
− | ["Оригинальная игра"] = 'Оригинальная игра', |
||
− | '&4Неизвестна', |
||
− | } |
||
− | local version |
||
− | local progress = args["Прогресс"] |
||
− | local mod |
||
− | |||
− | if args["Мод"] ~= '' then |
||
− | mod = args["Мод"] |
||
− | end |
||
− | |||
− | if progress then |
||
− | version = mw.ustring.match(progress, ':%s*([a-zA-Zа-яА-ЯёЁ 0-9]+)') or args["Версия"] or mod or 'Оригинальная игра' |
||
− | progress = mw.ustring.match(progress, '([a-zA-Zа-яА-ЯёЁ 0-9]+):') or progress or '&4Неизвестная машина' |
||
− | else |
||
− | version = args["Версия"] or 'Оригинальная игра' |
||
− | progress = 'Печь' |
||
− | end |
||
− | |||
if version then |
if version then |
||
− | if versions[version] then |
+ | if versions[version] then |
version = versions[version] |
version = versions[version] |
||
+ | machine_list = mw.loadData('Модуль:Обработка/' .. version) |
||
+ | machine = machine_list[progress] |
||
+ | furnace_like = false |
||
+ | class2 = machine["Out_class"] or '' |
||
else |
else |
||
− | version = versions[1] |
||
end |
end |
||
− | end |
||
− | |||
− | if version == "GregTech 4" or version == "IndustrialCraft 2" then |
||
− | mod = mod or version |
||
− | elseif version == "GregTech 6" or version == "GregTech 5" or version == "GregTech 5 Unofficial" then |
||
− | mod = mod or 'GregTech' |
||
else |
else |
||
− | + | version = versions[1] |
|
+ | body:wikitext('[[Категория:Страницы с неизвестной версией машин]]') |
||
− | end |
||
− | |||
− | local machine |
||
− | if machine_list[version] then |
||
− | machine = args["Машина"] or machine_list[version][progress]["I"] or '23231313004' |
||
− | else |
||
− | machine = '21110000102' |
||
− | end |
||
− | |||
− | -- Строк ячеек ресурса |
||
− | local input_rows = string.sub(machine,1,1) or '1' |
||
− | -- Столбцов ячеек ресурса |
||
− | local input_cols = string.sub(machine,2,2) or '1' |
||
− | -- Строк ячеек выхода |
||
− | local output_rows = string.sub(machine,3,3) or '1' |
||
− | -- Столбцов ячеек выхода |
||
− | local output_cols = string.sub(machine,4,4) or '1' |
||
− | -- Строк ячеек жидкого ресурса |
||
− | local fluid_input_rows = string.sub(machine,5,5) or '0' |
||
− | -- Столбцов ячеек жидкого ресурса |
||
− | local fluid_input_cols = string.sub(machine,6,6) or '0' |
||
− | -- Строк ячеек жидкого выхода |
||
− | local fluid_output_rows = string.sub(machine,7,7) or '0' |
||
− | -- Столбцов ячеек жидкого выхода |
||
− | local fluid_output_cols = string.sub(machine,8,8) or '0' |
||
− | -- Иконка между ячейками ресурсов |
||
− | local input_pic = string.sub(machine,9,9) or '0' |
||
− | -- Центральная ячейка |
||
− | local mid_input = string.sub(machine,10,10) or '0' |
||
− | -- Cтиль интерфейса |
||
− | local backImg = string.sub(machine,11,11) or '0' |
||
− | -- Оригинальное название |
||
− | local OrigName = mw.ustring.match(machine, ',%s*([-/()a-zA-Z 0-9]+)') or '' |
||
− | |||
− | -- Иконка реакции |
||
− | local fuelImg |
||
− | if input_pic ~= '0' then |
||
− | if machine_list[version] and version ~= 'Оригинальная игра' then |
||
− | fuelImg = machine_list[version][progress]["Image"] |
||
− | elseif ( args["Расход"] and mod ~= '' ) then |
||
− | fuelImg = '[[Файл:Grid layout ' .. args["Расход"] .. ' (' .. mod .. ').png|link=|alt=]]' |
||
− | else |
||
− | fuelImg = '[[Файл:layout_furnace_fire.png|link=|alt=]]' |
||
− | end |
||
end |
end |
||
+ | else |
||
+ | machine = { |
||
+ | ["Image"]="[[Файл:Layout_fire.gif|link=|36px|class=pixel-image]]", |
||
+ | ["Def_args"] = {["Топливо"] = "v:Любое топливо"}} |
||
+ | progress = 'Печь' |
||
+ | end |
||
+ | local mod = args["Мод"] or machine_list['def_mod'] |
||
-- Предопределённые аргументы |
-- Предопределённые аргументы |
||
+ | if machine["Def_args"] then |
||
− | if machine_list[version] and machine_list[version][progress] and machine_list[version][progress]["Def_args"] then |
||
− | + | for k,v in pairs(machine["Def_args"]) do |
|
− | + | args[k] = args[k] or v |
|
− | end |
||
end |
end |
||
+ | end |
||
+ | -- Конфигурация ячеек |
||
− | -- Определитель фоновой картинки |
||
+ | local machine_code = args["Машина"] or machine[1] or '21110000' |
||
− | local style = { |
||
+ | local input_rows = string.sub(machine_code,1,1) * 1 |
||
− | ['0'] = 'gt-gui', |
||
+ | local input_cols = string.sub(machine_code,2,2) * 1 |
||
− | ['1'] = 'gt-gui-bronze', |
||
+ | local output_rows = string.sub(machine_code,3,3) * 1 |
||
− | ['2'] = 'craft-gui', |
||
+ | local output_cols = string.sub(machine_code,4,4) * 1 |
||
− | ['3'] = 'gt-gui-brick', |
||
+ | local fluid_input_rows = string.sub(machine_code,5,5) * 1 |
||
− | ['4'] = 'gt-gui', |
||
+ | local fluid_input_cols = string.sub(machine_code,6,6) * 1 |
||
− | } |
||
+ | local fluid_output_rows = string.sub(machine_code,7,7) * 1 |
||
− | style = style[backImg] |
||
+ | local fluid_output_cols = string.sub(machine_code,8,8) * 1 |
||
− | |||
− | -- Регулятор класса ячейки получаемых предметов |
||
− | local class1 |
||
− | local class2 |
||
− | local large = '0' |
||
− | if backImg == '1' then |
||
− | class1 = 'bronze_invslot' |
||
− | class2 = 'bronze_invslot' |
||
− | elseif input_pic == '1' and output_cols * output_rows == 1 then |
||
− | class2 = 'invslot-large' |
||
− | large = '8' |
||
− | end |
||
+ | -- Определитель стиля |
||
− | -- Определители отступов |
||
− | + | local class1 = '' |
|
+ | if class2 == 'invslot-large' then |
||
− | local margin_input_diff = 0 |
||
+ | large = 16 |
||
− | local margin_fluid_input_diff = 0 |
||
+ | else |
||
− | local v_margin_input_1 = 0 |
||
+ | large = 0 |
||
− | local v_margin_input_2 = 0 |
||
+ | end |
||
+ | local style = machine_list["Skin"] or 'craft-gui' |
||
+ | if machine["Skin"] then |
||
+ | style = style .. '-' .. machine["Skin"] |
||
+ | class1 = machine["Skin"] .. '_invslot' |
||
+ | end |
||
+ | -- Иконка реакции |
||
− | local max_output_cols = 0 |
||
− | + | local input_pic = 0 |
|
+ | if (machine_list["Image"] or machine["Image"]) and machine["Image"] ~= 'None' then |
||
− | local v_margin_output_2 = 0 |
||
+ | fuelImg = machine["Image"] or machine_list["Image"] |
||
− | |||
+ | input_pic = 1 |
||
− | -- Определитель расширения высоты шаблона |
||
+ | elseif args["Расход"] then |
||
− | local h_size = 140 |
||
+ | fuelImg = '[[Файл:Grid layout ' .. args["Расход"] .. ' (' .. version .. ').png|link=]]' |
||
+ | input_pic = 1 |
||
+ | end |
||
-- Переопределение количества получаемых предметов (1-4) |
-- Переопределение количества получаемых предметов (1-4) |
||
− | + | if args["Уровень"] then |
|
− | + | output_rows = math.floor (args["Уровень"] / 4) + 1 |
|
− | + | output_cols = args["Уровень"] / output_rows |
|
− | + | end |
|
− | -- Предопределение или конвертация некоторых аргументов |
+ | -- Предопределение или конвертация некоторых аргументов |
− | + | args["Шанс1"] = args["Шанс1"] or args["Шанс"] |
|
− | + | args["Ресурс1"] = args["Ресурс1"] or args["Ресурс"] or args[1] |
|
− | + | args["Ресурс2"] = args["Ресурс2"] or args["Топливо"] or args["топливо"] |
|
− | + | args["Выход1"] = args["Выход1"] or args["Выход"] or args[2] |
|
− | + | args["Опыт"] = args["Опыт"] or args[3] |
|
− | + | args["РесурсЖ1"] = args["РесурсЖ1"] or args["РесурсЖ"] |
|
− | + | args["РЖК1"] = args["РЖК1"] or args["РЖК"] |
|
− | + | args["РЖТ1"] = args["РЖТ1"] or args["РЖТ"] |
|
− | + | args["ВыходЖ1"] = args["ВыходЖ1"] or args["ВыходЖ"] |
|
− | + | args["ВЖК1"] = args["ВЖК1"] or args["ВЖК"] |
|
+ | args["ВЖТ1"] = args["ВЖТ1"] or args["ВЖТ"] |
||
− | + | if args["Выход7"] and progress == 'Просеиватель' and version == 'GregTech 6' then |
|
− | + | args["Шанс1"] = '0.01' |
|
− | + | args["Шанс2"] = '01' |
|
− | + | args["Шанс3"] = '04' |
|
− | + | args["Шанс4"] = '15' |
|
− | + | args["Шанс5"] = '20' |
|
− | + | args["Шанс6"] = '40' |
|
− | + | args["Шанс7"] = '50' |
|
− | + | end |
|
+ | |||
− | |||
− | -- Реорганизация интерфейса некоторых машин |
||
− | if args["ОднаСтрока"] |
||
− | then |
||
− | input_rows = '0' |
||
− | fluid_input_cols = '2' |
||
− | args["РесурсЖ2"] = args["Ресурс1"] |
||
− | end |
||
− | |||
-- Параметры стрелки прогресса |
-- Параметры стрелки прогресса |
||
+ | if machine_list['Параметры'] then |
||
− | local arrowtext = '&3' .. progress |
||
+ | param = machine_list['Параметры'] |
||
− | if OrigName and OrigName ~= '' then |
||
+ | else |
||
− | arrowtext = arrowtext .. '/&9' .. OrigName |
||
+ | param = { |
||
− | end |
||
+ | ['sprite_size'] = 140, |
||
− | if version ~= 'Оригинальная игра' then |
||
+ | ['scale'] = 2, |
||
− | arrowtext = arrowtext .. '//&7Модификация:/' |
||
+ | ["default_ID"] = 1, |
||
− | end |
||
+ | ["arrow_width"] = 28, |
||
− | local ArrowIds = mw.loadData('Модуль:Обработка/Стрелки') |
||
+ | ["arrow_height"] = 24 |
||
− | local param = {} |
||
+ | } |
||
− | if ArrowIds[version] and ArrowIds[version]['Параметры'] then |
||
+ | end |
||
− | param = ArrowIds[version]['Параметры'] |
||
+ | local size = param['arrow_width'] -- ширина спрайта в пикселях |
||
− | else |
||
+ | local v_size = param['arrow_height'] -- высота спрайта в пикселях |
||
− | param = { |
||
+ | local pos = (machine['arrow_ID'] or param["default_ID"]) - 1 -- положение спрайта в таблице |
||
− | ["формат"] = 280, |
||
+ | local sheetWidth = param['sprite_size'] -- ширина таблицы спрайта в пикселях |
||
− | ["масштаб"] = 1, |
||
+ | local tiles = sheetWidth / size -- количество спрайтов в одной строке |
||
− | ["поз"] = 1, |
||
+ | local left = pos % tiles * size -- горизонтальная координата спрайта |
||
− | ["верт_разм"] = 48, |
||
+ | local top = math.floor(pos / tiles) * v_size -- вертикальная координата спрайта |
||
− | ["разм"] = 56, |
||
+ | local scale = param['scale'] -- масштаб спрайта (во сколько раз увеличить или уменьшить размер) |
||
− | } |
||
+ | local arrow_width = (machine['arrow_width'] or size) * scale -- ширина спрайта с учётом масштаба |
||
− | end |
||
+ | local arrow_height = (machine['arrow_height'] or v_size) * scale -- высота спрайта с учётом масштаба |
||
− | local ArrowID = 1 |
||
− | local arrow_version = version |
||
− | if version ~= '&4Неизвестна' and version ~= 'Оригинальная игра' then |
||
− | if ArrowIds[version] and ArrowIds[version][progress] then |
||
− | ArrowID = ArrowIds[version][progress] |
||
− | else |
||
− | arrowtext = arrowtext .. ' &4(Нет стрелки)' |
||
− | end |
||
− | else |
||
− | arrow_version = 'GregTech 4' |
||
− | end |
||
− | if version == 'GregTech 5 Unofficial' then |
||
− | arrow_version = 'GregTech 5' |
||
− | end |
||
− | local size = param["разм"] -- ширина спрайта в пикселях |
||
− | local v_size = param["верт_разм"] -- размер спрайта в пикселях в высоту |
||
− | local pos = ArrowID - 1 -- положение спрайта в таблице |
||
− | local sheetWidth = param["формат"] -- ширина таблицы спрайта в пикселях |
||
− | local tiles = sheetWidth / size -- количество спрайтов в одной строке |
||
− | local left = pos % tiles * size -- горизонтальная координата спрайта |
||
− | local top = math.floor(pos / tiles ) * v_size -- вертикальная координата спрайта |
||
− | local scale = param["масштаб"] -- масштаб спрайта (во сколько раз увеличить или уменьшить размер) |
||
− | local scaledsize = size * scale -- ширина спрайта с учётом масштаба |
||
− | |||
− | -- Размеры особой стрелки |
||
− | local arrow_height |
||
− | if args['высота_стрелки'] then |
||
− | arrow_height = args['высота_стрелки'] * scale |
||
− | else |
||
− | arrow_height = v_size * scale |
||
− | end |
||
− | local arrow_width |
||
− | if args['ширина_стрелки'] then |
||
− | arrow_width = args['ширина_стрелки'] * scale |
||
− | else |
||
− | arrow_width = scaledsize |
||
− | end |
||
− | |||
− | -- вычисление ширины зоны исходных ресурсов и разницы между количеством столбцов предметов и жидких ресурсов |
||
− | if input_cols >= fluid_input_cols |
||
− | then |
||
− | max_input_cols = input_cols |
||
− | margin_fluid_input_diff = ( input_cols - fluid_input_cols ) * 36 |
||
− | else |
||
− | max_input_cols = fluid_input_cols |
||
− | margin_input_diff = ( fluid_input_cols - input_cols ) * 36 |
||
− | end |
||
− | -- |
+ | -- Размеры и отступы шаблона |
+ | input_size = math.max(input_cols,fluid_input_cols) * 36 |
||
− | if output_cols >= fluid_output_cols |
||
+ | output_size = math.max(output_cols,fluid_output_cols) * (36 + large) |
||
− | then |
||
− | max_output_cols = output_cols |
||
− | else |
||
− | max_output_cols = fluid_output_cols |
||
− | end |
||
− | + | local h_margin = (270 - output_size - input_size - arrow_width) / 2 |
|
+ | if (input_rows + fluid_input_rows) > 3 or (output_rows + fluid_output_rows) > 3 then |
||
+ | h_size = 150 |
||
+ | else |
||
+ | h_size = 128 |
||
+ | end |
||
+ | recipe:css('margin', '0 ' .. math.floor(0.75 * h_margin) .. 'px') |
||
+ | recipe:css('height', h_size .. 'px') |
||
+ | recipe:css('display', 'inline-flex') |
||
+ | if ( fluid_input_rows * fluid_output_rows * input_rows * output_rows ) > 0 then |
||
− | -- Создание контейнера шаблона |
||
+ | local max_fluid_rows = math.max(fluid_output_rows,fluid_input_rows) |
||
− | local body = mw.html.create('div') |
||
+ | v_margin_input = (h_size - 36 * (input_rows + max_fluid_rows)) / 2 |
||
− | if version == '&4Неизвестна' then |
||
+ | v_margin_output = (h_size - 36 * (output_rows + max_fluid_rows)) / 2 |
||
− | body:wikitext('[[Категория:Страницы с неизвестной версией машин]]') |
||
+ | else |
||
+ | v_margin_input = (h_size - 36 * (input_rows + fluid_input_rows + input_pic)) / (3 - 0 ^ input_rows - 0 ^ fluid_input_rows) |
||
+ | v_margin_output = (h_size - (36 + large) * (output_rows + fluid_output_rows)) / (3 - 0 ^ output_rows - 0 ^ fluid_output_rows) |
||
+ | end |
||
+ | |||
+ | ------------------------------------------ Ячейки ресурсов ---------------------------------------- |
||
+ | local input = recipe:tag('span'):addClass('gt-input') |
||
+ | input:css('width', input_size .. 'px') |
||
+ | if input_rows > 0 then |
||
+ | local item_input = input:tag('div') |
||
+ | item_input:css('margin-top', v_margin_input .. 'px') |
||
+ | if fluid_input_cols > input_cols then |
||
+ | item_input:css('margin-left', (fluid_input_cols - input_cols) * 36 .. 'px') |
||
end |
end |
||
+ | num = 0 |
||
− | |||
− | -- Расширение при большом количестве строк |
||
− | if ( input_rows + fluid_input_rows ) > 3 or ( output_rows + fluid_output_rows ) > 3 then |
||
− | local line = body:tag('div'):addClass('gui-set-line') |
||
− | line:css( 'top', h_size - 9 .. 'px' ) |
||
− | line:css( 'position', 'absolute' ) |
||
− | h_size = h_size + 21 |
||
− | end |
||
− | |||
− | -- центровка ячеек исходного ресурса |
||
− | if ( input_rows == '0' or fluid_input_rows == '0' ) |
||
− | then |
||
− | if fluid_input_rows == '0' |
||
− | then |
||
− | v_margin_input_1 = ( h_size - 36 * ( input_rows + input_pic ) ) / 2 |
||
− | else |
||
− | v_margin_input_1 = ( h_size - 36 * ( fluid_input_rows ) ) / 2 |
||
− | end |
||
− | elseif input_pic ~= '0' then |
||
− | v_margin_input_1 = ( h_size - 36 * ( input_rows + input_pic + fluid_input_rows ) ) / 2 |
||
− | else |
||
− | v_margin_input_1 = ( h_size - 36 * ( input_rows + fluid_input_rows ) ) / 3 |
||
− | v_margin_input_2 = v_margin_input_1 |
||
− | end |
||
− | |||
− | -- центровка ячеек получаемых материалов |
||
− | if ( output_rows == '0' or fluid_output_rows == '0' ) |
||
− | then |
||
− | if fluid_output_rows == '0' |
||
− | then |
||
− | v_margin_output_1 = ( h_size - 36 * ( output_rows ) ) / 2 |
||
− | else |
||
− | v_margin_output_1 = ( h_size - 36 * ( fluid_output_rows ) ) / 2 |
||
− | end |
||
− | else |
||
− | v_margin_output_1 = ( h_size - 36 * ( output_rows + fluid_output_rows ) ) / 3 |
||
− | v_margin_output_2 = v_margin_output_1 |
||
− | end |
||
− | |||
− | -- выравнивание положения жидкостных ячеек |
||
− | if ( fluid_input_rows ~= '0' and fluid_output_rows ~= '0' ) and ( input_rows ~= '0' or output_rows ~= '0') |
||
− | then |
||
− | local max_fluid_rows = fluid_output_rows |
||
− | if fluid_input_rows > fluid_output_rows then |
||
− | max_fluid_rows = fluid_input_rows |
||
− | end |
||
− | v_margin_input_2 = ( h_size - 14 - 36 * ( input_rows + max_fluid_rows ) ) / 2 |
||
− | v_margin_input_1 = v_margin_input_2 + 6 |
||
− | v_margin_output_2 = ( h_size - 14 - 36 * ( output_rows + max_fluid_rows ) ) / 2 |
||
− | v_margin_output_1 = v_margin_output_2 + 6 |
||
− | end |
||
− | |||
− | -- Исходные предметы |
||
− | local input = body:tag('span'):addClass('gt-input') |
||
− | input:css('width', max_input_cols * 36 .. 'px') |
||
− | input:css('left', 0.75 * h_margin .. 'px') |
||
− | input:css('top', v_margin_input_1 .. 'px') |
||
− | input:css('position', 'absolute') |
||
− | local num = 0 |
||
− | local k = 0 |
||
for i = 1, input_rows do |
for i = 1, input_rows do |
||
− | local row = input:tag('span'):addClass('mcui-row') |
||
− | row:css('left', margin_input_diff .. 'px') |
||
− | row:css('top', ( i - 1 + k ) * 36 .. 'px') |
||
− | k = 0 |
||
− | row:css('position', 'absolute') |
||
for j = 1, input_cols do |
for j = 1, input_cols do |
||
num = num + 1 |
num = num + 1 |
||
if args["Ресурс" .. num] ~= 'none' then |
if args["Ресурс" .. num] ~= 'none' then |
||
− | if |
+ | if args["Параметр"] and string.find(args["Ресурс" .. num], 'Интегральная схема') then |
+ | args["Ресурс" .. num] = args["Ресурс" .. num] .. "[&7 Параметр: " .. args["Параметр"] .. "/]" |
||
− | then |
||
+ | end |
||
− | args["Ресурс" .. num] = args["Ресурс" .. num] .. "[&7 Параметр: " .. args["Параметр"] .. "/]" |
||
+ | if machine['slot_back'] then |
||
− | end |
||
+ | s = machine['slot_back']['in' .. num] or machine['slot_back']['in'] |
||
− | local s = mw.ustring.lower(string.gsub(progress,' ','_',5) .. '_in' .. num) |
||
+ | else |
||
− | row:wikitext(addSlot(args, version, mod, 'Ресурс' .. num,s,class1)) |
||
+ | s = nil |
||
+ | end |
||
+ | item_input:wikitext(addSlot(args, mod, 'Ресурс' .. num,s,class1)) |
||
end |
end |
||
end |
end |
||
− | if ( |
+ | if (input_pic == 1 and i == 1) then |
+ | item_input:wikitext(fuelImg .. '<br>') |
||
− | then |
||
+ | end |
||
− | row = input:tag('span'):addClass('mcui-row') |
||
− | row:css('left', margin_input_diff .. 'px') |
||
− | row:css('top', 36 .. 'px') |
||
− | row:css('position', 'absolute') |
||
− | row:wikitext(fuelImg) |
||
− | k = 1 |
||
− | end |
||
end |
end |
||
+ | end |
||
+ | if progress == 'Режущий механизм' then |
||
+ | input:wikitext(addSlot(args, mod, 'Диск',nil,'invslot-plain','position:absolute; top:55px; left:116px')) |
||
+ | end |
||
+ | if machine["Mid_input"] then |
||
+ | if machine['slot_back'] then |
||
+ | s = machine['slot_back']['mid'] |
||
+ | else |
||
+ | s = nil |
||
+ | end |
||
+ | input:wikitext(addSlot(args, mod, 'РесурсЦ',s,'','position:absolute; top:96px; left:' .. 6 + h_margin + input_size + (arrow_width - 36) / 2 .. 'px')) |
||
+ | end |
||
+ | -------------------------------------- Ячейки жидких ресурсов ------------------------------------- |
||
− | -- Переменные для подсказки к жидкостям |
||
+ | if fluid_input_rows > 0 then |
||
− | local rfsplit |
||
+ | local fluid_input = input:tag('div') |
||
− | local rfqsplit |
||
+ | fluid_input:css('text-align', 'right') |
||
− | local rftsplit |
||
+ | if input_pic ~= 1 then |
||
− | local pfsplit |
||
+ | fluid_input:css('margin-top', v_margin_input .. 'px') |
||
− | local pfqsplit |
||
+ | end |
||
− | local pftsplit |
||
− | + | num = 0 |
|
− | |||
− | -- Исходные жидкие ресурсы |
||
− | num = 0 |
||
for i = 1, fluid_input_rows do |
for i = 1, fluid_input_rows do |
||
− | local fluid_row = input:tag('span'):addClass('mcui-row') |
||
− | fluid_row:css('left', margin_fluid_input_diff .. 'px') |
||
− | fluid_row:css('top', (input_rows + input_pic ) * 36 + (i - 1) * 36 + v_margin_input_2 .. 'px') |
||
− | fluid_row:css('position', 'absolute') |
||
for j = 1, fluid_input_cols do |
for j = 1, fluid_input_cols do |
||
num = num + 1 |
num = num + 1 |
||
+ | if machine['slot_back'] then |
||
− | s = mw.ustring.lower(string.gsub(progress,' ','_',5) .. '_fluid_in' .. num) |
||
+ | s = machine['slot_back']['fl_in' .. num] or machine['slot_back']['fl_in'] |
||
− | if args["РесурсЖ" .. num] |
||
− | + | else |
|
+ | s = nil |
||
− | rfsplit = mw.text.split( args["РесурсЖ" .. num] , '%s*;%s*') |
||
+ | end |
||
− | maxn = table.maxn(rfsplit) or 0 |
||
− | + | if args["РесурсЖ" .. num] then |
|
− | + | c = 0 |
|
+ | fl_split = {} |
||
− | rfqsplit = mw.text.split( args["РЖК" .. num] , '%s*;%s*') |
||
+ | fl_quantity = {} |
||
− | if table.maxn(rfqsplit) > maxn then maxn = table.maxn(rfqsplit) end |
||
− | + | fl_temp = {} |
|
− | + | for text in mw.text.gsplit( args["РЖК" .. num] or '', '%s*;%s*' ) do |
|
− | + | if text ~= '' then |
|
+ | table.insert( fl_quantity, '/&9 Объём: ' .. text .. ' мВ/' ) |
||
− | rftsplit = mw.text.split( args["РЖТ" .. num] , '%s*;%s*') |
||
+ | end |
||
− | if table.maxn(rftsplit) > maxn then maxn = table.maxn(rftsplit) end |
||
− | + | end |
|
+ | for text in mw.text.gsplit( args["РЖТ" .. num] or '', '%s*;%s*' ) do |
||
− | for i = 1, maxn do |
||
− | + | if text ~= '' then |
|
+ | table.insert( fl_temp, '&c Температура: ' .. text .. ' К/' ) |
||
− | then |
||
+ | end |
||
− | table.insert( rfsplit,rfsplit[1] ) |
||
− | + | end |
|
− | + | if fl_quantity[1] or fl_temp[1] then |
|
+ | for text in mw.text.gsplit(args["РесурсЖ" .. num] , '%s*;%s*') do |
||
− | rfsplit[i] = rfsplit[i] .. '[' |
||
+ | if text ~= '' then |
||
− | if ( args["Параметр"] and string.find( args["РесурсЖ" .. num], 'Интегральная схема') ) |
||
− | + | c = c + 1 |
|
+ | text = text .. '[' .. (fl_quantity[c] or fl_quantity[1] or '') .. (fl_temp[c] or fl_temp[1] or '') .. ']' |
||
− | rfsplit[i] = rfsplit[i] .. "&7 Параметр: " .. args["Параметр"] .. "/" |
||
− | end |
||
− | if ( args["РЖК" .. num] and rfqsplit and rfqsplit[i] and rfqsplit[i] ~= '' ) |
||
− | then |
||
− | rfsplit[i] = rfsplit[i] .. "/&9 Объём: " .. rfqsplit[i] .. " мВ/" |
||
− | else |
||
− | if ( rfqsplit and rfqsplit[1] ~= '' ) |
||
− | then |
||
− | rfsplit[i] = rfsplit[i] .. "/&9 Объём: " .. rfqsplit[1] .. " мВ/" |
||
− | end |
||
− | end |
||
− | if ( args["РЖТ" .. num] and rftsplit and rftsplit[i] and rftsplit[i] ~= '' ) |
||
− | then |
||
− | rfsplit[i] = rfsplit[i] .. "&c Температура: " .. rftsplit[i] .. " К/" |
||
− | else |
||
− | if ( rftsplit and rftsplit[1] ~= '' ) |
||
− | then |
||
− | rfsplit[i] = rfsplit[i] .. "&c Температура: " .. rftsplit[1] .. " К/" |
||
− | end |
||
− | end |
||
− | rfsplit[i] = rfsplit[i] .. ']' |
||
end |
end |
||
+ | table.insert( fl_split, text ) |
||
end |
end |
||
− | + | args["РесурсЖ" .. num] = table.concat(fl_split , ';') |
|
− | rfsplit = nil |
||
− | rfqsplit = nil |
||
− | rftsplit = nil |
||
end |
end |
||
+ | end |
||
− | fluid_row:wikitext(addSlot(args, version, mod, 'РесурсЖ' .. num,s)) |
||
+ | fluid_input:wikitext(addSlot(args, mod, 'РесурсЖ' .. num,s,'fluid_invslot')) |
||
end |
end |
||
end |
end |
||
+ | end |
||
+ | ---------------------------------------- Стрелка прогресса ---------------------------------------- |
||
− | -- Изображение стрелки прогресса |
||
+ | local arrowtext = '&3' .. progress |
||
− | local arrow = body:tag('span'):addClass('invslot-item ') |
||
+ | if machine[2] then |
||
− | arrow:css('position', 'absolute') |
||
+ | arrowtext = arrowtext .. '/&9' .. machine[2] --англ. название |
||
− | arrow:attr('data-minetip-title','Обработчик:') |
||
+ | end |
||
− | if machine_list[version] and version ~= 'Оригинальная игра' then |
||
+ | if version then |
||
− | arrow:wikitext('[[' .. version .. '/' .. progress .. '|') |
||
− | + | arrowtext = arrowtext .. '//&7Модификация:/' .. version |
|
+ | end |
||
− | local ArrowImg = arrow:tag('span'):addClass('sprite') |
||
+ | local arrow = recipe:tag('span'):addClass('minetip') |
||
− | -- Отступы стрелки |
||
+ | arrow:attr('data-minetip-title','Обработчик:') |
||
− | arrow:css('top', ( 140 - arrow_height - 6 ) / 2 .. 'px') |
||
+ | arrow:attr('data-minetip-text', arrowtext) |
||
− | arrow:css('left', h_margin + max_input_cols * 36 .. 'px') |
||
+ | arrow:css('margin', 'auto ' .. math.floor(0.25 * h_margin) .. 'px') |
||
− | -- |
||
+ | if not furnace_like then |
||
− | ArrowImg:css('background-image', '{{FileUrl|' .. arrow_version .. '_ArrowProcessingCSS.png}}') |
||
+ | arrow:wikitext('[[' .. version .. '/' .. progress .. '|') |
||
− | ArrowImg:css('height', arrow_height .. 'px') |
||
+ | local ArrowImg = arrow:tag('span'):addClass('sprite arrow-' .. machine_list["Arrows"]) |
||
− | ArrowImg:css('width', arrow_width .. 'px') |
||
+ | ArrowImg:css('height', arrow_height .. 'px') |
||
− | -- Координаты |
||
− | + | ArrowImg:css('width', arrow_width .. 'px') |
|
+ | ArrowImg:css('background-position', '-' .. left * scale .. 'px -' .. top * scale ..'px') |
||
− | -- Масштаб |
||
+ | ArrowImg:css('background-size', sheetWidth * scale .. 'px auto') |
||
− | if scale ~= 1 then |
||
+ | arrow:wikitext(']]') |
||
− | ArrowImg:css('background-size', sheetWidth * scale .. 'px auto') |
||
+ | else |
||
− | end |
||
+ | if progress ~= 'Печь' and mod then |
||
− | ArrowImg:wikitext(' ') |
||
+ | arrow:wikitext('[[Файл:Grid layout ' .. progress .. ' Progress (' .. mod .. ').png|link=' .. mod .. '/' .. progress .. ']]') |
||
− | arrow:wikitext(']]') |
||
else |
else |
||
+ | arrow:wikitext('[[Файл:Grid_layout_Furnace_Progress.gif|link=Печь]]') |
||
− | if progress ~= 'Печь' and mod then |
||
− | arrowtext = arrowtext .. mod |
||
− | arrow:wikitext('[[Файл:Grid layout ' .. progress .. ' Progress (' .. mod .. ').png|link=' .. mod .. '/' .. progress .. ']]') |
||
− | else |
||
− | arrow:wikitext('[[Файл:Grid_layout_Furnace_Progress.png|link=Печь]]') |
||
− | end |
||
− | arrow:css('left', h_margin + max_input_cols * 36 - 25 .. 'px') |
||
− | arrow:css('top', '52px') |
||
− | arrow:css('width', '100px') |
||
end |
end |
||
− | arrow: |
+ | arrow:css('width', arrow_width .. 'px') |
+ | end |
||
+ | if progress == 'Формовщик металла' and args["Режим"] then |
||
+ | local mode = recipe:tag('div'):addClass('minetip') |
||
+ | mode:css('position', 'absolute') |
||
+ | mode:css('top', '86px') |
||
+ | mode:css('left', '113px') |
||
+ | mode:attr('data-minetip-title','Режим: ' .. args["Режим"]) |
||
+ | mode:wikitext('[[Файл:Формовщик металла_(' .. args["Режим"] .. ')_(IndustrialCraft 2).png|link=]]') |
||
+ | end |
||
+ | ----------------------------------------- Ячейки продуктов ---------------------------------------- |
||
− | -- Центральная ячейка |
||
+ | local output = recipe:tag('span'):addClass('gt-output') |
||
− | for i = 1, mid_input do |
||
+ | output:css('width', output_size .. 'px') |
||
− | local mid_cell = body:tag('span'):addClass('mcui-row') |
||
+ | num = 0 |
||
− | mid_cell:css('position', 'absolute') |
||
+ | if output_rows > 0 then |
||
− | if progress ~= 'Режущий механизм' then |
||
+ | local item_output = output:tag('div') |
||
− | mid_cell:css('left', h_margin + max_input_cols * 36 + ( arrow_width - 36 ) / 2 .. 'px') |
||
− | + | item_output:css('margin-top', v_margin_output .. 'px') |
|
− | s = mw.ustring.lower(string.gsub(progress,' ','_',5) .. '_mid') |
||
− | mid_cell:wikitext(addSlot(args, version, mod, 'РесурсЦ',s)) |
||
− | else |
||
− | mid_cell:css('left', h_margin + max_input_cols * 36 + ( arrow_width - 36 ) / 2 + 2 .. 'px') |
||
− | mid_cell:css('top', '54px') |
||
− | mid_cell:wikitext(addSlot(args, version, mod, 'Диск','','invslot-plain')) |
||
− | end |
||
− | end |
||
− | |||
− | -- Получаемые предметы |
||
− | local output = body:tag('span'):addClass('gt-output') |
||
− | output:css('width', max_output_cols * 36 .. 'px') |
||
− | output:css('left', 1.25 * h_margin + max_input_cols * 36 + arrow_width .. 'px') |
||
− | output:css('top', v_margin_output_1 - large .. 'px') |
||
− | output:css('position', 'absolute') |
||
− | num = 0 |
||
for i = 1, output_rows do |
for i = 1, output_rows do |
||
− | row = output:tag('span'):addClass('mcui-row') |
||
− | row:css('left', '0') |
||
− | row:css('top', ( i - 1 ) * 36 .. 'px') |
||
− | row:css('position', 'absolute') |
||
for j = 1, output_cols do |
for j = 1, output_cols do |
||
− | + | num = num + 1 |
|
+ | if machine['slot_back'] then |
||
− | s = mw.ustring.lower(string.gsub(progress,' ','_',5) .. '_out' .. num) |
||
+ | s = machine['slot_back']['out' .. num] or machine['slot_back']['out'] |
||
− | if args["Шанс" .. num] |
||
− | + | else |
|
+ | s = nil |
||
− | local rfsplit = mw.text.split( args["Выход" .. num] , '%s*;%s*') |
||
+ | end |
||
− | local rfqsplit = mw.text.split( args["Шанс" .. num] , '%s*;%s*') |
||
+ | if args["Шанс" .. num] then |
||
− | while table.maxn(rfqsplit) > table.maxn(rfsplit) |
||
− | + | c = 0 |
|
+ | pr_split = {} |
||
− | table.insert(rfsplit,rfsplit[1]) |
||
− | + | pr_chance = {} |
|
+ | for text in mw.text.gsplit( args["Шанс" .. num] or '', '%s*;%s*' ) do |
||
− | while table.maxn(rfsplit) > table.maxn(rfqsplit) |
||
− | + | if text ~= '' then |
|
− | + | table.insert( pr_chance, '[&7 Шанс получения: ' .. text .. '%/]' ) |
|
− | end |
||
− | for i = 1, table.maxn(rfsplit) do |
||
− | if ( rfqsplit[i] and rfqsplit[i] > '0' ) |
||
− | then |
||
− | rfsplit[i] = rfsplit[i] .. "[&7 Шанс получения: " .. rfqsplit[i] .. "%/]" |
||
− | end |
||
− | args["Выход" .. num] = table.concat(rfsplit , ';') |
||
end |
end |
||
end |
end |
||
− | + | for text in mw.text.gsplit(args["Выход" .. num] , '%s*;%s*') do |
|
+ | if text ~= '' then |
||
+ | c = c + 1 |
||
+ | text = text .. (pr_chance[c] or pr_chance[1] or '') |
||
+ | end |
||
+ | table.insert( pr_split, text ) |
||
+ | end |
||
+ | args["Выход" .. num] = table.concat(pr_split , ';') |
||
+ | end |
||
+ | item_output:wikitext(addSlot(args, mod, 'Выход' .. num,s,class1 .. ' ' .. class2)) |
||
end |
end |
||
end |
end |
||
+ | end |
||
− | -- Строка текста под получаемыми ресурсами |
+ | -- Строка текста под получаемыми ресурсами |
+ | if args["Температура"] or args["Опыт"] then |
||
− | local margin_out_2 = output:tag('span'):addClass('mcui-row') |
||
− | margin_out_2: |
+ | local margin_out_2 = output:tag('div') |
− | margin_out_2:css(' |
+ | margin_out_2:css('margin-top','6px') |
+ | if args["Температура"] then |
||
− | margin_out_2:wikitext(' ') |
||
+ | local margin_out_2_text = margin_out_2:tag('span') |
||
− | if args["Температура"] |
||
+ | margin_out_2_text = help_string(margin_out_2_text, animate(args["Температура"]) .. ' К', 'Необходимая температура печи в кельвинах.') |
||
− | then |
||
+ | elseif args["Опыт"] then |
||
− | margin_out_2:css('left', '0') |
||
− | + | margin_out_2:css('font-family', 'Minecraft-ru, sans-serif') |
|
+ | margin_out_2:wikitext(require('Модуль:Спрайт').base{ ['изобр'] = 'Сферы_опыта.png', ['выравн'] = 'text-bottom' }) |
||
− | local margin_out_2text = margin_out_2:tag('span') |
||
+ | local margin_out_3_text = margin_out_2:tag('span') |
||
− | margin_out_2text:css('border-bottom','1px dotted') |
||
+ | margin_out_3_text = help_string(margin_out_3_text, animate(args["Опыт"]), 'Дробная часть показывает вероятность получения единицы опыта.') |
||
− | margin_out_2text:css('cursor','help') |
||
+ | end |
||
− | margin_out_2text:attr('title','Необходимая температура печи в кельвинах.') |
||
+ | end |
||
− | margin_out_2text:wikitext( animate( args["Температура"] ) .. ' К' ) |
||
− | end |
||
− | if args["Опыт"] |
||
− | then |
||
− | margin_out_2:css('left', '-16px') |
||
− | margin_out_2:css('font-weight', 'bold') |
||
− | margin_out_2:css('font-family', 'Minecraft-ru, sans-serif') |
||
− | local margin_out_2text = margin_out_2:tag('span') |
||
− | margin_out_2text:css('border-bottom','1px dotted') |
||
− | margin_out_2text:css('cursor','help') |
||
− | margin_out_2text:attr('title','Дробная часть показывает вероятность получения единицы опыта.') |
||
− | margin_out_2text:wikitext( 'Опыт:' .. animate( args["Опыт"] ) ) |
||
− | end |
||
+ | -------------------------------------- Ячейки жидких продуктов ------------------------------------ |
||
− | -- Получаемые жидкие ресурсы |
||
+ | if fluid_output_rows > 0 then |
||
− | num = 0 |
||
+ | local fluid_output = output:tag('div') |
||
+ | fluid_output:css('margin-top', v_margin_output .. 'px') |
||
+ | fluid_output:css('text-align','left') |
||
+ | num = 0 |
||
for i = 1, fluid_output_rows do |
for i = 1, fluid_output_rows do |
||
− | fluid_row = output:tag('span'):addClass('mcui-row') |
||
− | fluid_row:css('left', '0') |
||
− | fluid_row:css('top', output_rows * 36 + (i - 1) * 36 + v_margin_output_2 .. 'px') |
||
− | fluid_row:css('position', 'absolute') |
||
for j = 1, fluid_output_cols do |
for j = 1, fluid_output_cols do |
||
− | + | num = num + 1 |
|
+ | if machine['slot_back'] then |
||
− | s = mw.ustring.lower(string.gsub(progress,' ','_',5) .. '_fluid_out' .. num) |
||
+ | s = machine['slot_back']['fl_out' .. num] or machine['slot_back']['fl_out'] |
||
− | if args["ВыходЖ" .. num] |
||
− | + | else |
|
+ | s = nil |
||
− | pfsplit = mw.text.split( args["ВыходЖ" .. num] , '%s*;%s*') |
||
+ | end |
||
− | maxn = table.maxn(pfsplit) or 0 |
||
− | + | if args["ВыходЖ" .. num] then |
|
− | + | c = 0 |
|
+ | fl_split = {} |
||
− | pfqsplit = mw.text.split( args["ВЖК" .. num] , '%s*;%s*') |
||
+ | fl_quantity = {} |
||
− | if table.maxn(pfqsplit) > maxn then maxn = table.maxn(pfqsplit) end |
||
− | + | fl_temp = {} |
|
− | + | for text in mw.text.gsplit( args["ВЖК" .. num] or '', '%s*;%s*' ) do |
|
− | + | if text ~= '' then |
|
+ | table.insert( fl_quantity, '/&9 Объём: ' .. text .. ' мВ/' ) |
||
− | pftsplit = mw.text.split( args["ВЖТ" .. num] , '%s*;%s*') |
||
+ | end |
||
− | if table.maxn(pftsplit) > maxn then maxn = table.maxn(pftsplit) end |
||
− | + | end |
|
+ | for text in mw.text.gsplit( args["ВЖТ" .. num] or '', '%s*;%s*' ) do |
||
− | for i = 1, maxn do |
||
− | + | if text ~= '' then |
|
+ | table.insert( fl_temp, '&c Температура: ' .. text .. ' К/' ) |
||
− | then |
||
+ | end |
||
− | table.insert( pfsplit,pfsplit[1] ) |
||
− | + | end |
|
− | + | if fl_quantity[1] or fl_temp[1] then |
|
+ | for text in mw.text.gsplit(args["ВыходЖ" .. num] , '%s*;%s*') do |
||
− | pfsplit[i] = pfsplit[i] .. '[' |
||
+ | if text ~= '' then |
||
− | if ( args["Параметр"] and string.find( args["ВыходЖ" .. num], 'Интегральная схема') ) |
||
− | + | c = c + 1 |
|
+ | text = text .. '[' .. (fl_quantity[c] or fl_quantity[1] or '') .. (fl_temp[c] or fl_temp[1] or '') .. ']' |
||
− | pfsplit[i] = pfsplit[i] .. "&7 Параметр: " .. args["Параметр"] .. "/" |
||
− | end |
||
− | if ( args["ВЖК" .. num] and pfqsplit and pfqsplit[i] and pfqsplit[i] ~= '' ) |
||
− | then |
||
− | pfsplit[i] = pfsplit[i] .. "/&9 Объём: " .. pfqsplit[i] .. " мВ/" |
||
− | else |
||
− | if ( pfqsplit and pfqsplit[1] ~= '' ) |
||
− | then |
||
− | pfsplit[i] = pfsplit[i] .. "/&9 Объём: " .. pfqsplit[1] .. " мВ/" |
||
− | end |
||
− | end |
||
− | if ( args["ВЖТ" .. num] and pftsplit and pftsplit[i] and pftsplit[i] ~= '' ) |
||
− | then |
||
− | pfsplit[i] = pfsplit[i] .. "&c Температура: " .. pftsplit[i] .. " К/" |
||
− | else |
||
− | if ( pftsplit and pftsplit[1] ~= '' ) |
||
− | then |
||
− | pfsplit[i] = pfsplit[i] .. "&c Температура: " .. pftsplit[1] .. " К/" |
||
− | end |
||
− | end |
||
− | pfsplit[i] = pfsplit[i] .. ']' |
||
end |
end |
||
+ | table.insert( fl_split, text ) |
||
end |
end |
||
− | + | args["ВыходЖ" .. num] = table.concat(fl_split , ';') |
|
− | pfsplit = nil |
||
− | pfqsplit = nil |
||
− | pftsplit = nil |
||
end |
end |
||
+ | end |
||
− | fluid_row:wikitext(addSlot(args, version, mod, 'ВыходЖ' .. num,s)) |
||
+ | fluid_output:wikitext(addSlot(args, mod, 'ВыходЖ' .. num,s,'fluid_invslot')) |
||
end |
end |
||
end |
end |
||
+ | end |
||
− | |||
− | h_size = h_size - 9 |
||
− | -- Добавление строки общего потребления пара |
||
− | if args["Пар"] |
||
− | then |
||
− | local vape = body:tag('div'):addClass('gui-set-line') |
||
− | vape:css( 'top', h_size .. 'px' ) |
||
− | local vape_text = vape:tag('span'):addClass('mcui-row') |
||
− | vape_text:css( 'margin-left', '22px' ) |
||
− | vape_text:css( 'text-align', 'left' ) |
||
− | vape_text:wikitext('Затраты пара: ' .. animate( args["Пар"] ) .. ' ') |
||
− | local vapeunit = vape:tag('span') |
||
− | vapeunit:css('font-weight', 'bold') |
||
− | vapeunit:css('border-bottom','1px dotted') |
||
− | vapeunit:css('cursor','help') |
||
− | vapeunit:attr('title','Милливедро (мВ) — единица объёма условно равная 1/1000 части ведра.') |
||
− | vapeunit:wikitext('мВ') |
||
− | h_size = h_size + 21 |
||
− | end |
||
+ | ---------------------------------------- Строки потребления --------------------------------------- |
||
− | -- Добавление строки энергии, требуемой для запуска реактора |
||
− | + | if args["Пар"] then |
|
+ | local vape = EString ('Пар:' , 'Объём пара, требующийся для проведения операции.' , args ["Пар"]) |
||
− | then |
||
− | + | local vapeunit = vape:tag('span') |
|
+ | vapeunit = help_string(vapeunit, 'мВ', 'Милливедро (мВ) — единица объёма условно равная 1/1000 части ведра.') |
||
− | start:css( 'top', h_size .. 'px' ) |
||
+ | end |
||
− | local start_text = start:tag('span'):addClass('mcui-row') |
||
− | start_text:css( 'margin-left', '22px' ) |
||
− | start_text:css( 'text-align', 'left' ) |
||
− | local starttext = start:tag('span') |
||
− | starttext:css('border-bottom','1px dotted') |
||
− | starttext:css('cursor','help') |
||
− | starttext:attr('title','Энергия, требующаяся на запуск процесса.') |
||
− | starttext:wikitext('Старт:') |
||
− | start:wikitext(' ' .. animate( args["Старт"] ) .. ' [[IndustrialCraft_2|еЭ]]') |
||
− | h_size = h_size + 21 |
||
− | end |
||
+ | if args["Старт"] then |
||
− | -- Добавление строки общего потребления энергии |
||
+ | local start = EString ('Старт:' , 'Энергия, требующаяся на запуск процесса.' , args ["Старт"], '[[IndustrialCraft_2|еЭ]]') |
||
− | if args["Энергия"] |
||
+ | end |
||
− | then |
||
− | local energy = body:tag('div'):addClass('gui-set-line') |
||
− | energy:css( 'top', h_size .. 'px' ) |
||
− | local energy_text = energy:tag('span'):addClass('mcui-row') |
||
− | energy_text:css( 'margin-left', '22px' ) |
||
− | energy_text:css( 'text-align', 'left' ) |
||
− | local energytext = energy:tag('span') |
||
− | energytext:css('border-bottom','1px dotted') |
||
− | energytext:css('cursor','help') |
||
− | energytext:attr('title','Энергия, затрачиваемая на каждую операцию.') |
||
− | energytext:wikitext('Энергия:') |
||
− | energy:wikitext(' ' .. animate( args["Энергия"] ) .. ' [[IndustrialCraft_2|еЭ]]') |
||
− | h_size = h_size + 21 |
||
− | end |
||
+ | if args["Энергия"] then |
||
− | -- Добавление строки скорости потребления энергии |
||
+ | local energy = EString ('Энергия:' , 'Энергия, затрачиваемая на каждую операцию.' , args ["Энергия"], '[[IndustrialCraft_2|еЭ]]') |
||
− | if args["Потребление"] |
||
+ | end |
||
− | then |
||
− | local consumption = body:tag('div'):addClass('gui-set-line') |
||
− | consumption:css( 'top', h_size .. 'px' ) |
||
− | local consumption_text = consumption:tag('span'):addClass('mcui-row') |
||
− | consumption_text:css( 'margin-left', '22px' ) |
||
− | consumption_text:css( 'text-align', 'left' ) |
||
− | local consumptiontext = consumption:tag('span') |
||
− | consumptiontext:css('border-bottom','1px dotted') |
||
− | consumptiontext:css('cursor','help') |
||
− | consumptiontext:attr('title','Скорость потребления энергии.') |
||
− | consumptiontext:wikitext('Потребление:') |
||
− | consumption:wikitext(' ' .. animate( args["Потребление"] ) .. ' [[IndustrialCraft_2|еЭ]]/[[Такт|т]]') |
||
− | h_size = h_size + 21 |
||
− | end |
||
+ | if args["Потребление"] then |
||
− | -- Добавление строки напряжения |
||
+ | local consumption = EString ('Потребление:' , 'Скорость потребления энергии.' , args ["Потребление"], '[[IndustrialCraft_2|еЭ]]/[[Такт|т]]') |
||
− | if args["Напряжение"] |
||
+ | end |
||
− | then |
||
− | local voltage = body:tag('div'):addClass('gui-set-line') |
||
− | voltage:css( 'top', h_size .. 'px' ) |
||
− | local voltage_text = voltage:tag('span'):addClass('mcui-row') |
||
− | voltage_text:css( 'margin-left', '22px' ) |
||
− | voltage_text:css( 'text-align', 'left' ) |
||
− | local voltagetext = voltage:tag('span') |
||
− | voltagetext:css('border-bottom','1px dotted') |
||
− | voltagetext:css('cursor','help') |
||
− | voltagetext:attr('title','Требуемое для операции напряжение.') |
||
− | voltagetext:wikitext('Напряжение:') |
||
− | voltage:wikitext(' ' .. animate( args["Напряжение"] ) .. ' [[IndustrialCraft_2|еЭ]]/[[Такт|т]]') |
||
− | h_size = h_size + 21 |
||
− | end |
||
+ | if args["Напряжение"] then |
||
− | -- Добавление строки силы тока |
||
+ | local voltage = EString ('Напряжение:' , 'Требуемое для операции напряжение.' , args ["Напряжение"], '[[IndustrialCraft_2|еЭ]]/[[Такт|т]]') |
||
− | if args["Сила тока"] |
||
+ | end |
||
− | then |
||
− | local amper = body:tag('div'):addClass('gui-set-line') |
||
− | amper:css( 'top', h_size .. 'px' ) |
||
− | local amper_text = amper:tag('span'):addClass('mcui-row') |
||
− | amper_text:css( 'margin-left', '22px' ) |
||
− | amper_text:css( 'text-align', 'left' ) |
||
− | local ampertext = amper:tag('span') |
||
− | ampertext:css('border-bottom','1px dotted') |
||
− | ampertext:css('cursor','help') |
||
− | ampertext:attr('title','Требуемая для операции сила тока.') |
||
− | ampertext:wikitext('Сила тока:') |
||
− | amper:wikitext(' ' .. animate( args["Сила тока"] ) ) |
||
− | h_size = h_size + 21 |
||
− | end |
||
+ | if args["Сила тока"] then |
||
− | -- Добавление строки времени |
||
+ | local amper = EString ('Сила тока:' , 'Требуемая для операции сила тока.' , args ["Сила тока"]) |
||
− | if args["Время"] |
||
+ | end |
||
− | then |
||
− | local timer = body:tag('div'):addClass('gui-set-line') |
||
− | timer:css( 'top', h_size .. 'px' ) |
||
− | local timer_text = timer:tag('span'):addClass('mcui-row') |
||
− | timer_text:css( 'margin-left', '22px' ) |
||
− | timer_text:css( 'text-align', 'left' ) |
||
− | local timertext = timer:tag('span') |
||
− | timertext:css('border-bottom','1px dotted') |
||
− | timertext:css('cursor','help') |
||
− | timertext:attr('title','Время, затрачиваемое на операцию.') |
||
− | timertext:wikitext('Время:') |
||
− | timer:wikitext(' ' .. animate( args["Время"] ) .. ' сек.' ) |
||
− | h_size = h_size + 21 |
||
− | end |
||
+ | if args["Время"] then |
||
− | -- Определение фоновой картинки на основании высоты |
||
+ | local timer = EString ('Время:' , 'Время, затрачиваемое на операцию.' , args ["Время"], 'сек.') |
||
− | if h_size > 140 then |
||
+ | end |
||
− | body:css( 'height', h_size + 8 .. 'px' ) |
||
+ | --------------------------------------------------------------------------------------------------- |
||
+ | |||
+ | if machine_list["Logo"] and not machine["Logo"] then |
||
+ | local GTlogo = body:tag('div'):addClass('gt-pic') |
||
+ | if machine["Skin"] then |
||
+ | GTlogo:addClass('gt-' .. machine["Skin"] .. '-pic') |
||
+ | else |
||
+ | GTlogo:addClass('gt-' .. machine_list["Logo"] .. '-pic') |
||
end |
end |
||
+ | end |
||
− | body:addClass('gui-set ' .. style .. ' gui' ) |
||
+ | |||
− | body:css( 'z-index', '1' ) |
||
+ | if h_size > 140 then |
||
− | |||
+ | body:css('height', h_size .. 'px') |
||
− | if ( version == 'GregTech 4' or version == 'GregTech 5' or version == 'GregTech 5 Unofficial') and backImg ~= '4' then |
||
+ | end |
||
− | local GTlogo = body:tag('div'):addClass('gt-pic') |
||
+ | body:addClass(style .. ' gui') |
||
− | if backImg == '1' then |
||
+ | |||
− | GTlogo:addClass('gt-bronze-pic') |
||
+ | return tostring(body) |
||
− | elseif backImg == '3' then |
||
+ | |||
− | GTlogo:addClass('gt-brick-pic') |
||
− | else |
||
− | GTlogo:addClass('gt-standart-pic') |
||
− | end |
||
− | end |
||
− | |||
− | if progress == 'Формовщик металла' and args["Режим"] then |
||
− | local mode = body:tag('div'):addClass('invslot-item') |
||
− | mode:css('position', 'absolute') |
||
− | mode:css('top', '86px') |
||
− | mode:css('left', '113px') |
||
− | mode:attr('data-minetip-title','Режим: ' .. args["Режим"]) |
||
− | mode:wikitext('[[Файл:Формовщик металла_(' .. args["Режим"] .. ')_(IndustrialCraft 2).png|link=]]') |
||
− | end |
||
− | |||
− | return tostring( mw.html.create( 'div' ):node( body ) ) |
||
end |
end |
||
Текущая версия от 19:52, 19 ноября 2021
Этот модуль реализует шаблон {{Сетка/Обработка}} и необходим для {{Обжиг}}.
Зависимости
- Конфигурация машин GT4
- Конфигурация машин GT5
- Конфигурация машин GT5u
- Конфигурация машин GT6
- Конфигурация машин IC2
- Инвентарный слот
Спрайты
Смотрите также
-- Экспортируемые функции
local p = {}
p.interface = function(f)
local args = f
if f == mw.getCurrentFrame() then
args = f:getParent().args
else
f = mw.getCurrentFrame()
end
-- Контейнер интерфейса
local body = mw.html.create('div')
local recipe = body:tag('span'):addClass('gui-recipe')
-------------------------------------- Используемые функции ---------------------------------------
-- Добавление слота
local slot = require('Модуль:Инвентарный слот').slot
local addSlot = function(args, mod, item, Back_ID, class, style)
return slot{
args[item], ["мод"] = mod, ["класс"] = class, ["Фон ИД"] = Back_ID, ["стиль"] = style
}
end
-- Анимирование текста
local animate = function(txt)
if string.find(txt, ';') then
local result = {}
for text in mw.text.gsplit( txt, '%s*;%s*' ) do
if text ~= '' then
table.insert( result, '<span>' .. text .. '</span>' )
end
end
result[1] = result[1]:gsub( '^<span>', '<span class="active">' )
txt = '<span class="animated">' .. table.concat( result ) .. '</span>'
end
return txt
end
-- Конструктор текста с подсказкой
local help_string = function (HBody, HTitle, HText)
HBody:css('border-bottom','1px dotted')
HBody:css('cursor','help')
HBody:attr('title', HText)
HBody:wikitext(HTitle)
return HBody
end
-- Конструктор строк потребления
local EString = function(EBody_Title, EBody_Help, arg, EBody_Unit)
if not EStrings then
EStrings = body:tag('div'):addClass('gui-energy-lines')
end
local EBody = EStrings:tag('div')
local EBody_Text = EBody:tag('span')
EBody_Text = help_string(EBody_Text, EBody_Title, EBody_Help)
EBody:wikitext(' ' .. animate(arg) .. ' ')
if EBody_Unit then
EBody:wikitext(EBody_Unit)
end
h_size = h_size + 22
return EBody
end
---------------------------------------------------------------------------------------------------
-- Параметры машины
local versions = {
["GregTech 4"] = 'GregTech 4',
["gt4"] = 'GregTech 4',
["GT4"] = 'GregTech 4',
["GregTech 5"] = 'GregTech 5',
["gt5"] = 'GregTech 5',
["GT5"] = 'GregTech 5',
["GregTech 5 Unofficial"] = 'GregTech 5 Unofficial',
["gt5u"] = 'GregTech 5 Unofficial',
["GT5U"] = 'GregTech 5 Unofficial',
["GregTech 6"] = 'GregTech 6',
["gt6"] = 'GregTech 6',
["GT6"] = 'GregTech 6',
["IndustrialCraft 2"] = 'IndustrialCraft 2',
["ic2"] = 'IndustrialCraft 2',
["IC2"] = 'IndustrialCraft 2',
["Metallurgy"] = 'Metallurgy',
'&4Неизвестна',
}
local progress = args["Прогресс"]
local machine_list = {}
local machine = {}
local furnace_like = true
local class2 = 'invslot-large'
if progress then
version = args["Версия"] or mw.ustring.match(progress, ':%s*([a-zA-Zа-яА-ЯёЁ 0-9]+)') or args["Мод"]
progress = mw.ustring.match(progress, '([a-zA-Zа-яА-ЯёЁ 0-9]+):') or progress
if version then
if versions[version] then
version = versions[version]
machine_list = mw.loadData('Модуль:Обработка/' .. version)
machine = machine_list[progress]
furnace_like = false
class2 = machine["Out_class"] or ''
else
end
else
version = versions[1]
body:wikitext('[[Категория:Страницы с неизвестной версией машин]]')
end
else
machine = {
["Image"]="[[Файл:Layout_fire.gif|link=|36px|class=pixel-image]]",
["Def_args"] = {["Топливо"] = "v:Любое топливо"}}
progress = 'Печь'
end
local mod = args["Мод"] or machine_list['def_mod']
-- Предопределённые аргументы
if machine["Def_args"] then
for k,v in pairs(machine["Def_args"]) do
args[k] = args[k] or v
end
end
-- Конфигурация ячеек
local machine_code = args["Машина"] or machine[1] or '21110000'
local input_rows = string.sub(machine_code,1,1) * 1
local input_cols = string.sub(machine_code,2,2) * 1
local output_rows = string.sub(machine_code,3,3) * 1
local output_cols = string.sub(machine_code,4,4) * 1
local fluid_input_rows = string.sub(machine_code,5,5) * 1
local fluid_input_cols = string.sub(machine_code,6,6) * 1
local fluid_output_rows = string.sub(machine_code,7,7) * 1
local fluid_output_cols = string.sub(machine_code,8,8) * 1
-- Определитель стиля
local class1 = ''
if class2 == 'invslot-large' then
large = 16
else
large = 0
end
local style = machine_list["Skin"] or 'craft-gui'
if machine["Skin"] then
style = style .. '-' .. machine["Skin"]
class1 = machine["Skin"] .. '_invslot'
end
-- Иконка реакции
local input_pic = 0
if (machine_list["Image"] or machine["Image"]) and machine["Image"] ~= 'None' then
fuelImg = machine["Image"] or machine_list["Image"]
input_pic = 1
elseif args["Расход"] then
fuelImg = '[[Файл:Grid layout ' .. args["Расход"] .. ' (' .. version .. ').png|link=]]'
input_pic = 1
end
-- Переопределение количества получаемых предметов (1-4)
if args["Уровень"] then
output_rows = math.floor (args["Уровень"] / 4) + 1
output_cols = args["Уровень"] / output_rows
end
-- Предопределение или конвертация некоторых аргументов
args["Шанс1"] = args["Шанс1"] or args["Шанс"]
args["Ресурс1"] = args["Ресурс1"] or args["Ресурс"] or args[1]
args["Ресурс2"] = args["Ресурс2"] or args["Топливо"] or args["топливо"]
args["Выход1"] = args["Выход1"] or args["Выход"] or args[2]
args["Опыт"] = args["Опыт"] or args[3]
args["РесурсЖ1"] = args["РесурсЖ1"] or args["РесурсЖ"]
args["РЖК1"] = args["РЖК1"] or args["РЖК"]
args["РЖТ1"] = args["РЖТ1"] or args["РЖТ"]
args["ВыходЖ1"] = args["ВыходЖ1"] or args["ВыходЖ"]
args["ВЖК1"] = args["ВЖК1"] or args["ВЖК"]
args["ВЖТ1"] = args["ВЖТ1"] or args["ВЖТ"]
if args["Выход7"] and progress == 'Просеиватель' and version == 'GregTech 6' then
args["Шанс1"] = '0.01'
args["Шанс2"] = '01'
args["Шанс3"] = '04'
args["Шанс4"] = '15'
args["Шанс5"] = '20'
args["Шанс6"] = '40'
args["Шанс7"] = '50'
end
-- Параметры стрелки прогресса
if machine_list['Параметры'] then
param = machine_list['Параметры']
else
param = {
['sprite_size'] = 140,
['scale'] = 2,
["default_ID"] = 1,
["arrow_width"] = 28,
["arrow_height"] = 24
}
end
local size = param['arrow_width'] -- ширина спрайта в пикселях
local v_size = param['arrow_height'] -- высота спрайта в пикселях
local pos = (machine['arrow_ID'] or param["default_ID"]) - 1 -- положение спрайта в таблице
local sheetWidth = param['sprite_size'] -- ширина таблицы спрайта в пикселях
local tiles = sheetWidth / size -- количество спрайтов в одной строке
local left = pos % tiles * size -- горизонтальная координата спрайта
local top = math.floor(pos / tiles) * v_size -- вертикальная координата спрайта
local scale = param['scale'] -- масштаб спрайта (во сколько раз увеличить или уменьшить размер)
local arrow_width = (machine['arrow_width'] or size) * scale -- ширина спрайта с учётом масштаба
local arrow_height = (machine['arrow_height'] or v_size) * scale -- высота спрайта с учётом масштаба
-- Размеры и отступы шаблона
input_size = math.max(input_cols,fluid_input_cols) * 36
output_size = math.max(output_cols,fluid_output_cols) * (36 + large)
local h_margin = (270 - output_size - input_size - arrow_width) / 2
if (input_rows + fluid_input_rows) > 3 or (output_rows + fluid_output_rows) > 3 then
h_size = 150
else
h_size = 128
end
recipe:css('margin', '0 ' .. math.floor(0.75 * h_margin) .. 'px')
recipe:css('height', h_size .. 'px')
recipe:css('display', 'inline-flex')
if ( fluid_input_rows * fluid_output_rows * input_rows * output_rows ) > 0 then
local max_fluid_rows = math.max(fluid_output_rows,fluid_input_rows)
v_margin_input = (h_size - 36 * (input_rows + max_fluid_rows)) / 2
v_margin_output = (h_size - 36 * (output_rows + max_fluid_rows)) / 2
else
v_margin_input = (h_size - 36 * (input_rows + fluid_input_rows + input_pic)) / (3 - 0 ^ input_rows - 0 ^ fluid_input_rows)
v_margin_output = (h_size - (36 + large) * (output_rows + fluid_output_rows)) / (3 - 0 ^ output_rows - 0 ^ fluid_output_rows)
end
------------------------------------------ Ячейки ресурсов ----------------------------------------
local input = recipe:tag('span'):addClass('gt-input')
input:css('width', input_size .. 'px')
if input_rows > 0 then
local item_input = input:tag('div')
item_input:css('margin-top', v_margin_input .. 'px')
if fluid_input_cols > input_cols then
item_input:css('margin-left', (fluid_input_cols - input_cols) * 36 .. 'px')
end
num = 0
for i = 1, input_rows do
for j = 1, input_cols do
num = num + 1
if args["Ресурс" .. num] ~= 'none' then
if args["Параметр"] and string.find(args["Ресурс" .. num], 'Интегральная схема') then
args["Ресурс" .. num] = args["Ресурс" .. num] .. "[&7 Параметр: " .. args["Параметр"] .. "/]"
end
if machine['slot_back'] then
s = machine['slot_back']['in' .. num] or machine['slot_back']['in']
else
s = nil
end
item_input:wikitext(addSlot(args, mod, 'Ресурс' .. num,s,class1))
end
end
if (input_pic == 1 and i == 1) then
item_input:wikitext(fuelImg .. '<br>')
end
end
end
if progress == 'Режущий механизм' then
input:wikitext(addSlot(args, mod, 'Диск',nil,'invslot-plain','position:absolute; top:55px; left:116px'))
end
if machine["Mid_input"] then
if machine['slot_back'] then
s = machine['slot_back']['mid']
else
s = nil
end
input:wikitext(addSlot(args, mod, 'РесурсЦ',s,'','position:absolute; top:96px; left:' .. 6 + h_margin + input_size + (arrow_width - 36) / 2 .. 'px'))
end
-------------------------------------- Ячейки жидких ресурсов -------------------------------------
if fluid_input_rows > 0 then
local fluid_input = input:tag('div')
fluid_input:css('text-align', 'right')
if input_pic ~= 1 then
fluid_input:css('margin-top', v_margin_input .. 'px')
end
num = 0
for i = 1, fluid_input_rows do
for j = 1, fluid_input_cols do
num = num + 1
if machine['slot_back'] then
s = machine['slot_back']['fl_in' .. num] or machine['slot_back']['fl_in']
else
s = nil
end
if args["РесурсЖ" .. num] then
c = 0
fl_split = {}
fl_quantity = {}
fl_temp = {}
for text in mw.text.gsplit( args["РЖК" .. num] or '', '%s*;%s*' ) do
if text ~= '' then
table.insert( fl_quantity, '/&9 Объём: ' .. text .. ' мВ/' )
end
end
for text in mw.text.gsplit( args["РЖТ" .. num] or '', '%s*;%s*' ) do
if text ~= '' then
table.insert( fl_temp, '&c Температура: ' .. text .. ' К/' )
end
end
if fl_quantity[1] or fl_temp[1] then
for text in mw.text.gsplit(args["РесурсЖ" .. num] , '%s*;%s*') do
if text ~= '' then
c = c + 1
text = text .. '[' .. (fl_quantity[c] or fl_quantity[1] or '') .. (fl_temp[c] or fl_temp[1] or '') .. ']'
end
table.insert( fl_split, text )
end
args["РесурсЖ" .. num] = table.concat(fl_split , ';')
end
end
fluid_input:wikitext(addSlot(args, mod, 'РесурсЖ' .. num,s,'fluid_invslot'))
end
end
end
---------------------------------------- Стрелка прогресса ----------------------------------------
local arrowtext = '&3' .. progress
if machine[2] then
arrowtext = arrowtext .. '/&9' .. machine[2] --англ. название
end
if version then
arrowtext = arrowtext .. '//&7Модификация:/' .. version
end
local arrow = recipe:tag('span'):addClass('minetip')
arrow:attr('data-minetip-title','Обработчик:')
arrow:attr('data-minetip-text', arrowtext)
arrow:css('margin', 'auto ' .. math.floor(0.25 * h_margin) .. 'px')
if not furnace_like then
arrow:wikitext('[[' .. version .. '/' .. progress .. '|')
local ArrowImg = arrow:tag('span'):addClass('sprite arrow-' .. machine_list["Arrows"])
ArrowImg:css('height', arrow_height .. 'px')
ArrowImg:css('width', arrow_width .. 'px')
ArrowImg:css('background-position', '-' .. left * scale .. 'px -' .. top * scale ..'px')
ArrowImg:css('background-size', sheetWidth * scale .. 'px auto')
arrow:wikitext(']]')
else
if progress ~= 'Печь' and mod then
arrow:wikitext('[[Файл:Grid layout ' .. progress .. ' Progress (' .. mod .. ').png|link=' .. mod .. '/' .. progress .. ']]')
else
arrow:wikitext('[[Файл:Grid_layout_Furnace_Progress.gif|link=Печь]]')
end
arrow:css('width', arrow_width .. 'px')
end
if progress == 'Формовщик металла' and args["Режим"] then
local mode = recipe:tag('div'):addClass('minetip')
mode:css('position', 'absolute')
mode:css('top', '86px')
mode:css('left', '113px')
mode:attr('data-minetip-title','Режим: ' .. args["Режим"])
mode:wikitext('[[Файл:Формовщик металла_(' .. args["Режим"] .. ')_(IndustrialCraft 2).png|link=]]')
end
----------------------------------------- Ячейки продуктов ----------------------------------------
local output = recipe:tag('span'):addClass('gt-output')
output:css('width', output_size .. 'px')
num = 0
if output_rows > 0 then
local item_output = output:tag('div')
item_output:css('margin-top', v_margin_output .. 'px')
for i = 1, output_rows do
for j = 1, output_cols do
num = num + 1
if machine['slot_back'] then
s = machine['slot_back']['out' .. num] or machine['slot_back']['out']
else
s = nil
end
if args["Шанс" .. num] then
c = 0
pr_split = {}
pr_chance = {}
for text in mw.text.gsplit( args["Шанс" .. num] or '', '%s*;%s*' ) do
if text ~= '' then
table.insert( pr_chance, '[&7 Шанс получения: ' .. text .. '%/]' )
end
end
for text in mw.text.gsplit(args["Выход" .. num] , '%s*;%s*') do
if text ~= '' then
c = c + 1
text = text .. (pr_chance[c] or pr_chance[1] or '')
end
table.insert( pr_split, text )
end
args["Выход" .. num] = table.concat(pr_split , ';')
end
item_output:wikitext(addSlot(args, mod, 'Выход' .. num,s,class1 .. ' ' .. class2))
end
end
end
-- Строка текста под получаемыми ресурсами
if args["Температура"] or args["Опыт"] then
local margin_out_2 = output:tag('div')
margin_out_2:css('margin-top','6px')
if args["Температура"] then
local margin_out_2_text = margin_out_2:tag('span')
margin_out_2_text = help_string(margin_out_2_text, animate(args["Температура"]) .. ' К', 'Необходимая температура печи в кельвинах.')
elseif args["Опыт"] then
margin_out_2:css('font-family', 'Minecraft-ru, sans-serif')
margin_out_2:wikitext(require('Модуль:Спрайт').base{ ['изобр'] = 'Сферы_опыта.png', ['выравн'] = 'text-bottom' })
local margin_out_3_text = margin_out_2:tag('span')
margin_out_3_text = help_string(margin_out_3_text, animate(args["Опыт"]), 'Дробная часть показывает вероятность получения единицы опыта.')
end
end
-------------------------------------- Ячейки жидких продуктов ------------------------------------
if fluid_output_rows > 0 then
local fluid_output = output:tag('div')
fluid_output:css('margin-top', v_margin_output .. 'px')
fluid_output:css('text-align','left')
num = 0
for i = 1, fluid_output_rows do
for j = 1, fluid_output_cols do
num = num + 1
if machine['slot_back'] then
s = machine['slot_back']['fl_out' .. num] or machine['slot_back']['fl_out']
else
s = nil
end
if args["ВыходЖ" .. num] then
c = 0
fl_split = {}
fl_quantity = {}
fl_temp = {}
for text in mw.text.gsplit( args["ВЖК" .. num] or '', '%s*;%s*' ) do
if text ~= '' then
table.insert( fl_quantity, '/&9 Объём: ' .. text .. ' мВ/' )
end
end
for text in mw.text.gsplit( args["ВЖТ" .. num] or '', '%s*;%s*' ) do
if text ~= '' then
table.insert( fl_temp, '&c Температура: ' .. text .. ' К/' )
end
end
if fl_quantity[1] or fl_temp[1] then
for text in mw.text.gsplit(args["ВыходЖ" .. num] , '%s*;%s*') do
if text ~= '' then
c = c + 1
text = text .. '[' .. (fl_quantity[c] or fl_quantity[1] or '') .. (fl_temp[c] or fl_temp[1] or '') .. ']'
end
table.insert( fl_split, text )
end
args["ВыходЖ" .. num] = table.concat(fl_split , ';')
end
end
fluid_output:wikitext(addSlot(args, mod, 'ВыходЖ' .. num,s,'fluid_invslot'))
end
end
end
---------------------------------------- Строки потребления ---------------------------------------
if args["Пар"] then
local vape = EString ('Пар:' , 'Объём пара, требующийся для проведения операции.' , args ["Пар"])
local vapeunit = vape:tag('span')
vapeunit = help_string(vapeunit, 'мВ', 'Милливедро (мВ) — единица объёма условно равная 1/1000 части ведра.')
end
if args["Старт"] then
local start = EString ('Старт:' , 'Энергия, требующаяся на запуск процесса.' , args ["Старт"], '[[IndustrialCraft_2|еЭ]]')
end
if args["Энергия"] then
local energy = EString ('Энергия:' , 'Энергия, затрачиваемая на каждую операцию.' , args ["Энергия"], '[[IndustrialCraft_2|еЭ]]')
end
if args["Потребление"] then
local consumption = EString ('Потребление:' , 'Скорость потребления энергии.' , args ["Потребление"], '[[IndustrialCraft_2|еЭ]]/[[Такт|т]]')
end
if args["Напряжение"] then
local voltage = EString ('Напряжение:' , 'Требуемое для операции напряжение.' , args ["Напряжение"], '[[IndustrialCraft_2|еЭ]]/[[Такт|т]]')
end
if args["Сила тока"] then
local amper = EString ('Сила тока:' , 'Требуемая для операции сила тока.' , args ["Сила тока"])
end
if args["Время"] then
local timer = EString ('Время:' , 'Время, затрачиваемое на операцию.' , args ["Время"], 'сек.')
end
---------------------------------------------------------------------------------------------------
if machine_list["Logo"] and not machine["Logo"] then
local GTlogo = body:tag('div'):addClass('gt-pic')
if machine["Skin"] then
GTlogo:addClass('gt-' .. machine["Skin"] .. '-pic')
else
GTlogo:addClass('gt-' .. machine_list["Logo"] .. '-pic')
end
end
if h_size > 140 then
body:css('height', h_size .. 'px')
end
body:addClass(style .. ' gui')
return tostring(body)
end
return p