forked from VoxeLibre/VoxeLibre
Compare commits
3 Commits
master
...
add-dirty-
Author | SHA1 | Date |
---|---|---|
SmokeyDope | 3be6bf404d | |
SmokeyDope | 2d191646db | |
SmokeyDope | 0a13d8d57a |
|
@ -406,7 +406,7 @@ mcl_core.register_snowed_node("mcl_core:dirt_with_grass_snow", "mcl_core:dirt_wi
|
|||
minetest.register_node("mcl_core:grass_path", {
|
||||
tiles = {"mcl_core_grass_path_top.png", "default_dirt.png", "mcl_core_grass_path_side.png"},
|
||||
description = S("Grass Path"),
|
||||
_doc_items_longdesc = S("Grass paths are a decorative variant of grass blocks. Their top has a different color and they are a bit lower than grass blocks, making them useful to build footpaths. Grass paths can be created with a shovel. A grass path turns into dirt when it is below a solid block."),
|
||||
_doc_items_longdesc = S("Grass paths are a decorative variant of grass blocks. Their top has a different color and they are a bit lower than grass blocks, making them useful to build footpaths. Grass paths can be created by right clicking with a shovel. A grass path turns into dirt when it is below a solid block or when shift+right clicked with a shovel."),
|
||||
drop = "mcl_core:dirt",
|
||||
is_ground_content = true,
|
||||
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false,
|
||||
|
@ -419,7 +419,7 @@ minetest.register_node("mcl_core:grass_path", {
|
|||
{-0.5, -0.5, -0.5, 0.5, 0.4375, 0.5},
|
||||
}
|
||||
},
|
||||
groups = {handy=1,shovely=1, cultivatable=2, dirtifies_below_solid=1, dirtifier=1, deco_block=1 },
|
||||
groups = {handy=1,shovely=1, cultivatable=2, dirtifies_below_solid=1, dirtifier=1, deco_block=1, path_remove_possible=1 },
|
||||
sounds = mcl_sounds.node_sound_dirt_defaults({
|
||||
footstep = {name="default_grass_footstep", gain=0.1},
|
||||
}),
|
||||
|
|
|
@ -165,11 +165,35 @@ local make_grass_path = function(itemstack, placer, pointed_thing)
|
|||
end
|
||||
end
|
||||
|
||||
-- Only make grass path if tool used on side or top of target node
|
||||
-- Only make or remove grass path if tool used on side or top of target node
|
||||
if pointed_thing.above.y < pointed_thing.under.y then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
-- Remove grass paths
|
||||
if (minetest.get_item_group(node.name, "path_remove_possible") == 1) and placer:get_player_control().sneak == true then
|
||||
local above = table.copy(pointed_thing.under)
|
||||
above.y = above.y + 1
|
||||
if minetest.get_node(above).name == "air" then
|
||||
if minetest.is_protected(pointed_thing.under, placer:get_player_name()) then
|
||||
minetest.record_protection_violation(pointed_thing.under, placer:get_player_name())
|
||||
return itemstack
|
||||
end
|
||||
|
||||
if not minetest.is_creative_enabled(placer:get_player_name()) then
|
||||
-- Add wear (as if digging a shovely node)
|
||||
local toolname = itemstack:get_name()
|
||||
local wear = mcl_autogroup.get_wear(toolname, "shovely")
|
||||
if wear then
|
||||
itemstack:add_wear(wear)
|
||||
end
|
||||
end
|
||||
minetest.sound_play({name="default_grass_footstep", gain=1}, {pos = above, max_hear_distance = 16}, true)
|
||||
minetest.swap_node(pointed_thing.under, {name="mcl_core:dirt"})
|
||||
end
|
||||
end
|
||||
|
||||
-- Make grass paths
|
||||
if (minetest.get_item_group(node.name, "path_creation_possible") == 1) then
|
||||
local above = table.copy(pointed_thing.under)
|
||||
above.y = above.y + 1
|
||||
|
|
Loading…
Reference in New Issue