Make Activate instruction work properly even when onActivate was not called in the same frame.

There are two major differences to the old implementation:
 - Activate can now be called on its own, e.g. in the console. In Vanilla this appears to be a no-op, so it is unlikely to be used and the potential for breakage is low.
 - The Action to execute is now determined when Activate is called, not when OnActivate is called. This however makes sense, since there may be a time difference between the two, and the object (or the player) could have changed in the meantime, requiring a different Action.

Fixes #1166 and #1346.