jonez = {} --Variables local modname = "jonez" local S = minetest.get_translator(minetest.get_current_modname()) function firstToUpper(str) return (str:gsub("^%l", string.upper)) end local function on_punch_marble(pos, player, replace_item) local wielded_item = player:get_wielded_item() local wielded_item_name = wielded_item:get_name() if wielded_item_name == "jonez:chisel" then minetest.set_node(pos, {name= replace_item}) minetest.sound_play("jonez_carve", {pos = pos, gain = 0.7, max_hear_distance = 5}) end end minetest.register_node("jonez:marble", { description = S("Ancient Marble"), tiles = {"jonez_marble.png"}, is_ground_content = true, groups = {cracky=3}, sounds = default.node_sound_stone_defaults(), on_punch = function(pos, node, player, pointed_thing) on_punch_marble(pos, player, "jonez:marble_polished") end, }) minetest.register_node("jonez:marble_polished", { description = S("Ancient Polished Marble"), tiles = {"jonez_marble_polished.png"}, is_ground_content = true, groups = {cracky=3}, sounds = default.node_sound_stone_defaults(), }) stairs.register_stair_and_slab( "marble", "jonez:marble", {choppy = 2, stone = 1}, {"jonez_marble.png"}, S("Ancient Marble Stair"), S("Ancient Marble Slab"), default.node_sound_stone_defaults() ) stairs.register_stair_and_slab( "marble_brick", "jonez:marble_brick", {choppy = 2, stone = 1}, {"jonez_marble_brick.png"}, S("Ancient Marble Brick Stair"), S("Ancient Marble Brick Slab"), default.node_sound_stone_defaults() ) minetest.register_node("jonez:marble_brick", { description = S("Ancient Marble Brick"), tiles = {"jonez_marble_brick.png"}, is_ground_content = false, groups = {cracky=3}, sounds = default.node_sound_stone_defaults(), on_punch = function(pos, node, player, pointed_thing) on_punch_marble(pos, player, "jonez:marble_brick_polished") end, }) minetest.register_node("jonez:marble_brick_polished", { description = S("Ancient Marble Polished Brick"), tiles = {"jonez_marble_brick_polished.png"}, is_ground_content = false, groups = {cracky=3}, sounds = default.node_sound_stone_defaults(), }) stairs.register_stair_and_slab( "marble_polished", "jonez:marble_polished", {choppy = 2, stone = 1}, {"jonez_marble_polished.png"}, S("Ancient Polished Marble Stair"), S("Ancient Polished Marble Slab"), default.node_sound_stone_defaults() ) stairs.register_stair_and_slab( "marble_brick_polished", "jonez:marble_brick_polished", {choppy = 2, stone = 1}, {"jonez_marble_brick_polished.png"}, S("Ancient Polished Marble Brick Stair"), S("Ancient Polished Marble Brick Slab"), default.node_sound_stone_defaults() ) minetest.register_craft({ output = 'jonez:marble_brick', recipe = { {'jonez:marble', 'jonez:marble'}, {'jonez:marble', 'jonez:marble'}, } }) minetest.register_craft({ output = 'jonez:marble_brick_polished', recipe = { {'jonez:marble_polished', 'jonez:marble_polished'}, {'jonez:marble_polished', 'jonez:marble_polished'}, } }) minetest.register_ore({ ore_type = "scatter", ore = "jonez:marble", wherein = "default:stone", clust_scarcity = 7*7*7, clust_num_ores = 5, clust_size = 3, height_min = -31000, height_max = -1000, flags = "absheight", }) local styles = { "roman", "greek", "germanic", "tuscan", "romanic", "nabataean", "artdeco", "minoan", "attic", "versailles" } --The chisel to carve the marble minetest.register_craftitem("jonez:chisel", { description = S("Chisel for Marble"), inventory_image = "jonez_chisel.png", wield_image = "jonez_chisel.png^[transformR180" }) minetest.register_craft({ type = "shaped", output = "jonez:chisel", recipe = { {"", "", "default:diamond"}, {"", "default:steel_ingot", ""}, {"default:stick", "", ""}, } }) local function save_meta(pos, i, element) local meta = minetest.get_meta(pos) meta:set_int("jonez:style", i) meta:set_string("jonez:element", element) end local function on_punch(pos, player) local wielded_item = player:get_wielded_item() local wielded_item_name = wielded_item:get_name() if wielded_item_name == "jonez:chisel" then local meta = minetest.get_meta(pos) local style = meta:get_int("jonez:style") local element = meta:get_string("jonez:element") style = style + 1 if style > # styles then style = 1 end minetest.set_node(pos, {name= "jonez:"..styles[style].."_"..element}) minetest.sound_play("jonez_carve", {pos = pos, gain = 0.7, max_hear_distance = 5}) end end for i = 1, #styles do minetest.register_node("jonez:"..styles[i].."_architrave", { description = S("Ancient").." "..S(firstToUpper(styles[i])).." "..S("Architrave"), tiles = {"jonez_"..styles[i].."_top_bottom.png", "jonez_"..styles[i].."_top_bottom.png", "jonez_"..styles[i].."_architrave.png"}, is_ground_content = false, groups = {cracky=3}, sounds = default.node_sound_stone_defaults(), on_construct = function(pos) save_meta(pos, i, "architrave") end, on_punch = function(pos, node, player, pointed_thing) on_punch(pos, player) end, }) minetest.register_node("jonez:"..styles[i].."_capital", { description = S("Ancient").." "..S(firstToUpper(styles[i])).." "..S("Capital"), tiles = {"jonez_"..styles[i].."_top_bottom.png", "jonez_"..styles[i].."_top_bottom.png", "jonez_"..styles[i].."_capital.png"}, is_ground_content = false, groups = {cracky=3}, sounds = default.node_sound_stone_defaults(), on_construct = function(pos) save_meta(pos, i, "capital") end, on_punch = function(pos, node, player, pointed_thing) on_punch(pos, player) end, }) minetest.register_node("jonez:"..styles[i].."_shaft", { description = S("Ancient").." "..S(firstToUpper(styles[i])).." "..S("Shaft"), tiles = {"jonez_"..styles[i].."_top_bottom.png", "jonez_"..styles[i].."_top_bottom.png", "jonez_"..styles[i].."_shaft.png"}, is_ground_content = false, groups = {cracky=3}, sounds = default.node_sound_stone_defaults(), on_construct = function(pos) save_meta(pos, i, "shaft") end, on_punch = function(pos, node, player, pointed_thing) on_punch(pos, player) end, }) minetest.register_node("jonez:"..styles[i].."_base", { description = S("Ancient").." "..S(firstToUpper(styles[i])).." "..S("Base"), tiles = {"jonez_"..styles[i].."_top_bottom.png", "jonez_"..styles[i].."_top_bottom.png", "jonez_"..styles[i].."_base.png"}, is_ground_content = false, groups = {cracky=3}, sounds = default.node_sound_stone_defaults(), on_construct = function(pos) save_meta(pos, i, "base") end, on_punch = function(pos, node, player, pointed_thing) on_punch(pos, player) end, }) end local vines = { {name= "jonez:swedish_ivy", description= "Swedish Ivy", texture= "jonez_sweedish_ivy.png"}, {name= "jonez:ruin_creeper", description= "Ruin Creeper", texture= "jonez_ruin_creeper.png"}, {name= "jonez:ruin_vine", description= "Ruin Vine", texture= "jonez_ruin_vine.png"}, {name= "jonez:climbing_rose", description= "Climbing Rose", texture= "jonez_climbing_rose.png"}, } for i = 1, #vines do minetest.register_node(vines[i].name, { description = S(vines[i].description), drawtype = "nodebox", walkable = true, paramtype = "light", paramtype2 = "facedir", tiles = {vines[i].texture}, inventory_image = vines[i].texture, wield_image = vines[i].texture, node_box = { type = "fixed", fixed = {-0.5, -0.5, 0.49, 0.5, 0.5, 0.5} }, groups = { snappy = 2, flammable = 3, oddly_breakable_by_hand = 3, choppy = 2, carpet = 1, leafdecay = 3, leaves = 1 }, sounds = default.node_sound_leaves_defaults(), }) end local panels = { {name= "jonez_panel_1", description= "Mosaic Glass Panel", textures={front= "jonez_panel_1.png", edge="jonez_panes_edge.png"}, recipe = { {"dye:blue", "dye:black", "dye:pink"}, {"dye:red", "xpanes:pane_flat", "dye:green"}, {"dye:yellow", "dye:black", "dye:orange"}, } }, {name= "jonez_panel_2", description= "Blossom Glass Panel", textures={front="jonez_panel_2.png", edge="jonez_panes_edge.png"}, recipe = { {"dye:blue", "dye:red", "dye:green"}, {"dye:yellow", "xpanes:pane_flat", "dye:yellow"}, {"dye:green", "dye:red", "dye:orange"}, } }, {name= "jonez:wrought_lattice_bottom", description= "Ancient Wrought Lattice (Bottom)",textures={front="jonez_wrought_lattice_bottom.png", edge="jonez_panes_edge.png"}, recipe = { {'', '', ''}, {'default:steel_ingot', 'default:tin_ingot', 'default:steel_ingot'}, {'default:steel_ingot', 'default:tin_ingot', 'default:steel_ingot'}, } }, {name= "jonez:palace_window_top", description= "Palace Window (Top)",textures={front="jonez_palace_window_top.png", edge="default_wood.png"}, recipe = { {'', 'xpanes:pane_flat', ''}, {'', 'xpanes:pane_flat', ''}, {'', '', ''}, } }, {name= "jonez:palace_window_bottom", description= "Palace Window (Bottom)",textures={front="jonez_palace_window_bottom.png", edge="default_wood.png"}, recipe = { {'', '', ''}, {'', 'xpanes:pane_flat', ''}, {'', 'xpanes:pane_flat', ''}, } }, } for j=1, #panels do xpanes.register_pane(panels[j].name, { description = S(panels[j].description), textures = {panels[j].textures.front, nil, panels[j].textures.edge}, inventory_image = panels[j].textures.front, wield_image = panels[j].textures.front, sounds = default.node_sound_glass_defaults(), groups = {snappy=2, cracky=3, oddly_breakable_by_hand=3}, recipe = panels[j].recipe }) end local pavements= { {name= "jonez:blossom_pavement", description= "Ancient Blossom Pavement", texture= "jonez_blossom_pavement.png", recipe = { {'', 'stairs:slab_marble', ''}, {'stairs:slab_marble', 'stairs:slab_marble', 'stairs:slab_marble'}, {'', 'stairs:slab_marble', ''}, } }, {name= "jonez:tiled_pavement", description= "Ancient Tiled Pavement", texture= "jonez_tiled_pavement.png", recipe = { {'stairs:slab_marble_brick', 'stairs:slab_marble_brick', ''}, {'', 'stairs:slab_marble_brick', 'stairs:slab_marble_brick'}, {'stairs:slab_marble_brick', 'stairs:slab_marble_brick', ''}, } }, {name= "jonez:mosaic_pavement", description= "Ancient Mosaic Pavement", texture= "jonez_mosaic_pavement.png", recipe = { {'stairs:slab_marble_brick', 'stairs:slab_marble_brick', 'stairs:slab_marble_brick'}, {'stairs:slab_marble_brick', 'stairs:slab_marble_brick', 'stairs:slab_marble_brick'}, {'stairs:slab_marble_brick', 'stairs:slab_marble_brick', 'stairs:slab_marble_brick'}, } }, {name= "jonez:diamond_pavement", description= "Ancient Diamond Pavement", texture= "jonez_diamond_pavement.png", recipe = { {'', 'stairs:slab_marble', ''}, {'stairs:slab_marble', '', 'stairs:slab_marble'}, {'', 'stairs:slab_marble', ''}, } }, {name= "jonez:pebbled_pavement", description= "Ancient Pebbled Pavement", texture= "jonez_pebbled_pavement.png", recipe = { {'', 'stairs:slab_marble_brick_polished', ''}, {'stairs:slab_marble_brick_polished', 'stairs:slab_marble_brick_polished', 'stairs:slab_marble_brick_polished'}, {'', 'stairs:slab_marble_brick_polished', ''}, } }, {name= "jonez:pebbled_wall", description= "Ancient Pebbled Wall", texture= "jonez_pebbled_wall.png", recipe = { {'', 'stairs:slab_marble_brick_polished', ''}, {'stairs:slab_marble_brick_polished', 'stairs:slab_marble_brick_polished', 'stairs:slab_marble_brick_polished'}, {'', 'stairs:slab_marble_brick_polished', ''}, } }, } for i = 1, #pavements do minetest.register_node(pavements[i].name, { description = S(pavements[i].description), tiles = {pavements[i].texture}, is_ground_content = true, groups = {cracky=3}, sounds = default.node_sound_stone_defaults(), }) minetest.register_craft({ output = pavements[i].name, type = 'shaped', recipe = pavements[i].recipe, }) end minetest.register_node("jonez:wrought_lattice_top", { description = S("Ancient Wrought Lattice (Top)"), is_ground_content = true, groups = {cracky=3}, walkable = true, sounds = default.node_sound_stone_defaults(), paramtype = "light", paramtype2 = "facedir", drawtype = "nodebox", node_box = { type = "fixed", fixed = { {-0.5, -0.5, -0.0, 0.5, 0.1875, 0.0}, } }, tiles = { nil, nil, nil, nil, "jonez_wrought_lattice_top.png", "jonez_wrought_lattice_top.png" }, }) minetest.register_craft({ output = 'jonez:wrought_lattice_top', recipe = { {'default:steel_ingot', 'default:tin_ingot', 'default:steel_ingot'}, {'default:steel_ingot', 'default:tin_ingot', 'default:steel_ingot'}, {'', '', ''}, } }) minetest.register_node("jonez:versailles_pavement", { description = S("Versailles Pavement"), tiles = {"jonez_versailles_pavement.png"}, is_ground_content = false, groups = {cracky=3}, sounds = default.node_sound_stone_defaults(), }) minetest.register_craft({ output = 'jonez:versailles_pavement', type = "shaped", recipe = { {'', '', ''}, {'', 'stairs:slab_marble_brick', ''}, {'stairs:slab_marble_brick', '', 'stairs:slab_marble_brick'}, }, }) minetest.register_node("jonez:versailles_tile", { description = S("Versailles Tile"), tiles = {"jonez_versailles_tile.png"}, is_ground_content = false, groups = {cracky=3}, sounds = default.node_sound_stone_defaults(), }) minetest.register_craft({ output = 'jonez:versailles_tile 9', type = "shapeless", recipe = { 'jonez:diamond_pavement', 'stairs:slab_marble_brick', 'jonez:diamond_pavement', 'stairs:slab_marble_brick', 'jonez:diamond_pavement', 'stairs:slab_marble_brick', 'jonez:diamond_pavement', 'stairs:slab_marble_brick', 'jonez:diamond_pavement', }, })