Replace some space indents by tabs

This commit is contained in:
JPG 2016-12-17 18:51:04 +01:00
parent 455a937521
commit e5cb84d02e

View File

@ -29,7 +29,8 @@ function craftguide:group_to_item(item)
item = group_stereotypes[short_itemstr]
elseif minetest.registered_items["default:"..item:sub(7)] then
item = item:gsub("group:", "default:")
else for node, def in pairs(minetest.registered_items) do
else
for node, def in pairs(minetest.registered_items) do
if def.groups[item:match("[^,:]+$")] then
item = node
end
@ -102,14 +103,17 @@ function craftguide:get_recipe(player_name, tooltipl, item, recipe_num, recipes)
if recipe_type == "normal" and
width > craftgrid_limit or rows > craftgrid_limit then
formspec = formspec.."label["..xoffset..","..(iY+2)..
formspec = formspec..
"label["..xoffset..","..(iY+2)..
";Recipe is too big to\nbe displayed ("..
width.."x"..rows..")]"
else for i, v in pairs(items) do
else
for i, v in pairs(items) do
local X = (i-1) % width + xoffset
local Y = ceil(i / width + iY+2 - min(2, rows))
if recipe_type == "normal" and width > 3 or rows > 3 then
if recipe_type == "normal" and
width > 3 or rows > 3 then
btn_size = width > 3 and 3 / width or 3 / rows
X = btn_size * (i % width) + xoffset
Y = btn_size * floor((i-1) / width) + iY+3 -
@ -122,14 +126,14 @@ function craftguide:get_recipe(player_name, tooltipl, item, recipe_num, recipes)
local tooltip = self:get_tooltip(item_r, recipe_type,
width, groups)
formspec = formspec.."item_image_button["..X..","..Y..";"..
btn_size..","..btn_size..";"..
item_r..";"..item_r..";"..label.."]"..
tooltip
formspec = formspec.."item_image_button["..X..","..Y..
";"..btn_size..","..btn_size..";"..item_r..
";"..item_r..";"..label.."]"..tooltip
end
end
local output = recipes[recipe_num].output
return formspec.."image["..(xoffset-1)..","..(iY+2)..
return formspec..
"image["..(xoffset-1)..","..(iY+2)..
".12;0.9,0.7;craftguide_arrow.png]"..
"item_image_button["..(xoffset-2)..","..(iY+2)..";1,1;"..
output..";"..item..";]"..tooltipl
@ -181,7 +185,8 @@ function craftguide:get_formspec(player_name, is_fuel)
else
formspec = formspec..
self:get_recipe(player_name, tooltip, data.item,
data.recipe_num, data.recipes_item)
data.recipe_num,
data.recipes_item)
end
end
@ -215,8 +220,8 @@ function craftguide:recipe_in_inv(inv, item_name, recipes_f)
if item:sub(1,6) == "group:" then
local groups = group_to_items(item)
for j=1, #groups do
if inv:contains_item("main",
groups[j]) then
if inv:contains_item(
"main", groups[j]) then
group_in_inv = true
end
end
@ -310,7 +315,8 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
data.pagenum = data.pagemax
end
craftguide:get_formspec(player_name)
else for item in pairs(fields) do
else
for item in pairs(fields) do
if not item:find(":") then break end
if item:sub(-4) == "_inv" then item = item:sub(1,-5) end
@ -320,12 +326,15 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
if not recipes and not is_fuel then return end
if progressive_mode then
local who = minetest.get_player_by_name(player_name)
local who =
minetest.get_player_by_name(player_name)
local inv = who:get_inventory()
local _, has_item = craftguide:recipe_in_inv(inv, item)
local _, has_item =
craftguide:recipe_in_inv(inv, item)
if not has_item then return end
recipes = craftguide:recipe_in_inv(inv, item, recipes)
recipes = craftguide:recipe_in_inv(
inv, item, recipes)
end
data.item = item