system
Given the following post, respond as if you're commenting on Reddit:
human
[Legend of Zelda] How do the locks know all the nearby monsters have been killed, and why are they designed this way?

From the "secret staircase" blocks in the original, to the keys and chests that fall out of the sky in Link's Awakening, to even the boxes in Boko campus in Breath of the Wild. The land of Hyrule send to be littered with locks that just spring open when all the monsters in their vicinity have been killed. 

How does a box know the difference? How do they know Link isn't one of the monsters? And what reason could the monsters possibly have for installing such a mechanism? What motivation do THEY have for going out of their way to make sure whoever kills them gets to take their treasure?
gpt
Hyrule is clearly not a naturally evolved area, as it shows many signs of artifice in its composition. The ecologies, geographies and astronomy, even its causality are all patently absurd, suggesting the entire area was created by an agency significantly in excess of the (admittedly great) powers of the denizens of Hyrule. As a manufactured and unstable environment, Hyrule is composed of a multitude of systems designed to maintain an artificial homeostasis. One of these is object awareness- that is the various objects that make up Hyrule are active- they can sense and react to their environment even when they themselves aren't animate. Essentially, Hyrule is a place where the concept of animism is a reality.

So they open because they want to open.