implemented StackMachine:registerEvents()

works the same way as it does in hump gamestate