This commit is contained in:
Cai 2026-01-28 14:13:30 +08:00
parent b74725a707
commit 9eb49b0447
No known key found for this signature in database
GPG key ID: 7D738D40768F4D11
18 changed files with 242 additions and 165 deletions

View file

@ -2435,6 +2435,8 @@ namespace TShockAPI
byte playerid = args.Data.ReadInt8();
// 0-3 male; 4-7 female
int skinVariant = args.Data.ReadByte();
int voiceVariant = args.Data.ReadByte();
float voicePitchOffset = args.Data.ReadSingle();
var hair = args.Data.ReadInt8();
string name = args.Data.ReadString();
byte hairDye = args.Data.ReadInt8();
@ -2509,6 +2511,8 @@ namespace TShockAPI
args.Player.TPlayer.hairColor = hairColor;
args.Player.TPlayer.hairDye = hairDye;
args.Player.TPlayer.skinVariant = skinVariant;
args.Player.TPlayer.voiceVariant = voiceVariant;
args.Player.TPlayer.voicePitchOffset = voicePitchOffset;
args.Player.TPlayer.skinColor = skinColor;
args.Player.TPlayer.eyeColor = eyeColor;
args.Player.TPlayer.pantsColor = pantsColor;
@ -2743,14 +2747,14 @@ namespace TShockAPI
if (Main.ServerSideCharacter)
{
// As long as the player has not changed his spawnpoint since initial connection,
// we should not use the client's spawnpoint value. This is because the spawnpoint
// value is not saved on the client when SSC is enabled. Hence, we have to assert
// the server-saved spawnpoint value until we can detect that the player has changed
// we should not use the client's spawnpoint value. This is because the spawnpoint
// value is not saved on the client when SSC is enabled. Hence, we have to assert
// the server-saved spawnpoint value until we can detect that the player has changed
// his spawn. Once we detect the spawnpoint changed, the client's spawnpoint value
// becomes the correct one to use.
//
// Note that spawnpoint changes (right-clicking beds) are not broadcasted to the
// server. Hence, the only way to detect spawnpoint changes is from the
// Note that spawnpoint changes (right-clicking beds) are not broadcasted to the
// server. Hence, the only way to detect spawnpoint changes is from the
// PlayerSpawn packet.
// handle initial connection
@ -2766,13 +2770,13 @@ namespace TShockAPI
args.Player.initialClientSpawnX = spawnX;
args.Player.initialClientSpawnY = spawnY;
// we first let the game handle completing the connection (state 3 => 10),
// then we will spawn the player at the saved spawnpoint in the next second,
// we first let the game handle completing the connection (state 3 => 10),
// then we will spawn the player at the saved spawnpoint in the next second,
// by reasserting the correct spawnpoint value
return false;
}
// once we detect the client has changed his spawnpoint in the current session,
// once we detect the client has changed his spawnpoint in the current session,
// the client spawnpoint value will be correct for the rest of the session
if (args.Player.spawnSynced || args.Player.initialClientSpawnX != spawnX || args.Player.initialClientSpawnY != spawnY)
{
@ -2784,11 +2788,11 @@ namespace TShockAPI
// spawn the player before teleporting
NetMessage.SendData((int)PacketTypes.PlayerSpawn, -1, args.Player.Index, null, args.Player.Index, (int)PlayerSpawnContext.ReviveFromDeath);
// the player has not changed his spawnpoint yet, so we assert the server-saved spawnpoint
// the player has not changed his spawnpoint yet, so we assert the server-saved spawnpoint
// by teleporting the player instead of letting the game use the client's incorrect spawnpoint.
TShock.Log.ConsoleDebug(GetString("GetDataHandlers / HandleSpawn force ssc teleport for {0} at ({1},{2})", args.Player.Name, args.TPlayer.SpawnX, args.TPlayer.SpawnY));
args.Player.TeleportSpawnpoint();
args.TPlayer.respawnTimer = respawnTimer;
args.TPlayer.numberOfDeathsPVE = numberOfDeathsPVE;
args.TPlayer.numberOfDeathsPVP = numberOfDeathsPVP;
@ -3886,7 +3890,7 @@ namespace TShockAPI
if (type == 0 && !args.Player.HasPermission(Permissions.rod))
{
TShock.Log.ConsoleDebug(GetString("GetDataHandlers / HandleTeleport rejected rod type {0} {1}", args.Player.Name, type));
args.Player.SendErrorMessage(GetString("You do not have permission to teleport using items.")); // Was going to write using RoD but Hook of Disonnance and Potion of Return both use the same teleport packet as RoD.
args.Player.SendErrorMessage(GetString("You do not have permission to teleport using items.")); // Was going to write using RoD but Hook of Disonnance and Potion of Return both use the same teleport packet as RoD.
args.Player.Teleport(args.TPlayer.position.X, args.TPlayer.position.Y); // Suggest renaming rod permission unless someone plans to add separate perms for the other 2 tp items.
return true;
}
@ -4418,7 +4422,7 @@ namespace TShockAPI
TEDisplayDoll displayDoll = tileEntity as TEDisplayDoll;
if (displayDoll != null)
{
oldItem = displayDoll._items[slot];
//oldItem = displayDoll._items[slot];
if (isDye)
oldItem = displayDoll._dyes[slot];