diff --git a/buildscripts/02_build_pa.sh b/buildscripts/02_build_pa.sh index 904d91e..067762b 100755 --- a/buildscripts/02_build_pa.sh +++ b/buildscripts/02_build_pa.sh @@ -14,7 +14,6 @@ mod_install minetest_game --exclude=farming minetest_game/mods/* # Install all other mods mod_install blocks_functions -mod_install building_blocks mod_install buildings mod_install environment mod_install flora @@ -22,3 +21,4 @@ mod_install gui mod_install lib_api mod_install mobs mod_install player +mod_install special diff --git a/mod_sources.txt b/mod_sources.txt index 2d630ab..db0ff72 100644 --- a/mod_sources.txt +++ b/mod_sources.txt @@ -37,10 +37,6 @@ origin https://github.com/sirrobzeroone/comboblock (fetch) * master 279a5e2 [origin/master] version increment Mod: blocks_functions/comboblock -origin https://gitlab.com/VanessaE/signs_lib (fetch) -* master 1a6b9f3 [origin/master] enable static save on signs' entities -Mod: building_blocks/signs_lib - origin https://github.com/Sokomine/cottages (fetch) * master 8cfaaed [origin/master] added listring to shelf Mod: buildings/cottages @@ -144,3 +140,7 @@ Mod: player/wield3d origin https://github.com/minetest-mods/wielded_light.git (fetch) * master 4376b55 [origin/master] Code maintanance Mod: player/wielded_light + +origin git@github.com:pyrollo/display_modpack.git (fetch) +* master 6135b3a [origin/master] Merge pull request #42 from mnh48-minetest/update_malay_july2020 +Mod: special/display_modpack diff --git a/mods/lib_api/modpack.conf b/mods/lib_api/modpack.conf index 8c3e277..31c4e44 100644 --- a/mods/lib_api/modpack.conf +++ b/mods/lib_api/modpack.conf @@ -1,5 +1,9 @@ description = Libraries and apis for mods -modlib, cmdlib - for character_anim -entitycontrol - for clumpfall -mobkit - for petz +cmdlib - for character_anim +display_modpack - for signs +mobkit - for petz and other mod mods +mobs_redo - for some mob mods +modlib - for character_anim + + diff --git a/mods/special/display_modpack/.gitmodules b/mods/special/display_modpack/.gitmodules new file mode 100644 index 0000000..a28a34b --- /dev/null +++ b/mods/special/display_modpack/.gitmodules @@ -0,0 +1,3 @@ +[submodule "display_api"] + path = display_api + url = https://github.com/pyrollo/display_api.git diff --git a/mods/special/display_modpack/LICENSE.txt b/mods/special/display_modpack/LICENSE.txt new file mode 100644 index 0000000..65c5ca8 --- /dev/null +++ b/mods/special/display_modpack/LICENSE.txt @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + 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/mods/special/display_modpack/README.md b/mods/special/display_modpack/README.md new file mode 100644 index 0000000..c37a469 --- /dev/null +++ b/mods/special/display_modpack/README.md @@ -0,0 +1,115 @@ +# Display Modpack +Version 1.3.1 + +This modpack provides mods with dynamic display. Mods are : + +- **[display_api](https://github.com/pyrollo/display_modpack/tree/master/display_api)**: A library for adding display entities to nodes; +- **[font_api](https://github.com/pyrollo/display_modpack/tree/master/font_api)**: A library for displaying fonts on entities; +- **[signs_api](https://github.com/pyrollo/display_modpack/tree/master/signs_api)**: A library for the easy creation of signs; +- **[font_metro](https://github.com/pyrollo/display_modpack/tree/master/font_metro)**: A font mod used as default font (includes uppercase, lowercase and accentuated latin letters, usual signs, cyrillic and greek letters) + +- **[boards](https://github.com/pyrollo/display_modpack/tree/master/boards)**: A mod providing school boards (includes *tiny cursive font*, a handwriting style font); +- **[ontime_clocks](https://github.com/pyrollo/display_modpack/tree/master/ontime_clocks)**: A mod providing clocks which display the ingame time; +- **[signs](https://github.com/pyrollo/display_modpack/tree/master/signs)**: A mod providing signs and direction signs displaying text; +- **[signs_road](https://github.com/pyrollo/display_modpack/tree/master/signs_road)**: A mod providing road signs displaying text; +- **[steles](https://github.com/pyrollo/display_modpack/tree/master/steles)**: A mod providing stone steles with text; + +For more information, see the [forum topic](https://forum.minetest.net/viewtopic.php?t=19365) at the Minetest forums. + +![Presentation image of Display_Modpack](screenshot.png) + +## Extra fonts + +*Metro* and *Tiny Cursive* fonts are provided in **Display Modpack** (in **font_metro** and **boards** mods) but you can add more fonts by installing font mods. Be aware that each font mod comes with numerous textures. This can result in slowing media downloading and/or client display. + +Extra font mods can be found here: + * [OldWizard](https://github.com/pyrollo/font_oldwizard): An old style gothic font. + * [Botic](https://github.com/pyrollo/font_botic): A scifi style font. + +## Deprecation notice (for modders) + +### December 2018 +Following objects are deprecated, shows a warning in log when used: +* `display_modpack_node` group (use `display_api` group instead); +* `display_lib_node` group (use `display_api` group instead); +* `display_lib` global table (use `display_api` global table instead); +* `font_lib` global table (use `font_api` global table instead); + +These objects will be removed in the future. + +## Changelog +### 2019-03-14 (Version 1.3.1) +- __dispay_api__: Display API now detects automatically whenr rotation restrictions have to be applied. +- __sign_api__: Screwdriver behavior changed. Now, left click rotates and changes direction. + +### 2019-03-09 (Version 1.3) +- __display_api__: Display nodes can be rotated in every directions (if running Minetest 5 or above). +- __display_api__: New setting to restrict rotations to Minetest 0.4 abilities (restriction enabled by default). +- __sign_api__: Changed behavior of screwdriver if no rotation restriction. + +### 2018-12-14 (Version 1.2.3) +- __display_api__: New `yaw` attributes, entities can now have different angles with node. +- __font_api__: New `Font:render` method for texture creation +- __font_api__: Specific management for fixed width font. Allows number of columns based texture width. +- __font_api__: Improve `display_api` integration into `font_api`. Display API fully optional. `font_api.on_display_update` defined only if `display_api` enabled. +- __font_api__: Improve management of invalid UTF strings (should not crash anymore) +- __font_api__: Deprecation of `font_lib` +- __signs__: Fixed craft recipe for labels + +### 2018-12-02 (Version 1.2.2) +- Fixed a bug that prevented Display API from working on some systems (Raspberry Pi) + +### 2018-11-01 (Version 1.2.1) +- Now font can be chosen per sign / stele + +### 2018-11-01 (Version 1.2) +- Labels and woodend signs added. +- Fallback mechanism for missing chars (For example: "é" --> "e" --> "E"). +- Several bug fixes by 12Me21 and naturefreshmilk. + +### 2018-07-16 (Version 1.1.1) +- Boards mod added. +- Bug fix in default font chosing when multiple font registered. + +### 2018-07-13 (Version 1.1.0) +- Font API rework introducing Font class. +- Replaced default Epilepsy Font by Metro Font for licensing purposes, +- Rework of all nodes displaying text accordingly to the Font API rework. + +As font_epilepsy mod has been replaced by font_metro mod, **don't forget to activate font_metro mod after updating** or you won't have any text displayed. + +### 2018-05-30 (Version 1.0.1) +Mostly bug fixes : +- Fix steles orientation when placing +- Update entity on mapblock load +- Use default formspec style +- Fix ndef nill value in steles mod when technics not installed +- Seperate signs API from signs définitions +- Allow a greater offset between display and block + +### 2018-01-13 (Version 1.0) +- Switch to Epilepsy font by KREATIVE SOFTWARE +- Add settings "default_font" +- Add horizontal alignment +- Add tool for creating font textures from .ttf font files +- Fix UTF 8 to Unicode decoding +- Updated forum thread link in README.md + +### 2017-12-19 +This change is a preparation to merge Andrzej Pieńkowski fork (apienk) : new font and support of UTF chars. +- Font\_lib support for multiple fonts (nothing yet visible in mods) ; +- Font\_lib support for Unicode characters (limited to Unicode Plane 0: 0000-FFFF, see [Wikipedia](https://en.wikipedia.org/wiki/Unicode)) ; +- New "default" font with original textures from Vanessa Ezekowitz (VanessaE) ; + +### 2017-12-10 +- Compatibility of signs mod with signs_lib (thanks to gpcf) ; +- Added large banner in road signs (thanks to gpcf) ; + +### 2017-08-26 +- Changed signs from wallmounted to facedir to improve textures and make it possible to use screwdriver. +**IMPORTANT** : Map will be updated to change to new nodes but inventory items will turn into "Unknown items" and have to be re-crafted. +- Intllib support added with french translation (whole modpack, thanks to fat115) ; +- Punch on nodes to update entity (signs, signs_road and steles). Usefull in case of /clearobjects ; +- Changed wooden direction sign textures (signs) ; +- Added back and side textures to all signs (road_signs) ; +- Added more sign types : White/yellow/green signs and direction signs (signs_road) ; diff --git a/mods/special/display_modpack/_config.yml b/mods/special/display_modpack/_config.yml new file mode 100644 index 0000000..2f7efbe --- /dev/null +++ b/mods/special/display_modpack/_config.yml @@ -0,0 +1 @@ +theme: jekyll-theme-minimal \ No newline at end of file diff --git a/mods/special/display_modpack/boards/LICENSE.txt b/mods/special/display_modpack/boards/LICENSE.txt new file mode 100644 index 0000000..341c30b --- /dev/null +++ b/mods/special/display_modpack/boards/LICENSE.txt @@ -0,0 +1,166 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + 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/mods/special/display_modpack/boards/LICENSE_FONT.txt b/mods/special/display_modpack/boards/LICENSE_FONT.txt new file mode 100644 index 0000000..29d0f9b --- /dev/null +++ b/mods/special/display_modpack/boards/LICENSE_FONT.txt @@ -0,0 +1,4 @@ +The FontStruction “Tiny Cursive” +(https://fontstruct.com/fontstructions/show/63155) by “cyfry77” is licensed +under a Creative Commons Attribution Share Alike license +(http://creativecommons.org/licenses/by-sa/3.0/). diff --git a/mods/special/display_modpack/boards/copyright.txt b/mods/special/display_modpack/boards/copyright.txt new file mode 100644 index 0000000..ad83a10 --- /dev/null +++ b/mods/special/display_modpack/boards/copyright.txt @@ -0,0 +1,2 @@ +Code by Pierre-Yves Rollo (pyrollo) +Font by (cyfry77) diff --git a/mods/special/display_modpack/boards/depends.txt b/mods/special/display_modpack/boards/depends.txt new file mode 100644 index 0000000..8c807e3 --- /dev/null +++ b/mods/special/display_modpack/boards/depends.txt @@ -0,0 +1,2 @@ +default +signs_api diff --git a/mods/special/display_modpack/boards/font_tinycurs.lua b/mods/special/display_modpack/boards/font_tinycurs.lua new file mode 100644 index 0000000..a9a323a --- /dev/null +++ b/mods/special/display_modpack/boards/font_tinycurs.lua @@ -0,0 +1,27 @@ +--[[ + Tinycurs font for Font API + + Original font Tiny Cursive + by cyfry77 + G and J textures by Pierre-Yves Rollo (pyrollo) + released under CC-BY-SA license + + https://fontstruct.com/fontstructions/show/63155/tiny_cursive + + Derivative texture are under CC-BY-SA license + Code is under LGPL v3 license +--]] + +font_api.register_font('tinycurs', + { + default = false, -- Don't register this font as a possible default font + margintop = -2, + marginbottom = -2, + linespacing = -4, + height = 19, + widths = { + [0]=9, [32]=9, [33]=6, [34]=7, [35]=10, [36]=14, [37]=14, [38]=12, [39]=3, [40]=6, [41]=6, [42]=9, [43]=8, [44]=3, [45]=7, [46]=3, [47]=9, [48]=9, [49]=7, [50]=10, [51]=9, [52]=9, [53]=10, [54]=10, [55]=9, [56]=10, [57]=8, [58]=5, [59]=5, [60]=8, [61]=8, [62]=8, [63]=8, [64]=12, [65]=9, [66]=7, [67]=9, [68]=10, [69]=8, [70]=8, [71]=8, [72]=10, [73]=7, [74]=8, [75]=9, [76]=9, [77]=12, [78]=10, [79]=9, [80]=9, [81]=9, [82]=11, [83]=11, [84]=8, [85]=11, [86]=11, [87]=12, [88]=12, [89]=11, [90]=11, [91]=8, [92]=5, [93]=8, [94]=8, [95]=8, [96]=5, [97]=6, [98]=6, [99]=6, [100]=7, [101]=6, [102]=5, [103]=6, [104]=6, [105]=4, [106]=5, [107]=7, [108]=5, [109]=9, [110]=8, [111]=6, [112]=9, [113]=8, [114]=7, [115]=7, [116]=6, [117]=8, [118]=8, [119]=11, [120]=10, [121]=8, [122]=8, [123]=8, [124]=6, [125]=9, [126]=10, [8216]=4, [8217]=4, [8220]=6, [8221]=6 + }, + } +); + diff --git a/mods/special/display_modpack/boards/init.lua b/mods/special/display_modpack/boards/init.lua new file mode 100644 index 0000000..4126a6c --- /dev/null +++ b/mods/special/display_modpack/boards/init.lua @@ -0,0 +1,139 @@ +--[[ + boards mod for Minetest. Black boards with text on it. + (c) Pierre-Yves Rollo + + This file is part of boards. + + boards 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. + + boards 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 boards. If not, see . +--]] + +boards = {} +boards.name = minetest.get_current_modname() +boards.path = minetest.get_modpath(boards.name) + +-- Load support for intllib. +local S, NS = dofile(boards.path.."/intllib.lua") +boards.intllib = S +local F = function(...) return minetest.formspec_escape(S(...)) end + +-- Load font +dofile(boards.path.."/font_tinycurs.lua") + +local function set_formspec(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,3;display_text;"..F("Text")..";${display_text}]".. + "button_exit[3,3.5;2,1;ok;"..F("Write").."]".. + "button_exit[1,3.5;2,1;wipe;"..F("Wipe").."]") +end + +-- On boards, everyone is allowed to write and wipe +local function on_receive_fields(pos, formname, fields, player) + if fields then + if fields.ok or fields.key_enter then + signs_api.set_display_text(pos, fields.display_text, fields.font) + end + if fields.wipe then + signs_api.set_display_text(pos, "", fields.font) + end + end +end + +models = { + black_board = { + depth = 1/16, width = 1, height = 1, + entity_fields = { + top = -1/32, + size = { x = 1, y = 15/16 }, + maxlines = 5, + color = "#fff", + font_name = "tinycurs", + valign = "top", + }, + node_fields = { + description = S("Black board"), + tiles = { "default_wood.png", "default_wood.png", + "default_wood.png", "default_wood.png", + "default_wood.png", "board_black_front.png" }, + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, 7/16, 0.5, 0.5, 0.5}, + {-0.5, -7/16, 6/16, 0.5, -0.5, 7/16} + }, + }, + on_construct = function(pos) + set_formspec(pos) + display_api.on_construct(pos) + end, + on_receive_fields = on_receive_fields, + }, + }, + green_board = { + depth = 1/16, width = 1, height = 1, + entity_fields = { + top = -1/32, + size = { x = 1, y = 15/16 }, + maxlines = 5, + color = "#fff", + font_name = "tinycurs", + valign = "top", + }, + node_fields = { + description = S("Green board"), + tiles = { "default_wood.png", "default_wood.png", + "default_wood.png", "default_wood.png", + "default_wood.png", "board_green_front.png" }, + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, 7/16, 0.5, 0.5, 0.5}, + {-0.5, -7/16, 6/16, 0.5, -0.5, 7/16} + }, + }, + on_construct = function(pos) + set_formspec(pos) + display_api.on_construct(pos) + end, + on_receive_fields = on_receive_fields, + }, + }, +} + +-- Node registration +for name, model in pairs(models) +do + signs_api.register_sign("boards", name, model) +end + +-- Recipes +minetest.register_craft( + { + output = "boards:black_board", + recipe = { + {"group:wood", "group:stone", "dye:black"}, + } + }) + +minetest.register_craft( + { + output = "boards:green_board", + recipe = { + {"group:wood", "group:stone", "dye:dark_green"}, + } + }) + diff --git a/mods/special/display_modpack/boards/intllib.lua b/mods/special/display_modpack/boards/intllib.lua new file mode 100644 index 0000000..6669d72 --- /dev/null +++ b/mods/special/display_modpack/boards/intllib.lua @@ -0,0 +1,45 @@ + +-- Fallback functions for when `intllib` is not installed. +-- Code released under Unlicense . + +-- 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/mods/special/display_modpack/boards/locale/fr.po b/mods/special/display_modpack/boards/locale/fr.po new file mode 100644 index 0000000..1b081be --- /dev/null +++ b/mods/special/display_modpack/boards/locale/fr.po @@ -0,0 +1,40 @@ +# 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 , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-07-16 10:00+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: init.lua +msgid "Text" +msgstr "Texte" + +#: init.lua +msgid "Write" +msgstr "Ecrire" + +#: init.lua +msgid "Wipe" +msgstr "Effacer" + +#: init.lua +msgid "Black board" +msgstr "Tableau noir" + +#: init.lua +msgid "Green board" +msgstr "Tableau vert" + + diff --git a/mods/special/display_modpack/boards/locale/ms.po b/mods/special/display_modpack/boards/locale/ms.po new file mode 100644 index 0000000..fe360aa --- /dev/null +++ b/mods/special/display_modpack/boards/locale/ms.po @@ -0,0 +1,35 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Yaya (Nurul Azeera Hidayah @ Muhammad Nur Hidayat) , 2020. +# +msgid "" +msgstr "" +"Project-Id-Version: Display Modpack\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-07-16 10:00+0200\n" +"PO-Revision-Date: 2020-07-05 11:31+0000\n" +"Language-Team: Malay \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 2.3\n" +"Last-Translator: Yaya MNH48 \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"Language: ms\n" + +#: init.lua +msgid "Text" +msgstr "Teks" + +#: init.lua +msgid "Write" +msgstr "Tulis" + +#: init.lua +msgid "Wipe" +msgstr "Padam" + +#: init.lua +msgid "Black board" +msgstr "Papan hitam" diff --git a/mods/special/display_modpack/boards/locale/template.pot b/mods/special/display_modpack/boards/locale/template.pot new file mode 100644 index 0000000..8db98b8 --- /dev/null +++ b/mods/special/display_modpack/boards/locale/template.pot @@ -0,0 +1,34 @@ +# 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 , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-07-16 10:00+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: init.lua +msgid "Text" +msgstr "" + +#: init.lua +msgid "Write" +msgstr "" + +#: init.lua +msgid "Wipe" +msgstr "" + +#: init.lua +msgid "Black board" +msgstr "" diff --git a/mods/special/display_modpack/boards/mod.conf b/mods/special/display_modpack/boards/mod.conf new file mode 100644 index 0000000..2343d07 --- /dev/null +++ b/mods/special/display_modpack/boards/mod.conf @@ -0,0 +1,3 @@ +name=boards +description=Writable school boards using sign_api +depends=default,signs_api diff --git a/mods/special/display_modpack/boards/textures/board_black_front.png b/mods/special/display_modpack/boards/textures/board_black_front.png new file mode 100644 index 0000000..9e4a534 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/board_black_front.png differ diff --git a/mods/special/display_modpack/boards/textures/board_green_front.png b/mods/special/display_modpack/boards/textures/board_green_front.png new file mode 100644 index 0000000..dd7758d Binary files /dev/null and b/mods/special/display_modpack/boards/textures/board_green_front.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0000.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0000.png new file mode 100644 index 0000000..981fe5b Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0000.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0020.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0020.png new file mode 100644 index 0000000..78711f4 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0020.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0021.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0021.png new file mode 100644 index 0000000..30454f5 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0021.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0022.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0022.png new file mode 100644 index 0000000..cab4525 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0022.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0023.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0023.png new file mode 100644 index 0000000..a8afe9c Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0023.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0024.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0024.png new file mode 100644 index 0000000..ec0292f Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0024.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0025.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0025.png new file mode 100644 index 0000000..c603fc0 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0025.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0026.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0026.png new file mode 100644 index 0000000..e77f57f Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0026.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0027.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0027.png new file mode 100644 index 0000000..46530fd Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0027.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0028.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0028.png new file mode 100644 index 0000000..beec165 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0028.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0029.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0029.png new file mode 100644 index 0000000..a4d8506 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0029.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_002a.png b/mods/special/display_modpack/boards/textures/font_tinycurs_002a.png new file mode 100644 index 0000000..e7f8694 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_002a.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_002b.png b/mods/special/display_modpack/boards/textures/font_tinycurs_002b.png new file mode 100644 index 0000000..ae04969 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_002b.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_002c.png b/mods/special/display_modpack/boards/textures/font_tinycurs_002c.png new file mode 100644 index 0000000..bff8fdc Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_002c.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_002d.png b/mods/special/display_modpack/boards/textures/font_tinycurs_002d.png new file mode 100644 index 0000000..246a186 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_002d.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_002e.png b/mods/special/display_modpack/boards/textures/font_tinycurs_002e.png new file mode 100644 index 0000000..08a2e41 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_002e.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_002f.png b/mods/special/display_modpack/boards/textures/font_tinycurs_002f.png new file mode 100644 index 0000000..4397f28 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_002f.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0030.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0030.png new file mode 100644 index 0000000..fa3ad5d Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0030.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0031.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0031.png new file mode 100644 index 0000000..cb5516d Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0031.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0032.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0032.png new file mode 100644 index 0000000..3958eec Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0032.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0033.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0033.png new file mode 100644 index 0000000..34ca071 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0033.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0034.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0034.png new file mode 100644 index 0000000..9c7a331 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0034.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0035.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0035.png new file mode 100644 index 0000000..a8b4b07 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0035.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0036.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0036.png new file mode 100644 index 0000000..35fe54f Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0036.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0037.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0037.png new file mode 100644 index 0000000..18b279b Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0037.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0038.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0038.png new file mode 100644 index 0000000..882d8bc Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0038.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0039.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0039.png new file mode 100644 index 0000000..23c8ea0 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0039.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_003a.png b/mods/special/display_modpack/boards/textures/font_tinycurs_003a.png new file mode 100644 index 0000000..c6ead96 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_003a.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_003b.png b/mods/special/display_modpack/boards/textures/font_tinycurs_003b.png new file mode 100644 index 0000000..28a08d2 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_003b.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_003c.png b/mods/special/display_modpack/boards/textures/font_tinycurs_003c.png new file mode 100644 index 0000000..0aa8e08 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_003c.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_003d.png b/mods/special/display_modpack/boards/textures/font_tinycurs_003d.png new file mode 100644 index 0000000..1761935 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_003d.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_003e.png b/mods/special/display_modpack/boards/textures/font_tinycurs_003e.png new file mode 100644 index 0000000..aeebbba Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_003e.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_003f.png b/mods/special/display_modpack/boards/textures/font_tinycurs_003f.png new file mode 100644 index 0000000..06f0fe3 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_003f.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0040.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0040.png new file mode 100644 index 0000000..210b9a4 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0040.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0041.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0041.png new file mode 100644 index 0000000..271e958 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0041.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0042.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0042.png new file mode 100644 index 0000000..14a6e02 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0042.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0043.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0043.png new file mode 100644 index 0000000..0bac54c Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0043.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0044.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0044.png new file mode 100644 index 0000000..8546bba Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0044.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0045.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0045.png new file mode 100644 index 0000000..769ccf8 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0045.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0046.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0046.png new file mode 100644 index 0000000..dc47409 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0046.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0047.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0047.png new file mode 100644 index 0000000..a67d655 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0047.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0048.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0048.png new file mode 100644 index 0000000..9f8ff06 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0048.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0049.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0049.png new file mode 100644 index 0000000..0df681d Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0049.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_004a.png b/mods/special/display_modpack/boards/textures/font_tinycurs_004a.png new file mode 100644 index 0000000..c9c7922 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_004a.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_004b.png b/mods/special/display_modpack/boards/textures/font_tinycurs_004b.png new file mode 100644 index 0000000..9d351e7 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_004b.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_004c.png b/mods/special/display_modpack/boards/textures/font_tinycurs_004c.png new file mode 100644 index 0000000..45104cc Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_004c.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_004d.png b/mods/special/display_modpack/boards/textures/font_tinycurs_004d.png new file mode 100644 index 0000000..96a27a8 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_004d.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_004e.png b/mods/special/display_modpack/boards/textures/font_tinycurs_004e.png new file mode 100644 index 0000000..d7ac6e9 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_004e.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_004f.png b/mods/special/display_modpack/boards/textures/font_tinycurs_004f.png new file mode 100644 index 0000000..58055b0 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_004f.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0050.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0050.png new file mode 100644 index 0000000..500aa9a Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0050.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0051.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0051.png new file mode 100644 index 0000000..37b30ae Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0051.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0052.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0052.png new file mode 100644 index 0000000..840cc1b Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0052.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0053.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0053.png new file mode 100644 index 0000000..06b21f7 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0053.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0054.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0054.png new file mode 100644 index 0000000..2e4ee5c Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0054.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0055.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0055.png new file mode 100644 index 0000000..8667c35 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0055.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0056.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0056.png new file mode 100644 index 0000000..a50cdb0 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0056.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0057.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0057.png new file mode 100644 index 0000000..1002ba6 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0057.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0058.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0058.png new file mode 100644 index 0000000..ab59eb3 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0058.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0059.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0059.png new file mode 100644 index 0000000..8718103 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0059.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_005a.png b/mods/special/display_modpack/boards/textures/font_tinycurs_005a.png new file mode 100644 index 0000000..a306f61 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_005a.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_005b.png b/mods/special/display_modpack/boards/textures/font_tinycurs_005b.png new file mode 100644 index 0000000..dc3c175 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_005b.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_005c.png b/mods/special/display_modpack/boards/textures/font_tinycurs_005c.png new file mode 100644 index 0000000..77f2ef1 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_005c.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_005d.png b/mods/special/display_modpack/boards/textures/font_tinycurs_005d.png new file mode 100644 index 0000000..996e0e6 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_005d.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_005e.png b/mods/special/display_modpack/boards/textures/font_tinycurs_005e.png new file mode 100644 index 0000000..5d92757 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_005e.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_005f.png b/mods/special/display_modpack/boards/textures/font_tinycurs_005f.png new file mode 100644 index 0000000..153ffec Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_005f.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0060.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0060.png new file mode 100644 index 0000000..df31daf Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0060.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0061.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0061.png new file mode 100644 index 0000000..7aaff24 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0061.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0062.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0062.png new file mode 100644 index 0000000..2ff008e Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0062.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0063.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0063.png new file mode 100644 index 0000000..d0bb6c2 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0063.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0064.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0064.png new file mode 100644 index 0000000..c858125 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0064.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0065.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0065.png new file mode 100644 index 0000000..5e09ff0 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0065.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0066.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0066.png new file mode 100644 index 0000000..f8e7470 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0066.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0067.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0067.png new file mode 100644 index 0000000..f872c2f Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0067.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0068.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0068.png new file mode 100644 index 0000000..730e2b4 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0068.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0069.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0069.png new file mode 100644 index 0000000..5dff581 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0069.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_006a.png b/mods/special/display_modpack/boards/textures/font_tinycurs_006a.png new file mode 100644 index 0000000..19c16b8 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_006a.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_006b.png b/mods/special/display_modpack/boards/textures/font_tinycurs_006b.png new file mode 100644 index 0000000..312fc63 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_006b.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_006c.png b/mods/special/display_modpack/boards/textures/font_tinycurs_006c.png new file mode 100644 index 0000000..ec7fbc4 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_006c.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_006d.png b/mods/special/display_modpack/boards/textures/font_tinycurs_006d.png new file mode 100644 index 0000000..6b8b0fe Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_006d.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_006e.png b/mods/special/display_modpack/boards/textures/font_tinycurs_006e.png new file mode 100644 index 0000000..a6cc6aa Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_006e.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_006f.png b/mods/special/display_modpack/boards/textures/font_tinycurs_006f.png new file mode 100644 index 0000000..5e19767 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_006f.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0070.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0070.png new file mode 100644 index 0000000..634f169 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0070.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0071.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0071.png new file mode 100644 index 0000000..2997b83 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0071.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0072.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0072.png new file mode 100644 index 0000000..a460efa Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0072.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0073.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0073.png new file mode 100644 index 0000000..38a3707 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0073.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0074.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0074.png new file mode 100644 index 0000000..5bd4d16 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0074.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0075.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0075.png new file mode 100644 index 0000000..0daa657 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0075.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0076.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0076.png new file mode 100644 index 0000000..a97bf65 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0076.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0077.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0077.png new file mode 100644 index 0000000..08fa1de Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0077.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0078.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0078.png new file mode 100644 index 0000000..9440b69 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0078.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_0079.png b/mods/special/display_modpack/boards/textures/font_tinycurs_0079.png new file mode 100644 index 0000000..9477e40 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_0079.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_007a.png b/mods/special/display_modpack/boards/textures/font_tinycurs_007a.png new file mode 100644 index 0000000..219e180 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_007a.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_007b.png b/mods/special/display_modpack/boards/textures/font_tinycurs_007b.png new file mode 100644 index 0000000..bd8b1c7 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_007b.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_007c.png b/mods/special/display_modpack/boards/textures/font_tinycurs_007c.png new file mode 100644 index 0000000..8de441f Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_007c.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_007d.png b/mods/special/display_modpack/boards/textures/font_tinycurs_007d.png new file mode 100644 index 0000000..b4affd2 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_007d.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_007e.png b/mods/special/display_modpack/boards/textures/font_tinycurs_007e.png new file mode 100644 index 0000000..175176d Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_007e.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_2018.png b/mods/special/display_modpack/boards/textures/font_tinycurs_2018.png new file mode 100644 index 0000000..f9d9c2d Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_2018.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_2019.png b/mods/special/display_modpack/boards/textures/font_tinycurs_2019.png new file mode 100644 index 0000000..4f389ee Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_2019.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_201c.png b/mods/special/display_modpack/boards/textures/font_tinycurs_201c.png new file mode 100644 index 0000000..06b34d6 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_201c.png differ diff --git a/mods/special/display_modpack/boards/textures/font_tinycurs_201d.png b/mods/special/display_modpack/boards/textures/font_tinycurs_201d.png new file mode 100644 index 0000000..435d6f4 Binary files /dev/null and b/mods/special/display_modpack/boards/textures/font_tinycurs_201d.png differ diff --git a/mods/special/display_modpack/boards/tools/updatepo.sh b/mods/special/display_modpack/boards/tools/updatepo.sh new file mode 100755 index 0000000..feb2504 --- /dev/null +++ b/mods/special/display_modpack/boards/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 diff --git a/mods/special/display_modpack/display_api/API.md b/mods/special/display_modpack/display_api/API.md new file mode 100644 index 0000000..2dfff21 --- /dev/null +++ b/mods/special/display_modpack/display_api/API.md @@ -0,0 +1,92 @@ +# Display API +This document describes Display API. Display API allows to add a dynamic display on a node. Display API limits node rotations. For wallmounted, only vertical positionning is available. For facedir, only first four position are availabel (those with default axis). + +## Provided methods +### update\_entities +**display\_api.update\_entities(pos)** + +This method triggers entities update for the display node at pos. Actual entity update is made by `on_display_update` callback associated to the entity. + +`pos`: Position of the node +### register\_display\_entity +**display\_api.register\_display\_entity(entity_name)** + +This is a helper to register entities used for display. + +`entity_name`: Name of the entity to register. + +## Provided callback implementations +### on_place +**display\_api.on\_place(itemstack, placer, pointed\_thing)** + +`on_place` node callback implementation. Display nodes should have this callback (avoid placement of horizontal display node). +### on_construct +**display\_api.on\_construct(pos)** + +`on_construct` node callback implementation. Display nodes should have this callback (creates, places and updates display entities on node construction). +### on_destruct +**display\_api.on_destruct(pos)** + +`on_destruct` node callback implementation. Display nodes should have this callback (removes display entities on node destruction). +### on_rotate +**display\_api.on\_rotate(pos, node, user, mode, new_param2)** + +`on_rotate` node callback implementation. Display nodes should have this callback (restricts rotations and rotates display entities associated with node). +### on_activate +**display\_api.on_activate(entity, staticdata)** + +`On_activate` entity callback implementation for display entities. No need of this method if display entities have been registered using `register_display_entity` (callback is already set). + +## Howto register a display node +* Register display entities with `register_display_entity` + +* Register node with : + - `on_place`, `on_construct`, `on_destruct` and `on_rotate` callbacks using display_api callbacks.\ + - `display_api` group. This will make this node have their entities updated as soon as the mapblock is loaded (Useful after /clearobjects).\ + - a `display_entities` field in node definition containing a entity name indexed table. See below for description of each display_entities fields.\ + +### Display_entities fields +`on_display_update` is a callback in charge of setting up entity texture. If not set, entity will have no texture and will be displayed as unknown item.\ +`depth`, `right` and `top`: Entity position regarding to node facedir/wallmounted main axis.\ +Values for these fields can be any number between -1.5 and 1.5 (default value is 0). Position 0,0,0 is the center of the node.\ +`depth` goes from front (-0.5) to rear (0.5), `top` goes from bottom (-0.5) to top (0.5) and `right` goes from left (-0.5) to right (0.5).\ +`yaw`: Entity yaw in radians, regarding to main axis. Default is 0, aligned to node face. + +In order to avoid flickering text, it's better to have text a little behind node surface. A good spacing value is given by `display_api.entity_spacing` variable. + +### Example + + display_api.register_display_entity("mymod:entity1") + display_api.register_display_entity("mymod:entity2") + + function my_display_update1(pos, objref) + objref:set_properties({ textures= {"mytexture1.png"}, + visual_size = {x=1, y=1} }) + end + + function my_display_update2(pos, objref) + objref:set_properties({ textures= {"mytexture2.png"}, +                         visual_size = {x=1, y=1} }) + end + + minetest.register_node("mymod:test_display_node", { + ... + paramtype2 = "facedir", + ... + groups = { display_api = 1, ... }, + ... + display_entities = { + ["mymod:entity1"] = { + depth = 0.3, + on_display_update = my_display_update1 }, + ["mymod:entity1"] = { + depth = 0.2, top = 0.1, + on_display_update = my_display_update2 }, + }, + ... + on_place = display_api.on_place, + on_construct = display_api.on_construct, + on_destruct = display_api.on_destruct, + on_rotate = display_api.on_rotate, + ... + }) diff --git a/mods/special/display_modpack/display_api/LICENSE.txt b/mods/special/display_modpack/display_api/LICENSE.txt new file mode 100644 index 0000000..341c30b --- /dev/null +++ b/mods/special/display_modpack/display_api/LICENSE.txt @@ -0,0 +1,166 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + 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/mods/special/display_modpack/display_api/README.md b/mods/special/display_modpack/display_api/README.md new file mode 100644 index 0000000..73acdf9 --- /dev/null +++ b/mods/special/display_modpack/display_api/README.md @@ -0,0 +1,34 @@ +# Display API + +This library's purpose is to ease creation of nodes with one or more displays on sides. For example, signs and clocks. Display can be dynamic and/or different for each node instance. + +**Limitations**: This lib uses entities to draw display. This means display has to be vertical (and "upside up") on Minetest before version 5.0. + +**Dependancies**:default + +**License**: LGPLv2 + +**API**: See [API.md](https://github.com/pyrollo/display_modpack/blob/master/display_api/API.md) document please. + +For more information, see the [forum topic](https://forum.minetest.net/viewtopic.php?t=19365) at the Minetest forums. + +## Deprecation notice (for modders) + +### December 2018 +Following objects are deprecated, shows a warning in log when used: +* `display_modpack_node` group (use `display_api` group instead); +* `display_lib_node` group (use `display_api` group instead); +* `display_lib` global table (use `display_api` global table instead); + +These objects will be removed in the future. + +## Change log +### 2019-03-14 +- __dispay_api__: Display API now detects automatically whenr rotation restrictions have to be applied. + +### 2019-03-09 +- __display_api__: Display nodes can be rotated in every directions (if running Minetest 5 or above). +- __display_api__: New setting to restrict rotations to Minetest 0.4 abilities (restriction enabled by default). + +### 2018-12-14 +- __display_api__: New `yaw` attributes, entities can now have different angles with node. diff --git a/mods/special/display_modpack/display_api/copyright.txt b/mods/special/display_modpack/display_api/copyright.txt new file mode 100644 index 0000000..e242c7c --- /dev/null +++ b/mods/special/display_modpack/display_api/copyright.txt @@ -0,0 +1,5 @@ +Code by Pierre-Yves Rollo (pyrollo) +Contributors: +(gpcf): Compatibility with signs lib +(Thomas--S): Fix /clearobjects bug +(12Me21): on_place and on_rotate improvements diff --git a/mods/special/display_modpack/display_api/depends.txt b/mods/special/display_modpack/display_api/depends.txt new file mode 100644 index 0000000..e69de29 diff --git a/mods/special/display_modpack/display_api/deprecation.lua b/mods/special/display_modpack/display_api/deprecation.lua new file mode 100644 index 0000000..b041f6f --- /dev/null +++ b/mods/special/display_modpack/display_api/deprecation.lua @@ -0,0 +1,78 @@ +--[[ + display_api mod for Minetest - Library to add dynamic display + capabilities to nodes + (c) Pierre-Yves Rollo + + This program 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. + + This program 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 this program. If not, see . +--]] + +-- Deprecation + +function deprecated_group(deprecated_group, replacement_group) + for name, ndef in pairs(minetest.registered_nodes) do + if ndef.groups and ndef.groups[deprecated_group] then + minetest.log("warning", string.format( + 'Node %s belongs to deprecated "%s" group which should be replaced with new "%s" group.', + name, deprecated_group, replacement_group)) + end + end +end + +function deprecated_global_table(deprecated_global_name, replacement_global_name) + assert(type(deprecated_global_name) == 'string', "deprecated_global_name should be a string.") + assert(type(replacement_global_name) == 'string', "replacement_global_name should be a string.") + assert(deprecated_global_name ~= '', "deprecated_global_name should not be empty.") + assert(replacement_global_name ~= '', "replacement_global_name should not be empty.") + assert(rawget(_G, deprecated_global_name) == nil, "deprecated global does not exist.") + if _G[replacement_global_name] == nil then + minetest.log('warning', string.format( + 'Replacement global "%s" does not exists.', replacement_global_name)) + return + end + local meta = { + deprecated = deprecated_global_name, + replacement = replacement_global_name, + __index = function(table, key) + local meta = getmetatable(table) + local dbg = debug.getinfo(2, "lS") + minetest.log("warning", string.format( + 'Accessing deprecated "%s" table, "%s" should be used instead (%s:%d).', + meta.deprecated, meta.replacement, (dbg.short_src or 'unknown'), + (dbg.currentline or 0))) + return _G[meta.replacement][key] + end, + __newindex = function(table, key, value) + local meta = getmetatable(table) + local dbg = debug.getinfo(2, "lS") + minetest.log("warning", string.format( + 'Accessing deprecated "%s" table, "%s" should be used instead (%s:%d).', + meta.deprecated, meta.replacement, (dbg.short_src or 'unknown'), + (dbg.currentline or 0))) + _G[meta.replacement][key]=value + end, + } + rawset(_G, deprecated_global_name, {}) + setmetatable(_G[deprecated_global_name], meta) +end + + +-- deprecated(1) -- December 2018 - Deprecation of groups display_modpack_node and display_lib_node +-- Group to be removed from display API register_lbm +minetest.after(0, function() + deprecated_group("display_modpack_node", "display_api") + deprecated_group("display_lib_node", "display_api") +end) + +-- deprecated(2) -- December 2018 - Deprecation of display_lib +deprecated_global_table('display_lib', 'display_api') diff --git a/mods/special/display_modpack/display_api/display.lua b/mods/special/display_modpack/display_api/display.lua new file mode 100644 index 0000000..fa7c854 --- /dev/null +++ b/mods/special/display_modpack/display_api/display.lua @@ -0,0 +1,325 @@ +--[[ + display_api mod for Minetest - Library to add dynamic display + capabilities to nodes + (c) Pierre-Yves Rollo + + This program 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. + + This program 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 this program. If not, see . +--]] + +-- Prefered gap between node and entity +-- Entity positionment is up to mods but it is a good practice to use this +-- variable as spacing between entity and node +display_api.entity_spacing = 0.002 + +-- Maximum entity position relative to the node pos +local max_entity_pos = 1.5 + +local wallmounted_rotations = { + [0]={x=1, y=0, z=0}, [1]={x=3, y=0, z=0}, + [2]={x=0, y=3, z=0}, [3]={x=0, y=1, z=0}, + [4]={x=0, y=0, z=0}, [5]={x=0, y=2, z=0}, + [6]={x=1, y=0, z=0}, [7]={x=1, y=1, z=1}, +} + +local facedir_rotations = { + [ 0]={x=0, y=0, z=0}, [ 1]={x=0, y=3, z=0}, + [ 2]={x=0, y=2, z=0}, [ 3]={x=0, y=1, z=0}, + [ 4]={x=3, y=0, z=0}, [ 5]={x=0, y=3, z=3}, + [ 6]={x=1, y=0, z=2}, [ 7]={x=0, y=1, z=1}, + [ 8]={x=1, y=0, z=0}, [ 9]={x=0, y=3, z=1}, + [10]={x=3, y=0, z=2}, [11]={x=0, y=1, z=3}, + [12]={x=0, y=0, z=1}, [13]={x=3, y=0, z=1}, + [14]={x=2, y=0, z=1}, [15]={x=1, y=0, z=1}, + [16]={x=0, y=0, z=3}, [17]={x=1, y=0, z=3}, + [18]={x=2, y=0, z=3}, [19]={x=3, y=0, z=3}, + [20]={x=0, y=0, z=2}, [21]={x=0, y=1, z=2}, + [22]={x=0, y=2, z=2}, [23]={x=0, y=3, z=2}, +} + +-- Compute other useful values depending on wallmounted and facedir param +local wallmounted_values = {} +local facedir_values = {} + +local function compute_values(r) + local function rx(v) return { x=v.x, y=v.z, z=-v.y} end + local function ry(v) return { x=-v.z, y=v.y, z=v.x} end + local function rz(v) return { x=v.y, y=-v.x, z=v.z} end + + local d = { x = 0, y = 0, z = 1 } + local w = { x = 1, y = 0, z = 0 } + local h = { x = 0, y = 1, z = 0 } + + -- Important to keep z rotation first (not same results) + for _ = 1, r.z do d, w, h = rz(d), rz(w), rz(h) end + for _ = 1, r.x do d, w, h = rx(d), rx(w), rx(h) end + for _ = 1, r.y do d, w, h = ry(d), ry(w), ry(h) end + + return { + rotation=r, depth=d, width=w, height=h, + restricted=(r.x==0 and r.z==0) } +end + +for i, r in pairs(facedir_rotations) do + facedir_values[i] = compute_values(r) +end + +for i, r in pairs(wallmounted_rotations) do + wallmounted_values[i] = compute_values(r) +end + +-- Detect rotation restriction +local rotation_restricted = nil +minetest.register_entity('display_api:dummy_entity', { + collisionbox = { 0, 0, 0, 0, 0, 0 }, + visual = "upright_sprite", + textures = {} }) + +function display_api.is_rotation_restricted() + if rotation_restricted == nil then + local objref = minetest.add_entity( + {x=0, y=0, z=0}, 'display_api:dummy_entity') + if objref then + rotation_restricted = objref.set_rotation == nil + objref:remove() + end + end + return rotation_restricted +end + +-- Clip position property to maximum entity position + +local function clip_pos_prop(posprop) + if posprop then + return math.max(-max_entity_pos, math.min(max_entity_pos, posprop)) + else + return 0 + end +end + +-- Get values needed for orientation computation of node + +local function get_orientation_values(node) + local ndef = minetest.registered_nodes[node.name] + + if ndef then + local paramtype2 = ndef.paramtype2 + if paramtype2 == "wallmounted" or paramtype2 == "colorwallmounted" then + return wallmounted_values[node.param2 % 8] + elseif paramtype2 == "facedir" or paramtype2 == "colorfacedir" then + return facedir_values[node.param2 % 32] + else + -- No orientation or unknown orientation type + return facedir_values[0] + end + end +end + +-- Gets the display entities attached with a node. +-- Add missing and remove duplicates + +local function get_display_objrefs(pos, create) + local objrefs = {} + local ndef = minetest.registered_nodes[minetest.get_node(pos).name] + if ndef and ndef.display_entities then + for _, objref in + ipairs(minetest.get_objects_inside_radius(pos, max_entity_pos)) do + local entity = objref:get_luaentity() + if entity and ndef.display_entities[entity.name] and + entity.nodepos and vector.equals(pos, entity.nodepos) then + if objrefs[entity.name] then + objref:remove() -- Remove duplicates + else + objrefs[entity.name] = objref + end + end + end + if create then + -- Add missing + for name, _ in pairs(ndef.display_entities) do + if not objrefs[name] then + objrefs[name] = minetest.add_entity(pos, name, + minetest.serialize({ nodepos = pos })) + end + end + end + end + return objrefs +end + +--- Force entity update : position and texture +function display_api.update_entities(pos) + + local node = minetest.get_node(pos) + local ndef = minetest.registered_nodes[node.name] + local ov = get_orientation_values(node) + if not ndef or not ov then + return + end + + for _, objref in pairs(get_display_objrefs(pos, true)) do + local edef = ndef.display_entities[objref:get_luaentity().name] + local depth = clip_pos_prop(edef.depth) + local right = clip_pos_prop(edef.right) + local top = clip_pos_prop(edef.top) + + objref:set_pos({ + x = pos.x + ov.depth.x*depth + ov.width.x*right - ov.height.x*top, + y = pos.y + ov.depth.y*depth + ov.width.y*right - ov.height.y*top, + z = pos.z + ov.depth.z*depth + ov.width.z*right - ov.height.z*top, + }) + + if objref.set_rotation then + objref:set_rotation({ + x = ov.rotation.x*math.pi/2, + y = ov.rotation.y*math.pi/2 + (edef.yaw or 0), + z = ov.rotation.z*math.pi/2, + }) + else + if ov.rotation.x ~=0 or ov.rotation.y ~= 0 then + minetest.log("warning", string.format( + "[display_api] unable to rotate correctly entity for node at %s without set_rotation method.", + minetest.pos_to_string(pos))) + end + objref:set_yaw(ov.rotation.y*math.pi/2 + (edef.yaw or 0)) + end + + -- Call on_display_update callback of a node for one of its display entities + if edef.on_display_update then + edef.on_display_update(pos, objref) + end + end +end + +--- On_activate callback for display_api entities. Calls on_display_update callbacks +--- of corresponding node for each entity. +function display_api.on_activate(entity, staticdata) + if entity then + if string.sub(staticdata, 1, string.len("return")) == "return" then + local data = minetest.deserialize(staticdata) + if data and type(data) == "table" then + entity.nodepos = data.nodepos + end + entity.object:set_armor_groups({immortal=1}) + end + + if entity.nodepos then + local node = minetest.get_node(entity.nodepos) + local ndef = minetest.registered_nodes[node.name] + if ndef and ndef.display_entities then + local edef = ndef.display_entities[entity.name] + if edef then + -- Call on_display_update callback of the entity to build texture + if edef.on_display_update then + edef.on_display_update(entity.nodepos, entity.object) + end + return + end + end + end + -- If we got here, this display entity is buggy and should be removed + entity.object:remove() + end +end + +--- On_place callback for display_api items. +-- Does nothing more than preventing node from being placed on ceiling or ground +-- TODO:When MT<5 is not in use anymore, simplify this +function display_api.on_place(itemstack, placer, pointed_thing, override_param2) + local ndef = itemstack:get_definition() + local dir = { + x = pointed_thing.under.x - pointed_thing.above.x, + y = pointed_thing.under.y - pointed_thing.above.y, + z = pointed_thing.under.z - pointed_thing.above.z, + } + + local rotation_restriction = display_api.is_rotation_restricted() + + if rotation_restriction then + -- If item is not placed on a wall, use the player's view direction instead + if dir.x == 0 and dir.z == 0 then + dir = placer:get_look_dir() + end + dir.y = 0 + end + + local param2 = 0 + if ndef then + if ndef.paramtype2 == "wallmounted" or + ndef.paramtype2 == "colorwallmounted" then + param2 = minetest.dir_to_wallmounted(dir) + + elseif ndef.paramtype2 == "facedir" or + ndef.paramtype2 == "colorfacedir" then + param2 = minetest.dir_to_facedir(dir, not rotation_restriction) + end + end + return minetest.item_place(itemstack, placer, pointed_thing, + param2 + (override_param2 or 0)) +end + +--- On_construct callback for display_api items. +-- Creates entities and update them. +function display_api.on_construct(pos) + display_api.update_entities(pos) +end + +--- On_destruct callback for display_api items. +-- Removes entities. +function display_api.on_destruct(pos) + for _, objref in pairs(get_display_objrefs(pos)) do + objref:remove() + end +end + +-- On_rotate (screwdriver) callback for display_api items. Prevents invalid +-- rotations and reorients entities. +function display_api.on_rotate(pos, node, user, _, new_param2) + node.param2 = new_param2 + local ov = get_orientation_values(node) + if not ov then + return + end + + if ov.restricted or not display_api.is_rotation_restricted() then + minetest.swap_node(pos, node) + display_api.update_entities(pos) + return true + else + return false + end +end + +--- Creates display entity with some fields and the on_activate callback +function display_api.register_display_entity(entity_name) + if not minetest.registered_entities[entity_name] then + minetest.register_entity(':'..entity_name, { + collisionbox = { 0, 0, 0, 0, 0, 0 }, + visual = "upright_sprite", + textures = {}, + on_activate = display_api.on_activate, + get_staticdata = function(self) + return minetest.serialize({ nodepos = self.nodepos }) + end, + }) + end +end + +minetest.register_lbm({ + label = "Update display_api entities", + name = "display_api:update_entities", + run_at_every_load = true, + nodenames = {"group:display_api", + "group:display_modpack_node", "group:display_lib_node"}, -- See deprecated(1) + action = function(pos, node) display_api.update_entities(pos) end, +}) diff --git a/mods/special/display_modpack/display_api/init.lua b/mods/special/display_modpack/display_api/init.lua new file mode 100644 index 0000000..f1e54e8 --- /dev/null +++ b/mods/special/display_modpack/display_api/init.lua @@ -0,0 +1,31 @@ +--[[ + display_api mod for Minetest - Library to add dynamic display + capabilities to nodes + (c) Pierre-Yves Rollo + + This program 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. + + This program 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 this program. If not, see . +--]] + +-- Global variables +------------------- + +display_api = {} +display_api.name = minetest.get_current_modname() +display_api.path = minetest.get_modpath(display_api.name) + +-- Inclusions +------------- + +dofile(display_api.path.."/display.lua") +dofile(display_api.path.."/deprecation.lua") diff --git a/mods/special/display_modpack/display_api/mod.conf b/mods/special/display_modpack/display_api/mod.conf new file mode 100644 index 0000000..d0b1da7 --- /dev/null +++ b/mods/special/display_modpack/display_api/mod.conf @@ -0,0 +1,2 @@ +name=display_api +description=A library for adding dynamic textures on nodes diff --git a/mods/special/display_modpack/font_api/API.md b/mods/special/display_modpack/font_api/API.md new file mode 100644 index 0000000..80b1121 --- /dev/null +++ b/mods/special/display_modpack/font_api/API.md @@ -0,0 +1,201 @@ +# Font API +This document describes Font API. Font API creates textures for font display on entities. + +## Settings +### default_font +Name of the font to be used when no font is given. The font should be registered. + +If no default\_font given or if default\_font given but not registered, the first registered font will be used as default. + +## Use font_api with display_api (to display text on nodes) +### Base setup +Font_api offers a direct integration with display_api to display text on nodes. + +First of all, create a display node with an entity. +To do this, refer to API.md in display_api mod, in particular "Howto register a display node". + +The only requirement then is to connect the `on_display_update` callback of the display entity to `font_api.on_display_update`: + +``` +minetest.register_node("mymod:test_text_node", { + ... + paramtype2 = "facedir", + ... + groups = { display_api = 1, ... }, + ... + display_entities = { + ["mymod:text"] = { + depth = -0.5 - display_api.entity_spacing, + on_display_update = font_api.on_display_update }, + } + ... + on_place = display_api.on_place, + on_construct = display_api.on_construct, + on_destruct = display_api.on_destruct, + on_rotate = display_api.on_rotate, + ... +}) +``` + +At this step, your node already displays text form "display_text" (by default) node meta. If you want to store your text into another meta data field, add a `meta_text` field to display entity definition. + +But it uses defaults (default font, default size, default color). Likely you need something more. + +### Style your text +Font style and size can be chosen by adding some more entries to the display_entities definition table. + +#### Font size +Font size can be defined in various ways (maybe more in the future). +Start with a number of lines, and font_api will make it fit to the entity size. + * `maxlines` or `lines`: Number of maximum lines of text to be displayed. The font height will be adjusted accordingly. + +Then specify the char width. Two methods available: + * `aspect_ratio`: Defines the aspect ratio of chars. Works with all fonts. Should not be used if `columns` is specified. + * `columns`: Only if using a fixed width font, specifies the number of columns to display. + +#### Font style + * `font_name`: name of the font to use. Should correspond to a registered font (from a font mod). If not specified or font not found, default font is used. + * `color`: color to be used (default black). + * `halign`: Horizontal alignment: "left", "center" or "right" (default "center"). + * `valign`: Vertical alignement: "top", "middle" or "bottom" (default "middle"). + +### Example +Using blue //botic// font, three lines height, aligned top left. Text stored in "text" node meta. +``` +minetest.register_node("mymod:test_text_node", { + ... + ... + display_entities = { + ["mymod:text"] = { + depth = -0.5 - display_api.entity_spacing, + on_display_update = font_api.on_display_update + meta_text = "text", + font_name = "botic", + color = "#0000FF", + maxlines = 3, + aspect_ratio = 0.5, + halign = "left", + valign = "top", + }, + } + ... +}) +``` +## Provided methods +### font_api.get_default_font_name() +Returns de default font name. + +### font_api.register_font(font_name, font_def) +Register a new font. + * `font_name`: Name of the font to register. If registering different sizes of the same font, add size in the font name (e.g. times_10, times_12...). + * `font_def`: Font definition table (see **Font definition table** below). + +### font_api.on_display_update(pos, objref) +Standard on_display_update entity callback. + * `pos`: Node position + * `objref`: Object reference of entity + +Node should have a corresponding display_entity with size, resolution and maxlines fields and optionally halign, valign and color fields. + +## Font definition table +Font definition table used by **font_api.register_font** and **font\_api.Font:new** may/can contain following elements: + +* `height` (required): Font height in pixels (all font textures should have the same height) . +* `widths` (required): Array of character widths in pixels, indexed by UTF codepoints. +* `margintop` (optional): Margin (in texture pixels) added on top of each char texture. +* `marginbottom` (optional): Margin (in texture pixels) added at bottom of each char texture. +* `linespacing` (optional): Spacing (in texture pixels) between each lines. + +`margintop`, `marginbottom` and `linespacing` can be negative numbers (default 0) and are to be used to adjust various font styles to each other. + +Font attributes around a single char:\ +![Font attributes on a char](doc/font.svg) + +Font attributes effects on several lines:\ +![Font attributes on lines](doc/lines.svg) + +#### Additional requirements + +Font must have a char 0 which will be used to display any unknown char. + +All textures corresponding to the indexes in widths array should be present in textures directory with a name matching the pattern : + +> font\_**{font_name}**_**{utf_code}**.png + +**{font\_name}**: Name of the font as given in the first argument + +**{utf\_code}**: UTF code of the char in 4 hexadecimal digits + +Example : font_courrier_0041.png is for the "A" char in the "courrier" font. + +To ease that declaration (specially to build the **widths** array), a shell is provided to build a {font\_name}.lua file from the texture files (see provided tools). + +## Provided tools + +Still in early stage of development, these tools are helpers to create font mods. + +### make_font_texture.sh + +This scripts takes a .ttf file as input and create one .png file per char, that can be used as font texture. Launch it from your future font mod directory. + +__Advice__ + +This script works much better with pixels font, providing the correct height. There is no antialiasing at all, vector fonts and bad heights gives very ugly results. + +__Syntax__ + +**make\_font\_texture.sh {fontfile} {fontname} {fontsize}** + +**{fontfile}**: A TTF font file to use to create textures. +**{fontname}**: The font name to be used in font_api (should be simple, with no spaces). +**{fontsize}**: Font height to be rendered. + +### make_font_lua.sh + +This script analyses textures in textures directory and creates a font\_{font\_name}.lua files with a call to register_font with images information. Launch it from your future font mod directory. + +Once the font\_{font\_name}.lua created, it can be included by a init.lua file or directly renamed to init.lua if you are creating a simple font mod. + +__Syntax__ + +**make\_font_lua.sh {fontname}** + +**{fontname}**: The font name to be used in font_api (same as given to make\_font\_texture.sh) + +### An exemple generating a font mod + + mkdir font_myfont + cd font_myfont + //tools/make_font_texture.sh myfont.ttf myfont 12 + //tools/make_font_lua.sh myfont + mv font_myfont.lua init.lua + +## Font class +A font usable with font API. This class is supposed to be for internal use but who knows. + +### font\_api.Font:new(def) +Create a new font object. + * `def` is a table containing font definition. See **Font definition table** above. + +### font:get_char_width(codepoint) +Returns the width of char `codepoint` in texture pixels. + * `codepoint`: Unicode codepoint of char. + +### font:get_height(nb_of_lines) +Returns line(s) height. Takes care of top and bottom margins and line spacing. + * `nb_of_lines`: Number of lines in the text. + +### font:get_width(line) +Returns the width of a text line. Beware, if line contains any new line char, they are ignored. + * `line`: Line of text which the width will be computed. + +### font:renter(text, texturew, textureh, style) +Builds texture for a multiline colored text. + * `text`: Text to be rendered. + * `texturew`: Width of the texture (extra text will be truncated). + * `textureh`: Height of the texture (extra text will be truncated). + * `style`: A table with style indications: + - `lines` or `maxlines`: Maximum number of lines (default none). + - `halign`: Horizontal text align: "left"/"center"/"right" (default "center") + - `valign`: Vertical text align: "top"/"middle"/"bottom" (default "middle") + - `color`: Color of the text (default black) diff --git a/mods/special/display_modpack/font_api/LICENSE.txt b/mods/special/display_modpack/font_api/LICENSE.txt new file mode 100644 index 0000000..341c30b --- /dev/null +++ b/mods/special/display_modpack/font_api/LICENSE.txt @@ -0,0 +1,166 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + 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/mods/special/display_modpack/font_api/README.md b/mods/special/display_modpack/font_api/README.md new file mode 100644 index 0000000..ff1dd98 --- /dev/null +++ b/mods/special/display_modpack/font_api/README.md @@ -0,0 +1,31 @@ +# Font API + +A library for rendernig text on textures (to be used with display_api for sign creation). + +**Dependancies**: default + +**License**: LGPL + +(Default font taken from VanessaE's homedecor/signs_lib, originally under WTFPL) + +**API**: See [API.md](https://github.com/pyrollo/display_modpack/blob/master/font_api/API.md) document please. + +For more information, see the [forum topic](https://forum.minetest.net/viewtopic.php?t=13563) at the Minetest forums. + +## Extra fonts + +You can add fonts by installing fonts mod. Be aware that each font comes with numerous textures. This can result in slowing media downloading and/or client display. + +Font mods can be found here: + + * [Metro](https://github.com/pyrollo/display_modpack/tree/master/font_metro): A multipurpose font with many chars (uppercase, lowercase and accentuated latin letters, usual signs, cyrillic and greek letters). + * [OldWizard](https://github.com/pyrollo/font_oldwizard): An old style gothic font. + * [Botic](https://github.com/pyrollo/font_botic): A scifi style font. + + ## Deprecation notice (for modders) + + ### December 2018 + Following object is deprecate, shows a warning in log when used: + * `font_lib` global table (use `font_api` global table instead); + + This object will be removed in the future. diff --git a/mods/special/display_modpack/font_api/copyright.txt b/mods/special/display_modpack/font_api/copyright.txt new file mode 100644 index 0000000..ceb5446 --- /dev/null +++ b/mods/special/display_modpack/font_api/copyright.txt @@ -0,0 +1,3 @@ +Code by Pierre-Yves Rollo (pyrollo) +Contributors: +Andrzej Pieńkowski (apienk): Unicode support and tool for creating texturess diff --git a/mods/special/display_modpack/font_api/depends.txt b/mods/special/display_modpack/font_api/depends.txt new file mode 100644 index 0000000..88fa963 --- /dev/null +++ b/mods/special/display_modpack/font_api/depends.txt @@ -0,0 +1 @@ +display_api? diff --git a/mods/special/display_modpack/font_api/deprecation.lua b/mods/special/display_modpack/font_api/deprecation.lua new file mode 100644 index 0000000..1ffed11 --- /dev/null +++ b/mods/special/display_modpack/font_api/deprecation.lua @@ -0,0 +1,59 @@ +--[[ + font_api mod for Minetest - Library creating textures with fonts and text + (c) Pierre-Yves Rollo + + This program 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. + + This program 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 this program. If not, see . +--]] + +-- Deprecation + +function deprecated_global_table(deprecated_global_name, replacement_global_name) + assert(type(deprecated_global_name) == 'string', "deprecated_global_name should be a string.") + assert(type(replacement_global_name) == 'string', "replacement_global_name should be a string.") + assert(deprecated_global_name ~= '', "deprecated_global_name should not be empty.") + assert(replacement_global_name ~= '', "replacement_global_name should not be empty.") + assert(rawget(_G, deprecated_global_name) == nil, "deprecated global does not exist.") + if _G[replacement_global_name] == nil then + minetest.log('warning', string.format( + 'Replacement global "%s" does not exists.', replacement_global_name)) + return + end + local meta = { + deprecated = deprecated_global_name, + replacement = replacement_global_name, + __index = function(table, key) + local meta = getmetatable(table) + local dbg = debug.getinfo(2, "lS") + minetest.log("warning", string.format( + 'Accessing deprecated "%s" table, "%s" should be used instead (%s:%d).', + meta.deprecated, meta.replacement, (dbg.short_src or 'unknown'), + (dbg.currentline or 0))) + return _G[meta.replacement][key] + end, + __newindex = function(table, key, value) + local meta = getmetatable(table) + local dbg = debug.getinfo(2, "lS") + minetest.log("warning", string.format( + 'Accessing deprecated "%s" table, "%s" should be used instead (%s:%d).', + meta.deprecated, meta.replacement, (dbg.short_src or 'unknown'), + (dbg.currentline or 0))) + _G[meta.replacement][key]=value + end, + } + rawset(_G, deprecated_global_name, {}) + setmetatable(_G[deprecated_global_name], meta) +end + +-- deprecated(2) -- December 2018 - Deprecation of font_lib +deprecated_global_table('font_lib', 'font_api') diff --git a/mods/special/display_modpack/font_api/display_api.lua b/mods/special/display_modpack/font_api/display_api.lua new file mode 100644 index 0000000..51a396d --- /dev/null +++ b/mods/special/display_modpack/font_api/display_api.lua @@ -0,0 +1,76 @@ +--[[ + font_api mod for Minetest - Library creating textures with fonts and text + (c) Pierre-Yves Rollo + + This program 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. + + This program 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 this program. If not, see . +--]] +-- Integration with display API + +if minetest.get_modpath("display_api") then + --- Standard on_display_update entity callback. + -- Node should have properly configured display_entity. + -- @param pos Node position + -- @param objref Object reference of entity + + font_api.on_display_update = function (pos, objref) + local meta = minetest.get_meta(pos) + local ndef = minetest.registered_nodes[minetest.get_node(pos).name] + local entity = objref:get_luaentity() + + if not entity or not ndef.display_entities[entity.name] then + return + end + + local def = ndef.display_entities[entity.name] + local font = font_api.get_font(meta:get_string("font") ~= "" + and meta:get_string("font") or def.font_name) + + local text = meta:get_string(def.meta_text or "display_text") + + -- Compute entity resolution accroding to given attributes + local texturew, textureh + textureh = font:get_height(def.lines or def.maxlines or 1) + + if def.columns then + if font.fixedwidth then + texturew = def.columns * font.fixedwidth + if def.aspect_ratio then + minetest.log('warning', "[font_api] 'aspect_ratio' ignored because 'columns' is specified") + end + else + minetest.log('warning', "[font_api] 'columns' ignored because '"..font.name.."' is not a fixed width font.") + end + end + + if not texturew then + if not def.aspect_ratio then + minetest.log('warning', "[font_api] No 'aspect_ratio' specified, using default 1.") + end + texturew = textureh * def.size.x / def.size.y / (def.aspect_ratio or 1) + end + + objref:set_properties({ + textures={ font:render(text, texturew, textureh, { + lines = def.maxlines or def.lines, + halign = def.halign, + valign = def.valign, + color = def.color} ) }, + visual_size = def.size, + }) + end +else + font_api.on_display_update = function (pos, objref) + minetest.log('error', '[font_api] font_api.on_display_update called but display_api mod not enabled.') + end +end diff --git a/mods/special/display_modpack/font_api/doc/font.svg b/mods/special/display_modpack/font_api/doc/font.svg new file mode 100644 index 0000000..e4e8757 --- /dev/null +++ b/mods/special/display_modpack/font_api/doc/font.svg @@ -0,0 +1,463 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + Texture Height + + Texture Width + + + + MarginTop + Margin Bottom + + Line Height + + + diff --git a/mods/special/display_modpack/font_api/doc/lines.svg b/mods/special/display_modpack/font_api/doc/lines.svg new file mode 100644 index 0000000..f75880f --- /dev/null +++ b/mods/special/display_modpack/font_api/doc/lines.svg @@ -0,0 +1,544 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + Line Height + + + Text Height + Line Spacing + + + + + + + + + diff --git a/mods/special/display_modpack/font_api/fallbacks.lua b/mods/special/display_modpack/font_api/fallbacks.lua new file mode 100644 index 0000000..da3ff03 --- /dev/null +++ b/mods/special/display_modpack/font_api/fallbacks.lua @@ -0,0 +1,175 @@ +--[[ + font_api mod for Minetest - Library creating textures with fonts and text + (c) Pierre-Yves Rollo + + This program 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. + + This program 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 this program. If not, see . +--]] + +-- This is the unicode char fallback map. If a char is not present in +-- font, this maps indicates which char to try to use instead next. + +return { + -- Lowercase chars + ['a'] = 'A', ['b'] = 'B', ['c'] = 'C', ['d'] = 'D', + ['e'] = 'E', ['f'] = 'F', ['g'] = 'G', ['h'] = 'H', + ['i'] = 'I', ['j'] = 'J', ['k'] = 'K', ['l'] = 'L', + ['m'] = 'M', ['n'] = 'N', ['o'] = 'O', ['p'] = 'P', + ['q'] = 'Q', ['r'] = 'R', ['s'] = 'S', ['t'] = 'T', + ['u'] = 'U', ['v'] = 'V', ['w'] = 'W', ['x'] = 'X', + ['y'] = 'Y', ['z'] = 'Z', + + -- Special + ['¢'] = 'c', ['£'] = 'L', ['¥'] = 'Y', ['€'] = 'E', + ['©'] = '(C)', ['®'] = '(R)', ['™'] = 'TM', + ['ª'] = 'a', ['º'] = 'o', + ['«'] = '"', ['»'] = '"', ['´'] = '\'', + ['¹'] = '1', ['²'] = '2', ['³'] = '3', + ['µ'] = 'u', ['¤'] = 'o', + ['¼'] = '1/4', ['½'] = '1/2', ['¾'] = '3/4', + ['⅛'] = '1/8', ['⅜'] = '3/8', ['⅝'] = '5/8', ['⅞'] = '7/8', + ['¿'] = '?', + + -- Upper case accents + ['À'] = 'A', ['Á'] = 'A', ['Â'] = 'A', ['Ã'] = 'A', + ['Ä'] = 'A', ['Å'] = 'A', + ['Æ'] = 'AE', ['Ç'] = 'C', + ['È'] = 'E', ['É'] = 'E', ['Ê'] = 'E', ['Ë'] = 'E', + ['Ì'] = 'I', ['Í'] = 'I', ['Î'] = 'I', ['Ï'] = 'I', + ['Ð'] = 'D', ['Ñ'] = 'N', + ['Ò'] = 'O', ['Ó'] = 'O', ['Ô'] = 'O', ['Õ'] = 'O', + ['Ö'] = 'O', ['Ø'] = 'O', + ['Ú'] = 'U', ['Ù'] = 'U', ['Û'] = 'U', ['Ü'] = 'U', + ['×'] = 'x', ['Ý'] = 'Y', + + -- Lower case accents + ['à'] = 'a', ['à'] = 'a', ['á'] = 'a', ['â'] = 'a', + ['ã'] = 'a', ['ä'] = 'a', ['å'] = 'a', + ['æ'] = 'ae', ['ç'] = 'c', + ['è'] = 'e', ['é'] = 'e', ['ê'] = 'e', ['ë'] = 'e', + ['ì'] = 'i', ['í'] = 'i', ['î'] = 'i', ['ï'] = 'i', + ['ð'] = 'd', ['ñ'] = 'n', + ['ò'] = 'o', ['ó'] = 'o', ['ô'] = 'o', ['õ'] = 'o', + ['ö'] = 'o', ['ø'] = 'o', + ['ù'] = 'u', ['ú'] = 'u', ['û'] = 'u', ['ü'] = 'u', + ['ý'] = 'y', ['ÿ'] = 'y', + + -- Extended latin A + + ['Ā'] = 'A', ['ā'] = 'a', ['Ă'] = 'A', ['ă'] = 'a', + ['Ą'] = 'A', ['ą'] = 'a', ['Ć'] = 'C', ['ć'] = 'c', + ['Ĉ'] = 'C', ['ĉ'] = 'c', ['Ċ'] = 'C', ['ċ'] = 'c', + ['Č'] = 'C', ['č'] = 'c', ['Ď'] = 'D', ['ď'] = 'd', + ['Đ'] = 'D', ['đ'] = 'd', ['Ē'] = 'E', ['ē'] = 'e', + ['Ĕ'] = 'E', ['ĕ'] = 'e', ['Ė'] = 'E', ['ė'] = 'e', + ['Ę'] = 'E', ['ę'] = 'e', ['Ě'] = 'E', ['ě'] = 'e', + ['Ĝ'] = 'G', ['Ğ'] = 'G', ['ğ'] = 'g', ['ĝ'] = 'g', + ['Ġ'] = 'G', ['ġ'] = 'g', ['Ģ'] = 'G', ['ģ'] = 'g', + ['Ĥ'] = 'H', ['ĥ'] = 'h', ['Ħ'] = 'H', ['ħ'] = 'h', + ['Ĩ'] = 'I', ['ĩ'] = 'i', ['Ī'] = 'I', ['ī'] = 'i', + ['Ĭ'] = 'I', ['ĭ'] = 'i', ['Į'] = 'I', ['į'] = 'i', + ['ı'] = 'i', ['İ'] = 'I', ['IJ'] = 'IJ', ['ij'] = 'ij', + ['Ĵ'] = 'J', ['ĵ'] = 'j', ['ķ'] = 'k', ['Ķ'] = 'K', + ['ĸ'] = 'k', + ['Ĺ'] = 'L', ['ĺ'] = 'l', ['Ļ'] = 'L', ['ļ'] = 'l', + ['Ľ'] = 'L', ['ľ'] = 'l', ['Ŀ'] = 'L', ['ŀ'] = 'l', + ['Ł'] = 'L', ['ł'] = 'l', ['Ń'] = 'N', ['ń'] = 'n', + ['Ņ'] = 'N', ['ņ'] = 'n', ['Ň'] = 'N', ['ň'] = 'n', + ['ʼn'] = 'n', ['Ŋ'] = 'n', ['ŋ'] = 'n', + ['Ō'] = 'O', ['ō'] = 'o', ['Ŏ'] = 'O', ['ŏ'] = 'o', + ['ő'] = 'o', ['Ő'] = 'O', ['œ'] = 'oe', ['Œ'] = 'OE', + ['Ŕ'] = 'R', ['ŕ'] = 'r', ['Ŗ'] = 'R', ['ŗ'] = 'r', + ['Ř'] = 'R', ['ř'] = 'r', ['Ś'] = 'S', ['ś'] = 's', + ['Ŝ'] = 'S', ['ŝ'] = 's', ['Ş'] = 'S', ['ş'] = 's', + ['Š'] = 'S', ['š'] = 's', ['Ţ'] = 'T', ['ţ'] = 't', + ['ť'] = 't', ['Ŧ'] = 'T', ['Ť'] = 'T', ['ŧ'] = 't', + ['Ũ'] = 'U', ['ũ'] = 'u', ['Ū'] = 'U', ['ū'] = 'u', + ['Ŭ'] = 'U', ['ŭ'] = 'u', ['Ů'] = 'U', ['ů'] = 'u', + ['Ű'] = 'U', ['ű'] = 'u', ['Ų'] = 'U', ['ų'] = 'u', + ['Ŵ'] = 'W', ['ŵ'] = 'w', ['Ŷ'] = 'Y', ['ŷ'] = 'y', + ['Ÿ'] = 'Y', + ['Ź'] = 'Z', ['ź'] = 'z', ['Ż'] = 'Z', ['ż'] = 'z', + ['Ž'] = 'Z', ['ž'] = 'z', ['ſ'] = 's', + + -- Extended latin B + ['ƀ'] = 'b', ['Ɓ'] = 'B', ['Ƃ'] = 'B', ['ƃ'] = 'b', + ['Ɔ'] = 'O', + ['Ƈ'] = 'C', ['ƈ'] = 'c', ['Ɖ'] = 'D', ['Ɗ'] = 'D', + ['Ƌ'] = 'D', ['ƌ'] = 'd', ['Ǝ'] = 'E', ['Ə'] = 'e', + ['Ɛ'] = 'E', + ['Ƒ'] = 'F', ['ƒ'] = 'f', ['Ɠ'] = 'G', + ['ƕ'] = 'hv', ['Ɨ'] = 'I', ['Ƙ'] = 'K', ['ƙ'] = 'k', + ['ƚ'] = 'l', ['Ɯ'] = 'M', ['Ɲ'] = 'N', ['ƞ'] = 'n', + ['Ɵ'] = 'O', + ['Ơ'] = 'O', ['ơ'] = 'o', ['Ƣ'] = 'OI', ['ƣ'] = 'oi', + ['Ƥ'] = 'P', ['ƥ'] = 'p', ['Ʀ'] = 'YR', + ['Ƨ'] = 'S', ['ƨ'] = 's', ['ƫ'] = 't', + ['Ƭ'] = 'T', ['ƭ'] = 't', ['Ʈ'] = 'T', + ['Ư'] = 'U', ['ư'] = 'u', ['Ʋ'] = 'V', + ['Ƴ'] = 'Y', ['ƴ'] = 'y', ['Ƶ'] = 'Z', ['ƶ'] = 'z', + ['ƻ'] = '2', ['Ƽ'] = '5', ['ƽ'] = '5', + ['DŽ'] = 'DZ', ['Dž'] = 'Dz', ['dž'] = 'dz', + ['LJ'] = 'LJ', ['Lj'] = 'Lj', ['lj'] = 'lj', + ['NJ'] = 'NJ', ['Nj'] = 'Nj', ['nj'] = 'nj', + ['Ǎ'] = 'A', ['ǎ'] = 'a', ['Ǐ'] = 'I', ['ǐ'] = 'i', + ['Ǒ'] = 'O', ['ǒ'] = 'o', ['Ǔ'] = 'U', ['ǔ'] = 'u', + ['Ǖ'] = 'U', ['ǖ'] = 'u', ['Ǘ'] = 'U', ['ǘ'] = 'u', + ['Ǚ'] = 'U', ['ǚ'] = 'u', ['Ǜ'] = 'U', ['ǜ'] = 'u', + ['ǝ'] = 'e', + ['Ǟ'] = 'A', ['ǟ'] = 'a', ['Ǡ'] = 'A', ['ǡ'] = 'a', + ['Ǣ'] = 'Æ', ['ǣ'] = 'æ', ['Ǥ'] = 'G', ['ǥ'] = 'g', + ['Ǧ'] = 'G', ['ǧ'] = 'g', ['Ǩ'] = 'K', ['ǩ'] = 'k', + ['Ǫ'] = 'Q', ['ǫ'] = 'q', ['Ǭ'] = 'Q', ['ǭ'] = 'q', + ['ǰ'] = 'J', + ['DZ'] = 'DZ', ['Dz'] = 'Dz', ['dz'] = 'dz', + ['Ǵ'] = 'G', ['ǵ'] = 'g', ['Ƕ'] = 'H', + ['Ǹ'] = 'N', ['ǹ'] = 'n', ['Ǻ'] = 'A', ['ǻ'] = 'a', + ['Ǽ'] = 'Æ', ['ǽ'] = 'æ', ['Ǿ'] = 'Ø', ['ǿ'] = 'ø', + ['Ȁ'] = 'A', ['ȁ'] = 'a', ['Ȃ'] = 'A', ['ȃ'] = 'a', + ['Ȅ'] = 'E', ['ȅ'] = 'e', ['Ȇ'] = 'E', ['ȇ'] = 'e', + ['Ȉ'] = 'I', ['ȉ'] = 'i', ['Ȋ'] = 'I', ['ȋ'] = 'i', + ['Ȍ'] = 'O', ['ȍ'] = 'o', ['Ȏ'] = 'O', ['ȏ'] = 'o', + ['Ȑ'] = 'R', ['ȑ'] = 'r', ['Ȓ'] = 'R', ['ȓ'] = 'r', + ['Ȕ'] = 'U', ['ȕ'] = 'u', ['Ȗ'] = 'U', ['ȗ'] = 'u', + ['Ș'] = 'S', ['ș'] = 's', ['Ț'] = 'T', ['ț'] = 't', + ['Ȟ'] = 'H', ['ȟ'] = 'h', ['Ƞ'] = 'N', + ['ȡ'] = 'd', + ['Ȣ'] = 'OU', ['ȣ'] = 'ou', ['Ȥ'] = 'Z', ['ȥ'] = 'z', + ['Ȧ'] = 'A', ['ȧ'] = 'a', ['Ȩ'] = 'E', ['ȩ'] = 'e', + ['Ȫ'] = 'O', ['ȫ'] = 'o', ['Ȭ'] = 'O', ['ȭ'] = 'o', + ['Ȯ'] = 'O', ['ȯ'] = 'o', ['Ȱ'] = 'O', ['ȱ'] = 'o', + ['Ȳ'] = 'Y', ['ȳ'] = 'y', ['ȴ'] = 'l', + ['ȵ'] = 'n', ['ȶ'] = 't', ['ȷ'] = 'j', + ['ȸ'] = 'db', ['ȹ'] = 'qp', ['Ⱥ'] = 'A', + ['Ȼ'] = 'C', ['ȼ'] = 'c', ['Ƚ'] = 'L', + ['Ⱦ'] = 'T', ['ȿ'] = 's', ['ɀ'] = 'z', + ['Ƀ'] = 'B', ['Ʉ'] = 'U', ['Ʌ'] = 'V', + ['Ɇ'] = 'E', ['ɇ'] = 'e', ['Ɉ'] = 'J', ['ɉ'] = 'j', + ['Ɋ'] = 'Q', ['ɋ'] = 'q', ['Ɍ'] = 'R', ['ɍ'] = 'r', + ['Ɏ'] = 'Y', ['ɏ'] = 'y', ['ɐ'] = 'a', + ['ɓ'] = 'b', ['ɔ'] = 'o', + ['ɕ'] = 'c', ['ɖ'] = 'd', ['ɗ'] = 'd', + ['ɘ'] = 'e', ['ə'] = 'e', ['ɚ'] = 'e', + ['ɛ'] = 'e', ['ɜ'] = 'e', ['ɝ'] = 'e', ['ɞ'] = 'e', + ['ɟ'] = 'j', + ['ɠ'] = 'g', ['ɡ'] = 'g', ['ɢ'] = 'G', + ['ɥ'] = 'h', ['ɦ'] = 'h', ['ɧ'] = 'h', + ['ɨ'] = 'i', ['ɪ'] = 'I', + ['ɫ'] = 'l', ['ɬ'] = 'l', ['ɭ'] = 'l', + ['ɮ'] = 'lz', + ['ɯ'] = 'm', ['ɰ'] = 'm', ['ɱ'] = 'm', + ['ɲ'] = 'n', ['ɳ'] = 'n', ['ɴ'] = 'N', + ['ɵ'] = 'o', ['ɶ'] = 'Œ', + ['ɹ'] = 'r', ['ɺ'] = 'r', ['ɻ'] = 'r', + ['ɼ'] = 'r', ['ɽ'] = 'r', ['ɾ'] = 'r', ['ɿ'] = 'r', +} diff --git a/mods/special/display_modpack/font_api/font.lua b/mods/special/display_modpack/font_api/font.lua new file mode 100644 index 0000000..5794867 --- /dev/null +++ b/mods/special/display_modpack/font_api/font.lua @@ -0,0 +1,274 @@ +--[[ + font_api mod for Minetest - Library creating textures with fonts and text + (c) Pierre-Yves Rollo + + This program 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. + + This program 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 this program. If not, see . +--]] + +-- Fallback table +local fallbacks = dofile(font_api.path.."/fallbacks.lua") + +-- Local functions +------------------ + +-- Returns number of UTF8 bytes of the first char of the string +local function get_char_bytes(str) + local msb = str:byte(1) + if msb ~= nil then + if msb < 0x80 then return 1 end + if msb >= 0xF0 then return 4 end + if msb >= 0xE0 then return 3 end + if msb >= 0xC2 then return 2 end + end +end + +-- Returns the unicode codepoint of the first char of the string +local function char_to_codepoint(str) + local bytes = get_char_bytes(str) + if bytes == 1 then + return str:byte(1) + elseif bytes == 2 and str:byte(2) ~= nil then + return (str:byte(1) - 0xC2) * 0x40 + + str:byte(2) + elseif bytes == 3 and str:byte(2) ~= nil and str:byte(3) ~= nil then + return (str:byte(1) - 0xE0) * 0x1000 + + str:byte(2) % 0x40 * 0x40 + + str:byte(3) % 0x40 + elseif bytes == 4 and str:byte(2) ~= nil and str:byte(3) ~= nil + and str:byte(4) ~= nil then -- Not tested + return (str:byte(1) - 0xF0) * 0x40000 + + str:byte(2) % 0x40 * 0x1000 + + str:byte(3) % 0x40 * 0x40 + + str:byte(4) % 0x40 + end +end + +-------------------------------------------------------------------------------- +--- Font class + +local Font = {} +font_api.Font = Font + +function Font:new(def) + + if type(def) ~= "table" then + minetest.log("error", + "[font_api] Font definition must be a table.") + return nil + end + + if def.height == nil or def.height <= 0 then + minetest.log("error", + "[font_api] Font definition must have a positive height.") + return nil + end + + if type(def.widths) ~= "table" then + minetest.log("error", + "[font_api] Font definition must have a widths array.") + return nil + end + + if def.widths[0] == nil then + minetest.log("error", + "[font_api] Font must have a char with codepoint 0 (=unknown char).") + return nil + end + + local font = table.copy(def) + setmetatable(font, self) + self.__index = self + + -- Check if fixedwidth + for codepoint, width in pairs(font.widths) do + font.fixedwidth = font.fixedwidth or width + if width ~= font.fixedwidth then + font.fixedwidth = nil + break + end + end + + return font +end + +--- Gets the next char of a text +-- @return Codepoint of first char, +-- @return Remaining string without this first char + +function Font:get_next_char(text) + local bytes = get_char_bytes(text) + + if bytes == nil then + minetest.log("warning", + "[font_api] Encountered a non UTF char, not displaying text.") + return nil, '' + end + + local codepoint = char_to_codepoint(text) + + if codepoint == nil then + minetest.log("warning", + "[font_api] Encountered a non UTF char, not displaying text.") + return nil, '' + end + + -- Fallback mechanism + if self.widths[codepoint] == nil then + local char = text:sub(1, bytes) + + if fallbacks[char] then + return self:get_next_char(fallbacks[char]..text:sub(bytes+1)) + else + return 0, text:sub(bytes+1) -- Ultimate fallback + end + else + return codepoint, text:sub(bytes+1) + end +end + +--- Returns the width of a given char +-- @param char : codepoint of the char +-- @return Char width +function Font:get_char_width(codepoint) + if self.fixedwidth then + return self.fixedwidth + elseif self.widths[codepoint] then + return self.widths[codepoint] + else + return self.widths[0] + end +end + +--- Text height for multiline text including margins and line spacing +-- @param nb_of_lines : number of text lines (default 1) +-- @return Text height + +function Font:get_height(nb_of_lines) + if nb_of_lines == nil then nb_of_lines = 1 end + + if nb_of_lines > 0 then + return + ( + (self.height or 0) + + (self.margintop or 0) + + (self.marginbottom or 0) + ) * nb_of_lines + + (self.linespacing or 0) * (nb_of_lines -1) + else + return nb_of_lines == 0 and 0 or nil + end +end + +--- Computes text width for a given text (ignores new lines) +-- @param line Line of text which the width will be computed. +-- @return Text width + +function Font:get_width(line) + local codepoint + local width = 0 + line = line or '' + + while line ~= "" do + codepoint, line = self:get_next_char(line) + if codepoint == nil then return 0 end -- UTF Error + width = width + self:get_char_width(codepoint) + end + + return width +end + +--- Legacy make_text_texture method (replaced by "render" - Dec 2018) + +function Font:make_text_texture(text, texturew, textureh, maxlines, + halign, valign, color) + return self:render(text, texturew, textureh, { + lines = maxlines, + valign = valign, + halign = halign, + color = color + }) +end + +--- Render text with the font in a view +-- @param text Text to be rendered +-- @param texturew Width (in pixels) of the texture (extra text will be truncated) +-- @param textureh Height (in pixels) of the texture (extra text will be truncated) +-- @param style Style of the rendering: +-- - lines: maximum number of text lines (if text is limited) +-- - halign: horizontal align ("left"/"center"/"right") +-- - valign: vertical align ("top"/"center"/"bottom") +-- - color: color of the text ("#rrggbb") +-- @return Texture string + +function Font:render(text, texturew, textureh, style) + local style = style or {} + + -- Split text into lines (and limit to style.lines # of lines) + local lines = {} + local pos = 1 + local found, line + repeat + found = string.find(text, "\n", pos) or (#text + 1) + line = string.sub(text, pos, found - 1) + lines[#lines + 1] = { text = line, width = self:get_width(line) } + pos = found + 1 + until (style.lines and (#lines >= style.lines)) or (pos > (#text + 1)) + + if not #lines then + return "" + end + + local x, y, codepoint + local texture = "" + local textheight = self:get_height(#lines) + + if style.valign == "top" then + y = 0 + elseif style.valign == "bottom" then + y = textureh - textheight + else + y = (textureh - textheight) / 2 + end + + y = y + (self.margintop or 0) + + for _, line in pairs(lines) do + if style.halign == "left" then + x = 0 + elseif style.halign == "right" then + x = texturew - line.width + else + x = (texturew - line.width) / 2 + end + + while line.text ~= '' do + codepoint, line.text = self:get_next_char(line.text) + if codepoint == nil then return '' end -- UTF Error + + -- Add image only if it is visible (at least partly) + if x + self.widths[codepoint] >= 0 and x <= texturew then + texture = texture.. + string.format(":%d,%d=font_%s_%04x.png", x, y, self.name, codepoint) + end + x = x + self.widths[codepoint] + end + + y = y + self:get_height() + (self.linespacing or 0) + end + texture = string.format("[combine:%dx%d", texturew, textureh)..texture + if style.color then + texture = texture.."^[colorize:"..style.color + end + return texture +end diff --git a/mods/special/display_modpack/font_api/fontform.lua b/mods/special/display_modpack/font_api/fontform.lua new file mode 100644 index 0000000..b7e6724 --- /dev/null +++ b/mods/special/display_modpack/font_api/fontform.lua @@ -0,0 +1,166 @@ +--[[ + font_api mod for Minetest - Library creating textures with fonts and text + (c) Pierre-Yves Rollo + + This program 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. + + This program 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 this program. If not, see . +--]] + +local modname = minetest.get_current_modname() + +local contexts = {} + +minetest.register_on_leaveplayer(function(player) + if minetest.is_player(player) then + contexts[player:get_player_name()] = nil + end +end) + +local function get_context(playername) + if not contexts[playername] then + contexts[playername] = { playername = playername } + end + return contexts[playername] +end + +-- Show node formspec functions +local function show_node_formspec(playername, pos) + local meta = minetest.get_meta(pos) + + -- Decontextualize formspec + local fs = meta:get_string('formspec') + + if not fs then + return + end + + -- Change context and currrent_name references to nodemeta references + -- Change context and currrent_name references to nodemeta references + local nodemeta = string.format("nodemeta:%i,%i,%i", pos.x, pos.y ,pos.z) + fs = fs:gsub("current_name", nodemeta) + fs = fs:gsub("context", nodemeta) + + -- Change all ${} to their corresponding metadata values + local s, e + repeat + s, e = fs:find('%${.*}') + if s and e then + fs = fs:sub(1, s-1).. + minetest.formspec_escape(meta:get_string(fs:sub(s+2,e-1))).. + fs:sub(e+1) + end + until s == nil + + local context = get_context(playername) + context.node_pos = pos + + -- Find node on_receive_fields + local ndef = minetest.registered_nodes[minetest.get_node(pos).name] + if ndef and ndef.on_receive_fields then + context.on_receive_fields = ndef.on_receive_fields + end + + -- Show formspec + minetest.show_formspec(playername, modname..':context_formspec', fs) +end + +minetest.register_on_player_receive_fields(function(player, formname, fields) + if formname ~= modname..':context_formspec' then + return + end + + if not minetest.is_player(player) then + return true + end + + local context = get_context(player:get_player_name()) + if context.on_receive_fields then + context.on_receive_fields(context.pos, '', fields, player) + end + return true +end) + +-- Specific functions + +local function show_font_formspec(playername) + local context = get_context(playername) + local fonts = {} + for name, _ in pairs(font_api.registered_fonts) do + fonts[#fonts+1] = name + end + table.sort(fonts) + + local fs = string.format( + "size[4,%s]%s%s%sbutton_exit[0,%s;4,1;cancel;Cancel]", + #fonts + 0.8, default.gui_bg, default.gui_bg_img, default.gui_slots, + #fonts) + + for line = 1, #fonts do + local font = font_api.get_font(fonts[line]) + local texture = font:make_text_texture(font.name, font:get_height()*5, + font:get_height()*1.2, 1, "center", "top", "#fff") + fs = string.format( + "%simage[0.1,%s;4.5,0.8;%s]button_exit[0,%s;4,1;font_%s;]", + fs, line-0.9, texture, line-1, font.name) + end + minetest.show_formspec(context.playername, modname..':font_list', fs) +end + +minetest.register_on_player_receive_fields(function(player, formname, fields) + if formname ~= modname..':font_list' then + return + end + + if not minetest.is_player(player) then + return true + end + + local playername = player:get_player_name() + local context = get_context(playername) + + if not context.pos + or minetest.is_protected(context.pos, playername) then + return true + end + + if fields.quit == 'true' then + for name, _ in pairs(font_api.registered_fonts) do + if fields['font_'..name] then + local meta = minetest.get_meta(context.pos) + meta:set_string("font", name) + display_api.update_entities(context.pos) + end + end + + if context.callback and type(context.callback) == "function" then + -- Using after to avoid the "double close" bug + minetest.after(0, context.callback, playername, context.pos) + else + -- Using after to avoid the "double close" bug + minetest.after(0, show_node_formspec, playername, context.pos) + end + end + return true +end) + +-- @param player Player viewing the form +-- @param pos Node pos +-- @param callback function(playername, pos) to be called on form close +function font_api.show_font_list(player, pos, callback) + if minetest.is_player(player) then + local context = get_context(player:get_player_name()) + context.pos = pos + context.callback = callback + show_font_formspec(player:get_player_name()) + end +end diff --git a/mods/special/display_modpack/font_api/init.lua b/mods/special/display_modpack/font_api/init.lua new file mode 100644 index 0000000..c5858f4 --- /dev/null +++ b/mods/special/display_modpack/font_api/init.lua @@ -0,0 +1,35 @@ +--[[ + font_api mod for Minetest - Library creating textures with fonts and text + (c) Pierre-Yves Rollo + + This program 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. + + This program 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 this program. If not, see . +--]] + +-- Global variables +------------------- + +font_api = {} +font_api.name = minetest.get_current_modname() +font_api.path = minetest.get_modpath(font_api.name) + +-- Inclusions +------------- + +dofile(font_api.path.."/font.lua") +dofile(font_api.path.."/registry.lua") +dofile(font_api.path.."/fontform.lua") +if minetest.get_modpath("display_api") then + dofile(font_api.path.."/display_api.lua") +end +dofile(font_api.path.."/deprecation.lua") diff --git a/mods/special/display_modpack/font_api/mod.conf b/mods/special/display_modpack/font_api/mod.conf new file mode 100644 index 0000000..1aaccc0 --- /dev/null +++ b/mods/special/display_modpack/font_api/mod.conf @@ -0,0 +1,3 @@ +name=font_api +description=A library for rendernig text on textures +optional_depends=display_api diff --git a/mods/special/display_modpack/font_api/registry.lua b/mods/special/display_modpack/font_api/registry.lua new file mode 100644 index 0000000..e183675 --- /dev/null +++ b/mods/special/display_modpack/font_api/registry.lua @@ -0,0 +1,160 @@ +--[[ + font_api mod for Minetest - Library creating textures with fonts and text + (c) Pierre-Yves Rollo + + This program 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. + + This program 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 this program. If not, see . +--]] + +-- Global variables +------------------- + +font_api.registered_fonts = {} +font_api.registered_fonts_number = 0 + +-- Local variables +------------------ + +local default_font = false + +-- Local functions +------------------ + +-- Gets a default (settings or fist font) +local function get_default_font() + -- First call + if default_font == false then + default_font = nil + + -- First, try with settings + local settings_font = minetest.settings:get("default_font") + + if settings_font ~= nil and settings_font ~= "" then + default_font = font_api.registered_fonts[settings_font] + + if default_font == nil then + minetest.log("warning", "Default font in settings (\"".. + settings_font.."\") is not registered.") + end + end + + -- If failed, choose first font without default = false + if default_font == nil then + for _, font in pairs(font_api.registered_fonts) do + if font.default then + default_font = font + break + end + end + end + + -- If failed, chose first font + if default_font == nil then + for _, font in pairs(font_api.registered_fonts) do + default_font = font + break + end + end + + -- Error, no font registered + if default_font == nil then + minetest.log("error", + "No font registred, unable to choose a default font.") + end + end + + return default_font +end + +--- Returns font object to be used according to font_name +-- @param font_name: Name of the font +-- @return Font object if font found (or default font) + +function font_api.get_font(font_name) + local font = font_api.registered_fonts[font_name] + + if font == nil then + local message + + if font_name == nil then + message = "No font given" + else + message = "Font \""..font_name.."\" unregistered" + end + + font = get_default_font() + + if font ~= nil then + minetest.log("info", message..", using font \""..font.name.."\".") + end + end + + return font +end + +-- API functions +---------------- + +--- Returns de default font name +-- @return Default font name + +function font_api.get_default_font_name() + return get_default_font().name +end + +--- Register a new font +-- Textures corresponding to the font should be named after following patern : +-- font__.png +-- : name of the font +-- : 4 digit hexadecimal unicode of the char +-- @param font_name Name of the font to register +-- If registering different sizes of the same font, add size in the font name +-- (e.g. times_10, times_12...). +-- @param def font definition. A associative array with following keys : +-- @key default True (by default) if this font may be used as default font +-- @key height (mandatory) Height in pixels of all font textures +-- @key widths (mandatory) Array of character widths in pixels, indexed by +-- UTF codepoints +-- @key margintop (optional) Margin (in texture pixels) added on top of each +-- char texture. +-- @key marginbottom (optional) dded at bottom of each char texture. +-- @key linespacing (optional) Spacing (in texture pixels) between each lines. +-- margintop, marginbottom and linespacing can be negative numbers (default 0) +-- and are to be used to adjust various font styles to each other. + +-- TODO: Add something to remove common accent if not defined in font + +function font_api.register_font(font_name, font_def) + + if font_api.registered_fonts[font_name] ~= nil then + minetest.log("error", "Font \""..font_name.."\" already registered.") + return + end + + local font = font_api.Font:new(font_def) + + if font == nil then + minetest.log("error", "Unable to register font \""..font_name.."\".") + return + end + + font.name = font_name + font_api.registered_fonts[font_name] = font + font_api.registered_fonts_number = font_api.registered_fonts_number + 1 + + -- Force to choose again default font + -- (allows use of fonts registered after start) + default_font = false + + minetest.log("action", "New font registered in font_api: "..font_name..".") +end diff --git a/mods/special/display_modpack/font_api/settingtypes.txt b/mods/special/display_modpack/font_api/settingtypes.txt new file mode 100644 index 0000000..d111159 --- /dev/null +++ b/mods/special/display_modpack/font_api/settingtypes.txt @@ -0,0 +1 @@ +default_font(Default font) string diff --git a/mods/special/display_modpack/font_api/textures/font_api_center.png b/mods/special/display_modpack/font_api/textures/font_api_center.png new file mode 100644 index 0000000..967db6a Binary files /dev/null and b/mods/special/display_modpack/font_api/textures/font_api_center.png differ diff --git a/mods/special/display_modpack/font_api/textures/font_api_font.png b/mods/special/display_modpack/font_api/textures/font_api_font.png new file mode 100644 index 0000000..e450338 Binary files /dev/null and b/mods/special/display_modpack/font_api/textures/font_api_font.png differ diff --git a/mods/special/display_modpack/font_api/textures/font_api_left.png b/mods/special/display_modpack/font_api/textures/font_api_left.png new file mode 100644 index 0000000..727410b Binary files /dev/null and b/mods/special/display_modpack/font_api/textures/font_api_left.png differ diff --git a/mods/special/display_modpack/font_api/textures/font_api_right.png b/mods/special/display_modpack/font_api/textures/font_api_right.png new file mode 100644 index 0000000..16401d3 Binary files /dev/null and b/mods/special/display_modpack/font_api/textures/font_api_right.png differ diff --git a/mods/special/display_modpack/font_api/tools/make_font_lua.sh b/mods/special/display_modpack/font_api/tools/make_font_lua.sh new file mode 100755 index 0000000..e858360 --- /dev/null +++ b/mods/special/display_modpack/font_api/tools/make_font_lua.sh @@ -0,0 +1,71 @@ +#!/bin/bash + +scriptname=$(basename $0) +identify="identify" + +usage() { + echo "Usage: $0 fontname" + echo "fontname: The name of the font. Must correspond to existing texture/font__????.png files" +} + +if [ $# -ne 1 ] +then + usage + exit 1 +fi + +font_name=$1 + +for f in textures/font_${font_name}_????.png +do + if [[ $f =~ textures/font_${font_name}_([0-9a-fA-F]{4}).png ]] + then + code=$((16#${BASH_REMATCH[1]})) + size=$(identify $f | cut -d " " -f 3) + w=$(echo $size | cut -d "x" -f 1) + h=$(echo $size | cut -d "x" -f 2) + + if [ -z "$font_height" ] + then + font_height=$h + else + if [ $font_height -ne $h ] + then + echo "Error : $f as height of $h pixels, previous textures have a height of $font_height pixels. All textures should have the same height." + fi + fi + + if [ -z "$font_widths" ] + then + font_widths="[$code]=$w" + else + font_widths="$font_widths, [$code]=$w" + fi + fi +done + +echo "--[[ + +$luafile generated by $scriptname $(LANG=en_US date) + +--]] + +font_api.register_font( + '$font_name', + { + height = $font_height, + widths = { + $font_widths + }, + } +); +" > font_$font_name.lua + +if grep -q font_api depends.txt &>/dev/null +then + echo "font_api already in depends.txt." +else + echo "adding font_api to depends.txt." + echo "font_api" >> depends.txt +fi + diff --git a/mods/special/display_modpack/font_api/tools/make_font_textures.sh b/mods/special/display_modpack/font_api/tools/make_font_textures.sh new file mode 100755 index 0000000..4a3191c --- /dev/null +++ b/mods/special/display_modpack/font_api/tools/make_font_textures.sh @@ -0,0 +1,111 @@ +#!/bin/bash + +# This program generates a bitmap font for font_api mod for Minetest game. +# (c) Andrzej Pieńkowski +# (c) Pierre-Yves Rollo +# License: GPL + +usage() { + echo "Usage: $0 fontfile fontname fontsize" + echo "fontfile: A TTF font file to use to create textures." + echo "fontname: The font name to be used in font_api (should be simple, with no spaces)." + echo "fontsize: Font height to be rendered." +} + +if [ $# -ne 3 ] +then + usage + exit 1 +fi + +fontfile=$1 +fontname=$2 +fontsize=$3 + +if [ ! -r "$fontfile" ] +then + echo "$fontfile not readable." + exit 1 +fi + +# check imagemagick +hash convert &>/dev/null +if [ $? -eq 1 ]; then + echo -e "Error: This program requires convert from ImageMagick! Please install it by typing 'sudo apt-get install imagemagick' in terminal." + abort=1 +fi + +# check ttx +hash ttx &>/dev/null +if [ $? -eq 1 ]; then + echo -e "Error: This program requires ttx from FontTools! Please install it by typing 'sudo apt-get install fonttools' in terminal." + abort=1 +fi + +if [ $abort ] +then + exit 1 +fi + +generate() { + for i in $(seq $((0x$1)) $((0x$2))) + do + if echo "$codepoints" | grep -qi $(printf "0x%x" $i) + then + hex=$(printf "%04x" $i) + echo -e "Generating textures/font_${fontname}_$hex.png file for \"\\U$hex\" char." + if [[ "$hex" == "005c" ]] # Backslash char + then + convert -background none -fill black -font "$fontfile" -pointsize $fontsize label:"\\\\" -colorspace gray -channel alpha -threshold 50% textures/font_${fontname}_$hex.png + else + convert -background none -fill black -font "$fontfile" -pointsize $fontsize label:"$(echo -en "\\U$hex")" -colorspace gray -channel alpha -threshold 50% textures/font_${fontname}_$hex.png + fi + fi + done +} + +mkdir textures + +# Reads all available code points in the font. +codepoints=$(ttx -o - "$fontfile" | grep " + 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/mods/special/display_modpack/ontime_clocks/README.md b/mods/special/display_modpack/ontime_clocks/README.md new file mode 100644 index 0000000..d9db998 --- /dev/null +++ b/mods/special/display_modpack/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/mods/special/display_modpack/ontime_clocks/common.lua b/mods/special/display_modpack/ontime_clocks/common.lua new file mode 100644 index 0000000..cced299 --- /dev/null +++ b/mods/special/display_modpack/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 . +--]] + +-- 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/mods/special/display_modpack/ontime_clocks/copyright.txt b/mods/special/display_modpack/ontime_clocks/copyright.txt new file mode 100644 index 0000000..a2afd94 --- /dev/null +++ b/mods/special/display_modpack/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/mods/special/display_modpack/ontime_clocks/crafts.lua b/mods/special/display_modpack/ontime_clocks/crafts.lua new file mode 100644 index 0000000..c94352a --- /dev/null +++ b/mods/special/display_modpack/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 . +--]] + +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/mods/special/display_modpack/ontime_clocks/depends.txt b/mods/special/display_modpack/ontime_clocks/depends.txt new file mode 100644 index 0000000..07a2ec1 --- /dev/null +++ b/mods/special/display_modpack/ontime_clocks/depends.txt @@ -0,0 +1,5 @@ +default +dye +display_api + +intllib? diff --git a/mods/special/display_modpack/ontime_clocks/init.lua b/mods/special/display_modpack/ontime_clocks/init.lua new file mode 100644 index 0000000..d0ac334 --- /dev/null +++ b/mods/special/display_modpack/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 . +--]] + +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/mods/special/display_modpack/ontime_clocks/intllib.lua b/mods/special/display_modpack/ontime_clocks/intllib.lua new file mode 100644 index 0000000..6669d72 --- /dev/null +++ b/mods/special/display_modpack/ontime_clocks/intllib.lua @@ -0,0 +1,45 @@ + +-- Fallback functions for when `intllib` is not installed. +-- Code released under Unlicense . + +-- 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/mods/special/display_modpack/ontime_clocks/locale/fr.po b/mods/special/display_modpack/ontime_clocks/locale/fr.po new file mode 100644 index 0000000..ed5d2b4 --- /dev/null +++ b/mods/special/display_modpack/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 , 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 \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/mods/special/display_modpack/ontime_clocks/locale/ms.po b/mods/special/display_modpack/ontime_clocks/locale/ms.po new file mode 100644 index 0000000..4d52ac2 --- /dev/null +++ b/mods/special/display_modpack/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. +# Yaya (Nurul Azeera Hidayah @ Muhammad Nur Hidayat) , 2017. +msgid "" +msgstr "" +"Project-Id-Version: Display Modpack\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-08-26 11:21+0200\n" +"PO-Revision-Date: 2020-07-05 11:32+0000\n" +"Last-Translator: Yaya MNH48 \n" +"Language-Team: Malay \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: Poedit 2.3\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/mods/special/display_modpack/ontime_clocks/locale/template.pot b/mods/special/display_modpack/ontime_clocks/locale/template.pot new file mode 100644 index 0000000..dca736f --- /dev/null +++ b/mods/special/display_modpack/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 , 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 \n" +"Language-Team: LANGUAGE \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/mods/special/display_modpack/ontime_clocks/mod.conf b/mods/special/display_modpack/ontime_clocks/mod.conf new file mode 100644 index 0000000..9c1a2e6 --- /dev/null +++ b/mods/special/display_modpack/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/mods/special/display_modpack/ontime_clocks/nodes.lua b/mods/special/display_modpack/ontime_clocks/nodes.lua new file mode 100644 index 0000000..107d2e9 --- /dev/null +++ b/mods/special/display_modpack/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 . +--]] + +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/mods/special/display_modpack/ontime_clocks/textures/ontime_clocks_digital.png b/mods/special/display_modpack/ontime_clocks/textures/ontime_clocks_digital.png new file mode 100644 index 0000000..a4876cd Binary files /dev/null and b/mods/special/display_modpack/ontime_clocks/textures/ontime_clocks_digital.png differ diff --git a/mods/special/display_modpack/ontime_clocks/textures/ontime_clocks_digital_background.png b/mods/special/display_modpack/ontime_clocks/textures/ontime_clocks_digital_background.png new file mode 100644 index 0000000..c416492 Binary files /dev/null and b/mods/special/display_modpack/ontime_clocks/textures/ontime_clocks_digital_background.png differ diff --git a/mods/special/display_modpack/ontime_clocks/textures/ontime_clocks_digital_digit.png b/mods/special/display_modpack/ontime_clocks/textures/ontime_clocks_digital_digit.png new file mode 100644 index 0000000..e5b5448 Binary files /dev/null and b/mods/special/display_modpack/ontime_clocks/textures/ontime_clocks_digital_digit.png differ diff --git a/mods/special/display_modpack/ontime_clocks/textures/ontime_clocks_frameless.png b/mods/special/display_modpack/ontime_clocks/textures/ontime_clocks_frameless.png new file mode 100644 index 0000000..37405d3 Binary files /dev/null and b/mods/special/display_modpack/ontime_clocks/textures/ontime_clocks_frameless.png differ diff --git a/mods/special/display_modpack/ontime_clocks/textures/ontime_clocks_frameless_inventory.png b/mods/special/display_modpack/ontime_clocks/textures/ontime_clocks_frameless_inventory.png new file mode 100644 index 0000000..5960507 Binary files /dev/null and b/mods/special/display_modpack/ontime_clocks/textures/ontime_clocks_frameless_inventory.png differ diff --git a/mods/special/display_modpack/ontime_clocks/textures/ontime_clocks_green_digital_inventory.png b/mods/special/display_modpack/ontime_clocks/textures/ontime_clocks_green_digital_inventory.png new file mode 100644 index 0000000..2bf9043 Binary files /dev/null and b/mods/special/display_modpack/ontime_clocks/textures/ontime_clocks_green_digital_inventory.png differ diff --git a/mods/special/display_modpack/ontime_clocks/textures/ontime_clocks_needle_h36.png b/mods/special/display_modpack/ontime_clocks/textures/ontime_clocks_needle_h36.png new file mode 100644 index 0000000..e08302f Binary files /dev/null and b/mods/special/display_modpack/ontime_clocks/textures/ontime_clocks_needle_h36.png differ diff --git a/mods/special/display_modpack/ontime_clocks/textures/ontime_clocks_needle_h48.png b/mods/special/display_modpack/ontime_clocks/textures/ontime_clocks_needle_h48.png new file mode 100644 index 0000000..1c28ef9 Binary files /dev/null and b/mods/special/display_modpack/ontime_clocks/textures/ontime_clocks_needle_h48.png differ diff --git a/mods/special/display_modpack/ontime_clocks/textures/ontime_clocks_needle_m36.png b/mods/special/display_modpack/ontime_clocks/textures/ontime_clocks_needle_m36.png new file mode 100644 index 0000000..31eb1ae Binary files /dev/null and b/mods/special/display_modpack/ontime_clocks/textures/ontime_clocks_needle_m36.png differ diff --git a/mods/special/display_modpack/ontime_clocks/textures/ontime_clocks_needle_m48.png b/mods/special/display_modpack/ontime_clocks/textures/ontime_clocks_needle_m48.png new file mode 100644 index 0000000..fd83f41 Binary files /dev/null and b/mods/special/display_modpack/ontime_clocks/textures/ontime_clocks_needle_m48.png differ diff --git a/mods/special/display_modpack/ontime_clocks/textures/ontime_clocks_red_digital_inventory.png b/mods/special/display_modpack/ontime_clocks/textures/ontime_clocks_red_digital_inventory.png new file mode 100644 index 0000000..5400167 Binary files /dev/null and b/mods/special/display_modpack/ontime_clocks/textures/ontime_clocks_red_digital_inventory.png differ diff --git a/mods/special/display_modpack/ontime_clocks/textures/ontime_clocks_white.png b/mods/special/display_modpack/ontime_clocks/textures/ontime_clocks_white.png new file mode 100644 index 0000000..e484303 Binary files /dev/null and b/mods/special/display_modpack/ontime_clocks/textures/ontime_clocks_white.png differ diff --git a/mods/special/display_modpack/ontime_clocks/textures/ontime_clocks_white_inventory.png b/mods/special/display_modpack/ontime_clocks/textures/ontime_clocks_white_inventory.png new file mode 100644 index 0000000..7436408 Binary files /dev/null and b/mods/special/display_modpack/ontime_clocks/textures/ontime_clocks_white_inventory.png differ diff --git a/mods/special/display_modpack/ontime_clocks/tools/updatepo.sh b/mods/special/display_modpack/ontime_clocks/tools/updatepo.sh new file mode 100755 index 0000000..feb2504 --- /dev/null +++ b/mods/special/display_modpack/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 diff --git a/mods/special/display_modpack/screenshot.png b/mods/special/display_modpack/screenshot.png new file mode 100644 index 0000000..e6650d2 Binary files /dev/null and b/mods/special/display_modpack/screenshot.png differ diff --git a/mods/special/display_modpack/signs/LICENSE.txt b/mods/special/display_modpack/signs/LICENSE.txt new file mode 100644 index 0000000..341c30b --- /dev/null +++ b/mods/special/display_modpack/signs/LICENSE.txt @@ -0,0 +1,166 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + 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/mods/special/display_modpack/signs/README.md b/mods/special/display_modpack/signs/README.md new file mode 100644 index 0000000..0282d2e --- /dev/null +++ b/mods/special/display_modpack/signs/README.md @@ -0,0 +1,30 @@ +# Signs + +This mod provides various signs 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 + +**License**: Code under LGPL, Textures and models under CC-BY-SA + +## Recipes + +**Poster** + + P P - + P P - + P P - + +P = Paper + +Poster displays only title, much more text can be read by right-clicking on it. + +**Wooden direction sign** + + W W W + W W - + - - - + +W = Wooden Plank (group) + diff --git a/mods/special/display_modpack/signs/common.lua b/mods/special/display_modpack/signs/common.lua new file mode 100644 index 0000000..733a44c --- /dev/null +++ b/mods/special/display_modpack/signs/common.lua @@ -0,0 +1,37 @@ +--[[ + signs mod for Minetest - Various signs with text displayed on + (c) Pierre-Yves Rollo + + This file is part of signs. + + signs 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. + + signs 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 signs. If not, see . +--]] + +local S = signs.intllib +local F = function(...) return minetest.formspec_escape(S(...)) end + +-- Generic callback for show_formspec displayed formspecs of "sign" mod + +minetest.register_on_player_receive_fields(function(player, formname, fields) + local found, _, mod, node_name, pos = formname:find("^([%w_]+):([%w_]+)@([^:]+)") + if found then + if mod ~= 'signs' then return end + + local ndef = minetest.registered_nodes[mod..":"..node_name] + + if ndef and ndef.on_receive_fields then + ndef.on_receive_fields(minetest.string_to_pos(pos), formname, fields, player) + end + end +end) diff --git a/mods/special/display_modpack/signs/compatibility.lua b/mods/special/display_modpack/signs/compatibility.lua new file mode 100644 index 0000000..dea8750 --- /dev/null +++ b/mods/special/display_modpack/signs/compatibility.lua @@ -0,0 +1,117 @@ +--[[ + signs mod for Minetest - Various signs with text displayed on + (c) Pierre-Yves Rollo + + This file is part of signs. + + signs 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. + + signs 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 signs. If not, see . +--]] + + +-- Wallmounted to facedir conversion +------------------------------------ + +local wallmounted_to_facedir = { + [0]=1, -- Should not happend with signs + [1]=1, -- Should not happend with signs + [2]=1, + [3]=3, + [4]=0, + [5]=2 +} + +-- Nodes conversions +local convert_nodes = { + ['signs:wooden_right'] = 'signs:wooden_right_sign', + ['signs:wooden_left'] = 'signs:wooden_left_sign', + ['signs:poster'] = 'signs:paper_poster' +} + +local function compatibility_check_1(pos, node) + -- Old wallmounted modes to new facedir nodes conversion + node.name = convert_nodes[node.name] + if node.name then + node.param2 = wallmounted_to_facedir[node.param2] + display_api.on_destruct(pos) + minetest.swap_node(pos, node) + display_api.on_construct(pos) + end +end + +minetest.register_lbm({ name = "signs:conpatibility_1", + nodenames = {"signs:wooden_right", "signs:wooden_left", "signs:poster"}, + action = compatibility_check_1, +}) + +-- Text entity name change because of signs_lib using signs prefix +------------------------------------------------------------------ + +-- If no other mod registered signs:text, register it. +-- We need to have this entity registered to be able to remove it. +if minetest.registered_entities["signs:text"] == nil then + minetest.register_entity("signs:text", { + collisionbox = { 0, 0, 0, 0, 0, 0 }, + visual = "upright_sprite", + textures = {}, + }) +end + +local function compatibility_check_2(pos, node) + -- Remove old entity + for _, objref in ipairs(minetest.get_objects_inside_radius(pos, 0.5)) do + local entity = objref:get_luaentity() + if entity and entity.name == "signs:text" then + objref:remove() + end + end + -- Create new entity + display_api.update_entities(pos) +end + +minetest.register_lbm({ name = "signs:conpatibility_2", + nodenames = {"signs:wooden_right_sign", "signs:wooden_left_sign", "signs:paper_poster"}, + action = compatibility_check_2, +}) + +--Backwards compatibility API functions + +signs.set_display_text = function(...) + minetest.log("warning", "signs.set_display_text() is deprecated, please use signs_api.set_display_text() instead.") + return signs_api.set_display_text(...) +end + +signs.set_formspec = function(...) + minetest.log("warning", "signs.set_formspec() is deprecated, please use signs_api.set_formspec() instead.") + return signs_api.set_formspec(...) +end + +signs.on_receive_fields = function(...) + minetest.log("warning", "signs.on_receive_fields() is deprecated, please use signs_api.on_receive_fields() instead.") + return signs_api.on_receive_fields(...) +end + +signs.on_place_direction = function(...) + minetest.log("warning", "signs.on_place_direction() is deprecated, please use signs_api.on_place_direction() instead.") + return signs_api.on_place_direction(...) +end + +signs.on_rotate = function(...) + minetest.log("warning", "signs.on_rotate() is deprecated, please use signs_api.on_rotate() instead.") + return signs_api.on_rotate(...) +end + +signs.register_sign = function(...) + minetest.log("warning", "signs.register_sign() is deprecated, please use signs_api.register_sign() instead.") + return signs_api.register_sign(...) +end diff --git a/mods/special/display_modpack/signs/copyright.txt b/mods/special/display_modpack/signs/copyright.txt new file mode 100644 index 0000000..9e3b294 --- /dev/null +++ b/mods/special/display_modpack/signs/copyright.txt @@ -0,0 +1,10 @@ +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 contributors: +(gpcf) +(Thomas--S) +Translations: +Muhammad Nur Hidayat Yasuyoshi (MuhdNurHidayat) +(fat115) + diff --git a/mods/special/display_modpack/signs/crafts.lua b/mods/special/display_modpack/signs/crafts.lua new file mode 100644 index 0000000..4242d5e --- /dev/null +++ b/mods/special/display_modpack/signs/crafts.lua @@ -0,0 +1,61 @@ +minetest.register_craft({ + output = 'signs:wooden_right_sign', + recipe = { + {'group:wood', 'group:wood', 'group:wood'}, + {'group:wood', 'group:wood', 'dye:black'}, + {'', '', ''}, + } +}) + +minetest.register_craft({ + output = 'signs:wooden_right_sign', + type = 'shapeless', + recipe = { 'signs:wooden_long_sign' } +}) + +minetest.register_craft({ + output = 'signs:wooden_long_sign', + recipe = { + {'group:wood', 'dye:black', 'group:wood'}, + {'group:wood', 'group:wood', 'group:wood'}, + {'', '', ''}, + } +}) + +minetest.register_craft({ + output = 'signs:wooden_long_sign', + type = 'shapeless', + recipe = { 'signs:wooden_right_sign' } +}) + +minetest.register_craft({ + output = 'signs:wooden_sign', + recipe = { + {'', 'dye:black', ''}, + {'group:wood', 'group:wood', 'group:wood'}, + {'group:wood', 'group:wood', 'group:wood'}, + } +}) + +minetest.register_craft({ + output = 'signs:paper_poster', + recipe = { + {'default:paper', 'default:paper', 'dye:black'}, + {'default:paper', 'default:paper', ''}, + {'default:paper', 'default:paper', ''}, + } +}) + +minetest.register_craft({ + output = 'signs:label_small', + recipe = { + {'default:paper', 'dye:black'}, + } +}) + +minetest.register_craft({ + output = 'signs:label_medium', + recipe = { + {'default:paper', 'default:paper', 'dye:black'}, + } +}) diff --git a/mods/special/display_modpack/signs/depends.txt b/mods/special/display_modpack/signs/depends.txt new file mode 100644 index 0000000..afeb838 --- /dev/null +++ b/mods/special/display_modpack/signs/depends.txt @@ -0,0 +1,4 @@ +default +dye +signs_api +intllib? diff --git a/mods/special/display_modpack/signs/init.lua b/mods/special/display_modpack/signs/init.lua new file mode 100644 index 0000000..4f9239f --- /dev/null +++ b/mods/special/display_modpack/signs/init.lua @@ -0,0 +1,36 @@ +--[[ + signs mod for Minetest - Various signs with text displayed on + (c) Pierre-Yves Rollo + + This file is part of signs. + + signs 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. + + signs 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 signs. If not, see . +--]] + +signs = {} +signs.name = minetest.get_current_modname() +signs.path = minetest.get_modpath(signs.name) + +-- Load support for intllib. +local S, NS = dofile(signs.path.."/intllib.lua") +signs.intllib = S + +dofile(signs.path.."/common.lua") +dofile(signs.path.."/nodes.lua") +dofile(signs.path.."/crafts.lua") +dofile(signs.path.."/compatibility.lua") + + + + diff --git a/mods/special/display_modpack/signs/intllib.lua b/mods/special/display_modpack/signs/intllib.lua new file mode 100644 index 0000000..6669d72 --- /dev/null +++ b/mods/special/display_modpack/signs/intllib.lua @@ -0,0 +1,45 @@ + +-- Fallback functions for when `intllib` is not installed. +-- Code released under Unlicense . + +-- 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/mods/special/display_modpack/signs/locale/fr.po b/mods/special/display_modpack/signs/locale/fr.po new file mode 100644 index 0000000..7a00544 --- /dev/null +++ b/mods/special/display_modpack/signs/locale/fr.po @@ -0,0 +1,54 @@ +# 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 , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-08-26 13:20+0200\n" +"PO-Revision-Date: 2017-05-08 07:08+0200\n" +"Last-Translator: Peppy \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" + +#: common.lua nodes.lua +msgid "Text" +msgstr "Texte" + +#: common.lua nodes.lua +msgid "Write" +msgstr "Écrire" + +#: common.lua +#, lua-format +msgid " (first %s lines only)" +msgstr " (uniquement les %s premières lignes)" + +#: nodes.lua +msgid "Title" +msgstr "Titre" + +#: nodes.lua +msgid "Close" +msgstr "Fermer" + +#: nodes.lua +msgid "(right-click to read more text)" +msgstr "(Clic-droit pour afficher le texte entier)" + +#: nodes.lua +msgid "Wooden direction sign" +msgstr "Panneau de direction en bois" + +#: nodes.lua +msgid "Poster" +msgstr "Affiche" + +#~ msgid "Textd" +#~ msgstr "Texte" diff --git a/mods/special/display_modpack/signs/locale/ms.po b/mods/special/display_modpack/signs/locale/ms.po new file mode 100644 index 0000000..defee7b --- /dev/null +++ b/mods/special/display_modpack/signs/locale/ms.po @@ -0,0 +1,51 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Yaya (Nurul Azeera Hidayah @ Muhammad Nur Hidayat) , 2017. +msgid "" +msgstr "" +"Project-Id-Version: Display Modpack\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-08-26 13:20+0200\n" +"PO-Revision-Date: 2020-07-05 11:34+0000\n" +"Last-Translator: Yaya MNH48 \n" +"Language-Team: Malay \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: Poedit 2.3\n" + +#: common.lua nodes.lua +msgid "Text" +msgstr "Teks" + +#: common.lua nodes.lua +msgid "Write" +msgstr "Tulis" + +#: common.lua +#, lua-format +msgid " (first %s lines only)" +msgstr " (%s baris pertama sahaja)" + +#: nodes.lua +msgid "Title" +msgstr "Tajuk" + +#: nodes.lua +msgid "Close" +msgstr "Tutup" + +#: nodes.lua +msgid "(right-click to read more text)" +msgstr "(klik-kanan untuk baca teks penuh)" + +#: nodes.lua +msgid "Wooden direction sign" +msgstr "Papan tanda arah kayu" + +#: nodes.lua +msgid "Poster" +msgstr "Poster" diff --git a/mods/special/display_modpack/signs/locale/template.pot b/mods/special/display_modpack/signs/locale/template.pot new file mode 100644 index 0000000..a1fc065 --- /dev/null +++ b/mods/special/display_modpack/signs/locale/template.pot @@ -0,0 +1,51 @@ +# 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 , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-08-26 13:20+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: common.lua nodes.lua +msgid "Text" +msgstr "" + +#: common.lua nodes.lua +msgid "Write" +msgstr "" + +#: common.lua +#, lua-format +msgid " (first %s lines only)" +msgstr "" + +#: nodes.lua +msgid "Title" +msgstr "" + +#: nodes.lua +msgid "Close" +msgstr "" + +#: nodes.lua +msgid "(right-click to read more text)" +msgstr "" + +#: nodes.lua +msgid "Wooden direction sign" +msgstr "" + +#: nodes.lua +msgid "Poster" +msgstr "" diff --git a/mods/special/display_modpack/signs/mod.conf b/mods/special/display_modpack/signs/mod.conf new file mode 100644 index 0000000..81d1358 --- /dev/null +++ b/mods/special/display_modpack/signs/mod.conf @@ -0,0 +1,4 @@ +name=signs +description=Basic signs and posters with text display using signs_api +depends=default,dye,signs_api +optional_depends=intllib diff --git a/mods/special/display_modpack/signs/models/signs_dir_left.obj b/mods/special/display_modpack/signs/models/signs_dir_left.obj new file mode 100644 index 0000000..91ead2d --- /dev/null +++ b/mods/special/display_modpack/signs/models/signs_dir_left.obj @@ -0,0 +1,51 @@ +# Blender v2.76 (sub 0) OBJ File: 'signs_dir_right.blend' +# www.blender.org +mtllib signs_dir_right.mtl +o Plane +v -0.500000 0.218750 0.437500 +v -0.500000 -0.218750 0.437500 +v 0.250000 0.218750 0.437500 +v 0.250000 -0.218750 0.437500 +v 0.437500 -0.000000 0.437500 +v -0.500000 0.218750 0.500000 +v -0.500000 -0.218750 0.500000 +v 0.250000 0.218750 0.500000 +v 0.250000 -0.218750 0.500000 +v 0.437500 -0.000000 0.500000 +vt 0.062500 0.500000 +vt 0.062500 0.937500 +vt 0.812500 0.937500 +vt 1.000000 0.718750 +vt 0.812500 0.500000 +vt 0.062500 0.437500 +vt 0.812500 0.437500 +vt 1.000000 0.218750 +vt 0.812500 0.000000 +vt 0.062500 0.000000 +vt 1.000000 0.312500 +vt 0.937500 0.312500 +vt 0.937500 0.625000 +vt 1.000000 0.625000 +vt 0.062500 1.000000 +vt 0.812500 1.000000 +vt 0.000000 0.312500 +vt 0.062500 0.312500 +vt 0.000000 0.000000 +vt 0.000000 0.500000 +vt 0.000000 0.937500 +vn 0.000000 0.000000 -1.000000 +vn 0.000000 0.000000 1.000000 +vn 0.759300 0.650800 0.000000 +vn 0.000000 1.000000 0.000000 +vn -0.000000 -1.000000 0.000000 +vn 0.759300 -0.650800 -0.000000 +vn -1.000000 0.000000 0.000000 +usemtl None +s off +f 2/1/1 1/2/1 3/3/1 5/4/1 4/5/1 +f 7/6/2 9/7/2 10/8/2 8/9/2 6/10/2 +f 3/11/3 8/12/3 10/13/3 5/14/3 +f 1/2/4 6/15/4 8/16/4 3/3/4 +f 4/5/5 9/7/5 7/6/5 2/1/5 +f 5/17/6 10/18/6 9/10/6 4/19/6 +f 2/1/7 7/20/7 6/21/7 1/2/7 diff --git a/mods/special/display_modpack/signs/models/signs_dir_right.obj b/mods/special/display_modpack/signs/models/signs_dir_right.obj new file mode 100644 index 0000000..6597bfd --- /dev/null +++ b/mods/special/display_modpack/signs/models/signs_dir_right.obj @@ -0,0 +1,51 @@ +# Blender v2.76 (sub 0) OBJ File: 'signs_dir_left.blend' +# www.blender.org +mtllib signs_dir_left.mtl +o Plane +v 0.500000 -0.218750 0.437500 +v 0.500000 0.218750 0.437500 +v -0.250000 -0.218750 0.437500 +v -0.250000 0.218750 0.437500 +v -0.437500 -0.000000 0.437500 +v 0.500000 -0.218750 0.500000 +v 0.500000 0.218750 0.500000 +v -0.250000 -0.218750 0.500000 +v -0.250000 0.218750 0.500000 +v -0.437500 -0.000000 0.500000 +vt 0.062500 0.500000 +vt 0.062500 0.937500 +vt 0.812500 0.937500 +vt 1.000000 0.718750 +vt 0.812500 0.500000 +vt 0.062500 0.437500 +vt 0.812500 0.437500 +vt 1.000000 0.218750 +vt 0.812500 0.000000 +vt 0.062500 0.000000 +vt 1.000000 0.312500 +vt 0.937500 0.312500 +vt 0.937500 0.625000 +vt 1.000000 0.625000 +vt 0.062500 1.000000 +vt 0.812500 1.000000 +vt 0.000000 0.312500 +vt 0.062500 0.312500 +vt 0.000000 0.000000 +vt 0.000000 0.500000 +vt 0.000000 0.937500 +vn -0.000000 0.000000 -1.000000 +vn 0.000000 -0.000000 1.000000 +vn -0.759300 -0.650800 -0.000000 +vn 0.000000 -1.000000 -0.000000 +vn -0.000000 1.000000 0.000000 +vn -0.759300 0.650800 0.000000 +vn 1.000000 0.000000 0.000000 +usemtl None +s off +f 2/1/1 1/2/1 3/3/1 5/4/1 4/5/1 +f 7/6/2 9/7/2 10/8/2 8/9/2 6/10/2 +f 3/11/3 8/12/3 10/13/3 5/14/3 +f 1/2/4 6/15/4 8/16/4 3/3/4 +f 4/5/5 9/7/5 7/6/5 2/1/5 +f 5/17/6 10/18/6 9/10/6 4/19/6 +f 2/1/7 7/20/7 6/21/7 1/2/7 diff --git a/mods/special/display_modpack/signs/nodes.lua b/mods/special/display_modpack/signs/nodes.lua new file mode 100644 index 0000000..7c238c4 --- /dev/null +++ b/mods/special/display_modpack/signs/nodes.lua @@ -0,0 +1,253 @@ +--[[ + signs mod for Minetest - Various signs with text displayed on + (c) Pierre-Yves Rollo + + This file is part of signs. + + signs 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. + + signs 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 signs. If not, see . +--]] + +local S = signs.intllib +local F = function(...) return minetest.formspec_escape(S(...)) end + +-- Poster specific formspec +local function display_poster(pos, node, player) + local meta = minetest.get_meta(pos) + + local def = minetest.registered_nodes[node.name].display_entities["signs:display_text"] + local font = font_api.get_font(meta:get_string("font") or def.font_name) + + local fs + local fname = string.format("%s@%s:display", + node.name, minetest.pos_to_string(pos)) + + -- Title texture + local titletexture = font:render(meta:get_string("display_text"), + font:get_height()*8.4, font:get_height(), { lines = 1 }) + + fs = string.format([=[ + size[7,9]bgcolor[#0000] + background[0,0;7,9;signs_poster_formspec.png] + image[0,-0.2;8.4,2;%s] + style_type[textarea;textcolor=#111] + textarea[0.3,1.5;7,8;;%s;]]=], + titletexture, + minetest.colorize("#111", + minetest.formspec_escape(meta:get_string("text")))) + + if minetest.is_protected(pos, player:get_player_name()) then + fs = string.format("%sbutton_exit[2.5,8;2,1;ok;%s]", fs, F("Close")) + else + fs = string.format( + "%sbutton[1,8;2,1;edit;%s]button_exit[4,8;2,1;ok;%s]", + fs, F("Edit"), F("Close")) + end + minetest.show_formspec(player:get_player_name(), fname, fs) +end + +local function edit_poster(pos, node, player) + local meta = minetest.get_meta(pos) + + local fs + local fname = string.format("%s@%s:edit", + node.name, minetest.pos_to_string(pos)) + + if not minetest.is_protected(pos, player:get_player_name()) then + fs = string.format([=[ + size[6.5,7.5]%s%s%s + field[0.5,0.7;6,1;display_text;%s;%s] + textarea[0.5,1.7;6,6;text;%s;%s] + button[1.25,7;2,1;font;%s] + button_exit[3.25,7;2,1;write;%s]]=], + default.gui_bg, default.gui_bg_img, default.gui_slots, F("Title"), + minetest.formspec_escape(meta:get_string("display_text")), + F("Text"), minetest.formspec_escape(meta:get_string("text")), + F("Title font"), F("Write")) + minetest.show_formspec(player:get_player_name(), fname, fs) + end +end + +-- Poster specific on_receive_fields callback +local function on_receive_fields_poster(pos, formname, fields, player) + local meta = minetest.get_meta(pos) + local node = minetest.get_node(pos) + + if not minetest.is_protected(pos, player:get_player_name()) and fields then + if formname == node.name.."@"..minetest.pos_to_string(pos)..":display" + and fields.edit then + edit_poster(pos, node, player) + return true + end + if formname == node.name.."@"..minetest.pos_to_string(pos)..":edit" + then + if (fields.write or fields.font or fields.key_enter) then + meta:set_string("display_text", fields.display_text) + meta:set_string("text", fields.text) + meta:set_string("infotext", "\""..fields.display_text + .."\"\n"..S("(right-click to read more text)")) + display_api.update_entities(pos) + end + if (fields.write or fields.key_enter) then + display_poster(pos, node, player) + elseif (fields.font) then + font_api.show_font_list(player, pos, function (playername, pos) + local player = minetest.get_player_by_name(playername) + local node = minetest.get_node(pos) + if player and node then + edit_poster(pos, node, player) + end + end) + end + return true + end + end +end + +-- Text entity for all signs +display_api.register_display_entity("signs:display_text") + +-- Sign models and registration +local models = { + wooden_sign = { + depth = 1/16, width = 14/16, height = 12/16, + entity_fields = { + size = { x = 12/16, y = 10/16 }, + maxlines = 3, + color = "#000", + }, + node_fields = { + description = S("Wooden sign"), + tiles = { "signs_wooden.png" }, + inventory_image = "signs_wooden_inventory.png", + groups= { dig_immediate = 2 }, + }, + }, + wooden_long_sign = { + depth = 1/16, width = 1, height = 7/16, + entity_fields = { + size = { x = 1, y = 6/16 }, + maxlines = 2, + color = "#000", + }, + node_fields = { + description = S("Wooden long sign"), + tiles = { "signs_wooden_long.png", "signs_wooden_long.png", + "signs_wooden_long.png^[transformR90", + "signs_wooden_long.png^[transformR90", + "signs_wooden_long.png", "signs_wooden_long.png", + }, + inventory_image = "signs_wooden_long_inventory.png", + groups= { dig_immediate = 2 }, + }, + }, + wooden_right_sign = { + depth = 1/16, width = 14/16, height = 7/16, + entity_fields = { + right = -3/32, + size = { x = 12/16, y = 6/16 }, + maxlines = 2, + color="#000", + }, + node_fields = { + description = S("Wooden direction sign"), + tiles = { "signs_wooden_direction.png" }, + inventory_image = "signs_wooden_direction_inventory.png", + signs_other_dir = 'signs:wooden_left_sign', + on_place = signs_api.on_place_direction, + drawtype = "mesh", + mesh = "signs_dir_right.obj", + selection_box = { type="fixed", fixed = {-0.5, -7/32, 0.5, 7/16, 7/32, 7/16}}, + collision_box = { type="fixed", fixed = {-0,5, -7/32, 0.5, 7/16, 7/32, 7/16}}, + groups= { dig_immediate = 2 }, + }, + }, + wooden_left_sign = { + depth = 1/16, width = 14/16, height = 7/16, + entity_fields = { + right = 3/32, + size = { x = 12/16, y = 6/16 }, + maxlines = 2, + color = "#000", + }, + node_fields = { + description = S("Wooden direction sign"), + tiles = { "signs_wooden_direction.png" }, + inventory_image = "signs_wooden_direction_inventory.png", + signs_other_dir = 'signs:wooden_right_sign', + drawtype = "mesh", + mesh = "signs_dir_left.obj", + selection_box = { type="fixed", fixed = {-7/16, -7/32, 0.5, 0.5, 7/32, 7/16}}, + collision_box = { type="fixed", fixed = {-7/16, -7/32, 0.5, 0.5, 7/32, 7/16}}, + groups = { not_in_creative_inventory = 1, dig_immediate = 2 }, + drop = "signs:wooden_right_sign", + }, + }, + paper_poster = { + depth = 1/32, width = 26/32, height = 30/32, + entity_fields = { + top = -11/32, + size = { x = 26/32, y = 6/32 }, + maxlines = 1, + color = "#000", + }, + node_fields = { + description = S("Poster"), + tiles = { "signs_poster_sides.png", "signs_poster_sides.png", + "signs_poster_sides.png", "signs_poster_sides.png", + "signs_poster_sides.png", "signs_poster.png" }, + inventory_image = "signs_poster_inventory.png", + groups= { dig_immediate = 3 }, + on_construct = display_api.on_construct, + on_rightclick = display_poster, + on_receive_fields = on_receive_fields_poster, + on_punch = function(pos, node, player, pointed_thing) + display_api.update_entities(pos) + end, + }, + }, + label_small = { + depth = 1/32, width = 4/16, height = 4/16, + entity_fields = { + size = { x = 4/16, y = 4/16 }, + maxlines = 1, + color = "#000", + }, + node_fields = { + description = S("Small label"), + tiles = { "signs_label.png" }, + inventory_image = "signs_label_small_inventory.png", + groups= { dig_immediate = 3 }, + }, + }, + label_medium = { + depth = 1/32, width = 8/16, height = 8/16, + entity_fields = { + size = { x = 8/16, y = 8/16 }, + maxlines = 2, + color = "#000", + }, + node_fields = { + description = S("Label"), + tiles = { "signs_label.png" }, + inventory_image = "signs_label_medium_inventory.png", + groups= { dig_immediate = 3 }, + }, + }, +} + +-- Node registration +for name, model in pairs(models) +do + signs_api.register_sign("signs", name, model) +end diff --git a/mods/special/display_modpack/signs/svg/black_direction.svg b/mods/special/display_modpack/signs/svg/black_direction.svg new file mode 100644 index 0000000..8e9b8a9 --- /dev/null +++ b/mods/special/display_modpack/signs/svg/black_direction.svg @@ -0,0 +1,128 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/mods/special/display_modpack/signs/svg/blue_street.svg b/mods/special/display_modpack/signs/svg/blue_street.svg new file mode 100644 index 0000000..0aa87ff --- /dev/null +++ b/mods/special/display_modpack/signs/svg/blue_street.svg @@ -0,0 +1,139 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + diff --git a/mods/special/display_modpack/signs/svg/green_street.svg b/mods/special/display_modpack/signs/svg/green_street.svg new file mode 100644 index 0000000..5d87509 --- /dev/null +++ b/mods/special/display_modpack/signs/svg/green_street.svg @@ -0,0 +1,104 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/mods/special/display_modpack/signs/svg/poster-formspec.svg b/mods/special/display_modpack/signs/svg/poster-formspec.svg new file mode 100644 index 0000000..1aa8fa2 --- /dev/null +++ b/mods/special/display_modpack/signs/svg/poster-formspec.svg @@ -0,0 +1,88 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/mods/special/display_modpack/signs/svg/poster.svg b/mods/special/display_modpack/signs/svg/poster.svg new file mode 100644 index 0000000..cc9e8fd --- /dev/null +++ b/mods/special/display_modpack/signs/svg/poster.svg @@ -0,0 +1,465 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + +   + + + + + + + + diff --git a/mods/special/display_modpack/signs/textures/signs_label.png b/mods/special/display_modpack/signs/textures/signs_label.png new file mode 100644 index 0000000..fa38e6a Binary files /dev/null and b/mods/special/display_modpack/signs/textures/signs_label.png differ diff --git a/mods/special/display_modpack/signs/textures/signs_label_medium_inventory.png b/mods/special/display_modpack/signs/textures/signs_label_medium_inventory.png new file mode 100644 index 0000000..9b9b67a Binary files /dev/null and b/mods/special/display_modpack/signs/textures/signs_label_medium_inventory.png differ diff --git a/mods/special/display_modpack/signs/textures/signs_label_small_inventory.png b/mods/special/display_modpack/signs/textures/signs_label_small_inventory.png new file mode 100644 index 0000000..86946dd Binary files /dev/null and b/mods/special/display_modpack/signs/textures/signs_label_small_inventory.png differ diff --git a/mods/special/display_modpack/signs/textures/signs_poster.png b/mods/special/display_modpack/signs/textures/signs_poster.png new file mode 100644 index 0000000..c00b036 Binary files /dev/null and b/mods/special/display_modpack/signs/textures/signs_poster.png differ diff --git a/mods/special/display_modpack/signs/textures/signs_poster_formspec.png b/mods/special/display_modpack/signs/textures/signs_poster_formspec.png new file mode 100644 index 0000000..7b85bdf Binary files /dev/null and b/mods/special/display_modpack/signs/textures/signs_poster_formspec.png differ diff --git a/mods/special/display_modpack/signs/textures/signs_poster_inventory.png b/mods/special/display_modpack/signs/textures/signs_poster_inventory.png new file mode 100644 index 0000000..da06997 Binary files /dev/null and b/mods/special/display_modpack/signs/textures/signs_poster_inventory.png differ diff --git a/mods/special/display_modpack/signs/textures/signs_poster_sides.png b/mods/special/display_modpack/signs/textures/signs_poster_sides.png new file mode 100644 index 0000000..0cf32d6 Binary files /dev/null and b/mods/special/display_modpack/signs/textures/signs_poster_sides.png differ diff --git a/mods/special/display_modpack/signs/textures/signs_wooden.png b/mods/special/display_modpack/signs/textures/signs_wooden.png new file mode 100644 index 0000000..bff6324 Binary files /dev/null and b/mods/special/display_modpack/signs/textures/signs_wooden.png differ diff --git a/mods/special/display_modpack/signs/textures/signs_wooden_direction.png b/mods/special/display_modpack/signs/textures/signs_wooden_direction.png new file mode 100644 index 0000000..bf85a34 Binary files /dev/null and b/mods/special/display_modpack/signs/textures/signs_wooden_direction.png differ diff --git a/mods/special/display_modpack/signs/textures/signs_wooden_direction_inventory.png b/mods/special/display_modpack/signs/textures/signs_wooden_direction_inventory.png new file mode 100644 index 0000000..32c49ca Binary files /dev/null and b/mods/special/display_modpack/signs/textures/signs_wooden_direction_inventory.png differ diff --git a/mods/special/display_modpack/signs/textures/signs_wooden_inventory.png b/mods/special/display_modpack/signs/textures/signs_wooden_inventory.png new file mode 100644 index 0000000..e8e821d Binary files /dev/null and b/mods/special/display_modpack/signs/textures/signs_wooden_inventory.png differ diff --git a/mods/special/display_modpack/signs/textures/signs_wooden_long.png b/mods/special/display_modpack/signs/textures/signs_wooden_long.png new file mode 100644 index 0000000..6b64a95 Binary files /dev/null and b/mods/special/display_modpack/signs/textures/signs_wooden_long.png differ diff --git a/mods/special/display_modpack/signs/textures/signs_wooden_long_inventory.png b/mods/special/display_modpack/signs/textures/signs_wooden_long_inventory.png new file mode 100644 index 0000000..f584b8c Binary files /dev/null and b/mods/special/display_modpack/signs/textures/signs_wooden_long_inventory.png differ diff --git a/mods/special/display_modpack/signs/tools/updatepo.sh b/mods/special/display_modpack/signs/tools/updatepo.sh new file mode 100755 index 0000000..feb2504 --- /dev/null +++ b/mods/special/display_modpack/signs/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 diff --git a/mods/special/display_modpack/signs_api/LICENSE.txt b/mods/special/display_modpack/signs_api/LICENSE.txt new file mode 100644 index 0000000..341c30b --- /dev/null +++ b/mods/special/display_modpack/signs_api/LICENSE.txt @@ -0,0 +1,166 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + 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/mods/special/display_modpack/signs_api/README.md b/mods/special/display_modpack/signs_api/README.md new file mode 100644 index 0000000..38e8d96 --- /dev/null +++ b/mods/special/display_modpack/signs_api/README.md @@ -0,0 +1,33 @@ +# Signs API + +This mod provides various helper functions for registereing signs with text display. Text is locked if area is protected. +No actual signs get registered by this mod, the signs are defined in the sign submod. + +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 + +**License**: Code under LGPL, Textures and models under CC-BY-SA + +## API Functions +### `signs_api.set_display_text(pos, text)` +Sets the text of a sign. Usually called in `on_receive_fields`. + +### `signs_api.set_formspec(pos)` +Usually called in `on_construct` to set the formspec. + +### `signs_api.on_receive_fields(pos, formname, fields, player)` +Helper function for `on_receive_fields`. Sets the display text and checks for protection. + +### `signs_api.on_place_direction(itemstack, placer, pointed_thing)` +On place callback for direction signs (chooses which sign according to look direction). + +### `signs_api.on_rotate(pos, node, player, mode, new_param2)` +Handles screwdriver rotation. Direction is affected for direction signs. + +### `signs_api.register_sign(mod, name, model)` +A method to quickly register signs. + +## Changelog +### 2019-03-14 +- __sign_api__: Screwdriver behavior changed. Now, left click rotates and changes direction. diff --git a/mods/special/display_modpack/signs_api/copyright.txt b/mods/special/display_modpack/signs_api/copyright.txt new file mode 100644 index 0000000..b70e051 --- /dev/null +++ b/mods/special/display_modpack/signs_api/copyright.txt @@ -0,0 +1,10 @@ +Code by Pierre-Yves Rollo (pyrollo) +intllib support (i18n) by (fat115) +intllib fallback code and tools by Diego Martínez (kaeza) +Extra contributors: +(gpcf) +(Thomas--S) +Translations: +Muhammad Nur Hidayat Yasuyoshi (MuhdNurHidayat) +(fat115) + diff --git a/mods/special/display_modpack/signs_api/depends.txt b/mods/special/display_modpack/signs_api/depends.txt new file mode 100644 index 0000000..f75ffcc --- /dev/null +++ b/mods/special/display_modpack/signs_api/depends.txt @@ -0,0 +1,4 @@ +default +intllib? +display_api +font_api diff --git a/mods/special/display_modpack/signs_api/init.lua b/mods/special/display_modpack/signs_api/init.lua new file mode 100644 index 0000000..1bd00d6 --- /dev/null +++ b/mods/special/display_modpack/signs_api/init.lua @@ -0,0 +1,251 @@ +--[[ + signs mod for Minetest - Various signs with text displayed on + (c) Pierre-Yves Rollo + + This file is part of signs. + + signs 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. + + signs 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 signs. If not, see . +--]] + +signs_api = {} +signs_api.name = minetest.get_current_modname() +signs_api.path = minetest.get_modpath(signs_api.name) + +-- Load support for intllib. +local S, NS = dofile(signs_api.path.."/intllib.lua") +signs_api.intllib = S +local F = function(...) return minetest.formspec_escape(S(...)) end + +function signs_api.set_display_text(pos, text, font) + local meta = minetest.get_meta(pos) + meta:set_string("display_text", text) + if text and text ~= "" then + meta:set_string("infotext", "\""..text.."\"") + else + meta:set_string("infotext", "") + end + if font then + meta:set_string("font", font) + end + display_api.update_entities(pos) +end + +function signs_api.set_formspec(pos) + local meta = minetest.get_meta(pos) + local ndef = minetest.registered_nodes[minetest.get_node(pos).name] + if ndef and ndef.display_entities + and ndef.display_entities["signs:display_text"] then + local maxlines = ndef.display_entities["signs:display_text"].maxlines + local fs, y + + if maxlines == 1 then + fs = "field[0.5,0.7;5.5,1;display_text;"..F("Text").. + ";${display_text}]" + y = 1.2 + else + local extralabel = "" + if maxlines then + extralabel = F(" (first %s lines only)"):format(maxlines) + end + + fs = "textarea[0.5,0.7;5.5,2;display_text;"..F("Text").."".. + extralabel..";${display_text}]" + y = 2.4 + end + + fs = fs.."button[1,"..y..";2,1;font;"..F("Font").."]" + fs = fs.."button_exit[3,"..y..";2,1;ok;"..F("Write").."]" + y = y + 0.8 + fs = "size[6,"..y.."]"..default.gui_bg.. + default.gui_bg_img..default.gui_slots..fs + + meta:set_string("formspec", fs) + end +end + +function signs_api.on_receive_fields(pos, formname, fields, player) + if not minetest.is_protected(pos, player:get_player_name()) then + if fields and (fields.ok or fields.key_enter) then + signs_api.set_display_text(pos, fields.display_text) + end + if fields and (fields.font) then + signs_api.set_display_text(pos, fields.display_text) + font_api.show_font_list(player, pos) + end + end +end + +-- On place callback for direction signs +-- (chooses which sign according to look direction) +function signs_api.on_place_direction(itemstack, placer, pointed_thing) + local name = itemstack:get_name() + local ndef = minetest.registered_nodes[name] + local restriction = display_api.is_rotation_restricted() + + local bdir = { + x = pointed_thing.under.x - pointed_thing.above.x, + y = pointed_thing.under.y - pointed_thing.above.y, + z = pointed_thing.under.z - pointed_thing.above.z} + + local pdir = placer:get_look_dir() + + local ndir, test + + if ndef.paramtype2 == "facedir" then + -- If legacy mode, only accept upright nodes + if restriction and bdir.x == 0 and bdir.z == 0 then + -- Ceiling or floor pointed (facedir chosen from player dir) + ndir = minetest.dir_to_facedir({x=pdir.x, y=0, z=pdir.z}) + else + -- Wall pointed or no rotation restriction + ndir = minetest.dir_to_facedir(bdir, not restriction) + end + + test = { [0]=-pdir.x, pdir.z, pdir.x, -pdir.z, -pdir.x, [8]=pdir.x } + end + + if ndef.paramtype2 == "wallmounted" then + ndir = minetest.dir_to_wallmounted(bdir) + -- If legacy mode, only accept upright nodes + if restriction and (ndir == 0 or ndir == 1) then + ndir = minetest.dir_to_wallmounted({x=pdir.x, y=0, z=pdir.z}) + end + + test = { [0]=-pdir.x, -pdir.x, pdir.z, -pdir.z, -pdir.x, pdir.x} + end + + -- Only for direction signs + -- TODO:Maybe improve ground and ceiling placement in every directions + if ndef.signs_other_dir then + if test[ndir] > 0 then + itemstack:set_name(ndef.signs_other_dir) + end + itemstack = minetest.item_place(itemstack, placer, pointed_thing, ndir) + itemstack:set_name(name) + + return itemstack + else + return minetest.item_place(itemstack, placer, pointed_thing, ndir) + end +end + +-- Handles screwdriver rotation +-- (see "if" block below for rotation restriction mode). +signs_api.on_rotate = function(pos, node, player, mode, new_param2) + -- If rotation mode is 1 and sign is directional, swap direction between + -- each rotation. + if mode == 1 then + local ndef = minetest.registered_nodes[node.name] + if ndef.signs_other_dir then + -- Switch direction + node = {name = ndef.signs_other_dir, + param1 = node.param1, param2 = node.param2} + minetest.swap_node(pos, node) + display_api.update_entities(pos) + -- Rotate only if not "main" sign + -- TODO:Improve detection of "main" direction sign + if ndef.groups and ndef.groups.not_in_creative_inventory then + return display_api.on_rotate(pos, node, player, mode, new_param2) + else + return true + end + end + end + return display_api.on_rotate(pos, node, player, mode, new_param2) +end + +-- Legacy mode with rotation restriction +-- TODO:When MT < 5.0 no more in use, to be removed +if display_api.is_rotation_restricted() then + signs_api.on_rotate = function(pos, node, player, mode, new_param2) + -- If rotation mode is 2 and sign is directional, swap direction. + -- Otherwise use display_api's on_rotate function. + if mode == 2 then + local ndef = minetest.registered_nodes[node.name] + if ndef.signs_other_dir then + minetest.swap_node(pos, {name = ndef.signs_other_dir, + param1 = node.param1, param2 = node.param2}) + display_api.update_entities(pos) + return true + end + end + return display_api.on_rotate(pos, node, player, mode, new_param2) + end +end + +function signs_api.register_sign(mod, name, model) + -- Default fields + local fields = { + sunlight_propagates = true, + paramtype = "light", + paramtype2 = "facedir", + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = {-model.width/2, -model.height/2, 0.5, + model.width/2, model.height/2, 0.5 - model.depth}, + }, + groups = {choppy=2, dig_immediate=2, not_blocking_trains=1, display_api=1}, + sounds = default.node_sound_defaults(), + display_entities = { + ["signs:display_text"] = { + on_display_update = font_api.on_display_update, + depth = 0.5 - display_api.entity_spacing - model.depth, + size = { x = model.width, y = model.height }, + aspect_ratio = 1/2, + maxlines = 1, + }, + + }, + on_place = display_api.on_place, + on_construct = function(pos) + local ndef = minetest.registered_nodes[minetest.get_node(pos).name] + local meta = minetest.get_meta(pos) + meta:set_string("font", ndef.display_entities.font_name or + font_api.get_default_font_name()) + signs_api.set_formspec(pos) + display_api.on_construct(pos) + end, + on_destruct = display_api.on_destruct, + on_rotate = signs_api.on_rotate, + on_receive_fields = signs_api.on_receive_fields, + on_punch = function(pos, node, player, pointed_thing) + signs_api.set_formspec(pos) + display_api.update_entities(pos) + end, + } + + -- Node fields override + for key, value in pairs(model.node_fields) do + if key == "groups" then + for key2, value2 in pairs(value) do + fields[key][key2] = value2 + end + else + fields[key] = value + end + end + + if not fields.wield_image then fields.wield_image = fields.inventory_image end + + -- Entity fields override + for key, value in pairs(model.entity_fields) do + fields.display_entities["signs:display_text"][key] = value + end + + minetest.register_node(mod..":"..name, fields) +end + +-- Text entity for all signs +display_api.register_display_entity("signs:display_text") diff --git a/mods/special/display_modpack/signs_api/intllib.lua b/mods/special/display_modpack/signs_api/intllib.lua new file mode 100644 index 0000000..6669d72 --- /dev/null +++ b/mods/special/display_modpack/signs_api/intllib.lua @@ -0,0 +1,45 @@ + +-- Fallback functions for when `intllib` is not installed. +-- Code released under Unlicense . + +-- 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/mods/special/display_modpack/signs_api/locale/fr.po b/mods/special/display_modpack/signs_api/locale/fr.po new file mode 100644 index 0000000..e490d1b --- /dev/null +++ b/mods/special/display_modpack/signs_api/locale/fr.po @@ -0,0 +1,49 @@ +# 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 , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-02-01 05:56+0100\n" +"PO-Revision-Date: 2017-05-08 07:08+0200\n" +"Last-Translator: Peppy \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" + +#: common.lua +msgid "Text" +msgstr "Texte" + +#: common.lua +msgid "Write" +msgstr "Écrire" + +#: common.lua +#, lua-format +msgid " (first %s lines only)" +msgstr " (uniquement les %s premières lignes)" + +#~ msgid "Title" +#~ msgstr "Titre" + +#~ msgid "Close" +#~ msgstr "Fermer" + +#~ msgid "(right-click to read more text)" +#~ msgstr "(Clic-droit pour afficher le texte entier)" + +#~ msgid "Wooden direction sign" +#~ msgstr "Panneau de direction en bois" + +#~ msgid "Poster" +#~ msgstr "Affiche" + +#~ msgid "Textd" +#~ msgstr "Texte" diff --git a/mods/special/display_modpack/signs_api/locale/ms.po b/mods/special/display_modpack/signs_api/locale/ms.po new file mode 100644 index 0000000..0d90222 --- /dev/null +++ b/mods/special/display_modpack/signs_api/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. +# Yaya (Nurul Azeera Hidayah @ Muhammad Nur Hidayat) , 2017. +msgid "" +msgstr "" +"Project-Id-Version: Display Modpack\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-02-01 05:56+0100\n" +"PO-Revision-Date: 2020-07-05 11:31+0000\n" +"Last-Translator: Yaya MNH48 \n" +"Language-Team: Malay \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: Poedit 2.3\n" + +#: common.lua +msgid "Text" +msgstr "Teks" + +#: common.lua +msgid "Write" +msgstr "Tulis" + +#: common.lua +#, lua-format +msgid " (first %s lines only)" +msgstr " (%s baris pertama sahaja)" + +#~ msgid "Title" +#~ msgstr "Tajuk" + +#~ msgid "Close" +#~ msgstr "Tutup" + +#~ msgid "(right-click to read more text)" +#~ msgstr "(klik-kanan untuk baca teks penuh)" + +#~ msgid "Wooden direction sign" +#~ msgstr "Papan tanda arah kayu" + +#~ msgid "Poster" +#~ msgstr "Poster" diff --git a/mods/special/display_modpack/signs_api/locale/template.pot b/mods/special/display_modpack/signs_api/locale/template.pot new file mode 100644 index 0000000..6004024 --- /dev/null +++ b/mods/special/display_modpack/signs_api/locale/template.pot @@ -0,0 +1,31 @@ +# 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 , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-02-01 05:56+0100\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: common.lua +msgid "Text" +msgstr "" + +#: common.lua +msgid "Write" +msgstr "" + +#: common.lua +#, lua-format +msgid " (first %s lines only)" +msgstr "" diff --git a/mods/special/display_modpack/signs_api/mod.conf b/mods/special/display_modpack/signs_api/mod.conf new file mode 100644 index 0000000..94ebf6a --- /dev/null +++ b/mods/special/display_modpack/signs_api/mod.conf @@ -0,0 +1,4 @@ +name=signs_api +description=A library providing various helper functions for registereing signs with text display +depends=default,display_api,font_api +optional_depends=intllib diff --git a/mods/special/display_modpack/signs_api/tools/updatepo.sh b/mods/special/display_modpack/signs_api/tools/updatepo.sh new file mode 100755 index 0000000..feb2504 --- /dev/null +++ b/mods/special/display_modpack/signs_api/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 diff --git a/mods/special/display_modpack/signs_road/LICENSE.txt b/mods/special/display_modpack/signs_road/LICENSE.txt new file mode 100644 index 0000000..341c30b --- /dev/null +++ b/mods/special/display_modpack/signs_road/LICENSE.txt @@ -0,0 +1,166 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + 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/mods/special/display_modpack/signs_road/README.md b/mods/special/display_modpack/signs_road/README.md new file mode 100644 index 0000000..0a2f685 --- /dev/null +++ b/mods/special/display_modpack/signs_road/README.md @@ -0,0 +1,76 @@ +# Signs Road + +This mod provides road signs 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, signs + +**License**: Code under LGPL, texture under CC-BY-SA + +## Recipes + +**Blue Street Sign** + + B W - + S S S + - - - + +B = Blue Dye, W = White Dye, S = Steel Ingot + +**Large Banner** + +Shapeless recipe : four white street signs. + + S S S + S - - + - - - + +S = White street sign + +**Red and White Street Sign** + + W R - + S S S + - - - + +W = White Dye, R = Red Dye, S = Steel Ingot + +**Black direction sign** + + B W S + S S - + - - - + +B = Black Dye, W = White Dye, S = Steel Ingot + +**White Signs** + +Two kinds of signs, normal and direction signs : + + W B - W B S + S S S S S - + - - - - - - + +W = White Dye, B = Black Dye, S = Steel Ingot + +**Green Signs** + +Two kinds of signs, normal and direction signs : + + G W - G W S + S S S S S - + - - - - - - + +G = Green Dye, W = White Dye, S = Steel Ingot + +**Yellow Signs** + +Two kinds of signs, normal and direction signs : + + Y B - Y B S + S S S S S - + - - - - - - + +Y = Yellow Dye, B = Black Dye, S = Steel Ingot + diff --git a/mods/special/display_modpack/signs_road/compatibility.lua b/mods/special/display_modpack/signs_road/compatibility.lua new file mode 100644 index 0000000..5fb673a --- /dev/null +++ b/mods/special/display_modpack/signs_road/compatibility.lua @@ -0,0 +1,90 @@ +--[[ + signs mod for Minetest - Various signs with text displayed on + (c) Pierre-Yves Rollo + + This file is part of signs. + + signs 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. + + signs 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 signs. If not, see . +--]] + +-- Wallmounted to facedir conversion +------------------------------------ + +local wallmounted_to_facedir = { + [0]=1, -- Should not happend with signs + [1]=1, -- Should not happend with signs + [2]=1, + [3]=3, + [4]=0, + [5]=2 +} + +-- Nodes conversions +local convert_nodes = { + ['signs_road:blue_street'] = 'signs_road:blue_street_sign', + ['signs_road:green_street'] = 'signs_road:green_street_sign', + ['signs_road:black_right'] = 'signs_road:black_right_sign', + ['signs_road:black_left'] = 'signs_road:black_left_sign', + ['signs_road:green_right'] = 'signs_road:green_right_sign', + ['signs_road:green_left'] = 'signs_road:green_left_sign' +} + +local function compatibility_check(pos, node) + -- Old wallmounted modes to new facedir nodes conversion + node.name = convert_nodes[node.name] + if node.name then + node.param2 = wallmounted_to_facedir[node.param2] + display_api.on_destruct(pos) + minetest.swap_node(pos, node) + display_api.on_construct(pos) + end +end + +minetest.register_lbm({ name = "signs_road:conpatibility_1", + nodenames = {'signs_road:blue_street', 'signs_road:green_street', 'signs_road:black_right', + 'signs_road:black_left', 'signs_road:green_right', 'signs_road:green_left'}, + action = compatibility_check, +}) + +-- Text entity name change because of signs_lib using signs prefix +------------------------------------------------------------------ + +local function compatibility_check_2(pos, node) + -- Remove old entity + for _, objref in ipairs(minetest.get_objects_inside_radius(pos, 0.5)) do + local entity = objref:get_luaentity() + if entity and entity.name == "signs:text" then + objref:remove() + end + end + -- Create new entity + display_api.update_entities(pos) +end + +minetest.register_lbm({ name = "signs_road:conpatibility_2", + nodenames = { + "signs_road:blue_street_sign", "signs_road:red_street_sign", "signs_road:white_street_sign", + "signs_road:green_street_sign", "signs_road:yellow_street_sign", "signs_road:black_right_sign", + "signs_road:black_left_sign", "signs_road:green_right_sign", "signs_road:green_left_sign", + "signs_road:yellow_right_sign", "signs_road:yellow_left_sign", "signs_road:white_right_sign", + "signs_road:white_left_sign"}, + action = compatibility_check_2, +}) + +-- Node name tidy up +-------------------- + +minetest.register_alias("signs_road:green_street_sign", "signs_road:green_sign") +minetest.register_alias("signs_road:yellow_street_sign", "signs_road:yellow_sign") +minetest.register_alias("signs_road:white_street_sign", "signs_road:white_sign") diff --git a/mods/special/display_modpack/signs_road/copyright.txt b/mods/special/display_modpack/signs_road/copyright.txt new file mode 100644 index 0000000..bb7adc8 --- /dev/null +++ b/mods/special/display_modpack/signs_road/copyright.txt @@ -0,0 +1,9 @@ +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 contributors: +(gpcf) +(Thomas--S) +Translations: +Muhammad Nur Hidayat Yasuyoshi (MuhdNurHidayat) +(fat115) diff --git a/mods/special/display_modpack/signs_road/crafts.lua b/mods/special/display_modpack/signs_road/crafts.lua new file mode 100644 index 0000000..314a91a --- /dev/null +++ b/mods/special/display_modpack/signs_road/crafts.lua @@ -0,0 +1,201 @@ +--[[ + signs_road mod for Minetest - Various road signs with text displayed + on. + (c) Pierre-Yves Rollo + + This file is part of signs_road. + + signs_road 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. + + signs_road 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 signs_road. If not, see . +--]] + +-- Standard rectangle signs + +minetest.register_craft({ + output = 'signs_road:white_sign 2', + recipe = { + {'dye:white', 'dye:black', ''}, + {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, + {'', '', ''}, + } +}) + +minetest.register_craft({ + output = 'signs_road:blue_sign 2', + recipe = { + {'dye:blue', 'dye:white', ''}, + {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, + {'', '', ''}, + } +}) + +minetest.register_craft({ + output = 'signs_road:green_sign 2', + recipe = { + {'dye:green', 'dye:white', ''}, + {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, + {'', '', ''}, + } +}) + +minetest.register_craft({ + output = 'signs_road:yellow_sign 2', + recipe = { + {'dye:yellow', 'dye:black', ''}, + {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, + {'', '', ''}, + } +}) + +minetest.register_craft({ + output = 'signs_road:red_sign 2', + recipe = { + {'dye:red', 'dye:white', ''}, + {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, + {'', '', ''}, + } +}) + +-- Standard direction signs + +minetest.register_craft({ + output = 'signs_road:black_right_sign 2', + recipe = { + {'dye:black', 'dye:white', 'default:steel_ingot'}, + {'default:steel_ingot', 'default:steel_ingot', ''}, + {'', '', ''}, + } +}) + +minetest.register_craft({ + output = 'signs_road:white_right_sign 2', + recipe = { + {'dye:white', 'dye:black', 'default:steel_ingot'}, + {'default:steel_ingot', 'default:steel_ingot', ''}, + {'', '', ''}, + } +}) + +minetest.register_craft({ + output = 'signs_road:blue_right_sign 2', + recipe = { + {'dye:blue', 'dye:white', 'default:steel_ingot'}, + {'default:steel_ingot', 'default:steel_ingot', ''}, + {'', '', ''}, + } +}) + +minetest.register_craft({ + output = 'signs_road:green_right_sign 2', + recipe = { + {'dye:green', 'dye:white', 'default:steel_ingot'}, + {'default:steel_ingot', 'default:steel_ingot', ''}, + {'', '', ''}, + } +}) + +minetest.register_craft({ + output = 'signs_road:yellow_right_sign 2', + recipe = { + {'dye:yellow', 'dye:black', 'default:steel_ingot'}, + {'default:steel_ingot', 'default:steel_ingot', ''}, + {'', '', ''}, + } +}) + +minetest.register_craft({ + output = 'signs_road:red_right_sign 2', + recipe = { + {'dye:red', 'dye:white', 'default:steel_ingot'}, + {'default:steel_ingot', 'default:steel_ingot', ''}, + {'', '', ''}, + } +}) + +-- Transform Rectangle <-> Direction + +minetest.register_craft({ + type = 'shapeless', output = 'signs_road:white_right_sign', + recipe = {'signs_road:white_sign'}, +}) + +minetest.register_craft({ + type = 'shapeless', output = 'signs_road:white_sign', + recipe = {'signs_road:white_right_sign'}, +}) + +minetest.register_craft({ + type = 'shapeless', output = 'signs_road:blue_right_sign', + recipe = {'signs_road:blue_sign'}, +}) + +minetest.register_craft({ + type = 'shapeless', output = 'signs_road:blue_sign', + recipe = {'signs_road:blue_right_sign'}, +}) + +minetest.register_craft({ + type = 'shapeless', output = 'signs_road:green_right_sign', + recipe = {'signs_road:green_sign'}, +}) + +minetest.register_craft({ + type = 'shapeless', output = 'signs_road:green_sign', + recipe = {'signs_road:green_right_sign'}, +}) + +minetest.register_craft({ + type = 'shapeless', output = 'signs_road:yellow_right_sign', + recipe = {'signs_road:yellow_sign'}, +}) + +minetest.register_craft({ + type = 'shapeless', output = 'signs_road:yellow_sign', + recipe = {'signs_road:yellow_right_sign'}, +}) + +minetest.register_craft({ + type = 'shapeless', output = 'signs_road:red_right_sign', + recipe = {'signs_road:red_sign'}, +}) + +minetest.register_craft({ + type = 'shapeless', output = 'signs_road:red_sign', + recipe = {'signs_road:red_right_sign'}, +}) + +-- Various signs + +minetest.register_craft({ + output = 'signs_road:blue_street_sign 4', + recipe = { + {'dye:blue', 'dye:white', 'dye:blue'}, + {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, + {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, + } +}) + +minetest.register_craft({ + output = 'signs_road:red_street_sign 2', + recipe = { + {'dye:white', 'dye:red', 'dye:black'}, + {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, + {'', '', ''}, + } +}) + +minetest.register_craft({ + type = "shapeless", + output = 'signs_road:large_street_sign', + recipe = {'signs_road:white_street_sign', 'signs_road:white_street_sign', 'signs_road:white_street_sign', 'signs_road:white_street_sign'}, +}) diff --git a/mods/special/display_modpack/signs_road/depends.txt b/mods/special/display_modpack/signs_road/depends.txt new file mode 100644 index 0000000..38a5f41 --- /dev/null +++ b/mods/special/display_modpack/signs_road/depends.txt @@ -0,0 +1,4 @@ +default +intllib? +dye +signs_api diff --git a/mods/special/display_modpack/signs_road/init.lua b/mods/special/display_modpack/signs_road/init.lua new file mode 100644 index 0000000..cd95c6c --- /dev/null +++ b/mods/special/display_modpack/signs_road/init.lua @@ -0,0 +1,37 @@ +--[[ + signs_road mod for Minetest - Various road signs with text displayed + on. + (c) Pierre-Yves Rollo + + This file is part of signs_road. + + signs_road 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. + + signs_road 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 signs_road. If not, see . +--]] + +signs_road = {} +signs_road.name = minetest.get_current_modname() +signs_road.path = minetest.get_modpath(signs_road.name) + +-- Load support for intllib. +local S, NS = dofile(signs_road.path.."/intllib.lua") +signs_road.intllib = S + +dofile(signs_road.path.."/nodes.lua") +dofile(signs_road.path.."/crafts.lua") +dofile(signs_road.path.."/compatibility.lua") + + + + + diff --git a/mods/special/display_modpack/signs_road/intllib.lua b/mods/special/display_modpack/signs_road/intllib.lua new file mode 100644 index 0000000..6669d72 --- /dev/null +++ b/mods/special/display_modpack/signs_road/intllib.lua @@ -0,0 +1,45 @@ + +-- Fallback functions for when `intllib` is not installed. +-- Code released under Unlicense . + +-- 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/mods/special/display_modpack/signs_road/locale/fr.po b/mods/special/display_modpack/signs_road/locale/fr.po new file mode 100644 index 0000000..833f115 --- /dev/null +++ b/mods/special/display_modpack/signs_road/locale/fr.po @@ -0,0 +1,56 @@ +# 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 , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-08-26 11:26+0200\n" +"PO-Revision-Date: 2017-05-08 06:40+0200\n" +"Last-Translator: Peppy \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 "Blue street sign" +msgstr "Plaque de rue bleue" + +#: nodes.lua +msgid "Red and white town sign" +msgstr "Panneau de ville rouge et blanc" + +#: nodes.lua +msgid "White street sign" +msgstr "Panneau blanc" + +#: nodes.lua +msgid "Green street sign" +msgstr "Panneau vert" + +#: nodes.lua +msgid "Yellow street sign" +msgstr "Panneau jaune" + +#: nodes.lua +msgid "Black direction sign" +msgstr "Panneau de direction noir" + +#: nodes.lua +msgid "Green direction sign" +msgstr "Panneau de direction vert" + +#: nodes.lua +msgid "Yellow direction sign" +msgstr "Panneau de direction jaune" + +#: nodes.lua +msgid "White direction sign" +msgstr "Panneau de direction blanc" + diff --git a/mods/special/display_modpack/signs_road/locale/ms.po b/mods/special/display_modpack/signs_road/locale/ms.po new file mode 100644 index 0000000..30ba158 --- /dev/null +++ b/mods/special/display_modpack/signs_road/locale/ms.po @@ -0,0 +1,54 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Yaya (Nurul Azeera Hidayah @ Muhammad Nur Hidayat) , 2017. +msgid "" +msgstr "" +"Project-Id-Version: Display Modpack\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-08-26 11:28+0200\n" +"PO-Revision-Date: 2020-07-05 11:32+0000\n" +"Last-Translator: Yaya MNH48 \n" +"Language-Team: Malay \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: Poedit 2.3\n" + +#: nodes.lua +msgid "Blue street sign" +msgstr "Papan tanda jalan biru" + +#: nodes.lua +msgid "Red and white town sign" +msgstr "Papan tanda bandar merah dan putih" + +#: nodes.lua +msgid "White street sign" +msgstr "Papan tanda jalan putih" + +#: nodes.lua +msgid "Green street sign" +msgstr "Papan tanda jalan hijau" + +#: nodes.lua +msgid "Yellow street sign" +msgstr "Papan tanda jalan kuning" + +#: nodes.lua +msgid "Black direction sign" +msgstr "Papan tanda arah hitam" + +#: nodes.lua +msgid "Green direction sign" +msgstr "Papan tanda arah hijau" + +#: nodes.lua +msgid "Yellow direction sign" +msgstr "Papan tanda arah kuning" + +#: nodes.lua +msgid "White direction sign" +msgstr "Papan tanda arah putih" diff --git a/mods/special/display_modpack/signs_road/locale/template.pot b/mods/special/display_modpack/signs_road/locale/template.pot new file mode 100644 index 0000000..b15ce94 --- /dev/null +++ b/mods/special/display_modpack/signs_road/locale/template.pot @@ -0,0 +1,54 @@ +# 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 , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-08-26 11:28+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: nodes.lua +msgid "Blue street sign" +msgstr "" + +#: nodes.lua +msgid "Red and white town sign" +msgstr "" + +#: nodes.lua +msgid "White street sign" +msgstr "" + +#: nodes.lua +msgid "Green street sign" +msgstr "" + +#: nodes.lua +msgid "Yellow street sign" +msgstr "" + +#: nodes.lua +msgid "Black direction sign" +msgstr "" + +#: nodes.lua +msgid "Green direction sign" +msgstr "" + +#: nodes.lua +msgid "Yellow direction sign" +msgstr "" + +#: nodes.lua +msgid "White direction sign" +msgstr "" diff --git a/mods/special/display_modpack/signs_road/mod.conf b/mods/special/display_modpack/signs_road/mod.conf new file mode 100644 index 0000000..83ae231 --- /dev/null +++ b/mods/special/display_modpack/signs_road/mod.conf @@ -0,0 +1,4 @@ +name=signs_road +description=Various road signs with text display using signs_api +depends=default,dye,signs_api +optional_depends=intllib diff --git a/mods/special/display_modpack/signs_road/nodes.lua b/mods/special/display_modpack/signs_road/nodes.lua new file mode 100644 index 0000000..74eca23 --- /dev/null +++ b/mods/special/display_modpack/signs_road/nodes.lua @@ -0,0 +1,451 @@ +--[[ + signs_road mod for Minetest - Various road signs with text displayed + on. + (c) Pierre-Yves Rollo + + This file is part of signs_road. + + signs_road 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. + + signs_road 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 signs_road. If not, see . +--]] + +local S = signs_road.intllib + +local models = { + blue_street_sign = { + depth = 1/16, + width = 14/16, + height = 12/16, + entity_fields = { + size = { x = 14/16, y = 10/16 }, + maxlines = 3, + color = "#fff", + }, + node_fields = { + description = S("Blue street sign"), + tiles = { "signs_road_sides.png", "signs_road_sides.png", + "signs_road_sides.png", "signs_road_sides.png", + "signs_road_sides.png", "signs_road_blue_street.png" }, + inventory_image = "signs_road_blue_street.png", + }, + }, + large_street_sign = { + depth = 1/16, + width = 64/16, + height = 12/16, + entity_fields = { + maxlines = 1, + color = "#000", + }, + node_fields = { + visual_scale = 1, + description = S("Large banner"), + tiles = { "signs_road_sides.png", "signs_road_sides.png", + "signs_road_sides.png", "signs_road_sides.png", + "signs_road_sides.png", "signs_road_large_white.png" }, + inventory_image = "signs_road_white.png", + }, + }, + red_street_sign = { + depth = 1/16, + width = 1, + height = 7/16, + entity_fields = { + size = { x = 1, y = 4/16 }, + maxlines = 1, + color = "#000", + }, + node_fields = { + description = S("Red and white town sign"), + tiles = { "signs_road_sides.png", "signs_road_sides.png", + "signs_road_sides.png", "signs_road_sides.png", + "signs_road_sides.png", "signs_road_red_white.png" }, + inventory_image="signs_road_red_white.png", + }, + }, + white_sign = { + depth = 1/16, + width = 1, + height = 7/16, + entity_fields = { + size = { x = 1, y = 6/16 }, + maxlines = 2, + color = "#000", + }, + node_fields = { + description = S("White street sign"), + tiles = { "signs_road_sides.png", "signs_road_sides.png", + "signs_road_sides.png", "signs_road_sides.png", + "signs_road_sides.png", "signs_road_white.png" }, + inventory_image = "signs_road_white.png", + }, + }, + blue_sign = { + depth = 1/16, + width = 1, + height = 7/16, + entity_fields = { + size = { x = 1, y = 6/16 }, + maxlines = 2, + color = "#fff", + }, + node_fields = { + description = S("Blue road sign"), + tiles = { "signs_road_sides.png", "signs_road_sides.png", + "signs_road_sides.png", "signs_road_sides.png", + "signs_road_sides.png", "signs_road_blue.png" }, + inventory_image = "signs_road_blue.png", + }, + }, + green_sign = { + depth = 1/16, + width = 1, + height = 7/16, + entity_fields = { + size = { x = 1, y = 6/16 }, + maxlines = 2, + color = "#fff", + }, + node_fields = { + description = S("Green road sign"), + tiles = { "signs_road_sides.png", "signs_road_sides.png", + "signs_road_sides.png", "signs_road_sides.png", + "signs_road_sides.png", "signs_road_green.png" }, + inventory_image = "signs_road_green.png", + }, + }, + yellow_sign = { + depth = 1/16, + width = 1, + height = 7/16, + entity_fields = { + size = { x = 1, y = 6/16 }, + maxlines = 2, + color = "#000", + }, + node_fields = { + description = S("Yellow road sign"), + tiles = { "signs_road_sides.png", "signs_road_sides.png", + "signs_road_sides.png", "signs_road_sides.png", + "signs_road_sides.png", "signs_road_yellow.png" }, + inventory_image="signs_road_yellow.png", + }, + }, + red_sign = { + depth = 1/16, + width = 1, + height = 7/16, + entity_fields = { + size = { x = 1, y = 6/16 }, + maxlines = 2, + color = "#fff", + }, + node_fields = { + description = S("Red road sign"), + tiles = { "signs_road_sides.png", "signs_road_sides.png", + "signs_road_sides.png", "signs_road_sides.png", + "signs_road_sides.png", "signs_road_red.png" }, + inventory_image = "signs_road_red.png", + }, + }, + black_right_sign = { + depth = 1/32, + width = 1, + height = 0.5, + entity_fields = { + aspect_ratio = 3/4, + size = { x = 1, y = 3/16 }, + maxlines = 1, + color = "#000", + }, + node_fields = { + description = S("Black direction sign"), + tiles = { "signs_road_sides.png", "signs_road_sides.png", + "signs_road_sides.png", "signs_road_sides.png", + "signs_road_sides.png", "signs_road_black_dir_right.png" }, + inventory_image = "signs_road_black_dir_inventory.png", + signs_other_dir = "signs_road:black_left_sign", + on_place = signs_api.on_place_direction, + on_rightclick = signs_api.on_right_click_direction, + }, + }, + black_left_sign = { + depth = 1/32, + width = 1, + height = 0.5, + entity_fields = { + aspect_ratio = 3/4, + size = { x = 1, y = 3/16 }, + maxlines = 1, + color = "#000", + }, + node_fields = { + description = S("Black direction sign"), + tiles = { "signs_road_sides.png", "signs_road_sides.png", + "signs_road_sides.png", "signs_road_sides.png", + "signs_road_sides.png", "signs_road_black_dir_left.png" }, + inventory_image = "signs_road_black_dir_inventory.png", + signs_other_dir = "signs_road:black_right_sign", + groups = { not_in_creative_inventory = 1 }, + drop = "signs_road:black_right_sign", + on_place = signs_api.on_place_direction, + on_rightclick = signs_api.on_right_click_direction, + }, + }, + white_right_sign = { + depth = 1/16, + width = 14/16, + height = 7/16, + entity_fields = { + right = -3/32, + size = { x = 12/16, y = 6/16 }, + maxlines = 2, + color = "#000", + }, + node_fields = { + description = S("White direction sign"), + tiles = { "signs_road_white_direction.png" }, + inventory_image = "signs_road_white_dir_inventory.png", + signs_other_dir = "signs_road:white_left_sign", + on_place = signs_api.on_place_direction, + on_rightclick = signs_api.on_right_click_direction, + drawtype = "mesh", + mesh = "signs_dir_right.obj", + selection_box = { type = "fixed", fixed = { -0.5, -7/32, 0.5, 7/16, 7/32, 7/16 } }, + collision_box = { type = "fixed", fixed = { -0.5, -7/32, 0.5, 7/16, 7/32, 7/16 } }, + }, + }, + white_left_sign = { + depth = 1/16, + width = 14/16, + height = 7/16, + entity_fields = { + right = 3/32, + size = { x = 12/16, y = 6/16 }, + maxlines = 2, + color = "#000", + }, + node_fields = { + description = S("White direction sign"), + tiles = { "signs_road_white_direction.png" }, + inventory_image = "signs_road_white_dir_inventory.png", + signs_other_dir = "signs_road:white_right_sign", + on_place=signs_api.on_place_direction, + on_rightclick = signs_api.on_right_click_direction, + drawtype = "mesh", + mesh = "signs_dir_left.obj", + selection_box = { type = "fixed", fixed = { -7/16, -7/32, 0.5, 0.5, 7/32, 7/16 } }, + collision_box = { type = "fixed", fixed = { -7/16, -7/32, 0.5, 0.5, 7/32, 7/16 } }, + groups = { not_in_creative_inventory = 1 }, + drop = "signs_road:white_right_sign", + }, + }, + blue_right_sign = { + depth = 1/16, + width = 14/16, + height = 7/16, + entity_fields = { + right = -3/32, + size = { x = 12/16, y = 6/16 }, + maxlines = 2, + color = "#fff", + }, + node_fields = { + description = S("Blue direction sign"), + tiles = { "signs_road_blue_direction.png" }, + inventory_image = "signs_road_blue_dir_inventory.png", + signs_other_dir = "signs_road:blue_left_sign", + on_place = signs_api.on_place_direction, + on_rightclick = signs_api.on_right_click_direction, + drawtype = "mesh", + mesh = "signs_dir_right.obj", + selection_box = { type = "fixed", fixed = { -0.5, -7/32, 0.5, 7/16, 7/32, 7/16 } }, + collision_box = { type = "fixed", fixed = { -0.5, -7/32, 0.5, 7/16, 7/32, 7/16 } }, + }, + }, + blue_left_sign = { + depth = 1/16, + width = 14/16, + height = 7/16, + entity_fields = { + right = 3/32, + size = { x = 12/16, y = 6/16 }, + maxlines = 2, + color="#fff", + }, + node_fields = { + description = S("Blue direction sign"), + tiles = { "signs_road_blue_direction.png" }, + inventory_image = "signs_road_blue_dir_inventory.png", + signs_other_dir = "signs_road:blue_right_sign", + on_place = signs_api.on_place_direction, + on_rightclick = signs_api.on_right_click_direction, + drawtype = "mesh", + mesh = "signs_dir_left.obj", + selection_box = { type = "fixed", fixed = { -7/16, -7/32, 0.5, 0.5, 7/32, 7/16 } }, + collision_box = { type = "fixed", fixed = { -7/16, -7/32, 0.5, 0.5, 7/32, 7/16 } }, + groups = { not_in_creative_inventory = 1 }, + drop = "signs_road:blue_right_sign", + }, + }, + green_right_sign = { + depth = 1/16, + width = 14/16, + height = 7/16, + entity_fields = { + right = -3/32, + size = { x = 12/16, y = 6/16 }, + maxlines = 2, + color = "#fff", + }, + node_fields = { + description = S("Green direction sign"), + tiles = { "signs_road_green_direction.png" }, + inventory_image = "signs_road_green_dir_inventory.png", + signs_other_dir = "signs_road:green_left_sign", + on_place = signs_api.on_place_direction, + on_rightclick = signs_api.on_right_click_direction, + drawtype = "mesh", + mesh = "signs_dir_right.obj", + selection_box = { type = "fixed", fixed = { -0.5, -7/32, 0.5, 7/16, 7/32, 7/16 } }, + collision_box = { type = "fixed", fixed = { -0.5, -7/32, 0.5, 7/16, 7/32, 7/16 } }, + }, + }, + green_left_sign = { + depth = 1/16, + width = 14/16, + height = 7/16, + entity_fields = { + right = 3/32, + size = { x = 12/16, y = 6/16 }, + maxlines = 2, + color="#fff", + }, + node_fields = { + description = S("Green direction sign"), + tiles = { "signs_road_green_direction.png" }, + inventory_image = "signs_road_green_dir_inventory.png", + signs_other_dir = "signs_road:green_right_sign", + on_place = signs_api.on_place_direction, + on_rightclick = signs_api.on_right_click_direction, + drawtype = "mesh", + mesh = "signs_dir_left.obj", + selection_box = { type = "fixed", fixed = { -7/16, -7/32, 0.5, 0.5, 7/32, 7/16 } }, + collision_box = { type = "fixed", fixed = { -7/16, -7/32, 0.5, 0.5, 7/32, 7/16 } }, + groups = { not_in_creative_inventory = 1 }, + drop = "signs_road:green_right_sign", + }, + }, + yellow_right_sign = { + depth = 1/16, + width = 14/16, + height = 7/16, + entity_fields = { + right = -3/32, + size = { x = 12/16, y = 6/16 }, + maxlines = 2, + color = "#000", + }, + node_fields = { + description = S("Yellow direction sign"), + tiles = { "signs_road_yellow_direction.png" }, + inventory_image = "signs_road_yellow_dir_inventory.png", + signs_other_dir = "signs_road:yellow_left_sign", + on_place = signs_api.on_place_direction, + on_rightclick = signs_api.on_right_click_direction, + drawtype = "mesh", + mesh = "signs_dir_right.obj", + selection_box = { type = "fixed", fixed = { -0.5, -7/32, 0.5, 7/16, 7/32, 7/16 } }, + collision_box = { type = "fixed", fixed = { -0.5, -7/32, 0.5, 7/16, 7/32, 7/16 } }, + }, + }, + yellow_left_sign = { + depth = 1/16, + width = 14/16, + height = 7/16, + entity_fields = { + right = 3/32, + size = { x = 12/16, y = 6/16 }, + maxlines = 2, + color = "#000", + }, + node_fields = { + description = S("Yellow direction sign"), + tiles = { "signs_road_yellow_direction.png" }, + inventory_image = "signs_road_yellow_dir_inventory.png", + signs_other_dir = "signs_road:yellow_right_sign", + on_place = signs_api.on_place_direction, + on_rightclick = signs_api.on_right_click_direction, + drawtype = "mesh", + mesh = "signs_dir_left.obj", + selection_box = { type = "fixed", fixed = { -7/16, -7/32, 0.5, 0.5, 7/32, 7/16 } }, + collision_box = { type = "fixed", fixed = { -7/16, -7/32, 0.5, 0.5, 7/32, 7/16 } }, + groups = { not_in_creative_inventory = 1 }, + drop = "signs_road:yellow_right_sign", + }, + }, + red_right_sign = { + depth = 1/16, + width = 14/16, + height = 7/16, + entity_fields = { + right = -3/32, + size = { x = 12/16, y = 6/16 }, + maxlines = 2, + color = "#fff", + }, + node_fields = { + description = S("Red direction sign"), + tiles = { "signs_road_red_direction.png" }, + inventory_image = "signs_road_red_dir_inventory.png", + signs_other_dir = "signs_road:red_left_sign", + on_place = signs_api.on_place_direction, + on_rightclick = signs_api.on_right_click_direction, + drawtype = "mesh", + mesh = "signs_dir_right.obj", + selection_box = { type = "fixed", fixed = { -0.5, -7/32, 0.5, 7/16, 7/32, 7/16 } }, + collision_box = { type = "fixed", fixed = { -0.5, -7/32, 0.5, 7/16, 7/32, 7/16 } }, + }, + }, + red_left_sign = { + depth = 1/16, + width = 14/16, + height = 7/16, + entity_fields = { + right = 3/32, + size = { x = 12/16, y = 6/16 }, + maxlines = 2, + color = "#fff", + }, + node_fields = { + description = S("Red direction sign"), + tiles = { "signs_road_red_direction.png" }, + inventory_image = "signs_road_red_dir_inventory.png", + signs_other_dir = "signs_road:red_right_sign", + on_place = signs_api.on_place_direction, + on_rightclick = signs_api.on_right_click_direction, + drawtype = "mesh", + mesh = "signs_dir_left.obj", + selection_box = { type = "fixed", fixed = { -7/16, -7/32, 0.5, 0.5, 7/32, 7/16 } }, + collision_box = { type = "fixed", fixed = { -7/16, -7/32, 0.5, 0.5, 7/32, 7/16 } }, + groups = { not_in_creative_inventory = 1 }, + drop = "signs_road:red_right_sign", + }, + }, +} + +-- Node registration +for name, model in pairs(models) +do + signs_api.register_sign("signs_road", name, model) +end diff --git a/mods/special/display_modpack/signs_road/svg/signs_road_black.svg b/mods/special/display_modpack/signs_road/svg/signs_road_black.svg new file mode 100644 index 0000000..8e9b8a9 --- /dev/null +++ b/mods/special/display_modpack/signs_road/svg/signs_road_black.svg @@ -0,0 +1,128 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/mods/special/display_modpack/signs_road/svg/signs_road_direction.svg b/mods/special/display_modpack/signs_road/svg/signs_road_direction.svg new file mode 100644 index 0000000..665146b --- /dev/null +++ b/mods/special/display_modpack/signs_road/svg/signs_road_direction.svg @@ -0,0 +1,316 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mods/special/display_modpack/signs_road/svg/signs_road_rectangle.svg b/mods/special/display_modpack/signs_road/svg/signs_road_rectangle.svg new file mode 100644 index 0000000..3dad58d --- /dev/null +++ b/mods/special/display_modpack/signs_road/svg/signs_road_rectangle.svg @@ -0,0 +1,188 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + diff --git a/mods/special/display_modpack/signs_road/svg/signs_road_street_blue.svg b/mods/special/display_modpack/signs_road/svg/signs_road_street_blue.svg new file mode 100644 index 0000000..0aa87ff --- /dev/null +++ b/mods/special/display_modpack/signs_road/svg/signs_road_street_blue.svg @@ -0,0 +1,139 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + diff --git a/mods/special/display_modpack/signs_road/textures/signs_road_black_dir_inventory.png b/mods/special/display_modpack/signs_road/textures/signs_road_black_dir_inventory.png new file mode 100644 index 0000000..cc919e8 Binary files /dev/null and b/mods/special/display_modpack/signs_road/textures/signs_road_black_dir_inventory.png differ diff --git a/mods/special/display_modpack/signs_road/textures/signs_road_black_dir_left.png b/mods/special/display_modpack/signs_road/textures/signs_road_black_dir_left.png new file mode 100644 index 0000000..46a3323 Binary files /dev/null and b/mods/special/display_modpack/signs_road/textures/signs_road_black_dir_left.png differ diff --git a/mods/special/display_modpack/signs_road/textures/signs_road_black_dir_right.png b/mods/special/display_modpack/signs_road/textures/signs_road_black_dir_right.png new file mode 100644 index 0000000..b6cba13 Binary files /dev/null and b/mods/special/display_modpack/signs_road/textures/signs_road_black_dir_right.png differ diff --git a/mods/special/display_modpack/signs_road/textures/signs_road_blue.png b/mods/special/display_modpack/signs_road/textures/signs_road_blue.png new file mode 100644 index 0000000..7951c16 Binary files /dev/null and b/mods/special/display_modpack/signs_road/textures/signs_road_blue.png differ diff --git a/mods/special/display_modpack/signs_road/textures/signs_road_blue_dir_inventory.png b/mods/special/display_modpack/signs_road/textures/signs_road_blue_dir_inventory.png new file mode 100644 index 0000000..835dd88 Binary files /dev/null and b/mods/special/display_modpack/signs_road/textures/signs_road_blue_dir_inventory.png differ diff --git a/mods/special/display_modpack/signs_road/textures/signs_road_blue_direction.png b/mods/special/display_modpack/signs_road/textures/signs_road_blue_direction.png new file mode 100644 index 0000000..22b42e0 Binary files /dev/null and b/mods/special/display_modpack/signs_road/textures/signs_road_blue_direction.png differ diff --git a/mods/special/display_modpack/signs_road/textures/signs_road_blue_street.png b/mods/special/display_modpack/signs_road/textures/signs_road_blue_street.png new file mode 100644 index 0000000..9e81e21 Binary files /dev/null and b/mods/special/display_modpack/signs_road/textures/signs_road_blue_street.png differ diff --git a/mods/special/display_modpack/signs_road/textures/signs_road_green.png b/mods/special/display_modpack/signs_road/textures/signs_road_green.png new file mode 100644 index 0000000..8f8b04a Binary files /dev/null and b/mods/special/display_modpack/signs_road/textures/signs_road_green.png differ diff --git a/mods/special/display_modpack/signs_road/textures/signs_road_green_dir_inventory.png b/mods/special/display_modpack/signs_road/textures/signs_road_green_dir_inventory.png new file mode 100644 index 0000000..4b4dc1e Binary files /dev/null and b/mods/special/display_modpack/signs_road/textures/signs_road_green_dir_inventory.png differ diff --git a/mods/special/display_modpack/signs_road/textures/signs_road_green_direction.png b/mods/special/display_modpack/signs_road/textures/signs_road_green_direction.png new file mode 100644 index 0000000..414d2f7 Binary files /dev/null and b/mods/special/display_modpack/signs_road/textures/signs_road_green_direction.png differ diff --git a/mods/special/display_modpack/signs_road/textures/signs_road_large_white.png b/mods/special/display_modpack/signs_road/textures/signs_road_large_white.png new file mode 100644 index 0000000..223900c Binary files /dev/null and b/mods/special/display_modpack/signs_road/textures/signs_road_large_white.png differ diff --git a/mods/special/display_modpack/signs_road/textures/signs_road_red.png b/mods/special/display_modpack/signs_road/textures/signs_road_red.png new file mode 100644 index 0000000..2c9fd41 Binary files /dev/null and b/mods/special/display_modpack/signs_road/textures/signs_road_red.png differ diff --git a/mods/special/display_modpack/signs_road/textures/signs_road_red_dir_inventory.png b/mods/special/display_modpack/signs_road/textures/signs_road_red_dir_inventory.png new file mode 100644 index 0000000..6ebb189 Binary files /dev/null and b/mods/special/display_modpack/signs_road/textures/signs_road_red_dir_inventory.png differ diff --git a/mods/special/display_modpack/signs_road/textures/signs_road_red_direction.png b/mods/special/display_modpack/signs_road/textures/signs_road_red_direction.png new file mode 100644 index 0000000..c6cca33 Binary files /dev/null and b/mods/special/display_modpack/signs_road/textures/signs_road_red_direction.png differ diff --git a/mods/special/display_modpack/signs_road/textures/signs_road_red_white.png b/mods/special/display_modpack/signs_road/textures/signs_road_red_white.png new file mode 100644 index 0000000..510f6b8 Binary files /dev/null and b/mods/special/display_modpack/signs_road/textures/signs_road_red_white.png differ diff --git a/mods/special/display_modpack/signs_road/textures/signs_road_sides.png b/mods/special/display_modpack/signs_road/textures/signs_road_sides.png new file mode 100644 index 0000000..caea16a Binary files /dev/null and b/mods/special/display_modpack/signs_road/textures/signs_road_sides.png differ diff --git a/mods/special/display_modpack/signs_road/textures/signs_road_white.png b/mods/special/display_modpack/signs_road/textures/signs_road_white.png new file mode 100644 index 0000000..45b759a Binary files /dev/null and b/mods/special/display_modpack/signs_road/textures/signs_road_white.png differ diff --git a/mods/special/display_modpack/signs_road/textures/signs_road_white_dir_inventory.png b/mods/special/display_modpack/signs_road/textures/signs_road_white_dir_inventory.png new file mode 100644 index 0000000..ac0b265 Binary files /dev/null and b/mods/special/display_modpack/signs_road/textures/signs_road_white_dir_inventory.png differ diff --git a/mods/special/display_modpack/signs_road/textures/signs_road_white_direction.png b/mods/special/display_modpack/signs_road/textures/signs_road_white_direction.png new file mode 100644 index 0000000..cd19197 Binary files /dev/null and b/mods/special/display_modpack/signs_road/textures/signs_road_white_direction.png differ diff --git a/mods/special/display_modpack/signs_road/textures/signs_road_yellow.png b/mods/special/display_modpack/signs_road/textures/signs_road_yellow.png new file mode 100644 index 0000000..33ced3b Binary files /dev/null and b/mods/special/display_modpack/signs_road/textures/signs_road_yellow.png differ diff --git a/mods/special/display_modpack/signs_road/textures/signs_road_yellow_dir_inventory.png b/mods/special/display_modpack/signs_road/textures/signs_road_yellow_dir_inventory.png new file mode 100644 index 0000000..6fd34cd Binary files /dev/null and b/mods/special/display_modpack/signs_road/textures/signs_road_yellow_dir_inventory.png differ diff --git a/mods/special/display_modpack/signs_road/textures/signs_road_yellow_direction.png b/mods/special/display_modpack/signs_road/textures/signs_road_yellow_direction.png new file mode 100644 index 0000000..ef7fbaa Binary files /dev/null and b/mods/special/display_modpack/signs_road/textures/signs_road_yellow_direction.png differ diff --git a/mods/special/display_modpack/signs_road/tools/updatepo.sh b/mods/special/display_modpack/signs_road/tools/updatepo.sh new file mode 100755 index 0000000..feb2504 --- /dev/null +++ b/mods/special/display_modpack/signs_road/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 diff --git a/mods/special/display_modpack/steles/LICENSE.txt b/mods/special/display_modpack/steles/LICENSE.txt new file mode 100644 index 0000000..341c30b --- /dev/null +++ b/mods/special/display_modpack/steles/LICENSE.txt @@ -0,0 +1,166 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + 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/mods/special/display_modpack/steles/README.md b/mods/special/display_modpack/steles/README.md new file mode 100644 index 0000000..bc14b53 --- /dev/null +++ b/mods/special/display_modpack/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/mods/special/display_modpack/steles/config.lua b/mods/special/display_modpack/steles/config.lua new file mode 100644 index 0000000..551429d --- /dev/null +++ b/mods/special/display_modpack/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 . +--]] + +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/mods/special/display_modpack/steles/copyright.txt b/mods/special/display_modpack/steles/copyright.txt new file mode 100644 index 0000000..1a4e167 --- /dev/null +++ b/mods/special/display_modpack/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/mods/special/display_modpack/steles/crafts.lua b/mods/special/display_modpack/steles/crafts.lua new file mode 100644 index 0000000..9973aac --- /dev/null +++ b/mods/special/display_modpack/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 . +--]] + +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/mods/special/display_modpack/steles/depends.txt b/mods/special/display_modpack/steles/depends.txt new file mode 100644 index 0000000..ba43223 --- /dev/null +++ b/mods/special/display_modpack/steles/depends.txt @@ -0,0 +1,5 @@ +default +intllib? +display_api +font_api +technic? diff --git a/mods/special/display_modpack/steles/init.lua b/mods/special/display_modpack/steles/init.lua new file mode 100644 index 0000000..e5d2430 --- /dev/null +++ b/mods/special/display_modpack/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 . +--]] + +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/mods/special/display_modpack/steles/intllib.lua b/mods/special/display_modpack/steles/intllib.lua new file mode 100644 index 0000000..6669d72 --- /dev/null +++ b/mods/special/display_modpack/steles/intllib.lua @@ -0,0 +1,45 @@ + +-- Fallback functions for when `intllib` is not installed. +-- Code released under Unlicense . + +-- 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/mods/special/display_modpack/steles/locale/fr.po b/mods/special/display_modpack/steles/locale/fr.po new file mode 100644 index 0000000..1785d8a --- /dev/null +++ b/mods/special/display_modpack/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 , 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 \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/mods/special/display_modpack/steles/locale/ms.po b/mods/special/display_modpack/steles/locale/ms.po new file mode 100644 index 0000000..1c58983 --- /dev/null +++ b/mods/special/display_modpack/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. +# Yaya (Nurul Azeera Hidayah @ Muhammad Nur Hidayat) , 2017. +msgid "" +msgstr "" +"Project-Id-Version: Display Modpack\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-08-26 11:29+0200\n" +"PO-Revision-Date: 2020-07-05 11:34+0000\n" +"Last-Translator: Yaya MNH48 \n" +"Language-Team: Malay \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: Poedit 2.3\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 terpapar (maksimum 3 baris)" + +#: nodes.lua +msgid "Write" +msgstr "Tulis" diff --git a/mods/special/display_modpack/steles/locale/template.pot b/mods/special/display_modpack/steles/locale/template.pot new file mode 100644 index 0000000..0144ace --- /dev/null +++ b/mods/special/display_modpack/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 , 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 \n" +"Language-Team: LANGUAGE \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/mods/special/display_modpack/steles/mod.conf b/mods/special/display_modpack/steles/mod.conf new file mode 100644 index 0000000..2b29f05 --- /dev/null +++ b/mods/special/display_modpack/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/mods/special/display_modpack/steles/nodes.lua b/mods/special/display_modpack/steles/nodes.lua new file mode 100644 index 0000000..2245e20 --- /dev/null +++ b/mods/special/display_modpack/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 . +--]] + +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/mods/special/display_modpack/steles/tools/updatepo.sh b/mods/special/display_modpack/steles/tools/updatepo.sh new file mode 100755 index 0000000..feb2504 --- /dev/null +++ b/mods/special/display_modpack/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 diff --git a/mods/special/modpack.conf b/mods/special/modpack.conf new file mode 100644 index 0000000..fe2b237 --- /dev/null +++ b/mods/special/modpack.conf @@ -0,0 +1,3 @@ +description = Diverse special elements + +display_modpack - signs, clock, boards, ...