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], "count")
awards.tbv(awards.players[playern], "deaths", 0)
awards.tbv(awards.players[playern], "chats", 0)
end
-- Load files

View File

@ -15,7 +15,7 @@ awards.register_achievement("award_lightitup",{
type = "place",
node = "default:torch",
target = 100,
},
}
})
-- Lumber Jack
@ -26,7 +26,7 @@ awards.register_achievement("award_lumberjack",{
type = "dig",
node = "default:tree",
target = 100,
},
}
})
-- Found some Mese!
@ -39,7 +39,7 @@ awards.register_achievement("award_mesefind",{
type = "dig",
node = "default:stone_with_mese",
target = 100,
},
}
})
-- Found a Nyan cat!
@ -50,7 +50,7 @@ awards.register_achievement("award_nyanfind",{
type = "dig",
node = "default:nyancat",
target = 1,
},
}
})
-- Just entered the mine
@ -63,7 +63,7 @@ awards.register_achievement("award_mine1",{
type = "dig",
node = "default:stone",
target = 10,
},
}
})
-- Mini Miner
@ -76,7 +76,7 @@ awards.register_achievement("award_mine2",{
type = "dig",
node = "default:stone",
target = 100,
},
}
})
-- Hardened Miner
@ -89,7 +89,7 @@ awards.register_achievement("award_mine3",{
type = "dig",
node = "default:stone",
target = 1000,
},
}
})
-- Master Miner
@ -102,7 +102,7 @@ awards.register_achievement("award_mine4",{
type = "dig",
node = "default:stone",
target = 10000,
},
}
})
-- First Death
@ -112,7 +112,7 @@ awards.register_achievement("award_death1",{
trigger = {
type = "death",
target = 1,
},
}
})
-- Burned to death
@ -121,6 +121,16 @@ awards.register_achievement("award_burn",{
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)
local pos = player:getpos()
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)
-- 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
end
-- Get player
local name = player:get_player_name()
awards.assertPlayer(playern)
awards.assertPlayer(name)
local data = awards.players[name]
-- Increment counter
@ -156,7 +156,8 @@ end)
minetest.register_on_chat_message(function(name, message)
-- Run checks
if not name then
local idx = string.find(message,"/")
if not name or (idx ~= nil and idx <= 1) then
return
end