Skip to content
Permalink
Browse files

Don't continously reset Status3 message, after having done a draw op …

…once.
  • Loading branch information...
UnknownShadow200 committed Oct 29, 2017
1 parent 901676a commit 35b61f094a1792ec4b310894a85b57add550cdff
Showing with 29 additions and 17 deletions.
  1. +6 −1 fCraft/Player/Player.cs
  2. +23 −16 fCraft/System/Server.cs
@@ -1546,7 +1546,8 @@ public void Message([NotNull] byte messageType, [NotNull] string message, [NotNu

[NotNull]
internal UndoState RedoBegin( DrawOperation op ) {
LastDrawOp = op;
LastDrawOp = op;
AnnouncedLastDrawOpFinished = false;
UndoState newState = new UndoState( op );
undoStack.AddLast( newState );
return newState;
@@ -1556,6 +1557,7 @@ public void Message([NotNull] byte messageType, [NotNull] string message, [NotNu
[NotNull]
internal UndoState UndoBegin( DrawOperation op ) {
LastDrawOp = op;
AnnouncedLastDrawOpFinished = false;
UndoState newState = new UndoState( op );
redoStack.AddLast( newState );
return newState;
@@ -1575,6 +1577,7 @@ public void Message([NotNull] byte messageType, [NotNull] string message, [NotNu

public UndoState DrawBegin( DrawOperation op ) {
LastDrawOp = op;
AnnouncedLastDrawOpFinished = false;
UndoState newState = new UndoState( op );
undoStack.AddLast( newState );
if( undoStack.Count > ConfigKey.MaxUndoStates.GetInt() ) {
@@ -1655,6 +1658,8 @@ public void Message([NotNull] byte messageType, [NotNull] string message, [NotNu
/// <summary> Last DrawOperation executed by this player this session. May be null (if nothing has been executed yet). </summary>
[CanBeNull]
public DrawOperation LastDrawOp { get; set; }

internal bool AnnouncedLastDrawOpFinished;

/// <summary> Whether clicks should be registered towards selection marks. </summary>
public bool DisableClickToMark { get; set; }
@@ -755,27 +755,12 @@ public static partial class Server {


private static void CheckIdles(SchedulerTask task) {

Player[] tempPlayerList = Players;
for (int i = 0; i < tempPlayerList.Length; i++) {
Player player = tempPlayerList[i];

if (player.Supports(CpeExt.MessageType)) {
//double speed = (Math.Sqrt(player.Position.DistanceSquaredTo(player.lastSolidPos)) / 32);
//player.Send(Packet.Message((byte)MessageType.Announcement, string.Format("&eSpeed: &f{0:N2} &eBlocks/s", speed), player.UseFallbackColors));
string bottomRight2 = player.Position.ToBlockCoordsRaw() + "&S[" + compassString(player.Position.R) + "&S]";
if (bottomRight2 != player.lastBottomRight2) {
player.lastBottomRight2 = bottomRight2;
player.Send(Packet.Message((byte)MessageType.BottomRight2, bottomRight2, player));
}

if (player.LastDrawOp != null && !player.IsPlayingCTF)
if (player.LastDrawOp.PercentDone < 100) {
player.Send(Packet.Message((byte)MessageType.Status3, player.LastDrawOp.Description +
" percent done: &f" + player.LastDrawOp.PercentDone + "&S%", player));
} else if (player.LastDrawOp.PercentDone == 100 || player.LastDrawOp.IsDone) {
player.Send(Packet.Message((byte)MessageType.Status3, "", player));
}
UpdateStatusMessages(player);
}
CTF.PrintCtfState(player);
player.lastSolidPos = player.Position;
@@ -809,6 +794,28 @@ public static partial class Server {
UpdateTabList(false);
}

static void UpdateStatusMessages(Player player) {
//double speed = (Math.Sqrt(player.Position.DistanceSquaredTo(player.lastSolidPos)) / 32);
//player.Send(Packet.Message((byte)MessageType.Announcement, string.Format("&eSpeed: &f{0:N2} &eBlocks/s", speed), player.UseFallbackColors));
string bottomRight2 = player.Position.ToBlockCoordsRaw() + "&S[" + compassString(player.Position.R) + "&S]";
if (bottomRight2 != player.lastBottomRight2) {
player.lastBottomRight2 = bottomRight2;
player.Send(Packet.Message((byte)MessageType.BottomRight2, bottomRight2, player));
}

if (player.LastDrawOp != null && !player.IsPlayingCTF) {
if (player.LastDrawOp.PercentDone < 100) {
player.Send(Packet.Message((byte)MessageType.Status3, player.LastDrawOp.Description +
" percent done: &f" + player.LastDrawOp.PercentDone + "&S%", player));
} else if (player.LastDrawOp.PercentDone == 100 || player.LastDrawOp.IsDone) {
if (!player.AnnouncedLastDrawOpFinished) {
player.Send(Packet.Message((byte)MessageType.Status3, "", player));
player.AnnouncedLastDrawOpFinished = true;
}
}
}
}

public static string compassString(int rot) {
if (rot > 240 || rot < 15) {
return "&1S";

0 comments on commit 35b61f0

Please sign in to comment.
You can’t perform that action at this time.