diff options
Diffstat (limited to 'ontime_clocks')
27 files changed, 842 insertions, 0 deletions
diff --git a/ontime_clocks/LICENSE.txt b/ontime_clocks/LICENSE.txt new file mode 100644 index 0000000..341c30b --- /dev/null +++ b/ontime_clocks/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/ontime_clocks/README.md b/ontime_clocks/README.md new file mode 100644 index 0000000..d9db998 --- /dev/null +++ b/ontime_clocks/README.md @@ -0,0 +1,49 @@ +# Ontime Clocks + +This mod provides clocks that display real ingame time. + +For more information, see the [forum topic](https://forum.minetest.net/viewtopic.php?t=19365) at the Minetest forums. + +**Dependancies**: display_api, default + +**License**: Code under LGPL, textures under CC-BY-SA + +## Recipes + +**Green and red digital clocks** + + - D - + G M G + - - - + +G = Glass, D = Dye, M = Mese Crystal, - = Empty + +Green dye for green clock, red dye for red clock + +**White clock** + + S P S + - M - + - - - + +P = Paper, S = Steel Ingot, M = Mese Crystal, - = Empty + + +**Frameless clock** + + S D S + - M - + - - - + +D = Dye, S = Steel Ingot, M = Mese Crystal, - = Empty + +Black dye for black clock, White dye for white clock + +**Gold frameless clock** + + G - G + - M - + - - - + +G = Gold Ingot, M = Mese Crystal, - = Empty + diff --git a/ontime_clocks/common.lua b/ontime_clocks/common.lua new file mode 100644 index 0000000..cced299 --- /dev/null +++ b/ontime_clocks/common.lua @@ -0,0 +1,61 @@ +--[[ + ontime_clocks mod for Minetest - Clock nodes displaying ingame time + (c) Pierre-Yves Rollo + + This file is part of ontime_clocks. + + ontime_clocks 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. + + ontime_clocks 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 ontime_clocks. If not, see <http://www.gnu.org/licenses/>. +--]] + +-- Entity for time display +display_api.register_display_entity("ontime_clocks:display") + +function ontime_clocks.get_h24() + return math.floor(minetest.get_timeofday()*24)%24 +end + +function ontime_clocks.get_h12() + return math.floor(minetest.get_timeofday()*24)%12 +end + +function ontime_clocks.get_m12() + return math.floor(minetest.get_timeofday()*288)%12 +end + +function ontime_clocks.get_digital_properties(color_off, color_on, hour, minute) + return + { + textures={"ontime_clocks_digital_background.png^[colorize:"..color_off + .."^([combine:21x7" + ..":0,"..(-7*(math.floor(hour/10))).."=ontime_clocks_digital_digit.png" + ..":5,"..(-7*(hour%10)).."=ontime_clocks_digital_digit.png" + ..":9,-70=ontime_clocks_digital_digit.png" + ..":12,"..(-7*(math.floor(minute/2))).."=ontime_clocks_digital_digit.png" + ..":17,"..(-35*(minute%2)).."=ontime_clocks_digital_digit.png" + .."^[colorize:"..color_on..")"}, + visual_size = {x=21/32, y=7/32} + } +end + +function ontime_clocks.get_needles_properties(color, size, hour, minute) + return + { + textures={"[combine:"..size.."x"..size + ..":0,"..(-size*hour).."=ontime_clocks_needle_h"..size..".png" + ..":0,"..(-size*minute).."=ontime_clocks_needle_m"..size..".png" + .."^[colorize:"..color}, + visual_size = {x=size/64, y=size/64} + } +end + diff --git a/ontime_clocks/copyright.txt b/ontime_clocks/copyright.txt new file mode 100644 index 0000000..a2afd94 --- /dev/null +++ b/ontime_clocks/copyright.txt @@ -0,0 +1,8 @@ +Code, Textures and Models by Pierre-Yves Rollo (pyrollo) +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/ontime_clocks/crafts.lua b/ontime_clocks/crafts.lua new file mode 100644 index 0000000..c94352a --- /dev/null +++ b/ontime_clocks/crafts.lua @@ -0,0 +1,75 @@ +--[[ + ontime_clocks mod for Minetest - Clock nodes displaying ingame time + (c) Pierre-Yves Rollo + + This file is part of ontime_clocks. + + ontime_clocks 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. + + ontime_clocks 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 ontime_clocks. If not, see <http://www.gnu.org/licenses/>. +--]] + +minetest.register_craft({ + output = 'ontime_clocks:green_digital', + recipe = { + {'', 'dye:green', ''}, + {'default:glass', 'default:mese_crystal', 'default:glass'}, + {'', '', ''}, + } +}) + +minetest.register_craft({ + output = 'ontime_clocks:red_digital', + recipe = { + {'', 'dye:red', ''}, + {'default:glass', 'default:mese_crystal', 'default:glass'}, + {'', '', ''}, + } +}) + +minetest.register_craft({ + output = 'ontime_clocks:white', + recipe = { + {'default:steel_ingot', 'default:paper', 'default:steel_ingot'}, + {'', 'default:mese_crystal', ''}, + {'', '', ''}, + } +}) + +minetest.register_craft({ + output = 'ontime_clocks:frameless_black', + recipe = { + {'default:steel_ingot', 'dye:black', 'default:steel_ingot'}, + {'', 'default:mese_crystal', ''}, + {'', '', ''}, + } +}) + +minetest.register_craft({ + output = 'ontime_clocks:frameless_gold', + recipe = { + {'default:gold_ingot', '', 'default:gold_ingot'}, + {'', 'default:mese_crystal', ''}, + {'', '', ''}, + } +}) + +minetest.register_craft({ + output = 'ontime_clocks:frameless_white', + recipe = { + {'default:steel_ingot', 'dye:white', 'default:steel_ingot'}, + {'', 'default:mese_crystal', ''}, + {'', '', ''}, + } +}) + + diff --git a/ontime_clocks/depends.txt b/ontime_clocks/depends.txt new file mode 100644 index 0000000..07a2ec1 --- /dev/null +++ b/ontime_clocks/depends.txt @@ -0,0 +1,5 @@ +default +dye +display_api + +intllib? diff --git a/ontime_clocks/init.lua b/ontime_clocks/init.lua new file mode 100644 index 0000000..d0ac334 --- /dev/null +++ b/ontime_clocks/init.lua @@ -0,0 +1,31 @@ +--[[ + ontime_clocks mod for Minetest - Clock nodes displaying ingame time + (c) Pierre-Yves Rollo + + This file is part of ontime_clocks. + + ontime_clocks 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. + + ontime_clocks 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 ontime_clocks. If not, see <http://www.gnu.org/licenses/>. +--]] + +ontime_clocks = {} +ontime_clocks.name = minetest.get_current_modname() +ontime_clocks.path = minetest.get_modpath(ontime_clocks.name) + +-- Load support for intllib. +local S, NS = dofile(ontime_clocks.path.."/intllib.lua") +ontime_clocks.intllib = S + +dofile(ontime_clocks.path.."/common.lua") +dofile(ontime_clocks.path.."/nodes.lua") +dofile(ontime_clocks.path.."/crafts.lua") diff --git a/ontime_clocks/intllib.lua b/ontime_clocks/intllib.lua new file mode 100644 index 0000000..6669d72 --- /dev/null +++ b/ontime_clocks/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/ontime_clocks/locale/fr.po b/ontime_clocks/locale/fr.po new file mode 100644 index 0000000..ed5d2b4 --- /dev/null +++ b/ontime_clocks/locale/fr.po @@ -0,0 +1,43 @@ +# 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 09:50+0200\n" +"PO-Revision-Date: 2017-05-08 06:20+0200\n" +"Last-Translator: Peppy <peppy@twang-factory.com>\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" + +#: nodes.lua +msgid "Green digital clock" +msgstr "Horloge numérique verte" + +#: nodes.lua +msgid "Red digital clock" +msgstr "Horloge numérique rouge" + +#: nodes.lua +msgid "White clock" +msgstr "Horloge blanche" + +#: nodes.lua +msgid "Frameless clock" +msgstr "Horloge sans cadre" + +#: nodes.lua +msgid "Frameless gold clock" +msgstr "Horloge dorée sans cadre" + +#: nodes.lua +msgid "Frameless white clock" +msgstr "Horloge blanche sans cadre" diff --git a/ontime_clocks/locale/ms.po b/ontime_clocks/locale/ms.po new file mode 100644 index 0000000..76f06a3 --- /dev/null +++ b/ontime_clocks/locale/ms.po @@ -0,0 +1,42 @@ +# 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:21+0200\n" +"PO-Revision-Date: 2017-08-27 09:41+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" + +#: nodes.lua +msgid "Green digital clock" +msgstr "Jam digital hijau" + +#: nodes.lua +msgid "Red digital clock" +msgstr "Jam digital merah" + +#: nodes.lua +msgid "White clock" +msgstr "Jam putih" + +#: nodes.lua +msgid "Frameless clock" +msgstr "Jam tanpa bingkai" + +#: nodes.lua +msgid "Frameless gold clock" +msgstr "Jam emas tanpa bingkai" + +#: nodes.lua +msgid "Frameless white clock" +msgstr "Jam putih tanpa bingkai" diff --git a/ontime_clocks/locale/template.pot b/ontime_clocks/locale/template.pot new file mode 100644 index 0000000..dca736f --- /dev/null +++ b/ontime_clocks/locale/template.pot @@ -0,0 +1,42 @@ +# 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:21+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" + +#: nodes.lua +msgid "Green digital clock" +msgstr "" + +#: nodes.lua +msgid "Red digital clock" +msgstr "" + +#: nodes.lua +msgid "White clock" +msgstr "" + +#: nodes.lua +msgid "Frameless clock" +msgstr "" + +#: nodes.lua +msgid "Frameless gold clock" +msgstr "" + +#: nodes.lua +msgid "Frameless white clock" +msgstr "" diff --git a/ontime_clocks/mod.conf b/ontime_clocks/mod.conf new file mode 100644 index 0000000..9c1a2e6 --- /dev/null +++ b/ontime_clocks/mod.conf @@ -0,0 +1,4 @@ +name=ontime_clocks +description=Clocks displaing real ingame time +depends=default,dye,display_api +optional_depends=intllib diff --git a/ontime_clocks/nodes.lua b/ontime_clocks/nodes.lua new file mode 100644 index 0000000..107d2e9 --- /dev/null +++ b/ontime_clocks/nodes.lua @@ -0,0 +1,246 @@ +--[[ + ontime_clocks mod for Minetest - Clock nodes displaying ingame time + (c) Pierre-Yves Rollo + + This file is part of ontime_clocks. + + ontime_clocks 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. + + ontime_clocks 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 ontime_clocks. If not, see <http://www.gnu.org/licenses/>. +--]] + +local S = ontime_clocks.intllib + +-- Green digital clock +minetest.register_node("ontime_clocks:green_digital", { + description = S("Green digital clock"), + inventory_image = "ontime_clocks_green_digital_inventory.png", + wield_image = "ontime_clocks_green_digital_inventory.png", + paramtype = "light", + paramtype2 = "wallmounted", + drawtype = "nodebox", + node_box = { + type = "wallmounted", + wall_side = { -0.5, -3/16, -7/16, -13/32, 7/32, 7/16 }, + wall_top = { -7/16, 0.5, -7/32, 7/16, 13/32, 3/16 }, + wall_bottom = { -7/16, -0.5, -3/16, 7/16, -13/32, 7/32 }, + }, + tiles = {"ontime_clocks_digital.png"}, + groups = {oddly_breakable_by_hand=1, not_blocking_trains=1, display_api=1}, + display_entities = { + ["ontime_clocks:display"] = { + depth = 13/32 - 0.01, + on_display_update = function(pos, objref) + objref:set_properties( + ontime_clocks.get_digital_properties( + "#040", "#0F0", ontime_clocks.get_h24(), ontime_clocks.get_m12())) + end }, + }, + on_place = display_api.on_place, + on_construct = display_api.on_construct, + on_destruct = display_api.on_destruct, + on_rotate = display_api.on_rotate, +}) + +minetest.register_abm({ + nodenames = {"ontime_clocks:green_digital"}, + interval = 5, + chance = 1, + action = display_api.update_entities, +}) + +-- Red digital clock +minetest.register_node("ontime_clocks:red_digital", { + description = S("Red digital clock"), + inventory_image = "ontime_clocks_red_digital_inventory.png", + wield_image = "ontime_clocks_red_digital_inventory.png", + paramtype = "light", + paramtype2 = "wallmounted", + drawtype = "nodebox", + node_box = { + type = "wallmounted", + wall_side = { -0.5, -3/16, -7/16, -13/32, 7/32, 7/16 }, + wall_bottom = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }, + wall_top = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 } + }, + tiles = {"ontime_clocks_digital.png"}, + groups = {oddly_breakable_by_hand=1, not_blocking_trains=1, display_api=1}, + display_entities = { + ["ontime_clocks:display"] = { + depth = 13/32 - 0.01, + on_display_update = function(pos, objref) + objref:set_properties( + ontime_clocks.get_digital_properties( + "#400", "#F00", ontime_clocks.get_h24(), ontime_clocks.get_m12())) + end }, + }, + on_place = display_api.on_place, + on_construct = display_api.on_construct, + on_destruct = display_api.on_destruct, + on_rotate = display_api.on_rotate, +}) + +minetest.register_abm({ + nodenames = {"ontime_clocks:red_digital"}, + interval = 5, + chance = 1, + action = display_api.update_entities, +}) + + +minetest.register_node("ontime_clocks:white", { + description = S("White clock"), + inventory_image = "ontime_clocks_white_inventory.png", + wield_image = "ontime_clocks_white_inventory.png", + paramtype = "light", + paramtype2 = "wallmounted", + drawtype = "nodebox", + node_box = { + type = "wallmounted", + wall_side = { -0.5, -7/16, -7/16, -6/16, 7/16, 7/16}, + wall_bottom = { -7/16, -0.5, -7/16, 7/16, -7/16, 7/16}, + wall_top = { -7/16, 0.5, -7/16, 7/16, 7/16, 7/16}, + }, + tiles = {"ontime_clocks_white.png"}, + groups = {oddly_breakable_by_hand=1, not_blocking_trains=1, display_api=1}, + display_entities = { + ["ontime_clocks:display"] = { + depth = 6/16 - 0.01, + on_display_update = function(pos, objref) + objref:set_properties( + ontime_clocks.get_needles_properties( + "#000", 36, ontime_clocks.get_h12(), ontime_clocks.get_m12())) + end }, + }, + on_place = display_api.on_place, + on_construct = display_api.on_construct, + on_destruct = display_api.on_destruct, + on_rotate = display_api.on_rotate, +}) + +minetest.register_abm({ + nodenames = {"ontime_clocks:white"}, + interval = 5, + chance = 1, + action = display_api.update_entities, +}) + +minetest.register_node("ontime_clocks:frameless_black", { + description = S("Frameless clock"), + inventory_image = "ontime_clocks_frameless_inventory.png", + wield_image = "ontime_clocks_frameless_inventory.png", + paramtype = "light", + paramtype2 = "wallmounted", + drawtype = "nodebox", + node_box = { + type = "wallmounted", + wall_side = { -0.5, -7/16, -7/16, -0.45, 7/16, 7/16 }, + wall_bottom = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }, + wall_top = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 } + }, + tiles = {"ontime_clocks_frameless.png"}, + groups = {oddly_breakable_by_hand=1, not_blocking_trains=1, display_api=1}, + display_entities = { + ["ontime_clocks:display"] = { + depth = 7/16, + on_display_update = function(pos, objref) + objref:set_properties( + ontime_clocks.get_needles_properties( + "#000", 48, ontime_clocks.get_h12(), ontime_clocks.get_m12())) + end }, + }, + on_place = display_api.on_place, + on_construct = display_api.on_construct, + on_destruct = display_api.on_destruct, + on_rotate = display_api.on_rotate, +}) + +minetest.register_abm({ + nodenames = {"ontime_clocks:frameless_black"}, + interval = 5, + chance = 1, + action = display_api.update_entities, +}) + +minetest.register_node("ontime_clocks:frameless_gold", { + description = S("Frameless gold clock"), + inventory_image = "ontime_clocks_frameless_inventory.png^[colorize:#FF0", + wield_image = "ontime_clocks_frameless_inventory.png^[colorize:#FF0", + paramtype = "light", + paramtype2 = "wallmounted", + drawtype = "nodebox", + node_box = { + type = "wallmounted", + wall_side = { -0.5, -7/16, -7/16, -0.45, 7/16, 7/16 }, + wall_bottom = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }, + wall_top = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 } + }, + tiles = {"ontime_clocks_frameless.png^[colorize:#FF0"}, + groups = {oddly_breakable_by_hand=1, not_blocking_trains=1, display_api=1}, + display_entities = { + ["ontime_clocks:display"] = { + depth = 7/16, + on_display_update = function(pos, objref) + objref:set_properties( + ontime_clocks.get_needles_properties( + "#FF0", 48, ontime_clocks.get_h12(), ontime_clocks.get_m12())) + end }, + }, + on_place = display_api.on_place, + on_construct = display_api.on_construct, + on_destruct = display_api.on_destruct, + on_rotate = display_api.on_rotate, +}) + +minetest.register_abm({ + nodenames = {"ontime_clocks:frameless_gold"}, + interval = 5, + chance = 1, + action = display_api.update_entities, +}) + +minetest.register_node("ontime_clocks:frameless_white", { + description = S("Frameless white clock"), + inventory_image = "ontime_clocks_frameless_inventory.png^[colorize:#FFF", + wield_image = "ontime_clocks_frameless_inventory.png^[colorize:#FFF", + paramtype = "light", + paramtype2 = "wallmounted", + drawtype = "nodebox", + node_box = { + type = "wallmounted", + wall_side = { -0.5, -7/16, -7/16, -0.45, 7/16, 7/16 }, + wall_bottom = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }, + wall_top = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 } + }, + tiles = {"ontime_clocks_frameless.png^[colorize:#FFF"}, + groups = {oddly_breakable_by_hand=1, not_blocking_trains=1, display_api=1}, + display_entities = { + ["ontime_clocks:display"] = { + depth = 7/16, + on_display_update = function(pos, objref) + objref:set_properties( + ontime_clocks.get_needles_properties( + "#FFF", 48, ontime_clocks.get_h12(), ontime_clocks.get_m12())) + end }, + }, + on_place = display_api.on_place, + on_construct = display_api.on_construct, + on_destruct = display_api.on_destruct, + on_rotate = display_api.on_rotate, +}) + +minetest.register_abm({ + nodenames = {"ontime_clocks:frameless_white"}, + interval = 5, + chance = 1, + action = display_api.update_entities, +}) diff --git a/ontime_clocks/textures/ontime_clocks_digital.png b/ontime_clocks/textures/ontime_clocks_digital.png Binary files differnew file mode 100644 index 0000000..a4876cd --- /dev/null +++ b/ontime_clocks/textures/ontime_clocks_digital.png diff --git a/ontime_clocks/textures/ontime_clocks_digital_background.png b/ontime_clocks/textures/ontime_clocks_digital_background.png Binary files differnew file mode 100644 index 0000000..c416492 --- /dev/null +++ b/ontime_clocks/textures/ontime_clocks_digital_background.png diff --git a/ontime_clocks/textures/ontime_clocks_digital_digit.png b/ontime_clocks/textures/ontime_clocks_digital_digit.png Binary files differnew file mode 100644 index 0000000..e5b5448 --- /dev/null +++ b/ontime_clocks/textures/ontime_clocks_digital_digit.png diff --git a/ontime_clocks/textures/ontime_clocks_frameless.png b/ontime_clocks/textures/ontime_clocks_frameless.png Binary files differnew file mode 100644 index 0000000..37405d3 --- /dev/null +++ b/ontime_clocks/textures/ontime_clocks_frameless.png diff --git a/ontime_clocks/textures/ontime_clocks_frameless_inventory.png b/ontime_clocks/textures/ontime_clocks_frameless_inventory.png Binary files differnew file mode 100644 index 0000000..5960507 --- /dev/null +++ b/ontime_clocks/textures/ontime_clocks_frameless_inventory.png diff --git a/ontime_clocks/textures/ontime_clocks_green_digital_inventory.png b/ontime_clocks/textures/ontime_clocks_green_digital_inventory.png Binary files differnew file mode 100644 index 0000000..2bf9043 --- /dev/null +++ b/ontime_clocks/textures/ontime_clocks_green_digital_inventory.png diff --git a/ontime_clocks/textures/ontime_clocks_needle_h36.png b/ontime_clocks/textures/ontime_clocks_needle_h36.png Binary files differnew file mode 100644 index 0000000..e08302f --- /dev/null +++ b/ontime_clocks/textures/ontime_clocks_needle_h36.png diff --git a/ontime_clocks/textures/ontime_clocks_needle_h48.png b/ontime_clocks/textures/ontime_clocks_needle_h48.png Binary files differnew file mode 100644 index 0000000..1c28ef9 --- /dev/null +++ b/ontime_clocks/textures/ontime_clocks_needle_h48.png diff --git a/ontime_clocks/textures/ontime_clocks_needle_m36.png b/ontime_clocks/textures/ontime_clocks_needle_m36.png Binary files differnew file mode 100644 index 0000000..31eb1ae --- /dev/null +++ b/ontime_clocks/textures/ontime_clocks_needle_m36.png diff --git a/ontime_clocks/textures/ontime_clocks_needle_m48.png b/ontime_clocks/textures/ontime_clocks_needle_m48.png Binary files differnew file mode 100644 index 0000000..fd83f41 --- /dev/null +++ b/ontime_clocks/textures/ontime_clocks_needle_m48.png diff --git a/ontime_clocks/textures/ontime_clocks_red_digital_inventory.png b/ontime_clocks/textures/ontime_clocks_red_digital_inventory.png Binary files differnew file mode 100644 index 0000000..5400167 --- /dev/null +++ b/ontime_clocks/textures/ontime_clocks_red_digital_inventory.png diff --git a/ontime_clocks/textures/ontime_clocks_white.png b/ontime_clocks/textures/ontime_clocks_white.png Binary files differnew file mode 100644 index 0000000..e484303 --- /dev/null +++ b/ontime_clocks/textures/ontime_clocks_white.png diff --git a/ontime_clocks/textures/ontime_clocks_white_inventory.png b/ontime_clocks/textures/ontime_clocks_white_inventory.png Binary files differnew file mode 100644 index 0000000..7436408 --- /dev/null +++ b/ontime_clocks/textures/ontime_clocks_white_inventory.png diff --git a/ontime_clocks/tools/updatepo.sh b/ontime_clocks/tools/updatepo.sh new file mode 100755 index 0000000..feb2504 --- /dev/null +++ b/ontime_clocks/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 |