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,
|
rmitem1 = RecipeDef.rmitem1,
|
||||||
rmitem2 = RecipeDef.rmitem2,
|
rmitem2 = RecipeDef.rmitem2,
|
||||||
output = RecipeDef.output or "",
|
output = RecipeDef.output or "",
|
||||||
|
level = RecipeDef.level or 0,
|
||||||
}
|
}
|
||||||
if recipe.rmitem1 == nil then
|
if recipe.rmitem1 == nil then
|
||||||
recipe.rmitem1 = true
|
recipe.rmitem1 = true
|
||||||
@ -16,13 +17,16 @@ function realtest.register_anvil_recipe(RecipeDef)
|
|||||||
if recipe.rmitem2 == nil then
|
if recipe.rmitem2 == nil then
|
||||||
recipe.rmitem2 = true
|
recipe.rmitem2 = true
|
||||||
end
|
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
|
if recipe.output ~= "" and recipe.item1 ~= "" and (recipe.type == "forge" or recipe.type == "weld") then
|
||||||
table.insert(realtest.registered_anvil_recipes, recipe)
|
table.insert(realtest.registered_anvil_recipes, recipe)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--Unshaped metals, buckets, double ingots and sheets
|
--Unshaped metals, buckets, double ingots, sheets and hammers
|
||||||
for _, metal in ipairs(METALS_LIST) do
|
for i, metal in ipairs(metals.list) do
|
||||||
realtest.register_anvil_recipe({
|
realtest.register_anvil_recipe({
|
||||||
item1 = "metals:"..metal.."_unshaped",
|
item1 = "metals:"..metal.."_unshaped",
|
||||||
output = "metals:"..metal.."_ingot",
|
output = "metals:"..metal.."_ingot",
|
||||||
@ -32,73 +36,68 @@ for _, metal in ipairs(METALS_LIST) do
|
|||||||
item2 = "metals:recipe_bucket",
|
item2 = "metals:recipe_bucket",
|
||||||
rmitem2 = false,
|
rmitem2 = false,
|
||||||
output = "metals:bucket_empty_"..metal,
|
output = "metals:bucket_empty_"..metal,
|
||||||
|
level = metals.levels[i],
|
||||||
})
|
})
|
||||||
realtest.register_anvil_recipe({
|
realtest.register_anvil_recipe({
|
||||||
item1 = "metals:"..metal.."_doubleingot",
|
item1 = "metals:"..metal.."_doubleingot",
|
||||||
output = "metals:"..metal.."_sheet",
|
output = "metals:"..metal.."_sheet",
|
||||||
|
level = metals.levels[i] - 1,
|
||||||
})
|
})
|
||||||
realtest.register_anvil_recipe({
|
realtest.register_anvil_recipe({
|
||||||
type = "weld",
|
type = "weld",
|
||||||
item1 = "metals:"..metal.."_ingot",
|
item1 = "metals:"..metal.."_ingot",
|
||||||
item2 = "metals:"..metal.."_ingot",
|
item2 = "metals:"..metal.."_ingot",
|
||||||
output = "metals:"..metal.."_doubleingot",
|
output = "metals:"..metal.."_doubleingot",
|
||||||
|
level = metals.levels[i] - 1,
|
||||||
})
|
})
|
||||||
realtest.register_anvil_recipe({
|
realtest.register_anvil_recipe({
|
||||||
type = "weld",
|
type = "weld",
|
||||||
item1 = "metals:"..metal.."_sheet",
|
item1 = "metals:"..metal.."_sheet",
|
||||||
item2 = "metals:"..metal.."_sheet",
|
item2 = "metals:"..metal.."_sheet",
|
||||||
output = "metals:"..metal.."_doublesheet",
|
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
|
end
|
||||||
--Pig iron --> Wrought iron
|
--Pig iron --> Wrought iron
|
||||||
realtest.register_anvil_recipe({
|
realtest.register_anvil_recipe({
|
||||||
item1 = "metals:pig_iron_ingot",
|
item1 = "metals:pig_iron_ingot",
|
||||||
output = "metals:wrought_iron_ingot",
|
output = "metals:wrought_iron_ingot",
|
||||||
|
level = 3,
|
||||||
})
|
})
|
||||||
|
--Instruments
|
||||||
local instruments =
|
local instruments =
|
||||||
{{"axe", "_ingot"},
|
{{"axe", "_ingot"},
|
||||||
{"pick", "_ingot"},
|
{"pick", "_ingot"},
|
||||||
{"shovel", "_ingot"},
|
{"shovel", "_ingot"},
|
||||||
{"spear", "_ingot"},
|
{"spear", "_ingot"},
|
||||||
{"sword", "_doubleingot"},
|
{"sword", "_doubleingot"},
|
||||||
{"hammer", "_doubleingot"}}
|
{"hammer", "_doubleingot"}
|
||||||
|
}
|
||||||
for _, instrument in ipairs(instruments) do
|
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({
|
realtest.register_anvil_recipe({
|
||||||
item1 = "metals:"..metal..instrument[2],
|
item1 = "metals:"..metal..instrument[2],
|
||||||
item2 = "metals:recipe_"..instrument[1],
|
item2 = "metals:recipe_"..instrument[1],
|
||||||
rmitem2 = false,
|
rmitem2 = false,
|
||||||
output = "metals:tool_"..instrument[1].."_"..metal.."_head",
|
output = "metals:tool_"..instrument[1].."_"..metal.."_head",
|
||||||
|
level = metals.levels[i],
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
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({
|
minetest.register_craft({
|
||||||
output = 'anvil:self',
|
output = 'anvil:stone_anvil',
|
||||||
recipe = {
|
recipe = {
|
||||||
{'default:stone','default:stone','default:stone'},
|
{'default:stone','default:stone','default:stone'},
|
||||||
{'','default:stone',''},
|
{'','default:stone',''},
|
||||||
@ -115,9 +114,10 @@ minetest.register_craft({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_tool("anvil:hammer", {
|
minetest.register_tool("anvil:tool_hammer_stone", {
|
||||||
description = "Hammer",
|
description = "Stone Hammer",
|
||||||
inventory_image = "anvil_hammer.png",
|
inventory_image = "anvil_tool_hammer_stone.png",
|
||||||
|
groups = {anvil_level = 0},
|
||||||
tool_capabilities = {
|
tool_capabilities = {
|
||||||
max_drop_level=1,
|
max_drop_level=1,
|
||||||
groupcaps={
|
groupcaps={
|
||||||
@ -127,9 +127,22 @@ minetest.register_tool("anvil:hammer", {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("anvil:self", {
|
local anvils = {
|
||||||
description = "Anvil",
|
{'stone', 'Stone', 0},
|
||||||
tiles = {"anvil_top.png","anvil_top.png","anvil_side.png"},
|
{'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}
|
||||||
|
}
|
||||||
|
|
||||||
|
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",
|
drawtype = "nodebox",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
@ -174,7 +187,7 @@ minetest.register_node("anvil:self", {
|
|||||||
"list[current_name;output;3.5,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_name;flux;6,1.5;1,1;]"..
|
||||||
"list[current_player;main;0,3;8,4;]")
|
"list[current_player;main;0,3;8,4;]")
|
||||||
meta:set_string("infotext", "Anvil")
|
meta:set_string("infotext", anvil[2].." Anvil")
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
inv:set_size("src1", 1)
|
inv:set_size("src1", 1)
|
||||||
inv:set_size("src2", 1)
|
inv:set_size("src2", 1)
|
||||||
@ -189,11 +202,12 @@ minetest.register_node("anvil:self", {
|
|||||||
local src1, src2 = inv:get_stack("src1", 1), inv:get_stack("src2", 1)
|
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 hammer, flux = inv:get_stack("hammer", 1), inv:get_stack("flux", 1)
|
||||||
local output = inv:get_stack("output", 1)
|
local output = inv:get_stack("output", 1)
|
||||||
|
if string.sub(hammer:get_name(), 12, 17) == "hammer" then
|
||||||
if fields["buttonForge"] then
|
if fields["buttonForge"] then
|
||||||
if table.contains(anvil.hammers, hammer:get_name()) then
|
|
||||||
for _, recipe in ipairs(realtest.registered_anvil_recipes) do
|
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 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 inv:room_for_item("output", recipe.output) then
|
||||||
if recipe.rmitem1 then
|
if recipe.rmitem1 then
|
||||||
src1:take_item()
|
src1:take_item()
|
||||||
@ -211,11 +225,12 @@ minetest.register_node("anvil:self", {
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
elseif fields["buttonWeld"] then
|
elseif fields["buttonWeld"] then
|
||||||
if flux:get_name() == "minerals:flux" and table.contains(anvil.hammers, hammer:get_name()) then
|
if flux:get_name() == "minerals:flux" then
|
||||||
for _, recipe in ipairs(realtest.registered_anvil_recipes) do
|
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 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 inv:room_for_item("output", recipe.output) then
|
||||||
if recipe.rmitem1 then
|
if recipe.rmitem1 then
|
||||||
src1:take_item()
|
src1:take_item()
|
||||||
@ -237,5 +252,17 @@ minetest.register_node("anvil:self", {
|
|||||||
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)
|
table.contains = function(t, v)
|
||||||
for _, i in ipairs(t) do
|
for _, i in ipairs(t) do
|
||||||
if i==v then
|
if i == v then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
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
|
-- Tool definition
|
||||||
--
|
--
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
bucket = {}
|
buckets = {}
|
||||||
bucket.liquids = {}
|
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,
|
source = source,
|
||||||
flowing = flowing,
|
flowing = flowing,
|
||||||
itemname = itemname,
|
itemname = itemname,
|
||||||
}
|
}
|
||||||
bucket.liquids[flowing] = bucket.liquids[source]
|
buckets.liquids[flowing] = buckets.liquids[source]
|
||||||
|
|
||||||
if itemname ~= nil then
|
if itemname ~= nil then
|
||||||
for i = 1,#METALS_LIST do
|
for i = 1,#metals.list do
|
||||||
minetest.register_craftitem(itemname.."_"..METALS_LIST[i], {
|
minetest.register_craftitem(itemname.."_"..metals.list[i], {
|
||||||
inventory_image = "metals_"..METALS_LIST[i].."_bucket.png^"..inventory_image,
|
inventory_image = "metals_"..metals.list[i].."_bucket.png^"..inventory_image,
|
||||||
stack_max = 1,
|
stack_max = 1,
|
||||||
liquids_pointable = true,
|
liquids_pointable = true,
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
@ -23,7 +23,7 @@ function bucket.register_liquid(source, flowing, itemname, inventory_image)
|
|||||||
end
|
end
|
||||||
-- Check if pointing to a liquid
|
-- Check if pointing to a liquid
|
||||||
n = minetest.env:get_node(pointed_thing.under)
|
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
|
-- Not a liquid
|
||||||
--if minetest.env:get_node(pointed_thing.above) == "air" then
|
--if minetest.env:get_node(pointed_thing.above) == "air" then
|
||||||
minetest.env:add_node(pointed_thing.above, {name=source})
|
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
|
-- It's a liquid
|
||||||
minetest.env:add_node(pointed_thing.under, {name=source})
|
minetest.env:add_node(pointed_thing.under, {name=source})
|
||||||
end
|
end
|
||||||
return {name="metals:bucket_empty_"..METALS_LIST[i]}
|
return {name="metals:bucket_empty_"..metals.list[i]}
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
for i = 1,#METALS_LIST do
|
for i = 1,#metals.list do
|
||||||
minetest.register_craftitem("metals:bucket_empty_"..METALS_LIST[i], {
|
minetest.register_craftitem("metals:bucket_empty_"..metals.list[i], {
|
||||||
description = "Emtpy " .. DESC_LIST[i] .. " Bucket",
|
description = "Emtpy " .. metals.desc_list[i] .. " Bucket",
|
||||||
inventory_image = "metals_"..METALS_LIST[i].."_bucket.png",
|
inventory_image = "metals_"..metals.list[i].."_bucket.png",
|
||||||
stack_max = 1,
|
stack_max = 1,
|
||||||
liquids_pointable = true,
|
liquids_pointable = true,
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
@ -52,23 +52,23 @@ for i = 1,#METALS_LIST do
|
|||||||
end
|
end
|
||||||
-- Check if pointing to a liquid source
|
-- Check if pointing to a liquid source
|
||||||
n = minetest.env:get_node(pointed_thing.under)
|
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
|
if liquiddef ~= nil and liquiddef.source == n.name and liquiddef.itemname ~= nil then
|
||||||
minetest.env:add_node(pointed_thing.under, {name="air"})
|
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,
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
bucket.register_liquid(
|
buckets.register_liquid(
|
||||||
"default:water_source",
|
"default:water_source",
|
||||||
"default:water_flowing",
|
"default:water_flowing",
|
||||||
"metals:bucket_water",
|
"metals:bucket_water",
|
||||||
"metals_water.png"
|
"metals_water.png"
|
||||||
)
|
)
|
||||||
|
|
||||||
bucket.register_liquid(
|
buckets.register_liquid(
|
||||||
"default:lava_source",
|
"default:lava_source",
|
||||||
"default:lava_flowing",
|
"default:lava_flowing",
|
||||||
"metals:bucket_lava",
|
"metals:bucket_lava",
|
||||||
|
@ -1,170 +1,159 @@
|
|||||||
--replacements = {{"metals:"..METALS_LIST[i].."_unshaped", "metals:ceramic_mold"}}
|
metals = {}
|
||||||
|
metals.spear = {}
|
||||||
|
|
||||||
SPEAR_DAMAGE=10
|
metals.spear.damage = 10
|
||||||
SPEAR_GRAVITY=9
|
metals.spear.gravity = 9
|
||||||
SPEAR_VELOCITY=19
|
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',
|
'bismuth',
|
||||||
'pig_iron',
|
|
||||||
'wrought_iron',
|
|
||||||
'steel',
|
|
||||||
'gold',
|
|
||||||
'nickel',
|
|
||||||
'platinum',
|
|
||||||
'tin',
|
|
||||||
'silver',
|
|
||||||
'lead',
|
|
||||||
'copper',
|
|
||||||
'zinc',
|
'zinc',
|
||||||
|
'tin',
|
||||||
|
----------
|
||||||
|
'copper',
|
||||||
|
----------
|
||||||
|
'lead',
|
||||||
|
'silver',
|
||||||
|
'gold',
|
||||||
'brass',
|
'brass',
|
||||||
'sterling_silver',
|
'sterling_silver',
|
||||||
'rose_gold',
|
'rose_gold',
|
||||||
'black_bronze',
|
'black_bronze',
|
||||||
'bismuth_bronze',
|
'bismuth_bronze',
|
||||||
'bronze',
|
'bronze',
|
||||||
'black_steel',
|
|
||||||
'aluminium',
|
'aluminium',
|
||||||
|
----------
|
||||||
|
'platinum',
|
||||||
|
'pig_iron',
|
||||||
|
'wrought_iron',
|
||||||
|
----------
|
||||||
|
'nickel',
|
||||||
|
'steel',
|
||||||
|
----------
|
||||||
|
'black_steel'
|
||||||
}
|
}
|
||||||
|
|
||||||
DESC_LIST={
|
metals.desc_list = {
|
||||||
'Bismuth',
|
'Bismuth',
|
||||||
'Pig Iron',
|
|
||||||
'Wrought Iron',
|
|
||||||
'Steel',
|
|
||||||
'Gold',
|
|
||||||
'Nickel',
|
|
||||||
'Platinum',
|
|
||||||
'Tin',
|
|
||||||
'Silver',
|
|
||||||
'Lead',
|
|
||||||
'Copper',
|
|
||||||
'Zinc',
|
'Zinc',
|
||||||
|
'Tin',
|
||||||
|
----------
|
||||||
|
'Copper',
|
||||||
|
----------
|
||||||
|
'Lead',
|
||||||
|
'Silver',
|
||||||
|
'Gold',
|
||||||
'Brass',
|
'Brass',
|
||||||
'Sterling Silver',
|
'Sterling Silver',
|
||||||
'Rose Gold',
|
'Rose Gold',
|
||||||
'Black Bronze',
|
'Black Bronze',
|
||||||
'Bismuth Bronze',
|
'Bismuth Bronze',
|
||||||
'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").."/groupcaps.lua")
|
||||||
dofile(minetest.get_modpath("metals").."/buckets.lua")
|
dofile(minetest.get_modpath("metals").."/buckets.lua")
|
||||||
|
|
||||||
for i=1, #METALS_LIST do
|
for i=1, #metals.list do
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Craftitems
|
-- Craftitems
|
||||||
--
|
--
|
||||||
|
|
||||||
minetest.register_craftitem("metals:"..METALS_LIST[i].."_unshaped", {
|
minetest.register_craftitem("metals:"..metals.list[i].."_unshaped", {
|
||||||
description = "Unshaped "..DESC_LIST[i],
|
description = "Unshaped "..metals.desc_list[i],
|
||||||
inventory_image = "metals_"..METALS_LIST[i].."_unshaped.png",
|
inventory_image = "metals_"..metals.list[i].."_unshaped.png",
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("metals:"..METALS_LIST[i].."_ingot", {
|
minetest.register_craftitem("metals:"..metals.list[i].."_ingot", {
|
||||||
description = DESC_LIST[i].." Ingot",
|
description = metals.desc_list[i].." Ingot",
|
||||||
inventory_image = "metals_"..METALS_LIST[i].."_ingot.png",
|
inventory_image = "metals_"..metals.list[i].."_ingot.png",
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("metals:" .. METALS_LIST[i] .. "_doubleingot", {
|
minetest.register_craftitem("metals:"..metals.list[i].."_doubleingot", {
|
||||||
description = DESC_LIST[i] .. " Double Ingot",
|
description = metals.desc_list[i].." Double Ingot",
|
||||||
inventory_image = "metals_" .. METALS_LIST[i] .. "_doubleingot.png",
|
inventory_image = "metals_"..metals.list[i].."_doubleingot.png",
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("metals:" .. METALS_LIST[i] .. "_sheet", {
|
minetest.register_craftitem("metals:"..metals.list[i].."_sheet", {
|
||||||
description = DESC_LIST[i] .. " Sheet",
|
description = metals.desc_list[i].." Sheet",
|
||||||
inventory_image = "metals_" .. METALS_LIST[i] .. "_sheet.png",
|
inventory_image = "metals_" .. metals.list[i].."_sheet.png",
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("metals:" .. METALS_LIST[i] .. "_doublesheet", {
|
minetest.register_craftitem("metals:"..metals.list[i].."_doublesheet", {
|
||||||
description = DESC_LIST[i] .. " Double Sheet",
|
description = metals.desc_list[i].." Double Sheet",
|
||||||
inventory_image = "metals_" .. METALS_LIST[i] .. "_doublesheet.png",
|
inventory_image = "metals_"..metals.list[i].."_doublesheet.png",
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("metals:tool_pick_"..METALS_LIST[i].."_head", {
|
minetest.register_craftitem("metals:tool_pick_"..metals.list[i].."_head", {
|
||||||
description =DESC_LIST[i].." pickaxe head",
|
description =metals.desc_list[i].." Pickaxe Head",
|
||||||
inventory_image = "metals_tool_pick_"..METALS_LIST[i].."_head.png",
|
inventory_image = "metals_tool_pick_"..metals.list[i].."_head.png",
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("metals:tool_axe_"..METALS_LIST[i].."_head", {
|
minetest.register_craftitem("metals:tool_axe_"..metals.list[i].."_head", {
|
||||||
description =DESC_LIST[i].." axe head",
|
description =metals.desc_list[i].." Axe Head",
|
||||||
inventory_image = "metals_tool_axe_"..METALS_LIST[i].."_head.png",
|
inventory_image = "metals_tool_axe_"..metals.list[i].."_head.png",
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("metals:tool_shovel_"..METALS_LIST[i].."_head", {
|
minetest.register_craftitem("metals:tool_shovel_"..metals.list[i].."_head", {
|
||||||
description =DESC_LIST[i].." shovel head",
|
description =metals.desc_list[i].." Shovel Head",
|
||||||
inventory_image = "metals_tool_shovel_"..METALS_LIST[i].."_head.png",
|
inventory_image = "metals_tool_shovel_"..metals.list[i].."_head.png",
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("metals:tool_sword_"..METALS_LIST[i].."_head", {
|
minetest.register_craftitem("metals:tool_sword_"..metals.list[i].."_head", {
|
||||||
description =DESC_LIST[i].." sword head",
|
description =metals.desc_list[i].." Sword Head",
|
||||||
inventory_image = "metals_tool_sword_"..METALS_LIST[i].."_head.png",
|
inventory_image = "metals_tool_sword_"..metals.list[i].."_head.png",
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("metals:tool_hammer_"..METALS_LIST[i].."_head", {
|
minetest.register_craftitem("metals:tool_hammer_"..metals.list[i].."_head", {
|
||||||
description =DESC_LIST[i].." hammer head",
|
description =metals.desc_list[i].." Hammer Head",
|
||||||
inventory_image = "metals_tool_hammer_"..METALS_LIST[i].."_head.png",
|
inventory_image = "metals_tool_hammer_"..metals.list[i].."_head.png",
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("metals:tool_spear_"..METALS_LIST[i].."_head", {
|
minetest.register_craftitem("metals:tool_spear_"..metals.list[i].."_head", {
|
||||||
description =DESC_LIST[i].." spear head",
|
description =metals.desc_list[i].." Spear Head",
|
||||||
inventory_image = "metals_tool_spear_"..METALS_LIST[i].."_head.png",
|
inventory_image = "metals_tool_spear_"..metals.list[i].."_head.png",
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("metals:tool_chisel_"..METALS_LIST[i].."_head", {
|
minetest.register_craftitem("metals:tool_chisel_"..metals.list[i].."_head", {
|
||||||
description =DESC_LIST[i].." chisel head",
|
description =metals.desc_list[i].." Chisel Head",
|
||||||
inventory_image = "metals_tool_chisel_"..METALS_LIST[i].."_head.png",
|
inventory_image = "metals_tool_chisel_"..metals.list[i].."_head.png",
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("metals:ceramic_mold_"..METALS_LIST[i], {
|
minetest.register_craftitem("metals:ceramic_mold_"..metals.list[i], {
|
||||||
description = "Ceramic mold with "..DESC_SMALL_LIST[i],
|
description = "Ceramic Mold with "..metals.desc_list[i],
|
||||||
inventory_image = "metals_ceramic_mold.png^metals_"..METALS_LIST[i].."_ingot.png",
|
inventory_image = "metals_ceramic_mold.png^metals_"..metals.list[i].."_ingot.png",
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("metals:tool_spear_"..METALS_LIST[i], {
|
minetest.register_craftitem("metals:tool_spear_"..metals.list[i], {
|
||||||
description = DESC_LIST[i].." spear",
|
description = metals.desc_list[i].." spear",
|
||||||
inventory_image = "metals_tool_spear_"..METALS_LIST[i]..".png",
|
inventory_image = "metals_tool_spear_"..metals.list[i]..".png",
|
||||||
on_use = function (item, player, pointed_thing)
|
on_use = function (item, player, pointed_thing)
|
||||||
local playerpos=player:getpos()
|
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 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()
|
local dir=player:get_look_dir()
|
||||||
obj:setvelocity({x=dir.x*SPEAR_VELOCITY, y=dir.y*SPEAR_VELOCITY, z=dir.z*SPEAR_VELOCITY})
|
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=-SPEAR_GRAVITY, z=dir.z*-3})
|
obj:setacceleration({x=dir.x*-3, y=-metals.spear.gravity, z=dir.z*-3})
|
||||||
return ""
|
return ""
|
||||||
end,
|
end,
|
||||||
stack_max = 1,
|
stack_max = 1,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("metals:tool_chisel_"..METALS_LIST[i], {
|
minetest.register_tool("metals:tool_chisel_"..metals.list[i], {
|
||||||
description = DESC_LIST[i].." chisel",
|
description = metals.desc_list[i].." chisel",
|
||||||
inventory_image = "metals_tool_chisel_"..METALS_LIST[i]..".png",
|
inventory_image = "metals_tool_chisel_"..metals.list[i]..".png",
|
||||||
on_use = function (item, player, pointed_thing)
|
on_use = function (item, player, pointed_thing)
|
||||||
if pointed_thing.type ~= "node" then
|
if pointed_thing.type ~= "node" then
|
||||||
return
|
return
|
||||||
@ -175,17 +164,18 @@ for i=1, #METALS_LIST do
|
|||||||
if minetest.env:get_node(pointed_thing.under).name == "default:desert_stone" then
|
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"})
|
minetest.env:add_node(pointed_thing.under, {name="realistic_add_blocks:desert_stone_flat"})
|
||||||
end
|
end
|
||||||
|
item:add_wear(65535/10)
|
||||||
|
return item
|
||||||
end,
|
end,
|
||||||
stack_max = 1,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Nodes
|
-- Nodes
|
||||||
--
|
--
|
||||||
|
|
||||||
minetest.register_node("metals:"..METALS_LIST[i].."_block", {
|
minetest.register_node("metals:"..metals.list[i].."_block", {
|
||||||
description = "Block of "..DESC_SMALL_LIST[i],
|
description = "Block of "..metals.desc_list[i],
|
||||||
tiles = {"metals_"..METALS_LIST[i].."_block.png"},
|
tiles = {"metals_"..metals.list[i].."_block.png"},
|
||||||
is_ground_content = true,
|
is_ground_content = true,
|
||||||
groups = {snappy=1,bendy=2,cracky=1,melty=2,level=2},
|
groups = {snappy=1,bendy=2,cracky=1,melty=2,level=2},
|
||||||
sounds = default.node_sound_stone_defaults(),
|
sounds = default.node_sound_stone_defaults(),
|
||||||
@ -195,9 +185,9 @@ for i=1, #METALS_LIST do
|
|||||||
-- Tools
|
-- Tools
|
||||||
--
|
--
|
||||||
|
|
||||||
minetest.register_tool("metals:tool_pick_"..METALS_LIST[i], {
|
minetest.register_tool("metals:tool_pick_"..metals.list[i], {
|
||||||
description = DESC_LIST[i].." pickaxe",
|
description = metals.desc_list[i].." Pickaxe",
|
||||||
inventory_image = "metals_tool_pick_"..METALS_LIST[i]..".png",
|
inventory_image = "metals_tool_pick_"..metals.list[i]..".png",
|
||||||
tool_capabilities = {
|
tool_capabilities = {
|
||||||
max_drop_level=1,
|
max_drop_level=1,
|
||||||
groupcaps={
|
groupcaps={
|
||||||
@ -205,9 +195,9 @@ for i=1, #METALS_LIST do
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
minetest.register_tool("metals:tool_shovel_"..METALS_LIST[i], {
|
minetest.register_tool("metals:tool_shovel_"..metals.list[i], {
|
||||||
description = DESC_LIST[i].." shovel",
|
description = metals.desc_list[i].." Shovel",
|
||||||
inventory_image = "metals_tool_shovel_"..METALS_LIST[i]..".png",
|
inventory_image = "metals_tool_shovel_"..metals.list[i]..".png",
|
||||||
tool_capabilities = {
|
tool_capabilities = {
|
||||||
max_drop_level=1,
|
max_drop_level=1,
|
||||||
groupcaps={
|
groupcaps={
|
||||||
@ -215,57 +205,47 @@ for i=1, #METALS_LIST do
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
minetest.register_tool("metals:tool_axe_"..METALS_LIST[i], {
|
minetest.register_tool("metals:tool_axe_"..metals.list[i], {
|
||||||
description = DESC_LIST[i].." axe",
|
description = metals.desc_list[i].." Axe",
|
||||||
inventory_image = "metals_tool_axe_"..METALS_LIST[i]..".png",
|
inventory_image = "metals_tool_axe_"..metals.list[i]..".png",
|
||||||
tool_capabilities = {
|
tool_capabilities = {
|
||||||
max_drop_level=1,
|
max_drop_level=1,
|
||||||
groupcaps=AXE_GROUPCAPS[i],
|
groupcaps=AXE_GROUPCAPS[i],
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
minetest.register_tool("metals:tool_sword_"..METALS_LIST[i], {
|
minetest.register_tool("metals:tool_sword_"..metals.list[i], {
|
||||||
description = DESC_LIST[i].." sword",
|
description = metals.desc_list[i].." Sword",
|
||||||
inventory_image = "metals_tool_sword_"..METALS_LIST[i]..".png",
|
inventory_image = "metals_tool_sword_"..metals.list[i]..".png",
|
||||||
tool_capabilities = {
|
tool_capabilities = {
|
||||||
full_punch_interval = 1.0,
|
full_punch_interval = 1.0,
|
||||||
max_drop_level=1,
|
max_drop_level=1,
|
||||||
groupcaps=SWORD_GROUPCAPS[i],
|
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
|
-- Crafts
|
||||||
--
|
--
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "metals:"..METALS_LIST[i].."_block",
|
output = "metals:"..metals.list[i].."_block",
|
||||||
recipe = {
|
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({
|
minetest.register_craft({
|
||||||
output = "metals:"..METALS_LIST[i].."_ingot 4",
|
output = "metals:"..metals.list[i].."_ingot 4",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"metals:"..METALS_LIST[i].."_block"},
|
{"metals:"..metals.list[i].."_block"},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "metals:ceramic_mold_"..METALS_LIST[i],
|
output = "metals:ceramic_mold_"..metals.list[i],
|
||||||
recipe = {
|
recipe = {
|
||||||
{"metals:"..METALS_LIST[i].."_ingot"},
|
{"metals:"..metals.list[i].."_ingot"},
|
||||||
{"metals:ceramic_mold"},
|
{"metals:ceramic_mold"},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -273,64 +253,64 @@ for i=1, #METALS_LIST do
|
|||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'sawing_table:self',
|
output = 'sawing_table:self',
|
||||||
recipe = {
|
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','','default:tree'},
|
||||||
{'default:tree',"metals:"..METALS_LIST[i].."_ingot",'default:tree'},
|
{'default:tree',"metals:"..metals.list[i].."_ingot",'default:tree'},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "metals:tool_pick_"..METALS_LIST[i],
|
output = "metals:tool_pick_"..metals.list[i],
|
||||||
recipe = {
|
recipe = {
|
||||||
{"metals:tool_pick_"..METALS_LIST[i].."_head"},
|
{"metals:tool_pick_"..metals.list[i].."_head"},
|
||||||
{'default:stick'},
|
{'default:stick'},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "metals:tool_axe_"..METALS_LIST[i],
|
output = "metals:tool_axe_"..metals.list[i],
|
||||||
recipe = {
|
recipe = {
|
||||||
{"metals:tool_axe_"..METALS_LIST[i].."_head"},
|
{"metals:tool_axe_"..metals.list[i].."_head"},
|
||||||
{'default:stick'},
|
{'default:stick'},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "metals:tool_shovel_"..METALS_LIST[i],
|
output = "metals:tool_shovel_"..metals.list[i],
|
||||||
recipe = {
|
recipe = {
|
||||||
{"metals:tool_shovel_"..METALS_LIST[i].."_head"},
|
{"metals:tool_shovel_"..metals.list[i].."_head"},
|
||||||
{'default:stick'},
|
{'default:stick'},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "metals:tool_sword_"..METALS_LIST[i],
|
output = "metals:tool_sword_"..metals.list[i],
|
||||||
recipe = {
|
recipe = {
|
||||||
{"metals:tool_sword_"..METALS_LIST[i].."_head"},
|
{"metals:tool_sword_"..metals.list[i].."_head"},
|
||||||
{'default:stick'},
|
{'default:stick'},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "metals:tool_hammer_"..METALS_LIST[i],
|
output = "metals:tool_hammer_"..metals.list[i],
|
||||||
recipe = {
|
recipe = {
|
||||||
{"metals:tool_hammer_"..METALS_LIST[i].."_head"},
|
{"metals:tool_hammer_"..metals.list[i].."_head"},
|
||||||
{'default:stick'},
|
{'default:stick'},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "metals:tool_spear_"..METALS_LIST[i],
|
output = "metals:tool_spear_"..metals.list[i],
|
||||||
recipe = {
|
recipe = {
|
||||||
{"metals:tool_spear_"..METALS_LIST[i].."_head"},
|
{"metals:tool_spear_"..metals.list[i].."_head"},
|
||||||
{'default:stick'},
|
{'default:stick'},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "metals:tool_chisel_"..METALS_LIST[i],
|
output = "metals:tool_chisel_"..metals.list[i],
|
||||||
recipe = {
|
recipe = {
|
||||||
{"metals:tool_chisel_"..METALS_LIST[i].."_head"},
|
{"metals:tool_chisel_"..metals.list[i].."_head"},
|
||||||
{'default:stick'},
|
{'default:stick'},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -341,8 +321,8 @@ for i=1, #METALS_LIST do
|
|||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "cooking",
|
type = "cooking",
|
||||||
output = "metals:"..METALS_LIST[i].."_unshaped",
|
output = "metals:"..metals.list[i].."_unshaped",
|
||||||
recipe = "metals:ceramic_mold_"..METALS_LIST[i],
|
recipe = "metals:ceramic_mold_"..metals.list[i],
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -453,7 +433,7 @@ end
|
|||||||
-- Recipes
|
-- Recipes
|
||||||
--
|
--
|
||||||
|
|
||||||
local recipes = {
|
metals.recipes = {
|
||||||
{"metals:recipe_pick", "Pick Recipe"},
|
{"metals:recipe_pick", "Pick Recipe"},
|
||||||
{"metals:recipe_axe", "Axe Recipe"},
|
{"metals:recipe_axe", "Axe Recipe"},
|
||||||
{"metals:recipe_shovel", "Shovel Recipe"},
|
{"metals:recipe_shovel", "Shovel Recipe"},
|
||||||
@ -463,7 +443,7 @@ local recipes = {
|
|||||||
{"metals:recipe_bucket","Bucket Recipe"},
|
{"metals:recipe_bucket","Bucket Recipe"},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, recipe in ipairs(recipes) do
|
for _, recipe in ipairs(metals.recipes) do
|
||||||
minetest.register_craftitem(recipe[1], {
|
minetest.register_craftitem(recipe[1], {
|
||||||
description = recipe[2],
|
description = recipe[2],
|
||||||
inventory_image = "metals_recipe.png",
|
inventory_image = "metals_recipe.png",
|
||||||
@ -530,7 +510,7 @@ minetest.register_craft({
|
|||||||
--
|
--
|
||||||
-- Entitis
|
-- Entitis
|
||||||
|
|
||||||
SPEAR_ENTITY={
|
metals.spear.entity = {
|
||||||
physical = false,
|
physical = false,
|
||||||
timer=0,
|
timer=0,
|
||||||
textures = {"spear_back.png"},
|
textures = {"spear_back.png"},
|
||||||
@ -538,7 +518,7 @@ SPEAR_ENTITY={
|
|||||||
collisionbox = {0,0,0,0,0,0},
|
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
|
self.timer=self.timer+dtime
|
||||||
local pos = self.object:getpos()
|
local pos = self.object:getpos()
|
||||||
local node = minetest.env:get_node(pos)
|
local node = minetest.env:get_node(pos)
|
||||||
@ -546,7 +526,7 @@ SPEAR_ENTITY.on_step = function(self, dtime)
|
|||||||
if self.timer>0.2 then
|
if self.timer>0.2 then
|
||||||
local objs = minetest.env:get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
|
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
|
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_entity_name() ~= "metals:spear_entity" then
|
||||||
if obj:get_hp()<=0 then
|
if obj:get_hp()<=0 then
|
||||||
obj:remove()
|
obj:remove()
|
||||||
@ -558,11 +538,11 @@ SPEAR_ENTITY.on_step = function(self, dtime)
|
|||||||
|
|
||||||
if self.lastpos.x~=nil then
|
if self.lastpos.x~=nil then
|
||||||
if node.name ~= "air" 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()
|
self.object:remove()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
self.lastpos={x=pos.x, y=pos.y, z=pos.z}
|
self.lastpos={x=pos.x, y=pos.y, z=pos.z}
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_entity("metals:spear_entity", SPEAR_ENTITY)
|
minetest.register_entity("metals:spear_entity", metals.spear.entity)
|
||||||
|