Compare commits

...

13 Commits

Author SHA1 Message Date
Sokomine dbe69bcfaf fixed bug in nodebox feldweg 2022-09-26 20:42:09 +02:00
Sokomine 7d2637478a fixed surplus , 2022-09-14 00:41:03 +02:00
Sokomine d2e96d409a made some parameters like groups more universal for feldweg nodes 2022-09-14 00:12:33 +02:00
Sokomine ddcfdf6402 added slopes to diffrent dirt type variants 2022-09-12 18:48:16 +02:00
Sokomine 53e58a06cd added 45 degree variants from APercy and Boot; added diffrent dirt types; in order to use, set mesh_incl_45 instead of mesh 2022-09-07 23:59:29 +02:00
Sokomine 8a2c3917e0 set use_texture_alpha 2022-01-06 00:05:37 +01:00
Sokomine 0893933b2d added mod.conf 2022-01-06 00:05:22 +01:00
Sokomine 2b10e6f679 fixed tree well 2021-06-16 19:09:11 +02:00
Sokomine 1afe904303 added cottages.forbid_repair to allow forbidding some tools from beeing repaired 2021-02-24 02:28:59 +01:00
Sokomine 3dec7bf200 fixed bug with hud removal 2021-02-23 23:26:53 +01:00
Sokomine 8cfaaed308 added listring to shelf 2020-10-02 01:46:32 +02:00
Sokomine 43eabc2f27 fixed bug 2019-03-12 21:24:13 +01:00
Sokomine ddafb51c10 removed deprecated setpos call 2019-03-11 23:44:35 +01:00
12 changed files with 439 additions and 280 deletions

5
mod.conf Normal file
View File

@ -0,0 +1,5 @@
name = cottages
description = Contains a lot of blocks that fit to medieval settlements and small cottages. Comes with hammer & anvil to repair tools. Threshing floor and handmill help process grains etc.
optional_depends = default, farming, stairs, homedecor, intllib, trees, wool, moreblocks
author = Sokomine
title = Blocks for building cottages.

BIN
models/feldweg_45.b3d Normal file

Binary file not shown.

BIN
models/feldweg_d_45.b3d Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
models/feldweg_s_45.b3d Normal file

Binary file not shown.

View File

@ -9,6 +9,12 @@
local S = cottages.S
-- disable repair with anvil by setting a message for the item in question
cottages.forbid_repair = {}
-- example for hammer no longer beeing able to repair the hammer
--cottages.forbid_repair["cottages:hammer"] = 'The hammer is too complex for repairing.'
-- the hammer for the anvil
minetest.register_tool("cottages:hammer", {
description = S("Steel hammer for repairing tools on the anvil"),
@ -138,6 +144,12 @@ minetest.register_node("cottages:anvil", {
S('The workpiece slot is for damaged tools only.'));
return 0;
end
if( listname=='input'
and cottages.forbid_repair[ stack:get_name() ]) then
minetest.chat_send_player( player:get_player_name(),
S(cottages.forbid_repair[ stack:get_name() ]));
return 0;
end
return stack:get_count()
end,
@ -181,6 +193,14 @@ minetest.register_node("cottages:anvil", {
-- 65535 is max damage
local damage_state = 40-math.floor(input:get_wear()/1638);
-- just to make sure that it really can't get repaired if it should not
-- (if the check of placing the item in the input slot failed somehow)
if( puncher and name and cottages.forbid_repair[ input:get_name() ]) then
minetest.chat_send_player( name,
S(cottages.forbid_repair[ input:get_name() ]));
return;
end
local tool_name = input:get_name();
local hud_image = "";
if( tool_name
@ -229,9 +249,9 @@ minetest.register_node("cottages:anvil", {
end
minetest.after(2, function()
if( puncher ) then
puncher:hud_remove(hud1);
puncher:hud_remove(hud2);
puncher:hud_remove(hud3);
if(hud1) then puncher:hud_remove(hud1); end
if(hud2) then puncher:hud_remove(hud2); end
if(hud3) then puncher:hud_remove(hud3); end
end
end)

View File

@ -19,64 +19,322 @@ local cottages_feldweg_mode = minetest.settings:get("cottages_feldweg_mode")
if( cottages_feldweg_mode ~= "mesh"
and cottages_feldweg_mode ~= "flat"
and cottages_feldweg_mode ~= "nodebox"
and cottages_feldweg_mode ~= "flat") then
and cottages_feldweg_mode ~= "mesh_incl_45") then
cottages_feldweg_mode = "mesh";
-- add the setting to the minetest.conf so that the player can set it there
minetest.settings:set("cottages_feldweg_mode", "mesh")
end
local function register_recipes(include_end)
-- make sure groups etc. are always the same
cottages.register_feldweg_node = function(node_name, def)
def.paramtype = "light"
def.paramtype2 = "facedir"
def.legacy_facedir_simple = true
def.groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,crumbly=2}
def.sounds = cottages.sounds.dirt
def.is_ground_content = false
minetest.register_node(node_name, def)
end
local function register_recipes(include_end, postfix, base_craftitem)
if(not(postfix)) then
postfix = ""
end
if(not(base_craftitem)) then
base_craftitem = cottages.craftitem_dirt
end
local base_node = "cottages:feldweg"..postfix
-- run a wagon wheel over dirt :-)
minetest.register_craft({
output = "cottages:feldweg_crossing 5",
output = base_node.." 4",
recipe = {
{"", "cottages:feldweg", "" },
{"cottages:feldweg", "cottages:feldweg", "cottages:feldweg"},
{"", "cottages:feldweg", "" },
{"", "cottages:wagon_wheel", "" },
{base_craftitem, base_craftitem, base_craftitem}
},
replacements = { {'cottages:wagon_wheel', 'cottages:wagon_wheel'}, }
})
minetest.register_craft({
output = "cottages:feldweg_crossing"..postfix.." 5",
recipe = {
{"", base_node, "" },
{base_node, base_node, base_node},
{"", base_node, "" },
},
})
minetest.register_craft({
output = "cottages:feldweg_t_junction 5",
output = "cottages:feldweg_t_junction"..postfix.." 5",
recipe = {
{"", "cottages:feldweg", "" },
{"", "cottages:feldweg", "" },
{"cottages:feldweg", "cottages:feldweg", "cottages:feldweg"}
{"", base_node, "" },
{"", base_node, "" },
{base_node, base_node, base_node}
},
})
minetest.register_craft({
output = "cottages:feldweg_curve 5",
output = "cottages:feldweg_curve"..postfix.." 5",
recipe = {
{"cottages:feldweg", "", "" },
{"cottages:feldweg", "", ""},
{"cottages:feldweg", "cottages:feldweg", "cottages:feldweg"}
{base_node, "", "" },
{base_node, "", ""},
{base_node, base_node, base_node}
},
})
if include_end then
minetest.register_craft({
output = "cottages:feldweg_end 5",
output = "cottages:feldweg_end"..postfix.." 5",
recipe = {
{"cottages:feldweg", "", "cottages:feldweg" },
{"cottages:feldweg", "cottages:feldweg", "cottages:feldweg"}
{base_node, "", base_node },
{base_node, base_node, base_node}
},
})
end
-- if the 45 degree version is loaded
if(minetest.registered_nodes["cottages:feldweg_45"..postfix]) then
minetest.register_craft({
output = "cottages:feldweg_45"..postfix,
recipe = {{base_node}}
})
minetest.register_craft({
output = "cottages:feldweg_l_curve"..postfix,
recipe = {{"cottages:feldweg_45"..postfix}}
})
minetest.register_craft({
output = "cottages:feldweg_r_curve"..postfix,
recipe = {{"cottages:feldweg_l_curve"..postfix}}
})
minetest.register_craft({
output = "cottages:feldweg_s_45"..postfix,
recipe = {{"cottages:feldweg_r_curve"..postfix}}
})
minetest.register_craft({
output = "cottages:feldweg_d_45"..postfix,
recipe = {{"cottages:feldweg_s_45"..postfix}}
})
minetest.register_craft({
output = "cottages:feldweg"..postfix,
recipe = {{"cottages:feldweg_d_45"..postfix}}
})
end
end
-- ignore_mode is unused here (exists just for compatibility with the _mesh version of the function)
cottages.register_nodes_slope = function(postfix, texture_top, texture_bottom, texture_side, ignore_mode, name_postfix, texture_side_with_dent, texture_edges)
if(not(postfix)) then
postfix = ""
end
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}
}};
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}
}};
cottages.register_feldweg_node("cottages:feldweg_slope"..postfix, {
description = S("dirt road slope"..name_postfix),
tiles = {texture_side_with_dent,
texture_side, texture_bottom, texture_top,
"cottages_feldweg_surface.png",
texture_edges},
drawtype = "mesh",
mesh = "feldweg_slope.obj",
collision_box = box_slope,
selection_box = box_slope,
})
cottages.register_feldweg_node("cottages:feldweg_slope_long"..postfix, {
description = S("dirt road slope long"..name_postfix),
tiles = {texture_side_with_dent,
texture_side, texture_bottom, texture_top,
"cottages_feldweg_surface.png",
texture_edges},
drawtype = "mesh",
mesh = "feldweg_slope_long.obj",
collision_box = box_slope_long,
selection_box = box_slope_long,
})
local base_node = "cottages:feldweg"..postfix
minetest.register_craft({
output = "cottages:feldweg_slope"..postfix.." 3",
recipe = {
{base_node, "", "" },
{base_node, base_node, ""}
},
})
minetest.register_craft({
output = "cottages:feldweg_slope_long"..postfix.." 4",
recipe = {
{base_node, "", "" },
{base_node, base_node, base_node}
},
})
end
-- those can be offered in diffrent variants...
cottages.register_nodes_mesh = function(postfix, texture_top, texture_bottom, texture_side, cottages_feldweg_mode, name_postfix, texture_side_with_dent, texture_edges)
-- a nice dirt road for small villages or paths to fields
cottages.register_feldweg_node("cottages:feldweg"..postfix, {
description = S("dirt road"..name_postfix),
tiles = {texture_side_with_dent,
-- "default_dirt.png^default_grass_side.png", "default_dirt.png", "default_grass.png",
texture_side, texture_bottom, texture_top,
"cottages_feldweg_surface.png",
texture_edges},
drawtype = "mesh",
mesh = "feldweg.obj",
})
cottages.register_feldweg_node("cottages:feldweg_crossing"..postfix, {
description = S("dirt road crossing"..name_postfix),
tiles = {texture_side_with_dent,
--"default_dirt.png", "default_grass.png",
texture_bottom, texture_top,
"cottages_feldweg_surface.png",
texture_edges},
drawtype = "mesh",
mesh = "feldweg-crossing.obj",
})
cottages.register_feldweg_node("cottages:feldweg_t_junction"..postfix, {
description = S("dirt road t junction"..name_postfix),
tiles = {texture_side_with_dent,
-- "default_dirt.png^default_grass_side.png", "default_dirt.png", "default_grass.png",
texture_side, texture_bottom, texture_top,
"cottages_feldweg_surface.png",
texture_edges},
drawtype = "mesh",
mesh = "feldweg-T-junction.obj",
})
cottages.register_feldweg_node("cottages:feldweg_curve"..postfix, {
description = S("dirt road curve"..name_postfix),
tiles = {
-- "default_dirt.png^default_grass_side.png","default_grass.png",
texture_side, texture_top,
-- "default_dirt.png^default_grass_side.png",
texture_side,
"cottages_feldweg_surface.png",
-- "default_dirt.png",
texture_bottom,
texture_edges},
-- "default_dirt.png^default_grass_side.png", "default_dirt.png", "default_grass.png",
texture_side, texture_bottom, texture_top,
drawtype = "mesh",
mesh = "feldweg-curve.obj",
})
cottages.register_feldweg_node("cottages:feldweg_end"..postfix, {
description = S("dirt road end"..name_postfix),
tiles = {texture_side_with_dent,
-- "default_dirt.png^default_grass_side.png", "default_dirt.png", "default_grass.png",
texture_side, texture_bottom, texture_top,
texture_edges,
"cottages_feldweg_surface.png"},
drawtype = "mesh",
mesh = "feldweg_end.obj",
})
if( cottages_feldweg_mode ~= "mesh_incl_45" ) then
return
end
-- new feldweg
cottages.register_feldweg_node("cottages:feldweg_45"..postfix, {
description = S("dirt road 45º"..name_postfix),
tiles = {
"cottages_feldweg_surface.png",
texture_edges,
-- "default_dirt.png^default_grass_side.png", "default_dirt.png", "default_grass.png",
texture_side, texture_bottom, texture_top,
},
drawtype = "mesh",
mesh = "feldweg_45.b3d",
})
cottages.register_feldweg_node("cottages:feldweg_s_45"..postfix, {
description = S("dirt road 45º edge"..name_postfix),
tiles = {
-- "default_grass.png", "default_dirt.png^default_grass_side.png", "default_dirt.png",
texture_top, texture_side, texture_bottom,
"cottages_feldweg_surface.png",
texture_edges,
},
drawtype = "mesh",
mesh = "feldweg_s_45.b3d",
})
cottages.register_feldweg_node("cottages:feldweg_d_45"..postfix, {
description = S("dirt road 45º double edge"..name_postfix),
tiles = {
-- "default_dirt.png^default_grass_side.png", "default_dirt.png", "default_grass.png",
texture_side, texture_bottom, texture_top,
texture_edges,
"cottages_feldweg_surface.png",
},
drawtype = "mesh",
mesh = "feldweg_d_45.b3d",
})
cottages.register_feldweg_node("cottages:feldweg_l_curve"..postfix, {
description = S("dirt road left curve"..name_postfix),
tiles = {
-- "default_dirt.png^default_grass_side.png", "default_dirt.png", "default_grass.png",
texture_side, texture_bottom, texture_top,
texture_edges,
"cottages_feldweg_surface.png",
},
drawtype = "mesh",
mesh = "feldweg_l_45_curve.b3d",
})
cottages.register_feldweg_node("cottages:feldweg_r_curve"..postfix, {
description = S("dirt road right curve"..name_postfix),
tiles = {
-- "default_dirt.png^default_grass_side.png", "default_dirt.png", "default_grass.png",
texture_side, texture_bottom, texture_top,
texture_edges,
"cottages_feldweg_surface.png",
},
drawtype = "mesh",
mesh = "feldweg_r_45_curve.b3d",
})
end
--- a nice dirt road for small villages or paths to fields
if( cottages_feldweg_mode == "simple" or cottages_feldweg_mode == "flat" ) then
minetest.register_node("cottages:feldweg", {
cottages.register_feldweg_node("cottages:feldweg", {
description = S("dirt road"),
tiles = {"cottages_feldweg.png","default_dirt.png", "default_dirt.png^default_grass_side.png"},
paramtype2 = "facedir",
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
legacy_facedir_simple = true,
groups = {crumbly=3},
sounds = cottages.sounds.dirt,
is_ground_content = false,
})
end
@ -87,37 +345,20 @@ end
--
if( cottages_feldweg_mode == "flat" ) then
minetest.register_node("cottages:feldweg_crossing", {
cottages.register_feldweg_node("cottages:feldweg_crossing", {
description = S("dirt road crossing"),
tiles = {"cottages_feldweg_kreuzung.png","default_dirt.png", "default_dirt.png^default_grass_side.png"},
paramtype2 = "facedir",
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
legacy_facedir_simple = true,
groups = {crumbly=3},
sounds = cottages.sounds.dirt,
is_ground_content = false,
})
minetest.register_node("cottages:feldweg_t_junction", {
cottages.register_feldweg_node("cottages:feldweg_t_junction", {
description = S("dirt road t junction"),
tiles = {"cottages_feldweg_t-kreuzung.png^[transform2","default_dirt.png", "default_dirt.png^default_grass_side.png"},
paramtype2 = "facedir",
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
legacy_facedir_simple = true,
groups = {crumbly=3},
sounds = cottages.sounds.dirt,
is_ground_content = false,
})
minetest.register_node("cottages:feldweg_curve", {
cottages.register_feldweg_node("cottages:feldweg_curve", {
description = S("dirt road curve"),
tiles = {"cottages_feldweg_ecke.png^[transform2","default_dirt.png", "default_dirt.png^default_grass_side.png"},
paramtype2 = "facedir",
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
legacy_facedir_simple = true,
groups = {crumbly=3},
sounds = cottages.sounds.dirt,
is_ground_content = false,
})
register_recipes(false)
@ -125,15 +366,10 @@ if( cottages_feldweg_mode == "flat" ) then
-- cube-style nodebox version
--
elseif( cottages_feldweg_mode == "nodebox" ) then
minetest.register_node("cottages:feldweg", {
cottages.register_feldweg_node("cottages:feldweg", {
description = S("dirt road"),
tiles = {"cottages_feldweg_orig.png","default_dirt.png", "default_dirt.png^default_grass_side.png"},
paramtype2 = "facedir",
roups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
legacy_facedir_simple = true,
groups = {crumbly=3},
sounds = cottages.sounds.dirt,
is_ground_content = false,
drawtype = "nodebox",
-- top, bottom, side1, side2, inner, outer
paramtype = "light",
@ -157,19 +393,11 @@ elseif( cottages_feldweg_mode == "nodebox" ) then
},
})
minetest.register_node("cottages:feldweg_crossing", {
cottages.register_feldweg_node("cottages:feldweg_crossing", {
description = S("dirt road crossing"),
tiles = {"cottages_feldweg_kreuzung.png","default_dirt.png", "default_dirt.png^default_grass_side.png"},
paramtype2 = "facedir",
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
legacy_facedir_simple = true,
groups = {crumbly=3},
sounds = cottages.sounds.dirt,
is_ground_content = false,
drawtype = "nodebox",
-- top, bottom, side1, side2, inner, outer
paramtype = "light",
node_box = {
type = "fixed",
fixed = {
@ -203,19 +431,11 @@ elseif( cottages_feldweg_mode == "nodebox" ) then
},
})
minetest.register_node("cottages:feldweg_t_junction", {
cottages.register_feldweg_node("cottages:feldweg_t_junction", {
description = S("dirt road t junction"),
tiles = {"cottages_feldweg_t-kreuzung.png^[transform2","default_dirt.png", "default_dirt.png^default_grass_side.png"},
paramtype2 = "facedir",
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
legacy_facedir_simple = true,
groups = {crumbly=3},
sounds = cottages.sounds.dirt,
is_ground_content = false,
drawtype = "nodebox",
-- top, bottom, side1, side2, inner, outer
paramtype = "light",
node_box = {
type = "fixed",
fixed = {
@ -247,19 +467,10 @@ elseif( cottages_feldweg_mode == "nodebox" ) then
},
})
minetest.register_node("cottages:feldweg_curve", {
cottages.register_feldweg_node("cottages:feldweg_curve", {
description = S("dirt road curve"),
tiles = {"cottages_feldweg_ecke.png^[transform2","default_dirt.png", "default_dirt.png^default_grass_side.png"},
paramtype2 = "facedir",
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
legacy_facedir_simple = true,
groups = {crumbly=3},
sounds = cottages.sounds.dirt,
is_ground_content = false,
drawtype = "nodebox",
-- top, bottom, side1, side2, inner, outer
paramtype = "light",
node_box = {
type = "fixed",
fixed = {
@ -297,105 +508,82 @@ elseif( cottages_feldweg_mode == "nodebox" ) then
--
-- the mesh version (rounded); provided and created by VanessaE
--
elseif( cottages_feldweg_mode == "mesh" ) then
-- a nice dirt road for small villages or paths to fields
minetest.register_node("cottages:feldweg", {
description = S("dirt road"),
paramtype2 = "facedir",
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
legacy_facedir_simple = true,
groups = {crumbly=3},
sounds = cottages.sounds.dirt,
is_ground_content = false,
tiles = {"cottages_feldweg_end.png","default_dirt.png^default_grass_side.png",
"default_dirt.png", "default_grass.png",
"cottages_feldweg_surface.png",
"cottages_feldweg_surface.png^cottages_feldweg_edges.png"},
paramtype = "light",
drawtype = "mesh",
mesh = "feldweg.obj",
})
elseif( cottages_feldweg_mode == "mesh"
or cottages_feldweg_mode == "mesh_incl_45" ) then
minetest.register_node("cottages:feldweg_crossing", {
description = S("dirt road crossing"),
paramtype2 = "facedir",
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
legacy_facedir_simple = true,
groups = {crumbly=3},
sounds = cottages.sounds.dirt,
is_ground_content = false,
tiles = {"cottages_feldweg_end.png","default_dirt.png",
"default_grass.png","cottages_feldweg_surface.png",
"cottages_feldweg_surface.png^cottages_feldweg_edges.png"},
paramtype = "light",
drawtype = "mesh",
mesh = "feldweg-crossing.obj",
})
local variants = {}
variants["grass"] = {
"default_grass.png", -- grass top
"default_dirt.png", -- bottom
"default_dirt.png^default_grass_side.png", -- side
"",
"default:dirt",
"",
"cottages_feldweg_end.png",
"cottages_feldweg_surface.png^cottages_feldweg_edges.png",
}
variants["gravel"] = {
"default_gravel.png", -- grass top
"default_gravel.png", -- bottom
"default_gravel.png", -- side
"_gravel",
"default:gravel",
" on gravel",
"default_gravel.png",
"cottages_feldweg_surface.png^default_gravel.png",
}
variants["coniferous"] = {
"default_coniferous_litter.png", -- grass top
"default_dirt.png", -- bottom
"default_dirt.png^default_coniferous_litter_side.png", -- side
"_coniferous",
"default:dirt_with_coniferous_litter",
" on coniferious litter",
"default_dirt.png^default_coniferous_litter_side.png", -- side with dent
"cottages_feldweg_surface.png^default_coniferous_litter.png",
}
variants["snow"] = {
"default_snow.png", -- grass top
"default_dirt.png", -- bottom
"default_dirt.png^default_snow_side.png", -- side
"_snow",
"default:dirt_with_snow",
" on snow",
"default_dirt.png^default_snow_side.png", -- side
"cottages_feldweg_surface.png^default_snow.png",
}
variants["dry"] = {
"default_dry_grass.png", -- grass top
"default_dirt.png", -- bottom
"default_dirt.png^default_dry_grass_side.png", -- side
"_dry",
"default:dry_dirt",
" on dry dirt",
"default_dirt.png^default_dry_grass_side.png", -- side
"cottages_feldweg_surface.png^default_dry_grass.png",
}
variants["bamboo"] = {
"ethereal_grass_bamboo_top.png", -- grass top
"default_dirt.png", -- bottom
"default_dirt.png^ethereal_grass_bamboo_side.png", -- side
"_bamboo",
"ethereal:bamboo_dirt",
" on bamboo dirt",
"default_dirt.png^ethereal_grass_bamboo_side.png", -- side
"cottages_feldweg_surface.png^ethereal_grass_bamboo_top.png",
}
minetest.register_node("cottages:feldweg_t_junction", {
description = S("dirt road t junction"),
paramtype2 = "facedir",
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
legacy_facedir_simple = true,
groups = {crumbly=3},
sounds = cottages.sounds.dirt,
is_ground_content = false,
tiles = {"cottages_feldweg_end.png","default_dirt.png^default_grass_side.png", "default_dirt.png",
"default_grass.png","cottages_feldweg_surface.png",
"cottages_feldweg_surface.png^cottages_feldweg_edges.png"},
paramtype = "light",
drawtype = "mesh",
mesh = "feldweg-T-junction.obj",
})
minetest.register_node("cottages:feldweg_curve", {
description = S("dirt road curve"),
paramtype2 = "facedir",
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
legacy_facedir_simple = true,
groups = {crumbly=3},
sounds = cottages.sounds.dirt,
is_ground_content = false,
tiles = {"default_dirt.png^default_grass_side.png","default_grass.png",
"default_dirt.png^default_grass_side.png","cottages_feldweg_surface.png",
"default_dirt.png","cottages_feldweg_surface.png^cottages_feldweg_edges.png"},
paramtype = "light",
drawtype = "mesh",
mesh = "feldweg-curve.obj",
})
minetest.register_node("cottages:feldweg_end", {
description = S("dirt road end"),
paramtype2 = "facedir",
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
legacy_facedir_simple = true,
groups = {crumbly=3},
sounds = cottages.sounds.dirt,
is_ground_content = false,
tiles = {"cottages_feldweg_end.png","default_dirt.png^default_grass_side.png",
"default_dirt.png", "default_grass.png",
"cottages_feldweg_surface.png^cottages_feldweg_edges.png",
"cottages_feldweg_surface.png"},
paramtype = "light",
drawtype = "mesh",
mesh = "feldweg_end.obj",
})
register_recipes(true)
for k, v in pairs(variants) do
cottages.register_nodes_mesh(v[4], v[1], v[2], v[3], cottages_feldweg_mode, v[6], v[7], v[8])
register_recipes(true, v[4], v[5])
-- register the two slope nodes
cottages.register_nodes_slope(v[4], v[1], v[2], v[3], cottages_feldweg_mode, v[6], v[7], v[8])
end
end
-- create stairs if possible
if( minetest.get_modpath("stairs") and stairs and stairs.register_stair_and_slab) then
stairs.register_stair_and_slab("feldweg", "cottages:feldweg",
@ -406,81 +594,19 @@ if( minetest.get_modpath("stairs") and stairs and stairs.register_stair_and_slab
cottages.sounds.dirt)
end
if( cottages_feldweg_mode == "nodebox" or cottages_feldweg_mode == "mesh" ) then
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}
}};
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}
}};
minetest.register_node("cottages:feldweg_slope", {
description = S("dirt road slope"),
paramtype2 = "facedir",
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
legacy_facedir_simple = true,
groups = {crumbly=3},
sounds = cottages.sounds.dirt,
is_ground_content = false,
tiles = {"cottages_feldweg_end.png","default_dirt.png^default_grass_side.png",
"default_dirt.png", "default_grass.png",
"cottages_feldweg_surface.png",
"cottages_feldweg_surface.png^cottages_feldweg_edges.png"},
paramtype = "light",
drawtype = "mesh",
mesh = "feldweg_slope.obj",
collision_box = box_slope,
selection_box = box_slope,
})
minetest.register_node("cottages:feldweg_slope_long", {
description = S("dirt road slope long"),
paramtype2 = "facedir",
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
legacy_facedir_simple = true,
groups = {crumbly=3},
sounds = cottages.sounds.dirt,
is_ground_content = false,
tiles = {"cottages_feldweg_end.png","default_dirt.png^default_grass_side.png",
"default_dirt.png", "default_grass.png",
"cottages_feldweg_surface.png",
"cottages_feldweg_surface.png^cottages_feldweg_edges.png"},
paramtype = "light",
drawtype = "mesh",
mesh = "feldweg_slope_long.obj",
collision_box = box_slope_long,
selection_box = box_slope_long,
})
minetest.register_craft({
output = "cottages:feldweg_slope 3",
recipe = {
{"cottages:feldweg", "", "" },
{"cottages:feldweg", "cottages:feldweg", ""}
},
})
minetest.register_craft({
output = "cottages:feldweg_slope_long 4",
recipe = {
{"cottages:feldweg", "", "" },
{"cottages:feldweg", "cottages:feldweg", "cottages:feldweg"}
},
})
if( cottages_feldweg_mode == "nodebox") then
local variants = {}
variants["grass"] = {
"default_grass.png", -- grass top
"default_dirt.png", -- bottom
"default_dirt.png^default_grass_side.png", -- side
"",
"default:dirt",
"",
"cottages_feldweg_end.png",
"cottages_feldweg_surface.png^cottages_feldweg_edges.png",
}
for k, v in pairs(variants) do
cottages.register_nodes_slope(v[4], v[1], v[2], v[3], cottages_feldweg_mode, v[6], v[7], v[8])
end
end

View File

@ -264,10 +264,13 @@ minetest.register_node("cottages:shelf", {
local meta = minetest.get_meta(pos);
local spos = pos.x .. "," .. pos.y .. "," .. pos.z
meta:set_string("formspec",
"size[8,8]"..
"list[current_name;main;0,0;8,3;]"..
"list[current_player;main;0,4;8,4;]")
"list[current_player;main;0,4;8,4;]"..
"listring[nodemeta:" .. spos .. ";main]" ..
"listring[current_player;main]")
meta:set_string("infotext", S("open storage shelf"))
local inv = meta:get_inventory();
inv:set_size("main", 24);
@ -441,7 +444,7 @@ cottages.sleep_in_bed = function( pos, node, clicker, itemstack, pointed_thing )
-- let players get back up
if( animation and animation.animation=="lay" ) then
default.player_attached[pname] = false
clicker:setpos({x=pos.x,y=pos.y-0.5,z=pos.z})
clicker:set_pos({x=pos.x,y=pos.y-0.5,z=pos.z})
clicker:set_eye_offset({x=0,y=0,z=0}, {x=0,y=0,z=0})
clicker:set_physics_override(1, 1, 1)
default.player_set_animation(clicker, "stand", 30)
@ -542,7 +545,7 @@ cottages.sleep_in_bed = function( pos, node, clicker, itemstack, pointed_thing )
-- no sleeping on this place
else
default.player_attached[pname] = false
clicker:setpos({x=pos.x,y=pos.y-0.5,z=pos.z})
clicker:set_pos({x=pos.x,y=pos.y-0.5,z=pos.z})
clicker:set_eye_offset({x=0,y=0,z=0}, {x=0,y=0,z=0})
clicker:set_physics_override(1, 1, 1)
default.player_set_animation(clicker, "stand", 30)

View File

@ -82,6 +82,7 @@ minetest.register_node("cottages:glass_pane", {
tiles = {"cottages_glass_pane.png"},
paramtype = "light",
paramtype2 = "facedir",
use_texture_alpha = "clip",
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
node_box = {
type = "fixed",
@ -106,6 +107,7 @@ minetest.register_node("cottages:glass_pane_side", {
tiles = {"cottages_glass_pane.png"},
paramtype = "light",
paramtype2 = "facedir",
use_texture_alpha = "clip",
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
node_box = {
type = "fixed",
@ -202,16 +204,6 @@ minetest.register_craft({
}
})
-- run a wagon wheel over dirt :-)
minetest.register_craft({
output = "cottages:feldweg 4",
recipe = {
{"", "cottages:wagon_wheel", "" },
{cottages.craftitem_dirt,cottages.craftitem_dirt,cottages.craftitem_dirt }
},
replacements = { {'cottages:wagon_wheel', 'cottages:wagon_wheel'}, }
})
minetest.register_craft({
output = "cottages:loam 4",
recipe = {

View File

@ -333,13 +333,13 @@ minetest.register_node("cottages:threshing_floor", {
minetest.after(2, function()
if( puncher ) then
puncher:hud_remove(hud1);
puncher:hud_remove(hud2);
puncher:hud_remove(hud3);
puncher:hud_remove(hud4);
puncher:hud_remove(hud5);
puncher:hud_remove(hud6);
puncher:hud_remove(hud0);
if(hud1) then puncher:hud_remove(hud1); end
if(hud2) then puncher:hud_remove(hud2); end
if(hud3) then puncher:hud_remove(hud3); end
if(hud4) then puncher:hud_remove(hud4); end
if(hud5) then puncher:hud_remove(hud5); end
if(hud6) then puncher:hud_remove(hud6); end
if(hud0) then puncher:hud_remove(hud0); end
end
end)
end,

View File

@ -117,7 +117,7 @@ minetest.register_node("cottages:water_gen", {
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
groups = {tree = 1, choppy = 2, cracky = 1, flammable = 2},
sounds = cottages.sounds.wood,
node_box = {
type = "fixed",
@ -178,8 +178,14 @@ minetest.register_node("cottages:water_gen", {
can_dig = function(pos,player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
return inv:is_empty("main") and
default.can_interact_with_node(player, pos)
local bucket = meta:get_string("bucket")
local start = meta:get_string("fillstarttime")
return inv:is_empty("main")
and default.can_interact_with_node(player, pos)
and (not(bucket) or bucket == "")
and ((not(start) or start == "" or
(minetest.get_us_time()/1000000) - tonumber(start)
>= cottages.water_fill_time -2))
end,
-- no inventory move allowed
allow_metadata_inventory_move = function(pos, from_list, from_index,
@ -202,7 +208,8 @@ minetest.register_node("cottages:water_gen", {
return stack:get_count()
end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
if not(cottages.player_can_use(meta:get_string(pos), player)) then
local meta = minetest.get_meta(pos)
if not(cottages.player_can_use(meta, player)) then
return 0
end
return stack:get_count()
@ -212,7 +219,7 @@ minetest.register_node("cottages:water_gen", {
cottages.switch_public(pos, formname, fields, sender, 'tree trunk well')
end,
-- punch to place and retrieve bucket
on_punch = function(pos, node, puncher)
on_punch = function(pos, node, puncher, pointed_thing)
if( not( pos ) or not( node ) or not( puncher )) then
return
end
@ -222,7 +229,8 @@ minetest.register_node("cottages:water_gen", {
local owner = meta:get_string("owner")
local public = meta:get_string("public")
if( name ~= owner and public~="public") then
minetest.chat_send_player( name, S("This tree trunk well is owned by %s. You can't use it."):format(name))
minetest.chat_send_player( name,
S("This tree trunk well is owned by %s. You can't use it."):format(owner))
return
end
@ -232,13 +240,18 @@ minetest.register_node("cottages:water_gen", {
-- is the well working on something? (either empty or full bucket)
local bucket = meta:get_string("bucket")
-- there is a bucket loaded - either empty or full
if( bucket and bucket~="") then
if( bucket and bucket~="" and bucket ~= "bucket:bucket_empty") then
if( not(pinv:room_for_item("main", bucket))) then
minetest.chat_send_player( puncher:get_player_name(),
S("Sorry. You have no room for the bucket. Please free some "..
"space in your inventory first!"))
return
end
elseif( bucket and bucket == "bucket:bucket_empty") then
minetest.chat_send_player( puncher:get_player_name(),
S("Please wait until your bucket has been filled."))
-- do not give the empty bucket back immediately
return
end
-- remove the old entity (either a bucket will be placed now or a bucket taken)
@ -266,8 +279,6 @@ minetest.register_node("cottages:water_gen", {
if( wielded
and wielded:get_name()
and wielded:get_name() == "bucket:bucket_empty") then
-- remove the bucket from the players inventory
pinv:remove_item( "main", "bucket:bucket_empty")
-- remember that we got a bucket loaded
meta:set_string("bucket", "bucket:bucket_empty")
-- create the entity
@ -279,6 +290,8 @@ minetest.register_node("cottages:water_gen", {
minetest.after(cottages.water_fill_time, cottages.water_gen_fill_bucket, pos)
-- the bucket will only be filled if the water ran long enough
meta:set_string("fillstarttime", tostring(minetest.get_us_time()/1000000))
-- remove the bucket from the players inventory
pinv:remove_item( "main", "bucket:bucket_empty")
return;
end
-- buckets can also be emptied here