Нет описания правки |
(блоки должны быть перед сеткой, убрал z-index) |
||
Строка 70: | Строка 70: | ||
local slotArgs = {} |
local slotArgs = {} |
||
if (argChar ~= '-') then |
if (argChar ~= '-') then |
||
− | table.insert(result, '<span style="position: absolute; margin-left: -20px; margin-top: 10px; |
+ | table.insert(result, '<span style="position: absolute; margin-left: -20px; margin-top: 10px;">[[Файл:Сетка изометрия.png|link=]]</span>') |
if (argChar ~= '_') then |
if (argChar ~= '_') then |
||
slotArgs["мод"] = args["Мод"] |
slotArgs["мод"] = args["Мод"] |
||
Строка 81: | Строка 81: | ||
if massb[n] ~= nil then |
if massb[n] ~= nil then |
||
if massb[n][i2+1-n] ~= nil then |
if massb[n][i2+1-n] ~= nil then |
||
− | slotArgs["стиль"] = " |
+ | slotArgs["стиль"] = "outline: 2px solid " .. ({"red", "blue", "green"})[massb[n][i2+1-n]] |
− | else |
||
− | slotArgs["стиль"] = "z-index:2;" |
||
end |
end |
||
end |
end |
Версия от 11:05, 12 июня 2018
p = {}
p.structure = function(f)
local args = f.args or f
if f == mw.getCurrentFrame() and args[1] == nil then
args = f:getParent().args
end
args = require("Модуль:ProcessArgs").norm(args)
local i = #args
local dub = {}
if args.dub~=nil then
for v in mw.text.gsplit( args.dub or '', '%s*;%s*' ) do
h = mw.text.split( v, '%s*,%s*' )[2]
dub[tonumber(mw.text.split( v, '%s*,%s*' )[1])] = h
i = i + h - 1
end
end
local result = {}
table.insert(result, '<table cellpadding="2" cellspacing="0" style="line-height: 36px; padding-right: 20px; padding-bottom: 20px">')
local border = 0
local invSlot = require("Модуль:Инвентарный слот").slot
for index, arg in ipairs(args) do
local k = 1
if dub[#args-index+1] ~= nil then
k = dub[#args-index+1]
end
if k == 1 then
table.insert(result, '<tr><td></td></tr><tr><td style="padding-right: 10px">Слой ' .. i .. '</td><td>')
else
table.insert(result, '<tr><td></td></tr><tr><td style="padding-right: 10px">Слои ' .. i - k + 1 .. '-' .. i .. '</td><td>')
end
local sloy = {}
sloy = mw.text.split(arg,',')
local mass = {}
local massb = {}
local maxw = #sloy
for row = 1, #sloy do
local line = sloy[row]
maxw = math.max(maxw, mw.ustring.len(mw.ustring.gsub(line, '%^', '')) )
mass[row] = {}
massb[row] = {}
for i2 = 1, mw.ustring.len(line) do
local argChar = mw.ustring.sub(line, i2, i2)
if argChar == '^' then
border = border + 1
else
table.insert(mass[row],argChar)
if border ~= 0 then
massb[row][#mass[row]] = border
border = 0
end
end
end
end
for i2 = 1, maxw + #sloy - 1 do
for n = math.max(1,i2+1-maxw), math.min(i2,maxw) do
if mass[n] == nil then
argChar = '-'
elseif mass[n][i2+1-n] == nil then
argChar = '-'
else
argChar = mass[n][i2+1-n]
end
local slotArgs = {}
if (argChar ~= '-') then
table.insert(result, '<span style="position: absolute; margin-left: -20px; margin-top: 10px;">[[Файл:Сетка изометрия.png|link=]]</span>')
if (argChar ~= '_') then
slotArgs["мод"] = args["Мод"]
slotArgs[1] = (args[argChar] or '')
end
else
slotArgs[1] = ''
end
slotArgs["класс"] = "invslot-plain"
if massb[n] ~= nil then
if massb[n][i2+1-n] ~= nil then
slotArgs["стиль"] = "outline: 2px solid " .. ({"red", "blue", "green"})[massb[n][i2+1-n]]
end
end
table.insert(result, invSlot(slotArgs))
table.insert(result, "<br>")
end
table.insert(result, '</td><td>')
end
table.insert(result, "</td></tr>\n")
i = i - k
end
table.insert(result, "</table>")
return table.concat(result)
end
return p