See Comments! Follow them to make the needed changes. Added in Recipe for rose gold nuggets, for the lantern.

This commit is contained in:
Michieal 2023-02-15 02:53:47 -05:00
parent 3d0365ae12
commit dcb928dda2
2 changed files with 102 additions and 88 deletions

View File

@ -3,19 +3,28 @@ local modpath = minetest.get_modpath(modname)
local S = minetest.get_translator(modname)
--local S = minetest.get_translator("mcl_lanterns")
--oxidation function
local function register_oxidation_abm(abm_name, node_name, oxidized_variant)
minetest.register_abm({
label = abm_name,
nodenames = {node_name},
interval = 500,
chance = 3,
action = function(pos, node)
minetest.swap_node(pos, {name = oxidized_variant, param2 = node.param2})
end,
})
-- function register_oxidation_abm(abm_name, node_name, oxidized_variant) can be removed once PR# 3454 is in play.
-- I've already added the optional dependency. Once the PR is in play, move it from optional_depends to depends, and
-- delete this chunk of code.
-- oxidation function
if not minetest.get_modpath("mcl_oxidization") then
function register_oxidation_abm(abm_name, node_name, oxidized_variant)
minetest.register_abm({
label = abm_name,
nodenames = { node_name },
interval = 500,
chance = 3,
action = function(pos, node)
minetest.swap_node(pos, { name = oxidized_variant, param2 = node.param2 })
end,
})
end
end
--[[
-- Not Needed, give the nodes _mcl_copper_waxed_variant and mcl_honey will do the rest.
function waxing_rose_gold_block(pos, node, player, itemstack, convert_to)
if itemstack:get_name() == "mcl_honey:honeycomb" then
node.name = convert_to
@ -28,30 +37,19 @@ function waxing_rose_gold_block(pos, node, player, itemstack, convert_to)
return true
end
end
]]
function scraping_rose_gold_block(pos, node, player, itemstack, convert_to)
if itemstack:get_name():find("axe") then
node.name = convert_to
minetest.set_node(pos, node)
awards.unlock(player:get_player_name(), "mcl:wax_off")
if not minetest.is_creative_enabled(player:get_player_name()) then
local tool = itemstack:get_name()
local wear = mcl_autogroup.get_wear(tool, "axey")
itemstack:add_wear(wear)
end
else
return true
end
end
-- function scraping_rose_gold_block(pos, node, player, itemstack, convert_to) is also not needed.
-- set _mcl_stripped_variant in the node def, and axes will handle the rest.
-- Change the contained entries in this array to reflect ONLY the nodes created. Otherwise, it'll have issues.
local block_oxidation = {
{"", "_exposed"},
{"_cut", "_exposed_cut"},
{"_exposed", "_weathered"},
{"_exposed_cut", "_weathered_cut"},
{"_weathered", "_oxidized"},
{"_weathered_cut", "_oxidized_cut"}
{ "", "_exposed" },
{ "_cut", "_exposed_cut" },
{ "_exposed", "_weathered" },
{ "_exposed_cut", "_weathered_cut" },
{ "_weathered", "_oxidized" },
{ "_weathered_cut", "_oxidized_cut" }
}
--[[local stair_oxidation = {
@ -76,7 +74,7 @@ local block_oxidation = {
}
]]
for _, b in pairs(block_oxidation) do
register_oxidation_abm("Rose gold oxidation", "mcl_rose_gold:rose_gold_block"..b[1], "mcl_rose_gold:rose_gold_block"..b[2])
register_oxidation_abm("Rose gold oxidation", "mcl_rose_gold:rose_gold_block" .. b[1], "mcl_rose_gold:rose_gold_block" .. b[2])
end
--[[
for _, s in pairs(stair_oxidation) do
@ -85,90 +83,105 @@ end
]]
--Rose Gold Nugget
minetest.register_craftitem("mcl_rose_gold:rose_gold_nugget", {
description = S("Rose Gold Nugget"),
_doc_items_longdesc = S("Rose Gold nuggets are very small pieces of molten rose gold; the main purpose is to create rose gold ingots."),
inventory_image = "mcl_rose_gold_rose_gold_nugget.png",
stack_max = 64,
groups = { craftitem=1 },
minetest.register_craftitem("mcl_rose_gold:rose_gold_nugget", {
description = S("Rose Gold Nugget"),
_doc_items_longdesc = S("Rose Gold nuggets are very small pieces of molten rose gold; the main purpose is to create rose gold ingots."),
inventory_image = "mcl_rose_gold_rose_gold_nugget.png",
stack_max = 64,
groups = { craftitem = 1 },
})
--Rose Gold Ingot
minetest.register_craftitem("mcl_rose_gold:rose_gold_ingot", {
description = S("Rose Gold Ingot"),
_doc_items_longdesc = S("Molten rose gold. It is used to craft armor, tools, and decorative items."),
inventory_image = "mcl_rose_gold_rose_gold_ingot2.png",
stack_max = 64,
groups = { craftitem=1 },
description = S("Rose Gold Ingot"),
_doc_items_longdesc = S("Molten rose gold. It is used to craft armor, tools, and decorative items."),
inventory_image = "mcl_rose_gold_rose_gold_ingot2.png",
stack_max = 64,
groups = { craftitem = 1 },
})
--Rose Gold Block
minetest.register_node("mcl_rose_gold:rose_gold_block", {
description = S("Block of Rose Gold"),
_doc_items_longdesc = S("A block of rose gold is mostly a shiny decorative block but also useful as a compact storage of rose gold ingots."),
tiles = {"mcl_rose_gold_rose_gold_block.png"},
is_ground_content = false,
stack_max = 64,
groups = {pickaxey=4, building_block=1},
sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 6,
_mcl_hardness = 3,
on_rightclick = function(pos, node, player, itemstack) waxing_rose_gold_block(pos, node, player, itemstack, "mcl_rose_gold:waxed_rose_gold_block") end,
description = S("Block of Rose Gold"),
_doc_items_longdesc = S("A block of rose gold is mostly a shiny decorative block but also useful as a compact storage of rose gold ingots."),
tiles = { "mcl_rose_gold_rose_gold_block.png" },
is_ground_content = false,
stack_max = 64,
groups = { pickaxey = 4, building_block = 1 },
sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 6,
_mcl_hardness = 3,
on_rightclick = function(pos, node, player, itemstack) -- convert this to _mcl_copper_waxed_variant and remove the on_rightclick()
waxing_rose_gold_block(pos, node, player, itemstack, "mcl_rose_gold:waxed_rose_gold_block")
end,
})
--Waxed Rose Gold Block
minetest.register_node("mcl_rose_gold:waxed_rose_gold_block", {
description = S("Waxed Block of Rose Gold"),
_doc_items_longdesc = S("A Waxed block of rose gold is mostly a shiny decorative block but also useful as a compact storage of rose gold ingots."),
tiles = {"mcl_rose_gold_rose_gold_block.png"},
is_ground_content = false,
stack_max = 64,
groups = {pickaxey=4, building_block=1},
sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 6,
_mcl_hardness = 3,
on_rightclick = function(pos, node, player, itemstack) scraping_rose_gold_block(pos, node, player, itemstack, "mcl_rose_gold:rose_gold_block") end,
description = S("Waxed Block of Rose Gold"),
_doc_items_longdesc = S("A Waxed block of rose gold is mostly a shiny decorative block but also useful as a compact storage of rose gold ingots."),
tiles = { "mcl_rose_gold_rose_gold_block.png" },
is_ground_content = false,
stack_max = 64,
groups = { pickaxey = 4, building_block = 1 },
sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 6,
_mcl_hardness = 3,
on_rightclick = function(pos, node, player, itemstack) -- convert this to _mcl_stripped_variant and remove the on_rightclick()
scraping_rose_gold_block(pos, node, player, itemstack, "mcl_rose_gold:rose_gold_block")
end,
})
--Exposed Rose Gold Block
minetest.register_node("mcl_rose_gold:rose_gold_block_exposed", {
description = S("Exposed Rose Gold"),
_doc_items_longdesc = S("Exposed Rose Gold is a decorative block."),
tiles = {"mcl_rose_gold_rose_gold_block_exposed.png"},
is_ground_content = false,
groups = {pickaxey = 2, building_block = 1},
sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 6,
_mcl_hardness = 5,
_mcl_anti_oxidation_varient = "mcl_rose_gold:rose_gold_block",
on_rightclick = function(pos, node, player, itemstack) waxing_rose_gold_block(pos, node, player, itemstack, "mcl_rose_gold:waxed_rose_gold_block_exposed") end,
description = S("Exposed Rose Gold"),
_doc_items_longdesc = S("Exposed Rose Gold is a decorative block."),
tiles = { "mcl_rose_gold_rose_gold_block_exposed.png" },
is_ground_content = false,
groups = { pickaxey = 2, building_block = 1 },
sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 6,
_mcl_hardness = 5,
_mcl_anti_oxidation_varient = "mcl_rose_gold:rose_gold_block",
on_rightclick = function(pos, node, player, itemstack) -- do the same here
waxing_rose_gold_block(pos, node, player, itemstack, "mcl_rose_gold:waxed_rose_gold_block_exposed")
end,
})
--Waxed Exposed Rose Gold Block
minetest.register_node("mcl_rose_gold:waxed_rose_gold_block_exposed", {
description = S("Waxed Exposed Rose Gold"),
_doc_items_longdesc = S("Waxed Exposed Rose Gold is a decorative block."),
tiles = {"mcl_rose_gold_rose_gold_block_exposed.png"},
is_ground_content = false,
groups = {pickaxey = 2, building_block = 1},
sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 6,
_mcl_hardness = 5,
on_rightclick = function(pos, node, player, itemstack) scraping_rose_gold_block(pos, node, player, itemstack, "mcl_rose_gold:rose_gold_block") end,
description = S("Waxed Exposed Rose Gold"),
_doc_items_longdesc = S("Waxed Exposed Rose Gold is a decorative block."),
tiles = { "mcl_rose_gold_rose_gold_block_exposed.png" },
is_ground_content = false,
groups = { pickaxey = 2, building_block = 1 },
sounds = mcl_sounds.node_sound_metal_defaults(),
_mcl_blast_resistance = 6,
_mcl_hardness = 5,
on_rightclick = function(pos, node, player, itemstack) -- and here.
scraping_rose_gold_block(pos, node, player, itemstack, "mcl_rose_gold:rose_gold_block")
end,
})
--Rose Gold Lantern
mcl_lanterns.register_lantern("mcl_rose_gold:rose_gold_lantern", {
description = S("Rose Gold Lantern"),
longdesc = S("Rose gold lanterns are light sources which can be placed on the top or the bottom of most blocks."),
texture = "mcl_rose_gold_rose_gold_lantern.png",
texture_inv = "mcl_rose_gold_rose_gold_lantern_inv.png",
light_level = 10,
description = S("Rose Gold Lantern"),
longdesc = S("Rose gold lanterns are light sources which can be placed on the top or the bottom of most blocks."),
texture = "mcl_rose_gold_rose_gold_lantern.png",
texture_inv = "mcl_rose_gold_rose_gold_lantern_inv.png",
light_level = 10,
})
-- Crafting Recipes
-- rose gold ingot recipe, following the one for iron_ingot.
minetest.register_craft({
output = "mcl_rose_gold:rose_gold_nugget 9",
recipe = {
{"mcl_rose_gold:rose_gold_ingot"},
}
})

View File

@ -1,5 +1,6 @@
name = mcl_rose_gold
depends = mcl_core, mcl_sounds, mcl_armor
optional_depends = mcl_oxidization
description = Adds rose gold tools and armor to Mineclone 2
release = 0.1
author = Various (Michieal, SmokeyDope)