diff options
Diffstat (limited to 'advtrains/trainhud.lua')
-rw-r--r-- | advtrains/trainhud.lua | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/advtrains/trainhud.lua b/advtrains/trainhud.lua index f9f4876..ce4b913 100644 --- a/advtrains/trainhud.lua +++ b/advtrains/trainhud.lua @@ -10,6 +10,8 @@ advtrains.hud[player:get_player_name()] = nil advtrains.hhud[player:get_player_name()] = nil end) +local hud_type_key = minetest.features.hud_def_type_field and "type" or "hud_elem_type" + local mletter={[1]="F", [-1]="R", [0]="N"} function advtrains.on_control_change(pc, train, flip) @@ -105,7 +107,7 @@ function advtrains.set_trainhud(name, text, driver) end local drivertext = driver or "" local driverhud = { - hud_elem_type = "image", + [hud_type_key] = "image", name = "ADVTRAINS_DRIVER", position = {x=0.5, y=1}, offset = {x=0,y=-170}, @@ -116,8 +118,8 @@ function advtrains.set_trainhud(name, text, driver) if not hud then hud = {} advtrains.hud[name] = hud - hud.id = player:hud_add { - hud_elem_type = "text", + hud.id = player:hud_add({ + [hud_type_key] = "text", name = "ADVTRAINS", number = 0xFFFFFF, position = {x=0.5, y=1}, @@ -125,7 +127,7 @@ function advtrains.set_trainhud(name, text, driver) text = text, scale = {x=200, y=60}, alignment = {x=0, y=-1}, - } + }) hud.driver = player:hud_add(driverhud) hud.oldText = text hud.oldDriver = drivertext @@ -156,7 +158,7 @@ function advtrains.set_help_hud(name, text) hud = {} advtrains.hhud[name] = hud hud.id = player:hud_add({ - hud_elem_type = "text", + [hud_type_key] = "text", name = "ADVTRAINS_HELP", number = 0xFFFFFF, position = {x=1, y=0.3}, |