Compare commits
3 Commits
experiment
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 21cfb2e59e | |||
| 0df11424ea | |||
| ad30eeab23 |
10
.github/workflows/luacheck.yml
vendored
@@ -1,10 +0,0 @@
|
|||||||
name: luacheck
|
|
||||||
on: [push, pull_request]
|
|
||||||
jobs:
|
|
||||||
luacheck:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@master
|
|
||||||
- name: Luacheck
|
|
||||||
uses: lunarmodules/luacheck@master
|
|
||||||
3
.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
*~
|
||||||
|
_*
|
||||||
|
|
||||||
19
.luacheckrc
@@ -1,19 +0,0 @@
|
|||||||
unused_args = false
|
|
||||||
|
|
||||||
read_globals = {
|
|
||||||
"minetest",
|
|
||||||
"table",
|
|
||||||
"vector",
|
|
||||||
"xcompat"
|
|
||||||
}
|
|
||||||
|
|
||||||
globals = {
|
|
||||||
"boards",
|
|
||||||
"display_api",
|
|
||||||
"font_api",
|
|
||||||
"ontime_clocks",
|
|
||||||
"signs",
|
|
||||||
"signs_api",
|
|
||||||
"signs_road",
|
|
||||||
"steles"
|
|
||||||
}
|
|
||||||
28
README.md
@@ -1,26 +1,22 @@
|
|||||||
# Display Modpack
|
# Display Modpack
|
||||||
|
Version 1.3.1
|
||||||
|
|
||||||

|
This modpack provides mods with dynamic display. Mods are :
|
||||||
[](https://content.minetest.net/packages/mt-mods/display_modpack/)
|
|
||||||
|
|
||||||
Requires Minetest 5.4+
|
- **[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)
|
||||||
|
|
||||||
This modpack provides mods with dynamic display. Mods are:
|
- **[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;
|
||||||
- **[display_api](https://github.com/mt-mods/display_modpack/tree/master/display_api)**: A library for adding display entities to nodes;
|
- **[signs](https://github.com/pyrollo/display_modpack/tree/master/signs)**: A mod providing signs and direction signs displaying text;
|
||||||
- **[font_api](https://github.com/mt-mods/display_modpack/tree/master/font_api)**: A library for displaying fonts on entities;
|
- **[signs_road](https://github.com/pyrollo/display_modpack/tree/master/signs_road)**: A mod providing road signs displaying text;
|
||||||
- **[signs_api](https://github.com/mt-mods/display_modpack/tree/master/signs_api)**: A library for the easy creation of signs;
|
- **[steles](https://github.com/pyrollo/display_modpack/tree/master/steles)**: A mod providing stone steles with text;
|
||||||
- **[font_metro](https://github.com/mt-mods/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/mt-mods/display_modpack/tree/master/boards)**: A mod providing school boards (includes *tiny cursive font*, a handwriting style font);
|
|
||||||
- **[ontime_clocks](https://github.com/mt-mods/display_modpack/tree/master/ontime_clocks)**: A mod providing clocks which display the ingame time;
|
|
||||||
- **[signs](https://github.com/mt-mods/display_modpack/tree/master/signs)**: A mod providing signs and direction signs displaying text;
|
|
||||||
- **[signs_road](https://github.com/mt-mods/display_modpack/tree/master/signs_road)**: A mod providing road signs displaying text;
|
|
||||||
- **[steles](https://github.com/mt-mods/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.
|
For more information, see the [forum topic](https://forum.minetest.net/viewtopic.php?t=19365) at the Minetest forums.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## Extra fonts
|
## Extra fonts
|
||||||
|
|
||||||
|
|||||||
1
_config.yml
Normal file
@@ -0,0 +1 @@
|
|||||||
|
theme: jekyll-theme-minimal
|
||||||
166
boards/LICENSE.txt
Normal file
@@ -0,0 +1,166 @@
|
|||||||
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
|
||||||
|
This version of the GNU Lesser General Public License incorporates
|
||||||
|
the terms and conditions of version 3 of the GNU General Public
|
||||||
|
License, supplemented by the additional permissions listed below.
|
||||||
|
|
||||||
|
0. Additional Definitions.
|
||||||
|
|
||||||
|
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||||
|
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||||
|
General Public License.
|
||||||
|
|
||||||
|
"The Library" refers to a covered work governed by this License,
|
||||||
|
other than an Application or a Combined Work as defined below.
|
||||||
|
|
||||||
|
An "Application" is any work that makes use of an interface provided
|
||||||
|
by the Library, but which is not otherwise based on the Library.
|
||||||
|
Defining a subclass of a class defined by the Library is deemed a mode
|
||||||
|
of using an interface provided by the Library.
|
||||||
|
|
||||||
|
A "Combined Work" is a work produced by combining or linking an
|
||||||
|
Application with the Library. The particular version of the Library
|
||||||
|
with which the Combined Work was made is also called the "Linked
|
||||||
|
Version".
|
||||||
|
|
||||||
|
The "Minimal Corresponding Source" for a Combined Work means the
|
||||||
|
Corresponding Source for the Combined Work, excluding any source code
|
||||||
|
for portions of the Combined Work that, considered in isolation, are
|
||||||
|
based on the Application, and not on the Linked Version.
|
||||||
|
|
||||||
|
The "Corresponding Application Code" for a Combined Work means the
|
||||||
|
object code and/or source code for the Application, including any data
|
||||||
|
and utility programs needed for reproducing the Combined Work from the
|
||||||
|
Application, but excluding the System Libraries of the Combined Work.
|
||||||
|
|
||||||
|
1. Exception to Section 3 of the GNU GPL.
|
||||||
|
|
||||||
|
You may convey a covered work under sections 3 and 4 of this License
|
||||||
|
without being bound by section 3 of the GNU GPL.
|
||||||
|
|
||||||
|
2. Conveying Modified Versions.
|
||||||
|
|
||||||
|
If you modify a copy of the Library, and, in your modifications, a
|
||||||
|
facility refers to a function or data to be supplied by an Application
|
||||||
|
that uses the facility (other than as an argument passed when the
|
||||||
|
facility is invoked), then you may convey a copy of the modified
|
||||||
|
version:
|
||||||
|
|
||||||
|
a) under this License, provided that you make a good faith effort to
|
||||||
|
ensure that, in the event an Application does not supply the
|
||||||
|
function or data, the facility still operates, and performs
|
||||||
|
whatever part of its purpose remains meaningful, or
|
||||||
|
|
||||||
|
b) under the GNU GPL, with none of the additional permissions of
|
||||||
|
this License applicable to that copy.
|
||||||
|
|
||||||
|
3. Object Code Incorporating Material from Library Header Files.
|
||||||
|
|
||||||
|
The object code form of an Application may incorporate material from
|
||||||
|
a header file that is part of the Library. You may convey such object
|
||||||
|
code under terms of your choice, provided that, if the incorporated
|
||||||
|
material is not limited to numerical parameters, data structure
|
||||||
|
layouts and accessors, or small macros, inline functions and templates
|
||||||
|
(ten or fewer lines in length), you do both of the following:
|
||||||
|
|
||||||
|
a) Give prominent notice with each copy of the object code that the
|
||||||
|
Library is used in it and that the Library and its use are
|
||||||
|
covered by this License.
|
||||||
|
|
||||||
|
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||||
|
document.
|
||||||
|
|
||||||
|
4. Combined Works.
|
||||||
|
|
||||||
|
You may convey a Combined Work under terms of your choice that,
|
||||||
|
taken together, effectively do not restrict modification of the
|
||||||
|
portions of the Library contained in the Combined Work and reverse
|
||||||
|
engineering for debugging such modifications, if you also do each of
|
||||||
|
the following:
|
||||||
|
|
||||||
|
a) Give prominent notice with each copy of the Combined Work that
|
||||||
|
the Library is used in it and that the Library and its use are
|
||||||
|
covered by this License.
|
||||||
|
|
||||||
|
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||||
|
document.
|
||||||
|
|
||||||
|
c) For a Combined Work that displays copyright notices during
|
||||||
|
execution, include the copyright notice for the Library among
|
||||||
|
these notices, as well as a reference directing the user to the
|
||||||
|
copies of the GNU GPL and this license document.
|
||||||
|
|
||||||
|
d) Do one of the following:
|
||||||
|
|
||||||
|
0) Convey the Minimal Corresponding Source under the terms of this
|
||||||
|
License, and the Corresponding Application Code in a form
|
||||||
|
suitable for, and under terms that permit, the user to
|
||||||
|
recombine or relink the Application with a modified version of
|
||||||
|
the Linked Version to produce a modified Combined Work, in the
|
||||||
|
manner specified by section 6 of the GNU GPL for conveying
|
||||||
|
Corresponding Source.
|
||||||
|
|
||||||
|
1) Use a suitable shared library mechanism for linking with the
|
||||||
|
Library. A suitable mechanism is one that (a) uses at run time
|
||||||
|
a copy of the Library already present on the user's computer
|
||||||
|
system, and (b) will operate properly with a modified version
|
||||||
|
of the Library that is interface-compatible with the Linked
|
||||||
|
Version.
|
||||||
|
|
||||||
|
e) Provide Installation Information, but only if you would otherwise
|
||||||
|
be required to provide such information under section 6 of the
|
||||||
|
GNU GPL, and only to the extent that such information is
|
||||||
|
necessary to install and execute a modified version of the
|
||||||
|
Combined Work produced by recombining or relinking the
|
||||||
|
Application with a modified version of the Linked Version. (If
|
||||||
|
you use option 4d0, the Installation Information must accompany
|
||||||
|
the Minimal Corresponding Source and Corresponding Application
|
||||||
|
Code. If you use option 4d1, you must provide the Installation
|
||||||
|
Information in the manner specified by section 6 of the GNU GPL
|
||||||
|
for conveying Corresponding Source.)
|
||||||
|
|
||||||
|
5. Combined Libraries.
|
||||||
|
|
||||||
|
You may place library facilities that are a work based on the
|
||||||
|
Library side by side in a single library together with other library
|
||||||
|
facilities that are not Applications and are not covered by this
|
||||||
|
License, and convey such a combined library under terms of your
|
||||||
|
choice, if you do both of the following:
|
||||||
|
|
||||||
|
a) Accompany the combined library with a copy of the same work based
|
||||||
|
on the Library, uncombined with any other library facilities,
|
||||||
|
conveyed under the terms of this License.
|
||||||
|
|
||||||
|
b) Give prominent notice with the combined library that part of it
|
||||||
|
is a work based on the Library, and explaining where to find the
|
||||||
|
accompanying uncombined form of the same work.
|
||||||
|
|
||||||
|
6. Revised Versions of the GNU Lesser General Public License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the GNU Lesser General Public License from time to time. Such new
|
||||||
|
versions will be similar in spirit to the present version, but may
|
||||||
|
differ in detail to address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Library as you received it specifies that a certain numbered version
|
||||||
|
of the GNU Lesser General Public License "or any later version"
|
||||||
|
applies to it, you have the option of following the terms and
|
||||||
|
conditions either of that published version or of any later version
|
||||||
|
published by the Free Software Foundation. If the Library as you
|
||||||
|
received it does not specify a version number of the GNU Lesser
|
||||||
|
General Public License, you may choose any version of the GNU Lesser
|
||||||
|
General Public License ever published by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Library as you received it specifies that a proxy can decide
|
||||||
|
whether future versions of the GNU Lesser General Public License shall
|
||||||
|
apply, that proxy's public statement of acceptance of any version is
|
||||||
|
permanent authorization for you to choose that version for the
|
||||||
|
Library.
|
||||||
|
|
||||||
2
boards/copyright.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
Code by Pierre-Yves Rollo (pyrollo)
|
||||||
|
Font by (cyfry77)
|
||||||
@@ -12,8 +12,6 @@
|
|||||||
Code is under LGPL v3 license
|
Code is under LGPL v3 license
|
||||||
--]]
|
--]]
|
||||||
|
|
||||||
-- widths is not split into several lines, because the font is generated by 'make_font_lua.sh'
|
|
||||||
-- luacheck: ignore
|
|
||||||
font_api.register_font('tinycurs',
|
font_api.register_font('tinycurs',
|
||||||
{
|
{
|
||||||
default = false, -- Don't register this font as a possible default font
|
default = false, -- Don't register this font as a possible default font
|
||||||
|
|||||||
@@ -22,21 +22,21 @@ boards = {}
|
|||||||
boards.name = minetest.get_current_modname()
|
boards.name = minetest.get_current_modname()
|
||||||
boards.path = minetest.get_modpath(boards.name)
|
boards.path = minetest.get_modpath(boards.name)
|
||||||
|
|
||||||
-- Translation support
|
-- Load support for intllib.
|
||||||
local S = minetest.get_translator(boards.name)
|
local S, NS = dofile(boards.path.."/intllib.lua")
|
||||||
local FS = function(...) return minetest.formspec_escape(S(...)) end
|
boards.intllib = S
|
||||||
|
local F = function(...) return minetest.formspec_escape(S(...)) end
|
||||||
|
|
||||||
-- Load font
|
-- Load font
|
||||||
dofile(boards.path.."/font_tinycurs.lua")
|
dofile(boards.path.."/font_tinycurs.lua")
|
||||||
|
|
||||||
local function set_formspec(pos)
|
local function set_formspec(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local display_text = minetest.formspec_escape(meta:get_string("display_text"))
|
|
||||||
meta:set_string("formspec",
|
meta:set_string("formspec",
|
||||||
"size[6,3.5]"..
|
"size[6,4]"..default.gui_bg..default.gui_bg_img..default.gui_slots..
|
||||||
"textarea[0.55,0.25;5.5,3;display_text;"..FS("Text")..";" .. display_text .. "]"..
|
"textarea[0.5,0.7;5.5,3;display_text;"..F("Text")..";${display_text}]"..
|
||||||
"button_exit[1,2.75;2,1;ok;"..FS("Write").."]"..
|
"button_exit[3,3.5;2,1;ok;"..F("Write").."]"..
|
||||||
"button[3,2.75;2,1;font;"..FS("Font").."]")
|
"button_exit[1,3.5;2,1;wipe;"..F("Wipe").."]")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- On boards, everyone is allowed to write and wipe
|
-- On boards, everyone is allowed to write and wipe
|
||||||
@@ -45,16 +45,13 @@ local function on_receive_fields(pos, formname, fields, player)
|
|||||||
if fields.ok or fields.key_enter then
|
if fields.ok or fields.key_enter then
|
||||||
signs_api.set_display_text(pos, fields.display_text, fields.font)
|
signs_api.set_display_text(pos, fields.display_text, fields.font)
|
||||||
end
|
end
|
||||||
if fields.font then
|
if fields.wipe then
|
||||||
signs_api.set_display_text(pos, fields.display_text)
|
signs_api.set_display_text(pos, "", fields.font)
|
||||||
font_api.show_font_list(player, pos)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local wood_texture = xcompat.textures.wood.planks
|
models = {
|
||||||
|
|
||||||
local models = {
|
|
||||||
black_board = {
|
black_board = {
|
||||||
depth = 1/16, width = 1, height = 1,
|
depth = 1/16, width = 1, height = 1,
|
||||||
entity_fields = {
|
entity_fields = {
|
||||||
@@ -67,10 +64,9 @@ local models = {
|
|||||||
},
|
},
|
||||||
node_fields = {
|
node_fields = {
|
||||||
description = S("Black board"),
|
description = S("Black board"),
|
||||||
tiles = {wood_texture, wood_texture,
|
tiles = { "default_wood.png", "default_wood.png",
|
||||||
wood_texture, wood_texture,
|
"default_wood.png", "default_wood.png",
|
||||||
wood_texture, "board_black_front.png"},
|
"default_wood.png", "board_black_front.png" },
|
||||||
_itemframe_texture = "board_black_front.png",
|
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
@@ -83,13 +79,6 @@ local models = {
|
|||||||
set_formspec(pos)
|
set_formspec(pos)
|
||||||
display_api.on_construct(pos)
|
display_api.on_construct(pos)
|
||||||
end,
|
end,
|
||||||
on_punch = function(pos)
|
|
||||||
set_formspec(pos)
|
|
||||||
display_api.update_entities(pos)
|
|
||||||
end,
|
|
||||||
on_rightclick = function(pos)
|
|
||||||
set_formspec(pos)
|
|
||||||
end,
|
|
||||||
on_receive_fields = on_receive_fields,
|
on_receive_fields = on_receive_fields,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -105,11 +94,10 @@ local models = {
|
|||||||
},
|
},
|
||||||
node_fields = {
|
node_fields = {
|
||||||
description = S("Green board"),
|
description = S("Green board"),
|
||||||
tiles = {wood_texture, wood_texture,
|
tiles = { "default_wood.png", "default_wood.png",
|
||||||
wood_texture, wood_texture,
|
"default_wood.png", "default_wood.png",
|
||||||
wood_texture, "board_green_front.png"},
|
"default_wood.png", "board_green_front.png" },
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
_itemframe_texture = "board_green_front.png",
|
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
@@ -121,13 +109,6 @@ local models = {
|
|||||||
set_formspec(pos)
|
set_formspec(pos)
|
||||||
display_api.on_construct(pos)
|
display_api.on_construct(pos)
|
||||||
end,
|
end,
|
||||||
on_punch = function(pos)
|
|
||||||
set_formspec(pos)
|
|
||||||
display_api.update_entities(pos)
|
|
||||||
end,
|
|
||||||
on_rightclick = function(pos)
|
|
||||||
set_formspec(pos)
|
|
||||||
end,
|
|
||||||
on_receive_fields = on_receive_fields,
|
on_receive_fields = on_receive_fields,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -140,13 +121,11 @@ do
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Recipes
|
-- Recipes
|
||||||
local mat = xcompat.materials
|
|
||||||
|
|
||||||
minetest.register_craft(
|
minetest.register_craft(
|
||||||
{
|
{
|
||||||
output = "boards:black_board",
|
output = "boards:black_board",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"group:wood", "group:stone", mat.dye_black},
|
{"group:wood", "group:stone", "dye:black"},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -154,7 +133,8 @@ minetest.register_craft(
|
|||||||
{
|
{
|
||||||
output = "boards:green_board",
|
output = "boards:green_board",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"group:wood", "group:stone", mat.dye_dark_green},
|
{"group:wood", "group:stone", "dye:dark_green"},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.log("action", "[boards] loaded.")
|
||||||
|
|||||||
45
boards/intllib.lua
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
|
||||||
|
-- Fallback functions for when `intllib` is not installed.
|
||||||
|
-- Code released under Unlicense <http://unlicense.org>.
|
||||||
|
|
||||||
|
-- Get the latest version of this file at:
|
||||||
|
-- https://raw.githubusercontent.com/minetest-mods/intllib/master/lib/intllib.lua
|
||||||
|
|
||||||
|
local function format(str, ...)
|
||||||
|
local args = { ... }
|
||||||
|
local function repl(escape, open, num, close)
|
||||||
|
if escape == "" then
|
||||||
|
local replacement = tostring(args[tonumber(num)])
|
||||||
|
if open == "" then
|
||||||
|
replacement = replacement..close
|
||||||
|
end
|
||||||
|
return replacement
|
||||||
|
else
|
||||||
|
return "@"..open..num..close
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return (str:gsub("(@?)@(%(?)(%d+)(%)?)", repl))
|
||||||
|
end
|
||||||
|
|
||||||
|
local gettext, ngettext
|
||||||
|
if minetest.get_modpath("intllib") then
|
||||||
|
if intllib.make_gettext_pair then
|
||||||
|
-- New method using gettext.
|
||||||
|
gettext, ngettext = intllib.make_gettext_pair()
|
||||||
|
else
|
||||||
|
-- Old method using text files.
|
||||||
|
gettext = intllib.Getter()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Fill in missing functions.
|
||||||
|
|
||||||
|
gettext = gettext or function(msgid, ...)
|
||||||
|
return format(msgid, ...)
|
||||||
|
end
|
||||||
|
|
||||||
|
ngettext = ngettext or function(msgid, msgid_plural, n, ...)
|
||||||
|
return format(n==1 and msgid or msgid_plural, ...)
|
||||||
|
end
|
||||||
|
|
||||||
|
return gettext, ngettext
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
# textdomain: boards
|
|
||||||
Text=Text
|
|
||||||
Write=Schreiben
|
|
||||||
Font=Schriftart
|
|
||||||
Black board=Schwarze Tafel
|
|
||||||
Green board=Grüne Tafel
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
# textdomain: boards
|
|
||||||
Text=Texte
|
|
||||||
Write=Écrire
|
|
||||||
Font=Police
|
|
||||||
Black board=Tableau noir
|
|
||||||
Green board=Tableau vert
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
# textdomain: boards
|
|
||||||
Text=
|
|
||||||
Write=
|
|
||||||
Font=
|
|
||||||
Black board=Papan hitam
|
|
||||||
Green board=
|
|
||||||
40
boards/locale/fr.po
Normal file
@@ -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 <EMAIL@ADDRESS>, 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 <EMAIL@ADDRESS>\n"
|
||||||
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
"Language: \n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=CHARSET\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
|
||||||
|
#: 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"
|
||||||
|
|
||||||
|
|
||||||
35
boards/locale/ms.po
Normal file
@@ -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) <translation@mnh48.moe>, 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 <translation@mnh48.moe>\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 <translation@mnh48.moe>\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"
|
||||||
34
boards/locale/template.pot
Normal file
@@ -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 <EMAIL@ADDRESS>, 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 <EMAIL@ADDRESS>\n"
|
||||||
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
"Language: \n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=CHARSET\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
|
||||||
|
#: init.lua
|
||||||
|
msgid "Text"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: init.lua
|
||||||
|
msgid "Write"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: init.lua
|
||||||
|
msgid "Wipe"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: init.lua
|
||||||
|
msgid "Black board"
|
||||||
|
msgstr ""
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
# textdomain: boards
|
|
||||||
Text=
|
|
||||||
Write=
|
|
||||||
Font=
|
|
||||||
Black board=
|
|
||||||
Green board=
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
name = boards
|
name = boards
|
||||||
title = Black boards
|
title = Black boards
|
||||||
description = Writable school boards using sign_api
|
description = Writable school boards using sign_api
|
||||||
depends = signs_api, xcompat
|
depends = default,signs_api
|
||||||
|
|||||||
25
boards/tools/updatepo.sh
Executable file
@@ -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
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
display_modpack (all mods):
|
|
||||||
- Original author: Pierre-Yves Rollo (pyrollo) License: LGPL v3, font_metro LGPL v2.1
|
|
||||||
- Many other contributors, see `git log`
|
|
||||||
|
|
||||||
boards:
|
|
||||||
- Font author: cyfry77 License: CC-BY-SA 3.0
|
|
||||||
|
|
||||||
font_metro:
|
|
||||||
- Font author: Christian Munk (CMunk) License: CC-BY-SA 3.0
|
|
||||||
166
display_api/LICENSE.txt
Normal file
@@ -0,0 +1,166 @@
|
|||||||
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
|
||||||
|
This version of the GNU Lesser General Public License incorporates
|
||||||
|
the terms and conditions of version 3 of the GNU General Public
|
||||||
|
License, supplemented by the additional permissions listed below.
|
||||||
|
|
||||||
|
0. Additional Definitions.
|
||||||
|
|
||||||
|
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||||
|
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||||
|
General Public License.
|
||||||
|
|
||||||
|
"The Library" refers to a covered work governed by this License,
|
||||||
|
other than an Application or a Combined Work as defined below.
|
||||||
|
|
||||||
|
An "Application" is any work that makes use of an interface provided
|
||||||
|
by the Library, but which is not otherwise based on the Library.
|
||||||
|
Defining a subclass of a class defined by the Library is deemed a mode
|
||||||
|
of using an interface provided by the Library.
|
||||||
|
|
||||||
|
A "Combined Work" is a work produced by combining or linking an
|
||||||
|
Application with the Library. The particular version of the Library
|
||||||
|
with which the Combined Work was made is also called the "Linked
|
||||||
|
Version".
|
||||||
|
|
||||||
|
The "Minimal Corresponding Source" for a Combined Work means the
|
||||||
|
Corresponding Source for the Combined Work, excluding any source code
|
||||||
|
for portions of the Combined Work that, considered in isolation, are
|
||||||
|
based on the Application, and not on the Linked Version.
|
||||||
|
|
||||||
|
The "Corresponding Application Code" for a Combined Work means the
|
||||||
|
object code and/or source code for the Application, including any data
|
||||||
|
and utility programs needed for reproducing the Combined Work from the
|
||||||
|
Application, but excluding the System Libraries of the Combined Work.
|
||||||
|
|
||||||
|
1. Exception to Section 3 of the GNU GPL.
|
||||||
|
|
||||||
|
You may convey a covered work under sections 3 and 4 of this License
|
||||||
|
without being bound by section 3 of the GNU GPL.
|
||||||
|
|
||||||
|
2. Conveying Modified Versions.
|
||||||
|
|
||||||
|
If you modify a copy of the Library, and, in your modifications, a
|
||||||
|
facility refers to a function or data to be supplied by an Application
|
||||||
|
that uses the facility (other than as an argument passed when the
|
||||||
|
facility is invoked), then you may convey a copy of the modified
|
||||||
|
version:
|
||||||
|
|
||||||
|
a) under this License, provided that you make a good faith effort to
|
||||||
|
ensure that, in the event an Application does not supply the
|
||||||
|
function or data, the facility still operates, and performs
|
||||||
|
whatever part of its purpose remains meaningful, or
|
||||||
|
|
||||||
|
b) under the GNU GPL, with none of the additional permissions of
|
||||||
|
this License applicable to that copy.
|
||||||
|
|
||||||
|
3. Object Code Incorporating Material from Library Header Files.
|
||||||
|
|
||||||
|
The object code form of an Application may incorporate material from
|
||||||
|
a header file that is part of the Library. You may convey such object
|
||||||
|
code under terms of your choice, provided that, if the incorporated
|
||||||
|
material is not limited to numerical parameters, data structure
|
||||||
|
layouts and accessors, or small macros, inline functions and templates
|
||||||
|
(ten or fewer lines in length), you do both of the following:
|
||||||
|
|
||||||
|
a) Give prominent notice with each copy of the object code that the
|
||||||
|
Library is used in it and that the Library and its use are
|
||||||
|
covered by this License.
|
||||||
|
|
||||||
|
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||||
|
document.
|
||||||
|
|
||||||
|
4. Combined Works.
|
||||||
|
|
||||||
|
You may convey a Combined Work under terms of your choice that,
|
||||||
|
taken together, effectively do not restrict modification of the
|
||||||
|
portions of the Library contained in the Combined Work and reverse
|
||||||
|
engineering for debugging such modifications, if you also do each of
|
||||||
|
the following:
|
||||||
|
|
||||||
|
a) Give prominent notice with each copy of the Combined Work that
|
||||||
|
the Library is used in it and that the Library and its use are
|
||||||
|
covered by this License.
|
||||||
|
|
||||||
|
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||||
|
document.
|
||||||
|
|
||||||
|
c) For a Combined Work that displays copyright notices during
|
||||||
|
execution, include the copyright notice for the Library among
|
||||||
|
these notices, as well as a reference directing the user to the
|
||||||
|
copies of the GNU GPL and this license document.
|
||||||
|
|
||||||
|
d) Do one of the following:
|
||||||
|
|
||||||
|
0) Convey the Minimal Corresponding Source under the terms of this
|
||||||
|
License, and the Corresponding Application Code in a form
|
||||||
|
suitable for, and under terms that permit, the user to
|
||||||
|
recombine or relink the Application with a modified version of
|
||||||
|
the Linked Version to produce a modified Combined Work, in the
|
||||||
|
manner specified by section 6 of the GNU GPL for conveying
|
||||||
|
Corresponding Source.
|
||||||
|
|
||||||
|
1) Use a suitable shared library mechanism for linking with the
|
||||||
|
Library. A suitable mechanism is one that (a) uses at run time
|
||||||
|
a copy of the Library already present on the user's computer
|
||||||
|
system, and (b) will operate properly with a modified version
|
||||||
|
of the Library that is interface-compatible with the Linked
|
||||||
|
Version.
|
||||||
|
|
||||||
|
e) Provide Installation Information, but only if you would otherwise
|
||||||
|
be required to provide such information under section 6 of the
|
||||||
|
GNU GPL, and only to the extent that such information is
|
||||||
|
necessary to install and execute a modified version of the
|
||||||
|
Combined Work produced by recombining or relinking the
|
||||||
|
Application with a modified version of the Linked Version. (If
|
||||||
|
you use option 4d0, the Installation Information must accompany
|
||||||
|
the Minimal Corresponding Source and Corresponding Application
|
||||||
|
Code. If you use option 4d1, you must provide the Installation
|
||||||
|
Information in the manner specified by section 6 of the GNU GPL
|
||||||
|
for conveying Corresponding Source.)
|
||||||
|
|
||||||
|
5. Combined Libraries.
|
||||||
|
|
||||||
|
You may place library facilities that are a work based on the
|
||||||
|
Library side by side in a single library together with other library
|
||||||
|
facilities that are not Applications and are not covered by this
|
||||||
|
License, and convey such a combined library under terms of your
|
||||||
|
choice, if you do both of the following:
|
||||||
|
|
||||||
|
a) Accompany the combined library with a copy of the same work based
|
||||||
|
on the Library, uncombined with any other library facilities,
|
||||||
|
conveyed under the terms of this License.
|
||||||
|
|
||||||
|
b) Give prominent notice with the combined library that part of it
|
||||||
|
is a work based on the Library, and explaining where to find the
|
||||||
|
accompanying uncombined form of the same work.
|
||||||
|
|
||||||
|
6. Revised Versions of the GNU Lesser General Public License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the GNU Lesser General Public License from time to time. Such new
|
||||||
|
versions will be similar in spirit to the present version, but may
|
||||||
|
differ in detail to address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Library as you received it specifies that a certain numbered version
|
||||||
|
of the GNU Lesser General Public License "or any later version"
|
||||||
|
applies to it, you have the option of following the terms and
|
||||||
|
conditions either of that published version or of any later version
|
||||||
|
published by the Free Software Foundation. If the Library as you
|
||||||
|
received it does not specify a version number of the GNU Lesser
|
||||||
|
General Public License, you may choose any version of the GNU Lesser
|
||||||
|
General Public License ever published by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Library as you received it specifies that a proxy can decide
|
||||||
|
whether future versions of the GNU Lesser General Public License shall
|
||||||
|
apply, that proxy's public statement of acceptance of any version is
|
||||||
|
permanent authorization for you to choose that version for the
|
||||||
|
Library.
|
||||||
|
|
||||||
@@ -4,7 +4,7 @@ This library's purpose is to ease creation of nodes with one or more displays on
|
|||||||
|
|
||||||
**Limitations**: This lib uses entities to draw display. This means display has to be vertical (and "upside up") on Minetest before version 5.0.
|
**Limitations**: This lib uses entities to draw display. This means display has to be vertical (and "upside up") on Minetest before version 5.0.
|
||||||
|
|
||||||
**Dependencies**: xcompat
|
**Dependancies**:default
|
||||||
|
|
||||||
**License**: LGPLv2
|
**License**: LGPLv2
|
||||||
|
|
||||||
|
|||||||
5
display_api/copyright.txt
Normal file
@@ -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
|
||||||
@@ -19,17 +19,17 @@
|
|||||||
|
|
||||||
-- Deprecation
|
-- Deprecation
|
||||||
|
|
||||||
local function deprecated_group(old_group, replacement_group)
|
function deprecated_group(deprecated_group, replacement_group)
|
||||||
for name, ndef in pairs(minetest.registered_nodes) do
|
for name, ndef in pairs(minetest.registered_nodes) do
|
||||||
if ndef.groups and ndef.groups[old_group] then
|
if ndef.groups and ndef.groups[deprecated_group] then
|
||||||
minetest.log("warning", string.format(
|
minetest.log("warning", string.format(
|
||||||
'Node %s belongs to deprecated "%s" group which should be replaced with new "%s" group.',
|
'Node %s belongs to deprecated "%s" group which should be replaced with new "%s" group.',
|
||||||
name, old_group, replacement_group))
|
name, deprecated_group, replacement_group))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function deprecated_global_table(deprecated_global_name, replacement_global_name)
|
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(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(type(replacement_global_name) == 'string', "replacement_global_name should be a string.")
|
||||||
assert(deprecated_global_name ~= '', "deprecated_global_name should not be empty.")
|
assert(deprecated_global_name ~= '', "deprecated_global_name should not be empty.")
|
||||||
|
|||||||
@@ -65,7 +65,9 @@ local function compute_values(r)
|
|||||||
for _ = 1, r.x do d, w, h = rx(d), rx(w), rx(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
|
for _ = 1, r.y do d, w, h = ry(d), ry(w), ry(h) end
|
||||||
|
|
||||||
return {rotation=r, depth=d, width=w, height=h}
|
return {
|
||||||
|
rotation=r, depth=d, width=w, height=h,
|
||||||
|
restricted=(r.x==0 and r.z==0) }
|
||||||
end
|
end
|
||||||
|
|
||||||
for i, r in pairs(facedir_rotations) do
|
for i, r in pairs(facedir_rotations) do
|
||||||
@@ -76,6 +78,25 @@ for i, r in pairs(wallmounted_rotations) do
|
|||||||
wallmounted_values[i] = compute_values(r)
|
wallmounted_values[i] = compute_values(r)
|
||||||
end
|
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
|
-- Clip position property to maximum entity position
|
||||||
|
|
||||||
local function clip_pos_prop(posprop)
|
local function clip_pos_prop(posprop)
|
||||||
@@ -222,6 +243,16 @@ function display_api.on_place(itemstack, placer, pointed_thing, override_param2)
|
|||||||
z = pointed_thing.under.z - pointed_thing.above.z,
|
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
|
local param2 = 0
|
||||||
if ndef then
|
if ndef then
|
||||||
if ndef.paramtype2 == "wallmounted" or
|
if ndef.paramtype2 == "wallmounted" or
|
||||||
@@ -230,7 +261,7 @@ function display_api.on_place(itemstack, placer, pointed_thing, override_param2)
|
|||||||
|
|
||||||
elseif ndef.paramtype2 == "facedir" or
|
elseif ndef.paramtype2 == "facedir" or
|
||||||
ndef.paramtype2 == "colorfacedir" then
|
ndef.paramtype2 == "colorfacedir" then
|
||||||
param2 = minetest.dir_to_facedir(dir, true)
|
param2 = minetest.dir_to_facedir(dir, not rotation_restriction)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return minetest.item_place(itemstack, placer, pointed_thing,
|
return minetest.item_place(itemstack, placer, pointed_thing,
|
||||||
@@ -251,15 +282,6 @@ function display_api.on_destruct(pos)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function display_api.on_blast(pos, intensity)
|
|
||||||
if not minetest.is_protected(pos, "") then
|
|
||||||
local node = minetest.get_node(pos)
|
|
||||||
local drops = minetest.get_node_drops(node, "tnt:blast")
|
|
||||||
minetest.remove_node(pos)
|
|
||||||
return drops
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- On_rotate (screwdriver) callback for display_api items. Prevents invalid
|
-- On_rotate (screwdriver) callback for display_api items. Prevents invalid
|
||||||
-- rotations and reorients entities.
|
-- rotations and reorients entities.
|
||||||
function display_api.on_rotate(pos, node, user, _, new_param2)
|
function display_api.on_rotate(pos, node, user, _, new_param2)
|
||||||
@@ -269,29 +291,26 @@ function display_api.on_rotate(pos, node, user, _, new_param2)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if ov.restricted or not display_api.is_rotation_restricted() then
|
||||||
minetest.swap_node(pos, node)
|
minetest.swap_node(pos, node)
|
||||||
display_api.update_entities(pos)
|
display_api.update_entities(pos)
|
||||||
return true
|
return true
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Creates display entity with some fields and the on_activate callback
|
--- Creates display entity with some fields and the on_activate callback
|
||||||
function display_api.register_display_entity(entity_name)
|
function display_api.register_display_entity(entity_name)
|
||||||
if not minetest.registered_entities[entity_name] then
|
if not minetest.registered_entities[entity_name] then
|
||||||
minetest.register_entity(':'..entity_name, {
|
minetest.register_entity(':'..entity_name, {
|
||||||
initial_properties = {
|
collisionbox = { 0, 0, 0, 0, 0, 0 },
|
||||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
|
||||||
visual = "upright_sprite",
|
visual = "upright_sprite",
|
||||||
textures = {},
|
textures = {},
|
||||||
collide_with_objects = false,
|
|
||||||
pointable = false
|
|
||||||
},
|
|
||||||
on_activate = display_api.on_activate,
|
on_activate = display_api.on_activate,
|
||||||
get_staticdata = function(self)
|
get_staticdata = function(self)
|
||||||
return minetest.serialize({ nodepos = self.nodepos })
|
return minetest.serialize({ nodepos = self.nodepos })
|
||||||
end,
|
end,
|
||||||
on_blast = function(self, damage)
|
|
||||||
return false, false, {}
|
|
||||||
end,
|
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -29,3 +29,5 @@ display_api.path = minetest.get_modpath(display_api.name)
|
|||||||
|
|
||||||
dofile(display_api.path.."/display.lua")
|
dofile(display_api.path.."/display.lua")
|
||||||
dofile(display_api.path.."/deprecation.lua")
|
dofile(display_api.path.."/deprecation.lua")
|
||||||
|
|
||||||
|
minetest.log("action", "[display_api] loaded.")
|
||||||
|
|||||||
@@ -1,188 +0,0 @@
|
|||||||
--
|
|
||||||
-- fonts_extra: A font mod for font_api
|
|
||||||
--
|
|
||||||
-- This file was generated by `../font_api/tools/make_font.lua` on 2025-10-12 at 10:26.
|
|
||||||
--
|
|
||||||
|
|
||||||
-- Font generated from file sources/pixeldroidBoticRegular.otf with pointsize 16
|
|
||||||
font_api.register_font(
|
|
||||||
'botic',
|
|
||||||
{
|
|
||||||
version = 2,
|
|
||||||
default = true,
|
|
||||||
margintop = 0,
|
|
||||||
linespacing = 0,
|
|
||||||
charspacing = 2,
|
|
||||||
texture_height = 39,
|
|
||||||
glyphs_height = 13,
|
|
||||||
glyphs = {
|
|
||||||
[0] = { 8, 45, 25, 0 }, [162] = { 6, 45, 32, 1 },
|
|
||||||
[8364] = { 7, 45, 38, 1 }, [248] = { 8, 40, 2, 2 },
|
|
||||||
[247] = { 6, 45, 37, 1 }, [216] = { 8, 40, 1, 2 },
|
|
||||||
[215] = { 6, 45, 36, 1 }, [187] = { 8, 40, 0, 2 },
|
|
||||||
[183] = { 5, 60, 32, 0 }, [176] = { 5, 60, 31, 0 },
|
|
||||||
[174] = { 9, 36, 13, 2 }, [171] = { 8, 40, 39, 1 },
|
|
||||||
[169] = { 9, 36, 12, 2 }, [168] = { 6, 45, 35, 1 },
|
|
||||||
[167] = { 5, 60, 30, 0 }, [166] = { 3, 90, 8, 0 },
|
|
||||||
[165] = { 7, 45, 34, 1 }, [164] = { 6, 45, 33, 1 },
|
|
||||||
[163] = { 9, 36, 11, 2 }, [32] = { 7 }, [33] = { 4, 72, 8, 0 },
|
|
||||||
[34] = { 5, 60, 13, 0 }, [35] = { 7, 45, 26, 0 },
|
|
||||||
[36] = { 7, 45, 27, 0 }, [37] = { 9, 36, 3, 2 },
|
|
||||||
[38] = { 9, 36, 4, 2 }, [39] = { 2, 120, 0, 0 },
|
|
||||||
[40] = { 4, 72, 9, 0 }, [41] = { 4, 72, 10, 0 },
|
|
||||||
[42] = { 5, 60, 14, 0 }, [43] = { 6, 45, 28, 0 },
|
|
||||||
[44] = { 3, 90, 2, 0 }, [45] = { 5, 60, 15, 0 },
|
|
||||||
[46] = { 3, 90, 3, 0 }, [47] = { 7, 45, 29, 0 },
|
|
||||||
[48] = { 7, 45, 30, 0 }, [49] = { 5, 60, 16, 0 },
|
|
||||||
[50] = { 7, 45, 31, 0 }, [51] = { 7, 45, 32, 0 },
|
|
||||||
[52] = { 7, 45, 33, 0 }, [53] = { 7, 45, 34, 0 },
|
|
||||||
[54] = { 7, 45, 35, 0 }, [55] = { 7, 45, 36, 0 },
|
|
||||||
[56] = { 7, 45, 37, 0 }, [57] = { 7, 45, 38, 0 },
|
|
||||||
[58] = { 5, 60, 17, 0 }, [59] = { 3, 90, 4, 0 },
|
|
||||||
[60] = { 5, 60, 18, 0 }, [61] = { 5, 60, 19, 0 },
|
|
||||||
[62] = { 5, 60, 20, 0 }, [63] = { 7, 45, 39, 0 },
|
|
||||||
[64] = { 9, 36, 5, 2 }, [65] = { 7, 45, 40, 0 },
|
|
||||||
[66] = { 7, 45, 41, 0 }, [67] = { 7, 45, 42, 0 },
|
|
||||||
[68] = { 7, 45, 43, 0 }, [69] = { 7, 45, 44, 0 },
|
|
||||||
[70] = { 6, 45, 0, 1 }, [71] = { 7, 45, 1, 1 },
|
|
||||||
[72] = { 7, 45, 2, 1 }, [73] = { 3, 90, 5, 0 },
|
|
||||||
[74] = { 5, 60, 21, 0 }, [75] = { 7, 45, 3, 1 },
|
|
||||||
[76] = { 6, 45, 4, 1 }, [77] = { 9, 36, 6, 2 },
|
|
||||||
[78] = { 7, 45, 5, 1 }, [79] = { 7, 45, 6, 1 },
|
|
||||||
[80] = { 7, 45, 7, 1 }, [81] = { 8, 40, 35, 1 },
|
|
||||||
[82] = { 7, 45, 8, 1 }, [83] = { 7, 45, 9, 1 },
|
|
||||||
[84] = { 8, 40, 36, 1 }, [85] = { 7, 45, 10, 1 },
|
|
||||||
[86] = { 6, 45, 11, 1 }, [87] = { 9, 36, 7, 2 },
|
|
||||||
[88] = { 8, 40, 37, 1 }, [89] = { 7, 45, 12, 1 },
|
|
||||||
[90] = { 8, 40, 38, 1 }, [91] = { 4, 72, 11, 0 },
|
|
||||||
[92] = { 6, 45, 13, 1 }, [93] = { 4, 72, 12, 0 },
|
|
||||||
[94] = { 7, 45, 14, 1 }, [95] = { 9, 36, 8, 2 },
|
|
||||||
[96] = { 3, 90, 6, 0 }, [97] = { 7, 45, 15, 1 },
|
|
||||||
[98] = { 7, 45, 16, 1 }, [99] = { 6, 45, 17, 1 },
|
|
||||||
[100] = { 7, 45, 18, 1 }, [101] = { 7, 45, 19, 1 },
|
|
||||||
[102] = { 5, 60, 22, 0 }, [103] = { 7, 45, 20, 1 },
|
|
||||||
[104] = { 6, 45, 21, 1 }, [105] = { 3, 90, 7, 0 },
|
|
||||||
[106] = { 4, 72, 13, 0 }, [107] = { 6, 45, 22, 1 },
|
|
||||||
[108] = { 4, 72, 14, 0 }, [109] = { 9, 36, 9, 2 },
|
|
||||||
[110] = { 6, 45, 23, 1 }, [111] = { 7, 45, 24, 1 },
|
|
||||||
[112] = { 7, 45, 25, 1 }, [113] = { 7, 45, 26, 1 },
|
|
||||||
[114] = { 5, 60, 23, 0 }, [115] = { 7, 45, 27, 1 },
|
|
||||||
[116] = { 5, 60, 24, 0 }, [117] = { 7, 45, 28, 1 },
|
|
||||||
[118] = { 5, 60, 25, 0 }, [119] = { 9, 36, 10, 2 },
|
|
||||||
[120] = { 7, 45, 29, 1 }, [121] = { 7, 45, 30, 1 },
|
|
||||||
[122] = { 6, 45, 31, 1 }, [123] = { 5, 60, 26, 0 },
|
|
||||||
[124] = { 2, 120, 1, 0 }, [125] = { 5, 60, 27, 0 },
|
|
||||||
[126] = { 5, 60, 28, 0 }, [161] = { 5, 60, 29, 0 },
|
|
||||||
},
|
|
||||||
}
|
|
||||||
)
|
|
||||||
-- Font generated from file sources/OldWizard.ttf with pointsize 16
|
|
||||||
font_api.register_font(
|
|
||||||
'oldwizard',
|
|
||||||
{
|
|
||||||
version = 2,
|
|
||||||
default = true,
|
|
||||||
margintop = 0,
|
|
||||||
linespacing = 0,
|
|
||||||
charspacing = 2,
|
|
||||||
texture_height = 25674,
|
|
||||||
glyphs_height = 389,
|
|
||||||
glyphs = {
|
|
||||||
[32] = { 18 }, [33] = { 3, 90, 0, 0 }, [34] = { 5, 60, 2, 0 },
|
|
||||||
[35] = { 8, 40, 6, 0 }, [36] = { 10, 30, 8, 0 },
|
|
||||||
[37] = { 14, 24, 8, 0 }, [38] = { 12, 24, 9, 0 },
|
|
||||||
[39] = { 3, 90, 1, 0 }, [40] = { 8, 40, 7, 0 },
|
|
||||||
[41] = { 9, 36, 8, 0 }, [42] = { 10, 30, 9, 0 },
|
|
||||||
[43] = { 16, 20, 11, 0 }, [44] = { 7, 45, 4, 0 },
|
|
||||||
[45] = { 14, 24, 10, 0 }, [46] = { 7, 45, 5, 0 },
|
|
||||||
[47] = { 15, 20, 12, 0 }, [48] = { 18, 18, 13, 0 },
|
|
||||||
[49] = { 17, 20, 13, 0 }, [50] = { 26, 12, 0, 1 },
|
|
||||||
[51] = { 18, 18, 14, 0 }, [52] = { 22, 15, 13, 0 },
|
|
||||||
[53] = { 23, 15, 14, 0 }, [54] = { 24, 12, 1, 1 },
|
|
||||||
[55] = { 25, 12, 2, 1 }, [56] = { 25, 12, 3, 1 },
|
|
||||||
[57] = { 26, 12, 4, 1 }, [58] = { 12, 24, 11, 0 },
|
|
||||||
[59] = { 12, 24, 12, 0 }, [60] = { 33, 10, 8, 1 },
|
|
||||||
[61] = { 30, 10, 9, 1 }, [62] = { 35, 10, 0, 2 },
|
|
||||||
[63] = { 27, 12, 5, 1 }, [64] = { 60, 5, 0, 7 },
|
|
||||||
[65] = { 43, 8, 4, 2 }, [66] = { 39, 9, 2, 2 },
|
|
||||||
[67] = { 45, 6, 1, 3 }, [68] = { 52, 6, 2, 3 },
|
|
||||||
[69] = { 42, 8, 5, 2 }, [70] = { 54, 6, 3, 3 },
|
|
||||||
[71] = { 49, 6, 4, 3 }, [72] = { 51, 6, 5, 3 },
|
|
||||||
[73] = { 52, 6, 0, 4 }, [74] = { 65, 5, 1, 7 },
|
|
||||||
[75] = { 60, 5, 2, 7 }, [76] = { 62, 5, 3, 7 },
|
|
||||||
[77] = { 88, 4, 0, 10 }, [78] = { 77, 4, 1, 10 },
|
|
||||||
[79] = { 58, 6, 1, 4 }, [80] = { 67, 5, 4, 7 },
|
|
||||||
[81] = { 67, 5, 0, 8 }, [82] = { 76, 4, 2, 10 },
|
|
||||||
[83] = { 70, 5, 1, 8 }, [84] = { 72, 4, 3, 10 },
|
|
||||||
[85] = { 73, 4, 0, 11 }, [86] = { 74, 4, 1, 11 },
|
|
||||||
[87] = { 113, 3, 0, 16 }, [88] = { 84, 4, 2, 11 },
|
|
||||||
[89] = { 85, 4, 3, 11 }, [90] = { 87, 4, 0, 12 },
|
|
||||||
[91] = { 48, 6, 2, 4 }, [92] = { 49, 6, 3, 4 },
|
|
||||||
[93] = { 50, 6, 4, 4 }, [94] = { 50, 6, 5, 4 },
|
|
||||||
[95] = { 76, 4, 1, 12 }, [96] = { 26, 12, 6, 1 },
|
|
||||||
[97] = { 61, 5, 2, 8 }, [98] = { 62, 5, 3, 8 },
|
|
||||||
[99] = { 54, 6, 0, 5 }, [100] = { 55, 6, 1, 5 },
|
|
||||||
[101] = { 56, 6, 2, 5 }, [102] = { 56, 6, 3, 5 },
|
|
||||||
[103] = { 67, 5, 4, 8 }, [104] = { 77, 4, 2, 12 },
|
|
||||||
[105] = { 40, 8, 6, 2 }, [106] = { 40, 8, 7, 2 },
|
|
||||||
[107] = { 90, 3, 1, 16 }, [108] = { 42, 8, 0, 3 },
|
|
||||||
[109] = { 124, 2, 1, 22 }, [110] = { 84, 4, 3, 12 },
|
|
||||||
[111] = { 63, 5, 0, 9 }, [112] = { 74, 4, 0, 13 },
|
|
||||||
[113] = { 75, 4, 1, 13 }, [114] = { 76, 4, 2, 13 },
|
|
||||||
[115] = { 66, 5, 1, 9 }, [116] = { 46, 6, 4, 5 },
|
|
||||||
[117] = { 102, 3, 2, 16 }, [118] = { 92, 3, 0, 17 },
|
|
||||||
[119] = { 127, 2, 0, 23 }, [120] = { 105, 3, 1, 17 },
|
|
||||||
[121] = { 83, 4, 3, 13 }, [122] = { 95, 3, 2, 17 },
|
|
||||||
[123] = { 72, 4, 0, 14 }, [124] = { 25, 12, 7, 1 },
|
|
||||||
[125] = { 74, 4, 1, 14 }, [126] = { 99, 3, 0, 18 },
|
|
||||||
[161] = { 38, 9, 3, 2 }, [162] = { 88, 4, 2, 14 },
|
|
||||||
[163] = { 128, 2, 1, 23 }, [164] = { 90, 3, 1, 18 },
|
|
||||||
[165] = { 117, 3, 2, 18 }, [166] = { 27, 12, 8, 1 },
|
|
||||||
[167] = { 93, 3, 0, 19 }, [168] = { 54, 6, 5, 5 },
|
|
||||||
[169] = { 135, 2, 0, 24 }, [170] = { 55, 6, 0, 6 },
|
|
||||||
[171] = { 110, 3, 1, 19 }, [172] = { 97, 3, 2, 19 },
|
|
||||||
[174] = { 140, 2, 1, 24 }, [175] = { 113, 3, 0, 20 },
|
|
||||||
[176] = { 71, 5, 2, 9 }, [177] = { 115, 3, 1, 20 },
|
|
||||||
[178] = { 58, 6, 1, 6 }, [179] = { 59, 6, 2, 6 },
|
|
||||||
[180] = { 45, 6, 3, 6 }, [181] = { 105, 3, 2, 20 },
|
|
||||||
[182] = { 105, 3, 0, 21 }, [183] = { 46, 6, 4, 6 },
|
|
||||||
[184] = { 61, 5, 3, 9 }, [185] = { 31, 10, 1, 2 },
|
|
||||||
[186] = { 78, 4, 3, 14 }, [187] = { 125, 2, 0, 25 },
|
|
||||||
[188] = { 142, 2, 1, 25 }, [189] = { 159, 2, 0, 26 },
|
|
||||||
[190] = { 160, 2, 1, 26 }, [191] = { 113, 3, 1, 21 },
|
|
||||||
[192] = { 146, 2, 0, 27 }, [193] = { 147, 2, 1, 27 },
|
|
||||||
[194] = { 148, 2, 0, 28 }, [195] = { 150, 2, 1, 28 },
|
|
||||||
[196] = { 151, 2, 0, 29 }, [197] = { 152, 2, 1, 29 },
|
|
||||||
[198] = { 221, 1, 0, 49 }, [199] = { 154, 2, 0, 30 },
|
|
||||||
[200] = { 138, 2, 1, 30 }, [201] = { 139, 2, 0, 31 },
|
|
||||||
[202] = { 140, 2, 1, 31 }, [203] = { 141, 2, 0, 32 },
|
|
||||||
[204] = { 160, 2, 1, 32 }, [205] = { 161, 2, 0, 33 },
|
|
||||||
[206] = { 162, 2, 1, 33 }, [207] = { 164, 2, 0, 34 },
|
|
||||||
[208] = { 183, 1, 0, 50 }, [209] = { 221, 1, 0, 51 },
|
|
||||||
[210] = { 166, 2, 1, 34 }, [211] = { 168, 2, 0, 35 },
|
|
||||||
[212] = { 169, 2, 1, 35 }, [213] = { 170, 2, 0, 36 },
|
|
||||||
[214] = { 171, 2, 1, 36 }, [215] = { 115, 3, 2, 21 },
|
|
||||||
[216] = { 192, 1, 0, 52 }, [217] = { 194, 1, 0, 53 },
|
|
||||||
[218] = { 195, 1, 0, 54 }, [219] = { 197, 1, 0, 55 },
|
|
||||||
[220] = { 198, 1, 0, 56 }, [221] = { 219, 1, 0, 57 },
|
|
||||||
[222] = { 160, 2, 0, 37 }, [223] = { 161, 2, 1, 37 },
|
|
||||||
[224] = { 142, 2, 0, 38 }, [225] = { 143, 2, 1, 38 },
|
|
||||||
[226] = { 144, 2, 0, 39 }, [227] = { 144, 2, 1, 39 },
|
|
||||||
[228] = { 145, 2, 0, 40 }, [229] = { 146, 2, 1, 40 },
|
|
||||||
[230] = { 210, 1, 0, 58 }, [231] = { 127, 2, 0, 41 },
|
|
||||||
[232] = { 128, 2, 1, 41 }, [233] = { 128, 2, 0, 42 },
|
|
||||||
[234] = { 129, 2, 1, 42 }, [235] = { 130, 2, 0, 43 },
|
|
||||||
[236] = { 88, 4, 0, 15 }, [237] = { 88, 4, 1, 15 },
|
|
||||||
[238] = { 88, 4, 2, 15 }, [239] = { 90, 3, 0, 22 },
|
|
||||||
[240] = { 156, 2, 1, 43 }, [241] = { 180, 1, 0, 59 },
|
|
||||||
[242] = { 135, 2, 0, 44 }, [243] = { 136, 2, 1, 44 },
|
|
||||||
[244] = { 137, 2, 0, 45 }, [245] = { 137, 2, 1, 45 },
|
|
||||||
[246] = { 138, 2, 0, 46 }, [247] = { 185, 1, 0, 60 },
|
|
||||||
[248] = { 163, 2, 1, 46 }, [249] = { 211, 1, 0, 61 },
|
|
||||||
[250] = { 212, 1, 0, 62 }, [251] = { 213, 1, 0, 63 },
|
|
||||||
[252] = { 214, 1, 0, 64 }, [253] = { 167, 2, 0, 47 },
|
|
||||||
[254] = { 144, 2, 1, 47 }, [255] = { 170, 2, 0, 48 },
|
|
||||||
[0] = { 8, 45, 3, 0 }, [8364] = { 243, 1, 0, 65 },
|
|
||||||
},
|
|
||||||
}
|
|
||||||
)
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
name = fonts_extra
|
|
||||||
title = Extra fonts
|
|
||||||
description = Extra fonts for font_api: botic
|
|
||||||
depends = font_api
|
|
||||||
@@ -1,132 +0,0 @@
|
|||||||
|
|
||||||
-- This is an example parameter file for make_font.lua
|
|
||||||
-- Copy this file as params.lua.
|
|
||||||
-- Replace values between brakets <> to your choices.
|
|
||||||
-- Launch make_font.lua params.lua
|
|
||||||
|
|
||||||
params = {
|
|
||||||
-- Resulting mod name (required)
|
|
||||||
-- As this name will be use as texture prefix and so repeated many times,
|
|
||||||
-- please avoid long names but keep explicit anyway.
|
|
||||||
mod_name = "fonts_extra",
|
|
||||||
|
|
||||||
-- If only one font, have font in title, like "xxx font"
|
|
||||||
mod_title = "Extra fonts",
|
|
||||||
|
|
||||||
-- A good description would be "... fonts for font_api"
|
|
||||||
mod_description = "Extra fonts for font_api: botic",
|
|
||||||
|
|
||||||
-- List of fons to include to the mod.
|
|
||||||
fonts = {
|
|
||||||
{
|
|
||||||
-- Registered font name (required)
|
|
||||||
-- As this name will be use as texture prefix and so repeated many times,
|
|
||||||
-- avoid long names. A good name would be a single world all lowercase.
|
|
||||||
name = "botic",
|
|
||||||
|
|
||||||
-- Registered font label (optional, default capitalized name)
|
|
||||||
-- This is the display name for this font. No need to be concise.
|
|
||||||
label = "Botic",
|
|
||||||
|
|
||||||
-- True type font file to get glyphs from (required)
|
|
||||||
file = "sources/pixeldroidBoticRegular.otf",
|
|
||||||
|
|
||||||
-- Author(s) of the original font (required)
|
|
||||||
author = "pixeldroid",
|
|
||||||
|
|
||||||
-- License of the original font (required)
|
|
||||||
-- Join license text, as a text file, to your mod.
|
|
||||||
license = "Open Font License",
|
|
||||||
|
|
||||||
-- Render pointsize (integer, required)
|
|
||||||
-- Try to find a proper value for a good rendering
|
|
||||||
pointsize = 16,
|
|
||||||
|
|
||||||
-- Shoud chars be trimmed? (boolean, required)
|
|
||||||
-- Set it to true to reduce texture size
|
|
||||||
-- and increase `char_spacing` accordingly.
|
|
||||||
-- If results are weird, you may try to set it to false.
|
|
||||||
trim = true,
|
|
||||||
|
|
||||||
-- Margin added on top of text textures with this font (integer, optional, default 0)
|
|
||||||
margin_top = 0,
|
|
||||||
|
|
||||||
-- Space between consecutive lines (integer, optional, default 0)
|
|
||||||
-- Space may be negative to make lines closer.
|
|
||||||
line_spacing = 0,
|
|
||||||
|
|
||||||
-- Space between consecutive chars (integer, optional, default 0)
|
|
||||||
char_spacing = 2,
|
|
||||||
|
|
||||||
-- Extra codepoints to include to font mod (optional, default none)
|
|
||||||
-- Codepoints from 0x0020 to 0x007f (ASCII) are always included.
|
|
||||||
-- Codepoint 0x0020 is always considered as a space.
|
|
||||||
-- Codepoints not existing in font file will be ignored.
|
|
||||||
-- Refer to https://en.wikipedia.org/wiki/Unicode
|
|
||||||
codepoints = {
|
|
||||||
-- 00a0-00ff Latin-1 Supplement (full except nbsp)
|
|
||||||
{ from = 0x00a1, to = 0x00ff },
|
|
||||||
|
|
||||||
-- 20a0-20cf Currency Symbols (Limited to Euro symbol)
|
|
||||||
{ from = 0x20ac, to = 0x20ac },
|
|
||||||
},
|
|
||||||
}, {
|
|
||||||
-- Registered font name (required)
|
|
||||||
-- As this name will be use as texture prefix and so repeated many times,
|
|
||||||
-- avoid long names. A good name would be a single world all lowercase.
|
|
||||||
name = "oldwizard",
|
|
||||||
|
|
||||||
-- Registered font label (optional, default capitalized name)
|
|
||||||
-- This is the display name for this font. No need to be concise.
|
|
||||||
label = "Old Wizard",
|
|
||||||
|
|
||||||
-- True type font file to get glyphs from (required)
|
|
||||||
file = "sources/OldWizard.ttf",
|
|
||||||
|
|
||||||
-- Author(s) of the original font (required)
|
|
||||||
author = "Angel",
|
|
||||||
|
|
||||||
-- License of the original font (required)
|
|
||||||
-- Join license text, as a text file, to your mod.
|
|
||||||
license = "Public Domain",
|
|
||||||
|
|
||||||
-- URL of the original font (optional)
|
|
||||||
-- This is an optional field but it is recommended to put an URL
|
|
||||||
-- if it exists.
|
|
||||||
url = "http://www.pentacom.jp/pentacom/bitfontmaker2/gallery/?id=168",
|
|
||||||
|
|
||||||
-- Render pointsize (integer, required)
|
|
||||||
-- Try to find a proper value for a good rendering
|
|
||||||
pointsize = 16,
|
|
||||||
|
|
||||||
-- Shoud chars be trimmed? (boolean, required)
|
|
||||||
-- Set it to true to reduce texture size
|
|
||||||
-- and increase `char_spacing` accordingly.
|
|
||||||
-- If results are weird, you may try to set it to false.
|
|
||||||
trim = true,
|
|
||||||
|
|
||||||
-- Margin added on top of text textures with this font (integer, optional, default 0)
|
|
||||||
margin_top = 0,
|
|
||||||
|
|
||||||
-- Space between consecutive lines (integer, optional, default 0)
|
|
||||||
-- Space may be negative to make lines closer.
|
|
||||||
line_spacing = 0,
|
|
||||||
|
|
||||||
-- Space between consecutive chars (integer, optional, default 0)
|
|
||||||
char_spacing = 2,
|
|
||||||
|
|
||||||
-- Extra codepoints to include to font mod (optional, default none)
|
|
||||||
-- Codepoints from 0x0020 to 0x007f (ASCII) are always included.
|
|
||||||
-- Codepoint 0x0020 is always considered as a space.
|
|
||||||
-- Codepoints not existing in font file will be ignored.
|
|
||||||
-- Refer to https://en.wikipedia.org/wiki/Unicode
|
|
||||||
codepoints = {
|
|
||||||
-- 00a0-00ff Latin-1 Supplement (full except nbsp)
|
|
||||||
{ from = 0x00a1, to = 0x00ff },
|
|
||||||
|
|
||||||
-- 20a0-20cf Currency Symbols (Limited to Euro symbol)
|
|
||||||
{ from = 0x20ac, to = 0x20ac },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 26 KiB |
@@ -1,7 +1,3 @@
|
|||||||
## TODO:
|
|
||||||
* Update documentation with new format
|
|
||||||
* add information about texture having to be escaped in formspecs with `:gsub("[\\^]", "\\%0")`
|
|
||||||
|
|
||||||
# Font API
|
# Font API
|
||||||
This document describes Font API. Font API creates textures for font display on entities.
|
This document describes Font API. Font API creates textures for font display on entities.
|
||||||
|
|
||||||
|
|||||||
166
font_api/LICENSE.txt
Normal file
@@ -0,0 +1,166 @@
|
|||||||
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
|
||||||
|
This version of the GNU Lesser General Public License incorporates
|
||||||
|
the terms and conditions of version 3 of the GNU General Public
|
||||||
|
License, supplemented by the additional permissions listed below.
|
||||||
|
|
||||||
|
0. Additional Definitions.
|
||||||
|
|
||||||
|
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||||
|
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||||
|
General Public License.
|
||||||
|
|
||||||
|
"The Library" refers to a covered work governed by this License,
|
||||||
|
other than an Application or a Combined Work as defined below.
|
||||||
|
|
||||||
|
An "Application" is any work that makes use of an interface provided
|
||||||
|
by the Library, but which is not otherwise based on the Library.
|
||||||
|
Defining a subclass of a class defined by the Library is deemed a mode
|
||||||
|
of using an interface provided by the Library.
|
||||||
|
|
||||||
|
A "Combined Work" is a work produced by combining or linking an
|
||||||
|
Application with the Library. The particular version of the Library
|
||||||
|
with which the Combined Work was made is also called the "Linked
|
||||||
|
Version".
|
||||||
|
|
||||||
|
The "Minimal Corresponding Source" for a Combined Work means the
|
||||||
|
Corresponding Source for the Combined Work, excluding any source code
|
||||||
|
for portions of the Combined Work that, considered in isolation, are
|
||||||
|
based on the Application, and not on the Linked Version.
|
||||||
|
|
||||||
|
The "Corresponding Application Code" for a Combined Work means the
|
||||||
|
object code and/or source code for the Application, including any data
|
||||||
|
and utility programs needed for reproducing the Combined Work from the
|
||||||
|
Application, but excluding the System Libraries of the Combined Work.
|
||||||
|
|
||||||
|
1. Exception to Section 3 of the GNU GPL.
|
||||||
|
|
||||||
|
You may convey a covered work under sections 3 and 4 of this License
|
||||||
|
without being bound by section 3 of the GNU GPL.
|
||||||
|
|
||||||
|
2. Conveying Modified Versions.
|
||||||
|
|
||||||
|
If you modify a copy of the Library, and, in your modifications, a
|
||||||
|
facility refers to a function or data to be supplied by an Application
|
||||||
|
that uses the facility (other than as an argument passed when the
|
||||||
|
facility is invoked), then you may convey a copy of the modified
|
||||||
|
version:
|
||||||
|
|
||||||
|
a) under this License, provided that you make a good faith effort to
|
||||||
|
ensure that, in the event an Application does not supply the
|
||||||
|
function or data, the facility still operates, and performs
|
||||||
|
whatever part of its purpose remains meaningful, or
|
||||||
|
|
||||||
|
b) under the GNU GPL, with none of the additional permissions of
|
||||||
|
this License applicable to that copy.
|
||||||
|
|
||||||
|
3. Object Code Incorporating Material from Library Header Files.
|
||||||
|
|
||||||
|
The object code form of an Application may incorporate material from
|
||||||
|
a header file that is part of the Library. You may convey such object
|
||||||
|
code under terms of your choice, provided that, if the incorporated
|
||||||
|
material is not limited to numerical parameters, data structure
|
||||||
|
layouts and accessors, or small macros, inline functions and templates
|
||||||
|
(ten or fewer lines in length), you do both of the following:
|
||||||
|
|
||||||
|
a) Give prominent notice with each copy of the object code that the
|
||||||
|
Library is used in it and that the Library and its use are
|
||||||
|
covered by this License.
|
||||||
|
|
||||||
|
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||||
|
document.
|
||||||
|
|
||||||
|
4. Combined Works.
|
||||||
|
|
||||||
|
You may convey a Combined Work under terms of your choice that,
|
||||||
|
taken together, effectively do not restrict modification of the
|
||||||
|
portions of the Library contained in the Combined Work and reverse
|
||||||
|
engineering for debugging such modifications, if you also do each of
|
||||||
|
the following:
|
||||||
|
|
||||||
|
a) Give prominent notice with each copy of the Combined Work that
|
||||||
|
the Library is used in it and that the Library and its use are
|
||||||
|
covered by this License.
|
||||||
|
|
||||||
|
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||||
|
document.
|
||||||
|
|
||||||
|
c) For a Combined Work that displays copyright notices during
|
||||||
|
execution, include the copyright notice for the Library among
|
||||||
|
these notices, as well as a reference directing the user to the
|
||||||
|
copies of the GNU GPL and this license document.
|
||||||
|
|
||||||
|
d) Do one of the following:
|
||||||
|
|
||||||
|
0) Convey the Minimal Corresponding Source under the terms of this
|
||||||
|
License, and the Corresponding Application Code in a form
|
||||||
|
suitable for, and under terms that permit, the user to
|
||||||
|
recombine or relink the Application with a modified version of
|
||||||
|
the Linked Version to produce a modified Combined Work, in the
|
||||||
|
manner specified by section 6 of the GNU GPL for conveying
|
||||||
|
Corresponding Source.
|
||||||
|
|
||||||
|
1) Use a suitable shared library mechanism for linking with the
|
||||||
|
Library. A suitable mechanism is one that (a) uses at run time
|
||||||
|
a copy of the Library already present on the user's computer
|
||||||
|
system, and (b) will operate properly with a modified version
|
||||||
|
of the Library that is interface-compatible with the Linked
|
||||||
|
Version.
|
||||||
|
|
||||||
|
e) Provide Installation Information, but only if you would otherwise
|
||||||
|
be required to provide such information under section 6 of the
|
||||||
|
GNU GPL, and only to the extent that such information is
|
||||||
|
necessary to install and execute a modified version of the
|
||||||
|
Combined Work produced by recombining or relinking the
|
||||||
|
Application with a modified version of the Linked Version. (If
|
||||||
|
you use option 4d0, the Installation Information must accompany
|
||||||
|
the Minimal Corresponding Source and Corresponding Application
|
||||||
|
Code. If you use option 4d1, you must provide the Installation
|
||||||
|
Information in the manner specified by section 6 of the GNU GPL
|
||||||
|
for conveying Corresponding Source.)
|
||||||
|
|
||||||
|
5. Combined Libraries.
|
||||||
|
|
||||||
|
You may place library facilities that are a work based on the
|
||||||
|
Library side by side in a single library together with other library
|
||||||
|
facilities that are not Applications and are not covered by this
|
||||||
|
License, and convey such a combined library under terms of your
|
||||||
|
choice, if you do both of the following:
|
||||||
|
|
||||||
|
a) Accompany the combined library with a copy of the same work based
|
||||||
|
on the Library, uncombined with any other library facilities,
|
||||||
|
conveyed under the terms of this License.
|
||||||
|
|
||||||
|
b) Give prominent notice with the combined library that part of it
|
||||||
|
is a work based on the Library, and explaining where to find the
|
||||||
|
accompanying uncombined form of the same work.
|
||||||
|
|
||||||
|
6. Revised Versions of the GNU Lesser General Public License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the GNU Lesser General Public License from time to time. Such new
|
||||||
|
versions will be similar in spirit to the present version, but may
|
||||||
|
differ in detail to address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Library as you received it specifies that a certain numbered version
|
||||||
|
of the GNU Lesser General Public License "or any later version"
|
||||||
|
applies to it, you have the option of following the terms and
|
||||||
|
conditions either of that published version or of any later version
|
||||||
|
published by the Free Software Foundation. If the Library as you
|
||||||
|
received it does not specify a version number of the GNU Lesser
|
||||||
|
General Public License, you may choose any version of the GNU Lesser
|
||||||
|
General Public License ever published by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Library as you received it specifies that a proxy can decide
|
||||||
|
whether future versions of the GNU Lesser General Public License shall
|
||||||
|
apply, that proxy's public statement of acceptance of any version is
|
||||||
|
permanent authorization for you to choose that version for the
|
||||||
|
Library.
|
||||||
|
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
A library for rendernig text on textures (to be used with display_api for sign creation).
|
A library for rendernig text on textures (to be used with display_api for sign creation).
|
||||||
|
|
||||||
**Dependencies**: xcompat
|
**Dependancies**: default
|
||||||
|
|
||||||
**License**: LGPL
|
**License**: LGPL
|
||||||
|
|
||||||
|
|||||||
3
font_api/copyright.txt
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
Code by Pierre-Yves Rollo (pyrollo)
|
||||||
|
Contributors:
|
||||||
|
Andrzej Pieńkowski (apienk): Unicode support and tool for creating texturess
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
-- Deprecation
|
-- Deprecation
|
||||||
|
|
||||||
local function deprecated_global_table(deprecated_global_name, replacement_global_name)
|
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(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(type(replacement_global_name) == 'string', "replacement_global_name should be a string.")
|
||||||
assert(deprecated_global_name ~= '', "deprecated_global_name should not be empty.")
|
assert(deprecated_global_name ~= '', "deprecated_global_name should not be empty.")
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ return {
|
|||||||
['×'] = 'x', ['Ý'] = 'Y',
|
['×'] = 'x', ['Ý'] = 'Y',
|
||||||
|
|
||||||
-- Lower case accents
|
-- Lower case accents
|
||||||
['à'] = 'a', ['á'] = 'a', ['â'] = 'a',
|
['à'] = 'a', ['à'] = 'a', ['á'] = 'a', ['â'] = 'a',
|
||||||
['ã'] = 'a', ['ä'] = 'a', ['å'] = 'a',
|
['ã'] = 'a', ['ä'] = 'a', ['å'] = 'a',
|
||||||
['æ'] = 'ae', ['ç'] = 'c',
|
['æ'] = 'ae', ['ç'] = 'c',
|
||||||
['è'] = 'e', ['é'] = 'e', ['ê'] = 'e', ['ë'] = 'e',
|
['è'] = 'e', ['é'] = 'e', ['ê'] = 'e', ['ë'] = 'e',
|
||||||
|
|||||||
@@ -58,7 +58,6 @@ end
|
|||||||
--- Font class
|
--- Font class
|
||||||
|
|
||||||
local Font = {}
|
local Font = {}
|
||||||
Font.__index = Font
|
|
||||||
font_api.Font = Font
|
font_api.Font = Font
|
||||||
|
|
||||||
function Font:new(def)
|
function Font:new(def)
|
||||||
@@ -69,68 +68,36 @@ function Font:new(def)
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
local font = table.copy(def)
|
if def.height == nil or def.height <= 0 then
|
||||||
|
|
||||||
-- Version 1 is with one texture per glyph
|
|
||||||
if font.version == nil or font.version == 1 then
|
|
||||||
if font.height == nil or font.height <= 0 then
|
|
||||||
minetest.log("error",
|
minetest.log("error",
|
||||||
"[font_api] Font definition must have a positive height.")
|
"[font_api] Font definition must have a positive height.")
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
if type(font.widths) ~= "table" then
|
if type(def.widths) ~= "table" then
|
||||||
minetest.log("error",
|
minetest.log("error",
|
||||||
"[font_api] Font definition must have a `widths` array.")
|
"[font_api] Font definition must have a widths array.")
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Kind of convert to version 2
|
if def.widths[0] == nil then
|
||||||
|
|
||||||
font.glyphs = {}
|
|
||||||
for codepoint, width in pairs(font.widths) do
|
|
||||||
font.glyphs[codepoint] = { width, codepoint }
|
|
||||||
end
|
|
||||||
font.widths = nil
|
|
||||||
|
|
||||||
font.glyphs_height = font.height
|
|
||||||
font.height = nil
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Version 2 is with one only texture for all glyphs, using `[sheet` textures
|
|
||||||
if font.version == 2 then
|
|
||||||
if type(font.glyphs) ~= "table" then
|
|
||||||
minetest.log("error",
|
|
||||||
"[font_api] Font definition must have a `glyphs` array.")
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
if font.texture_height == nil or font.texture_height <= 0 then
|
|
||||||
minetest.log("error",
|
|
||||||
"[font_api] Font definition must have a positive `texture_height`.")
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
if font.glyphs_height == nil or font.glyphs_height <= 0 then
|
|
||||||
minetest.log("error",
|
|
||||||
"[font_api] Font definition must have a positive `glyphs_height`.")
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
font.vertical_number_of_tiles = math.floor(font.texture_height / font.glyphs_height)
|
|
||||||
end
|
|
||||||
|
|
||||||
if font.glyphs[0] == nil then
|
|
||||||
minetest.log("error",
|
minetest.log("error",
|
||||||
"[font_api] Font must have a char with codepoint 0 (=unknown char).")
|
"[font_api] Font must have a char with codepoint 0 (=unknown char).")
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.charspacing == nil then
|
local font = table.copy(def)
|
||||||
self.charspacing = 0
|
|
||||||
end
|
|
||||||
|
|
||||||
setmetatable(font, self)
|
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
|
return font
|
||||||
end
|
end
|
||||||
@@ -157,7 +124,7 @@ function Font:get_next_char(text)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Fallback mechanism
|
-- Fallback mechanism
|
||||||
if self.glyphs[codepoint] == nil then
|
if self.widths[codepoint] == nil then
|
||||||
local char = text:sub(1, bytes)
|
local char = text:sub(1, bytes)
|
||||||
|
|
||||||
if fallbacks[char] then
|
if fallbacks[char] then
|
||||||
@@ -173,29 +140,14 @@ end
|
|||||||
--- Returns the width of a given char
|
--- Returns the width of a given char
|
||||||
-- @param char : codepoint of the char
|
-- @param char : codepoint of the char
|
||||||
-- @return Char width
|
-- @return Char width
|
||||||
|
|
||||||
function Font:get_char_width(codepoint)
|
function Font:get_char_width(codepoint)
|
||||||
-- [1] is char width
|
if self.fixedwidth then
|
||||||
return (self.glyphs[codepoint] or self.glyphs[0])[1] + self.charspacing
|
return self.fixedwidth
|
||||||
end
|
elseif self.widths[codepoint] then
|
||||||
|
return self.widths[codepoint]
|
||||||
--- Returns texture for a given glyph
|
else
|
||||||
-- @param glyph: table representing the glyph
|
return self.widths[0]
|
||||||
-- @return Texture
|
|
||||||
|
|
||||||
function Font:get_glyph_texture(glyph)
|
|
||||||
if #glyph == 4 then
|
|
||||||
-- Actual version with one texture for all glyphs
|
|
||||||
return string.format("font_%s.png^[sheet:%dx%d:%d,%d",
|
|
||||||
self.name, glyph[2], self.vertical_number_of_tiles, glyph[3], glyph[4])
|
|
||||||
end
|
end
|
||||||
if #glyph == 2 then
|
|
||||||
-- Former version with one texture per glyph
|
|
||||||
return string.format("font_%s_%04x.png",
|
|
||||||
self.name, glyph[2])
|
|
||||||
end
|
|
||||||
-- Case of invisible chars like space (no need to add any texture)
|
|
||||||
return ""
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Text height for multiline text including margins and line spacing
|
--- Text height for multiline text including margins and line spacing
|
||||||
@@ -208,7 +160,7 @@ function Font:get_height(nb_of_lines)
|
|||||||
if nb_of_lines > 0 then
|
if nb_of_lines > 0 then
|
||||||
return
|
return
|
||||||
(
|
(
|
||||||
self.glyphs_height +
|
(self.height or 0) +
|
||||||
(self.margintop or 0) +
|
(self.margintop or 0) +
|
||||||
(self.marginbottom or 0)
|
(self.marginbottom or 0)
|
||||||
) * nb_of_lines +
|
) * nb_of_lines +
|
||||||
@@ -250,8 +202,8 @@ end
|
|||||||
|
|
||||||
--- Render text with the font in a view
|
--- Render text with the font in a view
|
||||||
-- @param text Text to be rendered
|
-- @param text Text to be rendered
|
||||||
-- @param width Width (in pixels) of the texture (extra text will be truncated)
|
-- @param texturew Width (in pixels) of the texture (extra text will be truncated)
|
||||||
-- @param height Height (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:
|
-- @param style Style of the rendering:
|
||||||
-- - lines: maximum number of text lines (if text is limited)
|
-- - lines: maximum number of text lines (if text is limited)
|
||||||
-- - halign: horizontal align ("left"/"center"/"right")
|
-- - halign: horizontal align ("left"/"center"/"right")
|
||||||
@@ -259,8 +211,8 @@ end
|
|||||||
-- - color: color of the text ("#rrggbb")
|
-- - color: color of the text ("#rrggbb")
|
||||||
-- @return Texture string
|
-- @return Texture string
|
||||||
|
|
||||||
function Font:render(text, width, height, style)
|
function Font:render(text, texturew, textureh, style)
|
||||||
style = style or {}
|
local style = style or {}
|
||||||
|
|
||||||
-- Split text into lines (and limit to style.lines # of lines)
|
-- Split text into lines (and limit to style.lines # of lines)
|
||||||
local lines = {}
|
local lines = {}
|
||||||
@@ -279,50 +231,44 @@ function Font:render(text, width, height, style)
|
|||||||
|
|
||||||
local x, y, codepoint
|
local x, y, codepoint
|
||||||
local texture = ""
|
local texture = ""
|
||||||
local text_height = self:get_height(#lines)
|
local textheight = self:get_height(#lines)
|
||||||
|
|
||||||
if style.valign == "top" then
|
if style.valign == "top" then
|
||||||
y = 0
|
y = 0
|
||||||
elseif style.valign == "bottom" then
|
elseif style.valign == "bottom" then
|
||||||
y = height - text_height
|
y = textureh - textheight
|
||||||
else
|
else
|
||||||
y = (height - text_height) / 2
|
y = (textureh - textheight) / 2
|
||||||
end
|
end
|
||||||
|
|
||||||
y = y + (self.margintop or 0)
|
y = y + (self.margintop or 0)
|
||||||
|
|
||||||
for _, l in pairs(lines) do
|
for _, line in pairs(lines) do
|
||||||
if style.halign == "left" then
|
if style.halign == "left" then
|
||||||
x = 0
|
x = 0
|
||||||
elseif style.halign == "right" then
|
elseif style.halign == "right" then
|
||||||
x = width - l.width
|
x = texturew - line.width
|
||||||
else
|
else
|
||||||
x = (width - l.width) / 2
|
x = (texturew - line.width) / 2
|
||||||
end
|
end
|
||||||
|
|
||||||
while l.text ~= '' do
|
while line.text ~= '' do
|
||||||
codepoint, l.text = self:get_next_char(l.text)
|
codepoint, line.text = self:get_next_char(line.text)
|
||||||
if codepoint == nil then return '' end -- UTF Error
|
if codepoint == nil then return '' end -- UTF Error
|
||||||
|
|
||||||
local glyph = self.glyphs[codepoint]
|
|
||||||
|
|
||||||
-- Add image only if it is visible (at least partly)
|
-- Add image only if it is visible (at least partly)
|
||||||
if x + glyph[1] + self.charspacing >= 0 and x <= width then
|
if x + self.widths[codepoint] >= 0 and x <= texturew then
|
||||||
local glyph_texture = self:get_glyph_texture(glyph):gsub("[\\^:]", "\\%0")
|
texture = texture..
|
||||||
if glyph_texture ~= '' then
|
string.format(":%d,%d=font_%s_%04x.png", x, y, self.name, codepoint)
|
||||||
texture = string.format("%s:%d,%d=%s", texture, x, y, glyph_texture)
|
|
||||||
end
|
end
|
||||||
end
|
x = x + self.widths[codepoint]
|
||||||
x = x + glyph[1] + self.charspacing
|
|
||||||
end
|
end
|
||||||
|
|
||||||
y = y + self:get_height() + (self.linespacing or 0)
|
y = y + self:get_height() + (self.linespacing or 0)
|
||||||
end
|
end
|
||||||
|
texture = string.format("[combine:%dx%d", texturew, textureh)..texture
|
||||||
texture = string.format("[combine:%dx%d%s", width, height, texture)
|
|
||||||
if style.color then
|
if style.color then
|
||||||
texture = texture.."^[colorize:"..style.color
|
texture = texture.."^[colorize:"..style.color
|
||||||
end
|
end
|
||||||
print(texture)
|
|
||||||
return texture
|
return texture
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -16,9 +16,6 @@
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
--]]
|
--]]
|
||||||
|
|
||||||
local S = font_api.S
|
|
||||||
local FS = function(...) return minetest.formspec_escape(S(...)) end
|
|
||||||
|
|
||||||
local modname = minetest.get_current_modname()
|
local modname = minetest.get_current_modname()
|
||||||
|
|
||||||
local contexts = {}
|
local contexts = {}
|
||||||
@@ -54,9 +51,15 @@ local function show_node_formspec(playername, pos)
|
|||||||
fs = fs:gsub("context", nodemeta)
|
fs = fs:gsub("context", nodemeta)
|
||||||
|
|
||||||
-- Change all ${} to their corresponding metadata values
|
-- Change all ${} to their corresponding metadata values
|
||||||
fs = fs:gsub("([^\\])${(.-)}", function(prefix, key)
|
local s, e
|
||||||
return prefix .. minetest.formspec_escape(meta:get_string(key))
|
repeat
|
||||||
end)
|
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)
|
local context = get_context(playername)
|
||||||
context.node_pos = pos
|
context.node_pos = pos
|
||||||
@@ -98,22 +101,17 @@ local function show_font_formspec(playername)
|
|||||||
table.sort(fonts)
|
table.sort(fonts)
|
||||||
|
|
||||||
local fs = string.format(
|
local fs = string.format(
|
||||||
"size[4,%s]button_exit[0,%s;4,1;cancel;%s]",
|
"size[4,%s]%s%s%sbutton_exit[0,%s;4,1;cancel;Cancel]",
|
||||||
#fonts + 0.8, #fonts, FS("Cancel"))
|
#fonts + 0.8, default.gui_bg, default.gui_bg_img, default.gui_slots,
|
||||||
|
#fonts)
|
||||||
|
|
||||||
for line = 1, #fonts do
|
for line = 1, #fonts do
|
||||||
local font = font_api.get_font(fonts[line])
|
local font = font_api.get_font(fonts[line])
|
||||||
local texture = font:render(font.name,
|
local texture = font:make_text_texture(font.name, font:get_height()*5,
|
||||||
font:get_height()*5, font:get_height()*1.2, {
|
font:get_height()*1.2, 1, "center", "top", "#fff")
|
||||||
lines = 1,
|
|
||||||
valign = "middle",
|
|
||||||
halign = "center",
|
|
||||||
color = "#fff"
|
|
||||||
}
|
|
||||||
)
|
|
||||||
fs = string.format(
|
fs = string.format(
|
||||||
"%simage[0.1,%s;4.5,0.8;%s]button_exit[0,%s;4,1;font_%s;]",
|
"%simage[0.1,%s;4.5,0.8;%s]button_exit[0,%s;4,1;font_%s;]",
|
||||||
fs, line - 0.9, texture:gsub("[\\^]", "\\%0"), line - 1, font.name)
|
fs, line-0.9, texture, line-1, font.name)
|
||||||
end
|
end
|
||||||
minetest.show_formspec(context.playername, modname..':font_list', fs)
|
minetest.show_formspec(context.playername, modname..':font_list', fs)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -23,9 +23,6 @@ font_api = {}
|
|||||||
font_api.name = minetest.get_current_modname()
|
font_api.name = minetest.get_current_modname()
|
||||||
font_api.path = minetest.get_modpath(font_api.name)
|
font_api.path = minetest.get_modpath(font_api.name)
|
||||||
|
|
||||||
-- Translation support
|
|
||||||
font_api.S = minetest.get_translator(font_api.name)
|
|
||||||
|
|
||||||
-- Inclusions
|
-- Inclusions
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
@@ -36,3 +33,5 @@ if minetest.get_modpath("display_api") then
|
|||||||
dofile(font_api.path.."/display_api.lua")
|
dofile(font_api.path.."/display_api.lua")
|
||||||
end
|
end
|
||||||
dofile(font_api.path.."/deprecation.lua")
|
dofile(font_api.path.."/deprecation.lua")
|
||||||
|
|
||||||
|
minetest.log("action", "[font_api] loaded.")
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
# textdomain: font_api
|
|
||||||
Cancel=Schließen
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
# textdomain: font_api
|
|
||||||
Cancel=Annuler
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
# textdomain: font_api
|
|
||||||
Cancel=
|
|
||||||
@@ -58,9 +58,12 @@ local function get_default_font()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- If failed, choose the first registered font
|
-- If failed, chose first font
|
||||||
if default_font == nil then
|
if default_font == nil then
|
||||||
default_font = next(font_api.registered_fonts)
|
for _, font in pairs(font_api.registered_fonts) do
|
||||||
|
default_font = font
|
||||||
|
break
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Error, no font registered
|
-- Error, no font registered
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
# Mod maker for FontAPI
|
|
||||||
|
|
||||||
This tool makes font mods out of a true type font file.
|
|
||||||
|
|
||||||
```
|
|
||||||
lua <params.lua> <font_file>
|
|
||||||
```
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
This tool needs some aditional programs:
|
|
||||||
* `lua` to be able to launch it from command line
|
|
||||||
* `imagemagick` to process images and build texture
|
|
||||||
* `fonttools` and `xmlstarlet` to analyse true type font
|
|
||||||
|
|
||||||
On Debian like distros, these could be installing issuing:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
apt install lua5.4 imagemagick fonttools xmlstarlet
|
|
||||||
```
|
|
||||||
@@ -1,459 +0,0 @@
|
|||||||
--
|
|
||||||
-- A font mod generator for font_api
|
|
||||||
--
|
|
||||||
|
|
||||||
-- This is an utility script for code and texture generator,
|
|
||||||
-- not intended to be tranlslated.
|
|
||||||
|
|
||||||
-- TODO : detect and manage fixed width fonts
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Dependancies check
|
|
||||||
--
|
|
||||||
|
|
||||||
local function check(cmd, msg)
|
|
||||||
if os.execute(cmd .. " > /dev/null 2>&1") then
|
|
||||||
return true
|
|
||||||
else
|
|
||||||
print(msg)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if
|
|
||||||
not check("convert --version", "Error: This program requires convert from ImageMagick!") or
|
|
||||||
not check("identify --version", "Error: This program requires identify from ImageMagick!") or
|
|
||||||
not check("ttx --version", "Error: This program requires ttx from FontTools!") or
|
|
||||||
not check("xmlstarlet --version", "Error: This program requires xmlstarlet!")
|
|
||||||
then
|
|
||||||
print("Please fix above problem and retry.")
|
|
||||||
os.exit(1)
|
|
||||||
end
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Argument & parameters management
|
|
||||||
--
|
|
||||||
|
|
||||||
local function usage()
|
|
||||||
print (arg[0] .. " takes two arguments:")
|
|
||||||
print (" - parameter file")
|
|
||||||
print (" - destination path")
|
|
||||||
end
|
|
||||||
|
|
||||||
if #arg ~= 2 then
|
|
||||||
usage()
|
|
||||||
os.exit(1)
|
|
||||||
end
|
|
||||||
|
|
||||||
print("Reading paramaters.")
|
|
||||||
dofile(arg[1])
|
|
||||||
|
|
||||||
local mod_dir = arg[2]
|
|
||||||
if os.execute("[ -d " .. mod_dir .. " ]") then
|
|
||||||
print ("Directory " .. mod_dir .. " already exists!")
|
|
||||||
-- os.exit(1)
|
|
||||||
end
|
|
||||||
os.execute("mkdir -p " .. mod_dir .. "/textures")
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Available tile sizes management
|
|
||||||
--
|
|
||||||
|
|
||||||
local function compute_tile_sizes(texture_size)
|
|
||||||
results = {}
|
|
||||||
for size = 1, texture_size do
|
|
||||||
if texture_size % size == 0 then
|
|
||||||
table.insert(results, size)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return results
|
|
||||||
end
|
|
||||||
|
|
||||||
-- This will give enough tile width combinations (360 is 2 * 2 * 2 * 3 * 3 * 5)
|
|
||||||
local tile_widths = compute_tile_sizes(360)
|
|
||||||
|
|
||||||
-- Table width has to be sorted
|
|
||||||
table.sort(tile_widths)
|
|
||||||
local texture_width = tile_widths[#tile_widths]
|
|
||||||
|
|
||||||
-- Rounds glyph width up to available tile width (first width larger than given one)
|
|
||||||
local function tile_width(width)
|
|
||||||
for _, w in ipairs(tile_widths) do
|
|
||||||
if width < w then
|
|
||||||
return w
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return texture_width
|
|
||||||
end
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Helper functions
|
|
||||||
--
|
|
||||||
|
|
||||||
-- Issue an OS command and get its result
|
|
||||||
local function command(cmd)
|
|
||||||
local f = assert(io.popen(cmd, 'r'))
|
|
||||||
local s = assert(f:read('*a'))
|
|
||||||
f:close()
|
|
||||||
return s
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Escape chars that could harm commands
|
|
||||||
local function escape(char)
|
|
||||||
if char == "\\" then return "\\\\\\\\" end
|
|
||||||
if char == "\"" then return "\\\"" end
|
|
||||||
if char == "`" then return "\\`" end
|
|
||||||
return char
|
|
||||||
end
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Things start here
|
|
||||||
--
|
|
||||||
|
|
||||||
-- Measures a glyph, returs its height and width in pixels
|
|
||||||
local function measure(font, codepoint)
|
|
||||||
local char = utf8.char(codepoint)
|
|
||||||
|
|
||||||
local cmd = string.format(
|
|
||||||
"convert -font \"%s\" -pointsize %d label:\"%s\" -define trim:edges=east,west -trim info:",
|
|
||||||
font.file, font.glyphs_height, escape(char)
|
|
||||||
)
|
|
||||||
local _, _, w, h = string.find(command(cmd), "([0-9]+)x([0-9]+)" )
|
|
||||||
return tonumber(w), tonumber(h)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Read all available codepoints from ttf file
|
|
||||||
local function read_available_codepoints(file)
|
|
||||||
-- Takes only first cmap table found.
|
|
||||||
-- TODO: Should choose table according to platformID (3 else 0 else 2)
|
|
||||||
-- (see https://stackoverflow.com/a/29424838)
|
|
||||||
local cmd, errmsg, status = io.popen(string.format(
|
|
||||||
"ttx -o - \"%s\" 2>/dev/null | " ..
|
|
||||||
"xmlstarlet sel -t -v \"//*[starts-with(name(), 'cmap_format_')][1]/map/@code\" | " ..
|
|
||||||
"sort -u",
|
|
||||||
file), 'r')
|
|
||||||
|
|
||||||
if cmd == nil then
|
|
||||||
print(string.format(
|
|
||||||
"Could not open font file %s:\n%s", file, errmsg))
|
|
||||||
os.exit(status)
|
|
||||||
end
|
|
||||||
|
|
||||||
local codepoints = {}
|
|
||||||
local codepoint = cmd:read("*line")
|
|
||||||
while codepoint do
|
|
||||||
codepoints[tonumber(codepoint)] = true
|
|
||||||
codepoint = cmd:read("*line")
|
|
||||||
end
|
|
||||||
cmd:close()
|
|
||||||
|
|
||||||
return codepoints
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Add codepoints to a font
|
|
||||||
local function add_codepoints(font, from, to)
|
|
||||||
for codepoint = from, to do
|
|
||||||
if font.cp[codepoint] then
|
|
||||||
-- Glyph size
|
|
||||||
local w, h = measure(font, codepoint)
|
|
||||||
if h > font.glyphs_height then font.glyphs_height = h end
|
|
||||||
|
|
||||||
-- Detect and discard eventual buggy glyphs (may be spaces)
|
|
||||||
if h > 1 then
|
|
||||||
font.glyph_widths[codepoint] = w
|
|
||||||
|
|
||||||
-- Tile width
|
|
||||||
local tile_w = tile_width(w)
|
|
||||||
if font.by_width[tile_w] == nil then
|
|
||||||
font.by_width[tile_w] = {}
|
|
||||||
table.insert(font.tile_widths, tile_w)
|
|
||||||
end
|
|
||||||
table.insert(font.by_width[tile_w], codepoint)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Make font texture
|
|
||||||
-- Font must have all its codepoints added
|
|
||||||
local function make_final_texture(font)
|
|
||||||
local texture_file = string.format("%s/textures/font_%s.png",
|
|
||||||
mod_dir, font.name)
|
|
||||||
|
|
||||||
-- We start with a single line
|
|
||||||
font.texture_height = font.glyphs_height
|
|
||||||
|
|
||||||
-- Characteristics of [sheet:NxM:x,y
|
|
||||||
-- M is always the same and depends on font and texture height.
|
|
||||||
font.glyph_xs = {} -- x for each glyph
|
|
||||||
font.glyph_ys = {} -- y for each glyph
|
|
||||||
font.glyph_ns = {} -- n of tiles in sheet for each glyph (=texturewidth / tilewidth)
|
|
||||||
|
|
||||||
local x = 0 -- cursor x
|
|
||||||
local glyph_y = 0
|
|
||||||
|
|
||||||
table.sort(font.tile_widths)
|
|
||||||
print(" Computing positions")
|
|
||||||
-- Compute positions
|
|
||||||
for _, tile_width in ipairs(font.tile_widths) do
|
|
||||||
for _, codepoint in ipairs(font.by_width[tile_width]) do
|
|
||||||
local glyph_x = math.ceil(x / tile_width)
|
|
||||||
x = glyph_x * tile_width
|
|
||||||
if x + tile_width > texture_width then -- no space left on current line
|
|
||||||
x = 0
|
|
||||||
glyph_x = 0
|
|
||||||
glyph_y = glyph_y + 1
|
|
||||||
font.texture_height = font.texture_height + font.glyphs_height
|
|
||||||
end
|
|
||||||
font.glyph_xs[codepoint] = glyph_x
|
|
||||||
font.glyph_ys[codepoint] = glyph_y
|
|
||||||
font.glyph_ns[codepoint] = math.floor(texture_width / tile_width)
|
|
||||||
x = x + tile_width
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
print(" Composing texture")
|
|
||||||
|
|
||||||
-- Compose texture
|
|
||||||
command(string.format(
|
|
||||||
"convert -size %dx%d xc:transparent %s",
|
|
||||||
texture_width, font.texture_height, texture_file
|
|
||||||
))
|
|
||||||
|
|
||||||
for codepoint, n in pairs(font.glyph_ns) do
|
|
||||||
print(codepoint)
|
|
||||||
local w = math.floor(texture_width / n)
|
|
||||||
local x = w * font.glyph_xs[codepoint]
|
|
||||||
local y = font.glyphs_height * font.glyph_ys[codepoint]
|
|
||||||
|
|
||||||
local cmd
|
|
||||||
-- Subtexture subcommand
|
|
||||||
if codepoint == 0 then
|
|
||||||
-- The "unknown" char
|
|
||||||
cmd = string.format(
|
|
||||||
"convert %s" ..
|
|
||||||
" -stroke black -fill transparent -strokewidth 1 " ..
|
|
||||||
" -draw \"rectangle %d,%d %d,%d\" %s",
|
|
||||||
texture_file, x, y, x + w, y + font.glyphs_height, texture_file
|
|
||||||
)
|
|
||||||
else
|
|
||||||
-- Other glyhp chars
|
|
||||||
cmd = string.format(
|
|
||||||
"convert %s \\(" ..
|
|
||||||
" -background none -font \"%s\" -pointsize %d label:\"%s\"" ..
|
|
||||||
" -define trim:edges=east,west -trim" ..
|
|
||||||
" -repage +%d+%d \\) -flatten %s",
|
|
||||||
texture_file, font.file, font.pointsize, escape(utf8.char(codepoint)),
|
|
||||||
x, y, texture_file
|
|
||||||
)
|
|
||||||
|
|
||||||
end
|
|
||||||
command(cmd)
|
|
||||||
end
|
|
||||||
|
|
||||||
command(string.format("convert %s -channel alpha -threshold 50%% %s", texture_file, texture_file))
|
|
||||||
end
|
|
||||||
|
|
||||||
local function process_font(font)
|
|
||||||
|
|
||||||
-- Defaults
|
|
||||||
font.label = font.label or font.name:gsub("^%l", string.upper)
|
|
||||||
font.margin_top = font.margin_top or 0
|
|
||||||
font.line_spacing = font.line_spacing or 0
|
|
||||||
font.char_spacing = font.char_spacing or 0
|
|
||||||
|
|
||||||
print(string.format("Processing font \"%s\" (%s)", font.label, font.name))
|
|
||||||
|
|
||||||
-- Computed values
|
|
||||||
font.by_width = {} -- Codepoints by tile width
|
|
||||||
font.tile_widths = {} -- Used tile widths
|
|
||||||
font.glyph_widths = {} -- Exact width of reach glyph
|
|
||||||
font.glyphs_height = 0 -- Max height of all glyphs
|
|
||||||
|
|
||||||
print(" Reading available glyphs")
|
|
||||||
|
|
||||||
-- Available codepoints from file
|
|
||||||
font.cp = read_available_codepoints(font.file)
|
|
||||||
|
|
||||||
print(" Computing glyphs properties")
|
|
||||||
|
|
||||||
-- Special char: unknown char
|
|
||||||
-- We use size of glyph "0" (rounded) but it would be better to get size from ttx
|
|
||||||
|
|
||||||
-- TODO: We could get information from ttx:
|
|
||||||
-- <mtx> gives a width always divisible by 125 for metro font (check if its somehow proportional to what magick gives)
|
|
||||||
|
|
||||||
local w = tile_width(measure(font, 0x0030))
|
|
||||||
font.glyph_widths[0] = w
|
|
||||||
font.by_width[w] = { 0 }
|
|
||||||
font.tile_widths = { w }
|
|
||||||
|
|
||||||
-- Mandatory codepoints (ASCII)
|
|
||||||
add_codepoints(font, 0x0021, 0x007f)
|
|
||||||
|
|
||||||
-- Extra codepoints
|
|
||||||
if font.codepoints then
|
|
||||||
for _, range in ipairs(font.codepoints) do
|
|
||||||
add_codepoints(font, range.from, range.to)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
print(" Creating final texture")
|
|
||||||
|
|
||||||
make_final_texture(font)
|
|
||||||
|
|
||||||
-- Add invisible chars : Spaces
|
|
||||||
-- TODO: Should be computed from ttx
|
|
||||||
-- TODO: manage half/quater spaces
|
|
||||||
font.glyph_widths[0x0020] = font.glyph_widths[0x0030]
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
local function get_font_registration_lua(font)
|
|
||||||
|
|
||||||
local glyphs = "{"
|
|
||||||
local curlinesize = 1000
|
|
||||||
|
|
||||||
for codepoint, w in pairs(font.glyph_widths) do
|
|
||||||
local glyph
|
|
||||||
local x = font.glyph_xs[codepoint]
|
|
||||||
local y = font.glyph_ys[codepoint]
|
|
||||||
local n = font.glyph_ns[codepoint]
|
|
||||||
if x ~= nil and y ~=nil and n ~= nil then
|
|
||||||
glyph = string.format("[%d] = { %d, %d, %d, %d },", codepoint, w, n, x, y)
|
|
||||||
else
|
|
||||||
glyph = string.format("[%d] = { %d },", codepoint, w)
|
|
||||||
end
|
|
||||||
|
|
||||||
curlinesize = curlinesize + glyph:len() + 1
|
|
||||||
if curlinesize > 80 then
|
|
||||||
glyphs = glyphs .. "\n\t\t\t" .. glyph
|
|
||||||
curlinesize = 12 + glyph:len()
|
|
||||||
else
|
|
||||||
glyphs = glyphs .. " " .. glyph
|
|
||||||
end
|
|
||||||
end
|
|
||||||
glyphs = glyphs .. "\n\t\t}"
|
|
||||||
|
|
||||||
return string.format([[
|
|
||||||
-- Font generated from file %s with pointsize %d
|
|
||||||
font_api.register_font(
|
|
||||||
'%s',
|
|
||||||
{
|
|
||||||
version = 2,
|
|
||||||
default = true,
|
|
||||||
margintop = %d,
|
|
||||||
linespacing = %d,
|
|
||||||
charspacing = %d,
|
|
||||||
texture_height = %d,
|
|
||||||
glyphs_height = %d,
|
|
||||||
glyphs = %s,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
]], font.file, font.pointsize, font.name,
|
|
||||||
font.margin_top, font.line_spacing, font.char_spacing,
|
|
||||||
font.texture_height, font.glyphs_height, glyphs)
|
|
||||||
end
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Main code
|
|
||||||
--
|
|
||||||
|
|
||||||
for _, font in ipairs(params.fonts) do
|
|
||||||
process_font(font)
|
|
||||||
end
|
|
||||||
|
|
||||||
print("All fonts processed, writing mod files")
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Write init.lua
|
|
||||||
--
|
|
||||||
|
|
||||||
print(" Writing init.lua")
|
|
||||||
|
|
||||||
local file = io.open(mod_dir .. "/init.lua", "w")
|
|
||||||
|
|
||||||
file:write(string.format([[
|
|
||||||
--
|
|
||||||
-- %s: A font mod for font_api
|
|
||||||
--
|
|
||||||
-- This file was generated by `%s` on %s.
|
|
||||||
--
|
|
||||||
|
|
||||||
]], params.mod_name, arg[0], os.date("%Y-%m-%d at %H:%M")
|
|
||||||
))
|
|
||||||
|
|
||||||
for _, font in ipairs(params.fonts) do
|
|
||||||
file:write(get_font_registration_lua(font))
|
|
||||||
end
|
|
||||||
|
|
||||||
file:close()
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Write mod.conf
|
|
||||||
--
|
|
||||||
print(" Writing mod.conf")
|
|
||||||
|
|
||||||
local file = io.open(mod_dir .. "/mod.conf", "w")
|
|
||||||
file:write(string.format([[
|
|
||||||
name = %s
|
|
||||||
title = %s
|
|
||||||
description = %s
|
|
||||||
depends = font_api
|
|
||||||
]], params.mod_name, params.mod_title, params.mod_description))
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Write README.md
|
|
||||||
--
|
|
||||||
|
|
||||||
print(" Writing README.md")
|
|
||||||
|
|
||||||
local function list(t)
|
|
||||||
return #t == 1 and t[1] or
|
|
||||||
table.concat(t, ", ", 1, #t - 1) .. " and " .. t[#t]
|
|
||||||
end
|
|
||||||
|
|
||||||
local font_labels = {}
|
|
||||||
for _, font in ipairs(params.fonts) do
|
|
||||||
table.insert(font_name, font.label)
|
|
||||||
end
|
|
||||||
|
|
||||||
local function font_description(font)
|
|
||||||
local orignal = string.format("%s by %s", font.label, font.author)
|
|
||||||
if font.url and font.url ~= "" then
|
|
||||||
original = string.format("[%s](%s)", original, font.url)
|
|
||||||
end
|
|
||||||
|
|
||||||
return string.format([[
|
|
||||||

|
|
||||||
|
|
||||||
**Original font**: %s
|
|
||||||
|
|
||||||
**License**: %s
|
|
||||||
]], font.label, font.name, orignal, font.license)
|
|
||||||
end
|
|
||||||
|
|
||||||
local file = io.open(mod_dir .. "/README.md", "w")
|
|
||||||
file:write(string.format([[
|
|
||||||
# %s minetest mod for font API
|
|
||||||
|
|
||||||
This mod adds %s to Font API mod (from [display_modpack](https://github.com/pyrollo/display_modpack)).
|
|
||||||
|
|
||||||
For more information, see the [forum topic](https://forum.minetest.net/viewtopic.php?t=13563) at the Minetest forums.
|
|
||||||
]], params.mod_title, list(font_labels)))
|
|
||||||
|
|
||||||
file:write([[
|
|
||||||
**Dependancies**: font_api
|
|
||||||
|
|
||||||
**License**: code under LGPL v2.1
|
|
||||||
]])
|
|
||||||
|
|
||||||
if #params.fonts > 1 then
|
|
||||||
for _, font in ipairs(params.fonts) do
|
|
||||||
file:write("## %s font\n", font.label)
|
|
||||||
file:write(font_description(font))
|
|
||||||
end
|
|
||||||
else
|
|
||||||
file:write(font_description(params.font[1]))
|
|
||||||
end
|
|
||||||
|
|
||||||
-- This font includes uppercase, lowercase and many accentuated latin letters, greek and cyrillic letters.
|
|
||||||
@@ -1,97 +0,0 @@
|
|||||||
|
|
||||||
-- This is an example parameter file for make_font.lua
|
|
||||||
-- Copy this file as params.lua.
|
|
||||||
-- Replace values between brakets <> to your choices.
|
|
||||||
-- Launch make_font.lua params.lua
|
|
||||||
|
|
||||||
params = {
|
|
||||||
-- Resulting mod name (required)
|
|
||||||
-- As this name will be use as texture prefix and so repeated many times,
|
|
||||||
-- please avoid long names but keep explicit anyway.
|
|
||||||
mod_name = "<your mod name>",
|
|
||||||
|
|
||||||
-- If only one font, have font in title, like "xxx font"
|
|
||||||
mod_title = "<your mod title>",
|
|
||||||
|
|
||||||
-- A good description would be "... fonts for font_api"
|
|
||||||
mod_description = "<your mod description>",
|
|
||||||
|
|
||||||
-- List of fons to include to the mod.
|
|
||||||
fonts = {
|
|
||||||
{
|
|
||||||
-- Registered font name (required)
|
|
||||||
-- As this name will be use as texture prefix and so repeated many times,
|
|
||||||
-- avoid long names. A good name would be a single world all lowercase.
|
|
||||||
name = "<your font technical name>",
|
|
||||||
|
|
||||||
-- Registered font label (optional, default capitalized name)
|
|
||||||
-- This is the display name for this font. No need to be concise.
|
|
||||||
label = "<your font display label>",
|
|
||||||
|
|
||||||
-- True type font file to get glyphs from (required)
|
|
||||||
file = "<your font true type font>",
|
|
||||||
|
|
||||||
-- Author(s) of the original font (required)
|
|
||||||
author = "<author or list of authors>",
|
|
||||||
|
|
||||||
-- License of the original font (required)
|
|
||||||
-- Join license text, as a text file, to your mod.
|
|
||||||
license = "<name of the license>",
|
|
||||||
|
|
||||||
-- URL of the original font (optional)
|
|
||||||
-- If there is an URL about this font, it is recommended to have it
|
|
||||||
-- here. It should be URL of font project if it exists or at least
|
|
||||||
-- an URL where to download the font with details about author and
|
|
||||||
-- license.
|
|
||||||
url = "<URL>",
|
|
||||||
|
|
||||||
-- Render pointsize (integer, required)
|
|
||||||
-- Try to find a proper value for a good rendering
|
|
||||||
pointsize = <proper rendering height>,
|
|
||||||
|
|
||||||
-- Shoud chars be trimmed? (boolean, required)
|
|
||||||
-- Set it to true to reduce texture size
|
|
||||||
-- and increase `char_spacing` accordingly.
|
|
||||||
-- If results are weird, you may try to set it to false.
|
|
||||||
trim = true,
|
|
||||||
|
|
||||||
-- Margin added on top of text textures with this font (integer, optional, default 0)
|
|
||||||
margin_top = 3,
|
|
||||||
|
|
||||||
-- Space between consecutive lines (integer, optional, default 0)
|
|
||||||
-- Space may be negative to make lines closer.
|
|
||||||
line_spacing = -2,
|
|
||||||
|
|
||||||
-- Space between consecutive chars (integer, optional, default 0)
|
|
||||||
char_spacing = 2,
|
|
||||||
|
|
||||||
-- Extra codepoints to include to font mod (optional, default none)
|
|
||||||
-- Codepoints from 0x0020 to 0x007f (ASCII) are always included.
|
|
||||||
-- Codepoint 0x0020 is always considered as a space.
|
|
||||||
-- Codepoints not existing in font file will be ignored.
|
|
||||||
-- Refer to https://en.wikipedia.org/wiki/Unicode
|
|
||||||
codepoints = {
|
|
||||||
-- 00a0-00ff Latin-1 Supplement (full except nbsp)
|
|
||||||
{ from = 0x00a1, to = 0x00ff },
|
|
||||||
|
|
||||||
-- 0100-017f Latin Extended-A (full)
|
|
||||||
{ from = 0x0100, to = 0x017f },
|
|
||||||
|
|
||||||
-- 0370-03ff Greek (full)
|
|
||||||
{ from = 0x0370, to = 0x03ff },
|
|
||||||
|
|
||||||
-- 0400-04ff Cyrilic (full)
|
|
||||||
{ from = 0x0400, to = 0x04ff },
|
|
||||||
|
|
||||||
-- 2000-206f General Punctuation (Limited to Dashes)
|
|
||||||
{ from = 0x2010, to = 0x2015 },
|
|
||||||
|
|
||||||
-- 2000-206f General Punctuation (Limited to Quotes)
|
|
||||||
{ from = 0x2018, to = 0x201F },
|
|
||||||
|
|
||||||
-- 20a0-20cf Currency Symbols (Limited to Euro symbol)
|
|
||||||
{ from = 0x20ac, to = 0x20ac },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -31,20 +31,14 @@ fi
|
|||||||
# check imagemagick
|
# check imagemagick
|
||||||
hash convert &>/dev/null
|
hash convert &>/dev/null
|
||||||
if [ $? -eq 1 ]; then
|
if [ $? -eq 1 ]; then
|
||||||
echo -e "Error: This program requires convert from ImageMagick!"
|
echo -e "Error: This program requires convert from ImageMagick! Please install it by typing 'sudo apt-get install imagemagick' in terminal."
|
||||||
abort=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
hash montage &>/dev/null
|
|
||||||
if [ $? -eq 1 ]; then
|
|
||||||
echo -e "Error: This program requires montage from ImageMagick!"
|
|
||||||
abort=1
|
abort=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check ttx
|
# check ttx
|
||||||
hash ttx &>/dev/null
|
hash ttx &>/dev/null
|
||||||
if [ $? -eq 1 ]; then
|
if [ $? -eq 1 ]; then
|
||||||
echo -e "Error: This program requires ttx from FontTools!"
|
echo -e "Error: This program requires ttx from FontTools! Please install it by typing 'sudo apt-get install fonttools' in terminal."
|
||||||
abort=1
|
abort=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
3
font_metro/copyright.txt
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
Font by Christian Munk (CMunk)
|
||||||
|
Code by Pierre-Yves Rollo (pyrollo)
|
||||||
|
|
||||||
@@ -11,8 +11,6 @@
|
|||||||
Derivative textures and code are under CC-BY-SA license
|
Derivative textures and code are under CC-BY-SA license
|
||||||
--]]
|
--]]
|
||||||
|
|
||||||
-- widths is not split into several lines, because the font is generated by 'make_font_lua.sh'
|
|
||||||
-- luacheck: ignore
|
|
||||||
font_api.register_font(
|
font_api.register_font(
|
||||||
'metro',
|
'metro',
|
||||||
{
|
{
|
||||||
@@ -24,3 +22,4 @@ font_api.register_font(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
minetest.log("action", "[font_metro] loaded.")
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
The FontStruction “Metro Sans”
|
|
||||||
(https://fontstruct.com/fontstructions/show/723864) by Christian Munk is
|
|
||||||
licensed under a Creative Commons Attribution Share Alike license
|
|
||||||
(http://creativecommons.org/licenses/by-sa/3.0/).
|
|
||||||
[ancestry]
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
The font file in this archive was created using Fontstruct the free, online
|
|
||||||
font-building tool.
|
|
||||||
This font was created by Christian Munk.
|
|
||||||
This font has a homepage where this archive and other versions may be found:
|
|
||||||
https://fontstruct.com/fontstructions/show/723864
|
|
||||||
[ancestry]
|
|
||||||
Try Fontstruct at https://fontstruct.com
|
|
||||||
It’s easy and it’s fun.
|
|
||||||
|
|
||||||
Fontstruct is copyright ©2012-2025 Rob Meek
|
|
||||||
|
|
||||||
LEGAL NOTICE:
|
|
||||||
In using this font you must comply with the licensing terms described in the
|
|
||||||
file “license.txt” included with this archive.
|
|
||||||
If you redistribute the font file in this archive, it must be accompanied by all
|
|
||||||
the other files from this archive, including this one.
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
name = display_modpack
|
|
||||||
description = Display modpack for Minetest, provides mods with dynamic display and font display: clocks, signs, and more.
|
|
||||||
title = Display Modpack
|
|
||||||
min_minetest_version = 5.4.0
|
|
||||||
0
modpack.txt
Normal file
166
ontime_clocks/LICENSE.txt
Normal file
@@ -0,0 +1,166 @@
|
|||||||
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
|
||||||
|
This version of the GNU Lesser General Public License incorporates
|
||||||
|
the terms and conditions of version 3 of the GNU General Public
|
||||||
|
License, supplemented by the additional permissions listed below.
|
||||||
|
|
||||||
|
0. Additional Definitions.
|
||||||
|
|
||||||
|
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||||
|
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||||
|
General Public License.
|
||||||
|
|
||||||
|
"The Library" refers to a covered work governed by this License,
|
||||||
|
other than an Application or a Combined Work as defined below.
|
||||||
|
|
||||||
|
An "Application" is any work that makes use of an interface provided
|
||||||
|
by the Library, but which is not otherwise based on the Library.
|
||||||
|
Defining a subclass of a class defined by the Library is deemed a mode
|
||||||
|
of using an interface provided by the Library.
|
||||||
|
|
||||||
|
A "Combined Work" is a work produced by combining or linking an
|
||||||
|
Application with the Library. The particular version of the Library
|
||||||
|
with which the Combined Work was made is also called the "Linked
|
||||||
|
Version".
|
||||||
|
|
||||||
|
The "Minimal Corresponding Source" for a Combined Work means the
|
||||||
|
Corresponding Source for the Combined Work, excluding any source code
|
||||||
|
for portions of the Combined Work that, considered in isolation, are
|
||||||
|
based on the Application, and not on the Linked Version.
|
||||||
|
|
||||||
|
The "Corresponding Application Code" for a Combined Work means the
|
||||||
|
object code and/or source code for the Application, including any data
|
||||||
|
and utility programs needed for reproducing the Combined Work from the
|
||||||
|
Application, but excluding the System Libraries of the Combined Work.
|
||||||
|
|
||||||
|
1. Exception to Section 3 of the GNU GPL.
|
||||||
|
|
||||||
|
You may convey a covered work under sections 3 and 4 of this License
|
||||||
|
without being bound by section 3 of the GNU GPL.
|
||||||
|
|
||||||
|
2. Conveying Modified Versions.
|
||||||
|
|
||||||
|
If you modify a copy of the Library, and, in your modifications, a
|
||||||
|
facility refers to a function or data to be supplied by an Application
|
||||||
|
that uses the facility (other than as an argument passed when the
|
||||||
|
facility is invoked), then you may convey a copy of the modified
|
||||||
|
version:
|
||||||
|
|
||||||
|
a) under this License, provided that you make a good faith effort to
|
||||||
|
ensure that, in the event an Application does not supply the
|
||||||
|
function or data, the facility still operates, and performs
|
||||||
|
whatever part of its purpose remains meaningful, or
|
||||||
|
|
||||||
|
b) under the GNU GPL, with none of the additional permissions of
|
||||||
|
this License applicable to that copy.
|
||||||
|
|
||||||
|
3. Object Code Incorporating Material from Library Header Files.
|
||||||
|
|
||||||
|
The object code form of an Application may incorporate material from
|
||||||
|
a header file that is part of the Library. You may convey such object
|
||||||
|
code under terms of your choice, provided that, if the incorporated
|
||||||
|
material is not limited to numerical parameters, data structure
|
||||||
|
layouts and accessors, or small macros, inline functions and templates
|
||||||
|
(ten or fewer lines in length), you do both of the following:
|
||||||
|
|
||||||
|
a) Give prominent notice with each copy of the object code that the
|
||||||
|
Library is used in it and that the Library and its use are
|
||||||
|
covered by this License.
|
||||||
|
|
||||||
|
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||||
|
document.
|
||||||
|
|
||||||
|
4. Combined Works.
|
||||||
|
|
||||||
|
You may convey a Combined Work under terms of your choice that,
|
||||||
|
taken together, effectively do not restrict modification of the
|
||||||
|
portions of the Library contained in the Combined Work and reverse
|
||||||
|
engineering for debugging such modifications, if you also do each of
|
||||||
|
the following:
|
||||||
|
|
||||||
|
a) Give prominent notice with each copy of the Combined Work that
|
||||||
|
the Library is used in it and that the Library and its use are
|
||||||
|
covered by this License.
|
||||||
|
|
||||||
|
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||||
|
document.
|
||||||
|
|
||||||
|
c) For a Combined Work that displays copyright notices during
|
||||||
|
execution, include the copyright notice for the Library among
|
||||||
|
these notices, as well as a reference directing the user to the
|
||||||
|
copies of the GNU GPL and this license document.
|
||||||
|
|
||||||
|
d) Do one of the following:
|
||||||
|
|
||||||
|
0) Convey the Minimal Corresponding Source under the terms of this
|
||||||
|
License, and the Corresponding Application Code in a form
|
||||||
|
suitable for, and under terms that permit, the user to
|
||||||
|
recombine or relink the Application with a modified version of
|
||||||
|
the Linked Version to produce a modified Combined Work, in the
|
||||||
|
manner specified by section 6 of the GNU GPL for conveying
|
||||||
|
Corresponding Source.
|
||||||
|
|
||||||
|
1) Use a suitable shared library mechanism for linking with the
|
||||||
|
Library. A suitable mechanism is one that (a) uses at run time
|
||||||
|
a copy of the Library already present on the user's computer
|
||||||
|
system, and (b) will operate properly with a modified version
|
||||||
|
of the Library that is interface-compatible with the Linked
|
||||||
|
Version.
|
||||||
|
|
||||||
|
e) Provide Installation Information, but only if you would otherwise
|
||||||
|
be required to provide such information under section 6 of the
|
||||||
|
GNU GPL, and only to the extent that such information is
|
||||||
|
necessary to install and execute a modified version of the
|
||||||
|
Combined Work produced by recombining or relinking the
|
||||||
|
Application with a modified version of the Linked Version. (If
|
||||||
|
you use option 4d0, the Installation Information must accompany
|
||||||
|
the Minimal Corresponding Source and Corresponding Application
|
||||||
|
Code. If you use option 4d1, you must provide the Installation
|
||||||
|
Information in the manner specified by section 6 of the GNU GPL
|
||||||
|
for conveying Corresponding Source.)
|
||||||
|
|
||||||
|
5. Combined Libraries.
|
||||||
|
|
||||||
|
You may place library facilities that are a work based on the
|
||||||
|
Library side by side in a single library together with other library
|
||||||
|
facilities that are not Applications and are not covered by this
|
||||||
|
License, and convey such a combined library under terms of your
|
||||||
|
choice, if you do both of the following:
|
||||||
|
|
||||||
|
a) Accompany the combined library with a copy of the same work based
|
||||||
|
on the Library, uncombined with any other library facilities,
|
||||||
|
conveyed under the terms of this License.
|
||||||
|
|
||||||
|
b) Give prominent notice with the combined library that part of it
|
||||||
|
is a work based on the Library, and explaining where to find the
|
||||||
|
accompanying uncombined form of the same work.
|
||||||
|
|
||||||
|
6. Revised Versions of the GNU Lesser General Public License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the GNU Lesser General Public License from time to time. Such new
|
||||||
|
versions will be similar in spirit to the present version, but may
|
||||||
|
differ in detail to address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Library as you received it specifies that a certain numbered version
|
||||||
|
of the GNU Lesser General Public License "or any later version"
|
||||||
|
applies to it, you have the option of following the terms and
|
||||||
|
conditions either of that published version or of any later version
|
||||||
|
published by the Free Software Foundation. If the Library as you
|
||||||
|
received it does not specify a version number of the GNU Lesser
|
||||||
|
General Public License, you may choose any version of the GNU Lesser
|
||||||
|
General Public License ever published by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Library as you received it specifies that a proxy can decide
|
||||||
|
whether future versions of the GNU Lesser General Public License shall
|
||||||
|
apply, that proxy's public statement of acceptance of any version is
|
||||||
|
permanent authorization for you to choose that version for the
|
||||||
|
Library.
|
||||||
|
|
||||||
@@ -4,7 +4,7 @@ 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.
|
For more information, see the [forum topic](https://forum.minetest.net/viewtopic.php?t=19365) at the Minetest forums.
|
||||||
|
|
||||||
**Dependencies**: display_api, xcompat
|
**Dependancies**: display_api, default
|
||||||
|
|
||||||
**License**: Code under LGPL, textures under CC-BY-SA
|
**License**: Code under LGPL, textures under CC-BY-SA
|
||||||
|
|
||||||
|
|||||||
8
ontime_clocks/copyright.txt
Normal file
@@ -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)
|
||||||
@@ -18,13 +18,11 @@
|
|||||||
along with ontime_clocks. If not, see <http://www.gnu.org/licenses/>.
|
along with ontime_clocks. If not, see <http://www.gnu.org/licenses/>.
|
||||||
--]]
|
--]]
|
||||||
|
|
||||||
local mat = xcompat.materials
|
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'ontime_clocks:green_digital',
|
output = 'ontime_clocks:green_digital',
|
||||||
recipe = {
|
recipe = {
|
||||||
{'', mat.dye_green, ''},
|
{'', 'dye:green', ''},
|
||||||
{mat.glass, mat.mese_crystal, mat.glass},
|
{'default:glass', 'default:mese_crystal', 'default:glass'},
|
||||||
{'', '', ''},
|
{'', '', ''},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -32,8 +30,8 @@ minetest.register_craft({
|
|||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'ontime_clocks:red_digital',
|
output = 'ontime_clocks:red_digital',
|
||||||
recipe = {
|
recipe = {
|
||||||
{'', mat.dye_red, ''},
|
{'', 'dye:red', ''},
|
||||||
{mat.glass, mat.mese_crystal, mat.glass},
|
{'default:glass', 'default:mese_crystal', 'default:glass'},
|
||||||
{'', '', ''},
|
{'', '', ''},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -41,8 +39,8 @@ minetest.register_craft({
|
|||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'ontime_clocks:white',
|
output = 'ontime_clocks:white',
|
||||||
recipe = {
|
recipe = {
|
||||||
{mat.steel_ingot, mat.paper, mat.steel_ingot},
|
{'default:steel_ingot', 'default:paper', 'default:steel_ingot'},
|
||||||
{'', mat.mese_crystal, ''},
|
{'', 'default:mese_crystal', ''},
|
||||||
{'', '', ''},
|
{'', '', ''},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -50,8 +48,8 @@ minetest.register_craft({
|
|||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'ontime_clocks:frameless_black',
|
output = 'ontime_clocks:frameless_black',
|
||||||
recipe = {
|
recipe = {
|
||||||
{mat.steel_ingot, mat.dye_black, mat.steel_ingot},
|
{'default:steel_ingot', 'dye:black', 'default:steel_ingot'},
|
||||||
{'', mat.mese_crystal, ''},
|
{'', 'default:mese_crystal', ''},
|
||||||
{'', '', ''},
|
{'', '', ''},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -59,8 +57,8 @@ minetest.register_craft({
|
|||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'ontime_clocks:frameless_gold',
|
output = 'ontime_clocks:frameless_gold',
|
||||||
recipe = {
|
recipe = {
|
||||||
{mat.gold_ingot, '', mat.gold_ingot},
|
{'default:gold_ingot', '', 'default:gold_ingot'},
|
||||||
{'', mat.mese_crystal, ''},
|
{'', 'default:mese_crystal', ''},
|
||||||
{'', '', ''},
|
{'', '', ''},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -68,8 +66,8 @@ minetest.register_craft({
|
|||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'ontime_clocks:frameless_white',
|
output = 'ontime_clocks:frameless_white',
|
||||||
recipe = {
|
recipe = {
|
||||||
{mat.steel_ingot, mat.dye_white, mat.steel_ingot},
|
{'default:steel_ingot', 'dye:white', 'default:steel_ingot'},
|
||||||
{'', mat.mese_crystal, ''},
|
{'', 'default:mese_crystal', ''},
|
||||||
{'', '', ''},
|
{'', '', ''},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -22,9 +22,12 @@ ontime_clocks = {}
|
|||||||
ontime_clocks.name = minetest.get_current_modname()
|
ontime_clocks.name = minetest.get_current_modname()
|
||||||
ontime_clocks.path = minetest.get_modpath(ontime_clocks.name)
|
ontime_clocks.path = minetest.get_modpath(ontime_clocks.name)
|
||||||
|
|
||||||
-- Translation support
|
-- Load support for intllib.
|
||||||
ontime_clocks.S = minetest.get_translator(ontime_clocks.name)
|
local S, NS = dofile(ontime_clocks.path.."/intllib.lua")
|
||||||
|
ontime_clocks.intllib = S
|
||||||
|
|
||||||
dofile(ontime_clocks.path.."/common.lua")
|
dofile(ontime_clocks.path.."/common.lua")
|
||||||
dofile(ontime_clocks.path.."/nodes.lua")
|
dofile(ontime_clocks.path.."/nodes.lua")
|
||||||
dofile(ontime_clocks.path.."/crafts.lua")
|
dofile(ontime_clocks.path.."/crafts.lua")
|
||||||
|
|
||||||
|
minetest.log("action", "[ontime_clocks] loaded.")
|
||||||
|
|||||||
45
ontime_clocks/intllib.lua
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
|
||||||
|
-- Fallback functions for when `intllib` is not installed.
|
||||||
|
-- Code released under Unlicense <http://unlicense.org>.
|
||||||
|
|
||||||
|
-- Get the latest version of this file at:
|
||||||
|
-- https://raw.githubusercontent.com/minetest-mods/intllib/master/lib/intllib.lua
|
||||||
|
|
||||||
|
local function format(str, ...)
|
||||||
|
local args = { ... }
|
||||||
|
local function repl(escape, open, num, close)
|
||||||
|
if escape == "" then
|
||||||
|
local replacement = tostring(args[tonumber(num)])
|
||||||
|
if open == "" then
|
||||||
|
replacement = replacement..close
|
||||||
|
end
|
||||||
|
return replacement
|
||||||
|
else
|
||||||
|
return "@"..open..num..close
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return (str:gsub("(@?)@(%(?)(%d+)(%)?)", repl))
|
||||||
|
end
|
||||||
|
|
||||||
|
local gettext, ngettext
|
||||||
|
if minetest.get_modpath("intllib") then
|
||||||
|
if intllib.make_gettext_pair then
|
||||||
|
-- New method using gettext.
|
||||||
|
gettext, ngettext = intllib.make_gettext_pair()
|
||||||
|
else
|
||||||
|
-- Old method using text files.
|
||||||
|
gettext = intllib.Getter()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Fill in missing functions.
|
||||||
|
|
||||||
|
gettext = gettext or function(msgid, ...)
|
||||||
|
return format(msgid, ...)
|
||||||
|
end
|
||||||
|
|
||||||
|
ngettext = ngettext or function(msgid, msgid_plural, n, ...)
|
||||||
|
return format(n==1 and msgid or msgid_plural, ...)
|
||||||
|
end
|
||||||
|
|
||||||
|
return gettext, ngettext
|
||||||
43
ontime_clocks/locale/fr.po
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
# SOME DESCRIPTIVE TITLE.
|
||||||
|
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||||
|
# This file is distributed under the same license as the PACKAGE package.
|
||||||
|
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||||
|
#
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: \n"
|
||||||
|
"Report-Msgid-Bugs-To: \n"
|
||||||
|
"POT-Creation-Date: 2017-08-05 09:50+0200\n"
|
||||||
|
"PO-Revision-Date: 2017-05-08 06:20+0200\n"
|
||||||
|
"Last-Translator: Peppy <peppy@twang-factory.com>\n"
|
||||||
|
"Language-Team: \n"
|
||||||
|
"Language: fr\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"X-Generator: Poedit 1.8.12\n"
|
||||||
|
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
||||||
|
|
||||||
|
#: nodes.lua
|
||||||
|
msgid "Green digital clock"
|
||||||
|
msgstr "Horloge numérique verte"
|
||||||
|
|
||||||
|
#: nodes.lua
|
||||||
|
msgid "Red digital clock"
|
||||||
|
msgstr "Horloge numérique rouge"
|
||||||
|
|
||||||
|
#: nodes.lua
|
||||||
|
msgid "White clock"
|
||||||
|
msgstr "Horloge blanche"
|
||||||
|
|
||||||
|
#: nodes.lua
|
||||||
|
msgid "Frameless clock"
|
||||||
|
msgstr "Horloge sans cadre"
|
||||||
|
|
||||||
|
#: nodes.lua
|
||||||
|
msgid "Frameless gold clock"
|
||||||
|
msgstr "Horloge dorée sans cadre"
|
||||||
|
|
||||||
|
#: nodes.lua
|
||||||
|
msgid "Frameless white clock"
|
||||||
|
msgstr "Horloge blanche sans cadre"
|
||||||
42
ontime_clocks/locale/ms.po
Normal file
@@ -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) <translation@mnh48.moe>, 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 <translation@mnh48.moe>\n"
|
||||||
|
"Language-Team: Malay <translation@mnh48.moe>\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"
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
# textdomain: ontime_clocks
|
|
||||||
Green digital clock=Grüne Digitaluhr
|
|
||||||
Red digital clock=Rote Digitaluhr
|
|
||||||
White clock=Weiße Uhr
|
|
||||||
Frameless clock=Rahmenlose Uhr
|
|
||||||
Frameless gold clock=Rahmenlose goldene Uhr
|
|
||||||
Frameless white clock=Rahmenlose weiße Uhr
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
# textdomain: ontime_clocks
|
|
||||||
Green digital clock=Horloge numérique verte
|
|
||||||
Red digital clock=Horloge numérique rouge
|
|
||||||
White clock=Horloge blanche
|
|
||||||
Frameless clock=Horloge sans cadre
|
|
||||||
Frameless gold clock=Horloge dorée sans cadre
|
|
||||||
Frameless white clock=Horloge blanche sans cadre
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
# textdomain: ontime_clocks
|
|
||||||
Green digital clock=Jam digital hijau
|
|
||||||
Red digital clock=Jam digital merah
|
|
||||||
White clock=Jam putih
|
|
||||||
Frameless clock=Jam tanpa bingkai
|
|
||||||
Frameless gold clock=Jam emas tanpa bingkai
|
|
||||||
Frameless white clock=Jam putih tanpa bingkai
|
|
||||||
42
ontime_clocks/locale/template.pot
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
# SOME DESCRIPTIVE TITLE.
|
||||||
|
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||||
|
# This file is distributed under the same license as the PACKAGE package.
|
||||||
|
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||||
|
#
|
||||||
|
#, fuzzy
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
|
"Report-Msgid-Bugs-To: \n"
|
||||||
|
"POT-Creation-Date: 2017-08-26 11:21+0200\n"
|
||||||
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
"Language: \n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=CHARSET\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
|
||||||
|
#: nodes.lua
|
||||||
|
msgid "Green digital clock"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: nodes.lua
|
||||||
|
msgid "Red digital clock"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: nodes.lua
|
||||||
|
msgid "White clock"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: nodes.lua
|
||||||
|
msgid "Frameless clock"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: nodes.lua
|
||||||
|
msgid "Frameless gold clock"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: nodes.lua
|
||||||
|
msgid "Frameless white clock"
|
||||||
|
msgstr ""
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
# textdomain: ontime_clocks
|
|
||||||
Green digital clock=
|
|
||||||
Red digital clock=
|
|
||||||
White clock=
|
|
||||||
Frameless clock=
|
|
||||||
Frameless gold clock=
|
|
||||||
Frameless white clock=
|
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
name = ontime_clocks
|
name = ontime_clocks
|
||||||
title = Ontime Clocks
|
title = Ontime Clocks
|
||||||
description = Clocks displaing real ingame time
|
description = Clocks displaing real ingame time
|
||||||
depends = display_api, xcompat
|
depends = default,dye,display_api
|
||||||
|
optional_depends = intllib
|
||||||
|
|||||||
@@ -18,18 +18,7 @@
|
|||||||
along with ontime_clocks. If not, see <http://www.gnu.org/licenses/>.
|
along with ontime_clocks. If not, see <http://www.gnu.org/licenses/>.
|
||||||
--]]
|
--]]
|
||||||
|
|
||||||
local S = ontime_clocks.S
|
local S = ontime_clocks.intllib
|
||||||
|
|
||||||
local function clock_on_construct(pos)
|
|
||||||
local timer = minetest.get_node_timer(pos)
|
|
||||||
timer:start(5)
|
|
||||||
display_api.on_construct(pos)
|
|
||||||
end
|
|
||||||
|
|
||||||
local function clock_on_timer(pos)
|
|
||||||
display_api.update_entities(pos)
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Green digital clock
|
-- Green digital clock
|
||||||
minetest.register_node("ontime_clocks:green_digital", {
|
minetest.register_node("ontime_clocks:green_digital", {
|
||||||
@@ -41,15 +30,12 @@ minetest.register_node("ontime_clocks:green_digital", {
|
|||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "wallmounted",
|
type = "wallmounted",
|
||||||
wall_side = {-0.5, -3/16, -7/16, -13/32, 7/32, 7/16},
|
wall_side = { -0.5, -3/16, -7/16, -13/32, 7/32, 7/16 },
|
||||||
wall_bottom = {-7/16, -0.5, -3/16, 7/16, -13/32, 7/32},
|
wall_top = { -7/16, 0.5, -7/32, 7/16, 13/32, 3/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"},
|
tiles = {"ontime_clocks_digital.png"},
|
||||||
groups = {oddly_breakable_by_hand=1, not_blocking_trains=1, display_api=1, handy = 1},
|
groups = {oddly_breakable_by_hand=1, not_blocking_trains=1, display_api=1},
|
||||||
_mcl_hardness = 0.8,
|
|
||||||
_mcl_blast_resistance = 1,
|
|
||||||
is_ground_content = false,
|
|
||||||
display_entities = {
|
display_entities = {
|
||||||
["ontime_clocks:display"] = {
|
["ontime_clocks:display"] = {
|
||||||
depth = 13/32 - 0.01,
|
depth = 13/32 - 0.01,
|
||||||
@@ -60,13 +46,17 @@ minetest.register_node("ontime_clocks:green_digital", {
|
|||||||
end },
|
end },
|
||||||
},
|
},
|
||||||
on_place = display_api.on_place,
|
on_place = display_api.on_place,
|
||||||
on_construct = clock_on_construct,
|
on_construct = display_api.on_construct,
|
||||||
on_destruct = display_api.on_destruct,
|
on_destruct = display_api.on_destruct,
|
||||||
on_blast = display_api.on_blast,
|
|
||||||
on_rotate = display_api.on_rotate,
|
on_rotate = display_api.on_rotate,
|
||||||
on_timer = clock_on_timer,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_abm({
|
||||||
|
nodenames = {"ontime_clocks:green_digital"},
|
||||||
|
interval = 5,
|
||||||
|
chance = 1,
|
||||||
|
action = display_api.update_entities,
|
||||||
|
})
|
||||||
|
|
||||||
-- Red digital clock
|
-- Red digital clock
|
||||||
minetest.register_node("ontime_clocks:red_digital", {
|
minetest.register_node("ontime_clocks:red_digital", {
|
||||||
@@ -78,15 +68,12 @@ minetest.register_node("ontime_clocks:red_digital", {
|
|||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "wallmounted",
|
type = "wallmounted",
|
||||||
wall_side = {-0.5, -3/16, -7/16, -13/32, 7/32, 7/16},
|
wall_side = { -0.5, -3/16, -7/16, -13/32, 7/32, 7/16 },
|
||||||
wall_bottom = {-7/16, -0.5, -3/16, 7/16, -13/32, 7/32},
|
wall_bottom = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 },
|
||||||
wall_top = {-7/16, 0.5, -7/32, 7/16, 13/32, 3/16}
|
wall_top = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }
|
||||||
},
|
},
|
||||||
tiles = {"ontime_clocks_digital.png"},
|
tiles = {"ontime_clocks_digital.png"},
|
||||||
groups = {oddly_breakable_by_hand=1, not_blocking_trains=1, display_api=1, handy = 1},
|
groups = {oddly_breakable_by_hand=1, not_blocking_trains=1, display_api=1},
|
||||||
_mcl_hardness = 0.8,
|
|
||||||
_mcl_blast_resistance = 1,
|
|
||||||
is_ground_content = false,
|
|
||||||
display_entities = {
|
display_entities = {
|
||||||
["ontime_clocks:display"] = {
|
["ontime_clocks:display"] = {
|
||||||
depth = 13/32 - 0.01,
|
depth = 13/32 - 0.01,
|
||||||
@@ -97,11 +84,16 @@ minetest.register_node("ontime_clocks:red_digital", {
|
|||||||
end },
|
end },
|
||||||
},
|
},
|
||||||
on_place = display_api.on_place,
|
on_place = display_api.on_place,
|
||||||
on_construct = clock_on_construct,
|
on_construct = display_api.on_construct,
|
||||||
on_destruct = display_api.on_destruct,
|
on_destruct = display_api.on_destruct,
|
||||||
on_blast = display_api.on_blast,
|
|
||||||
on_rotate = display_api.on_rotate,
|
on_rotate = display_api.on_rotate,
|
||||||
on_timer = clock_on_timer,
|
})
|
||||||
|
|
||||||
|
minetest.register_abm({
|
||||||
|
nodenames = {"ontime_clocks:red_digital"},
|
||||||
|
interval = 5,
|
||||||
|
chance = 1,
|
||||||
|
action = display_api.update_entities,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@@ -119,10 +111,7 @@ minetest.register_node("ontime_clocks:white", {
|
|||||||
wall_top = { -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"},
|
tiles = {"ontime_clocks_white.png"},
|
||||||
groups = {oddly_breakable_by_hand=1, not_blocking_trains=1, display_api=1, handy = 1},
|
groups = {oddly_breakable_by_hand=1, not_blocking_trains=1, display_api=1},
|
||||||
_mcl_hardness = 0.8,
|
|
||||||
_mcl_blast_resistance = 1,
|
|
||||||
is_ground_content = false,
|
|
||||||
display_entities = {
|
display_entities = {
|
||||||
["ontime_clocks:display"] = {
|
["ontime_clocks:display"] = {
|
||||||
depth = 6/16 - 0.01,
|
depth = 6/16 - 0.01,
|
||||||
@@ -133,13 +122,17 @@ minetest.register_node("ontime_clocks:white", {
|
|||||||
end },
|
end },
|
||||||
},
|
},
|
||||||
on_place = display_api.on_place,
|
on_place = display_api.on_place,
|
||||||
on_construct = clock_on_construct,
|
on_construct = display_api.on_construct,
|
||||||
on_destruct = display_api.on_destruct,
|
on_destruct = display_api.on_destruct,
|
||||||
on_blast = display_api.on_blast,
|
|
||||||
on_rotate = display_api.on_rotate,
|
on_rotate = display_api.on_rotate,
|
||||||
on_timer = clock_on_timer,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_abm({
|
||||||
|
nodenames = {"ontime_clocks:white"},
|
||||||
|
interval = 5,
|
||||||
|
chance = 1,
|
||||||
|
action = display_api.update_entities,
|
||||||
|
})
|
||||||
|
|
||||||
minetest.register_node("ontime_clocks:frameless_black", {
|
minetest.register_node("ontime_clocks:frameless_black", {
|
||||||
description = S("Frameless clock"),
|
description = S("Frameless clock"),
|
||||||
@@ -148,7 +141,6 @@ minetest.register_node("ontime_clocks:frameless_black", {
|
|||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "wallmounted",
|
paramtype2 = "wallmounted",
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
use_texture_alpha = "clip",
|
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "wallmounted",
|
type = "wallmounted",
|
||||||
wall_side = { -0.5, -7/16, -7/16, -0.45, 7/16, 7/16 },
|
wall_side = { -0.5, -7/16, -7/16, -0.45, 7/16, 7/16 },
|
||||||
@@ -156,10 +148,7 @@ minetest.register_node("ontime_clocks:frameless_black", {
|
|||||||
wall_top = { -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"},
|
tiles = {"ontime_clocks_frameless.png"},
|
||||||
groups = {oddly_breakable_by_hand=1, not_blocking_trains=1, display_api=1, handy = 1},
|
groups = {oddly_breakable_by_hand=1, not_blocking_trains=1, display_api=1},
|
||||||
_mcl_hardness = 0.8,
|
|
||||||
_mcl_blast_resistance = 1,
|
|
||||||
is_ground_content = false,
|
|
||||||
display_entities = {
|
display_entities = {
|
||||||
["ontime_clocks:display"] = {
|
["ontime_clocks:display"] = {
|
||||||
depth = 7/16,
|
depth = 7/16,
|
||||||
@@ -170,13 +159,17 @@ minetest.register_node("ontime_clocks:frameless_black", {
|
|||||||
end },
|
end },
|
||||||
},
|
},
|
||||||
on_place = display_api.on_place,
|
on_place = display_api.on_place,
|
||||||
on_construct = clock_on_construct,
|
on_construct = display_api.on_construct,
|
||||||
on_destruct = display_api.on_destruct,
|
on_destruct = display_api.on_destruct,
|
||||||
on_blast = display_api.on_blast,
|
|
||||||
on_rotate = display_api.on_rotate,
|
on_rotate = display_api.on_rotate,
|
||||||
on_timer = clock_on_timer,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_abm({
|
||||||
|
nodenames = {"ontime_clocks:frameless_black"},
|
||||||
|
interval = 5,
|
||||||
|
chance = 1,
|
||||||
|
action = display_api.update_entities,
|
||||||
|
})
|
||||||
|
|
||||||
minetest.register_node("ontime_clocks:frameless_gold", {
|
minetest.register_node("ontime_clocks:frameless_gold", {
|
||||||
description = S("Frameless gold clock"),
|
description = S("Frameless gold clock"),
|
||||||
@@ -185,7 +178,6 @@ minetest.register_node("ontime_clocks:frameless_gold", {
|
|||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "wallmounted",
|
paramtype2 = "wallmounted",
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
use_texture_alpha = "clip",
|
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "wallmounted",
|
type = "wallmounted",
|
||||||
wall_side = { -0.5, -7/16, -7/16, -0.45, 7/16, 7/16 },
|
wall_side = { -0.5, -7/16, -7/16, -0.45, 7/16, 7/16 },
|
||||||
@@ -193,10 +185,7 @@ minetest.register_node("ontime_clocks:frameless_gold", {
|
|||||||
wall_top = { -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"},
|
tiles = {"ontime_clocks_frameless.png^[colorize:#FF0"},
|
||||||
groups = {oddly_breakable_by_hand=1, not_blocking_trains=1, display_api=1, handy = 1},
|
groups = {oddly_breakable_by_hand=1, not_blocking_trains=1, display_api=1},
|
||||||
_mcl_hardness = 0.8,
|
|
||||||
_mcl_blast_resistance = 1,
|
|
||||||
is_ground_content = false,
|
|
||||||
display_entities = {
|
display_entities = {
|
||||||
["ontime_clocks:display"] = {
|
["ontime_clocks:display"] = {
|
||||||
depth = 7/16,
|
depth = 7/16,
|
||||||
@@ -207,13 +196,17 @@ minetest.register_node("ontime_clocks:frameless_gold", {
|
|||||||
end },
|
end },
|
||||||
},
|
},
|
||||||
on_place = display_api.on_place,
|
on_place = display_api.on_place,
|
||||||
on_construct = clock_on_construct,
|
on_construct = display_api.on_construct,
|
||||||
on_destruct = display_api.on_destruct,
|
on_destruct = display_api.on_destruct,
|
||||||
on_blast = display_api.on_blast,
|
|
||||||
on_rotate = display_api.on_rotate,
|
on_rotate = display_api.on_rotate,
|
||||||
on_timer = clock_on_timer,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_abm({
|
||||||
|
nodenames = {"ontime_clocks:frameless_gold"},
|
||||||
|
interval = 5,
|
||||||
|
chance = 1,
|
||||||
|
action = display_api.update_entities,
|
||||||
|
})
|
||||||
|
|
||||||
minetest.register_node("ontime_clocks:frameless_white", {
|
minetest.register_node("ontime_clocks:frameless_white", {
|
||||||
description = S("Frameless white clock"),
|
description = S("Frameless white clock"),
|
||||||
@@ -222,7 +215,6 @@ minetest.register_node("ontime_clocks:frameless_white", {
|
|||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "wallmounted",
|
paramtype2 = "wallmounted",
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
use_texture_alpha = "clip",
|
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "wallmounted",
|
type = "wallmounted",
|
||||||
wall_side = { -0.5, -7/16, -7/16, -0.45, 7/16, 7/16 },
|
wall_side = { -0.5, -7/16, -7/16, -0.45, 7/16, 7/16 },
|
||||||
@@ -230,10 +222,7 @@ minetest.register_node("ontime_clocks:frameless_white", {
|
|||||||
wall_top = { -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"},
|
tiles = {"ontime_clocks_frameless.png^[colorize:#FFF"},
|
||||||
groups = {oddly_breakable_by_hand=1, not_blocking_trains=1, display_api=1, handy = 1},
|
groups = {oddly_breakable_by_hand=1, not_blocking_trains=1, display_api=1},
|
||||||
_mcl_hardness = 0.8,
|
|
||||||
_mcl_blast_resistance = 1,
|
|
||||||
is_ground_content = false,
|
|
||||||
display_entities = {
|
display_entities = {
|
||||||
["ontime_clocks:display"] = {
|
["ontime_clocks:display"] = {
|
||||||
depth = 7/16,
|
depth = 7/16,
|
||||||
@@ -244,21 +233,14 @@ minetest.register_node("ontime_clocks:frameless_white", {
|
|||||||
end },
|
end },
|
||||||
},
|
},
|
||||||
on_place = display_api.on_place,
|
on_place = display_api.on_place,
|
||||||
on_construct = clock_on_construct,
|
on_construct = display_api.on_construct,
|
||||||
on_destruct = display_api.on_destruct,
|
on_destruct = display_api.on_destruct,
|
||||||
on_blast = display_api.on_blast,
|
|
||||||
on_rotate = display_api.on_rotate,
|
on_rotate = display_api.on_rotate,
|
||||||
on_timer = clock_on_timer,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_abm({
|
||||||
minetest.register_lbm({
|
nodenames = {"ontime_clocks:frameless_white"},
|
||||||
name = "ontime_clocks:nodetimer_init",
|
interval = 5,
|
||||||
nodenames = {"ontime_clocks:green_digital", "ontime_clocks:red_digital", "ontime_clocks:white",
|
chance = 1,
|
||||||
"ontime_clocks:frameless_black", "ontime_clocks:frameless_gold", "ontime_clocks:frameless_white"},
|
action = display_api.update_entities,
|
||||||
run_at_every_load = false,
|
|
||||||
action = function(pos)
|
|
||||||
local timer = minetest.get_node_timer(pos)
|
|
||||||
timer:start(5)
|
|
||||||
end
|
|
||||||
})
|
})
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 164 B After Width: | Height: | Size: 175 B |
25
ontime_clocks/tools/updatepo.sh
Executable file
@@ -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
|
||||||
166
signs/LICENSE.txt
Normal file
@@ -0,0 +1,166 @@
|
|||||||
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
|
||||||
|
This version of the GNU Lesser General Public License incorporates
|
||||||
|
the terms and conditions of version 3 of the GNU General Public
|
||||||
|
License, supplemented by the additional permissions listed below.
|
||||||
|
|
||||||
|
0. Additional Definitions.
|
||||||
|
|
||||||
|
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||||
|
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||||
|
General Public License.
|
||||||
|
|
||||||
|
"The Library" refers to a covered work governed by this License,
|
||||||
|
other than an Application or a Combined Work as defined below.
|
||||||
|
|
||||||
|
An "Application" is any work that makes use of an interface provided
|
||||||
|
by the Library, but which is not otherwise based on the Library.
|
||||||
|
Defining a subclass of a class defined by the Library is deemed a mode
|
||||||
|
of using an interface provided by the Library.
|
||||||
|
|
||||||
|
A "Combined Work" is a work produced by combining or linking an
|
||||||
|
Application with the Library. The particular version of the Library
|
||||||
|
with which the Combined Work was made is also called the "Linked
|
||||||
|
Version".
|
||||||
|
|
||||||
|
The "Minimal Corresponding Source" for a Combined Work means the
|
||||||
|
Corresponding Source for the Combined Work, excluding any source code
|
||||||
|
for portions of the Combined Work that, considered in isolation, are
|
||||||
|
based on the Application, and not on the Linked Version.
|
||||||
|
|
||||||
|
The "Corresponding Application Code" for a Combined Work means the
|
||||||
|
object code and/or source code for the Application, including any data
|
||||||
|
and utility programs needed for reproducing the Combined Work from the
|
||||||
|
Application, but excluding the System Libraries of the Combined Work.
|
||||||
|
|
||||||
|
1. Exception to Section 3 of the GNU GPL.
|
||||||
|
|
||||||
|
You may convey a covered work under sections 3 and 4 of this License
|
||||||
|
without being bound by section 3 of the GNU GPL.
|
||||||
|
|
||||||
|
2. Conveying Modified Versions.
|
||||||
|
|
||||||
|
If you modify a copy of the Library, and, in your modifications, a
|
||||||
|
facility refers to a function or data to be supplied by an Application
|
||||||
|
that uses the facility (other than as an argument passed when the
|
||||||
|
facility is invoked), then you may convey a copy of the modified
|
||||||
|
version:
|
||||||
|
|
||||||
|
a) under this License, provided that you make a good faith effort to
|
||||||
|
ensure that, in the event an Application does not supply the
|
||||||
|
function or data, the facility still operates, and performs
|
||||||
|
whatever part of its purpose remains meaningful, or
|
||||||
|
|
||||||
|
b) under the GNU GPL, with none of the additional permissions of
|
||||||
|
this License applicable to that copy.
|
||||||
|
|
||||||
|
3. Object Code Incorporating Material from Library Header Files.
|
||||||
|
|
||||||
|
The object code form of an Application may incorporate material from
|
||||||
|
a header file that is part of the Library. You may convey such object
|
||||||
|
code under terms of your choice, provided that, if the incorporated
|
||||||
|
material is not limited to numerical parameters, data structure
|
||||||
|
layouts and accessors, or small macros, inline functions and templates
|
||||||
|
(ten or fewer lines in length), you do both of the following:
|
||||||
|
|
||||||
|
a) Give prominent notice with each copy of the object code that the
|
||||||
|
Library is used in it and that the Library and its use are
|
||||||
|
covered by this License.
|
||||||
|
|
||||||
|
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||||
|
document.
|
||||||
|
|
||||||
|
4. Combined Works.
|
||||||
|
|
||||||
|
You may convey a Combined Work under terms of your choice that,
|
||||||
|
taken together, effectively do not restrict modification of the
|
||||||
|
portions of the Library contained in the Combined Work and reverse
|
||||||
|
engineering for debugging such modifications, if you also do each of
|
||||||
|
the following:
|
||||||
|
|
||||||
|
a) Give prominent notice with each copy of the Combined Work that
|
||||||
|
the Library is used in it and that the Library and its use are
|
||||||
|
covered by this License.
|
||||||
|
|
||||||
|
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||||
|
document.
|
||||||
|
|
||||||
|
c) For a Combined Work that displays copyright notices during
|
||||||
|
execution, include the copyright notice for the Library among
|
||||||
|
these notices, as well as a reference directing the user to the
|
||||||
|
copies of the GNU GPL and this license document.
|
||||||
|
|
||||||
|
d) Do one of the following:
|
||||||
|
|
||||||
|
0) Convey the Minimal Corresponding Source under the terms of this
|
||||||
|
License, and the Corresponding Application Code in a form
|
||||||
|
suitable for, and under terms that permit, the user to
|
||||||
|
recombine or relink the Application with a modified version of
|
||||||
|
the Linked Version to produce a modified Combined Work, in the
|
||||||
|
manner specified by section 6 of the GNU GPL for conveying
|
||||||
|
Corresponding Source.
|
||||||
|
|
||||||
|
1) Use a suitable shared library mechanism for linking with the
|
||||||
|
Library. A suitable mechanism is one that (a) uses at run time
|
||||||
|
a copy of the Library already present on the user's computer
|
||||||
|
system, and (b) will operate properly with a modified version
|
||||||
|
of the Library that is interface-compatible with the Linked
|
||||||
|
Version.
|
||||||
|
|
||||||
|
e) Provide Installation Information, but only if you would otherwise
|
||||||
|
be required to provide such information under section 6 of the
|
||||||
|
GNU GPL, and only to the extent that such information is
|
||||||
|
necessary to install and execute a modified version of the
|
||||||
|
Combined Work produced by recombining or relinking the
|
||||||
|
Application with a modified version of the Linked Version. (If
|
||||||
|
you use option 4d0, the Installation Information must accompany
|
||||||
|
the Minimal Corresponding Source and Corresponding Application
|
||||||
|
Code. If you use option 4d1, you must provide the Installation
|
||||||
|
Information in the manner specified by section 6 of the GNU GPL
|
||||||
|
for conveying Corresponding Source.)
|
||||||
|
|
||||||
|
5. Combined Libraries.
|
||||||
|
|
||||||
|
You may place library facilities that are a work based on the
|
||||||
|
Library side by side in a single library together with other library
|
||||||
|
facilities that are not Applications and are not covered by this
|
||||||
|
License, and convey such a combined library under terms of your
|
||||||
|
choice, if you do both of the following:
|
||||||
|
|
||||||
|
a) Accompany the combined library with a copy of the same work based
|
||||||
|
on the Library, uncombined with any other library facilities,
|
||||||
|
conveyed under the terms of this License.
|
||||||
|
|
||||||
|
b) Give prominent notice with the combined library that part of it
|
||||||
|
is a work based on the Library, and explaining where to find the
|
||||||
|
accompanying uncombined form of the same work.
|
||||||
|
|
||||||
|
6. Revised Versions of the GNU Lesser General Public License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the GNU Lesser General Public License from time to time. Such new
|
||||||
|
versions will be similar in spirit to the present version, but may
|
||||||
|
differ in detail to address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Library as you received it specifies that a certain numbered version
|
||||||
|
of the GNU Lesser General Public License "or any later version"
|
||||||
|
applies to it, you have the option of following the terms and
|
||||||
|
conditions either of that published version or of any later version
|
||||||
|
published by the Free Software Foundation. If the Library as you
|
||||||
|
received it does not specify a version number of the GNU Lesser
|
||||||
|
General Public License, you may choose any version of the GNU Lesser
|
||||||
|
General Public License ever published by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Library as you received it specifies that a proxy can decide
|
||||||
|
whether future versions of the GNU Lesser General Public License shall
|
||||||
|
apply, that proxy's public statement of acceptance of any version is
|
||||||
|
permanent authorization for you to choose that version for the
|
||||||
|
Library.
|
||||||
|
|
||||||
@@ -4,7 +4,7 @@ This mod provides various signs with text display. Text is locked if area is pro
|
|||||||
|
|
||||||
For more information, see the [forum topic](https://forum.minetest.net/viewtopic.php?t=19365) at the Minetest forums.
|
For more information, see the [forum topic](https://forum.minetest.net/viewtopic.php?t=19365) at the Minetest forums.
|
||||||
|
|
||||||
**Dependencies**: xcompat, display\_lib, font\_lib
|
**Dependancies**: default, display\_lib, font\_lib
|
||||||
|
|
||||||
**License**: Code under LGPL, Textures and models under CC-BY-SA
|
**License**: Code under LGPL, Textures and models under CC-BY-SA
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,9 @@
|
|||||||
along with signs. If not, see <http://www.gnu.org/licenses/>.
|
along with signs. If not, see <http://www.gnu.org/licenses/>.
|
||||||
--]]
|
--]]
|
||||||
|
|
||||||
|
local S = signs.intllib
|
||||||
|
local F = function(...) return minetest.formspec_escape(S(...)) end
|
||||||
|
|
||||||
-- Generic callback for show_formspec displayed formspecs of "sign" mod
|
-- Generic callback for show_formspec displayed formspecs of "sign" mod
|
||||||
|
|
||||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
|
|||||||
@@ -61,16 +61,9 @@ minetest.register_lbm({ name = "signs:conpatibility_1",
|
|||||||
-- We need to have this entity registered to be able to remove it.
|
-- We need to have this entity registered to be able to remove it.
|
||||||
if minetest.registered_entities["signs:text"] == nil then
|
if minetest.registered_entities["signs:text"] == nil then
|
||||||
minetest.register_entity("signs:text", {
|
minetest.register_entity("signs:text", {
|
||||||
on_activate = function(self)
|
collisionbox = { 0, 0, 0, 0, 0, 0 },
|
||||||
if self.object then
|
|
||||||
self.object:remove()
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
initial_properties = {
|
|
||||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
|
||||||
visual = "upright_sprite",
|
visual = "upright_sprite",
|
||||||
textures = {}
|
textures = {},
|
||||||
}
|
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
10
signs/copyright.txt
Normal file
@@ -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)
|
||||||
|
|
||||||
@@ -1,10 +1,8 @@
|
|||||||
local mat = xcompat.materials
|
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'signs:wooden_right_sign',
|
output = 'signs:wooden_right_sign',
|
||||||
recipe = {
|
recipe = {
|
||||||
{'group:wood', 'group:wood', 'group:wood'},
|
{'group:wood', 'group:wood', 'group:wood'},
|
||||||
{'group:wood', 'group:wood', mat.dye_black},
|
{'group:wood', 'group:wood', 'dye:black'},
|
||||||
{'', '', ''},
|
{'', '', ''},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -18,7 +16,7 @@ minetest.register_craft({
|
|||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'signs:wooden_long_sign',
|
output = 'signs:wooden_long_sign',
|
||||||
recipe = {
|
recipe = {
|
||||||
{'group:wood', mat.dye_black, 'group:wood'},
|
{'group:wood', 'dye:black', 'group:wood'},
|
||||||
{'group:wood', 'group:wood', 'group:wood'},
|
{'group:wood', 'group:wood', 'group:wood'},
|
||||||
{'', '', ''},
|
{'', '', ''},
|
||||||
}
|
}
|
||||||
@@ -33,7 +31,7 @@ minetest.register_craft({
|
|||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'signs:wooden_sign',
|
output = 'signs:wooden_sign',
|
||||||
recipe = {
|
recipe = {
|
||||||
{'', mat.dye_black, ''},
|
{'', 'dye:black', ''},
|
||||||
{'group:wood', 'group:wood', 'group:wood'},
|
{'group:wood', 'group:wood', 'group:wood'},
|
||||||
{'group:wood', 'group:wood', 'group:wood'},
|
{'group:wood', 'group:wood', 'group:wood'},
|
||||||
}
|
}
|
||||||
@@ -42,40 +40,22 @@ minetest.register_craft({
|
|||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'signs:paper_poster',
|
output = 'signs:paper_poster',
|
||||||
recipe = {
|
recipe = {
|
||||||
{mat.paper, mat.paper, mat.dye_black},
|
{'default:paper', 'default:paper', 'dye:black'},
|
||||||
{mat.paper, mat.paper, ''},
|
{'default:paper', 'default:paper', ''},
|
||||||
{mat.paper, mat.paper, ''},
|
{'default:paper', 'default:paper', ''},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
local dyes = {
|
|
||||||
mat.dye_white,
|
|
||||||
mat.dye_grey,
|
|
||||||
mat.dye_orange,
|
|
||||||
mat.dye_brown,
|
|
||||||
mat.dye_dark_grey,
|
|
||||||
mat.dye_yellow,
|
|
||||||
mat.dye_green,
|
|
||||||
mat.dye_red,
|
|
||||||
}
|
|
||||||
for i, dye in ipairs(dyes) do
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "shapeless",
|
|
||||||
output = minetest.itemstring_with_palette("signs:paper_poster", (i-1) * 32),
|
|
||||||
recipe = {"signs:paper_poster", dye},
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'signs:label_small',
|
output = 'signs:label_small',
|
||||||
recipe = {
|
recipe = {
|
||||||
{mat.paper, mat.dye_black},
|
{'default:paper', 'dye:black'},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'signs:label_medium',
|
output = 'signs:label_medium',
|
||||||
recipe = {
|
recipe = {
|
||||||
{mat.paper, mat.paper, mat.dye_black},
|
{'default:paper', 'default:paper', 'dye:black'},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -22,14 +22,13 @@ signs = {}
|
|||||||
signs.name = minetest.get_current_modname()
|
signs.name = minetest.get_current_modname()
|
||||||
signs.path = minetest.get_modpath(signs.name)
|
signs.path = minetest.get_modpath(signs.name)
|
||||||
|
|
||||||
-- Translation support
|
-- Load support for intllib.
|
||||||
signs.S = minetest.get_translator(signs.name)
|
local S, NS = dofile(signs.path.."/intllib.lua")
|
||||||
|
signs.intllib = S
|
||||||
|
|
||||||
dofile(signs.path.."/common.lua")
|
dofile(signs.path.."/common.lua")
|
||||||
dofile(signs.path.."/nodes.lua")
|
dofile(signs.path.."/nodes.lua")
|
||||||
dofile(signs.path.."/crafts.lua")
|
dofile(signs.path.."/crafts.lua")
|
||||||
dofile(signs.path.."/compatibility.lua")
|
dofile(signs.path.."/compatibility.lua")
|
||||||
|
|
||||||
|
minetest.log("action", "[signs] loaded.")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
45
signs/intllib.lua
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
|
||||||
|
-- Fallback functions for when `intllib` is not installed.
|
||||||
|
-- Code released under Unlicense <http://unlicense.org>.
|
||||||
|
|
||||||
|
-- Get the latest version of this file at:
|
||||||
|
-- https://raw.githubusercontent.com/minetest-mods/intllib/master/lib/intllib.lua
|
||||||
|
|
||||||
|
local function format(str, ...)
|
||||||
|
local args = { ... }
|
||||||
|
local function repl(escape, open, num, close)
|
||||||
|
if escape == "" then
|
||||||
|
local replacement = tostring(args[tonumber(num)])
|
||||||
|
if open == "" then
|
||||||
|
replacement = replacement..close
|
||||||
|
end
|
||||||
|
return replacement
|
||||||
|
else
|
||||||
|
return "@"..open..num..close
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return (str:gsub("(@?)@(%(?)(%d+)(%)?)", repl))
|
||||||
|
end
|
||||||
|
|
||||||
|
local gettext, ngettext
|
||||||
|
if minetest.get_modpath("intllib") then
|
||||||
|
if intllib.make_gettext_pair then
|
||||||
|
-- New method using gettext.
|
||||||
|
gettext, ngettext = intllib.make_gettext_pair()
|
||||||
|
else
|
||||||
|
-- Old method using text files.
|
||||||
|
gettext = intllib.Getter()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Fill in missing functions.
|
||||||
|
|
||||||
|
gettext = gettext or function(msgid, ...)
|
||||||
|
return format(msgid, ...)
|
||||||
|
end
|
||||||
|
|
||||||
|
ngettext = ngettext or function(msgid, msgid_plural, n, ...)
|
||||||
|
return format(n==1 and msgid or msgid_plural, ...)
|
||||||
|
end
|
||||||
|
|
||||||
|
return gettext, ngettext
|
||||||
54
signs/locale/fr.po
Normal file
@@ -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 <EMAIL@ADDRESS>, 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 <peppy@twang-factory.com>\n"
|
||||||
|
"Language-Team: \n"
|
||||||
|
"Language: fr\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"X-Generator: Poedit 1.8.12\n"
|
||||||
|
|
||||||
|
#: 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"
|
||||||
51
signs/locale/ms.po
Normal file
@@ -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) <translation@mnh48.moe>, 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 <translation@mnh48.moe>\n"
|
||||||
|
"Language-Team: Malay <translation@mnh48.moe>\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"
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
# textdomain: signs
|
|
||||||
Close=Schließen
|
|
||||||
Edit=Bearbeiten
|
|
||||||
Title=Titel
|
|
||||||
Text=Text
|
|
||||||
Title font=Titel Schriftart
|
|
||||||
Write=Schreiben
|
|
||||||
(right-click to read more text)=(Rechtsklick für mehr Text)
|
|
||||||
Wooden sign=Hölzernes Schild
|
|
||||||
Wooden long sign=Langes hölzernes Schild
|
|
||||||
Wooden direction sign=Hölzerner Wegweiser
|
|
||||||
Poster=Poster
|
|
||||||
Small label=Kleines Etikett
|
|
||||||
Label=Etikett
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
# textdomain: signs
|
|
||||||
Close=Fermer
|
|
||||||
Edit=Éditer
|
|
||||||
Title=Titre
|
|
||||||
Text=Texte
|
|
||||||
Title font=Police de titre
|
|
||||||
Write=Écrire
|
|
||||||
(right-click to read more text)=(Clic-droit pour afficher le texte entier)
|
|
||||||
Wooden sign=Signe en bois
|
|
||||||
Wooden long sign=Long signe en bois
|
|
||||||
Wooden direction sign=Panneau de direction en bois
|
|
||||||
Poster=Affiche
|
|
||||||
Small label=Petite étiquette
|
|
||||||
Label=Étiquette
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
# textdomain: signs
|
|
||||||
Close=
|
|
||||||
Edit=
|
|
||||||
Title=
|
|
||||||
Text=
|
|
||||||
Title font=
|
|
||||||
Write=
|
|
||||||
(right-click to read more text)=(klik-kanan untuk baca teks penuh)
|
|
||||||
Wooden sign=
|
|
||||||
Wooden long sign=
|
|
||||||
Wooden direction sign=Papan tanda arah kayu
|
|
||||||
Poster=Poster
|
|
||||||
Small label=
|
|
||||||
Label=
|
|
||||||
51
signs/locale/template.pot
Normal file
@@ -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 <EMAIL@ADDRESS>, 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 <EMAIL@ADDRESS>\n"
|
||||||
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
"Language: \n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=CHARSET\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
|
||||||
|
#: 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 ""
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
# textdomain: signs
|
|
||||||
Close=
|
|
||||||
Edit=
|
|
||||||
Title=
|
|
||||||
Text=
|
|
||||||
Title font=
|
|
||||||
Write=
|
|
||||||
(right-click to read more text)=
|
|
||||||
Wooden sign=
|
|
||||||
Wooden long sign=
|
|
||||||
Wooden direction sign=
|
|
||||||
Poster=
|
|
||||||
Small label=
|
|
||||||
Label=
|
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
name = signs
|
name = signs
|
||||||
title = Signs
|
title = Signs
|
||||||
description = Basic signs and posters with text display using signs_api
|
description = Basic signs and posters with text display using signs_api
|
||||||
depends = signs_api, xcompat
|
depends = default,dye,signs_api
|
||||||
|
optional_depends = intllib
|
||||||
|
|||||||
@@ -18,8 +18,8 @@
|
|||||||
along with signs. If not, see <http://www.gnu.org/licenses/>.
|
along with signs. If not, see <http://www.gnu.org/licenses/>.
|
||||||
--]]
|
--]]
|
||||||
|
|
||||||
local S = signs.S
|
local S = signs.intllib
|
||||||
local FS = function(...) return minetest.formspec_escape(S(...)) end
|
local F = function(...) return minetest.formspec_escape(S(...)) end
|
||||||
|
|
||||||
-- Poster specific formspec
|
-- Poster specific formspec
|
||||||
local function display_poster(pos, node, player)
|
local function display_poster(pos, node, player)
|
||||||
@@ -42,15 +42,16 @@ local function display_poster(pos, node, player)
|
|||||||
image[0,-0.2;8.4,2;%s]
|
image[0,-0.2;8.4,2;%s]
|
||||||
style_type[textarea;textcolor=#111]
|
style_type[textarea;textcolor=#111]
|
||||||
textarea[0.3,1.5;7,8;;%s;]]=],
|
textarea[0.3,1.5;7,8;;%s;]]=],
|
||||||
titletexture:gsub("[\\^]", "\\%0"),
|
titletexture,
|
||||||
minetest.formspec_escape(meta:get_string("text")))
|
minetest.colorize("#111",
|
||||||
|
minetest.formspec_escape(meta:get_string("text"))))
|
||||||
|
|
||||||
if minetest.is_protected(pos, player:get_player_name()) then
|
if minetest.is_protected(pos, player:get_player_name()) then
|
||||||
fs = string.format("%sbutton_exit[2.5,8;2,1;ok;%s]", fs, FS("Close"))
|
fs = string.format("%sbutton_exit[2.5,8;2,1;ok;%s]", fs, F("Close"))
|
||||||
else
|
else
|
||||||
fs = string.format(
|
fs = string.format(
|
||||||
"%sbutton[1,8;2,1;edit;%s]button_exit[4,8;2,1;ok;%s]",
|
"%sbutton[1,8;2,1;edit;%s]button_exit[4,8;2,1;ok;%s]",
|
||||||
fs, FS("Edit"), FS("Close"))
|
fs, F("Edit"), F("Close"))
|
||||||
end
|
end
|
||||||
minetest.show_formspec(player:get_player_name(), fname, fs)
|
minetest.show_formspec(player:get_player_name(), fname, fs)
|
||||||
end
|
end
|
||||||
@@ -64,15 +65,15 @@ local function edit_poster(pos, node, player)
|
|||||||
|
|
||||||
if not minetest.is_protected(pos, player:get_player_name()) then
|
if not minetest.is_protected(pos, player:get_player_name()) then
|
||||||
fs = string.format([=[
|
fs = string.format([=[
|
||||||
size[6.5,7.5]
|
size[6.5,7.5]%s%s%s
|
||||||
field[0.5,0.7;6,1;display_text;%s;%s]
|
field[0.5,0.7;6,1;display_text;%s;%s]
|
||||||
textarea[0.5,1.7;6,6;text;%s;%s]
|
textarea[0.5,1.7;6,6;text;%s;%s]
|
||||||
button[1.25,7;2,1;font;%s]
|
button[1.25,7;2,1;font;%s]
|
||||||
button_exit[3.25,7;2,1;write;%s]]=],
|
button_exit[3.25,7;2,1;write;%s]]=],
|
||||||
FS("Title"),
|
default.gui_bg, default.gui_bg_img, default.gui_slots, F("Title"),
|
||||||
minetest.formspec_escape(meta:get_string("display_text")),
|
minetest.formspec_escape(meta:get_string("display_text")),
|
||||||
FS("Text"), minetest.formspec_escape(meta:get_string("text")),
|
F("Text"), minetest.formspec_escape(meta:get_string("text")),
|
||||||
FS("Title font"), FS("Write"))
|
F("Title font"), F("Write"))
|
||||||
minetest.show_formspec(player:get_player_name(), fname, fs)
|
minetest.show_formspec(player:get_player_name(), fname, fs)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -94,17 +95,17 @@ local function on_receive_fields_poster(pos, formname, fields, player)
|
|||||||
meta:set_string("display_text", fields.display_text)
|
meta:set_string("display_text", fields.display_text)
|
||||||
meta:set_string("text", fields.text)
|
meta:set_string("text", fields.text)
|
||||||
meta:set_string("infotext", "\""..fields.display_text
|
meta:set_string("infotext", "\""..fields.display_text
|
||||||
.."\"\n"..FS("(right-click to read more text)"))
|
.."\"\n"..S("(right-click to read more text)"))
|
||||||
display_api.update_entities(pos)
|
display_api.update_entities(pos)
|
||||||
end
|
end
|
||||||
if (fields.write or fields.key_enter) then
|
if (fields.write or fields.key_enter) then
|
||||||
display_poster(pos, node, player)
|
display_poster(pos, node, player)
|
||||||
elseif (fields.font) then
|
elseif (fields.font) then
|
||||||
font_api.show_font_list(player, pos, function (playername, npos)
|
font_api.show_font_list(player, pos, function (playername, pos)
|
||||||
local user = minetest.get_player_by_name(playername)
|
local player = minetest.get_player_by_name(playername)
|
||||||
local node2 = minetest.get_node(npos)
|
local node = minetest.get_node(pos)
|
||||||
if user and node2 then
|
if player and node then
|
||||||
edit_poster(npos, node2, user)
|
edit_poster(pos, node, player)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
@@ -130,8 +131,6 @@ local models = {
|
|||||||
tiles = { "signs_wooden.png" },
|
tiles = { "signs_wooden.png" },
|
||||||
inventory_image = "signs_wooden_inventory.png",
|
inventory_image = "signs_wooden_inventory.png",
|
||||||
groups= { dig_immediate = 2 },
|
groups= { dig_immediate = 2 },
|
||||||
_mcl_hardness = 0.8,
|
|
||||||
_mcl_blast_resistance = 1,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
wooden_long_sign = {
|
wooden_long_sign = {
|
||||||
@@ -150,8 +149,6 @@ local models = {
|
|||||||
},
|
},
|
||||||
inventory_image = "signs_wooden_long_inventory.png",
|
inventory_image = "signs_wooden_long_inventory.png",
|
||||||
groups= { dig_immediate = 2 },
|
groups= { dig_immediate = 2 },
|
||||||
_mcl_hardness = 0.8,
|
|
||||||
_mcl_blast_resistance = 1,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
wooden_right_sign = {
|
wooden_right_sign = {
|
||||||
@@ -171,10 +168,8 @@ local models = {
|
|||||||
drawtype = "mesh",
|
drawtype = "mesh",
|
||||||
mesh = "signs_dir_right.obj",
|
mesh = "signs_dir_right.obj",
|
||||||
selection_box = { type="fixed", fixed = {-0.5, -7/32, 0.5, 7/16, 7/32, 7/16}},
|
selection_box = { type="fixed", fixed = {-0.5, -7/32, 0.5, 7/16, 7/32, 7/16}},
|
||||||
collision_box = { type="fixed", fixed = {-7/16, -7/32, 0.5, 0.5, 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 },
|
groups= { dig_immediate = 2 },
|
||||||
_mcl_hardness = 0.8,
|
|
||||||
_mcl_blast_resistance = 1,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
wooden_left_sign = {
|
wooden_left_sign = {
|
||||||
@@ -195,8 +190,6 @@ local models = {
|
|||||||
selection_box = { type="fixed", fixed = {-7/16, -7/32, 0.5, 0.5, 7/32, 7/16}},
|
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}},
|
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 },
|
groups = { not_in_creative_inventory = 1, dig_immediate = 2 },
|
||||||
_mcl_hardness = 0.8,
|
|
||||||
_mcl_blast_resistance = 1,
|
|
||||||
drop = "signs:wooden_right_sign",
|
drop = "signs:wooden_right_sign",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -214,12 +207,7 @@ local models = {
|
|||||||
"signs_poster_sides.png", "signs_poster_sides.png",
|
"signs_poster_sides.png", "signs_poster_sides.png",
|
||||||
"signs_poster_sides.png", "signs_poster.png" },
|
"signs_poster_sides.png", "signs_poster.png" },
|
||||||
inventory_image = "signs_poster_inventory.png",
|
inventory_image = "signs_poster_inventory.png",
|
||||||
use_texture_alpha = "clip",
|
groups= { dig_immediate = 3 },
|
||||||
paramtype2 = "colorfacedir",
|
|
||||||
palette = "signs_poster_palette.png",
|
|
||||||
groups= { dig_immediate = 2 },
|
|
||||||
_mcl_hardness = 0.8,
|
|
||||||
_mcl_blast_resistance = 1,
|
|
||||||
on_construct = display_api.on_construct,
|
on_construct = display_api.on_construct,
|
||||||
on_rightclick = display_poster,
|
on_rightclick = display_poster,
|
||||||
on_receive_fields = on_receive_fields_poster,
|
on_receive_fields = on_receive_fields_poster,
|
||||||
@@ -239,9 +227,7 @@ local models = {
|
|||||||
description = S("Small label"),
|
description = S("Small label"),
|
||||||
tiles = { "signs_label.png" },
|
tiles = { "signs_label.png" },
|
||||||
inventory_image = "signs_label_small_inventory.png",
|
inventory_image = "signs_label_small_inventory.png",
|
||||||
groups= { dig_immediate = 2 },
|
groups= { dig_immediate = 3 },
|
||||||
_mcl_hardness = 0.8,
|
|
||||||
_mcl_blast_resistance = 1,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
label_medium = {
|
label_medium = {
|
||||||
@@ -255,9 +241,7 @@ local models = {
|
|||||||
description = S("Label"),
|
description = S("Label"),
|
||||||
tiles = { "signs_label.png" },
|
tiles = { "signs_label.png" },
|
||||||
inventory_image = "signs_label_medium_inventory.png",
|
inventory_image = "signs_label_medium_inventory.png",
|
||||||
groups= { dig_immediate = 2 },
|
groups= { dig_immediate = 3 },
|
||||||
_mcl_hardness = 0.8,
|
|
||||||
_mcl_blast_resistance = 1,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 101 B |
25
signs/tools/updatepo.sh
Executable file
@@ -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
|
||||||
166
signs_api/LICENSE.txt
Normal file
@@ -0,0 +1,166 @@
|
|||||||
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
|
||||||
|
This version of the GNU Lesser General Public License incorporates
|
||||||
|
the terms and conditions of version 3 of the GNU General Public
|
||||||
|
License, supplemented by the additional permissions listed below.
|
||||||
|
|
||||||
|
0. Additional Definitions.
|
||||||
|
|
||||||
|
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||||
|
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||||
|
General Public License.
|
||||||
|
|
||||||
|
"The Library" refers to a covered work governed by this License,
|
||||||
|
other than an Application or a Combined Work as defined below.
|
||||||
|
|
||||||
|
An "Application" is any work that makes use of an interface provided
|
||||||
|
by the Library, but which is not otherwise based on the Library.
|
||||||
|
Defining a subclass of a class defined by the Library is deemed a mode
|
||||||
|
of using an interface provided by the Library.
|
||||||
|
|
||||||
|
A "Combined Work" is a work produced by combining or linking an
|
||||||
|
Application with the Library. The particular version of the Library
|
||||||
|
with which the Combined Work was made is also called the "Linked
|
||||||
|
Version".
|
||||||
|
|
||||||
|
The "Minimal Corresponding Source" for a Combined Work means the
|
||||||
|
Corresponding Source for the Combined Work, excluding any source code
|
||||||
|
for portions of the Combined Work that, considered in isolation, are
|
||||||
|
based on the Application, and not on the Linked Version.
|
||||||
|
|
||||||
|
The "Corresponding Application Code" for a Combined Work means the
|
||||||
|
object code and/or source code for the Application, including any data
|
||||||
|
and utility programs needed for reproducing the Combined Work from the
|
||||||
|
Application, but excluding the System Libraries of the Combined Work.
|
||||||
|
|
||||||
|
1. Exception to Section 3 of the GNU GPL.
|
||||||
|
|
||||||
|
You may convey a covered work under sections 3 and 4 of this License
|
||||||
|
without being bound by section 3 of the GNU GPL.
|
||||||
|
|
||||||
|
2. Conveying Modified Versions.
|
||||||
|
|
||||||
|
If you modify a copy of the Library, and, in your modifications, a
|
||||||
|
facility refers to a function or data to be supplied by an Application
|
||||||
|
that uses the facility (other than as an argument passed when the
|
||||||
|
facility is invoked), then you may convey a copy of the modified
|
||||||
|
version:
|
||||||
|
|
||||||
|
a) under this License, provided that you make a good faith effort to
|
||||||
|
ensure that, in the event an Application does not supply the
|
||||||
|
function or data, the facility still operates, and performs
|
||||||
|
whatever part of its purpose remains meaningful, or
|
||||||
|
|
||||||
|
b) under the GNU GPL, with none of the additional permissions of
|
||||||
|
this License applicable to that copy.
|
||||||
|
|
||||||
|
3. Object Code Incorporating Material from Library Header Files.
|
||||||
|
|
||||||
|
The object code form of an Application may incorporate material from
|
||||||
|
a header file that is part of the Library. You may convey such object
|
||||||
|
code under terms of your choice, provided that, if the incorporated
|
||||||
|
material is not limited to numerical parameters, data structure
|
||||||
|
layouts and accessors, or small macros, inline functions and templates
|
||||||
|
(ten or fewer lines in length), you do both of the following:
|
||||||
|
|
||||||
|
a) Give prominent notice with each copy of the object code that the
|
||||||
|
Library is used in it and that the Library and its use are
|
||||||
|
covered by this License.
|
||||||
|
|
||||||
|
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||||
|
document.
|
||||||
|
|
||||||
|
4. Combined Works.
|
||||||
|
|
||||||
|
You may convey a Combined Work under terms of your choice that,
|
||||||
|
taken together, effectively do not restrict modification of the
|
||||||
|
portions of the Library contained in the Combined Work and reverse
|
||||||
|
engineering for debugging such modifications, if you also do each of
|
||||||
|
the following:
|
||||||
|
|
||||||
|
a) Give prominent notice with each copy of the Combined Work that
|
||||||
|
the Library is used in it and that the Library and its use are
|
||||||
|
covered by this License.
|
||||||
|
|
||||||
|
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||||
|
document.
|
||||||
|
|
||||||
|
c) For a Combined Work that displays copyright notices during
|
||||||
|
execution, include the copyright notice for the Library among
|
||||||
|
these notices, as well as a reference directing the user to the
|
||||||
|
copies of the GNU GPL and this license document.
|
||||||
|
|
||||||
|
d) Do one of the following:
|
||||||
|
|
||||||
|
0) Convey the Minimal Corresponding Source under the terms of this
|
||||||
|
License, and the Corresponding Application Code in a form
|
||||||
|
suitable for, and under terms that permit, the user to
|
||||||
|
recombine or relink the Application with a modified version of
|
||||||
|
the Linked Version to produce a modified Combined Work, in the
|
||||||
|
manner specified by section 6 of the GNU GPL for conveying
|
||||||
|
Corresponding Source.
|
||||||
|
|
||||||
|
1) Use a suitable shared library mechanism for linking with the
|
||||||
|
Library. A suitable mechanism is one that (a) uses at run time
|
||||||
|
a copy of the Library already present on the user's computer
|
||||||
|
system, and (b) will operate properly with a modified version
|
||||||
|
of the Library that is interface-compatible with the Linked
|
||||||
|
Version.
|
||||||
|
|
||||||
|
e) Provide Installation Information, but only if you would otherwise
|
||||||
|
be required to provide such information under section 6 of the
|
||||||
|
GNU GPL, and only to the extent that such information is
|
||||||
|
necessary to install and execute a modified version of the
|
||||||
|
Combined Work produced by recombining or relinking the
|
||||||
|
Application with a modified version of the Linked Version. (If
|
||||||
|
you use option 4d0, the Installation Information must accompany
|
||||||
|
the Minimal Corresponding Source and Corresponding Application
|
||||||
|
Code. If you use option 4d1, you must provide the Installation
|
||||||
|
Information in the manner specified by section 6 of the GNU GPL
|
||||||
|
for conveying Corresponding Source.)
|
||||||
|
|
||||||
|
5. Combined Libraries.
|
||||||
|
|
||||||
|
You may place library facilities that are a work based on the
|
||||||
|
Library side by side in a single library together with other library
|
||||||
|
facilities that are not Applications and are not covered by this
|
||||||
|
License, and convey such a combined library under terms of your
|
||||||
|
choice, if you do both of the following:
|
||||||
|
|
||||||
|
a) Accompany the combined library with a copy of the same work based
|
||||||
|
on the Library, uncombined with any other library facilities,
|
||||||
|
conveyed under the terms of this License.
|
||||||
|
|
||||||
|
b) Give prominent notice with the combined library that part of it
|
||||||
|
is a work based on the Library, and explaining where to find the
|
||||||
|
accompanying uncombined form of the same work.
|
||||||
|
|
||||||
|
6. Revised Versions of the GNU Lesser General Public License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the GNU Lesser General Public License from time to time. Such new
|
||||||
|
versions will be similar in spirit to the present version, but may
|
||||||
|
differ in detail to address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Library as you received it specifies that a certain numbered version
|
||||||
|
of the GNU Lesser General Public License "or any later version"
|
||||||
|
applies to it, you have the option of following the terms and
|
||||||
|
conditions either of that published version or of any later version
|
||||||
|
published by the Free Software Foundation. If the Library as you
|
||||||
|
received it does not specify a version number of the GNU Lesser
|
||||||
|
General Public License, you may choose any version of the GNU Lesser
|
||||||
|
General Public License ever published by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Library as you received it specifies that a proxy can decide
|
||||||
|
whether future versions of the GNU Lesser General Public License shall
|
||||||
|
apply, that proxy's public statement of acceptance of any version is
|
||||||
|
permanent authorization for you to choose that version for the
|
||||||
|
Library.
|
||||||
|
|
||||||
@@ -5,7 +5,7 @@ No actual signs get registered by this mod, the signs are defined in the sign su
|
|||||||
|
|
||||||
For more information, see the [forum topic](https://forum.minetest.net/viewtopic.php?t=19365) at the Minetest forums.
|
For more information, see the [forum topic](https://forum.minetest.net/viewtopic.php?t=19365) at the Minetest forums.
|
||||||
|
|
||||||
**Dependencies**: xcompat, display\_lib, font\_lib
|
**Dependancies**: default, display\_lib, font\_lib
|
||||||
|
|
||||||
**License**: Code under LGPL, Textures and models under CC-BY-SA
|
**License**: Code under LGPL, Textures and models under CC-BY-SA
|
||||||
|
|
||||||
|
|||||||
10
signs_api/copyright.txt
Normal file
@@ -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)
|
||||||
|
|
||||||
@@ -22,14 +22,13 @@ signs_api = {}
|
|||||||
signs_api.name = minetest.get_current_modname()
|
signs_api.name = minetest.get_current_modname()
|
||||||
signs_api.path = minetest.get_modpath(signs_api.name)
|
signs_api.path = minetest.get_modpath(signs_api.name)
|
||||||
|
|
||||||
-- Translation support
|
-- Load support for intllib.
|
||||||
local S = minetest.get_translator(signs_api.name)
|
local S, NS = dofile(signs_api.path.."/intllib.lua")
|
||||||
local FS = function(...) return minetest.formspec_escape(S(...)) end
|
signs_api.intllib = S
|
||||||
|
local F = function(...) return minetest.formspec_escape(S(...)) end
|
||||||
|
|
||||||
function signs_api.set_display_text(pos, text, font)
|
function signs_api.set_display_text(pos, text, font)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
-- Fix pasting from Windows: CR instead of LF
|
|
||||||
text = string.gsub(text, "\r\n?", "\n")
|
|
||||||
meta:set_string("display_text", text)
|
meta:set_string("display_text", text)
|
||||||
if text and text ~= "" then
|
if text and text ~= "" then
|
||||||
meta:set_string("infotext", "\""..text.."\"")
|
meta:set_string("infotext", "\""..text.."\"")
|
||||||
@@ -49,27 +48,27 @@ function signs_api.set_formspec(pos)
|
|||||||
and ndef.display_entities["signs:display_text"] then
|
and ndef.display_entities["signs:display_text"] then
|
||||||
local maxlines = ndef.display_entities["signs:display_text"].maxlines
|
local maxlines = ndef.display_entities["signs:display_text"].maxlines
|
||||||
local fs, y
|
local fs, y
|
||||||
local display_text = minetest.formspec_escape(meta:get_string("display_text"))
|
|
||||||
|
|
||||||
if maxlines == 1 then
|
if maxlines == 1 then
|
||||||
fs = "field[0.5,0.7;5.5,1;display_text;"..FS("Text")..
|
fs = "field[0.5,0.7;5.5,1;display_text;"..F("Text")..
|
||||||
";" .. display_text .. "]"
|
";${display_text}]"
|
||||||
y = 1.2
|
y = 1.2
|
||||||
else
|
else
|
||||||
local extralabel = ""
|
local extralabel = ""
|
||||||
if maxlines then
|
if maxlines then
|
||||||
extralabel = FS(" (first @1 lines only)", maxlines)
|
extralabel = F(" (first %s lines only)"):format(maxlines)
|
||||||
end
|
end
|
||||||
|
|
||||||
fs = "textarea[0.5,0.7;5.5,2;display_text;"..FS("Text")..""..
|
fs = "textarea[0.5,0.7;5.5,2;display_text;"..F("Text")..""..
|
||||||
extralabel..";" .. display_text .. "]"
|
extralabel..";${display_text}]"
|
||||||
y = 2.4
|
y = 2.4
|
||||||
end
|
end
|
||||||
|
|
||||||
fs = fs.."button[1,"..y..";2,1;font;"..FS("Font").."]"
|
fs = fs.."button[1,"..y..";2,1;font;"..F("Font").."]"
|
||||||
fs = fs.."button_exit[3,"..y..";2,1;ok;"..FS("Write").."]"
|
fs = fs.."button_exit[3,"..y..";2,1;ok;"..F("Write").."]"
|
||||||
y = y + 0.8
|
y = y + 0.8
|
||||||
fs = "size[6,"..y.."]"..fs
|
fs = "size[6,"..y.."]"..default.gui_bg..
|
||||||
|
default.gui_bg_img..default.gui_slots..fs
|
||||||
|
|
||||||
meta:set_string("formspec", fs)
|
meta:set_string("formspec", fs)
|
||||||
end
|
end
|
||||||
@@ -79,11 +78,9 @@ function signs_api.on_receive_fields(pos, formname, fields, player)
|
|||||||
if not minetest.is_protected(pos, player:get_player_name()) then
|
if not minetest.is_protected(pos, player:get_player_name()) then
|
||||||
if fields and (fields.ok or fields.key_enter) then
|
if fields and (fields.ok or fields.key_enter) then
|
||||||
signs_api.set_display_text(pos, fields.display_text)
|
signs_api.set_display_text(pos, fields.display_text)
|
||||||
signs_api.set_formspec(pos)
|
|
||||||
end
|
end
|
||||||
if fields and (fields.font) then
|
if fields and (fields.font) then
|
||||||
signs_api.set_display_text(pos, fields.display_text)
|
signs_api.set_display_text(pos, fields.display_text)
|
||||||
signs_api.set_formspec(pos)
|
|
||||||
font_api.show_font_list(player, pos)
|
font_api.show_font_list(player, pos)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -94,6 +91,7 @@ end
|
|||||||
function signs_api.on_place_direction(itemstack, placer, pointed_thing)
|
function signs_api.on_place_direction(itemstack, placer, pointed_thing)
|
||||||
local name = itemstack:get_name()
|
local name = itemstack:get_name()
|
||||||
local ndef = minetest.registered_nodes[name]
|
local ndef = minetest.registered_nodes[name]
|
||||||
|
local restriction = display_api.is_rotation_restricted()
|
||||||
|
|
||||||
local bdir = {
|
local bdir = {
|
||||||
x = pointed_thing.under.x - pointed_thing.above.x,
|
x = pointed_thing.under.x - pointed_thing.above.x,
|
||||||
@@ -104,25 +102,33 @@ function signs_api.on_place_direction(itemstack, placer, pointed_thing)
|
|||||||
|
|
||||||
local ndir, test
|
local ndir, test
|
||||||
|
|
||||||
if ndef and (ndef.paramtype2 == "facedir" or ndef.paramtype2 == "colorfacedir") then
|
if ndef.paramtype2 == "facedir" then
|
||||||
-- Wall pointed
|
-- If legacy mode, only accept upright nodes
|
||||||
ndir = minetest.dir_to_facedir(bdir, true)
|
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 }
|
test = { [0]=-pdir.x, pdir.z, pdir.x, -pdir.z, -pdir.x, [8]=pdir.x }
|
||||||
end
|
end
|
||||||
|
|
||||||
if ndef and ndef.paramtype2 == "wallmounted" then
|
if ndef.paramtype2 == "wallmounted" then
|
||||||
ndir = minetest.dir_to_wallmounted(bdir)
|
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}
|
test = { [0]=-pdir.x, -pdir.x, pdir.z, -pdir.z, -pdir.x, pdir.x}
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Only for direction signs
|
-- Only for direction signs
|
||||||
-- TODO:Maybe improve ground and ceiling placement in every directions
|
-- TODO:Maybe improve ground and ceiling placement in every directions
|
||||||
if ndef and ndef.signs_other_dir then
|
if ndef.signs_other_dir then
|
||||||
if not test[ndir] then -- https://github.com/pyrollo/display_modpack/issues/48
|
if test[ndir] > 0 then
|
||||||
return itemstack
|
|
||||||
elseif test[ndir] > 0 then
|
|
||||||
itemstack:set_name(ndef.signs_other_dir)
|
itemstack:set_name(ndef.signs_other_dir)
|
||||||
end
|
end
|
||||||
itemstack = minetest.item_place(itemstack, placer, pointed_thing, ndir)
|
itemstack = minetest.item_place(itemstack, placer, pointed_thing, ndir)
|
||||||
@@ -135,12 +141,13 @@ function signs_api.on_place_direction(itemstack, placer, pointed_thing)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Handles screwdriver rotation
|
-- Handles screwdriver rotation
|
||||||
|
-- (see "if" block below for rotation restriction mode).
|
||||||
signs_api.on_rotate = function(pos, node, player, mode, new_param2)
|
signs_api.on_rotate = function(pos, node, player, mode, new_param2)
|
||||||
-- If rotation mode is 1 and sign is directional, swap direction between
|
-- If rotation mode is 1 and sign is directional, swap direction between
|
||||||
-- each rotation.
|
-- each rotation.
|
||||||
if mode == 1 then
|
if mode == 1 then
|
||||||
local ndef = minetest.registered_nodes[node.name]
|
local ndef = minetest.registered_nodes[node.name]
|
||||||
if ndef and ndef.signs_other_dir then
|
if ndef.signs_other_dir then
|
||||||
-- Switch direction
|
-- Switch direction
|
||||||
node = {name = ndef.signs_other_dir,
|
node = {name = ndef.signs_other_dir,
|
||||||
param1 = node.param1, param2 = node.param2}
|
param1 = node.param1, param2 = node.param2}
|
||||||
@@ -158,6 +165,25 @@ signs_api.on_rotate = function(pos, node, player, mode, new_param2)
|
|||||||
return display_api.on_rotate(pos, node, player, mode, new_param2)
|
return display_api.on_rotate(pos, node, player, mode, new_param2)
|
||||||
end
|
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)
|
function signs_api.register_sign(mod, name, model)
|
||||||
-- Default fields
|
-- Default fields
|
||||||
local fields = {
|
local fields = {
|
||||||
@@ -170,9 +196,8 @@ function signs_api.register_sign(mod, name, model)
|
|||||||
fixed = {-model.width/2, -model.height/2, 0.5,
|
fixed = {-model.width/2, -model.height/2, 0.5,
|
||||||
model.width/2, model.height/2, 0.5 - model.depth},
|
model.width/2, model.height/2, 0.5 - model.depth},
|
||||||
},
|
},
|
||||||
groups = {choppy=2, dig_immediate=2, not_blocking_trains=1, display_api=1,signs_api_formspec_lbm=1},
|
groups = {choppy=2, dig_immediate=2, not_blocking_trains=1, display_api=1},
|
||||||
is_ground_content = false,
|
sounds = default.node_sound_defaults(),
|
||||||
sounds = xcompat.sounds.node_sound_default(),
|
|
||||||
display_entities = {
|
display_entities = {
|
||||||
["signs:display_text"] = {
|
["signs:display_text"] = {
|
||||||
on_display_update = font_api.on_display_update,
|
on_display_update = font_api.on_display_update,
|
||||||
@@ -187,13 +212,12 @@ function signs_api.register_sign(mod, name, model)
|
|||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local ndef = minetest.registered_nodes[minetest.get_node(pos).name]
|
local ndef = minetest.registered_nodes[minetest.get_node(pos).name]
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("font", ndef and ndef.display_entities.font_name or
|
meta:set_string("font", ndef.display_entities.font_name or
|
||||||
font_api.get_default_font_name())
|
font_api.get_default_font_name())
|
||||||
signs_api.set_formspec(pos)
|
signs_api.set_formspec(pos)
|
||||||
display_api.on_construct(pos)
|
display_api.on_construct(pos)
|
||||||
end,
|
end,
|
||||||
on_destruct = display_api.on_destruct,
|
on_destruct = display_api.on_destruct,
|
||||||
on_blast = display_api.on_blast,
|
|
||||||
on_rotate = signs_api.on_rotate,
|
on_rotate = signs_api.on_rotate,
|
||||||
on_receive_fields = signs_api.on_receive_fields,
|
on_receive_fields = signs_api.on_receive_fields,
|
||||||
on_punch = function(pos, node, player, pointed_thing)
|
on_punch = function(pos, node, player, pointed_thing)
|
||||||
@@ -226,13 +250,4 @@ end
|
|||||||
-- Text entity for all signs
|
-- Text entity for all signs
|
||||||
display_api.register_display_entity("signs:display_text")
|
display_api.register_display_entity("signs:display_text")
|
||||||
|
|
||||||
-- Update sign formspecs
|
minetest.log("action", "[signs_api] loaded.")
|
||||||
minetest.register_lbm({
|
|
||||||
label = "Update signs_api formspecs",
|
|
||||||
name = "signs_api:update_formspecs",
|
|
||||||
run_at_every_load = false,
|
|
||||||
nodenames = {"group:signs_api_formspec_lbm"},
|
|
||||||
action = function(pos)
|
|
||||||
signs_api.set_formspec(pos)
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|||||||
45
signs_api/intllib.lua
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
|
||||||
|
-- Fallback functions for when `intllib` is not installed.
|
||||||
|
-- Code released under Unlicense <http://unlicense.org>.
|
||||||
|
|
||||||
|
-- Get the latest version of this file at:
|
||||||
|
-- https://raw.githubusercontent.com/minetest-mods/intllib/master/lib/intllib.lua
|
||||||
|
|
||||||
|
local function format(str, ...)
|
||||||
|
local args = { ... }
|
||||||
|
local function repl(escape, open, num, close)
|
||||||
|
if escape == "" then
|
||||||
|
local replacement = tostring(args[tonumber(num)])
|
||||||
|
if open == "" then
|
||||||
|
replacement = replacement..close
|
||||||
|
end
|
||||||
|
return replacement
|
||||||
|
else
|
||||||
|
return "@"..open..num..close
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return (str:gsub("(@?)@(%(?)(%d+)(%)?)", repl))
|
||||||
|
end
|
||||||
|
|
||||||
|
local gettext, ngettext
|
||||||
|
if minetest.get_modpath("intllib") then
|
||||||
|
if intllib.make_gettext_pair then
|
||||||
|
-- New method using gettext.
|
||||||
|
gettext, ngettext = intllib.make_gettext_pair()
|
||||||
|
else
|
||||||
|
-- Old method using text files.
|
||||||
|
gettext = intllib.Getter()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Fill in missing functions.
|
||||||
|
|
||||||
|
gettext = gettext or function(msgid, ...)
|
||||||
|
return format(msgid, ...)
|
||||||
|
end
|
||||||
|
|
||||||
|
ngettext = ngettext or function(msgid, msgid_plural, n, ...)
|
||||||
|
return format(n==1 and msgid or msgid_plural, ...)
|
||||||
|
end
|
||||||
|
|
||||||
|
return gettext, ngettext
|
||||||