1
0
mirror of https://github.com/Sokomine/cottages.git synced 2025-07-07 18:30:27 +02:00

stylua fixes

This commit is contained in:
flux
2023-01-22 19:36:23 -08:00
parent b58368ea6a
commit 0157649fa5
50 changed files with 945 additions and 980 deletions

View File

@ -31,7 +31,7 @@ function api.register_quern_craft(recipe)
unified_inventory.register_craft({
output = recipe.output,
type = "cottages:quern",
items = {recipe.input},
items = { recipe.input },
width = 1,
})
end
@ -47,7 +47,7 @@ function api.register_threshing_craft(recipe)
unified_inventory.register_craft({
output = output,
type = "cottages:threshing",
items = {recipe.input},
items = { recipe.input },
width = 1,
})
end

View File

@ -3,18 +3,18 @@ local ci = cottages.craftitems
minetest.register_craft({
output = "cottages:straw_mat 6",
recipe = {
{ci.stone, "", ""},
{"farming:wheat", "farming:wheat", "farming:wheat", },
{ ci.stone, "", "" },
{ "farming:wheat", "farming:wheat", "farming:wheat" },
},
replacements = {{ci.stone, ci.seed_wheat .. " 3"}},
replacements = { { ci.stone, ci.seed_wheat .. " 3" } },
})
-- this is a better way to get straw mats
minetest.register_craft({
output = "cottages:threshing_floor",
recipe = {
{ci.junglewood, ci.chest_locked, ci.junglewood, },
{ci.junglewood, ci.stone, ci.junglewood, },
{ ci.junglewood, ci.chest_locked, ci.junglewood },
{ ci.junglewood, ci.stone, ci.junglewood },
},
})
@ -22,39 +22,39 @@ minetest.register_craft({
minetest.register_craft({
output = "cottages:quern",
recipe = {
{ci.stick, ci.stone, "", },
{"", ci.steel, "", },
{"", ci.stone, "", },
{ ci.stick, ci.stone, "" },
{ "", ci.steel, "" },
{ "", ci.stone, "" },
},
})
minetest.register_craft({
output = "cottages:straw_bale",
recipe = {
{"cottages:straw_mat"},
{"cottages:straw_mat"},
{"cottages:straw_mat"},
{ "cottages:straw_mat" },
{ "cottages:straw_mat" },
{ "cottages:straw_mat" },
},
})
minetest.register_craft({
output = "cottages:straw",
recipe = {
{"cottages:straw_bale"},
{ "cottages:straw_bale" },
},
})
minetest.register_craft({
output = "cottages:straw_bale",
recipe = {
{"cottages:straw"},
{ "cottages:straw" },
},
})
minetest.register_craft({
output = "cottages:straw_mat 3",
recipe = {
{"cottages:straw_bale"},
{ "cottages:straw_bale" },
},
})
@ -62,32 +62,32 @@ minetest.register_craft({
if ci.flour then
if ci.seed_barley then
cottages.straw.register_quern_craft({input = ci.seed_barley, output = ci.flour})
cottages.straw.register_quern_craft({ input = ci.seed_barley, output = ci.flour })
end
if ci.seed_oat then
cottages.straw.register_quern_craft({input = ci.seed_oat, output = ci.flour})
cottages.straw.register_quern_craft({ input = ci.seed_oat, output = ci.flour })
end
if ci.seed_rye then
cottages.straw.register_quern_craft({input = ci.seed_rye, output = ci.flour})
cottages.straw.register_quern_craft({ input = ci.seed_rye, output = ci.flour })
end
if ci.seed_wheat then
cottages.straw.register_quern_craft({input = ci.seed_wheat, output = ci.flour})
cottages.straw.register_quern_craft({ input = ci.seed_wheat, output = ci.flour })
end
end
if ci.rice and ci.rice_flour then
cottages.straw.register_quern_craft({input = ci.rice, output = ci.rice_flour})
cottages.straw.register_quern_craft({ input = ci.rice, output = ci.rice_flour })
end
if ci.barley and ci.seed_barley then
cottages.straw.register_threshing_craft({input = ci.barley, output = {ci.seed_barley, ci.straw_mat}})
cottages.straw.register_threshing_craft({ input = ci.barley, output = { ci.seed_barley, ci.straw_mat } })
end
if ci.oat and ci.seed_oat then
cottages.straw.register_threshing_craft({input = ci.oat, output = {ci.seed_oat, ci.straw_mat}})
cottages.straw.register_threshing_craft({ input = ci.oat, output = { ci.seed_oat, ci.straw_mat } })
end
if ci.rye and ci.seed_rye then
cottages.straw.register_threshing_craft({input = ci.rye, output = {ci.seed_rye, ci.straw_mat}})
cottages.straw.register_threshing_craft({ input = ci.rye, output = { ci.seed_rye, ci.straw_mat } })
end
if ci.wheat and ci.seed_wheat then
cottages.straw.register_threshing_craft({input = ci.wheat, output = {ci.seed_wheat, ci.straw_mat}})
cottages.straw.register_threshing_craft({ input = ci.wheat, output = { ci.seed_wheat, ci.straw_mat } })
end

View File

@ -2,7 +2,9 @@ local straw = cottages.straw
local S = cottages.S
local F = minetest.formspec_escape
local FS = function(...) return F(S(...)) end
local FS = function(...)
return F(S(...))
end
local get_safe_short_description = futil.get_safe_short_description
@ -11,23 +13,22 @@ local stamina_use = cottages.settings.straw.quern_stamina
local quern_min_per_turn = cottages.settings.straw.quern_min_per_turn
local quern_max_per_turn = cottages.settings.straw.quern_max_per_turn
function straw.get_quern_fs_parts()
return {
("size[8,8]"),
"size[8,8]",
("image[0,1;1,1;%s]"):format(F(cottages.textures.wheat_seed)),
("label[0,0.5;%s]"):format(FS("Input:")),
("label[3,0.5;%s]"):format(FS("Output:")),
("label[0,-0.3;%s]"):format(FS("Quern")),
("label[0,2.5;%s]"):format(FS("Punch this hand-driven quern")),
("label[0,3.0;%s]"):format(FS("to grind suitable items.")),
("list[context;seeds;1,1;1,1;]"),
("list[context;flour;4,1;2,2;]"),
("list[current_player;main;0,4;8,4;]"),
("listring[current_player;main]"),
("listring[context;seeds]"),
("listring[current_player;main]"),
("listring[context;flour]"),
"list[context;seeds;1,1;1,1;]",
"list[context;flour;4,1;2,2;]",
"list[current_player;main;0,4;8,4;]",
"listring[current_player;main]",
"listring[context;seeds]",
"listring[current_player;main]",
"listring[context;flour]",
}
end
@ -36,7 +37,6 @@ function straw.get_quern_info(pos)
if meta:get_int("used") == 0 then
return S("quern, powered by punching")
else
local inv = meta:get_inventory()
local input = inv:get_stack("seeds", 1)
@ -45,7 +45,6 @@ function straw.get_quern_info(pos)
if count > 0 then
local input_description = get_safe_short_description(input)
return S("quern, @1 @2 remaining", count, input_description)
else
return S("quern, none remaining")
end
@ -56,14 +55,12 @@ local function get_quern_results(input)
local item = input:get_name()
local output_def = straw.registered_quern_crafts[item]
if type(output_def) == "string" then
return {ItemStack(output_def)}
return { ItemStack(output_def) }
elseif type(output_def) == "table" and #output_def > 0 then
local outputs = {}
for _, output_item in ipairs(output_def) do
if type(output_item) == "string" then
table.insert(outputs, ItemStack(output_item))
elseif type(output_item) == "table" then
local chance
output_item, chance = unpack(output_item)
@ -74,7 +71,6 @@ local function get_quern_results(input)
end
return outputs
elseif type(output_def) == "function" then
return output_def()
end
@ -127,11 +123,7 @@ function straw.use_quern(pos, player)
maxacc = vector.new(0, -3, 0),
})
minetest.sound_play(
{name = cottages.sounds.use_quern},
{pos = pos, gain = 1, pitch = 0.25},
true
)
minetest.sound_play({ name = cottages.sounds.use_quern }, { pos = pos, gain = 1, pitch = 0.25 }, true)
if has_stamina then
stamina.exhaust_player(player, stamina_use, "cottages:quern")
@ -145,9 +137,9 @@ cottages.api.register_machine("cottages:quern", {
short_description = S("quern-stone"),
drawtype = "mesh",
mesh = "cottages_quern.obj",
tiles = {"cottages_stone.png"},
selection_box = {type = "fixed", fixed = {{-0.50, -0.5, -0.50, 0.50, 0.25, 0.50}}},
groups = {cracky = 2},
tiles = { "cottages_stone.png" },
selection_box = { type = "fixed", fixed = { { -0.50, -0.5, -0.50, 0.50, 0.25, 0.50 } } },
groups = { cracky = 2 },
sounds = cottages.sounds.stone,
inv_info = {

View File

@ -2,7 +2,9 @@ local straw = cottages.straw
local S = cottages.S
local F = minetest.formspec_escape
local FS = function(...) return F(S(...)) end
local FS = function(...)
return F(S(...))
end
local get_safe_short_description = futil.get_safe_short_description
@ -13,7 +15,7 @@ local threshing_max_per_punch = cottages.settings.straw.threshing_max_per_punch
function straw.get_threshing_fs_parts()
return {
("size[8,8]"),
"size[8,8]",
("image[3,1;1,1;%s]"):format(F(cottages.textures.stick)),
("image[0,1;1,1;%s]"):format(F(cottages.textures.wheat)),
("label[1,0.5;%s]"):format(FS("Input:")),
@ -21,16 +23,16 @@ function straw.get_threshing_fs_parts()
("label[0,0;%s]"):format(FS("Threshing Floor")),
("label[0,2.5;%s]"):format(FS("Punch threshing floor with a stick")),
("label[0,3.0;%s]"):format(FS("to get straw and seeds from wheat.")),
("list[context;harvest;1,1;2,1;]"),
("list[context;straw;4,0;2,2;]"),
("list[context;seeds;4,2;2,2;]"),
("list[current_player;main;0,4;8,4;]"),
("listring[current_player;main]"),
("listring[context;harvest]"),
("listring[current_player;main]"),
("listring[context;straw]"),
("listring[current_player;main]"),
("listring[context;seeds]"),
"list[context;harvest;1,1;2,1;]",
"list[context;straw;4,0;2,2;]",
"list[context;seeds;4,2;2,2;]",
"list[current_player;main;0,4;8,4;]",
"listring[current_player;main]",
"listring[context;harvest]",
"listring[current_player;main]",
"listring[context;straw]",
"listring[current_player;main]",
"listring[context;seeds]",
}
end
@ -39,7 +41,6 @@ function straw.get_threshing_info(pos)
if meta:get_int("used") == 0 then
return S("threshing floor")
else
local inv = meta:get_inventory()
local input1 = inv:get_stack("harvest", 1)
@ -50,12 +51,10 @@ function straw.get_threshing_info(pos)
local input_description
if input1:is_empty() then
input_description = get_safe_short_description(input2)
else
input_description = get_safe_short_description(input1)
end
return S("threshing floor, @1 @2 remaining", count, input_description)
else
return S("threshing floor, none remaining")
end
@ -66,14 +65,12 @@ local function get_threshing_results(input)
local item = input:get_name()
local output_def = straw.registered_threshing_crafts[item]
if type(output_def) == "string" then
return {ItemStack(output_def)}
return { ItemStack(output_def) }
elseif type(output_def) == "table" and #output_def > 0 then
local outputs = {}
for _, output_item in ipairs(output_def) do
if type(output_item) == "string" then
table.insert(outputs, ItemStack(output_item))
elseif type(output_item) == "table" then
local chance
output_item, chance = unpack(output_item)
@ -84,7 +81,6 @@ local function get_threshing_results(input)
end
return outputs
elseif type(output_def) == "function" then
return output_def()
end
@ -168,11 +164,7 @@ function straw.use_threshing(pos, player)
maxacc = vector.new(0, -10, 0),
})
minetest.sound_play(
{name = cottages.sounds.use_thresher},
{pos = particle_pos, gain = 1, pitch = 0.5},
true
)
minetest.sound_play({ name = cottages.sounds.use_thresher }, { pos = particle_pos, gain = 1, pitch = 0.5 }, true)
if has_stamina then
stamina.exhaust_player(player, stamina_use, "cottages:quern")
@ -188,27 +180,27 @@ cottages.api.register_machine("cottages:threshing_floor", {
node_box = {
type = "fixed",
fixed = {
{-0.50, -0.5, -0.50, 0.50, -0.40, 0.50},
{ -0.50, -0.5, -0.50, 0.50, -0.40, 0.50 },
{-0.50, -0.4, -0.50, -0.45, -0.20, 0.50},
{0.45, -0.4, -0.50, 0.50, -0.20, 0.50},
{ -0.50, -0.4, -0.50, -0.45, -0.20, 0.50 },
{ 0.45, -0.4, -0.50, 0.50, -0.20, 0.50 },
{-0.45, -0.4, -0.50, 0.45, -0.20, -0.45},
{-0.45, -0.4, 0.45, 0.45, -0.20, 0.50},
}
{ -0.45, -0.4, -0.50, 0.45, -0.20, -0.45 },
{ -0.45, -0.4, 0.45, 0.45, -0.20, 0.50 },
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.50, -0.5, -0.50, 0.50, -0.20, 0.50},
}
{ -0.50, -0.5, -0.50, 0.50, -0.20, 0.50 },
},
},
tiles = {
"cottages_junglewood.png^farming_wheat.png",
"cottages_junglewood.png",
"cottages_junglewood.png^" .. cottages.textures.stick
"cottages_junglewood.png^" .. cottages.textures.stick,
},
groups = {cracky = 2, choppy = 2},
groups = { cracky = 2, choppy = 2 },
sounds = cottages.sounds.wood,
is_ground_content = false,