Minecraft Wiki
Регистрация
Advertisement
local slot = require('Модуль:Инвентарный слот').slot
local text = require('Модуль:Анимация').text
local addSlot = function( args, version, mod, item, CSS, class, prefix, default )
	prefix = prefix or item
	return slot{
		args[item], ["мод"] = mod, ["ссылка"] = args[prefix .. 'Ссылка'],
		["назв"] = args[prefix .. 'Назв'], ["класс"] = class, ["умолчаниеCSS"] = CSS, ["Версия"] = version
	}
end

-- Функция анимирования текста
local animate = function(txt)
	return text{ txt }
end

-- Экспортируемые функции
local p = {}

p.interface = function( f )
	local args = f
		if f == mw.getCurrentFrame() 
			then
				args = f:getParent().args
			else
				f = mw.getCurrentFrame()
			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 '&4Неизвестная машина'
	else
		version = args["Версия"]
		progress = 'Печь'
	end
	
	if versions[version] then
		version = versions[version]
	else
		version = versions[1]
	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
		mod = mod or ''
	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

-- Предопределённые аргументы
	if machine_list[version] and machine_list[version][progress] and machine_list[version][progress]["Def_args"] then
		for k,v in pairs(machine_list[version][progress]["Def_args"]) do
			args[k] = v
		end
	end

-- Определитель фоновой картинки
	local style = {
	['0'] = 'gt-gui',
	['1'] = 'gt-gui-bronze',
	['2'] = 'craft-gui',
	['3'] = 'gt-gui-brick',
	['4'] = 'gt-gui',
	}
	style = style[backImg]
	
-- Регулятор класса ячейки получаемых предметов	
	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 max_input_cols = 0
	local margin_input_diff = 0
	local margin_fluid_input_diff = 0
	local v_margin_input_1 = 0
	local v_margin_input_2 = 0

	local max_output_cols = 0
	local v_margin_output_1 = 0
	local v_margin_output_2 = 0

-- Определитель расширения высоты шаблона		
	local h_size = 140

-- Переопределение количества получаемых предметов (1-4)
	if args["Уровень"] then
		output_rows = tostring( math.floor ( args["Уровень"] / 4) + 1 )
		output_cols = tostring( 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["РесурсЖ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 progress == 'Просеиватель' and version == 'GregTech 6' and args["Выход7"] 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
		
-- Параметры стрелки прогресса
	local arrowtext = '&3' .. progress
	if OrigName and OrigName ~= '' then
		arrowtext = arrowtext ..  '/&9' .. OrigName
	end
	if version ~= 'Оригинальная игра' then 
		arrowtext = arrowtext ..  '//&7Модификация:/'
	end
	local ArrowIds = mw.loadData('Модуль:Обработка/Стрелки')
	local param = {}
	if ArrowIds[version] and ArrowIds[version]['Параметры'] then
		param = ArrowIds[version]['Параметры']
	else
		param = {
			["формат"] = 280,
			["масштаб"] = 1,
			["поз"] = 1,
			["верт_разм"] = 48,
			["разм"] = 56,
		}
	end
	local ArrowID = 1
	local arrow_version = version
	if version ~= '&4Неизвестна' then
		if ArrowIds[version] and ArrowIds[version][progress] then
			ArrowID = ArrowIds[version][progress]
		elseif version ~= 'Оригинальная игра' then
			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

-- Горизонтальные отступы
	if output_cols >= fluid_output_cols 
		then
			max_output_cols = output_cols
		else
			max_output_cols = fluid_output_cols
	end

	local h_margin = ( 282 - 36 * ( max_output_cols + max_input_cols ) - arrow_width ) / 2 - large

-- Создание контейнера шаблона	
	local body = mw.html.create('div')
	if version == '&4Неизвестна' then
		body:wikitext('[[Категория:Страницы с неизвестной версией машин]]')
	end
	
-- Расширение при большом количестве строк		
	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
		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
			num = num + 1
			if args["Ресурс" .. num] ~= 'none' then
				if ( args["Параметр"] and string.find( args["Ресурс" .. num], 'Интегральная схема') )
					then 
						args["Ресурс" .. num] = args["Ресурс" .. num] .. "[&7 Параметр: " .. args["Параметр"] .. "/]"
					end
				local s = mw.ustring.lower(string.gsub(progress,' ','_',5) .. '_in' .. num)
				row:wikitext(addSlot(args, version, mod, 'Ресурс' .. num,s,class1))
			end
		end
		if ( input_pic == '1' and i == 1 )
			then
				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

-- Переменные для подсказки к жидкостям	
	local rfsplit
	local rfqsplit
	local rftsplit
	local pfsplit
	local pfqsplit
	local pftsplit
	local maxn = 0

-- Исходные жидкие ресурсы	
    num = 0
	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
			num = num + 1
    		s = mw.ustring.lower(string.gsub(progress,' ','_',5) .. '_fluid_in' .. num)
			if args["РесурсЖ" .. num] 
				then
					rfsplit = mw.text.split( args["РесурсЖ" .. num] , '%s*;%s*')
					maxn = table.maxn(rfsplit) or 0
					if args["РЖК" .. num]
						then 
							rfqsplit = mw.text.split( args["РЖК" .. num] , '%s*;%s*')
							if table.maxn(rfqsplit) > maxn then maxn = table.maxn(rfqsplit) end
						end
					if args["РЖТ" .. num]
						then 
							rftsplit = mw.text.split( args["РЖТ" .. num] , '%s*;%s*')
							if table.maxn(rftsplit) > maxn then maxn = table.maxn(rftsplit) end
						end
					for i = 1, maxn do
						if ( i > 1 and table.maxn(rfsplit) == 1 )
							then
								table.insert( rfsplit,rfsplit[1] )
							end
						if rfsplit[i] ~= '' then
							rfsplit[i] = rfsplit[i] .. '['
							if ( args["Параметр"] and string.find( args["РесурсЖ" .. num], 'Интегральная схема') )
								then 
									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
					args["РесурсЖ" .. num] = table.concat(rfsplit , ';')
					rfsplit = nil
					rfqsplit = nil
					rftsplit = nil
				end
			fluid_row:wikitext(addSlot(args, version, mod, 'РесурсЖ' .. num,s))
		end
	end

-- Изображение стрелки прогресса	
	local arrow = body:tag('span'):addClass('invslot-item ')
	arrow:css('position', 'absolute')
	arrow:attr('data-minetip-title','Обработчик:')
	if machine_list[version] then
		arrow:wikitext('[[' .. version .. '/' .. progress .. '|')
		arrowtext = arrowtext  .. version
		local ArrowImg = arrow:tag('span'):addClass('sprite')
		-- Отступы стрелки
		arrow:css('top', ( 140 - arrow_height - 6 ) / 2 .. 'px')
		arrow:css('left', h_margin + max_input_cols * 36 .. 'px')
		--
		ArrowImg:css('background-image', '{{FileUrl|' .. arrow_version .. '_ArrowProcessingCSS.png}}')
		ArrowImg:css('height', arrow_height .. 'px')
		ArrowImg:css('width', arrow_width .. 'px')
		-- Координаты
		ArrowImg:css('background-position', '-' .. left * scale .. 'px -' .. top * scale ..'px')
		-- Масштаб
		if scale ~= 1 then
			ArrowImg:css('background-size', sheetWidth * scale .. 'px auto')
		end
		ArrowImg:wikitext(' ')
		arrow:wikitext(']]')
	else
		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
	arrow:attr('data-minetip-text', arrowtext)

-- Центральная ячейка
	for i = 1, mid_input do
		local mid_cell = body:tag('span'):addClass('mcui-row')
		mid_cell:css('position', 'absolute')
		if progress ~= 'Режущий механизм' then
			mid_cell:css('left', h_margin + max_input_cols * 36 + ( arrow_width - 36 ) / 2 .. 'px')
			mid_cell:css('top', '94px')
			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
		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
            num = num + 1
    		s = mw.ustring.lower(string.gsub(progress,' ','_',5) .. '_out' .. num)	
			if args["Шанс" .. num]
				then
					local rfsplit = mw.text.split( args["Выход" .. num] , '%s*;%s*')
					local rfqsplit = mw.text.split( args["Шанс" .. num] , '%s*;%s*')
					while table.maxn(rfqsplit) > table.maxn(rfsplit)
						do
							table.insert(rfsplit,rfsplit[1])
						end
					while table.maxn(rfsplit) > table.maxn(rfqsplit)
						do
							table.insert(rfqsplit,rfqsplit[1])
						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
			row:wikitext(addSlot(args, version, mod, 'Выход' .. num,s,class2))
		end
	end

-- Строка текста под получаемыми ресурсами	
	local margin_out_2 = output:tag('span'):addClass('mcui-row')
	margin_out_2:css('top', output_rows * 36 + large * 2 .. 'px')
	margin_out_2:css('position', 'absolute')
	margin_out_2:wikitext(' ')
	if args["Температура"]
		then
			margin_out_2:css('left', '0')
			margin_out_2:css('font-weight', 'bold')
			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 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

-- Получаемые жидкие ресурсы	
    num = 0
	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
            num = num + 1
    		s = mw.ustring.lower(string.gsub(progress,' ','_',5) .. '_fluid_out' .. num)	
			if args["ВыходЖ" .. num] 
				then
					pfsplit = mw.text.split( args["ВыходЖ" .. num] , '%s*;%s*')
					maxn = table.maxn(pfsplit) or 0
					if args["ВЖК" .. num]
						then 
							pfqsplit = mw.text.split( args["ВЖК" .. num] , '%s*;%s*')
							if table.maxn(pfqsplit) > maxn then maxn = table.maxn(pfqsplit) end
						end
					if args["ВЖТ" .. num]
						then 
							pftsplit = mw.text.split( args["ВЖТ" .. num] , '%s*;%s*')
							if table.maxn(pftsplit) > maxn then maxn = table.maxn(pftsplit) end
						end
					for i = 1, maxn do
						if ( i > 1 and table.maxn(pfsplit) == 1 )
							then
								table.insert( pfsplit,pfsplit[1] )
							end
						if pfsplit[i] ~= '' then
							pfsplit[i] = pfsplit[i] .. '['
							if ( args["Параметр"] and string.find( args["ВыходЖ" .. num], 'Интегральная схема') )
								then 
									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
					args["ВыходЖ" .. num] = table.concat(pfsplit , ';')
					pfsplit = nil
					pfqsplit = nil
					pftsplit = nil
				end
			fluid_row:wikitext(addSlot(args, version, mod, 'ВыходЖ' .. num,s))
		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 start = body:tag('div'):addClass('gui-set-line')
			start:css( 'top', h_size .. 'px' )
			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 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 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 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 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 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 h_size > 140 then
		body:css( 'height', h_size + 8 .. 'px' )
	end
	body:addClass('gui-set ' .. style .. ' gui' )
	body:css( 'z-index', '1' )
	
	if ( version == 'GregTech 4' or version == 'GregTech 5' or version == 'GregTech 5 Unofficial') and backImg ~= '4' then
		local GTlogo = body:tag('div'):addClass('gt-pic')
		if backImg == '1' then		
			GTlogo:addClass('gt-bronze-pic')
		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

return p
Advertisement