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

Merge pull request #10 from kaeza/master

Some Fixes
This commit is contained in:
VanessaE 2013-03-22 14:31:18 -07:00
commit cc97a0ebd9
4 changed files with 44 additions and 7 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")
@ -144,11 +153,6 @@ minetest.register_node(":default:sign_wall", {
itemstack:take_item() itemstack:take_item()
return itemstack return itemstack
elseif wdir == 1 then elseif wdir == 1 then
local def = minetest.registered_nodes[minetest.env:get_node(pointed_thing.above).name]
if homedecor_node_is_owned(pointed_thing.above, placer)
or (not def.buildable_to) then
return
end
minetest.env:add_node(above, {name = "signs:sign_yard", param2 = fdir}) minetest.env:add_node(above, {name = "signs:sign_yard", param2 = fdir})
sign_info = signs_yard[fdir + 1] sign_info = signs_yard[fdir + 1]
else else
@ -156,6 +160,12 @@ minetest.register_node(":default:sign_wall", {
sign_info = signs[fdir + 1] sign_info = signs[fdir + 1]
end end
local def = minetest.registered_nodes[minetest.env:get_node(pointed_thing.above).name]
if homedecor_node_is_owned(pointed_thing.above, placer)
or (not def.buildable_to) then
return
end
local text = minetest.env:add_entity({x = above.x + sign_info.delta.x, local text = minetest.env:add_entity({x = above.x + sign_info.delta.x,
y = above.y + sign_info.delta.y, y = above.y + sign_info.delta.y,
z = above.z + sign_info.delta.z}, "signs:text") z = above.z + sign_info.delta.z}, "signs:text")
@ -172,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)
@ -200,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)
@ -401,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, ...)
@ -418,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