owl_tech/ore/node_register.lua

984 lines
40 KiB
Lua
Executable File

local S = minetest.get_translator(minetest.get_current_modname())
local name = minetest.get_current_modname()
local path = minetest.get_modpath(name)
---- This crutch was suggested by the developers of Mineclone 2 - they made the functions of their shovels and hoes local
local function create_soil(pos, inv)
if pos == nil then
return false
end
local node = minetest.get_node(pos)
local name = node.name
local above = minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z})
if minetest.get_item_group(name, "cultivatable") == 2 then
if above.name == "air" then
node.name = "mcl_farming:soil"
minetest.set_node(pos, node)
minetest.sound_play("default_dig_crumbly", { pos = pos, gain = 0.5 }, true)
return true
end
elseif minetest.get_item_group(name, "cultivatable") == 1 then
if above.name == "air" then
node.name = "mcl_core:dirt"
minetest.set_node(pos, node)
minetest.sound_play("default_dig_crumbly", { pos = pos, gain = 0.6 }, true)
return true
end
end
return false
end
local make_grass_path = function(itemstack, placer, pointed_thing)
-- Use pointed node's on_rightclick function first, if present
local node = minetest.get_node(pointed_thing.under)
if placer and not placer:get_player_control().sneak then
if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then
return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer, itemstack) or itemstack
end
end
-- Only make grass path if tool used on side or top of target node
if pointed_thing.above.y < pointed_thing.under.y then
return itemstack
end
if (minetest.get_item_group(node.name, "path_creation_possible") == 1) then
local above = table.copy(pointed_thing.under)
above.y = above.y + 1
if minetest.get_node(above).name == "air" then
if minetest.is_protected(pointed_thing.under, placer:get_player_name()) then
minetest.record_protection_violation(pointed_thing.under, placer:get_player_name())
return itemstack
end
if not minetest.is_creative_enabled(placer:get_player_name()) then
-- Add wear (as if digging a shovely node)
local toolname = itemstack:get_name()
local wear = mcl_autogroup.get_wear(toolname, "shovely")
itemstack:add_wear(wear)
end
minetest.sound_play({name="default_grass_footstep", gain=1}, {pos = above}, true)
minetest.swap_node(pointed_thing.under, {name="mcl_core:grass_path"})
end
end
return itemstack
end
-- Axes
local function make_stripped_trunk(itemstack, placer, pointed_thing)
if pointed_thing.type ~= "node" then return end
local node = minetest.get_node(pointed_thing.under)
local noddef = minetest.registered_nodes[minetest.get_node(pointed_thing.under).name]
if not placer:get_player_control().sneak and noddef.on_rightclick then
return minetest.item_place(itemstack, placer, pointed_thing)
end
if minetest.is_protected(pointed_thing.under, placer:get_player_name()) then
minetest.record_protection_violation(pointed_thing.under, placer:get_player_name())
return itemstack
end
if noddef._mcl_stripped_variant == nil then
return itemstack
else
minetest.swap_node(pointed_thing.under, {name=noddef._mcl_stripped_variant, param2=node.param2})
if not minetest.is_creative_enabled(placer:get_player_name()) then
-- Add wear (as if digging a axey node)
local toolname = itemstack:get_name()
local wear = mcl_autogroup.get_wear(toolname, "axey")
itemstack:add_wear(wear)
end
end
return itemstack
end
local hoe_on_place_function = function(wear_divisor) --Copy-past from mcl_farming ( in mc it local func adn can 't access to mod ')
return function(itemstack, user, pointed_thing)
-- Call on_rightclick if the pointed node defines it
local node = minetest.get_node(pointed_thing.under)
if user and not user:get_player_control().sneak then
if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then
return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, user, itemstack) or itemstack
end
end
if minetest.is_protected(pointed_thing.under, user:get_player_name()) then
minetest.record_protection_violation(pointed_thing.under, user:get_player_name())
return itemstack
end
if create_soil(pointed_thing.under, user:get_inventory()) then
if not minetest.is_creative_enabled(user:get_player_name()) then
itemstack:add_wear(65535/wear_divisor)
end
return itemstack
end
end
end
-- 1)tech_name 2)useal name 3)ineed ore ? 4)pickasxe_level 5)color 6)intrument uses 7)can simple burn ore in furnance ( and dusts)
local metals_ore_array={
{"iron","Iron",true,3,"#f7f7f7",125,true},
{"copper","Copper",true,2,"#ff5e00",75,true},
{"tin","Tin",true,2,"#c9c9c9",88,true},
{"gold","Golg",true,2,"#ffe600",50,true},
{"silver","Silver",true,3,"#d1d1d1",62,true},
{"lead","Lead",true,3,"#9092ab",62,true},
{"steel","Steel",false,3,"#575757",300,false},
{"bronze","Bronze",false,3,"#a35900",200,true},
{"electrum","Electrum",false,2,"#fffd73",55,true},
}
--make metals ALL
for i, value in ipairs(metals_ore_array) do
--ore
if metals_ore_array[i][3] then
minetest.register_node("owl_tech:"..metals_ore_array[i][1].."_ore", {
description = S(metals_ore_array[i][2].." ore"),
_doc_items_longdesc = S(metals_ore_array[i][2]..' ore'),
_doc_items_hidden = false,
tiles = {"default_stone.png^(owl_tech_ore_base.png^[colorize:"..metals_ore_array[i][5]..":128)"},
is_ground_content = true,
stack_max = 64,
groups = {pickaxey=metals_ore_array[i][4], building_block=1, material_stone=1, blast_furnace_smeltable=1},
drop = "owl_tech:"..metals_ore_array[i][1].."_ore",
sounds = mcl_sounds.node_sound_stone_defaults(),
_mcl_blast_resistance = 3,
_mcl_hardness = 3,
_mcl_silk_touch_drop = true,
})
end
--Nugget
minetest.register_craftitem("owl_tech:"..metals_ore_array[i][1].."_nugget", {
description = S(metals_ore_array[i][2].. " Nugget"),
_doc_items_longdesc = S(metals_ore_array[i][2].. " Nugget"),
inventory_image = "mcl_core_iron_nugget.png^[colorize:"..metals_ore_array[i][5]..":128",
stack_max = 64,
groups = { craftitem=1 },
})
--Ingot
minetest.register_craftitem("owl_tech:"..metals_ore_array[i][1].."_ingot", {
description = S(metals_ore_array[i][2].. " Ingot"),
_doc_items_longdesc = S(metals_ore_array[i][2].. " Ingot"),
inventory_image = "default_steel_ingot.png^[colorize:"..metals_ore_array[i][5]..":128",
stack_max = 64,
groups = { craftitem=1 },
})
if metals_ore_array[i][7] then
--Simple burn ore in ingot
minetest.register_craft({
type = "cooking",
output = "owl_tech:"..metals_ore_array[i][1].."_ingot",
recipe = "owl_tech:"..metals_ore_array[i][1].."_ore",
cooktime = 10,
})
--Simple burn dust in ingot
minetest.register_craft({
type = "cooking",
output = "owl_tech:"..metals_ore_array[i][1].."_ingot",
recipe = "owl_tech:"..metals_ore_array[i][1].."_dust",
cooktime = 10,
})
end
--dust
minetest.register_craftitem("owl_tech:"..metals_ore_array[i][1].."_dust", {
description = S(metals_ore_array[i][2].. " dust"),
_doc_items_longdesc = S(metals_ore_array[i][2].. " dust"),
inventory_image = "owl_tech_dust.png^[colorize:"..metals_ore_array[i][5]..":128",
stack_max = 64,
groups = { craftitem=1 },
})
--Cafte dust
minetest.register_craft({
type = "shapeless",
output = "owl_tech:"..metals_ore_array[i][1].."_dust",
recipe = {"owl_tech:work_mortar","owl_tech:"..metals_ore_array[i][1].."_ingot"},
replacements = {
{"owl_tech:work_mortar","owl_tech:work_mortar"},
}
})
--dirt dust
minetest.register_craftitem("owl_tech:"..metals_ore_array[i][1].."_dirt_dust", {
description = S(metals_ore_array[i][2].. " dirt dust"),
_doc_items_longdesc = S(metals_ore_array[i][2].. " dirt dust"),
inventory_image = "owl_tech_dirt_dust.png^[colorize:"..metals_ore_array[i][5]..":128",
stack_max = 64,
groups = { craftitem=1 },
})
--plate
minetest.register_craftitem("owl_tech:"..metals_ore_array[i][1].."_plate", {
description = S(metals_ore_array[i][2].. " plate"),
_doc_items_longdesc = S(metals_ore_array[i][2].. " plate"),
inventory_image = "owl_tech_plate.png^[colorize:"..metals_ore_array[i][5]..":128",
stack_max = 64,
groups = { craftitem=1 },
})
--Cafte plate
minetest.register_craft({
type = "shapeless",
output = "owl_tech:"..metals_ore_array[i][1].."_plate",
recipe = {"owl_tech:work_hammer","owl_tech:"..metals_ore_array[i][1].."_ingot","owl_tech:"..metals_ore_array[i][1].."_ingot"},
replacements = {
{"owl_tech:work_hammer", "owl_tech:work_hammer"},
}
})
--pick
minetest.register_tool("owl_tech:pick_".. metals_ore_array[i][1], {
description = S( metals_ore_array[i][2].." Pickaxe"),
_doc_items_longdesc = "Pick from owl tech",
inventory_image = "(owl_tech_pick_head.png^[colorize:"..metals_ore_array[i][5]..":128)^owl_tech_pick_stick.png", --owl_tech_pick_head.png owl_tech_pick_stick.png
wield_scale = mcl_vars.tool_wield_scale,
groups = { tool=1, pickaxe=1, dig_speed_class=4, enchantability=14 },
tool_capabilities = {
-- 1/1.2
full_punch_interval = 0.83333333,
max_drop_level=4,
damage_groups = {fleshy=4},
punch_attack_uses = (metals_ore_array[i][6]),
},
sound = { breaks = "default_tool_breaks" },
_repair_material = "owl_tech:"..metals_ore_array[i][1].."_ingot",
_mcl_toollike_wield = true,
_mcl_diggroups = {
pickaxey = { speed = 6, level = 4, uses = metals_ore_array[i][6]*2}
},
})
--Pick head
minetest.register_craftitem("owl_tech:pick_head_"..metals_ore_array[i][1], {
description = S("Pick head "..metals_ore_array[i][1]),
_doc_items_longdesc = S("Pick head use for crafte pick in any place"),
inventory_image = "(owl_tech_pick_head.png^[colorize:"..metals_ore_array[i][5]..":128)",
stack_max = 64,
groups = { craftitem=1 },
})
--Crafte pick head
minetest.register_craft({
type = "shaped",
output = "owl_tech:pick_head_"..metals_ore_array[i][1],
recipe = {
{"owl_tech:"..metals_ore_array[i][1].."_plate","owl_tech:"..metals_ore_array[i][1].."_ingot","owl_tech:"..metals_ore_array[i][1].."_ingot"},
{"owl_tech:work_file","","owl_tech:work_hammer",},
{"","",""}
},
replacements = {
{"owl_tech:work_hammer", "owl_tech:work_hammer"},
{"owl_tech:work_file", "owl_tech:work_file"},
}
})
--Crafte pick from pick head
minetest.register_craft({
type = "shapeless",
output = "owl_tech:pick_"..metals_ore_array[i][1],
recipe = {"owl_tech:pick_head_"..metals_ore_array[i][1],"mcl_core:stick"}
})
--axe
minetest.register_tool("owl_tech:axe_".. metals_ore_array[i][1], {
description = S(metals_ore_array[i][2].." axe"),
_doc_items_longdesc = "Axe owl tech",
inventory_image = "(owl_tech_axe_head.png^[colorize:"..metals_ore_array[i][5]..":128)^owl_tech_pick_stick.png",
wield_scale = mcl_vars.tool_wield_scale,
groups = { tool=1, axe=1, dig_speed_class=4, enchantability=14 },
tool_capabilities = {
-- 1/0.9
full_punch_interval = 1.11111111,
max_drop_level=4,
damage_groups = {fleshy=9},
punch_attack_uses = (metals_ore_array[i][6]),
},
on_place = make_stripped_trunk,
sound = { breaks = "default_tool_breaks" },
_repair_material = "owl_tech:"..metals_ore_array[i][1].."_ingot",
_mcl_toollike_wield = true,
_mcl_diggroups = {
axey = { speed = 6, level = 4, uses = metals_ore_array[i][6]*2 }
},
})
--axe head item
minetest.register_craftitem("owl_tech:axe_head_"..metals_ore_array[i][1], {
description = S("Axe head "..metals_ore_array[i][1]),
_doc_items_longdesc = S("Axe head use for crafte axe in any place"),
inventory_image = "(owl_tech_axe_head.png^[colorize:"..metals_ore_array[i][5]..":128)",
stack_max = 64,
groups = { craftitem=1 },
})
--Crafte axe from axe head
minetest.register_craft({
type = "shapeless",
output = "owl_tech:axe_"..metals_ore_array[i][1],
recipe = {"owl_tech:axe_head_"..metals_ore_array[i][1],"mcl_core:stick"}
})
--Crafte head
minetest.register_craft({
type = "shaped",
output = "owl_tech:axe_head_"..metals_ore_array[i][1],
recipe = {
{"owl_tech:"..metals_ore_array[i][1].."_plate","owl_tech:"..metals_ore_array[i][1].."_ingot",""},
{"owl_tech:"..metals_ore_array[i][1].."_ingot","owl_tech:work_hammer",""},
{"owl_tech:work_file","",""}
},
replacements = {
{"owl_tech:work_hammer", "owl_tech:work_hammer"},
{"owl_tech:work_file", "owl_tech:work_file"},
}
})
--Sword
minetest.register_tool("owl_tech:sword_"..metals_ore_array[i][1], {
description = S(metals_ore_array[i][2].." sword"),
_doc_items_longdesc = "Owl tech sword",
inventory_image = "(owl_tech_sword_blade.png^[colorize:"..metals_ore_array[i][5]..":128)^owl_tech_sword_stick.png",
wield_scale = mcl_vars.tool_wield_scale,
groups = { weapon=1, sword=1, dig_speed_class=4, enchantability=14 },
tool_capabilities = {
full_punch_interval = 0.625,
max_drop_level=4,
damage_groups = {fleshy=6},
punch_attack_uses = metals_ore_array[i][6],
},
sound = { breaks = "default_tool_breaks" },
_repair_material = "owl_tech:"..metals_ore_array[i][1].."_ingot",
_mcl_toollike_wield = true,
_mcl_diggroups = {
swordy = { speed = 6, level = 4, uses = metals_ore_array[i][6]*2 },
swordy_cobweb = { speed = 6, level = 4, uses = metals_ore_array[i][6]*2 }
},
})
--sword head
minetest.register_craftitem("owl_tech:sword_head_"..metals_ore_array[i][1], {
description = S("Sword head "..metals_ore_array[i][1]),
_doc_items_longdesc = S("Sword head use for crafte sword in any place"),
inventory_image = "(owl_tech_sword_blade.png^[colorize:"..metals_ore_array[i][5]..":128)",
stack_max = 64,
groups = { craftitem=1 },
})
--Crafte sword from sword head
minetest.register_craft({
type = "shapeless",
output = "owl_tech:sword_"..metals_ore_array[i][1],
recipe = {"owl_tech:sword_head_"..metals_ore_array[i][1],"mcl_core:stick"}
})
--Crafte sword head
minetest.register_craft({
type = "shaped",
output = "owl_tech:sword_head_"..metals_ore_array[i][1],
recipe = {
{"","owl_tech:"..metals_ore_array[i][1].."_plate",""},
{"owl_tech:work_file","owl_tech:"..metals_ore_array[i][1].."_plate","owl_tech:work_hammer"},
{"","",""}
},
replacements = {
{"owl_tech:work_hammer", "owl_tech:work_hammer"},
{"owl_tech:work_file", "owl_tech:work_file"},
}
})
--shovel
minetest.register_tool("owl_tech:shovel_"..metals_ore_array[i][1], {
description = S(metals_ore_array[i][2].." Shovel"),
_doc_items_longdesc = "Owl tech shovel",
_doc_items_usagehelp = shovel_use,
inventory_image = "(owl_tech_shovel_head.png^[colorize:"..metals_ore_array[i][5]..":128)^owl_tech_shovel_stick.png",
wield_scale = wield_scale,
groups = { tool=1, shovel=1, dig_speed_class=4, enchantability=14 },
tool_capabilities = {
full_punch_interval = 1,
max_drop_level=4,
damage_groups = {fleshy=4},
punch_attack_uses = metals_ore_array[i][6],
},
on_place = make_grass_path,
sound = { breaks = "default_tool_breaks" },
_repair_material = "owl_tech:"..metals_ore_array[i][1].."_ingot",
_mcl_toollike_wield = true,
_mcl_diggroups = {
shovely = { speed = 6, level = 4, uses = metals_ore_array[i][6]*2 }
},
})
--Shovel head
minetest.register_craftitem("owl_tech:shovel_head_"..metals_ore_array[i][1], {
description = S("Shovel head "..metals_ore_array[i][1]),
_doc_items_longdesc = S("Shovel head use for crafte pick in any place"),
inventory_image = "(owl_tech_shovel_head.png^[colorize:"..metals_ore_array[i][5]..":128)",
stack_max = 64,
groups = { craftitem=1 },
})
--Crafte sword from sword head
minetest.register_craft({
type = "shapeless",
output = "owl_tech:shovel_"..metals_ore_array[i][1],
recipe = {"owl_tech:shovel_head_"..metals_ore_array[i][1],"mcl_core:stick"}
})
--Crafte sword head
minetest.register_craft({
type = "shaped",
output = "owl_tech:shovel_head_"..metals_ore_array[i][1],
recipe = {
{"owl_tech:work_file","owl_tech:"..metals_ore_array[i][1].."_plate","owl_tech:work_hammer"},
{"","owl_tech:"..metals_ore_array[i][1].."_ingot",""},
{"","",""}
},
replacements = {
{"owl_tech:work_hammer", "owl_tech:work_hammer"},
{"owl_tech:work_file", "owl_tech:work_file"},
}
})
--Hoe
minetest.register_tool("owl_tech:hoe_"..metals_ore_array[i][1], {
description = S(metals_ore_array[i][1].." Hoe"),
--_tt_help = hoe_tt.."\n"..S("Uses: @1", uses.iron),
_doc_items_longdesc = "Owl tech hoe",
inventory_image = "(owl_tech_hoe_head.png^[colorize:"..metals_ore_array[i][5]..":128)^owl_tech_hoe_stick.png",
wield_scale = mcl_vars.tool_wield_scale,
on_place = hoe_on_place_function(metals_ore_array[i][6]),
groups = { tool=1, hoe=1, enchantability=14 },
tool_capabilities = {
-- 1/3
full_punch_interval = 0.33333333,
damage_groups = { fleshy = 1, },
punch_attack_uses = metals_ore_array[i][6],
},
_repair_material = "owl_tech:"..metals_ore_array[i][1].."_ingot",
_mcl_toollike_wield = true,
_mcl_diggroups = {
hoey = { speed = 6, level = 4, uses = 251 }
},
})
--Hoe head
minetest.register_craftitem("owl_tech:hoe_head_"..metals_ore_array[i][1], {
description = S("Hoe head "..metals_ore_array[i][1]),
_doc_items_longdesc = S("Hoe head use for crafte hoe in any place"),
inventory_image = "(owl_tech_hoe_head.png^[colorize:"..metals_ore_array[i][5]..":128)",
stack_max = 64,
groups = { craftitem=1 },
})
--Crafte hoe from hoe head
minetest.register_craft({
type = "shapeless",
output = "owl_tech:hoe_"..metals_ore_array[i][1],
recipe = {"owl_tech:hoe_head_"..metals_ore_array[i][1],"mcl_core:stick"}
})
--Crafte hoe head
minetest.register_craft({
type = "shaped",
output = "owl_tech:hoe_head_"..metals_ore_array[i][1],
recipe = {
{"owl_tech:work_file","owl_tech:"..metals_ore_array[i][1].."_plate",""},
{"owl_tech:work_hammer","owl_tech:"..metals_ore_array[i][1].."_ingot",""},
{"","",""}
},
replacements = {
{"owl_tech:work_hammer", "owl_tech:work_hammer"},
{"owl_tech:work_file", "owl_tech:work_file"},
}
})
--stick
minetest.register_craftitem("owl_tech:"..metals_ore_array[i][1].."_stick", {
description = S(metals_ore_array[i][2].. " stick"),
_doc_items_longdesc = S(metals_ore_array[i][2].. " stick"),
inventory_image = "owl_tech_stick.png^[colorize:"..metals_ore_array[i][5]..":128",
stack_max = 64,
groups = { craftitem=1 },
})
--carfte stick
minetest.register_craft({
type = "shapeless",
output = "owl_tech:"..metals_ore_array[i][1].."_stick",
recipe = {"owl_tech:work_file","owl_tech:"..metals_ore_array[i][1].."_ingot","owl_tech:"..metals_ore_array[i][1].."_ingot"},
replacements = {
{"owl_tech:work_file","owl_tech:work_file"},
}
})
--Block
minetest.register_node("owl_tech:"..metals_ore_array[i][1].."block", {
description = S("Block of "..metals_ore_array[i][2]),
_doc_items_longdesc = S("Block of "..metals_ore_array[i][2]),
tiles = {"default_steel_block.png^[colorize:"..metals_ore_array[i][5]..":128"},
is_ground_content = false,
stack_max = 64,
groups = {pickaxey=metals_ore_array[i][4], building_block=1},
sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 6,
_mcl_hardness = 5,
})
--Block dust
minetest.register_node("owl_tech:"..metals_ore_array[i][1].."_dust_block", {
description = S("Dust block of "..metals_ore_array[i][2]),
_doc_items_longdesc = S("Block of "..metals_ore_array[i][2]),
tiles = {"owl_tech_dust_block_1.png^[colorize:"..metals_ore_array[i][5]..":128"},
is_ground_content = false,
stack_max = 64,
groups = {pickaxey=metals_ore_array[i][4], building_block=1},
sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 6,
_mcl_hardness = 5,
})
--metal briks
minetest.register_node("owl_tech:"..value[1].."_briks", {
description = S(value[2].." briks"),
_doc_items_longdesc = S("Part of multiblocks -safe for decor"),
tiles = {"owl_tech_base_briks.png^[colorize:"..value[5]..":128"},
is_ground_content = false,
stack_max = 64,
groups = {pickaxey=2 },
sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 6,
_mcl_hardness = 5
})
--crafte metal briks
minetest.register_craft({
type = "shaped",
output = "owl_tech:"..value[1].."_briks",
recipe = {
{"owl_tech:"..metals_ore_array[i][1].."_plate","owl_tech:"..metals_ore_array[i][1].."_plate","owl_tech:"..metals_ore_array[i][1].."_plate"},
{"owl_tech:"..metals_ore_array[i][1].."_plate","mcl_core:brick_block","owl_tech:"..metals_ore_array[i][1].."_plate"},
{"owl_tech:"..metals_ore_array[i][1].."_plate","owl_tech:"..metals_ore_array[i][1].."_plate","owl_tech:"..metals_ore_array[i][1].."_plate"}
}
})
--frames
minetest.register_node("owl_tech:"..value[1].."_frames", {
description = S(value[2].." frames"),
_doc_items_longdesc = S("Part of multiblocks -safe for decor"),
tiles = {"owl_tech_base_frame.png^[colorize:"..value[5]..":128"},
is_ground_content = false,
stack_max = 64,
groups = {pickaxey=2 },
sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 6,
_mcl_hardness = 5
})
--crafte metal briks
minetest.register_craft({
type = "shaped",
output = "owl_tech:"..value[1].."_frames",
recipe = {
{"owl_tech:"..metals_ore_array[i][1].."_stick","owl_tech:"..metals_ore_array[i][1].."_stick","owl_tech:"..metals_ore_array[i][1].."_stick"},
{"owl_tech:"..metals_ore_array[i][1].."_stick","owl_tech:wrench","owl_tech:"..metals_ore_array[i][1].."_stick"},
{"owl_tech:"..metals_ore_array[i][1].."_stick","owl_tech:"..metals_ore_array[i][1].."_stick","owl_tech:"..metals_ore_array[i][1].."_stick"}
},
replacements = {
{"owl_tech:wrench","owl_tech:wrench"},
}
})
--grids
minetest.register_node("owl_tech:"..value[1].."_grid", {
description = S(value[2].." grid"),
_doc_items_longdesc = S("Part of multiblocks -safe for decor"),
tiles = {"owl_tech_base_grid.png^[colorize:"..value[5]..":128"},
is_ground_content = false,
stack_max = 64,
groups = {pickaxey=2 },
sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 6,
_mcl_hardness = 5
})
--crafte metal grids
minetest.register_craft({
type = "shaped",
output = "owl_tech:"..value[1].."_grid",
recipe = {
{"owl_tech:"..metals_ore_array[i][1].."_stick","owl_tech:work_hammer","owl_tech:"..metals_ore_array[i][1].."_stick"},
{"owl_tech:"..metals_ore_array[i][1].."_stick","owl_tech:work_file","owl_tech:"..metals_ore_array[i][1].."_stick"},
{"owl_tech:"..metals_ore_array[i][1].."_stick","owl_tech:wrench","owl_tech:"..metals_ore_array[i][1].."_stick"}
},
replacements = {
{"owl_tech:wrench","owl_tech:wrench"},
{"owl_tech:work_file","owl_tech:work_file"},
{"owl_tech:work_hammer","owl_tech:work_hammer"},
}
})
--tiles
minetest.register_node("owl_tech:"..value[1].."_tiles", {
description = S(value[2].." tiles"),
_doc_items_longdesc = S("Part of multiblocks -safe for decor"),
tiles = {"owl_tech_base_tiles.png^[colorize:"..value[5]..":128"},
is_ground_content = false,
stack_max = 64,
groups = {pickaxey=2 },
sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 6,
_mcl_hardness = 5
})
--crafte tile
minetest.register_craft({
type = "shaped",
output = "owl_tech:"..value[1].."_tiles",
recipe = {
{"owl_tech:"..metals_ore_array[i][1].."_plate","owl_tech:"..metals_ore_array[i][1].."_stick","owl_tech:"..metals_ore_array[i][1].."_plate"},
{"owl_tech:"..metals_ore_array[i][1].."_stick","owl_tech:wrench","owl_tech:"..metals_ore_array[i][1].."_stick"},
{"owl_tech:"..metals_ore_array[i][1].."_plate","owl_tech:"..metals_ore_array[i][1].."_stick","owl_tech:"..metals_ore_array[i][1].."_plate"}
},
replacements = {
{"owl_tech:wrench","owl_tech:wrench"},
}
})
--big tiles
minetest.register_node("owl_tech:"..value[1].."_big_tiles", {
description = S(value[2].." big tiles"),
_doc_items_longdesc = S("Part of multiblocks -safe for decor"), --_big_tiles
tiles = {"owl_tech_base_big_tiles.png^[colorize:"..value[5]..":128"},
is_ground_content = false,
stack_max = 64,
groups = {pickaxey=2 },
sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 6,
_mcl_hardness = 5
})
--crafte tile
minetest.register_craft({
type = "shaped",
output = "owl_tech:"..value[1].."_big_tiles",
recipe = {
{"owl_tech:"..metals_ore_array[i][1].."_plate","owl_tech:"..metals_ore_array[i][1].."_stick","owl_tech:"..metals_ore_array[i][1].."_plate"},
{"owl_tech:"..metals_ore_array[i][1].."_stick","owl_tech:work_hammer","owl_tech:"..metals_ore_array[i][1].."_stick"},
{"owl_tech:"..metals_ore_array[i][1].."_plate","owl_tech:"..metals_ore_array[i][1].."_stick","owl_tech:"..metals_ore_array[i][1].."_plate"}
},
replacements = {
{"owl_tech:work_hammer","owl_tech:work_hammer"},
}
})
--Crafte ingot from nugets
minetest.register_craft({
type = "shaped",
output = "owl_tech:"..metals_ore_array[i][1].."_ingot",
recipe = {
{"owl_tech:"..metals_ore_array[i][1].."_nugget","owl_tech:"..metals_ore_array[i][1].."_nugget","owl_tech:"..metals_ore_array[i][1].."_nugget"},
{"owl_tech:"..metals_ore_array[i][1].."_nugget","owl_tech:"..metals_ore_array[i][1].."_nugget","owl_tech:"..metals_ore_array[i][1].."_nugget"},
{"owl_tech:"..metals_ore_array[i][1].."_nugget","owl_tech:"..metals_ore_array[i][1].."_nugget","owl_tech:"..metals_ore_array[i][1].."_nugget"}
}
})
--Crafte block from ingots
minetest.register_craft({
type = "shaped",
output = "owl_tech:"..metals_ore_array[i][1].."block",
recipe = {
{"owl_tech:"..metals_ore_array[i][1].."_ingot","owl_tech:"..metals_ore_array[i][1].."_ingot","owl_tech:"..metals_ore_array[i][1].."_ingot"},
{"owl_tech:"..metals_ore_array[i][1].."_ingot","owl_tech:"..metals_ore_array[i][1].."_ingot","owl_tech:"..metals_ore_array[i][1].."_ingot"},
{"owl_tech:"..metals_ore_array[i][1].."_ingot","owl_tech:"..metals_ore_array[i][1].."_ingot","owl_tech:"..metals_ore_array[i][1].."_ingot"}
}
})
--Crafte block dust from ingots
minetest.register_craft({
type = "shaped",
output = "owl_tech:"..metals_ore_array[i][1].."_dust_block",
recipe = {
{"owl_tech:"..metals_ore_array[i][1].."_dust","owl_tech:"..metals_ore_array[i][1].."_dust","owl_tech:"..metals_ore_array[i][1].."_dust"},
{"owl_tech:"..metals_ore_array[i][1].."_dust","owl_tech:"..metals_ore_array[i][1].."_dust","owl_tech:"..metals_ore_array[i][1].."_dust"},
{"owl_tech:"..metals_ore_array[i][1].."_dust","owl_tech:"..metals_ore_array[i][1].."_dust","owl_tech:"..metals_ore_array[i][1].."_dust"}
}
})
--Crafte ingots from block
minetest.register_craft({
type = "shapeless",
output = "owl_tech:"..metals_ore_array[i][1].."_ingot 9",
recipe = {"owl_tech:"..metals_ore_array[i][1].."block"}
})
--Crafte dust from block
minetest.register_craft({
type = "shapeless",
output = "owl_tech:"..metals_ore_array[i][1].."_dust 9",
recipe = {"owl_tech:"..metals_ore_array[i][1].."_dust_block"}
})
end
-- 1)tech_name 2)useal name 3)need ore ? 4)pickasxe_level 5)color 6)gem_base 7)gem_block_base 8)dust_block 9)burn fuel
local gems_orew_array={
{"coal","Coal ",true,1,"#1b1b1b","owl_tech_gem_1.png","owl_tech_gem_block_1.png","owl_tech_dust_block_1.png",80},
{"sulfur","Sulfur ",true,1,"#c2a800","owl_tech_gem_1.png","owl_tech_gem_block_1.png","owl_tech_dust_block_1.png",0},
{"saltpeter","Saltpeter ",true,1,"#b3e6ee","owl_tech_gem_1.png","owl_tech_gem_block_1.png","owl_tech_dust_block_1.png",0},
{"diamond","Diamond ",true,3,"#d40000","owl_tech_gem_2.png","owl_tech_gem_block_2.png","owl_tech_dust_block_1.png",0},
{"ruby","Ruby ",true,3,"#77cefb","owl_tech_gem_2.png","owl_tech_gem_block_2.png","owl_tech_dust_block_1.png",0},--
{"raw_ruber","Raw Ruber ",false,1,"#dace00","owl_tech_gem_3.png","owl_tech_gem_block_3.png","owl_tech_dust_block_1.png",0},
{"ruber","Ruber ",false,1,"#171717","default_steel_ingot.png","default_steel_block.png","owl_tech_dust_block_1.png",0},
}
for i, value in ipairs(gems_orew_array) do
--ore
if gems_orew_array[i][3] then
minetest.register_node("owl_tech:"..gems_orew_array[i][1].."_ore", {
description = S(gems_orew_array[i][2].." ore"),
_doc_items_longdesc = S(gems_orew_array[i][2]..' ore'),
_doc_items_hidden = false,
tiles = {"default_stone.png^(owl_tech_ore_base.png^[colorize:"..gems_orew_array[i][5]..":128)"},
is_ground_content = true,
stack_max = 64,
groups = {pickaxey=gems_orew_array[i][4], building_block=1, material_stone=1, blast_furnace_smeltable=1},
drop = "owl_tech:coal_ore",
sounds = mcl_sounds.node_sound_stone_defaults(),
_mcl_blast_resistance = 3,
_mcl_hardness = 3,
_mcl_silk_touch_drop = true,
})
end
--dust
minetest.register_craftitem("owl_tech:"..gems_orew_array[i][1].."_dust", {
description = S(gems_orew_array[i][2].. " dust"),
_doc_items_longdesc = S(gems_orew_array[i][2].. " dust"),
inventory_image = "owl_tech_dust.png^[colorize:"..gems_orew_array[i][5]..":128",
stack_max = 64,
groups = { craftitem=1 },
})
--dirt dust
minetest.register_craftitem("owl_tech:"..gems_orew_array[i][1].."_dirt_dust", {
description = S(gems_orew_array[i][2].. " dirt dust"),
_doc_items_longdesc = S(gems_orew_array[i][2].. " dirt dust"),
inventory_image = "owl_tech_dirt_dust.png^[colorize:"..gems_orew_array[i][5]..":128",
stack_max = 64,
groups = { craftitem=1 },
})
--gem
minetest.register_craftitem("owl_tech:"..gems_orew_array[i][1], {
description = S(gems_orew_array[i][2]),
_doc_items_longdesc = S(gems_orew_array[i][2]),
inventory_image = gems_orew_array[i][6].."^[colorize:"..gems_orew_array[i][5]..":128",
stack_max = 64,
groups = { craftitem=1 },
})
--plate
minetest.register_craftitem("owl_tech:"..gems_orew_array[i][1].."_plate", {
description = S(gems_orew_array[i][2].. " plate"),
_doc_items_longdesc = S(gems_orew_array[i][2].. " plate"),
inventory_image = "owl_tech_plate.png^[colorize:"..gems_orew_array[i][5]..":128",
stack_max = 64,
groups = { craftitem=1 },
})
--stick
minetest.register_craftitem("owl_tech:"..gems_orew_array[i][1].."_stick", {
description = S(gems_orew_array[i][2].. " stick"),
_doc_items_longdesc = S(gems_orew_array[i][2].. " stick"),
inventory_image = "owl_tech_stick.png^[colorize:"..gems_orew_array[i][5]..":128",
stack_max = 64,
groups = { craftitem=1 },
})
--burn time gem
if gems_orew_array[i][9]>0 then
minetest.register_craft({
type = "fuel",
recipe = "owl_tech:"..gems_orew_array[i][1],
burntime = gems_orew_array[i][9],
})
end
--Block
minetest.register_node("owl_tech:"..gems_orew_array[i][1].."_block", {
description = S("Block of "..gems_orew_array[i][2]),
_doc_items_longdesc = S("Block of "..gems_orew_array[i][2]),
tiles = {gems_orew_array[i][7].."^[colorize:"..gems_orew_array[i][5]..":128"},
is_ground_content = false,
stack_max = 64,
groups = {pickaxey=gems_orew_array[i][4], building_block=1},
sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 6,
_mcl_hardness = 5,
})
--burn time block
if gems_orew_array[i][9]>0 then
minetest.register_craft({
type = "fuel",
recipe = "owl_tech:"..gems_orew_array[i][1].."_block",
burntime = gems_orew_array[i][9]*9,
})
end
--Block dust
minetest.register_node("owl_tech:"..gems_orew_array[i][1].."_dust_block", {
description = S("Block of "..gems_orew_array[i][2]),
_doc_items_longdesc = S("Block of "..gems_orew_array[i][2]),
tiles = {gems_orew_array[i][8].."^[colorize:"..gems_orew_array[i][5]..":128"},
is_ground_content = false,
stack_max = 64,
groups = {pickaxey=gems_orew_array[i][4], building_block=1},
sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 6,
_mcl_hardness = 5,
})
end
-----------------------------------------------------------------------------------
--Some custom recips
--Crafte bronze dust from copper and tin
minetest.register_craft({
type = "shapeless",
output = "owl_tech:bronze_dust 3",
recipe = {"owl_tech:copper_dust","owl_tech:copper_dust","owl_tech:copper_dust","owl_tech:tin_dust"}
})
--Crafte electrum from gold and silver
minetest.register_craft({
type = "shapeless",
output = "owl_tech:electrum_dust 3",
recipe = {"owl_tech:gold_dust","owl_tech:gold_dust","owl_tech:silver_dust","owl_tech:silver_dust"}
})
--MC2 ingots in Owl_tech
--Crutch - remake how the idea will be better!!!!
minetest.register_craft({
type = "cooking",
output = "owl_tech:gold_ingot",
recipe = "mcl_core:gold_ingot",
cooktime = 10,
})
minetest.register_craft({
type = "cooking",
output = "owl_tech:iron_ingot",
recipe = "mcl_core:iron_ingot",
cooktime = 10,
})
--Burn raw ruber in ruber
minetest.register_craft({
type = "cooking",
output = "owl_tech:ruber",
recipe = "mcl_core:raw_ruber",
cooktime = 10,
})
----------------------------------------------------------------------------------------
--Flint tools
--pick "mcl_core:flint"
minetest.register_tool("owl_tech:pick_flint", {
description = ("Flint Pickaxe"),
_doc_items_longdesc = "Pick from owl tech",
inventory_image = "(owl_tech_pick_head.png^[colorize:#00264d:128)^owl_tech_pick_stick.png",
wield_scale = wield_scale,
groups = { tool=1, pickaxe=1, dig_speed_class=3, enchantability=5 },
tool_capabilities = {
-- 1/1.2
full_punch_interval = 0.83333333,
max_drop_level=3,
damage_groups = {fleshy=3},
punch_attack_uses = 75,
},
sound = { breaks = "default_tool_breaks" },
_repair_material = "mcl_core:flint",
_mcl_toollike_wield = true,
_mcl_diggroups = {
pickaxey = { speed = 4, level = 3, uses = 150 }
},
})
minetest.register_craft({
output = "owl_tech:pick_flint",
recipe = {
{"mcl_core:flint","mcl_core:flint","mcl_core:flint"},
{"","mcl_core:stick",""},
{"","mcl_core:stick",""}
}
})
--axe
minetest.register_tool("owl_tech:axe_flint", {
description = S("Flint axe"),
_doc_items_longdesc = "Axe owl tech",
inventory_image = "(owl_tech_axe_head.png^[colorize:#00264d:128)^owl_tech_pick_stick.png",
wield_scale = wield_scale,
groups = { tool=1, axe=1, dig_speed_class=3, enchantability=5 },
tool_capabilities = {
full_punch_interval = 1.25,
max_drop_level=3,
damage_groups = {fleshy=9},
punch_attack_uses = 75,
},
on_place = make_stripped_trunk,
sound = { breaks = "default_tool_breaks" },
_repair_material = "mcl_core:flint",
_mcl_toollike_wield = true,
_mcl_diggroups = {
axey = { speed = 4, level = 3, uses = 155 }
},
})
minetest.register_craft({
output = "owl_tech:axe_flint",
recipe = {
{"mcl_core:flint","mcl_core:flint"},
{"mcl_core:flint","mcl_core:stick"},
{"","mcl_core:stick"}
}
})
--Sword
minetest.register_tool("owl_tech:sword_flint", {
description = ("Flint sword"),
_doc_items_longdesc = "Owl tech sword",
inventory_image = "(owl_tech_sword_blade.png^[colorize:#00264d:128)^owl_tech_sword_stick.png",
wield_scale = wield_scale,
groups = { weapon=1, sword=1, dig_speed_class=3, enchantability=5 },
tool_capabilities = {
full_punch_interval = 0.625,
max_drop_level=3,
damage_groups = {fleshy=5},
punch_attack_uses = 150,
},
sound = { breaks = "default_tool_breaks" },
_repair_material = "mcl_core:flint",
_mcl_toollike_wield = true,
_mcl_diggroups = {
swordy = { speed = 4, level = 3, uses = 150 },
swordy_cobweb = { speed = 4, level = 3, uses = 150 }
},
})
minetest.register_craft({
output = "owl_tech:sword_flint",
recipe = {
{"mcl_core:flint"},
{"mcl_core:flint"},
{"mcl_core:stick"}
}
})
--shovel
minetest.register_tool("owl_tech:shovel_flint", {
description = S("Flint shovel"),
_doc_items_longdesc = "Owl tech shovel",
_doc_items_usagehelp = shovel_use,
inventory_image = "(owl_tech_shovel_head.png^[colorize:#00264d:128)^owl_tech_shovel_stick.png",
wield_scale = wield_scale,
groups = { tool=1, shovel=1, dig_speed_class=3, enchantability=5 },
tool_capabilities = {
full_punch_interval = 1,
max_drop_level=3,
damage_groups = {fleshy=3},
punch_attack_uses = 66,
},
on_place = make_grass_path,
sound = { breaks = "default_tool_breaks" },
_repair_material = "mcl_core:flint",
_mcl_toollike_wield = true,
_mcl_diggroups = {
shovely = { speed = 4, level = 3, uses = 132 }
},
})
minetest.register_craft({
output = "owl_tech:shovel_flint",
recipe = {
{"mcl_core:flint"},
{"mcl_core:stick"},
{"mcl_core:stick"}
}
})
--Hoe
minetest.register_tool("owl_tech:hoe_flint", {
description = S("Flint hoe"),
--_tt_help = hoe_tt.."\n"..S("Uses: @1", uses.iron),
_doc_items_longdesc = "Owl tech hoe",
inventory_image = "(owl_tech_hoe_head.png^[colorize:#00264d:128)^owl_tech_hoe_stick.png",
wield_scale = mcl_vars.tool_wield_scale,
on_place = hoe_on_place_function(75),
groups = { tool=1, hoe=1, enchantability=5 },
tool_capabilities = {
full_punch_interval = 0.5,
damage_groups = { fleshy = 1, },
punch_attack_uses = 75,
},
_repair_material = "mcl_core:flint",
_mcl_toollike_wield = true,
_mcl_diggroups = {
hoey = { speed = 4, level = 3, uses = 150 }
},
})
minetest.register_craft({
output = "owl_tech:hoe_flint",
recipe = {
{"mcl_core:flint", "mcl_core:flint"},
{"", "mcl_core:stick"},
{"", "mcl_core:stick"}
}
})
minetest.register_craft({
output = "owl_tech:hoe_flint",
recipe = {
{"mcl_core:flint", "mcl_core:flint"},
{"mcl_core:stick", ""},
{"mcl_core:stick", ""}
}
})