Add code snippets, change how Entities are validated

Actions now receive and Entity reference directly instead of needing to check
if the id is still alive, and getting the Entity ref before doing actuall work
on the check logic.
Add the InputDevice class.