Massive refactoring during the exam, hurrah!

Move "plugin" functions/vars to game object
Start moving explicit global $ag calls to component constructor
More unit testing
Remove hard-coded globals from db component
Proper returns in some functions
Strip unused duplicate log functions from game object