aboutsummaryrefslogtreecommitdiff
path: root/steles
diff options
context:
space:
mode:
Diffstat (limited to 'steles')
-rw-r--r--steles/LICENSE.txt166
-rw-r--r--steles/README.md25
-rw-r--r--steles/config.lua37
-rw-r--r--steles/copyright.txt9
-rw-r--r--steles/crafts.lua33
-rw-r--r--steles/depends.txt5
-rw-r--r--steles/init.lua31
-rw-r--r--steles/intllib.lua45
-rw-r--r--steles/locale/fr.po47
-rw-r--r--steles/locale/ms.po46
-rw-r--r--steles/locale/template.pot46
-rw-r--r--steles/mod.conf4
-rw-r--r--steles/nodes.lua94
-rwxr-xr-xsteles/tools/updatepo.sh25
14 files changed, 613 insertions, 0 deletions
diff --git a/steles/LICENSE.txt b/steles/LICENSE.txt
new file mode 100644
index 0000000..341c30b
--- /dev/null
+++ b/steles/LICENSE.txt
@@ -0,0 +1,166 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
+
diff --git a/steles/README.md b/steles/README.md
new file mode 100644
index 0000000..bc14b53
--- /dev/null
+++ b/steles/README.md
@@ -0,0 +1,25 @@
+# Steles
+
+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?t=19365) at the Minetest forums.
+
+**Dependancies**: default, display\_lib, font\_lib, technic?
+
+(Technic adds marble and granite steles)
+
+**License**: LGPL
+
+## Recipes
+
+ - M -
+ - B -
+ M M M
+
+B = Black Dye, M = Material
+
+Material (must be all the same) can be : Stone, Desert Stone, Sandstone, Granite or Marble
+
+Gives 4 steles of corresponding material. Right click on stele to update text.
+
+(Extra materials can be added in config.lua file)
diff --git a/steles/config.lua b/steles/config.lua
new file mode 100644
index 0000000..551429d
--- /dev/null
+++ b/steles/config.lua
@@ -0,0 +1,37 @@
+--[[
+ steles mod for Minetest. Steles / graves with text on it.
+ (c) Pierre-Yves Rollo
+
+ This file is part of steles.
+
+ steles is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ steles is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with steles. If not, see <http://www.gnu.org/licenses/>.
+--]]
+
+local S = steles.intllib
+
+steles.materials = {
+ 'default:stone',
+ 'default:sandstone',
+ 'default:desert_stone',
+ 'technic:marble',
+ 'technic:granite',
+}
+
+steles.materials_desc = {
+ S("Stone Stele"),
+ S("Sandstone Stele"),
+ S("Desert Stone Stele"),
+ S("Marble Stele"),
+ S("Granite Stele"),
+}
diff --git a/steles/copyright.txt b/steles/copyright.txt
new file mode 100644
index 0000000..1a4e167
--- /dev/null
+++ b/steles/copyright.txt
@@ -0,0 +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)
+
diff --git a/steles/crafts.lua b/steles/crafts.lua
new file mode 100644
index 0000000..9973aac
--- /dev/null
+++ b/steles/crafts.lua
@@ -0,0 +1,33 @@
+--[[
+ steles mod for Minetest. Steles / graves with text on it.
+ (c) Pierre-Yves Rollo
+
+ This file is part of steles.
+
+ steles is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ steles is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with steles. If not, see <http://www.gnu.org/licenses/>.
+--]]
+
+for _, material in ipairs(steles.materials) do
+ local parts = material:split(":")
+
+ minetest.register_craft({
+ output = 'steles:'..parts[2]..'_stele 4',
+ recipe = {
+ {'', material, ''},
+ {'', 'dye:black', ''},
+ {material, material, material},
+ }
+ })
+
+end
diff --git a/steles/depends.txt b/steles/depends.txt
new file mode 100644
index 0000000..ba43223
--- /dev/null
+++ b/steles/depends.txt
@@ -0,0 +1,5 @@
+default
+intllib?
+display_api
+font_api
+technic?
diff --git a/steles/init.lua b/steles/init.lua
new file mode 100644
index 0000000..e5d2430
--- /dev/null
+++ b/steles/init.lua
@@ -0,0 +1,31 @@
+--[[
+ steles mod for Minetest. Steles / graves with text on it.
+ (c) Pierre-Yves Rollo
+
+ This file is part of steles.
+
+ steles is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ steles is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with steles. If not, see <http://www.gnu.org/licenses/>.
+--]]
+
+steles = {}
+steles.name = minetest.get_current_modname()
+steles.path = minetest.get_modpath(steles.name)
+
+-- Load support for intllib.
+local S, NS = dofile(steles.path.."/intllib.lua")
+steles.intllib = S
+
+dofile(steles.path.."/config.lua")
+dofile(steles.path.."/nodes.lua")
+dofile(steles.path.."/crafts.lua")
diff --git a/steles/intllib.lua b/steles/intllib.lua
new file mode 100644
index 0000000..6669d72
--- /dev/null
+++ b/steles/intllib.lua
@@ -0,0 +1,45 @@
+
+-- Fallback functions for when `intllib` is not installed.
+-- Code released under Unlicense <http://unlicense.org>.
+
+-- Get the latest version of this file at:
+-- https://raw.githubusercontent.com/minetest-mods/intllib/master/lib/intllib.lua
+
+local function format(str, ...)
+ local args = { ... }
+ local function repl(escape, open, num, close)
+ if escape == "" then
+ local replacement = tostring(args[tonumber(num)])
+ if open == "" then
+ replacement = replacement..close
+ end
+ return replacement
+ else
+ return "@"..open..num..close
+ end
+ end
+ return (str:gsub("(@?)@(%(?)(%d+)(%)?)", repl))
+end
+
+local gettext, ngettext
+if minetest.get_modpath("intllib") then
+ if intllib.make_gettext_pair then
+ -- New method using gettext.
+ gettext, ngettext = intllib.make_gettext_pair()
+ else
+ -- Old method using text files.
+ gettext = intllib.Getter()
+ end
+end
+
+-- Fill in missing functions.
+
+gettext = gettext or function(msgid, ...)
+ return format(msgid, ...)
+end
+
+ngettext = ngettext or function(msgid, msgid_plural, n, ...)
+ return format(n==1 and msgid or msgid_plural, ...)
+end
+
+return gettext, ngettext
diff --git a/steles/locale/fr.po b/steles/locale/fr.po
new file mode 100644
index 0000000..1785d8a
--- /dev/null
+++ b/steles/locale/fr.po
@@ -0,0 +1,47 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: \n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2017-08-05 10:06+0200\n"
+"PO-Revision-Date: 2017-08-05 09:03+0200\n"
+"Last-Translator: fat115 <fat115@framasoft.org>\n"
+"Language-Team: \n"
+"Language: fr\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: Poedit 1.8.12\n"
+"Plural-Forms: nplurals=2; plural=(n > 1);\n"
+
+#: config.lua
+msgid "Stone Stele"
+msgstr "Stèle en pierre"
+
+#: config.lua
+msgid "Sandstone Stele"
+msgstr "Stèle en grès"
+
+#: config.lua
+msgid "Desert Stone Stele"
+msgstr "Stèle en pierre du désert"
+
+#: config.lua
+msgid "Marble Stele"
+msgstr "Stèle en marbre"
+
+#: config.lua
+msgid "Granite Stele"
+msgstr "Stèle en granit"
+
+#: nodes.lua
+msgid "Displayed text (3 lines max)"
+msgstr "Texte à afficher (3 lignes maxi.)"
+
+#: nodes.lua
+msgid "Write"
+msgstr "Écrire"
diff --git a/steles/locale/ms.po b/steles/locale/ms.po
new file mode 100644
index 0000000..8de818f
--- /dev/null
+++ b/steles/locale/ms.po
@@ -0,0 +1,46 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# Muhammad Nur Hidayat <muhdnurhidayat96@yahoo.com>, 2017.
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2017-08-26 11:29+0200\n"
+"PO-Revision-Date: 2017-08-27 16:13+0800\n"
+"Last-Translator: Muhammad Nur Hidayat <muhdnurhidayat96@yahoo.com>\n"
+"Language-Team: Malay <muhdnurhidayat96@yahoo.com>\n"
+"Language: ms\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=1; plural=0;\n"
+"X-Generator: Vé 0.1.4\n"
+
+#: config.lua
+msgid "Stone Stele"
+msgstr "Tulisan Batu"
+
+#: config.lua
+msgid "Sandstone Stele"
+msgstr "Tulisan Batu Pasir"
+
+#: config.lua
+msgid "Desert Stone Stele"
+msgstr "Tulisan Batu Gurun"
+
+#: config.lua
+msgid "Marble Stele"
+msgstr "Tulisan Marmar"
+
+#: config.lua
+msgid "Granite Stele"
+msgstr "Tulisan Granit"
+
+#: nodes.lua
+msgid "Displayed text (3 lines max)"
+msgstr "Teks untuk dipaparkan (maksimum 3 baris)"
+
+#: nodes.lua
+msgid "Write"
+msgstr "Tulis"
diff --git a/steles/locale/template.pot b/steles/locale/template.pot
new file mode 100644
index 0000000..0144ace
--- /dev/null
+++ b/steles/locale/template.pot
@@ -0,0 +1,46 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2017-08-26 11:29+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: config.lua
+msgid "Stone Stele"
+msgstr ""
+
+#: config.lua
+msgid "Sandstone Stele"
+msgstr ""
+
+#: config.lua
+msgid "Desert Stone Stele"
+msgstr ""
+
+#: config.lua
+msgid "Marble Stele"
+msgstr ""
+
+#: config.lua
+msgid "Granite Stele"
+msgstr ""
+
+#: nodes.lua
+msgid "Displayed text (3 lines max)"
+msgstr ""
+
+#: nodes.lua
+msgid "Write"
+msgstr ""
diff --git a/steles/mod.conf b/steles/mod.conf
new file mode 100644
index 0000000..2b29f05
--- /dev/null
+++ b/steles/mod.conf
@@ -0,0 +1,4 @@
+name=steles
+description=Stone steles with text display on them
+depends=default,display_api,font_api
+optional_depends=intllib,technic
diff --git a/steles/nodes.lua b/steles/nodes.lua
new file mode 100644
index 0000000..2245e20
--- /dev/null
+++ b/steles/nodes.lua
@@ -0,0 +1,94 @@
+--[[
+ steles mod for Minetest. Steles / graves with text on it.
+ (c) Pierre-Yves Rollo
+
+ This file is part of steles.
+
+ steles is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ steles is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with steles. If not, see <http://www.gnu.org/licenses/>.
+--]]
+
+local S = steles.intllib
+local F = function(...) return minetest.formspec_escape(S(...)) end
+
+display_api.register_display_entity("steles:text")
+
+for i, material in ipairs(steles.materials) do
+
+ local ndef = minetest.registered_nodes[material]
+
+ if ndef then
+ local groups = table.copy(ndef.groups)
+ local parts = material:split(":")
+ groups.display_api = 1
+
+ minetest.register_node("steles:"..parts[2].."_stele", {
+ description = steles.materials_desc[i],
+ sunlight_propagates = true,
+ paramtype = "light",
+ paramtype2 = "facedir",
+ tiles = ndef.tiles,
+ drawtype = "nodebox",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-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,
+ top = -2/16,
+ aspect_ratio = 0.4,
+ size = { x = 10/16, y = 12/16 },
+ maxlines = 3,
+ },
+ },
+ on_place = function(itemstack, placer, pointed_thing)
+ minetest.rotate_node(itemstack, placer, pointed_thing)
+ return display_api.on_place(itemstack, placer, pointed_thing)
+ end,
+ on_construct = function(pos)
+ local meta = minetest.get_meta(pos)
+ 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,
+ 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.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
diff --git a/steles/tools/updatepo.sh b/steles/tools/updatepo.sh
new file mode 100755
index 0000000..feb2504
--- /dev/null
+++ b/steles/tools/updatepo.sh
@@ -0,0 +1,25 @@
+#! /bin/bash
+
+# To create a new translation:
+# msginit --locale=ll_CC -o locale/ll_CC.po -i locale/template.pot
+
+cd "$(dirname "${BASH_SOURCE[0]}")/..";
+
+# Extract translatable strings.
+xgettext --from-code=UTF-8 \
+ --language=Lua \
+ --sort-by-file \
+ --keyword=S \
+ --keyword=NS:1,2 \
+ --keyword=N_ \
+ --keyword=F \
+ --add-comments='Translators:' \
+ --add-location=file \
+ -o locale/template.pot \
+ $(find . -name '*.lua')
+
+# Update translations.
+find locale -name '*.po' | while read -r file; do
+ echo $file
+ msgmerge --update $file locale/template.pot;
+done