2022-05-01 03:12:53 +02:00
local modname = minetest.get_current_modname ( )
local S = minetest.get_translator ( modname )
local copper_mod = minetest.get_modpath ( " mcl_copper " )
local cobble = " mcl_deepslate:deepslate_cobbled "
local stick = " mcl_core:stick "
2022-05-04 11:07:04 +02:00
2022-08-31 02:22:42 +02:00
local function spawn_silverfish ( pos , oldnode , oldmetadata , digger )
if not minetest.is_creative_enabled ( " " ) then
minetest.add_entity ( pos , " mobs_mc:silverfish " )
end
end
2022-05-01 03:12:53 +02:00
minetest.register_node ( " mcl_deepslate:deepslate " , {
description = S ( " Deepslate " ) ,
_doc_items_longdesc = S ( " Deepslate is a stone type found deep underground in the Overworld that functions similar to regular stone but is harder than the stone. " ) ,
_doc_items_hidden = false ,
tiles = { " mcl_deepslate_top.png " , " mcl_deepslate_top.png " , " mcl_deepslate.png " } ,
paramtype2 = " facedir " ,
is_ground_content = true ,
on_place = mcl_util.rotate_axis ,
groups = { pickaxey = 1 , stone = 1 , building_block = 1 , material_stone = 1 } ,
drop = cobble ,
sounds = mcl_sounds.node_sound_stone_defaults ( ) ,
on_rotate = screwdriver.rotate_3way ,
_mcl_blast_resistance = 6 ,
_mcl_hardness = 3 ,
_mcl_silk_touch_drop = true ,
} )
minetest.register_node ( " mcl_deepslate:infested_deepslate " , {
description = S ( " Infested Deepslate " ) ,
_doc_items_longdesc = S ( " An infested block is a block from which a silverfish will pop out when it is broken. It looks identical to its normal counterpart. " ) ,
_tt_help = S ( " Hides a silverfish " ) ,
tiles = { " mcl_deepslate_top.png " , " mcl_deepslate_top.png " , " mcl_deepslate.png " } ,
is_ground_content = true ,
groups = { dig_immediate = 3 , spawns_silverfish = 1 , deco_block = 1 } ,
drop = " " ,
sounds = mcl_sounds.node_sound_stone_defaults ( ) ,
after_dig_node = spawn_silverfish ,
_mcl_hardness = 0 ,
_mcl_blast_resistance = 0.5 ,
} )
minetest.register_node ( " mcl_deepslate:tuff " , {
description = S ( " Tuff " ) ,
_doc_items_longdesc = S ( " Tuff is an ornamental rock formed from volcanic ash, occurring in underground blobs below Y=16. " ) ,
_doc_items_hidden = false ,
tiles = { " mcl_deepslate_tuff.png " } ,
groups = { pickaxey = 1 , deco_block = 1 } ,
sounds = mcl_sounds.node_sound_stone_defaults ( ) ,
_mcl_blast_resistance = 6 ,
_mcl_hardness = 1.5 ,
_mcl_silk_touch_drop = true ,
} )
2022-05-03 22:16:48 +02:00
local function register_deepslate_ore ( desc , drop , cooked , pick , xp )
2022-05-01 03:12:53 +02:00
local item = desc : lower ( )
local item_string
if item == " lapis lazuli " then
item_string = " lapis "
2022-05-04 11:07:04 +02:00
else
2022-05-01 03:12:53 +02:00
item_string = item
end
2022-05-03 22:16:48 +02:00
local nodename = " mcl_deepslate:deepslate_with_ " .. item_string
minetest.register_node ( nodename , {
2022-05-01 03:12:53 +02:00
description = S ( " Deepslate " .. desc .. " Ore " ) ,
_doc_items_longdesc = S ( " Deepslate " .. item .. " ore is a variant of " .. item .. " ore that can generate in deepslate and tuff blobs. " ) ,
_doc_items_hidden = false ,
tiles = { " mcl_deepslate_ " .. item_string .. " _ore.png " } ,
is_ground_content = true ,
stack_max = 64 ,
groups = { pickaxey = pick , building_block = 1 , material_stone = 1 , xp = xp } ,
drop = drop ,
sounds = mcl_sounds.node_sound_stone_defaults ( ) ,
_mcl_blast_resistance = 3 ,
_mcl_hardness = 4.5 ,
_mcl_silk_touch_drop = true ,
_mcl_fortune_drop = mcl_core.fortune_drop_ore ,
} )
2022-05-03 22:16:48 +02:00
minetest.register_craft ( {
type = " cooking " ,
output = cooked ,
recipe = nodename ,
cooktime = 10 ,
} )
2022-05-01 03:12:53 +02:00
end
2022-05-03 22:16:48 +02:00
local lapis_drops = {
max_items = 1 , items = {
2022-12-22 18:10:59 +01:00
{ items = { " mcl_core:lapis 8 " } , rarity = 5 } ,
{ items = { " mcl_core:lapis 7 " } , rarity = 5 } ,
{ items = { " mcl_core:lapis 6 " } , rarity = 5 } ,
{ items = { " mcl_core:lapis 5 " } , rarity = 5 } ,
{ items = { " mcl_core:lapis 4 " } }
2022-05-03 22:16:48 +02:00
}
}
2022-05-01 03:12:53 +02:00
local deepslate_ores = {
2022-05-03 22:16:48 +02:00
{ " Coal " , " mcl_core:coal_lump " , " mcl_core:coal_lump " , 1 , 1 } ,
{ " Iron " , " mcl_raw_ores:raw_iron " , " mcl_core:iron_ingot " , 3 , 0 } ,
{ " Gold " , " mcl_raw_ores:raw_gold " , " mcl_core:gold_ingot " , 4 , 0 } ,
{ " Emerald " , " mcl_core:emerald " , " mcl_core:emerald " , 4 , 6 } ,
{ " Diamond " , " mcl_core:diamond " , " mcl_core:diamond " , 4 , 4 } ,
2022-12-22 18:10:59 +01:00
{ " Lapis Lazuli " , lapis_drops , " mcl_core:lapis " , 3 , 6 } ,
2022-05-01 03:12:53 +02:00
}
for _ , p in pairs ( deepslate_ores ) do
2022-05-03 22:16:48 +02:00
register_deepslate_ore ( p [ 1 ] , p [ 2 ] , p [ 3 ] , p [ 4 ] , p [ 5 ] )
2022-05-01 03:12:53 +02:00
end
2022-05-04 11:07:04 +02:00
2022-05-01 03:12:53 +02:00
if copper_mod then
2022-05-03 22:16:48 +02:00
register_deepslate_ore ( " Copper " , " mcl_copper:raw_copper " , " mcl_copper:copper_ingot " , 4 , 4 )
2022-05-01 03:12:53 +02:00
end
local redstone_timer = 68.28
2022-05-04 11:07:04 +02:00
2022-10-22 01:05:53 +02:00
local function redstone_ore_activate ( pos , node , puncher , p ointed_thing )
2022-05-01 03:12:53 +02:00
minetest.swap_node ( pos , { name = " mcl_deepslate:deepslate_with_redstone_lit " } )
local t = minetest.get_node_timer ( pos )
t : start ( redstone_timer )
2022-10-22 01:05:53 +02:00
if puncher and pointed_thing then
return minetest.node_punch ( pos , node , puncher , pointed_thing )
end
2022-05-01 03:12:53 +02:00
end
2022-05-04 11:07:04 +02:00
2022-10-22 01:05:53 +02:00
local function redstone_ore_reactivate ( pos , node , puncher , pointed_thing )
2022-05-01 03:12:53 +02:00
local t = minetest.get_node_timer ( pos )
t : start ( redstone_timer )
2022-10-22 01:05:53 +02:00
if puncher and pointed_thing then
return minetest.node_punch ( pos , node , puncher , pointed_thing )
end
2022-05-01 03:12:53 +02:00
end
minetest.register_node ( " mcl_deepslate:deepslate_with_redstone " , {
description = S ( " Deepslate Redstone Ore " ) ,
_doc_items_longdesc = S ( " Deepslate redstone ore is a variant of redstone ore that can generate in deepslate and tuff blobs. " ) ,
tiles = { " mcl_deepslate_redstone_ore.png " } ,
is_ground_content = true ,
groups = { pickaxey = 4 , building_block = 1 , material_stone = 1 , xp = 7 } ,
drop = {
items = {
max_items = 1 ,
{ items = { " mesecons:redstone 4 " } , rarity = 2 } ,
{ items = { " mesecons:redstone 5 " } } ,
}
} ,
sounds = mcl_sounds.node_sound_stone_defaults ( ) ,
on_punch = redstone_ore_activate ,
on_walk_over = redstone_ore_activate ,
_mcl_blast_resistance = 3 ,
_mcl_hardness = 4.5 ,
_mcl_silk_touch_drop = true ,
_mcl_fortune_drop = {
discrete_uniform_distribution = true ,
items = { " mesecons:redstone " } ,
min_count = 4 ,
max_count = 5 ,
}
} )
minetest.register_node ( " mcl_deepslate:deepslate_with_redstone_lit " , {
description = S ( " Lit Deepslate Redstone Ore " ) ,
_doc_items_create_entry = false ,
tiles = { " mcl_deepslate_redstone_ore.png " } ,
paramtype = " light " ,
light_source = 9 ,
is_ground_content = true ,
2022-05-04 11:07:04 +02:00
groups = { pickaxey = 4 , not_in_creative_inventory = 1 , material_stone = 1 , xp = 7 } ,
2022-05-01 03:12:53 +02:00
drop = {
items = {
max_items = 1 ,
{ items = { " mesecons:redstone 4 " } , rarity = 2 } ,
{ items = { " mesecons:redstone 5 " } } ,
}
} ,
sounds = mcl_sounds.node_sound_stone_defaults ( ) ,
on_punch = redstone_ore_reactivate ,
on_walk_over = redstone_ore_reactivate , -- Uses walkover mod
2022-05-04 11:07:04 +02:00
on_timer = function ( pos , _ )
2022-05-01 03:12:53 +02:00
minetest.swap_node ( pos , { name = " mcl_deepslate:deepslate_with_redstone " } )
end ,
_mcl_blast_resistance = 3 ,
_mcl_hardness = 4.5 ,
_mcl_silk_touch_drop = { " mcl_deepslate:deepslate_with_redstone " } ,
_mcl_fortune_drop = {
discrete_uniform_distribution = true ,
items = { " mesecons:redstone " } ,
min_count = 4 ,
max_count = 5 ,
2022-05-03 22:16:48 +02:00
} ,
} )
2022-05-01 03:12:53 +02:00
local function register_deepslate_variant ( item , desc , longdesc )
local texture = desc : lower ( ) : gsub ( " % " , " _ " )
2022-05-04 23:09:59 +02:00
local def = {
2022-05-01 03:12:53 +02:00
description = S ( desc ) ,
_doc_items_longdesc = S ( longdesc ) ,
_doc_items_hidden = false ,
tiles = { " mcl_ " .. texture .. " .png " } ,
groups = { pickaxey = 1 , building_block = 1 , material_stone = 1 } ,
sounds = mcl_sounds.node_sound_stone_defaults ( ) ,
_mcl_blast_resistance = 6 ,
_mcl_hardness = 3.5 ,
_mcl_silk_touch_drop = true ,
2022-05-04 23:09:59 +02:00
}
if item == " cobbled " then
def.groups . cobble = 1
end
2022-05-06 12:32:13 +02:00
minetest.register_node ( " mcl_deepslate:deepslate_ " .. item , table.copy ( def ) )
2022-05-04 23:09:59 +02:00
2022-05-01 03:12:53 +02:00
if item == " bricks " or item == " tiles " then
2022-05-04 23:09:59 +02:00
def.description = S ( " Cracked " .. desc )
def._doc_items_longdesc = S ( " Cracked " .. desc : lower ( ) .. " are a cracked variant. " )
def.tiles = { " mcl_cracked_ " .. texture .. " .png " }
minetest.register_node ( " mcl_deepslate:deepslate_ " .. item .. " _cracked " , def )
2022-05-01 03:12:53 +02:00
end
if item ~= " chiseled " then
mcl_stairs.register_stair_and_slab_simple ( " deepslate_ " .. item , " mcl_deepslate:deepslate_ " .. item , S ( desc .. " Stairs " ) , S ( desc .. " Slab " ) , S ( " Double " .. desc .. " Slab " ) )
2023-09-17 13:47:18 +02:00
mcl_walls.register_wall (
" mcl_deepslate:deepslate " .. item .. " wall " ,
S ( desc .. " Wall " ) ,
2023-09-17 16:14:36 +02:00
" mcl_deepslate:deepslate_ " .. item )
2022-05-01 03:12:53 +02:00
end
end
local deepslate_variants = {
{ " cobbled " , " Cobbled Deepslate " , " Cobbled deepslate is a stone variant that functions similar to cobblestone or blackstone. " } ,
2022-05-04 11:07:04 +02:00
{ " polished " , " Polished Deepslate " , " Polished deepslate is the stone-like polished version of deepslate. " } ,
2022-05-01 03:12:53 +02:00
{ " bricks " , " Deepslate Bricks " , " Deepslate bricks are the brick version of deepslate. " } ,
{ " tiles " , " Deepslate Tiles " , " Deepslate tiles are a decorative variant of deepslate. " } ,
{ " chiseled " , " Chiseled Deepslate " , " Chiseled deepslate is the chiseled version of deepslate. " } ,
}
2022-05-04 11:07:04 +02:00
2022-05-01 03:12:53 +02:00
for _ , dv in pairs ( deepslate_variants ) do
register_deepslate_variant ( dv [ 1 ] , dv [ 2 ] , dv [ 3 ] )
end
2022-05-04 11:07:04 +02:00
2022-05-01 03:12:53 +02:00
for i = 1 , 3 do
local s = " mcl_deepslate:deepslate_ " .. deepslate_variants [ i ] [ 1 ]
minetest.register_craft ( {
output = " mcl_deepslate:deepslate_ " .. deepslate_variants [ i + 1 ] [ 1 ] .. " 4 " ,
2022-05-04 11:07:04 +02:00
recipe = { { s , s } , { s , s } }
2022-05-01 03:12:53 +02:00
} )
2023-11-13 21:18:39 +01:00
mcl_stonecutter.register_recipe (
" mcl_deepslate:deepslate_ " .. deepslate_variants [ i ] [ 1 ] ,
" mcl_deepslate:deepslate_ " .. deepslate_variants [ i + 1 ] [ 1 ]
)
2022-05-01 03:12:53 +02:00
end
2022-05-04 11:07:04 +02:00
2022-05-01 03:12:53 +02:00
for _ , p in pairs ( { " bricks " , " tiles " } ) do
minetest.register_craft ( {
type = " cooking " ,
output = " mcl_deepslate:deepslate_ " .. p .. " _cracked " ,
recipe = " mcl_deepslate:deepslate_ " .. p ,
cooktime = 10 ,
} )
end
2022-05-04 11:07:04 +02:00
2022-08-31 02:22:42 +02:00
minetest.register_craft ( {
type = " cooking " ,
output = " mesecons:redstone " ,
recipe = " mcl_deepslate:deepslate_with_redstone " ,
cooktime = 10 ,
} )
2022-05-01 03:12:53 +02:00
minetest.register_craft ( {
type = " cooking " ,
output = " mcl_deepslate:deepslate " ,
recipe = cobble ,
cooktime = 10 ,
} )
2022-05-04 11:07:04 +02:00
2022-05-01 03:12:53 +02:00
minetest.register_craft ( {
output = " mcl_deepslate:deepslate_chiseled " ,
recipe = {
{ " mcl_stairs:slab_deepslate_cobbled " } ,
{ " mcl_stairs:slab_deepslate_cobbled " } ,
2022-05-04 11:07:04 +02:00
} ,
2022-05-01 03:12:53 +02:00
} )
2023-11-13 21:18:39 +01:00
mcl_stonecutter.register_recipe ( " mcl_deepslate:deepslate_cobbled " , " mcl_deepslate:deepslate_chiseled " )