Pvp with no team (#2851)

* Update TShockConfig.cs

* Update TShock.cs

* Update GetDataHandlers.cs

* Update changelog.md

* Update GetDataHandlers.cs

* Update changelog.md

* Update changelog.md

* Update changelog.md
This commit is contained in:
ATFGK 2022-12-06 14:27:42 +08:00 committed by GitHub
parent 95d157fd5d
commit e46bbe99c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 5 deletions

View file

@ -113,8 +113,8 @@ namespace TShockAPI.Configuration
[Description("Enables never ending invasion events. You still need to start the event, such as with the /invade command.")]
public bool InfiniteInvasion;
/// <summary>Sets the PvP mode. Valid types are: "normal", "always", "disabled".</summary>
[Description("Sets the PvP mode. Valid types are: \"normal\", \"always\" and \"disabled\".")]
/// <summary>Sets the PvP mode. Valid types are: "normal", "always", "pvpwithnoteam", "disabled".</summary>
[Description("Sets the PvP mode. Valid types are: \"normal\", \"always\", \"pvpwithnoteam\" and \"disabled\".")]
public string PvPMode = "normal";
/// <summary>Prevents tiles from being placed within SpawnProtectionRadius of the default spawn.</summary>

View file

@ -3092,7 +3092,7 @@ namespace TShockAPI
}
string pvpMode = TShock.Config.Settings.PvPMode.ToLowerInvariant();
if (pvpMode == "disabled" || pvpMode == "always" || (DateTime.UtcNow - args.Player.LastPvPTeamChange).TotalSeconds < 5)
if (pvpMode == "disabled" || pvpMode == "always" || pvpMode == "pvpwithnoteam" || (DateTime.UtcNow - args.Player.LastPvPTeamChange).TotalSeconds < 5)
{
TShock.Log.ConsoleDebug(GetString("GetDataHandlers / HandleTogglePvp rejected fastswitch {0}", args.Player.Name));
args.Player.SendData(PacketTypes.TogglePvp, "", id);
@ -3349,7 +3349,8 @@ namespace TShockAPI
if (id != args.Player.Index)
return true;
if ((DateTime.UtcNow - args.Player.LastPvPTeamChange).TotalSeconds < 5)
string pvpMode = TShock.Config.Settings.PvPMode.ToLowerInvariant();
if (pvpMode == "pvpwithnoteam" || (DateTime.UtcNow - args.Player.LastPvPTeamChange).TotalSeconds < 5)
{
args.Player.SendData(PacketTypes.PlayerTeam, "", id);
TShock.Log.ConsoleDebug(GetString("GetDataHandlers / HandlePlayerTeam rejected team fastswitch {0}", args.Player.Name));

View file

@ -1676,7 +1676,7 @@ namespace TShockAPI
player.SendFileTextAsMessage(FileTools.MotdPath);
string pvpMode = Config.Settings.PvPMode.ToLowerInvariant();
if (pvpMode == "always")
if (pvpMode == "always" || pvpMode == "pvpwithnoteam")
{
player.TPlayer.hostile = true;
player.SendData(PacketTypes.TogglePvp, "", player.Index);

View file

@ -78,6 +78,7 @@ Use past tense when adding new entries; sign your name off when you add or chang
* If there is no section called "Upcoming changes" below this line, please add one with `## Upcoming changes` as the first line, and then a bulleted item directly after with the first change. -->
## Upcoming changes
* An additional option `pvpwithnoteam` is added at `PvPMode` to enable PVP with no team.(@CelestialAnarchy, #2617, @ATFGK)
* Corrected and updated deserialization of the following packets (@ATFGK):
* `ProjectileNew`: Read the third `AI` value.
* Before this change, it was previously possible for the projectile damage limit to falsely trigger, such as when using the Terra Balde and Fire Gauntlet together.
@ -102,6 +103,7 @@ Use past tense when adding new entries; sign your name off when you add or chang
* Allowed the Hellfire (`OnFire3`) buff. (@drunderscore)
## TShock 5.1.3
* Added support for Terraria 1.4.4.9 via OTAPI 3.1.20. (@SignatureBeef)