Compare commits

..

3 Commits

3 changed files with 28 additions and 19 deletions

View File

@ -21,7 +21,7 @@ The basic digging time groups determine by which tools a node can be dug.
* `swordy=1`: Diggable by sword (any material), and this node is *not* a cobweb
* `swordy_cobweb=1`: Diggable by sword (any material), and this node is a cobweb
* `shearsy=1`: Diggable by shears, and this node is *not* wool
* `shearsy_wool=1`: Diggable by shears, and this node is wool
* `shearsy=wool=1`: Diggable by shears, and this node is wool
* `handy=1`: Breakable by hand and this node gives it useful drop when dug by hand. All nodes which are breakable by pickaxe, axe, shovel, sword or shears are also automatically breakable by hand, but not neccess
* `creative_breakable=1`: Block is breakable by hand in creative mode. This group is implied if the node belongs to any other digging group

View File

@ -149,19 +149,22 @@ minetest.register_craftitem("mcl_enchanting:book_enchanted", {
minetest.register_alias("mcl_books:book_enchanted", "mcl_enchanting:book_enchanted")
local spawn_book_entity = function(pos, respawn)
if respawn then
-- Check if we already have a book
local objs = minetest.get_objects_inside_radius(pos, 1)
for o=1, #objs do
local obj = objs[o]
local lua = obj:get_luaentity()
if lua and lua.name == "mcl_enchanting:book" then
if lua._table_pos and vector.equals(pos, lua._table_pos) then
return
end
local cnt=0
-- Check if we already have books within 5 nodes distance to avoid too many entities
local objs = minetest.get_objects_inside_radius(pos, 5)
for o=1, #objs do
local obj = objs[o]
local lua = obj:get_luaentity()
if lua and lua.name == "mcl_enchanting:book" then
if respawn and lua._table_pos and vector.equals(pos, lua._table_pos) then
return
end
cnt=cnt+1
end
end
if cnt > 10 then return end
local obj = minetest.add_entity(vector.add(pos, mcl_enchanting.book_offset), "mcl_enchanting:book")
if obj then
local lua = obj:get_luaentity()
@ -192,8 +195,8 @@ minetest.register_entity("mcl_enchanting:book", {
local old_player_near = self._player_near
local player_near = false
local player
for _, obj in ipairs(minetest.get_objects_inside_radius(vector.subtract(self.object:get_pos(), mcl_enchanting.book_offset), 2.5)) do
if obj:is_player() then
for _,obj in pairs(minetest.get_connected_players()) do
if vector.distance(obj:get_pos(),self.object:get_pos()) < 2.5 then
player_near = true
player = obj
end
@ -210,6 +213,13 @@ minetest.register_entity("mcl_enchanting:book", {
end
self._player_near = player_near
mcl_enchanting.check_animation_schedule(self, dtime)
if self._table_pos then
local tn=minetest.get_node_or_nil(self._table_pos)
if tn and tn.name ~= "mcl_enchanting:table" then
self.object:remove()
end
end
end,
})
@ -309,8 +319,8 @@ minetest.register_abm({
nodenames = "mcl_enchanting:table",
action = function(pos)
local playernames = {}
for _, obj in ipairs(minetest.get_objects_inside_radius(pos, 15)) do
if obj:is_player() then
for _,obj in pairs(minetest.get_connected_players()) do
if vector.distance(obj:get_pos(),pos) < 15 then
table.insert(playernames, obj:get_player_name())
end
end

View File

@ -388,11 +388,12 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s
{ x=0, y=0, z=-1 },
{ x=0, y=0, z=1 },
}
local floorpos, floor
for n=#neighbors, 1, -1 do
local offset = neighbors[n]
local blockpos = vector.add(stempos, offset)
local floorpos = { x=blockpos.x, y=blockpos.y-1, z=blockpos.z }
local floor = minetest.get_node(floorpos)
floorpos = { x=blockpos.x, y=blockpos.y-1, z=blockpos.z }
floor = minetest.get_node(floorpos)
local block = minetest.get_node(blockpos)
local soilgroup = minetest.get_item_group(floor.name, "soil")
if not ((minetest.get_item_group(floor.name, "grass_block") == 1 or floor.name=="mcl_core:dirt" or soilgroup == 2 or soilgroup == 3) and block.name == "air") then
@ -406,8 +407,6 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s
local r = math.random(1, #neighbors)
local offset = neighbors[r]
local blockpos = vector.add(stempos, offset)
local floorpos = { x=blockpos.x, y=blockpos.y-1, z=blockpos.z }
local floor = minetest.get_node(floorpos)
local p2
if offset.x == 1 then
minetest.set_node(stempos, {name=connected_stem_names[1]})