Move notifs to the left

This commit is contained in:
Jean-Patrick Guerrero 2023-04-02 01:23:11 +02:00
parent 83623effbf
commit 85fc8219c1
4 changed files with 16 additions and 16 deletions

View File

@ -321,7 +321,7 @@ function i3.hud_notif(name, msg, img)
local player = get_player_by_name(name) local player = get_player_by_name(name)
if not player then return end if not player then return end
local max_y = -120 local max_y = -125
local def = { local def = {
show = true, show = true,

View File

@ -640,8 +640,8 @@ local function init_hud_notif(player)
return { return {
bg = player:hud_add { bg = player:hud_add {
hud_elem_type = "image", hud_elem_type = "image",
position = {x = 1, y = 1}, position = {x = 0, y = 1},
offset = {x = -330, y = 0}, offset = {x = 10, y = 0},
alignment = {x = 1, y = 1}, alignment = {x = 1, y = 1},
scale = {x = 0.6, y = 0.6}, scale = {x = 0.6, y = 0.6},
text = "i3_bg_notif.png", text = "i3_bg_notif.png",
@ -650,8 +650,8 @@ local function init_hud_notif(player)
img = player:hud_add { img = player:hud_add {
hud_elem_type = "image", hud_elem_type = "image",
position = {x = 1, y = 1}, position = {x = 0, y = 1},
offset = {x = -320, y = 20}, offset = {x = 20, y = 20},
alignment = {x = 1, y = 1}, alignment = {x = 1, y = 1},
scale = {x = 1, y = 1}, scale = {x = 1, y = 1},
text = "", text = "",
@ -660,8 +660,8 @@ local function init_hud_notif(player)
text = player:hud_add { text = player:hud_add {
hud_elem_type = "text", hud_elem_type = "text",
position = {x = 1, y = 1}, position = {x = 0, y = 1},
offset = {x = -245, y = 40}, offset = {x = 100, y = 40},
alignment = {x = 1, y = 1}, alignment = {x = 1, y = 1},
number = 0xffffff, number = 0xffffff,
text = "", text = "",

View File

@ -1,4 +1,4 @@
IMPORT("abs", "max", "ceil", "remove", "str_to_pos") IMPORT("max", "ceil", "remove", "str_to_pos")
IMPORT("get_connected_players", "add_hud_waypoint") IMPORT("get_connected_players", "add_hud_waypoint")
local function init_hud(player) local function init_hud(player)
@ -57,7 +57,7 @@ local function show_hud(player, data, notif, idx, dt)
player:hud_change(def, "offset", { player:hud_change(def, "offset", {
x = hud_info.offset.x, x = hud_info.offset.x,
y = hud_info.offset.y - (speed * max(1, (#data.hud.notifs - idx + 1) / 1.4)) y = hud_info.offset.y - (speed * max(1, (#data.hud.notifs - idx + 1) / 1.45))
}) })
end end
elseif notif.show == false and notif.hud_timer >= i3.settings.hud_timer_max then elseif notif.show == false and notif.hud_timer >= i3.settings.hud_timer_max then
@ -67,11 +67,11 @@ local function show_hud(player, data, notif, idx, dt)
local hud_info = player:hud_get(def) local hud_info = player:hud_get(def)
player:hud_change(def, "offset", { player:hud_change(def, "offset", {
x = hud_info.offset.x + speed, x = hud_info.offset.x - speed,
y = hud_info.offset.y y = hud_info.offset.y
}) })
if hud_info.offset.x > abs(notif.max.x) then if hud_info.offset.x < notif.max.x then
player:hud_remove(def) player:hud_remove(def)
remove(data.hud.notifs, idx) remove(data.hud.notifs, idx)
end end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 870 B

After

Width:  |  Height:  |  Size: 1.4 KiB