/* KindHud: the mod By Jaden (the entirety of this with my lua knowledge) of course, reusable :3 */ rawset(_G, "kindhud", {}) -- do the mario kindhud.speedometer = CV_RegisterVar({"kind_speedometer", "On", CV_NETVAR|CV_MODIFIED, CV_OnOff}) local function IsPlayerValid(player) return (player and player.valid) and (player.mo and player.mo.valid) end local function DisableHUD() for _, TheHUDS in ipairs({"score", "lives", "rings", "time"}) hud.disable(TheHUDS) end end local function VanillaThing(v, player) if not IsPlayerValid(player) then return end if player.powers[pw_carry] == CR_NIGHTSMODE then return end DisableHUD() -- lives local skinname = skins[player.realmo.skin].hudname local align1 = (v.stringWidth(skinname) > 48) and "thin" or "left" local align2 = (string.len(player.name) > 7) and "thin" or "left" local flags = V_SNAPTOLEFT|V_SNAPTOBOTTOM|V_HUDTRANS|V_PERPLAYER v.draw(16, 190, v.getSprite2Patch(player.realmo.skin, SPR2_XTRA, false, 2), flags, v.getColormap(player.realmo.skin, player.skincolor)) if not multiplayer then v.drawString(29, 174, skinname, flags|V_YELLOWMAP, align1) else v.drawString(29, 174, player.name, skincolors[player.mo.color].chatcolor|flags|V_ALLOWLOWERCASE, align2) end local namelives, alignlives local yoffs = 182 -- only for the thin alignment, lol if (gametyperules & GTR_LIVES) then alignlives = "left" if (player.lives > 0) then namelives = player.lives else namelives = "DNF" end elseif (gametyperules & GTR_TEAMS) then alignlives = "thin" yoffs = $ + 1 if player.ctfteam == 1 then -- Red namelives = "Red Team" elseif player.ctfteam == 2 then -- Blue namelives = "Blue Team" end elseif (gametyperules & GTR_TAG) then alignlives = "left" if (player.pflags & PF_TAGIT) then namelives = "IT!" else namelives = "Not IT!" end elseif (gametyperules & GTR_RINGSLINGER) then alignlives = "thin" yoffs = $ + 1 namelives = "Free for All" elseif (gametyperules & GTR_RACE) then alignlives = "left" namelives = "INF" end v.drawString(29, yoffs, namelives, flags|V_ALLOWLOWERCASE, alignlives) -- speedometer if (kindhud.speedometer.value) then local calcspeed, decimal = player.speed / FRACUNIT, FixedMul(player.speed % FRACUNIT, 10*FRACUNIT)/FRACUNIT local final = calcspeed + "." + decimal + " FU/t" v.drawString(8, 158, "Speed: " .. final, skincolors[player.skincolor].chatcolor|V_PERPLAYER|V_HUDTRANS|V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, "thin") end -- score, rings and time if not G_IsSpecialStage() then local flags = V_PERPLAYER|V_HUDTRANS|V_SNAPTOTOP // Scores v.drawString(33, 6, "Score", flags|V_SNAPTOLEFT|V_YELLOWMAP, "thin-center") v.drawString(33, 13, player.score, flags|V_SNAPTOLEFT, "center") // Time local thing = "%02d" local drawTime = G_TicsToMinutes(player.realtime, true) + ":" + string.format(thing, G_TicsToSeconds(player.realtime)) + "." + string.format(thing, G_TicsToCentiseconds(player.realtime)) v.drawString(160, 6, "Time", flags|V_YELLOWMAP, "thin-center") v.drawString(160, 13, drawTime, flags, "center") // Rings (ugly hack :agony:) v.drawString(283, 6, "Rings", flags|V_YELLOWMAP|V_SNAPTORIGHT, "thin-center") if player.rings == 0 and (leveltime/4%2) then v.drawString(283, 6, "Rings", flags|V_REDMAP|V_SNAPTORIGHT, "thin-center") end v.drawString(283, 13, player.rings, flags|V_SNAPTORIGHT, "center") end end hud.add(VanillaThing, "game")