1
0
mirror of https://github.com/mt-mods/homedecor_modpack.git synced 2024-12-23 08:20:21 +01:00

add logging support to signslib and re-add intllib support

This commit is contained in:
Diego Martínez 2013-03-22 14:49:57 -03:00
parent d4f7de4640
commit 1ce512a3c8
4 changed files with 38 additions and 2 deletions

View File

@ -176,3 +176,5 @@ Small CRT Television = Pequeña Televisión CRT
E: character map file not found = E: archivo de mapa de caracteres no encontrado E: character map file not found = E: archivo de mapa de caracteres no encontrado
## 1: Full String, 2: pos in string, 3: current char at pos ## 1: Full String, 2: pos in string, 3: current char at pos
W: unknown symbol in '%s' at %d (probably %s) = A: símbolo desconocido en '%s' posición %d (probablemente %s) W: unknown symbol in '%s' at %d (probably %s) = A: símbolo desconocido en '%s' posición %d (probablemente %s)
%s wrote "%s" to sign at %s = %s ha escrito "%s" en el letrero en %s
signs loaded = letreros cargados

View File

@ -176,3 +176,5 @@ Small CRT Television = Petite télévision à tube cathodique
E: character map file not found = E: fichier de table de caractère non trouvé E: character map file not found = E: fichier de table de caractère non trouvé
## 1: Full String, 2: pos in string, 3: current char at pos ## 1: Full String, 2: pos in string, 3: current char at pos
W: unknown symbol in '%s' at %d (probably %s) = A: symbole inconnu dans '%s' dans %d (probablement %s) W: unknown symbol in '%s' at %d (probably %s) = A: symbole inconnu dans '%s' dans %d (probablement %s)
%s wrote "%s" to sign at %s =
signs loaded =

View File

@ -180,3 +180,5 @@ Small CRT Television =
E: character map file not found = E: character map file not found =
## 1: Full String, 2: pos in string, 3: current char at pos ## 1: Full String, 2: pos in string, 3: current char at pos
W: unknown symbol in '%s' at %d (probably %s) = W: unknown symbol in '%s' at %d (probably %s) =
%s wrote "%s" to sign at %s =
signs loaded =

View File

@ -1,11 +1,20 @@
-- Font: 04.jp.org -- Font: 04.jp.org
-- Boilerplate to support localized strings if intllib mod is installed.
local S
if (minetest.get_modpath("intllib")) then
dofile(minetest.get_modpath("intllib").."/intllib.lua")
S = intllib.Getter(minetest.get_current_modname())
else
S = function ( s ) return s end
end
-- load characters map -- load characters map
local chars_file = io.open(minetest.get_modpath("homedecor").."/characters", "r") local chars_file = io.open(minetest.get_modpath("homedecor").."/characters", "r")
local charmap = {} local charmap = {}
local max_chars = 16 local max_chars = 16
if not chars_file then if not chars_file then
print("[signs] E: character map file not found") print("[signs] "..S("E: character map file not found"))
else else
while true do while true do
local char = chars_file:read("*l") local char = chars_file:read("*l")
@ -173,6 +182,13 @@ minetest.register_node(":default:sign_wall", {
homedecor_destruct_sign(pos) homedecor_destruct_sign(pos)
end, end,
on_receive_fields = function(pos, formname, fields, sender) on_receive_fields = function(pos, formname, fields, sender)
if fields then
print(S("%s wrote \"%s\" to sign at %s"):format(
(sender:get_player_name() or ""),
fields.text,
minetest.pos_to_string(pos)
))
end
homedecor_update_sign(pos, fields) homedecor_update_sign(pos, fields)
end, end,
on_punch = function(pos, node, puncher) on_punch = function(pos, node, puncher)
@ -201,6 +217,13 @@ minetest.register_node(":signs:sign_yard", {
homedecor_destruct_sign(pos) homedecor_destruct_sign(pos)
end, end,
on_receive_fields = function(pos, formname, fields, sender) on_receive_fields = function(pos, formname, fields, sender)
if fields then
print(S("%s wrote \"%s\" to sign at %s"):format(
(sender:get_player_name() or ""),
fields.text,
minetest.pos_to_string(pos)
))
end
homedecor_update_sign(pos, fields) homedecor_update_sign(pos, fields)
end, end,
on_punch = function(pos, node, puncher) on_punch = function(pos, node, puncher)
@ -402,6 +425,13 @@ function homedecor_register_fence_with_sign(fencename, fencewithsignname)
homedecor_destruct_sign(pos) homedecor_destruct_sign(pos)
end end
def_sign.on_receive_fields = function(pos, formname, fields, sender, ...) def_sign.on_receive_fields = function(pos, formname, fields, sender, ...)
if fields then
print(S("%s wrote \"%s\" to sign at %s"):format(
(sender:get_player_name() or ""),
fields.text,
minetest.pos_to_string(pos)
))
end
homedecor_update_sign(pos, fields) homedecor_update_sign(pos, fields)
end end
def_sign.on_punch = function(pos, node, puncher, ...) def_sign.on_punch = function(pos, node, puncher, ...)
@ -419,5 +449,5 @@ function homedecor_register_fence_with_sign(fencename, fencewithsignname)
end end
if minetest.setting_get("log_mods") then if minetest.setting_get("log_mods") then
minetest.log("action", "signs loaded") minetest.log("action", S("signs loaded"))
end end