Bonuspunkt

TrueStack

5 posts in this topic

Available at Workshop http://steamcommunity.com/sharedfiles/filedetails/?id=788616471

vvv--- original post ----vvv

Displays how much damage it takes to kill you

require "base/internal/ui/reflexcore"

TrueStack =
{
    draw = function()

        -- Early out if HUD shouldn´t be shown.
        if not shouldShowHUD() then return end;

        -- Find player
        local player = getPlayer();

        local textColor = Color(255,255,255,255);

        nvgFontSize(52);
        nvgFontFace("TitilliumWeb-Bold");
        nvgTextAlign(NVG_ALIGN_CENTER, NVG_ALIGN_TOP);
        nvgFontBlur(0);
        nvgFillColor(textColor);

        local armorProtection = player.armorProtection + 1;

        local maxDamage =
            math.min(player.armor, player.health * armorProtection) +
            player.health;

        nvgText(0, 0, maxDamage);
    end
};
registerWidget("TrueStack");
NeuerGolf, Grybzt, MnstH and 2 others like this

Share this post


Link to post
Share on other sites
        local armorProtection = player.armorProtection + 1;

        local maxDamage =
            math.min(player.armor, player.health * armorProtection) +
            player.health;

Strange formula... I'd be interested in knowing what exactly what the armorProtection variable is... is it a bool 0/1, i.e. you either have protection or your don't or some scalar?

Share this post


Link to post
Share on other sites

LuaVariables.txt

number armorProtection          0 = green, 1 = yellow, 2 = red

it isn't strange, it just took me a while to wrap my head around because you usually calculate in the other direction.

 

as mentioned on the wiki - Green provides a 1:1 protection, Yellow 2:1 and Red 3:1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now