1
0
mirror of https://github.com/Sokomine/cottages.git synced 2025-07-16 14:40:25 +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

@ -38,7 +38,6 @@ function api.get_up(player)
player_monoids.speed:del_change(player, "cottages:furniture")
player_monoids.jump:del_change(player, "cottages:furniture")
player_monoids.gravity:del_change(player, "cottages:furniture")
else
player:set_physics_override(1, 1, 1)
end
@ -53,7 +52,7 @@ function api.get_up(player)
attached_to[player] = nil
end
player:set_eye_offset({x = 0, y = 0, z = 0}, {x = 0, y = 0, z = 0})
player:set_eye_offset({ x = 0, y = 0, z = 0 }, { x = 0, y = 0, z = 0 })
end
function api.stop_moving(player)
@ -61,7 +60,6 @@ function api.stop_moving(player)
player_monoids.speed:add_change(player, 0, "cottages:furniture")
player_monoids.jump:add_change(player, 0, "cottages:furniture")
player_monoids.gravity:add_change(player, 0, "cottages:furniture")
else
player:set_physics_override(0, 0, 0)
end
@ -79,10 +77,9 @@ function api.sit_on_bench(pos, node, player)
return
elseif animation.animation == "sit" then
api.get_up(player)
else
-- the bench is not centered; prevent the player from sitting on air
local player_pos = {x = pos.x, y = pos.y, z = pos.z}
local player_pos = { x = pos.x, y = pos.y, z = pos.z }
local player_name = player:get_player_name()
if node.param2 == 0 then
@ -100,10 +97,10 @@ function api.sit_on_bench(pos, node, player)
player_api.set_animation(player, "sit")
player_api.player_attached[player_name] = true
player:set_eye_offset({x = 0, y = -7, z = 2}, {x = 0, y = 0, z = 0})
player:set_eye_offset({ x = 0, y = -7, z = 2 }, { x = 0, y = 0, z = 0 })
player:set_pos(player_pos)
attached_to[player] = {pos}
attached_to[player] = { pos }
attached_at[pts(pos)] = player
end
end
@ -156,7 +153,6 @@ function api.is_valid_bed(pos, node)
if api.is_foot_of(node.name, foot_node.name) and node.param2 == foot_node.param2 then
return head_pos, foot_pos
end
else
if node.param2 == 2 then
head_pos.z = pos.z - 1
@ -184,10 +180,10 @@ function api.sleep_in_bed(pos, node, player)
local player_name = player:get_player_name()
local head_pos, foot_pos = api.is_valid_bed(pos, node)
for _, p in ipairs({head_pos, foot_pos}) do
for _, p in ipairs({ head_pos, foot_pos }) do
if p then
for y = 1, 2 do
local node_above = minetest.get_node(vector.add(p, {x = 0, y = y, z = 0}))
local node_above = minetest.get_node(vector.add(p, { x = 0, y = y, z = 0 }))
if node_above.name ~= "air" then
minetest.chat_send_player(
@ -211,19 +207,19 @@ function api.sleep_in_bed(pos, node, player)
if animation.animation == "lay" then
api.get_up(player)
minetest.chat_send_player(player_name, "That was enough sleep for now. You stand up again.")
elseif animation.animation == "sit" then
if head_pos and foot_pos then
player_api.set_animation(player, "lay")
player:set_eye_offset({x = 0, y = -14, z = 2}, {x = 0, y = 0, z = 0})
minetest.chat_send_player(player_name, S("You lie down and take a nap. A right-click will wake you up."))
player:set_eye_offset({ x = 0, y = -14, z = 2 }, { x = 0, y = 0, z = 0 })
minetest.chat_send_player(
player_name,
S("You lie down and take a nap. A right-click will wake you up.")
)
else
api.get_up(player)
minetest.chat_send_player(player_name, S("That was enough sitting around for now. You stand up again."))
end
end
else
-- sit on the bed before lying down
api.stop_moving(player)
@ -237,7 +233,6 @@ function api.sleep_in_bed(pos, node, player)
if bed_type == "bed" then
-- set the right height for the bed
sleep_pos.y = sleep_pos.y + 0.4
elseif bed_type == "mat" then
sleep_pos.y = sleep_pos.y - 0.4
end
@ -247,11 +242,11 @@ function api.sleep_in_bed(pos, node, player)
sleep_pos.z = (head_pos.z + foot_pos.z) / 2
end
player:set_eye_offset({x = 0, y = -7, z = 2}, {x = 0, y = 0, z = 0})
player:set_eye_offset({ x = 0, y = -7, z = 2 }, { x = 0, y = 0, z = 0 })
player:set_pos(sleep_pos)
if head_pos and foot_pos then
attached_to[player] = {head_pos, foot_pos}
attached_to[player] = { head_pos, foot_pos }
attached_at[pts(head_pos)] = player
attached_at[pts(foot_pos)] = player
@ -260,7 +255,7 @@ function api.sleep_in_bed(pos, node, player)
S("Aaah! What a comfortable @1. A second right-click will let you sleep.", bed_type)
)
else
attached_to[player] = {pos}
attached_to[player] = { pos }
attached_at[pts(pos)] = player
minetest.chat_send_player(

View File

@ -4,62 +4,62 @@ if ci.wool and ci.wood and ci.stick then
minetest.register_craft({
output = "cottages:bed_foot",
recipe = {
{ci.wool, "", "", },
{ci.wood, "", "", },
{ci.stick, "", "", }
}
{ ci.wool, "", "" },
{ ci.wood, "", "" },
{ ci.stick, "", "" },
},
})
minetest.register_craft({
output = "cottages:bed_head",
recipe = {
{"", "", ci.wool, },
{"", ci.stick, ci.wood, },
{"", "", ci.stick, }
}
{ "", "", ci.wool },
{ "", ci.stick, ci.wood },
{ "", "", ci.stick },
},
})
end
minetest.register_craft({
output = "cottages:sleeping_mat 3",
recipe = {
{"cottages:wool_tent", "cottages:straw_mat", "cottages:straw_mat"}
}
{ "cottages:wool_tent", "cottages:straw_mat", "cottages:straw_mat" },
},
})
minetest.register_craft({
output = "cottages:sleeping_mat_head",
recipe = {
{"cottages:sleeping_mat", "cottages:straw_mat"}
}
{ "cottages:sleeping_mat", "cottages:straw_mat" },
},
})
if ci.stick and ci.slab_wood then
minetest.register_craft({
output = "cottages:table",
recipe = {
{"", ci.slab_wood, "", },
{"", ci.stick, ""}
}
{ "", ci.slab_wood, "" },
{ "", ci.stick, "" },
},
})
end
minetest.register_craft({
output = "cottages:bench",
recipe = {
{"", ci.wood, "", },
{ci.stick, "", ci.stick, }
}
{ "", ci.wood, "" },
{ ci.stick, "", ci.stick },
},
})
if ci.stick and ci.wood then
minetest.register_craft({
output = "cottages:shelf",
recipe = {
{ci.stick, ci.wood, ci.stick, },
{ci.stick, ci.wood, ci.stick, },
{ci.stick, "", ci.stick}
}
{ ci.stick, ci.wood, ci.stick },
{ ci.stick, ci.wood, ci.stick },
{ ci.stick, "", ci.stick },
},
})
end
@ -67,9 +67,9 @@ if ci.stick and ci.clay then
minetest.register_craft({
output = "cottages:washing 2",
recipe = {
{ci.stick, },
{ci.clay, },
}
{ ci.stick },
{ ci.clay },
},
})
end
@ -77,7 +77,7 @@ if ci.steel then
minetest.register_craft({
output = "cottages:stovepipe 2",
recipe = {
{ci.steel, "", ci.steel},
}
{ ci.steel, "", ci.steel },
},
})
end

View File

@ -9,26 +9,26 @@ minetest.register_node("cottages:bed_foot", {
"cottages_beds_bed_side.png",
"cottages_beds_bed_side.png",
"cottages_beds_bed_side.png",
"cottages_beds_bed_side.png"
"cottages_beds_bed_side.png",
},
paramtype = "light",
paramtype2 = "facedir",
groups = {snappy = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
groups = { snappy = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3 },
sounds = cottages.sounds.wood,
node_box = {
type = "fixed",
fixed = {
{-0.5, 0.0, -0.5, 0.5, 0.3, 0.5},
{-0.5, -0.5, -0.5, -0.4, 0.5, -0.4},
{0.4, -0.5, -0.5, 0.5, 0.5, -0.4},
{-0.4, 0.3, -0.5, 0.4, 0.5, -0.4},
}
{ -0.5, 0.0, -0.5, 0.5, 0.3, 0.5 },
{ -0.5, -0.5, -0.5, -0.4, 0.5, -0.4 },
{ 0.4, -0.5, -0.5, 0.5, 0.5, -0.4 },
{ -0.4, 0.3, -0.5, 0.4, 0.5, -0.4 },
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.3, 0.5},
}
{ -0.5, -0.5, -0.5, 0.5, 0.3, 0.5 },
},
},
is_ground_content = false,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
@ -48,26 +48,26 @@ minetest.register_node("cottages:bed_head", {
"cottages_beds_bed_side_top_r.png",
"cottages_beds_bed_side_top_l.png",
cottages.textures.furniture,
"cottages_beds_bed_side.png"
"cottages_beds_bed_side.png",
},
paramtype = "light",
paramtype2 = "facedir",
groups = {snappy = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
groups = { snappy = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3 },
sounds = cottages.sounds.wood,
node_box = {
type = "fixed",
fixed = {
{-0.5, 0.0, -0.5, 0.5, 0.3, 0.5},
{-0.5, -0.5, 0.4, -0.4, 0.5, 0.5},
{0.4, -0.5, 0.4, 0.5, 0.5, 0.5},
{-0.4, 0.3, 0.4, 0.4, 0.5, 0.5},
}
{ -0.5, 0.0, -0.5, 0.5, 0.3, 0.5 },
{ -0.5, -0.5, 0.4, -0.4, 0.5, 0.5 },
{ 0.4, -0.5, 0.4, 0.5, 0.5, 0.5 },
{ -0.4, 0.3, 0.4, 0.4, 0.5, 0.5 },
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.3, 0.5},
}
{ -0.5, -0.5, -0.5, 0.5, 0.3, 0.5 },
},
},
is_ground_content = false,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
@ -81,26 +81,26 @@ minetest.register_node("cottages:bed_head", {
minetest.register_node("cottages:sleeping_mat", {
description = S("sleeping mat"),
drawtype = "nodebox",
tiles = {"cottages_sleepingmat.png"},
tiles = { "cottages_sleepingmat.png" },
wield_image = "cottages_sleepingmat.png",
inventory_image = "cottages_sleepingmat.png",
sunlight_propagates = true,
paramtype = "light",
paramtype2 = "facedir",
walkable = false,
groups = {snappy = 3},
groups = { snappy = 3 },
sounds = cottages.sounds.leaves,
node_box = {
type = "fixed",
fixed = {
{-0.48, -0.5, -0.48, 0.48, -0.5 + 1 / 16, 0.48},
}
{ -0.48, -0.5, -0.48, 0.48, -0.5 + 1 / 16, 0.48 },
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.48, -0.5, -0.48, 0.48, -0.5 + 2 / 16, 0.48},
}
{ -0.48, -0.5, -0.48, 0.48, -0.5 + 2 / 16, 0.48 },
},
},
is_ground_content = false,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
@ -114,25 +114,25 @@ minetest.register_node("cottages:sleeping_mat", {
minetest.register_node("cottages:sleeping_mat_head", {
description = S("sleeping mat with pillow"),
drawtype = "nodebox",
tiles = {"cottages_sleepingmat.png"}, -- done by VanessaE
tiles = { "cottages_sleepingmat.png" }, -- done by VanessaE
wield_image = "cottages_sleepingmat.png",
inventory_image = "cottages_sleepingmat.png",
sunlight_propagates = true,
paramtype = "light",
paramtype2 = "facedir",
groups = {snappy = 3},
groups = { snappy = 3 },
sounds = cottages.sounds.leaves,
node_box = {
type = "fixed",
fixed = {
{-0.48, -0.5, -0.48, 0.48, -0.5 + 1 / 16, 0.48},
{-0.34, -0.5 + 1 / 16, -0.12, 0.34, -0.5 + 2 / 16, 0.34},
{ -0.48, -0.5, -0.48, 0.48, -0.5 + 1 / 16, 0.48 },
{ -0.34, -0.5 + 1 / 16, -0.12, 0.34, -0.5 + 2 / 16, 0.34 },
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.48, -0.5, -0.48, 0.48, -0.5 + 2 / 16, 0.48},
{ -0.48, -0.5, -0.48, 0.48, -0.5 + 2 / 16, 0.48 },
},
},
is_ground_content = false,
@ -153,25 +153,25 @@ minetest.register_node("cottages:bench", {
"cottages_minimal_wood.png",
"cottages_minimal_wood.png",
"cottages_minimal_wood.png",
"cottages_minimal_wood.png"
"cottages_minimal_wood.png",
},
paramtype = "light",
paramtype2 = "facedir",
groups = {snappy = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
groups = { snappy = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3 },
sounds = cottages.sounds.wood,
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.15, 0.1, 0.5, -0.05, 0.5},
{-0.4, -0.5, 0.2, -0.3, -0.15, 0.4},
{0.3, -0.5, 0.2, 0.4, -0.15, 0.4},
}
{ -0.5, -0.15, 0.1, 0.5, -0.05, 0.5 },
{ -0.4, -0.5, 0.2, -0.3, -0.15, 0.4 },
{ 0.3, -0.5, 0.2, 0.4, -0.15, 0.4 },
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, 0, 0.5, 0, 0.5},
}
{ -0.5, -0.5, 0, 0.5, 0, 0.5 },
},
},
is_ground_content = false,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
@ -185,21 +185,21 @@ minetest.register_node("cottages:bench", {
minetest.register_node("cottages:table", {
description = S("table"),
drawtype = "nodebox",
tiles = {"cottages_minimal_wood.png"},
tiles = { "cottages_minimal_wood.png" },
paramtype = "light",
paramtype2 = "facedir",
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2},
groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2 },
node_box = {
type = "fixed",
fixed = {
{-0.1, -0.5, -0.1, 0.1, 0.3, 0.1},
{-0.5, 0.48, -0.5, 0.5, 0.4, 0.5},
{ -0.1, -0.5, -0.1, 0.1, 0.3, 0.1 },
{ -0.5, 0.48, -0.5, 0.5, 0.4, 0.5 },
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.4, 0.5},
{ -0.5, -0.5, -0.5, 0.5, 0.4, 0.5 },
},
},
is_ground_content = false,
@ -208,35 +208,38 @@ minetest.register_node("cottages:table", {
minetest.register_node("cottages:shelf", {
description = S("open storage shelf"),
drawtype = "nodebox",
tiles = {"cottages_minimal_wood.png"},
tiles = { "cottages_minimal_wood.png" },
paramtype = "light",
paramtype2 = "facedir",
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2},
groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2 },
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.3, -0.4, 0.5, 0.5},
{0.4, -0.5, -0.3, 0.5, 0.5, 0.5},
{ -0.5, -0.5, -0.3, -0.4, 0.5, 0.5 },
{ 0.4, -0.5, -0.3, 0.5, 0.5, 0.5 },
{-0.5, -0.2, -0.3, 0.5, -0.1, 0.5},
{-0.5, 0.3, -0.3, 0.5, 0.4, 0.5},
{ -0.5, -0.2, -0.3, 0.5, -0.1, 0.5 },
{ -0.5, 0.3, -0.3, 0.5, 0.4, 0.5 },
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
{ -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 },
},
},
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", [[
meta:set_string(
"formspec",
[[
size[8,8]
list[context;main;0,0;8,3;]
list[current_player;main;0,4;8,4;]
listring[]
]])
]]
)
meta:set_string("infotext", S("open storage shelf"))
local inv = meta:get_inventory()
inv:set_size("main", 24)
@ -263,20 +266,20 @@ minetest.register_node("cottages:shelf", {
minetest.register_node("cottages:stovepipe", {
description = S("stovepipe"),
drawtype = "nodebox",
tiles = {"cottages_steel_block.png"},
tiles = { "cottages_steel_block.png" },
paramtype = "light",
paramtype2 = "facedir",
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2},
groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2 },
node_box = {
type = "fixed",
fixed = {
{0.20, -0.5, 0.20, 0.45, 0.5, 0.45},
{ 0.20, -0.5, 0.20, 0.45, 0.5, 0.45 },
},
},
selection_box = {
type = "fixed",
fixed = {
{0.20, -0.5, 0.20, 0.45, 0.5, 0.45},
{ 0.20, -0.5, 0.20, 0.45, 0.5, 0.45 },
},
},
is_ground_content = false,
@ -286,36 +289,32 @@ minetest.register_node("cottages:washing", {
description = S("washing place"),
drawtype = "nodebox",
-- top, bottom, side1, side2, inner, outer
tiles = {"cottages_clay.png"},
tiles = { "cottages_clay.png" },
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2},
groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2 },
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.2, -0.2},
{-0.5, -0.5, -0.2, -0.4, 0.2, 0.5},
{0.4, -0.5, -0.2, 0.5, 0.2, 0.5},
{-0.4, -0.5, 0.4, 0.4, 0.2, 0.5},
{-0.4, -0.5, -0.2, 0.4, 0.2, -0.1},
{ -0.5, -0.5, -0.5, 0.5, -0.2, -0.2 },
{ -0.5, -0.5, -0.2, -0.4, 0.2, 0.5 },
{ 0.4, -0.5, -0.2, 0.5, 0.2, 0.5 },
{ -0.4, -0.5, 0.4, 0.4, 0.2, 0.5 },
{ -0.4, -0.5, -0.2, 0.4, 0.2, -0.1 },
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.2, 0.5},
{ -0.5, -0.5, -0.5, 0.5, 0.2, 0.5 },
},
},
on_rightclick = function(pos, node, player)
-- works only with water beneath
local node_under = minetest.get_node({x = pos.x, y = (pos.y - 1), z = pos.z})
local node_under = minetest.get_node({ x = pos.x, y = (pos.y - 1), z = pos.z })
if minetest.get_item_group(node_under.name, "water") > 0 then
minetest.chat_send_player(
player:get_player_name(),
S("You feel much cleaner after some washing.")
)
minetest.chat_send_player(player:get_player_name(), S("You feel much cleaner after some washing."))
else
minetest.chat_send_player(
player:get_player_name(),