2024-07-18 19:50:34 -06:00

127 lines
3.7 KiB
Lua

PyuTestCore.make_item("pyutest_core:magic_shards", "Magic Shards", {}, "magic-shards.png")
minetest.override_item("pyutest_core:crying_obsidian_block", {
drop = {
max_items = 1,
items = {
{
rarity = 5,
items = {"pyutest_core:magic_shards 3"}
},
{
items = {"pyutest_core:crying_obsidian_block"}
}
}
}
})
PyuTestCore.make_spellbook = function (nsname, desc, color, craftitem, action)
if action == nil then
action = function(_, _, _)end
end
PyuTestCore.make_item(nsname, desc, {}, "spellbook.png", {
stack_max = 1,
color = color,
on_use = function (itemstack, user, pointed_thing)
local pos = user:get_pos()
minetest.sound_play({name = "spellbook_action", gain = 0.75}, {pos = pos})
action(itemstack, user, pointed_thing)
end
})
minetest.register_craft({
output = nsname,
recipe = {
{"", "pyutest_core:magic_shards", ""},
{"pyutest_core:magic_shards", craftitem, "pyutest_core:magic_shards"},
{"", "pyutest_core:magic_shards", ""}
}
})
end
PyuTestCore.make_spellbook("pyutest_core:explosions_spellbook", "Spellbook of Explosions", "gray", "pyutest_core:bomb", function (itemstack, user)
PyuTestCore.create_explosion(user:get_pos(), 3, false, 7, user)
end)
PyuTestCore.make_spellbook("pyutest_core:fire_spellbook", "Spellbook of Fire", "crimson", "pyutest_core:hellstone_block", function (itemstack, user)
local range = 2
local function replace(pos)
local node = minetest.get_node_or_nil(pos)
if node == nil then return end
if node.name ~= "air" then return end
local pos2 = vector.new(pos.x, pos.y - 1, pos.z)
node = minetest.get_node_or_nil(pos)
if node == nil then return end
if node.name ~= "air" then return end
minetest.set_node(pos, {name = "pyutest_core:fire"})
end
for dx = -range, range do
for dz = -range, range do
local pos = user:get_pos()
replace({x = pos.x + dx, y = pos.y, z = pos.z + dz})
end
end
end)
PyuTestCore.make_item("pyutest_core:enchanted_shard", "Enchanted Shard", {}, "shard.png", {
color = "indigo",
})
minetest.register_craft({
output = "pyutest_core:enchanted_shard 2",
recipe = {
{"pyutest_core:magic_shards", "pyutest_core:diamond_shard", "pyutest_core:magic_shards"},
{"pyutest_core:emerald_shard", "pyutest_core:magic_shards", "pyutest_core:emerald_shard"},
{"pyutest_core:magic_shards", "pyutest_core:diamond_shard", "pyutest_core:magic_shards"}
}
})
-- these tools are worth the hassle
PyuTestCore.make_tool("pyutest_core:enchanted_pickaxe", "Enchanted Pickaxe", {}, "enchanted-pickaxe.png", {
stack_max = 1,
tool_capabilities = {
groupcaps = {
block = {
times = {
[PyuTestCore.BLOCK_BREAKABLE_INSTANT] = 0.015,
[PyuTestCore.BLOCK_BREAKABLE_NORMAL] = 0.035,
[PyuTestCore.BLOCK_BREAKABLE_CHOPPY] = 0.075,
[PyuTestCore.BLOCK_BREAKABLE_MIDDLE] = 0.15,
[PyuTestCore.BLOCK_BREAKABLE_LONG] = 0.8,
[PyuTestCore.BLOCK_BREAKABLE_VERYLONG] = 1.2,
[PyuTestCore.BLOCK_BREAKABLE_FOREVER] = 3
},
uses = 3600,
}
},
punch_attack_uses = 1200,
damage_groups = {fleshy = 4}
}
})
minetest.register_craft({
output = "pyutest_core:enchanted_pickaxe",
recipe = {
{"pyutest_core:enchanted_shard", "pyutest_core:enchanted_shard", "pyutest_core:enchanted_shard"},
{"", "pyutest_core:stick", ""},
{"", "pyutest_core:stick", ""}
}
})
PyuTestCore.make_sword("pyutest_core:enchanted_sword", "Enchanted Sword", "enchanted-sword.png", 15, 3600)
minetest.register_craft({
output = "pyutest_core:enchanted_sword",
recipe = {
{"pyutest_core:enchanted_shard"},
{"pyutest_core:enchanted_shard"},
{"pyutest_core:stick"}
}
})