Skip to content

Commit

Permalink
Toolranks support and localization (#3)
Browse files Browse the repository at this point in the history
* Toolranks support

* Localization

* Stairs localization

* Local S varriable

* Translate correct
  • Loading branch information
adikalon authored Sep 7, 2024
1 parent 8b630ec commit ec9531c
Show file tree
Hide file tree
Showing 9 changed files with 209 additions and 51 deletions.
40 changes: 21 additions & 19 deletions craftitems.lua
Original file line number Diff line number Diff line change
@@ -1,89 +1,91 @@
local S = magic_materials.S

minetest.register_craftitem("magic_materials:arcanite_crystal", {
description = "Arcanite Crystal",
description = S("Arcanite Crystal"),
inventory_image = "magic_materials_arcanite_crystal.png",
})

minetest.register_craftitem("magic_materials:arcanite_fragments", {
description = "Arcanite Fragments",
description = S("Arcanite Fragments"),
inventory_image = "magic_materials_arcanite_fragments.png",
})

minetest.register_craftitem("magic_materials:egerum_crystal", {
description = "Egerum Crystal",
description = S("Egerum Crystal"),
inventory_image = "magic_materials_egerum_crystal.png",
})

minetest.register_craftitem("magic_materials:februm_crystal", {
description = "Februm Crystal",
description = S("Februm Crystal"),
inventory_image = "magic_materials_februm_crystal.png",
})

minetest.register_craftitem("magic_materials:enchanted_book", {
description = "Blank Enchanted Book",
description = S("Blank Enchanted Book"),
inventory_image = "magic_materials_enchanted_book.png",
})

minetest.register_craftitem("magic_materials:enchanted_page", {
description = "Enchanted Page",
description = S("Enchanted Page"),
inventory_image = "magic_materials_enchanted_page.png",
})

minetest.register_craftitem("magic_materials:enchanted_rune", {
description = "Enchanted Rune",
description = S("Enchanted Rune"),
inventory_image = "magic_materials_enchanted_rune.png",
})

minetest.register_craftitem("magic_materials:enchanted_staff", {
description = "Blank Enchanted Staff",
description = S("Blank Enchanted Staff"),
inventory_image = "magic_materials_enchanted_staff.png",
})

minetest.register_craftitem("magic_materials:magic_root", {
description = "Magic Root",
description = S("Magic Root"),
inventory_image = "magic_materials_magic_root.png",
})

minetest.register_craftitem("magic_materials:magic_flower", {
description = "Magic Flower",
description = S("Magic Flower"),
inventory_image = "magic_materials_magic_flower.png",
})

minetest.register_craftitem("magic_materials:magic_mushroom", {
description = "Magic Mushroom",
description = S("Magic Mushroom"),
inventory_image = "magic_materials_magic_mushroom.png",
})

minetest.register_craftitem("magic_materials:fire_rune", {
description = "Fire Rune",
description = S("Fire Rune"),
inventory_image = "magic_materials_fire_rune.png",
})

minetest.register_craftitem("magic_materials:ice_rune", {
description = "Ice Rune",
description = S("Ice Rune"),
inventory_image = "magic_materials_ice_rune.png",
})

minetest.register_craftitem("magic_materials:storm_rune", {
description = "Storm Rune",
description = S("Storm Rune"),
inventory_image = "magic_materials_storm_rune.png",
})

minetest.register_craftitem("magic_materials:void_rune", {
description = "Void Rune",
description = S("Void Rune"),
inventory_image = "magic_materials_void_rune.png",
})

minetest.register_craftitem("magic_materials:light_rune", {
description = "Light Rune",
description = S("Light Rune"),
inventory_image = "magic_materials_light_rune.png",
})

minetest.register_craftitem("magic_materials:energy_rune", {
description = "Energy Rune",
description = S("Energy Rune"),
inventory_image = "magic_materials_energy_rune.png",
})

minetest.register_craftitem("magic_materials:earth_rune", {
description = "Earth Rune",
description = S("Earth Rune"),
inventory_image = "magic_materials_earth_rune.png",
})
})
5 changes: 0 additions & 5 deletions depends.txt

This file was deleted.

9 changes: 7 additions & 2 deletions init.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
local path = minetest.get_modpath("magic_materials")
local path = minetest.get_modpath(minetest.get_current_modname())

magic_materials = {}

magic_materials.S = minetest.get_translator(minetest.get_current_modname())

dofile(path .. "/nodes.lua")
dofile(path .. "/craftitems.lua")
dofile(path .. "/crafts.lua")
Expand All @@ -7,4 +12,4 @@ dofile(path .. "/tools.lua")

if minetest.get_modpath("technic") then
dofile(path .. "/technic.lua")
end
end
44 changes: 44 additions & 0 deletions locale/magic_materials.ru.tr
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# textdomain: magic_materials
Arcanite Crystal=Кристалл арканита
Arcanite Fragments=Осколок арканита
Egerum Crystal=Кристалл эгерума
Februm Crystal=Кристалл фебрума
Blank Enchanted Book=Пустая книга зачарований
Enchanted Page=Страница зачарований
Enchanted Rune=Руна зачарований
Blank Enchanted Staff=Пустой посох зачарования
Magic Root=Волшебный корень
Magic Flower=Волшебный цветок
Magic Mushroom=Волшебный гриб
Fire Rune=Руна огня
Ice Rune=Руна льда
Storm Rune=Руна ветра
Void Rune=Руна пустоты
Light Rune=Руна света
Energy Rune=Руна энергии
Earth Rune=Руна земли
Februm Ore=Фебрумовая руда
Egerum Ore=Эгерумовая руда
Arcanite Block=Арканитовый блок
Februm Block=Фебрумовый блок
Egerum Block=Эгерумовый блок
Arcanite Stair=Лестница из арканита
Arcanite Slab=Плита из арканита
Inner Arcanite Stair=Внутренняя лестница из арканита
Outer Arcanite Stair=Внешняя лестница из арканита
Februm Stair=Лестница из фебрума
Februm Slab=Плита из фебрума
Inner Februm Stair=Внутренняя лестница из фебрума
Outer Februm Stair=Внешняя лестница из фебрума
Egerum Stair=Лестница из эгерума
Egerum Slab=Плита из эгерума
Inner Egerum Stair=Внутренняя лестница из эгерума
Outer Egerum Stair=Внешняя лестница из эгерума
Arcanite Dust=Арканитовая пыль
Februm Dust=Фебрумовая пыль
Egerum Dust=Эгерумовая пыль
Arcanite Pickaxe=Арканитовая кирка
Arcanite Shovel=Арканитовая лопата
Arcanite Axe=Арканитовый топор
Arcanite Sword=Арканитовый меч
Arcanite Hoe=Арканитовая мотыга
44 changes: 44 additions & 0 deletions locale/template.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# textdomain: magic_materials
Arcanite Crystal=
Arcanite Fragments=
Egerum Crystal=
Februm Crystal=
Blank Enchanted Book=
Enchanted Page=
Enchanted Rune=
Blank Enchanted Staff=
Magic Root=
Magic Flower=
Magic Mushroom=
Fire Rune=
Ice Rune=
Storm Rune=
Void Rune=
Light Rune=
Energy Rune=
Earth Rune=
Februm Ore=
Egerum Ore=
Arcanite Block=
Februm Block=
Egerum Block=
Arcanite Stair=
Arcanite Slab=
Inner Arcanite Stair=
Outer Arcanite Stair=
Februm Stair=
Februm Slab=
Inner Februm Stair=
Outer Februm Stair=
Egerum Stair=
Egerum Slab=
Inner Egerum Stair=
Outer Egerum Stair=
Arcanite Dust=
Februm Dust=
Egerum Dust=
Arcanite Pickaxe=
Arcanite Shovel=
Arcanite Axe=
Arcanite Sword=
Arcanite Hoe=
4 changes: 4 additions & 0 deletions mod.conf
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
name = magic_materials
title = Magic Materials
description = Adds magical materials.
depends = default, bucket, farming
optional_depends = technic, stairs, toolranks
60 changes: 44 additions & 16 deletions nodes.lua
Original file line number Diff line number Diff line change
@@ -1,54 +1,82 @@
local S = magic_materials.S

minetest.register_node("magic_materials:stone_with_februm", {
description = "Februm Ore",
description = S("Februm Ore"),
tiles = {"default_stone.png^magic_materials_mineral_februm.png"},
groups = {cracky = 1},
drop = "magic_materials:februm_crystal",
sounds = default.node_sound_stone_defaults(),
})

minetest.register_node("magic_materials:stone_with_egerum", {
description = "Egerum Ore",
description = S("Egerum Ore"),
tiles = {"default_stone.png^magic_materials_mineral_egerum.png"},
groups = {cracky = 1},
drop = "magic_materials:egerum_crystal",
sounds = default.node_sound_stone_defaults(),
})

minetest.register_node("magic_materials:arcanite_block", {
description = "Arcanite Block",
description = S("Arcanite Block"),
tiles = {"magic_materials_arcanite_block.png"},
is_ground_content = false,
groups = {cracky = 1, level = 2},
sounds = default.node_sound_stone_defaults(),
})

minetest.register_node("magic_materials:februm_block", {
description = "Februm Block",
description = S("Februm Block"),
tiles = {"magic_materials_februm_block.png"},
is_ground_content = false,
groups = {cracky = 1, level = 2},
sounds = default.node_sound_stone_defaults(),
})

minetest.register_node("magic_materials:egerum_block", {
description = "Egerum Block",
description = S("Egerum Block"),
tiles = {"magic_materials_egerum_block.png"},
is_ground_content = false,
groups = {cracky = 1, level = 2},
sounds = default.node_sound_stone_defaults(),
})

if minetest.get_modpath("stairs") then
for k,v in pairs({Arcanite="arcanite", Februm="februm", Egerum="egerum"}) do
stairs.register_stair_and_slab(
v,
"magic_materials:" .. v .. "_block",
stairs.register_stair_and_slab(
"arcanite",
"magic_materials:arcanite_block",
{cracky=1, level=2},
{"magic_materials_arcanite_block.png"},
S("Arcanite Stair"),
S("Arcanite Slab"),
default.node_sound_stone_defaults(),
false,
S("Inner Arcanite Stair"),
S("Outer Arcanite Stair")
)

stairs.register_stair_and_slab(
"februm",
"magic_materials:februm_block",
{cracky=1, level=2},
{"magic_materials_februm_block.png"},
S("Februm Stair"),
S("Februm Slab"),
default.node_sound_stone_defaults(),
false,
S("Inner Februm Stair"),
S("Outer Februm Stair")
)

stairs.register_stair_and_slab(
"egerum",
"magic_materials:egerum_block",
{cracky=1, level=2},
{"magic_materials_" .. v .. "_block.png"},
k .. " Stair",
k .. " Slab",
{"magic_materials_egerum_block.png"},
S("Egerum Stair"),
S("Egerum Slab"),
default.node_sound_stone_defaults(),
false
)
end
end
false,
S("Inner Egerum Stair"),
S("Outer Egerum Stair")
)
end
10 changes: 6 additions & 4 deletions technic.lua
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
local S = magic_materials.S

--Dusts
minetest.register_craftitem("magic_materials:arcanite_dust", {
description = "Arcanite Dust",
description = S("Arcanite Dust"),
inventory_image = "magic_materials_arcanite_dust.png",
})

minetest.register_craftitem("magic_materials:februm_dust", {
description = "Februm Dust",
description = S("Februm Dust"),
inventory_image = "magic_materials_februm_dust.png",
})

minetest.register_craftitem("magic_materials:egerum_dust", {
description = "Egerum Dust",
description = S("Egerum Dust"),
inventory_image = "magic_materials_egerum_dust.png",
})

Expand Down Expand Up @@ -72,4 +74,4 @@ minetest.register_craft({
output = "magic_materials:arcanite_crystal",
recipe = "magic_materials:arcanite_dust",
cooktime = 3,
})
})
Loading

0 comments on commit ec9531c

Please sign in to comment.