On a modern firearm, the feature that functions like the lock on a muzzleloader is the safety. The safety was added to modern guns to prevent them from accidentally firing, although it should be noted that a safety is a man-made mechanical device which makes it subject to failure at times.