summaryrefslogtreecommitdiff
path: root/itemframes/init.lua
diff options
context:
space:
mode:
Diffstat (limited to 'itemframes/init.lua')
-rw-r--r--itemframes/init.lua16
1 files changed, 16 insertions, 0 deletions
diff --git a/itemframes/init.lua b/itemframes/init.lua
index 6284efe..f5c8ce0 100644
--- a/itemframes/init.lua
+++ b/itemframes/init.lua
@@ -66,6 +66,7 @@ local update_item = function(pos, node)
if meta:get_string("item") ~= "" then
if node.name == "itemframes:frame" then
local posad = facedir[node.param2]
+ if not posad 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
@@ -182,6 +183,21 @@ minetest.register_node("itemframes:pedestal",{
end,
})
+-- automatically restore entities lost from frames/pedestals
+-- due to /clearobjects or similar
+
+minetest.register_abm({
+ nodenames = { "itemframes:frame", "itemframes:pedestal" },
+ interval = 15,
+ chance = 1,
+ action = function(pos, node, active_object_count, active_object_count_wider)
+ if #minetest.get_objects_inside_radius(pos, 0.5) > 0 then return end
+ update_item(pos, node)
+ end
+})
+
+-- crafts
+
minetest.register_craft({
output = 'itemframes:frame',
recipe = {