summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubenwardy <anjayward@gmail.com>2014-05-02 19:11:21 +0100
committerrubenwardy <anjayward@gmail.com>2014-05-02 19:11:21 +0100
commit8bd3658d9ee363c55225c63f867a8ebf70c44b6e (patch)
treee540f84f5eca80259ab56f026f937800f8e96bf7
parent8adf859127a3cf3218811c3e6d9ff4b6a3aff1a8 (diff)
first word award and bug fixes
-rw-r--r--api.lua3
-rw-r--r--init.lua28
-rw-r--r--triggers.lua11
3 files changed, 27 insertions, 15 deletions
diff --git a/api.lua b/api.lua
index b0bf068..71ddd2f 100644
--- a/api.lua
+++ b/api.lua
@@ -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
@@ -148,7 +149,7 @@ end
-- award - the name of the award to give
function awards.give_achievement(name,award)
-- Access Player Data
- local data=awards.players[name]
+ local data = awards.players[name]
-- Perform checks
if not data then
diff --git a/init.lua b/init.lua
index e91347d..b87c884 100644
--- a/init.lua
+++ b/init.lua
@@ -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
diff --git a/triggers.lua b/triggers.lua
index cdff4ae..b6005be 100644
--- a/triggers.lua
+++ b/triggers.lua
@@ -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)
+ -- Get player
+ 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