2020-12-19 13:55:23 +01:00
|
|
|
arena_lib.on_load("sumo", function(arena)
|
|
|
|
|
|
|
|
local item = ItemStack("sumo:pushstick")
|
|
|
|
|
|
|
|
for pl_name, stats in pairs(arena.players) do
|
|
|
|
local player = minetest.get_player_by_name(pl_name)
|
|
|
|
player:get_inventory():set_stack("main", 1, item)
|
|
|
|
end
|
|
|
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--if the game times out
|
|
|
|
arena_lib.on_timeout('sumo', function(arena)
|
|
|
|
local winner_names = {}
|
|
|
|
for p_name, p_stats in pairs(arena.players) do
|
|
|
|
table.insert(winner_names, p_name)
|
|
|
|
end
|
|
|
|
|
|
|
|
arena_lib.load_celebration('sumo', arena, winner_names)
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
arena_lib.on_death('sumo', function(arena, p_name, reason)
|
|
|
|
arena_lib.remove_player_from_arena(p_name, 1)
|
|
|
|
end)
|
2020-12-19 16:05:30 +00:00
|
|
|
|
2020-12-19 16:23:34 +00:00
|
|
|
--this is necessary beacuse it is required by arena_lib for timed games
|
|
|
|
arena_lib.on_time_tick('sumo', function(arena)
|
|
|
|
return
|
|
|
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
2020-12-19 16:05:30 +00:00
|
|
|
--remove stick if in inv when joinplayer
|
|
|
|
minetest.register_on_joinplayer(function(player)
|
|
|
|
local inv = player:get_inventory()
|
|
|
|
local stack = ItemStack("sumo:pushstick")
|
|
|
|
local taken = inv:remove_item("main", stack)
|
|
|
|
|
|
|
|
end)
|