summaryrefslogtreecommitdiff
path: root/pacmine
diff options
context:
space:
mode:
Diffstat (limited to 'pacmine')
-rwxr-xr-xpacmine/depends.txt1
-rwxr-xr-xpacmine/gamestate.lua14
2 files changed, 15 insertions, 0 deletions
diff --git a/pacmine/depends.txt b/pacmine/depends.txt
new file mode 100755
index 0000000..01e0fb0
--- /dev/null
+++ b/pacmine/depends.txt
@@ -0,0 +1 @@
+myhighscore
diff --git a/pacmine/gamestate.lua b/pacmine/gamestate.lua
index 718bf02..7bbc0af 100755
--- a/pacmine/gamestate.lua
+++ b/pacmine/gamestate.lua
@@ -64,6 +64,14 @@ function pacmine.game_end(id)
pacmine.remove_hud(player, gamestate.player_name)
player:moveto(vector.add(gamestate.pos,{x=0.5,y=0.5,z=-1.5}))
end
+ -- Save score
+ local ranking = myhighscore.save_score("pacmine", {
+ player = gamestate.player_name,
+ score = gamestate.score
+ })
+ if ranking then
+ minetest.chat_send_player(gamestate.player_name, "You made it to the highscores! Your Ranking: " .. ranking)
+ end
-- Clear the data
pacmine.games[id] = nil
pacmine.players[id] = nil
@@ -314,3 +322,9 @@ minetest.register_chatcommand("pacmine_exit", {
end
end
})
+
+-- Register with the myhighscore mod
+myhighscore.register_game("pacmine", {
+ description = "Pacmine",
+ icon = "pacmine_1.png",
+})