Compare commits

...

5 Commits

Author SHA1 Message Date
Minetest-j45 e8ed720de2
Update kb.lua 2021-03-25 22:27:25 +00:00
Minetest-j45 6d17d142ac
Update hud.lua 2021-03-25 22:14:53 +00:00
Minetest-j45 1840ec4ad8
Update messages.lua 2021-03-24 17:29:52 +00:00
Minetest-j45 cb52adad1e
Update messages.lua 2021-03-24 17:22:13 +00:00
Minetest-j45 67b6e07c8b
Update init.lua 2021-03-24 17:04:07 +00:00
4 changed files with 21 additions and 0 deletions

View File

@ -16,6 +16,10 @@ minetest.register_on_joinplayer(function(player)
minetest.after(1, sumo_duels.hud_update, nil)
end)
minetest.register_on_leaveplayer(function(player)
sumo_duels.huds[player:get_player_name()] = nil
end)
sumo_duels.hud_update = function()
local players = minetest.get_connected_players()
for _, player in ipairs(players) do

View File

@ -10,3 +10,4 @@ dofile(mp .. "/kb.lua")
dofile(mp .. "/teams.lua")
dofile(mp .. "/void.lua")
dofile(mp .. "/hud.lua")
dofile(mp .. "/messages.lua")

1
kb.lua
View File

@ -1,4 +1,5 @@
minetest.calculate_knockback = function(player, hitter, time_from_last_punch, tool_capabilities, dir, distance, damage)
player:set_hp(20)
if not time_from_last_punch or time_from_last_punch >= 1.5 then
return 1.5
elseif time_from_last_punch <= 1 and time_from_last_punch >= 0.5 then

View File

@ -1 +1,16 @@
sumo_duels.messages = {
"You can join the waiting list for an arena using /join <number from 1 to 3>",
"The longer you wait to hit your opponent, the more knockback you do",
"Once there are at least 2 people in a waiting list for an arena, the first 2 people who were in the waiting list will be put in a game"
}
local timer = 0
minetest.register_globalstep(function(dtime)
timer = timer + dtime;
if timer >= 5 then
-- Send message to all players every 5 seconds
local random = math.random(1, #sumo_duels.messages)
minetest.chat_send_all(minetest.colorize("#999997", sumo_duels.messages[random]))
timer = 0
end
end)