How to contour plot a quantized function?

I am trying to plot a function over a 2 dimensional region, which takes integer and half integer values.

However, due to numerical approximations and errors, the calculated value of the function sometimes becomes 0.99 or 1.01 instead of exactly 1. When I make a contour plot, it gives a certain color between 0 and 1, another color between 1 and 2, and so on. As a result, 0.99 and 1.01 acquire different colors (while I want both of them to be the same color, because they represent 1).

What would be an efficient way to plot different integers (approximately, upto numerical errors) and half integers with different colors in a contour (or a similar) plot?

Also, the function takes values between -2 and 2, so I don’t need to take care of all integers.

I cannot use floor function because that will send both 0.99 (should be 1) and 0.01 (should be 0) to 0.