diff options
Diffstat (limited to 'pacmine/gamestate.lua')
-rwxr-xr-x | pacmine/gamestate.lua | 14 |
1 files changed, 14 insertions, 0 deletions
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", +}) |