Fix hud_elem_type depercation except for 1 mod

This commit is contained in:
Wuzzy 2024-08-31 13:39:29 +02:00
parent 1604788e0b
commit fbe9c96e8b
5 changed files with 55 additions and 10 deletions

View File

@ -1,5 +1,14 @@
local S = minetest.get_translator("hades_bounds")
-- Boilerplate for compatibiliity with pre-5.9.0
-- versions of minetest
local hud_def_type_field
if minetest.features.hud_def_type_field then
hud_def_type_field = "type"
else
hud_def_type_field = "hud_elem_type"
end
local players_out_of_bounds = {}
local players_out_of_bounds_blinding = {}
@ -73,7 +82,7 @@ minetest.register_globalstep(function(dtime)
end
if not players_out_of_bounds[name] then
local hudid = player:hud_add({
hud_elem_type = "text",
[hud_def_type_field]= "text",
text = text,
position = { x = 0.5, y = 0.2 },
number = 0xFFFF00,
@ -87,7 +96,7 @@ minetest.register_globalstep(function(dtime)
end
if img and not players_out_of_bounds_blinding[name] then
local hudid = player:hud_add({
hud_elem_type = "image",
[hud_def_type_field] = "image",
text = img,
position = { x = 0.5, y = 0.5 },
number = 0xFFFF00,

View File

@ -1,5 +1,14 @@
hades_compass = {}
-- Boilerplate for compatibiliity with pre-5.9.0
-- versions of minetest
local hud_def_type_field
if minetest.features.hud_def_type_field then
hud_def_type_field = "type"
else
hud_def_type_field = "hud_elem_type"
end
local huds = {}
local ly = 5 -- letter Y offset
@ -32,7 +41,7 @@ minetest.register_on_joinplayer(function(player)
local name = player:get_player_name()
huds[name] = {}
local bg = player:hud_add({
hud_elem_type = "image",
[hud_def_type_field] = "image",
position = { x = 0.5, y = 0 },
offset = { x = 0, y = 5 },
size = { x = 125, y = 50 },
@ -42,7 +51,7 @@ minetest.register_on_joinplayer(function(player)
z_index = 20,
})
local compass = player:hud_add({
hud_elem_type = "compass",
[hud_def_type_field] = "compass",
position = { x = 0.5, y = 0 },
offset = { x = 0, y = 5 },
size = { x = 125, y = 50 },

View File

@ -1,5 +1,14 @@
local S = minetest.get_translator("hades_movement")
-- Boilerplate for compatibiliity with pre-5.9.0
-- versions of minetest
local hud_def_type_field
if minetest.features.hud_def_type_field then
hud_def_type_field = "type"
else
hud_def_type_field = "hud_elem_type"
end
local HIDE_JUMP_HUD_AFTER = 5 -- seconds after which to hide jump HUD
local JUMP_FACTOR_HIGH = 1
local JUMP_FACTOR_MED = 0.85
@ -73,7 +82,7 @@ minetest.register_on_joinplayer(function(player)
jump_modes[name] = 0
-- Show icon that displays the current jump mode
jump_huds[name] = player:hud_add({
hud_elem_type = "image",
[hud_def_type_field] = "image",
position = { x=1, y=1 },
alignment = { x=-1, y=-1 },
size = { x=100, y=100 },

View File

@ -1,5 +1,14 @@
local S = minetest.get_translator("hades_orienteering")
-- Boilerplate for compatibiliity with pre-5.9.0
-- versions of minetest
local hud_def_type_field
if minetest.features.hud_def_type_field then
hud_def_type_field = "type"
else
hud_def_type_field = "hud_elem_type"
end
local hades_orienteering = {}
hades_orienteering.playerhuds = {}
hades_orienteering.settings = {}
@ -228,7 +237,7 @@ function hades_orienteering.init_hud(player)
hades_orienteering.playerhuds[name] = {}
for i=1, o_lines do
hades_orienteering.playerhuds[name]["o_line"..i] = player:hud_add({
hud_elem_type = "text",
[hud_def_type_field] = "text",
text = "",
position = hades_orienteering.settings.hud_pos,
offset = { x = hades_orienteering.settings.hud_offset.x, y = hades_orienteering.settings.hud_offset.y + 20*(i-1) },

View File

@ -1,6 +1,15 @@
local S = minetest.get_translator("hudbars")
local NS = function(s) return s end
-- Boilerplate for compatibiliity with pre-5.9.0
-- versions of minetest
local hud_def_type_field
if minetest.features.hud_def_type_field then
hud_def_type_field = "type"
else
hud_def_type_field = "hud_elem_type"
end
hb = {}
hb.hudtables = {}
@ -194,7 +203,7 @@ function hb.register_hudbar(identifier, text_color, label, textures, default_sta
end
if hb.settings.bar_type == "progress_bar" then
ids.bg = player:hud_add({
hud_elem_type = "image",
[hud_def_type_field] = "image",
position = pos,
scale = bgscale,
text = "hudbars_bar_background.png",
@ -204,7 +213,7 @@ function hb.register_hudbar(identifier, text_color, label, textures, default_sta
})
if textures.icon ~= nil then
ids.icon = player:hud_add({
hud_elem_type = "image",
[hud_def_type_field] = "image",
position = pos,
scale = iconscale,
text = textures.icon,
@ -230,7 +239,7 @@ function hb.register_hudbar(identifier, text_color, label, textures, default_sta
bar_size = {x=24, y=24}
end
ids.bar = player:hud_add({
hud_elem_type = "statbar",
[hud_def_type_field] = "statbar",
position = pos,
text = bar_image,
text2 = bgicon,
@ -244,7 +253,7 @@ function hb.register_hudbar(identifier, text_color, label, textures, default_sta
})
if hb.settings.bar_type == "progress_bar" then
ids.text = player:hud_add({
hud_elem_type = "text",
[hud_def_type_field] = "text",
position = pos,
text = text,
alignment = {x=1,y=1},