Localized prosocial preferences, public goods, and common-pool resources