stylua fixes

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

View File

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

View File

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

View File

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

View File

@ -5,7 +5,7 @@ if workbench then
local cottages_table_def = minetest.registered_nodes["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,
can_dig = workbench.can_dig,
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)
cottages = {
version = os.time({year = 2022, month = 9, day = 29}),
version = os.time({ year = 2022, month = 9, day = 29 }),
fork = "fluxionary",
modname = modname,
@ -36,7 +36,7 @@ cottages = {
end,
dofile = function(...)
return dofile(table.concat({modpath, ...}, DIR_DELIM) .. ".lua")
return dofile(table.concat({ modpath, ... }, DIR_DELIM) .. ".lua")
end,
}

View File

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

View File

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

View File

@ -11,10 +11,10 @@ minetest.register_tool("cottages:hammer", {
max_drop_level = 1,
groupcaps = {
-- 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

View File

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

View File

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

View File

@ -8,7 +8,7 @@ local rotations = {
minetest.register_lbm({
label = "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,
action = function(pos, node)
node.name = string.gsub(node.name, "_lying", "")
@ -16,5 +16,5 @@ minetest.register_lbm({
minetest.swap_node(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({
output = "cottages:barrel",
recipe = {
{ci.wood, ci.wood, ci.wood},
{ci.steel, "", ci.steel},
{ci.wood, ci.wood, ci.wood},
{ ci.wood, ci.wood, ci.wood },
{ ci.steel, "", ci.steel },
{ ci.wood, ci.wood, ci.wood },
},
})
minetest.register_craft({
output = "cottages:barrel_open",
recipe = {
{ci.wood, "", ci.wood},
{ci.steel, "", ci.steel},
{ci.wood, ci.wood, ci.wood},
{ ci.wood, "", ci.wood },
{ ci.steel, "", ci.steel },
{ ci.wood, ci.wood, ci.wood },
},
})
end
@ -23,14 +23,14 @@ end
minetest.register_craft({
output = "cottages:tub 2",
recipe = {
{"cottages:barrel"},
{ "cottages:barrel" },
},
})
minetest.register_craft({
output = "cottages:barrel",
recipe = {
{"cottages:tub"},
{"cottages:tub"},
{ "cottages:tub" },
{ "cottages:tub" },
},
})

View File

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

View File

@ -1,23 +1,23 @@
-- open shutters in the morning
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
chance = 3, -- not all people wake up at the same time!
action = function(pos)
if not cottages.doorlike.is_night() then
cottages.doorlike.shutter_open(pos)
end
end
end,
})
-- close them at night
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
chance = 2,
action = function(pos)
if cottages.doorlike.is_night() then
cottages.doorlike.shutter_close(pos)
end
end
end,
})

View File

@ -12,10 +12,10 @@ local offsets = {
}
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)
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_down = false
@ -66,24 +66,24 @@ end
-- 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
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 = {
{-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.49, -0.55, -0.49, -0.3, -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.075, -0.55, -0.075, 0.3, -0.45, 0.075},
{ -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.49, -0.55, -0.49, -0.3, -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.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
{-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.45, -0.530, 0.45, -0.15, -0.470, 0.525 },
{ 0.15, -0.530, 0.45, 0.45, -0.470, 0.525 },
-- 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)
@ -100,7 +100,7 @@ local function rotate(unrotated)
y2 = -z1
z1 = -tmp
table.insert(rotated, {x1, y1, z1, x2, y2, z2})
table.insert(rotated, { x1, y1, z1, x2, y2, z2 })
end
return rotated
end
@ -111,7 +111,7 @@ function api.register_hatch(nodename, description, texture, receipe_item, def)
def.description = S(description)
def.tile_front = 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 = {
type = "fixed",
fixed = node_box,
@ -122,16 +122,15 @@ function api.register_hatch(nodename, description, texture, receipe_item, def)
}
doors.register_trapdoor(nodename, def)
else
minetest.register_node(nodename, {
description = S(description), -- not that there are any other...
drawtype = "nodebox",
-- top, bottom, side1, side2, inner, outer
tiles = {texture},
tiles = { texture },
paramtype = "light",
paramtype2 = "facedir",
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2},
groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2 },
node_box = {
type = "fixed",
@ -139,14 +138,14 @@ function api.register_hatch(nodename, description, texture, receipe_item, def)
},
selection_box = {
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)
if has_stamina then
stamina.exhaust_player(puncher, stamina_use, nodename)
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,
is_ground_content = false,
on_place = minetest.rotate_node,
@ -156,8 +155,8 @@ function api.register_hatch(nodename, description, texture, receipe_item, def)
minetest.register_craft({
output = nodename,
recipe = {
{"", "", receipe_item},
{receipe_item, cottages.craftitems.stick, ""},
}
{ "", "", receipe_item },
{ receipe_item, cottages.craftitems.stick, "" },
},
})
end

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -6,25 +6,25 @@ minetest.register_node("cottages:fence_small", {
description = S("small fence"),
drawtype = "nodebox",
-- top, bottom, side1, side2, inner, outer
tiles = {"cottages_minimal_wood.png"},
tiles = { "cottages_minimal_wood.png" },
paramtype = "light",
paramtype2 = "facedir",
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2},
groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2 },
node_box = {
type = "fixed",
fixed = {
{-0.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.35, 0.46, 0.45, 0.50, 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.35, 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.50, -0.50, 0.46, -0.45, 0.50, 0.50 },
{ 0.45, -0.50, 0.46, 0.50, 0.50, 0.50 },
},
},
selection_box = {
type = "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,
@ -34,32 +34,32 @@ minetest.register_node("cottages:fence_corner", {
description = S("small fence corner"),
drawtype = "nodebox",
-- top, bottom, side1, side2, inner, outer
tiles = {"cottages_minimal_wood.png"},
tiles = { "cottages_minimal_wood.png" },
paramtype = "light",
paramtype2 = "facedir",
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2},
groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2 },
node_box = {
type = "fixed",
fixed = {
{-0.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.35, 0.46, 0.45, 0.50, 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.35, 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.50, -0.50, 0.46, -0.45, 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.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.20, 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.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.50, 0.50, 0.50, -0.45 },
{ 0.46, -0.50, 0.45, 0.50, 0.50, 0.50 },
},
},
selection_box = {
type = "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,
@ -69,39 +69,39 @@ minetest.register_node("cottages:fence_end", {
description = S("small fence end"),
drawtype = "nodebox",
-- top, bottom, side1, side2, inner, outer
tiles = {"cottages_minimal_wood.png"},
tiles = { "cottages_minimal_wood.png" },
paramtype = "light",
paramtype2 = "facedir",
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2},
groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2 },
node_box = {
type = "fixed",
fixed = {
{-0.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.35, 0.46, 0.45, 0.50, 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.35, 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.50, -0.50, 0.46, -0.45, 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.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.20, 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.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.50, 0.50, 0.50, -0.45 },
{ 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.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.20, 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.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.50, -0.46, 0.50, -0.45 },
{ -0.50, -0.50, 0.45, -0.46, 0.50, 0.50 },
},
},
selection_box = {
type = "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,

View File

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

View File

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

View File

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

View File

@ -1,26 +1,25 @@
minetest.register_craft({
output = "cottages:hay_mat 9",
recipe = {
{"cottages:hay"},
{ "cottages:hay" },
},
})
minetest.register_craft({
output = "cottages:hay",
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({
output = "cottages:hay",
recipe = {{"cottages:hay_bale"}},
recipe = { { "cottages:hay_bale" } },
})
minetest.register_craft({
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", "crafts")

View File

@ -5,29 +5,29 @@ minetest.register_node("cottages:hay_mat", {
paramtype2 = "leveled",
description = S("Some hay"),
tiles = {
cottages.textures.straw .. "^[multiply:#88BB88"
cottages.textures.straw .. "^[multiply:#88BB88",
},
groups = {hay = 3, snappy = 2, oddly_breakable_by_hand = 2, flammable = 3},
groups = { hay = 3, snappy = 2, oddly_breakable_by_hand = 2, flammable = 3 },
sounds = cottages.sounds.leaves,
-- the bale is slightly smaller than a full node
is_ground_content = false,
node_box = {
type = "leveled", --"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
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,
})
-- hay block, similar to straw block
minetest.register_node("cottages:hay", {
description = S("Hay"),
tiles = {cottages.textures.straw .. "^[multiply:#88BB88"},
groups = {hay = 3, snappy = 2, oddly_breakable_by_hand = 2, flammable = 3},
tiles = { cottages.textures.straw .. "^[multiply:#88BB88" },
groups = { hay = 3, snappy = 2, oddly_breakable_by_hand = 2, flammable = 3 },
sounds = cottages.sounds.leaves,
is_ground_content = false,
})
@ -36,22 +36,22 @@ minetest.register_node("cottages:hay", {
minetest.register_node("cottages:hay_bale", {
drawtype = "nodebox",
description = S("Hay bale"),
tiles = {"cottages_darkage_straw_bale.png^[multiply:#88BB88"},
tiles = { "cottages_darkage_straw_bale.png^[multiply:#88BB88" },
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,
-- the bale is slightly smaller than a full node
node_box = {
type = "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 = {
type = "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,
})

View File

@ -4,10 +4,10 @@ if ci.iron and ci.stick and ci.steel then
minetest.register_craft({
output = "cottages:wagon_wheel 3",
recipe = {
{ci.iron, ci.stick, ci.iron},
{ci.stick, ci.steel, ci.stick},
{ci.iron, ci.stick, ci.iron}
}
{ ci.iron, ci.stick, ci.iron },
{ ci.stick, ci.steel, ci.stick },
{ ci.iron, ci.stick, ci.iron },
},
})
end
@ -15,52 +15,52 @@ if ci.sand and ci.clay then
minetest.register_craft({
output = "cottages:loam 4",
recipe = {
{ci.sand},
{ci.clay}
}
{ ci.sand },
{ ci.clay },
},
})
end
minetest.register_craft({
output = "cottages:straw_ground 2",
recipe = {
{"cottages:straw_mat"},
{"cottages:loam"}
}
{ "cottages:straw_mat" },
{ "cottages:loam" },
},
})
if ci.stick and ci.glass then
minetest.register_craft({
output = "cottages:glass_pane 4",
recipe = {
{ci.stick, ci.stick, ci.stick},
{ci.stick, ci.glass, ci.stick},
{ci.stick, ci.stick, ci.stick}
}
{ ci.stick, ci.stick, ci.stick },
{ ci.stick, ci.glass, ci.stick },
{ ci.stick, ci.stick, ci.stick },
},
})
end
minetest.register_craft({
output = "cottages:glass_pane_side",
recipe = {
{"cottages:glass_pane"},
}
{ "cottages:glass_pane" },
},
})
minetest.register_craft({
output = "cottages:glass_pane",
recipe = {
{"cottages:glass_pane_side"},
}
{ "cottages:glass_pane_side" },
},
})
if ci.stick and ci.string then
minetest.register_craft({
output = "cottages:wood_flat 16",
recipe = {
{ci.stick, ci.string, ci.stick},
{ci.stick, "", ci.stick},
}
{ ci.stick, ci.string, ci.stick },
{ ci.stick, "", ci.stick },
},
})
end
@ -68,15 +68,15 @@ if ci.stick then
minetest.register_craft({
output = "cottages:wool_tent 2",
recipe = {
{ci.string, ci.string},
{"", ci.stick}
}
{ ci.string, ci.string },
{ "", ci.stick },
},
})
end
minetest.register_craft({
output = "cottages:wool",
recipe = {
{"cottages:wool_tent", "cottages:wool_tent"}
}
{ "cottages:wool_tent", "cottages:wool_tent" },
},
})

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -8,7 +8,7 @@ minetest.register_node("cottages:pitchfork", {
short_description = S("Pitchfork"),
inventory_image = "cottages_pitchfork.png",
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,
liquids_pointable = false,
@ -16,11 +16,11 @@ minetest.register_node("cottages:pitchfork", {
full_punch_interval = 1.0,
max_drop_level = 1,
groupcaps = {
crumbly = {times={[2]=3.00, [3]=0.70}, maxlevel = 1, uses = 0, punch_attack_uses = 0, },
snappy = {times = {[2] = 0.40, [3] = 0.20}, maxlevel = 1, uses = 0, punch_attack_uses = 0, },
hay = {times = {[2] = 0.10, [3] = 0.10}, maxlevel = 1, uses = 0, punch_attack_uses = 0, },
crumbly = { times = { [2] = 3.00, [3] = 0.70 }, maxlevel = 1, uses = 0, punch_attack_uses = 0 },
snappy = { times = { [2] = 0.40, [3] = 0.20 }, maxlevel = 1, uses = 0, punch_attack_uses = 0 },
hay = { times = { [2] = 0.10, [3] = 0.10 }, maxlevel = 1, uses = 0, punch_attack_uses = 0 },
},
damage_groups = {fleshy = 5}, -- slightly stronger than a stone sword
damage_groups = { fleshy = 5 }, -- slightly stronger than a stone sword
},
drawtype = "nodebox",
@ -29,29 +29,29 @@ minetest.register_node("cottages:pitchfork", {
is_ground_content = false,
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,
visual_scale = 1.0,
tiles = {"default_wood.png^[transformR90"},
tiles = { "default_wood.png^[transformR90" },
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 = {
type = "fixed",
fixed = {
-- 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
{-(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
{-(7 / 32), -(11 / 16), -(1 / 32), -(5 / 32), -(4 / 16), (1 / 32)},
{(5 / 32), -(11 / 16), -(1 / 32), (7 / 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) },
},
},
selection_box = {
type = "fixed",
fixed = {-0.3, -0.5, -0.1, 0.3, 1.0, 0.1}
fixed = { -0.3, -0.5, -0.1, 0.3, 1.0, 0.1 },
},
})
@ -81,15 +81,15 @@ local function override_on_dig(node_name, replacement)
return old_on_dig(pos, node, digger)
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)
if minetest.is_protected(pos_above, digger_name) or node_above.name ~= "air" then
return old_on_dig(pos, node, digger)
end
minetest.swap_node(pos, {name = replacement})
minetest.swap_node(pos_above, {name = "cottages:hay_mat", param2 = math.random(2, 25)})
minetest.swap_node(pos, { name = replacement })
minetest.swap_node(pos_above, { name = "cottages:hay_mat", param2 = math.random(2, 25) })
if has_stamina then
stamina.exhaust_player(digger, stamina_use, "cottages:pitchfork")

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,8 @@
local F = minetest.formspec_escape
local S = cottages.S
local FS = function(...) return F(S(...)) end
local FS = function(...)
return F(S(...))
end
local s = cottages.sounds
local t = cottages.textures
@ -16,7 +18,7 @@ local well_fill_time = cottages.settings.water.well_fill_time
function water.get_well_fs_parts(pos)
return {
("size[8,9]"),
"size[8,9]",
("label[3.0,0.0;%s]"):format(FS("Tree trunk well")),
("label[0,0.7;%s]"):format(FS("Punch the well while wielding an empty bucket.")),
("label[0,1.0;%s]"):format(FS("Your bucket will slowly be filled with river water.")),
@ -25,9 +27,9 @@ function water.get_well_fs_parts(pos)
("label[1.0,2.9;%s]"):format(FS("Internal bucket storage (passive storage only):")),
("item_image[0,2.8;1.0,1.0;%s]"):format(F(ci.bucket)),
("item_image[0,3.8;1.0,1.0;%s]"):format(F(ci.bucket_filled)),
("list[context;main;1,3.3;8,1;]"),
("list[current_player;main;0,4.85;8,4;]"),
("listring[]"),
"list[context;main;1,3.3;8,1;]",
"list[current_player;main;0,4.85;8,4;]",
"listring[]",
}
end
@ -42,7 +44,7 @@ function water.use_well(pos, puncher)
local pinv = puncher:get_inventory()
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
local wielded = puncher:get_wielded_item()
@ -58,19 +60,13 @@ function water.use_well(pos, puncher)
timer:start(well_fill_time)
water.add_filling_effects(pos)
elseif wielded_name == ci.bucket_filled then
-- empty a bucket
pinv:remove_item("main", ci.bucket_filled)
pinv:add_item("main", ci.bucket)
minetest.sound_play(
{name = s.water_empty},
{pos = entity_pos, gain = 0.5, pitch = 2.0},
true
)
minetest.sound_play({ name = s.water_empty }, { pos = entity_pos, gain = 0.5, pitch = 2.0 }, true)
end
elseif bucket == ci.bucket then
minetest.chat_send_player(player_name, S("Please wait until your bucket has been filled."))
local timer = minetest.get_node_timer(pos)
@ -78,11 +74,10 @@ function water.use_well(pos, puncher)
timer:start(well_fill_time)
water.add_filling_effects(pos)
end
elseif bucket == ci.bucket_filled then
meta:set_string("bucket", "")
for _, obj in ipairs(minetest.get_objects_inside_radius(entity_pos, .1)) do
for _, obj in ipairs(minetest.get_objects_inside_radius(entity_pos, 0.1)) do
local ent = obj:get_luaentity()
if ent and ent.name == "cottages:bucket_entity" then
obj:remove()
@ -94,7 +89,7 @@ function water.use_well(pos, puncher)
end
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)
@ -103,15 +98,15 @@ function water.add_filling_effects(pos)
minetest.sound_stop(previous_handle)
end
sound_handles_by_pos[spos] = minetest.sound_play(
{name = s.water_fill},
{pos = entity_pos, loop = true, gain = 0.5, pitch = 2.0}
{ name = s.water_fill },
{ pos = entity_pos, loop = true, gain = 0.5, pitch = 2.0 }
)
local previous_id = particlespawner_ids_by_pos[spos]
if previous_id then
minetest.delete_particlespawner(previous_id)
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({
amount = 10,
time = 0,
@ -131,12 +126,12 @@ function water.add_filling_effects(pos)
end
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()
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
@ -158,7 +153,7 @@ function water.initialize_entity(pos)
local meta = minetest.get_meta(pos)
local bucket = meta:get("bucket")
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)
if bucket == ci.bucket then
@ -173,13 +168,13 @@ end
cottages.api.register_machine("cottages:water_gen", {
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",
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
groups = {choppy = 2, cracky = 1, flammable = 2},
groups = { choppy = 2, cracky = 1, flammable = 2 },
sounds = cottages.sounds.wood,
inv_info = {
@ -190,29 +185,28 @@ cottages.api.register_machine("cottages:water_gen", {
type = "fixed",
fixed = {
-- 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
{-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 - (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 - (2 / 16) },
-- 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
{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
{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
{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 = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, 0.5 + (4 / 16), 0.5}
fixed = { -0.5, -0.5, -0.5, 0.5, 0.5 + (4 / 16), 0.5 },
},
get_fs_parts = water.get_well_fs_parts,
get_info = water.get_well_info,
@ -245,9 +239,9 @@ cottages.api.register_machine("cottages:water_gen", {
use = water.use_well,
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()
if ent and ent.name == "cottages:bucket_entity" then
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
node_entity_queue.api.register_node_entity_loader("cottages:water_gen", water.initialize_entity)
else
minetest.register_lbm({
name = "cottages:add_well_entity",
label = "Initialize entity to cottages well",
nodenames = {"cottages:water_gen"},
nodenames = { "cottages:water_gen" },
run_at_every_load = true,
action = function(pos, node)
water.initialize_entity(pos)
end
end,
})
end

View File

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

View File

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

View File

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

View File

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