Add dry-green grass node and ABM for erosion of dirt with grass.
parent
f1c98b550f
commit
a620019ffb
|
@ -50,3 +50,53 @@ end
|
|||
function displaytime(time)
|
||||
return math.floor(time * 1000000 + 0.5) / 1000 .. " ms"
|
||||
end
|
||||
|
||||
--
|
||||
-- Convert dirt with dry grass to dirt with dry graan grass when next to dirt with grass
|
||||
--
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"default:dirt_with_grass"},
|
||||
neighbors = {
|
||||
"default:dirt_with_dry_grass",
|
||||
},
|
||||
interval = 6,
|
||||
chance = 67,
|
||||
catch_up = false,
|
||||
action = function(pos, node)
|
||||
-- Most likely case, half the time it's too dark for this.
|
||||
local above = {x = pos.x, y = pos.y + 1, z = pos.z}
|
||||
if (minetest.get_node_light(above) or 0) < 13 then
|
||||
return
|
||||
end
|
||||
|
||||
-- Look for likely neighbors.
|
||||
local p2 = minetest.find_node_near(pos, 1, {"default:dirt_with_dry_grass"})
|
||||
if p2 then
|
||||
-- But the node needs to be under air in this case.
|
||||
local n2 = minetest.get_node(above)
|
||||
if n2 and n2.name == "air" then
|
||||
minetest.set_node(pos, {name = "australia:dirt_with_dry_green_grass"})
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
-- Anything on top?
|
||||
local n2 = minetest.get_node(above)
|
||||
if not n2 then
|
||||
return
|
||||
end
|
||||
|
||||
local name = n2.name
|
||||
-- Snow check is cheapest, so comes first.
|
||||
if name == "default:snow" then
|
||||
minetest.set_node(pos, {name = "default:dirt_with_snow"})
|
||||
-- Most likely case first.
|
||||
elseif minetest.get_item_group(name, "grass") ~= 0 then
|
||||
minetest.set_node(pos, {name = "default:dirt_with_grass"})
|
||||
elseif minetest.get_item_group(name, "dry_grass") ~= 0 then
|
||||
minetest.set_node(pos, {name = "default:dirt_with_dry_grass"})
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
|
|
|
@ -1,5 +1,17 @@
|
|||
-- mods/australia/nodes_other.lua
|
||||
|
||||
minetest.register_node("australia:dirt_with_dry_green_grass", {
|
||||
description = "Dirt with Dry-Green Grass",
|
||||
tiles = {"aus_dry_green_grass.png",
|
||||
"default_dirt.png",
|
||||
{name = "default_dirt.png^aus_dry_green_grass_side.png",
|
||||
tileable_vertical = false}},
|
||||
groups = {crumbly = 3, soil = 1},
|
||||
drop = 'default:dirt',
|
||||
sounds = default.node_sound_dirt_defaults({
|
||||
footstep = {name = "default_grass_footstep", gain = 0.33},
|
||||
}),
|
||||
})
|
||||
|
||||
minetest.register_node("australia:red_stone", {
|
||||
description = "Red Stone",
|
||||
|
@ -83,7 +95,8 @@ minetest.register_node("australia:red_gravel", {
|
|||
minetest.register_node("australia:mangrove_mud", {
|
||||
description = "Mangrove Mud",
|
||||
tiles = {"aus_mangrove_mud.png"},
|
||||
groups = {crumbly=2, soil=1},
|
||||
liquid_viscosity = 5,
|
||||
groups = {crumbly=2, soil=1, disable_jump=1},
|
||||
sounds = default.node_sound_dirt_defaults({
|
||||
footstep = {name="aus_mangrove_mud", gain=0.4},
|
||||
dug = {name="aus_mangrove_mud", gain=0.4},
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 397 B |
Binary file not shown.
After Width: | Height: | Size: 890 B |
Loading…
Reference in New Issue