From a71ae8e01314d0653f785a022a898636cdf54424 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Rollo Date: Sat, 13 Jan 2018 12:38:55 +0100 Subject: Version 1.0 --- steles/README.md | 2 +- steles/nodes.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'steles') diff --git a/steles/README.md b/steles/README.md index e83a6af..bc14b53 100644 --- a/steles/README.md +++ b/steles/README.md @@ -2,7 +2,7 @@ This mod provides stone steles with text display. Text is locked if area is protected. -For more information, see the [forum topic](https://forum.minetest.net/viewtopic.php?f=11&t=13563) at the Minetest forums. +For more information, see the [forum topic](https://forum.minetest.net/viewtopic.php?t=19365) at the Minetest forums. **Dependancies**: default, display\_lib, font\_lib, technic? diff --git a/steles/nodes.lua b/steles/nodes.lua index 39eb9ee..87f4e9b 100644 --- a/steles/nodes.lua +++ b/steles/nodes.lua @@ -61,7 +61,7 @@ for i, material in ipairs(steles.materials) do on_display_update = font_lib.on_display_update, depth = -2/16-0.001, height = 2/16, size = { x = 14/16, y = 12/16 }, - resolution = { x = 144, y = 64 }, + resolution = { x = 11, y = 5 }, maxlines = 3, }, }, -- cgit v1.2.3 From ea36ed50d886677c79ec7ddf056c9815f040835e Mon Sep 17 00:00:00 2001 From: Pierre-Yves Rollo Date: Thu, 18 Jan 2018 21:46:10 +0100 Subject: Added display_lib.entity_spacing variable to centralize entity spacing. --- steles/nodes.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'steles') diff --git a/steles/nodes.lua b/steles/nodes.lua index 87f4e9b..5dba981 100644 --- a/steles/nodes.lua +++ b/steles/nodes.lua @@ -59,7 +59,7 @@ for i, material in ipairs(steles.materials) do display_entities = { ["steles:text"] = { on_display_update = font_lib.on_display_update, - depth = -2/16-0.001, height = 2/16, + depth = -2/16 - display_lib.entity_spacing, height = 2/16, size = { x = 14/16, y = 12/16 }, resolution = { x = 11, y = 5 }, maxlines = 3, -- cgit v1.2.3 From 78e3b852740c77b78e19b814e649f66b91dba673 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Rollo Date: Thu, 18 Jan 2018 22:13:15 +0100 Subject: Rotation after placement of steles and code style --- steles/nodes.lua | 53 +++++++++++++++++++++++------------------------------ 1 file changed, 23 insertions(+), 30 deletions(-) (limited to 'steles') diff --git a/steles/nodes.lua b/steles/nodes.lua index 5dba981..7bad5ae 100644 --- a/steles/nodes.lua +++ b/steles/nodes.lua @@ -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,29 +54,33 @@ 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]" - .."textarea[0.5,0.7;5.5,2;display_text;" - ..F("Displayed text (3 lines max)") - ..";${display_text}]" - .."button_exit[2,3;2,1;ok;"..F("Write").."]") - display_lib.on_construct(pos) - end, + local meta = minetest.get_meta(pos) + meta:set_string("formspec", "size[6,4]" + .."textarea[0.5,0.7;5.5,2;display_text;" + ..F("Displayed text (3 lines max)") + ..";${display_text}]" + .."button_exit[2,3;2,1;ok;"..F("Write").."]") + display_lib.on_construct(pos) + end, on_destruct = display_lib.on_destruct, on_rotate = display_lib.on_rotate, on_receive_fields = function(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, - on_punch = function(pos, node, player, pointed_thing) display_lib.update_entities(pos) end, + 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, + on_punch = display_lib.update_entities, }) end end + -- cgit v1.2.3 From 1c1be8a7c13cb664551503b88516c75b189aed87 Mon Sep 17 00:00:00 2001 From: Thomas--S Date: Sat, 27 Jan 2018 17:40:42 +0100 Subject: Update the entities as soon as mapblock is loaded Useful e.g. after /clearobjects Introduces the group `display_lib_node` --- steles/nodes.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'steles') diff --git a/steles/nodes.lua b/steles/nodes.lua index 7bad5ae..80995c2 100644 --- a/steles/nodes.lua +++ b/steles/nodes.lua @@ -26,6 +26,8 @@ display_lib.register_display_entity("steles:text") for i, material in ipairs(steles.materials) do local ndef = minetest.registered_nodes[material] + local groups = table.copy(ndef.groups) + groups.display_lib_node = 1 if ndef then local parts = material:split(":") @@ -44,7 +46,7 @@ for i, material in ipairs(steles.materials) do {-7/16, -0.5, -4/16, 7/16, -4/16, 4/16} } }, - groups = ndef.groups, + groups = groups, display_entities = { ["steles:text"] = { on_display_update = font_lib.on_display_update, -- cgit v1.2.3 From 60e80180c61ad2d851a6f6794c73b5b3b6d002b8 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Rollo Date: Sun, 28 Jan 2018 19:08:07 +0100 Subject: Copyright notices update --- steles/copyright.txt | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'steles') diff --git a/steles/copyright.txt b/steles/copyright.txt index 63371e7..1a4e167 100644 --- a/steles/copyright.txt +++ b/steles/copyright.txt @@ -1 +1,9 @@ Code by Pierre-Yves Rollo +intllib support (i18n) by (fat115) +intllib fallback code and tools by Diego Martínez (kaeza) +Extra contibutors: +(Thomas--S) +Translations: +Muhammad Nur Hidayat Yasuyoshi (MuhdNurHidayat) +(fat115) + -- cgit v1.2.3 From 3483f34fa9ac7c537f2ccf1d52b52f147e736659 Mon Sep 17 00:00:00 2001 From: Thomas--S Date: Wed, 31 Jan 2018 21:13:03 +0100 Subject: Use default formspec style --- steles/nodes.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'steles') diff --git a/steles/nodes.lua b/steles/nodes.lua index 80995c2..4eff56f 100644 --- a/steles/nodes.lua +++ b/steles/nodes.lua @@ -63,6 +63,7 @@ for i, material in ipairs(steles.materials) do on_construct = function(pos) local meta = minetest.get_meta(pos) meta:set_string("formspec", "size[6,4]" + ..default.gui_bg .. default.gui_bg_img .. default.gui_slots .."textarea[0.5,0.7;5.5,2;display_text;" ..F("Displayed text (3 lines max)") ..";${display_text}]" -- cgit v1.2.3 From 2acccd72610d240c115c17a63fe1d0b8a068406a Mon Sep 17 00:00:00 2001 From: Pierre-Yves Rollo Date: Fri, 2 Feb 2018 22:44:58 +0100 Subject: Fix ndef nill value in steles mod when technics not installed --- steles/nodes.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'steles') diff --git a/steles/nodes.lua b/steles/nodes.lua index 4eff56f..d2fb504 100644 --- a/steles/nodes.lua +++ b/steles/nodes.lua @@ -26,11 +26,11 @@ display_lib.register_display_entity("steles:text") for i, material in ipairs(steles.materials) do local ndef = minetest.registered_nodes[material] - local groups = table.copy(ndef.groups) - groups.display_lib_node = 1 if ndef then + local groups = table.copy(ndef.groups) local parts = material:split(":") + groups.display_lib_node = 1 minetest.register_node("steles:"..parts[2].."_stele", { description = steles.materials_desc[i], -- cgit v1.2.3 From f3970f641eb60bf92492b6715084273cc1bceb74 Mon Sep 17 00:00:00 2001 From: Thomas--S Date: Thu, 1 Feb 2018 16:54:55 +0100 Subject: Seperate signs API from signs definitions Change modnames from *_lib to *_api --- steles/depends.txt | 4 ++-- steles/nodes.lua | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'steles') diff --git a/steles/depends.txt b/steles/depends.txt index 35625c0..ba43223 100644 --- a/steles/depends.txt +++ b/steles/depends.txt @@ -1,5 +1,5 @@ default intllib? -display_lib -font_lib +display_api +font_api technic? diff --git a/steles/nodes.lua b/steles/nodes.lua index d2fb504..eabb096 100644 --- a/steles/nodes.lua +++ b/steles/nodes.lua @@ -21,7 +21,7 @@ local S = steles.intllib local F = function(...) return minetest.formspec_escape(S(...)) end -display_lib.register_display_entity("steles:text") +display_api.register_display_entity("steles:text") for i, material in ipairs(steles.materials) do @@ -30,7 +30,7 @@ for i, material in ipairs(steles.materials) do if ndef then local groups = table.copy(ndef.groups) local parts = material:split(":") - groups.display_lib_node = 1 + groups.display_modpack_node = 1 minetest.register_node("steles:"..parts[2].."_stele", { description = steles.materials_desc[i], @@ -49,8 +49,8 @@ for i, material in ipairs(steles.materials) do groups = groups, display_entities = { ["steles:text"] = { - on_display_update = font_lib.on_display_update, - depth = -2/16 - display_lib.entity_spacing, height = 2/16, + on_display_update = font_api.on_display_update, + depth = -2/16 - display_api.entity_spacing, height = 2/16, size = { x = 14/16, y = 12/16 }, resolution = { x = 11, y = 5 }, maxlines = 3, @@ -58,7 +58,7 @@ for i, material in ipairs(steles.materials) do }, on_place = function(itemstack, placer, pointed_thing) minetest.rotate_node(itemstack, placer, pointed_thing) - display_lib.on_place(itemstack, placer, pointed_thing) + display_api.on_place(itemstack, placer, pointed_thing) end, on_construct = function(pos) local meta = minetest.get_meta(pos) @@ -68,21 +68,21 @@ for i, material in ipairs(steles.materials) do ..F("Displayed text (3 lines max)") ..";${display_text}]" .."button_exit[2,3;2,1;ok;"..F("Write").."]") - display_lib.on_construct(pos) + display_api.on_construct(pos) end, - on_destruct = display_lib.on_destruct, - on_rotate = display_lib.on_rotate, + on_destruct = display_api.on_destruct, + on_rotate = display_api.on_rotate, on_receive_fields = function(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) + display_api.update_entities(pos) end end end, - on_punch = display_lib.update_entities, + on_punch = display_api.update_entities, }) end end -- cgit v1.2.3 From 8c7557e45d4744fe35ad058950062cf771640126 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Rollo Date: Fri, 13 Jul 2018 20:41:53 +0200 Subject: Rework all nodes displaying text according to new font_api --- steles/nodes.lua | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'steles') diff --git a/steles/nodes.lua b/steles/nodes.lua index eabb096..9fb65dd 100644 --- a/steles/nodes.lua +++ b/steles/nodes.lua @@ -42,17 +42,18 @@ for i, material in ipairs(steles.materials) do node_box = { type = "fixed", fixed = { - {-5/16, -4/16, -2/16, 5/16, 0.5, 2/16}, - {-7/16, -0.5, -4/16, 7/16, -4/16, 4/16} - } + {-5/16, -5/16, -2/16, 5/16, 0.5, 2/16}, + {-7/16, -0.5, -4/16, 7/16, -5/16, 4/16} + }, }, groups = groups, display_entities = { ["steles:text"] = { on_display_update = font_api.on_display_update, - depth = -2/16 - display_api.entity_spacing, height = 2/16, - size = { x = 14/16, y = 12/16 }, - resolution = { x = 11, y = 5 }, + depth = -2/16 - display_api.entity_spacing, + top = -2/16, + aspect_ratio = 0.4, + size = { x = 10/16, y = 12/16 }, maxlines = 3, }, }, -- cgit v1.2.3 From 1c40830ddf62aca507a16e8f4802365ceb17b1c5 Mon Sep 17 00:00:00 2001 From: Thomas Rudin Date: Wed, 3 Oct 2018 09:07:42 +0200 Subject: fix infinite stack of steles --- steles/nodes.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'steles') diff --git a/steles/nodes.lua b/steles/nodes.lua index 9fb65dd..9b23b8d 100644 --- a/steles/nodes.lua +++ b/steles/nodes.lua @@ -59,7 +59,7 @@ for i, material in ipairs(steles.materials) do }, on_place = function(itemstack, placer, pointed_thing) minetest.rotate_node(itemstack, placer, pointed_thing) - display_api.on_place(itemstack, placer, pointed_thing) + return display_api.on_place(itemstack, placer, pointed_thing) end, on_construct = function(pos) local meta = minetest.get_meta(pos) -- cgit v1.2.3 From 367e5026ddef3e6a0220f37a2f4aba64ec88f16b Mon Sep 17 00:00:00 2001 From: Pierre-Yves Rollo Date: Fri, 23 Nov 2018 11:34:55 +0100 Subject: Fonts configurable in signs, posters and steles --- steles/nodes.lua | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'steles') diff --git a/steles/nodes.lua b/steles/nodes.lua index 9b23b8d..79a9ed3 100644 --- a/steles/nodes.lua +++ b/steles/nodes.lua @@ -50,7 +50,7 @@ for i, material in ipairs(steles.materials) do display_entities = { ["steles:text"] = { on_display_update = font_api.on_display_update, - depth = -2/16 - display_api.entity_spacing, + depth = -2/16 - display_api.entity_spacing, top = -2/16, aspect_ratio = 0.4, size = { x = 10/16, y = 12/16 }, @@ -63,12 +63,14 @@ for i, material in ipairs(steles.materials) do end, on_construct = function(pos) local meta = minetest.get_meta(pos) - meta:set_string("formspec", "size[6,4]" - ..default.gui_bg .. default.gui_bg_img .. default.gui_slots - .."textarea[0.5,0.7;5.5,2;display_text;" - ..F("Displayed text (3 lines max)") - ..";${display_text}]" - .."button_exit[2,3;2,1;ok;"..F("Write").."]") + meta:set_string("formspec", string.format([=[ + size[6,4]%s%s%s + textarea[0.5,0.7;5.5,2;display_text;%s;${display_text}] + button[1,3;2,1;font;%s] + button_exit[3,3;2,1;ok;%s]]=], + default.gui_bg, default.gui_bg_img, default.gui_slots, + F("Displayed text (3 lines max)"), + F("Font"), F("Write"))) display_api.on_construct(pos) end, on_destruct = display_api.on_destruct, @@ -76,15 +78,17 @@ for i, material in ipairs(steles.materials) do on_receive_fields = function(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 + if fields.ok or fields.font then meta:set_string("display_text", fields.display_text) meta:set_string("infotext", "\""..fields.display_text.."\"") display_api.update_entities(pos) end + if fields.font then + font_api.show_font_list(player, pos) + end end end, on_punch = display_api.update_entities, }) end end - -- cgit v1.2.3