Partially revert latest commit (fixes #334)

This commit is contained in:
marco_a 2024-09-02 00:55:06 +02:00
parent a1a489b668
commit f40ed854d0
2 changed files with 62 additions and 60 deletions

View File

@ -1,63 +1,63 @@
local player_huds = {} -- KEY: p_name, INDEX: {HUD_BG_ID, HUD_TXT_ID}
local hud_type = minetest.features.hud_def_type_field and "type" or "hud_elem_type"
function arena_lib.HUD_add(player)
local HUD_TITLE_IMG = player:hud_add({
type = "image",
position = { x = 0.5, y = 0.25},
offset = { x = 0, y = 50},
text = "",
scale = { x = 4, y = 1.5 },
number = 0xFFFFFF,
z_index = 1100
[hud_type] = "image",
position = { x = 0.5, y = 0.25},
offset = { x = 0, y = 50},
text = "",
scale = { x = 4, y = 1.5 },
number = 0xFFFFFF,
z_index = 1100
})
local HUD_TITLE_TXT = player:hud_add({
type = "text",
position = { x = 0.5, y = 0.25},
offset = { x = 0, y = 50},
text = "",
size = { x = 2},
number = 0xFFFFFF,
z_index = 1100
[hud_type] = "text",
position = { x = 0.5, y = 0.25},
offset = { x = 0, y = 50},
text = "",
size = { x = 2},
number = 0xFFFFFF,
z_index = 1100
})
local HUD_BROADCAST_IMG = player:hud_add({
type = "image",
position = { x = 0.5, y = 0.25},
text = "",
scale = { x = 25, y = 2},
number = 0xFFFFFF,
z_index = 1100
[hud_type] = "image",
position = { x = 0.5, y = 0.25},
text = "",
scale = { x = 25, y = 2},
number = 0xFFFFFF,
z_index = 1100
})
local HUD_BROADCAST_TXT = player:hud_add({
type = "text",
position = { x = 0.5, y = 0.25},
text = "",
number = 0xFFFFFF,
z_index = 1100
[hud_type] = "text",
position = { x = 0.5, y = 0.25},
text = "",
number = 0xFFFFFF,
z_index = 1100
})
local HUD_HOTBAR_IMG = player:hud_add({
type = "image",
position = { x = 0.5, y = 1},
offset = {x = 0, y = -105},
text = "",
scale = { x = 25, y = 1.5},
number = 0xFFFFFF,
z_index = 1100
[hud_type] = "image",
position = { x = 0.5, y = 1},
offset = {x = 0, y = -105},
text = "",
scale = { x = 25, y = 1.5},
number = 0xFFFFFF,
z_index = 1100
})
local HUD_HOTBAR_TXT = player:hud_add({
type = "text",
position = { x = 0.5, y = 1},
offset = {x = 0, y = -105},
text = "",
size = { x = 1, y = 1},
number = 0xFFFFFF,
z_index = 1100
[hud_type] = "text",
position = { x = 0.5, y = 1},
offset = {x = 0, y = -105},
text = "",
size = { x = 1, y = 1},
number = 0xFFFFFF,
z_index = 1100
})
player_huds[player:get_player_name()] = {HUD_TITLE_IMG, HUD_TITLE_TXT, HUD_BROADCAST_IMG, HUD_BROADCAST_TXT, HUD_HOTBAR_IMG, HUD_HOTBAR_TXT}

View File

@ -1,5 +1,7 @@
local S = minetest.get_translator("arena_lib")
local waypoints = {} -- KEY: player name; VALUE: {Waypoints IDs}
local hud_type = minetest.features.hud_def_type_field and "type" or "hud_elem_type"
@ -18,10 +20,10 @@ function arena_lib.show_waypoints(p_name, mod, arena)
if not arena.teams_enabled then
for ID, spwn in pairs(arena.spawn_points) do
local HUD_ID = player:hud_add({
name = "#" .. ID,
type = "waypoint",
precision = 0,
world_pos = spwn.pos
[hud_type] = "waypoint",
name = "#" .. ID,
precision = 0,
world_pos = spwn.pos
})
table.insert(waypoints[p_name], HUD_ID)
@ -30,10 +32,10 @@ function arena_lib.show_waypoints(p_name, mod, arena)
for i = 1, #arena.teams do
for ID, spwn in pairs(arena.spawn_points[i]) do
local HUD_ID = player:hud_add({
name = "#" .. ID .. ", " .. arena.teams[i].name,
type = "waypoint",
precision = 0,
world_pos = spwn.pos
[hud_type] = "waypoint",
name = "#" .. ID .. ", " .. arena.teams[i].name,
precision = 0,
world_pos = spwn.pos
})
table.insert(waypoints[p_name], HUD_ID)
@ -43,10 +45,10 @@ function arena_lib.show_waypoints(p_name, mod, arena)
-- punto di ritorno
local HUD_ID = player:hud_add({
name = arena.custom_return_point and S("Return point (custom)") or S("Return point"),
type = "waypoint",
precision = 0,
world_pos = arena.custom_return_point and arena.custom_return_point.pos or arena_lib.mods[mod].settings.return_point.pos
[hud_type] = "waypoint",
name = arena.custom_return_point and S("Return point (custom)") or S("Return point"),
precision = 0,
world_pos = arena.custom_return_point and arena.custom_return_point.pos or arena_lib.mods[mod].settings.return_point.pos
})
table.insert(waypoints[p_name], HUD_ID)
@ -62,17 +64,17 @@ function arena_lib.show_waypoints(p_name, mod, arena)
-- personalizzazioni grafiche dell'arena (quindi prob anche peggio)
if arena.pos1 then
local pos1 = player:hud_add({
name = "Pos1",
type = "waypoint",
precision = 0,
world_pos = arena.pos1
[hud_type] = "waypoint",
name = "Pos1",
precision = 0,
world_pos = arena.pos1
})
local pos2 = player:hud_add({
name = "Pos2",
type = "waypoint",
precision = 0,
world_pos = arena.pos2
[hud_type] = "waypoint",
name = "Pos2",
precision = 0,
world_pos = arena.pos2
})
table.insert(waypoints[p_name], pos1)