forked from mtcontrib/homedecor_modpack
add logging support to signslib and re-add intllib support
This commit is contained in:
@ -1,11 +1,20 @@
|
||||
-- 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
|
||||
local chars_file = io.open(minetest.get_modpath("homedecor").."/characters", "r")
|
||||
local charmap = {}
|
||||
local max_chars = 16
|
||||
if not chars_file then
|
||||
print("[signs] E: character map file not found")
|
||||
print("[signs] "..S("E: character map file not found"))
|
||||
else
|
||||
while true do
|
||||
local char = chars_file:read("*l")
|
||||
@ -173,6 +182,13 @@ minetest.register_node(":default:sign_wall", {
|
||||
homedecor_destruct_sign(pos)
|
||||
end,
|
||||
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)
|
||||
end,
|
||||
on_punch = function(pos, node, puncher)
|
||||
@ -201,6 +217,13 @@ minetest.register_node(":signs:sign_yard", {
|
||||
homedecor_destruct_sign(pos)
|
||||
end,
|
||||
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)
|
||||
end,
|
||||
on_punch = function(pos, node, puncher)
|
||||
@ -402,6 +425,13 @@ function homedecor_register_fence_with_sign(fencename, fencewithsignname)
|
||||
homedecor_destruct_sign(pos)
|
||||
end
|
||||
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)
|
||||
end
|
||||
def_sign.on_punch = function(pos, node, puncher, ...)
|
||||
@ -419,5 +449,5 @@ function homedecor_register_fence_with_sign(fencename, fencewithsignname)
|
||||
end
|
||||
|
||||
if minetest.setting_get("log_mods") then
|
||||
minetest.log("action", "signs loaded")
|
||||
minetest.log("action", S("signs loaded"))
|
||||
end
|
||||
|
Reference in New Issue
Block a user