summaryrefslogtreecommitdiff
path: root/anvil
diff options
context:
space:
mode:
Diffstat (limited to 'anvil')
-rw-r--r--anvil/README.md (renamed from anvil/README.txt)0
-rw-r--r--anvil/init.lua33
-rw-r--r--anvil/locale/es.po65
-rw-r--r--anvil/locale/fr.po70
-rw-r--r--anvil/locale/it.po68
5 files changed, 223 insertions, 13 deletions
diff --git a/anvil/README.txt b/anvil/README.md
index 227321f..227321f 100644
--- a/anvil/README.txt
+++ b/anvil/README.md
diff --git a/anvil/init.lua b/anvil/init.lua
index 1567894..e4bc8bd 100644
--- a/anvil/init.lua
+++ b/anvil/init.lua
@@ -5,14 +5,18 @@
-- * the hammer gets dammaged a bit at each repair step
---------------------------------------------------------------------------------------
+anvil = {
+ setting = {
+ item_displacement = 7/16,
+ }
+}
+
minetest.register_alias("castle:anvil", "anvil:anvil")
-- internationalization boilerplate
local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua")
-local item_displacement = 7/16
-
-- the hammer for the anvil
minetest.register_tool("anvil:hammer", {
description = S("Steel blacksmithing hammer"),
@@ -69,7 +73,7 @@ minetest.register_entity("anvil:item",{
})
local remove_item = function(pos, node)
- local objs = minetest.env:get_objects_inside_radius({x = pos.x, y = pos.y + item_displacement, z = pos.z}, .5)
+ local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y + anvil.setting.item_displacement, z = pos.z}, .5)
if objs then
for _, obj in ipairs(objs) do
if obj and obj:get_luaentity() and obj:get_luaentity().name == "anvil:item" then
@@ -80,13 +84,13 @@ local remove_item = function(pos, node)
end
local update_item = function(pos, node)
- local meta = minetest.env:get_meta(pos)
+ local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
if not inv:is_empty("input") then
- pos.y = pos.y + item_displacement
+ pos.y = pos.y + anvil.setting.item_displacement
tmp.nodename = node.name
tmp.texture = inv:get_stack("input", 1):get_name()
- local e = minetest.env:add_entity(pos,"anvil:item")
+ local e = minetest.add_entity(pos,"anvil:item")
local yaw = math.pi*2 - node.param2 * math.pi/2
e:setyaw(yaw)
end
@@ -157,6 +161,7 @@ minetest.register_node("anvil:anvil", {
end
if (listname=='input'
and(stack:get_wear() == 0
+ or minetest.get_item_group(stack:get_name(), "not_repaired_by_anvil") ~= 0
or stack:get_name() == "technic:water_can"
or stack:get_name() == "technic:lava_can" )) then
@@ -179,12 +184,13 @@ minetest.register_node("anvil:anvil", {
on_rightclick = function(pos, node, clicker, itemstack)
if itemstack:get_count() == 0 then
- local meta = minetest.env:get_meta(pos)
+ local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
if not inv:is_empty("input") then
local return_stack = inv:get_stack("input", 1)
inv:set_stack("input", 1, nil)
- clicker:get_inventory():add_item("main", return_stack)
+ local wield_index = clicker:get_wield_index()
+ clicker:get_inventory():set_stack("main", wield_index, return_stack)
remove_item(pos, node)
return return_stack
end
@@ -192,7 +198,7 @@ minetest.register_node("anvil:anvil", {
local this_def = minetest.registered_nodes[node.name]
if this_def.allow_metadata_inventory_put(pos, "input", 1, itemstack:peek_item(), clicker) > 0 then
local s = itemstack:take_item()
- local meta = minetest.env:get_meta(pos)
+ local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
inv:add_item("input", s)
update_item(pos,node)
@@ -213,7 +219,8 @@ minetest.register_node("anvil:anvil", {
if not inv:is_empty("input") then
local return_stack = inv:get_stack("input", 1)
inv:set_stack("input", 1, nil)
- puncher:get_inventory():add_item("main", return_stack)
+ local wield_index = puncher:get_wield_index()
+ puncher:get_inventory():set_stack("main", wield_index, return_stack)
remove_item(pos, node)
end
end
@@ -280,7 +287,7 @@ minetest.register_node("anvil:anvil", {
minetest.chat_send_player( puncher:get_player_name(), S('Your @1 has been repaired successfully.', tool_desc))
return
else
- pos.y = pos.y + item_displacement
+ pos.y = pos.y + anvil.setting.item_displacement
minetest.sound_play({name="anvil_clang"}, {pos=pos})
minetest.add_particlespawner({
amount = 10,
@@ -318,7 +325,7 @@ minetest.register_lbm({
nodenames = { "anvil:anvil" },
run_at_every_load = true,
action = function(pos, node, active_object_count, active_object_count_wider)
- local test_pos = {x=pos.x, y=pos.y + item_displacement, z=pos.z}
+ local test_pos = {x=pos.x, y=pos.y + anvil.setting.item_displacement, z=pos.z}
if #minetest.get_objects_inside_radius(test_pos, 0.5) > 0 then return end
update_item(pos, node)
end
@@ -361,6 +368,6 @@ minetest.register_craft({
recipe = {
{"default:steel_ingot","default:steel_ingot","default:steel_ingot"},
{"default:steel_ingot","default:steel_ingot","default:steel_ingot"},
- {'', "group:stick", '' } }
+ {"group:stick", '', ''} },
})
diff --git a/anvil/locale/es.po b/anvil/locale/es.po
new file mode 100644
index 0000000..167dbb4
--- /dev/null
+++ b/anvil/locale/es.po
@@ -0,0 +1,65 @@
+# 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-03-07 22:17-0700\n"
+"PO-Revision-Date: 2017-04-20 19:05 -0500\n"
+"Last-Translator: Carlos Barraza <carlosbarrazaes@gmail.com>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: Español\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: init.lua:19
+msgid "Steel blacksmithing hammer"
+msgstr "Martillo de acero para la herrería"
+
+#: init.lua:20
+msgid "A tool for repairing other tools at a blacksmith's anvil."
+msgstr "Es una herramienta para reparar otras herramientas en el yunque del herrero"
+
+#: init.lua:21
+msgid ""
+"Use this hammer to strike blows upon an anvil bearing a damaged tool and you "
+"can repair it. It can also be used for smashing stone, but it is not well "
+"suited to this task."
+msgstr ""
+"Use este martillo para dar golpes sobre el yunque donde puso la herramienta dañada"
+"Tambien puede ser usado para romper piedra pero no es muy adecuado para esa tarea."
+
+#: init.lua:98
+msgid "Anvil"
+msgstr "Yunque"
+
+#: init.lua:99
+msgid ""
+"A tool for repairing other tools in conjunction with a blacksmith's hammer."
+msgstr "Es una herramienta para reparar de herramientas dañadas en conjunto con el martillo del herrero."
+
+#: init.lua:100
+msgid ""
+"Right-click on this anvil with a damaged tool to place the damaged tool upon "
+"it. You can then repair the damaged tool by striking it with a blacksmith's "
+"hammer. Repeated blows may be necessary to fully repair a badly worn tool. "
+"To retrieve the tool either punch or right-click the anvil with an empty "
+"hand."
+msgstr ""
+"Haga clic derecho sobre este yunque con una herramienta dañada"
+"Puede reparar la herramienta dañada golpeándola con el martillo del herrero"
+"Para reparar completamente una herramienta puede dar varios golpes"
+"Para sacar la herramienta, golpeela con la mano vacia o tambien con un clic derecho"
+
+#: init.lua:155
+msgid "This anvil is for damaged tools only."
+msgstr "Este yunque es sólo para herramientas dañadas"
+
+#: init.lua:267
+msgid "Your @1 has been repaired successfully."
+msgstr "Su @1 ha sido reparado correctamente."
diff --git a/anvil/locale/fr.po b/anvil/locale/fr.po
new file mode 100644
index 0000000..66cc21d
--- /dev/null
+++ b/anvil/locale/fr.po
@@ -0,0 +1,70 @@
+# 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-06-26 12:18+0200\n"
+"PO-Revision-Date: 2017-06-26 12:22+0200\n"
+"Last-Translator: \n"
+"Language-Team: \n"
+"Language: fr_FR\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: Poedit 2.0.2\n"
+"Plural-Forms: nplurals=2; plural=(n > 1);\n"
+
+#: init.lua:19
+msgid "Steel blacksmithing hammer"
+msgstr "Marteau de forgeron en acier"
+
+#: init.lua:20
+msgid "A tool for repairing other tools at a blacksmith's anvil."
+msgstr "Un outil pour réparer les autres outils avec une enclume de forgeron."
+
+#: init.lua:21
+msgid ""
+"Use this hammer to strike blows upon an anvil bearing a damaged tool and you "
+"can repair it. It can also be used for smashing stone, but it is not well "
+"suited to this task."
+msgstr ""
+"Utilisez ce marteau pour frapper une enclume contenant un outil endommagé, "
+"ainsi vous pourrez le réparer. Il peut être aussi utilisé pour casser de la "
+"pierre, mais il n'est pas adapté à cette tâche."
+
+#: init.lua:98
+msgid "Anvil"
+msgstr "Enclume"
+
+#: init.lua:99
+msgid ""
+"A tool for repairing other tools in conjunction with a blacksmith's hammer."
+msgstr ""
+"Un outil pour réparer les autres outils à utiliser avec un marteau de "
+"forgeron."
+
+#: init.lua:100
+msgid ""
+"Right-click on this anvil with a damaged tool to place the damaged tool upon "
+"it. You can then repair the damaged tool by striking it with a blacksmith's "
+"hammer. Repeated blows may be necessary to fully repair a badly worn tool. "
+"To retrieve the tool either punch or right-click the anvil with an empty "
+"hand."
+msgstr ""
+"Cliquez-droit sur cette enclume avec un outil endommagé pour le placer "
+"dessus. Vous pourrez alors réparer l'outil endommagé en le frappant avec un "
+"marteau de forgeron. Des coups successifs seront nécessaires pour réparer "
+"l'outil entièrement. Pour récupérer l'outil, frappez dessus ou faites un "
+"click-droit en ayant la main vide."
+
+#: init.lua:155
+msgid "This anvil is for damaged tools only."
+msgstr "L'enclume s'utilise sur les outils endommagés."
+
+#: init.lua:267
+msgid "Your @1 has been repaired successfully."
+msgstr "Votre @1 a été réparé avec succès."
diff --git a/anvil/locale/it.po b/anvil/locale/it.po
new file mode 100644
index 0000000..3659a1d
--- /dev/null
+++ b/anvil/locale/it.po
@@ -0,0 +1,68 @@
+# ITALIAN LOCALE FILE FOR THE ANVIL MODULE
+# Copyright (C) 2017 Sokomine
+# This file is distributed under the same license as the ANVIL package.
+# Hamlet <h4mlet@riseup.net>, 2017.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Italian locale file for the Anvil module\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2017-03-07 22:17-0700\n"
+"PO-Revision-Date: 2017-08-18 16:14+0100\n"
+"Last-Translator: H4mlet <h4mlet@riseup.net>\n"
+"Language-Team: \n"
+"Language: it\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"X-Generator: Poedit 1.6.10\n"
+
+#: init.lua:19
+msgid "Steel blacksmithing hammer"
+msgstr "Martello da fabbro di acciaio"
+
+#: init.lua:20
+msgid "A tool for repairing other tools at a blacksmith's anvil."
+msgstr "Un attrezzo per riparare altri attrezzi su di una incudine da fabbro."
+
+#: init.lua:21
+msgid ""
+"Use this hammer to strike blows upon an anvil bearing a damaged tool and you "
+"can repair it. It can also be used for smashing stone, but it is not well "
+"suited to this task."
+msgstr ""
+"Usate questo martello per colpire una incudine su cui è posto un attrezzo "
+"danneggiato e potrete ripararlo. Può anche essere usato per colpire la "
+"pietra, ma non è molto adatto a questo compito."
+
+#: init.lua:98
+msgid "Anvil"
+msgstr "Incudine"
+
+#: init.lua:99
+msgid ""
+"A tool for repairing other tools in conjunction with a blacksmith's hammer."
+msgstr "Un attrezzo per riparare altri attrezzi usando un martello da fabbro."
+
+#: init.lua:100
+msgid ""
+"Right-click on this anvil with a damaged tool to place the damaged tool upon "
+"it. You can then repair the damaged tool by striking it with a blacksmith's "
+"hammer. Repeated blows may be necessary to fully repair a badly worn tool. "
+"To retrieve the tool either punch or right-click the anvil with an empty "
+"hand."
+msgstr ""
+"Fate click destro su questa incudine con un attrezzo danneggiato per "
+"metterlo sull'incudine. Poi potrete ripararlo colpendolo con un martello da "
+"fabbro. Potrebbero essere necessari più colpi per riparare un attrezzo "
+"gravemente danneggiato. Per riprendere l'attrezzo colpite o fate click "
+"destro sull'incudine a mani vuote."
+
+#: init.lua:155
+msgid "This anvil is for damaged tools only."
+msgstr "Questa incudine è solo per attrezzi danneggiati."
+
+#: init.lua:267
+msgid "Your @1 has been repaired successfully."
+msgstr "La/il vostr* @1 è stat* riparat* con successo."