-
Notifications
You must be signed in to change notification settings - Fork 6
Description
Problem
Currently player instances are always valid, disconnected players are not returned by get_connected_players but if reference to instance is available then it will be valid.
Compatibility with simple tests
Allow player instances to be used before joining just like before, do not change that.
Handling invalidated
Fail with clear error message if player instance is used after player is disconnected by calling mineunit:execute_on_leaveplayer(player).
This allows properly validating cases where player instance might be used after player disconnected from game.
Also handle replaced instances
Also make replaced player invalid. Currently when new Player instance is created it will just replace old one but wont invalidate previous instance. At this point control over previous instance is lost (but another ref might very well be available within mod, spec or fixture code).
Invalidate this old instance immediately, similar way how leaving game is handled.
Implementation
Should be enough to set some flag (so that instance can be restored when player joins, metadata stays) and error when trying to access index. This also allows access using rawget and rawset if needed for some weird unknown reason.
Metadata
Metadata
Assignees
Labels
Projects
Status