Merge remote-tracking branch 'origin/anvils'
@ -1,4 +1,4 @@
|
||||
realtest
|
||||
RealTest
|
||||
========
|
||||
|
||||
Realtest game for Minetest
|
||||
Realistic game for Minetest 0.4.3 and over
|
||||
|
@ -9,6 +9,7 @@ function realtest.register_anvil_recipe(RecipeDef)
|
||||
rmitem1 = RecipeDef.rmitem1,
|
||||
rmitem2 = RecipeDef.rmitem2,
|
||||
output = RecipeDef.output or "",
|
||||
level = RecipeDef.level or 0,
|
||||
}
|
||||
if recipe.rmitem1 == nil then
|
||||
recipe.rmitem1 = true
|
||||
@ -16,13 +17,16 @@ function realtest.register_anvil_recipe(RecipeDef)
|
||||
if recipe.rmitem2 == nil then
|
||||
recipe.rmitem2 = true
|
||||
end
|
||||
if recipe.level < 0 then
|
||||
recipe.level = 0
|
||||
end
|
||||
if recipe.output ~= "" and recipe.item1 ~= "" and (recipe.type == "forge" or recipe.type == "weld") then
|
||||
table.insert(realtest.registered_anvil_recipes, recipe)
|
||||
end
|
||||
end
|
||||
|
||||
--Unshaped metals, buckets, double ingots and sheets
|
||||
for _, metal in ipairs(METALS_LIST) do
|
||||
--Unshaped metals, buckets, double ingots, sheets and hammers
|
||||
for i, metal in ipairs(metals.list) do
|
||||
realtest.register_anvil_recipe({
|
||||
item1 = "metals:"..metal.."_unshaped",
|
||||
output = "metals:"..metal.."_ingot",
|
||||
@ -32,73 +36,68 @@ for _, metal in ipairs(METALS_LIST) do
|
||||
item2 = "metals:recipe_bucket",
|
||||
rmitem2 = false,
|
||||
output = "metals:bucket_empty_"..metal,
|
||||
level = metals.levels[i],
|
||||
})
|
||||
realtest.register_anvil_recipe({
|
||||
item1 = "metals:"..metal.."_doubleingot",
|
||||
output = "metals:"..metal.."_sheet",
|
||||
level = metals.levels[i] - 1,
|
||||
})
|
||||
realtest.register_anvil_recipe({
|
||||
type = "weld",
|
||||
item1 = "metals:"..metal.."_ingot",
|
||||
item2 = "metals:"..metal.."_ingot",
|
||||
output = "metals:"..metal.."_doubleingot",
|
||||
level = metals.levels[i] - 1,
|
||||
})
|
||||
realtest.register_anvil_recipe({
|
||||
type = "weld",
|
||||
item1 = "metals:"..metal.."_sheet",
|
||||
item2 = "metals:"..metal.."_sheet",
|
||||
output = "metals:"..metal.."_doublesheet",
|
||||
level = metals.levels[i] - 1,
|
||||
})
|
||||
minetest.register_tool("anvil:tool_hammer_"..metal, {
|
||||
description = metals.desc_list[i].." Hammer",
|
||||
inventory_image = "anvil_tool_hammer_"..metal..".png",
|
||||
groups = {anvil_level = metals.levels[i]},
|
||||
tool_capabilities = {
|
||||
max_drop_level=1,
|
||||
groupcaps={
|
||||
cracky=PICKS_CRACKY_LIST[i],
|
||||
}
|
||||
},
|
||||
})
|
||||
end
|
||||
--Pig iron --> Wrought iron
|
||||
realtest.register_anvil_recipe({
|
||||
item1 = "metals:pig_iron_ingot",
|
||||
output = "metals:wrought_iron_ingot",
|
||||
level = 3,
|
||||
})
|
||||
--Instruments
|
||||
local instruments =
|
||||
{{"axe", "_ingot"},
|
||||
{"pick", "_ingot"},
|
||||
{"shovel", "_ingot"},
|
||||
{"spear", "_ingot"},
|
||||
{"sword", "_doubleingot"},
|
||||
{"hammer", "_doubleingot"}}
|
||||
{"hammer", "_doubleingot"}
|
||||
}
|
||||
for _, instrument in ipairs(instruments) do
|
||||
for _, metal in ipairs(METALS_LIST) do
|
||||
for i, metal in ipairs(metals.list) do
|
||||
realtest.register_anvil_recipe({
|
||||
item1 = "metals:"..metal..instrument[2],
|
||||
item2 = "metals:recipe_"..instrument[1],
|
||||
rmitem2 = false,
|
||||
output = "metals:tool_"..instrument[1].."_"..metal.."_head",
|
||||
level = metals.levels[i],
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
anvil.hammers={
|
||||
'anvil:hammer',
|
||||
'metals:tool_hammer_bismuth',
|
||||
'metals:tool_hammer_pig_iron',
|
||||
'metals:tool_hammer_wrought_iron',
|
||||
'metals:tool_hammer_steel',
|
||||
'metals:tool_hammer_gold',
|
||||
'metals:tool_hammer_nickel',
|
||||
'metals:tool_hammer_platinum',
|
||||
'metals:tool_hammer_tin',
|
||||
'metals:tool_hammer_silver',
|
||||
'metals:tool_hammer_lead',
|
||||
'metals:tool_hammer_copper',
|
||||
'metals:tool_hammer_zinc',
|
||||
'metals:tool_hammer_brass',
|
||||
'metals:tool_hammer_sterling_silver',
|
||||
'metals:tool_hammer_rose_gold',
|
||||
'metals:tool_hammer_black_bronze',
|
||||
'metals:tool_hammer_bismuth_bronze',
|
||||
'metals:tool_hammer_bronze',
|
||||
'metals:tool_hammer_black_steel',
|
||||
}
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'anvil:self',
|
||||
output = 'anvil:stone_anvil',
|
||||
recipe = {
|
||||
{'default:stone','default:stone','default:stone'},
|
||||
{'','default:stone',''},
|
||||
@ -115,9 +114,10 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_tool("anvil:hammer", {
|
||||
description = "Hammer",
|
||||
inventory_image = "anvil_hammer.png",
|
||||
minetest.register_tool("anvil:tool_hammer_stone", {
|
||||
description = "Stone Hammer",
|
||||
inventory_image = "anvil_tool_hammer_stone.png",
|
||||
groups = {anvil_level = 0},
|
||||
tool_capabilities = {
|
||||
max_drop_level=1,
|
||||
groupcaps={
|
||||
@ -127,115 +127,142 @@ minetest.register_tool("anvil:hammer", {
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_node("anvil:self", {
|
||||
description = "Anvil",
|
||||
tiles = {"anvil_top.png","anvil_top.png","anvil_side.png"},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5,-0.5,-0.3,0.5,-0.4,0.3},
|
||||
{-0.35,-0.4,-0.25,0.35,-0.3,0.25},
|
||||
{-0.3,-0.3,-0.15,0.3,-0.1,0.15},
|
||||
{-0.35,-0.1,-0.2,0.35,0.1,0.2},
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5,-0.5,-0.3,0.5,-0.4,0.3},
|
||||
{-0.35,-0.4,-0.25,0.35,-0.3,0.25},
|
||||
{-0.3,-0.3,-0.15,0.3,-0.1,0.15},
|
||||
{-0.35,-0.1,-0.2,0.35,0.1,0.2},
|
||||
},
|
||||
},
|
||||
groups = {oddly_breakable_by_hand=2, cracky=3, dig_immediate=1},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
can_dig = function(pos,player)
|
||||
local meta = minetest.env:get_meta(pos);
|
||||
local inv = meta:get_inventory()
|
||||
if inv:is_empty("src1") and inv:is_empty("src2") and inv:is_empty("hammer")
|
||||
and inv:is_empty("output") and inv:is_empty("flux") then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end,
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
meta:set_string("formspec", "invsize[8,7;]"..
|
||||
"button[0.5,0.25;2,1;buttonForge;Forge]"..
|
||||
"list[current_name;src1;2.9,0.25;1,1;]"..
|
||||
"image[3.69,0.22;0.54,1.5;anvil_arrow.png]"..
|
||||
"list[current_name;src2;4.1,0.25;1,1;]"..
|
||||
"button[5.5,0.25;2,1;buttonWeld;Weld]"..
|
||||
"list[current_name;hammer;1,1.5;1,1;]"..
|
||||
"list[current_name;output;3.5,1.5;1,1;]"..
|
||||
"list[current_name;flux;6,1.5;1,1;]"..
|
||||
"list[current_player;main;0,3;8,4;]")
|
||||
meta:set_string("infotext", "Anvil")
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("src1", 1)
|
||||
inv:set_size("src2", 1)
|
||||
inv:set_size("hammer", 1)
|
||||
inv:set_size("output", 1)
|
||||
inv:set_size("flux", 1)
|
||||
end,
|
||||
on_receive_fields = function(pos, formname, fields, sender)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
|
||||
local src1, src2 = inv:get_stack("src1", 1), inv:get_stack("src2", 1)
|
||||
local hammer, flux = inv:get_stack("hammer", 1), inv:get_stack("flux", 1)
|
||||
local output = inv:get_stack("output", 1)
|
||||
local anvils = {
|
||||
{'stone', 'Stone', 0},
|
||||
{'copper', 'Copper', 1},
|
||||
{'rose_gold', 'Rose Gold', 2},
|
||||
{'bismuth_bronze', 'Bismuth Bronze', 2},
|
||||
{'black_bronze', 'Black Bronze', 2},
|
||||
{'bronze', 'Bronze', 2},
|
||||
{'wrought_iron', 'Wrought Iron', 3},
|
||||
{'steel', 'Steel', 4},
|
||||
{'black_steel', 'Black Steel', 5}
|
||||
}
|
||||
|
||||
if fields["buttonForge"] then
|
||||
if table.contains(anvil.hammers, hammer:get_name()) then
|
||||
for _, recipe in ipairs(realtest.registered_anvil_recipes) do
|
||||
if recipe.type == "forge" and recipe.item1 == src1:get_name() and recipe.item2 == src2:get_name() then
|
||||
if inv:room_for_item("output", recipe.output) then
|
||||
if recipe.rmitem1 then
|
||||
src1:take_item()
|
||||
inv:set_stack("src1", 1, src1)
|
||||
end
|
||||
if recipe.item2 ~= "" and recipe.rmitem2 then
|
||||
src2:take_item()
|
||||
inv:set_stack("src2", 1, src2)
|
||||
end
|
||||
output:add_item(recipe.output)
|
||||
inv:set_stack("output", 1, output)
|
||||
hammer:add_wear(65535/30)
|
||||
inv:set_stack("hammer", 1, hammer)
|
||||
end
|
||||
return
|
||||
end
|
||||
end
|
||||
for _, anvil in ipairs(anvils) do
|
||||
minetest.register_node("anvil:"..anvil[1].."_anvil", {
|
||||
description = anvil[2] .. " Anvil",
|
||||
tiles = {"anvil_"..anvil[1].."_top.png","anvil_"..anvil[1].."_top.png","anvil_"..anvil[1].."_side.png"},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5,-0.5,-0.3,0.5,-0.4,0.3},
|
||||
{-0.35,-0.4,-0.25,0.35,-0.3,0.25},
|
||||
{-0.3,-0.3,-0.15,0.3,-0.1,0.15},
|
||||
{-0.35,-0.1,-0.2,0.35,0.1,0.2},
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5,-0.5,-0.3,0.5,-0.4,0.3},
|
||||
{-0.35,-0.4,-0.25,0.35,-0.3,0.25},
|
||||
{-0.3,-0.3,-0.15,0.3,-0.1,0.15},
|
||||
{-0.35,-0.1,-0.2,0.35,0.1,0.2},
|
||||
},
|
||||
},
|
||||
groups = {oddly_breakable_by_hand=2, cracky=3, dig_immediate=1},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
can_dig = function(pos,player)
|
||||
local meta = minetest.env:get_meta(pos);
|
||||
local inv = meta:get_inventory()
|
||||
if inv:is_empty("src1") and inv:is_empty("src2") and inv:is_empty("hammer")
|
||||
and inv:is_empty("output") and inv:is_empty("flux") then
|
||||
return true
|
||||
end
|
||||
elseif fields["buttonWeld"] then
|
||||
if flux:get_name() == "minerals:flux" and table.contains(anvil.hammers, hammer:get_name()) then
|
||||
for _, recipe in ipairs(realtest.registered_anvil_recipes) do
|
||||
if recipe.type == "weld" and recipe.item1 == src1:get_name() and recipe.item2 == src2:get_name() then
|
||||
if inv:room_for_item("output", recipe.output) then
|
||||
if recipe.rmitem1 then
|
||||
src1:take_item()
|
||||
inv:set_stack("src1", 1, src1)
|
||||
return false
|
||||
end,
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
meta:set_string("formspec", "invsize[8,7;]"..
|
||||
"button[0.5,0.25;2,1;buttonForge;Forge]"..
|
||||
"list[current_name;src1;2.9,0.25;1,1;]"..
|
||||
"image[3.69,0.22;0.54,1.5;anvil_arrow.png]"..
|
||||
"list[current_name;src2;4.1,0.25;1,1;]"..
|
||||
"button[5.5,0.25;2,1;buttonWeld;Weld]"..
|
||||
"list[current_name;hammer;1,1.5;1,1;]"..
|
||||
"list[current_name;output;3.5,1.5;1,1;]"..
|
||||
"list[current_name;flux;6,1.5;1,1;]"..
|
||||
"list[current_player;main;0,3;8,4;]")
|
||||
meta:set_string("infotext", anvil[2].." Anvil")
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("src1", 1)
|
||||
inv:set_size("src2", 1)
|
||||
inv:set_size("hammer", 1)
|
||||
inv:set_size("output", 1)
|
||||
inv:set_size("flux", 1)
|
||||
end,
|
||||
on_receive_fields = function(pos, formname, fields, sender)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
|
||||
local src1, src2 = inv:get_stack("src1", 1), inv:get_stack("src2", 1)
|
||||
local hammer, flux = inv:get_stack("hammer", 1), inv:get_stack("flux", 1)
|
||||
local output = inv:get_stack("output", 1)
|
||||
if string.sub(hammer:get_name(), 12, 17) == "hammer" then
|
||||
if fields["buttonForge"] then
|
||||
for _, recipe in ipairs(realtest.registered_anvil_recipes) do
|
||||
if recipe.type == "forge" and recipe.item1 == src1:get_name() and recipe.item2 == src2:get_name() and
|
||||
anvil[3] >= recipe.level and
|
||||
minetest.registered_items[hammer:get_name()].groups["anvil_level"] >= recipe.level then
|
||||
if inv:room_for_item("output", recipe.output) then
|
||||
if recipe.rmitem1 then
|
||||
src1:take_item()
|
||||
inv:set_stack("src1", 1, src1)
|
||||
end
|
||||
if recipe.item2 ~= "" and recipe.rmitem2 then
|
||||
src2:take_item()
|
||||
inv:set_stack("src2", 1, src2)
|
||||
end
|
||||
output:add_item(recipe.output)
|
||||
inv:set_stack("output", 1, output)
|
||||
hammer:add_wear(65535/30)
|
||||
inv:set_stack("hammer", 1, hammer)
|
||||
end
|
||||
if recipe.item2 ~= "" and recipe.rmitem2 then
|
||||
src2:take_item()
|
||||
inv:set_stack("src2", 1, src2)
|
||||
end
|
||||
output:add_item(recipe.output)
|
||||
inv:set_stack("output", 1, output)
|
||||
flux:take_item()
|
||||
inv:set_stack("flux", 1, flux)
|
||||
hammer:add_wear(65535/60)
|
||||
inv:set_stack("hammer", 1, hammer)
|
||||
return
|
||||
end
|
||||
return
|
||||
end
|
||||
elseif fields["buttonWeld"] then
|
||||
if flux:get_name() == "minerals:flux" then
|
||||
for _, recipe in ipairs(realtest.registered_anvil_recipes) do
|
||||
if recipe.type == "weld" and recipe.item1 == src1:get_name() and recipe.item2 == src2:get_name() and
|
||||
anvil[3] >= recipe.level and
|
||||
minetest.registered_items[hammer:get_name()].groups["anvil_level"] >= recipe.level then
|
||||
if inv:room_for_item("output", recipe.output) then
|
||||
if recipe.rmitem1 then
|
||||
src1:take_item()
|
||||
inv:set_stack("src1", 1, src1)
|
||||
end
|
||||
if recipe.item2 ~= "" and recipe.rmitem2 then
|
||||
src2:take_item()
|
||||
inv:set_stack("src2", 1, src2)
|
||||
end
|
||||
output:add_item(recipe.output)
|
||||
inv:set_stack("output", 1, output)
|
||||
flux:take_item()
|
||||
inv:set_stack("flux", 1, flux)
|
||||
hammer:add_wear(65535/60)
|
||||
inv:set_stack("hammer", 1, hammer)
|
||||
end
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
end,
|
||||
})
|
||||
if anvil[1] ~= "stone" then
|
||||
minetest.register_craft({
|
||||
output = "anvil:"..anvil[1].."_anvil",
|
||||
recipe = {
|
||||
{"metals:"..anvil[1].."_doubleingot","metals:"..anvil[1].."_doubleingot","metals:"..anvil[1].."_doubleingot"},
|
||||
{"","metals:"..anvil[1].."_doubleingot",""},
|
||||
{"metals:"..anvil[1].."_doubleingot","metals:"..anvil[1].."_doubleingot","metals:"..anvil[1].."_doubleingot"},
|
||||
}
|
||||
})
|
||||
end
|
||||
end
|
||||
|
BIN
mods/anvil/textures/anvil_bismuth_bronze_side.png
Normal file
After Width: | Height: | Size: 507 B |
BIN
mods/anvil/textures/anvil_bismuth_bronze_top.png
Normal file
After Width: | Height: | Size: 683 B |
BIN
mods/anvil/textures/anvil_black_bronze_side.png
Normal file
After Width: | Height: | Size: 465 B |
BIN
mods/anvil/textures/anvil_black_bronze_top.png
Normal file
After Width: | Height: | Size: 519 B |
BIN
mods/anvil/textures/anvil_black_steel_side.png
Normal file
After Width: | Height: | Size: 441 B |
BIN
mods/anvil/textures/anvil_black_steel_top.png
Normal file
After Width: | Height: | Size: 577 B |
BIN
mods/anvil/textures/anvil_bronze_side.png
Normal file
After Width: | Height: | Size: 498 B |
BIN
mods/anvil/textures/anvil_bronze_top.png
Normal file
After Width: | Height: | Size: 689 B |
BIN
mods/anvil/textures/anvil_copper_side.png
Normal file
After Width: | Height: | Size: 563 B |
BIN
mods/anvil/textures/anvil_copper_top.png
Normal file
After Width: | Height: | Size: 783 B |
BIN
mods/anvil/textures/anvil_rose_gold_side.png
Normal file
After Width: | Height: | Size: 508 B |
BIN
mods/anvil/textures/anvil_rose_gold_top.png
Normal file
After Width: | Height: | Size: 682 B |
Before Width: | Height: | Size: 609 B |
BIN
mods/anvil/textures/anvil_steel_side.png
Normal file
After Width: | Height: | Size: 541 B |
BIN
mods/anvil/textures/anvil_steel_top.png
Normal file
After Width: | Height: | Size: 693 B |
BIN
mods/anvil/textures/anvil_stone_side.png
Normal file
After Width: | Height: | Size: 567 B |
BIN
mods/anvil/textures/anvil_stone_top.png
Normal file
After Width: | Height: | Size: 564 B |
Before Width: | Height: | Size: 371 B After Width: | Height: | Size: 371 B |
Before Width: | Height: | Size: 433 B After Width: | Height: | Size: 433 B |
Before Width: | Height: | Size: 339 B After Width: | Height: | Size: 339 B |
Before Width: | Height: | Size: 335 B After Width: | Height: | Size: 335 B |
Before Width: | Height: | Size: 330 B After Width: | Height: | Size: 330 B |
Before Width: | Height: | Size: 363 B After Width: | Height: | Size: 363 B |
Before Width: | Height: | Size: 362 B After Width: | Height: | Size: 362 B |
Before Width: | Height: | Size: 363 B After Width: | Height: | Size: 363 B |
Before Width: | Height: | Size: 354 B After Width: | Height: | Size: 354 B |
Before Width: | Height: | Size: 362 B After Width: | Height: | Size: 362 B |
Before Width: | Height: | Size: 358 B After Width: | Height: | Size: 358 B |
Before Width: | Height: | Size: 362 B After Width: | Height: | Size: 362 B |
Before Width: | Height: | Size: 430 B After Width: | Height: | Size: 430 B |
Before Width: | Height: | Size: 375 B After Width: | Height: | Size: 375 B |
Before Width: | Height: | Size: 368 B After Width: | Height: | Size: 368 B |
Before Width: | Height: | Size: 358 B After Width: | Height: | Size: 358 B |
Before Width: | Height: | Size: 363 B After Width: | Height: | Size: 363 B |
Before Width: | Height: | Size: 339 B After Width: | Height: | Size: 339 B |
Before Width: | Height: | Size: 354 B After Width: | Height: | Size: 354 B |
Before Width: | Height: | Size: 355 B After Width: | Height: | Size: 355 B |
Before Width: | Height: | Size: 390 B After Width: | Height: | Size: 390 B |
Before Width: | Height: | Size: 804 B |
BIN
mods/anvil/textures/anvil_wrought_iron_side.png
Normal file
After Width: | Height: | Size: 538 B |
BIN
mods/anvil/textures/anvil_wrought_iron_top.png
Normal file
After Width: | Height: | Size: 722 B |
@ -18,13 +18,22 @@ dofile(minetest.get_modpath("default").."/leafdecay.lua")
|
||||
|
||||
table.contains = function(t, v)
|
||||
for _, i in ipairs(t) do
|
||||
if i==v then
|
||||
if i == v then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
table.get_index = function(t, v)
|
||||
for j, i in ipairs(t) do
|
||||
if i == v then
|
||||
return j
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
--
|
||||
-- Tool definition
|
||||
--
|
||||
|
@ -1,19 +1,19 @@
|
||||
bucket = {}
|
||||
bucket.liquids = {}
|
||||
buckets = {}
|
||||
buckets.liquids = {}
|
||||
|
||||
function bucket.register_liquid(source, flowing, itemname, inventory_image)
|
||||
function buckets.register_liquid(source, flowing, itemname, inventory_image)
|
||||
|
||||
bucket.liquids[source] = {
|
||||
buckets.liquids[source] = {
|
||||
source = source,
|
||||
flowing = flowing,
|
||||
itemname = itemname,
|
||||
}
|
||||
bucket.liquids[flowing] = bucket.liquids[source]
|
||||
buckets.liquids[flowing] = buckets.liquids[source]
|
||||
|
||||
if itemname ~= nil then
|
||||
for i = 1,#METALS_LIST do
|
||||
minetest.register_craftitem(itemname.."_"..METALS_LIST[i], {
|
||||
inventory_image = "metals_"..METALS_LIST[i].."_bucket.png^"..inventory_image,
|
||||
for i = 1,#metals.list do
|
||||
minetest.register_craftitem(itemname.."_"..metals.list[i], {
|
||||
inventory_image = "metals_"..metals.list[i].."_bucket.png^"..inventory_image,
|
||||
stack_max = 1,
|
||||
liquids_pointable = true,
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
@ -23,7 +23,7 @@ function bucket.register_liquid(source, flowing, itemname, inventory_image)
|
||||
end
|
||||
-- Check if pointing to a liquid
|
||||
n = minetest.env:get_node(pointed_thing.under)
|
||||
if bucket.liquids[n.name] == nil then
|
||||
if buckets.liquids[n.name] == nil then
|
||||
-- Not a liquid
|
||||
--if minetest.env:get_node(pointed_thing.above) == "air" then
|
||||
minetest.env:add_node(pointed_thing.above, {name=source})
|
||||
@ -32,17 +32,17 @@ function bucket.register_liquid(source, flowing, itemname, inventory_image)
|
||||
-- It's a liquid
|
||||
minetest.env:add_node(pointed_thing.under, {name=source})
|
||||
end
|
||||
return {name="metals:bucket_empty_"..METALS_LIST[i]}
|
||||
return {name="metals:bucket_empty_"..metals.list[i]}
|
||||
end
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for i = 1,#METALS_LIST do
|
||||
minetest.register_craftitem("metals:bucket_empty_"..METALS_LIST[i], {
|
||||
description = "Emtpy " .. DESC_LIST[i] .. " Bucket",
|
||||
inventory_image = "metals_"..METALS_LIST[i].."_bucket.png",
|
||||
for i = 1,#metals.list do
|
||||
minetest.register_craftitem("metals:bucket_empty_"..metals.list[i], {
|
||||
description = "Emtpy " .. metals.desc_list[i] .. " Bucket",
|
||||
inventory_image = "metals_"..metals.list[i].."_bucket.png",
|
||||
stack_max = 1,
|
||||
liquids_pointable = true,
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
@ -52,23 +52,23 @@ for i = 1,#METALS_LIST do
|
||||
end
|
||||
-- Check if pointing to a liquid source
|
||||
n = minetest.env:get_node(pointed_thing.under)
|
||||
liquiddef = bucket.liquids[n.name]
|
||||
liquiddef = buckets.liquids[n.name]
|
||||
if liquiddef ~= nil and liquiddef.source == n.name and liquiddef.itemname ~= nil then
|
||||
minetest.env:add_node(pointed_thing.under, {name="air"})
|
||||
return {name=liquiddef.itemname.."_"..METALS_LIST[i]}
|
||||
return {name=liquiddef.itemname.."_"..metals.list[i]}
|
||||
end
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
bucket.register_liquid(
|
||||
buckets.register_liquid(
|
||||
"default:water_source",
|
||||
"default:water_flowing",
|
||||
"metals:bucket_water",
|
||||
"metals_water.png"
|
||||
)
|
||||
|
||||
bucket.register_liquid(
|
||||
buckets.register_liquid(
|
||||
"default:lava_source",
|
||||
"default:lava_flowing",
|
||||
"metals:bucket_lava",
|
||||
|
@ -1,170 +1,159 @@
|
||||
--replacements = {{"metals:"..METALS_LIST[i].."_unshaped", "metals:ceramic_mold"}}
|
||||
metals = {}
|
||||
metals.spear = {}
|
||||
|
||||
SPEAR_DAMAGE=10
|
||||
SPEAR_GRAVITY=9
|
||||
SPEAR_VELOCITY=19
|
||||
metals.spear.damage = 10
|
||||
metals.spear.gravity = 9
|
||||
metals.spear.velocity = 19
|
||||
|
||||
METALS_LIST={
|
||||
metals.levels = {0,0,0,1,2,2,2,2,2,2,2,2,2,2,3,3,3,4,4,5}
|
||||
|
||||
metals.list = {
|
||||
'bismuth',
|
||||
'pig_iron',
|
||||
'wrought_iron',
|
||||
'steel',
|
||||
'gold',
|
||||
'nickel',
|
||||
'platinum',
|
||||
'tin',
|
||||
'silver',
|
||||
'lead',
|
||||
'copper',
|
||||
'zinc',
|
||||
'tin',
|
||||
----------
|
||||
'copper',
|
||||
----------
|
||||
'lead',
|
||||
'silver',
|
||||
'gold',
|
||||
'brass',
|
||||
'sterling_silver',
|
||||
'rose_gold',
|
||||
'black_bronze',
|
||||
'bismuth_bronze',
|
||||
'bronze',
|
||||
'black_steel',
|
||||
'aluminium',
|
||||
----------
|
||||
'platinum',
|
||||
'pig_iron',
|
||||
'wrought_iron',
|
||||
----------
|
||||
'nickel',
|
||||
'steel',
|
||||
----------
|
||||
'black_steel'
|
||||
}
|
||||
|
||||
DESC_LIST={
|
||||
metals.desc_list = {
|
||||
'Bismuth',
|
||||
'Pig Iron',
|
||||
'Wrought Iron',
|
||||
'Steel',
|
||||
'Gold',
|
||||
'Nickel',
|
||||
'Platinum',
|
||||
'Tin',
|
||||
'Silver',
|
||||
'Lead',
|
||||
'Copper',
|
||||
'Zinc',
|
||||
'Tin',
|
||||
----------
|
||||
'Copper',
|
||||
----------
|
||||
'Lead',
|
||||
'Silver',
|
||||
'Gold',
|
||||
'Brass',
|
||||
'Sterling Silver',
|
||||
'Rose Gold',
|
||||
'Black Bronze',
|
||||
'Bismuth Bronze',
|
||||
'Bronze',
|
||||
'Black Steel',
|
||||
'Aluminium'
|
||||
'Aluminium',
|
||||
----------
|
||||
'Platinum',
|
||||
'Pig Iron',
|
||||
'Wrought Iron',
|
||||
----------
|
||||
'Nickel',
|
||||
'Steel',
|
||||
----------
|
||||
'Black Steel'
|
||||
}
|
||||
|
||||
DESC_SMALL_LIST={
|
||||
'bismuth',
|
||||
'pig iron',
|
||||
'wrought iron',
|
||||
'steel',
|
||||
'gold',
|
||||
'nickel',
|
||||
'platinum',
|
||||
'tin',
|
||||
'silver',
|
||||
'lead',
|
||||
'copper',
|
||||
'zinc',
|
||||
'brass',
|
||||
'sterling silver',
|
||||
'rose gold',
|
||||
'black bronze',
|
||||
'bismuth bronze',
|
||||
'bronze',
|
||||
'black steel',
|
||||
'aluminium',
|
||||
}
|
||||
|
||||
|
||||
dofile(minetest.get_modpath("metals").."/groupcaps.lua")
|
||||
dofile(minetest.get_modpath("metals").."/buckets.lua")
|
||||
|
||||
for i=1, #METALS_LIST do
|
||||
for i=1, #metals.list do
|
||||
|
||||
--
|
||||
-- Craftitems
|
||||
--
|
||||
|
||||
minetest.register_craftitem("metals:"..METALS_LIST[i].."_unshaped", {
|
||||
description = "Unshaped "..DESC_LIST[i],
|
||||
inventory_image = "metals_"..METALS_LIST[i].."_unshaped.png",
|
||||
minetest.register_craftitem("metals:"..metals.list[i].."_unshaped", {
|
||||
description = "Unshaped "..metals.desc_list[i],
|
||||
inventory_image = "metals_"..metals.list[i].."_unshaped.png",
|
||||
})
|
||||
|
||||
minetest.register_craftitem("metals:"..METALS_LIST[i].."_ingot", {
|
||||
description = DESC_LIST[i].." Ingot",
|
||||
inventory_image = "metals_"..METALS_LIST[i].."_ingot.png",
|
||||
minetest.register_craftitem("metals:"..metals.list[i].."_ingot", {
|
||||
description = metals.desc_list[i].." Ingot",
|
||||
inventory_image = "metals_"..metals.list[i].."_ingot.png",
|
||||
})
|
||||
|
||||
minetest.register_craftitem("metals:" .. METALS_LIST[i] .. "_doubleingot", {
|
||||
description = DESC_LIST[i] .. " Double Ingot",
|
||||
inventory_image = "metals_" .. METALS_LIST[i] .. "_doubleingot.png",
|
||||
minetest.register_craftitem("metals:"..metals.list[i].."_doubleingot", {
|
||||
description = metals.desc_list[i].." Double Ingot",
|
||||
inventory_image = "metals_"..metals.list[i].."_doubleingot.png",
|
||||
})
|
||||
|
||||
minetest.register_craftitem("metals:" .. METALS_LIST[i] .. "_sheet", {
|
||||
description = DESC_LIST[i] .. " Sheet",
|
||||
inventory_image = "metals_" .. METALS_LIST[i] .. "_sheet.png",
|
||||
minetest.register_craftitem("metals:"..metals.list[i].."_sheet", {
|
||||
description = metals.desc_list[i].." Sheet",
|
||||
inventory_image = "metals_" .. metals.list[i].."_sheet.png",
|
||||
})
|
||||
|
||||
minetest.register_craftitem("metals:" .. METALS_LIST[i] .. "_doublesheet", {
|
||||
description = DESC_LIST[i] .. " Double Sheet",
|
||||
inventory_image = "metals_" .. METALS_LIST[i] .. "_doublesheet.png",
|
||||
minetest.register_craftitem("metals:"..metals.list[i].."_doublesheet", {
|
||||
description = metals.desc_list[i].." Double Sheet",
|
||||
inventory_image = "metals_"..metals.list[i].."_doublesheet.png",
|
||||
})
|
||||
|
||||
minetest.register_craftitem("metals:tool_pick_"..METALS_LIST[i].."_head", {
|
||||
description =DESC_LIST[i].." pickaxe head",
|
||||
inventory_image = "metals_tool_pick_"..METALS_LIST[i].."_head.png",
|
||||
minetest.register_craftitem("metals:tool_pick_"..metals.list[i].."_head", {
|
||||
description =metals.desc_list[i].." Pickaxe Head",
|
||||
inventory_image = "metals_tool_pick_"..metals.list[i].."_head.png",
|
||||
})
|
||||
|
||||
minetest.register_craftitem("metals:tool_axe_"..METALS_LIST[i].."_head", {
|
||||
description =DESC_LIST[i].." axe head",
|
||||
inventory_image = "metals_tool_axe_"..METALS_LIST[i].."_head.png",
|
||||
minetest.register_craftitem("metals:tool_axe_"..metals.list[i].."_head", {
|
||||
description =metals.desc_list[i].." Axe Head",
|
||||
inventory_image = "metals_tool_axe_"..metals.list[i].."_head.png",
|
||||
})
|
||||
|
||||
minetest.register_craftitem("metals:tool_shovel_"..METALS_LIST[i].."_head", {
|
||||
description =DESC_LIST[i].." shovel head",
|
||||
inventory_image = "metals_tool_shovel_"..METALS_LIST[i].."_head.png",
|
||||
minetest.register_craftitem("metals:tool_shovel_"..metals.list[i].."_head", {
|
||||
description =metals.desc_list[i].." Shovel Head",
|
||||
inventory_image = "metals_tool_shovel_"..metals.list[i].."_head.png",
|
||||
})
|
||||
|
||||
minetest.register_craftitem("metals:tool_sword_"..METALS_LIST[i].."_head", {
|
||||
description =DESC_LIST[i].." sword head",
|
||||
inventory_image = "metals_tool_sword_"..METALS_LIST[i].."_head.png",
|
||||
minetest.register_craftitem("metals:tool_sword_"..metals.list[i].."_head", {
|
||||
description =metals.desc_list[i].." Sword Head",
|
||||
inventory_image = "metals_tool_sword_"..metals.list[i].."_head.png",
|
||||
})
|
||||
|
||||
minetest.register_craftitem("metals:tool_hammer_"..METALS_LIST[i].."_head", {
|
||||
description =DESC_LIST[i].." hammer head",
|
||||
inventory_image = "metals_tool_hammer_"..METALS_LIST[i].."_head.png",
|
||||
minetest.register_craftitem("metals:tool_hammer_"..metals.list[i].."_head", {
|
||||
description =metals.desc_list[i].." Hammer Head",
|
||||
inventory_image = "metals_tool_hammer_"..metals.list[i].."_head.png",
|
||||
})
|
||||
|
||||
minetest.register_craftitem("metals:tool_spear_"..METALS_LIST[i].."_head", {
|
||||
description =DESC_LIST[i].." spear head",
|
||||
inventory_image = "metals_tool_spear_"..METALS_LIST[i].."_head.png",
|
||||
minetest.register_craftitem("metals:tool_spear_"..metals.list[i].."_head", {
|
||||
description =metals.desc_list[i].." Spear Head",
|
||||
inventory_image = "metals_tool_spear_"..metals.list[i].."_head.png",
|
||||
})
|
||||
|
||||
minetest.register_craftitem("metals:tool_chisel_"..METALS_LIST[i].."_head", {
|
||||
description =DESC_LIST[i].." chisel head",
|
||||
inventory_image = "metals_tool_chisel_"..METALS_LIST[i].."_head.png",
|
||||
minetest.register_craftitem("metals:tool_chisel_"..metals.list[i].."_head", {
|
||||
description =metals.desc_list[i].." Chisel Head",
|
||||
inventory_image = "metals_tool_chisel_"..metals.list[i].."_head.png",
|
||||
})
|
||||
|
||||
minetest.register_craftitem("metals:ceramic_mold_"..METALS_LIST[i], {
|
||||
description = "Ceramic mold with "..DESC_SMALL_LIST[i],
|
||||
inventory_image = "metals_ceramic_mold.png^metals_"..METALS_LIST[i].."_ingot.png",
|
||||
minetest.register_craftitem("metals:ceramic_mold_"..metals.list[i], {
|
||||
description = "Ceramic Mold with "..metals.desc_list[i],
|
||||
inventory_image = "metals_ceramic_mold.png^metals_"..metals.list[i].."_ingot.png",
|
||||
})
|
||||
|
||||
minetest.register_craftitem("metals:tool_spear_"..METALS_LIST[i], {
|
||||
description = DESC_LIST[i].." spear",
|
||||
inventory_image = "metals_tool_spear_"..METALS_LIST[i]..".png",
|
||||
minetest.register_craftitem("metals:tool_spear_"..metals.list[i], {
|
||||
description = metals.desc_list[i].." spear",
|
||||
inventory_image = "metals_tool_spear_"..metals.list[i]..".png",
|
||||
on_use = function (item, player, pointed_thing)
|
||||
local playerpos=player:getpos()
|
||||
local obj=minetest.env:add_entity({x=playerpos.x,y=playerpos.y+1.5,z=playerpos.z}, "metals:spear_entity")
|
||||
local dir=player:get_look_dir()
|
||||
obj:setvelocity({x=dir.x*SPEAR_VELOCITY, y=dir.y*SPEAR_VELOCITY, z=dir.z*SPEAR_VELOCITY})
|
||||
obj:setacceleration({x=dir.x*-3, y=-SPEAR_GRAVITY, z=dir.z*-3})
|
||||
obj:setvelocity({x=dir.x*metals.spear.velocity, y=dir.y*metals.spear.velocity, z=dir.z*metals.spear.velocity})
|
||||
obj:setacceleration({x=dir.x*-3, y=-metals.spear.gravity, z=dir.z*-3})
|
||||
return ""
|
||||
end,
|
||||
stack_max = 1,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("metals:tool_chisel_"..METALS_LIST[i], {
|
||||
description = DESC_LIST[i].." chisel",
|
||||
inventory_image = "metals_tool_chisel_"..METALS_LIST[i]..".png",
|
||||
minetest.register_tool("metals:tool_chisel_"..metals.list[i], {
|
||||
description = metals.desc_list[i].." chisel",
|
||||
inventory_image = "metals_tool_chisel_"..metals.list[i]..".png",
|
||||
on_use = function (item, player, pointed_thing)
|
||||
if pointed_thing.type ~= "node" then
|
||||
return
|
||||
@ -175,17 +164,18 @@ for i=1, #METALS_LIST do
|
||||
if minetest.env:get_node(pointed_thing.under).name == "default:desert_stone" then
|
||||
minetest.env:add_node(pointed_thing.under, {name="realistic_add_blocks:desert_stone_flat"})
|
||||
end
|
||||
item:add_wear(65535/10)
|
||||
return item
|
||||
end,
|
||||
stack_max = 1,
|
||||
})
|
||||
|
||||
--
|
||||
-- Nodes
|
||||
--
|
||||
|
||||
minetest.register_node("metals:"..METALS_LIST[i].."_block", {
|
||||
description = "Block of "..DESC_SMALL_LIST[i],
|
||||
tiles = {"metals_"..METALS_LIST[i].."_block.png"},
|
||||
minetest.register_node("metals:"..metals.list[i].."_block", {
|
||||
description = "Block of "..metals.desc_list[i],
|
||||
tiles = {"metals_"..metals.list[i].."_block.png"},
|
||||
is_ground_content = true,
|
||||
groups = {snappy=1,bendy=2,cracky=1,melty=2,level=2},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
@ -195,9 +185,9 @@ for i=1, #METALS_LIST do
|
||||
-- Tools
|
||||
--
|
||||
|
||||
minetest.register_tool("metals:tool_pick_"..METALS_LIST[i], {
|
||||
description = DESC_LIST[i].." pickaxe",
|
||||
inventory_image = "metals_tool_pick_"..METALS_LIST[i]..".png",
|
||||
minetest.register_tool("metals:tool_pick_"..metals.list[i], {
|
||||
description = metals.desc_list[i].." Pickaxe",
|
||||
inventory_image = "metals_tool_pick_"..metals.list[i]..".png",
|
||||
tool_capabilities = {
|
||||
max_drop_level=1,
|
||||
groupcaps={
|
||||
@ -205,9 +195,9 @@ for i=1, #METALS_LIST do
|
||||
}
|
||||
},
|
||||
})
|
||||
minetest.register_tool("metals:tool_shovel_"..METALS_LIST[i], {
|
||||
description = DESC_LIST[i].." shovel",
|
||||
inventory_image = "metals_tool_shovel_"..METALS_LIST[i]..".png",
|
||||
minetest.register_tool("metals:tool_shovel_"..metals.list[i], {
|
||||
description = metals.desc_list[i].." Shovel",
|
||||
inventory_image = "metals_tool_shovel_"..metals.list[i]..".png",
|
||||
tool_capabilities = {
|
||||
max_drop_level=1,
|
||||
groupcaps={
|
||||
@ -215,57 +205,47 @@ for i=1, #METALS_LIST do
|
||||
}
|
||||
},
|
||||
})
|
||||
minetest.register_tool("metals:tool_axe_"..METALS_LIST[i], {
|
||||
description = DESC_LIST[i].." axe",
|
||||
inventory_image = "metals_tool_axe_"..METALS_LIST[i]..".png",
|
||||
minetest.register_tool("metals:tool_axe_"..metals.list[i], {
|
||||
description = metals.desc_list[i].." Axe",
|
||||
inventory_image = "metals_tool_axe_"..metals.list[i]..".png",
|
||||
tool_capabilities = {
|
||||
max_drop_level=1,
|
||||
groupcaps=AXE_GROUPCAPS[i],
|
||||
},
|
||||
})
|
||||
minetest.register_tool("metals:tool_sword_"..METALS_LIST[i], {
|
||||
description = DESC_LIST[i].." sword",
|
||||
inventory_image = "metals_tool_sword_"..METALS_LIST[i]..".png",
|
||||
minetest.register_tool("metals:tool_sword_"..metals.list[i], {
|
||||
description = metals.desc_list[i].." Sword",
|
||||
inventory_image = "metals_tool_sword_"..metals.list[i]..".png",
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 1.0,
|
||||
max_drop_level=1,
|
||||
groupcaps=SWORD_GROUPCAPS[i],
|
||||
}
|
||||
})
|
||||
minetest.register_tool("metals:tool_hammer_"..METALS_LIST[i], {
|
||||
description = DESC_LIST[i].." hammer",
|
||||
inventory_image = "metals_tool_hammer_"..METALS_LIST[i]..".png",
|
||||
tool_capabilities = {
|
||||
max_drop_level=1,
|
||||
groupcaps={
|
||||
cracky=PICKS_CRACKY_LIST[i],
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
--
|
||||
-- Crafts
|
||||
--
|
||||
|
||||
minetest.register_craft({
|
||||
output = "metals:"..METALS_LIST[i].."_block",
|
||||
output = "metals:"..metals.list[i].."_block",
|
||||
recipe = {
|
||||
{"metals:"..METALS_LIST[i].."_ingot", "metals:"..METALS_LIST[i].."_ingot"},
|
||||
{"metals:"..METALS_LIST[i].."_ingot", "metals:"..METALS_LIST[i].."_ingot"},
|
||||
{"metals:"..metals.list[i].."_ingot", "metals:"..metals.list[i].."_ingot"},
|
||||
{"metals:"..metals.list[i].."_ingot", "metals:"..metals.list[i].."_ingot"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "metals:"..METALS_LIST[i].."_ingot 4",
|
||||
output = "metals:"..metals.list[i].."_ingot 4",
|
||||
recipe = {
|
||||
{"metals:"..METALS_LIST[i].."_block"},
|
||||
{"metals:"..metals.list[i].."_block"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "metals:ceramic_mold_"..METALS_LIST[i],
|
||||
output = "metals:ceramic_mold_"..metals.list[i],
|
||||
recipe = {
|
||||
{"metals:"..METALS_LIST[i].."_ingot"},
|
||||
{"metals:"..metals.list[i].."_ingot"},
|
||||
{"metals:ceramic_mold"},
|
||||
}
|
||||
})
|
||||
@ -273,64 +253,64 @@ for i=1, #METALS_LIST do
|
||||
minetest.register_craft({
|
||||
output = 'sawing_table:self',
|
||||
recipe = {
|
||||
{'default:tree',"metals:"..METALS_LIST[i].."_ingot",'default:tree'},
|
||||
{'default:tree',"metals:"..metals.list[i].."_ingot",'default:tree'},
|
||||
{'default:tree','','default:tree'},
|
||||
{'default:tree',"metals:"..METALS_LIST[i].."_ingot",'default:tree'},
|
||||
{'default:tree',"metals:"..metals.list[i].."_ingot",'default:tree'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "metals:tool_pick_"..METALS_LIST[i],
|
||||
output = "metals:tool_pick_"..metals.list[i],
|
||||
recipe = {
|
||||
{"metals:tool_pick_"..METALS_LIST[i].."_head"},
|
||||
{"metals:tool_pick_"..metals.list[i].."_head"},
|
||||
{'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "metals:tool_axe_"..METALS_LIST[i],
|
||||
output = "metals:tool_axe_"..metals.list[i],
|
||||
recipe = {
|
||||
{"metals:tool_axe_"..METALS_LIST[i].."_head"},
|
||||
{"metals:tool_axe_"..metals.list[i].."_head"},
|
||||
{'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "metals:tool_shovel_"..METALS_LIST[i],
|
||||
output = "metals:tool_shovel_"..metals.list[i],
|
||||
recipe = {
|
||||
{"metals:tool_shovel_"..METALS_LIST[i].."_head"},
|
||||
{"metals:tool_shovel_"..metals.list[i].."_head"},
|
||||
{'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "metals:tool_sword_"..METALS_LIST[i],
|
||||
output = "metals:tool_sword_"..metals.list[i],
|
||||
recipe = {
|
||||
{"metals:tool_sword_"..METALS_LIST[i].."_head"},
|
||||
{"metals:tool_sword_"..metals.list[i].."_head"},
|
||||
{'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "metals:tool_hammer_"..METALS_LIST[i],
|
||||
output = "metals:tool_hammer_"..metals.list[i],
|
||||
recipe = {
|
||||
{"metals:tool_hammer_"..METALS_LIST[i].."_head"},
|
||||
{"metals:tool_hammer_"..metals.list[i].."_head"},
|
||||
{'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "metals:tool_spear_"..METALS_LIST[i],
|
||||
output = "metals:tool_spear_"..metals.list[i],
|
||||
recipe = {
|
||||
{"metals:tool_spear_"..METALS_LIST[i].."_head"},
|
||||
{"metals:tool_spear_"..metals.list[i].."_head"},
|
||||
{'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "metals:tool_chisel_"..METALS_LIST[i],
|
||||
output = "metals:tool_chisel_"..metals.list[i],
|
||||
recipe = {
|
||||
{"metals:tool_chisel_"..METALS_LIST[i].."_head"},
|
||||
{"metals:tool_chisel_"..metals.list[i].."_head"},
|
||||
{'default:stick'},
|
||||
}
|
||||
})
|
||||
@ -341,8 +321,8 @@ for i=1, #METALS_LIST do
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "metals:"..METALS_LIST[i].."_unshaped",
|
||||
recipe = "metals:ceramic_mold_"..METALS_LIST[i],
|
||||
output = "metals:"..metals.list[i].."_unshaped",
|
||||
recipe = "metals:ceramic_mold_"..metals.list[i],
|
||||
})
|
||||
end
|
||||
|
||||
@ -453,7 +433,7 @@ end
|
||||
-- Recipes
|
||||
--
|
||||
|
||||
local recipes = {
|
||||
metals.recipes = {
|
||||
{"metals:recipe_pick", "Pick Recipe"},
|
||||
{"metals:recipe_axe", "Axe Recipe"},
|
||||
{"metals:recipe_shovel", "Shovel Recipe"},
|
||||
@ -463,7 +443,7 @@ local recipes = {
|
||||
{"metals:recipe_bucket","Bucket Recipe"},
|
||||
}
|
||||
|
||||
for _, recipe in ipairs(recipes) do
|
||||
for _, recipe in ipairs(metals.recipes) do
|
||||
minetest.register_craftitem(recipe[1], {
|
||||
description = recipe[2],
|
||||
inventory_image = "metals_recipe.png",
|
||||
@ -530,7 +510,7 @@ minetest.register_craft({
|
||||
--
|
||||
-- Entitis
|
||||
|
||||
SPEAR_ENTITY={
|
||||
metals.spear.entity = {
|
||||
physical = false,
|
||||
timer=0,
|
||||
textures = {"spear_back.png"},
|
||||
@ -538,7 +518,7 @@ SPEAR_ENTITY={
|
||||
collisionbox = {0,0,0,0,0,0},
|
||||
}
|
||||
|
||||
SPEAR_ENTITY.on_step = function(self, dtime)
|
||||
metals.spear.entity.on_step = function(self, dtime)
|
||||
self.timer=self.timer+dtime
|
||||
local pos = self.object:getpos()
|
||||
local node = minetest.env:get_node(pos)
|
||||
@ -546,7 +526,7 @@ SPEAR_ENTITY.on_step = function(self, dtime)
|
||||
if self.timer>0.2 then
|
||||
local objs = minetest.env:get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
|
||||
for k, obj in pairs(objs) do
|
||||
obj:set_hp(obj:get_hp()-SPEAR_DAMAGE)
|
||||
obj:set_hp(obj:get_hp()-metals.spear.damage)
|
||||
if obj:get_entity_name() ~= "metals:spear_entity" then
|
||||
if obj:get_hp()<=0 then
|
||||
obj:remove()
|
||||
@ -558,11 +538,11 @@ SPEAR_ENTITY.on_step = function(self, dtime)
|
||||
|
||||
if self.lastpos.x~=nil then
|
||||
if node.name ~= "air" then
|
||||
minetest.env:add_item(self.lastpos, 'metals:tool_spear_bismuth')
|
||||
minetest.env:add_item(self.lastpos, 'metals:tool_spear_bismuth')--FIXME
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
self.lastpos={x=pos.x, y=pos.y, z=pos.z}
|
||||
end
|
||||
|
||||
minetest.register_entity("metals:spear_entity", SPEAR_ENTITY)
|
||||
minetest.register_entity("metals:spear_entity", metals.spear.entity)
|
||||
|