From d3dfd13f78a007e86ce5b4a43cf4e38ebc035e7d Mon Sep 17 00:00:00 2001 From: kay27 Date: Sat, 5 Feb 2022 03:01:23 +0400 Subject: [PATCH] #11 Fix the style, add template.txt, add Russian translation --- mods/ITEMS/mcl_amethyst/grow.lua | 24 ++++++++++--------- mods/ITEMS/mcl_amethyst/init.lua | 7 +++--- .../mcl_amethyst/locale/mcl_anvils.ru.tr | 17 +++++++++++++ mods/ITEMS/mcl_amethyst/locale/template.txt | 17 +++++++++++++ 4 files changed, 50 insertions(+), 15 deletions(-) create mode 100644 mods/ITEMS/mcl_amethyst/locale/mcl_anvils.ru.tr create mode 100644 mods/ITEMS/mcl_amethyst/locale/template.txt diff --git a/mods/ITEMS/mcl_amethyst/grow.lua b/mods/ITEMS/mcl_amethyst/grow.lua index ba4ba0c00..059fede5a 100644 --- a/mods/ITEMS/mcl_amethyst/grow.lua +++ b/mods/ITEMS/mcl_amethyst/grow.lua @@ -1,21 +1,22 @@ -function mcl_amethyst.grow_amethyst_bud(pos,ignore_budding_amethyst) +local S = minetest.get_translator(minetest.get_current_modname()) + +function mcl_amethyst.grow_amethyst_bud(pos, ignore_budding_amethyst) local node = minetest.get_node(pos) - if not node.name then return false end local def = minetest.registered_nodes[node.name] - if not def then return false end - if not def.groups and def.groups.amethyst_buds then return false end + if not (def and def.groups and def.groups.amethyst_buds) then return end local next_gen = def._mcl_amethyst_next_grade - if not next_gen then return false end + if not next_gen then return end + -- Check Budding Amethyst if not ignore_budding_amethyst then local dir = minetest.wallmounted_to_dir(node.param2) - local ba_pos = vector.add(pos,dir) + local ba_pos = vector.add(pos, dir) local ba_node = minetest.get_node(ba_pos) - if ba_node.name ~= "mcl_amethyst:budding_amethyst_block" then return false end + if ba_node.name ~= "mcl_amethyst:budding_amethyst_block" then return end end local swap_result = table.copy(node) swap_result.name = next_gen - minetest.swap_node(pos,swap_result) + minetest.swap_node(pos, swap_result) return true end @@ -26,17 +27,17 @@ local function get_growing_tool_handle(ignore) local pos = minetest.get_pointed_thing_position(pointed_thing) if minetest.is_protected(pos, name) then minetest.record_protection_violation(pos, name) - minetest.chat_send_player(name,"Not allowed to use Amethyst Growing Tool in a protected area!") + minetest.chat_send_player(name, S("Not allowed to use Amethyst Growing Tool in a protected area!")) return end if not mcl_amethyst.grow_amethyst_bud(pos, ignore) then - minetest.chat_send_player(name,"Growing Failed") + minetest.chat_send_player(name, S("Growing Failed")) end end end minetest.register_tool("mcl_amethyst:growing_tool",{ - description = "Amethyst Growing Tool", + description = S("Amethyst Growing Tool"), on_use = get_growing_tool_handle(true), on_place = get_growing_tool_handle(false), inventory_image = "amethyst_cluster.png^amethyst_shard.png", @@ -44,4 +45,5 @@ minetest.register_tool("mcl_amethyst:growing_tool",{ tool = 1, }, }) + mcl_wip.register_experimental_item("mcl_amethyst:growing_tool") diff --git a/mods/ITEMS/mcl_amethyst/init.lua b/mods/ITEMS/mcl_amethyst/init.lua index e13c42e8d..1406e5de6 100644 --- a/mods/ITEMS/mcl_amethyst/init.lua +++ b/mods/ITEMS/mcl_amethyst/init.lua @@ -14,10 +14,9 @@ minetest.register_node("mcl_amethyst:amethyst_block",{ sounds = mcl_sounds.node_sound_glass_defaults(), is_ground_content = true, stack_max = 64, - _doc_items_longdesc = S("The Block of Anethyst is a decoration block creft from amethyst shards."), + _doc_items_longdesc = S("The Block of Amethyst is a decoration block creft from amethyst shards."), }) --- (WIP!) Budding Amethyst minetest.register_node("mcl_amethyst:budding_amethyst_block",{ description = S("Budding Amethyst"), tiles = {"budding_amethyst.png"}, @@ -32,7 +31,7 @@ minetest.register_node("mcl_amethyst:budding_amethyst_block",{ sounds = mcl_sounds.node_sound_glass_defaults(), is_ground_content = true, stack_max = 64, - _doc_items_longdesc = S("The Budding Anethyst can grow amethyst"), + _doc_items_longdesc = S("The Budding Amethyst can grow amethyst"), }) mcl_wip.register_wip_item("mcl_amethyst:budding_amethyst_block") @@ -123,7 +122,7 @@ for x,y in pairs(bud_def) do }, _mcl_silk_touch_drop = true, _mcl_amethyst_next_grade = y[3], - _doc_items_longdesc = S(y[2] .. " Amethyst Bud is the " .. y[1] .. " grouth of amethyst bud."), + _doc_items_longdesc = S("@1 Amethyst Bud is the @2 grouth of amethyst bud.", y[2], y[1]), }) end diff --git a/mods/ITEMS/mcl_amethyst/locale/mcl_anvils.ru.tr b/mods/ITEMS/mcl_amethyst/locale/mcl_anvils.ru.tr new file mode 100644 index 000000000..f1d6e92a6 --- /dev/null +++ b/mods/ITEMS/mcl_amethyst/locale/mcl_anvils.ru.tr @@ -0,0 +1,17 @@ +# textdomain: mcl_amethyst +@1 Amethyst Bud is the @2 grouth of amethyst bud.=@1 Аметистовый Бутон - это @2-я стадия роста аместистового бутона. +Amethyst Cluster=Аметистовая друза +Amethyst Cluster is the final grouth of amethyst bud.=Аметистовая друза - это последняя 4-я стадия роста аметистового бутона. +Amethyst Growing Tool=Выращиватель аметиста +Amethyst Shard=Осколок аметиста +An amethyst shard is a crystalline mineral.=Осколок аметиста - это кристаллический минерал, получаемый в результате разрушения кластеров аметиста. +Block of Amethyst=Аметистовый блок +Budding Amethyst=Растущий аметист +Calcite=Кальцит +Calcite can be found as part of amethyst geodes.=Кальцит можно найти в составе аметистовых жеод. +Growing Failed=Выращивание не удалось +Not allowed to use Amethyst Growing Tool in a protected area!=Выращиватель аметиста нельзя использовать в защищённых частях мира +The Block of Amethyst is a decoration block creft from amethyst shards.=Блок аметиста - декоративный блок, скрафченный из осколков аметиста. +The Budding Amethyst can grow amethyst=Растущий аметист может вырастить аметист +Tinted Glass=Тонированное стекло +Tinted Glass is a type of glass which blocks lights while it is visually transparent.=Тонированное стекло блокирует свет, но визуально прозрачно. diff --git a/mods/ITEMS/mcl_amethyst/locale/template.txt b/mods/ITEMS/mcl_amethyst/locale/template.txt new file mode 100644 index 000000000..e9f6a81cb --- /dev/null +++ b/mods/ITEMS/mcl_amethyst/locale/template.txt @@ -0,0 +1,17 @@ +# textdomain: mcl_amethyst +@1 Amethyst Bud is the @2 grouth of amethyst bud.= +Amethyst Cluster= +Amethyst Cluster is the final grouth of amethyst bud.= +Amethyst Growing Tool= +Amethyst Shard= +An amethyst shard is a crystalline mineral.= +Block of Amethyst= +Budding Amethyst= +Calcite= +Calcite can be found as part of amethyst geodes.= +Growing Failed= +Not allowed to use Amethyst Growing Tool in a protected area!= +The Block of Amethyst is a decoration block creft from amethyst shards.= +The Budding Amethyst can grow amethyst= +Tinted Glass= +Tinted Glass is a type of glass which blocks lights while it is visually transparent.=