Add tool callback

This commit adds a tool callback, that is called instead of wearing the tool if a tool wants to use custom code when being used. It could already be done before, but would require to override a global function, which is not a good solution.