From 37275963df6a59b461c74c5a50169339650a7c3e Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Fri, 6 Apr 2018 00:24:56 +0100 Subject: [PATCH] Fix notification positioning Fixes #55, also fixes @Fixer-007 --- api.lua | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/api.lua b/api.lua index 9cf60d1..9a2ec0c 100644 --- a/api.lua +++ b/api.lua @@ -428,7 +428,7 @@ function awards.unlock(name, award) name = "award_bg", scale = {x = 2, y = 1}, text = background, - position = {x = 0.5, y = 0}, + position = {x = 0.5, y = 0.05}, offset = {x = 0, y = 138}, alignment = {x = 0, y = -1} }) @@ -444,8 +444,8 @@ function awards.unlock(name, award) number = 0xFFFFFF, scale = {x = 100, y = 20}, text = hud_announce, - position = {x = 0.5, y = 0}, - offset = {x = 0, y = 40}, + position = {x = 0.5, y = 0.05}, + offset = {x = 0, y = 45}, alignment = {x = 0, y = -1} }) local three = player:hud_add({ @@ -454,8 +454,8 @@ function awards.unlock(name, award) number = 0xFFFFFF, scale = {x = 100, y = 20}, text = title, - position = {x = 0.5, y = 0}, - offset = {x = 30, y = 100}, + position = {x = 0.5, y = 0.05}, + offset = {x = 0, y = 100}, alignment = {x = 0, y = -1} }) local four = player:hud_add({ @@ -463,15 +463,18 @@ function awards.unlock(name, award) name = "award_icon", scale = {x = 4, y = 4}, text = icon, - position = {x = 0.4, y = 0}, - offset = {x = -81.5, y = 126}, + position = {x = 0.5, y = 0.05}, + offset = {x = -200.5, y = 126}, alignment = {x = 0, y = -1} }) minetest.after(4, function() - player:hud_remove(one) - player:hud_remove(two) - player:hud_remove(three) - player:hud_remove(four) + local player2 = minetest.get_player_by_name(name) + if player2 then + player2:hud_remove(one) + player2:hud_remove(two) + player2:hud_remove(three) + player2:hud_remove(four) + end end) end end