I only need to store 2 values, the node name and the facedir, and i wanna know if having a lot of these metadatas together will affect the game performance.
Here is the code i used to test:
- setting the values
Code: Select all
minetest.override_item("default:leaves", {
description = "Apple Leaves",
drop = {max_items = 1,
items = {
{items = {"default:stick"}, rarity = 0},
{items = {"default:sapling"}, rarity = 0},
},
},
groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1, apple = 1},
on_punch = function(pos)
local node = minetest.get_node(pos)
minetest.set_node(pos, {name="realtrees:invisible_leaves"})
local meta = minetest.get_meta(pos)
meta:set_int("face",node.param2)
meta:set_string("name",node.name)
end,
on_timer = function(pos)
realtrees.leafdecay(pos, 5, "apple", "default:leaves")
end,
})
Code: Select all
minetest.register_node("realtrees:invisible_leaves", {
description = "Invisible Apple Leaves",
drawtype = "airlike",
paramtype = "light",
paramtype2 = "facedir",
walkable = true,
pointable = true,
buildable_to = true,
on_punch = function(pos)
minetest.get_node_timer(pos):start(5)
end,
on_timer = function(pos)
local meta = minetest.get_meta(pos)
local face = meta:get_int("face")
local name = meta:get_string("name")
minetest.set_node(pos, {name=name, param2=face})
end,
})