Sugarcane less strict w/ water check on place

This commit is contained in:
Wuzzy 2020-11-11 21:00:37 +01:00
parent 47c834a809
commit 132db02011
1 changed files with 8 additions and 12 deletions

View File

@ -93,18 +93,14 @@ minetest.register_node("mcl_core:reeds", {
return false return false
end end
local posses = { -- Legal water position rules are the same as for decoration spawn_by rules.
{ x=0, y=0, z=1}, -- This differs from MC, which does not allow diagonal neighbors
{ x=0, y=0, z=-1}, -- and neighbors 1 layer above.
{ x=1, y=0, z=0}, local np1 = {x=soil_pos.x-1, y=soil_pos.y, z=soil_pos.z-1}
{ x=-1, y=0, z=0}, local np2 = {x=soil_pos.x+1, y=soil_pos.y+1, z=soil_pos.z+1}
} if #minetest.find_nodes_in_area(np1, np2, {"group:water", "group:frosted_ice"}) > 0 then
for p=1, #posses do -- Water found! Sugar canes are happy! :-)
local checknode = minetest.get_node(vector.add(soil_pos, posses[p])) return true
if minetest.get_item_group(checknode.name, "water") ~= 0 or minetest.get_item_group(checknode.name, "frosted_ice") ~= 0 then
-- Water found! Sugar canes are happy! :-)
return true
end
end end
-- No water found! Sugar canes are not amuzed and refuses to be placed. :-( -- No water found! Sugar canes are not amuzed and refuses to be placed. :-(