Fix codestyle issues with `mcl_deepslate`, `mcl_copper`, `mcl_raw_ores`

This commit is contained in:
AFCMS 2022-05-04 11:07:04 +02:00 committed by Gitea
parent b0b8ef3921
commit f8f6ea22c8
8 changed files with 104 additions and 87 deletions

View File

@ -1,10 +1,7 @@
# MineClone2 Copper
### by NO11
[![ContentDB](https://content.minetest.net/packages/NO11/mcl_copper/shields/title/)](https://content.minetest.net/packages/NO11/mcl_copper/)
[![ContentDB](https://content.minetest.net/packages/NO11/mcl_copper/shields/downloads/)](https://content.minetest.net/packages/NO11/mcl_copper/)
Adds copper ore, blocks and items.
You need the Minetest subgame "Mineclone 2" to use the mod.
![screenshot](https://content.minetest.net/uploads/338864e2d3.png)
![screenshot](./screenshot.png)

View File

@ -4,61 +4,70 @@ minetest.register_craft({
{ "mcl_copper:raw_copper", "mcl_copper:raw_copper", "mcl_copper:raw_copper" },
{ "mcl_copper:raw_copper", "mcl_copper:raw_copper", "mcl_copper:raw_copper" },
{ "mcl_copper:raw_copper", "mcl_copper:raw_copper", "mcl_copper:raw_copper" },
}
},
})
minetest.register_craft({
output = "mcl_copper:block",
recipe = {
{ "mcl_copper:copper_ingot", "mcl_copper:copper_ingot" },
{ "mcl_copper:copper_ingot", "mcl_copper:copper_ingot" },
}
},
})
minetest.register_craft({
output = "mcl_copper:block_cut 4",
recipe = {
{ "mcl_copper:block", "mcl_copper:block" },
{ "mcl_copper:block", "mcl_copper:block" },
}
},
})
minetest.register_craft({
output = "mcl_copper:block_exposed_cut 4",
recipe = {
{ "mcl_copper:block_exposed", "mcl_copper:block_exposed" },
{ "mcl_copper:block_exposed", "mcl_copper:block_exposed" },
}
},
})
minetest.register_craft({
output = "mcl_copper:block_oxidized_cut 4",
recipe = {
{ "mcl_copper:block_oxidized", "mcl_copper:block_oxidized" },
{ "mcl_copper:block_oxidized", "mcl_copper:block_oxidized" },
}
},
})
minetest.register_craft({
output = "mcl_copper:mcl_copper:block_weathered_cut 4",
recipe = {
{ "mcl_copper:block_weathered", "mcl_copper:block_weathered" },
{ "mcl_copper:block_weathered", "mcl_copper:block_weathered" },
}
},
})
minetest.register_craft({
output = "mcl_copper:copper_ingot 4",
recipe = {
{ "mcl_copper:block" },
}
},
})
minetest.register_craft({
output = "mcl_copper:raw_copper 9",
recipe = {
{ "mcl_copper:block_raw" },
}
},
})
minetest.register_craft({
type = "cooking",
output = "mcl_copper:copper_ingot",
recipe = "mcl_copper:raw_copper",
cooktime = 10,
})
minetest.register_craft({
type = "cooking",
output = "mcl_copper:copper_ingot",

View File

@ -1,4 +1,5 @@
local deepslate_mod = minetest.get_modpath("mcl_deepslate")
--local deepslate_mod = minetest.get_modpath("mcl_deepslate")
local function register_oxidation_abm(abm_name, node_name, oxidized_variant)
minetest.register_abm({
label = abm_name,
@ -6,11 +7,12 @@ local function register_oxidation_abm(abm_name, node_name, oxidized_variant)
interval = 500,
chance = 3,
action = function(pos, node)
minetest.swap_node(pos, {name=oxidized_variant, param2=node.param2})
end
minetest.swap_node(pos, {name = oxidized_variant, param2 = node.param2})
end,
})
end
--[[
local stairs = {
{"stair", "exposed", "_inner", "cut_inner"},
{"stair", "weathered", "_inner", "exposed_cut_inner"},
@ -29,9 +31,10 @@ local stairs = {
{"slab", "weathered", "_double","exposed_cut_double"},
{"stair", "exposed", "","cut"},
{"stair", "oxidized", "", "weathered_cut"},
{"stair", "weathered", "", "exposed_cut"}
}
{"stair", "weathered", "", "exposed_cut"},
}]]
--[[
local function anti_oxidation_particles(pointed_thing)
local pos = pointed_thing.under
minetest.add_particlespawner({
@ -103,7 +106,8 @@ local function register_axe_override(axe_name)
minetest.override_item("mcl_tools:axe_"..axe_name, {
on_place = anti_oxidation,
})
end
end]]
--[[ Commented out for now because there the discussion how to handle this is ongoing
local stonelike = {"mcl_core:stone", "mcl_core:diorite", "mcl_core:andesite", "mcl_core:granite"}
if not deepslate_mod then
@ -168,7 +172,8 @@ end
for _, s in pairs(stair_oxidation) do
register_oxidation_abm("Copper oxidation", "mcl_stairs:"..s[1].."_copper_"..s[2], "mcl_stairs:"..s[1].."_copper_"..s[3])
end
local axes = {"wood", "stone", "iron", "gold", "diamond"}
--local axes = {"wood", "stone", "iron", "gold", "diamond"}
--[[
for _, axe in pairs(axes) do
register_axe_override(axe)

View File

@ -4,13 +4,12 @@ minetest.register_craftitem("mcl_copper:copper_ingot", {
description = S("Copper Ingot"),
_doc_items_longdesc = S("Molten Raw Copper. It is used to craft blocks."),
inventory_image = "mcl_copper_ingot.png",
stack_max = 64,
groups = { craftitem=1 },
groups = { craftitem = 1 },
})
minetest.register_craftitem("mcl_copper:raw_copper", {
description = S("Raw Copper"),
_doc_items_longdesc = S("Raw Copper. Mine a Copper Ore to get it."),
inventory_image = "mcl_copper_raw.png",
stack_max = 64,
groups = { craftitem=1 },
groups = { craftitem = 1 },
})

View File

@ -5,8 +5,7 @@ minetest.register_node("mcl_copper:stone_with_copper", {
_doc_items_longdesc = S("Some copper contained in stone, it is pretty common and can be found below sea level."),
tiles = {"default_stone.png^mcl_copper_ore.png"},
is_ground_content = true,
stack_max = 64,
groups = {pickaxey=3, building_block=1, material_stone=1},
groups = {pickaxey = 3, building_block = 1, material_stone = 1},
drop = "mcl_copper:raw_copper",
sounds = mcl_sounds.node_sound_stone_defaults(),
_mcl_blast_resistance = 3,
@ -21,8 +20,7 @@ minetest.register_node("mcl_copper:block_raw", {
_doc_items_longdesc = S("A block used for compact raw copper storage."),
tiles = {"mcl_copper_block_raw.png"},
is_ground_content = false,
stack_max = 64,
groups = {pickaxey=2, building_block=1},
groups = {pickaxey = 2, building_block = 1},
sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 6,
_mcl_hardness = 5,
@ -33,8 +31,7 @@ minetest.register_node("mcl_copper:block", {
_doc_items_longdesc = S("A block of copper is mostly a decorative block."),
tiles = {"mcl_copper_block.png"},
is_ground_content = false,
stack_max = 64,
groups = {pickaxey=2, building_block=1},
groups = {pickaxey = 2, building_block = 1},
sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 6,
_mcl_hardness = 5,
@ -45,8 +42,7 @@ minetest.register_node("mcl_copper:block_exposed", {
_doc_items_longdesc = S("Exposed copper is a decorative block."),
tiles = {"mcl_copper_exposed.png"},
is_ground_content = false,
stack_max = 64,
groups = {pickaxey=2, building_block=1},
groups = {pickaxey = 2, building_block = 1},
sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 6,
_mcl_hardness = 5,
@ -58,8 +54,7 @@ minetest.register_node("mcl_copper:block_oxidized", {
_doc_items_longdesc = S("Oxidized copper is a decorative block."),
tiles = {"mcl_copper_oxidized.png"},
is_ground_content = false,
stack_max = 64,
groups = {pickaxey=2, building_block=1},
groups = {pickaxey = 2, building_block = 1},
sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 6,
_mcl_hardness = 5,
@ -71,8 +66,7 @@ minetest.register_node("mcl_copper:block_weathered", {
_doc_items_longdesc = S("Weathered copper is a decorative block."),
tiles = {"mcl_copper_weathered.png"},
is_ground_content = false,
stack_max = 64,
groups = {pickaxey=2, building_block=1},
groups = {pickaxey = 2, building_block = 1},
sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 6,
_mcl_hardness = 5,
@ -84,8 +78,7 @@ minetest.register_node("mcl_copper:block_cut", {
_doc_items_longdesc = S("Cut copper is a decorative block."),
tiles = {"mcl_copper_block_cut.png"},
is_ground_content = false,
stack_max = 64,
groups = {pickaxey=2, building_block=1},
groups = {pickaxey = 2, building_block = 1},
sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 6,
_mcl_hardness = 5,
@ -96,8 +89,7 @@ minetest.register_node("mcl_copper:block_exposed_cut", {
_doc_items_longdesc = S("Exposed cut copper is a decorative block."),
tiles = {"mcl_copper_exposed_cut.png"},
is_ground_content = false,
stack_max = 64,
groups = {pickaxey=2, building_block=1},
groups = {pickaxey = 2, building_block = 1},
sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 6,
_mcl_hardness = 5,
@ -109,8 +101,7 @@ minetest.register_node("mcl_copper:block_oxidized_cut", {
_doc_items_longdesc = S("Oxidized cut copper is a decorative block."),
tiles = {"mcl_copper_oxidized_cut.png"},
is_ground_content = false,
stack_max = 64,
groups = {pickaxey=2, building_block=1},
groups = {pickaxey = 2, building_block = 1},
sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 6,
_mcl_hardness = 5,
@ -122,8 +113,7 @@ minetest.register_node("mcl_copper:block_weathered_cut", {
_doc_items_longdesc = S("Weathered cut copper is a decorative block."),
tiles = {"mcl_copper_weathered_cut.png"},
is_ground_content = false,
stack_max = 64,
groups = {pickaxey=2, building_block=1},
groups = {pickaxey = 2, building_block = 1},
sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 6,
_mcl_hardness = 5,
@ -131,56 +121,56 @@ minetest.register_node("mcl_copper:block_weathered_cut", {
})
mcl_stairs.register_slab("copper_cut", "mcl_copper:block_cut",
{pickaxey=2},
{pickaxey = 2},
{"mcl_copper_block_cut.png", "mcl_copper_block_cut.png", "mcl_copper_block_cut.png"},
S("Slab of Cut Copper"),
nil, nil, nil,
S("Double Slab of Cut Copper"))
mcl_stairs.register_slab("copper_exposed_cut", "mcl_copper:block_exposed_cut",
{pickaxey=2},
{pickaxey = 2},
{"mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png"},
S("Slab of Exposed Cut Copper"),
nil, nil, nil,
S("Double Slab of Exposed Cut Copper"))
mcl_stairs.register_slab("copper_oxidized_cut", "mcl_copper:block_oxidized_cut",
{pickaxey=2},
{pickaxey = 2},
{"mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png"},
S("Slab of Oxidized Cut Copper"),
nil, nil, nil,
S("Double Slab of Oxidized Cut Copper"))
mcl_stairs.register_slab("copper_weathered_cut", "mcl_copper:block_weathered_cut",
{pickaxey=2},
{pickaxey = 2},
{"mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png"},
S("Slab of Weathered Cut Copper"),
nil, nil, nil,
S("Double Slab of Weathered Cut Copper"))
mcl_stairs.register_stair("copper_cut", "mcl_copper:block_cut",
{pickaxey=2},
{pickaxey = 2},
{"mcl_copper_block_cut.png", "mcl_copper_block_cut.png", "mcl_copper_block_cut.png", "mcl_copper_block_cut.png", "mcl_copper_block_cut.png", "mcl_copper_block_cut.png"},
S("Stairs of Cut Copper"),
nil, 6, nil,
"woodlike")
mcl_stairs.register_stair("copper_exposed_cut", "mcl_copper:block_exposed_cut",
{pickaxey=2},
{pickaxey = 2},
{"mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png", "mcl_copper_exposed_cut.png"},
S("Stairs of Exposed Cut Copper"),
nil, 6, nil,
"woodlike")
mcl_stairs.register_stair("copper_oxidized_cut", "mcl_copper:block_oxidized_cut",
{pickaxey=2},
{pickaxey = 2},
{"mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png", "mcl_copper_oxidized_cut.png"},
S("Stairs of Oxidized Cut Copper"),
nil, 6, nil,
"woodlike")
mcl_stairs.register_stair("copper_weathered_cut", "mcl_copper:block_weathered_cut",
{pickaxey=2},
{pickaxey = 2},
{"mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png", "mcl_copper_weathered_cut.png"},
S("Stairs of Weathered Cut Copper"),
nil, 6, nil,

Binary file not shown.

After

Width:  |  Height:  |  Size: 215 KiB

View File

@ -1,20 +1,21 @@
local modname = minetest.get_current_modname()
local S = minetest.get_translator(modname)
local layer_max = mcl_worlds.layer_to_y(16)
local layer_min = mcl_vars.mg_overworld_min
--local layer_max = mcl_worlds.layer_to_y(16)
--local layer_min = mcl_vars.mg_overworld_min
local copper_mod = minetest.get_modpath("mcl_copper")
local cobble = "mcl_deepslate:deepslate_cobbled"
local stick = "mcl_core:stick"
--[[
local mountains = {
"ExtremeHills", "ExtremeHills_beach", "ExtremeHills_ocean", "ExtremeHills_deep_ocean", "ExtremeHills_underground",
"ExtremeHills+", "ExtremeHills+_ocean", "ExtremeHills+_deep_ocean", "ExtremeHills+_underground",
"ExtremeHillsM", "ExtremeHillsM_ocean", "ExtremeHillsM_deep_ocean", "ExtremeHillsM_underground",
}
if minetest.get_modpath("mcl_item_id") then
mcl_item_id.set_mod_namespace(modname)
end
]]
minetest.register_node("mcl_deepslate:deepslate", {
description = S("Deepslate"),
@ -23,7 +24,6 @@ minetest.register_node("mcl_deepslate:deepslate", {
tiles = { "mcl_deepslate_top.png", "mcl_deepslate_top.png", "mcl_deepslate.png" },
paramtype2 = "facedir",
is_ground_content = true,
stack_max = 64,
on_place = mcl_util.rotate_axis,
groups = { pickaxey = 1, stone = 1, building_block = 1, material_stone = 1 },
drop = cobble,
@ -59,7 +59,6 @@ minetest.register_node("mcl_deepslate: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" },
stack_max = 64,
groups = { pickaxey = 1, deco_block = 1 },
sounds = mcl_sounds.node_sound_stone_defaults(),
_mcl_blast_resistance = 6,
@ -111,16 +110,19 @@ local deepslate_ores = {
for _, p in pairs(deepslate_ores) do
register_deepslate_ore(p[1], p[2], p[3], p[4])
end
if copper_mod then
register_deepslate_ore("Copper", "mcl_copper:raw_copper", 4, 4)
end
local redstone_timer = 68.28
local function redstone_ore_activate(pos)
minetest.swap_node(pos, { name = "mcl_deepslate:deepslate_with_redstone_lit" })
local t = minetest.get_node_timer(pos)
t:start(redstone_timer)
end
local function redstone_ore_reactivate(pos)
local t = minetest.get_node_timer(pos)
t:start(redstone_timer)
@ -131,7 +133,6 @@ minetest.register_node("mcl_deepslate:deepslate_with_redstone", {
_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,
stack_max = 64,
groups = { pickaxey = 4, building_block = 1, material_stone = 1, xp = 7 },
drop = {
items = {
@ -161,8 +162,7 @@ minetest.register_node("mcl_deepslate:deepslate_with_redstone_lit", {
paramtype = "light",
light_source = 9,
is_ground_content = true,
stack_max = 64,
groups = { pickaxey = 4, not_in_creative_inventory = 1, material_stone = 1, xp = 7},
groups = { pickaxey = 4, not_in_creative_inventory = 1, material_stone = 1, xp = 7 },
drop = {
items = {
max_items = 1,
@ -173,7 +173,7 @@ minetest.register_node("mcl_deepslate:deepslate_with_redstone_lit", {
sounds = mcl_sounds.node_sound_stone_defaults(),
on_punch = redstone_ore_reactivate,
on_walk_over = redstone_ore_reactivate, -- Uses walkover mod
on_timer = function(pos, elapsed)
on_timer = function(pos, _)
minetest.swap_node(pos, { name = "mcl_deepslate:deepslate_with_redstone" })
end,
_mcl_blast_resistance = 3,
@ -186,6 +186,7 @@ minetest.register_node("mcl_deepslate:deepslate_with_redstone_lit", {
max_count = 5,
}
})
--[[ Commented out for now because there the discussion how to handle this is ongoing
minetest.register_ore({
ore_type = "blob",
@ -353,7 +354,6 @@ local function register_deepslate_variant(item, desc, longdesc)
_doc_items_longdesc = S(longdesc),
_doc_items_hidden = false,
tiles = { "mcl_"..texture..".png" },
stack_max = 64,
groups = { pickaxey = 1, building_block = 1, material_stone = 1 },
sounds = mcl_sounds.node_sound_stone_defaults(),
_mcl_blast_resistance = 6,
@ -366,7 +366,6 @@ local function register_deepslate_variant(item, desc, longdesc)
_doc_items_longdesc = S("Cracked "..desc:lower().." are a cracked variant."),
_doc_items_hidden = false,
tiles = { "mcl_cracked_"..texture..".png" },
stack_max = 64,
groups = { pickaxey = 1, building_block = 1, material_stone = 1 },
sounds = mcl_sounds.node_sound_stone_defaults(),
_mcl_blast_resistance = 6,
@ -387,9 +386,11 @@ local deepslate_variants = {
{ "tiles", "Deepslate Tiles", "Deepslate tiles are a decorative variant of deepslate." },
{ "chiseled", "Chiseled Deepslate", "Chiseled deepslate is the chiseled version of deepslate." },
}
for _, dv in pairs(deepslate_variants) do
register_deepslate_variant(dv[1], dv[2], dv[3])
end
for i = 1, 3 do
local s = "mcl_deepslate:deepslate_"..deepslate_variants[i][1]
minetest.register_craft({
@ -397,6 +398,7 @@ for i = 1, 3 do
recipe = { { s, s }, { s, s } }
})
end
for _, p in pairs({ "bricks", "tiles" }) do
minetest.register_craft({
type = "cooking",
@ -405,87 +407,98 @@ for _, p in pairs({ "bricks", "tiles" }) do
cooktime = 10,
})
end
minetest.register_craft({
type = "cooking",
output = "mcl_deepslate:deepslate",
recipe = cobble,
cooktime = 10,
})
minetest.register_craft({
output = "mcl_deepslate:deepslate_chiseled",
recipe = {
{ "mcl_stairs:slab_deepslate_cobbled" },
{ "mcl_stairs:slab_deepslate_cobbled" },
}
},
})
minetest.register_craft({
output = "mcl_brewing:stand_000",
recipe = {
{ "", "mcl_mobitems:blaze_rod", "" },
{ cobble, cobble, cobble },
}
},
})
minetest.register_craft({
output = "mcl_furnaces:furnace",
recipe = {
{ cobble, cobble, cobble },
{ cobble, "", cobble },
{ cobble, cobble, cobble },
}
},
})
minetest.register_craft({
output = "mcl_tools:pick_stone",
recipe = {
{ cobble, cobble, cobble },
{ "", stick, "" },
{ "", stick, "" },
}
},
})
minetest.register_craft({
output = "mcl_tools:shovel_stone",
recipe = {
{ cobble },
{ stick },
{ stick },
}
},
})
minetest.register_craft({
output = "mcl_tools:axe_stone",
recipe = {
{ cobble, cobble },
{ cobble, stick },
{ "", stick },
}
},
})
minetest.register_craft({
output = "mcl_tools:axe_stone",
recipe = {
{ cobble, cobble },
{ stick, cobble },
{ stick, "" },
}
},
})
minetest.register_craft({
output = "mcl_tools:sword_stone",
recipe = {
{ cobble },
{ cobble },
{ stick },
}
},
})
minetest.register_craft({
output = "mcl_farming:hoe_stone",
recipe = {
{ cobble, cobble },
{ "", stick },
{ "", stick }
}
},
})
minetest.register_craft({
output = "mcl_farming:hoe_stone",
recipe = {
{ cobble, cobble },
{ stick, "" },
{ stick, "" }
}
},
})

View File

@ -3,44 +3,48 @@ local function register_raw_ore(description, n)
local n = n or ""
local raw_ingot = "mcl_raw_ores:raw_"..ore
local texture = "mcl_raw_ores_raw_"..ore
minetest.register_craftitem(raw_ingot, {
description = ("Raw "..description),
_doc_items_longdesc = ("Raw "..ore..". Mine a"..n.." "..ore.." ore to get it."),
inventory_image = texture..".png",
stack_max = 64,
groups = { craftitem = 1 },
description = ("Raw "..description),
_doc_items_longdesc = ("Raw "..ore..". Mine a"..n.." "..ore.." ore to get it."),
inventory_image = texture..".png",
groups = { craftitem = 1 },
})
minetest.register_node(raw_ingot.."_block", {
description = ("Block of Raw "..description),
_doc_items_longdesc = ("A block of raw "..ore.." is mostly a decorative block but also useful as a compact storage of raw "..ore.."."),
tiles = { texture.."_block.png" },
is_ground_content = false,
stack_max = 64,
groups = { pickaxey = 2, building_block = 1 },
sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 6,
_mcl_hardness = 5,
})
minetest.register_craft({
output = raw_ingot.."_block",
recipe = {
{ raw_ingot, raw_ingot, raw_ingot },
{ raw_ingot, raw_ingot, raw_ingot },
{ raw_ingot, raw_ingot, raw_ingot },
}
},
})
minetest.register_craft({
type = "cooking",
output = "mcl_core:"..ore.."_ingot",
recipe = raw_ingot,
cooktime = 10,
})
minetest.register_craft({
output = raw_ingot.." 9",
recipe = {
{ raw_ingot.."_block" },
}
},
})
end
register_raw_ore("Iron", "n")
register_raw_ore("Gold")