Add Votekick functionality (#32005)

This commit is contained in:
SlamBamActionman
2024-09-26 18:32:13 +02:00
committed by GitHub
parent 4491550a5e
commit eeadc75b0a
20 changed files with 1009 additions and 164 deletions

View File

@@ -1,4 +1,4 @@
using Lidgren.Network;
using Lidgren.Network;
using Robust.Shared.Network;
using Robust.Shared.Serialization;
@@ -17,6 +17,8 @@ namespace Content.Shared.Voting
public (ushort votes, string name)[] Options = default!;
public bool IsYourVoteDirty;
public byte? YourVote;
public bool DisplayVotes;
public int TargetEntity;
public override void ReadFromBuffer(NetIncomingMessage buffer, IRobustSerializer serializer)
{
@@ -31,6 +33,8 @@ namespace Content.Shared.Voting
VoteInitiator = buffer.ReadString();
StartTime = TimeSpan.FromTicks(buffer.ReadInt64());
EndTime = TimeSpan.FromTicks(buffer.ReadInt64());
DisplayVotes = buffer.ReadBoolean();
TargetEntity = buffer.ReadVariableInt32();
Options = new (ushort votes, string name)[buffer.ReadByte()];
for (var i = 0; i < Options.Length; i++)
@@ -58,6 +62,8 @@ namespace Content.Shared.Voting
buffer.Write(VoteInitiator);
buffer.Write(StartTime.Ticks);
buffer.Write(EndTime.Ticks);
buffer.Write(DisplayVotes);
buffer.WriteVariableInt32(TargetEntity);
buffer.Write((byte) Options.Length);
foreach (var (votes, name) in Options)