Hi Zain
In the RailEnv.step FLATland checks whether there is a mal function for given agent. If so the agent can not move. See the comment in the rail_env.py:
# Induce malfunction before we do a step, thus a broken agent can't move in this step
self._break_agent(agent)
When an agent is not yet active (READY_TO_DEPART) and the agentโs apply action MOVE_LEFT,MOVE_RIGHT,MOVE_FORWARD it become active and the agent is set to its initial position but only if the cell is empty
Adrian