diff --git a/minigame_manager/globalstep.lua b/minigame_manager/globalstep.lua index 0c8aa0e..7a1b0ef 100644 --- a/minigame_manager/globalstep.lua +++ b/minigame_manager/globalstep.lua @@ -238,6 +238,12 @@ minetest.register_globalstep(function(dtime) end + if minetest.get_modpath("aes_xp") then + --register some achievements + aes_xp.add_achievement("Cannibal Worm", 5, 0, 0, "Eat your own color. Yuck!", "magiccompass_wormball.png") + aes_xp.achieve(pl_name,"Cannibal Worm") + end + --move the player's attached entity local att = player:get_attach() if att then @@ -274,7 +280,7 @@ minetest.register_globalstep(function(dtime) --draw the head and the first body segment wormball.place_node(arena.players[pl_name].nodes,arena.players[pl_name].direction,old_dir,look_dir,color) - + -- add 1 to the player's score arena.players[pl_name].score = arena.players[pl_name].score + 1 @@ -283,6 +289,14 @@ minetest.register_globalstep(function(dtime) -- send HUD message arena_lib.HUD_send_msg('broadcast', pl_name, 'Yay! You are now '..arena.players[pl_name].score..' long.', 2, 'wormball_powerup',0x00FF11) + + if minetest.get_modpath("aes_xp") then + --register some achievements + if math.fmod(arena.players[pl_name].score,50) == 0 then + aes_xp.add_achievement("Longer and Longer "..arena.players[pl_name].score, 50, 0, 0, "Get "..arena.players[pl_name].score .. " points \nfor the first time.", "magiccompass_wormball.png") + aes_xp.achieve(pl_name,"Longer and Longer "..arena.players[pl_name].score) + end + end --move the player's attached entity local att = player:get_attach() @@ -372,6 +386,13 @@ minetest.register_globalstep(function(dtime) arena_lib.load_celebration('wormball', arena, pl_name) else arena_lib.remove_player_from_arena(pl_name, 1) + + if minetest.get_modpath("aes_xp") then + --register some achievements + aes_xp.add_achievement("Global Worming", 50, 0, 0, "Play a game of Multiplayer \nWormball for the first time", "magiccompass_wormball.png") + aes_xp.achieve(pl_name,"Global Worming") + end + end end,pl_name, arena) diff --git a/minigame_manager/on_celebration.lua b/minigame_manager/on_celebration.lua index 33d3b92..10709a7 100644 --- a/minigame_manager/on_celebration.lua +++ b/minigame_manager/on_celebration.lua @@ -96,22 +96,47 @@ arena_lib.on_celebration('wormball', function(arena, winner_name) if new_highscore then arena_lib.HUD_send_msg_all("title", arena, 'New High Score!', 2 ,'sumo_win',0xAEAE00) - minetest.after(5,function() + minetest.after(2,function() if minetest.get_modpath("aes_xp") then --register some achievements - aes_xp.add_achievement("Wormball Master", 50, 40, 0, "Beat the Highscore", "wormball_win.png") + aes_xp.add_achievement("Wormball Master", 150, 100, 0, "Beat the Highscore", "wormball_win.png") aes_xp.achieve(winner_name,"Wormball Master") end end) else arena_lib.HUD_send_msg_all("title", arena, 'Game Over!', 2 ,'sumo_win',0xAEAE00) - minetest.after(5,function() + minetest.after(3,function() if minetest.get_modpath("aes_xp") then --register some achievements - aes_xp.add_achievement("Worming Along", 10, 3, 0, "Play a round of \nsingleplayer wormball", "magiccompass_wormball.png") + aes_xp.add_achievement("Worming Along", 10, 0, 0, "Play a round of \nsingleplayer wormball", "magiccompass_wormball.png") aes_xp.achieve(winner_name,"Worming Along") end end) + if score > 50 then + minetest.after(4,function() + if minetest.get_modpath("aes_xp") then + --register some achievements + aes_xp.add_achievement("Mega Worm", 50, 40, 0, "Eat more than 50 \npowerpoints in singleplayer\nwormball", "magiccompass_wormball.png") + aes_xp.achieve(winner_name,"Mega Worm") + end + end) + elseif score > 20 then + minetest.after(4,function() + if minetest.get_modpath("aes_xp") then + --register some achievements + aes_xp.add_achievement("Small Worm", 15, 10, 0, "Eat more than 20 \npowerpoints in singleplayer\nwormball", "magiccompass_wormball.png") + aes_xp.achieve(winner_name,"Small Worm") + end + end) + elseif score > 5 then + minetest.after(4,function() + if minetest.get_modpath("aes_xp") then + --register some achievements + aes_xp.add_achievement("Baby Wiggler", 5, 5, 0, "Eat more than 5 \npowerpoints in singleplayer\nwormball", "magiccompass_wormball.png") + aes_xp.achieve(winner_name,"Baby Wiggler") + end + end) + end end minetest.after( 3 , function( arena , score , leaderboard ) @@ -140,21 +165,42 @@ arena_lib.on_celebration('wormball', function(arena, winner_name) local scores = arena.multi_scores - - - if minetest.get_modpath( 'panel_lib' ) then - - minetest.after( 2 , function( arena , scores ) - - for pl_name , stats in pairs(arena.players_and_spectators) do - wormball.show_multi_scores( arena , pl_name , scores ) - end - - -- show the scoreboard here - - end , arena , scores ) - + -- add some multiplayer achievements + local len = 0 + for j,k in pairs(scores) do + len = len + 1 end + if len == 2 then + if minetest.get_modpath("aes_xp") then + --register some achievements + aes_xp.add_achievement("Worm vs Worm", 10, 5, 0, "Win a 2 player Wormball match", "wormball_win.png") + aes_xp.achieve(winner_name,"Worm vs Worm") + end + elseif len < 4 then + if minetest.get_modpath("aes_xp") then + --register some achievements + aes_xp.add_achievement("Sir LongWorm", 30, 20, 0, "Win a small Wormball match", "wormball_win.png") + aes_xp.achieve(winner_name,"Sir LongWorm") + end + else + if minetest.get_modpath("aes_xp") then + --register some achievements + aes_xp.add_achievement("King of the Worms", 70, 40, 0, "Win a large Wormball match", "wormball_win.png") + aes_xp.achieve(winner_name,"King of the Worms") + end + end + + + minetest.after( 2 , function( arena , scores ) + + for pl_name , stats in pairs(arena.players_and_spectators) do + wormball.show_multi_scores( arena , pl_name , scores ) + end + + -- show the scoreboard here + + end , arena , scores ) + end end