コード例 #1
0
 /// <summary>
 /// Invoked when the health of the player is modified.
 /// If their health is not full while their buildmode is on, they get healed to full health.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private static void OnPlayerHP(object sender, PlayerHPEventArgs e)
 {
     if ((e.Current < e.Max) && e.Player.IsBuildModeOn())
     {
         e.Player.Heal(e.Player.TPlayer.statLifeMax2);
     }
 }
コード例 #2
0
ファイル: GetDataHandlers.cs プロジェクト: CXUtk/TShock
        private static bool OnPlayerHP(byte _plr, short _cur, short _max)
        {
            if (PlayerHP == null)
                return false;

            var args = new PlayerHPEventArgs
            {
                PlayerId = _plr,
                Current = _cur,
                Max = _max,
            };
            PlayerHP.Invoke(null, args);
            return args.Handled;
        }