Exemplo n.º 1
0
 /// <summary>
 /// Provides an alternative to `Player.GetModPlayer(...)` to ensure the given player is properly loaded. Addresses some
 /// confusing types of errors.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="player"></param>
 /// <returns></returns>
 public static T SafelyGetModPlayer <T>(Player player) where T : ModPlayer
 {
     TmlHelpers.ForceSetupPlayer(player);
     return(player.GetModPlayer <T>());
 }
Exemplo n.º 2
0
        ////

        /// <summary>
        /// Provides an alternative to `Player.GetModPlayer(...)` to ensure the given player is properly loaded. Addresses some
        /// confusing types of errors.
        /// </summary>
        /// <param name="player"></param>
        /// <param name="mod"></param>
        /// <param name="modPlayerName"></param>
        /// <returns></returns>
        public static ModPlayer SafelyGetModPlayer(Player player, Mod mod, string modPlayerName)                // Solely for Main.LocalPlayer?
        {
            TmlHelpers.ForceSetupPlayer(player);
            return(player.GetModPlayer(mod, modPlayerName));
        }