ExchangeClone/exchangeclone/klein_stars.lua

60 lines
2.1 KiB
Lua
Raw Normal View History

2024-02-12 19:02:52 +01:00
local S = minetest.get_translator()
local names = {
"Klein Star Ein",
"Klein Star Zwei",
"Klein Star Drei",
"Klein Star Vier",
"Klein Star Sphere",
"Klein Star Omega",
"Magnum Star Ein",
"Magnum Star Zwei",
"Magnum Star Drei",
"Magnum Star Vier",
"Magnum Star Sphere",
"Magnum Star Omega",
}
minetest.register_alias("exchangeclone:exchange_orb", "exchangeclone:klein_star_omega")
for i, name in ipairs(names) do
local codified_name = name:lower():gsub(" ", "_")
2024-02-13 02:20:48 +01:00
local capacity = 50000*math.pow(4,i-1)
2024-02-12 19:02:52 +01:00
minetest.register_tool("exchangeclone:"..codified_name, {
2024-02-13 02:20:48 +01:00
description = S(name).."\n"..S("Current Charge: @1/@2", 0, exchangeclone.format_number(capacity)),
2024-02-12 19:02:52 +01:00
inventory_image = "exchangeclone_"..codified_name..".png",
wield_image = "exchangeclone_"..codified_name..".png",
groups = {klein_star = i, disable_repair = 1, fire_immune = 1},
2024-02-13 02:20:48 +01:00
max_capacity = capacity,
2024-02-12 19:02:52 +01:00
_mcl_generate_description = function(itemstack)
2024-02-13 02:20:48 +01:00
return name.."\n"..S(
"Current Charge: @1/@2",
exchangeclone.format_number(exchangeclone.get_star_itemstack_emc(itemstack)),
2024-02-13 02:20:48 +01:00
exchangeclone.format_number(capacity)
)
2024-02-12 19:02:52 +01:00
end
})
if i > 1 then
2024-02-13 01:25:25 +01:00
local previous_codified_name = names[i-1]:lower():gsub(" ", "_")
2024-02-12 19:02:52 +01:00
minetest.register_craft({
output = "exchangeclone:"..codified_name,
type = "shapeless",
recipe = {
"exchangeclone:"..previous_codified_name,
"exchangeclone:"..previous_codified_name,
"exchangeclone:"..previous_codified_name,
"exchangeclone:"..previous_codified_name,
}
})
end
end
minetest.register_craft({
output = "exchangeclone:klein_star_ein",
recipe = {
{"exchangeclone:mobius_fuel", "exchangeclone:mobius_fuel", "exchangeclone:mobius_fuel"},
{"exchangeclone:mobius_fuel", exchangeclone.itemstrings.diamond, "exchangeclone:mobius_fuel"},
{"exchangeclone:mobius_fuel", "exchangeclone:mobius_fuel", "exchangeclone:mobius_fuel"},
}
})