The bolt slides backwards due to either recoil, gas pressure or a push rod, the spent round ejects and the bolt loads a new round from a magazine when it slides forward due to spring pressure.
The work in both light and dark just the same.
If you're talking about autoflowers, well thats a totally different thing.