1
0
Fork 0

Grass Path+Farmland→Dirt if below solid, instantly

This commit is contained in:
Wuzzy 2017-05-14 22:44:34 +02:00
parent d20de89780
commit 3f57f80d54
4 changed files with 13 additions and 16 deletions

View File

@ -35,6 +35,7 @@ Please read <http://minecraft.gamepedia.com/Breaking> to learn how digging times
* `cultivatable=1`: Block will be turned into Dirt by using a hoe on it * `cultivatable=1`: Block will be turned into Dirt by using a hoe on it
* `flammable`: Block helps spreading fire and gets destroyed by nearby fire (rating doesn't matter) * `flammable`: Block helps spreading fire and gets destroyed by nearby fire (rating doesn't matter)
* `spreading_dirt_type=1`: A dirt-type block with a cover (e.g. grass) which may spread to neighbor dirt blocks * `spreading_dirt_type=1`: A dirt-type block with a cover (e.g. grass) which may spread to neighbor dirt blocks
* `dirtifies_below_solid=1`: This node turns into dirt immediately when a solid node is placed on top
* `non_mycelium_plant=1`: A plant which can't grow on mycelium. Placing it on mycelium fails and if mycelium spreads below it, it uproots * `non_mycelium_plant=1`: A plant which can't grow on mycelium. Placing it on mycelium fails and if mycelium spreads below it, it uproots
* `soil=1`: Saplings and other small plants can grow on it * `soil=1`: Saplings and other small plants can grow on it
* `soil_sapling=2`: Soil for saplings. Intended to be natural soil. All saplings will grow on this * `soil_sapling=2`: Soil for saplings. Intended to be natural soil. All saplings will grow on this

View File

@ -445,21 +445,16 @@ minetest.register_abm({
end end
}) })
minetest.register_abm({ -- Turn Grass Path and similar nodes to Dirt if a solid node is placed above it
label = "Turn Grass Path below solid block into Dirt", minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack, pointed_thing)
nodenames = {"mcl_core:grass_path"}, if minetest.get_item_group(newnode.name, "solid") ~= 0 then
neighbors = {"group:solid"}, local below = {x=pos.x, y=pos.y-1, z=pos.z}
interval = 8, local belownode = minetest.get_node(below)
chance = 50, if minetest.get_item_group(belownode.name, "dirtifies_below_solid") == 1 then
action = function(pos, node) minetest.set_node(below, {name="mcl_core:dirt"})
local above = {x = pos.x, y = pos.y + 1, z = pos.z}
local name = minetest.get_node(above).name
local nodedef = minetest.registered_nodes[name]
if name ~= "ignore" and nodedef and (nodedef.groups and nodedef.groups.solid) then
minetest.set_node(pos, {name = "mcl_core:dirt"})
end end
end end
}) end)
-------------------------- --------------------------
-- Try generate tree --- -- Try generate tree ---

View File

@ -407,7 +407,7 @@ minetest.register_node("mcl_core:grass_path", {
{-0.5, -0.5, -0.5, 0.5, 0.4375, 0.5}, {-0.5, -0.5, -0.5, 0.5, 0.4375, 0.5},
} }
}, },
groups = {handy=1,shovely=1, cultivatable=2, not_in_creative_inventory=1, }, groups = {handy=1,shovely=1, cultivatable=2, dirtifies_below_solid=1, not_in_creative_inventory=1, },
sounds = mcl_sounds.node_sound_dirt_defaults({ sounds = mcl_sounds.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.4}, footstep = {name="default_grass_footstep", gain=0.4},
}), }),

View File

@ -16,7 +16,7 @@ minetest.register_node("mcl_farming:soil", {
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_int("wet", 0) meta:set_int("wet", 0)
end, end,
groups = {handy=1,shovely=1, not_in_creative_inventory=1, soil=2, soil_sapling=1 }, groups = {handy=1,shovely=1, not_in_creative_inventory=1, dirtifies_below_solid=1, soil=2, soil_sapling=1 },
sounds = mcl_sounds.node_sound_dirt_defaults(), sounds = mcl_sounds.node_sound_dirt_defaults(),
_mcl_blast_resistance = 3, _mcl_blast_resistance = 3,
_mcl_hardness = 0.6, _mcl_hardness = 0.6,
@ -39,7 +39,7 @@ minetest.register_node("mcl_farming:soil_wet", {
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_int("wet", 7) meta:set_int("wet", 7)
end, end,
groups = {handy=1,shovely=1, not_in_creative_inventory=1, soil=3, soil_sapling=1 }, groups = {handy=1,shovely=1, not_in_creative_inventory=1, dirtifies_below_solid=1, soil=3, soil_sapling=1 },
sounds = mcl_sounds.node_sound_dirt_defaults(), sounds = mcl_sounds.node_sound_dirt_defaults(),
_mcl_blast_resistance = 3, _mcl_blast_resistance = 3,
_mcl_hardness = 0.6, _mcl_hardness = 0.6,
@ -120,3 +120,4 @@ minetest.register_abm({
end end
end, end,
}) })