mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-22 02:21:06 +01:00
meta:set_private("wet"), require only walkable nodes
This commit is contained in:
parent
a8318f6600
commit
ebf6cf32e8
2 changed files with 7 additions and 4 deletions
|
@ -307,12 +307,11 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s
|
|||
or (dir == 3 and vector.offset(stempos, 0, 0, 1))
|
||||
or vector.offset(stempos, 0, 0, -1)
|
||||
if minetest.get_node(neighbor).name ~= "air" then return end -- occupied
|
||||
-- check for suitable floor: grass, dirt, or soil
|
||||
-- check for suitable floor -- in contrast to MC, we think everything solid is fine
|
||||
local floorpos = vector.offset(neighbor, 0, -1, 0)
|
||||
local floorname = minetest.get_node(floorpos).name
|
||||
local floordef = minetest.registered_nodes[floorname]
|
||||
if not floordef then return end
|
||||
if (floordef.groups.grass_block or 0) == 0 and (floordef.groups.dirt or 0) == 0 and (floordef.groups.soil or 0) < 2 then return end -- not suitable for growing
|
||||
if not floordef or not floordef.walkable then return end
|
||||
|
||||
-- check moisture level
|
||||
local odds = floor(25 / (get_moisture_level(stempos) * get_same_crop_penalty(stempos))) + 1
|
||||
|
|
|
@ -72,6 +72,7 @@ minetest.register_abm({
|
|||
node.name = "mcl_farming:soil_wet"
|
||||
minetest.set_node(pos, node) -- resets wetness
|
||||
meta:set_int("wet", 7)
|
||||
meta:mark_as_private("wet")
|
||||
elseif wet < 7 then
|
||||
meta:set_int("wet", 7)
|
||||
end
|
||||
|
@ -85,8 +86,11 @@ minetest.register_abm({
|
|||
if node.name == "mcl_farming:soil_wet" then -- change visual appearance to dry
|
||||
node.name = "mcl_farming:soil"
|
||||
minetest.set_node(pos, node)
|
||||
meta:set_int("wet", wet - 1)
|
||||
meta:mark_as_private("wet") -- after set_int
|
||||
else
|
||||
meta:set_int("wet", wet - 1)
|
||||
end
|
||||
meta:set_int("wet", wet - 1)
|
||||
return
|
||||
end
|
||||
-- Revert to dirt if wetness is 0, and no plant above
|
||||
|
|
Loading…
Reference in a new issue