Merge pull request 'Implement MC-like kelps in terms of growing and destroying' (#1354) from iliekprogrammar/MineClone2:kelp into master

Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/1354
This commit is contained in:
iliekprogrammar 2021-03-31 11:57:59 +00:00
commit c44054b51c
3 changed files with 717 additions and 217 deletions

View File

@ -74,6 +74,7 @@ function mesecon.is_mvps_unsticky(node, pulldir, stack, stackid)
end end
-- Functions to be called on mvps movement -- Functions to be called on mvps movement
-- See also the callback
function mesecon.register_on_mvps_move(callback) function mesecon.register_on_mvps_move(callback)
mesecon.on_mvps_move[#mesecon.on_mvps_move+1] = callback mesecon.on_mvps_move[#mesecon.on_mvps_move+1] = callback
end end
@ -405,17 +406,20 @@ mesecon.register_mvps_unsticky("mcl_colorblocks:glazed_terracotta_brown")
mesecon.register_mvps_unsticky("mcl_colorblocks:glazed_terracotta_light_blue") mesecon.register_mvps_unsticky("mcl_colorblocks:glazed_terracotta_light_blue")
mesecon.register_mvps_unsticky("mcl_colorblocks:glazed_terracotta_pink") mesecon.register_mvps_unsticky("mcl_colorblocks:glazed_terracotta_pink")
-- Includes node heat when moving them
mesecon.register_on_mvps_move(mesecon.move_hot_nodes) mesecon.register_on_mvps_move(mesecon.move_hot_nodes)
-- Check for falling after moving node
mesecon.register_on_mvps_move(function(moved_nodes) mesecon.register_on_mvps_move(function(moved_nodes)
for i = 1, #moved_nodes do for i = 1, #moved_nodes do
local moved_node = moved_nodes[i] local moved_node = moved_nodes[i]
-- Check for falling after moving node
mesecon.on_placenode(moved_node.pos, moved_node.node) mesecon.on_placenode(moved_node.pos, moved_node.node)
minetest.after(0, function() minetest.after(0, function()
minetest.check_for_falling(moved_node.oldpos) minetest.check_for_falling(moved_node.oldpos)
minetest.check_for_falling(moved_node.pos) minetest.check_for_falling(moved_node.pos)
end) end)
-- Callback for on_mvps_move stored in nodedef
local node_def = minetest.registered_nodes[moved_node.node.name] local node_def = minetest.registered_nodes[moved_node.node.name]
if node_def and node_def.mesecon and node_def.mesecon.on_mvps_move then if node_def and node_def.mesecon and node_def.mesecon.on_mvps_move then
node_def.mesecon.on_mvps_move(moved_node.pos, moved_node.node, node_def.mesecon.on_mvps_move(moved_node.pos, moved_node.node,

View File

@ -1,3 +1,5 @@
mcl_ocean = {}
-- Prismarine (includes sea lantern) -- Prismarine (includes sea lantern)
dofile(minetest.get_modpath(minetest.get_current_modname()).."/prismarine.lua") dofile(minetest.get_modpath(minetest.get_current_modname()).."/prismarine.lua")

File diff suppressed because it is too large Load Diff