]> git.lizzy.rs Git - xdecor.git/commitdiff
Item Frame : misc. tweaking
authorJean-Patrick Guerrero <jeanpatrick.guerrero@gmail.com>
Tue, 8 Mar 2016 14:58:01 +0000 (15:58 +0100)
committerJean-Patrick Guerrero <jeanpatrick.guerrero@gmail.com>
Tue, 8 Mar 2016 14:58:01 +0000 (15:58 +0100)
itemframe.lua

index 4f73d22761d98d91ba888e285026025a0bc2875a..52a98ca89e5acc8dc980f4afbf5d7c4d0de047f0 100644 (file)
@@ -7,15 +7,14 @@ local function remove_item(pos, node)
 
        for _, obj in pairs(objs) do
                if obj and obj:get_luaentity() and
-                       obj:get_luaentity().name == "xdecor:f_item" then
-                       obj:remove()
+                               obj:get_luaentity().name == "xdecor:f_item" then
+                       obj:remove() break
                end
        end
 end
 
 local facedir = {
-       [0] = {x=0, y=0, z=1}, {x=1, y=0, z=0},
-             {x=0, y=0, z=-1},{x=-1, y=0, z=0}
+       [0] = {x=0, y=0, z=1}, {x=1, y=0, z=0}, {x=0, y=0, z=-1}, {x=-1, y=0, z=0}
 }
 
 local function update_item(pos, node)
@@ -25,9 +24,7 @@ local function update_item(pos, node)
        local posad = facedir[node.param2]
        if not posad or itemstring == "" then return end
 
-       pos.x = pos.x + posad.x * 6.5/16
-       pos.y = pos.y + posad.y * 6.5/16
-       pos.z = pos.z + posad.z * 6.5/16
+       pos = vector.add(pos, vector.multiply(posad, 6.5/16))
        tmp.nodename = node.name
        tmp.texture = ItemStack(itemstring):get_name()
 
@@ -53,9 +50,8 @@ local function drop_item(pos, node)
 end
 
 minetest.register_entity("xdecor:f_item", {
-       hp_max = 1,
        visual = "wielditem",
-       visual_size = {x=.33, y=.33},
+       visual_size = {x=0.33, y=0.33},
        collisionbox = {0},
        physical = false,
        textures = {"air"},