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 = { cottages.handmill_product = {
__newindex = function(t, k, v) __newindex = function(t, k, v)
cottages.straw.register_quern_craft({input = k, output = v}) cottages.straw.register_quern_craft({ input = k, output = v })
end end,
} }
cottages.forbid_repair = { cottages.forbid_repair = {
__newindex = function(t, k, v) __newindex = function(t, k, v)
cottages.anvil.make_unrepairable(k) cottages.anvil.make_unrepairable(k)
end end,
} }

View File

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

View File

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

View File

@ -5,7 +5,7 @@ if workbench then
local cottages_table_def = minetest.registered_nodes["cottages:table"] local cottages_table_def = minetest.registered_nodes["cottages:table"]
minetest.override_item("cottages:table", { minetest.override_item("cottages:table", {
tiles = {workbench.tiles[1], cottages_table_def.tiles[1]}, tiles = { workbench.tiles[1], cottages_table_def.tiles[1] },
on_construct = workbench.on_construct, on_construct = workbench.on_construct,
can_dig = workbench.can_dig, can_dig = workbench.can_dig,
on_metadata_inventory_take = workbench.on_metadata_inventory_take, on_metadata_inventory_take = workbench.on_metadata_inventory_take,

View File

@ -3,7 +3,7 @@ local modpath = minetest.get_modpath(modname)
local S = minetest.get_translator(modname) local S = minetest.get_translator(modname)
cottages = { cottages = {
version = os.time({year = 2022, month = 9, day = 29}), version = os.time({ year = 2022, month = 9, day = 29 }),
fork = "fluxionary", fork = "fluxionary",
modname = modname, modname = modname,
@ -36,7 +36,7 @@ cottages = {
end, end,
dofile = function(...) dofile = function(...)
return dofile(table.concat({modpath, ...}, DIR_DELIM) .. ".lua") return dofile(table.concat({ modpath, ... }, DIR_DELIM) .. ".lua")
end, end,
} }

View File

@ -4,7 +4,7 @@ function api.make_unrepairable(itemstring)
local def = minetest.registered_items[itemstring] local def = minetest.registered_items[itemstring]
local groups = table.copy(def.groups or {}) local groups = table.copy(def.groups or {})
groups.not_repaired_by_anvil = 1 groups.not_repaired_by_anvil = 1
minetest.override_item(itemstring, {groups = groups}) minetest.override_item(itemstring, { groups = groups })
end end
function api.can_repair(tool_stack) function api.can_repair(tool_stack)

View File

@ -7,15 +7,15 @@ minetest.register_entity("cottages:anvil_item", {
initial_properties = { initial_properties = {
hp_max = 1, hp_max = 1,
visual = "wielditem", visual = "wielditem",
visual_size = {x = .33, y = .33}, visual_size = { x = 0.33, y = 0.33 },
collisionbox = {0, 0, 0, 0, 0, 0}, collisionbox = { 0, 0, 0, 0, 0, 0 },
physical = false, physical = false,
collide_with_objects = false, collide_with_objects = false,
pointable = false, pointable = false,
}, },
get_staticdata = function(self) get_staticdata = function(self)
return serialize({self.pos, self.item}) return serialize({ self.pos, self.item })
end, end,
on_activate = function(self, staticdata, dtime_s) on_activate = function(self, staticdata, dtime_s)
@ -27,7 +27,7 @@ minetest.register_entity("cottages:anvil_item", {
return return
end end
self.pos = pos -- *MUST* set before calling api.get_entity self.pos = pos -- *MUST* set before calling api.get_entity
local other_obj = anvil.get_entity(pos) local other_obj = anvil.get_entity(pos)
if other_obj and obj ~= other_obj then if other_obj and obj ~= other_obj then
@ -37,8 +37,8 @@ minetest.register_entity("cottages:anvil_item", {
self.item = item self.item = item
obj:set_properties({wield_item = item}) obj:set_properties({ wield_item = item })
obj:set_armor_groups({immortal = 1}) obj:set_armor_groups({ immortal = 1 })
end, end,
on_punch = function() on_punch = function()
@ -54,22 +54,20 @@ if cottages.settings.anvil.tool_entity_enabled then
-- automatically restore entities lost due to /clearobjects or similar -- automatically restore entities lost due to /clearobjects or similar
if cottages.has.node_entity_queue then if cottages.has.node_entity_queue then
node_entity_queue.api.register_node_entity_loader("cottages:anvil", anvil.update_entity) node_entity_queue.api.register_node_entity_loader("cottages:anvil", anvil.update_entity)
else else
minetest.register_lbm({ minetest.register_lbm({
name = "cottages:anvil_item_restoration", name = "cottages:anvil_item_restoration",
nodenames = {"cottages:anvil"}, nodenames = { "cottages:anvil" },
run_at_every_load = true, run_at_every_load = true,
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)
anvil.update_entity(pos) anvil.update_entity(pos)
end, end,
}) })
end end
else else
minetest.register_lbm({ minetest.register_lbm({
name = "cottages:anvil_item_removal", name = "cottages:anvil_item_removal",
nodenames = {"cottages:anvil"}, nodenames = { "cottages:anvil" },
run_at_every_load = true, run_at_every_load = true,
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)
anvil.clear_entity(pos) anvil.clear_entity(pos)
@ -84,13 +82,12 @@ if minetest.registered_entities["anvil:item"] then
self.object:remove() self.object:remove()
end end
end end
else else
minetest.register_entity(":anvil:item", { minetest.register_entity(":anvil:item", {
on_step = function(self) on_step = function(self)
if self.object then if self.object then
self.object:remove() self.object:remove()
end end
end end,
}) })
end end

View File

@ -11,10 +11,10 @@ minetest.register_tool("cottages:hammer", {
max_drop_level = 1, max_drop_level = 1,
groupcaps = { groupcaps = {
-- about equal to a stone pick (it's not intended as a tool) -- about equal to a stone pick (it's not intended as a tool)
cracky = {times = {[2] = 2.00, [3] = 1.20}, uses = 30, maxlevel = 1}, cracky = { times = { [2] = 2.00, [3] = 1.20 }, uses = 30, maxlevel = 1 },
}, },
damage_groups = {fleshy = 6}, damage_groups = { fleshy = 6 },
} },
}) })
if cottages.settings.anvil.disable_hammer_repair then if cottages.settings.anvil.disable_hammer_repair then

View File

@ -42,7 +42,7 @@ function api.decrease_liquid_amount(pos)
end end
local function empty_and_liquid(bucket_empty, liquid) local function empty_and_liquid(bucket_empty, liquid)
return table.concat({bucket_empty, liquid}, "::") return table.concat({ bucket_empty, liquid }, "::")
end end
function api.register_barrel_liquid(def) function api.register_barrel_liquid(def)
@ -100,8 +100,8 @@ function api.add_barrel_liquid(pos, bucket_full)
api.increase_liquid_amount(pos) api.increase_liquid_amount(pos)
minetest.sound_play( minetest.sound_play(
{name = api.input_sound_by_liquid[liquid]}, { name = api.input_sound_by_liquid[liquid] },
{pos = pos, loop = false, gain = 0.5, pitch = 2.0} { pos = pos, loop = false, gain = 0.5, pitch = 2.0 }
) )
return api.get_bucket_empty(bucket_full) return api.get_bucket_empty(bucket_full)
@ -113,8 +113,8 @@ function api.drain_barrel_liquid(pos, bucket_empty)
api.decrease_liquid_amount(pos) api.decrease_liquid_amount(pos)
minetest.sound_play( minetest.sound_play(
{name = api.output_sound_by_liquid[liquid]}, { name = api.output_sound_by_liquid[liquid] },
{pos = pos, loop = false, gain = 0.5, pitch = 2.0} { pos = pos, loop = false, gain = 0.5, pitch = 2.0 }
) )
return api.get_bucket_full(bucket_empty, liquid) return api.get_bucket_full(bucket_empty, liquid)

View File

@ -1,6 +1,8 @@
local S = cottages.S local S = cottages.S
local F = minetest.formspec_escape 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 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), barrel.get_liquid_amount(pos),
max_liquid_amount max_liquid_amount
) )
else else
return S("Empty Barrel") return S("Empty Barrel")
end end
@ -22,17 +23,17 @@ end
function barrel.get_barrel_fs_parts(pos) function barrel.get_barrel_fs_parts(pos)
local parts = { local parts = {
("size[8,9]"), "size[8,9]",
("label[0,0.0;%s]"):format(FS("barrel (liquid storage)")), ("label[0,0.0;%s]"):format(FS("barrel (liquid storage)")),
("label[3,0;%s]"):format(FS("fill:")), ("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:")), ("label[5,3.3;%s]"):format(FS("drain:")),
("list[context;output;5,3.8;1,1;]"), "list[context;output;5,3.8;1,1;]",
("list[current_player;main;0,5;8,4;]"), "list[current_player;main;0,5;8,4;]",
("listring[context;output]"), "listring[context;output]",
("listring[current_player;main]"), "listring[current_player;main]",
("listring[context;input]"), "listring[context;input]",
("listring[current_player;main]"), "listring[current_player;main]",
} }
local liquid = barrel.get_barrel_liquid(pos) local liquid = barrel.get_barrel_liquid(pos)
@ -40,35 +41,50 @@ function barrel.get_barrel_fs_parts(pos)
if liquid then if liquid then
local liquid_texture = barrel.texture_by_liquid[liquid] 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(
F(cottages.textures.furniture), parts,
max_liquid_amount, max_liquid_amount, ("image[2.6,2;2,3;%s^[resize:%ix%i^[lowpart:%s:%s]"):format(
math.floor(max_liquid_amount * liquid_amount / max_liquid_amount), F(cottages.textures.furniture),
F(liquid_texture max_liquid_amount,
.. futil.escape_texture(("^[resize:%ix%i"):format(max_liquid_amount, max_liquid_amount))) max_liquid_amount,
)) math.floor(max_liquid_amount * liquid_amount / max_liquid_amount),
table.insert(parts, ("tooltip[2.6,2;2,3;%s]"):format( F(
F(("%s (%i/%i)"):format( liquid_texture
barrel.name_by_liquid[liquid], .. futil.escape_texture(("^[resize:%ix%i"):format(max_liquid_amount, max_liquid_amount))
barrel.get_liquid_amount(pos), )
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 else
table.insert(parts, ("image[2.6,2;2,3;%s^[resize:%ix%i^[lowpart:%s:%s]"):format( table.insert(
F(cottages.textures.furniture), parts,
max_liquid_amount, max_liquid_amount, ("image[2.6,2;2,3;%s^[resize:%ix%i^[lowpart:%s:%s]"):format(
0, F(cottages.textures.furniture),
F(cottages.textures.furniture max_liquid_amount,
.. futil.escape_texture(("^[resize:%ix%i"):format(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))
)
)
)
end end
return parts return parts
end end
function barrel.can_dig(pos, player) function barrel.can_dig(pos, player)
return barrel.get_liquid_amount(pos) == 0 return barrel.get_liquid_amount(pos) == 0
end 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 if barrel.can_drain(pos, item) then
return 1 return 1
end end
elseif to_list == "output" then elseif to_list == "output" then
if barrel.can_fill(pos, item) then if barrel.can_fill(pos, item) then
return 1 return 1
@ -106,7 +121,6 @@ function barrel.allow_metadata_inventory_put(pos, listname, index, stack, player
if barrel.can_drain(pos, item) then if barrel.can_drain(pos, item) then
return 1 return 1
end end
elseif listname == "output" then elseif listname == "output" then
if barrel.can_fill(pos, item) then if barrel.can_fill(pos, item) then
return 1 return 1
@ -124,7 +138,6 @@ function barrel.on_metadata_inventory_put(pos, listname, index, stack, player)
if listname == "input" then if listname == "input" then
local empty = barrel.add_barrel_liquid(pos, name) local empty = barrel.add_barrel_liquid(pos, name)
inv:set_stack(listname, index, empty) inv:set_stack(listname, index, empty)
elseif listname == "output" then elseif listname == "output" then
local full = barrel.drain_barrel_liquid(pos, name) local full = barrel.drain_barrel_liquid(pos, name)
inv:set_stack(listname, index, full) inv:set_stack(listname, index, full)
@ -144,13 +157,13 @@ cottages.api.register_machine("cottages:barrel", {
paramtype2 = "facedir", paramtype2 = "facedir",
drawtype = "mesh", drawtype = "mesh",
mesh = "cottages_barrel_closed.obj", mesh = "cottages_barrel_closed.obj",
tiles = {"cottages_barrel.png"}, tiles = { "cottages_barrel.png" },
is_ground_content = false, is_ground_content = false,
groups = { groups = {
snappy = 1, snappy = 1,
choppy = 2, choppy = 2,
oddly_breakable_by_hand = 1, oddly_breakable_by_hand = 1,
flammable = 2 flammable = 2,
}, },
sounds = cottages.sounds.wood, sounds = cottages.sounds.wood,

View File

@ -8,7 +8,7 @@ local rotations = {
minetest.register_lbm({ minetest.register_lbm({
label = "Convert lying barrels", label = "Convert lying barrels",
name = "cottages:convert_lying_barrels", name = "cottages:convert_lying_barrels",
nodenames = {"cottages:barrel_lying", "cottages:barrel_lying_open"}, nodenames = { "cottages:barrel_lying", "cottages:barrel_lying_open" },
run_at_every_load = false, run_at_every_load = false,
action = function(pos, node) action = function(pos, node)
node.name = string.gsub(node.name, "_lying", "") node.name = string.gsub(node.name, "_lying", "")
@ -16,5 +16,5 @@ minetest.register_lbm({
minetest.swap_node(pos, node) minetest.swap_node(pos, node)
cottages.api.update(pos, node) cottages.api.update(pos, node)
end end,
}) })

View File

@ -4,18 +4,18 @@ if ci.wood and ci.steel then
minetest.register_craft({ minetest.register_craft({
output = "cottages:barrel", output = "cottages:barrel",
recipe = { recipe = {
{ci.wood, ci.wood, ci.wood}, { ci.wood, ci.wood, ci.wood },
{ci.steel, "", ci.steel}, { ci.steel, "", ci.steel },
{ci.wood, ci.wood, ci.wood}, { ci.wood, ci.wood, ci.wood },
}, },
}) })
minetest.register_craft({ minetest.register_craft({
output = "cottages:barrel_open", output = "cottages:barrel_open",
recipe = { recipe = {
{ci.wood, "", ci.wood}, { ci.wood, "", ci.wood },
{ci.steel, "", ci.steel}, { ci.steel, "", ci.steel },
{ci.wood, ci.wood, ci.wood}, { ci.wood, ci.wood, ci.wood },
}, },
}) })
end end
@ -23,14 +23,14 @@ end
minetest.register_craft({ minetest.register_craft({
output = "cottages:tub 2", output = "cottages:tub 2",
recipe = { recipe = {
{"cottages:barrel"}, { "cottages:barrel" },
}, },
}) })
minetest.register_craft({ minetest.register_craft({
output = "cottages:barrel", output = "cottages:barrel",
recipe = { recipe = {
{"cottages:tub"}, { "cottages:tub" },
{"cottages:tub"}, { "cottages:tub" },
}, },
}) })

View File

@ -7,7 +7,7 @@ minetest.register_node("cottages:barrel_open", {
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
mesh = "cottages_barrel.obj", mesh = "cottages_barrel.obj",
tiles = {"cottages_barrel.png"}, tiles = { "cottages_barrel.png" },
is_ground_content = false, is_ground_content = false,
groups = { groups = {
snappy = 1, snappy = 1,
@ -23,22 +23,24 @@ minetest.register_node("cottages:tub", {
paramtype = "light", paramtype = "light",
drawtype = "mesh", drawtype = "mesh",
mesh = "cottages_tub.obj", mesh = "cottages_tub.obj",
tiles = {"cottages_barrel.png"}, tiles = { "cottages_barrel.png" },
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.1, 0.5}, { -0.5, -0.5, -0.5, 0.5, -0.1, 0.5 },
}}, },
collision_box = { },
collision_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.1, 0.5}, { -0.5, -0.5, -0.5, 0.5, -0.1, 0.5 },
}}, },
},
groups = { groups = {
snappy = 1, snappy = 1,
choppy = 2, choppy = 2,
oddly_breakable_by_hand = 1, oddly_breakable_by_hand = 1,
flammable = 2 flammable = 2,
}, },
is_ground_content = false, is_ground_content = false,
}) })

View File

@ -1,23 +1,23 @@
-- open shutters in the morning -- open shutters in the morning
minetest.register_abm({ minetest.register_abm({
nodenames = {"cottages:window_shutter_closed"}, nodenames = { "cottages:window_shutter_closed" },
interval = 20, -- change this to 600 if your machine is too slow interval = 20, -- change this to 600 if your machine is too slow
chance = 3, -- not all people wake up at the same time! chance = 3, -- not all people wake up at the same time!
action = function(pos) action = function(pos)
if not cottages.doorlike.is_night() then if not cottages.doorlike.is_night() then
cottages.doorlike.shutter_open(pos) cottages.doorlike.shutter_open(pos)
end end
end end,
}) })
-- close them at night -- close them at night
minetest.register_abm({ minetest.register_abm({
nodenames = {"cottages:window_shutter_open"}, nodenames = { "cottages:window_shutter_open" },
interval = 20, -- change this to 600 if your machine is too slow interval = 20, -- change this to 600 if your machine is too slow
chance = 2, chance = 2,
action = function(pos) action = function(pos)
if cottages.doorlike.is_night() then if cottages.doorlike.is_night() then
cottages.doorlike.shutter_close(pos) cottages.doorlike.shutter_close(pos)
end end
end end,
}) })

View File

@ -12,10 +12,10 @@ local offsets = {
} }
function api.shutter_operate(pos, old_node_state_name, new_node_state_name) function api.shutter_operate(pos, old_node_state_name, new_node_state_name)
local new_node = {name = new_node_state_name} local new_node = { name = new_node_state_name }
local old_node = minetest.get_node(pos) local old_node = minetest.get_node(pos)
new_node.param2 = old_node.param2 new_node.param2 = old_node.param2
minetest.swap_node(pos, {name = new_node_state_name, param2 = old_node.param2}) minetest.swap_node(pos, { name = new_node_state_name, param2 = old_node.param2 })
local stop_up = false local stop_up = false
local stop_down = false local stop_down = false
@ -66,24 +66,24 @@ end
-- hatches rotate around their axis -- hatches rotate around their axis
-- old facedir: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23 -- old facedir: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23
local new_facedirs = {10, 19, 4, 13, 2, 18, 22, 14, 20, 16, 0, 12, 11, 3, 7, 21, 9, 23, 5, 1, 8, 15, 6, 17} local new_facedirs = { 10, 19, 4, 13, 2, 18, 22, 14, 20, 16, 0, 12, 11, 3, 7, 21, 9, 23, 5, 1, 8, 15, 6, 17 }
local node_box = { local node_box = {
{-0.49, -0.55, -0.49, -0.3, -0.45, 0.45}, { -0.49, -0.55, -0.49, -0.3, -0.45, 0.45 },
{0.3, -0.55, -0.3, 0.49, -0.45, 0.45}, { 0.3, -0.55, -0.3, 0.49, -0.45, 0.45 },
{0.49, -0.55, -0.49, -0.3, -0.45, -0.3}, { 0.49, -0.55, -0.49, -0.3, -0.45, -0.3 },
{-0.075, -0.55, -0.3, 0.075, -0.45, 0.3}, { -0.075, -0.55, -0.3, 0.075, -0.45, 0.3 },
{-0.3, -0.55, -0.075, -0.075, -0.45, 0.075}, { -0.3, -0.55, -0.075, -0.075, -0.45, 0.075 },
{0.075, -0.55, -0.075, 0.3, -0.45, 0.075}, { 0.075, -0.55, -0.075, 0.3, -0.45, 0.075 },
{-0.3, -0.55, 0.3, 0.3, -0.45, 0.45}, { -0.3, -0.55, 0.3, 0.3, -0.45, 0.45 },
-- hinges -- hinges
{-0.45, -0.530, 0.45, -0.15, -0.470, 0.525}, { -0.45, -0.530, 0.45, -0.15, -0.470, 0.525 },
{0.15, -0.530, 0.45, 0.45, -0.470, 0.525}, { 0.15, -0.530, 0.45, 0.45, -0.470, 0.525 },
-- handle -- handle
{-0.05, -0.60, -0.35, 0.05, -0.40, -0.45}, { -0.05, -0.60, -0.35, 0.05, -0.40, -0.45 },
} }
local function rotate(unrotated) local function rotate(unrotated)
@ -100,7 +100,7 @@ local function rotate(unrotated)
y2 = -z1 y2 = -z1
z1 = -tmp z1 = -tmp
table.insert(rotated, {x1, y1, z1, x2, y2, z2}) table.insert(rotated, { x1, y1, z1, x2, y2, z2 })
end end
return rotated return rotated
end end
@ -111,7 +111,7 @@ function api.register_hatch(nodename, description, texture, receipe_item, def)
def.description = S(description) def.description = S(description)
def.tile_front = texture def.tile_front = texture
def.tile_side = texture def.tile_side = texture
def.groups = def.groups or {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2} def.groups = def.groups or { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2 }
def.nodebox_closed = { def.nodebox_closed = {
type = "fixed", type = "fixed",
fixed = node_box, fixed = node_box,
@ -122,16 +122,15 @@ function api.register_hatch(nodename, description, texture, receipe_item, def)
} }
doors.register_trapdoor(nodename, def) doors.register_trapdoor(nodename, def)
else else
minetest.register_node(nodename, { minetest.register_node(nodename, {
description = S(description), -- not that there are any other... description = S(description), -- not that there are any other...
drawtype = "nodebox", drawtype = "nodebox",
-- top, bottom, side1, side2, inner, outer -- top, bottom, side1, side2, inner, outer
tiles = {texture}, tiles = { texture },
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2}, groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2 },
node_box = { node_box = {
type = "fixed", type = "fixed",
@ -139,14 +138,14 @@ function api.register_hatch(nodename, description, texture, receipe_item, def)
}, },
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = {-0.5, -0.55, -0.5, 0.5, -0.45, 0.5}, fixed = { -0.5, -0.55, -0.5, 0.5, -0.45, 0.5 },
}, },
on_rightclick = function(pos, node, puncher) on_rightclick = function(pos, node, puncher)
if has_stamina then if has_stamina then
stamina.exhaust_player(puncher, stamina_use, nodename) stamina.exhaust_player(puncher, stamina_use, nodename)
end end
minetest.swap_node(pos, {name = node.name, param2 = new_facedirs[node.param2 + 1]}) minetest.swap_node(pos, { name = node.name, param2 = new_facedirs[node.param2 + 1] })
end, end,
is_ground_content = false, is_ground_content = false,
on_place = minetest.rotate_node, on_place = minetest.rotate_node,
@ -156,8 +155,8 @@ function api.register_hatch(nodename, description, texture, receipe_item, def)
minetest.register_craft({ minetest.register_craft({
output = nodename, output = nodename,
recipe = { recipe = {
{"", "", receipe_item}, { "", "", receipe_item },
{receipe_item, cottages.craftitems.stick, ""}, { receipe_item, cottages.craftitems.stick, "" },
} },
}) })
end end

View File

@ -4,23 +4,23 @@ local ci = cottages.craftitems
minetest.register_craft({ minetest.register_craft({
output = "cottages:window_shutter_open", output = "cottages:window_shutter_open",
recipe = { recipe = {
{"cottages:window_shutter_closed"}, { "cottages:window_shutter_closed" },
} },
}) })
minetest.register_craft({ minetest.register_craft({
output = "cottages:window_shutter_closed", output = "cottages:window_shutter_closed",
recipe = { recipe = {
{"cottages:window_shutter_open"}, { "cottages:window_shutter_open" },
} },
}) })
if ci.wood then if ci.wood then
minetest.register_craft({ minetest.register_craft({
output = "cottages:window_shutter_open", output = "cottages:window_shutter_open",
recipe = { recipe = {
{ci.wood, "", ci.wood}, { ci.wood, "", ci.wood },
} },
}) })
end end
@ -28,24 +28,24 @@ end
minetest.register_craft({ minetest.register_craft({
output = "cottages:half_door", output = "cottages:half_door",
recipe = { recipe = {
{"cottages:half_door_inverted"}, { "cottages:half_door_inverted" },
} },
}) })
minetest.register_craft({ minetest.register_craft({
output = "cottages:half_door_inverted", output = "cottages:half_door_inverted",
recipe = { recipe = {
{"cottages:half_door"}, { "cottages:half_door" },
} },
}) })
if ci.wood and ci.door then if ci.wood and ci.door then
minetest.register_craft({ minetest.register_craft({
output = "cottages:half_door 2", output = "cottages:half_door 2",
recipe = { recipe = {
{"", ci.wood, ""}, { "", ci.wood, "" },
{"", ci.door, ""}, { "", ci.door, "" },
} },
}) })
end end
@ -53,22 +53,22 @@ end
minetest.register_craft({ minetest.register_craft({
output = "cottages:gate_closed", output = "cottages:gate_closed",
recipe = { recipe = {
{"cottages:gate_open"}, { "cottages:gate_open" },
} },
}) })
minetest.register_craft({ minetest.register_craft({
output = "cottages:gate_open", output = "cottages:gate_open",
recipe = { recipe = {
{"cottages:gate_closed"}, { "cottages:gate_closed" },
} },
}) })
if ci.stick and ci.wood then if ci.stick and ci.wood then
minetest.register_craft({ minetest.register_craft({
output = "cottages:gate_closed", output = "cottages:gate_closed",
recipe = { recipe = {
{ci.stick, ci.stick, ci.wood}, { ci.stick, ci.stick, ci.wood },
} },
}) })
end end

View File

@ -4,22 +4,22 @@ local S = cottages.S
minetest.register_node("cottages:window_shutter_open", { minetest.register_node("cottages:window_shutter_open", {
description = S("opened window shutters"), description = S("opened window shutters"),
drawtype = "nodebox", drawtype = "nodebox",
tiles = {"cottages_minimal_wood.png"}, tiles = { "cottages_minimal_wood.png" },
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2}, groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2 },
-- larger than one node but slightly smaller than a half node so that wallmounted torches pose no problem -- larger than one node but slightly smaller than a half node so that wallmounted torches pose no problem
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.90, -0.5, 0.4, -0.45, 0.5, 0.5}, { -0.90, -0.5, 0.4, -0.45, 0.5, 0.5 },
{0.45, -0.5, 0.4, 0.9, 0.5, 0.5}, { 0.45, -0.5, 0.4, 0.9, 0.5, 0.5 },
}, },
}, },
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.9, -0.5, 0.4, 0.9, 0.5, 0.5}, { -0.9, -0.5, 0.4, 0.9, 0.5, 0.5 },
}, },
}, },
on_rightclick = function(pos, node, puncher) on_rightclick = function(pos, node, puncher)
@ -31,21 +31,21 @@ minetest.register_node("cottages:window_shutter_open", {
minetest.register_node("cottages:window_shutter_closed", { minetest.register_node("cottages:window_shutter_closed", {
description = S("closed window shutters"), description = S("closed window shutters"),
drawtype = "nodebox", drawtype = "nodebox",
tiles = {"cottages_minimal_wood.png"}, tiles = { "cottages_minimal_wood.png" },
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, not_in_creative_inventory = 1}, groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, not_in_creative_inventory = 1 },
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, -0.5, 0.4, -0.05, 0.5, 0.5}, { -0.5, -0.5, 0.4, -0.05, 0.5, 0.5 },
{0.05, -0.5, 0.4, 0.5, 0.5, 0.5}, { 0.05, -0.5, 0.4, 0.5, 0.5, 0.5 },
}, },
}, },
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, -0.5, 0.4, 0.5, 0.5, 0.5}, { -0.5, -0.5, 0.4, 0.5, 0.5, 0.5 },
}, },
}, },
on_rightclick = function(pos, node, puncher) on_rightclick = function(pos, node, puncher)
@ -58,41 +58,44 @@ minetest.register_node("cottages:window_shutter_closed", {
minetest.register_node("cottages:half_door", { minetest.register_node("cottages:half_door", {
description = S("half door"), description = S("half door"),
drawtype = "nodebox", drawtype = "nodebox",
tiles = {"cottages_minimal_wood.png"}, tiles = { "cottages_minimal_wood.png" },
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2}, groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2 },
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, -0.5, 0.4, 0.48, 0.5, 0.5}, { -0.5, -0.5, 0.4, 0.48, 0.5, 0.5 },
}, },
}, },
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, -0.5, 0.4, 0.48, 0.5, 0.5}, { -0.5, -0.5, 0.4, 0.48, 0.5, 0.5 },
}, },
}, },
on_rightclick = function(pos, node, puncher) on_rightclick = function(pos, node, puncher)
local node2 = minetest.get_node({x = pos.x, y = (pos.y + 1), z = pos.z}) local node2 = minetest.get_node({ x = pos.x, y = (pos.y + 1), z = pos.z })
local param2 = node.param2 local param2 = node.param2
if param2 % 4 == 1 then if param2 % 4 == 1 then
param2 = param2 + 1; --2 param2 = param2 + 1 --2
elseif param2 % 4 == 2 then elseif param2 % 4 == 2 then
param2 = param2 - 1; --1 param2 = param2 - 1 --1
elseif param2 % 4 == 3 then elseif param2 % 4 == 3 then
param2 = param2 - 3; --0 param2 = param2 - 3 --0
elseif param2 % 4 == 0 then elseif param2 % 4 == 0 then
param2 = param2 + 3; --3 param2 = param2 + 3 --3
end end
minetest.swap_node(pos, {name = "cottages:half_door", param2 = param2}) 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 -- if the node above consists of a door of the same type, open it as well
-- Note: doors beneath this one are not opened! -- Note: doors beneath this one are not opened!
-- It is a special feature of these doors that they can be opend partly -- 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 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
end, end,
is_ground_content = false, is_ground_content = false,
@ -101,40 +104,42 @@ minetest.register_node("cottages:half_door", {
minetest.register_node("cottages:half_door_inverted", { minetest.register_node("cottages:half_door_inverted", {
description = S("half door inverted"), description = S("half door inverted"),
drawtype = "nodebox", drawtype = "nodebox",
tiles = {"cottages_minimal_wood.png"}, tiles = { "cottages_minimal_wood.png" },
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2}, groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2 },
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, -0.5, -0.5, 0.48, 0.5, -0.4}, { -0.5, -0.5, -0.5, 0.48, 0.5, -0.4 },
}, },
}, },
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, -0.5, -0.5, 0.48, 0.5, -0.4}, { -0.5, -0.5, -0.5, 0.48, 0.5, -0.4 },
}, },
}, },
on_rightclick = function(pos, node, puncher) on_rightclick = function(pos, node, puncher)
local node2 = minetest.get_node({x = pos.x, y = (pos.y + 1), z = pos.z}) local node2 = minetest.get_node({ x = pos.x, y = (pos.y + 1), z = pos.z })
local param2 = node.param2 local param2 = node.param2
if param2 % 4 == 1 then if param2 % 4 == 1 then
param2 = param2 - 1; --0 param2 = param2 - 1 --0
elseif param2 % 4 == 0 then elseif param2 % 4 == 0 then
param2 = param2 + 1; --1 param2 = param2 + 1 --1
elseif param2 % 4 == 2 then elseif param2 % 4 == 2 then
param2 = param2 + 1; --3 param2 = param2 + 1 --3
elseif param2 % 4 == 3 then elseif param2 % 4 == 3 then
param2 = param2 - 1; --2 param2 = param2 - 1 --2
end end
minetest.swap_node(pos, {name = "cottages:half_door_inverted", param2 = param2}) minetest.swap_node(pos, { name = "cottages:half_door_inverted", param2 = param2 })
-- open upper parts of this door (if there are any) -- open upper parts of this door (if there are any)
if node2 ~= nil and node2.name == node.name and node2.param2 == node.param2 then 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}, minetest.swap_node(
{name = "cottages:half_door_inverted", param2 = param2}) { x = pos.x, y = (pos.y + 1), z = pos.z },
{ name = "cottages:half_door_inverted", param2 = param2 }
)
end end
end, end,
is_ground_content = false, is_ground_content = false,
@ -143,29 +148,29 @@ minetest.register_node("cottages:half_door_inverted", {
minetest.register_node("cottages:gate_closed", { minetest.register_node("cottages:gate_closed", {
description = S("closed fence gate"), description = S("closed fence gate"),
drawtype = "nodebox", drawtype = "nodebox",
tiles = {cottages.textures.furniture}, tiles = { cottages.textures.furniture },
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2}, groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2 },
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.85, -0.25, -0.02, 0.85, -0.05, 0.02}, { -0.85, -0.25, -0.02, 0.85, -0.05, 0.02 },
{-0.85, 0.15, -0.02, 0.85, 0.35, 0.02}, { -0.85, 0.15, -0.02, 0.85, 0.35, 0.02 },
{-0.80, -0.05, -0.02, -0.60, 0.15, 0.02}, { -0.80, -0.05, -0.02, -0.60, 0.15, 0.02 },
{0.60, -0.05, -0.02, 0.80, 0.15, 0.02}, { 0.60, -0.05, -0.02, 0.80, 0.15, 0.02 },
{-0.15, -0.05, -0.02, 0.15, 0.15, 0.02}, { -0.15, -0.05, -0.02, 0.15, 0.15, 0.02 },
}, },
}, },
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.85, -0.25, -0.1, 0.85, 0.35, 0.1}, { -0.85, -0.25, -0.1, 0.85, 0.35, 0.1 },
}, },
}, },
on_rightclick = function(pos, node, puncher) on_rightclick = function(pos, node, puncher)
minetest.swap_node(pos, {name = "cottages:gate_open", param2 = node.param2}) minetest.swap_node(pos, { name = "cottages:gate_open", param2 = node.param2 })
end, end,
is_ground_content = false, is_ground_content = false,
}) })
@ -173,31 +178,30 @@ minetest.register_node("cottages:gate_closed", {
minetest.register_node("cottages:gate_open", { minetest.register_node("cottages:gate_open", {
description = S("opened fence gate"), description = S("opened fence gate"),
drawtype = "nodebox", drawtype = "nodebox",
tiles = {cottages.textures.furniture}, tiles = { cottages.textures.furniture },
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
drop = "cottages:gate_closed", drop = "cottages:gate_closed",
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, not_in_creative_inventory = 1}, groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, not_in_creative_inventory = 1 },
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.85, -0.5, -0.25, 0.85, -0.46, -0.05}, { -0.85, -0.5, -0.25, 0.85, -0.46, -0.05 },
{-0.85, -0.5, 0.15, 0.85, -0.46, 0.35}, { -0.85, -0.5, 0.15, 0.85, -0.46, 0.35 },
{-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},
{ -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 = { selection_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.85, -0.5, -0.25, 0.85, -0.3, 0.35}, { -0.85, -0.5, -0.25, 0.85, -0.3, 0.35 },
}, },
}, },
on_rightclick = function(pos, node, puncher) on_rightclick = function(pos, node, puncher)
minetest.swap_node(pos, {name = "cottages:gate_closed", param2 = node.param2}) minetest.swap_node(pos, { name = "cottages:gate_closed", param2 = node.param2 })
end, end,
is_ground_content = false, is_ground_content = false,
}) })
@ -209,7 +213,7 @@ cottages.doorlike.register_hatch(
"cottages_minimal_wood.png", "cottages_minimal_wood.png",
cottages.craftitems.slab_wood, cottages.craftitems.slab_wood,
{ {
groups = {node = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, groups = { node = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 2 },
sounds = cottages.sounds.wood, sounds = cottages.sounds.wood,
} }
) )
@ -220,7 +224,7 @@ cottages.doorlike.register_hatch(
"cottages_steel_block.png", "cottages_steel_block.png",
cottages.craftitems.steel, cottages.craftitems.steel,
{ {
groups = {node = 1, cracky = 1, level = 2}, groups = { node = 1, cracky = 1, level = 2 },
sounds = cottages.sounds.metal, sounds = cottages.sounds.metal,
sound_open = "doors_steel_door_open", sound_open = "doors_steel_door_open",
sound_close = "doors_steel_door_close", sound_close = "doors_steel_door_close",

View File

@ -2,332 +2,326 @@ local S = cottages.S
local api = cottages.feldweg local api = cottages.feldweg
local box_slope = { local box_slope = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.25, 0.5}, { -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.25, -0.25, 0.5, 0, 0.5 },
{-0.5, 0, 0, 0.5, 0.25, 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 = { local box_slope_long = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, -0.5, -1.5, 0.5, -0.10, 0.5}, { -0.5, -0.5, -1.5, 0.5, -0.10, 0.5 },
{-0.5, -0.25, -1.3, 0.5, -0.25, 0.5}, { -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.25, -1.0, 0.5, 0, 0.5 },
{-0.5, 0, -0.5, 0.5, 0.25, 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) local function simplify_tile(tile)
if type(tile) == "string" then if type(tile) == "string" then
return tile return tile
elseif type(tile) == "table" then
elseif type(tile) == "table" then if type(tile.name) == "string" then
if type(tile.name) == "string" then return tile.name
return tile.name else
error(("weird tile %q"):dump(tile))
else end
error(("weird tile %q"):dump(tile)) else
end error(("weird tile %q"):dump(tile))
end
else
error(("weird tile %q"):dump(tile))
end
end end
local function get_textures(tiles, special) local function get_textures(tiles, special)
if #tiles == 1 then if #tiles == 1 then
local tile1 = simplify_tile(tiles[1]) local tile1 = simplify_tile(tiles[1])
return tile1, tile1, tile1, tile1, "cottages_feldweg_surface.png^" .. (special or tile1) return tile1, tile1, tile1, tile1, "cottages_feldweg_surface.png^" .. (special or tile1)
elseif #tiles == 2 then
elseif #tiles == 2 then local tile1 = simplify_tile(tiles[1])
local tile1 = simplify_tile(tiles[1]) local tile2 = simplify_tile(tiles[2])
local tile2 = simplify_tile(tiles[2]) return tile1, tile2, tile1, tile1, "cottages_feldweg_surface.png^" .. (special or tile1)
return tile1, tile2, tile1, tile1, "cottages_feldweg_surface.png^" .. (special or tile1) elseif #tiles == 3 then
local tile1 = simplify_tile(tiles[1])
elseif #tiles == 3 then local tile2 = simplify_tile(tiles[2])
local tile1 = simplify_tile(tiles[1]) local tile3 = simplify_tile(tiles[3])
local tile2 = simplify_tile(tiles[2]) return tile1, tile2, tile3, tile3, "cottages_feldweg_surface.png^" .. (special or tile1)
local tile3 = simplify_tile(tiles[3]) else
return tile1, tile2, tile3, tile3, "cottages_feldweg_surface.png^" .. (special or tile1) error(("not implemented: %i tiles"):format(#tiles))
end
else
error(("not implemented: %i tiles"):format(#tiles))
end
end end
local function register_feldweg(name, base_def, def) local function register_feldweg(name, base_def, def)
minetest.register_node(name, { minetest.register_node(name, {
description = def.description, description = def.description,
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
legacy_facedir_simple = true, legacy_facedir_simple = true,
drawtype = "mesh", drawtype = "mesh",
mesh = def.mesh, mesh = def.mesh,
tiles = def.tiles, tiles = def.tiles,
collision_box = def.collision_box, collision_box = def.collision_box,
selection_box = def.selection_box, selection_box = def.selection_box,
is_ground_content = false, is_ground_content = false,
groups = base_def.groups, groups = base_def.groups,
sounds = base_def.sounds, sounds = base_def.sounds,
}) })
minetest.register_craft({ minetest.register_craft({
output = name .. " " .. def.output_amount, output = name .. " " .. def.output_amount,
recipe = def.recipe, recipe = def.recipe,
replacements = def.replacements, replacements = def.replacements,
}) })
minetest.register_craft({ minetest.register_craft({
output = def.reverts_to, output = def.reverts_to,
recipe = { recipe = {
{name}, { name },
}, },
}) })
end end
function api.register_feldweg(node, suffix, special) function api.register_feldweg(node, suffix, special)
local def = minetest.registered_nodes[node] local def = minetest.registered_nodes[node]
local texture_top, texture_bottom, texture_side, texture_side_with_dent, texture_edges = local texture_top, texture_bottom, texture_side, texture_side_with_dent, texture_edges =
get_textures(def.tiles, special) get_textures(def.tiles, special)
local desc = futil.get_safe_short_description(node) local desc = futil.get_safe_short_description(node)
local feldweg_name = "cottages:feldweg" .. suffix local feldweg_name = "cottages:feldweg" .. suffix
register_feldweg(feldweg_name, def, { register_feldweg(feldweg_name, def, {
description = S("dirt road on @1", desc), description = S("dirt road on @1", desc),
mesh = "feldweg.obj", mesh = "feldweg.obj",
tiles = { tiles = {
texture_side_with_dent, texture_side_with_dent,
texture_side, texture_side,
texture_bottom,
texture_top,
"cottages_feldweg_surface.png",
texture_edges
},
recipe = {
{"", "cottages:wagon_wheel", ""},
{node, node, node},
},
replacements = {{"cottages:wagon_wheel", "cottages:wagon_wheel"},},
output_amount = 3,
reverts_to = node,
})
register_feldweg("cottages:feldweg_crossing" .. suffix, def, {
description = S("dirt road crossing on @1", desc),
mesh = "feldweg-crossing.obj",
tiles = {
texture_side_with_dent,
texture_bottom, texture_bottom,
texture_top,
"cottages_feldweg_surface.png",
texture_edges,
},
recipe = {
{"", feldweg_name, ""},
{feldweg_name, feldweg_name, feldweg_name},
{"", feldweg_name, ""},
},
output_amount = 5,
reverts_to = feldweg_name,
})
register_feldweg("cottages:feldweg_t_junction" .. suffix, def, {
description = S("dirt road t junction on @1", desc),
mesh = "feldweg-T-junction.obj",
tiles = {
texture_side_with_dent,
texture_side,
texture_bottom,
texture_top,
"cottages_feldweg_surface.png",
texture_edges,
},
recipe = {
{"", feldweg_name, ""},
{"", feldweg_name, ""},
{feldweg_name, feldweg_name, feldweg_name},
},
output_amount = 5,
reverts_to = feldweg_name,
})
register_feldweg("cottages:feldweg_curve" .. suffix, def, {
description = S("dirt road curve on @1", desc),
mesh = "feldweg-curve.obj",
tiles = {
texture_side,
texture_top,
texture_side,
"cottages_feldweg_surface.png",
texture_bottom,
texture_edges,
},
recipe = {
{feldweg_name, "", ""},
{feldweg_name, "", ""},
{feldweg_name, feldweg_name, feldweg_name},
},
output_amount = 5,
reverts_to = feldweg_name,
})
register_feldweg("cottages:feldweg_end" .. suffix, def, {
description = S("dirt road end on @1", desc),
mesh = "feldweg_end.obj",
tiles = {
texture_side_with_dent,
texture_side,
texture_bottom,
texture_top,
texture_edges,
"cottages_feldweg_surface.png",
},
recipe = {
{feldweg_name, "", feldweg_name},
{feldweg_name, feldweg_name, feldweg_name},
},
output_amount = 5,
reverts_to = feldweg_name,
})
register_feldweg("cottages:feldweg_45" .. suffix, def, {
description = S("dirt road 45º on @1", desc),
mesh = "feldweg_45.b3d",
tiles = {
"cottages_feldweg_surface.png",
texture_edges,
texture_side,
texture_bottom,
texture_top,
},
recipe = {
{feldweg_name, "", feldweg_name},
{"", feldweg_name, ""},
{feldweg_name, "", feldweg_name},
},
output_amount = 5,
reverts_to = feldweg_name,
})
register_feldweg("cottages:feldweg_s_45" .. suffix, def, {
description = S("dirt road 45º edge on @1", desc),
mesh = "feldweg_s_45.b3d",
tiles = {
texture_top, texture_top,
texture_side,
texture_bottom,
"cottages_feldweg_surface.png", "cottages_feldweg_surface.png",
texture_edges, texture_edges,
}, },
recipe = { recipe = {
{feldweg_name, ""}, { "", "cottages:wagon_wheel", "" },
{"", feldweg_name}, { node, node, node },
}, },
output_amount = 2, replacements = { { "cottages:wagon_wheel", "cottages:wagon_wheel" } },
reverts_to = feldweg_name, output_amount = 3,
}) reverts_to = node,
})
register_feldweg("cottages:feldweg_d_45" .. suffix, def, { register_feldweg("cottages:feldweg_crossing" .. suffix, def, {
description = S("dirt road 45º double edge on @1", desc), description = S("dirt road crossing on @1", desc),
mesh = "feldweg_d_45.b3d", mesh = "feldweg-crossing.obj",
tiles = { tiles = {
texture_side_with_dent,
texture_bottom,
texture_top,
"cottages_feldweg_surface.png",
texture_edges,
},
recipe = {
{ "", feldweg_name, "" },
{ feldweg_name, feldweg_name, feldweg_name },
{ "", feldweg_name, "" },
},
output_amount = 5,
reverts_to = feldweg_name,
})
register_feldweg("cottages:feldweg_t_junction" .. suffix, def, {
description = S("dirt road t junction on @1", desc),
mesh = "feldweg-T-junction.obj",
tiles = {
texture_side_with_dent,
texture_side, texture_side,
texture_bottom, texture_bottom,
texture_top, texture_top,
"cottages_feldweg_surface.png",
texture_edges,
},
recipe = {
{ "", feldweg_name, "" },
{ "", feldweg_name, "" },
{ feldweg_name, feldweg_name, feldweg_name },
},
output_amount = 5,
reverts_to = feldweg_name,
})
register_feldweg("cottages:feldweg_curve" .. suffix, def, {
description = S("dirt road curve on @1", desc),
mesh = "feldweg-curve.obj",
tiles = {
texture_side,
texture_top,
texture_side,
"cottages_feldweg_surface.png",
texture_bottom,
texture_edges,
},
recipe = {
{ feldweg_name, "", "" },
{ feldweg_name, "", "" },
{ feldweg_name, feldweg_name, feldweg_name },
},
output_amount = 5,
reverts_to = feldweg_name,
})
register_feldweg("cottages:feldweg_end" .. suffix, def, {
description = S("dirt road end on @1", desc),
mesh = "feldweg_end.obj",
tiles = {
texture_side_with_dent,
texture_side,
texture_bottom,
texture_top,
texture_edges, texture_edges,
"cottages_feldweg_surface.png", "cottages_feldweg_surface.png",
}, },
recipe = { recipe = {
{feldweg_name, "", feldweg_name}, { feldweg_name, "", feldweg_name },
{"", feldweg_name, ""}, { feldweg_name, feldweg_name, feldweg_name },
}, },
output_amount = 3, output_amount = 5,
reverts_to = feldweg_name, reverts_to = feldweg_name,
}) })
register_feldweg("cottages:feldweg_l_curve" .. suffix, def, { register_feldweg("cottages:feldweg_45" .. suffix, def, {
description = S("dirt road left curve on @1", desc), description = S("dirt road 45º on @1", desc),
mesh = "feldweg_l_45_curve.b3d", mesh = "feldweg_45.b3d",
tiles = { tiles = {
"cottages_feldweg_surface.png",
texture_edges,
texture_side, texture_side,
texture_bottom, texture_bottom,
texture_top, texture_top,
},
recipe = {
{ feldweg_name, "", feldweg_name },
{ "", feldweg_name, "" },
{ feldweg_name, "", feldweg_name },
},
output_amount = 5,
reverts_to = feldweg_name,
})
register_feldweg("cottages:feldweg_s_45" .. suffix, def, {
description = S("dirt road 45º edge on @1", desc),
mesh = "feldweg_s_45.b3d",
tiles = {
texture_top,
texture_side,
texture_bottom,
"cottages_feldweg_surface.png",
texture_edges,
},
recipe = {
{ feldweg_name, "" },
{ "", feldweg_name },
},
output_amount = 2,
reverts_to = feldweg_name,
})
register_feldweg("cottages:feldweg_d_45" .. suffix, def, {
description = S("dirt road 45º double edge on @1", desc),
mesh = "feldweg_d_45.b3d",
tiles = {
texture_side,
texture_bottom,
texture_top,
texture_edges, texture_edges,
"cottages_feldweg_surface.png", "cottages_feldweg_surface.png",
}, },
recipe = { recipe = {
{"", "", feldweg_name}, { feldweg_name, "", feldweg_name },
{feldweg_name, feldweg_name, ""}, { "", feldweg_name, "" },
}, },
output_amount = 3, output_amount = 3,
reverts_to = feldweg_name, reverts_to = feldweg_name,
}) })
register_feldweg("cottages:feldweg_r_curve" .. suffix, def, { register_feldweg("cottages:feldweg_l_curve" .. suffix, def, {
description = S("dirt road right curve on @1", desc), description = S("dirt road left curve on @1", desc),
mesh = "feldweg_r_45_curve.b3d", mesh = "feldweg_l_45_curve.b3d",
tiles = { tiles = {
texture_side, texture_side,
texture_bottom, texture_bottom,
texture_top, texture_top,
texture_edges, texture_edges,
"cottages_feldweg_surface.png", "cottages_feldweg_surface.png",
}, },
recipe = { recipe = {
{feldweg_name, "", ""}, { "", "", feldweg_name },
{"", feldweg_name, feldweg_name}, { feldweg_name, feldweg_name, "" },
}, },
output_amount = 3, output_amount = 3,
reverts_to = feldweg_name, reverts_to = feldweg_name,
}) })
register_feldweg("cottages:feldweg_slope" .. suffix, def, { register_feldweg("cottages:feldweg_r_curve" .. suffix, def, {
description = S("dirt road slope on @1", desc), description = S("dirt road right curve on @1", desc),
mesh = "feldweg_slope.obj", mesh = "feldweg_r_45_curve.b3d",
tiles = { tiles = {
texture_side_with_dent,
texture_side, texture_side,
texture_bottom, texture_bottom,
texture_top, texture_top,
texture_edges,
"cottages_feldweg_surface.png",
},
recipe = {
{ feldweg_name, "", "" },
{ "", feldweg_name, feldweg_name },
},
output_amount = 3,
reverts_to = feldweg_name,
})
register_feldweg("cottages:feldweg_slope" .. suffix, def, {
description = S("dirt road slope on @1", desc),
mesh = "feldweg_slope.obj",
tiles = {
texture_side_with_dent,
texture_side,
texture_bottom,
texture_top,
"cottages_feldweg_surface.png", "cottages_feldweg_surface.png",
texture_edges, texture_edges,
}, },
collision_box = box_slope, collision_box = box_slope,
selection_box = box_slope, selection_box = box_slope,
recipe = { recipe = {
{feldweg_name, ""}, { feldweg_name, "" },
{feldweg_name, feldweg_name}, { feldweg_name, feldweg_name },
}, },
output_amount = 3, output_amount = 3,
reverts_to = feldweg_name, reverts_to = feldweg_name,
}) })
register_feldweg("cottages:feldweg_slope_long" .. suffix, def, { register_feldweg("cottages:feldweg_slope_long" .. suffix, def, {
description = S("dirt road slope long on @1", desc), description = S("dirt road slope long on @1", desc),
mesh = "feldweg_slope_long.obj", mesh = "feldweg_slope_long.obj",
tiles = { tiles = {
texture_side_with_dent, texture_side_with_dent,
texture_side, texture_side,
texture_bottom, texture_bottom,
texture_top, texture_top,
"cottages_feldweg_surface.png", "cottages_feldweg_surface.png",
texture_edges, texture_edges,
}, },
collision_box = box_slope_long, collision_box = box_slope_long,
selection_box = box_slope_long, selection_box = box_slope_long,
recipe = { recipe = {
{feldweg_name, "", ""}, { feldweg_name, "", "" },
{feldweg_name, feldweg_name, feldweg_name}, { feldweg_name, feldweg_name, feldweg_name },
}, },
output_amount = 4, output_amount = 4,
reverts_to = feldweg_name, reverts_to = feldweg_name,
}) })
end end

View File

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

View File

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

View File

@ -4,8 +4,8 @@ if ci.fence then
minetest.register_craft({ minetest.register_craft({
output = "cottages:fence_small 3", output = "cottages:fence_small 3",
recipe = { recipe = {
{ci.fence, ci.fence}, { ci.fence, ci.fence },
} },
}) })
end end
@ -14,35 +14,35 @@ if minetest.get_modpath("xfences") then
minetest.register_craft({ minetest.register_craft({
output = "cottages:fence_small 3", output = "cottages:fence_small 3",
recipe = { recipe = {
{"xfences:fence", "xfences:fence"}, { "xfences:fence", "xfences:fence" },
} },
}) })
end end
minetest.register_craft({ minetest.register_craft({
output = "cottages:fence_corner", output = "cottages:fence_corner",
recipe = { recipe = {
{"cottages:fence_small", "cottages:fence_small"}, { "cottages:fence_small", "cottages:fence_small" },
} },
}) })
minetest.register_craft({ minetest.register_craft({
output = "cottages:fence_small 2", output = "cottages:fence_small 2",
recipe = { recipe = {
{"cottages:fence_corner"}, { "cottages:fence_corner" },
} },
}) })
minetest.register_craft({ minetest.register_craft({
output = "cottages:fence_end", output = "cottages:fence_end",
recipe = { recipe = {
{"cottages:fence_small", "cottages:fence_small", "cottages:fence_small"}, { "cottages:fence_small", "cottages:fence_small", "cottages:fence_small" },
} },
}) })
minetest.register_craft({ minetest.register_craft({
output = "cottages:fence_small 3", output = "cottages:fence_small 3",
recipe = { recipe = {
{"cottages:fence_end"}, { "cottages:fence_end" },
} },
}) })

View File

@ -6,25 +6,25 @@ minetest.register_node("cottages:fence_small", {
description = S("small fence"), description = S("small fence"),
drawtype = "nodebox", drawtype = "nodebox",
-- top, bottom, side1, side2, inner, outer -- top, bottom, side1, side2, inner, outer
tiles = {"cottages_minimal_wood.png"}, tiles = { "cottages_minimal_wood.png" },
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2}, groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2 },
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.45, -0.35, 0.46, 0.45, -0.20, 0.50}, { -0.45, -0.35, 0.46, 0.45, -0.20, 0.50 },
{-0.45, 0.00, 0.46, 0.45, 0.15, 0.50}, { -0.45, 0.00, 0.46, 0.45, 0.15, 0.50 },
{-0.45, 0.35, 0.46, 0.45, 0.50, 0.50}, { -0.45, 0.35, 0.46, 0.45, 0.50, 0.50 },
{-0.50, -0.50, 0.46, -0.45, 0.50, 0.50}, { -0.50, -0.50, 0.46, -0.45, 0.50, 0.50 },
{0.45, -0.50, 0.46, 0.50, 0.50, 0.50}, { 0.45, -0.50, 0.46, 0.50, 0.50, 0.50 },
}, },
}, },
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.50, -0.50, 0.4, 0.50, 0.50, 0.5}, { -0.50, -0.50, 0.4, 0.50, 0.50, 0.5 },
}, },
}, },
is_ground_content = false, is_ground_content = false,
@ -34,32 +34,32 @@ minetest.register_node("cottages:fence_corner", {
description = S("small fence corner"), description = S("small fence corner"),
drawtype = "nodebox", drawtype = "nodebox",
-- top, bottom, side1, side2, inner, outer -- top, bottom, side1, side2, inner, outer
tiles = {"cottages_minimal_wood.png"}, tiles = { "cottages_minimal_wood.png" },
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2}, groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2 },
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.45, -0.35, 0.46, 0.45, -0.20, 0.50}, { -0.45, -0.35, 0.46, 0.45, -0.20, 0.50 },
{-0.45, 0.00, 0.46, 0.45, 0.15, 0.50}, { -0.45, 0.00, 0.46, 0.45, 0.15, 0.50 },
{-0.45, 0.35, 0.46, 0.45, 0.50, 0.50}, { -0.45, 0.35, 0.46, 0.45, 0.50, 0.50 },
{-0.50, -0.50, 0.46, -0.45, 0.50, 0.50}, { -0.50, -0.50, 0.46, -0.45, 0.50, 0.50 },
{0.45, -0.50, 0.46, 0.50, 0.50, 0.50}, { 0.45, -0.50, 0.46, 0.50, 0.50, 0.50 },
{0.46, -0.35, -0.45, 0.50, -0.20, 0.45}, { 0.46, -0.35, -0.45, 0.50, -0.20, 0.45 },
{0.46, 0.00, -0.45, 0.50, 0.15, 0.45}, { 0.46, 0.00, -0.45, 0.50, 0.15, 0.45 },
{0.46, 0.35, -0.45, 0.50, 0.50, 0.45}, { 0.46, 0.35, -0.45, 0.50, 0.50, 0.45 },
{0.46, -0.50, -0.50, 0.50, 0.50, -0.45}, { 0.46, -0.50, -0.50, 0.50, 0.50, -0.45 },
{0.46, -0.50, 0.45, 0.50, 0.50, 0.50}, { 0.46, -0.50, 0.45, 0.50, 0.50, 0.50 },
}, },
}, },
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.50, -0.50, -0.5, 0.50, 0.50, 0.5}, { -0.50, -0.50, -0.5, 0.50, 0.50, 0.5 },
}, },
}, },
is_ground_content = false, is_ground_content = false,
@ -69,39 +69,39 @@ minetest.register_node("cottages:fence_end", {
description = S("small fence end"), description = S("small fence end"),
drawtype = "nodebox", drawtype = "nodebox",
-- top, bottom, side1, side2, inner, outer -- top, bottom, side1, side2, inner, outer
tiles = {"cottages_minimal_wood.png"}, tiles = { "cottages_minimal_wood.png" },
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2}, groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2 },
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.45, -0.35, 0.46, 0.45, -0.20, 0.50}, { -0.45, -0.35, 0.46, 0.45, -0.20, 0.50 },
{-0.45, 0.00, 0.46, 0.45, 0.15, 0.50}, { -0.45, 0.00, 0.46, 0.45, 0.15, 0.50 },
{-0.45, 0.35, 0.46, 0.45, 0.50, 0.50}, { -0.45, 0.35, 0.46, 0.45, 0.50, 0.50 },
{-0.50, -0.50, 0.46, -0.45, 0.50, 0.50}, { -0.50, -0.50, 0.46, -0.45, 0.50, 0.50 },
{0.45, -0.50, 0.46, 0.50, 0.50, 0.50}, { 0.45, -0.50, 0.46, 0.50, 0.50, 0.50 },
{0.46, -0.35, -0.45, 0.50, -0.20, 0.45}, { 0.46, -0.35, -0.45, 0.50, -0.20, 0.45 },
{0.46, 0.00, -0.45, 0.50, 0.15, 0.45}, { 0.46, 0.00, -0.45, 0.50, 0.15, 0.45 },
{0.46, 0.35, -0.45, 0.50, 0.50, 0.45}, { 0.46, 0.35, -0.45, 0.50, 0.50, 0.45 },
{0.46, -0.50, -0.50, 0.50, 0.50, -0.45}, { 0.46, -0.50, -0.50, 0.50, 0.50, -0.45 },
{0.46, -0.50, 0.45, 0.50, 0.50, 0.50}, { 0.46, -0.50, 0.45, 0.50, 0.50, 0.50 },
{-0.50, -0.35, -0.45, -0.46, -0.20, 0.45}, { -0.50, -0.35, -0.45, -0.46, -0.20, 0.45 },
{-0.50, 0.00, -0.45, -0.46, 0.15, 0.45}, { -0.50, 0.00, -0.45, -0.46, 0.15, 0.45 },
{-0.50, 0.35, -0.45, -0.46, 0.50, 0.45}, { -0.50, 0.35, -0.45, -0.46, 0.50, 0.45 },
{-0.50, -0.50, -0.50, -0.46, 0.50, -0.45}, { -0.50, -0.50, -0.50, -0.46, 0.50, -0.45 },
{-0.50, -0.50, 0.45, -0.46, 0.50, 0.50}, { -0.50, -0.50, 0.45, -0.46, 0.50, 0.50 },
}, },
}, },
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.50, -0.50, -0.5, 0.50, 0.50, 0.5}, { -0.50, -0.50, -0.5, 0.50, 0.50, 0.5 },
}, },
}, },
is_ground_content = false, is_ground_content = false,

View File

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

View File

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

View File

@ -1,26 +1,25 @@
minetest.register_craft({ minetest.register_craft({
output = "cottages:hay_mat 9", output = "cottages:hay_mat 9",
recipe = { recipe = {
{"cottages:hay"}, { "cottages:hay" },
}, },
}) })
minetest.register_craft({ minetest.register_craft({
output = "cottages:hay", output = "cottages:hay",
recipe = { recipe = {
{"cottages:hay_mat", "cottages:hay_mat", "cottages:hay_mat"}, { "cottages:hay_mat", "cottages:hay_mat", "cottages:hay_mat" },
{"cottages:hay_mat", "cottages:hay_mat", "cottages:hay_mat"}, { "cottages:hay_mat", "cottages:hay_mat", "cottages:hay_mat" },
{"cottages:hay_mat", "cottages:hay_mat", "cottages:hay_mat"}, { "cottages:hay_mat", "cottages:hay_mat", "cottages:hay_mat" },
}, },
}) })
minetest.register_craft({ minetest.register_craft({
output = "cottages:hay", output = "cottages:hay",
recipe = {{"cottages:hay_bale"}}, recipe = { { "cottages:hay_bale" } },
}) })
minetest.register_craft({ minetest.register_craft({
output = "cottages:hay_bale", output = "cottages:hay_bale",
recipe = {{"cottages:hay"}}, recipe = { { "cottages:hay" } },
}) })

View File

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

View File

@ -5,29 +5,29 @@ minetest.register_node("cottages:hay_mat", {
paramtype2 = "leveled", paramtype2 = "leveled",
description = S("Some hay"), description = S("Some hay"),
tiles = { tiles = {
cottages.textures.straw .. "^[multiply:#88BB88" cottages.textures.straw .. "^[multiply:#88BB88",
}, },
groups = {hay = 3, snappy = 2, oddly_breakable_by_hand = 2, flammable = 3}, groups = { hay = 3, snappy = 2, oddly_breakable_by_hand = 2, flammable = 3 },
sounds = cottages.sounds.leaves, sounds = cottages.sounds.leaves,
-- the bale is slightly smaller than a full node -- the bale is slightly smaller than a full node
is_ground_content = false, is_ground_content = false,
node_box = { node_box = {
type = "leveled", --"fixed", type = "leveled", --"fixed",
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 },
} },
}, },
-- make sure a placed hay block looks halfway reasonable -- make sure a placed hay block looks halfway reasonable
after_place_node = function(pos, placer, itemstack, pointed_thing) after_place_node = function(pos, placer, itemstack, pointed_thing)
minetest.swap_node(pos, {name = "cottages:hay_mat", param2 = math.random(2, 25)}) minetest.swap_node(pos, { name = "cottages:hay_mat", param2 = math.random(2, 25) })
end, end,
}) })
-- hay block, similar to straw block -- hay block, similar to straw block
minetest.register_node("cottages:hay", { minetest.register_node("cottages:hay", {
description = S("Hay"), description = S("Hay"),
tiles = {cottages.textures.straw .. "^[multiply:#88BB88"}, tiles = { cottages.textures.straw .. "^[multiply:#88BB88" },
groups = {hay = 3, snappy = 2, oddly_breakable_by_hand = 2, flammable = 3}, groups = { hay = 3, snappy = 2, oddly_breakable_by_hand = 2, flammable = 3 },
sounds = cottages.sounds.leaves, sounds = cottages.sounds.leaves,
is_ground_content = false, is_ground_content = false,
}) })
@ -36,22 +36,22 @@ minetest.register_node("cottages:hay", {
minetest.register_node("cottages:hay_bale", { minetest.register_node("cottages:hay_bale", {
drawtype = "nodebox", drawtype = "nodebox",
description = S("Hay bale"), description = S("Hay bale"),
tiles = {"cottages_darkage_straw_bale.png^[multiply:#88BB88"}, tiles = { "cottages_darkage_straw_bale.png^[multiply:#88BB88" },
paramtype = "light", paramtype = "light",
groups = {hay = 3, snappy = 2, oddly_breakable_by_hand = 2, flammable = 3}, groups = { hay = 3, snappy = 2, oddly_breakable_by_hand = 2, flammable = 3 },
sounds = cottages.sounds.leaves, sounds = cottages.sounds.leaves,
-- the bale is slightly smaller than a full node -- the bale is slightly smaller than a full node
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.45, -0.5, -0.45, 0.45, 0.45, 0.45}, { -0.45, -0.5, -0.45, 0.45, 0.45, 0.45 },
} },
}, },
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.45, -0.5, -0.45, 0.45, 0.45, 0.45}, { -0.45, -0.5, -0.45, 0.45, 0.45, 0.45 },
} },
}, },
is_ground_content = false, is_ground_content = false,
}) })

View File

@ -4,10 +4,10 @@ if ci.iron and ci.stick and ci.steel then
minetest.register_craft({ minetest.register_craft({
output = "cottages:wagon_wheel 3", output = "cottages:wagon_wheel 3",
recipe = { recipe = {
{ci.iron, ci.stick, ci.iron}, { ci.iron, ci.stick, ci.iron },
{ci.stick, ci.steel, ci.stick}, { ci.stick, ci.steel, ci.stick },
{ci.iron, ci.stick, ci.iron} { ci.iron, ci.stick, ci.iron },
} },
}) })
end end
@ -15,52 +15,52 @@ if ci.sand and ci.clay then
minetest.register_craft({ minetest.register_craft({
output = "cottages:loam 4", output = "cottages:loam 4",
recipe = { recipe = {
{ci.sand}, { ci.sand },
{ci.clay} { ci.clay },
} },
}) })
end end
minetest.register_craft({ minetest.register_craft({
output = "cottages:straw_ground 2", output = "cottages:straw_ground 2",
recipe = { recipe = {
{"cottages:straw_mat"}, { "cottages:straw_mat" },
{"cottages:loam"} { "cottages:loam" },
} },
}) })
if ci.stick and ci.glass then if ci.stick and ci.glass then
minetest.register_craft({ minetest.register_craft({
output = "cottages:glass_pane 4", output = "cottages:glass_pane 4",
recipe = { recipe = {
{ci.stick, ci.stick, ci.stick}, { ci.stick, ci.stick, ci.stick },
{ci.stick, ci.glass, ci.stick}, { ci.stick, ci.glass, ci.stick },
{ci.stick, ci.stick, ci.stick} { ci.stick, ci.stick, ci.stick },
} },
}) })
end end
minetest.register_craft({ minetest.register_craft({
output = "cottages:glass_pane_side", output = "cottages:glass_pane_side",
recipe = { recipe = {
{"cottages:glass_pane"}, { "cottages:glass_pane" },
} },
}) })
minetest.register_craft({ minetest.register_craft({
output = "cottages:glass_pane", output = "cottages:glass_pane",
recipe = { recipe = {
{"cottages:glass_pane_side"}, { "cottages:glass_pane_side" },
} },
}) })
if ci.stick and ci.string then if ci.stick and ci.string then
minetest.register_craft({ minetest.register_craft({
output = "cottages:wood_flat 16", output = "cottages:wood_flat 16",
recipe = { recipe = {
{ci.stick, ci.string, ci.stick}, { ci.stick, ci.string, ci.stick },
{ci.stick, "", ci.stick}, { ci.stick, "", ci.stick },
} },
}) })
end end
@ -68,15 +68,15 @@ if ci.stick then
minetest.register_craft({ minetest.register_craft({
output = "cottages:wool_tent 2", output = "cottages:wool_tent 2",
recipe = { recipe = {
{ci.string, ci.string}, { ci.string, ci.string },
{"", ci.stick} { "", ci.stick },
} },
}) })
end end
minetest.register_craft({ minetest.register_craft({
output = "cottages:wool", output = "cottages:wool",
recipe = { 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", "nodes")
cottages.dofile("modules", "historic", "crafts") cottages.dofile("modules", "historic", "crafts")

View File

@ -2,33 +2,32 @@ local S = cottages.S
if cottages.has.wool and minetest.registered_nodes["wool:white"] then if cottages.has.wool and minetest.registered_nodes["wool:white"] then
minetest.register_alias("cottages:wool", "wool:white") minetest.register_alias("cottages:wool", "wool:white")
else else
minetest.register_node("cottages:wool", { minetest.register_node("cottages:wool", {
description = "Wool", description = "Wool",
tiles = {"cottages_wool.png"}, tiles = { "cottages_wool.png" },
is_ground_content = false, is_ground_content = false,
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 3, flammable = 3, wool = 1}, groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 3, flammable = 3, wool = 1 },
}) })
end end
minetest.register_node("cottages:wool_tent", { minetest.register_node("cottages:wool_tent", {
description = S("wool for tents"), description = S("wool for tents"),
drawtype = "nodebox", drawtype = "nodebox",
tiles = {"cottages_wool.png"}, tiles = { "cottages_wool.png" },
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2}, groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2 },
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, -0.5, -0.50, 0.5, -0.5 + 1 / 16, 0.50}, { -0.5, -0.5, -0.50, 0.5, -0.5 + 1 / 16, 0.50 },
}, },
}, },
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, -0.5, -0.50, 0.5, -0.5 + 1 / 16, 0.50}, { -0.5, -0.5, -0.50, 0.5, -0.5 + 1 / 16, 0.50 },
}, },
}, },
is_ground_content = false, is_ground_content = false,
@ -38,20 +37,20 @@ minetest.register_node("cottages:wool_tent", {
minetest.register_node("cottages:wood_flat", { minetest.register_node("cottages:wood_flat", {
description = S("flat wooden planks"), description = S("flat wooden planks"),
drawtype = "nodebox", drawtype = "nodebox",
tiles = {"cottages_minimal_wood.png"}, tiles = { "cottages_minimal_wood.png" },
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2}, groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2 },
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, -0.5, -0.50, 0.5, -0.5 + 1 / 16, 0.50}, { -0.5, -0.5, -0.50, 0.5, -0.5 + 1 / 16, 0.50 },
}, },
}, },
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, -0.5, -0.50, 0.5, -0.5 + 1 / 16, 0.50}, { -0.5, -0.5, -0.50, 0.5, -0.5 + 1 / 16, 0.50 },
}, },
}, },
is_ground_content = false, is_ground_content = false,
@ -61,20 +60,20 @@ minetest.register_node("cottages:wood_flat", {
minetest.register_node("cottages:glass_pane", { minetest.register_node("cottages:glass_pane", {
description = S("simple glass pane (centered)"), description = S("simple glass pane (centered)"),
drawtype = "nodebox", drawtype = "nodebox",
tiles = {"cottages_glass_pane.png"}, tiles = { "cottages_glass_pane.png" },
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2}, groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2 },
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, -0.5, -0.05, 0.5, 0.5, 0.05}, { -0.5, -0.5, -0.05, 0.5, 0.5, 0.05 },
}, },
}, },
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, -0.5, -0.05, 0.5, 0.5, 0.05}, { -0.5, -0.5, -0.05, 0.5, 0.5, 0.05 },
}, },
}, },
is_ground_content = false, is_ground_content = false,
@ -83,20 +82,20 @@ minetest.register_node("cottages:glass_pane", {
minetest.register_node("cottages:glass_pane_side", { minetest.register_node("cottages:glass_pane_side", {
description = S("simple glass pane"), description = S("simple glass pane"),
drawtype = "nodebox", drawtype = "nodebox",
tiles = {"cottages_glass_pane.png"}, tiles = { "cottages_glass_pane.png" },
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2}, groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2 },
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, -0.5, -0.40, 0.5, 0.5, -0.50}, { -0.5, -0.5, -0.40, 0.5, 0.5, -0.50 },
}, },
}, },
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, -0.5, -0.40, 0.5, 0.5, -0.50}, { -0.5, -0.5, -0.40, 0.5, 0.5, -0.50 },
}, },
}, },
is_ground_content = false, is_ground_content = false,
@ -110,18 +109,17 @@ minetest.register_node("cottages:straw_ground", {
"cottages_loam.png", "cottages_loam.png",
"cottages_loam.png", "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}, groups = { snappy = 2, crumbly = 3, choppy = 2, oddly_breakable_by_hand = 2 },
sounds = cottages.sounds.leaves, sounds = cottages.sounds.leaves,
is_ground_content = false, is_ground_content = false,
}) })
minetest.register_node("cottages:loam", { minetest.register_node("cottages:loam", {
description = S("loam"), description = S("loam"),
tiles = {"cottages_loam.png"}, tiles = { "cottages_loam.png" },
groups = {snappy = 2, crumbly = 3, choppy = 2, oddly_breakable_by_hand = 2}, groups = { snappy = 2, crumbly = 3, choppy = 2, oddly_breakable_by_hand = 2 },
sounds = cottages.sounds.dirt, sounds = cottages.sounds.dirt,
is_ground_content = false, is_ground_content = false,
}) })
@ -129,7 +127,7 @@ minetest.register_node("cottages:loam", {
minetest.register_node("cottages:wagon_wheel", { minetest.register_node("cottages:wagon_wheel", {
description = S("wagon wheel"), description = S("wagon wheel"),
drawtype = "signlike", drawtype = "signlike",
tiles = {"cottages_wagonwheel.png"}, tiles = { "cottages_wagonwheel.png" },
inventory_image = "cottages_wagonwheel.png", inventory_image = "cottages_wagonwheel.png",
wield_image = "cottages_wagonwheel.png", wield_image = "cottages_wagonwheel.png",
paramtype = "light", paramtype = "light",
@ -139,15 +137,17 @@ minetest.register_node("cottages:wagon_wheel", {
selection_box = { selection_box = {
type = "wallmounted", type = "wallmounted",
}, },
groups = {choppy = 2, dig_immediate = 2, attached_node = 1}, groups = { choppy = 2, dig_immediate = 2, attached_node = 1 },
legacy_wallmounted = true, legacy_wallmounted = true,
is_ground_content = false, is_ground_content = false,
}) })
if cottages.has.stairs then if cottages.has.stairs then
stairs.register_stair_and_slab("loam", "cottages:loam", stairs.register_stair_and_slab(
{snappy = 2, crumbly = 3, choppy = 2, oddly_breakable_by_hand = 2}, "loam",
{"cottages_loam.png"}, "cottages:loam",
{ snappy = 2, crumbly = 3, choppy = 2, oddly_breakable_by_hand = 2 },
{ "cottages_loam.png" },
S("Loam Stairs"), S("Loam Stairs"),
S("Loam Slab"), S("Loam Slab"),
cottages.sounds.dirt cottages.sounds.dirt

View File

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

View File

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

View File

@ -5,10 +5,10 @@ if ci.stick then
minetest.register_craft({ minetest.register_craft({
output = "cottages:pitchfork", output = "cottages:pitchfork",
recipe = { recipe = {
{ci.stick, ci.stick, ci.stick}, { ci.stick, ci.stick, ci.stick },
{"", ci.stick, ""}, { "", ci.stick, "" },
{"", ci.stick, ""}, { "", ci.stick, "" },
} },
}) })
end end
@ -24,7 +24,7 @@ if cottages.has.unified_inventory then
unified_inventory.register_craft({ unified_inventory.register_craft({
output = "cottages:hay_mat", output = "cottages:hay_mat",
type = "cottages:pitchfork", type = "cottages:pitchfork",
items = {"default:dirt_with_grass"}, items = { "default:dirt_with_grass" },
width = 1, width = 1,
}) })
end end

View File

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

View File

@ -8,7 +8,7 @@ minetest.register_node("cottages:pitchfork", {
short_description = S("Pitchfork"), short_description = S("Pitchfork"),
inventory_image = "cottages_pitchfork.png", inventory_image = "cottages_pitchfork.png",
wield_image = "cottages_pitchfork.png^[transformFYR180", wield_image = "cottages_pitchfork.png^[transformFYR180",
wield_scale = {x = 1.5, y = 1.5, z = 0.5}, wield_scale = { x = 1.5, y = 1.5, z = 0.5 },
stack_max = 1, stack_max = 1,
liquids_pointable = false, liquids_pointable = false,
@ -16,11 +16,11 @@ minetest.register_node("cottages:pitchfork", {
full_punch_interval = 1.0, full_punch_interval = 1.0,
max_drop_level = 1, max_drop_level = 1,
groupcaps = { groupcaps = {
crumbly = {times={[2]=3.00, [3]=0.70}, 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, }, 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, }, 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 damage_groups = { fleshy = 5 }, -- slightly stronger than a stone sword
}, },
drawtype = "nodebox", drawtype = "nodebox",
@ -29,29 +29,29 @@ minetest.register_node("cottages:pitchfork", {
is_ground_content = false, is_ground_content = false,
drop = "cottages:pitchfork", drop = "cottages:pitchfork",
groups = {snappy = 2, dig_immediate = 3, falling_node = 1, attached_node = 1}, groups = { snappy = 2, dig_immediate = 3, falling_node = 1, attached_node = 1 },
sounds = cottages.sounds.wood, sounds = cottages.sounds.wood,
visual_scale = 1.0, visual_scale = 1.0,
tiles = {"default_wood.png^[transformR90"}, tiles = { "default_wood.png^[transformR90" },
special_tiles = {}, special_tiles = {},
post_effect_color = {a=0, r=0, g=0, b=0}, post_effect_color = { a = 0, r = 0, g = 0, b = 0 },
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
-- handle (goes a bit into the ground) -- handle (goes a bit into the ground)
{-(1 / 32), -(11 / 16), -(1 / 32), (1 / 32), 16 / 16, (1 / 32)}, { -(1 / 32), -(11 / 16), -(1 / 32), (1 / 32), 16 / 16, (1 / 32) },
-- middle connection -- middle connection
{-(7 / 32), -(4 / 16), -(1 / 32), (7 / 32), -(2 / 16), (1 / 32)}, { -(7 / 32), -(4 / 16), -(1 / 32), (7 / 32), -(2 / 16), (1 / 32) },
-- thongs -- thongs
{-(7 / 32), -(11 / 16), -(1 / 32), -(5 / 32), -(4 / 16), (1 / 32)}, { -(7 / 32), -(11 / 16), -(1 / 32), -(5 / 32), -(4 / 16), (1 / 32) },
{(5 / 32), -(11 / 16), -(1 / 32), (7 / 32), -(4 / 16), (1 / 32)}, { (5 / 32), -(11 / 16), -(1 / 32), (7 / 32), -(4 / 16), (1 / 32) },
}, },
}, },
selection_box = { selection_box = {
type = "fixed", 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 },
}, },
}) })
@ -81,15 +81,15 @@ local function override_on_dig(node_name, replacement)
return old_on_dig(pos, node, digger) return old_on_dig(pos, node, digger)
end end
local pos_above = vector.add(pos, {x=0, y=1, z=0}) local pos_above = vector.add(pos, { x = 0, y = 1, z = 0 })
local node_above = minetest.get_node(pos_above) local node_above = minetest.get_node(pos_above)
if minetest.is_protected(pos_above, digger_name) or node_above.name ~= "air" then if minetest.is_protected(pos_above, digger_name) or node_above.name ~= "air" then
return old_on_dig(pos, node, digger) return old_on_dig(pos, node, digger)
end end
minetest.swap_node(pos, {name = replacement}) minetest.swap_node(pos, { name = replacement })
minetest.swap_node(pos_above, {name = "cottages:hay_mat", param2 = math.random(2, 25)}) minetest.swap_node(pos_above, { name = "cottages:hay_mat", param2 = math.random(2, 25) })
if has_stamina then if has_stamina then
stamina.exhaust_player(digger, stamina_use, "cottages:pitchfork") stamina.exhaust_player(digger, stamina_use, "cottages:pitchfork")

View File

@ -8,19 +8,19 @@ function cottages.roof.register_roof(name, material, tiles)
tiles = tiles, tiles = tiles,
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2}, groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2 },
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, -0.5, -0.5, 0.5, 0, 0}, { -0.5, -0.5, -0.5, 0.5, 0, 0 },
{-0.5, 0, 0, 0.5, 0.5, 0.5}, { -0.5, 0, 0, 0.5, 0.5, 0.5 },
}, },
}, },
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, -0.5, -0.5, 0.5, 0, 0}, { -0.5, -0.5, -0.5, 0.5, 0, 0 },
{-0.5, 0, 0, 0.5, 0.5, 0.5}, { -0.5, 0, 0, 0.5, 0.5, 0.5 },
}, },
}, },
is_ground_content = false, is_ground_content = false,
@ -33,19 +33,19 @@ function cottages.roof.register_roof(name, material, tiles)
tiles = tiles, tiles = tiles,
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2}, groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2 },
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, -0.5, -0.5, 0.5, 0, 0.5}, { -0.5, -0.5, -0.5, 0.5, 0, 0.5 },
{-0.5, 0, 0, 0.5, 0.5, 0.5}, { -0.5, 0, 0, 0.5, 0.5, 0.5 },
}, },
}, },
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, -0.5, -0.5, 0.5, 0, 0.5}, { -0.5, -0.5, -0.5, 0.5, 0, 0.5 },
{-0.5, 0, 0, 0.5, 0.5, 0.5}, { -0.5, 0, 0, 0.5, 0.5, 0.5 },
}, },
}, },
is_ground_content = false, is_ground_content = false,
@ -57,20 +57,20 @@ function cottages.roof.register_roof(name, material, tiles)
drawtype = "nodebox", drawtype = "nodebox",
-- top, bottom, side1, side2, inner, outer -- top, bottom, side1, side2, inner, outer
-- this one is from all sides - except from the underside - of the given material -- this one is from all sides - except from the underside - of the given material
tiles = {tiles[1], tiles[2], tiles[1], tiles[1], tiles[1], tiles[1]}, tiles = { tiles[1], tiles[2], tiles[1], tiles[1], tiles[1], tiles[1] },
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2}, groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2 },
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, -0.5, -0.5, 0.5, 0, 0.5}, { -0.5, -0.5, -0.5, 0.5, 0, 0.5 },
}, },
}, },
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, -0.5, -0.5, 0.5, 0, 0.5}, { -0.5, -0.5, -0.5, 0.5, 0, 0.5 },
}, },
}, },
is_ground_content = false, is_ground_content = false,
@ -79,33 +79,32 @@ function cottages.roof.register_roof(name, material, tiles)
minetest.register_craft({ minetest.register_craft({
output = "cottages:roof_" .. name .. " 6", output = "cottages:roof_" .. name .. " 6",
recipe = { recipe = {
{"", "", material}, { "", "", material },
{"", material, ""}, { "", material, "" },
{material, "", ""} { material, "", "" },
} },
}) })
minetest.register_craft({ minetest.register_craft({
output = "cottages:roof_connector_" .. name, output = "cottages:roof_connector_" .. name,
recipe = { recipe = {
{"cottages:roof_" .. name}, { "cottages:roof_" .. name },
{ci.wood}, { ci.wood },
} },
}) })
minetest.register_craft({ minetest.register_craft({
output = "cottages:roof_flat_" .. name .. " 2", output = "cottages:roof_flat_" .. name .. " 2",
recipe = { recipe = {
{"cottages:roof_" .. name, "cottages:roof_" .. name}, { "cottages:roof_" .. name, "cottages:roof_" .. name },
} },
}) })
-- convert flat roofs back to normal roofs -- convert flat roofs back to normal roofs
minetest.register_craft({ minetest.register_craft({
output = "cottages:roof_" .. name, output = "cottages:roof_" .. name,
recipe = { 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 ) end -- of cottages.register_roof( name, tiles, basic_material )

View File

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

View File

@ -5,82 +5,93 @@ if cottages.settings.roof.use_farming_straw_stairs then
minetest.register_alias("cottages:roof_straw", "stairs:stair_straw") minetest.register_alias("cottages:roof_straw", "stairs:stair_straw")
minetest.register_alias("cottages:roof_connector_straw", "stairs:stair_straw") minetest.register_alias("cottages:roof_connector_straw", "stairs:stair_straw")
minetest.register_alias("cottages:roof_flat_straw", "stairs:slab_straw") minetest.register_alias("cottages:roof_flat_straw", "stairs:slab_straw")
else else
cottages.roof.register_roof( cottages.roof.register_roof("straw", "cottages:straw_mat", {
"straw", cottages.textures.straw,
"cottages:straw_mat", cottages.textures.straw,
{cottages.textures.straw, cottages.textures.straw, cottages.textures.straw,
cottages.textures.straw, cottages.textures.straw, cottages.textures.straw,
cottages.textures.straw, cottages.textures.straw} cottages.textures.straw,
) cottages.textures.straw,
})
end end
cottages.roof.register_roof( cottages.roof.register_roof("reet", ci.papyrus, {
"reet", "cottages_reet.png",
ci.papyrus, "cottages_reet.png",
{"cottages_reet.png", "cottages_reet.png", "cottages_reet.png",
"cottages_reet.png", "cottages_reet.png", "cottages_reet.png",
"cottages_reet.png", "cottages_reet.png"} "cottages_reet.png",
) "cottages_reet.png",
})
cottages.roof.register_roof( cottages.roof.register_roof("wood", ci.wood, {
"wood", cottages.textures.roof_wood,
ci.wood, cottages.textures.roof_sides,
{cottages.textures.roof_wood, cottages.textures.roof_sides, cottages.textures.roof_sides,
cottages.textures.roof_sides, cottages.textures.roof_sides, cottages.textures.roof_sides,
cottages.textures.roof_sides, cottages.textures.roof_wood} cottages.textures.roof_sides,
) cottages.textures.roof_wood,
})
cottages.roof.register_roof( cottages.roof.register_roof("black", ci.coal_lump, {
"black", "cottages_homedecor_shingles_asphalt.png",
ci.coal_lump, cottages.textures.roof_sides,
{"cottages_homedecor_shingles_asphalt.png", cottages.textures.roof_sides, cottages.textures.roof_sides,
cottages.textures.roof_sides, cottages.textures.roof_sides, cottages.textures.roof_sides,
cottages.textures.roof_sides, "cottages_homedecor_shingles_asphalt.png"} cottages.textures.roof_sides,
) "cottages_homedecor_shingles_asphalt.png",
})
cottages.roof.register_roof( cottages.roof.register_roof("red", ci.clay_brick, {
"red", "cottages_homedecor_shingles_terracotta.png",
ci.clay_brick, cottages.textures.roof_sides,
{"cottages_homedecor_shingles_terracotta.png", cottages.textures.roof_sides, cottages.textures.roof_sides,
cottages.textures.roof_sides, cottages.textures.roof_sides, cottages.textures.roof_sides,
cottages.textures.roof_sides, "cottages_homedecor_shingles_terracotta.png"} cottages.textures.roof_sides,
) "cottages_homedecor_shingles_terracotta.png",
})
cottages.roof.register_roof( cottages.roof.register_roof("brown", ci.dirt, {
"brown", "cottages_homedecor_shingles_wood.png",
ci.dirt, cottages.textures.roof_sides,
{"cottages_homedecor_shingles_wood.png", cottages.textures.roof_sides, cottages.textures.roof_sides,
cottages.textures.roof_sides, cottages.textures.roof_sides, cottages.textures.roof_sides,
cottages.textures.roof_sides, "cottages_homedecor_shingles_wood.png"} cottages.textures.roof_sides,
) "cottages_homedecor_shingles_wood.png",
})
cottages.roof.register_roof( cottages.roof.register_roof("slate", ci.stone, {
"slate", "cottages_slate.png",
ci.stone, cottages.textures.roof_sides,
{"cottages_slate.png", cottages.textures.roof_sides, "cottages_slate.png",
"cottages_slate.png", "cottages_slate.png", "cottages_slate.png",
cottages.textures.roof_sides, "cottages_slate.png"} cottages.textures.roof_sides,
) "cottages_slate.png",
})
-------- --------
minetest.register_node("cottages:reet", { minetest.register_node("cottages:reet", {
description = S("Reed for thatching"), description = S("Reed for thatching"),
tiles = {"cottages_reet.png"}, tiles = { "cottages_reet.png" },
groups = {hay = 3, snappy = 3, choppy = 3, oddly_breakable_by_hand = 3, flammable = 3}, groups = { hay = 3, snappy = 3, choppy = 3, oddly_breakable_by_hand = 3, flammable = 3 },
sounds = cottages.sounds.leaves, sounds = cottages.sounds.leaves,
is_ground_content = false, is_ground_content = false,
}) })
minetest.register_node("cottages:slate_vertical", { minetest.register_node("cottages:slate_vertical", {
description = S("Vertical Slate"), description = S("Vertical Slate"),
tiles = {"cottages_slate.png", cottages.textures.roof_sides, tiles = {
"cottages_slate.png", "cottages_slate.png", "cottages_slate.png",
cottages.textures.roof_sides, "cottages_slate.png"}, cottages.textures.roof_sides,
"cottages_slate.png",
"cottages_slate.png",
cottages.textures.roof_sides,
"cottages_slate.png",
},
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {cracky = 2, stone = 1}, groups = { cracky = 2, stone = 1 },
sounds = cottages.sounds.stone, sounds = cottages.sounds.stone,
is_ground_content = false, is_ground_content = false,
}) })

View File

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

View File

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

View File

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

View File

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

View File

@ -4,9 +4,9 @@ if ci.stick and ci.tree and ci.stick and ci.bucket then
minetest.register_craft({ minetest.register_craft({
output = "cottages:water_gen", output = "cottages:water_gen",
recipe = { recipe = {
{ci.stick, "", ""}, { ci.stick, "", "" },
{ci.tree, ci.bucket, ci.tree}, { ci.tree, ci.bucket, ci.tree },
{ci.tree, ci.tree, ci.tree}, { ci.tree, ci.tree, ci.tree },
} },
}) })
end end

View File

@ -5,8 +5,8 @@ minetest.register_entity("cottages:bucket_entity", {
visual = "wielditem", visual = "wielditem",
automatic_rotate = 1, automatic_rotate = 1,
wield_item = ci.bucket, wield_item = ci.bucket,
visual_size = {x = 0.33, y = 0.33}, visual_size = { x = 0.33, y = 0.33 },
collisionbox = {0, 0, 0, 0, 0, 0}, collisionbox = { 0, 0, 0, 0, 0, 0 },
pointable = false, pointable = false,
physical = false, physical = false,
static_save = false, static_save = false,
@ -25,8 +25,8 @@ minetest.register_entity("cottages:bucket_entity", {
local obj = self.object local obj = self.object
obj:set_properties({wield_item = staticdata}) obj:set_properties({ wield_item = staticdata })
obj:set_armor_groups({immortal = 1}) obj:set_armor_groups({ immortal = 1 })
end, end,
on_punch = function() on_punch = function()

View File

@ -1,6 +1,8 @@
local F = minetest.formspec_escape local F = minetest.formspec_escape
local S = cottages.S local S = cottages.S
local FS = function(...) return F(S(...)) end local FS = function(...)
return F(S(...))
end
local s = cottages.sounds local s = cottages.sounds
local t = cottages.textures 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) function water.get_well_fs_parts(pos)
return { return {
("size[8,9]"), "size[8,9]",
("label[3.0,0.0;%s]"):format(FS("Tree trunk well")), ("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,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.")), ("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):")), ("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,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)), ("item_image[0,3.8;1.0,1.0;%s]"):format(F(ci.bucket_filled)),
("list[context;main;1,3.3;8,1;]"), "list[context;main;1,3.3;8,1;]",
("list[current_player;main;0,4.85;8,4;]"), "list[current_player;main;0,4.85;8,4;]",
("listring[]"), "listring[]",
} }
end end
@ -42,7 +44,7 @@ function water.use_well(pos, puncher)
local pinv = puncher:get_inventory() local pinv = puncher:get_inventory()
local bucket = meta:get("bucket") local bucket = meta:get("bucket")
local entity_pos = vector.add(pos, vector.new(0, 1/4, 0)) local entity_pos = vector.add(pos, vector.new(0, 1 / 4, 0))
if not bucket then if not bucket then
local wielded = puncher:get_wielded_item() local wielded = puncher:get_wielded_item()
@ -58,19 +60,13 @@ function water.use_well(pos, puncher)
timer:start(well_fill_time) timer:start(well_fill_time)
water.add_filling_effects(pos) water.add_filling_effects(pos)
elseif wielded_name == ci.bucket_filled then elseif wielded_name == ci.bucket_filled then
-- empty a bucket -- empty a bucket
pinv:remove_item("main", ci.bucket_filled) pinv:remove_item("main", ci.bucket_filled)
pinv:add_item("main", ci.bucket) pinv:add_item("main", ci.bucket)
minetest.sound_play( minetest.sound_play({ name = s.water_empty }, { pos = entity_pos, gain = 0.5, pitch = 2.0 }, true)
{name = s.water_empty},
{pos = entity_pos, gain = 0.5, pitch = 2.0},
true
)
end end
elseif bucket == ci.bucket then elseif bucket == ci.bucket then
minetest.chat_send_player(player_name, S("Please wait until your bucket has been filled.")) minetest.chat_send_player(player_name, S("Please wait until your bucket has been filled."))
local timer = minetest.get_node_timer(pos) local timer = minetest.get_node_timer(pos)
@ -78,11 +74,10 @@ function water.use_well(pos, puncher)
timer:start(well_fill_time) timer:start(well_fill_time)
water.add_filling_effects(pos) water.add_filling_effects(pos)
end end
elseif bucket == ci.bucket_filled then elseif bucket == ci.bucket_filled then
meta:set_string("bucket", "") 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() local ent = obj:get_luaentity()
if ent and ent.name == "cottages:bucket_entity" then if ent and ent.name == "cottages:bucket_entity" then
obj:remove() obj:remove()
@ -94,7 +89,7 @@ function water.use_well(pos, puncher)
end end
function water.add_filling_effects(pos) function water.add_filling_effects(pos)
local entity_pos = vector.add(pos, vector.new(0, 1/4, 0)) local entity_pos = vector.add(pos, vector.new(0, 1 / 4, 0))
local spos = minetest.hash_node_position(pos) local spos = minetest.hash_node_position(pos)
@ -103,15 +98,15 @@ function water.add_filling_effects(pos)
minetest.sound_stop(previous_handle) minetest.sound_stop(previous_handle)
end end
sound_handles_by_pos[spos] = minetest.sound_play( sound_handles_by_pos[spos] = minetest.sound_play(
{name = s.water_fill}, { name = s.water_fill },
{pos = entity_pos, loop = true, gain = 0.5, pitch = 2.0} { pos = entity_pos, loop = true, gain = 0.5, pitch = 2.0 }
) )
local previous_id = particlespawner_ids_by_pos[spos] local previous_id = particlespawner_ids_by_pos[spos]
if previous_id then if previous_id then
minetest.delete_particlespawner(previous_id) minetest.delete_particlespawner(previous_id)
end end
local particle_pos = vector.add(pos, vector.new(0, 1/2 + 1/16, 0)) local particle_pos = vector.add(pos, vector.new(0, 1 / 2 + 1 / 16, 0))
particlespawner_ids_by_pos[spos] = minetest.add_particlespawner({ particlespawner_ids_by_pos[spos] = minetest.add_particlespawner({
amount = 10, amount = 10,
time = 0, time = 0,
@ -131,12 +126,12 @@ function water.add_filling_effects(pos)
end end
function water.fill_bucket(pos) function water.fill_bucket(pos)
local entity_pos = vector.add(pos, vector.new(0, 1/4, 0)) 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() local ent = obj:get_luaentity()
if ent and ent.name == "cottages:bucket_entity" then if ent and ent.name == "cottages:bucket_entity" then
obj:set_properties({wield_item = ci.bucket_filled}) obj:set_properties({ wield_item = ci.bucket_filled })
end end
end end
@ -158,7 +153,7 @@ function water.initialize_entity(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local bucket = meta:get("bucket") local bucket = meta:get("bucket")
if bucket then if bucket then
local entity_pos = vector.add(pos, vector.new(0, 1/4, 0)) local entity_pos = vector.add(pos, vector.new(0, 1 / 4, 0))
minetest.add_entity(entity_pos, "cottages:bucket_entity", bucket) minetest.add_entity(entity_pos, "cottages:bucket_entity", bucket)
if bucket == ci.bucket then if bucket == ci.bucket then
@ -173,13 +168,13 @@ end
cottages.api.register_machine("cottages:water_gen", { cottages.api.register_machine("cottages:water_gen", {
description = S("Tree Trunk Well"), description = S("Tree Trunk Well"),
tiles = {t.tree_top, ("%s^[transformR90"):format(t.tree), ("%s^[transformR90"):format(t.tree)}, tiles = { t.tree_top, ("%s^[transformR90"):format(t.tree), ("%s^[transformR90"):format(t.tree) },
drawtype = "nodebox", drawtype = "nodebox",
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
is_ground_content = false, is_ground_content = false,
groups = {choppy = 2, cracky = 1, flammable = 2}, groups = { choppy = 2, cracky = 1, flammable = 2 },
sounds = cottages.sounds.wood, sounds = cottages.sounds.wood,
inv_info = { inv_info = {
@ -190,29 +185,28 @@ cottages.api.register_machine("cottages:water_gen", {
type = "fixed", type = "fixed",
fixed = { fixed = {
-- floor of water bassin -- floor of water bassin
{-0.5, -0.5 + (3 / 16), -0.5, 0.5, -0.5 + (4 / 16), 0.5}, { -0.5, -0.5 + (3 / 16), -0.5, 0.5, -0.5 + (4 / 16), 0.5 },
-- walls -- walls
{-0.5, -0.5 + (3 / 16), -0.5, 0.5, (4 / 16), -0.5 + (2 / 16)}, { -0.5, -0.5 + (3 / 16), -0.5, 0.5, (4 / 16), -0.5 + (2 / 16) },
{-0.5, -0.5 + (3 / 16), -0.5, -0.5 + (2 / 16), (4 / 16), 0.5}, { -0.5, -0.5 + (3 / 16), -0.5, -0.5 + (2 / 16), (4 / 16), 0.5 },
{0.5, -0.5 + (3 / 16), 0.5, 0.5 - (2 / 16), (4 / 16), -0.5}, { 0.5, -0.5 + (3 / 16), 0.5, 0.5 - (2 / 16), (4 / 16), -0.5 },
{0.5, -0.5 + (3 / 16), 0.5, -0.5 + (2 / 16), (4 / 16), 0.5 - (2 / 16)}, { 0.5, -0.5 + (3 / 16), 0.5, -0.5 + (2 / 16), (4 / 16), 0.5 - (2 / 16) },
-- feet -- feet
{-0.5 + (3 / 16), -0.5, -0.5 + (3 / 16), -0.5 + (6 / 16), -0.5 + (3 / 16), 0.5 - (3 / 16)}, { -0.5 + (3 / 16), -0.5, -0.5 + (3 / 16), -0.5 + (6 / 16), -0.5 + (3 / 16), 0.5 - (3 / 16) },
{0.5 - (3 / 16), -0.5, -0.5 + (3 / 16), 0.5 - (6 / 16), -0.5 + (3 / 16), 0.5 - (3 / 16)}, { 0.5 - (3 / 16), -0.5, -0.5 + (3 / 16), 0.5 - (6 / 16), -0.5 + (3 / 16), 0.5 - (3 / 16) },
-- real pump -- real pump
{0.5 - (4 / 16), -0.5, -(2 / 16), 0.5, 0.5 + (4 / 16), (2 / 16)}, { 0.5 - (4 / 16), -0.5, -(2 / 16), 0.5, 0.5 + (4 / 16), (2 / 16) },
-- water pipe inside wooden stem -- water pipe inside wooden stem
{0.5 - (8 / 16), 0.5 + (1 / 16), -(1 / 16), 0.5, 0.5 + (3 / 16), (1 / 16)}, { 0.5 - (8 / 16), 0.5 + (1 / 16), -(1 / 16), 0.5, 0.5 + (3 / 16), (1 / 16) },
-- where the water comes out -- where the water comes out
{0.5 - (15 / 32), 0.5, -(1 / 32), 0.5 - (12 / 32), 0.5 + (1 / 16), (1 / 32)}, { 0.5 - (15 / 32), 0.5, -(1 / 32), 0.5 - (12 / 32), 0.5 + (1 / 16), (1 / 32) },
}, },
}, },
selection_box = { selection_box = {
type = "fixed", 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_fs_parts = water.get_well_fs_parts,
get_info = water.get_well_info, get_info = water.get_well_info,
@ -245,9 +239,9 @@ cottages.api.register_machine("cottages:water_gen", {
use = water.use_well, use = water.use_well,
on_destruct = function(pos) on_destruct = function(pos)
local entity_pos = vector.add(pos, vector.new(0, 1/4, 0)) 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() local ent = obj:get_luaentity()
if ent and ent.name == "cottages:bucket_entity" then if ent and ent.name == "cottages:bucket_entity" then
minetest.add_item(pos, obj:get_properties().wield_item) minetest.add_item(pos, obj:get_properties().wield_item)
@ -271,15 +265,14 @@ cottages.api.register_machine("cottages:water_gen", {
if cottages.has.node_entity_queue then if cottages.has.node_entity_queue then
node_entity_queue.api.register_node_entity_loader("cottages:water_gen", water.initialize_entity) node_entity_queue.api.register_node_entity_loader("cottages:water_gen", water.initialize_entity)
else else
minetest.register_lbm({ minetest.register_lbm({
name = "cottages:add_well_entity", name = "cottages:add_well_entity",
label = "Initialize entity to cottages well", label = "Initialize entity to cottages well",
nodenames = {"cottages:water_gen"}, nodenames = { "cottages:water_gen" },
run_at_every_load = true, run_at_every_load = true,
action = function(pos, node) action = function(pos, node)
water.initialize_entity(pos) water.initialize_entity(pos)
end end,
}) })
end end

View File

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

View File

@ -12,7 +12,6 @@ if has.default then
textures.tree = "default_tree.png" textures.tree = "default_tree.png"
textures.tree_top = "default_tree_top.png" textures.tree_top = "default_tree_top.png"
textures.dust = "default_item_smoke.png" textures.dust = "default_item_smoke.png"
else else
textures.furniture = "cottages_minimal_wood.png" textures.furniture = "cottages_minimal_wood.png"
textures.roof_sides = "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), enabled = s:get_bool("cottages.roof.enabled", true),
use_farming_straw_stairs = ( use_farming_straw_stairs = (
s:get_bool("cottages.roof.use_farming_straw_stairs", false) and s:get_bool("cottages.roof.use_farming_straw_stairs", false)
minetest.registered_nodes["stairs:stair_straw"] and minetest.registered_nodes["stairs:stair_straw"]
), ),
}, },
@ -83,6 +83,6 @@ cottages.settings = {
water = { water = {
enabled = s:get_bool("cottages.water.enabled", true), 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 if owner == player_name then
return true return true
elseif owner == "" or owner == " " or public == 1 then elseif owner == "" or owner == " " or public == 1 then
return not minetest.is_protected(pos, player_name) return not minetest.is_protected(pos, player_name)
else else
return true return true
end end
@ -46,18 +44,15 @@ function util.toggle_public(pos, sender)
-- owner can switch private to protected -- owner can switch private to protected
meta:set_int("public", 1) meta:set_int("public", 1)
return true return true
elseif public == 1 and not minetest.is_protected(pos, sender_name) then elseif public == 1 and not minetest.is_protected(pos, sender_name) then
-- player of area can switch protected to public -- player of area can switch protected to public
meta:set_int("public", 2) meta:set_int("public", 2)
return true return true
elseif public == 2 then elseif public == 2 then
if owner == sender_name then if owner == sender_name then
-- owner can switch public to private -- owner can switch public to private
meta:set_int("public", 0) meta:set_int("public", 0)
return true return true
elseif not minetest.is_protected(pos, sender_name) then elseif not minetest.is_protected(pos, sender_name) then
-- player of area can switch public to protected -- player of area can switch public to protected
meta:set_int("public", 1) meta:set_int("public", 1)