1
0
mirror of https://github.com/pyrollo/display_modpack.git synced 2025-10-15 16:45:35 +02:00

Add luacheck, update translations, replace ABMs, bug fixes (#1)

* luacheck, mt 5 translation, german translation, maintenance

* fix luacheck warnings

* Fix digital clock nodebox and texture

* Fix luacheck usage

* Add comment why fonts are not split into several lines
This commit is contained in:
Niklp
2023-07-24 09:59:26 +02:00
committed by GitHub
parent e0e0305836
commit 1440f35fa6
91 changed files with 415 additions and 1465 deletions

View File

@@ -1,5 +1,5 @@
--[[
ontime_clocks mod for Minetest - Clock nodes displaying ingame time
ontime_clocks mod for Minetest - Clock nodes displaying ingame time
(c) Pierre-Yves Rollo
This file is part of ontime_clocks.
@@ -34,7 +34,7 @@ function ontime_clocks.get_m12()
end
function ontime_clocks.get_digital_properties(color_off, color_on, hour, minute)
return
return
{
textures={"ontime_clocks_digital_background.png^[colorize:"..color_off
.."^([combine:21x7"
@@ -51,7 +51,7 @@ end
function ontime_clocks.get_needles_properties(color, size, hour, minute)
return
{
textures={"[combine:"..size.."x"..size
textures={"[combine:"..size.."x"..size
..":0,"..(-size*hour).."=ontime_clocks_needle_h"..size..".png"
..":0,"..(-size*minute).."=ontime_clocks_needle_m"..size..".png"
.."^[colorize:"..color},

View File

@@ -1,5 +1,5 @@
--[[
ontime_clocks mod for Minetest - Clock nodes displaying ingame time
ontime_clocks mod for Minetest - Clock nodes displaying ingame time
(c) Pierre-Yves Rollo
This file is part of ontime_clocks.

View File

@@ -1,5 +1,5 @@
--[[
ontime_clocks mod for Minetest - Clock nodes displaying ingame time
ontime_clocks mod for Minetest - Clock nodes displaying ingame time
(c) Pierre-Yves Rollo
This file is part of ontime_clocks.
@@ -22,9 +22,8 @@ ontime_clocks = {}
ontime_clocks.name = minetest.get_current_modname()
ontime_clocks.path = minetest.get_modpath(ontime_clocks.name)
-- Load support for intllib.
local S, NS = dofile(ontime_clocks.path.."/intllib.lua")
ontime_clocks.intllib = S
-- Translation support
ontime_clocks.S = minetest.get_translator(ontime_clocks.name)
dofile(ontime_clocks.path.."/common.lua")
dofile(ontime_clocks.path.."/nodes.lua")

View File

@@ -1,45 +0,0 @@
-- 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

View File

@@ -1,43 +0,0 @@
# 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"

View File

@@ -1,42 +0,0 @@
# 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"

View File

@@ -0,0 +1,7 @@
# 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

View File

@@ -0,0 +1,7 @@
# 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

View File

@@ -0,0 +1,7 @@
# 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

View File

@@ -1,42 +0,0 @@
# 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 ""

View File

@@ -0,0 +1,7 @@
# textdomain: ontime_clocks
Green digital clock=
Red digital clock=
White clock=
Frameless clock=
Frameless gold clock=
Frameless white clock=

View File

@@ -2,4 +2,3 @@ name = ontime_clocks
title = Ontime Clocks
description = Clocks displaing real ingame time
depends = default,dye,display_api
optional_depends = intllib

View File

@@ -18,7 +18,18 @@
along with ontime_clocks. If not, see <http://www.gnu.org/licenses/>.
--]]
local S = ontime_clocks.intllib
local S = ontime_clocks.S
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
minetest.register_node("ontime_clocks:green_digital", {
@@ -30,9 +41,9 @@ minetest.register_node("ontime_clocks:green_digital", {
drawtype = "nodebox",
node_box = {
type = "wallmounted",
wall_side = { -0.5, -3/16, -7/16, -13/32, 7/32, 7/16 },
wall_top = { -7/16, 0.5, -7/32, 7/16, 13/32, 3/16 },
wall_bottom = { -7/16, -0.5, -3/16, 7/16, -13/32, 7/32 },
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}
},
tiles = {"ontime_clocks_digital.png"},
groups = {oddly_breakable_by_hand=1, not_blocking_trains=1, display_api=1},
@@ -46,17 +57,12 @@ minetest.register_node("ontime_clocks:green_digital", {
end },
},
on_place = display_api.on_place,
on_construct = display_api.on_construct,
on_construct = clock_on_construct,
on_destruct = display_api.on_destruct,
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
minetest.register_node("ontime_clocks:red_digital", {
@@ -68,9 +74,9 @@ minetest.register_node("ontime_clocks:red_digital", {
drawtype = "nodebox",
node_box = {
type = "wallmounted",
wall_side = { -0.5, -3/16, -7/16, -13/32, 7/32, 7/16 },
wall_bottom = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 },
wall_top = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }
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}
},
tiles = {"ontime_clocks_digital.png"},
groups = {oddly_breakable_by_hand=1, not_blocking_trains=1, display_api=1},
@@ -84,16 +90,10 @@ minetest.register_node("ontime_clocks:red_digital", {
end },
},
on_place = display_api.on_place,
on_construct = display_api.on_construct,
on_construct = clock_on_construct,
on_destruct = display_api.on_destruct,
on_rotate = display_api.on_rotate,
})
minetest.register_abm({
nodenames = {"ontime_clocks:red_digital"},
interval = 5,
chance = 1,
action = display_api.update_entities,
on_timer = clock_on_timer,
})
@@ -122,17 +122,12 @@ minetest.register_node("ontime_clocks:white", {
end },
},
on_place = display_api.on_place,
on_construct = display_api.on_construct,
on_construct = clock_on_construct,
on_destruct = display_api.on_destruct,
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", {
description = S("Frameless clock"),
@@ -159,17 +154,12 @@ minetest.register_node("ontime_clocks:frameless_black", {
end },
},
on_place = display_api.on_place,
on_construct = display_api.on_construct,
on_construct = clock_on_construct,
on_destruct = display_api.on_destruct,
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", {
description = S("Frameless gold clock"),
@@ -196,17 +186,12 @@ minetest.register_node("ontime_clocks:frameless_gold", {
end },
},
on_place = display_api.on_place,
on_construct = display_api.on_construct,
on_construct = clock_on_construct,
on_destruct = display_api.on_destruct,
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", {
description = S("Frameless white clock"),
@@ -233,14 +218,20 @@ minetest.register_node("ontime_clocks:frameless_white", {
end },
},
on_place = display_api.on_place,
on_construct = display_api.on_construct,
on_construct = clock_on_construct,
on_destruct = display_api.on_destruct,
on_rotate = display_api.on_rotate,
on_timer = clock_on_timer,
})
minetest.register_abm({
nodenames = {"ontime_clocks:frameless_white"},
interval = 5,
chance = 1,
action = display_api.update_entities,
minetest.register_lbm({
name = "ontime_clocks:nodetimer_init",
nodenames = {"ontime_clocks:green_digital", "ontime_clocks:red_digital", "ontime_clocks:white",
"ontime_clocks:frameless_black", "ontime_clocks:frameless_gold", "ontime_clocks:frameless_white"},
run_at_every_load = false,
action = function(pos)
local timer = minetest.get_node_timer(pos)
timer:start(5)
end
})

Binary file not shown.

Before

Width:  |  Height:  |  Size: 175 B

After

Width:  |  Height:  |  Size: 164 B

View File

@@ -1,25 +0,0 @@
#! /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