Add Entity/TemplateIndex, which allows for lookups

This enables code to lookup entities or templates by their respective
unique id, which allows for some game logic patterns to be expressed much
more simply and efficiently.
Reduce visibility