First upload

master
DonBatman 2016-03-05 09:47:07 -08:00
commit cde3fe94a0
223 changed files with 2568 additions and 0 deletions

0
modpack.txt Normal file
View File

145
mymagic/blocks.lua Normal file
View File

@ -0,0 +1,145 @@
local blocks = {
{"Orange", "orange", "sword", {magic_sword = 4}},
{"Green", "green", "sword", {magic_sword = 3}},
{"Blue", "blue", "sword", {magic_sword = 2}},
{"Red", "red", "sword", {magic_sword = 1}},
{"Orange", "orange", "axe", {magic_axe = 4}},
{"Green", "green", "axe", {magic_axe = 3}},
{"Blue", "blue", "axe", {magic_axe = 2}},
{"Red", "red", "axe", {magic_axe = 1}},
}
for i in ipairs (blocks) do
local des = blocks[i][1]
local col = blocks[i][2]
local tool = blocks[i][3]
local mag = blocks[i][4]
minetest.register_node("mymagic:block_"..col..tool,{
description = des.." Magic block - "..tool,
tiles = {"mymagic_block_"..tool.."_"..col..".png"},
paramtype = "light",
drop = "",
groups = mag,
on_punch = function(pos, node, puncher, pointed_thing)
minetest.chat_send_player(puncher:get_player_name(), "You need an enchanted "..col.." "..tool.." to break this block")
end,
})
end
local function parti(pos)
minetest.add_particlespawner(40, 1,
pos, pos,
{x=-5, y=-5, z=-5}, {x=5, y=5, z=5},
{x=-2, y=-2, z=-2}, {x=2, y=2, z=2},
0.2, 2,
0.2, 3,
false, "mymagic_magic_parti.png")
end
local items = {
{"default:sword_diamond","sword","Sword Block"},
{"default:pick_diamond","pick","Pick Block"},
{"default:axe_diamond","axe","Axe Block"},
}
for i in ipairs (items) do
local itm = items[i][1]
local nam = items[i][2]
local des = items[i][3]
minetest.register_node("mymagic:"..nam.."_block",{
description = des,
tiles = {"mymagic_block_"..nam..".png"},
drawtype = "nodebox",
paramtype = "light",
drop = "",
light_source = 12,
groups = {magic_sword = 1,cracky=3},
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, 0.3125, -0.3125, 0.5, 0.5},
{-0.5, -0.5, -0.5, -0.3125, 0.5, -0.3125},
{0.3125, -0.5, -0.5, 0.5, 0.5, -0.3125},
{0.3125, -0.5, 0.3125, 0.5, 0.5, 0.5},
{0.3125, -0.5, -0.3125, 0.5, -0.3125, 0.3125},
{-0.5, -0.5, -0.3125, -0.3125, -0.3125, 0.3125},
{-0.5, 0.3125, -0.3125, -0.3125, 0.5, 0.3125},
{0.3125, 0.3125, -0.3125, 0.5, 0.5, 0.3125},
{-0.3125, 0.3125, 0.3125, 0.3125, 0.5, 0.5},
{-0.3125, 0.3125, -0.5, 0.3125, 0.5, -0.3125},
{-0.3125, -0.5, -0.5, 0.3125, -0.3125, -0.3125},
{-0.3125, -0.5, 0.3125, 0.3125, -0.3125, 0.5},
{-0.3125, -0.3125, -0.3125, 0.3125, 0.3125, 0.3125},
}
},
on_destruct = function(pos)
minetest.spawn_item(pos, itm)
parti(pos)
end,
})
end
local colors = {
{"red",{ r=255, g=0, b=0, a=200 }},
{"green",{ r=0, g=255, b=0, a=200 }},
{"blue",{ r=0, g=150, b=180, a=200 }},
{"orange",{ r=200, g=150, b=0, a=200 }}
}
for i in ipairs(colors) do
local col = colors[i][1]
local rgb = colors[i][2]
local scol = 0
if col == "red" then scol = 1
elseif col == "blue" then scol = 2
elseif col == "green" then scol = 3
elseif col == "orange" then scol = 4
end
minetest.register_node("mymagic:colored_energy_"..col,{
description = "Energy Block",
tiles = {{name="mymagic_teleport_ani_"..col..".png", animation={type="vertical_frames",aspect_w=16, aspect_h=16, length=0.5}}},
paramtype = "light",
drawtype = "liquid",
post_effect_color = rgb,
drop = "",
light_source = 14,
walkable = false,
groups = {cracky=1,magic_shovel = scol},
})
minetest.register_craft({
output = "mymagic:colored_energy_"..col,
recipe = {
{"mymagic:orb_"..col,"mymagic:orb_"..col,""},
{"mymagic:orb_"..col,"mymagic:orb_"..col,""},
{"","",""}
},
})
end
minetest.register_node("mymagic:hole1",{
description = "FakeTeleport Block",
tiles = {
"mymagic_hole_in_floor.png",
"mymagic_floor.png",
"mymagic_floor.png",
"mymagic_floor.png",
"mymagic_floor.png",
"mymagic_floor.png",
},
paramtype = "light",
drop = "",
groups = {magic_shovel = 1},
})
minetest.register_node("mymagic:hole2",{
description = "FakeTeleport Block",
tiles = {
"mymagic_hole_in_floor.png",
"mymagic_floor.png",
"mymagic_floor.png",
"mymagic_floor.png",
"mymagic_floor.png",
"mymagic_floor.png",
},
paramtype = "light",
drop = "",
groups = {magic_shovel = 1},
})

View File

@ -0,0 +1,21 @@
local blocks = {
{"pick","cobble","Cobble",{cracky=1}},
{"pick","desert_cobble","Desert Cobble",{cracky=1}},
{"pick","stone_brick","Stone Brick",{cracky=1}},
{"pick","desert_stone_brick","Desert Stone Brick",{cracky=1}},
}
for i in ipairs(blocks) do
local tl = blocks[i][1]
local itm = blocks[i][2]
local des = blocks[i][3]
local gro = blocks[i][4]
minetest.register_node("mymagic:dark"..itm,{
description = "Dark "..des,
tiles = {"mymagic_dark_"..itm..".png"},
drawtype = "normal",
paramtype = "light",
groups = {magic_pick = 1},
})
end

12
mymagic/craftitems.lua Normal file
View File

@ -0,0 +1,12 @@
--Blood Drop
minetest.register_craftitem("mymagic:blood_drop",{
inventory_image = "mymagic_blood_drop.png",
description = "Blood Drop",
})
--Gold Coin
minetest.register_craftitem("mymagic:gold_coin",{
inventory_image = "mymagic_gold_coin.png",
description = "Gold Coin",
stack_max = 10000,
})

1
mymagic/depends.txt Normal file
View File

@ -0,0 +1 @@
default

149
mymagic/doors.lua Normal file
View File

@ -0,0 +1,149 @@
local door_bottom_box_closed = {type = "fixed",fixed = {
{-0.5, -0.5, -0.5, -0.25, 0.5, 0.5},
{-0.5, -0.5, -0.1875, 0.5, 0.5, 0.1875},}}
local door_bottom_box_open = {type = "fixed",fixed = {
{-0.5, -0.5, -0.5, -0.25, 0.5, 0.5},
{-0.5, -0.5, -0.1875, 0, 0.5, 0.1875},}}
local door_top_box_closed = {type = "fixed",fixed = {
{-0.5, -0.5, -0.5, -0.25, 0.5, 0.5},
{-0.5, -0.5, -0.1875, 0.5, 0.5, 0.1875},
{-0.5, 0.4375, -0.5, 0.5, 0.5, 0.5},
{-0.5, 0.375, -0.5, 0.1875, 0.5, 0.5},
{-0.5, 0.3125, -0.5, 0.0625, 0.5, 0.5},
{-0.5, 0, -0.5, -0.1875, 0.5, 0.5},
{-0.5, 0.125, -0.5, -0.125, 0.5, 0.5},
{-0.5, 0.1875, -0.5, -0.0625, 0.5, 0.5},
{-0.5, 0.25, -0.5, 0, 0.5, 0.5},}}
local door_top_box_open = {type = "fixed",fixed = {
{-0.5, -0.5, -0.5, -0.25, 0.5, 0.5},
{-0.5, -0.5, -0.1875, 0, 0.5, 0.1875},
{-0.5, 0.4375, -0.5, 0.5, 0.5, 0.5},
{-0.5, 0.375, -0.5, 0.1875, 0.5, 0.5},
{-0.5, 0.3125, -0.5, 0.0625, 0.5, 0.5},
{-0.5, 0, -0.5, -0.1875, 0.5, 0.5},
{-0.5, 0.125, -0.5, -0.125, 0.5, 0.5},
{-0.5, 0.1875, -0.5, -0.0625, 0.5, 0.5},
{-0.5, 0.25, -0.5, 0, 0.5, 0.5},}}
local door_box = {type = "fixed",fixed = {
{-0.5, -0.5, -0.1875, 1.5, 1.5, 0.1875},}}
local nobox = {type = "fixed",fixed = {
{0, 0, 0, 0, 0, 0},}}
local door_nodes = {
{"dungeon", "Magic Door", 0,{"default_stone_brick.png"}, door_bottom_box_closed, door_box},
{"bottom_closed", "a", 1,{"default_stone_brick.png"}, door_bottom_box_closed, nobox},
{"bottom_open", "a", 1,{"default_stone_brick.png"}, door_bottom_box_open, nobox},
{"bottom_open2", "a", 1,{"default_stone_brick.png"}, door_bottom_box_open, door_box},
{"top_closed", "a", 1,{"default_stone_brick.png"}, door_top_box_closed, nobox},
{"top_open", "a", 1,{"default_stone_brick.png"}, door_top_box_open, nobox},
}
for i in ipairs(door_nodes) do
local itm = door_nodes[i][1]
local des = door_nodes[i][2]
local nic = door_nodes[i][3]
local til = door_nodes[i][4]
local nbox = door_nodes[i][5]
local sbox = door_nodes[i][6]
minetest.register_node("mymagic:door_"..itm,{
description = des,
tiles = til,
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 1, not_in_creative_inventory = nic},
node_box = nbox,
selection_box = sbox,
})
end
minetest.override_item("mymagic:door_dungeon",{
on_place = function(itemstack, placer, pointed_thing)
local dir = minetest.dir_to_facedir(placer:get_look_dir())
local pos = pointed_thing.above
local pt = pos
if dir == 0 then
pt = {x=pos.x+1,y=pos.y,z=pos.z}
elseif dir == 1 then
pt = {x=pos.x,y=pos.y,z=pos.z-1}
elseif dir == 2 then
pt = {x=pos.x-1,y=pos.y,z=pos.z}
elseif dir == 3 then
pt = {x=pos.x,y=pos.y,z=pos.z+1}
end
local par = dir
local par2 = dir + 2
if par2 == 4 then
par2 = 0
elseif par2 == 5 then
par2 = 1
end
minetest.set_node(pos,{name = "mymagic:door_dungeon", param2 = dir})
minetest.set_node(pt,{name = "mymagic:door_bottom_closed", param2 = par2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name = "mymagic:door_top_closed", param2 = dir})
minetest.set_node({x=pt.x,y=pt.y+1,z=pt.z},{name = "mymagic:door_top_closed", param2 = par2})
end,
after_destruct = function(pos, oldnode)
local door = minetest.find_nodes_in_area({x=pos.x-1,y=pos.y,z=pos.z-1},{x=pos.x+1,y=pos.y+1,z=pos.z+1}, {"mymagic:door_dungeon","mymagic:door_bottom_closed","mymagic:door_top_closed"})
for k, p in pairs(door) do
minetest.set_node(p,{name="air"})
end
end,
on_punch = function(pos, node, puncher, pointed_thing)
local timer = minetest.get_node_timer(pos)
local wi = puncher:get_wielded_item()
if wi:get_name() == "mymagic:orb_orange" or
wi:get_name() == "mymagic:orb_green" or
wi:get_name() == "mymagic:orb_blue" or
wi:get_name() == "mymagic:orb_red" then
local door = minetest.find_nodes_in_area({x=pos.x-1,y=pos.y,z=pos.z-1},{x=pos.x+1,y=pos.y+1,z=pos.z+1}, {"mymagic:door_dungeon","mymagic:door_bottom_closed","mymagic:door_top_closed"})
for k, p in pairs(door) do
local pnode = minetest.get_node(p)
if pnode.name == "mymagic:door_dungeon" then
minetest.swap_node(p,{name="mymagic:door_bottom_open2", param2=pnode.param2})
elseif pnode.name == "mymagic:door_bottom_closed" then
minetest.swap_node(p,{name="mymagic:door_bottom_open", param2=pnode.param2})
elseif pnode.name == "mymagic:door_top_closed" then
minetest.swap_node(p,{name="mymagic:door_top_open", param2=pnode.param2})
end
end
timer:start(3)
else minetest.chat_send_player(puncher:get_player_name(), "You need to hold an orb to open!")
end
end,
})
minetest.override_item("mymagic:door_bottom_open2",{
on_timer = function(pos, elapsed)
local door = minetest.find_nodes_in_area({x=pos.x-1,y=pos.y,z=pos.z-1},{x=pos.x+1,y=pos.y+1,z=pos.z+1}, {"mymagic:door_bottom_open2","mymagic:door_bottom_open","mymagic:door_top_open"})
for k, p in pairs(door) do
local pnode = minetest.get_node(p)
if pnode.name == "mymagic:door_bottom_open2" then
minetest.swap_node(p,{name="mymagic:door_dungeon", param2=pnode.param2})
elseif pnode.name == "mymagic:door_bottom_open" then
minetest.swap_node(p,{name="mymagic:door_bottom_closed", param2=pnode.param2})
elseif pnode.name == "mymagic:door_top_open" then
minetest.swap_node(p,{name="mymagic:door_top_closed", param2=pnode.param2})
end
end
end,
after_destruct = function(pos, oldnode)
local door = minetest.find_nodes_in_area({x=pos.x-1,y=pos.y,z=pos.z-1},{x=pos.x+1,y=pos.y+1,z=pos.z+1}, {"mymagic:door_open2","mymagic:door_bottom_open","mymagic:door_top_open"})
for k, p in pairs(door) do
minetest.set_node(p,{name="air"})
end
end,
})

213
mymagic/enchanter.lua Normal file
View File

@ -0,0 +1,213 @@
local enchanted_tool = {}
local enchant = false
minetest.register_node("mymagic:enchantment_table",{
description = "Enchantment Table",
tiles = {
{name="mymagic_enchantment_table_top_ani.png", animation={type="vertical_frames",aspect_w=16, aspect_h=16, length=0.3}},
"mymagic_enchantment_table_bottom.png",
{name="mymagic_enchantment_table_side_ani.png", animation={type="vertical_frames",aspect_w=16, aspect_h=16, length=0.3}},
{name="mymagic_enchantment_table_side_ani.png", animation={type="vertical_frames",aspect_w=16, aspect_h=16, length=0.3}},
{name="mymagic_enchantment_table_side_ani.png", animation={type="vertical_frames",aspect_w=16, aspect_h=16, length=0.3}},
{name="mymagic_enchantment_table_side_ani.png", animation={type="vertical_frames",aspect_w=16, aspect_h=16, length=0.3}},
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
light_source = 7,
groups = {choppy = 2},
node_box = {
type = "fixed",
fixed = {
{-0.4375, -0.5, 0.25, -0.25, 0.125, 0.4375},
{0.25, -0.5, 0.25, 0.4375, 0.125, 0.4375},
{-0.4375, -0.5, -0.4375, -0.25, 0.125, -0.25},
{0.25, -0.5, -0.4375, 0.4375, 0.125, -0.25},
{-0.5, 0.125, -0.5, 0.5, 0.25, 0.5},
{-0.375, -0.0625, -0.375, 0.375, 0.125, 0.375},
{-0.4375, 0.25, 0.125, -0.375, 0.5, 0.1875},
{0.375, 0.25, 0.125, 0.4375, 0.5, 0.1875},
{-0.0625, 0.25, 0.375, 0, 0.5, 0.4375},
{-0.25, 0.25, -0.375, -0.1875, 0.5, -0.3125},
{0.1875, 0.25, -0.375, 0.25, 0.5, -0.3125},
}
},
after_place_node = function(pos, placer)
local meta = minetest.env:get_meta(pos);
meta:set_string("infotext", "Enchantment Table");
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
if not inv:is_empty("tool") then
return false
elseif not inv:is_empty("orb1") then
return false
elseif not inv:is_empty("orb2") then
return false
elseif not inv:is_empty("orb3") then
return false
elseif not inv:is_empty("orb4") then
return false
elseif not inv:is_empty("output") then
return false
end
return true
end,
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
meta:set_string("formspec", "size[10,8;]"..
"background[-2,-2;13,12;mymagic_enchantment_table_bg.png]"..
"listcolors[#00000000;#00000000;#000000]"..
--top row
"label[1,0.5;Tool]"..
"label[3,0.5;Orbs]"..
"list[current_name;tool;1,1;1,1;]"..
"list[current_name;orb1;3,1;1,1;]"..
"list[current_name;orb2;4,1;1,1;]"..
--bottom row
"list[current_name;orb3;3,2;1,1;]"..
"list[current_name;orb4;4,2;1,1;]"..
--Output
"button[5.5,1;2,1;button;Enchant]"..
--"label[6,1.5;Enchanted Tool]"..
"list[current_name;output;6,2;1,1;]"..
--Show Inventory
"list[current_player;main;0.5,4;8,4;]")
meta:set_string("infotext", "Tool Upgrade")
local inv = meta:get_inventory()
inv:set_size("tool", 1)
inv:set_size("orb1", 1)
inv:set_size("orb2", 1)
inv:set_size("orb3", 1)
inv:set_size("orb4", 1)
inv:set_size("output", 1)
end,
on_receive_fields = function(pos, formname, fields, sender)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
if fields["button"]
then
enchant = false
if inv:is_empty("tool") or
inv:is_empty("orb1") or
inv:is_empty("orb2") or
inv:is_empty("orb3") or
inv:is_empty("orb4") then
return
end
local tool = inv:get_stack("tool", 1)
local orba = inv:get_stack("orb1", 1)
local orbb = inv:get_stack("orb2", 1)
local orbc = inv:get_stack("orb3", 1)
local orbd = inv:get_stack("orb4", 1)
local t = {"pick","axe","shovel","sword"}
local c = {"orange","green","blue","red"}
local m = {"wood","stone","steel","bronze","mese","diamond"}
for i, tls in pairs(t) do
--for i, clr in pairs(c) do
for i, mtr in pairs(m) do
local tool_list = {
{"default:"..tls.."_"..mtr, "orange", "mymagic_tools:"..tls.."_enchanted_"..mtr.."_orange"},
{"mymagic_tools:"..tls.."_enchanted_"..mtr.."_orange", "green", "mymagic_tools:"..tls.."_enchanted_"..mtr.."_green"},
{"mymagic_tools:"..tls.."_enchanted_"..mtr.."_green", "blue", "mymagic_tools:"..tls.."_enchanted_"..mtr.."_blue"},
{"mymagic_tools:"..tls.."_enchanted_"..mtr.."_blue", "red", "mymagic_tools:"..tls.."_enchanted_"..mtr.."_red"},
{"mymagic_tools:knife_"..mtr, "orange", "mymagic_tools:knife_enchanted_"..mtr.."_orange"},
{"mymagic_tools:knife_enchanted_"..mtr.."_orange", "green", "mymagic_tools:knife_enchanted_"..mtr.."_green"},
{"mymagic_tools:knife_enchanted_"..mtr.."_green", "blue", "mymagic_tools:knife_enchanted_"..mtr.."_blue"},
{"mymagic_tools:knife_enchanted_"..mtr.."_blue", "red", "mymagic_tools:knife_enchanted_"..mtr.."_red"},
{"3d_armor:helmet_diamond", "orange", "dungeon_armor:diamond_helmet_orange"},
{"3d_armor:chestplate_diamond", "orange", "dungeon_armor:diamond_chestplate_orange"},
{"3d_armor:leggings_diamond", "orange", "dungeon_armor:diamond_leggings_orange"},
{"3d_armor:boots_diamond", "orange", "dungeon_armor:diamond_boots_orange"},
{"dungeon_armor:diamond_helmet_orange", "green", "dungeon_armor:diamond_helmet_green"},
{"dungeon_armor:diamond_chestplate_orange", "green", "dungeon_armor:diamond_chestplate_green"},
{"dungeon_armor:diamond_leggings_orange", "green", "dungeon_armor:diamond_leggings_green"},
{"dungeon_armor:diamond_boots_orange", "green", "dungeon_armor:diamond_boots_green"},
{"dungeon_armor:diamond_helmet_green", "blue", "dungeon_armor:diamond_helmet_blue"},
{"dungeon_armor:diamond_chestplate_green", "blue", "dungeon_armor:diamond_chestplate_blue"},
{"dungeon_armor:diamond_leggings_green", "blue", "dungeon_armor:diamond_leggings_blue"},
{"dungeon_armor:diamond_boots_green", "blue", "dungeon_armor:diamond_boots_blue"},
{"dungeon_armor:diamond_helmet_blue", "red", "dungeon_armor:diamond_helmet_red"},
{"dungeon_armor:diamond_chestplate_blue", "red", "dungeon_armor:diamond_chestplate_red"},
{"dungeon_armor:diamond_leggings_blue", "red", "dungeon_armor:diamond_leggings_red"},
{"dungeon_armor:diamond_boots_blue", "red", "dungeon_armor:diamond_boots_red"},
}
for i in ipairs (tool_list) do
local tin = tool_list[i][1]
local col = tool_list[i][2]
local tout = tool_list[i][3]
if tool:get_name() == tin and
orba:get_name() == "mymagic:orb_"..col and
orbb:get_name() == "mymagic:orb_"..col and
orbc:get_name() == "mymagic:orb_"..col and
orbd:get_name() == "mymagic:orb_"..col then
enchanted_tool = tout
enchant = true
end
end
end
end
local tool_wear = tool:get_wear()
if enchant == true then
inv:add_item("output",enchanted_tool)
local out = inv:get_stack("output", 1)
out:set_wear(tool_wear)
inv:set_stack("output",1,out)
orba:take_item()
inv:set_stack("orb1",1,orba)
orbb:take_item()
inv:set_stack("orb2",1,orbb)
orbc:take_item()
inv:set_stack("orb3",1,orbc)
orbd:take_item()
inv:set_stack("orb4",1,orbd)
tool:take_item()
inv:set_stack("tool",1,tool)
end
end
end,
})
minetest.register_craft({
output = "mymagic:enchantment_table",
recipe = {{"default:torch","mymagic:orb_red","default:torch"},
{"default:wood","default:wood","default:wood"},
{"default:stick","","default:stick"}}
})

210
mymagic/gem_blocks.lua Normal file
View File

@ -0,0 +1,210 @@
local function parti(pos)
minetest.add_particlespawner(40, 1,
pos, pos,
{x=-5, y=-5, z=-5}, {x=5, y=5, z=5},
{x=-2, y=-2, z=-2}, {x=2, y=2, z=2},
0.2, 2,
0.2, 3,
false, "mymagic_magic_parti.png")
end
minetest.register_node("mymagic:gem_block_orange",{
description = "Orange Gem Block",
tiles = {"mymagic_gem_block_orange.png"},
light_source = 11,
paramtype2 = "facedir",
groups = {creative_breakable = 1},
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", "size[4,5.5;]"..
"background[-0.5,-0.5;5,6.5;mymagic_gem_block_bg_orange.png]"..
"background[0.5,0.5;3,3;mymagic_gem_block_orange.png]"..
"listcolors[#cf7f00;#fb9c06;#000000]"..
"label[1,0;Insert Orange Crystal]"..
"list[current_name;orange_gem;1.5,1.5;1,1;]"..
"button_exit[1,3.5;2,1;orange;Activate]"..
"list[current_player;main;0,4.5;4,1;]")
local inv = meta:get_inventory()
inv:set_size("orange_gem", 1)
end,
on_receive_fields = function(pos, formname, fields, sender)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
if fields["orange"] then
if inv:is_empty("orange_gem") then
return
end
local gem = inv:get_stack("orange_gem", 1)
if gem:get_name() == "mymagic:crystal_orange" then
local node = minetest.get_node(pos)
gem:take_item()
minetest.spawn_item({x=pos.x,y=pos.y+1,z=pos.z}, gem)
minetest.set_node(pos,{name="default:ladder",param2=node.param2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name="default:ladder",param2=node.param2})
minetest.set_node({x=pos.x,y=pos.y-1,z=pos.z},{name="default:ladder",param2=node.param2})
minetest.set_node({x=pos.x,y=pos.y-2,z=pos.z},{name="default:ladder",param2=node.param2})
minetest.set_node({x=pos.x,y=pos.y-3,z=pos.z},{name="default:ladder",param2=node.param2})
minetest.set_node({x=pos.x,y=pos.y-4,z=pos.z},{name="default:ladder",param2=node.param2})
minetest.set_node({x=pos.x,y=pos.y-5,z=pos.z},{name="default:ladder",param2=node.param2})
parti(pos)
end
end
end,
})
minetest.register_node("mymagic:gem_block_green",{
description = "Green Gem Block",
tiles = {"mymagic_gem_block_green.png"},
light_source = 11,
paramtype2 = "facedir",
groups = {creative_breakable = 1},
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", "size[4,5.5;]"..
"background[-0.5,-0.5;5,6.5;mymagic_gem_block_bg_green.png]"..
"background[0.5,0.5;3,3;mymagic_gem_block_green.png]"..
"listcolors[#0d6601;#13a400;#000000]"..
"label[1,0;Insert Green Crystal]"..
"list[current_name;green_gem;1.5,1.5;1,1;]"..
"button_exit[1,3.5;2,1;green;Activate]"..
"list[current_player;main;0,4.5;4,1;]")
local inv = meta:get_inventory()
inv:set_size("green_gem", 1)
end,
on_receive_fields = function(pos, formname, fields, sender)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
if fields["green"] then
if inv:is_empty("green_gem") then
return
end
local gem = inv:get_stack("green_gem", 1)
if gem:get_name() == "mymagic:crystal_green" then
local node = minetest.get_node(pos)
gem:take_item()
minetest.spawn_item({x=pos.x,y=pos.y+1,z=pos.z}, gem)
minetest.set_node(pos,{name="default:ladder",param2=node.param2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name="default:ladder",param2=node.param2})
minetest.set_node({x=pos.x,y=pos.y+2,z=pos.z},{name="default:ladder",param2=node.param2})
minetest.set_node({x=pos.x,y=pos.y+3,z=pos.z},{name="default:ladder",param2=node.param2})
minetest.set_node({x=pos.x,y=pos.y+4,z=pos.z},{name="default:ladder",param2=node.param2})
minetest.set_node({x=pos.x,y=pos.y+5,z=pos.z},{name="default:ladder",param2=node.param2})
minetest.set_node({x=pos.x,y=pos.y+6,z=pos.z},{name="default:ladder",param2=node.param2})
parti(pos)
end
end
end,
})
minetest.register_node("mymagic:gem_block_blue",{
description = "Blue Gem Block",
tiles = {"mymagic_gem_block_blue.png"},
light_source = 11,
paramtype2 = "facedir",
groups = {creative_breakable = 1},
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", "size[4,5.5;]"..
"background[-0.5,-0.5;5,6.5;mymagic_gem_block_bg_blue.png]"..
"background[0.5,0.5;3,3;mymagic_gem_block_blue.png]"..
"listcolors[#030f4a;#030f7b;#000000]"..
"label[1,0;Insert Blue Crystal]"..
"list[current_name;blue_gem;1.5,1.5;1,1;]"..
"button_exit[1,3.5;2,1;blue;Activate]"..
"list[current_player;main;0,4.5;4,1;]")
local inv = meta:get_inventory()
inv:set_size("blue_gem", 1)
end,
on_receive_fields = function(pos, formname, fields, sender)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
if fields["blue"] then
if inv:is_empty("blue_gem") then
return
end
local gem = inv:get_stack("blue_gem", 1)
if gem:get_name() == "mymagic:crystal_blue" then
local node = minetest.get_node(pos)
gem:take_item()
minetest.spawn_item({x=pos.x,y=pos.y+1,z=pos.z}, gem)
minetest.set_node(pos,{name="air",param2=node.param2})
minetest.set_node({x=pos.x,y=pos.y-1,z=pos.z},{name="mymagic:hole1",param2=node.param2})
parti(pos)
end
end
end,
})
minetest.register_node("mymagic:gem_block_red",{
description = "Red Gem Block",
tiles = {"mymagic_gem_block_red.png"},
light_source = 11,
paramtype2 = "facedir",
groups = {creative_breakable = 1},
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", "size[4,5.5;]"..
"background[-0.5,-0.5;5,6.5;mymagic_gem_block_bg_red.png]"..
"background[0.5,0.5;3,3;mymagic_gem_block_red.png]"..
"listcolors[#910000;#d50000;#000000]"..
"label[1,0;Insert Red Crystal]"..
"list[current_name;red_gem;1.5,1.5;1,1;]"..
"button_exit[1,3.5;2,1;red;Activate]"..
"list[current_player;main;0,4.5;4,1;]")
local inv = meta:get_inventory()
inv:set_size("red_gem", 1)
end,
on_receive_fields = function(pos, formname, fields, sender)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
if fields["red"] then
if inv:is_empty("red_gem") then
return
end
local gem = inv:get_stack("red_gem", 1)
if gem:get_name() == "mymagic:crystal_red" then
local node = minetest.get_node(pos)
gem:take_item()
minetest.spawn_item({x=pos.x,y=pos.y+1,z=pos.z}, gem)
minetest.set_node(pos,{name="air",param2=node.param2})
minetest.set_node({x=pos.x,y=pos.y-1,z=pos.z},{name="mymagic:hole2",param2=node.param2})
parti(pos)
end
end
end,
})
minetest.register_abm({
nodenames = {"mymagic:hole1","mymagic:hole2"},
interval = 0.5,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
local objs = minetest.get_objects_inside_radius(pos, 1)
for k, player in pairs(objs) do
if player:get_player_name() then
if node.name == "mymagic:hole1" then
player:setpos({x=pos.x,y=pos.y+7,z=pos.z})
elseif node.name == "mymagic:hole2" then
player:setpos({x=pos.x,y=pos.y-3,z=pos.z})
end
end
end
end
})

10
mymagic/init.lua Normal file
View File

@ -0,0 +1,10 @@
dofile(minetest.get_modpath("mymagic").."/enchanter.lua")
dofile(minetest.get_modpath("mymagic").."/blocks.lua")
dofile(minetest.get_modpath("mymagic").."/craftitems.lua")
dofile(minetest.get_modpath("mymagic").."/gem_blocks.lua")
dofile(minetest.get_modpath("mymagic").."/tool_recharge.lua")
dofile(minetest.get_modpath("mymagic").."/doors.lua")
dofile(minetest.get_modpath("mymagic").."/orbs_crystals.lua")
dofile(minetest.get_modpath("mymagic").."/blocks_default.lua")

56
mymagic/orbs_crystals.lua Normal file
View File

@ -0,0 +1,56 @@
local items = {
{"Orange Crystal","crystal_orange",10},
{"Green Crystal","crystal_green",20},
{"Blue Crystal","crystal_blue",30},
{"Red Crystal","crystal_red",40},
}
for i in ipairs(items) do
local des = items[i][1]
local itm = items[i][2]
local man = items[i][3]
minetest.register_craftitem("mymagic:"..itm,{
description = des,
inventory_image = "mymagic_"..itm..".png",
})
end
local items = {
{"Orange Energy Orb","orb_orange",20},
{"Green Energy Orb","orb_green",40},
{"Blue Energy Orb","orb_blue",60},
{"Red Energy Orb","orb_red",80},
}
for i in ipairs(items) do
local des = items[i][1]
local itm = items[i][2]
local man = items[i][3]
minetest.register_craftitem("mymagic:"..itm,{
description = des,
inventory_image = "mymagic_"..itm..".png",
})
end
minetest.override_item("default:stone",{
drop = {
max_items = 2,
items = {
{items = {"default:cobble"},rarity = 1},
{items = {"mymagic:orb_orange"},rarity = 150},
{items = {"mymagic:orb_green"},rarity = 300},
{items = {"mymagic:orb_blue"},rarity = 450},
{items = {"mymagic:orb_red"},rarity = 600},
{items = {"mymagic:crystal_orange"},rarity = 150},
{items = {"mymagic:crystal_green"},rarity = 300},
{items = {"mymagic:crystal_blue"},rarity = 450},
{items = {"mymagic:crystal_red"},rarity = 600},
}},
})

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 863 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 363 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 339 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 593 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 414 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 403 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 544 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 267 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1012 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 804 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 928 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 839 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 842 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 777 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 812 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 392 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 346 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 477 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 429 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 417 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 467 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 682 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 695 B

157
mymagic/tool_recharge.lua Normal file
View File

@ -0,0 +1,157 @@
local charged_tool = {}
local recharge = false
local repair_time = 0
minetest.register_node("mymagic:tool_recharge",{
description = "Tool Recharging Station",
tiles = {
"mymagic_tool_recharge_top.png",
"mymagic_tool_recharge_top.png",
"mymagic_tool_recharge.png",
"mymagic_tool_recharge.png",
"mymagic_tool_recharge.png",
"mymagic_tool_recharge.png",
},
drawtype = "normal",
paramtype = "light",
paramtype2 = "facedir",
light_source = 7,
groups = {cracky=1},
after_place_node = function(pos, placer)
local meta = minetest.env:get_meta(pos);
meta:set_string("infotext", "Tool Recharging Station");
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
if not inv:is_empty("tool") then
return false
elseif not inv:is_empty("orb") then
return false
elseif not inv:is_empty("output") then
return false
end
return true
end,
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
meta:set_string("formspec", "size[4,3;]"..
"background[-0.5,-0.5;5,4;mymagic_gem_block_bg.png]"..
"listcolors[#5e4300;#936800;#000000]"..
"label[0,0;Tool]"..
"label[1,0;Orb]"..
"list[current_name;tool;0,0.5;1,1;]"..
"list[current_name;orb;1,0.5;1,1;]"..
"button[2,0.5;1,1;button;Charge]"..
"list[current_name;output;3,0.5;1,1;]"..
--Show Inventory
"list[current_player;main;0,2;4,1;]")
meta:set_string("infotext", "Tool Recharging Station")
local inv = meta:get_inventory()
inv:set_size("tool", 1)
inv:set_size("orb", 1)
inv:set_size("output", 1)
end,
on_receive_fields = function(pos, formname, fields, sender)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
if fields["button"] then
recharge = false
if inv:is_empty("tool") or
inv:is_empty("orb") then
return
end
if inv:is_empty("output") == false then
return
end
local tools = inv:get_stack("tool", 1)
local orbs = inv:get_stack("orb", 1)
local t = {"axe","pick","shovel","sword","knife"}
for i, tl in pairs(t) do
local tool_list = {
{"mymagic_tools:"..tl.."_enchanted_wood_orange", "orange"},
{"mymagic_tools:"..tl.."_enchanted_stone_orange", "orange"},
{"mymagic_tools:"..tl.."_enchanted_steel_orange", "orange"},
{"mymagic_tools:"..tl.."_enchanted_bronze_orange","orange"},
{"mymagic_tools:"..tl.."_enchanted_mese_orange", "orange"},
{"mymagic_tools:"..tl.."_enchanted_diamond_orange","orange"},
{"mymagic_tools:"..tl.."_enchanted_wood_green", "green"},
{"mymagic_tools:"..tl.."_enchanted_stone_green", "green"},
{"mymagic_tools:"..tl.."_enchanted_steel_green", "green"},
{"mymagic_tools:"..tl.."_enchanted_bronze_green", "green"},
{"mymagic_tools:"..tl.."_enchanted_mese_green", "green"},
{"mymagic_tools:"..tl.."_enchanted_diamond_green","green"},
{"mymagic_tools:"..tl.."_enchanted_wood_blue", "blue"},
{"mymagic_tools:"..tl.."_enchanted_stone_blue", "blue"},
{"mymagic_tools:"..tl.."_enchanted_steel_blue", "blue"},
{"mymagic_tools:"..tl.."_enchanted_bronze_blue", "blue"},
{"mymagic_tools:"..tl.."_enchanted_mese_blue", "blue"},
{"mymagic_tools:"..tl.."_enchanted_diamond_blue", "blue"},
{"mymagic_tools:"..tl.."_enchanted_wood_red", "red"},
{"mymagic_tools:"..tl.."_enchanted_stone_red", "red"},
{"mymagic_tools:"..tl.."_enchanted_steel_red", "red"},
{"mymagic_tools:"..tl.."_enchanted_bronze_red", "red"},
{"mymagic_tools:"..tl.."_enchanted_mese_red", "red"},
{"mymagic_tools:"..tl.."_enchanted_diamond_red", "red"},
{"mymagic_tools:diamond_helmet_orange", "orange"},
{"mymagic_tools:diamond_chestplate_orange", "orange"},
{"mymagic_tools:diamond_leggings_orange", "orange"},
{"mymagic_tools:diamond_boots_orange", "orange"},
{"mymagic_tools:diamond_helmet_green", "green"},
{"mymagic_tools:diamond_chestplate_green", "green"},
{"mymagic_tools:diamond_leggings_green", "green"},
{"mymagic_tools:diamond_boots_green", "green"},
{"mymagic_tools:diamond_helmet_blue", "red"},
{"mymagic_tools:diamond_chestplate_blue", "red"},
{"mymagic_tools:diamond_leggings_blue", "red"},
{"mymagic_tools:diamond_boots_blue", "red"},
}
for i in ipairs (tool_list) do
local tin = tool_list[i][1]
local col = tool_list[i][2]
if tools:get_name() == tin and
orbs:get_name() == "mymagic:orb_"..col then
charged_tool = tin
recharge = true
if col == "orange" then
repair_time = 5
elseif col == "green" then
repair_time = 10
elseif col == "blue" then
repair_time = 15
elseif col == "red" then
repair_time = 20
end
end
end
end
if recharge == true then
minetest.after(repair_time,function()
tools:add_wear(-10000)
inv:set_stack("output", 1, tools)
orbs:take_item()
inv:set_stack("orb",1,orbs)
tools:take_item()
inv:set_stack("tool",1,tools)
end)
end
end
end,
})

View File

@ -0,0 +1,45 @@
local parts = {
{"Wood Axe Head","axe_blade_wood"},
{"Stone Axe Head","axe_blade_stone"},
{"Steel Axe Head","axe_blade_steel"},
{"Bronze Axe Head","axe_blade_bronze"},
{"Mese Axe Head","axe_blade_mese"},
{"Diamond Axe Head","axe_blade_diamond"},
{"Axe Handle","axe_handle"},
}
for i in ipairs (parts) do
local des = parts[i][1]
local mat = parts[i][2]
minetest.register_craftitem("mymagic_tools:"..mat,{
description = des,
inventory_image = "mymagic_"..mat..".png",
groups = {not_in_creative_inventory = 1}
})
end
local items = {
{"Wood Blade","blade_wood","sword_wood"},
{"Stone Blade","blade_stone","sword_stone"},
{"Steel Blade","blade_steel","sword_steel"},
{"Bronze Blade","blade_bronze","sword_bronze"},
{"Mese Blade","blade_mese","sword_mese"},
{"Diamond Blade","blade_diamond","sword_diamond"},
}
for i in ipairs(items) do
local des = items[i][1]
local itm = items[i][2]
local cra = items[i][3]
minetest.register_craftitem("mymagic_tools:"..itm,{
description = des,
inventory_image = "mymagic_sword_"..itm..".png",
groups = {not_in_creative_inventory = 1}
})
end
minetest.register_craftitem("mymagic_tools:handle_wood",{
description = "Wood Sword Handle",
inventory_image = "mymagic_sword_handle_wood.png",
groups = {not_in_creative_inventory = 1}
})

View File

@ -0,0 +1,78 @@
minetest.register_tool(":default:axe_wood",{
description = "Wood Axe",
inventory_image = "mymagic_axe_wood.png^mymagic_leather_grip.png",
wield_scale = {x=1,y=1.5,z=0.5},
tool_capabilities = {
full_punch_interval = 1,
max_drop_level=0,
groupcaps={
choppy={times={[2]=1.6, [3]=0.40}, uses=10, maxlevel=1},
},
damage_groups = {fleshy=2},
}
})
minetest.register_tool(":default:axe_stone",{
description = "Stone Axe",
inventory_image = "mymagic_axe_stone.png^mymagic_leather_grip.png",
wield_scale = {x=1,y=1.5,z=0.5},
tool_capabilities = {
full_punch_interval = 1,
max_drop_level=0,
groupcaps={
choppy={times={[2]=1.4, [3]=0.40}, uses=20, maxlevel=1},
},
damage_groups = {fleshy=4},
}
})
minetest.register_tool(":default:axe_steel",{
description = "Steel Axe",
inventory_image = "mymagic_axe_steel.png^mymagic_leather_grip.png",
wield_scale = {x=1,y=1.5,z=0.5},
tool_capabilities = {
full_punch_interval = 0.8,
max_drop_level=1,
groupcaps={
choppy={times={[1]=2.5, [2]=1.2, [3]=0.35}, uses=30, maxlevel=1},
},
damage_groups = {fleshy=6},
}
})
minetest.register_tool(":default:axe_bronze",{
description = "Bronze Axe",
inventory_image = "mymagic_axe_bronze.png^mymagic_leather_grip.png",
wield_scale = {x=1,y=1.5,z=0.5},
tool_capabilities = {
full_punch_interval = 0.8,
max_drop_level=1,
groupcaps={
choppy={times={[1]=2.5, [2]=1.2, [3]=0.35}, uses=40, maxlevel=1},
},
damage_groups = {fleshy=6},
}
})
minetest.register_tool(":default:axe_mese",{
description = "Mese Axe",
inventory_image = "mymagic_axe_mese.png^mymagic_leather_grip.png",
wield_scale = {x=1,y=1.5,z=0.5},
tool_capabilities = {
full_punch_interval = 0.7,
max_drop_level=1,
groupcaps={
choppy={times={[1]=2, [2]=1, [3]=0.35}, uses=30, maxlevel=1},
},
damage_groups = {fleshy=7},
}
})
minetest.register_tool(":default:axe_diamond",{
description = "Diamond Axe",
inventory_image = "mymagic_axe_diamond.png^mymagic_leather_grip.png",
wield_scale = {x=1,y=1.5,z=0.5},
tool_capabilities = {
full_punch_interval = 0.7,
max_drop_level=1,
groupcaps={
choppy={times={[1]=1.9, [2]=0.9, [3]=0.30}, uses=40, maxlevel=1},
},
damage_groups = {fleshy=8},
}
})

View File

@ -0,0 +1,131 @@
minetest.register_tool("mymagic_tools:knife_wood",{
description = "Wood Knife",
inventory_image = "mymagic_knife_wood.png",
wield_scale = {x=1.5,y=1.5,z=0.5},
tool_capabilities = {
full_punch_interval = 1,
max_drop_level=0,
groupcaps={
snappy={times={[2]=1.6, [3]=0.40}, uses=10, maxlevel=1},
},
damage_groups = {fleshy=2},
}
})
minetest.register_tool("mymagic_tools:knife_stone",{
description = "Stone Knife",
inventory_image = "mymagic_knife_stone.png",
wield_scale = {x=1.5,y=1.5,z=0.5},
tool_capabilities = {
full_punch_interval = 1,
max_drop_level=0,
groupcaps={
snappy={times={[2]=1.4, [3]=0.40}, uses=20, maxlevel=1},
},
damage_groups = {fleshy=2},
}
})
minetest.register_tool("mymagic_tools:knife_steel",{
description = "Steel Knife",
inventory_image = "mymagic_knife_steel.png",
wield_scale = {x=1.5,y=1.5,z=0.5},
tool_capabilities = {
full_punch_interval = 0.8,
max_drop_level=1,
groupcaps={
snappy={times={[1]=2.5, [2]=1.2, [3]=0.35}, uses=30, maxlevel=1},
},
damage_groups = {fleshy=3},
}
})
minetest.register_tool("mymagic_tools:knife_bronze",{
description = "Bronze Knife",
inventory_image = "mymagic_knife_bronze.png",
wield_scale = {x=1.5,y=1.5,z=0.5},
tool_capabilities = {
full_punch_interval = 0.8,
max_drop_level=1,
groupcaps={
snappy={times={[1]=2.5, [2]=1.2, [3]=0.35}, uses=40, maxlevel=1},
},
damage_groups = {fleshy=3},
}
})
minetest.register_tool("mymagic_tools:knife_mese",{
description = "Mese Knife",
inventory_image = "mymagic_knife_mese.png",
wield_scale = {x=1.5,y=1.5,z=0.5},
tool_capabilities = {
full_punch_interval = 0.7,
max_drop_level=1,
groupcaps={
snappy={times={[1]=2, [2]=1, [3]=0.35}, uses=30, maxlevel=1},
},
damage_groups = {fleshy=4},
}
})
minetest.register_tool("mymagic_tools:knife_diamond",{
description = "Diamond Knife",
inventory_image = "mymagic_knife_diamond.png",
wield_scale = {x=1.5,y=1.5,z=0.5},
tool_capabilities = {
full_punch_interval = 0.7,
max_drop_level=1,
groupcaps={
snappy={times={[1]=1.9, [2]=0.9, [3]=0.30}, uses=40, maxlevel=1},
},
damage_groups = {fleshy=4},
}
})
minetest.register_craft({
output = 'mymagic_tools:knife_wood',
recipe = {
{'group:wood'},
{'group:wood'},
{'group:stick'},
}
})
minetest.register_craft({
output = 'mymagic_tools:knife_stone',
recipe = {
{'group:stone'},
{'group:stone'},
{'group:stick'},
}
})
minetest.register_craft({
output = 'mymagic_tools:knife_steel',
recipe = {
{'default:steel_ingot'},
{'default:steel_ingot'},
{'group:stick'},
}
})
minetest.register_craft({
output = 'mymagic_tools:knife_bronze',
recipe = {
{'mymagic_tools:knife_ingot'},
{'default:bronze_ingot'},
{'group:stick'},
}
})
minetest.register_craft({
output = 'mymagic_tools:knife_mese',
recipe = {
{'default:mese_crystal'},
{'default:mese_crystal'},
{'group:stick'},
}
})
minetest.register_craft({
output = 'mymagic_tools:knife_diamond',
recipe = {
{'default:diamond'},
{'default:diamond'},
{'group:stick'},
}
})

View File

@ -0,0 +1,72 @@
minetest.register_tool(":default:pick_wood", {
description = "Wooden Pickaxe",
inventory_image = "mymagic_pick_wood.png",
tool_capabilities = {
full_punch_interval = 1.2,
max_drop_level=0,
groupcaps={
cracky = {times={[3]=1.60}, uses=10, maxlevel=1},
},
damage_groups = {fleshy=2},
},
})
minetest.register_tool(":default:pick_stone", {
description = "Stone Pickaxe",
inventory_image = "mymagic_pick_stone.png",
tool_capabilities = {
full_punch_interval = 1.3,
max_drop_level=0,
groupcaps={
cracky = {times={[2]=2.0, [3]=1.00}, uses=20, maxlevel=1},
},
damage_groups = {fleshy=3},
},
})
minetest.register_tool(":default:pick_steel", {
description = "Steel Pickaxe",
inventory_image = "mymagic_pick_steel.png",
tool_capabilities = {
full_punch_interval = 1.0,
max_drop_level=1,
groupcaps={
cracky = {times={[1]=4.00, [2]=1.60, [3]=0.80}, uses=20, maxlevel=2},
},
damage_groups = {fleshy=4},
},
})
minetest.register_tool(":default:pick_bronze", {
description = "Bronze Pickaxe",
inventory_image = "mymagic_pick_bronze.png",
tool_capabilities = {
full_punch_interval = 1.0,
max_drop_level=1,
groupcaps={
cracky = {times={[1]=4.00, [2]=1.60, [3]=0.80}, uses=30, maxlevel=2},
},
damage_groups = {fleshy=4},
},
})
minetest.register_tool(":default:pick_mese", {
description = "Mese Pickaxe",
inventory_image = "mymagic_pick_mese.png",
tool_capabilities = {
full_punch_interval = 0.9,
max_drop_level=3,
groupcaps={
cracky = {times={[1]=2.4, [2]=1.2, [3]=0.60}, uses=20, maxlevel=3},
},
damage_groups = {fleshy=5},
},
})
minetest.register_tool(":default:pick_diamond", {
description = "Diamond Pickaxe",
inventory_image = "mymagic_pick_diamond.png",
tool_capabilities = {
full_punch_interval = 0.9,
max_drop_level=3,
groupcaps={
cracky = {times={[1]=2.0, [2]=1.0, [3]=0.50}, uses=30, maxlevel=3},
},
damage_groups = {fleshy=5},
},
})

View File

@ -0,0 +1,78 @@
minetest.register_tool(":default:shovel_wood", {
description = "Wooden Shovel",
inventory_image = "mymagic_shovel_wood.png",
wield_image = "mymagic_shovel_wood.png^[transformR90",
tool_capabilities = {
full_punch_interval = 1.2,
max_drop_level=0,
groupcaps={
crumbly = {times={[1]=3.00, [2]=1.60, [3]=0.60}, uses=10, maxlevel=1},
},
damage_groups = {fleshy=2},
},
})
minetest.register_tool(":default:shovel_stone", {
description = "Stone Shovel",
inventory_image = "mymagic_shovel_stone.png",
wield_image = "mymagic_shovel_stone.png^[transformR90",
tool_capabilities = {
full_punch_interval = 1.4,
max_drop_level=0,
groupcaps={
crumbly = {times={[1]=1.80, [2]=1.20, [3]=0.50}, uses=20, maxlevel=1},
},
damage_groups = {fleshy=2},
},
})
minetest.register_tool(":default:shovel_steel", {
description = "Steel Shovel",
inventory_image = "mymagic_shovel_steel.png",
wield_image = "mymagic_shovel_steel.png^[transformR90",
tool_capabilities = {
full_punch_interval = 1.1,
max_drop_level=1,
groupcaps={
crumbly = {times={[1]=1.50, [2]=0.90, [3]=0.40}, uses=30, maxlevel=2},
},
damage_groups = {fleshy=3},
},
})
minetest.register_tool(":default:shovel_bronze", {
description = "Bronze Shovel",
inventory_image = "mymagic_shovel_bronze.png",
wield_image = "mymagic_shovel_bronze.png^[transformR90",
tool_capabilities = {
full_punch_interval = 1.1,
max_drop_level=1,
groupcaps={
crumbly = {times={[1]=1.50, [2]=0.90, [3]=0.40}, uses=40, maxlevel=2},
},
damage_groups = {fleshy=3},
},
})
minetest.register_tool(":default:shovel_mese", {
description = "Mese Shovel",
inventory_image = "mymagic_shovel_mese.png",
wield_image = "mymagic_shovel_mese.png^[transformR90",
tool_capabilities = {
full_punch_interval = 1.0,
max_drop_level=3,
groupcaps={
crumbly = {times={[1]=1.20, [2]=0.60, [3]=0.30}, uses=20, maxlevel=3},
},
damage_groups = {fleshy=4},
},
})
minetest.register_tool(":default:shovel_diamond", {
description = "Diamond Shovel",
inventory_image = "mymagic_shovel_diamond.png",
wield_image = "mymagic_shovel_diamond.png^[transformR90",
tool_capabilities = {
full_punch_interval = 1.0,
max_drop_level=1,
groupcaps={
crumbly = {times={[1]=1.10, [2]=0.50, [3]=0.30}, uses=30, maxlevel=3},
},
damage_groups = {fleshy=4},
},
})

View File

@ -0,0 +1,78 @@
minetest.register_tool(":default:sword_wood",{
description = "Wood Sword",
inventory_image = "mymagic_sword_blade_wood.png^mymagic_sword_handle_wood.png",
wield_scale = {x=1.5,y=1.5,z=0.5},
tool_capabilities = {
full_punch_interval = 1,
max_drop_level=0,
groupcaps={
snappy={times={[2]=1.6, [3]=0.40}, uses=10, maxlevel=1},
},
damage_groups = {fleshy=2},
}
})
minetest.register_tool(":default:sword_stone",{
description = "Stone Sword",
inventory_image = "mymagic_sword_blade_stone.png^mymagic_sword_handle_wood.png",
wield_scale = {x=1.5,y=1.5,z=0.5},
tool_capabilities = {
full_punch_interval = 1,
max_drop_level=0,
groupcaps={
snappy={times={[2]=1.4, [3]=0.40}, uses=20, maxlevel=1},
},
damage_groups = {fleshy=4},
}
})
minetest.register_tool(":default:sword_steel",{
description = "Steel Sword",
inventory_image = "mymagic_sword_blade_steel.png^mymagic_sword_handle_wood.png",
wield_scale = {x=1.5,y=1.5,z=0.5},
tool_capabilities = {
full_punch_interval = 0.8,
max_drop_level=1,
groupcaps={
snappy={times={[1]=2.5, [2]=1.2, [3]=0.35}, uses=30, maxlevel=1},
},
damage_groups = {fleshy=6},
}
})
minetest.register_tool(":default:sword_bronze",{
description = "Bronze Sword",
inventory_image = "mymagic_sword_blade_bronze.png^mymagic_sword_handle_wood.png",
wield_scale = {x=1.5,y=1.5,z=0.5},
tool_capabilities = {
full_punch_interval = 0.8,
max_drop_level=1,
groupcaps={
snappy={times={[1]=2.5, [2]=1.2, [3]=0.35}, uses=40, maxlevel=1},
},
damage_groups = {fleshy=6},
}
})
minetest.register_tool(":default:sword_mese",{
description = "Mese Sword",
inventory_image = "mymagic_sword_blade_mese.png^mymagic_sword_handle_wood.png",
wield_scale = {x=1.5,y=1.5,z=0.5},
tool_capabilities = {
full_punch_interval = 0.7,
max_drop_level=1,
groupcaps={
snappy={times={[1]=2, [2]=1, [3]=0.35}, uses=30, maxlevel=1},
},
damage_groups = {fleshy=7},
}
})
minetest.register_tool(":default:sword_diamond",{
description = "Diamond Sword",
inventory_image = "mymagic_sword_blade_diamond.png^mymagic_sword_handle_wood.png",
wield_scale = {x=1.5,y=1.5,z=0.5},
tool_capabilities = {
full_punch_interval = 0.7,
max_drop_level=1,
groupcaps={
snappy={times={[1]=1.9, [2]=0.9, [3]=0.30}, uses=40, maxlevel=1},
},
damage_groups = {fleshy=8},
}
})

View File

@ -0,0 +1,3 @@
default
mymagic
3darmor?

View File

@ -0,0 +1,41 @@
local colors = {
{"diamond","Diamond","Orange","orange",16,14,55,0},
{"diamond","Diamond","Green","green",17,15,60,0},
{"diamond","Diamond","Blue","blue",18,16,65,0},
{"diamond","Diamond","Red","red",19,17,70,1},
}
for i in ipairs (colors) do
local mat = colors[i][1]
local mdes = colors[i][2]
local des = colors[i][3]
local col = colors[i][4]
local ar1 = colors[i][5]
local ar2 = colors[i][6]
local ar3 = colors[i][7]
local ar4 = colors[i][8]
minetest.register_tool("mymagic_tools:"..mat.."_helmet_"..col, {
description = mdes.." Helmet Enchanted "..des,
inventory_image = "mymagic_armor_inv_helmet_"..mat.."_"..col..".png",
groups = {armor_head=ar1, armor_heal=ar2, armor_use=ar3, armor_fire=ar4},
wear = 0,
})
minetest.register_tool("mymagic_tools:"..mat.."_chestplate_"..col, {
description = mdes.." Chestplate Enchanted "..des,
inventory_image = "mymagic_armor_inv_chestplate_"..mat.."_"..col..".png",
groups = {armor_torso=20, armor_heal=12, armor_use=50, armor_fire=ar4},
wear = 0,
})
minetest.register_tool("mymagic_tools:"..mat.."_leggings_"..col, {
description = mdes.." Leggings Enchanted "..des,
inventory_image = "mymagic_armor_inv_leggings_"..mat.."_"..col..".png",
groups = {armor_legs=20, armor_heal=12, armor_use=50, armor_fire=ar4},
wear = 0,
})
minetest.register_tool("mymagic_tools:"..mat.."_boots_"..col, {
description = mdes.." Boots Enchanted "..des,
inventory_image = "mymagic_armor_inv_boots_"..mat.."_"..col..".png",
groups = {armor_feet=15, armor_heal=12, armor_use=50, physics_speed=0.8, physics_jump=0.5, armor_fire=ar4},
wear = 0,
})
end

View File

@ -0,0 +1,83 @@
local axe = {
{"wood", "Wood", "orange", "Orange", {fleshy=3}, {[1]=2.3, [2]=1.7, [3]=1.5, [4]=1.5}, 15, 4, 0.9},
{"wood", "Wood", "green", "Green", {fleshy=4}, {[1]=2.2, [2]=1.6, [3]=1.2, [4]=1.2}, 20, 3, 0.9},
{"wood", "Wood", "blue", "Blue", {fleshy=5}, {[1]=2.1, [2]=1.5, [3]=0.9, [4]=0.9}, 25, 2, 0.9},
{"wood", "Wood", "red", "Red", {fleshy=6}, {[1]=2.0, [2]=1.4, [3]=0.6, [4]=0.6}, 30, 1, 0.9},
{"stone", "Stone", "orange", "Orange", {fleshy=5}, {[1]=2.0, [2]=1.5, [3]=1.3, [4]=1.3}, 25, 4, 0.8},
{"stone", "Stone", "green", "Green", {fleshy=6}, {[1]=1.9, [2]=1.4, [3]=1.1, [4]=1.1}, 30, 3, 0.8},
{"stone", "Stone", "blue", "Blue", {fleshy=7}, {[1]=1.8, [2]=1.3, [3]=0.8, [4]=0.8}, 35, 2, 0.8},
{"stone", "Stone", "red", "Red", {fleshy=8}, {[1]=1.7, [2]=1.2, [3]=0.6, [4]=0.6}, 40, 1, 0.8},
{"steel", "Steel", "orange", "Orange", {fleshy=7}, {[1]=1.7, [2]=1.3, [3]=1.1, [4]=1.1}, 35, 4, 0.7},
{"steel", "Steel", "green", "Green", {fleshy=8}, {[1]=1.6, [2]=1.2, [3]=0.8, [4]=0.8}, 40, 3, 0.7},
{"steel", "Steel", "blue", "Blue", {fleshy=9}, {[1]=1.5, [2]=1.1, [3]=0.6, [4]=0.6}, 45, 2, 0.7},
{"steel", "Steel", "red", "Red", {fleshy=10},{[1]=1.4, [2]=1.0, [3]=0.4, [4]=0.4}, 50, 1, 0.7},
{"bronze", "Bronze", "orange", "Orange", {fleshy=9}, {[1]=1.4, [2]=1.1, [3]=0.9, [4]=0.9}, 45, 4, 0.6},
{"bronze", "Bronze", "green", "Green", {fleshy=10},{[1]=1.3, [2]=1.0, [3]=0.8, [4]=0.8}, 50, 3, 0.6},
{"bronze", "Bronze", "blue", "Blue", {fleshy=11},{[1]=1.2, [2]=0.9, [3]=0.6, [4]=0.6}, 55, 2, 0.6},
{"bronze", "Bronze", "red", "Red", {fleshy=12},{[1]=1.1, [2]=0.8, [3]=0.4, [4]=0.4}, 60, 1, 0.6},
{"mese", "Mese", "orange", "Orange", {fleshy=11},{[1]=1.4, [2]=0.9, [3]=0.7, [4]=0.7}, 35, 4, 0.5},
{"mese", "Mese", "green", "Green", {fleshy=12},{[1]=1.2, [2]=0.8, [3]=0.6, [4]=0.6}, 40, 3, 0.5},
{"mese", "Mese", "blue", "Blue", {fleshy=13},{[1]=1.0, [2]=0.7, [3]=0.4, [4]=0.4}, 45, 2, 0.5},
{"mese", "Mese", "red", "Red", {fleshy=14},{[1]=0.8, [2]=0.6, [3]=0.2, [4]=0.2}, 50, 1, 0.5},
{"diamond", "Diamond", "orange", "Orange", {fleshy=13},{[1]=0.8, [2]=0.7, [3]=0.5, [4]=0.5}, 50, 4, 0.4},
{"diamond", "Diamond", "green", "Green", {fleshy=14},{[1]=0.6, [2]=0.6, [3]=0.4, [4]=0.4}, 60, 3, 0.4},
{"diamond", "Diamond", "blue", "Blue", {fleshy=15},{[1]=0.4, [2]=0.4, [3]=0.3, [4]=0.3}, 70, 2, 0.3},
{"diamond", "Diamond", "red", "Red", {fleshy=16},{[1]=0.2, [2]=0.2, [3]=0.2, [4]=0.2}, 80, 1, 0.3},
}
for i in ipairs (axe) do
local mat = axe[i][1]
local mdes = axe[i][2]
local col = axe[i][3]
local cdes = axe[i][4]
local fles = axe[i][5]
local gro = axe[i][6]
local us = axe[i][7]
local ml = axe[i][8]
local fp = axe[i][9]
minetest.register_tool("mymagic_tools:axe_enchanted_"..mat.."_"..col,{
description = "Enchanted "..mdes.." Axe - "..cdes,
inventory_image = "mymagic_axe_"..col..".png^mymagic_axe_handle_"..mat..".png^mymagic_leather_grip.png",
wield_scale = {x=1,y=1.5,z=0.5},
tool_capabilities = {
full_punch_interval = fp,
max_drop_level=1,
groupcaps={
choppy = {times = gro, uses = us, maxlevel=ml},
magic_axe = {times = gro, uses = us, maxlevel=ml},
},
damage_groups = fles,
},
groups = {not_in_creative_inventory = 1}
})
end
--[[
function = op(itemstack, placer, pointed_thing)
local node = pointed_thing.above
if pointed_thing.type ~= "node" then
return
end
--]]

View File

@ -0,0 +1,55 @@
local knife = {
{"wood", "Wood", "orange", "Orange", {fleshy=3}, {times={ [4]=1.5}, uses=15, maxlevel=4},4},
{"wood", "Wood", "green", "Green", {fleshy=4}, {times={ [3]=1.2, [4]=1.2}, uses=20, maxlevel=3},3},
{"wood", "Wood", "blue", "Blue", {fleshy=5}, {times={ [2]=1.5, [3]=1.2, [4]=0.9}, uses=25, maxlevel=2},2},
{"wood", "Wood", "red", "Red", {fleshy=6}, {times={[1]=2.0, [2]=1.4, [3]=1.2, [4]=0.6}, uses=30, maxlevel=1},1},
{"stone", "Stone", "orange", "Orange", {fleshy=5}, {times={ [4]=1.3}, uses=25, maxlevel=4},4},
{"stone", "Stone", "green", "Green", {fleshy=6}, {times={ [3]=1.0, [4]=1.1}, uses=30, maxlevel=3},3},
{"stone", "Stone", "blue", "Blue", {fleshy=7}, {times={ [2]=1.3, [3]=1.0, [4]=0.8}, uses=35, maxlevel=2},2},
{"stone", "Stone", "red", "Red", {fleshy=8}, {times={[1]=1.7, [2]=1.2, [3]=1.0, [4]=0.6}, uses=40, maxlevel=1},1},
{"steel", "Steel", "orange", "Orange", {fleshy=7}, {times={ [4]=1.1}, uses=35, maxlevel=4},4},
{"steel", "Steel", "green", "Green", {fleshy=8}, {times={ [3]=0.8, [4]=0.8}, uses=40, maxlevel=3},3},
{"steel", "Steel", "blue", "Blue", {fleshy=9}, {times={ [2]=1.1, [3]=0.8, [4]=0.6}, uses=45, maxlevel=2},2},
{"steel", "Steel", "red", "Red", {fleshy=10},{times={[1]=1.4, [2]=1.0, [3]=0.8, [4]=0.4}, uses=50, maxlevel=1},1},
{"bronze", "Bronze", "orange", "Orange", {fleshy=7}, {times={ [4]=0.9}, uses=45, maxlevel=4},4},
{"bronze", "Bronze", "green", "Green", {fleshy=8}, {times={ [3]=0.6, [4]=0.8}, uses=50, maxlevel=3},3},
{"bronze", "Bronze", "blue", "Blue", {fleshy=9}, {times={ [2]=0.9, [3]=0.6, [4]=0.6}, uses=55, maxlevel=2},2},
{"bronze", "Bronze", "red", "Red", {fleshy=10},{times={[1]=1.1, [2]=0.8, [3]=0.6, [4]=0.4}, uses=60, maxlevel=1},1},
{"mese", "Mese", "orange", "Orange", {fleshy=8}, {times={ [4]=0.7}, uses=35, maxlevel=4},4},
{"mese", "Mese", "green", "Green", {fleshy=9}, {times={ [3]=0.4, [4]=0.6}, uses=40, maxlevel=3},3},
{"mese", "Mese", "blue", "Blue", {fleshy=10},{times={ [2]=0.7, [3]=0.4, [4]=0.4}, uses=45, maxlevel=2},2},
{"mese", "Mese", "red", "Red", {fleshy=11},{times={[1]=0.8, [2]=0.6, [3]=0.4, [4]=0.2}, uses=50, maxlevel=1},1},
{"diamond", "Diamond", "orange", "Orange", {fleshy=10},{times={ [4]=0.5}, uses=50, maxlevel=4},4},
{"diamond", "Diamond", "green", "Green", {fleshy=12},{times={ [3]=0.3, [4]=0.4}, uses=60, maxlevel=3},3},
{"diamond", "Diamond", "blue", "Blue", {fleshy=15},{times={ [2]=0.5, [3]=0.3, [4]=0.3}, uses=70, maxlevel=2},2},
{"diamond", "Diamond", "red", "Red", {fleshy=20},{times={[1]=0.5, [2]=0.4, [3]=0.3, [4]=0.2}, uses=80, maxlevel=1},1},
}
for i in ipairs (knife) do
local mat = knife[i][1]
local mdes = knife[i][2]
local col = knife[i][3]
local cdes = knife[i][4]
local fles = knife[i][5]
local gro = knife[i][6]
local mag = knife[i][7]
minetest.register_tool("mymagic_tools:knife_enchanted_"..mat.."_"..col,{
description = "Enchanted "..mdes.." Knife - "..cdes,
inventory_image = "mymagic_knife_"..col..".png",
wield_scale = {x=1,y=1.5,z=0.5},
tool_capabilities = {
full_punch_interval = 0.7,
max_drop_level=1,
groupcaps={
snappy=gro,
},
damage_groups = fles,
},
groups = {not_in_creative_inventory = 1,magic_knife = mag}
})
end

View File

@ -0,0 +1,69 @@
local picks = {
{"wood", "Wood", "orange", "Orange", {fleshy=3}, {[1]=2.3, [2]=1.7, [3]=1.5, [4]=1.5}, 15, 4, 0.9},
{"wood", "Wood", "green", "Green", {fleshy=4}, {[1]=2.2, [2]=1.6, [3]=1.2, [4]=1.2}, 20, 3, 0.9},
{"wood", "Wood", "blue", "Blue", {fleshy=5}, {[1]=2.1, [2]=1.5, [3]=0.9, [4]=0.9}, 25, 2, 0.9},
{"wood", "Wood", "red", "Red", {fleshy=6}, {[1]=2.0, [2]=1.4, [3]=0.6, [4]=0.6}, 30, 1, 0.9},
{"stone", "Stone", "orange", "Orange", {fleshy=5}, {[1]=2.0, [2]=1.5, [3]=1.3, [4]=1.3}, 25, 4, 0.8},
{"stone", "Stone", "green", "Green", {fleshy=6}, {[1]=1.9, [2]=1.4, [3]=1.1, [4]=1.1}, 30, 3, 0.8},
{"stone", "Stone", "blue", "Blue", {fleshy=7}, {[1]=1.8, [2]=1.3, [3]=0.8, [4]=0.8}, 35, 2, 0.8},
{"stone", "Stone", "red", "Red", {fleshy=8}, {[1]=1.7, [2]=1.2, [3]=0.6, [4]=0.6}, 40, 1, 0.8},
{"steel", "Steel", "orange", "Orange", {fleshy=7}, {[1]=1.7, [2]=1.3, [3]=1.1, [4]=1.1}, 35, 4, 0.7},
{"steel", "Steel", "green", "Green", {fleshy=8}, {[1]=1.6, [2]=1.2, [3]=0.8, [4]=0.8}, 40, 3, 0.7},
{"steel", "Steel", "blue", "Blue", {fleshy=9}, {[1]=1.5, [2]=1.1, [3]=0.6, [4]=0.6}, 45, 2, 0.7},
{"steel", "Steel", "red", "Red", {fleshy=10},{[1]=1.4, [2]=1.0, [3]=0.4, [4]=0.4}, 50, 1, 0.7},
{"bronze", "Bronze", "orange", "Orange", {fleshy=9}, {[1]=1.4, [2]=1.1, [3]=0.9, [4]=0.9}, 45, 4, 0.6},
{"bronze", "Bronze", "green", "Green", {fleshy=10},{[1]=1.3, [2]=1.0, [3]=0.8, [4]=0.8}, 50, 3, 0.6},
{"bronze", "Bronze", "blue", "Blue", {fleshy=11},{[1]=1.2, [2]=0.9, [3]=0.6, [4]=0.6}, 55, 2, 0.6},
{"bronze", "Bronze", "red", "Red", {fleshy=12},{[1]=1.1, [2]=0.8, [3]=0.4, [4]=0.4}, 60, 1, 0.6},
{"mese", "Mese", "orange", "Orange", {fleshy=11},{[1]=1.4, [2]=0.9, [3]=0.7, [4]=0.7}, 35, 4, 0.5},
{"mese", "Mese", "green", "Green", {fleshy=12},{[1]=1.2, [2]=0.8, [3]=0.6, [4]=0.6}, 40, 3, 0.5},
{"mese", "Mese", "blue", "Blue", {fleshy=13},{[1]=1.0, [2]=0.7, [3]=0.4, [4]=0.4}, 45, 2, 0.5},
{"mese", "Mese", "red", "Red", {fleshy=14},{[1]=0.8, [2]=0.6, [3]=0.2, [4]=0.2}, 50, 1, 0.5},
{"diamond", "Diamond", "orange", "Orange", {fleshy=13},{[1]=0.8, [2]=0.7, [3]=0.5, [4]=0.5}, 50, 4, 0.4},
{"diamond", "Diamond", "green", "Green", {fleshy=14},{[1]=0.6, [2]=0.6, [3]=0.4, [4]=0.4}, 60, 3, 0.4},
{"diamond", "Diamond", "blue", "Blue", {fleshy=15},{[1]=0.4, [2]=0.4, [3]=0.3, [4]=0.3}, 70, 2, 0.3},
{"diamond", "Diamond", "red", "Red", {fleshy=16},{[1]=0.2, [2]=0.2, [3]=0.2, [4]=0.2}, 80, 1, 0.3},
}
for i in ipairs (picks) do
local mat = picks[i][1]
local mdes = picks[i][2]
local col = picks[i][3]
local cdes = picks[i][4]
local fles = picks[i][5]
local gro = picks[i][6]
local us = picks[i][7]
local ml = picks[i][8]
local fp = picks[i][9]
minetest.register_tool("mymagic_tools:pick_enchanted_"..mat.."_"..col,{
description = "Enchanted "..mdes.." Pick - "..cdes,
inventory_image = "mymagic_pick_"..col..".png^mymagic_axe_handle_"..mat..".png^mymagic_leather_grip.png",
wield_scale = {x=1,y=1.5,z=1.5},
tool_capabilities = {
full_punch_interval = fp,
max_drop_level=1,
groupcaps={
cracky = {times = gro, uses = us, maxlevel=ml},
magic_pick = {times = gro, uses = us, maxlevel=ml},
},
damage_groups = fles,
},
groups = {not_in_creative_inventory = 1},
on_place = function(itemstack, placer, pointed_thing)
minetest.set_node(pointed_thing.above,{name = "default:cobble"})
end
})
end

View File

@ -0,0 +1,62 @@
local shov = {
{"wood", "Wood", "orange", "Orange", {fleshy=3}, {[1]=2.3, [2]=1.7, [3]=1.5, [4]=1.5}, 15, 4, 0.9},
{"wood", "Wood", "green", "Green", {fleshy=4}, {[1]=2.2, [2]=1.6, [3]=1.2, [4]=1.2}, 20, 3, 0.9},
{"wood", "Wood", "blue", "Blue", {fleshy=5}, {[1]=2.1, [2]=1.5, [3]=0.9, [4]=0.9}, 25, 2, 0.9},
{"wood", "Wood", "red", "Red", {fleshy=6}, {[1]=2.0, [2]=1.4, [3]=0.6, [4]=0.6}, 30, 1, 0.9},
{"stone", "Stone", "orange", "Orange", {fleshy=5}, {[1]=2.0, [2]=1.5, [3]=1.3, [4]=1.3}, 25, 4, 0.8},
{"stone", "Stone", "green", "Green", {fleshy=6}, {[1]=1.9, [2]=1.4, [3]=1.1, [4]=1.1}, 30, 3, 0.8},
{"stone", "Stone", "blue", "Blue", {fleshy=7}, {[1]=1.8, [2]=1.3, [3]=0.8, [4]=0.8}, 35, 2, 0.8},
{"stone", "Stone", "red", "Red", {fleshy=8}, {[1]=1.7, [2]=1.2, [3]=0.6, [4]=0.6}, 40, 1, 0.8},
{"steel", "Steel", "orange", "Orange", {fleshy=7}, {[1]=1.7, [2]=1.3, [3]=1.1, [4]=1.1}, 35, 4, 0.7},
{"steel", "Steel", "green", "Green", {fleshy=8}, {[1]=1.6, [2]=1.2, [3]=0.8, [4]=0.8}, 40, 3, 0.7},
{"steel", "Steel", "blue", "Blue", {fleshy=9}, {[1]=1.5, [2]=1.1, [3]=0.6, [4]=0.6}, 45, 2, 0.7},
{"steel", "Steel", "red", "Red", {fleshy=10},{[1]=1.4, [2]=1.0, [3]=0.4, [4]=0.4}, 50, 1, 0.7},
{"bronze", "Bronze", "orange", "Orange", {fleshy=9}, {[1]=1.4, [2]=1.1, [3]=0.9, [4]=0.9}, 45, 4, 0.6},
{"bronze", "Bronze", "green", "Green", {fleshy=10},{[1]=1.3, [2]=1.0, [3]=0.8, [4]=0.8}, 50, 3, 0.6},
{"bronze", "Bronze", "blue", "Blue", {fleshy=11},{[1]=1.2, [2]=0.9, [3]=0.6, [4]=0.6}, 55, 2, 0.6},
{"bronze", "Bronze", "red", "Red", {fleshy=12},{[1]=1.1, [2]=0.8, [3]=0.4, [4]=0.4}, 60, 1, 0.6},
{"mese", "Mese", "orange", "Orange", {fleshy=11},{[1]=1.4, [2]=0.9, [3]=0.7, [4]=0.7}, 35, 4, 0.5},
{"mese", "Mese", "green", "Green", {fleshy=12},{[1]=1.2, [2]=0.8, [3]=0.6, [4]=0.6}, 40, 3, 0.5},
{"mese", "Mese", "blue", "Blue", {fleshy=13},{[1]=1.0, [2]=0.7, [3]=0.4, [4]=0.4}, 45, 2, 0.5},
{"mese", "Mese", "red", "Red", {fleshy=14},{[1]=0.8, [2]=0.6, [3]=0.2, [4]=0.2}, 50, 1, 0.5},
{"diamond", "Diamond", "orange", "Orange", {fleshy=13},{[1]=0.8, [2]=0.7, [3]=0.5, [4]=0.5}, 50, 4, 0.4},
{"diamond", "Diamond", "green", "Green", {fleshy=14},{[1]=0.6, [2]=0.6, [3]=0.4, [4]=0.4}, 60, 3, 0.4},
{"diamond", "Diamond", "blue", "Blue", {fleshy=15},{[1]=0.4, [2]=0.4, [3]=0.3, [4]=0.3}, 70, 2, 0.3},
{"diamond", "Diamond", "red", "Red", {fleshy=16},{[1]=0.2, [2]=0.2, [3]=0.2, [4]=0.2}, 80, 1, 0.3},
}
for i in ipairs (shov) do
local mat = shov[i][1]
local mdes = shov[i][2]
local col = shov[i][3]
local cdes = shov[i][4]
local fles = shov[i][5]
local gro = shov[i][6]
local us = shov[i][7]
local ml = shov[i][8]
local fp = shov[i][9]
minetest.register_tool("mymagic_tools:shovel_enchanted_"..mat.."_"..col,{
description = "Enchanted "..mdes.." Shovel - "..cdes,
inventory_image = "mymagic_shovel_"..col..".png^mymagic_axe_handle_"..mat..".png^mymagic_leather_grip.png",
wield_image = "mymagic_shovel_"..col..".png^mymagic_axe_handle_"..mat..".png^mymagic_leather_grip.png^[transformR90",
wield_scale = {x=1,y=1.5,z=1},
tool_capabilities = {
full_punch_interval = fp,
max_drop_level=1,
groupcaps={
crumbly = {times = gro, uses = us, maxlevel=ml},
magic_shovel = {times = gro, uses = us, maxlevel=ml},
},
damage_groups = fles,
},
groups = {not_in_creative_inventory = 1},
on_place = function(itemstack, placer, pointed_thing)
minetest.set_node(pointed_thing.above,{name = "default:dirt"})
end
})
end

View File

@ -0,0 +1,61 @@
local swrds = {
{"wood", "Wood", "orange", "Orange", {fleshy=3}, {[1]=2.3, [2]=1.7, [3]=1.5, [4]=1.5}, 15, 4, 0.9},
{"wood", "Wood", "green", "Green", {fleshy=4}, {[1]=2.2, [2]=1.6, [3]=1.2, [4]=1.2}, 20, 3, 0.9},
{"wood", "Wood", "blue", "Blue", {fleshy=5}, {[1]=2.1, [2]=1.5, [3]=0.9, [4]=0.9}, 25, 2, 0.9},
{"wood", "Wood", "red", "Red", {fleshy=6}, {[1]=2.0, [2]=1.4, [3]=0.6, [4]=0.6}, 30, 1, 0.9},
{"stone", "Stone", "orange", "Orange", {fleshy=5}, {[1]=2.0, [2]=1.5, [3]=1.3, [4]=1.3}, 25, 4, 0.8},
{"stone", "Stone", "green", "Green", {fleshy=6}, {[1]=1.9, [2]=1.4, [3]=1.1, [4]=1.1}, 30, 3, 0.8},
{"stone", "Stone", "blue", "Blue", {fleshy=7}, {[1]=1.8, [2]=1.3, [3]=0.8, [4]=0.8}, 35, 2, 0.8},
{"stone", "Stone", "red", "Red", {fleshy=8}, {[1]=1.7, [2]=1.2, [3]=0.6, [4]=0.6}, 40, 1, 0.8},
{"steel", "Steel", "orange", "Orange", {fleshy=7}, {[1]=1.7, [2]=1.3, [3]=1.1, [4]=1.1}, 35, 4, 0.7},
{"steel", "Steel", "green", "Green", {fleshy=8}, {[1]=1.6, [2]=1.2, [3]=0.8, [4]=0.8}, 40, 3, 0.7},
{"steel", "Steel", "blue", "Blue", {fleshy=9}, {[1]=1.5, [2]=1.1, [3]=0.6, [4]=0.6}, 45, 2, 0.7},
{"steel", "Steel", "red", "Red", {fleshy=10},{[1]=1.4, [2]=1.0, [3]=0.4, [4]=0.4}, 50, 1, 0.7},
{"bronze", "Bronze", "orange", "Orange", {fleshy=9}, {[1]=1.4, [2]=1.1, [3]=0.9, [4]=0.9}, 45, 4, 0.6},
{"bronze", "Bronze", "green", "Green", {fleshy=10},{[1]=1.3, [2]=1.0, [3]=0.8, [4]=0.8}, 50, 3, 0.6},
{"bronze", "Bronze", "blue", "Blue", {fleshy=11},{[1]=1.2, [2]=0.9, [3]=0.6, [4]=0.6}, 55, 2, 0.6},
{"bronze", "Bronze", "red", "Red", {fleshy=12},{[1]=1.1, [2]=0.8, [3]=0.4, [4]=0.4}, 60, 1, 0.6},
{"mese", "Mese", "orange", "Orange", {fleshy=11},{[1]=1.4, [2]=0.9, [3]=0.7, [4]=0.7}, 35, 4, 0.5},
{"mese", "Mese", "green", "Green", {fleshy=12},{[1]=1.2, [2]=0.8, [3]=0.6, [4]=0.6}, 40, 3, 0.5},
{"mese", "Mese", "blue", "Blue", {fleshy=13},{[1]=1.0, [2]=0.7, [3]=0.4, [4]=0.4}, 45, 2, 0.5},
{"mese", "Mese", "red", "Red", {fleshy=14},{[1]=0.8, [2]=0.6, [3]=0.2, [4]=0.2}, 50, 1, 0.5},
{"diamond", "Diamond", "orange", "Orange", {fleshy=13},{[1]=0.8, [2]=0.7, [3]=0.5, [4]=0.5}, 50, 4, 0.4},
{"diamond", "Diamond", "green", "Green", {fleshy=14},{[1]=0.6, [2]=0.6, [3]=0.4, [4]=0.4}, 60, 3, 0.4},
{"diamond", "Diamond", "blue", "Blue", {fleshy=15},{[1]=0.4, [2]=0.4, [3]=0.3, [4]=0.3}, 70, 2, 0.3},
{"diamond", "Diamond", "red", "Red", {fleshy=16},{[1]=0.2, [2]=0.2, [3]=0.2, [4]=0.2}, 80, 1, 0.3},
}
for i in ipairs (swrds) do
local mat = swrds[i][1]
local mdes = swrds[i][2]
local col = swrds[i][3]
local cdes = swrds[i][4]
local fles = swrds[i][5]
local gro = swrds[i][6]
local us = swrds[i][7]
local ml = swrds[i][8]
local fp = swrds[i][9]
minetest.register_tool("mymagic_tools:sword_enchanted_"..mat.."_"..col,{
description = "Enchanted "..mdes.." Sword - "..cdes,
inventory_image = "mymagic_sword_handle_"..mat.."_enchanted.png^mymagic_sword_blade_"..col..".png",
wield_scale = {x=1.5,y=1.5,z=0.5},
tool_capabilities = {
full_punch_interval = fp,
max_drop_level=1,
groupcaps={
snappy = {times = gro, uses = us, maxlevel=ml},
magic_sword = {times = gro, uses = us, maxlevel=ml},
},
damage_groups = fles,
},
groups = {not_in_creative_inventory = 1,magic_sword = mag},
on_place = function(itemstack, placer, pointed_thing)
minetest.set_node(pointed_thing.above,{name = "default:dirt"})
end
})
end

View File

@ -0,0 +1,246 @@
local helmet = {}
local make_helmet = false
local chest = {}
local make_chest = false
local pants = {}
local make_pants = false
local boots = {}
local make_boots = false
minetest.register_node("mymagic_tools:forge_armor",{
description = "Armor Forge",
tiles = {
{name="mymagic_forge_top.png", animation={type="vertical_frames",aspect_w=16, aspect_h=16, length=0.3}},
"mymagic_forge_back.png",
"mymagic_forge_side.png^[transformFX",
"mymagic_forge_side.png",
"mymagic_forge_back.png",
{name="mymagic_forge_front_armor.png", animation={type="vertical_frames",aspect_w=16, aspect_h=16, length=0.3}},
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
light_source = 14,
groups = {cracky=1},
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.375, -0.375, 0.5, 0.375},
{-0.5, -0.5, 0.375, 0.5, 0.5, 0.5},
{0.375, -0.5, -0.375, 0.5, 0.5, 0.375},
{-0.5, -0.5, -0.5, 0.5, 0.25, -0.375},
{-0.375, -0.5, -0.375, 0.375, 0.3125, 0.375},
{-0.375, -0.5, -0.3125, 0.375, 0.375, 0.375},
}
},
after_place_node = function(pos, placer)
local meta = minetest.get_meta(pos);
meta:set_string("infotext", "Armor Forge");
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
if not inv:is_empty("input") then
return false
elseif not inv:is_empty("output") then
return false
end
return true
end,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", "size[11,4;]"..
"background[-0.5,-0.5;12,5;mymagic_forge_bg.png]"..
"listcolors[#191515;#464545;#000000]"..
"label[0,0;Input]"..
"list[current_name;input;0,0.5;1,1;]"..
"image_button[1.5,0;1,1;3d_armor_inv_helmet_diamond.png;helmet;x5]"..
"image_button[1.5,1;1,1;3d_armor_inv_chestplate_diamond.png;chest;x6]"..
"image_button[1.5,2;1,1;3d_armor_inv_leggings_diamond.png;pants;x5]"..
"image_button[1.5,3;1,1;3d_armor_inv_boots_diamond.png;boots;x4]"..
--output
"label[0,2.5;Output]"..
"list[current_name;output;0,3;1,1;]"..
--Show Inventory
"list[current_player;main;3,0;8,4;]")
meta:set_string("infotext", "Armor Forge")
local inv = meta:get_inventory()
inv:set_size("input", 1)
inv:set_size("output", 1)
end,
on_receive_fields = function(pos, formname, fields, sender)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local istack = inv:get_stack("input",1)
if fields["helmet"]then
make_helmet = false
local siz = istack:get_count("input")
if siz <= 4 then
minetest.chat_send_player(sender:get_player_name(), "You need 5 items to make a Helmet!")
return
end
if inv:is_empty("output") == false then
return
end
local helmets = {
{"default:wood", "3d_armor:helmet_wood"},
{"default:cactus", "3d_armor:helmet_cactus"},
{"default:steel_ingot", "3d_armor:helmet_steel"},
{"default:bronze_ingot", "3d_armor:helmet_bronze"},
{"default:gold_ingot", "3d_armor:helmet_diamond"},
{"default:diamond", "3d_armor:helmet_gold"},
}
for i in ipairs (helmets) do
local mat = helmets[i][1]
local arm = helmets[i][2]
if istack:get_name() == mat then
helmet = arm
make_helmet = true
end
end
if make_helmet == true then
inv:add_item("output",helmet)
istack:take_item(5)
inv:set_stack("input",1,istack)
end
elseif fields["chest"]then
make_chest = false
local siz = istack:get_count("input")
if siz <= 5 then
minetest.chat_send_player(sender:get_player_name(), "You need 6 items to make a Chestplate!")
return
end
if inv:is_empty("output") == false then
return
end
local chests = {
{"default:wood", "3d_armor:chestplate_wood"},
{"default:cactus", "3d_armor:chestplate_cactus"},
{"default:steel_ingot", "3d_armor:chestplate_steel"},
{"default:bronze_ingot", "3d_armor:chestplate_bronze"},
{"default:gold_ingot", "3d_armor:chestplate_diamond"},
{"default:diamond", "3d_armor:chestplate_gold"},
}
for i in ipairs (chests) do
local mat = chests[i][1]
local arm = chests[i][2]
if istack:get_name() == mat then
chest = arm
make_chest = true
end
end
if make_chest == true then
inv:add_item("output",chest)
istack:take_item(6)
inv:set_stack("input",1,istack)
end
elseif fields["pants"]then
make_pants = false
local siz = istack:get_count("input")
if siz <= 4 then
minetest.chat_send_player(sender:get_player_name(), "You need 5 items to make Leggings!")
return
end
if inv:is_empty("output") == false then
return
end
local pant = {
{"default:wood", "3d_armor:leggings_wood"},
{"default:cactus", "3d_armor:leggings_cactus"},
{"default:steel_ingot", "3d_armor:leggings_steel"},
{"default:bronze_ingot", "3d_armor:leggings_bronze"},
{"default:gold_ingot", "3d_armor:leggings_diamond"},
{"default:diamond", "3d_armor:leggings_gold"},
}
for i in ipairs (pant) do
local mat = pant[i][1]
local arm = pant[i][2]
if istack:get_name() == mat then
pants = arm
make_pants = true
end
end
if make_pants == true then
inv:add_item("output",pants)
istack:take_item(5)
inv:set_stack("input",1,istack)
end
elseif fields["boots"]then
make_boots = false
local siz = istack:get_count("input")
if siz <= 3 then
minetest.chat_send_player(sender:get_player_name(), "You need 4 items to make Boots!")
return
end
if inv:is_empty("output") == false then
return
end
local boot = {
{"default:wood", "3d_armor:boots_wood"},
{"default:cactus", "3d_armor:boots_cactus"},
{"default:steel_ingot", "3d_armor:boots_steel"},
{"default:bronze_ingot", "3d_armor:boots_bronze"},
{"default:gold_ingot", "3d_armor:boots_diamond"},
{"default:diamond", "3d_armor:boots_gold"},
}
for i in ipairs (boot) do
local mat = boot[i][1]
local arm = boot[i][2]
if istack:get_name() == mat then
boots = arm
make_boots = true
end
end
if make_boots == true then
inv:add_item("output",boots)
istack:take_item(4)
inv:set_stack("input",1,istack)
end
end
end,
})
minetest.register_craft({
output = "mymagic_tools:forge_armor",
recipe = {
{"default:steel_ingot","default:coalblock","default:steel_ingot"},
{"default:steel_ingot","default:clay","default:steel_ingot"},
{"default:steel_ingot","default:steel_ingot","default:steel_ingot"}
},
})

211
mymagic_tools/forge_axe.lua Normal file
View File

@ -0,0 +1,211 @@
local blade = {}
local make_blade = false
local handle = {}
local make_handle = false
local axe = {}
local make_axe = false
minetest.register_node("mymagic_tools:axe_forge",{
description = "Axe Forge",
tiles = {
{name="mymagic_forge_top.png", animation={type="vertical_frames",aspect_w=16, aspect_h=16, length=0.3}},
"mymagic_forge_back.png",
"mymagic_forge_side.png^[transformFX",
"mymagic_forge_side.png",
"mymagic_forge_back.png",
{name="mymagic_forge_front_axe.png", animation={type="vertical_frames",aspect_w=16, aspect_h=16, length=0.3}},
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
light_source = 14,
groups = {creative_breakable=1},
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.375, -0.375, 0.5, 0.375},
{-0.5, -0.5, 0.375, 0.5, 0.5, 0.5},
{0.375, -0.5, -0.375, 0.5, 0.5, 0.375},
{-0.5, -0.5, -0.5, 0.5, 0.25, -0.375},
{-0.375, -0.5, -0.375, 0.375, 0.3125, 0.375},
{-0.375, -0.5, -0.3125, 0.375, 0.375, 0.375},
}
},
after_place_node = function(pos, placer)
local meta = minetest.get_meta(pos);
meta:set_string("infotext", "Axe Forge");
end,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", "size[9,10;]"..
"background[-0.15,-0.25;9.40,10.75;mymagic_forge_bg.png]"..
"listcolors[#191515;#464545;#000000]"..
--Blade
"label[1,1.5;Blade]"..
"list[current_name;blade1;3,1.5;1,1;]"..
"list[current_name;blade2;2,1;1,1;]"..
"list[current_name;blade3;2,2;1,1;]"..
"button[2,3.5;1,1;bbutton;Make]"..
"list[current_name;blade;2,4.5;1,1;]"..
--Handle
"label[4.5,1.5;Handle]"..
"list[current_name;handle1;6,0.5;1,1;]"..
"list[current_name;handle2;6,1.5;1,1;]"..
"list[current_name;handle3;6,2.5;1,1;]"..
"button[6,3.5;1,1;hbutton;Make]"..
"list[current_name;handle;3,4.5;1,1;]"..
--Axe
"button[4,4.5;2,1;abutton;Make]"..
"list[current_name;axe;6,4.5;1,1;]"..
--Show Inventory
"list[current_player;main;0.5,6;8,4;]")
meta:set_string("infotext", "Axe Forge")
local inv = meta:get_inventory()
inv:set_size("blade", 1)
inv:set_size("blade1", 1)
inv:set_size("blade2", 1)
inv:set_size("blade3", 1)
inv:set_size("handle", 1)
inv:set_size("handle1", 1)
inv:set_size("handle2", 1)
inv:set_size("handle3", 1)
inv:set_size("axe", 1)
end,
on_receive_fields = function(pos, formname, fields, sender)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
if fields["bbutton"]then
make_blade = false
if inv:is_empty("blade1") or
inv:is_empty("blade2") or
inv:is_empty("blade3") then
return
end
local b1 = inv:get_stack("blade1", 1)
local b2 = inv:get_stack("blade2", 1)
local b3 = inv:get_stack("blade3", 1)
local blade_list = {
{"default:wood", "mymagic_tools:axe_blade_wood"},
{"default:stone", "mymagic_tools:axe_blade_stone"},
{"default:steel_ingot", "mymagic_tools:axe_blade_steel"},
{"default:bronze_ingot", "mymagic_tools:axe_blade_bronze"},
{"default:mese_crystal", "mymagic_tools:axe_blade_mese"},
{"default:diamond", "mymagic_tools:axe_blade_diamond"},
}
for i in ipairs (blade_list) do
local mat = blade_list[i][1]
local bld = blade_list[i][2]
if b1:get_name() == mat and
b2:get_name() == mat and
b3:get_name() == mat then
blade = bld
make_blade = true
end
end
if make_blade == true then
inv:add_item("blade",blade)
b1:take_item()
inv:set_stack("blade1",1,b1)
b2:take_item()
inv:set_stack("blade2",1,b2)
b3:take_item()
inv:set_stack("blade3",1,b3)
end
elseif fields["hbutton"]then
make_handle = false
if inv:is_empty("handle1") or
inv:is_empty("handle2") or
inv:is_empty("handle3") then
return
end
local h1 = inv:get_stack("handle1", 1)
local h2 = inv:get_stack("handle2", 1)
local h3 = inv:get_stack("handle3", 1)
if h1:get_name() == "default:stick" and
h2:get_name() == "default:stick" and
h3:get_name() == "default:stick" then
handle = "mymagic_tools:axe_handle"
make_handle = true
end
if make_handle == true then
inv:add_item("handle",handle)
h1:take_item()
inv:set_stack("handle1",1,h1)
h2:take_item()
inv:set_stack("handle2",1,h2)
h3:take_item()
inv:set_stack("handle3",1,h3)
end
elseif fields["abutton"]then
make_sword = false
if inv:is_empty("blade") or
inv:is_empty("handle") then
return
end
local s1 = inv:get_stack("blade", 1)
local s2 = inv:get_stack("handle", 1)
local maters = {"wood","stone","steel","bronze","mese","diamond"}
for i=1,#maters do
local mater = maters[i]
if s1:get_name() == "mymagic_tools:axe_blade_"..mater and
s2:get_name() == "mymagic_tools:axe_handle" then
axe = "default:axe_"..mater
make_axe = true
end
end
if make_axe == true then
inv:add_item("axe",axe)
s1:take_item()
inv:set_stack("blade",1,s1)
s2:take_item()
inv:set_stack("handle",1,s2)
end
end
end,
})

View File

@ -0,0 +1,251 @@
local blade = {}
local make_blade = false
local handle = {}
local make_handle = false
local sword = {}
local make_sword = false
minetest.register_node("mymagic_tools:forge_sword",{
description = "Sword Forge",
tiles = {
{name="mymagic_forge_top.png", animation={type="vertical_frames",aspect_w=16, aspect_h=16, length=0.3}},
"mymagic_forge_back.png",
"mymagic_forge_side.png^[transformFX",
"mymagic_forge_side.png",
"mymagic_forge_back.png",
{name="mymagic_forge_front_sword.png", animation={type="vertical_frames",aspect_w=16, aspect_h=16, length=0.3}},
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
light_source = 14,
groups = {cracky=1},
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.375, -0.375, 0.5, 0.375},
{-0.5, -0.5, 0.375, 0.5, 0.5, 0.5},
{0.375, -0.5, -0.375, 0.5, 0.5, 0.375},
{-0.5, -0.5, -0.5, 0.5, 0.25, -0.375},
{-0.375, -0.5, -0.375, 0.375, 0.3125, 0.375},
{-0.375, -0.5, -0.3125, 0.375, 0.375, 0.375},
}
},
after_place_node = function(pos, placer)
local meta = minetest.get_meta(pos);
meta:set_string("infotext", "Sword Forge");
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
if not inv:is_empty("blade") then
return false
elseif not inv:is_empty("blade1") then
return false
elseif not inv:is_empty("blade2") then
return false
elseif not inv:is_empty("blade3") then
return false
elseif not inv:is_empty("handle") then
return false
elseif not inv:is_empty("handle1") then
return false
elseif not inv:is_empty("handle2") then
return false
elseif not inv:is_empty("handle3") then
return false
elseif not inv:is_empty("sword") then
return false
end
return true
end,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", "size[9,10;]"..
"background[-0.15,-0.25;9.40,10.75;mymagic_forge_bg.png]"..
"listcolors[#191515;#464545;#000000]"..
--Blade
"label[1,1.5;Blade]"..
"list[current_name;blade1;2,0.5;1,1;]"..
"list[current_name;blade2;2,1.5;1,1;]"..
"list[current_name;blade3;2,2.5;1,1;]"..
"button[2,3.5;1,1;bbutton;Make]"..
"list[current_name;blade;2,4.5;1,1;]"..
--Handle
"label[4.5,1.5;Handle]"..
"list[current_name;handle1;6,0.5;1,1;]"..
"list[current_name;handle2;6,1.5;1,1;]"..
"list[current_name;handle3;6,2.5;1,1;]"..
"button[6,3.5;1,1;hbutton;Make]"..
"list[current_name;handle;3,4.5;1,1;]"..
--Sword
"button[4,4.5;2,1;sbutton;Make]"..
"list[current_name;sword;6,4.5;1,1;]"..
--Show Inventory
"list[current_player;main;0.5,6;8,4;]")
meta:set_string("infotext", "Sword Forge")
local inv = meta:get_inventory()
inv:set_size("blade", 1)
inv:set_size("blade1", 1)
inv:set_size("blade2", 1)
inv:set_size("blade3", 1)
inv:set_size("handle", 1)
inv:set_size("handle1", 1)
inv:set_size("handle2", 1)
inv:set_size("handle3", 1)
inv:set_size("sword", 1)
end,
on_receive_fields = function(pos, formname, fields, sender)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
if fields["bbutton"]then
make_blade = false
if inv:is_empty("blade1") or
inv:is_empty("blade2") or
inv:is_empty("blade3") then
return
end
local b1 = inv:get_stack("blade1", 1)
local b2 = inv:get_stack("blade2", 1)
local b3 = inv:get_stack("blade3", 1)
local blade_list = {
{"default:wood", "mymagic_tools:blade_wood"},
{"default:stone", "mymagic_tools:blade_stone"},
{"default:steel_ingot", "mymagic_tools:blade_steel"},
{"default:bronze_ingot", "mymagic_tools:blade_bronze"},
{"default:mese_crystal", "mymagic_tools:blade_mese"},
{"default:diamond", "mymagic_tools:blade_diamond"},
}
for i in ipairs (blade_list) do
local mat = blade_list[i][1]
local bld = blade_list[i][2]
if b1:get_name() == mat and
b2:get_name() == mat and
b3:get_name() == mat then
blade = bld
make_blade = true
end
end
if make_blade == true then
inv:add_item("blade",blade)
b1:take_item()
inv:set_stack("blade1",1,b1)
b2:take_item()
inv:set_stack("blade2",1,b2)
b3:take_item()
inv:set_stack("blade3",1,b3)
end
elseif fields["hbutton"]then
make_handle = false
if inv:is_empty("handle1") or
inv:is_empty("handle2") or
inv:is_empty("handle3") then
return
end
local h1 = inv:get_stack("handle1", 1)
local h2 = inv:get_stack("handle2", 1)
local h3 = inv:get_stack("handle3", 1)
local handle_list = {
{"default:stick", "mymagic_tools:handle_wood"},
{"default:steel_ingot", "mymagic_tools:handle_steel"},
}
for i in ipairs (handle_list) do
local mat = handle_list[i][1]
local bld = handle_list[i][2]
if h1:get_name() == mat and
h2:get_name() == mat and
h3:get_name() == mat then
handle = bld
make_handle = true
end
end
if make_handle == true then
inv:add_item("handle",handle)
h1:take_item()
inv:set_stack("handle1",1,h1)
h2:take_item()
inv:set_stack("handle2",1,h2)
h3:take_item()
inv:set_stack("handle3",1,h3)
end
elseif fields["sbutton"]then
make_sword = false
if inv:is_empty("blade") or
inv:is_empty("handle") then
return
end
local s1 = inv:get_stack("blade", 1)
local s2 = inv:get_stack("handle", 1)
local maters = {"wood","stone","steel","bronze","mese","diamond"}
for i=1,#maters do
local mater = maters[i]
if s1:get_name() == "mymagic_tools:blade_"..mater and
s2:get_name() == "mymagic_tools:handle_wood" then
sword = "default:sword_"..mater
make_sword = true
end
end
if make_sword == true then
inv:add_item("sword",sword)
s1:take_item()
inv:set_stack("blade",1,s1)
s2:take_item()
inv:set_stack("handle",1,s2)
end
end
end,
})
minetest.register_craft({
output = "mymagic_tools:forge_sword",
recipe = {
{"default:steel_ingot","default:coalblock","default:steel_ingot"},
{"default:steel_ingot","default:brick","default:steel_ingot"},
{"default:steel_ingot","default:steel_ingot","default:steel_ingot"},
},
})

30
mymagic_tools/init.lua Normal file
View File

@ -0,0 +1,30 @@
dofile(minetest.get_modpath("mymagic_tools").."/craftitems.lua")
--default tools
dofile(minetest.get_modpath("mymagic_tools").."/default_knife.lua")
dofile(minetest.get_modpath("mymagic_tools").."/default_shovel.lua")
dofile(minetest.get_modpath("mymagic_tools").."/default_axe.lua")
dofile(minetest.get_modpath("mymagic_tools").."/default_sword.lua")
dofile(minetest.get_modpath("mymagic_tools").."/default_pick.lua")
--enchanted tools
dofile(minetest.get_modpath("mymagic_tools").."/enchanted_swords.lua")
dofile(minetest.get_modpath("mymagic_tools").."/enchanted_axes.lua")
dofile(minetest.get_modpath("mymagic_tools").."/enchanted_knives.lua")
dofile(minetest.get_modpath("mymagic_tools").."/enchanted_picks.lua")
dofile(minetest.get_modpath("mymagic_tools").."/enchanted_shovels.lua")
--forges
--dofile(minetest.get_modpath("mymagic_tools").."/forge_axe.lua")
dofile(minetest.get_modpath("mymagic_tools").."/forge_sword.lua")
local mod_3darmor = minetest.get_modpath("3d_armor")
if mod_3darmor then
dofile(minetest.get_modpath("mymagic_tools").."/forge_armor.lua")
dofile(minetest.get_modpath("mymagic_tools").."/enchanted_armor.lua")
end

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 321 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 453 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 443 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 437 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 432 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 833 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 555 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 809 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 552 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 804 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 553 B

Some files were not shown because too many files have changed in this diff Show More