Add grass path

This commit is contained in:
Wuzzy 2017-02-06 19:25:15 +01:00
parent 282e14cc18
commit a152604816
4 changed files with 44 additions and 0 deletions

View File

@ -262,6 +262,24 @@ minetest.register_node("mcl_core:dirt_with_grass", {
}),
})
minetest.register_node("mcl_core:grass_path", {
tiles = {"mcl_core_grass_path_top.png", "mcl_core_grass_path_side.png"},
description = "Grass Path",
drop = "mcl_core:dirt",
is_ground_content = true,
drawtype = "nodebox",
paramtype = "light",
node_box = {
type = "fixed",
fixed = {
-- 15/16 of the normal height
{-0.5, -0.5, -0.5, 0.5, 0.4375, 0.5},
}
},
groups = { crumbly=3, not_in_creative_inventory=1, soil=2, soil_sapling=1 },
sounds = mcl_core.node_sound_dirt_defaults(),
})
-- TODO: Add particles
minetest.register_node("mcl_core:mycelium", {
description = "Mycelium",

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -105,6 +105,27 @@ minetest.register_tool("mcl_core:pick_diamond", {
},
})
local make_grass_path = function(itemstack, placer, pointed_thing)
if minetest.get_node(pointed_thing.under).name == "mcl_core:dirt_with_grass" and pointed_thing.above.y == pointed_thing.under.y then
local above = table.copy(pointed_thing.under)
above.y = above.y + 1
if minetest.get_node(above).name == "air" then
if not minetest.setting_getbool("creative_mode") then
-- Add wear, as if digging a level 0 crumbly node
local def = minetest.registered_items[itemstack:get_name()]
local base_uses = def.tool_capabilities.groupcaps.crumbly.uses
local maxlevel = def.tool_capabilities.groupcaps.crumbly.maxlevel
local uses = base_uses * math.pow(3, maxlevel)
local wear = math.ceil(65535 / uses)
itemstack:add_wear(wear)
end
minetest.sound_play({name="default_dirt_footstep", gain=1.1}, {pos = above})
minetest.swap_node(pointed_thing.under, {name="mcl_core:grass_path"})
end
end
return itemstack
end
-- Shovels
minetest.register_tool("mcl_core:shovel_wood", {
description = "Wooden Shovel",
@ -119,6 +140,7 @@ minetest.register_tool("mcl_core:shovel_wood", {
},
damage_groups = {fleshy=2},
},
on_place = make_grass_path,
})
minetest.register_tool("mcl_core:shovel_stone", {
description = "Stone Shovel",
@ -133,6 +155,7 @@ minetest.register_tool("mcl_core:shovel_stone", {
},
damage_groups = {fleshy=3},
},
on_place = make_grass_path,
})
minetest.register_tool("mcl_core:shovel_steel", {
description = "Iron Shovel",
@ -147,6 +170,7 @@ minetest.register_tool("mcl_core:shovel_steel", {
},
damage_groups = {fleshy=4},
},
on_place = make_grass_path,
})
minetest.register_tool("mcl_core:shovel_gold", {
description = "Golden Shovel",
@ -161,6 +185,7 @@ minetest.register_tool("mcl_core:shovel_gold", {
},
damage_groups = {fleshy=2},
},
on_place = make_grass_path,
})
minetest.register_tool("mcl_core:shovel_diamond", {
description = "Diamond Shovel",
@ -175,6 +200,7 @@ minetest.register_tool("mcl_core:shovel_diamond", {
},
damage_groups = {fleshy=5},
},
on_place = make_grass_path,
})
-- Axes