Add /sync command to alleviate door related sadness

Run /sync if your doors disappear. This will resync your local client
with the server state. For more information, please see the associated
changelog entry.
This commit is contained in:
Lucas Nicodemus 2020-05-29 21:04:48 -07:00
parent 44ad2d2eff
commit f82ab41a25
No known key found for this signature in database
GPG key ID: A07BD9023D1664DB
5 changed files with 26 additions and 3 deletions

View file

@ -558,6 +558,8 @@ namespace TShockAPI
return;
}
bool changed = false;
bool failed = false;
try
{
var tiles = new NetTile[size, size];
@ -569,7 +571,6 @@ namespace TShockAPI
}
}
bool changed = false;
for (int x = 0; x < size; x++)
{
int realx = tileX + x;
@ -709,9 +710,10 @@ namespace TShockAPI
catch
{
args.Player.SendTileSquare(tileX, tileY, size);
failed = true;
}
TShock.Log.ConsoleDebug("Bouncer / SendTileSquare reimplemented from spaghetti from {0}", args.Player.Name);
TShock.Log.ConsoleDebug("Bouncer / SendTileSquare from {0} {1} {2}", args.Player.Name, changed, failed);
args.Handled = true;
}

View file

@ -589,6 +589,10 @@ namespace TShockAPI
{
HelpText = "Creates a reference tables for Terraria data types and the TShock permission system in the server folder."
});
add(new Command(Permissions.synclocalarea, SyncLocalArea, "sync")
{
HelpText = "Sends all tiles from the server to the player to resync the client with the actual world state."
});
#endregion
add(new Command(Aliases, "aliases")
@ -5302,6 +5306,13 @@ namespace TShockAPI
return;
}
private static void SyncLocalArea(CommandArgs args)
{
args.Player.SendTileSquare((int) args.Player.TileX, (int) args.Player.TileY, 32);
args.Player.SendWarningMessage("Sync'd!");
return;
}
#endregion General Commands
#region Cheat Commands

View file

@ -64,7 +64,8 @@ namespace TShockAPI.DB
Permissions.canlogin,
Permissions.canpartychat,
Permissions.cantalkinthird,
Permissions.canchat));
Permissions.canchat,
Permissions.synclocalarea));
AddDefaultGroup("default", "guest",
string.Join(",",

View file

@ -465,6 +465,9 @@ namespace TShockAPI
[Description("Player can see advanced information about any user account.")]
public static readonly string advaccountinfo = "tshock.accountinfo.details";
[Description("Player can resync themselves with server state.")]
public static readonly string synclocalarea = "tshock.synclocalarea";
#endregion
/// <summary>
/// Lists all commands associated with a given permission