+local
+minetest,vector,table,pairs,type,math
+=
+minetest,vector,table,pairs,type,math
--
-- Falling entity ("rewrite"")
--
+local param_translation = {
+ [0] = 0,
+ [3] = math.pi/2,
+ [2] = math.pi,
+ [1] = math.pi*1.5,
+}
+
+
+
minetest.register_entity(":__builtin:falling_node", {
initial_properties = {
visual = "wielditem",
end
end
self.meta = meta
+
+
self.object:set_properties({
is_visible = true,
textures = {node.name},
})
+
+ if node.param2 then
+ self.object:set_rotation(vector.new(0,param_translation[node.param2],0))
+ end
end,
get_staticdata = function(self)
-- If it's not air or liquid, remove node and replace it with
-- it's drops
if n2.name ~= "air" and (not nd or nd.liquidtype == "none") then
- minetest.throw_item(np, self.node)
+ local drops = minetest.get_node_drops(self.node.name, "")
+ if drops and table.getn(drops) > 0 then
+ for _,droppy in pairs(drops) do
+ minetest.throw_item(np,droppy)
+ end
+ else
+ minetest.throw_item(np,self.node)
+ end
self.object:remove()
return
end