What properties must $f$ have if $f(x)=f(\sin(\pi x)+x)\iff x\in\Bbb{Z}$?

This is a follow-up from my previous question.

I now know that the statement: $$f(x)=f(\sin(\pi x)+x)\iff x\in\Bbb{Z}$$ is not true for all $$f$$. For example, $$f$$ can be $$x$$ to any constant power or any constant to the $$x$$th power but it cannot be the gamma function $$\Gamma(x)$$ or $$\sin(x)$$ or $$x^x$$. According to the answer I received, it is important to note whether or not $$f$$ is injective. However, $$f(x)=x^2$$ is not injective, yet it satisfies the statement. If being injective is only a sufficient condition as opposed to a necessary condition, what exactly do we know about the class of functions that makes this statement true?

We assume that $$f$$ is a function from $$\Bbb R$$ to$$\Bbb R$$. Let $$\mathcal P_f$$ be a partition of $$\Bbb R$$ into the equivalence classess of a relation $$\sim_f$$, where $$x\sim_f x’$$ iff $$f(x)=f(x’)$$ for any $$x,x’\in\Bbb R$$. The function makes the statement true iff for each $$P\in P_f$$ and each $$x\in P\setminus\Bbb Z$$ we have $$x+\sin(\pi x)\not\in P$$. This is clearly satisfied when $$f$$ is injective, because in this case each $$P\in\mathcal P_f$$ is a one-point set.
Now consider an other binary relation $$\sim_s$$ on $$\Bbb R$$ defined as follows. For any $$x,x’\in\Bbb R$$ we have $$x\sim_s x’$$ iff there exists a finite sequence $$x=x_1, x_2,\dots, x_n=x’$$ such that for each $$1\le i\le n-1$$ we have $$x_{i+1}=x_i+\sin (\pi x_i)$$ or $$x_{i}=x_{i+1}+\sin (\pi x_{i+1})$$. Then $$\Bbb R$$ splits into equivalence classes of the relation $$\sim_s$$, providing a partition $$\mathcal P_s$$ of $$\Bbb R$$. Then the function $$f$$ satisfies the condition iff for each $$P\in\mathcal P_f$$ and each $$P’\in\mathcal P_s$$ we have $$P\cap P’$$ is empty or an one-point set.
So we have to study the partition $$\mathcal P_s$$. The graph of the function $$x+\sin(\pi x)$$ shown below suggests that for each integer $$n$$, the set $$\{2n\}$$ is an one-point member of $$\mathcal P_s$$, but other members of $$\mathcal P_s$$ can have more complicated structure.