]> git.lizzy.rs Git - Crafter.git/blobdiff - mods/main/falling.lua
remove server debug
[Crafter.git] / mods / main / falling.lua
index 4b081c20a54740fcc688512e962ce94471a2ff1b..2d80d837aa6adf40ed81436fae592a217b2abd36 100644 (file)
@@ -1,7 +1,20 @@
+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",
@@ -30,10 +43,16 @@ minetest.register_entity(":__builtin:falling_node", {
                        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)
@@ -102,7 +121,14 @@ minetest.register_entity(":__builtin:falling_node", {
                        -- 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