Add delaystart and forcepreset commands (#1163)

* Add extendroundstart message to extend lobby start timer

* Rename StartExtend to DelayStart

* Fix delaystart amounts above 59 not working

* Change delaystart seconds type from int to uint

* Change delaystart wrong args amount message

* Add forcegamepreset command

* Rename forcegamepreset to forcepreset and merged start and forcestart preset methods

* Fix index out of bounds exception when forcing suspicion to start

* Change game preset to match regardless of casing

* Add forcepreset unknown preset message

* Add and move in lobby checks

* Remove testing changes

* Change delaystart to pause/resume the timer when no seconds are specified

* Change pause message

* Remove testing code

* Change 0 seconds to not be a valid amount of seconds

* Replace MsgTickerLobbyCountdown Seconds with DateTime instead of uint

* Add one entire dot

* Replace Math.Min + Math.Max with Math.Clamp

Co-authored-by: ComicIronic <comicironic@gmail.com>

Co-authored-by: ComicIronic <comicironic@gmail.com>
This commit is contained in:
DrSmugleaf
2020-06-21 22:05:47 +02:00
committed by GitHub
parent 7b98f37f9a
commit d91a8c4925
13 changed files with 274 additions and 37 deletions

View File

@@ -116,6 +116,40 @@ namespace Content.Shared
buffer.Write(TextBlob);
}
}
protected class MsgTickerLobbyCountdown : NetMessage
{
#region REQUIRED
public const MsgGroups GROUP = MsgGroups.Command;
public const string NAME = nameof(MsgTickerLobbyCountdown);
public MsgTickerLobbyCountdown(INetChannel channel) : base(NAME, GROUP) { }
#endregion
/// <summary>
/// The total amount of seconds to go until the countdown finishes
/// </summary>
public DateTime StartTime { get; set; }
/// <summary>
/// Whether or not the countdown is paused
/// </summary>
public bool Paused { get; set; }
public override void ReadFromBuffer(NetIncomingMessage buffer)
{
StartTime = new DateTime(buffer.ReadInt64(), DateTimeKind.Utc);
Paused = buffer.ReadBoolean();
}
public override void WriteToBuffer(NetOutgoingMessage buffer)
{
buffer.Write(StartTime.Ticks);
buffer.Write(Paused);
}
}
public struct RoundEndPlayerInfo
{
public string PlayerOOCName;