Merge pull request #2447 from AgaSpace/patch-1

Add the ability to change the player's pvp mode
This commit is contained in:
Zoom L1 2021-11-24 13:52:47 +07:00 committed by GitHub
parent 01aa4b5732
commit f98df0e4a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1563,6 +1563,18 @@ namespace TShockAPI
NetMessage.SendData((int)PacketTypes.PlayerTeam, -1, -1, NetworkText.Empty, Index);
}
/// <summary>
/// Sets the player's pvp.
/// </summary>
/// <param name="mode">The state of the pvp mode.</param>
public virtual void SetPvP(bool mode, bool withMsg = false)
{
Main.player[Index].hostile = mode;
NetMessage.SendData((int)PacketTypes.TogglePvp, -1, -1, NetworkText.Empty, Index);
if (withMsg)
TSPlayer.All.SendMessage(Language.GetTextValue(mode ? "LegacyMultiplayer.11" : "LegacyMultiplayer.12", Name), Main.teamColor[Team]);
}
private DateTime LastDisableNotification = DateTime.UtcNow;
/// <summary>