diff --git a/mcl_copper_stuff/tools.lua b/mcl_copper_stuff/tools.lua index 6634b6d..3a5c16c 100644 --- a/mcl_copper_stuff/tools.lua +++ b/mcl_copper_stuff/tools.lua @@ -244,6 +244,72 @@ minetest.register_craftitem("mcl_copper_stuff:copper_nugget", { inventory_image = "mcl_copper_stuff_copper_nugget.png", }) +--copper chain +minetest.register_node("mcl_copper_stuff:copper_chain", { + description = S("Copper Chain"), + _doc_items_longdesc = S("Copper Chains are metallic decoration blocks."), + inventory_image = "mcl_copper_stuff_copper_chain_inv.png", + tiles = {"mcl_copper_stuff_copper_chain.png"}, + drawtype = "mesh", + paramtype = "light", + paramtype2 = "facedir", + use_texture_alpha = "clip", + mesh = "mcl_lanterns_chain.obj", + is_ground_content = false, + sunlight_propagates = true, + collision_box = { + type = "fixed", + fixed = { + {-0.0625, -0.5, -0.0625, 0.0625, 0.5, 0.0625}, + } + }, + selection_box = { + type = "fixed", + fixed = { + {-0.0625, -0.5, -0.0625, 0.0625, 0.5, 0.0625}, + } + }, + groups = {pickaxey = 1, deco_block = 1}, + sounds = mcl_sounds.node_sound_metal_defaults(), + on_place = function(itemstack, placer, pointed_thing) + if pointed_thing.type ~= "node" then + return itemstack + end + + local p0 = pointed_thing.under + local p1 = pointed_thing.above + local param2 = 0 + + local placer_pos = placer:get_pos() + if placer_pos then + local dir = { + x = p1.x - placer_pos.x, + y = p1.y - placer_pos.y, + z = p1.z - placer_pos.z + } + param2 = minetest.dir_to_facedir(dir) + end + + if p0.y - 1 == p1.y then + param2 = 20 + elseif p0.x - 1 == p1.x then + param2 = 16 + elseif p0.x + 1 == p1.x then + param2 = 12 + elseif p0.z - 1 == p1.z then + param2 = 8 + elseif p0.z + 1 == p1.z then + param2 = 4 + end + + return minetest.item_place(itemstack, placer, pointed_thing, param2) + end, + _mcl_blast_resistance = 6, + _mcl_hardness = 5, + mcl_lanterns.add_allowed_non_solid_nodes_ceiling("mcl_copper_stuff:copper_chain"), + mcl_lanterns.add_allowed_non_solid_nodes_floor("mcl_copper_stuff:copper_chain"), +}) + -- Registering crafts minetest.register_craft({ output = "mcl_copper_stuff:pick_copper", @@ -312,4 +378,13 @@ minetest.register_craft({ {"mcl_copper_stuff:copper_nugget", "mcl_torches:torch" , "mcl_copper_stuff:copper_nugget"}, {"mcl_copper_stuff:copper_nugget", "mcl_copper_stuff:copper_nugget", "mcl_copper_stuff:copper_nugget"}, }, +}) +--copper chain recipe +minetest.register_craft({ + output = "mcl_copper_stuff:copper_chain", + recipe = { + {"mcl_copper_stuff:copper_nugget"}, + {"mcl_copper:copper_ingot"}, + {"mcl_copper_stuff:copper_nugget"}, + }, }) \ No newline at end of file