stylua fixes

This commit is contained in:
flux 2023-01-22 19:36:23 -08:00
parent b58368ea6a
commit 0157649fa5
No known key found for this signature in database
GPG Key ID: 9333B27816848A15
50 changed files with 945 additions and 980 deletions

View File

@ -1,10 +1,10 @@
cottages.handmill_product = {
__newindex = function(t, k, v)
cottages.straw.register_quern_craft({ input = k, output = v })
end
end,
}
cottages.forbid_repair = {
__newindex = function(t, k, v)
cottages.anvil.make_unrepairable(k)
end
end,
}

View File

@ -5,6 +5,6 @@ if workbench then
minetest.override_item("cottages:table", {
tiles = { workbench.tiles[1], cottages_table_def.tiles[1] },
on_rightclick = workbench.on_rightclick
on_rightclick = workbench.on_rightclick,
})
end

View File

@ -1,4 +1,3 @@
if cottages.has.workbench then
cottages.dofile("compat", "adventuretest")
cottages.dofile("compat", "realtest")

View File

@ -7,7 +7,7 @@ minetest.register_entity("cottages:anvil_item", {
initial_properties = {
hp_max = 1,
visual = "wielditem",
visual_size = {x = .33, y = .33},
visual_size = { x = 0.33, y = 0.33 },
collisionbox = { 0, 0, 0, 0, 0, 0 },
physical = false,
collide_with_objects = false,
@ -54,7 +54,6 @@ if cottages.settings.anvil.tool_entity_enabled then
-- automatically restore entities lost due to /clearobjects or similar
if cottages.has.node_entity_queue then
node_entity_queue.api.register_node_entity_loader("cottages:anvil", anvil.update_entity)
else
minetest.register_lbm({
name = "cottages:anvil_item_restoration",
@ -65,7 +64,6 @@ if cottages.settings.anvil.tool_entity_enabled then
end,
})
end
else
minetest.register_lbm({
name = "cottages:anvil_item_removal",
@ -84,13 +82,12 @@ if minetest.registered_entities["anvil:item"] then
self.object:remove()
end
end
else
minetest.register_entity(":anvil:item", {
on_step = function(self)
if self.object then
self.object:remove()
end
end
end,
})
end

View File

@ -14,7 +14,7 @@ minetest.register_tool("cottages:hammer", {
cracky = { times = { [2] = 2.00, [3] = 1.20 }, uses = 30, maxlevel = 1 },
},
damage_groups = { fleshy = 6 },
}
},
})
if cottages.settings.anvil.disable_hammer_repair then

View File

@ -1,6 +1,8 @@
local S = cottages.S
local F = minetest.formspec_escape
local FS = function(...) return F(S(...)) end
local FS = function(...)
return F(S(...))
end
local max_liquid_amount = cottages.settings.barrel.max_liquid_amount
@ -14,7 +16,6 @@ function barrel.get_barrel_info(pos)
barrel.get_liquid_amount(pos),
max_liquid_amount
)
else
return S("Empty Barrel")
end
@ -22,17 +23,17 @@ end
function barrel.get_barrel_fs_parts(pos)
local parts = {
("size[8,9]"),
"size[8,9]",
("label[0,0.0;%s]"):format(FS("barrel (liquid storage)")),
("label[3,0;%s]"):format(FS("fill:")),
("list[context;input;3,0.5;1,1;]"),
"list[context;input;3,0.5;1,1;]",
("label[5,3.3;%s]"):format(FS("drain:")),
("list[context;output;5,3.8;1,1;]"),
("list[current_player;main;0,5;8,4;]"),
("listring[context;output]"),
("listring[current_player;main]"),
("listring[context;input]"),
("listring[current_player;main]"),
"list[context;output;5,3.8;1,1;]",
"list[current_player;main;0,5;8,4;]",
"listring[context;output]",
"listring[current_player;main]",
"listring[context;input]",
"listring[current_player;main]",
}
local liquid = barrel.get_barrel_liquid(pos)
@ -40,35 +41,50 @@ function barrel.get_barrel_fs_parts(pos)
if liquid then
local liquid_texture = barrel.texture_by_liquid[liquid]
table.insert(parts, ("image[2.6,2;2,3;%s^[resize:%ix%i^[lowpart:%s:%s]"):format(
table.insert(
parts,
("image[2.6,2;2,3;%s^[resize:%ix%i^[lowpart:%s:%s]"):format(
F(cottages.textures.furniture),
max_liquid_amount, max_liquid_amount,
max_liquid_amount,
max_liquid_amount,
math.floor(max_liquid_amount * liquid_amount / max_liquid_amount),
F(liquid_texture
.. futil.escape_texture(("^[resize:%ix%i"):format(max_liquid_amount, max_liquid_amount)))
))
table.insert(parts, ("tooltip[2.6,2;2,3;%s]"):format(
F(("%s (%i/%i)"):format(
F(
liquid_texture
.. futil.escape_texture(("^[resize:%ix%i"):format(max_liquid_amount, max_liquid_amount))
)
)
)
table.insert(
parts,
("tooltip[2.6,2;2,3;%s]"):format(
F(
("%s (%i/%i)"):format(
barrel.name_by_liquid[liquid],
barrel.get_liquid_amount(pos),
max_liquid_amount
)))
)
)
)
)
else
table.insert(parts, ("image[2.6,2;2,3;%s^[resize:%ix%i^[lowpart:%s:%s]"):format(
table.insert(
parts,
("image[2.6,2;2,3;%s^[resize:%ix%i^[lowpart:%s:%s]"):format(
F(cottages.textures.furniture),
max_liquid_amount, max_liquid_amount,
max_liquid_amount,
max_liquid_amount,
0,
F(cottages.textures.furniture
.. futil.escape_texture(("^[resize:%ix%i"):format(max_liquid_amount, max_liquid_amount)))
))
F(
cottages.textures.furniture
.. futil.escape_texture(("^[resize:%ix%i"):format(max_liquid_amount, max_liquid_amount))
)
)
)
end
return parts
end
function barrel.can_dig(pos, player)
return barrel.get_liquid_amount(pos) == 0
end
@ -89,7 +105,6 @@ function barrel.allow_metadata_inventory_move(pos, from_list, from_index, to_lis
if barrel.can_drain(pos, item) then
return 1
end
elseif to_list == "output" then
if barrel.can_fill(pos, item) then
return 1
@ -106,7 +121,6 @@ function barrel.allow_metadata_inventory_put(pos, listname, index, stack, player
if barrel.can_drain(pos, item) then
return 1
end
elseif listname == "output" then
if barrel.can_fill(pos, item) then
return 1
@ -124,7 +138,6 @@ function barrel.on_metadata_inventory_put(pos, listname, index, stack, player)
if listname == "input" then
local empty = barrel.add_barrel_liquid(pos, name)
inv:set_stack(listname, index, empty)
elseif listname == "output" then
local full = barrel.drain_barrel_liquid(pos, name)
inv:set_stack(listname, index, full)
@ -150,7 +163,7 @@ cottages.api.register_machine("cottages:barrel", {
snappy = 1,
choppy = 2,
oddly_breakable_by_hand = 1,
flammable = 2
flammable = 2,
},
sounds = cottages.sounds.wood,

View File

@ -16,5 +16,5 @@ minetest.register_lbm({
minetest.swap_node(pos, node)
cottages.api.update(pos, node)
end
end,
})

View File

@ -28,17 +28,19 @@ minetest.register_node("cottages:tub", {
type = "fixed",
fixed = {
{ -0.5, -0.5, -0.5, 0.5, -0.1, 0.5 },
}},
},
},
collision_box = {
type = "fixed",
fixed = {
{ -0.5, -0.5, -0.5, 0.5, -0.1, 0.5 },
}},
},
},
groups = {
snappy = 1,
choppy = 2,
oddly_breakable_by_hand = 1,
flammable = 2
flammable = 2,
},
is_ground_content = false,
})

View File

@ -7,7 +7,7 @@ minetest.register_abm({
if not cottages.doorlike.is_night() then
cottages.doorlike.shutter_open(pos)
end
end
end,
})
-- close them at night
@ -19,5 +19,5 @@ minetest.register_abm({
if cottages.doorlike.is_night() then
cottages.doorlike.shutter_close(pos)
end
end
end,
})

View File

@ -122,7 +122,6 @@ function api.register_hatch(nodename, description, texture, receipe_item, def)
}
doors.register_trapdoor(nodename, def)
else
minetest.register_node(nodename, {
description = S(description), -- not that there are any other...
@ -158,6 +157,6 @@ function api.register_hatch(nodename, description, texture, receipe_item, def)
recipe = {
{ "", "", receipe_item },
{ receipe_item, cottages.craftitems.stick, "" },
}
},
})
end

View File

@ -5,14 +5,14 @@ minetest.register_craft({
output = "cottages:window_shutter_open",
recipe = {
{ "cottages:window_shutter_closed" },
}
},
})
minetest.register_craft({
output = "cottages:window_shutter_closed",
recipe = {
{ "cottages:window_shutter_open" },
}
},
})
if ci.wood then
@ -20,7 +20,7 @@ if ci.wood then
output = "cottages:window_shutter_open",
recipe = {
{ ci.wood, "", ci.wood },
}
},
})
end
@ -29,14 +29,14 @@ minetest.register_craft({
output = "cottages:half_door",
recipe = {
{ "cottages:half_door_inverted" },
}
},
})
minetest.register_craft({
output = "cottages:half_door_inverted",
recipe = {
{ "cottages:half_door" },
}
},
})
if ci.wood and ci.door then
@ -45,7 +45,7 @@ if ci.wood and ci.door then
recipe = {
{ "", ci.wood, "" },
{ "", ci.door, "" },
}
},
})
end
@ -54,14 +54,14 @@ minetest.register_craft({
output = "cottages:gate_closed",
recipe = {
{ "cottages:gate_open" },
}
},
})
minetest.register_craft({
output = "cottages:gate_open",
recipe = {
{ "cottages:gate_closed" },
}
},
})
if ci.stick and ci.wood then
@ -69,6 +69,6 @@ if ci.stick and ci.wood then
output = "cottages:gate_closed",
recipe = {
{ ci.stick, ci.stick, ci.wood },
}
},
})
end

View File

@ -79,20 +79,23 @@ minetest.register_node("cottages:half_door", {
local param2 = node.param2
if param2 % 4 == 1 then
param2 = param2 + 1; --2
param2 = param2 + 1 --2
elseif param2 % 4 == 2 then
param2 = param2 - 1; --1
param2 = param2 - 1 --1
elseif param2 % 4 == 3 then
param2 = param2 - 3; --0
param2 = param2 - 3 --0
elseif param2 % 4 == 0 then
param2 = param2 + 3; --3
param2 = param2 + 3 --3
end
minetest.swap_node(pos, { name = "cottages:half_door", param2 = param2 })
-- if the node above consists of a door of the same type, open it as well
-- Note: doors beneath this one are not opened!
-- It is a special feature of these doors that they can be opend partly
if node2 ~= nil and node2.name == node.name and node2.param2 == node.param2 then
minetest.swap_node({x = pos.x, y = (pos.y + 1), z = pos.z}, {name = "cottages:half_door", param2 = param2})
minetest.swap_node(
{ x = pos.x, y = (pos.y + 1), z = pos.z },
{ name = "cottages:half_door", param2 = param2 }
)
end
end,
is_ground_content = false,
@ -122,19 +125,21 @@ minetest.register_node("cottages:half_door_inverted", {
local param2 = node.param2
if param2 % 4 == 1 then
param2 = param2 - 1; --0
param2 = param2 - 1 --0
elseif param2 % 4 == 0 then
param2 = param2 + 1; --1
param2 = param2 + 1 --1
elseif param2 % 4 == 2 then
param2 = param2 + 1; --3
param2 = param2 + 1 --3
elseif param2 % 4 == 3 then
param2 = param2 - 1; --2
param2 = param2 - 1 --2
end
minetest.swap_node(pos, { name = "cottages:half_door_inverted", param2 = param2 })
-- open upper parts of this door (if there are any)
if node2 ~= nil and node2.name == node.name and node2.param2 == node.param2 then
minetest.swap_node({x = pos.x, y = (pos.y + 1), z = pos.z},
{name = "cottages:half_door_inverted", param2 = param2})
minetest.swap_node(
{ x = pos.x, y = (pos.y + 1), z = pos.z },
{ name = "cottages:half_door_inverted", param2 = param2 }
)
end
end,
is_ground_content = false,
@ -187,7 +192,6 @@ minetest.register_node("cottages:gate_open", {
{ -0.80, -0.5, -0.05, -0.60, -0.46, 0.15 },
{ 0.60, -0.5, -0.05, 0.80, -0.46, 0.15 },
{ -0.15, -0.5, -0.05, 0.15, -0.46, 0.15 },
},
},
selection_box = {

View File

@ -7,8 +7,8 @@ local box_slope = {
{ -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 },
{ -0.5, -0.25, -0.25, 0.5, 0, 0.5 },
{ -0.5, 0, 0, 0.5, 0.25, 0.5 },
{-0.5, 0.25, 0.25, 0.5, 0.5, 0.5}
}
{ -0.5, 0.25, 0.25, 0.5, 0.5, 0.5 },
},
}
local box_slope_long = {
@ -18,22 +18,19 @@ local box_slope_long = {
{ -0.5, -0.25, -1.3, 0.5, -0.25, 0.5 },
{ -0.5, -0.25, -1.0, 0.5, 0, 0.5 },
{ -0.5, 0, -0.5, 0.5, 0.25, 0.5 },
{-0.5, 0.25, 0, 0.5, 0.5, 0.5}
}
{ -0.5, 0.25, 0, 0.5, 0.5, 0.5 },
},
}
local function simplify_tile(tile)
if type(tile) == "string" then
return tile
elseif type(tile) == "table" then
if type(tile.name) == "string" then
return tile.name
else
error(("weird tile %q"):dump(tile))
end
else
error(("weird tile %q"):dump(tile))
end
@ -43,18 +40,15 @@ local function get_textures(tiles, special)
if #tiles == 1 then
local tile1 = simplify_tile(tiles[1])
return tile1, tile1, tile1, tile1, "cottages_feldweg_surface.png^" .. (special or tile1)
elseif #tiles == 2 then
local tile1 = simplify_tile(tiles[1])
local tile2 = simplify_tile(tiles[2])
return tile1, tile2, tile1, tile1, "cottages_feldweg_surface.png^" .. (special or tile1)
elseif #tiles == 3 then
local tile1 = simplify_tile(tiles[1])
local tile2 = simplify_tile(tiles[2])
local tile3 = simplify_tile(tiles[3])
return tile1, tile2, tile3, tile3, "cottages_feldweg_surface.png^" .. (special or tile1)
else
error(("not implemented: %i tiles"):format(#tiles))
end
@ -109,13 +103,13 @@ function api.register_feldweg(node, suffix, special)
texture_bottom,
texture_top,
"cottages_feldweg_surface.png",
texture_edges
texture_edges,
},
recipe = {
{ "", "cottages:wagon_wheel", "" },
{ node, node, node },
},
replacements = {{"cottages:wagon_wheel", "cottages:wagon_wheel"},},
replacements = { { "cottages:wagon_wheel", "cottages:wagon_wheel" } },
output_amount = 3,
reverts_to = node,
})

View File

@ -1,2 +1 @@
cottages.feldweg.register_feldweg("ethereal:bamboo_dirt", "_bamboo")

View File

@ -1,18 +1,10 @@
local S = cottages.S
stairs.register_stair_and_slab(
"feldweg",
"cottages:feldweg",
{crumbly = 3},
{
stairs.register_stair_and_slab("feldweg", "cottages:feldweg", { crumbly = 3 }, {
"cottages_feldweg.png",
"default_dirt.png",
"default_grass.png",
"default_grass.png",
"cottages_feldweg.png",
"cottages_feldweg.png"
},
S("Dirt Road Stairs"),
S("Dirt Road, half height"),
cottages.sounds.dirt
)
"cottages_feldweg.png",
}, S("Dirt Road Stairs"), S("Dirt Road, half height"), cottages.sounds.dirt)

View File

@ -5,7 +5,7 @@ if ci.fence then
output = "cottages:fence_small 3",
recipe = {
{ ci.fence, ci.fence },
}
},
})
end
@ -15,7 +15,7 @@ if minetest.get_modpath("xfences") then
output = "cottages:fence_small 3",
recipe = {
{ "xfences:fence", "xfences:fence" },
}
},
})
end
@ -23,26 +23,26 @@ minetest.register_craft({
output = "cottages:fence_corner",
recipe = {
{ "cottages:fence_small", "cottages:fence_small" },
}
},
})
minetest.register_craft({
output = "cottages:fence_small 2",
recipe = {
{ "cottages:fence_corner" },
}
},
})
minetest.register_craft({
output = "cottages:fence_end",
recipe = {
{ "cottages:fence_small", "cottages:fence_small", "cottages:fence_small" },
}
},
})
minetest.register_craft({
output = "cottages:fence_small 3",
recipe = {
{ "cottages:fence_end" },
}
},
})

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
@ -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,7 +77,6 @@ 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 }
@ -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
@ -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."))
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

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
@ -78,6 +78,6 @@ if ci.steel then
output = "cottages:stovepipe 2",
recipe = {
{ ci.steel, "", ci.steel },
}
},
})
end

View File

@ -9,7 +9,7 @@ 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",
@ -22,13 +22,13 @@ minetest.register_node("cottages:bed_foot", {
{ -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 },
}
},
},
is_ground_content = false,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
@ -48,7 +48,7 @@ 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",
@ -61,13 +61,13 @@ minetest.register_node("cottages:bed_head", {
{ -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 },
}
},
},
is_ground_content = false,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
@ -94,13 +94,13 @@ minetest.register_node("cottages:sleeping_mat", {
type = "fixed",
fixed = {
{ -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 },
}
},
},
is_ground_content = false,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
@ -153,7 +153,7 @@ 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",
@ -165,13 +165,13 @@ minetest.register_node("cottages:bench", {
{ -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 },
}
},
},
is_ground_content = false,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
@ -231,12 +231,15 @@ minetest.register_node("cottages:shelf", {
},
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)
@ -311,11 +314,7 @@ minetest.register_node("cottages:washing", {
-- works only with water beneath
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(),

View File

@ -1,4 +1,3 @@
minetest.register_craft({
output = "cottages:hay_mat 9",
recipe = {

View File

@ -1,3 +1,2 @@
cottages.dofile("modules", "hay", "nodes")
cottages.dofile("modules", "hay", "crafts")

View File

@ -5,7 +5,7 @@ minetest.register_node("cottages:hay_mat", {
paramtype2 = "leveled",
description = S("Some hay"),
tiles = {
cottages.textures.straw .. "^[multiply:#88BB88"
cottages.textures.straw .. "^[multiply:#88BB88",
},
groups = { hay = 3, snappy = 2, oddly_breakable_by_hand = 2, flammable = 3 },
sounds = cottages.sounds.leaves,
@ -15,7 +15,7 @@ minetest.register_node("cottages:hay_mat", {
type = "leveled", --"fixed",
fixed = {
{ -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 },
}
},
},
-- make sure a placed hay block looks halfway reasonable
after_place_node = function(pos, placer, itemstack, pointed_thing)
@ -45,13 +45,13 @@ minetest.register_node("cottages:hay_bale", {
type = "fixed",
fixed = {
{ -0.45, -0.5, -0.45, 0.45, 0.45, 0.45 },
}
},
},
selection_box = {
type = "fixed",
fixed = {
{ -0.45, -0.5, -0.45, 0.45, 0.45, 0.45 },
}
},
},
is_ground_content = false,
})

View File

@ -6,8 +6,8 @@ if ci.iron and ci.stick and ci.steel then
recipe = {
{ ci.iron, ci.stick, ci.iron },
{ ci.stick, ci.steel, ci.stick },
{ci.iron, ci.stick, ci.iron}
}
{ ci.iron, ci.stick, ci.iron },
},
})
end
@ -16,8 +16,8 @@ if ci.sand and ci.clay then
output = "cottages:loam 4",
recipe = {
{ ci.sand },
{ci.clay}
}
{ ci.clay },
},
})
end
@ -25,8 +25,8 @@ minetest.register_craft({
output = "cottages:straw_ground 2",
recipe = {
{ "cottages:straw_mat" },
{"cottages:loam"}
}
{ "cottages:loam" },
},
})
if ci.stick and ci.glass then
@ -35,8 +35,8 @@ if ci.stick and ci.glass then
recipe = {
{ ci.stick, ci.stick, ci.stick },
{ ci.stick, ci.glass, ci.stick },
{ci.stick, ci.stick, ci.stick}
}
{ ci.stick, ci.stick, ci.stick },
},
})
end
@ -44,14 +44,14 @@ minetest.register_craft({
output = "cottages:glass_pane_side",
recipe = {
{ "cottages:glass_pane" },
}
},
})
minetest.register_craft({
output = "cottages:glass_pane",
recipe = {
{ "cottages:glass_pane_side" },
}
},
})
if ci.stick and ci.string then
@ -60,7 +60,7 @@ if ci.stick and ci.string then
recipe = {
{ ci.stick, ci.string, ci.stick },
{ ci.stick, "", ci.stick },
}
},
})
end
@ -69,14 +69,14 @@ if ci.stick then
output = "cottages:wool_tent 2",
recipe = {
{ ci.string, ci.string },
{"", ci.stick}
}
{ "", ci.stick },
},
})
end
minetest.register_craft({
output = "cottages:wool",
recipe = {
{"cottages:wool_tent", "cottages:wool_tent"}
}
{ "cottages:wool_tent", "cottages:wool_tent" },
},
})

View File

@ -1,3 +1,2 @@
cottages.dofile("modules", "historic", "nodes")
cottages.dofile("modules", "historic", "crafts")

View File

@ -2,7 +2,6 @@ local S = cottages.S
if cottages.has.wool and minetest.registered_nodes["wool:white"] then
minetest.register_alias("cottages:wool", "wool:white")
else
minetest.register_node("cottages:wool", {
description = "Wool",
@ -110,14 +109,13 @@ minetest.register_node("cottages:straw_ground", {
"cottages_loam.png",
"cottages_loam.png",
"cottages_loam.png",
"cottages_loam.png"
"cottages_loam.png",
},
groups = { snappy = 2, crumbly = 3, choppy = 2, oddly_breakable_by_hand = 2 },
sounds = cottages.sounds.leaves,
is_ground_content = false,
})
minetest.register_node("cottages:loam", {
description = S("loam"),
tiles = { "cottages_loam.png" },
@ -145,7 +143,9 @@ minetest.register_node("cottages:wagon_wheel", {
})
if cottages.has.stairs then
stairs.register_stair_and_slab("loam", "cottages:loam",
stairs.register_stair_and_slab(
"loam",
"cottages:loam",
{ snappy = 2, crumbly = 3, choppy = 2, oddly_breakable_by_hand = 2 },
{ "cottages_loam.png" },
S("Loam Stairs"),

View File

@ -4,8 +4,8 @@ if ci.cotton then
minetest.register_craft({
output = "cottages:rope",
recipe = {
{ci.cotton, ci.cotton, ci.cotton}
}
{ ci.cotton, ci.cotton, ci.cotton },
},
})
end
@ -13,7 +13,7 @@ if ci.ladder and ci.rail then
minetest.register_craft({
output = "cottages:ladder_with_rope_and_rail 3",
recipe = {
{ci.ladder, "cottages:rope", ci.rail}
}
{ ci.ladder, "cottages:rope", ci.rail },
},
})
end

View File

@ -1,3 +1,2 @@
cottages.dofile("modules", "mining", "nodes")
cottages.dofile("modules", "mining", "crafts")

View File

@ -8,7 +8,7 @@ if ci.stick then
{ ci.stick, ci.stick, ci.stick },
{ "", ci.stick, "" },
{ "", ci.stick, "" },
}
},
})
end

View File

@ -1,3 +1,2 @@
cottages.dofile("modules", "pitchfork", "tool")
cottages.dofile("modules", "pitchfork", "crafts")

View File

@ -16,9 +16,9 @@ minetest.register_node("cottages:pitchfork", {
full_punch_interval = 1.0,
max_drop_level = 1,
groupcaps = {
crumbly = {times={[2]=3.00, [3]=0.70}, maxlevel = 1, uses = 0, punch_attack_uses = 0, },
snappy = {times = {[2] = 0.40, [3] = 0.20}, maxlevel = 1, uses = 0, punch_attack_uses = 0, },
hay = {times = {[2] = 0.10, [3] = 0.10}, maxlevel = 1, uses = 0, punch_attack_uses = 0, },
crumbly = { times = { [2] = 3.00, [3] = 0.70 }, maxlevel = 1, uses = 0, punch_attack_uses = 0 },
snappy = { times = { [2] = 0.40, [3] = 0.20 }, maxlevel = 1, uses = 0, punch_attack_uses = 0 },
hay = { times = { [2] = 0.10, [3] = 0.10 }, maxlevel = 1, uses = 0, punch_attack_uses = 0 },
},
damage_groups = { fleshy = 5 }, -- slightly stronger than a stone sword
},
@ -51,7 +51,7 @@ minetest.register_node("cottages:pitchfork", {
},
selection_box = {
type = "fixed",
fixed = {-0.3, -0.5, -0.1, 0.3, 1.0, 0.1}
fixed = { -0.3, -0.5, -0.1, 0.3, 1.0, 0.1 },
},
})

View File

@ -81,8 +81,8 @@ function cottages.roof.register_roof(name, material, tiles)
recipe = {
{ "", "", material },
{ "", material, "" },
{material, "", ""}
}
{ material, "", "" },
},
})
minetest.register_craft({
@ -90,22 +90,21 @@ function cottages.roof.register_roof(name, material, tiles)
recipe = {
{ "cottages:roof_" .. name },
{ ci.wood },
}
},
})
minetest.register_craft({
output = "cottages:roof_flat_" .. name .. " 2",
recipe = {
{ "cottages:roof_" .. name, "cottages:roof_" .. name },
}
},
})
-- convert flat roofs back to normal roofs
minetest.register_craft({
output = "cottages:roof_" .. name,
recipe = {
{"cottages:roof_flat_" .. name, "cottages:roof_flat_" .. name}
}
{ "cottages:roof_flat_" .. name, "cottages:roof_flat_" .. name },
},
})
end -- of cottages.register_roof( name, tiles, basic_material )

View File

@ -2,12 +2,10 @@ local ci = cottages.craftitems
minetest.register_craft({
output = "cottages:reet",
recipe = {{ci.papyrus, ci.papyrus},
{ci.papyrus, ci.papyrus},
},
recipe = { { ci.papyrus, ci.papyrus }, { ci.papyrus, ci.papyrus } },
})
minetest.register_craft({
output = "cottages:slate_vertical",
recipe = {{ci.stone, ci.wood}}
recipe = { { ci.stone, ci.wood } },
})

View File

@ -5,64 +5,70 @@ if cottages.settings.roof.use_farming_straw_stairs then
minetest.register_alias("cottages:roof_straw", "stairs:stair_straw")
minetest.register_alias("cottages:roof_connector_straw", "stairs:stair_straw")
minetest.register_alias("cottages:roof_flat_straw", "stairs:slab_straw")
else
cottages.roof.register_roof(
"straw",
"cottages:straw_mat",
{cottages.textures.straw, cottages.textures.straw,
cottages.textures.straw, cottages.textures.straw,
cottages.textures.straw, cottages.textures.straw}
)
cottages.roof.register_roof("straw", "cottages:straw_mat", {
cottages.textures.straw,
cottages.textures.straw,
cottages.textures.straw,
cottages.textures.straw,
cottages.textures.straw,
cottages.textures.straw,
})
end
cottages.roof.register_roof(
"reet",
ci.papyrus,
{"cottages_reet.png", "cottages_reet.png",
"cottages_reet.png", "cottages_reet.png",
"cottages_reet.png", "cottages_reet.png"}
)
cottages.roof.register_roof("reet", ci.papyrus, {
"cottages_reet.png",
"cottages_reet.png",
"cottages_reet.png",
"cottages_reet.png",
"cottages_reet.png",
"cottages_reet.png",
})
cottages.roof.register_roof(
"wood",
ci.wood,
{cottages.textures.roof_wood, cottages.textures.roof_sides,
cottages.textures.roof_sides, cottages.textures.roof_sides,
cottages.textures.roof_sides, cottages.textures.roof_wood}
)
cottages.roof.register_roof("wood", ci.wood, {
cottages.textures.roof_wood,
cottages.textures.roof_sides,
cottages.textures.roof_sides,
cottages.textures.roof_sides,
cottages.textures.roof_sides,
cottages.textures.roof_wood,
})
cottages.roof.register_roof(
"black",
ci.coal_lump,
{"cottages_homedecor_shingles_asphalt.png", cottages.textures.roof_sides,
cottages.textures.roof_sides, cottages.textures.roof_sides,
cottages.textures.roof_sides, "cottages_homedecor_shingles_asphalt.png"}
)
cottages.roof.register_roof("black", ci.coal_lump, {
"cottages_homedecor_shingles_asphalt.png",
cottages.textures.roof_sides,
cottages.textures.roof_sides,
cottages.textures.roof_sides,
cottages.textures.roof_sides,
"cottages_homedecor_shingles_asphalt.png",
})
cottages.roof.register_roof(
"red",
ci.clay_brick,
{"cottages_homedecor_shingles_terracotta.png", cottages.textures.roof_sides,
cottages.textures.roof_sides, cottages.textures.roof_sides,
cottages.textures.roof_sides, "cottages_homedecor_shingles_terracotta.png"}
)
cottages.roof.register_roof("red", ci.clay_brick, {
"cottages_homedecor_shingles_terracotta.png",
cottages.textures.roof_sides,
cottages.textures.roof_sides,
cottages.textures.roof_sides,
cottages.textures.roof_sides,
"cottages_homedecor_shingles_terracotta.png",
})
cottages.roof.register_roof(
"brown",
ci.dirt,
{"cottages_homedecor_shingles_wood.png", cottages.textures.roof_sides,
cottages.textures.roof_sides, cottages.textures.roof_sides,
cottages.textures.roof_sides, "cottages_homedecor_shingles_wood.png"}
)
cottages.roof.register_roof("brown", ci.dirt, {
"cottages_homedecor_shingles_wood.png",
cottages.textures.roof_sides,
cottages.textures.roof_sides,
cottages.textures.roof_sides,
cottages.textures.roof_sides,
"cottages_homedecor_shingles_wood.png",
})
cottages.roof.register_roof(
"slate",
ci.stone,
{"cottages_slate.png", cottages.textures.roof_sides,
"cottages_slate.png", "cottages_slate.png",
cottages.textures.roof_sides, "cottages_slate.png"}
)
cottages.roof.register_roof("slate", ci.stone, {
"cottages_slate.png",
cottages.textures.roof_sides,
"cottages_slate.png",
"cottages_slate.png",
cottages.textures.roof_sides,
"cottages_slate.png",
})
--------
@ -76,9 +82,14 @@ minetest.register_node("cottages:reet", {
minetest.register_node("cottages:slate_vertical", {
description = S("Vertical Slate"),
tiles = {"cottages_slate.png", cottages.textures.roof_sides,
"cottages_slate.png", "cottages_slate.png",
cottages.textures.roof_sides, "cottages_slate.png"},
tiles = {
"cottages_slate.png",
cottages.textures.roof_sides,
"cottages_slate.png",
"cottages_slate.png",
cottages.textures.roof_sides,
"cottages_slate.png",
},
paramtype2 = "facedir",
groups = { cracky = 2, stone = 1 },
sounds = cottages.sounds.stone,

View File

@ -4,7 +4,7 @@ minetest.register_craft({
output = "cottages:straw_mat 6",
recipe = {
{ ci.stone, "", "" },
{"farming:wheat", "farming:wheat", "farming:wheat", },
{ "farming:wheat", "farming:wheat", "farming:wheat" },
},
replacements = { { ci.stone, ci.seed_wheat .. " 3" } },
})
@ -13,8 +13,8 @@ minetest.register_craft({
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,9 +22,9 @@ 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, "" },
},
})

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
@ -57,13 +56,11 @@ local function get_quern_results(input)
local output_def = straw.registered_quern_crafts[item]
if type(output_def) == "string" then
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")

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
@ -67,13 +66,11 @@ local function get_threshing_results(input)
local output_def = straw.registered_threshing_crafts[item]
if type(output_def) == "string" then
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")
@ -195,18 +187,18 @@ cottages.api.register_machine("cottages:threshing_floor", {
{ -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 },
}
},
},
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 },
sounds = cottages.sounds.wood,

View File

@ -7,6 +7,6 @@ if ci.stick and ci.tree and ci.stick and ci.bucket then
{ ci.stick, "", "" },
{ ci.tree, ci.bucket, ci.tree },
{ ci.tree, ci.tree, ci.tree },
}
},
})
end

View File

@ -1,6 +1,8 @@
local F = minetest.formspec_escape
local S = cottages.S
local FS = function(...) return F(S(...)) end
local FS = function(...)
return F(S(...))
end
local s = cottages.sounds
local t = cottages.textures
@ -16,7 +18,7 @@ local well_fill_time = cottages.settings.water.well_fill_time
function water.get_well_fs_parts(pos)
return {
("size[8,9]"),
"size[8,9]",
("label[3.0,0.0;%s]"):format(FS("Tree trunk well")),
("label[0,0.7;%s]"):format(FS("Punch the well while wielding an empty bucket.")),
("label[0,1.0;%s]"):format(FS("Your bucket will slowly be filled with river water.")),
@ -25,9 +27,9 @@ function water.get_well_fs_parts(pos)
("label[1.0,2.9;%s]"):format(FS("Internal bucket storage (passive storage only):")),
("item_image[0,2.8;1.0,1.0;%s]"):format(F(ci.bucket)),
("item_image[0,3.8;1.0,1.0;%s]"):format(F(ci.bucket_filled)),
("list[context;main;1,3.3;8,1;]"),
("list[current_player;main;0,4.85;8,4;]"),
("listring[]"),
"list[context;main;1,3.3;8,1;]",
"list[current_player;main;0,4.85;8,4;]",
"listring[]",
}
end
@ -58,19 +60,13 @@ function water.use_well(pos, puncher)
timer:start(well_fill_time)
water.add_filling_effects(pos)
elseif wielded_name == ci.bucket_filled then
-- empty a bucket
pinv:remove_item("main", ci.bucket_filled)
pinv:add_item("main", ci.bucket)
minetest.sound_play(
{name = s.water_empty},
{pos = entity_pos, gain = 0.5, pitch = 2.0},
true
)
minetest.sound_play({ name = s.water_empty }, { pos = entity_pos, gain = 0.5, pitch = 2.0 }, true)
end
elseif bucket == ci.bucket then
minetest.chat_send_player(player_name, S("Please wait until your bucket has been filled."))
local timer = minetest.get_node_timer(pos)
@ -78,11 +74,10 @@ function water.use_well(pos, puncher)
timer:start(well_fill_time)
water.add_filling_effects(pos)
end
elseif bucket == ci.bucket_filled then
meta:set_string("bucket", "")
for _, obj in ipairs(minetest.get_objects_inside_radius(entity_pos, .1)) do
for _, obj in ipairs(minetest.get_objects_inside_radius(entity_pos, 0.1)) do
local ent = obj:get_luaentity()
if ent and ent.name == "cottages:bucket_entity" then
obj:remove()
@ -133,7 +128,7 @@ end
function water.fill_bucket(pos)
local entity_pos = vector.add(pos, vector.new(0, 1 / 4, 0))
for _, obj in ipairs(minetest.get_objects_inside_radius(entity_pos, .1)) do
for _, obj in ipairs(minetest.get_objects_inside_radius(entity_pos, 0.1)) do
local ent = obj:get_luaentity()
if ent and ent.name == "cottages:bucket_entity" then
obj:set_properties({ wield_item = ci.bucket_filled })
@ -209,10 +204,9 @@ cottages.api.register_machine("cottages:water_gen", {
},
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, 0.5 + (4 / 16), 0.5}
fixed = { -0.5, -0.5, -0.5, 0.5, 0.5 + (4 / 16), 0.5 },
},
get_fs_parts = water.get_well_fs_parts,
get_info = water.get_well_info,
@ -247,7 +241,7 @@ cottages.api.register_machine("cottages:water_gen", {
on_destruct = function(pos)
local entity_pos = vector.add(pos, vector.new(0, 1 / 4, 0))
for _, obj in ipairs(minetest.get_objects_inside_radius(entity_pos, .1)) do
for _, obj in ipairs(minetest.get_objects_inside_radius(entity_pos, 0.1)) do
local ent = obj:get_luaentity()
if ent and ent.name == "cottages:bucket_entity" then
minetest.add_item(pos, obj:get_properties().wield_item)
@ -271,7 +265,6 @@ cottages.api.register_machine("cottages:water_gen", {
if cottages.has.node_entity_queue then
node_entity_queue.api.register_node_entity_loader("cottages:water_gen", water.initialize_entity)
else
minetest.register_lbm({
name = "cottages:add_well_entity",
@ -280,6 +273,6 @@ else
run_at_every_load = true,
action = function(pos, node)
water.initialize_entity(pos)
end
end,
})
end

View File

@ -58,10 +58,8 @@ end
if has.stairsplus and has.default then
ci.slab_wood = resolve_item("default:slab_wood_8")
elseif has.moreblocks and resolve_item("moreblocks:slab_wood") then
ci.slab_wood = resolve_item("moreblocks:slab_wood")
elseif has.stairs then
ci.slab_wood = resolve_item("stairs:slab_wood")
end

View File

@ -12,7 +12,6 @@ if has.default then
textures.tree = "default_tree.png"
textures.tree_top = "default_tree_top.png"
textures.dust = "default_item_smoke.png"
else
textures.furniture = "cottages_minimal_wood.png"
textures.roof_sides = "cottages_minimal_wood.png"

View File

@ -63,8 +63,8 @@ cottages.settings = {
enabled = s:get_bool("cottages.roof.enabled", true),
use_farming_straw_stairs = (
s:get_bool("cottages.roof.use_farming_straw_stairs", false) and
minetest.registered_nodes["stairs:stair_straw"]
s:get_bool("cottages.roof.use_farming_straw_stairs", false)
and minetest.registered_nodes["stairs:stair_straw"]
),
},
@ -83,6 +83,6 @@ cottages.settings = {
water = {
enabled = s:get_bool("cottages.water.enabled", true),
well_fill_time = tonumber(s:get("cottages.water.well_fill_time")) or 10
well_fill_time = tonumber(s:get("cottages.water.well_fill_time")) or 10,
},
}

View File

@ -17,10 +17,8 @@ function util.player_can_use(pos, player)
if owner == player_name then
return true
elseif owner == "" or owner == " " or public == 1 then
return not minetest.is_protected(pos, player_name)
else
return true
end
@ -46,18 +44,15 @@ function util.toggle_public(pos, sender)
-- owner can switch private to protected
meta:set_int("public", 1)
return true
elseif public == 1 and not minetest.is_protected(pos, sender_name) then
-- player of area can switch protected to public
meta:set_int("public", 2)
return true
elseif public == 2 then
if owner == sender_name then
-- owner can switch public to private
meta:set_int("public", 0)
return true
elseif not minetest.is_protected(pos, sender_name) then
-- player of area can switch public to protected
meta:set_int("public", 1)