add achievements to almost everything and fixed some bugs and features
This commit is contained in:
parent
f167fd2851
commit
c8e0dbfe68
@ -38,6 +38,8 @@ drop_items_on_die = true
|
||||
|
||||
# mob stuff
|
||||
mobs_enable_blood = false
|
||||
# if mobs don't attack within 256 nodes of the staic_spawn_point; disabled in singleplayer
|
||||
mobs_safe_spawn = true
|
||||
|
||||
# if beds can be slept in
|
||||
bed_enabled = true
|
||||
|
@ -138,8 +138,8 @@ minetest.register_on_dignode(on_dig)
|
||||
minetest.register_on_placenode(on_place)
|
||||
|
||||
local form = default.ui.get_page("core")
|
||||
form = form .. "tableoptions[background=#88888840]"
|
||||
form = form .. "tablecolumns[text,align=left;text,align=left]"
|
||||
form = form .. "tableoptions[background=#DDDDDD30]"
|
||||
form = form .. "tablecolumns[text,align=left,width=11;text,align=left,width=28;text,align=left,width=5]"
|
||||
default.ui.register_page("core_achievements", form)
|
||||
|
||||
function achievements.get_formspec(name, row)
|
||||
@ -147,45 +147,56 @@ function achievements.get_formspec(name, row)
|
||||
|
||||
local achievement_list = ""
|
||||
|
||||
local amt_gotten = 0
|
||||
local amt_progress = 0
|
||||
|
||||
for _, aname in ipairs(achievements.registered_achievements_list) do
|
||||
local def = achievements.registered_achievements[aname]
|
||||
|
||||
local amt = ""
|
||||
local progress = ""
|
||||
if achievements.achievements[name][aname] then
|
||||
if achievements.achievements[name][aname] == -1 then
|
||||
amt = " (Gotten)"
|
||||
progress = "Gotten"
|
||||
amt_gotten = amt_gotten + 1
|
||||
else
|
||||
amt = " (" .. achievements.achievements[name][aname] .. "/" .. def.times .. ")"
|
||||
progress = achievements.achievements[name][aname] .. "/" .. def.times
|
||||
amt_progress = amt_progress + 1
|
||||
end
|
||||
else
|
||||
progress = "Missing"
|
||||
end
|
||||
|
||||
if achievement_list == "" then
|
||||
achievement_list = achievement_list .. minetest.formspec_escape(def.title .. amt) .. "," .. minetest.formspec_escape(def.description)
|
||||
else
|
||||
achievement_list = achievement_list .. "," .. minetest.formspec_escape(def.title .. amt) .. "," .. minetest.formspec_escape(def.description)
|
||||
if achievement_list ~= "" then
|
||||
achievement_list = achievement_list .. ","
|
||||
end
|
||||
|
||||
achievement_list = achievement_list .. minetest.formspec_escape(def.title) .. ","
|
||||
achievement_list = achievement_list .. minetest.formspec_escape(def.description) .. ","
|
||||
achievement_list = achievement_list .. progress
|
||||
end
|
||||
|
||||
local form = default.ui.get_page("core_achievements")
|
||||
|
||||
form = form .. "table[0.25,3;7.75,5.5;achievement_list;" .. achievement_list .. ";" .. row .. "]"
|
||||
form = form .. "table[0.25,2.5;7.75,5.5;achievement_list;" .. achievement_list .. ";" .. row .. "]"
|
||||
|
||||
local aname = achievements.registered_achievements_list[row]
|
||||
local def = achievements.registered_achievements[aname]
|
||||
|
||||
local amt = ""
|
||||
local progress = ""
|
||||
if achievements.achievements[name][aname] then
|
||||
if achievements.achievements[name][aname] == -1 then
|
||||
amt = "Gotten"
|
||||
progress = "Gotten"
|
||||
else
|
||||
amt = achievements.achievements[name][aname] .. "/" .. def.times
|
||||
progress = achievements.achievements[name][aname] .. "/" .. def.times
|
||||
end
|
||||
else
|
||||
amt = "Missing"
|
||||
progress = "Missing"
|
||||
end
|
||||
|
||||
form = form .. "label[0.25,8.15;" .. minetest.formspec_escape(amt_gotten .. " of " .. #achievements.registered_achievements_list .. " achievements gotten, " .. amt_progress .. " in progress") .. "]"
|
||||
|
||||
form = form .. "label[0.25,0.25;" .. minetest.formspec_escape(def.title) .. "]"
|
||||
form = form .. "label[7.25,0.25;" .. minetest.formspec_escape(amt) .. "]"
|
||||
form = form .. "label[7.25,0.25;" .. minetest.formspec_escape(progress) .. "]"
|
||||
|
||||
form = form .. "label[0.5,0.75;" .. minetest.formspec_escape(def.description) .. "]"
|
||||
|
||||
@ -215,7 +226,12 @@ end
|
||||
minetest.register_on_player_receive_fields(receive_fields)
|
||||
|
||||
|
||||
-- below is the default achievements
|
||||
--
|
||||
-- Below is the default achievements
|
||||
--
|
||||
|
||||
-- Joining
|
||||
|
||||
achievements.register_achievement(
|
||||
"firstjoin",
|
||||
{
|
||||
@ -232,6 +248,8 @@ achievements.register_achievement(
|
||||
times = 100,
|
||||
})
|
||||
|
||||
-- Dying
|
||||
|
||||
achievements.register_achievement(
|
||||
"killathon",
|
||||
{
|
||||
@ -240,31 +258,122 @@ achievements.register_achievement(
|
||||
times = 10,
|
||||
})
|
||||
|
||||
-- Crafting a broadsword
|
||||
|
||||
achievements.register_achievement(
|
||||
"off_to_battle",
|
||||
{
|
||||
title = "Off to Battle",
|
||||
description = "Craft a Broadsword",
|
||||
times = 1,
|
||||
craftitem = "default:broadsword",
|
||||
})
|
||||
|
||||
-- Placing planks
|
||||
|
||||
achievements.register_achievement(
|
||||
"plunks",
|
||||
{
|
||||
title = "Plunks",
|
||||
description = "Place 10 planks",
|
||||
times = 10,
|
||||
placenode = "group:planks",
|
||||
})
|
||||
|
||||
achievements.register_achievement(
|
||||
"carpenter",
|
||||
{
|
||||
title = "Carpenter",
|
||||
description = "Place 100 planks",
|
||||
times = 100,
|
||||
placenode = "group:planks",
|
||||
})
|
||||
|
||||
achievements.register_achievement(
|
||||
"master_carpenter",
|
||||
{
|
||||
title = "Master Carpenter",
|
||||
description = "Place 500 planks",
|
||||
times = 500,
|
||||
placenode = "group:planks",
|
||||
})
|
||||
|
||||
-- Digging stone
|
||||
|
||||
achievements.register_achievement(
|
||||
"mineority",
|
||||
{
|
||||
title = "Mineority",
|
||||
description = "Mine 20 stone",
|
||||
times = 20,
|
||||
dignode = "group:stone",
|
||||
})
|
||||
|
||||
achievements.register_achievement(
|
||||
"rockin'",
|
||||
{
|
||||
title = "Rockin'",
|
||||
description = "Mine 200 stone",
|
||||
times = 200,
|
||||
dignode = "group:stone",
|
||||
})
|
||||
|
||||
achievements.register_achievement(
|
||||
"rocksolid",
|
||||
{
|
||||
title = "Rock Solid",
|
||||
description = "Mine 1000 stone",
|
||||
times = 1000,
|
||||
dignode = "group:stone",
|
||||
})
|
||||
|
||||
-- Digging wood
|
||||
|
||||
achievements.register_achievement(
|
||||
"timber",
|
||||
{
|
||||
title = "Timber!",
|
||||
title = "Timber",
|
||||
description = "Dig 10 tree trunks.",
|
||||
times = 10,
|
||||
dignode = "group:tree",
|
||||
})
|
||||
|
||||
achievements.register_achievement(
|
||||
"timberer",
|
||||
{
|
||||
title = "Timberer",
|
||||
description = "Dig 100 tree trunks.",
|
||||
times = 100,
|
||||
dignode = "group:tree",
|
||||
})
|
||||
|
||||
achievements.register_achievement(
|
||||
"timbererest",
|
||||
{
|
||||
title = "Timbererest",
|
||||
description = "Dig 500 tree trunks.",
|
||||
times = 500,
|
||||
dignode = "group:tree",
|
||||
})
|
||||
|
||||
-- Planting flowers
|
||||
|
||||
achievements.register_achievement(
|
||||
"gardener",
|
||||
{
|
||||
title = "Gardener",
|
||||
description = "Place 10 flowers.",
|
||||
description = "Plant 10 flowers.",
|
||||
times = 10,
|
||||
placenode = "default:flower",
|
||||
})
|
||||
|
||||
achievements.register_achievement(
|
||||
"your_pick",
|
||||
"master_gardener",
|
||||
{
|
||||
title = "Your pick",
|
||||
description = "Craft yourself a new wooden pickaxe.",
|
||||
times = 1,
|
||||
craftitem = "default:pick_wood",
|
||||
title = "Master Gardener",
|
||||
description = "Plant 100 flowers.",
|
||||
times = 100,
|
||||
placenode = "default:flower",
|
||||
})
|
||||
|
||||
local function on_dieplayer(player)
|
||||
|
2
mods/armor/depends.txt
Normal file
2
mods/armor/depends.txt
Normal file
@ -0,0 +1,2 @@
|
||||
default
|
||||
achievements
|
@ -291,3 +291,25 @@ form_armor = form_armor .. "listring[current_player;armor_helmet]"
|
||||
form_armor = form_armor .. default.ui.get_itemslot_bg(2.25, 0.75, 1, 1)
|
||||
|
||||
default.ui.register_page("core_armor", form_armor)
|
||||
|
||||
-- Achievements
|
||||
|
||||
achievements.register_achievement(
|
||||
"armored",
|
||||
{
|
||||
title = "Armored",
|
||||
description = "Craft a piece of armor",
|
||||
times = 1,
|
||||
craftitem = "group:is_armor",
|
||||
})
|
||||
|
||||
achievements.register_achievement(
|
||||
"warrior",
|
||||
{
|
||||
title = "Warrior",
|
||||
description = "Craft 10 piece of armor",
|
||||
times = 10,
|
||||
craftitem = "group:is_armor",
|
||||
})
|
||||
|
||||
default.log("mod:armor", "loaded")
|
@ -1,3 +1,4 @@
|
||||
default
|
||||
player_effects
|
||||
achievements
|
||||
farming?
|
||||
|
@ -201,4 +201,15 @@ minetest.register_on_leaveplayer(
|
||||
players_in_bed[player:get_player_name()] = nil
|
||||
end)
|
||||
|
||||
-- Achievements
|
||||
|
||||
achievements.register_achievement(
|
||||
"bedtime",
|
||||
{
|
||||
title = "Bed Time",
|
||||
description = "Craft a bed",
|
||||
times = 1,
|
||||
craftitem = "bed:bed",
|
||||
})
|
||||
|
||||
default.log("mod:bed", "loaded")
|
||||
|
@ -1 +1,2 @@
|
||||
default
|
||||
achievements
|
||||
|
@ -45,3 +45,16 @@ minetest.register_on_player_receive_fields(
|
||||
itemstack:set_metadata(minetest.serialize(data))
|
||||
player:set_wielded_item(itemstack)
|
||||
end)
|
||||
|
||||
-- Achievements
|
||||
|
||||
achievements.register_achievement(
|
||||
"scribe",
|
||||
{
|
||||
title = "Scribe",
|
||||
description = "Craft a book",
|
||||
times = 1,
|
||||
placenode = "default:book",
|
||||
})
|
||||
|
||||
default.log("mod:book", "loaded")
|
@ -1 +1,2 @@
|
||||
default
|
||||
achievements
|
||||
|
@ -314,4 +314,15 @@ minetest.register_craft(
|
||||
}
|
||||
})
|
||||
|
||||
-- Achievements
|
||||
|
||||
achievements.register_achievement(
|
||||
"adoorable",
|
||||
{
|
||||
title = "Adoorable",
|
||||
description = "Craft a door",
|
||||
times = 1,
|
||||
craftitem = "group:door",
|
||||
})
|
||||
|
||||
default.log("mod:door", "loaded")
|
@ -1,2 +1,3 @@
|
||||
default
|
||||
weather
|
||||
achievements
|
||||
|
@ -20,4 +20,42 @@ farming.register_plant(
|
||||
light_max = 15,
|
||||
})
|
||||
|
||||
-- Achievements
|
||||
|
||||
achievements.register_achievement(
|
||||
"farmer",
|
||||
{
|
||||
title = "Farmer",
|
||||
description = "Plant 20 wheat seeds",
|
||||
times = 20,
|
||||
placenode = "farming:wheat_1",
|
||||
})
|
||||
|
||||
achievements.register_achievement(
|
||||
"master_farmer",
|
||||
{
|
||||
title = "Master Farmer",
|
||||
description = "Plant 200 wheat seeds",
|
||||
times = 200,
|
||||
placenode = "farming:wheat_1",
|
||||
})
|
||||
|
||||
achievements.register_achievement(
|
||||
"cotton_farmer",
|
||||
{
|
||||
title = "Cotton Farmer",
|
||||
description = "Plant 10 cotton seeds",
|
||||
times = 10,
|
||||
placenode = "farming:cotton_1",
|
||||
})
|
||||
|
||||
achievements.register_achievement(
|
||||
"master_cotton_farmer",
|
||||
{
|
||||
title = "Master Cotton Farmer",
|
||||
description = "Plant 100 cotton seeds",
|
||||
times = 100,
|
||||
placenode = "farming:cotton_1",
|
||||
})
|
||||
|
||||
default.log("plants", "loaded")
|
@ -1 +1,2 @@
|
||||
default
|
||||
achievements
|
||||
|
@ -167,6 +167,9 @@ minetest.register_node(
|
||||
inv:set_stack("main", 1, ItemStack(jewels.get_jeweled(itemname)))
|
||||
|
||||
itemstack:take_item()
|
||||
|
||||
achievements.trigger_achievement(player, "jeweler")
|
||||
achievements.trigger_achievement(player, "master_jeweler")
|
||||
end
|
||||
end
|
||||
|
||||
@ -223,4 +226,22 @@ minetest.register_ore(
|
||||
|
||||
dofile(minetest.get_modpath("jewels").."/jewels.lua")
|
||||
|
||||
-- Achievements
|
||||
|
||||
achievements.register_achievement(
|
||||
"jeweler",
|
||||
{
|
||||
title = "Jeweler",
|
||||
description = "Jewel a tool",
|
||||
times = 1,
|
||||
})
|
||||
|
||||
achievements.register_achievement(
|
||||
"master_jeweler",
|
||||
{
|
||||
title = "Master Jeweler",
|
||||
description = "Jewel 10 tools",
|
||||
times = 10,
|
||||
})
|
||||
|
||||
default.log("mod:jewels", "loaded")
|
||||
|
@ -1 +1,2 @@
|
||||
default
|
||||
achievements
|
||||
|
@ -197,4 +197,24 @@ minetest.register_craft(
|
||||
recipe = {"default:chest", "locks:lock"},
|
||||
})
|
||||
|
||||
-- Achievements
|
||||
|
||||
achievements.register_achievement(
|
||||
"locksmith",
|
||||
{
|
||||
title = "Locksmith",
|
||||
description = "Craft a lock",
|
||||
times = 1,
|
||||
craftitem = "locks:lock",
|
||||
})
|
||||
|
||||
achievements.register_achievement(
|
||||
"burglar",
|
||||
{
|
||||
title = "Burglar",
|
||||
description = "Craft a lock pick",
|
||||
times = 1,
|
||||
craftitem = "locks:pick",
|
||||
})
|
||||
|
||||
default.log("mod:locks", "loaded")
|
@ -10,8 +10,12 @@ mobs.protected = tonumber(minetest.setting_get("mobs_spawn_protected")) or 0
|
||||
mobs.remove = minetest.setting_getbool("remove_far_mobs") or false
|
||||
|
||||
local function is_too_near_spawn(pos)
|
||||
local sp = minetest.settting_getbool("static_spawn_point") or {x = 0, y = 0, z = 0}
|
||||
local rad = minetest.settting_getbool("static_spawn_radius") or 256
|
||||
if minetest.is_singleplayer() or (not minetest.setting_getbool("mobs_safe_spawn")) then
|
||||
return false
|
||||
end
|
||||
|
||||
local sp = minetest.setting_getbool("static_spawn_point") or {x = 0, y = 0, z = 0}
|
||||
local rad = minetest.setting_getbool("static_spawn_radius") or 256
|
||||
|
||||
return (vector.distance(pos, sp) < rad)
|
||||
end
|
||||
|
@ -140,3 +140,14 @@ function step(dtime)
|
||||
end
|
||||
|
||||
minetest.register_globalstep(step)
|
||||
|
||||
-- Achievements
|
||||
|
||||
achievements.register_achievement(
|
||||
"true_navigator",
|
||||
{
|
||||
title = "True Navigator",
|
||||
description = "Craft a compass",
|
||||
times = 1,
|
||||
craftitem = "nav:compass_3",
|
||||
})
|
@ -1,2 +1,3 @@
|
||||
default
|
||||
util
|
||||
achievements
|
||||
|
@ -158,3 +158,14 @@ minetest.register_on_joinplayer(on_joinplayer)
|
||||
minetest.register_on_leaveplayer(on_leaveplayer)
|
||||
minetest.register_globalstep(step)
|
||||
minetest.register_on_player_receive_fields(recieve_fields)
|
||||
|
||||
-- Achievements
|
||||
|
||||
achievements.register_achievement(
|
||||
"navigator",
|
||||
{
|
||||
title = "Navigator",
|
||||
description = "Craft a map",
|
||||
times = 1,
|
||||
craftitem = "nav:map",
|
||||
})
|
@ -118,7 +118,6 @@ function player_effects.remove_effect(player, ename)
|
||||
end
|
||||
|
||||
function player_effects.refresh_effects(player)
|
||||
local function check(ename)
|
||||
local phys = {speed = 1, jump = 1, gravity = 1}
|
||||
|
||||
for en, _ in pairs(player_effects.effects[player:get_player_name()]) do
|
||||
@ -140,11 +139,6 @@ function player_effects.refresh_effects(player)
|
||||
end
|
||||
|
||||
player:set_physics_override(phys)
|
||||
end
|
||||
|
||||
for ename, endtime in pairs(player_effects.effects[player:get_player_name()]) do
|
||||
check(ename)
|
||||
end
|
||||
|
||||
save_effects()
|
||||
end
|
||||
|
@ -1,2 +1,2 @@
|
||||
default
|
||||
|
||||
achievements
|
||||
|
@ -268,4 +268,15 @@ minetest.register_craft(
|
||||
burntime = 13,
|
||||
})
|
||||
|
||||
-- Achievements
|
||||
|
||||
achievements.register_achievement(
|
||||
"boom",
|
||||
{
|
||||
title = "Boom!",
|
||||
description = "Craft TNT",
|
||||
times = 1,
|
||||
craftitem = "tnt:tnt",
|
||||
})
|
||||
|
||||
default.log("mod:tnt", "loaded")
|
Loading…
Reference in New Issue
Block a user