1
0

PlayerDataExt.cs 889 B

123456789101112131415161718192021222324252627282930
  1. using Robust.Shared.Player;
  2. namespace Content.Shared.Players;
  3. public static class PlayerDataExt
  4. {
  5. /// <summary>
  6. /// Gets the correctly cast instance of content player data from an engine player data storage.
  7. /// </summary>
  8. public static ContentPlayerData? ContentData(this SessionData data)
  9. {
  10. return (ContentPlayerData?) data.ContentDataUncast;
  11. }
  12. /// <summary>
  13. /// Gets the correctly cast instance of content player data from an engine player data storage.
  14. /// </summary>
  15. public static ContentPlayerData? ContentData(this ICommonSession session)
  16. {
  17. return session.Data.ContentData();
  18. }
  19. /// <summary>
  20. /// Gets the mind that is associated with this player.
  21. /// </summary>
  22. public static EntityUid? GetMind(this ICommonSession session)
  23. {
  24. return session.Data.ContentData()?.Mind;
  25. }
  26. }