first word award and bug fixes

This commit is contained in:
rubenwardy 2014-05-02 19:11:21 +01:00
parent 8adf859127
commit 8bd3658d9e
3 changed files with 27 additions and 15 deletions

View File

@ -64,6 +64,7 @@ function awards.assertPlayer(playern)
awards.tbv(awards.players[playern], "place") awards.tbv(awards.players[playern], "place")
awards.tbv(awards.players[playern], "count") awards.tbv(awards.players[playern], "count")
awards.tbv(awards.players[playern], "deaths", 0) awards.tbv(awards.players[playern], "deaths", 0)
awards.tbv(awards.players[playern], "chats", 0)
end end
-- Load files -- Load files
@ -148,7 +149,7 @@ end
-- award - the name of the award to give -- award - the name of the award to give
function awards.give_achievement(name,award) function awards.give_achievement(name,award)
-- Access Player Data -- Access Player Data
local data=awards.players[name] local data = awards.players[name]
-- Perform checks -- Perform checks
if not data then if not data then

View File

@ -15,7 +15,7 @@ awards.register_achievement("award_lightitup",{
type = "place", type = "place",
node = "default:torch", node = "default:torch",
target = 100, target = 100,
}, }
}) })
-- Lumber Jack -- Lumber Jack
@ -26,7 +26,7 @@ awards.register_achievement("award_lumberjack",{
type = "dig", type = "dig",
node = "default:tree", node = "default:tree",
target = 100, target = 100,
}, }
}) })
-- Found some Mese! -- Found some Mese!
@ -39,7 +39,7 @@ awards.register_achievement("award_mesefind",{
type = "dig", type = "dig",
node = "default:stone_with_mese", node = "default:stone_with_mese",
target = 100, target = 100,
}, }
}) })
-- Found a Nyan cat! -- Found a Nyan cat!
@ -50,7 +50,7 @@ awards.register_achievement("award_nyanfind",{
type = "dig", type = "dig",
node = "default:nyancat", node = "default:nyancat",
target = 1, target = 1,
}, }
}) })
-- Just entered the mine -- Just entered the mine
@ -63,7 +63,7 @@ awards.register_achievement("award_mine1",{
type = "dig", type = "dig",
node = "default:stone", node = "default:stone",
target = 10, target = 10,
}, }
}) })
-- Mini Miner -- Mini Miner
@ -76,7 +76,7 @@ awards.register_achievement("award_mine2",{
type = "dig", type = "dig",
node = "default:stone", node = "default:stone",
target = 100, target = 100,
}, }
}) })
-- Hardened Miner -- Hardened Miner
@ -89,7 +89,7 @@ awards.register_achievement("award_mine3",{
type = "dig", type = "dig",
node = "default:stone", node = "default:stone",
target = 1000, target = 1000,
}, }
}) })
-- Master Miner -- Master Miner
@ -102,7 +102,7 @@ awards.register_achievement("award_mine4",{
type = "dig", type = "dig",
node = "default:stone", node = "default:stone",
target = 10000, target = 10000,
}, }
}) })
-- First Death -- First Death
@ -112,7 +112,7 @@ awards.register_achievement("award_death1",{
trigger = { trigger = {
type = "death", type = "death",
target = 1, target = 1,
}, }
}) })
-- Burned to death -- Burned to death
@ -121,6 +121,16 @@ awards.register_achievement("award_burn",{
description = "Burn to death in a fire", description = "Burn to death in a fire",
}) })
-- 1 sentence
awards.register_achievement("award_chat1",{
title = "First Word",
description = "Use the chat to talk to players",
trigger = {
type = "chat",
target = 1,
},
})
awards.register_onDeath(function(player,data) awards.register_onDeath(function(player,data)
local pos = player:getpos() local pos = player:getpos()
if pos and minetest.find_node_near(pos, 1, "fire:basic_flame") ~= nil then if pos and minetest.find_node_near(pos, 1, "fire:basic_flame") ~= nil then

View File

@ -124,13 +124,13 @@ end)
minetest.register_on_dieplayer(function(player) minetest.register_on_dieplayer(function(player)
-- Run checks -- Run checks
if not player or not player:get_player_name() or player:get_player_name()=="" then local name = player:get_player_name()
if not player or not name or name=="" then
return return
end end
-- Get player -- Get player
local name = player:get_player_name() awards.assertPlayer(name)
awards.assertPlayer(playern)
local data = awards.players[name] local data = awards.players[name]
-- Increment counter -- Increment counter
@ -156,7 +156,8 @@ end)
minetest.register_on_chat_message(function(name, message) minetest.register_on_chat_message(function(name, message)
-- Run checks -- Run checks
if not name then local idx = string.find(message,"/")
if not name or (idx ~= nil and idx <= 1) then
return return
end end