mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-25 20:11:06 +01:00
Add falling node variants of seagrass
This commit is contained in:
parent
40a55729ca
commit
b81396c03f
4 changed files with 22 additions and 12 deletions
1
API.md
1
API.md
|
@ -21,6 +21,7 @@ All nodes can have these fields:
|
|||
|
||||
* `_mcl_hardness`: Hardness of the block, ranges from 0 to infinity (represented by -1). Determines digging times. Default: 0
|
||||
* `_mcl_blast_resistance`: How well this block blocks and resists explosions. Default: 0
|
||||
* `_mcl_falling_node_alternative`: If set to an itemstring, the node will turn into this node before it starts to fall.
|
||||
* `_mcl_after_falling(pos)`: Called after a falling node finished falling and turned into a node.
|
||||
|
||||
Use the `mcl_sounds` mod for the sounds.
|
||||
|
|
|
@ -79,10 +79,14 @@ minetest.register_entity(":__builtin:falling_node", {
|
|||
meta = {},
|
||||
|
||||
set_node = function(self, node, meta)
|
||||
local def = core.registered_nodes[node.name]
|
||||
-- Change falling node if definition tells us to
|
||||
if def and def._mcl_falling_node_alternative then
|
||||
node.name = def._mcl_falling_node_alternative
|
||||
end
|
||||
local glow
|
||||
self.node = node
|
||||
self.meta = meta or {}
|
||||
local def = core.registered_nodes[node.name]
|
||||
local glow
|
||||
-- Set correct entity yaw
|
||||
if def and node.param2 ~= 0 then
|
||||
if (def.paramtype2 == "facedir" or def.paramtype2 == "colorfacedir") then
|
||||
|
|
|
@ -110,7 +110,7 @@ for c=1, #corals do
|
|||
node_placement_prediction = "",
|
||||
node_dig_prediction = "mcl_ocean:"..id.."_coral_block",
|
||||
on_place = coral_on_place,
|
||||
after_destruct = function(pos)
|
||||
after_dig_node = function(pos)
|
||||
local node = minetest.get_node(pos)
|
||||
if minetest.get_item_group(node.name, "coral") == 0 then
|
||||
minetest.set_node(pos, {name="mcl_ocean:"..id.."_coral_block"})
|
||||
|
@ -140,7 +140,7 @@ for c=1, #corals do
|
|||
node_placement_prediction = "",
|
||||
node_dig_prediction = "mcl_ocean:dead_"..id.."_coral_block",
|
||||
on_place = coral_on_place,
|
||||
after_destruct = function(pos)
|
||||
after_dig_node = function(pos)
|
||||
local node = minetest.get_node(pos)
|
||||
if minetest.get_item_group(node.name, "coral") == 0 then
|
||||
minetest.set_node(pos, {name="mcl_ocean:dead_"..id.."_coral_block"})
|
||||
|
@ -173,7 +173,7 @@ for c=1, #corals do
|
|||
node_placement_prediction = "",
|
||||
node_dig_prediction = "mcl_ocean:"..id.."_coral_block",
|
||||
on_place = coral_on_place,
|
||||
after_destruct = function(pos)
|
||||
after_dig_node = function(pos)
|
||||
local node = minetest.get_node(pos)
|
||||
if minetest.get_item_group(node.name, "coral") == 0 then
|
||||
minetest.set_node(pos, {name="mcl_ocean:"..id.."_coral_block"})
|
||||
|
@ -203,7 +203,7 @@ for c=1, #corals do
|
|||
node_placement_prediction = "",
|
||||
node_dig_prediction = "mcl_ocean:dead_"..id.."_coral_block",
|
||||
on_place = coral_on_place,
|
||||
after_destruct = function(pos)
|
||||
after_dig_node = function(pos)
|
||||
local node = minetest.get_node(pos)
|
||||
if minetest.get_item_group(node.name, "coral") == 0 then
|
||||
minetest.set_node(pos, {name="mcl_ocean:dead_"..id.."_coral_block"})
|
||||
|
|
|
@ -4,6 +4,9 @@ local S = minetest.get_translator("mcl_ocean")
|
|||
local surfaces = {
|
||||
{ "dirt", "mcl_core:dirt" },
|
||||
{ "clay", "mcl_core:clay" },
|
||||
{ "sand", "mcl_core:sand", 1 },
|
||||
{ "redsand", "mcl_core:redsand", 1 },
|
||||
{ "gravel", "mcl_core:gravel", 1 },
|
||||
}
|
||||
|
||||
local function seagrass_on_place(itemstack, placer, pointed_thing)
|
||||
|
@ -76,6 +79,10 @@ minetest.register_craftitem("mcl_ocean:seagrass", {
|
|||
|
||||
for s=1, #surfaces do
|
||||
local def = minetest.registered_nodes[surfaces[s][2]]
|
||||
local alt
|
||||
if surfaces[s][3] == 1 then
|
||||
alt = surfaces[s][2]
|
||||
end
|
||||
minetest.register_node("mcl_ocean:seagrass_"..surfaces[s][1], {
|
||||
drawtype = "plantlike_rooted",
|
||||
paramtype = "light",
|
||||
|
@ -97,16 +104,14 @@ for s=1, #surfaces do
|
|||
{ -0.5, 0.5, -0.5, 0.5, 1.3, 0.5 },
|
||||
},
|
||||
},
|
||||
groups = { dig_immediate = 3, deco_block = 1, plant = 1, seagrass = 1, },
|
||||
groups = { dig_immediate = 3, deco_block = 1, plant = 1, seagrass = 1, falling_node = surfaces[s][3] },
|
||||
sounds = mcl_sounds.node_sound_leaves_defaults({footstep = mcl_sounds.node_sound_dirt_defaults().footstep}),
|
||||
node_dig_prediction = surfaces[s][2],
|
||||
after_destruct = function(pos)
|
||||
local node = minetest.get_node(pos)
|
||||
if minetest.get_item_group(node.name, "seagrass") == 0 then
|
||||
after_dig_node = function(pos)
|
||||
minetest.set_node(pos, {name=surfaces[s][2]})
|
||||
end
|
||||
end,
|
||||
drop = "",
|
||||
_mcl_falling_node_alternative = alt,
|
||||
_mcl_shears_drop = true,
|
||||
_mcl_hardness = 0,
|
||||
_mcl_blast_resistance = 0,
|
||||
|
|
Loading…
Reference in a new issue