forked from VoxeLibre/VoxeLibre
Bug fixes and new functions.lua
This commit is contained in:
parent
20888dfe32
commit
5f9da709f6
|
@ -1,5 +1,5 @@
|
|||
minetest.register_craft({
|
||||
output = "mcl_copper:raw_block",
|
||||
output = "mcl_copper:block_raw",
|
||||
recipe = {
|
||||
{ "mcl_copper:raw_copper", "mcl_copper:raw_copper", "mcl_copper:raw_copper" },
|
||||
{ "mcl_copper:raw_copper", "mcl_copper:raw_copper", "mcl_copper:raw_copper" },
|
||||
|
@ -56,13 +56,24 @@ local function get_shape(name, material)
|
|||
end
|
||||
|
||||
function mcl_copper.register_variants_recipes(name, material, amount)
|
||||
local names
|
||||
local materials = {}
|
||||
local names = {
|
||||
if name ~= "cut" then
|
||||
names = {
|
||||
name, "waxed_"..name,
|
||||
name.."_exposed", "waxed_"..name.."_exposed",
|
||||
name.."_weathered", "waxed_"..name.."_weathered",
|
||||
name.."_oxidized", "waxed_"..name.."_oxidized"
|
||||
}
|
||||
else
|
||||
names = {
|
||||
"block_"..name, "waxed_block_"..name,
|
||||
"block_exposed_"..name, "waxed_block_exposed_"..name,
|
||||
"block_weathered_"..name, "waxed_block_weathered_"..name,
|
||||
"block_oxidized_"..name, "waxed_block_oxidized_"..name
|
||||
}
|
||||
end
|
||||
|
||||
if type(material) == "string" then
|
||||
materials = {
|
||||
"mcl_copper:"..material, "mcl_copper:waxed_"..material,
|
||||
|
@ -90,7 +101,7 @@ end
|
|||
|
||||
mcl_copper.register_variants_recipes("cut", "block", 4)
|
||||
mcl_copper.register_variants_recipes("grate", "block", 4)
|
||||
--mcl_copper.register_variants_recipes("door", "block", 3)
|
||||
mcl_copper.register_variants_recipes("door", "block", 3)
|
||||
mcl_copper.register_variants_recipes("trapdoor", "block", 2)
|
||||
mcl_copper.register_variants_recipes("bulb_off", "block", 4)
|
||||
|
||||
|
@ -109,21 +120,25 @@ mcl_copper.register_variants_recipes("chiseled", chiseled_materials, 1)
|
|||
|
||||
local waxable_blocks = {
|
||||
"block",
|
||||
"cut",
|
||||
"block_cut",
|
||||
"grate",
|
||||
"chiseled",
|
||||
"bulb_off",
|
||||
"block_exposed",
|
||||
"cut_exposed",
|
||||
"block_exposed_cut",
|
||||
"grate_exposed",
|
||||
"chiseled_exposed",
|
||||
"bulb_off_exposed",
|
||||
"block_weathered",
|
||||
"cut_weathered",
|
||||
"block_weathered_cut",
|
||||
"grate_weathered",
|
||||
"chiseled_weathered",
|
||||
"bulb_off_weathered",
|
||||
"block_oxidized",
|
||||
"cut_oxidized",
|
||||
"block_oxidized_cut",
|
||||
"grate_oxidized",
|
||||
"chiseled_oxidized"
|
||||
"chiseled_oxidized",
|
||||
"bulb_off_oxidized"
|
||||
}
|
||||
|
||||
for _, w in ipairs(waxable_blocks) do
|
||||
|
@ -147,10 +162,10 @@ local cuttable_blocks = {
|
|||
}
|
||||
|
||||
for _, c in ipairs(cuttable_blocks) do
|
||||
mcl_stonecutter.register_recipe("mcl_copper:"..c, "mcl_copper:"..c:gsub("block", "cut"), 4)
|
||||
mcl_stonecutter.register_recipe("mcl_copper:"..c, "mcl_copper:"..c.."_cut", 4)
|
||||
mcl_stonecutter.register_recipe("mcl_copper:"..c, "mcl_copper:"..c:gsub("block", "grate"), 4)
|
||||
mcl_stonecutter.register_recipe("mcl_copper:"..c, "mcl_copper:"..c:gsub("block", "chiseled"), 4)
|
||||
mcl_stonecutter.register_recipe("mcl_copper:"..c:gsub("block", "cut"), "mcl_copper:"..c:gsub("block", "chiseled"), 1)
|
||||
mcl_stonecutter.register_recipe("mcl_copper:"..c.."_cut", "mcl_copper:"..c:gsub("block", "chiseled"))
|
||||
end
|
||||
|
||||
minetest.register_craft({
|
||||
|
@ -163,7 +178,7 @@ minetest.register_craft({
|
|||
minetest.register_craft({
|
||||
output = "mcl_copper:raw_copper 9",
|
||||
recipe = {
|
||||
{ "mcl_copper:raw_block" },
|
||||
{ "mcl_copper:block_raw" },
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -184,6 +199,6 @@ minetest.register_craft({
|
|||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "mcl_copper:block",
|
||||
recipe = "mcl_copper:raw_block",
|
||||
recipe = "mcl_copper:block_raw",
|
||||
cooktime = 90,
|
||||
})
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
local lit_desc = "(Lit)"
|
||||
local pow_desc = "(Powered)"
|
||||
local mix_desc = "(Lit and Powered)"
|
||||
|
||||
mcl_copper.copper_descs = {
|
||||
["block"] = {
|
||||
"Block of Copper", "Waxed Block of Copper",
|
||||
|
@ -23,7 +24,7 @@ mcl_copper.copper_descs = {
|
|||
["chiseled"] = {
|
||||
"Chiseled Copper", "Waxed Chiseled Copper",
|
||||
"Exposed Chiseled Copper", "Waxed Exposed Chiseled Copper",
|
||||
"Weathered Chiseled Copper", "Waxed Weathered Chiseled Copped",
|
||||
"Weathered Chiseled Copper", "Waxed Weathered Chiseled Copper",
|
||||
"Oxidized Chiseled Copper", "Waxed Oxidized Chiseled Copper"
|
||||
},
|
||||
["bulb_off"] = {
|
||||
|
@ -120,10 +121,10 @@ mcl_copper.stairs_descs = {
|
|||
"Waxed Slab of Cut Copper", "Waxed Double Slab of Cut Copper", "Waxed Stairs of Cut Copper",
|
||||
},
|
||||
["copper_exposed_cut"] = {
|
||||
"Slab of Exposed Cut Copper", "Double Slab of Exposed Cut Copper", "Stairs of Exposed Cut waxed_copper_oxidized_cut"
|
||||
"Slab of Exposed Cut Copper", "Double Slab of Exposed Cut Copper", "Stairs of Exposed Cut Copper"
|
||||
},
|
||||
["waxed_copper_exposed_cut"] = {
|
||||
"Waxed Slab of Exposed Cut Copper", "Waxed Double Slab of Exposed Cut Copper", "Stairs of Exposed Cut Copper"
|
||||
"Waxed Slab of Exposed Cut Copper", "Waxed Double Slab of Exposed Cut Copper", "Waxed Stairs of Exposed Cut Copper"
|
||||
},
|
||||
["copper_weathered_cut"] = {
|
||||
"Slab of Weathered Cut Copper", "Double Slab of Weathered Cut Copper", "Stairs of Weathered Cut Copper"
|
||||
|
|
|
@ -1,142 +1,73 @@
|
|||
local stair_oxidization = {
|
||||
{ "cut", "exposed_cut" },
|
||||
{ "cut_inner", "exposed_cut_inner" },
|
||||
{ "cut_outer", "exposed_cut_outer" },
|
||||
{ "exposed_cut", "weathered_cut" },
|
||||
{ "exposed_cut_inner", "weathered_cut_inner" },
|
||||
{ "exposed_cut_outer", "weathered_cut_outer" },
|
||||
{ "weathered_cut", "oxidized_cut" },
|
||||
{ "weathered_cut_inner", "oxidized_cut_inner" },
|
||||
{ "weathered_cut_outer", "oxidized_cut_outer" }
|
||||
function mcl_copper.register_oxidation_and_scraping(mod_name, subname, decay_chain)
|
||||
local item, oxidized_item
|
||||
|
||||
for i = 1, #decay_chain - 1 do
|
||||
item = mod_name..":"..subname..decay_chain[i]
|
||||
oxidized_item = mod_name..":"..subname..decay_chain[i + 1]
|
||||
|
||||
minetest.override_item(item, {_mcl_oxidized_variant = oxidized_item})
|
||||
minetest.override_item(oxidized_item, {_mcl_stripped_variant = item})
|
||||
|
||||
if subname:find("stair") then
|
||||
minetest.override_item(item.."_inner", {_mcl_oxidized_variant = oxidized_item.."_inner"})
|
||||
minetest.override_item(item.."_outer", {_mcl_oxidized_variant = oxidized_item.."_outer"})
|
||||
minetest.override_item(oxidized_item.."_inner", {_mcl_stripped_variant = item.."_inner"})
|
||||
minetest.override_item(oxidized_item.."_outer", {_mcl_stripped_variant = item.."_outer"})
|
||||
elseif subname:find("slab") then
|
||||
minetest.override_item(item.."_double", {_mcl_oxidized_variant = oxidized_item.."_double"})
|
||||
minetest.override_item(item.."_top", {_mcl_oxidized_variant = oxidized_item.."_top"})
|
||||
minetest.override_item(oxidized_item.."_double", {_mcl_stripped_variant = item.."_double"})
|
||||
minetest.override_item(oxidized_item.."_top", {_mcl_stripped_variant = item.."_top"})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function mcl_copper.register_waxing_and_scraping(mod_name, subname, decay_chain)
|
||||
local waxed_item, unwaxed_item
|
||||
|
||||
for i = 1, #decay_chain do
|
||||
waxed_item = mod_name..":"..subname..decay_chain[i]
|
||||
unwaxed_item = mod_name..":"..subname:gsub("waxed_", "")..decay_chain[i]
|
||||
|
||||
minetest.override_item(waxed_item, {_mcl_stripped_variant = unwaxed_item})
|
||||
minetest.override_item(unwaxed_item, {_mcl_waxed_variant = waxed_item})
|
||||
|
||||
if subname:find("stair") then
|
||||
minetest.override_item(waxed_item.."_inner", {_mcl_stripped_variant = unwaxed_item.."_inner"})
|
||||
minetest.override_item(waxed_item.."_outer", {_mcl_stripped_variant = unwaxed_item.."_outer"})
|
||||
minetest.override_item(unwaxed_item.."_inner", {_mcl_waxed_variant = waxed_item.."_inner"})
|
||||
minetest.override_item(unwaxed_item.."_outer", {_mcl_waxed_variant = waxed_item.."_outer"})
|
||||
elseif subname:find("slab") then
|
||||
minetest.override_item(waxed_item.."_double", {_mcl_stripped_variant = unwaxed_item.."_double"})
|
||||
minetest.override_item(waxed_item.."_top", {_mcl_stripped_variant = unwaxed_item.."_top"})
|
||||
minetest.override_item(unwaxed_item.."_double", {_mcl_waxed_variant = waxed_item.."_double"})
|
||||
minetest.override_item(unwaxed_item.."_top", {_mcl_waxed_variant = waxed_item.."_top"})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local cut_decay_chain = {
|
||||
"_cut",
|
||||
"_exposed_cut",
|
||||
"_weathered_cut",
|
||||
"_oxidized_cut"
|
||||
}
|
||||
local trapdoor_decay_chain = {
|
||||
"",
|
||||
"_exposed",
|
||||
"_weathered",
|
||||
"_oxidized"
|
||||
}
|
||||
local waxed_trapdoor_decay_chain = {
|
||||
"",
|
||||
"_exposed",
|
||||
"_weathered",
|
||||
"_oxidized"
|
||||
}
|
||||
|
||||
local slab_oxidization = {
|
||||
{ "cut", "exposed_cut" },
|
||||
{ "cut_top", "exposed_cut_top" },
|
||||
{ "cut_double", "exposed_cut_double" },
|
||||
{ "exposed_cut", "weathered_cut" },
|
||||
{ "exposed_cut_top", "weathered_cut_top" },
|
||||
{ "exposed_cut_double", "weathered_cut_double" },
|
||||
{ "weathered_cut", "oxidized_cut" },
|
||||
{ "weathered_cut_top", "oxidized_cut_top" },
|
||||
{ "weathered_cut_double", "oxidized_cut_double" },
|
||||
}
|
||||
|
||||
local def
|
||||
local def_variant_oxidized
|
||||
local def_variant_waxed
|
||||
local def_variant_scraped
|
||||
|
||||
-- set up oxidized and waxed variants.
|
||||
for i = 1, #stair_oxidization do
|
||||
-- stairs
|
||||
def = "mcl_stairs:stair_copper_" .. stair_oxidization[i][1]
|
||||
def_variant_oxidized = "mcl_stairs:stair_copper_" .. stair_oxidization[i][2]
|
||||
minetest.override_item(def, { _mcl_oxidized_variant = def_variant_oxidized })
|
||||
|
||||
def_variant_waxed = "mcl_stairs:stair_waxed_copper_" .. stair_oxidization[i][1]
|
||||
minetest.override_item(def, { _mcl_waxed_variant = def_variant_waxed })
|
||||
|
||||
-- slabs
|
||||
def = "mcl_stairs:slab_copper_" .. slab_oxidization[i][1]
|
||||
def_variant_oxidized = "mcl_stairs:slab_copper_" .. slab_oxidization[i][2]
|
||||
minetest.override_item(def, { _mcl_oxidized_variant = def_variant_oxidized })
|
||||
|
||||
def_variant_waxed = "mcl_stairs:slab_waxed_copper_" .. slab_oxidization[i][1]
|
||||
minetest.override_item(def, { _mcl_waxed_variant = def_variant_waxed })
|
||||
end
|
||||
|
||||
-- Set up scraped variants.
|
||||
for i = 1, #stair_oxidization do
|
||||
-- does both stairs and slabs.
|
||||
if i > 3 then
|
||||
def = "mcl_stairs:stair_copper_" .. stair_oxidization[i][1]
|
||||
def_variant_scraped = "mcl_stairs:stair_copper_" .. stair_oxidization[i - 3][1]
|
||||
minetest.override_item(def, { _mcl_stripped_variant = def_variant_scraped })
|
||||
|
||||
def = "mcl_stairs:slab_copper_" .. slab_oxidization[i][1]
|
||||
def_variant_scraped = "mcl_stairs:slab_copper_" .. slab_oxidization[i - 3][1]
|
||||
minetest.override_item(def, { _mcl_stripped_variant = def_variant_scraped })
|
||||
end
|
||||
if i > 6 then
|
||||
def = "mcl_stairs:stair_copper_" .. stair_oxidization[i][2]
|
||||
def_variant_scraped = "mcl_stairs:stair_copper_" .. stair_oxidization[i][1]
|
||||
minetest.override_item(def, { _mcl_stripped_variant = def_variant_scraped })
|
||||
|
||||
def = "mcl_stairs:slab_copper_" .. slab_oxidization[i][2]
|
||||
def_variant_scraped = "mcl_stairs:slab_copper_" .. slab_oxidization[i][1]
|
||||
minetest.override_item(def, { _mcl_stripped_variant = def_variant_scraped })
|
||||
end
|
||||
end
|
||||
|
||||
-- Set up scraped variants for waxed stairs.
|
||||
local waxed_variants = {
|
||||
{ "waxed_copper_cut", "copper_cut" },
|
||||
{ "waxed_copper_exposed_cut", "copper_exposed_cut" },
|
||||
{ "waxed_copper_weathered_cut", "copper_weathered_cut" },
|
||||
{ "waxed_copper_oxidized_cut", "copper_oxidized_cut" },
|
||||
}
|
||||
|
||||
for i = 1, #waxed_variants do
|
||||
-- stairs
|
||||
def = "mcl_stairs:stair_" .. waxed_variants[i][1]
|
||||
def_variant_scraped = "mcl_stairs:stair_" .. waxed_variants[i][2]
|
||||
minetest.override_item(def, { _mcl_stripped_variant = def_variant_scraped })
|
||||
|
||||
def = "mcl_stairs:stair_" .. waxed_variants[i][1] .. "_inner"
|
||||
def_variant_scraped = "mcl_stairs:stair_" .. waxed_variants[i][2] .. "_inner"
|
||||
minetest.override_item(def, { _mcl_stripped_variant = def_variant_scraped })
|
||||
|
||||
def = "mcl_stairs:stair_" .. waxed_variants[i][1] .. "_outer"
|
||||
def_variant_scraped = "mcl_stairs:stair_" .. waxed_variants[i][2] .. "_outer"
|
||||
minetest.override_item(def, { _mcl_stripped_variant = def_variant_scraped })
|
||||
|
||||
-- slab
|
||||
def = "mcl_stairs:slab_" .. waxed_variants[i][1]
|
||||
def_variant_scraped = "mcl_stairs:slab_" .. waxed_variants[i][2]
|
||||
minetest.override_item(def, { _mcl_stripped_variant = def_variant_scraped })
|
||||
|
||||
def = "mcl_stairs:slab_" .. waxed_variants[i][1] .. "_top"
|
||||
def_variant_scraped = "mcl_stairs:slab_" .. waxed_variants[i][2] .. "_top"
|
||||
minetest.override_item(def, { _mcl_stripped_variant = def_variant_scraped })
|
||||
|
||||
def = "mcl_stairs:slab_" .. waxed_variants[i][1] .. "_double"
|
||||
def_variant_scraped = "mcl_stairs:slab_" .. waxed_variants[i][2] .. "_double"
|
||||
minetest.override_item(def, { _mcl_stripped_variant = def_variant_scraped })
|
||||
|
||||
end
|
||||
|
||||
-- Waxed Oxidized Slabs and Stairs
|
||||
local oxidized_slabs = {
|
||||
"oxidized_cut",
|
||||
"oxidized_cut_double",
|
||||
"oxidized_cut_top"
|
||||
}
|
||||
|
||||
for i = 1, #oxidized_slabs do
|
||||
def = "mcl_stairs:slab_copper_" .. oxidized_slabs[i]
|
||||
def_variant_waxed = "mcl_stairs:slab_waxed_copper_" .. oxidized_slabs[i]
|
||||
minetest.override_item(def, { _mcl_waxed_variant = def_variant_waxed })
|
||||
end
|
||||
|
||||
local oxidized_stairs = {
|
||||
"oxidized_cut",
|
||||
"oxidized_cut_inner",
|
||||
"oxidized_cut_outer"
|
||||
}
|
||||
|
||||
for i = 1, #oxidized_stairs do
|
||||
def = "mcl_stairs:stair_copper_" .. oxidized_stairs[i]
|
||||
def_variant_waxed = "mcl_stairs:stair_waxed_copper_" .. oxidized_stairs[i]
|
||||
minetest.override_item(def, { _mcl_waxed_variant = def_variant_waxed })
|
||||
end
|
||||
|
||||
minetest.register_alias("mcl_copper:raw_block", "mcl_copper:block_raw")
|
||||
minetest.register_alias("mcl_copper:cut", "mcl_copper:block_cut")
|
||||
minetest.register_alias("mcl_copper:waxed_cut", "mcl_copper:waxed_block_cut")
|
||||
minetest.register_alias("mcl_copper:cut_exposed", "mcl_copper:block_exposed_cut")
|
||||
minetest.register_alias("mcl_copper:waxed_cut_exposed", "mcl_copper:waxed_block_exposed_cut")
|
||||
minetest.register_alias("mcl_copper:cut_weathered", "mcl_copper:block_weathered_cut")
|
||||
minetest.register_alias("mcl_copper:waxed_cut_weathered", "mcl_copper:waxed_block_weathered_cut")
|
||||
minetest.register_alias("mcl_copper:cut_oxidized", "mcl_copper:block_oxidized_cut")
|
||||
minetest.register_alias("mcl_copper:waxed_cut_oxidized", "mcl_copper:waxed_block_oxidized_cut")
|
||||
mcl_copper.register_oxidation_and_scraping("mcl_stairs", "stair_copper", cut_decay_chain)
|
||||
mcl_copper.register_oxidation_and_scraping("mcl_stairs", "slab_copper", cut_decay_chain)
|
||||
mcl_copper.register_oxidation_and_scraping("mcl_copper", "trapdoor", trapdoor_decay_chain)
|
||||
mcl_copper.register_waxing_and_scraping("mcl_stairs", "stair_waxed_copper", cut_decay_chain)
|
||||
mcl_copper.register_waxing_and_scraping("mcl_stairs", "slab_waxed_copper", cut_decay_chain)
|
||||
mcl_copper.register_waxing_and_scraping("mcl_copper", "waxed_trapdoor", waxed_trapdoor_decay_chain)
|
||||
|
|
|
@ -1,16 +1,84 @@
|
|||
local S = minetest.get_translator("mcl_copper")
|
||||
|
||||
local function set_description(descs, s_index, n_index)
|
||||
local description
|
||||
|
||||
if type(descs[s_index][n_index]) == "string" then
|
||||
description = S(descs[s_index][n_index])
|
||||
elseif type(descs[s_index][n_index]) == "table" then
|
||||
description = S("@1 "..descs[s_index][n_index][2], S(descs[s_index][n_index][1]))
|
||||
else
|
||||
return nil
|
||||
end
|
||||
|
||||
return description
|
||||
end
|
||||
|
||||
local function set_drop(drop, old_name, index_name)
|
||||
if drop and old_name and index_name then
|
||||
drop = "mcl_copper:"..old_name:gsub(index_name, drop)
|
||||
end
|
||||
|
||||
return drop
|
||||
end
|
||||
|
||||
local function set_groups(name, groups)
|
||||
local groups = table.copy(groups)
|
||||
|
||||
if name and groups then
|
||||
if name:find("waxed") then
|
||||
groups.waxed = 1
|
||||
elseif not name:find("oxidized") then
|
||||
groups.oxidizable = 1
|
||||
end
|
||||
|
||||
if name:find("door") then
|
||||
groups.building_block = 0
|
||||
groups.mesecon_effector_on = 1
|
||||
end
|
||||
else
|
||||
return nil
|
||||
end
|
||||
|
||||
return groups
|
||||
end
|
||||
|
||||
local function set_light_level(light_source, index)
|
||||
local ceil, floor_5, floor_7 = math.ceil(index / 2), math.floor(index / 5), math.floor(index / 7)
|
||||
if light_source then
|
||||
light_source = light_source - 3 * (ceil - 1) - floor_5 - floor_7
|
||||
end
|
||||
|
||||
return light_source
|
||||
end
|
||||
|
||||
local function set_tiles(tiles, index)
|
||||
if not tiles or not index then
|
||||
return
|
||||
end
|
||||
|
||||
return tiles[math.ceil(index / 2)]
|
||||
end
|
||||
|
||||
function mcl_copper.register_copper_variants(name, definitions)
|
||||
local description, drop
|
||||
local light_level = nil
|
||||
local oxidized_variant, stripped_variant, waxed_variant
|
||||
local mcl_copper_groups = table.copy(definitions.groups)
|
||||
local names = {
|
||||
local names, oxidized_variant, stripped_variant, waxed_variant
|
||||
|
||||
if name ~= "cut" then
|
||||
names = {
|
||||
name, "waxed_"..name,
|
||||
name.."_exposed", "waxed_"..name.."_exposed",
|
||||
name.."_weathered", "waxed_"..name.."_weathered",
|
||||
name.."_oxidized", "waxed_"..name.."_oxidized"
|
||||
}
|
||||
else
|
||||
names = {
|
||||
"block_"..name, "waxed_block_"..name,
|
||||
"block_exposed_"..name, "waxed_block_exposed_"..name,
|
||||
"block_weathered_"..name, "waxed_block_weathered_"..name,
|
||||
"block_oxidized_"..name, "waxed_block_oxidized_"..name
|
||||
}
|
||||
end
|
||||
|
||||
local tiles = {
|
||||
"mcl_copper_"..name..".png",
|
||||
"mcl_copper_"..name.."_exposed.png",
|
||||
|
@ -19,22 +87,10 @@ function mcl_copper.register_copper_variants(name, definitions)
|
|||
}
|
||||
|
||||
for i = 1, #names do
|
||||
if type(mcl_copper.copper_descs[name][i]) == "string" then
|
||||
description = S(mcl_copper.copper_descs[name][i])
|
||||
elseif type(mcl_copper.copper_descs[name][i]) == "table" then
|
||||
description = S("@1 "..mcl_copper.copper_descs[name][i][2], S(mcl_copper.copper_descs[name][i][1]))
|
||||
end
|
||||
|
||||
if definitions.drop then
|
||||
drop = "mcl_copper:"..names[i]:gsub(name, definitions.drop)
|
||||
end
|
||||
|
||||
if names[i]:find("waxed") then
|
||||
mcl_copper_groups.waxed = 1
|
||||
stripped_variant = "mcl_copper:"..names[i-1]
|
||||
else
|
||||
if not names[i]:find("oxidized") then
|
||||
mcl_copper_groups.oxidizable = 1
|
||||
oxidized_variant = "mcl_copper:"..names[i+2]
|
||||
end
|
||||
if i ~= 1 then
|
||||
|
@ -43,23 +99,19 @@ function mcl_copper.register_copper_variants(name, definitions)
|
|||
waxed_variant = "mcl_copper:"..names[i+1]
|
||||
end
|
||||
|
||||
if definitions.light_source then
|
||||
light_level = definitions.light_source-3*(math.ceil(i/2)-1)-math.floor(i/5)-math.floor(i/7)
|
||||
end
|
||||
|
||||
minetest.register_node("mcl_copper:"..names[i], {
|
||||
description = description,
|
||||
description = set_description(mcl_copper.copper_descs, name, i),
|
||||
drawtype = definitions.drawtype or "normal",
|
||||
drop = drop or nil,
|
||||
groups = mcl_copper_groups,
|
||||
drop = set_drop(definitions.drop, names[i], name),
|
||||
groups = set_groups(names[i], definitions.groups),
|
||||
is_ground_content = false,
|
||||
light_source = light_level,
|
||||
light_source = set_light_level(definitions.light_source, i),
|
||||
mesecons = definitions.mesecons,
|
||||
paramtype = definitions.paramtype or "none",
|
||||
paramtype2 = definitions.paramtype2 or "none",
|
||||
sounds = mcl_sounds.node_sound_metal_defaults(),
|
||||
sunlight_propagates = definitions.sunlight_propagates or false,
|
||||
tiles = {tiles[math.ceil(i/2)]},
|
||||
tiles = {set_tiles(tiles, i)},
|
||||
_doc_items_longdesc = S(mcl_copper.copper_longdescs[name][math.ceil(i/2)]),
|
||||
_mcl_blast_resistance = 6,
|
||||
_mcl_hardness = 3,
|
||||
|
@ -70,29 +122,24 @@ function mcl_copper.register_copper_variants(name, definitions)
|
|||
|
||||
if definitions._mcl_stairs then
|
||||
local subname = mcl_copper.stairs_subnames[name][i]
|
||||
local mcl_stairs_groups = table.copy(mcl_copper_groups)
|
||||
|
||||
mcl_stairs.register_slab(subname, "mcl_copper:"..names[i],
|
||||
mcl_stairs_groups, {tiles[math.ceil(i/2)], tiles[math.ceil(i/2)], tiles[math.ceil(i/2)]},
|
||||
S(mcl_copper.stairs_descs[subname][1]), nil, nil, nil,
|
||||
S(mcl_copper.stairs_descs[subname][2])
|
||||
mcl_stairs.register_slab(subname, "mcl_copper:"..names[i], set_groups(subname, definitions.groups),
|
||||
{set_tiles(tiles, i), set_tiles(tiles, i), set_tiles(tiles, i)},
|
||||
set_description(mcl_copper.stairs_descs, subname, 1), nil, nil, nil,
|
||||
set_description(mcl_copper.stairs_descs, subname, 2)
|
||||
)
|
||||
|
||||
mcl_stairs.register_stair(subname, "mcl_copper:"..names[i],
|
||||
mcl_stairs_groups, {tiles[math.ceil(i/2)], tiles[math.ceil(i/2)], tiles[math.ceil(i/2)],
|
||||
tiles[math.ceil(i/2)], tiles[math.ceil(i/2)], tiles[math.ceil(i/2)]},
|
||||
S(mcl_copper.stairs_descs[subname][3]), nil, nil, nil, "woodlike"
|
||||
mcl_stairs.register_stair(subname, "mcl_copper:"..names[i], set_groups(subname, definitions.groups),
|
||||
{set_tiles(tiles, i), set_tiles(tiles, i), set_tiles(tiles, i),
|
||||
set_tiles(tiles, i), set_tiles(tiles, i), set_tiles(tiles, i)},
|
||||
set_description(mcl_copper.stairs_descs, subname, 3), nil, nil, nil, "woodlike"
|
||||
)
|
||||
end
|
||||
|
||||
if definitions._mcl_doors then
|
||||
local itemimg, lowertext, uppertext, frontimg, sideimg
|
||||
local door_groups = table.copy(mcl_copper_groups)
|
||||
local trapdoor_groups = table.copy(mcl_copper_groups)
|
||||
door_groups.building_block = 0
|
||||
door_groups.mesecon_effector_on = 1
|
||||
trapdoor_groups.building_block = 0
|
||||
trapdoor_groups.mesecon_effector_on = 1
|
||||
local door_groups = set_groups(names[i]:gsub(name, "door"), definitions.groups)
|
||||
local trapdoor_groups = set_groups(names[i]:gsub(name, "trapdoor"), definitions.groups)
|
||||
|
||||
if i % 2 == 1 then
|
||||
itemimg = "mcl_copper_item_"..names[i]:gsub(name, "door")..".png"
|
||||
|
@ -135,26 +182,6 @@ function mcl_copper.register_copper_variants(name, definitions)
|
|||
_mcl_blast_resistance = 3,
|
||||
_mcl_hardness = 3
|
||||
})
|
||||
|
||||
if names[i]:find("waxed") then
|
||||
minetest.override_item("mcl_copper:"..names[i]:gsub(name, "trapdoor"), {
|
||||
_mcl_stripped_variant = "mcl_copper:"..names[i-1]:gsub(name, "trapdoor")
|
||||
})
|
||||
else
|
||||
if not names[i]:find("oxidized") then
|
||||
minetest.override_item("mcl_copper:"..names[i]:gsub(name, "trapdoor"), {
|
||||
_mcl_oxidized_variant = "mcl_copper:"..names[i+2]:gsub(name, "trapdoor")
|
||||
})
|
||||
end
|
||||
if i ~= 1 then
|
||||
minetest.override_item("mcl_copper:"..names[i]:gsub(name, "trapdoor"), {
|
||||
_mcl_stripped_variant = "mcl_copper:"..names[i-2]:gsub(name, "trapdoor")
|
||||
})
|
||||
end
|
||||
minetest.override_item("mcl_copper:"..names[i]:gsub(name, "trapdoor"), {
|
||||
_mcl_waxed_variant = "mcl_copper:"..names[i+1]:gsub(name, "trapdoor")
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -173,7 +200,7 @@ minetest.register_node("mcl_copper:stone_with_copper", {
|
|||
_mcl_fortune_drop = mcl_core.fortune_drop_ore,
|
||||
})
|
||||
|
||||
minetest.register_node("mcl_copper:raw_block", {
|
||||
minetest.register_node("mcl_copper:block_raw", {
|
||||
description = S("Block of Raw Copper"),
|
||||
_doc_items_longdesc = S("A block used for compact raw copper storage."),
|
||||
tiles = {"mcl_copper_raw_block.png"},
|
||||
|
@ -211,7 +238,7 @@ mcl_copper.register_copper_variants("bulb_off", {
|
|||
action_on = function (pos, node)
|
||||
minetest.swap_node(pos, {name = node.name:gsub("bulb_off", "bulb_powered_on")})
|
||||
end
|
||||
}
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -224,7 +251,7 @@ mcl_copper.register_copper_variants("bulb_on", {
|
|||
action_on = function (pos, node)
|
||||
minetest.swap_node(pos, {name = node.name:gsub("bulb_on", "bulb_powered_off")})
|
||||
end
|
||||
}
|
||||
},
|
||||
},
|
||||
paramtype = "light"
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue