#Timed ghosting not working

1 messages · Page 1 of 1 (latest)

river remnant
#

After I pick a time for ghosting it never turns off its always on. Is this a bug or is it just me?

shrewd flax
#

It's probably broken.

Maybe it'll be fixed one day

#

Very low prio from me, cause it's annoying to debug ghosting lol

river remnant
#

I feel that lol Ive been trying to debug all day

shrewd flax
#

Keep an eye on #patch-notes and maybe it'll be fixed some day if I can be arsed lul

river remnant
#

I think I fixed it, when testing I’ll post the code in a bit

river remnant
#
local function initGhosting()
  debugLog('Initializing ghosting with time: ' .. tostring(CurrentRaceData.GhostingTime))
  ghostPlayer() -- Set player as ghosted immediately

  -- Handle timed ghosting if GhostingTime is set
  if CurrentRaceData.GhostingTime and CurrentRaceData.GhostingTime > 0 then
    CreateThread(function()
      local ghostEndTime = GetGameTimer() + (CurrentRaceData.GhostingTime) -- Convert seconds to milliseconds
      while CurrentRaceData.Started and GetGameTimer() < ghostEndTime do
        checkAndDisableGhosting() -- Check proximity while timer runs
        Wait(Config.Ghosting.DistanceLoopTime)
      end
      if CurrentRaceData.Started then
        debugLog('Ghosting timer expired, un-ghosting player')
        unGhostPlayer()
      end
    end)
  else
      -- Fallback to continuous proximity checking if no time is set
    CreateThread(function()
      while CurrentRaceData.Started do
        checkAndDisableGhosting()
        Wait(Config.Ghosting.DistanceLoopTime)
      end
    end)
  end
end```
shrewd flax
#

Niice!
I'll take a look at it, see if I can simplify it for a release sometime later