From 7199ee4ff89f8990fd6c9eed9499108ccefc887f Mon Sep 17 00:00:00 2001 From: Desour Date: Fri, 17 Nov 2023 19:15:29 +0100 Subject: [PATCH] Devtest: Fix testnodes bouncy color calculation Values were out of range. --- games/devtest/mods/testnodes/properties.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/games/devtest/mods/testnodes/properties.lua b/games/devtest/mods/testnodes/properties.lua index e75cc8b69c37..938511b83222 100644 --- a/games/devtest/mods/testnodes/properties.lua +++ b/games/devtest/mods/testnodes/properties.lua @@ -428,17 +428,17 @@ local MAX_BOUNCE_NONJUMPY = 140 for i=-MAX_BOUNCE_NONJUMPY, MAX_BOUNCE_JUMPY, 20 do if i ~= 0 then local desc - local val = math.floor(((i-20)/200)*255) - local val2 = math.max(0, 200 - val) + local val = math.floor((math.abs(i) - 20) / 200 * 255) + local val2 = math.max(0, 255 - val) local num = string.format("%03d", math.abs(i)) if i > 0 then desc = S("Bouncy Node (@1%), jumpy", i).."\n".. S("Sneaking/jumping affects bounce") - color = { r=255-val, g=255-val, b=255, a=255 } + color = { r=val2, g=val2, b=255, a=255 } else desc = S("Bouncy Node (@1%), non-jumpy", math.abs(i)).."\n".. S("Sneaking/jumping does not affect bounce") - color = { r=val, g=255, b=val, a=255 } + color = { r=val2, g=255, b=val2, a=255 } num = "NEG"..num end minetest.register_node("testnodes:bouncy"..num, {