mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2025-01-26 09:40:28 +01:00
mff_classic: fix nyancat & cherry tree mapgen
This commit is contained in:
parent
dcc1873cbe
commit
c00b4ce858
@ -157,6 +157,7 @@ local function add_trunk_and_leaves(data, a, pos, tree_cid, leaves_cid,
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
default.add_trunk_and_leaves = add_trunk_and_leaves -- MFF edit 2016-08-21
|
||||||
|
|
||||||
-- Apple tree
|
-- Apple tree
|
||||||
|
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
local modname = minetest.get_current_modname()
|
local modname = minetest.get_current_modname()
|
||||||
|
local thismod = _G[modname]
|
||||||
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
nodenames = {'default:cherry_sapling', modname .. 'mg_cherry_sapling'},
|
nodenames = {modname .. ':cherry_sapling', modname .. 'mg_cherry_sapling'},
|
||||||
interval = 80,
|
interval = 80,
|
||||||
chance = 3,
|
chance = 3,
|
||||||
action = function(pos, node)
|
action = function(pos, node)
|
||||||
@ -14,6 +15,6 @@ minetest.register_abm({
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.remove_node({x=pos.x, y=pos.y, z=pos.z})
|
minetest.remove_node({x=pos.x, y=pos.y, z=pos.z})
|
||||||
default.grow_cherry_tree(pos, false, 'default:cherry_tree', 'default:cherry_blossom_leaves')
|
thismod.grow_cherry_tree(pos, false, modname .. ':cherry_tree', modname .. ':cherry_blossom_leaves')
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
@ -224,7 +224,7 @@ function thismod.generate_nyancats(minp, maxp, seed)
|
|||||||
local y0 = pr:next(minp.y, maxp.y)
|
local y0 = pr:next(minp.y, maxp.y)
|
||||||
local z0 = pr:next(minp.z, maxp.z)
|
local z0 = pr:next(minp.z, maxp.z)
|
||||||
local p0 = {x = x0, y = y0, z = z0}
|
local p0 = {x = x0, y = y0, z = z0}
|
||||||
default.make_nyancat(p0, pr:next(0, 3), pr:next(10, 15))
|
thismod.make_nyancat(p0, pr:next(0, 3), pr:next(10, 15))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
local modname = minetest.get_current_modname()
|
local modname = minetest.get_current_modname()
|
||||||
|
local thismod = _G[modname]
|
||||||
|
|
||||||
-- From BFD:
|
-- From BFD:
|
||||||
|
|
||||||
@ -24,7 +25,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
local p_pos = area:index(x,y,z)
|
local p_pos = area:index(x,y,z)
|
||||||
local content_id = data[p_pos]
|
local content_id = data[p_pos]
|
||||||
if content_id == c_mg_cherry_sapling then
|
if content_id == c_mg_cherry_sapling then
|
||||||
minetest.after(1, default.grow_cherry_tree,
|
minetest.after(1, thismod.grow_cherry_tree,
|
||||||
{x=x, y=y, z=z},
|
{x=x, y=y, z=z},
|
||||||
false,
|
false,
|
||||||
modname .. ':cherry_tree',
|
modname .. ':cherry_tree',
|
||||||
@ -40,7 +41,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
minetest.log('action', trees_grown..geninfo)
|
minetest.log('action', trees_grown..geninfo)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
function default.grow_cherry_tree(pos, is_apple_tree, trunk_node, leaves_node)
|
function thismod.grow_cherry_tree(pos, is_apple_tree, trunk_node, leaves_node)
|
||||||
--[[
|
--[[
|
||||||
NOTE: Tree-placing code is currently duplicated in the engine
|
NOTE: Tree-placing code is currently duplicated in the engine
|
||||||
and in games that have saplings; both are deprecated but not
|
and in games that have saplings; both are deprecated but not
|
||||||
@ -60,7 +61,7 @@ function default.grow_cherry_tree(pos, is_apple_tree, trunk_node, leaves_node)
|
|||||||
local a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp})
|
local a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp})
|
||||||
local data = vm:get_data()
|
local data = vm:get_data()
|
||||||
|
|
||||||
add_trunk_and_leaves(data, a, pos, c_tree, c_leaves, height, 2, 8, is_apple_tree)
|
default.add_trunk_and_leaves(data, a, pos, c_tree, c_leaves, height, 2, 8, is_apple_tree)
|
||||||
|
|
||||||
vm:set_data(data)
|
vm:set_data(data)
|
||||||
vm:write_to_map()
|
vm:write_to_map()
|
||||||
|
Loading…
Reference in New Issue
Block a user