This is absolutely a thing that should be implemented! I had problems with that in my first house all the time. My neighbors would randomly come over and run through my house without so much as a by your leave. And none of these people were friends either. They just liked to invade every chance they got no matter how much it bothered me.