The mechanism is that guns are harder to get, both legally and illegally, if there are strong controls on their purchase and use. Yes, a mass shooter would ignore the legal implications of getting a gun, but they cannot ignore the fact that there are fewer guns to get.