[GREENFOOT-371] Provide more help after objects have removed themselves
It's possible for an actor to remove itself from the world mid-act(). If the code tries to do anything more that relates to the world (e.g. moving), an exception is thrown (NotInWorldException or something?). Lots of people on the Greenfoot forum seem to get confused by this exception despite the fact that the exception message tells them what may have gone wrong.
We should be able to identify specifically the case where an actor has removed itself mid-act() and is moving after being removed from the world (as opposed to the other cause of this exception: moving before being added to the world) -- because we know which Actor we are currently invoking act() on. If the actor being act()ed on is the one who isn't in the world, it must be because they've just removed themselves (there's no other way that Greenfoot would be calling act() on them and yet they aren't in the world). So we could be more specific in the exception to say:
"Actor has already been removed from the world -- stop executing code after you remove yourself from the world! And read these messages!"
Issue metadata
- Issue type: Task
- Priority: Medium
- Fix versions: 3.7.0