From b6eb0ab66ce4c90741a71928913615a6cdf37fd7 Mon Sep 17 00:00:00 2001 From: NO11 Date: Sat, 10 Jul 2021 15:12:41 +0000 Subject: [PATCH] Fix #1808 (Make end credits speed up when pressing jump) --- mods/HUD/mcl_credits/init.lua | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/mods/HUD/mcl_credits/init.lua b/mods/HUD/mcl_credits/init.lua index 2943738753..633a68c8fd 100644 --- a/mods/HUD/mcl_credits/init.lua +++ b/mods/HUD/mcl_credits/init.lua @@ -156,7 +156,16 @@ function mcl_credits.show(player) offset = {x = -5, y = -5}, z_index = 1001, number = 0xFFFFFF, - }) + }), + player:hud_add({ + hud_elem_type = "text", + text = " Jump to speed up (additionally sprint)", + position = {x = 0, y = 1}, + alignment = {x = 1, y = -1}, + offset = {x = -5, y = -5}, + z_index = 1002, + number = 0xFFFFFF, + }), }, } add_hud_element({ @@ -216,13 +225,24 @@ end) minetest.register_globalstep(function(dtime) for _, huds in pairs(mcl_credits.players) do local player = huds.player - if not huds.new and player:get_player_control().sneak then + local control = player:get_player_control() + if not huds.new and control.sneak then mcl_credits.hide(player) else local moving = {} local any for id, y in pairs(huds.moving) do - y = y - 1 + + if not control.jump then + y = y - 1 + else + if not control.aux1 then + y = y - 3 + else + y = y - 8 + end + end + if y > -100 then if id == huds.icon then y = math.max(400, y)