1
0
mirror of https://github.com/minetest/minetest_game.git synced 2025-06-29 13:20:25 +02:00

Decorations: Add kelp to cool and temperate shallow ocean

Original texture by tobyplowy, colourised by paramat.
This commit is contained in:
paramat
2017-10-04 23:46:32 +01:00
committed by paramat
parent 3ff296961e
commit eb5a5b56e1
5 changed files with 86 additions and 0 deletions

View File

@ -149,6 +149,8 @@ default:acacia_bush_stem
default:acacia_bush_leaves
default:acacia_bush_sapling
default:sand_with_kelp
Corals
------
@ -1449,6 +1451,55 @@ minetest.register_node("default:acacia_bush_sapling", {
end,
})
minetest.register_node("default:sand_with_kelp", {
description = "Kelp On Sand",
drawtype = "plantlike_rooted",
tiles = {"default_sand.png"},
special_tiles = {{name = "default_kelp.png", tileable_vertical = true}},
inventory_image = "default_kelp.png",
paramtype2 = "leveled",
groups = {snappy = 3},
node_placement_prediction = "",
on_place = function(itemstack, placer, pointed_thing)
-- Call on_rightclick if the pointed node defines it
if pointed_thing.type == "node" and placer and
not placer:get_player_control().sneak then
local node_ptu = minetest.get_node(pointed_thing.under)
local def_ptu = minetest.registered_nodes[node_ptu.name]
if def_ptu and def_ptu.on_rightclick then
return def_ptu.on_rightclick(pointed_thing.under, node_ptu, placer,
itemstack, pointed_thing)
end
end
local pos = pointed_thing.above
local height = math.random(4, 6)
local pos_top = {x = pos.x, y = pos.y + height, z = pos.z}
local node_top = minetest.get_node(pos_top)
local def_top = minetest.registered_nodes[node_top.name]
local player_name = placer:get_player_name()
if def_top and def_top.liquidtype == "source" and
minetest.get_item_group(node_top.name, "water") > 0 then
if not minetest.is_protected(pos, player_name) and
not minetest.is_protected(pos_top, player_name) then
minetest.set_node(pos, {name = "default:sand_with_kelp",
param2 = height * 16})
if not (creative and creative.is_enabled_for
and creative.is_enabled_for(player_name)) then
itemstack:take_item()
end
else
minetest.chat_send_player(player_name, "Node is protected")
minetest.record_protection_violation(pos, player_name)
end
end
return itemstack
end
})
--
-- Corals