Merge branch 'general-devel' into sqliteconf
This commit is contained in:
commit
773092b7bf
7 changed files with 54 additions and 40 deletions
|
|
@ -3,6 +3,7 @@
|
|||
This is the rolling changelog for TShock for Terraria. Use past tense when adding new entries; sign your name off when you add or change something. This should primarily be things like user changes, not necessarily codebase changes unless it's really relevant or large.
|
||||
|
||||
## Upcoming changes
|
||||
* Update player spawn related things to 1.4. `Terraria.Player.Spawn` method now has a required argument, `PlayerSpawnContext context`. (@AxeelAnder)
|
||||
* Make sqlite db path configurable. (@AxeelAnder)
|
||||
|
||||
## TShock 4.4.0 (Pre-release 4)
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ namespace TShockAPI
|
|||
var lastTileY = args.Player.LastNetPosition.Y - 48;
|
||||
if (!args.Player.Teleport(lastTileX, lastTileY))
|
||||
{
|
||||
args.Player.Spawn();
|
||||
args.Player.Spawn(PlayerSpawnContext.RecallFromItem);
|
||||
}
|
||||
TShock.Log.ConsoleDebug("Bouncer / OnPlayerUpdate rejected from (??) {0}", args.Player.Name);
|
||||
args.Handled = true;
|
||||
|
|
@ -491,7 +491,7 @@ namespace TShockAPI
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Bouncer's SendTileSquare hook halts large scope world destruction.</summary>
|
||||
/// <param name="sender">The object that triggered the event.</param>
|
||||
/// <param name="args">The packet arguments that the event has.</param>
|
||||
|
|
@ -684,7 +684,7 @@ namespace TShockAPI
|
|||
|
||||
args.Handled = true;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Registered when items fall to the ground to prevent cheating.</summary>
|
||||
/// <param name="sender">The object that triggered the event.</param>
|
||||
/// <param name="args">The packet arguments that the event has.</param>
|
||||
|
|
@ -969,7 +969,7 @@ namespace TShockAPI
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Handles ProjectileKill events for throttling and out of bounds projectiles.</summary>
|
||||
/// <param name="sender">The object that triggered the event.</param>
|
||||
/// <param name="args">The packet arguments that the event has.</param>
|
||||
|
|
@ -995,7 +995,7 @@ namespace TShockAPI
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Handles when a chest item is changed.</summary>
|
||||
/// <param name="sender">The object that triggered the event.</param>
|
||||
/// <param name="args">The packet arguments that the event has.</param>
|
||||
|
|
@ -1032,7 +1032,7 @@ namespace TShockAPI
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>The Bouncer handler for when chests are opened.</summary>
|
||||
/// <param name="sender">The object that triggered the event.</param>
|
||||
/// <param name="args">The packet arguments that the event has.</param>
|
||||
|
|
@ -1059,7 +1059,7 @@ namespace TShockAPI
|
|||
int id = Chest.FindChest(args.X, args.Y);
|
||||
args.Player.ActiveChest = id;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>The place chest event that Bouncer hooks to prevent accidental damage.</summary>
|
||||
/// <param name="sender">The object that triggered the event.</param>
|
||||
/// <param name="args">The packet arguments that the event has.</param>
|
||||
|
|
@ -1119,7 +1119,7 @@ namespace TShockAPI
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Handles PlayerZone events for preventing spawning NPC maliciously.</summary>
|
||||
/// <param name="sender">The object that triggered the event.</param>
|
||||
/// <param name="args">The packet arguments that the event has.</param>
|
||||
|
|
@ -1155,7 +1155,7 @@ namespace TShockAPI
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Handles basic animation throttling for disabled players.</summary>
|
||||
/// <param name="sender">sender</param>
|
||||
/// <param name="args">args</param>
|
||||
|
|
@ -1175,7 +1175,7 @@ namespace TShockAPI
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Handles Bouncer's liquid set anti-cheat.</summary>
|
||||
/// <param name="sender">The object that triggered the event.</param>
|
||||
/// <param name="args">The packet arguments that the event has.</param>
|
||||
|
|
@ -1315,7 +1315,7 @@ namespace TShockAPI
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Handles Buff events.</summary>
|
||||
/// <param name="sender">The object that triggered the event.</param>
|
||||
/// <param name="args">The packet arguments that the event has.</param>
|
||||
|
|
@ -1372,7 +1372,7 @@ namespace TShockAPI
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Handles NPCAddBuff events.</summary>
|
||||
/// <param name="sender">The object that triggered the event.</param>
|
||||
/// <param name="args">The packet arguments that the event has.</param>
|
||||
|
|
@ -1432,7 +1432,7 @@ namespace TShockAPI
|
|||
args.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>The Bouncer handler for when an NPC is rehomed.</summary>
|
||||
/// <param name="sender">The object that triggered the event.</param>
|
||||
/// <param name="args">The packet arguments that the event has.</param>
|
||||
|
|
@ -1459,7 +1459,7 @@ namespace TShockAPI
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Bouncer's HealOther handler prevents gross misuse of HealOther packets by hackers.</summary>
|
||||
/// <param name="sender">The object that triggered the event.</param>
|
||||
/// <param name="args">The packet arguments that the event has.</param>
|
||||
|
|
@ -1501,7 +1501,7 @@ namespace TShockAPI
|
|||
args.Handled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Bouncer's PlaceObject hook reverts malicious tile placement.</summary>
|
||||
/// <param name="sender">The object that triggered the event.</param>
|
||||
/// <param name="args">The packet arguments that the event has.</param>
|
||||
|
|
@ -1571,8 +1571,8 @@ namespace TShockAPI
|
|||
return;
|
||||
}
|
||||
|
||||
// This is neccessary to check in order to prevent special tiles such as
|
||||
// queen bee larva, paintings etc that use this packet from being placed
|
||||
// This is neccessary to check in order to prevent special tiles such as
|
||||
// queen bee larva, paintings etc that use this packet from being placed
|
||||
// without selecting the right item.
|
||||
if (type != args.Player.TPlayer.inventory[args.Player.TPlayer.selectedItem].createTile)
|
||||
{
|
||||
|
|
@ -1634,7 +1634,7 @@ namespace TShockAPI
|
|||
args.Player.TilesCreated.Add(coords, Main.tile[x, y]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Fired when a PlaceTileEntity occurs for basic anti-cheat on perms and range.</summary>
|
||||
/// <param name="sender">The object that triggered the event.</param>
|
||||
/// <param name="args">The packet arguments that the event has.</param>
|
||||
|
|
@ -1658,7 +1658,7 @@ namespace TShockAPI
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Fired when an item frame is placed for anti-cheat detection.</summary>
|
||||
/// <param name="sender">The object that triggered the event.</param>
|
||||
/// <param name="args">The packet arguments that the event has.</param>
|
||||
|
|
@ -1685,7 +1685,7 @@ namespace TShockAPI
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
internal void OnPlayerPortalTeleport(object sender, GetDataHandlers.TeleportThroughPortalEventArgs args)
|
||||
{
|
||||
//Packet 96 (player teleport through portal) has no validation on whether or not the player id provided
|
||||
|
|
@ -1713,7 +1713,7 @@ namespace TShockAPI
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Handles the anti-cheat components of gem lock toggles.</summary>
|
||||
/// <param name="sender">The object that triggered the event.</param>
|
||||
/// <param name="args">The packet arguments that the event has.</param>
|
||||
|
|
@ -1743,7 +1743,7 @@ namespace TShockAPI
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Handles validation of of basic anti-cheat on mass wire operations.</summary>
|
||||
/// <param name="sender">The object that triggered the event.</param>
|
||||
/// <param name="args">The packet arguments that the event has.</param>
|
||||
|
|
|
|||
|
|
@ -2565,7 +2565,7 @@ namespace TShockAPI
|
|||
|
||||
private static void Home(CommandArgs args)
|
||||
{
|
||||
args.Player.Spawn();
|
||||
args.Player.Spawn(PlayerSpawnContext.RecallFromItem);
|
||||
args.Player.SendSuccessMessage("Teleported to your spawnpoint.");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2092,7 +2092,7 @@ namespace TShockAPI
|
|||
|
||||
if (respawnTimer > 0)
|
||||
args.Player.Dead = true;
|
||||
else
|
||||
else
|
||||
args.Player.Dead = false;
|
||||
return false;
|
||||
}
|
||||
|
|
@ -2662,7 +2662,7 @@ namespace TShockAPI
|
|||
if (type == 1 && TShock.Config.DisableDungeonGuardian)
|
||||
{
|
||||
args.Player.SendMessage("The Dungeon Guardian returned you to your spawn point", Color.Purple);
|
||||
args.Player.Spawn();
|
||||
args.Player.Spawn(PlayerSpawnContext.RecallFromItem);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
TShock, a server mod for Terraria
|
||||
Copyright (C) 2011-2019 Pryaxis & TShock Contributors
|
||||
|
||||
|
|
@ -18,6 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
|
||||
using System.IO;
|
||||
using System.IO.Streams;
|
||||
using Terraria;
|
||||
|
||||
namespace TShockAPI.Net
|
||||
{
|
||||
|
|
@ -28,15 +29,19 @@ namespace TShockAPI.Net
|
|||
get { return PacketTypes.PlayerSpawn; }
|
||||
}
|
||||
|
||||
public byte PlayerIndex { get; set; }
|
||||
public short TileX { get; set; }
|
||||
public short TileY { get; set; }
|
||||
public byte PlayerIndex { get; set; }
|
||||
public int RespawnTimer { get; set; }
|
||||
public PlayerSpawnContext PlayerSpawnContext { get; set; }
|
||||
|
||||
public override void Pack(Stream stream)
|
||||
{
|
||||
stream.WriteInt8(PlayerIndex);
|
||||
stream.WriteInt32(TileX);
|
||||
stream.WriteInt32(TileY);
|
||||
stream.WriteInt16(TileX);
|
||||
stream.WriteInt16(TileY);
|
||||
stream.WriteInt32(RespawnTimer);
|
||||
stream.WriteByte((byte) PlayerSpawnContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -297,7 +297,11 @@ namespace TShockAPI
|
|||
/// <summary>
|
||||
/// The player's respawn timer.
|
||||
/// </summary>
|
||||
public int RespawnTimer;
|
||||
public int RespawnTimer
|
||||
{
|
||||
get => TPlayer.respawnTimer;
|
||||
set => TPlayer.respawnTimer = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether the player is dead or not.
|
||||
|
|
@ -569,7 +573,7 @@ namespace TShockAPI
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return check;
|
||||
|
|
@ -1164,15 +1168,15 @@ namespace TShockAPI
|
|||
/// <summary>
|
||||
/// Spawns the player at his spawn point.
|
||||
/// </summary>
|
||||
public void Spawn()
|
||||
public void Spawn(PlayerSpawnContext context, int? respawnTimer = null)
|
||||
{
|
||||
if (this.sX > 0 && this.sY > 0)
|
||||
{
|
||||
Spawn(this.sX, this.sY);
|
||||
Spawn(this.sX, this.sY, context, respawnTimer);
|
||||
}
|
||||
else
|
||||
{
|
||||
Spawn(TPlayer.SpawnX, TPlayer.SpawnY);
|
||||
Spawn(TPlayer.SpawnX, TPlayer.SpawnY, context, respawnTimer);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1181,7 +1185,9 @@ namespace TShockAPI
|
|||
/// </summary>
|
||||
/// <param name="tilex">The X coordinate.</param>
|
||||
/// <param name="tiley">The Y coordinate.</param>
|
||||
public void Spawn(int tilex, int tiley)
|
||||
/// <param name="context">The PlayerSpawnContext.</param>
|
||||
/// <param name="respawnTimer">The respawn timer, will be Player.respawnTimer if parameter is null.</param>
|
||||
public void Spawn(int tilex, int tiley, PlayerSpawnContext context, int? respawnTimer = null)
|
||||
{
|
||||
using (var ms = new MemoryStream())
|
||||
{
|
||||
|
|
@ -1189,7 +1195,9 @@ namespace TShockAPI
|
|||
{
|
||||
PlayerIndex = (byte)Index,
|
||||
TileX = (short)tilex,
|
||||
TileY = (short)tiley
|
||||
TileY = (short)tiley,
|
||||
RespawnTimer = respawnTimer ?? TShock.Players[Index].TPlayer.respawnTimer,
|
||||
PlayerSpawnContext = context,
|
||||
};
|
||||
msg.PackFull(ms);
|
||||
SendRawData(ms.ToArray());
|
||||
|
|
@ -1215,7 +1223,7 @@ namespace TShockAPI
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>Sends a tile square at a location with a given size.
|
||||
/// <summary>Sends a tile square at a location with a given size.
|
||||
/// Typically used to revert changes by Bouncer through sending the
|
||||
/// "old" version of modified data back to a client.
|
||||
/// Prevents desync issues.
|
||||
|
|
@ -1624,7 +1632,7 @@ namespace TShockAPI
|
|||
public void SendMultipleMatchError(IEnumerable<object> matches)
|
||||
{
|
||||
SendErrorMessage("More than one match found: ");
|
||||
|
||||
|
||||
var lines = PaginationTools.BuildLinesFromTerms(matches.ToArray());
|
||||
lines.ForEach(SendInfoMessage);
|
||||
|
||||
|
|
|
|||
|
|
@ -1048,7 +1048,7 @@ namespace TShockAPI
|
|||
|
||||
if (player.RespawnTimer > 0 && --player.RespawnTimer == 0 && player.Difficulty != 2)
|
||||
{
|
||||
player.Spawn();
|
||||
player.Spawn(PlayerSpawnContext.ReviveFromDeath);
|
||||
}
|
||||
|
||||
if (!Main.ServerSideCharacter || (Main.ServerSideCharacter && player.IsLoggedIn))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue