addHook("PlayerThink", function(player) if not (player.mo and player.mo.valid) then return end if player.wild_timer == nil then player.wild_timer = 0 end if player.wild_extra_thrust == nil then player.wild_extra_thrust = 0 end local cur_speed = player.speed local threshold = 35*FRACUNIT if cur_speed >= threshold then player.wild_timer = $ + 1 if player.wild_timer % 180 == 0 then player.wild_extra_thrust = $ + (FRACUNIT) player.wild_boost_count = ($ or 0) + 1 end if player.wild_extra_thrust > 0 then P_Thrust(player.mo, player.mo.angle, player.wild_extra_thrust) end if (leveltime % 2 == 0) then local ghost = P_SpawnMobj(player.mo.x, player.mo.y, player.mo.z, MT_GHOST) ghost.target = player.mo ghost.angle = player.drawangle or player.mo.angle or 0 ghost.colorized = true ghost.color = SKINCOLOR_CHERRY ghost.fuse = 10 ghost.flags2 = $1|MF2_SHADOW end else player.wild_timer = 0 player.wild_extra_thrust = 0 player.wild_boost_count = 0 end end) local function wildSpeedsHUD(v, player) if not (player and player.valid and player.mo and player.mo.valid) then return end local boosts = player.wild_boost_count or 0 local timer = player.wild_timer or 0 local threshold = 180 if player.speed >= 35*FRACUNIT then v.drawString(300, 40, "CHARGING UP!", V_SNAPTOTOP|V_SNAPTORIGHT|V_HUDTRANS|V_REDMAP, "thin-right") local barProgress = (timer % threshold) / 20 local barStr = "" for i=1, barProgress do barStr = $ .. "-" end v.drawString(300, 48, barStr, V_SNAPTOTOP|V_SNAPTORIGHT|V_REDMAP, "thin-right") v.drawString(300, 30, "BOOST " .. boosts, V_SNAPTOTOP|V_SNAPTORIGHT|V_REDMAP, "thin-right") end end hud.add(wildSpeedsHUD, "game")