Fix egg code

master
shivajiva101 2020-08-19 20:28:51 +01:00 committed by GitHub
parent 1b10fd67bd
commit 24c723b303
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 20 deletions

View File

@ -70,7 +70,6 @@ dofile(MP .. "/tools.lua")
--- Sets server conf settings
-- @return nothing
local function set_settings()
minetest.settings:set_bool('unlimited_player_transfer_distance', false)
minetest.settings:set('player_transfer_distance', 20)
minetest.settings:set('time_speed', 0)
minetest.settings:write()
@ -247,22 +246,6 @@ local function remove_match_hud(key)
end
end
--- Update match status flag in players HUD
-- @param key - arena key string
-- @param id - hud element id
-- @return nothing
local function update_hud(key, id)
for k, def in pairs(eggwars.match[key].player) do
local obj = minetest.get_player_by_name(k)
if not id then
obj:hud_change(def.remaining, 'text', 'Remaining: ' ..
eggwars.match[key].hud_time .. 'm')
else
obj:hud_change(def.hud_id[id], 'text', def.hud_img[2])
end
end
end
--- Add an image that removes itself to a players HUD
-- @param player - object
-- @param image_string - filename of image
@ -452,6 +435,10 @@ local function safe_spawn(minp)
return minp
end
-------------------
-- API Functions --
-------------------
--- Removes a player hud image if its registered
-- @param name - players name
-- @return nothing
@ -463,9 +450,21 @@ eggwars.remove_hud_image = function(name)
end
end
-------------------
-- API Functions --
-------------------
--- Update match status flag in players HUD
-- @param key - arena key string
-- @param id - hud element id
-- @return nothing
eggwars.update_hud = function(key, id)
for k, def in pairs(eggwars.match[key].player) do
local obj = minetest.get_player_by_name(k)
if not id then
obj:hud_change(def.remaining, 'text', 'Remaining: ' ..
eggwars.match[key].hud_time .. 'm')
else
obj:hud_change(def.hud_id[id], 'text', def.hud_img[2])
end
end
end
--- Reset arena by index
-- @param arena integer index of registered arena