Rotation after placement of steles and code style

This commit is contained in:
Pierre-Yves Rollo 2018-01-18 22:13:15 +01:00
parent ea36ed50d8
commit 78e3b85274
1 changed files with 23 additions and 30 deletions

View File

@ -21,17 +21,6 @@
local S = steles.intllib
local F = function(...) return minetest.formspec_escape(S(...)) end
function steles.on_receive_fields(pos, formname, fields, player)
if not minetest.is_protected(pos, player:get_player_name()) then
local meta = minetest.get_meta(pos)
if fields and fields.ok then
meta:set_string("display_text", fields.display_text)
meta:set_string("infotext", "\""..fields.display_text.."\"")
display_lib.update_entities(pos)
end
end
end
display_lib.register_display_entity("steles:text")
for i, material in ipairs(steles.materials) do
@ -65,7 +54,10 @@ for i, material in ipairs(steles.materials) do
maxlines = 3,
},
},
on_place = display_lib.on_place,
on_place = function(itemstack, placer, pointed_thing)
minetest.rotate_node(itemstack, placer, pointed_thing)
display_lib.on_place(itemstack, placer, pointed_thing)
end,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", "size[6,4]"
@ -87,7 +79,8 @@ for i, material in ipairs(steles.materials) do
end
end
end,
on_punch = function(pos, node, player, pointed_thing) display_lib.update_entities(pos) end,
on_punch = display_lib.update_entities,
})
end
end