if not Corruptor.Options:GetValue("RandomizeSounds") then
    return
end

local nochange = {
    footstep_run = true,
    footstep_walk = true,
    footstep_land = true,
}

local function fucking_play(self, dallas)
    local spam_filter = Corruptor.Options:GetValue("SpamFilter")
    if spam_filter then
        Corruptor.spam_stop[self] = TimerManager:game():time() + Corruptor.Options:GetValue("SpamFilterStop")
    end
    self._unit:sound_source():set_rtpc("game_speed", math.random(0.1, 1.5))
    if not spam_filter or not nochange[dallas] then
        return nochange[dallas] or Corruptor:GetRandomSound()
    end
    return dallas
end

PlayerSound._orig_play = PlayerSound._orig_play or PlayerSound._play
function PlayerSound:_play(dallas, sauce, ...)
    dallas = fucking_play(self, dallas)
    return self:_orig_play(dallas, nil, ...)
end

CopSound._orig_play = CopSound._orig_play or CopSound._play
function CopSound:_play(dallas, sauce, ...)
    dallas = fucking_play(self, dallas)
    return self:_orig_play(dallas, nil, ...)
end

CivilianHeisterSound._orig_play = CivilianHeisterSound._orig_play or CivilianHeisterSound._play
function CivilianHeisterSound:_play(dallas, sauce, ...)
    dallas = fucking_play(self, dallas)
    return self:_orig_play(dallas, nil, ...)
end

DramaExt.stop = DramaExt.stop_cue
DramaExt._orig_play_sound = DramaExt._orig_play_sound or DramaExt.play_sound
function DramaExt:play_sound(dallas, sauce, ...)
    dallas = fucking_play(self, dallas)
    return self:_orig_play_sound(dallas, sauce, ...)
end