Add find_all_minerals achievement

This commit is contained in:
Wuzzy 2023-02-01 22:40:51 +01:00
parent a647f216ca
commit 40841ce44b
8 changed files with 51 additions and 9 deletions

View File

@ -55,6 +55,8 @@ These groups are mainly used for a better item sorting in Creative Mode.
* `spawn_egg`: Item that spawns mobs
* `book`: Book. Rating: 1 = unspecific book, 2 = writable book
* `mineral_lump`: A lump of a mineral, like coal lump, iron lump, etc.
* `mineral_natural`: A mineral item that occurs naturally (NOT the ore!)
* `mineral_artificial`: A mineral item that does not occur naturally (e.g. bronze lump)
* `ingot`: Ingot

View File

@ -176,3 +176,41 @@ if mg_name ~= "v6" then
end
end)
end
minetest.register_on_mods_loaded(function()
if not minetest.get_modpath("rp_checkitem") then
return
end
local minerals = {}
local minerals_readable = {}
for k,v in pairs(minetest.registered_items) do
if minetest.get_item_group(k, "mineral_natural") == 1 then
table.insert(minerals, k)
table.insert(minerals_readable, ItemStack(k):get_short_description())
end
end
-- Achievement for collecting all minerals that generate naturally in the world
-- (e.g. coal lump, iron lump, etc.).
achievements.register_achievement(
"find_all_minerals",
{
title = S("A Complete Collection"),
description = S("Obtain one of each minerals from the underground."),
subconditions = minerals,
subconditions_readable = minerals_readable,
times = 0,
icon = "rp_default_achievement_find_all_minerals.png",
})
local got_mineral = function(player, item)
end
for m=1, #minerals do
rp_checkitem.register_on_got_item(minerals[m], function(player)
achievements.trigger_subcondition(player, "find_all_minerals", minerals[m])
end)
end
end)

View File

@ -42,6 +42,7 @@ minetest.register_craftitem(
"rp_default:sheet_graphite",
{
description = S("Graphite Sheet"),
groups = { mineral_natural = 1 },
inventory_image = "default_sheet_graphite.png",
})
@ -51,7 +52,7 @@ minetest.register_craftitem(
"rp_default:lump_sulfur",
{
description = S("Sulfur Lump"),
groups = { mineral_lump = 1 },
groups = { mineral_lump = 1, mineral_natural = 1 },
inventory_image = "default_lump_sulfur.png",
})
@ -59,7 +60,7 @@ minetest.register_craftitem(
"rp_default:lump_coal",
{
description = S("Coal Lump"),
groups = { mineral_lump = 1 },
groups = { mineral_lump = 1, mineral_natural = 1 },
inventory_image = "default_lump_coal.png",
})
@ -67,7 +68,7 @@ minetest.register_craftitem(
"rp_default:lump_iron",
{
description = S("Iron Lump"),
groups = { mineral_lump = 1 },
groups = { mineral_lump = 1, mineral_natural = 1 },
inventory_image = "default_lump_iron.png",
})
@ -75,7 +76,7 @@ minetest.register_craftitem(
"rp_default:lump_tin",
{
description = S("Tin Lump"),
groups = { mineral_lump = 1 },
groups = { mineral_lump = 1, mineral_natural = 1 },
inventory_image = "default_lump_tin.png",
})
@ -83,7 +84,7 @@ minetest.register_craftitem(
"rp_default:lump_copper",
{
description = S("Copper Lump"),
groups = { mineral_lump = 1 },
groups = { mineral_lump = 1, mineral_natural = 1 },
inventory_image = "default_lump_copper.png",
})
@ -91,7 +92,7 @@ minetest.register_craftitem(
"rp_default:lump_bronze",
{
description = S("Bronze Lump"),
groups = { mineral_lump = 1 },
groups = { mineral_lump = 1, mineral_artificial = 1 },
inventory_image = "default_lump_bronze.png",
})

View File

@ -1,4 +1,4 @@
name = rp_default
depends = rp_sounds, rp_util, rp_formspec, rp_crafting, rp_item_drop
optional_depends = rp_achievements, rp_weather
optional_depends = rp_achievements, rp_checkitem, rp_weather
description = Main Repixture content mod. Contains most of the basic building blocks and items, including tools, weapons, fertilizer, buckets, chest, furnace, signs, torches, ladders and fences. Also contains the core map generator.

Binary file not shown.

After

Width:  |  Height:  |  Size: 809 B

View File

@ -536,7 +536,7 @@ minetest.register_craftitem(
"rp_gold:lump_gold",
{
description = S("Gold Lump"),
groups = { mineral_lump = 1 },
groups = { mineral_lump = 1, mineral_natural = 1 },
inventory_image = "gold_lump_gold.png",
})

View File

@ -260,6 +260,7 @@ minetest.register_node(
type = "fixed",
fixed = {-4/16, -0.5, -4/16, 4/16, -0.5+(3/16), 4/16}
},
-- Note: The jewel does NOT count as a mineral, it is special
groups = {dig_immediate = 3, craftitem = 1, attached_node = 1},
sounds = rp_sounds.node_sound_defaults(),
})

View File

@ -115,7 +115,7 @@ minetest.register_node(
description = S("Lumien Block"),
_tt_help = S("It shines so bright"),
tiles = {"lumien_block.png"},
groups = {cracky = 1},
groups = {cracky = 1, mineral_natural=1},
light_source = LUMIEN_BLOCK_LIGHT,
sounds = rp_sounds.node_sound_stone_defaults(),
})