2021-02-03 15:10:50 -05:00
--thx AliasAlreadyTaken for this version cmd
minetest.register_chatcommand ( " wormball_version " , {
description = " Shows wormball version " ,
privs = {
interact = true ,
} ,
func = function ( name , param )
return true , " Wormball Version: " .. wormball.version
end
} )
2021-01-19 21:46:28 -05:00
ChatCmdBuilder.new ( " wormball " , function ( cmd )
-- create arena
cmd : sub ( " create :arena " , function ( name , arena_name )
arena_lib.create_arena ( name , " wormball " , arena_name )
end )
cmd : sub ( " create :arena :minplayers:int :maxplayers:int " , function ( name , arena_name , min_players , max_players )
arena_lib.create_arena ( name , " wormball " , arena_name , min_players , max_players )
end )
-- remove arena
cmd : sub ( " remove :arena " , function ( name , arena_name )
arena_lib.remove_arena ( name , " wormball " , arena_name )
end )
-- list of the arenas
cmd : sub ( " list " , function ( name )
arena_lib.print_arenas ( name , " wormball " )
end )
-- enter editor mode
cmd : sub ( " edit :arena " , function ( sender , arena )
arena_lib.enter_editor ( sender , " wormball " , arena )
end )
-- enable and disable arenas
cmd : sub ( " enable :arena " , function ( name , arena )
arena_lib.enable_arena ( name , " wormball " , arena )
end )
cmd : sub ( " disable :arena " , function ( name , arena )
arena_lib.disable_arena ( name , " wormball " , arena )
end )
2021-12-30 22:17:55 -05:00
--clear highscores
cmd : sub ( " clrleaderboard :arena " , function ( name , arena )
local success , msg = wormball.leaderboard . clear_highscores ( arena )
if success == true then
return " [!] Wormball arena " .. arena .. " Highscores Cleared! "
else
return " [!] Highscore Clear Attempt Failed! Error: " .. msg
end
end )
2021-12-31 01:09:22 -05:00
cmd : sub ( " leaderboard :arena :p_name:username " , function ( name , arena , p_name )
2021-12-31 00:30:17 -05:00
if not wormball.show_singleplayer_leaderboard ( arena , p_name ) then
return " Invalid usage: please specify a valid wormball arena name to view its leaderboard. "
end
end )
2021-01-19 21:46:28 -05:00
end , {
description = [ [
( / help wormball )
Use this to configure your arena :
- create < arena name > [ min players ] [ max players ]
- edit < arena name >
- enable < arena name >
2021-02-01 13:16:19 -05:00
- list -- show created arenas
2021-12-30 22:17:55 -05:00
- clrleaderboard < arena_name >
2021-01-19 21:46:28 -05:00
Other commands :
- remove < arena name >
- disable < arena >
] ] ,
privs = { wormball_admin = true }
} )
2021-03-11 04:58:55 -05:00
2021-12-31 01:09:22 -05:00
ChatCmdBuilder.new ( " wormball " , function ( cmd )
-- create arena
cmd : sub ( " create :arena " , function ( name , arena_name )
arena_lib.create_arena ( name , " wormball " , arena_name )
end )
cmd : sub ( " create :arena :minplayers:int :maxplayers:int " , function ( name , arena_name , min_players , max_players )
arena_lib.create_arena ( name , " wormball " , arena_name , min_players , max_players )
end )
-- remove arena
cmd : sub ( " remove :arena " , function ( name , arena_name )
arena_lib.remove_arena ( name , " wormball " , arena_name )
end )
-- list of the arenas
cmd : sub ( " list " , function ( name )
arena_lib.print_arenas ( name , " wormball " )
end )
-- enter editor mode
cmd : sub ( " edit :arena " , function ( sender , arena )
arena_lib.enter_editor ( sender , " wormball " , arena )
end )
-- enable and disable arenas
cmd : sub ( " enable :arena " , function ( name , arena )
arena_lib.enable_arena ( name , " wormball " , arena )
end )
cmd : sub ( " disable :arena " , function ( name , arena )
arena_lib.disable_arena ( name , " wormball " , arena )
end )
cmd : sub ( " leaderboard :arena :player " , function ( name , arena , player )
wormball.show_singleplayer_leaderboard ( arena , player )
end )
--clear highscores
cmd : sub ( " clrleaderboard :arena " , function ( name , arena )
local success , msg = wormball.leaderboard . clear_highscores ( arena )
end )
end , {
description = [ [
( / help wormball )
Use this to configure your arena :
- create < arena name > [ min players ] [ max players ]
- edit < arena name >
- enable < arena name >
- list -- show created arenas
- clrleaderboard < arena_name >
Other commands :
- remove < arena name >
- disable < arena >
] ] ,
privs = { wormball_admin = true }
} )
2021-03-11 04:58:55 -05:00
minetest.register_chatcommand ( " wormball_leaderboard " , {
params = " <arena_name> " ,
description = [ [
View the singleplayer leaderboard of a wormball arena
- arena_name -- must be a valid wormball arena name
] ] ,
privs = { } ,
func = function ( name , arena_name )
if not wormball.show_singleplayer_leaderboard ( arena_name , name ) then
return " Invalid usage: please specify a valid wormball arena name to view its leaderboard. "
end
end ,
} )
2021-12-31 01:09:22 -05:00
2021-03-11 04:58:55 -05:00
minetest.register_chatcommand ( " wormball_multiscores " , {
params = " <arena_name> " ,
description = [ [
View the scores of players of the last game played in a wormball arena
- arena_name -- must be a valid wormball arena name
] ] ,
privs = { } ,
func = function ( name , arena_name )
if not arena_lib.get_arena_by_name ( ' wormball ' , arena_name ) then return " Invalid usage: please specify a valid wormball arena name to view its leaderboard. " end
local arena_id , arena = arena_lib.get_arena_by_name ( ' wormball ' , arena_name )
if not arena.multi_scores or arena.multiscores == { } then return " no scores found! " end
if not wormball.show_multi_scores ( arena , name , arena.multi_scores ) then
return " Invalid usage: please specify a valid wormball arena name to view its leaderboard. "
end
return " error "
end ,
} )
2021-12-30 22:17:55 -05:00