dfcaverns/df_achievements/farming.lua

155 lines
11 KiB
Lua
Raw Normal View History

Mineclone compatibility (#36) * latest versions of mapgen_helper and subterrane * initial work * call it "minetest_game" compatibility instead of "default" compatibility * Getting started on moving all default dependencies to a single root mod * distilling out more dependencies * fix some typos * more default dependencies * beds * start getting some MCL equivalents set up * mine gas dependencies * reorganize * add some mapgen stuff * getting close to actually being able to run mineclone with this * it actually runs! Crashes with out-of-memory error when you try to go below -64, but it's a start. * hide flowing pit plasma from creative inventory * mineclone 5 settings * Update subterrane * get rid of meselamp dependency, bring in ancient lanterns from deep roads * stair dependencies * add mcl fences * add mcl blast resistance and hardness to everything. Also an alternate name for Nethercap in MCL, since "nether" has another meaning there. * buckets of oil and syrup should work in mineclone now * 'splosions! * make hunters avoid repaired ancient lanterns * mapgen torchspine wasn't having its timer set * split mapgen compatibility code into its own file * bypass dependency indirection for df_farming. * apply threshold alpha to food items, they look better that way * bypass dependency indirection for df_mapitems * bypass dependency indirection for df_primordial_items * bypass dependency indirection for df_trees * bypass dependency indirection for df_underworld_items * bypass dependency indirection for df_caverns * fixing up the puzzle seal to work in both * fix puzzle seal formspec for mcl * create built-in substitutes for fireflies and bones mods for when those aren't available * set up mcl dungeon loot for underworld warriors, port over some translations from default * overlooked a debug * add itemslot backgrounds for mcl * added mineclone groups to all registered nodes. TODO: craftitems. This was extremely tedious. Completely untested, aside from simply running the game. * minor fixes to the built-in bones node * eatable group for edibles * clean up some TODOs * adjust pit plasma abm conditions * add df_ambience * fixing up explosions. Also make slade sand diggable in mcl, and fix a bug in web generators * make tower cap caves less chirpy, fix bigger goblin hut schematic, allow glowing spindlestem extract bottles * avoid an undeclared global check * alas, cave pearls aren't set up right for attached_node_facedir. * bunch of work on mineclone ores, moved main config into df_dependencies * add a few more ores * update depends in mod.conf * add opaque group to light-sensitive dirt types Mineclone adds the "opaque" group only to non-light nodes, and torches check for the opaque group to decide whether they can be placed there. light-sensitive nodes need the "light" paramtype to work, though. So adding the opaque group manually to these. * add a touch of reverb to one of the whisper tracks, it didn't fit with the others without it * bloodthorn also needs to be set opaque * add sound to torchspines * isolate Nethercap translation name to make it easier to swap out in Mineclone contexts * ambience tweak * fix dirt spreads https://github.com/FaceDeer/dfcaverns/issues/35 * adding achievements! Almost all untested yet. * fix a few achievements glitches * tweak some more achievements, add delay when achievements unlock other achievements * fix farming achievements, fix spindlestem callbacks on place * icons for farming achievements * more achievement icons, fix ancient lantern achievement * two more icons, update text * add icons for upper cavern layers * all achievements have icons now. Also add another sound to the magma sea ambience * hook into awards' trigger system to get "x/y" progress displayed for the multi-achievement achievements * ironically, Mineclone has an old version of awards that is incompatible with my trigger work. * every award should now have a description and a difficulty. * removing leftovers * missing callbacks for farmables * put growth restrictions on farmables so the achievement doesn't trigger inappropriately. * enable ores in MCL2, fix some undeclared globals, fix icecap growth in MCL (achievements are a good debugging tool) * get *all* the copper and iron containing nodes * fix old awards mod's handling of grouped dig items * Add a little bonus for players who activate a slade breacher - a handheld 'splosion tool * used the wrong drop method * beef up explosions in MCL, make slade brick craftable from slade sand and lava * better creative mode checks, fix crash when digging walls in MCL * Update subterrane * various bugfixes and tweaks * whipping up a simple puzzle chest to give a clue about ancient numbering The coding is done, but UI and a node mesh need to be done * prepare for some art tomorrow * chest node and sounds * images for the combination dials * add puzzle chests to the underworld buildings * update translations * oops, can't initialize the contents of puzzle chests every time or players get endless stuff * add backgrounds to item slots in MCL * wrap the existing function rather than copy and pasting it * fix bucket dependency in cooking recipes * add _mcl_saturation to edibles
2022-08-29 07:48:44 +02:00
local S = minetest.get_translator(minetest.get_current_modname())
local nethercap_name = df_dependencies.nethercap_name
local hoe_texture = df_dependencies.texture_tool_steelhoe
local soil_texture = df_dependencies.texture_farming_soil
local ice_texture = df_dependencies.texture_ice
local coal_ore = "(".. df_dependencies.texture_stone .."^".. df_dependencies.texture_mineral_coal ..")"
local make_texture = function(plant_texture, bg_tex)
bg_tex = bg_tex or soil_texture
return "dfcaverns_awards_backgroundx32.png^[combine:32x32:3,4="..bg_tex.."^[combine:32x32:3,2="..plant_texture.."^[combine:32x32:14,13="..hoe_texture.."^dfcaverns_awards_foregroundx32.png"
end
-- forestry
local plant_node_achievements =
{
["df_trees:black_cap_sapling"] = {achievement="dfcaverns_plant_black_cap",
title=S("Plant Black Cap"), icon=make_texture("dfcaverns_black_cap_sapling.png", coal_ore), _dfcaverns_achievements={"dfcaverns_plant_all_upper_trees", "dfcaverns_plant_all_underground_trees"}, difficulty = 1,},
["df_trees:fungiwood_sapling"] = {achievement="dfcaverns_plant_fungiwood",
title=S("Plant Fungiwood"), icon=make_texture("dfcaverns_fungiwood_sapling.png"), _dfcaverns_achievements={"dfcaverns_plant_all_upper_trees", "dfcaverns_plant_all_underground_trees"}, difficulty = 1,},
["df_trees:goblin_cap_sapling"] = {achievement="dfcaverns_plant_goblin_cap",
title=S("Plant Goblin Cap"), icon=make_texture("dfcaverns_goblin_cap_sapling.png"), _dfcaverns_achievements={"dfcaverns_plant_all_upper_trees", "dfcaverns_plant_all_underground_trees"}, difficulty = 1,},
["df_trees:nether_cap_sapling"] = {achievement="dfcaverns_plant_nethercap",
title=S("Plant @1", nethercap_name), icon=make_texture("dfcaverns_nether_cap_sapling.png", ice_texture), _dfcaverns_achievements={"dfcaverns_plant_all_upper_trees", "dfcaverns_plant_all_underground_trees"}, difficulty = 1,},
["df_trees:spore_tree_sapling"] = {achievement="dfcaverns_plant_spore_tree",
title=S("Plant Spore Tree"), icon=make_texture("dfcaverns_spore_tree_sapling.png"), _dfcaverns_achievements={"dfcaverns_plant_all_upper_trees", "dfcaverns_plant_all_underground_trees"}, difficulty = 1,},
["df_trees:tower_cap_sapling"] = {achievement="dfcaverns_plant_tower_cap",
title=S("Plant Tower Cap"), icon=make_texture("dfcaverns_tower_cap_sapling.png"), _dfcaverns_achievements={"dfcaverns_plant_all_upper_trees", "dfcaverns_plant_all_underground_trees"}, difficulty = 1,},
["df_trees:tunnel_tube_sapling"] = {achievement="dfcaverns_plant_tunnel_tube",
title=S("Plant Tunnel Tube"), icon=make_texture("dfcaverns_tunnel_tube_sapling.png"), _dfcaverns_achievements={"dfcaverns_plant_all_upper_trees", "dfcaverns_plant_all_underground_trees"}, difficulty = 1,},
["df_trees:torchspine_ember"] = {achievement="dfcaverns_plant_torchspine",
title=S("Plant Torchspine"), icon=make_texture("dfcaverns_torchspine_achievement.png", coal_ore), _dfcaverns_achievements={"dfcaverns_plant_all_upper_trees", "dfcaverns_plant_all_underground_trees"}, difficulty = 1,},
["df_trees:spindlestem_seedling"] = {achievement="dfcaverns_plant_spindlestem",
title=S("Plant Spindlestem"), icon=make_texture("dfcaverns_spindlestem_achievement.png"), _dfcaverns_achievements={"dfcaverns_plant_all_upper_trees", "dfcaverns_plant_all_underground_trees"}, difficulty = 1,},
["df_trees:blood_thorn"] = {achievement="dfcaverns_plant_bloodthorn",
title=S("Plant Bloodthorn"), icon=make_texture("dfcaverns_bloodthorn_achievement.png"), _dfcaverns_achievements={"dfcaverns_plant_all_upper_trees", "dfcaverns_plant_all_underground_trees"}, difficulty = 1,},
["df_primordial_items:giant_hypha_apical_meristem"] = {achievement="dfcaverns_plant_giant_mycelium",
title=S("Plant Primordial Mycelium"), icon=make_texture("dfcaverns_mush_soil.png"), secret = true, _dfcaverns_achievements={"dfcaverns_plant_all_primordial", "dfcaverns_plant_all_underground_trees"}, difficulty = 3,},
["df_primordial_items:fern_sapling"] = {achievement="dfcaverns_plant_primordial_fern",
title=S("Plant Primordial Fern"), icon=make_texture("dfcaverns_jungle_fern_03.png"), secret = true, _dfcaverns_achievements={"dfcaverns_plant_all_primordial", "dfcaverns_plant_all_underground_trees"}, difficulty = 3,},
["df_primordial_items:jungle_mushroom_sapling"] = {achievement="dfcaverns_plant_primordial_jungle_mushroom",
title=S("Plant Primordial Jungle Mushroom"), icon=make_texture("dfcaverns_jungle_mushroom_02.png"), secret = true, _dfcaverns_achievements={"dfcaverns_plant_all_primordial", "dfcaverns_plant_all_underground_trees"}, difficulty = 3,},
["df_primordial_items:jungletree_sapling"] = {achievement="dfcaverns_plant_primordial_jungletree",
title=S("Plant Primordial Jungle Tree"), icon=make_texture("dfcaverns_jungle_sapling.png"), secret = true, _dfcaverns_achievements={"dfcaverns_plant_all_primordial", "dfcaverns_plant_all_underground_trees"}, difficulty = 3,},
["df_primordial_items:mush_sapling"] = {achievement="dfcaverns_plant_primordial_mushroom",
title=S("Plant Primordial Mushroom"), icon=make_texture("dfcaverns_mush_sapling.png"), secret = true, _dfcaverns_achievements={"dfcaverns_plant_all_primordial", "dfcaverns_plant_all_underground_trees"}, difficulty = 3,},
["df_farming:cave_wheat_seed"] = {achievement="dfcaverns_plant_cave_wheat",
title=S("Plant Cave Wheat"), icon=make_texture("dfcaverns_cave_wheat_8.png"), _dfcaverns_achievements={"dfcaverns_plant_all_farmables"}, difficulty = 1,},
["df_farming:dimple_cup_seed"] = {achievement="dfcaverns_plant_dimple_cup",
title=S("Plant Dimple Cup"), icon=make_texture("dfcaverns_dimple_cup_4.png"), _dfcaverns_achievements={"dfcaverns_plant_all_farmables"}, difficulty = 1,},
["df_farming:pig_tail_seed"] = {achievement="dfcaverns_plant_pig_tail",
title=S("Plant Pig Tail"), icon=make_texture("dfcaverns_pig_tail_8.png"), _dfcaverns_achievements={"dfcaverns_plant_all_farmables"}, difficulty = 1,},
["df_farming:plump_helmet_spawn"] = {achievement="dfcaverns_plant_plump_helmet",
title=S("Plant Plump Helmet"), icon=make_texture("dfcaverns_plump_helmet_achievement.png"), _dfcaverns_achievements={"dfcaverns_plant_all_farmables"}, difficulty = 1,},
["df_farming:quarry_bush_seed"] = {achievement="dfcaverns_plant_quarry_bush",
title=S("Plant Quarry Bush"), icon=make_texture("dfcaverns_quarry_bush_5.png"), _dfcaverns_achievements={"dfcaverns_plant_all_farmables"}, difficulty = 1,},
["df_farming:sweet_pod_seed"] = {achievement="dfcaverns_plant_sweet_pod",
title=S("Plant Sweet Pod"), icon=make_texture("dfcaverns_sweet_pod_6.png"), _dfcaverns_achievements={"dfcaverns_plant_all_farmables"}, difficulty = 1,},
}
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack, pointed_thing)
if placer == nil then return end
Mineclone compatibility (#36) * latest versions of mapgen_helper and subterrane * initial work * call it "minetest_game" compatibility instead of "default" compatibility * Getting started on moving all default dependencies to a single root mod * distilling out more dependencies * fix some typos * more default dependencies * beds * start getting some MCL equivalents set up * mine gas dependencies * reorganize * add some mapgen stuff * getting close to actually being able to run mineclone with this * it actually runs! Crashes with out-of-memory error when you try to go below -64, but it's a start. * hide flowing pit plasma from creative inventory * mineclone 5 settings * Update subterrane * get rid of meselamp dependency, bring in ancient lanterns from deep roads * stair dependencies * add mcl fences * add mcl blast resistance and hardness to everything. Also an alternate name for Nethercap in MCL, since "nether" has another meaning there. * buckets of oil and syrup should work in mineclone now * 'splosions! * make hunters avoid repaired ancient lanterns * mapgen torchspine wasn't having its timer set * split mapgen compatibility code into its own file * bypass dependency indirection for df_farming. * apply threshold alpha to food items, they look better that way * bypass dependency indirection for df_mapitems * bypass dependency indirection for df_primordial_items * bypass dependency indirection for df_trees * bypass dependency indirection for df_underworld_items * bypass dependency indirection for df_caverns * fixing up the puzzle seal to work in both * fix puzzle seal formspec for mcl * create built-in substitutes for fireflies and bones mods for when those aren't available * set up mcl dungeon loot for underworld warriors, port over some translations from default * overlooked a debug * add itemslot backgrounds for mcl * added mineclone groups to all registered nodes. TODO: craftitems. This was extremely tedious. Completely untested, aside from simply running the game. * minor fixes to the built-in bones node * eatable group for edibles * clean up some TODOs * adjust pit plasma abm conditions * add df_ambience * fixing up explosions. Also make slade sand diggable in mcl, and fix a bug in web generators * make tower cap caves less chirpy, fix bigger goblin hut schematic, allow glowing spindlestem extract bottles * avoid an undeclared global check * alas, cave pearls aren't set up right for attached_node_facedir. * bunch of work on mineclone ores, moved main config into df_dependencies * add a few more ores * update depends in mod.conf * add opaque group to light-sensitive dirt types Mineclone adds the "opaque" group only to non-light nodes, and torches check for the opaque group to decide whether they can be placed there. light-sensitive nodes need the "light" paramtype to work, though. So adding the opaque group manually to these. * add a touch of reverb to one of the whisper tracks, it didn't fit with the others without it * bloodthorn also needs to be set opaque * add sound to torchspines * isolate Nethercap translation name to make it easier to swap out in Mineclone contexts * ambience tweak * fix dirt spreads https://github.com/FaceDeer/dfcaverns/issues/35 * adding achievements! Almost all untested yet. * fix a few achievements glitches * tweak some more achievements, add delay when achievements unlock other achievements * fix farming achievements, fix spindlestem callbacks on place * icons for farming achievements * more achievement icons, fix ancient lantern achievement * two more icons, update text * add icons for upper cavern layers * all achievements have icons now. Also add another sound to the magma sea ambience * hook into awards' trigger system to get "x/y" progress displayed for the multi-achievement achievements * ironically, Mineclone has an old version of awards that is incompatible with my trigger work. * every award should now have a description and a difficulty. * removing leftovers * missing callbacks for farmables * put growth restrictions on farmables so the achievement doesn't trigger inappropriately. * enable ores in MCL2, fix some undeclared globals, fix icecap growth in MCL (achievements are a good debugging tool) * get *all* the copper and iron containing nodes * fix old awards mod's handling of grouped dig items * Add a little bonus for players who activate a slade breacher - a handheld 'splosion tool * used the wrong drop method * beef up explosions in MCL, make slade brick craftable from slade sand and lava * better creative mode checks, fix crash when digging walls in MCL * Update subterrane * various bugfixes and tweaks * whipping up a simple puzzle chest to give a clue about ancient numbering The coding is done, but UI and a node mesh need to be done * prepare for some art tomorrow * chest node and sounds * images for the combination dials * add puzzle chests to the underworld buildings * update translations * oops, can't initialize the contents of puzzle chests every time or players get endless stuff * add backgrounds to item slots in MCL * wrap the existing function rather than copy and pasting it * fix bucket dependency in cooking recipes * add _mcl_saturation to edibles
2022-08-29 07:48:44 +02:00
local player_name = placer:get_player_name()
if player_name == nil then return end
local player_awards = awards.player(player_name)
local achievement = plant_node_achievements[newnode.name]
if not achievement then return end
local achievement_name = achievement.achievement
if not player_awards.unlocked or player_awards.unlocked[achievement_name] ~= achievement_name then
-- all of the growable plants in DFCaverns are timer-based. If you place
-- a seedling or seed and the resulting node has a timer running, then
-- it's passed the checks to see if it was placed in a growable area.
if minetest.get_node_timer(pos):is_started() then
awards.unlock(player_name, achievement_name)
end
end
end)
for seed_item, def in pairs(plant_node_achievements) do
awards.register_achievement(def.achievement, {
title = def.title,
description = S("Plant a @1 in a place where it can grow.", minetest.registered_items[seed_item].description),
icon = def.icon,
secret = def.secret,
_dfcaverns_achievements = def._dfcaverns_achievements,
})
end
awards.register_achievement("dfcaverns_plant_all_upper_trees", {
title = S("Fungal Arborist"),
description = S("Plant one of every kind of 'tree' found in the caverns above the Sunless Sea."),
icon = "dfcaverns_awards_backgroundx32.png^"
.."(dfcaverns_awards_cavern_towercapx32.png^dfcaverns_awards_cavern_fungiwoodx32.png^dfcaverns_awards_cavern_goblincapx32.png)^[transformFX"
.."^[combine:32x32:16,15="..hoe_texture.."^dfcaverns_awards_foregroundx32.png",
difficulty = 1 / df_achievements.get_child_achievement_count("dfcaverns_plant_all_upper_trees"),
trigger = {
type="dfcaverns_achievements",
achievement_name="dfcaverns_plant_all_upper_trees",
target=df_achievements.get_child_achievement_count("dfcaverns_plant_all_upper_trees"),
},
})
awards.register_achievement("dfcaverns_plant_all_primordial", {
title = S("Primordial Arborist"),
description = S("Plant one of every kind of 'tree' from the Primordial caverns."),
icon = "dfcaverns_awards_backgroundx32.png^"
.."(dfcaverns_awards_cavern_primordial_mushx32.png^dfcaverns_awards_cavern_junglex32.png)^[transformFX"
.."^[combine:32x32:16,15="..hoe_texture.."^dfcaverns_awards_foregroundx32.png",
secret = true,
difficulty = 3 / df_achievements.get_child_achievement_count("dfcaverns_plant_all_primordial"),
trigger = {
type="dfcaverns_achievements",
achievement_name="dfcaverns_plant_all_primordial",
target=df_achievements.get_child_achievement_count("dfcaverns_plant_all_primordial"),
},
})
awards.register_achievement("dfcaverns_plant_all_underground_trees", {
title = S("Underground Arborist"),
description = S("Plant one of every kind of 'tree' found in the caverns beneath the surface."),
icon = "dfcaverns_awards_backgroundx32.png^"
.."(dfcaverns_awards_cavern_towercapx32.png^dfcaverns_awards_cavern_fungiwoodx32.png^dfcaverns_awards_cavern_goblincapx32.png)^[transformFX"
.. "^dfcaverns_awards_cavern_primordial_mushx32.png^dfcaverns_awards_cavern_junglex32.png"
.."^[combine:32x32:16,15="..hoe_texture.."^dfcaverns_awards_foregroundx32.png",
difficulty = 4 / df_achievements.get_child_achievement_count("dfcaverns_plant_all_underground_trees"),
trigger = {
type="dfcaverns_achievements",
achievement_name="dfcaverns_plant_all_underground_trees",
target=df_achievements.get_child_achievement_count("dfcaverns_plant_all_underground_trees"),
},
})
awards.register_achievement("dfcaverns_plant_all_farmables", {
title = S("Underground Farmer"),
description = S("Plant one of every kind of small farmable plant found in the caverns beneath the surface."),
icon = "dfcaverns_awards_backgroundx32.png"
.."^[combine:32x32:0,0="..soil_texture
.."^[combine:32x32:0,16="..soil_texture
.."^[combine:32x32:16,0="..soil_texture
.."^[combine:32x32:16,16="..soil_texture
.."^[combine:32x32:0,0=dfcaverns_cave_wheat_8.png"
.."^[combine:32x32:16,0=dfcaverns_dimple_cup_4.png"
.."^[combine:32x32:8,8=dfcaverns_plump_helmet_achievement.png"
.."^[combine:32x32:0,16=dfcaverns_sweet_pod_6.png"
.."^[combine:32x32:16,16=dfcaverns_quarry_bush_5.png"
.."^[combine:32x32:16,15="..hoe_texture.."^dfcaverns_awards_foregroundx32.png",
difficulty = 1 / df_achievements.get_child_achievement_count("dfcaverns_plant_all_farmables"),
trigger = {
type="dfcaverns_achievements",
achievement_name="dfcaverns_plant_all_farmables",
target=df_achievements.get_child_achievement_count("dfcaverns_plant_all_farmables"),
},
})